Skip to content

Commit 7301cef

Browse files
Fix Ruff formatting reports
1 parent bd2d17f commit 7301cef

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

fickling/loader.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pickle
2+
from io import BytesIO
23

34
from fickling.analysis import Severity, check_safety
45
from fickling.exception import UnsafeFileError
@@ -57,17 +58,15 @@ def loads(
5758
Raises:
5859
UnsafeFileError: If the pickle data is unsafe or contains invalid opcodes
5960
"""
60-
import io
61-
6261
# Convert bytes to file-like object
63-
file = io.BytesIO(data)
62+
file = BytesIO(data)
6463

6564
# Reuse existing load() function which already handles all the logic
6665
return load(
6766
file,
67+
*args,
6868
max_acceptable_severity=max_acceptable_severity,
6969
print_results=print_results,
7070
json_output_path=json_output_path,
71-
*args,
72-
**kwargs
71+
**kwargs,
7372
)

test/test_loads_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
class Payload:
1010
"""Malicious payload for testing"""
11+
1112
def __init__(self):
1213
self.a = 1
1314

@@ -50,7 +51,7 @@ def test_loads_matches_pickle_signature(self):
5051
data = pickle.dumps(test_data, protocol=2)
5152

5253
# Should work with extra args like pickle.loads()
53-
loaded_data = fickling.loads(data, encoding='ASCII', errors='strict')
54+
loaded_data = fickling.loads(data, encoding="ASCII", errors="strict")
5455

5556
self.assertEqual(loaded_data, test_data)
5657

0 commit comments

Comments
 (0)