Skip to content

Commit 7510f1e

Browse files
peyman-salehipeymanslh
authored andcommitted
Fix ruff issues
1 parent 980aad4 commit 7510f1e

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,4 @@ jobs:
9191
steps:
9292
- uses: actions/checkout@v3
9393
- run: pip install --user ruff
94-
- run: ruff --extend-select=C4,C9,I,PLC,PLE,PLR,U --ignore=C414,I001,PLR0913,UP007,UP032 --target-version=py38 .
94+
- run: ruff check . --extend-select=C4,C9,I,PLC,PLE,PLR,U --ignore=C414,I001,PLR0913,UP007,UP032 --target-version=py38

pipeline/compressors/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def construct_asset_path(
320320
os.path.dirname(source_path).replace("\\", "/"),
321321
)
322322
if self.embeddable(public_path, variant):
323-
return "__EMBED__%s" % public_path
323+
return f"__EMBED__{public_path}"
324324
if not posixpath.isabs(asset_path):
325325
asset_path = self.relative_path(public_path, output_filename)
326326
return asset_path

pipeline/packager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@ def compile(self, paths, compiler_options={}, force=False):
127127
if source_storage is not None:
128128
with source_storage.open(path) as source_file:
129129
if self.verbose:
130-
print("Saving: %s" % path)
130+
print(f"Saving: {path}")
131131
self.storage.save(path, source_file)
132132
else:
133-
raise OSError("File does not exist: %s" % path)
133+
raise OSError(f"File does not exist: {path}")
134134
return paths
135135

136136
def pack(self, package, compress, signal, **kwargs):
@@ -168,7 +168,7 @@ def find_source_storage(self, path):
168168
for short_path, storage in finder.list(""):
169169
if short_path == path:
170170
if self.verbose:
171-
print("Found storage: %s" % str(self.storage))
171+
print(f"Found storage: {str(self.storage)}")
172172
return storage
173173
return None
174174

tests/tests/test_compressor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ def tearDown(self):
518518

519519
def _test_compressor(self, compressor_cls, compress_type, expected_file):
520520
override_settings = {
521-
("%s_COMPRESSOR" % compress_type.upper()): compressor_cls,
521+
(f"{compress_type.upper()}_COMPRESSOR"): compressor_cls,
522522
}
523523
with pipeline_settings(**override_settings):
524524
if compress_type == "js":

tests/tests/test_forms.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ class MyMedia(PipelineFormMedia):
7171
)
7272
self.assertEqual(MyMedia.css, media._css)
7373
expected_regex = [
74-
r'<link href="%s"( type="text/css")? media="all" '
75-
'rel="stylesheet"( /)?>' % path
74+
r'<link href="{}"( type="text/css")? media="all" '
75+
'rel="stylesheet"( /)?>'.format(path)
7676
for path in (
7777
"/static/extra1.css",
7878
"/static/extra2.css",
@@ -116,8 +116,8 @@ class MyMedia(PipelineFormMedia):
116116
self.assertEqual(MyMedia.css, media._css)
117117

118118
expected_regex = [
119-
'<link href="%s"( type="text/css")? media="all" '
120-
'rel="stylesheet"( /)?>' % path
119+
'<link href="{}"( type="text/css")? media="all" '
120+
'rel="stylesheet"( /)?>'.format(path)
121121
for path in (
122122
"/static/extra1.css",
123123
"/static/extra2.css",

tests/tests/test_views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def setUp(self):
1717

1818
self.filename = "pipeline/js/first.js"
1919
self.storage = staticfiles_storage
20-
self.request = RequestFactory().get("/static/%s" % self.filename)
20+
self.request = RequestFactory().get(f"/static/{self.filename}")
2121

2222
default_collector.clear()
2323

0 commit comments

Comments
 (0)