check-empty 3.0.0__tar.gz → 3.0.1__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.
- {check_empty-3.0.0 → check_empty-3.0.1}/PKG-INFO +7 -7
- {check_empty-3.0.0 → check_empty-3.0.1}/README.md +5 -5
- {check_empty-3.0.0 → check_empty-3.0.1}/check_empty/__init__.py +2 -3
- {check_empty-3.0.0 → check_empty-3.0.1}/check_empty/__main__.py +6 -5
- {check_empty-3.0.0 → check_empty-3.0.1}/check_empty/archives.py +8 -3
- {check_empty-3.0.0 → check_empty-3.0.1}/check_empty/constants.py +2 -2
- {check_empty-3.0.0 → check_empty-3.0.1}/check_empty/reporter/dct.py +3 -0
- {check_empty-3.0.0 → check_empty-3.0.1}/pyproject.toml +2 -2
- {check_empty-3.0.0 → check_empty-3.0.1}/pyproject.toml.orig +2 -2
- {check_empty-3.0.0 → check_empty-3.0.1}/AUTHORS.md +0 -0
- {check_empty-3.0.0 → check_empty-3.0.1}/LICENSE +0 -0
- {check_empty-3.0.0 → check_empty-3.0.1}/check_empty/py.typed +0 -0
- {check_empty-3.0.0 → check_empty-3.0.1}/check_empty/reporter/__init__.py +0 -0
- {check_empty-3.0.0 → check_empty-3.0.1}/check_empty/reporter/abcdef.py +0 -0
- {check_empty-3.0.0 → check_empty-3.0.1}/check_empty/reporter/exceptions.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: check-empty
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.1
|
|
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.
|
|
30
|
+
Requires-Dist: check-empty[7z,ace,ar,lzh,rar]==3.0.1 ; 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/
|
|
45
|
+
# [check-empty](https://pypi.org/project/check-empty/3.0.1)
|
|
46
46
|
|
|
47
47
|
[](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.
|
|
129
|
+
rev: v3.0.1 # 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.
|
|
145
|
+
rev = "v3.0.1"
|
|
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.
|
|
169
|
+
rev = "v3.0.1"
|
|
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.
|
|
189
|
+
- uses: jonathandung/check-empty@v3.0.1 # 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:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# [check-empty](https://pypi.org/
|
|
1
|
+
# [check-empty](https://pypi.org/project/check-empty/3.0.1)
|
|
2
2
|
|
|
3
3
|
[](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.
|
|
85
|
+
rev: v3.0.1 # 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.
|
|
101
|
+
rev = "v3.0.1"
|
|
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.
|
|
125
|
+
rev = "v3.0.1"
|
|
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.
|
|
145
|
+
- uses: jonathandung/check-empty@v3.0.1 # 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:
|
|
@@ -7,12 +7,10 @@ Pre-commit hook, command-line tool and GitHub Action all-in-one.
|
|
|
7
7
|
|
|
8
8
|
from __future__ import annotations
|
|
9
9
|
|
|
10
|
-
from contextlib import suppress
|
|
11
|
-
|
|
12
10
|
from check_empty import constants, reporter
|
|
13
11
|
|
|
14
12
|
__all__ = ('Handler', 'check', 'default_reporter')
|
|
15
|
-
__version__ = '3.0.
|
|
13
|
+
__version__ = '3.0.1'
|
|
16
14
|
"""The version of the package."""
|
|
17
15
|
default_reporter: reporter.Reporter = reporter.Reporter()
|
|
18
16
|
"""The default reporter used by :func:`check`."""
|
|
@@ -124,6 +122,7 @@ def check(
|
|
|
124
122
|
The integer exit code calculated by the reporter.
|
|
125
123
|
|
|
126
124
|
"""
|
|
125
|
+
from contextlib import suppress
|
|
127
126
|
from os import fsdecode, scandir, stat
|
|
128
127
|
|
|
129
128
|
files = list(files)
|
|
@@ -68,15 +68,16 @@ def main(argv: Iterable[str] | None = None) -> int:
|
|
|
68
68
|
# ruff: ignore[open-file-with-context-handler]
|
|
69
69
|
c.default_reporter.to(open(o, 'w', encoding='utf-8'))
|
|
70
70
|
m = c.constants
|
|
71
|
-
r = m.RecurseInto
|
|
72
|
-
for a in m.ARCHIVE_FORMATS:
|
|
73
|
-
if getattr(n, a._name_.lower()):
|
|
74
|
-
r |= a
|
|
71
|
+
r = m.RecurseInto
|
|
75
72
|
return c.check(
|
|
76
73
|
n.filenames,
|
|
77
74
|
clear=n.clear,
|
|
78
75
|
may_not_exist=n.may_not_exist,
|
|
79
|
-
recurse_into=
|
|
76
|
+
recurse_into=__import__('functools').reduce(
|
|
77
|
+
r.__or__,
|
|
78
|
+
filter(lambda a: getattr(n, a.name.lower()), m.ARCHIVE_FORMATS),
|
|
79
|
+
r.NONE,
|
|
80
|
+
),
|
|
80
81
|
verbosity=2 + n.verbose - n.quiet,
|
|
81
82
|
)
|
|
82
83
|
|
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import os
|
|
6
|
-
from itertools import filterfalse
|
|
7
|
-
from operator import attrgetter
|
|
8
6
|
from tempfile import NamedTemporaryFile
|
|
9
7
|
|
|
10
8
|
__all__ = (
|
|
11
9
|
'AR_FS',
|
|
12
10
|
'AR_MAG',
|
|
13
11
|
'AR_NAME_SIZE',
|
|
12
|
+
'AR_SKIP',
|
|
14
13
|
'clear_file_in_zip',
|
|
15
14
|
'purge_7z',
|
|
16
15
|
'purge_ar',
|
|
@@ -18,13 +17,17 @@ __all__ = (
|
|
|
18
17
|
)
|
|
19
18
|
_ = __import__('io').BytesIO()
|
|
20
19
|
AR_FS: Final = b'%-16b0 0 0 100644 %-10d`\n%b'
|
|
20
|
+
"""A C-style format string used to create file headers and bodies in ar archives."""
|
|
21
21
|
AR_MAG: Final = b'!<arch>\n'
|
|
22
|
+
"""The magic number for ar archives."""
|
|
22
23
|
AR_NAME_SIZE: Final = 16
|
|
24
|
+
"""The maximum length of a file name in an ar archive before special handling."""
|
|
23
25
|
AR_SKIP: Final[
|
|
24
26
|
frozenset[
|
|
25
27
|
Literal[b'/', b'//', b'/SYM64/', b'__.SYMDEF', b'__.SYMDEF SORTED'] | None
|
|
26
28
|
]
|
|
27
29
|
] = frozenset((b'/', b'//', b'/SYM64/', b'__.SYMDEF', b'__.SYMDEF SORTED', None))
|
|
30
|
+
"""The file names to skip when clearing files in an ar archive."""
|
|
28
31
|
TYPE_CHECKING = False
|
|
29
32
|
if TYPE_CHECKING:
|
|
30
33
|
import tarfile
|
|
@@ -83,7 +86,9 @@ def purge_ar(a: Archive, g: int) -> None:
|
|
|
83
86
|
with NamedTemporaryFile(suffix='.a', delete=False) as f:
|
|
84
87
|
w = f.write
|
|
85
88
|
w(AR_MAG)
|
|
86
|
-
q =
|
|
89
|
+
q = __import__('itertools').filterfalse(
|
|
90
|
+
AR_SKIP.__contains__, map(__import__('operator').attrgetter('name'), i)
|
|
91
|
+
)
|
|
87
92
|
_purge_ar_gnu(tuple(q), w) if i[0].type == g else _purge_ar_bsd(q, w)
|
|
88
93
|
os.replace(f.name, n)
|
|
89
94
|
|
|
@@ -16,7 +16,7 @@ TYPE_CHECKING = False
|
|
|
16
16
|
if TYPE_CHECKING:
|
|
17
17
|
from typing import Final
|
|
18
18
|
TYPE_MASK: Final = 0xF000
|
|
19
|
-
"""
|
|
19
|
+
"""The mask that extracts the type of a file from its mode bits from :func:`os.stat`."""
|
|
20
20
|
S_IFDIR: Final = 0x4000
|
|
21
21
|
"""Equal to :data:`stat.S_IFDIR`."""
|
|
22
22
|
ENOENT: Final = 2
|
|
@@ -58,7 +58,7 @@ class RecurseInto(__import__('enum').IntFlag):
|
|
|
58
58
|
"""Recurse into all archive types."""
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
ARCHIVE_FORMATS: Final = tuple(
|
|
61
|
+
ARCHIVE_FORMATS: Final[tuple[RecurseInto, ...]] = tuple(
|
|
62
62
|
filter(lambda x: x > 0 == x & (x - 1), RecurseInto)
|
|
63
63
|
if __import__('sys').version_info < (3, 11)
|
|
64
64
|
else RecurseInto
|
|
@@ -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.
|
|
58
|
+
version = "3.0.1"
|
|
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.
|
|
71
|
+
all = ["check-empty[7z,ace,ar,lzh,rar]==3.0.1"]
|
|
72
72
|
ar = ["arpy==2.4.0"]
|
|
73
73
|
lzh = ["lhafile==0.3.1"]
|
|
74
74
|
rar = ["rarfile==4.5"]
|
|
@@ -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.
|
|
19
|
+
version = "3.0.1"
|
|
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.
|
|
24
|
+
all = ["check-empty[7z,ace,ar,lzh,rar]==3.0.1"]
|
|
25
25
|
ar = ["arpy==2.4.0"]
|
|
26
26
|
lzh = ["lhafile==0.3.1"]
|
|
27
27
|
rar = ["rarfile==4.5"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|