filelock 4.2.8__tar.gz → 4.2.10__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 (108) hide show
  1. filelock-4.2.10/.python-sbom-revision +1 -0
  2. {filelock-4.2.8 → filelock-4.2.10}/PKG-INFO +1 -1
  3. {filelock-4.2.8 → filelock-4.2.10}/docs/changelog.rst +41 -0
  4. {filelock-4.2.8 → filelock-4.2.10}/docs/conf.py +25 -27
  5. {filelock-4.2.8 → filelock-4.2.10}/pyproject.toml +20 -1
  6. {filelock-4.2.8 → filelock-4.2.10}/src/filelock/__init__.py +23 -18
  7. {filelock-4.2.8 → filelock-4.2.10}/src/filelock/_api.py +893 -867
  8. {filelock-4.2.8 → filelock-4.2.10}/src/filelock/_async.py +135 -135
  9. {filelock-4.2.8 → filelock-4.2.10}/src/filelock/_async_read_write.py +132 -125
  10. {filelock-4.2.8 → filelock-4.2.10}/src/filelock/_error.py +23 -8
  11. {filelock-4.2.8 → filelock-4.2.10}/src/filelock/_identity.py +68 -84
  12. {filelock-4.2.8 → filelock-4.2.10}/src/filelock/_lease.py +102 -95
  13. {filelock-4.2.8 → filelock-4.2.10}/src/filelock/_marker.py +30 -16
  14. {filelock-4.2.8 → filelock-4.2.10}/src/filelock/_read_write.py +441 -445
  15. {filelock-4.2.8 → filelock-4.2.10}/src/filelock/_soft.py +199 -200
  16. filelock-4.2.10/src/filelock/_soft_rw/__init__.py +1 -0
  17. {filelock-4.2.8 → filelock-4.2.10}/src/filelock/_soft_rw/_async.py +107 -100
  18. {filelock-4.2.8 → filelock-4.2.10}/src/filelock/_soft_rw/_protocol.py +205 -216
  19. {filelock-4.2.8 → filelock-4.2.10}/src/filelock/_soft_rw/_storage.py +94 -96
  20. {filelock-4.2.8 → filelock-4.2.10}/src/filelock/_soft_rw/_sync.py +232 -222
  21. {filelock-4.2.8 → filelock-4.2.10}/src/filelock/_strict.py +133 -142
  22. {filelock-4.2.8 → filelock-4.2.10}/src/filelock/_unix.py +24 -19
  23. {filelock-4.2.8 → filelock-4.2.10}/src/filelock/_util.py +201 -230
  24. {filelock-4.2.8 → filelock-4.2.10}/src/filelock/_windows.py +174 -196
  25. {filelock-4.2.8 → filelock-4.2.10}/src/filelock/asyncio.py +264 -228
  26. {filelock-4.2.8 → filelock-4.2.10}/src/filelock/version.py +2 -2
  27. {filelock-4.2.8 → filelock-4.2.10}/tasks/benchmark.py +27 -37
  28. {filelock-4.2.8 → filelock-4.2.10}/tasks/capabilities.py +11 -11
  29. {filelock-4.2.8 → filelock-4.2.10}/tasks/capability/sitecustomize.py +2 -2
  30. {filelock-4.2.8 → filelock-4.2.10}/tasks/coverage_pragmas.py +3 -5
  31. {filelock-4.2.8 → filelock-4.2.10}/tasks/deny_symlink.py +22 -24
  32. {filelock-4.2.8 → filelock-4.2.10}/tasks/termux/Dockerfile +4 -2
  33. filelock-4.2.10/tasks/termux/requirements.txt +59 -0
  34. {filelock-4.2.8 → filelock-4.2.10}/tasks/verify_filesystem.py +28 -27
  35. {filelock-4.2.8 → filelock-4.2.10}/tests/async_filelock_cancellation_helpers.py +22 -10
  36. {filelock-4.2.8 → filelock-4.2.10}/tests/capability_marks.py +4 -8
  37. {filelock-4.2.8 → filelock-4.2.10}/tests/conftest.py +29 -33
  38. {filelock-4.2.8 → filelock-4.2.10}/tests/descriptor_helpers.py +0 -2
  39. {filelock-4.2.8 → filelock-4.2.10}/tests/fork_helpers.py +6 -3
  40. {filelock-4.2.8 → filelock-4.2.10}/tests/pid_namespace_helpers.py +23 -21
  41. {filelock-4.2.8 → filelock-4.2.10}/tests/process_helpers.py +13 -7
  42. {filelock-4.2.8 → filelock-4.2.10}/tests/read_write_helpers.py +21 -13
  43. {filelock-4.2.8 → filelock-4.2.10}/tests/soft_rw/conftest.py +2 -4
  44. {filelock-4.2.8 → filelock-4.2.10}/tests/soft_rw/test_soft_rw_async.py +179 -125
  45. {filelock-4.2.8 → filelock-4.2.10}/tests/soft_rw/test_soft_rw_protocol.py +242 -232
  46. {filelock-4.2.8 → filelock-4.2.10}/tests/soft_rw/test_soft_rw_storage.py +55 -25
  47. {filelock-4.2.8 → filelock-4.2.10}/tests/soft_rw/test_soft_rw_sync.py +179 -141
  48. {filelock-4.2.8 → filelock-4.2.10}/tests/test_async_filelock.py +241 -203
  49. {filelock-4.2.8 → filelock-4.2.10}/tests/test_async_filelock_acquire_cancellation.py +266 -156
  50. {filelock-4.2.8 → filelock-4.2.10}/tests/test_async_filelock_release_cancellation.py +46 -21
  51. {filelock-4.2.8 → filelock-4.2.10}/tests/test_async_filelock_rollback_agnostic.py +29 -24
  52. {filelock-4.2.8 → filelock-4.2.10}/tests/test_async_filelock_runner_shutdown.py +72 -57
  53. {filelock-4.2.8 → filelock-4.2.10}/tests/test_async_filelock_transition_admission.py +36 -28
  54. {filelock-4.2.8 → filelock-4.2.10}/tests/test_async_read_write.py +249 -112
  55. {filelock-4.2.8 → filelock-4.2.10}/tests/test_async_read_write_cancel_wait.py +17 -10
  56. {filelock-4.2.8 → filelock-4.2.10}/tests/test_async_read_write_cancellation.py +239 -222
  57. {filelock-4.2.8 → filelock-4.2.10}/tests/test_async_read_write_worker_ownership.py +4 -3
  58. {filelock-4.2.8 → filelock-4.2.10}/tests/test_async_soft_contracts.py +6 -4
  59. {filelock-4.2.8 → filelock-4.2.10}/tests/test_async_transition_gate.py +11 -6
  60. {filelock-4.2.8 → filelock-4.2.10}/tests/test_default_mode.py +6 -7
  61. {filelock-4.2.8 → filelock-4.2.10}/tests/test_error.py +8 -7
  62. {filelock-4.2.8 → filelock-4.2.10}/tests/test_filelock.py +644 -481
  63. {filelock-4.2.8 → filelock-4.2.10}/tests/test_fork_backends.py +60 -69
  64. {filelock-4.2.8 → filelock-4.2.10}/tests/test_fork_coordination.py +4 -3
  65. {filelock-4.2.8 → filelock-4.2.10}/tests/test_fork_ownership.py +13 -24
  66. {filelock-4.2.8 → filelock-4.2.10}/tests/test_fork_registries.py +7 -8
  67. {filelock-4.2.8 → filelock-4.2.10}/tests/test_host_name_grammar.py +1 -1
  68. {filelock-4.2.8 → filelock-4.2.10}/tests/test_lazy_import.py +22 -22
  69. {filelock-4.2.8 → filelock-4.2.10}/tests/test_lifetime_validation.py +16 -23
  70. {filelock-4.2.8 → filelock-4.2.10}/tests/test_lock_expiry.py +11 -2
  71. {filelock-4.2.8 → filelock-4.2.10}/tests/test_marker_records.py +17 -7
  72. {filelock-4.2.8 → filelock-4.2.10}/tests/test_process_identity.py +71 -39
  73. {filelock-4.2.8 → filelock-4.2.10}/tests/test_read_write.py +162 -140
  74. {filelock-4.2.8 → filelock-4.2.10}/tests/test_read_write_fork.py +400 -431
  75. {filelock-4.2.8 → filelock-4.2.10}/tests/test_read_write_private_link.py +39 -29
  76. {filelock-4.2.8 → filelock-4.2.10}/tests/test_read_write_unit.py +122 -62
  77. {filelock-4.2.8 → filelock-4.2.10}/tests/test_soft_lease.py +172 -107
  78. {filelock-4.2.8 → filelock-4.2.10}/tests/test_soft_lifetime_warning.py +38 -68
  79. {filelock-4.2.8 → filelock-4.2.10}/tests/test_soft_stale.py +259 -220
  80. {filelock-4.2.8 → filelock-4.2.10}/tests/test_strict_soft.py +11 -13
  81. {filelock-4.2.8 → filelock-4.2.10}/tests/test_strict_soft_compat.py +17 -17
  82. {filelock-4.2.8 → filelock-4.2.10}/tests/test_strict_soft_failures.py +278 -234
  83. {filelock-4.2.8 → filelock-4.2.10}/tests/test_strict_soft_paths.py +24 -28
  84. {filelock-4.2.8 → filelock-4.2.10}/tests/test_strict_soft_races.py +21 -19
  85. {filelock-4.2.8 → filelock-4.2.10}/tests/test_strict_soft_recovery.py +45 -46
  86. {filelock-4.2.8 → filelock-4.2.10}/tests/test_strict_soft_stress.py +10 -9
  87. {filelock-4.2.8 → filelock-4.2.10}/tests/test_subclass_options.py +135 -143
  88. {filelock-4.2.8 → filelock-4.2.10}/tests/test_unix_fallback.py +36 -16
  89. {filelock-4.2.8 → filelock-4.2.10}/tests/test_util.py +21 -15
  90. filelock-4.2.8/src/filelock/_soft_rw/__init__.py +0 -14
  91. {filelock-4.2.8 → filelock-4.2.10}/.gitignore +0 -0
  92. {filelock-4.2.8 → filelock-4.2.10}/LICENSE +0 -0
  93. {filelock-4.2.8 → filelock-4.2.10}/docs/_static/custom.css +0 -0
  94. {filelock-4.2.8 → filelock-4.2.10}/docs/api.rst +0 -0
  95. {filelock-4.2.8 → filelock-4.2.10}/docs/concepts.rst +0 -0
  96. {filelock-4.2.8 → filelock-4.2.10}/docs/example.gif +0 -0
  97. {filelock-4.2.8 → filelock-4.2.10}/docs/how-to.rst +0 -0
  98. {filelock-4.2.8 → filelock-4.2.10}/docs/index.rst +0 -0
  99. {filelock-4.2.8 → filelock-4.2.10}/docs/license.rst +0 -0
  100. {filelock-4.2.8 → filelock-4.2.10}/docs/logo.svg +0 -0
  101. {filelock-4.2.8 → filelock-4.2.10}/docs/tutorials.rst +0 -0
  102. {filelock-4.2.8 → filelock-4.2.10}/src/filelock/_descriptor.py +0 -0
  103. {filelock-4.2.8 → filelock-4.2.10}/src/filelock/_soft_protocol.py +0 -0
  104. {filelock-4.2.8 → filelock-4.2.10}/src/filelock/py.typed +0 -0
  105. {filelock-4.2.8 → filelock-4.2.10}/tasks/capability/assert_fallback.py +0 -0
  106. {filelock-4.2.8 → filelock-4.2.10}/tests/test_descriptor_helpers.py +0 -0
  107. {filelock-4.2.8 → filelock-4.2.10}/tests/test_virtualenv.py +0 -0
  108. {filelock-4.2.8 → filelock-4.2.10}/tox.toml +0 -0
@@ -0,0 +1 @@
1
+ node: f9e562169e2580019e3fd96e66d8e0accf57fe4a
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: filelock
3
- Version: 4.2.8
3
+ Version: 4.2.10
4
4
  Import-Name: filelock
5
5
  Summary: A platform independent file lock.
6
6
  Project-URL: Changelog, https://py-filelock.readthedocs.io/en/latest/changelog.html
@@ -6,6 +6,47 @@
6
6
 
7
7
  .. towncrier release notes start
8
8
 
9
+ .. _release-4-2-10:
10
+
11
+ *********************
12
+ 4.2.10 (2026-11-09)
13
+ *********************
14
+
15
+ .. _release-4-2-10-fixed:
16
+
17
+ Fixed
18
+ =====
19
+
20
+ - Contended :class:`~filelock.FileLock` and :class:`~filelock.SoftFileLock` acquisitions now raise
21
+ :class:`~filelock.Timeout` when elapsed time reaches the requested timeout. A clock that landed exactly on the
22
+ deadline previously left a waiter retrying with zero-length sleeps indefinitely (:pr:`922`) by :user:`gaborbernat`.
23
+
24
+ .. _release-4-2-10-packaging:
25
+
26
+ Packaging
27
+ =========
28
+
29
+ - Every wheel now carries a `PEP 770 <https://peps.python.org/pep-0770/>`_ CycloneDX SBOM in its ``.dist-info/sboms``
30
+ directory, written at build time by `python-sbom <https://github.com/tox-dev/python-sbom>`_ (:pr:`921`) by
31
+ :user:`gaborbernat`.
32
+
33
+ .. _release-4-2-9:
34
+
35
+ ********************
36
+ 4.2.9 (2026-11-04)
37
+ ********************
38
+
39
+ .. _release-4-2-9-fixed:
40
+
41
+ Fixed
42
+ =====
43
+
44
+ - :class:`~filelock.ReadWriteLock`, :class:`~filelock.SoftReadWriteLock` and their async wrappers now raise
45
+ :class:`TypeError` for a *blocking* that is not a :class:`bool`, in the constructor and on acquire, as
46
+ :class:`~filelock.FileLock` already does. Before, ``blocking=0`` waited out the full timeout on a contended
47
+ :class:`~filelock.ReadWriteLock` while ``blocking=False`` failed at once, and a truthy value such as ``"false"``
48
+ turned a single attempt into a blocking wait (:pr:`908`) by :user:`abhishekcpp007` and :user:`gaborbernat`.
49
+
9
50
  .. _release-4-2-8:
10
51
 
11
52
  ********************
@@ -1,4 +1,4 @@
1
- # ruff:ignore[implicit-namespace-package]
1
+ # ruff:ignore[implicit-namespace-package] # Sphinx runs conf.py as a script, not as a package
2
2
  """Configuration for Sphinx."""
3
3
 
4
4
  from __future__ import annotations
@@ -6,7 +6,7 @@ from __future__ import annotations
6
6
  import os
7
7
  from datetime import UTC, datetime
8
8
  from pathlib import Path
9
- from typing import TYPE_CHECKING
9
+ from typing import TYPE_CHECKING, Final
10
10
 
11
11
  from docutils.nodes import Element, Text, reference
12
12
  from sphinx.domains.python import PythonDomain
@@ -22,7 +22,7 @@ if TYPE_CHECKING:
22
22
  name, company = "filelock", "tox-dev"
23
23
  now = datetime.now(tz=UTC)
24
24
  version, release = ".".join(__version__.split(".")[:2]), __version__
25
- copyright = f"2014-{now.date().year}, {company}" # ruff:ignore[builtin-variable-shadowing]
25
+ copyright: Final[str] = f"2014-{now.date().year}, {company}" # ruff:ignore[builtin-variable-shadowing] # Sphinx reads the module-level copyright name
26
26
  extensions = [
27
27
  "sphinx_llm.txt",
28
28
  "sphinx.ext.autodoc",
@@ -41,17 +41,19 @@ extensions = [
41
41
  # raw output lets the browser render the diagrams, so they can follow furo's light/dark toggle. The extension picks the
42
42
  # theme below from the page background and re-renders on every toggle; neutral pairs grays with the semantic tints that
43
43
  # docs/_static/custom.css applies.
44
- mermaid_output_format = "raw"
45
- mermaid_light_theme = "neutral"
44
+ mermaid_output_format: Final[str] = "raw"
45
+ mermaid_light_theme: Final[str] = "neutral"
46
46
 
47
47
  # sphinxcontrib-towncrier: the .. towncrier-draft-entries:: directive in changelog.rst shows the unreleased fragments.
48
- towncrier_draft_autoversion_mode = "draft"
49
- towncrier_draft_include_empty = True # keep the docs build green right after a release, when no fragments remain
48
+ towncrier_draft_autoversion_mode: Final[str] = "draft"
49
+ towncrier_draft_include_empty: Final[bool] = (
50
+ True # keep the docs build green right after a release, when no fragments remain
51
+ )
50
52
  towncrier_draft_working_directory = Path(__file__).parent.parent
51
53
 
52
54
  # sphinx-copybutton: add copy button to code blocks
53
- copybutton_prompt_is_regexp = True
54
- copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: "
55
+ copybutton_prompt_is_regexp: Final[bool] = True
56
+ copybutton_prompt_text: Final[str] = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: "
55
57
 
56
58
  # sphinx-design: no special config needed
57
59
 
@@ -59,18 +61,18 @@ copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: "
59
61
  # sitemap at pages that 404.
60
62
  html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "https://py-filelock.readthedocs.io/en/stable/")
61
63
  # sphinx-sitemap: generate sitemap.xml; html_baseurl already carries the language and version.
62
- sitemap_url_scheme = "{link}"
64
+ sitemap_url_scheme: Final[str] = "{link}"
63
65
  # sphinx-notfound-page: custom 404 pages (no config needed)
64
66
 
65
67
  # sphinxext-opengraph: social media metadata
66
68
  ogp_site_url = html_baseurl
67
69
  ogp_social_cards = {"enable": False}
68
- ogp_use_first_image = True
69
- ogp_description_length = 200
70
+ ogp_use_first_image: Final[bool] = True
71
+ ogp_description_length: Final[int] = 200
70
72
 
71
- html_theme = "furo"
72
- html_logo = "logo.svg"
73
- html_favicon = "logo.svg"
73
+ html_theme: Final[str] = "furo"
74
+ html_logo: Final[str] = "logo.svg"
75
+ html_favicon: Final[str] = "logo.svg"
74
76
  html_static_path = ["_static"]
75
77
  html_css_files = ["custom.css"]
76
78
  html_title, html_last_updated_fmt = name, now.isoformat()
@@ -79,11 +81,11 @@ autoclass_content, autodoc_member_order, autodoc_typehints = "both", "bysource",
79
81
  # _typeshed exists only inside type checkers; sphinx-autodoc-typehints executes TYPE_CHECKING imports to resolve hints.
80
82
  autodoc_mock_imports = ["_typeshed"]
81
83
  autodoc_default_options = {"member-order": "bysource", "undoc-members": True, "show-inheritance": True}
82
- autosectionlabel_prefix_document = True
83
- autosectionlabel_maxdepth = 2
84
+ autosectionlabel_prefix_document: Final[bool] = True
85
+ autosectionlabel_maxdepth: Final[int] = 2
84
86
 
85
87
  intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}
86
- nitpicky = True
88
+ nitpicky: Final[bool] = True
87
89
  # show-inheritance renders AcquireReturnProxy's Generic[_LockT] base; the type variable is private and undocumented.
88
90
  nitpick_ignore = [("py:obj", "filelock._api._LockT")]
89
91
  # Towncrier news fragments are rST snippets folded into changelog.rst at release; they are not standalone pages.
@@ -96,20 +98,16 @@ extlinks = {
96
98
 
97
99
 
98
100
  def setup(app: Sphinx) -> None:
99
- """
100
- Setup app.
101
-
102
- :param app: the app
103
-
104
- """
105
-
101
+ # Setup app.
102
+ #
103
+ # :param app: the app
106
104
  class PatchedPythonDomain(PythonDomain):
107
- def resolve_xref( # ruff:ignore[too-many-arguments, too-many-positional-arguments]
105
+ def resolve_xref( # ruff:ignore[too-many-arguments, too-many-positional-arguments] # overrides Sphinx's signature
108
106
  self,
109
107
  env: BuildEnvironment,
110
108
  fromdocname: str,
111
109
  builder: Builder,
112
- type: str, # ruff:ignore[builtin-argument-shadowing]
110
+ type: str, # ruff:ignore[builtin-argument-shadowing] # Sphinx's resolve_xref names this parameter type
113
111
  target: str,
114
112
  node: pending_xref,
115
113
  contnode: Element,
@@ -4,6 +4,7 @@ requires = [
4
4
  "hatch-fancy-pypi-readme>=25.1",
5
5
  "hatch-vcs>=0.5",
6
6
  "hatchling>=1.29",
7
+ "python-sbom[hatch]>=0.1.2",
7
8
  ]
8
9
 
9
10
  [project]
@@ -87,6 +88,7 @@ build = [
87
88
  "hatch-fancy-pypi-readme>=25.1",
88
89
  "hatch-vcs>=0.5",
89
90
  "hatchling>=1.29",
91
+ "python-sbom[hatch]>=0.1.2",
90
92
  "setuptools>=80",
91
93
  ]
92
94
  coverage = [
@@ -125,6 +127,7 @@ version.source = "vcs"
125
127
  metadata.hooks.fancy-pypi-readme.content-type = "text/markdown"
126
128
  metadata.hooks.fancy-pypi-readme.fragments = [ { path = "README.md" } ]
127
129
  build.hooks.vcs.version-file = "src/filelock/version.py"
130
+ build.hooks.python-sbom = {}
128
131
  build.targets.sdist.include = [
129
132
  "/docs",
130
133
  "/src",
@@ -163,6 +166,12 @@ lint.ignore = [
163
166
  "non-empty-init-module", # `__init__` module should only contain docstrings and re-exports
164
167
  "non-imperative-mood", # First line of docstring should be in imperative mood
165
168
  "single-line-implicit-string-concatenation", # Conflict with formatter
169
+ "undocumented-magic-method", # undocumented-public-api (simplint SMP903) covers the public API instead
170
+ "undocumented-public-class", # undocumented-public-api (simplint SMP903) covers the public API instead
171
+ "undocumented-public-function", # undocumented-public-api (simplint SMP903) covers the public API instead
172
+ "undocumented-public-init", # undocumented-public-api (simplint SMP903) covers the public API instead
173
+ "undocumented-public-method", # undocumented-public-api (simplint SMP903) covers the public API instead
174
+ "undocumented-public-nested-class", # undocumented-public-api (simplint SMP903) covers the public API instead
166
175
  ]
167
176
  lint.per-file-ignores."tasks/**/*.py" = [
168
177
  "assert", # asserts state the platform a Windows-only script already refuses to run outside of, narrowing it for ty
@@ -309,6 +318,9 @@ standalone.lazy-exclude-modules = [
309
318
  "sqlite3",
310
319
  ]
311
320
 
321
+ [tool.python-sbom]
322
+ supplier = { name = "tox-dev", url = [ "https://github.com/tox-dev" ] }
323
+
312
324
  [tool.nab]
313
325
  mode = "universal"
314
326
  base-group = "project-runtime"
@@ -316,6 +328,13 @@ uploaded-prior-to = "P7D"
316
328
  decision-order = "stable"
317
329
  matrix.python = ">=3.15,<3.16"
318
330
  matrix.platforms = [ "linux_x86_64" ]
319
- # release-creator 4.4.0 needs a seven-day cutoff exception through 2026-11-09.
331
+ # release-creator 4.4.0 needs a seven-day cutoff exception.
332
+ # expires 2026-11-09
320
333
  # expires 2026-11-09
321
334
  packages.release-creator.uploaded-prior-to = 2026-11-02T21:45:00Z
335
+ # python-sbom 0.1.2 needs a seven-day cutoff exception.
336
+ # expires 2026-11-15
337
+ packages.python-sbom.uploaded-prior-to = 2026-11-08T17:54:00Z
338
+
339
+ [tool.simplint]
340
+ docstring-style = "rst"
@@ -14,29 +14,30 @@ from __future__ import annotations
14
14
 
15
15
  __lazy_modules__ = ["filelock._descriptor", "filelock._error", "importlib"]
16
16
 
17
- import sys
18
- import warnings
19
- from importlib import import_module
20
- from typing import TYPE_CHECKING, Final
17
+ import sys # simplint: ignore[SMP407] # lazy loader and platform selection live here
18
+ import warnings # simplint: ignore[SMP407] # lazy loader and platform selection live here
19
+ from importlib import import_module # simplint: ignore[SMP407] # PEP 562 loader imports submodules by name
20
+ from typing import TYPE_CHECKING, Final # simplint: ignore[SMP407] # TYPE_CHECKING and Final for module constants
21
21
 
22
22
  from filelock._api import AcquireReturnProxy, BaseFileLock, CloseErrorPolicy, ContextErrorPolicy, LockOptions
23
23
  from filelock._descriptor import lock_descriptor, unlock_descriptor
24
24
  from filelock._error import LeaseSettingsMismatch, SoftFileLockLifetimeWarning, SoftFileLockProtocolError, Timeout
25
25
  from filelock._unix import UnixFileLock
26
- from filelock._unix import has_fcntl as _has_fcntl
26
+ from filelock._unix import has_fcntl as _has_fcntl # simplint: ignore[SMP407] # private probe feeding public has_fcntl
27
27
  from filelock._windows import WindowsFileLock
28
28
 
29
29
  # Keeps ``filelock.version`` the string 4.0.12 exposed rather than the submodule.
30
- from filelock.version import version
30
+ from filelock.version import version # simplint: ignore[SMP407] # API exposes filelock.version as this string
31
31
 
32
- if TYPE_CHECKING:
32
+ if TYPE_CHECKING: # simplint: ignore[SMP407] # type-checker platform lock aliases
33
33
  from filelock import asyncio
34
34
  from filelock._async_read_write import AsyncAcquireReadWriteReturnProxy, AsyncReadWriteLock
35
35
  from filelock._lease import CompromiseReason, LeaseCompromise, SoftFileLease
36
36
  from filelock._marker import MarkerSoftFileLock, OwnerMode, OwnerRecord
37
37
  from filelock._read_write import ReadWriteLock
38
38
  from filelock._soft import SoftFileLock
39
- from filelock._soft_rw import AsyncAcquireSoftReadWriteReturnProxy, AsyncSoftReadWriteLock, SoftReadWriteLock
39
+ from filelock._soft_rw._async import AsyncAcquireSoftReadWriteReturnProxy, AsyncSoftReadWriteLock
40
+ from filelock._soft_rw._sync import SoftReadWriteLock
40
41
  from filelock._strict import StrictSoftFileClaim, StrictSoftFileClaimState, StrictSoftFileLock
41
42
  from filelock.asyncio import (
42
43
  AsyncAcquireReturnProxy,
@@ -49,16 +50,16 @@ if TYPE_CHECKING:
49
50
  )
50
51
 
51
52
  #: version of the project as a string
52
- __version__: Final[str] = version
53
+ __version__: Final[str] = version # simplint: ignore[SMP407] # public __version__ is a Final assignment
53
54
 
54
55
  #: ``True`` when :func:`fcntl.flock` is available. Off Windows, :data:`FileLock` then resolves to
55
56
  #: :class:`UnixFileLock`, otherwise to :class:`SoftFileLock`. Always ``False`` on Windows.
56
57
  #:
57
58
  #: :meta hide-value:
58
- has_fcntl: Final[bool] = _has_fcntl
59
+ has_fcntl: Final[bool] = _has_fcntl # simplint: ignore[SMP102, SMP407] # public name; renaming breaks importers
59
60
 
60
61
 
61
- if sys.platform == "win32": # pragma: win32 cover
62
+ if sys.platform == "win32": # pragma: win32 cover # simplint: ignore[SMP407] # platform selection runs at import
62
63
  _FileLock: type[BaseFileLock] = WindowsFileLock
63
64
  else: # pragma: win32 no cover # ruff:ignore[collapsible-else-if] # the else carries the win32 no-cover pragma
64
65
  if has_fcntl:
@@ -69,23 +70,25 @@ else: # pragma: win32 no cover # ruff:ignore[collapsible-else-if] # the else c
69
70
  _FileLock = SoftFileLock
70
71
  warnings.warn("only soft file lock is available", stacklevel=2)
71
72
 
72
- if TYPE_CHECKING:
73
+ if TYPE_CHECKING: # simplint: ignore[SMP407] # type-checker FileLock alias
74
+ #: Alias for the lock, which should be used for the current platform.
73
75
  FileLock = SoftFileLock
76
+ #: Alias for the async lock, which should be used for the current platform.
74
77
  AsyncFileLock = AsyncSoftFileLock
75
78
  else:
76
79
  #: Alias for the lock, which should be used for the current platform.
77
80
  FileLock = _FileLock
78
81
 
79
82
  # Importing asyncio and sqlite3 costs more than the rest of the package, so names that need them load on first access.
80
- _LAZY_ATTRIBUTES: Final[dict[str, str]] = {
83
+ _LAZY_ATTRIBUTES: Final[dict[str, str]] = { # simplint: ignore[SMP407] # lookup read by PEP 562 __getattr__
81
84
  "AsyncAcquireReadWriteReturnProxy": "._async_read_write",
82
85
  "AsyncAcquireReturnProxy": ".asyncio",
83
- "AsyncAcquireSoftReadWriteReturnProxy": "._soft_rw",
86
+ "AsyncAcquireSoftReadWriteReturnProxy": "._soft_rw._async",
84
87
  "AsyncFileLock": ".asyncio",
85
88
  "AsyncReadWriteLock": "._async_read_write",
86
89
  "AsyncSoftFileLease": ".asyncio",
87
90
  "AsyncSoftFileLock": ".asyncio",
88
- "AsyncSoftReadWriteLock": "._soft_rw",
91
+ "AsyncSoftReadWriteLock": "._soft_rw._async",
89
92
  "AsyncStrictSoftFileLock": ".asyncio",
90
93
  "AsyncUnixFileLock": ".asyncio",
91
94
  "AsyncWindowsFileLock": ".asyncio",
@@ -98,7 +101,7 @@ _LAZY_ATTRIBUTES: Final[dict[str, str]] = {
98
101
  "ReadWriteLock": "._read_write",
99
102
  "SoftFileLease": "._lease",
100
103
  "SoftFileLock": "._soft",
101
- "SoftReadWriteLock": "._soft_rw",
104
+ "SoftReadWriteLock": "._soft_rw._sync",
102
105
  "StrictSoftFileClaim": "._strict",
103
106
  "StrictSoftFileClaimState": "._strict",
104
107
  "StrictSoftFileLock": "._strict",
@@ -106,7 +109,9 @@ _LAZY_ATTRIBUTES: Final[dict[str, str]] = {
106
109
  }
107
110
 
108
111
 
109
- def __getattr__(name: str) -> object:
112
+ def __getattr__( # simplint: ignore[SMP407] # PEP 562 __getattr__ lives here
113
+ name: str,
114
+ ) -> object: # simplint: ignore[SMP602] # lazy attributes span several types
110
115
  if (module_name := _LAZY_ATTRIBUTES.get(name)) is None:
111
116
  msg = f"module {__name__!r} has no attribute {name!r}"
112
117
  raise AttributeError(msg)
@@ -128,7 +133,7 @@ def __getattr__(name: str) -> object:
128
133
  return value
129
134
 
130
135
 
131
- def __dir__() -> list[str]:
136
+ def __dir__() -> list[str]: # simplint: ignore[SMP407] # PEP 562 __dir__ lives here
132
137
  return sorted({*globals(), *_LAZY_ATTRIBUTES})
133
138
 
134
139