-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
pathlib ABCs: remove or namespace private attributes #127807
Labels
Comments
barneygale
added a commit
to barneygale/cpython
that referenced
this issue
Dec 11, 2024
…ted class Move 9 private `PathBase` attributes and methods into a new `CopyWorker` class. Change `PathBase.copy` from a method to a `CopyWorker` instance. The methods remain private in the `CopyWorker` class. In future we might make some/all of them public so that user subclasses of `PathBase` can customize the copying process (in particular reading/writing of metadata,) but we'd need to make `PathBase` public first.
barneygale
added a commit
to barneygale/cpython
that referenced
this issue
Dec 11, 2024
…ted class Move 9 private `PathBase` attributes and methods into a new `CopyWorker` class. Change `PathBase.copy` from a method to a `CopyWorker` instance. The methods remain private in the `CopyWorker` class. In future we might make some/all of them public so that user subclasses of `PathBase` can customize the copying process (in particular reading/writing of metadata,) but we'd need to make `PathBase` public first.
barneygale
added a commit
to barneygale/cpython
that referenced
this issue
Dec 12, 2024
From `PurePathBase` delete `_stack` and `_pattern_str`, and from `PathBase` delete `_glob_selector`.
barneygale
added a commit
to barneygale/cpython
that referenced
this issue
Dec 12, 2024
This method helped us customise the `UnsupportedOperation` message depending on the type. But we're aiming to make `PathBase` a proper ABC soon, so `NotImplementedError` is the right exception to raise there.
barneygale
added a commit
to barneygale/cpython
that referenced
this issue
Dec 12, 2024
This method helped us customise the `UnsupportedOperation` message depending on the type. But we're aiming to make `PathBase` a proper ABC soon, so `NotImplementedError` is the right exception to raise there.
barneygale
added a commit
to barneygale/cpython
that referenced
this issue
Dec 12, 2024
This method helped us customise the `UnsupportedOperation` message depending on the type. But we're aiming to make `PathBase` a proper ABC soon, so `NotImplementedError` is the right exception to raise there.
barneygale
added a commit
that referenced
this issue
Dec 12, 2024
This method helped us customise the `UnsupportedOperation` message depending on the type. But we're aiming to make `PathBase` a proper ABC soon, so `NotImplementedError` is the right exception to raise there.
barneygale
added a commit
to barneygale/cpython
that referenced
this issue
Dec 12, 2024
Remove the `PurePathBase` initializer, and make `with_segments()` and `__str__()` abstract. This allows us to drop the `_raw_paths` attribute, and also the `Parser.join()` protocol method.
barneygale
added a commit
to barneygale/cpython
that referenced
this issue
Dec 22, 2024
barneygale
added a commit
that referenced
this issue
Dec 22, 2024
Remove the `PurePathBase` initializer, and make `with_segments()` and `__str__()` abstract. This allows us to drop the `_raw_paths` attribute, and also the `Parser.join()` protocol method.
barneygale
added a commit
to barneygale/cpython
that referenced
this issue
Dec 22, 2024
barneygale
added a commit
that referenced
this issue
Dec 22, 2024
From `PurePathBase` delete `_globber`, `_stack` and `_pattern_str`, and from `PathBase` delete `_glob_selector`. This helps avoid an unpleasant surprise for a users who try to use these names.
barneygale
added a commit
to barneygale/cpython
that referenced
this issue
Dec 22, 2024
barneygale
added a commit
that referenced
this issue
Dec 22, 2024
…ass (#127810) Move 9 private `PathBase` attributes and methods into a new `CopyWorker` class. Change `PathBase.copy` from a method to a `CopyWorker` instance. The methods remain private in the `CopyWorker` class. In future we might make some/all of them public so that user subclasses of `PathBase` can customize the copying process (in particular reading/writing of metadata,) but we'd need to make `PathBase` public first.
This is done, with two exceptions:
|
srinivasreddy
pushed a commit
to srinivasreddy/cpython
that referenced
this issue
Dec 23, 2024
…on#127883) Remove the `PurePathBase` initializer, and make `with_segments()` and `__str__()` abstract. This allows us to drop the `_raw_paths` attribute, and also the `Parser.join()` protocol method.
srinivasreddy
pushed a commit
to srinivasreddy/cpython
that referenced
this issue
Dec 23, 2024
…n#127851) From `PurePathBase` delete `_globber`, `_stack` and `_pattern_str`, and from `PathBase` delete `_glob_selector`. This helps avoid an unpleasant surprise for a users who try to use these names.
srinivasreddy
pushed a commit
to srinivasreddy/cpython
that referenced
this issue
Dec 23, 2024
…ted class (python#127810) Move 9 private `PathBase` attributes and methods into a new `CopyWorker` class. Change `PathBase.copy` from a method to a `CopyWorker` instance. The methods remain private in the `CopyWorker` class. In future we might make some/all of them public so that user subclasses of `PathBase` can customize the copying process (in particular reading/writing of metadata,) but we'd need to make `PathBase` public first.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@encukou pointed out:
PurePathBase
andPathBase
have ~10 private attributes for facilitating copying, ~3 for matching and globbing, and ~3 more for miscellaneous purposes. We should try to eliminate as many as possible, and namespace the rest (e.g. under_pathlib_
)Linked PRs
PathBase._unsupported_msg()
#127855PurePathBase._raw_paths
#127883The text was updated successfully, but these errors were encountered: