@autorest/python 6.13.9 → 6.13.11
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.
- package/autorest/black/__init__.py +12 -3
- package/package.json +1 -1
- package/requirements.txt +1 -1
|
@@ -37,7 +37,15 @@ class BlackScriptPlugin(Plugin): # pylint: disable=abstract-method
|
|
|
37
37
|
[
|
|
38
38
|
Path(f)
|
|
39
39
|
for f in self.list_file()
|
|
40
|
-
if all(
|
|
40
|
+
if all(
|
|
41
|
+
item not in f
|
|
42
|
+
for item in (
|
|
43
|
+
"__pycache__",
|
|
44
|
+
"node_modules",
|
|
45
|
+
".tox",
|
|
46
|
+
".mypy_cache",
|
|
47
|
+
)
|
|
48
|
+
)
|
|
41
49
|
and Path(f).suffix == ".py"
|
|
42
50
|
],
|
|
43
51
|
)
|
|
@@ -45,8 +53,8 @@ class BlackScriptPlugin(Plugin): # pylint: disable=abstract-method
|
|
|
45
53
|
return True
|
|
46
54
|
|
|
47
55
|
def format_file(self, file: Path) -> None:
|
|
48
|
-
file_content = self.read_file(file)
|
|
49
56
|
try:
|
|
57
|
+
file_content = self.read_file(file)
|
|
50
58
|
file_content = black.format_file_contents(
|
|
51
59
|
file_content, fast=True, mode=_BLACK_MODE
|
|
52
60
|
)
|
|
@@ -55,7 +63,8 @@ class BlackScriptPlugin(Plugin): # pylint: disable=abstract-method
|
|
|
55
63
|
except: # pylint: disable=bare-except
|
|
56
64
|
_LOGGER.error("Error: failed to format %s", file)
|
|
57
65
|
raise
|
|
58
|
-
|
|
66
|
+
else:
|
|
67
|
+
self.write_file(file, file_content)
|
|
59
68
|
|
|
60
69
|
|
|
61
70
|
class BlackScriptPluginAutorest(BlackScriptPlugin, PluginAutorest):
|
package/package.json
CHANGED
package/requirements.txt
CHANGED