pycln 2.2.0__tar.gz → 2.2.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.
- {pycln-2.2.0 → pycln-2.2.2}/PKG-INFO +2 -1
- {pycln-2.2.0 → pycln-2.2.2}/README.md +1 -0
- {pycln-2.2.0 → pycln-2.2.2}/pycln/utils/_exceptions.py +6 -0
- {pycln-2.2.0 → pycln-2.2.2}/pycln/utils/iou.py +13 -1
- {pycln-2.2.0 → pycln-2.2.2}/pycln/utils/refactor.py +3 -0
- {pycln-2.2.0 → pycln-2.2.2}/pyproject.toml +1 -1
- {pycln-2.2.0 → pycln-2.2.2}/LICENSE +0 -0
- {pycln-2.2.0 → pycln-2.2.2}/pycln/__init__.py +0 -0
- {pycln-2.2.0 → pycln-2.2.2}/pycln/__main__.py +0 -0
- {pycln-2.2.0 → pycln-2.2.2}/pycln/cli.py +0 -0
- {pycln-2.2.0 → pycln-2.2.2}/pycln/utils/__init__.py +0 -0
- {pycln-2.2.0 → pycln-2.2.2}/pycln/utils/_nodes.py +0 -0
- {pycln-2.2.0 → pycln-2.2.2}/pycln/utils/config.py +0 -0
- {pycln-2.2.0 → pycln-2.2.2}/pycln/utils/pathu.py +0 -0
- {pycln-2.2.0 → pycln-2.2.2}/pycln/utils/regexu.py +0 -0
- {pycln-2.2.0 → pycln-2.2.2}/pycln/utils/report.py +0 -0
- {pycln-2.2.0 → pycln-2.2.2}/pycln/utils/scan.py +0 -0
- {pycln-2.2.0 → pycln-2.2.2}/pycln/utils/transform.py +0 -0
- {pycln-2.2.0 → pycln-2.2.2}/vendor/custom/__init__.py +0 -0
- {pycln-2.2.0 → pycln-2.2.2}/vendor/custom/_site.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pycln
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.2
|
|
4
4
|
Summary: A formatter for finding and removing unused import statements.
|
|
5
5
|
Home-page: https://hadialqattan.github.io/pycln
|
|
6
6
|
License: MIT
|
|
@@ -128,6 +128,7 @@ The following notable open-source projects trust and use _Pycln_:
|
|
|
128
128
|
- [cibuildwheel](https://github.com/pypa/cibuildwheel)
|
|
129
129
|
- [Open Event Server](https://github.com/fossasia/open-event-server)
|
|
130
130
|
- [pybind11](https://github.com/pybind/pybind11)
|
|
131
|
+
- [pywin32](https://github.com/mhammond/pywin32)
|
|
131
132
|
- [Poetry](https://github.com/python-poetry/poetry)
|
|
132
133
|
- [Pyodide](https://github.com/pyodide/pyodide)
|
|
133
134
|
- [Rich](https://github.com/Textualize/rich)
|
|
@@ -98,6 +98,7 @@ The following notable open-source projects trust and use _Pycln_:
|
|
|
98
98
|
- [cibuildwheel](https://github.com/pypa/cibuildwheel)
|
|
99
99
|
- [Open Event Server](https://github.com/fossasia/open-event-server)
|
|
100
100
|
- [pybind11](https://github.com/pybind/pybind11)
|
|
101
|
+
- [pywin32](https://github.com/mhammond/pywin32)
|
|
101
102
|
- [Poetry](https://github.com/python-poetry/poetry)
|
|
102
103
|
- [Pyodide](https://github.com/pyodide/pyodide)
|
|
103
104
|
- [Rich](https://github.com/Textualize/rich)
|
|
@@ -24,6 +24,12 @@ class WritePermissionError(BaseOSError):
|
|
|
24
24
|
"""Raises when the file does not have write permission."""
|
|
25
25
|
|
|
26
26
|
|
|
27
|
+
class InitFileDoesNotExistError(BaseOSError):
|
|
28
|
+
|
|
29
|
+
"""Raises when an `__init__.py` file path encountered of a non-existing
|
|
30
|
+
path."""
|
|
31
|
+
|
|
32
|
+
|
|
27
33
|
class UnexpandableImportStar(Exception):
|
|
28
34
|
|
|
29
35
|
"""Raises when the import `*` statement unexpandable."""
|
|
@@ -6,7 +6,12 @@ import tokenize
|
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
from typing import List, Tuple
|
|
8
8
|
|
|
9
|
-
from ._exceptions import
|
|
9
|
+
from ._exceptions import (
|
|
10
|
+
InitFileDoesNotExistError,
|
|
11
|
+
ReadPermissionError,
|
|
12
|
+
UnparsableFile,
|
|
13
|
+
WritePermissionError,
|
|
14
|
+
)
|
|
10
15
|
|
|
11
16
|
# Constants.
|
|
12
17
|
STDIN_FILE = Path("STDIN")
|
|
@@ -14,6 +19,7 @@ STDIN_NOTATION = Path("-")
|
|
|
14
19
|
FORM_FEED_CHAR = "\x0c"
|
|
15
20
|
CRLF = "\r\n"
|
|
16
21
|
LF = "\n"
|
|
22
|
+
__INIT__ = "__init__.py"
|
|
17
23
|
|
|
18
24
|
# Types
|
|
19
25
|
FileContent = str
|
|
@@ -61,7 +67,13 @@ def safe_read(
|
|
|
61
67
|
and the source does not have write permission.
|
|
62
68
|
:raises UnparsableFile: If both a BOM and a cookie are present, but disagree.
|
|
63
69
|
or some rare characters presented.
|
|
70
|
+
:raises InitFileDoesNotExistError: when `path` is a path to a non-existing
|
|
71
|
+
`__init__.py` file.
|
|
64
72
|
"""
|
|
73
|
+
# Check for a non-existing `__init__.py` file case.
|
|
74
|
+
if str(path).endswith(__INIT__) and not path.exists():
|
|
75
|
+
raise InitFileDoesNotExistError(2, "`__init__.py` file does not exist", path)
|
|
76
|
+
|
|
65
77
|
# Check these permissions before openinig the file.
|
|
66
78
|
for permission in permissions:
|
|
67
79
|
if not os.access(path, permission):
|
|
@@ -8,6 +8,7 @@ from typing import Iterable, List, Optional, Set, Tuple, Union, cast
|
|
|
8
8
|
from .. import ISWIN
|
|
9
9
|
from . import iou, pathu, regexu, scan
|
|
10
10
|
from ._exceptions import (
|
|
11
|
+
InitFileDoesNotExistError,
|
|
11
12
|
ReadPermissionError,
|
|
12
13
|
UnexpandableImportStar,
|
|
13
14
|
UnparsableFile,
|
|
@@ -175,6 +176,8 @@ class Refactor:
|
|
|
175
176
|
UnparsableFile,
|
|
176
177
|
) as err:
|
|
177
178
|
self.reporter.failure(str(err))
|
|
179
|
+
except InitFileDoesNotExistError:
|
|
180
|
+
pass
|
|
178
181
|
finally:
|
|
179
182
|
self._reset()
|
|
180
183
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|