check-empty 3.0.1__tar.gz → 4.0.0__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: 3.0.1
3
+ Version: 4.0.0
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
@@ -27,7 +27,7 @@ Classifier: Topic :: Utilities
27
27
  Classifier: Typing :: Typed
28
28
  Requires-Dist: py7zr==1.1.3 ; extra == '7z'
29
29
  Requires-Dist: acefile==0.6.14 ; extra == 'ace'
30
- Requires-Dist: check-empty[7z,ace,ar,lzh,rar]==3.0.1 ; extra == 'all'
30
+ Requires-Dist: check-empty[7z,ace,ar,lzh,rar]==4.0.0 ; extra == 'all'
31
31
  Requires-Dist: arpy==2.4.0 ; extra == 'ar'
32
32
  Requires-Dist: lhafile==0.3.1 ; extra == 'lzh'
33
33
  Requires-Dist: rarfile==4.5 ; extra == 'rar'
@@ -42,7 +42,7 @@ Provides-Extra: lzh
42
42
  Provides-Extra: rar
43
43
  Description-Content-Type: text/markdown
44
44
 
45
- # [check-empty](https://pypi.org/project/check-empty/3.0.1)
45
+ # [check-empty](https://pypi.org/project/check-empty/4.0.0)
46
46
 
47
47
  [![#StandWithPalestine](https://raw.githubusercontent.com/TheBSD/StandWithPalestine/main/badges/StandWithPalestine.svg)](https://github.com/TheBSD/StandWithPalestine/blob/main/docs/README.md)
48
48
 
@@ -126,7 +126,7 @@ As a pre-commit hook:
126
126
  # .pre-commit-config.yaml
127
127
  repos:
128
128
  - repo: https://github.com/jonathandung/check-empty
129
- rev: v3.0.1 # repository version
129
+ rev: v4.0.0 # repository version
130
130
  hooks:
131
131
  - id: check-empty # the hook
132
132
  args: # example list of arguments
@@ -142,7 +142,7 @@ equivalent in `prek.toml` format:
142
142
  ```toml
143
143
  [[repos]]
144
144
  repo = "https://github.com/jonathandung/check-empty"
145
- rev = "v3.0.1"
145
+ rev = "v4.0.0"
146
146
 
147
147
  [[repos.hooks]]
148
148
  id = "check-empty"
@@ -166,7 +166,7 @@ or (TOML 1.1+):
166
166
  # using multiline inline tables
167
167
  [[repos]]
168
168
  repo = "https://github.com/jonathandung/check-empty"
169
- rev = "v3.0.1"
169
+ rev = "v4.0.0"
170
170
  hooks = [{
171
171
  id = "check-empty",
172
172
  args = ["-Q"],
@@ -186,7 +186,7 @@ As a GitHub Actions workflow step:
186
186
 
187
187
  ```yaml
188
188
  steps:
189
- - uses: jonathandung/check-empty@v3.0.1 # the latest version on the GitHub Actions
189
+ - uses: jonathandung/check-empty@v4.0.0 # the latest version on the GitHub Actions
190
190
  # marketplace; this step will fail and subsequent jobs will not run if any file is
191
191
  # not empty
192
192
  with:
@@ -197,6 +197,7 @@ steps:
197
197
  static/.gitkeep
198
198
  some_dir
199
199
  globs: '**/*.lock'
200
+ # must use single quotes to escape asterisks, which refer to YAML aliases
200
201
  # can also be an array of globs joined into a newline-delimited multiline string,
201
202
  # as in filenames
202
203
  ```
@@ -244,10 +245,11 @@ to read the
244
245
  and the
245
246
  [contributing guide](https://github.com/jonathandung/.github/blob/main/CONTRIBUTING.md).
246
247
 
247
- To build the docs locally (needs Python 3.12+ because of Sphinx), install with the
248
- `docs` [group](https://packaging.python.org/en/latest/specifications/dependency-groups)
249
- using a package manager that supports it (e.g. pip 25.1+ or uv 0.4.27+), preferably
250
- into a virtual environment.
248
+ To build the docs locally (needs Python 3.12+ because of Sphinx), install the package
249
+ with the `docs`
250
+ [group](https://packaging.python.org/en/latest/specifications/dependency-groups) using
251
+ a package manager that supports it (e.g. pip 25.1+ or uv 0.4.27+), preferably into a
252
+ virtual environment.
251
253
 
252
254
  Tests are run with:
253
255
 
@@ -1,4 +1,4 @@
1
- # [check-empty](https://pypi.org/project/check-empty/3.0.1)
1
+ # [check-empty](https://pypi.org/project/check-empty/4.0.0)
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
 
@@ -82,7 +82,7 @@ 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: v3.0.1 # repository version
85
+ rev: v4.0.0 # repository version
86
86
  hooks:
87
87
  - id: check-empty # the hook
88
88
  args: # example list of arguments
@@ -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 = "v3.0.1"
101
+ rev = "v4.0.0"
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 = "v3.0.1"
125
+ rev = "v4.0.0"
126
126
  hooks = [{
127
127
  id = "check-empty",
128
128
  args = ["-Q"],
@@ -142,7 +142,7 @@ As a GitHub Actions workflow step:
142
142
 
143
143
  ```yaml
144
144
  steps:
145
- - uses: jonathandung/check-empty@v3.0.1 # the latest version on the GitHub Actions
145
+ - uses: jonathandung/check-empty@v4.0.0 # 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:
@@ -153,6 +153,7 @@ steps:
153
153
  static/.gitkeep
154
154
  some_dir
155
155
  globs: '**/*.lock'
156
+ # must use single quotes to escape asterisks, which refer to YAML aliases
156
157
  # can also be an array of globs joined into a newline-delimited multiline string,
157
158
  # as in filenames
158
159
  ```
@@ -200,10 +201,11 @@ to read the
200
201
  and the
201
202
  [contributing guide](https://github.com/jonathandung/.github/blob/main/CONTRIBUTING.md).
202
203
 
203
- To build the docs locally (needs Python 3.12+ because of Sphinx), install with the
204
- `docs` [group](https://packaging.python.org/en/latest/specifications/dependency-groups)
205
- using a package manager that supports it (e.g. pip 25.1+ or uv 0.4.27+), preferably
206
- into a virtual environment.
204
+ To build the docs locally (needs Python 3.12+ because of Sphinx), install the package
205
+ with the `docs`
206
+ [group](https://packaging.python.org/en/latest/specifications/dependency-groups) using
207
+ a package manager that supports it (e.g. pip 25.1+ or uv 0.4.27+), preferably into a
208
+ virtual environment.
207
209
 
208
210
  Tests are run with:
209
211
 
@@ -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__ = '3.0.1'
13
+ __version__ = '4.0.0'
14
14
  """The version of the package."""
15
15
  default_reporter: reporter.Reporter = reporter.Reporter()
16
16
  """The default reporter used by :func:`check`."""
@@ -322,6 +322,6 @@ def check(
322
322
  Handler(*i, a).o()
323
323
  x, d = k[1] if z is None else len(z) - 1, k[2] if w is None else len(w)
324
324
  y, p = k[3] if r is None else len(r), k[0] if b is None else len(b) - 1
325
- reporter.report(z, w, v, b, r, x, y, d, p, n, t, verbosity, clear)
325
+ reporter.report(z, v, b, ra, r, w, x, y, d, p, n, t, verbosity, clear)
326
326
  reporter.reset_out()
327
327
  return reporter.calculate_result(*map(bool, (y, x and not may_not_exist, d)))
@@ -3,7 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import os
6
- from tempfile import NamedTemporaryFile
6
+ from tempfile import NamedTemporaryFile as h
7
7
 
8
8
  __all__ = (
9
9
  'AR_FS',
@@ -65,7 +65,7 @@ def purge_tar(t: tarfile.TarFile) -> None:
65
65
  import tarfile as z
66
66
 
67
67
  with (
68
- NamedTemporaryFile(suffix='.tar.gz', delete=False) as p,
68
+ h(suffix='.tar.gz', delete=False) as p,
69
69
  z.open(fileobj=p, mode='w:gz') as f,
70
70
  ):
71
71
  a = f.addfile
@@ -83,17 +83,17 @@ def purge_ar(a: Archive, g: int) -> None:
83
83
  os.truncate(n, 8)
84
84
  return
85
85
 
86
- with NamedTemporaryFile(suffix='.a', delete=False) as f:
86
+ with h(suffix='.a', delete=False) as f:
87
87
  w = f.write
88
88
  w(AR_MAG)
89
89
  q = __import__('itertools').filterfalse(
90
90
  AR_SKIP.__contains__, map(__import__('operator').attrgetter('name'), i)
91
91
  )
92
- _purge_ar_gnu(tuple(q), w) if i[0].type == g else _purge_ar_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 _purge_ar_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 _purge_ar_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 _purge_ar_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:
@@ -34,10 +34,11 @@ class Reporter(abcdef.ReporterABC):
34
34
  def report( # ruff: ignore[too-many-arguments, too-many-positional-arguments]
35
35
  self,
36
36
  z: list[str] | None,
37
- w: list[OSError] | None,
38
37
  a: list[str] | None,
39
38
  b: list[str] | None,
39
+ e: list[str] | None,
40
40
  r: list[tuple[str, int]] | None,
41
+ w: list[OSError] | None,
41
42
  x: int,
42
43
  y: int,
43
44
  d: int,
@@ -59,6 +60,8 @@ class Reporter(abcdef.ReporterABC):
59
60
  q = (s.stdout if q is None else q).write
60
61
  if a is not None:
61
62
  q('\nRecursing into directory: '.join(a))
63
+ if e is not None:
64
+ q('\nRecursing into archive: '.join(e))
62
65
  if z is not None:
63
66
  q('\nNot found: '.join(z))
64
67
  q(
@@ -22,10 +22,11 @@ class ReporterABC(metaclass=a.ABCMeta):
22
22
  def report( # ruff: ignore[too-many-arguments, too-many-positional-arguments]
23
23
  self,
24
24
  z: list[str] | None,
25
- w: list[OSError] | None,
26
25
  a: list[str] | None,
27
26
  b: list[str] | None,
27
+ e: list[str] | None,
28
28
  r: list[tuple[str, int]] | None,
29
+ w: list[OSError] | None,
29
30
  x: int,
30
31
  y: int,
31
32
  d: int,
@@ -39,11 +40,18 @@ class ReporterABC(metaclass=a.ABCMeta):
39
40
  """Report the results of the check.
40
41
 
41
42
  Args:
42
- z: list of paths to files that were not found.
43
- w: list of I/O errors when processing non-missing files.
44
- a: list of directories that were recursed into.
45
- b: list of empty file paths.
46
- r: list of 2-tuples representing non-empty files and their sizes.
43
+ z: list of paths to files that were not found, or ``None`` if ``v`` is less
44
+ than 3; the first element of the list is an empty string.
45
+ a: list of paths to directories that were recursed into, or ``None`` if
46
+ ``v`` is less than 4; the first element of the list is an empty string.
47
+ b: list of empty file paths, or ``None`` if ``v`` is less than 5; the first
48
+ element of the list is an empty string.
49
+ e: list of paths to archives that were recursed into, or ``None`` if
50
+ ``v`` is less than 4; the first element of the list is an empty string.
51
+ r: list of 2-tuples representing non-empty files and their sizes, or
52
+ ``None`` if ``v`` is less than 2.
53
+ w: list of I/O errors when processing non-missing files, or ``None`` if
54
+ ``v`` is less than 3.
47
55
  x: number of files that were not found.
48
56
  y: number of non-empty files.
49
57
  d: number of I/O errors encountered.
@@ -72,7 +80,7 @@ class ReporterABC(metaclass=a.ABCMeta):
72
80
  x: whether any files or directories were absent and
73
81
  :ref:`-m <check-empty--m>` /
74
82
  :ref:`--may-not-exist <check-empty---may-not-exist>` was omitted
75
- d: whether any :exc:`OSError` was caught while processing files.
83
+ d: whether any :exc:`OSError` were caught while processing files.
76
84
 
77
85
  Returns:
78
86
  An integer derived from the arguments, which will be returned by
@@ -37,7 +37,11 @@ class ReporterError(Exception):
37
37
 
38
38
 
39
39
  class NoReport(ReporterError):
40
- """A delayed reporter was asked to report but had nothing to report."""
40
+ """Raised by a :class:`check_empty.reporter.abcdef.DelayedReporterMixin`.
41
+
42
+ The error is due to no data having been collected to report when the reporter was
43
+ asked to report.
44
+ """
41
45
 
42
46
  reporter: DelayedReporterMixin
43
47
  """The reporter concerned."""
@@ -52,7 +56,7 @@ class IncorrectKeynames(ReporterError):
52
56
 
53
57
 
54
58
  class IncorrectKeynamesLength(IncorrectKeynames):
55
- """The length of ``keys`` was not 13."""
59
+ """The length of ``keys`` was not equal to 13."""
56
60
 
57
61
  message = 'keys must have length 13'
58
62
 
@@ -1,5 +1,5 @@
1
1
  [build-system]
2
- requires = ["uv_build>=0.12.19"]
2
+ requires = ["uv_build>=0.13.0"]
3
3
  build-backend = "uv_build"
4
4
 
5
5
  [dependency-groups]
@@ -55,7 +55,7 @@ license-files = [
55
55
  name = "check-empty"
56
56
  readme = "README.md"
57
57
  requires-python = ">=3.10"
58
- version = "3.0.1"
58
+ version = "4.0.0"
59
59
 
60
60
  [[project.authors]]
61
61
  name = "Jonathan Dung"
@@ -68,7 +68,7 @@ email = "jonathandung@yahoo.com"
68
68
  [project.optional-dependencies]
69
69
  7z = ["py7zr==1.1.3"]
70
70
  ace = ["acefile==0.6.14"]
71
- all = ["check-empty[7z,ace,ar,lzh,rar]==3.0.1"]
71
+ all = ["check-empty[7z,ace,ar,lzh,rar]==4.0.0"]
72
72
  ar = ["arpy==2.4.0"]
73
73
  lzh = ["lhafile==0.3.1"]
74
74
  rar = ["rarfile==4.5"]
@@ -77,7 +77,7 @@ rar = ["rarfile==4.5"]
77
77
  check-empty = "check_empty.__main__:main"
78
78
 
79
79
  [tool.ruff]
80
- required-version = ">=0.16.9"
80
+ required-version = ">=0.17.0"
81
81
  target-version = "py310"
82
82
 
83
83
  [tool.ruff.analyze]
@@ -93,6 +93,7 @@ ignore = [
93
93
  "PT",
94
94
  "bad-quotes-inline-string",
95
95
  "builtin-open",
96
+ "camelcase-imported-as-lowercase",
96
97
  "complex-structure",
97
98
  "error-suffix-on-exception-name",
98
99
  "import-outside-top-level",
@@ -152,8 +153,14 @@ possibly-unresolved-reference = "ignore"
152
153
  redundant-condition = "ignore"
153
154
  unsound-assignment = "ignore"
154
155
 
156
+ [[tool.ty.overrides]]
157
+ include = ["check_empty/reporter/exceptions.py"]
158
+
159
+ [tool.ty.overrides.rules]
160
+ invalid-mutable-override = "ignore"
161
+
155
162
  [tool.uv]
156
- required-version = ">=0.12.19"
163
+ required-version = ">=0.13.0"
157
164
 
158
165
  [tool.uv.build-backend]
159
166
  module-name = "check_empty"
@@ -1,5 +1,5 @@
1
1
  [build-system]
2
- requires = ["uv_build>=0.12.19"]
2
+ requires = ["uv_build>=0.13.0"]
3
3
  build-backend = "uv_build"
4
4
 
5
5
  [dependency-groups]
@@ -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.10"
19
- version = "3.0.1"
19
+ version = "4.0.0"
20
20
 
21
21
  [project.optional-dependencies]
22
22
  "7z" = ["py7zr==1.1.3"]
23
23
  ace = ["acefile==0.6.14"]
24
- all = ["check-empty[7z,ace,ar,lzh,rar]==3.0.1"]
24
+ all = ["check-empty[7z,ace,ar,lzh,rar]==4.0.0"]
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.16.9"
33
+ required-version = ">=0.17.0"
34
34
  target-version = "py310"
35
35
 
36
36
  [tool.ruff.analyze]
@@ -40,7 +40,7 @@ type-checking-imports = false
40
40
  quote-style = "single"
41
41
 
42
42
  [tool.ruff.lint]
43
- ignore = ["COM", "FBT", "PT", "bad-quotes-inline-string", "builtin-open", "complex-structure", "error-suffix-on-exception-name", "import-outside-top-level", "incorrect-blank-line-before-class", "meta-class-abc-meta", "multi-line-summary-second-line", "non-empty-init-module", "os-replace"]
43
+ ignore = ["COM", "FBT", "PT", "bad-quotes-inline-string", "builtin-open", "camelcase-imported-as-lowercase", "complex-structure", "error-suffix-on-exception-name", "import-outside-top-level", "incorrect-blank-line-before-class", "meta-class-abc-meta", "multi-line-summary-second-line", "non-empty-init-module", "os-replace"]
44
44
  preview = true
45
45
  select = ["ALL"]
46
46
 
@@ -81,8 +81,12 @@ missing-override-decorator = "ignore"
81
81
  include = ["check_empty/__init__.py"]
82
82
  rules = {possibly-unresolved-reference = "ignore", redundant-condition = "ignore", unsound-assignment = "ignore"}
83
83
 
84
+ [[tool.ty.overrides]]
85
+ include = ["check_empty/reporter/exceptions.py"]
86
+ rules = {invalid-mutable-override = "ignore"}
87
+
84
88
  [tool.uv]
85
- required-version = ">=0.12.19"
89
+ required-version = ">=0.13.0"
86
90
 
87
91
  [tool.uv.build-backend]
88
92
  module-name = "check_empty"
File without changes
File without changes