Skip to content

Commit 0a908ed

Browse files
Pass failing linter check
1 parent 3e52ae6 commit 0a908ed

File tree

1 file changed

+27
-22
lines changed

1 file changed

+27
-22
lines changed

fickling/fickle.py

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,30 @@
4040
OPCODES_BY_NAME: dict[str, type[Opcode]] = {}
4141
OPCODE_INFO_BY_NAME: dict[str, OpcodeInfo] = {opcode.name: opcode for opcode in opcodes}
4242

43-
UNSAFE_IMPORTS: frozenset[str] = frozenset([
44-
"__builtin__",
45-
"__builtins__",
46-
"builtins",
47-
"os",
48-
"posix",
49-
"nt",
50-
"subprocess",
51-
"sys",
52-
"socket",
53-
"pty",
54-
"marshal",
55-
"types",
56-
"runpy",
57-
"cProfile",
58-
"ctypes",
59-
"pydoc",
60-
"importlib",
61-
"code",
62-
"multiprocessing",
63-
])
43+
UNSAFE_IMPORTS: frozenset[str] = frozenset(
44+
[
45+
"__builtin__",
46+
"__builtins__",
47+
"builtins",
48+
"os",
49+
"posix",
50+
"nt",
51+
"subprocess",
52+
"sys",
53+
"socket",
54+
"pty",
55+
"marshal",
56+
"types",
57+
"runpy",
58+
"cProfile",
59+
"ctypes",
60+
"pydoc",
61+
"importlib",
62+
"code",
63+
"multiprocessing",
64+
]
65+
)
66+
6467

6568
def is_std_module(module_name: str) -> bool:
6669
return in_stdlib(module_name) or module_name in BUILTIN_MODULE_NAMES
@@ -885,7 +888,9 @@ def is_likely_safe(self):
885888

886889
def unsafe_imports(self) -> Iterator[ast.Import | ast.ImportFrom]:
887890
for node in self.properties.imports:
888-
if node.module and any(component in UNSAFE_IMPORTS for component in node.module.split(".")):
891+
if node.module and any(
892+
component in UNSAFE_IMPORTS for component in node.module.split(".")
893+
):
889894
yield node
890895
elif "eval" in (n.name for n in node.names):
891896
yield node

0 commit comments

Comments
 (0)