check-empty 4.1.0__tar.gz → 4.1.2__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: check-empty
3
- Version: 4.1.0
3
+ Version: 4.1.2
4
4
  Summary: Command-line utility, as well as a hook usable by the Python pre-commit framework, and a GitHub Action, to ensure that selected files are empty.
5
5
  Keywords: check,command-line,empty,files,github-action,helper,hook,lightweight,pre-commit,prek,tool,utility
6
6
  Author: Jonathan Dung
@@ -24,9 +24,9 @@ Classifier: Programming Language :: Python :: 3.16
24
24
  Classifier: Programming Language :: Python :: Free Threading :: 3 - Stable
25
25
  Classifier: Topic :: Utilities
26
26
  Classifier: Typing :: Typed
27
- Requires-Dist: py7zr==1.1.3 ; extra == '7z'
27
+ Requires-Dist: py7zr==1.1.4 ; extra == '7z'
28
28
  Requires-Dist: acefile==0.6.14 ; extra == 'ace'
29
- Requires-Dist: check-empty[7z,ace,ar,lzh,rar]==4.1.0 ; extra == 'all'
29
+ Requires-Dist: check-empty[7z,ace,ar,lzh,rar]==4.1.2 ; extra == 'all'
30
30
  Requires-Dist: arpy==2.4.0 ; extra == 'ar'
31
31
  Requires-Dist: lhafile==0.3.1 ; extra == 'lzh'
32
32
  Requires-Dist: rarfile==4.5 ; extra == 'rar'
@@ -41,7 +41,7 @@ Provides-Extra: lzh
41
41
  Provides-Extra: rar
42
42
  Description-Content-Type: text/markdown
43
43
 
44
- # [check-empty](https://pypi.org/project/check-empty/4.1.0)
44
+ # [check-empty](https://pypi.org/project/check-empty/4.1.2)
45
45
 
46
46
  [![#StandWithPalestine](https://raw.githubusercontent.com/TheBSD/StandWithPalestine/main/badges/StandWithPalestine.svg)](https://github.com/TheBSD/StandWithPalestine/blob/main/docs/README.md)
47
47
 
@@ -56,7 +56,7 @@ specified.
56
56
 
57
57
  ## Prerequisites
58
58
 
59
- Supports every Python 3.11 runtime. There are no other requirements unless you want to
59
+ Supports every Python 3.11+ runtime. There are no other requirements unless you want to
60
60
  check if files in certain types of (compressed) archives are empty.
61
61
 
62
62
  ## Quickstart
@@ -125,15 +125,15 @@ As a pre-commit hook:
125
125
  # .pre-commit-config.yaml
126
126
  repos:
127
127
  - repo: https://github.com/jonathandung/check-empty
128
- rev: v4.1.0 # repository version
128
+ rev: v4.1.2 # repository version
129
129
  hooks:
130
- - id: check-empty # the hook
131
- args: # example list of arguments
132
- - -Q # flag to decrease output, applicable twice (shorthand for --quiet)
133
- files: ^src/mylib/py\.typed|docs/\.nojekyll|static/\.gitkeep|some_dir/.*|.*\.lock$
134
- # paths to files/directories to clear or keep empty as a single regular
135
- # expression (as per the somewhat restrictive pre-commit config schema),
136
- # relative to project root
130
+ - id: check-empty # the hook
131
+ args: # example list of arguments
132
+ - -Q # flag to decrease output, applicable twice (shorthand for --quiet)
133
+ files: ^src/mylib/py\.typed|docs/\.nojekyll|static/\.gitkeep|some_dir/.*|.*\.lock$
134
+ # paths to files/directories to clear or keep empty as a single regular
135
+ # expression (as per the somewhat restrictive pre-commit config schema),
136
+ # relative to project root
137
137
  ```
138
138
 
139
139
  equivalent in `prek.toml` format:
@@ -141,7 +141,7 @@ equivalent in `prek.toml` format:
141
141
  ```toml
142
142
  [[repos]]
143
143
  repo = "https://github.com/jonathandung/check-empty"
144
- rev = "v4.1.0"
144
+ rev = "v4.1.2"
145
145
 
146
146
  [[repos.hooks]]
147
147
  id = "check-empty"
@@ -165,7 +165,7 @@ or (TOML 1.1+):
165
165
  # using multiline inline tables
166
166
  [[repos]]
167
167
  repo = "https://github.com/jonathandung/check-empty"
168
- rev = "v4.1.0"
168
+ rev = "v4.1.2"
169
169
  hooks = [{
170
170
  id = "check-empty",
171
171
  args = ["-Q"],
@@ -185,11 +185,11 @@ As a GitHub Actions workflow step:
185
185
 
186
186
  ```yaml
187
187
  steps:
188
- - uses: jonathandung/check-empty@v4.1.0 # the latest version on the GitHub Actions
188
+ - uses: jonathandung/check-empty@v4.1.2 # the latest version on the GitHub Actions
189
189
  # marketplace; this step will fail and subsequent jobs will not run if any file is
190
190
  # not empty
191
191
  with:
192
- python-version: '3.14' # run the script on the latest stable Python version
192
+ python-version: '3.15' # run the script on the latest stable Python version
193
193
  filenames: |
194
194
  src/mylib/py.typed
195
195
  docs/.nojekyll
@@ -244,7 +244,7 @@ to read the
244
244
  and the
245
245
  [contributing guide](https://github.com/jonathandung/.github/blob/main/CONTRIBUTING.md).
246
246
 
247
- To build the docs locally (needs Python 3.12+ because of Sphinx), install the package
247
+ To build the docs locally (needs Python 3.13+ because of Sphinx), install the package
248
248
  with the `docs`
249
249
  [group](https://packaging.python.org/en/latest/specifications/dependency-groups) using
250
250
  a package manager that supports it (e.g. pip 25.1+ or uv 0.4.27+), preferably into a
@@ -256,4 +256,4 @@ Tests are run with:
256
256
  python -m test_check_empty
257
257
  ```
258
258
 
259
- at the project root. `pytest` is not needed.
259
+ at the project root.
@@ -1,4 +1,4 @@
1
- # [check-empty](https://pypi.org/project/check-empty/4.1.0)
1
+ # [check-empty](https://pypi.org/project/check-empty/4.1.2)
2
2
 
3
3
  [![#StandWithPalestine](https://raw.githubusercontent.com/TheBSD/StandWithPalestine/main/badges/StandWithPalestine.svg)](https://github.com/TheBSD/StandWithPalestine/blob/main/docs/README.md)
4
4
 
@@ -13,7 +13,7 @@ specified.
13
13
 
14
14
  ## Prerequisites
15
15
 
16
- Supports every Python 3.11 runtime. There are no other requirements unless you want to
16
+ Supports every Python 3.11+ runtime. There are no other requirements unless you want to
17
17
  check if files in certain types of (compressed) archives are empty.
18
18
 
19
19
  ## Quickstart
@@ -82,15 +82,15 @@ As a pre-commit hook:
82
82
  # .pre-commit-config.yaml
83
83
  repos:
84
84
  - repo: https://github.com/jonathandung/check-empty
85
- rev: v4.1.0 # repository version
85
+ rev: v4.1.2 # repository version
86
86
  hooks:
87
- - id: check-empty # the hook
88
- args: # example list of arguments
89
- - -Q # flag to decrease output, applicable twice (shorthand for --quiet)
90
- files: ^src/mylib/py\.typed|docs/\.nojekyll|static/\.gitkeep|some_dir/.*|.*\.lock$
91
- # paths to files/directories to clear or keep empty as a single regular
92
- # expression (as per the somewhat restrictive pre-commit config schema),
93
- # relative to project root
87
+ - id: check-empty # the hook
88
+ args: # example list of arguments
89
+ - -Q # flag to decrease output, applicable twice (shorthand for --quiet)
90
+ files: ^src/mylib/py\.typed|docs/\.nojekyll|static/\.gitkeep|some_dir/.*|.*\.lock$
91
+ # paths to files/directories to clear or keep empty as a single regular
92
+ # expression (as per the somewhat restrictive pre-commit config schema),
93
+ # relative to project root
94
94
  ```
95
95
 
96
96
  equivalent in `prek.toml` format:
@@ -98,7 +98,7 @@ equivalent in `prek.toml` format:
98
98
  ```toml
99
99
  [[repos]]
100
100
  repo = "https://github.com/jonathandung/check-empty"
101
- rev = "v4.1.0"
101
+ rev = "v4.1.2"
102
102
 
103
103
  [[repos.hooks]]
104
104
  id = "check-empty"
@@ -122,7 +122,7 @@ or (TOML 1.1+):
122
122
  # using multiline inline tables
123
123
  [[repos]]
124
124
  repo = "https://github.com/jonathandung/check-empty"
125
- rev = "v4.1.0"
125
+ rev = "v4.1.2"
126
126
  hooks = [{
127
127
  id = "check-empty",
128
128
  args = ["-Q"],
@@ -142,11 +142,11 @@ As a GitHub Actions workflow step:
142
142
 
143
143
  ```yaml
144
144
  steps:
145
- - uses: jonathandung/check-empty@v4.1.0 # the latest version on the GitHub Actions
145
+ - uses: jonathandung/check-empty@v4.1.2 # the latest version on the GitHub Actions
146
146
  # marketplace; this step will fail and subsequent jobs will not run if any file is
147
147
  # not empty
148
148
  with:
149
- python-version: '3.14' # run the script on the latest stable Python version
149
+ python-version: '3.15' # run the script on the latest stable Python version
150
150
  filenames: |
151
151
  src/mylib/py.typed
152
152
  docs/.nojekyll
@@ -201,7 +201,7 @@ to read the
201
201
  and the
202
202
  [contributing guide](https://github.com/jonathandung/.github/blob/main/CONTRIBUTING.md).
203
203
 
204
- To build the docs locally (needs Python 3.12+ because of Sphinx), install the package
204
+ To build the docs locally (needs Python 3.13+ because of Sphinx), install the package
205
205
  with the `docs`
206
206
  [group](https://packaging.python.org/en/latest/specifications/dependency-groups) using
207
207
  a package manager that supports it (e.g. pip 25.1+ or uv 0.4.27+), preferably into a
@@ -213,4 +213,4 @@ Tests are run with:
213
213
  python -m test_check_empty
214
214
  ```
215
215
 
216
- at the project root. `pytest` is not needed.
216
+ at the project root.
@@ -10,7 +10,7 @@ from __future__ import annotations
10
10
  from check_empty import constants, reporter
11
11
 
12
12
  __all__ = ('Handler', 'check', 'default_reporter')
13
- __version__ = '4.1.0'
13
+ __version__ = '4.1.2'
14
14
  """The version of the package."""
15
15
  default_reporter: reporter.Reporter = reporter.Reporter()
16
16
  """The default reporter used by :func:`check`."""
@@ -209,7 +209,7 @@ def check(
209
209
 
210
210
  if tr and v(tr.open, tr.TarError):
211
211
  aa(a)
212
- for r in d.getmembers():
212
+ for r in d.getmembers(): # ruff: ignore[undefined-local]
213
213
  a, s = q = r.name, r.size
214
214
  e()
215
215
  av.purge_tar(d) if clear else d.close()
@@ -319,8 +319,12 @@ def check(
319
319
  t += s
320
320
  if clear:
321
321
  Handler(*i, a).o()
322
- x, d = k[1] if z is None else len(z) - 1, k[2] if w is None else len(w)
323
- y, p = k[3] if r is None else len(r), k[0] if b is None else len(b) - 1
322
+ x, d, y, p = (
323
+ k[1] if z is None else len(z) - 1,
324
+ k[2] if w is None else len(w),
325
+ k[3] if r is None else len(r),
326
+ k[0] if b is None else len(b) - 1,
327
+ )
324
328
  reporter.report(z, v, b, ra, r, w, x, y, d, p, n, t, verbosity, clear)
325
329
  reporter.reset_out()
326
330
  return reporter.calculate_result(*map(bool, (y, x and not may_not_exist, d)))
@@ -62,7 +62,7 @@ def main(argv: Iterable[str] | None = None) -> int:
62
62
  try:
63
63
  n = _p.parse_args(argv)
64
64
  except SystemExit as e:
65
- return e.code # ty: ignore[invalid-return-type]
65
+ return e.code # ty: ignore[invalid-explicit-return]
66
66
  o = n.out
67
67
  if o is not None:
68
68
  # ruff: ignore[open-file-with-context-handler]
@@ -89,11 +89,11 @@ def purge_ar(a: Archive, g: int) -> None:
89
89
  q = __import__('itertools').filterfalse(
90
90
  AR_SKIP.__contains__, map(__import__('operator').attrgetter('name'), i)
91
91
  )
92
- _gnu(tuple(q), w) if i[0].type == g else _bsd(q, w)
92
+ __gnu(tuple(q), w) if i[0].type == g else __bsd(q, w)
93
93
  os.replace(f.name, n)
94
94
 
95
95
 
96
- def _bsd(q: Iterable[bytes], w: Callable[[bytes], int]) -> None:
96
+ def __bsd(q: Iterable[bytes], w: Callable[[bytes], int]) -> None:
97
97
  """Clear the contents of each file in a BSD .a, .ar or .lib archive."""
98
98
  for m in q:
99
99
  x = len(m)
@@ -101,7 +101,7 @@ def _bsd(q: Iterable[bytes], w: Callable[[bytes], int]) -> None:
101
101
  w(AR_FS % (b'#1/%d' % x if b else m, x, m if b else b''))
102
102
 
103
103
 
104
- def _gnu(q: tuple[bytes, ...], w: Callable[[bytes], int]) -> None:
104
+ def __gnu(q: tuple[bytes, ...], w: Callable[[bytes], int]) -> None:
105
105
  """Clear the contents of each file in a GNU .a, .ar or .lib archive."""
106
106
  c, d = 0, {}
107
107
  for m in q:
@@ -5,10 +5,10 @@ from __future__ import annotations
5
5
  import os
6
6
 
7
7
  __all__ = (
8
+ 'ARCHIVE_FORMATS',
8
9
  'DIRFD_UNSUPPORTED',
9
10
  'ENOENT',
10
11
  'S_IFDIR',
11
- 'TYPE_CHECKING',
12
12
  'TYPE_MASK',
13
13
  'RecurseInto',
14
14
  )
@@ -16,17 +16,17 @@ TYPE_CHECKING = False
16
16
  if TYPE_CHECKING:
17
17
  from typing import Final
18
18
  TYPE_MASK: Final = 0xF000
19
- """The mask that extracts the type of a file from its mode bits from :func:`os.stat`."""
19
+ """The mask that extracts the type of a file from its mode bits using bitwise and."""
20
20
  S_IFDIR: Final = 0x4000
21
21
  """Equal to :data:`stat.S_IFDIR`."""
22
22
  ENOENT: Final = 2
23
23
  """Equal to :data:`errno.ENOENT`."""
24
- DIRFD_UNSUPPORTED: Final[BaseException] = (
24
+ DIRFD_UNSUPPORTED: Final = (
25
25
  SystemError('got directory descriptor on Windows')
26
26
  if os.name == 'nt'
27
27
  else NotImplementedError('directory descriptors are not supported')
28
28
  )
29
- """Error raised when a directory descriptor is passed to :func:`~check_empty.check`."""
29
+ """The error raised when :func:`~check_empty.check` gets a directory descriptor."""
30
30
 
31
31
 
32
32
  class RecurseInto(__import__('enum').IntFlag):
@@ -49,14 +49,15 @@ class RecurseInto(__import__('enum').IntFlag):
49
49
  TYPICAL = 15
50
50
  """Recurse into the most common archive types, namely .zip, .tar, .7z, and .rar."""
51
51
  AR = 16
52
- """Recurse into .a, .ar and .lib archives; requires :mod:`!arpy`."""
52
+ """Recurse into .a, .ar and .lib archives; requires `arpy <https://github.com/onekey-sec/arpy>`__."""
53
53
  LZH = 32
54
- """Recurse into .lzh and .lha archives; requires :mod:`!lhafile`."""
54
+ """Recurse into .lzh and .lha archives; requires `lhafile <https://github.com/FrodeSolheim/python-lhafile>`__."""
55
55
  ACE = 64
56
- """Recurse into .ace archives; requires :mod:`!acefile`."""
56
+ """Recurse into .ace archives; requires `acefile <https://apidoc.roe.ch/acefile/latest>`__."""
57
57
  ALL = 127
58
- """Recurse into all archive types."""
58
+ """Recurse into all supported archive types."""
59
59
 
60
60
 
61
61
  ARCHIVE_FORMATS: Final = tuple(RecurseInto)
62
+ """A tuple of the flags corresponding to each supported archive type ordered by bit."""
62
63
  del os, TYPE_CHECKING
@@ -1,14 +1,13 @@
1
1
  [build-system]
2
- requires = ["uv_build>=0.13.0"]
2
+ requires = ["uv_build>=0.13.9"]
3
3
  build-backend = "uv_build"
4
4
 
5
5
  [dependency-groups]
6
6
  docs = [
7
7
  "furo==2025.12.19",
8
- "sphinx==9.1.0",
9
- "sphinx-argparse-cli==1.22.1",
8
+ "sphinx==9.2.0",
9
+ "sphinx-argparse-cli==1.24.2",
10
10
  "sphinx-copybutton==0.5.2",
11
- "sphinx-lint==1.0.2",
12
11
  "sphinx-notfound-page==1.1.0",
13
12
  ]
14
13
 
@@ -54,7 +53,7 @@ license-files = [
54
53
  name = "check-empty"
55
54
  readme = "README.md"
56
55
  requires-python = ">=3.11"
57
- version = "4.1.0"
56
+ version = "4.1.2"
58
57
 
59
58
  [[project.authors]]
60
59
  name = "Jonathan Dung"
@@ -65,9 +64,9 @@ name = "Jonathan Dung"
65
64
  email = "jonathandung@yahoo.com"
66
65
 
67
66
  [project.optional-dependencies]
68
- 7z = ["py7zr==1.1.3"]
67
+ 7z = ["py7zr==1.1.4"]
69
68
  ace = ["acefile==0.6.14"]
70
- all = ["check-empty[7z,ace,ar,lzh,rar]==4.1.0"]
69
+ all = ["check-empty[7z,ace,ar,lzh,rar]==4.1.2"]
71
70
  ar = ["arpy==2.4.0"]
72
71
  lzh = ["lhafile==0.3.1"]
73
72
  rar = ["rarfile==4.5"]
@@ -76,7 +75,7 @@ rar = ["rarfile==4.5"]
76
75
  check-empty = "check_empty.__main__:main"
77
76
 
78
77
  [tool.ruff]
79
- required-version = ">=0.17.0"
78
+ required-version = ">=0.17.6"
80
79
  target-version = "py311"
81
80
 
82
81
  [tool.ruff.analyze]
@@ -133,17 +132,6 @@ combine-as-imports = true
133
132
  [tool.ruff.lint.pydocstyle]
134
133
  convention = "google"
135
134
 
136
- [tool.ty.analysis]
137
- respect-type-ignore-comments = false
138
-
139
- [tool.ty.environment]
140
- python-version = "3.11"
141
- python-platform = "all"
142
-
143
- [tool.ty.rules]
144
- all = "error"
145
- missing-override-decorator = "ignore"
146
-
147
135
  [[tool.ty.overrides]]
148
136
  include = ["check_empty/__init__.py"]
149
137
 
@@ -156,14 +144,26 @@ unsound-assignment = "ignore"
156
144
  include = ["check_empty/reporter/exceptions.py"]
157
145
 
158
146
  [tool.ty.overrides.rules]
159
- invalid-mutable-override = "ignore"
147
+ incompatible-mutable-override = "ignore"
148
+
149
+ [tool.ty.analysis]
150
+ respect-type-ignore-comments = false
151
+
152
+ [tool.ty.environment]
153
+ python-version = "3.11"
154
+ python-platform = "all"
155
+
156
+ [tool.ty.rules]
157
+ all = "error"
158
+ missing-override-decorator = "ignore"
160
159
 
161
160
  [tool.uv]
162
- required-version = ">=0.13.0"
161
+ preview = true
162
+ required-version = ">=0.13.9"
163
163
 
164
164
  [tool.uv.build-backend]
165
165
  module-name = "check_empty"
166
166
  module-root = ""
167
167
 
168
168
  [tool.uv.dependency-groups.docs]
169
- requires-python = ">=3.12"
169
+ requires-python = ">=3.13"
@@ -1,9 +1,9 @@
1
1
  [build-system]
2
- requires = ["uv_build>=0.13.0"]
2
+ requires = ["uv_build>=0.13.9"]
3
3
  build-backend = "uv_build"
4
4
 
5
5
  [dependency-groups]
6
- docs = ["furo==2025.12.19", "sphinx==9.1.0", "sphinx-argparse-cli==1.22.1", "sphinx-copybutton==0.5.2", "sphinx-lint==1.0.2", "sphinx-notfound-page==1.1.0"]
6
+ docs = ["furo==2025.12.19", "sphinx==9.2.0", "sphinx-argparse-cli==1.24.2", "sphinx-copybutton==0.5.2", "sphinx-notfound-page==1.1.0"]
7
7
 
8
8
  [project]
9
9
  authors = [{name = "Jonathan Dung", email = "jonathandung@yahoo.com"}]
@@ -16,12 +16,12 @@ maintainers = [{name = "Jonathan Dung", email = "jonathandung@yahoo.com"}]
16
16
  name = "check-empty"
17
17
  readme = "README.md"
18
18
  requires-python = ">=3.11"
19
- version = "4.1.0"
19
+ version = "4.1.2"
20
20
 
21
21
  [project.optional-dependencies]
22
- "7z" = ["py7zr==1.1.3"]
22
+ "7z" = ["py7zr==1.1.4"]
23
23
  ace = ["acefile==0.6.14"]
24
- all = ["check-empty[7z,ace,ar,lzh,rar]==4.1.0"]
24
+ all = ["check-empty[7z,ace,ar,lzh,rar]==4.1.2"]
25
25
  ar = ["arpy==2.4.0"]
26
26
  lzh = ["lhafile==0.3.1"]
27
27
  rar = ["rarfile==4.5"]
@@ -30,7 +30,7 @@ rar = ["rarfile==4.5"]
30
30
  check-empty = "check_empty.__main__:main"
31
31
 
32
32
  [tool.ruff]
33
- required-version = ">=0.17.0"
33
+ required-version = ">=0.17.6"
34
34
  target-version = "py311"
35
35
 
36
36
  [tool.ruff.analyze]
@@ -66,6 +66,12 @@ combine-as-imports = true
66
66
  [tool.ruff.lint.pydocstyle]
67
67
  convention = "google"
68
68
 
69
+ [tool.ty]
70
+ overrides = [
71
+ {include = ["check_empty/__init__.py"], rules = {possibly-unresolved-reference = "ignore", redundant-condition = "ignore", unsound-assignment = "ignore"}},
72
+ {include = ["check_empty/reporter/exceptions.py"], rules = {incompatible-mutable-override = "ignore"}}
73
+ ]
74
+
69
75
  [tool.ty.analysis]
70
76
  respect-type-ignore-comments = false
71
77
 
@@ -77,20 +83,13 @@ python-platform = "all"
77
83
  all = "error"
78
84
  missing-override-decorator = "ignore"
79
85
 
80
- [[tool.ty.overrides]]
81
- include = ["check_empty/__init__.py"]
82
- rules = {possibly-unresolved-reference = "ignore", redundant-condition = "ignore", unsound-assignment = "ignore"}
83
-
84
- [[tool.ty.overrides]]
85
- include = ["check_empty/reporter/exceptions.py"]
86
- rules = {invalid-mutable-override = "ignore"}
87
-
88
86
  [tool.uv]
89
- required-version = ">=0.13.0"
87
+ preview = true
88
+ required-version = ">=0.13.9"
90
89
 
91
90
  [tool.uv.build-backend]
92
91
  module-name = "check_empty"
93
92
  module-root = ""
94
93
 
95
94
  [tool.uv.dependency-groups]
96
- docs = {requires-python = ">=3.12"}
95
+ docs = {requires-python = ">=3.13"}
File without changes
File without changes