pathlib-next 0.1.6__tar.gz → 0.1.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {pathlib_next-0.1.6 → pathlib_next-0.1.7}/PKG-INFO +1 -1
  2. {pathlib_next-0.1.6 → pathlib_next-0.1.7}/pyproject.toml +1 -1
  3. {pathlib_next-0.1.6 → pathlib_next-0.1.7}/src/pathlib_next/mempath.py +0 -3
  4. {pathlib_next-0.1.6 → pathlib_next-0.1.7}/src/pathlib_next/path.py +15 -7
  5. {pathlib_next-0.1.6 → pathlib_next-0.1.7}/src/pathlib_next/utils/glob.py +3 -8
  6. {pathlib_next-0.1.6 → pathlib_next-0.1.7}/.gitignore +0 -0
  7. {pathlib_next-0.1.6 → pathlib_next-0.1.7}/LICENSE +0 -0
  8. {pathlib_next-0.1.6 → pathlib_next-0.1.7}/README.md +0 -0
  9. {pathlib_next-0.1.6 → pathlib_next-0.1.7}/src/example.py +0 -0
  10. {pathlib_next-0.1.6 → pathlib_next-0.1.7}/src/pathlib_next/__init__.py +0 -0
  11. {pathlib_next-0.1.6 → pathlib_next-0.1.7}/src/pathlib_next/fspath.py +0 -0
  12. {pathlib_next-0.1.6 → pathlib_next-0.1.7}/src/pathlib_next/uri/__init__.py +0 -0
  13. {pathlib_next-0.1.6 → pathlib_next-0.1.7}/src/pathlib_next/uri/query.py +0 -0
  14. {pathlib_next-0.1.6 → pathlib_next-0.1.7}/src/pathlib_next/uri/schemes/__init__.py +0 -0
  15. {pathlib_next-0.1.6 → pathlib_next-0.1.7}/src/pathlib_next/uri/schemes/file.py +0 -0
  16. {pathlib_next-0.1.6 → pathlib_next-0.1.7}/src/pathlib_next/uri/schemes/http.py +0 -0
  17. {pathlib_next-0.1.6 → pathlib_next-0.1.7}/src/pathlib_next/uri/schemes/sftp.py +0 -0
  18. {pathlib_next-0.1.6 → pathlib_next-0.1.7}/src/pathlib_next/uri/source.py +0 -0
  19. {pathlib_next-0.1.6 → pathlib_next-0.1.7}/src/pathlib_next/utils/__init__.py +0 -0
  20. {pathlib_next-0.1.6 → pathlib_next-0.1.7}/src/pathlib_next/utils/stat.py +0 -0
  21. {pathlib_next-0.1.6 → pathlib_next-0.1.7}/src/pathlib_next/utils/sync.py +0 -0
  22. {pathlib_next-0.1.6 → pathlib_next-0.1.7}/tests/test_local.py +0 -0
  23. {pathlib_next-0.1.6 → pathlib_next-0.1.7}/tests/test_uri.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pathlib_next
3
- Version: 0.1.6
3
+ Version: 0.1.7
4
4
  Summary: Generic Path Protocol based pathlib
5
5
  Project-URL: Homepage, https://github.com/jose-pr/pathlib_next/
6
6
  Project-URL: Issues, https://github.com/jose-pr/pathlib_next/issues
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "pathlib_next"
7
- version = "0.1.6"
7
+ version = "0.1.7"
8
8
  authors = [{ name = "Jose A" }]
9
9
  description = "Generic Path Protocol based pathlib"
10
10
  readme = "README.md"
@@ -92,9 +92,6 @@ class MemPath(Path):
92
92
  def as_uri(self):
93
93
  return f"mempath:{_urlquote(self.as_posix())}"
94
94
 
95
- def as_posix(self):
96
- return "/".join(self.segments)
97
-
98
95
  def _parent_container(self) -> tuple[dict[str, bytearray], str]:
99
96
  parent = self.backend
100
97
  *ancestors, name = self.normalized
@@ -5,14 +5,14 @@ paths with operations that have semantics appropriate for different
5
5
  operating systems.
6
6
  """
7
7
 
8
+ import abc as _abc
9
+ import io as _io
8
10
  import os as _os
9
11
  import re as _re
12
+ import shutil as _shutil
10
13
  import stat as _stat
11
- from pathlib import _ignore_error
12
14
  import typing as _ty
13
- import abc as _abc
14
- import io as _io
15
- import shutil as _shutil
15
+ from pathlib import _ignore_error
16
16
 
17
17
  from . import utils as _utils
18
18
  from .utils import glob as _glob
@@ -36,6 +36,7 @@ _os.PathLike.register(FsPathLike)
36
36
 
37
37
  _FsPathLike = str | FsPathLike
38
38
 
39
+
39
40
  class _PathnameParents(_ty.Sequence[PN]):
40
41
  """This object provides sequence-like access to the logical ancestors
41
42
  of a path. Don't try to construct it yourself."""
@@ -69,6 +70,7 @@ class _PathnameParents(_ty.Sequence[PN]):
69
70
  def __repr__(self):
70
71
  return "<{}.parents>".format(type(self._path).__name__)
71
72
 
73
+
72
74
  class Pathname(FsPathLike, _ty.Generic[_P]):
73
75
  """Base class for manipulating paths without I/O."""
74
76
 
@@ -184,10 +186,9 @@ class Pathname(FsPathLike, _ty.Generic[_P]):
184
186
  """The logical parent of the path."""
185
187
 
186
188
  @property
187
- def parents(self)->_ty.Sequence[_ty.Self]:
189
+ def parents(self) -> _ty.Sequence[_ty.Self]:
188
190
  return _PathnameParents(self)
189
191
 
190
-
191
192
  @_utils.notimplemented
192
193
  def is_absolute(self) -> bool:
193
194
  """True if the path is absolute (has both a root and, if applicable,
@@ -208,7 +209,14 @@ class Pathname(FsPathLike, _ty.Generic[_P]):
208
209
  return path_pattern.match(path) is not None
209
210
 
210
211
  @_utils.notimplemented
211
- def as_posix(self) -> str: ...
212
+ def as_posix(self) -> str:
213
+ return "/".join(self.segments)
214
+
215
+ def has_glob_pattern(self):
216
+ for segment in self.segments:
217
+ if _glob.WILCARD_PATTERN.match(segment) != None:
218
+ return True
219
+ return False
212
220
 
213
221
 
214
222
  PurePathLike = str | Pathname
@@ -4,10 +4,9 @@
4
4
  """Filename globbing utility."""
5
5
 
6
6
  import fnmatch as _fnmatch
7
- import typing as _ty
8
7
  import functools as _func
9
8
  import re as _re
10
-
9
+ import typing as _ty
11
10
 
12
11
  RECURSIVE = "**"
13
12
  ANY_PATTERN = _re.compile(_fnmatch.translate("*"))
@@ -33,7 +32,7 @@ def glob(
33
32
  root_dir: _Globable | None = None,
34
33
  recursive: bool = False,
35
34
  include_hidden: bool = False,
36
- case_sensitive: bool | None = None
35
+ case_sensitive: bool | None = None,
37
36
  ) -> _ty.Iterable[_Globable]:
38
37
  """Return an iterator which yields the paths matching a pathname pattern.
39
38
 
@@ -52,12 +51,8 @@ def glob(
52
51
  pattern = compile_pattern(path.name, case_sensitive) if path.name else ANY_PATTERN
53
52
 
54
53
  name_is_pattern = WILCARD_PATTERN.match(path.name) != None
55
- wildcard_in_path = name_is_pattern
54
+ wildcard_in_path = name_is_pattern or path.has_glob_pattern()
56
55
  parent = next(iter(path.parents), None)
57
- for segment in path.segments:
58
- if WILCARD_PATTERN.match(segment) != None:
59
- wildcard_in_path = True
60
- break
61
56
 
62
57
  root: _Globable = (
63
58
  (root_dir or parent) if not root_dir or not parent else (root_dir / parent)
File without changes
File without changes
File without changes