pathrs 0.2.5__tar.gz → 0.2.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pathrs
3
- Version: 0.2.5
3
+ Version: 0.2.6
4
4
  Summary: Python bindings for libpathrs, a safe path resolution library for Linux.
5
5
  Author-email: Aleksa Sarai <cyphar@cyphar.com>
6
6
  Maintainer-email: Aleksa Sarai <cyphar@cyphar.com>
@@ -19,7 +19,7 @@ Classifier: Operating System :: POSIX :: Linux
19
19
  Classifier: Programming Language :: Python
20
20
  Classifier: Programming Language :: Python :: 3
21
21
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
- Requires-Python: >=3.9
22
+ Requires-Python: >=3.10
23
23
  Description-Content-Type: text/markdown
24
24
  License-File: COPYING
25
25
  Requires-Dist: cffi>=1.10.0
@@ -67,11 +67,11 @@ RENAME_EXCHANGE = 0x2
67
67
 
68
68
  with pathrs.Root("/path/to/rootfs") as root:
69
69
  # symlink
70
- root.symlink("foo", "bar") # foo -> bar
70
+ root.symlink("foo", "bar") # foo -> bar
71
71
  # link
72
- root.hardlink("a", "b") # a -> b
72
+ root.hardlink("a", "b") # a -> b
73
73
  # rename(at2)
74
- root.rename("foo", "b", flags=RENAME_EXCHANGE) # foo <-> b
74
+ root.rename("foo", "b", flags=RENAME_EXCHANGE) # foo <-> b
75
75
  # open(O_CREAT)
76
76
  with root.creat("newfile", "w+") as f:
77
77
  f.write("Some contents.")
@@ -38,11 +38,11 @@ RENAME_EXCHANGE = 0x2
38
38
 
39
39
  with pathrs.Root("/path/to/rootfs") as root:
40
40
  # symlink
41
- root.symlink("foo", "bar") # foo -> bar
41
+ root.symlink("foo", "bar") # foo -> bar
42
42
  # link
43
- root.hardlink("a", "b") # a -> b
43
+ root.hardlink("a", "b") # a -> b
44
44
  # rename(at2)
45
- root.rename("foo", "b", flags=RENAME_EXCHANGE) # foo <-> b
45
+ root.rename("foo", "b", flags=RENAME_EXCHANGE) # foo <-> b
46
46
  # open(O_CREAT)
47
47
  with root.creat("newfile", "w+") as f:
48
48
  f.write("Some contents.")
@@ -1,4 +1,3 @@
1
- #!/usr/bin/python3
2
1
  # SPDX-License-Identifier: MPL-2.0
3
2
  #
4
3
  # libpathrs: safe path resolution on Linux
@@ -13,7 +12,7 @@ import importlib
13
12
  import importlib.metadata
14
13
 
15
14
  from . import _pathrs
16
- from ._pathrs import * # noqa: F403 # We just re-export everything.
15
+ from ._pathrs import * # We just re-export everything.
17
16
 
18
17
  # In order get pydoc to include the documentation for the re-exported code from
19
18
  # _pathrs, we need to include all of the members in __all__. Rather than
@@ -1,4 +1,3 @@
1
- #!/usr/bin/python3
2
1
  # SPDX-License-Identifier: MPL-2.0
3
2
  #
4
3
  # libpathrs: safe path resolution on Linux
@@ -9,19 +8,18 @@
9
8
  # License, v. 2.0. If a copy of the MPL was not distributed with this
10
9
  # file, You can obtain one at https://mozilla.org/MPL/2.0/.
11
10
 
12
- import io
13
- import os
14
- import sys
15
11
  import copy
16
12
  import errno
17
13
  import fcntl
18
-
14
+ import io
15
+ import os
16
+ import sys
19
17
  import typing
20
18
  from types import TracebackType
21
- from typing import Any, Dict, IO, Optional, TextIO, Type, TypeVar, Union
19
+ from typing import IO, Any, ClassVar, TextIO, TypeAlias, TypeVar
22
20
 
23
21
  # TODO: Remove this once we only support Python >= 3.11.
24
- from typing_extensions import Self, TypeAlias
22
+ from typing_extensions import Self
25
23
 
26
24
  from ._libpathrs_cffi import lib as libpathrs_so
27
25
 
@@ -52,7 +50,7 @@ def _pystr(cstr: CString) -> str:
52
50
 
53
51
 
54
52
  def _cbuffer(size: int) -> CBuffer:
55
- return ffi.new("char[%d]" % (size,))
53
+ return ffi.new(f"char[{size}]")
56
54
 
57
55
 
58
56
  def _is_pathrs_err(ret: int) -> bool:
@@ -68,10 +66,10 @@ class PathrsError(Exception):
68
66
  """
69
67
 
70
68
  message: str
71
- errno: Optional[int]
72
- strerror: Optional[str]
69
+ errno: int | None
70
+ strerror: str | None
73
71
 
74
- def __init__(self, message: str, /, *, errno: Optional[int] = None):
72
+ def __init__(self, message: str, /, *, errno: int | None = None):
75
73
  # Construct Exception.
76
74
  super().__init__(message)
77
75
 
@@ -88,7 +86,7 @@ class PathrsError(Exception):
88
86
  self.strerror = str(errno)
89
87
 
90
88
  @classmethod
91
- def _fetch(cls, err_id: int, /) -> Optional[Self]:
89
+ def _fetch(cls, err_id: int, /) -> Self | None:
92
90
  if err_id >= 0:
93
91
  return None
94
92
 
@@ -109,10 +107,10 @@ class PathrsError(Exception):
109
107
  if self.errno is None:
110
108
  return self.message
111
109
  else:
112
- return "%s (%s)" % (self.message, self.strerror)
110
+ return f"{self.message} ({self.strerror})"
113
111
 
114
112
  def __repr__(self) -> str:
115
- return "Error(%r, errno=%r)" % (self.message, self.errno)
113
+ return f"Error({self.message!r}, errno={self.errno!r})"
116
114
 
117
115
  def pprint(self, out: TextIO = sys.stdout) -> None:
118
116
  "Pretty-print the error to the given @out file."
@@ -120,8 +118,8 @@ class PathrsError(Exception):
120
118
  if self.errno is None:
121
119
  print("pathrs error:", file=out)
122
120
  else:
123
- print("pathrs error [%s]:" % (self.strerror,), file=out)
124
- print(" %s" % (self.message,), file=out)
121
+ print(f"pathrs error [{self.strerror}]:", file=out)
122
+ print(f" {self.message}", file=out)
125
123
 
126
124
 
127
125
  INTERNAL_ERROR = PathrsError("tried to fetch libpathrs error but no error found")
@@ -131,7 +129,7 @@ class FilenoFile(typing.Protocol):
131
129
  def fileno(self) -> int: ...
132
130
 
133
131
 
134
- FileLike = Union[FilenoFile, int]
132
+ FileLike = FilenoFile | int
135
133
 
136
134
 
137
135
  def _fileno(file: FileLike) -> int:
@@ -151,7 +149,7 @@ def _clonefile(file: FileLike) -> int:
151
149
  Fd = TypeVar("Fd", bound="WrappedFd")
152
150
 
153
151
 
154
- class WrappedFd(object):
152
+ class WrappedFd:
155
153
  """
156
154
  Represents a file descriptor that allows for manual lifetime management,
157
155
  unlike os.fdopen() which are tracked by the GC with no way of "leaking" the
@@ -160,7 +158,7 @@ class WrappedFd(object):
160
158
  pathrs will return WrappedFds for most operations that return an fd.
161
159
  """
162
160
 
163
- _fd: Optional[int]
161
+ _fd: int | None
164
162
 
165
163
  def __init__(self, file: FileLike, /):
166
164
  """
@@ -233,12 +231,12 @@ class WrappedFd(object):
233
231
  raise
234
232
 
235
233
  @classmethod
236
- def from_raw_fd(cls: Type[Fd], fd: int, /) -> Fd:
234
+ def from_raw_fd(cls, fd: int, /) -> Self:
237
235
  "Shorthand for WrappedFd(fd)."
238
236
  return cls(fd)
239
237
 
240
238
  @classmethod
241
- def from_file(cls: Type[Fd], file: FileLike, /) -> Fd:
239
+ def from_file(cls, file: FileLike, /) -> Self:
242
240
  "Shorthand for WrappedFd(file)."
243
241
  return cls(file)
244
242
 
@@ -288,7 +286,7 @@ class WrappedFd(object):
288
286
  # A "shallow copy" of a file is the same as a deep copy.
289
287
  return copy.deepcopy(self)
290
288
 
291
- def __deepcopy__(self, memo: Dict[int, Any]) -> Self:
289
+ def __deepcopy__(self, memo: dict[int, Any]) -> Self:
292
290
  "Identical to WrappedFd.clone()"
293
291
  return self.clone()
294
292
 
@@ -301,9 +299,9 @@ class WrappedFd(object):
301
299
 
302
300
  def __exit__(
303
301
  self,
304
- exc_type: Optional[Type[BaseException]],
305
- exc_value: Optional[BaseException],
306
- exc_traceback: Optional[TracebackType],
302
+ exc_type: type[BaseException] | None,
303
+ exc_value: BaseException | None,
304
+ exc_traceback: TracebackType | None,
307
305
  ) -> None:
308
306
  self.close()
309
307
 
@@ -349,9 +347,9 @@ def _convert_mode(mode: str) -> int:
349
347
  class SingletonClass(type):
350
348
  """Metaclass used to create singleton classes."""
351
349
 
352
- _instances: dict[type, Type[Any]] = {}
350
+ _instances: ClassVar[dict[type, type[Any]]] = {}
353
351
 
354
352
  def __call__(cls, *args, **kwargs): # type: ignore[no-untyped-def] # TODO: Not clear what annotations to use, and mypy appears to be confused by metaclasses.
355
353
  if cls not in cls._instances:
356
- cls._instances[cls] = super(SingletonClass, cls).__call__(*args, **kwargs)
354
+ cls._instances[cls] = super().__call__(*args, **kwargs)
357
355
  return cls._instances[cls]
@@ -8,10 +8,7 @@
8
8
  # License, v. 2.0. If a copy of the MPL was not distributed with this
9
9
  # file, You can obtain one at https://mozilla.org/MPL/2.0/.
10
10
 
11
- from typing import type_check_only, Union
12
-
13
- # TODO: Remove this once we only support Python >= 3.10.
14
- from typing_extensions import TypeAlias, Literal
11
+ from typing import Literal, TypeAlias, type_check_only
15
12
 
16
13
  from .._pathrs import CBuffer, CString
17
14
  from ..procfs import ProcfsBase
@@ -29,7 +26,7 @@ __PATHRS_MAX_ERR_VALUE: ErrorId
29
26
 
30
27
  # TODO: We actually return Union[CError, cffi.FFI.NULL] but we can't express
31
28
  # this using the typing stubs for CFFI...
32
- def pathrs_errorinfo(err_id: Union[ErrorId, int]) -> CError: ...
29
+ def pathrs_errorinfo(err_id: ErrorId | int) -> CError: ...
33
30
  def pathrs_errorinfo_free(err: CError) -> None: ...
34
31
 
35
32
  # pathrs_version_info_t *
@@ -37,7 +34,7 @@ def pathrs_errorinfo_free(err: CError) -> None: ...
37
34
  class VersionInfo:
38
35
  version_string: CString
39
36
 
40
- def pathrs_version(info: VersionInfo, size: int) -> Union[ErrorId, int]: ...
37
+ def pathrs_version(info: VersionInfo, size: int) -> ErrorId | int: ...
41
38
 
42
39
  # uint64_t
43
40
  ProcfsOpenFlags: TypeAlias = int
@@ -58,70 +55,64 @@ __PATHRS_PROC_TYPE_PID: ProcfsBase
58
55
  PATHRS_PROC_DEFAULT_ROOTFD: RawFd
59
56
 
60
57
  # procfs API
61
- def pathrs_procfs_open(how: ProcfsOpenHow, size: int) -> Union[RawFd, ErrorId]: ...
58
+ def pathrs_procfs_open(how: ProcfsOpenHow, size: int) -> RawFd | ErrorId: ...
62
59
  def pathrs_proc_open(
63
60
  base: ProcfsBase, path: CString, flags: int
64
- ) -> Union[RawFd, ErrorId]: ...
61
+ ) -> RawFd | ErrorId: ...
65
62
  def pathrs_proc_openat(
66
63
  proc_root_fd: RawFd, base: ProcfsBase, path: CString, flags: int
67
- ) -> Union[RawFd, ErrorId]: ...
64
+ ) -> RawFd | ErrorId: ...
68
65
  def pathrs_proc_readlink(
69
66
  base: ProcfsBase, path: CString, linkbuf: CBuffer, linkbuf_size: int
70
- ) -> Union[int, ErrorId]: ...
67
+ ) -> int | ErrorId: ...
71
68
  def pathrs_proc_readlinkat(
72
69
  proc_root_fd: RawFd,
73
70
  base: ProcfsBase,
74
71
  path: CString,
75
72
  linkbuf: CBuffer,
76
73
  linkbuf_size: int,
77
- ) -> Union[int, ErrorId]: ...
74
+ ) -> int | ErrorId: ...
78
75
 
79
76
  # core API
80
- def pathrs_open_root(path: CString) -> Union[RawFd, ErrorId]: ...
81
- def pathrs_reopen(fd: RawFd, flags: int) -> Union[RawFd, ErrorId]: ...
82
- def pathrs_inroot_resolve(rootfd: RawFd, path: CString) -> Union[RawFd, ErrorId]: ...
83
- def pathrs_inroot_resolve_nofollow(
84
- rootfd: RawFd, path: CString
85
- ) -> Union[RawFd, ErrorId]: ...
86
- def pathrs_inroot_open(
87
- rootfd: RawFd, path: CString, flags: int
88
- ) -> Union[RawFd, ErrorId]: ...
77
+ def pathrs_open_root(path: CString) -> RawFd | ErrorId: ...
78
+ def pathrs_reopen(fd: RawFd, flags: int) -> RawFd | ErrorId: ...
79
+ def pathrs_inroot_resolve(rootfd: RawFd, path: CString) -> RawFd | ErrorId: ...
80
+ def pathrs_inroot_resolve_nofollow(rootfd: RawFd, path: CString) -> RawFd | ErrorId: ...
81
+ def pathrs_inroot_open(rootfd: RawFd, path: CString, flags: int) -> RawFd | ErrorId: ...
89
82
  def pathrs_inroot_creat(
90
83
  rootfd: RawFd, path: CString, flags: int, filemode: int
91
- ) -> Union[RawFd, ErrorId]: ...
84
+ ) -> RawFd | ErrorId: ...
92
85
  def pathrs_inroot_rename(
93
86
  old_rootfd: RawFd,
94
87
  old_path: CString,
95
88
  new_rootfd: RawFd,
96
89
  new_path: CString,
97
90
  flags: int,
98
- ) -> Union[Literal[0], ErrorId]: ...
99
- def pathrs_inroot_rmdir(rootfd: RawFd, path: CString) -> Union[Literal[0], ErrorId]: ...
100
- def pathrs_inroot_unlink(
101
- rootfd: RawFd, path: CString
102
- ) -> Union[Literal[0], ErrorId]: ...
103
- def pathrs_inroot_remove_all(rootfd: RawFd, path: CString) -> Union[RawFd, ErrorId]: ...
91
+ ) -> Literal[0] | ErrorId: ...
92
+ def pathrs_inroot_rmdir(rootfd: RawFd, path: CString) -> Literal[0] | ErrorId: ...
93
+ def pathrs_inroot_unlink(rootfd: RawFd, path: CString) -> Literal[0] | ErrorId: ...
94
+ def pathrs_inroot_remove_all(rootfd: RawFd, path: CString) -> RawFd | ErrorId: ...
104
95
  def pathrs_inroot_mkdir(
105
96
  rootfd: RawFd, path: CString, mode: int
106
- ) -> Union[Literal[0], ErrorId]: ...
97
+ ) -> Literal[0] | ErrorId: ...
107
98
  def pathrs_inroot_mkdir_all(
108
99
  rootfd: RawFd, path: CString, mode: int
109
- ) -> Union[Literal[0], ErrorId]: ...
100
+ ) -> Literal[0] | ErrorId: ...
110
101
  def pathrs_inroot_mknod(
111
102
  rootfd: RawFd, path: CString, mode: int, dev: int
112
- ) -> Union[Literal[0], ErrorId]: ...
103
+ ) -> Literal[0] | ErrorId: ...
113
104
  def pathrs_inroot_hardlink(
114
105
  old_rootfd: RawFd,
115
106
  old_path: CString,
116
107
  new_rootfd: RawFd,
117
108
  new_path: CString,
118
109
  flags: int,
119
- ) -> Union[Literal[0], ErrorId]: ...
110
+ ) -> Literal[0] | ErrorId: ...
120
111
  def pathrs_inroot_symlink(
121
112
  target: CString,
122
113
  rootfd: RawFd,
123
114
  linkpath: CString,
124
- ) -> Union[Literal[0], ErrorId]: ...
115
+ ) -> Literal[0] | ErrorId: ...
125
116
  def pathrs_inroot_readlink(
126
117
  rootfd: RawFd, path: CString, linkbuf: CBuffer, linkbuf_size: int
127
- ) -> Union[int, ErrorId]: ...
118
+ ) -> int | ErrorId: ...
@@ -1,4 +1,3 @@
1
- #!/usr/bin/python3
2
1
  # SPDX-License-Identifier: MPL-2.0
3
2
  #
4
3
  # libpathrs: safe path resolution on Linux
@@ -10,29 +9,27 @@
10
9
  # file, You can obtain one at https://mozilla.org/MPL/2.0/.
11
10
 
12
11
  import os
13
-
14
12
  import typing
15
- from typing import Any, IO, Union, cast
16
13
  import warnings
17
14
 
18
15
  # TODO: Remove this once we only support Python >= 3.11.
19
- from typing_extensions import TypeAlias
16
+ from typing import IO, Any, TypeAlias, cast
20
17
 
21
18
  from ._internal import (
22
- # Generic helpers.
23
- SingletonClass,
19
+ INTERNAL_ERROR,
24
20
  # File type helpers.
25
21
  FileLike,
26
- WrappedFd,
27
- _convert_mode,
28
22
  # Error API.
29
23
  PathrsError,
30
- _is_pathrs_err,
31
- INTERNAL_ERROR,
24
+ # Generic helpers.
25
+ SingletonClass,
26
+ WrappedFd,
27
+ _cbuffer,
28
+ _convert_mode,
32
29
  # CFFI helpers.
33
30
  _cstr,
31
+ _is_pathrs_err,
34
32
  _pystr,
35
- _cbuffer,
36
33
  )
37
34
  from ._libpathrs_cffi import lib as libpathrs_so
38
35
 
@@ -52,12 +49,12 @@ else:
52
49
  CBuffer: TypeAlias = ffi.CData
53
50
 
54
51
  __all__ = [
55
- # Core api.
56
- "Root",
57
52
  "Handle",
58
- "library_version",
59
53
  # Error api (re-export).
60
54
  "PathrsError",
55
+ # Core api.
56
+ "Root",
57
+ "library_version",
61
58
  ]
62
59
 
63
60
 
@@ -133,7 +130,7 @@ class Root(WrappedFd):
133
130
  relative to.
134
131
  """
135
132
 
136
- def __init__(self, file_or_path: Union[FileLike, str], /):
133
+ def __init__(self, file_or_path: FileLike | str, /):
137
134
  """
138
135
  Create a handle from a file-like object or a path to a directory.
139
136
 
@@ -13,12 +13,14 @@
13
13
  # build of libpathrs, and can be redistributed alongside the pathrs.py wrapping
14
14
  # library). It's much better than the ABI-mode of CFFI.
15
15
 
16
- import re
16
+ # TODO: Remove this once we only support Python >= 3.10.
17
+ from __future__ import annotations # PEP 604
18
+
17
19
  import os
20
+ import re
18
21
  import sys
19
-
20
- from typing import Any, Optional
21
22
  from collections.abc import Iterable
23
+ from typing import Any
22
24
 
23
25
  import cffi
24
26
 
@@ -97,7 +99,7 @@ def find_rootdir() -> str:
97
99
  return root_dir
98
100
 
99
101
 
100
- def srcdir_ffibuilder(root_dir: Optional[str] = None) -> cffi.FFI:
102
+ def srcdir_ffibuilder(root_dir: str | None = None) -> cffi.FFI:
101
103
  """
102
104
  Build the CFFI bindings using the provided root_dir as the root of a
103
105
  pathrs source tree which has compiled cdylibs ready in target/*.
@@ -108,7 +110,7 @@ def srcdir_ffibuilder(root_dir: Optional[str] = None) -> cffi.FFI:
108
110
 
109
111
  # Figure out which libs are usable.
110
112
  library_dirs: Iterable[str] = (
111
- os.path.join(root_dir, "target/%s/libpathrs.so" % (mode,))
113
+ os.path.join(root_dir, f"target/{mode}/libpathrs.so")
112
114
  for mode in ("debug", "release")
113
115
  )
114
116
  library_dirs = (so_path for so_path in library_dirs if os.path.exists(so_path))
@@ -1,4 +1,3 @@
1
- #!/usr/bin/python3
2
1
  # SPDX-License-Identifier: MPL-2.0
3
2
  #
4
3
  # libpathrs: safe path resolution on Linux
@@ -10,22 +9,22 @@
10
9
  # file, You can obtain one at https://mozilla.org/MPL/2.0/.
11
10
 
12
11
  import typing
13
- from typing import Any, IO, cast
12
+ from typing import IO, Any, TypeAlias, cast
14
13
 
15
14
  # TODO: Remove this once we only support Python >= 3.11.
16
- from typing_extensions import Self, TypeAlias
15
+ from typing_extensions import Self
17
16
 
18
17
  from ._internal import (
18
+ INTERNAL_ERROR,
19
+ # Error API.
20
+ PathrsError,
19
21
  # File type helpers.
20
22
  WrappedFd,
23
+ _cbuffer,
21
24
  _convert_mode,
22
- # Error API.
23
- PathrsError,
24
- _is_pathrs_err,
25
- INTERNAL_ERROR,
26
25
  # CFFI helpers.
27
26
  _cstr,
28
- _cbuffer,
27
+ _is_pathrs_err,
29
28
  )
30
29
  from ._libpathrs_cffi import lib as libpathrs_so
31
30
 
@@ -45,10 +44,10 @@ else:
45
44
  CBuffer: TypeAlias = ffi.CData
46
45
 
47
46
  __all__ = [
47
+ "PROC_PID",
48
48
  "PROC_ROOT",
49
49
  "PROC_SELF",
50
50
  "PROC_THREAD_SELF",
51
- "PROC_PID",
52
51
  "ProcfsHandle",
53
52
  # Shorthand for ProcfsHandle.cached().<foo>.
54
53
  "open",
@@ -94,7 +93,13 @@ def PROC_PID(pid: int) -> ProcfsBase:
94
93
 
95
94
 
96
95
  class ProcfsHandle(WrappedFd):
97
- """ """
96
+ """
97
+ A handle to a procfs root that can be operated on safely.
98
+
99
+ While you can create your own custom handles with ProcfsHandle.new(), most
100
+ users should use the module-level procfs.* helper functions, which are all
101
+ shorthand for ProcfsHandle.cached().*.
102
+ """
98
103
 
99
104
  _PROCFS_OPEN_HOW_TYPE = "pathrs_procfs_open_how *"
100
105
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pathrs
3
- Version: 0.2.5
3
+ Version: 0.2.6
4
4
  Summary: Python bindings for libpathrs, a safe path resolution library for Linux.
5
5
  Author-email: Aleksa Sarai <cyphar@cyphar.com>
6
6
  Maintainer-email: Aleksa Sarai <cyphar@cyphar.com>
@@ -19,7 +19,7 @@ Classifier: Operating System :: POSIX :: Linux
19
19
  Classifier: Programming Language :: Python
20
20
  Classifier: Programming Language :: Python :: 3
21
21
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
- Requires-Python: >=3.9
22
+ Requires-Python: >=3.10
23
23
  Description-Content-Type: text/markdown
24
24
  License-File: COPYING
25
25
  Requires-Dist: cffi>=1.10.0
@@ -67,11 +67,11 @@ RENAME_EXCHANGE = 0x2
67
67
 
68
68
  with pathrs.Root("/path/to/rootfs") as root:
69
69
  # symlink
70
- root.symlink("foo", "bar") # foo -> bar
70
+ root.symlink("foo", "bar") # foo -> bar
71
71
  # link
72
- root.hardlink("a", "b") # a -> b
72
+ root.hardlink("a", "b") # a -> b
73
73
  # rename(at2)
74
- root.rename("foo", "b", flags=RENAME_EXCHANGE) # foo <-> b
74
+ root.rename("foo", "b", flags=RENAME_EXCHANGE) # foo <-> b
75
75
  # open(O_CREAT)
76
76
  with root.creat("newfile", "w+") as f:
77
77
  f.write("Some contents.")
@@ -21,7 +21,7 @@ build-backend = "setuptools.build_meta"
21
21
  [project]
22
22
  name = "pathrs"
23
23
  # TODO: Figure out a way to keep this version up-to-date with Cargo.toml.
24
- version = "0.2.5"
24
+ version = "0.2.6"
25
25
  description = "Python bindings for libpathrs, a safe path resolution library for Linux."
26
26
  readme = "README.md"
27
27
  keywords = ["libpathrs", "pathrs"]
@@ -44,7 +44,7 @@ classifiers = [
44
44
  "Topic :: Software Development :: Libraries :: Python Modules",
45
45
  ]
46
46
 
47
- requires-python = ">= 3.9"
47
+ requires-python = ">= 3.10"
48
48
  dependencies = [
49
49
  "cffi>=1.10.0",
50
50
  "typing_extensions>=4.0.0", # TODO: Remove this once we only support Python >= 3.11.
@@ -9,13 +9,13 @@
9
9
  # License, v. 2.0. If a copy of the MPL was not distributed with this
10
10
  # file, You can obtain one at https://mozilla.org/MPL/2.0/.
11
11
 
12
- import setuptools
12
+ from typing import Any
13
13
 
14
- from typing import Any, Dict
14
+ import setuptools
15
15
 
16
16
 
17
17
  # This is only needed for backwards compatibility with older versions.
18
- def parse_pyproject() -> Dict[str, Any]:
18
+ def parse_pyproject() -> dict[str, Any]:
19
19
  try:
20
20
  import tomllib
21
21
 
File without changes
File without changes
File without changes