Skip to content

Commit

Permalink
Fix various quality issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Aug 27, 2023
1 parent 9da618d commit 3c02be2
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion colour_hdri/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
try:
_version: str = (
subprocess.check_output(
["git", "describe"],
["git", "describe"], # noqa: S603,S607
cwd=os.path.dirname(__file__),
stderr=subprocess.STDOUT,
)
Expand Down
4 changes: 2 additions & 2 deletions colour_hdri/process/dng.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def convert_raw_files_to_dng_files(
),
]

subprocess.call(command, shell=_IS_WINDOWS_PLATFORM)
subprocess.call(command, shell=_IS_WINDOWS_PLATFORM) # noqa: S603

dng_files.append(dng_file)

Expand Down Expand Up @@ -354,7 +354,7 @@ def convert_dng_files_to_intermediate_files(
),
]

subprocess.call(command, shell=_IS_WINDOWS_PLATFORM)
subprocess.call(command, shell=_IS_WINDOWS_PLATFORM) # noqa: S603

tiff_file = os.path.join(
output_directory, os.path.basename(intermediate_file)
Expand Down
4 changes: 2 additions & 2 deletions colour_hdri/recovery/tests/test_recovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def test_highlights_recovery_blend(self):
),
]

subprocess.call(command)
subprocess.call(command) # noqa: S603

test_tiff_file = read_image(
str(re.sub("\\.CR2$", ".tiff", test_raw_file))
Expand Down Expand Up @@ -168,7 +168,7 @@ def test_highlights_recovery_LCHab(self):
),
]

subprocess.call(command)
subprocess.call(command) # noqa: S603

test_tiff_file = read_image(
str(re.sub("\\.CR2$", ".tiff", test_raw_file))
Expand Down
15 changes: 10 additions & 5 deletions colour_hdri/utilities/exif.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def read_exif_tags(image: str) -> defaultdict:
lines = str(
subprocess.check_output(
[EXIF_EXECUTABLE, "-D", "-G", "-a", "-u", "-n", image],
shell=_IS_WINDOWS_PLATFORM,
shell=_IS_WINDOWS_PLATFORM, # noqa: S603
),
"utf-8",
"ignore",
Expand Down Expand Up @@ -309,7 +309,9 @@ def copy_exif_tags(source: str, target: str) -> bool:

arguments = [EXIF_EXECUTABLE, "-overwrite_original", "-TagsFromFile"]
arguments += [source, target]
subprocess.check_output(arguments, shell=_IS_WINDOWS_PLATFORM)
subprocess.check_output(
arguments, shell=_IS_WINDOWS_PLATFORM # noqa: S603
)

return True

Expand Down Expand Up @@ -356,7 +358,7 @@ def delete_exif_tags(image: str) -> bool:

subprocess.check_output(
[EXIF_EXECUTABLE, "-overwrite_original", "-all=", image],
shell=_IS_WINDOWS_PLATFORM,
shell=_IS_WINDOWS_PLATFORM, # noqa: S603
)

return True
Expand All @@ -382,7 +384,8 @@ def read_exif_tag(image: str, tag: str) -> str:
value = (
str(
subprocess.check_output(
[EXIF_EXECUTABLE, f"-{tag}", image], shell=_IS_WINDOWS_PLATFORM
[EXIF_EXECUTABLE, f"-{tag}", image],
shell=_IS_WINDOWS_PLATFORM, # noqa: S603
),
"utf-8",
"ignore",
Expand Down Expand Up @@ -426,6 +429,8 @@ def write_exif_tag(image: str, tag: str, value: str) -> bool:

arguments = [EXIF_EXECUTABLE, "-overwrite_original"]
arguments += [f"-{tag}={value}", image]
subprocess.check_output(arguments, shell=_IS_WINDOWS_PLATFORM)
subprocess.check_output(
arguments, shell=_IS_WINDOWS_PLATFORM # noqa: S603
)

return True
4 changes: 2 additions & 2 deletions utilities/export_todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ def extract_todo_items(root_directory: str) -> dict:
if not filename.endswith(".py"):
continue

filename = os.path.join(root, filename)
filename = os.path.join(root, filename) # noqa: PLW2901
with codecs.open(filename, encoding="utf8") as file_handle:
content = file_handle.readlines()

in_todo = False
line_number = 1
todo_item = []
for i, line in enumerate(content):
line = line.strip()
line = line.strip() # noqa: PLW2901
if line.startswith("# TODO:"):
in_todo = True
line_number = i + 1
Expand Down
2 changes: 1 addition & 1 deletion utilities/unicode_to_ascii.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def unicode_to_ascii(root_directory: str):
if filename == "unicode_to_ascii.py":
continue

filename = os.path.join(root, filename)
filename = os.path.join(root, filename) # noqa: PLW2901
with codecs.open(filename, encoding="utf8") as file_handle:
content = file_handle.read()

Expand Down

0 comments on commit 3c02be2

Please sign in to comment.