Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-68320, gh-88302 - Allow for pathlib.Path subclassing #31691

Merged
merged 53 commits into from
Dec 23, 2022

Commits on Mar 5, 2022

  1. bpo-24132, bpo-44136 - Fix pathlib.Path subclassing.

    Users may wish to define subclasses of `pathlib.Path` to add or modify
    existing methods. Before this change, attempting to instantiate a subclass
    raised an exception like:
    
        AttributeError: type object 'PPath' has no attribute '_flavour'
    
    Previously the `_flavour` attribute was assigned as follows:
    
        PurePath._flavour        = xxx not set!! xxx
        PurePosixPath._flavour   = _PosixFlavour()
        PureWindowsPath._flavour = _WindowsFlavour()
    
    This commit replaces it with a `_pathmod` attribute, set as follows:
    
        PurePath._pathmod        = os.path
        PurePosixPath._pathmod   = posixpath
        PureWindowsPath._pathmod = ntpath
    
    Functionality from `_PosixFlavour` and `_WindowsFlavour` is moved into
    `PurePath` as underscored-prefixed classmethods. Flavours are removed.
    barneygale committed Mar 5, 2022
    Configuration menu
    Copy the full SHA
    7371220 View commit details
    Browse the repository at this point in the history
  2. Add tests

    barneygale committed Mar 5, 2022
    Configuration menu
    Copy the full SHA
    8431d12 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    bf2ad3a View commit details
    Browse the repository at this point in the history
  4. Update Misc/NEWS.d/next/Library/2022-03-05-02-14-09.bpo-24132.W6iORO.rst

    Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
    barneygale and AlexWaygood authored Mar 5, 2022
    Configuration menu
    Copy the full SHA
    4036e2e View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    0d08533 View commit details
    Browse the repository at this point in the history
  6. Merge branch 'bpo-44136-remove-pathlib-flavour-2' of github.com:barne…

    …ygale/cpython into bpo-44136-remove-pathlib-flavour-2
    barneygale committed Mar 5, 2022
    Configuration menu
    Copy the full SHA
    0ad8022 View commit details
    Browse the repository at this point in the history

Commits on Mar 25, 2022

  1. Configuration menu
    Copy the full SHA
    28992fc View commit details
    Browse the repository at this point in the history
  2. Remove _casefold() and _casefold_parts() methods.

    Makes the code a little more direct.
    barneygale committed Mar 25, 2022
    Configuration menu
    Copy the full SHA
    dbec230 View commit details
    Browse the repository at this point in the history

Commits on Apr 29, 2022

  1. Configuration menu
    Copy the full SHA
    d814ee4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    63f1d68 View commit details
    Browse the repository at this point in the history
  3. Apply suggestions from code review

    Co-authored-by: Brett Cannon <brett@python.org>
    barneygale and brettcannon authored Apr 29, 2022
    Configuration menu
    Copy the full SHA
    8dddfdf View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    b4da721 View commit details
    Browse the repository at this point in the history
  5. Fix tests

    barneygale committed Apr 29, 2022
    Configuration menu
    Copy the full SHA
    7a166fd View commit details
    Browse the repository at this point in the history
  6. Fix docstring formatting.

    barneygale committed Apr 29, 2022
    Configuration menu
    Copy the full SHA
    1f4dff1 View commit details
    Browse the repository at this point in the history

Commits on Apr 30, 2022

  1. Remove FIXME comments

    barneygale committed Apr 30, 2022
    Configuration menu
    Copy the full SHA
    51893c1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    48b49b6 View commit details
    Browse the repository at this point in the history

Commits on May 3, 2022

  1. Update Lib/pathlib.py

    Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
    barneygale and AlexWaygood authored May 3, 2022
    Configuration menu
    Copy the full SHA
    3624c97 View commit details
    Browse the repository at this point in the history

Commits on May 31, 2022

  1. Configuration menu
    Copy the full SHA
    ab54c14 View commit details
    Browse the repository at this point in the history

Commits on Jun 10, 2022

  1. Configuration menu
    Copy the full SHA
    2627417 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    bc7aded View commit details
    Browse the repository at this point in the history

Commits on Jun 12, 2022

  1. Configuration menu
    Copy the full SHA
    4d6e4f3 View commit details
    Browse the repository at this point in the history

Commits on Jun 13, 2022

  1. Update Lib/pathlib.py

    Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
    barneygale and AA-Turner authored Jun 13, 2022
    Configuration menu
    Copy the full SHA
    70ca838 View commit details
    Browse the repository at this point in the history

Commits on Jun 16, 2022

  1. Remove unused import

    barneygale committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    a2cc74f View commit details
    Browse the repository at this point in the history

Commits on Jun 17, 2022

  1. Configuration menu
    Copy the full SHA
    0e2478b View commit details
    Browse the repository at this point in the history

Commits on Jul 29, 2022

  1. Apply suggestions from code review

    Co-authored-by: Brett Cannon <brett@python.org>
    barneygale and brettcannon authored Jul 29, 2022
    Configuration menu
    Copy the full SHA
    0d0cf60 View commit details
    Browse the repository at this point in the history
  2. Clarify _pparts and _ncparts naming.

    - `_pparts` --> `_parts_tuple`
    - `_ncparts` --> `_parts_normcase`
    - `_cached_ncparts` --> `_parts_normcase_cached`
    barneygale committed Jul 29, 2022
    Configuration menu
    Copy the full SHA
    f3048d3 View commit details
    Browse the repository at this point in the history

Commits on Jul 30, 2022

  1. Configuration menu
    Copy the full SHA
    8a213ae View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    402dafe View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5cc3ab2 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    19a8804 View commit details
    Browse the repository at this point in the history
  5. Fix Windows tests

    barneygale committed Jul 30, 2022
    Configuration menu
    Copy the full SHA
    9da46bc View commit details
    Browse the repository at this point in the history

Commits on Aug 1, 2022

  1. Configuration menu
    Copy the full SHA
    29f9f81 View commit details
    Browse the repository at this point in the history

Commits on Aug 5, 2022

  1. Configuration menu
    Copy the full SHA
    52851b8 View commit details
    Browse the repository at this point in the history

Commits on Aug 12, 2022

  1. Optimize _split_root()

    barneygale committed Aug 12, 2022
    Configuration menu
    Copy the full SHA
    b39da53 View commit details
    Browse the repository at this point in the history

Commits on Aug 13, 2022

  1. Configuration menu
    Copy the full SHA
    c7b18b1 View commit details
    Browse the repository at this point in the history

Commits on Aug 23, 2022

  1. Configuration menu
    Copy the full SHA
    806ad15 View commit details
    Browse the repository at this point in the history
  2. Use os.path.normcase() when globbing.

    This removes a `flavour is posixpath` check in `_WildcardSelector`.
    Instead, we normalise the case of both the pattern and the `os.scandir()`
    entries, and then perform a case-sensitive comparison. The same approach is
    taken by `fnmatch.fnmatch()`.
    barneygale committed Aug 23, 2022
    Configuration menu
    Copy the full SHA
    a350009 View commit details
    Browse the repository at this point in the history

Commits on Aug 25, 2022

  1. Configuration menu
    Copy the full SHA
    799b40e View commit details
    Browse the repository at this point in the history

Commits on Aug 26, 2022

  1. Configuration menu
    Copy the full SHA
    a6b25ea View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ac6f6e2 View commit details
    Browse the repository at this point in the history

Commits on Aug 27, 2022

  1. Revert "Move is_reserved() implementation into os.path as a priva…

    …te function."
    
    This reverts commit 806ad15.
    barneygale committed Aug 27, 2022
    Configuration menu
    Copy the full SHA
    b8874df View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9d5e18a View commit details
    Browse the repository at this point in the history
  3. Remove test that /b/c/d and ///b/c/d are equivalent.

    This is no longer true as of 99fcf15, see python#96290
    barneygale committed Aug 27, 2022
    Configuration menu
    Copy the full SHA
    f73f426 View commit details
    Browse the repository at this point in the history

Commits on Sep 16, 2022

  1. Configuration menu
    Copy the full SHA
    37e4bc1 View commit details
    Browse the repository at this point in the history

Commits on Nov 7, 2022

  1. Apply suggestions from code review

    Co-authored-by: Eryk Sun <eryksun@gmail.com>
    Co-authored-by: Brett Cannon <brett@python.org>
    3 people authored Nov 7, 2022
    Configuration menu
    Copy the full SHA
    e3f13ef View commit details
    Browse the repository at this point in the history

Commits on Nov 15, 2022

  1. Configuration menu
    Copy the full SHA
    ff4e1b3 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    07c67d0 View commit details
    Browse the repository at this point in the history
  3. Reduce tests diff

    barneygale committed Nov 15, 2022
    Configuration menu
    Copy the full SHA
    950aa47 View commit details
    Browse the repository at this point in the history
  4. Remove test that /b/c/d and ///b/c/d are equivalent.

    This is no longer true as of 99fcf15, see python#96290
    barneygale committed Nov 15, 2022
    Configuration menu
    Copy the full SHA
    d5f6f03 View commit details
    Browse the repository at this point in the history
  5. Fix missing full stops.

    barneygale committed Nov 15, 2022
    Configuration menu
    Copy the full SHA
    b66a4fb View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    fbaadf4 View commit details
    Browse the repository at this point in the history

Commits on Nov 25, 2022

  1. Configuration menu
    Copy the full SHA
    3692fdf View commit details
    Browse the repository at this point in the history

Commits on Dec 17, 2022

  1. Configuration menu
    Copy the full SHA
    40dc514 View commit details
    Browse the repository at this point in the history