Skip to content

Commit

Permalink
Fix ruff issues
Browse files Browse the repository at this point in the history
  • Loading branch information
peyman-salehi authored and peymanslh committed Aug 18, 2024
1 parent 980aad4 commit 7510f1e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: pip install --user ruff
- run: ruff --extend-select=C4,C9,I,PLC,PLE,PLR,U --ignore=C414,I001,PLR0913,UP007,UP032 --target-version=py38 .
- run: ruff check . --extend-select=C4,C9,I,PLC,PLE,PLR,U --ignore=C414,I001,PLR0913,UP007,UP032 --target-version=py38
2 changes: 1 addition & 1 deletion pipeline/compressors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def construct_asset_path(
os.path.dirname(source_path).replace("\\", "/"),
)
if self.embeddable(public_path, variant):
return "__EMBED__%s" % public_path
return f"__EMBED__{public_path}"
if not posixpath.isabs(asset_path):
asset_path = self.relative_path(public_path, output_filename)
return asset_path
Expand Down
6 changes: 3 additions & 3 deletions pipeline/packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ def compile(self, paths, compiler_options={}, force=False):
if source_storage is not None:
with source_storage.open(path) as source_file:
if self.verbose:
print("Saving: %s" % path)
print(f"Saving: {path}")
self.storage.save(path, source_file)
else:
raise OSError("File does not exist: %s" % path)
raise OSError(f"File does not exist: {path}")
return paths

def pack(self, package, compress, signal, **kwargs):
Expand Down Expand Up @@ -168,7 +168,7 @@ def find_source_storage(self, path):
for short_path, storage in finder.list(""):
if short_path == path:
if self.verbose:
print("Found storage: %s" % str(self.storage))
print(f"Found storage: {str(self.storage)}")
return storage
return None

Expand Down
2 changes: 1 addition & 1 deletion tests/tests/test_compressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def tearDown(self):

def _test_compressor(self, compressor_cls, compress_type, expected_file):
override_settings = {
("%s_COMPRESSOR" % compress_type.upper()): compressor_cls,
(f"{compress_type.upper()}_COMPRESSOR"): compressor_cls,
}
with pipeline_settings(**override_settings):
if compress_type == "js":
Expand Down
8 changes: 4 additions & 4 deletions tests/tests/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ class MyMedia(PipelineFormMedia):
)
self.assertEqual(MyMedia.css, media._css)
expected_regex = [
r'<link href="%s"( type="text/css")? media="all" '
'rel="stylesheet"( /)?>' % path
r'<link href="{}"( type="text/css")? media="all" '
'rel="stylesheet"( /)?>'.format(path)
for path in (
"/static/extra1.css",
"/static/extra2.css",
Expand Down Expand Up @@ -116,8 +116,8 @@ class MyMedia(PipelineFormMedia):
self.assertEqual(MyMedia.css, media._css)

expected_regex = [
'<link href="%s"( type="text/css")? media="all" '
'rel="stylesheet"( /)?>' % path
'<link href="{}"( type="text/css")? media="all" '
'rel="stylesheet"( /)?>'.format(path)
for path in (
"/static/extra1.css",
"/static/extra2.css",
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def setUp(self):

self.filename = "pipeline/js/first.js"
self.storage = staticfiles_storage
self.request = RequestFactory().get("/static/%s" % self.filename)
self.request = RequestFactory().get(f"/static/{self.filename}")

default_collector.clear()

Expand Down

0 comments on commit 7510f1e

Please sign in to comment.