Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

language tidyups for python 3.7+ #245

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/gen_api_nav.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def main():
full_doc_path = full_doc_path.as_posix().replace("\\", "/")
with mkdocs_gen_files.open(full_doc_path, "w") as fd:
ident = ".".join(parts)
print(f"::: " + ident, file=fd)
print("::: " + ident, file=fd)

mkdocs_gen_files.set_edit_path(full_doc_path, path.as_posix().replace("\\", "/"))

Expand Down
2 changes: 1 addition & 1 deletion docs/gen_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
)


class Examples(object):
class Examples():
def __init__(self, root: Path):
self._root = root

Expand Down
2 changes: 1 addition & 1 deletion photoshop/api/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from photoshop.api.errors import PhotoshopPythonAPIError


class Photoshop(object):
class Photoshop():
"""Core API for all photoshop objects."""

_root = "Photoshop"
Expand Down
4 changes: 2 additions & 2 deletions photoshop/api/_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def fullName(self):
return Path(self.app.fullName)
except COMError:
self.eval_javascript(
'alert ("Please save your Document first!",' '"{}")'.format(self.name),
f'alert ("Please save your Document first!","{self.name}")',
)

@property
Expand Down Expand Up @@ -237,7 +237,7 @@ def path(self) -> str:
return Path(self.app.path)
except COMError:
self.eval_javascript(
'alert ("Please save your Document first!",' '"{}")'.format(self.name),
f'alert ("Please save your Document first!","{self.name}")',
)

@path.setter
Expand Down
2 changes: 1 addition & 1 deletion photoshop/api/_notifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, parent: Optional[Any] = None):

@property
def _notifiers(self) -> list:
return [n for n in self.app]
return list(self.app)

def __len__(self):
return self.length
Expand Down
2 changes: 1 addition & 1 deletion photoshop/api/_text_fonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def __iter__(self):

@property
def _fonts(self):
return [a for a in self.app]
return list(self.app)

def __len__(self):
return self.length
Expand Down
16 changes: 3 additions & 13 deletions photoshop/api/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,7 @@ def doAction(self, action, action_from="Default Actions"):
return True

def doForcedProgress(self, title, javascript):
script = "app.doForcedProgress('{}', '{}')".format(
title,
javascript,
)
script = f"app.doForcedProgress('{title}', '{javascript}')"
self.eval_javascript(script)
# Ensure the script execute success.
time.sleep(1)
Expand All @@ -307,10 +304,7 @@ def doProgress(self, title, javascript):
javascript (str): JavaScriptString to execute.
"""
script = "app.doProgress('{}', '{}')".format(
title,
javascript,
)
script = f"app.doProgress('{title}', '{javascript}')"
self.eval_javascript(script)
# Ensure the script execute success.
time.sleep(1)
Expand All @@ -327,11 +321,7 @@ def doProgressSegmentTask(self, segmentLength, done, total, javascript):
time.sleep(1)

def doProgressSubTask(self, index, limit, javascript):
script = "app.doProgressSubTask({}, {}, '{}');".format(
index,
limit,
javascript,
)
script = f"app.doProgressSubTask({index}, {limit}, '{javascript}');"
self.eval_javascript(script)
# Ensure the script execute success.
time.sleep(1)
Expand Down
2 changes: 1 addition & 1 deletion test/test_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

def test_imports():
"""Test import modules."""
prefix = "{}.".format(photoshop.__name__)
prefix = f"{photoshop.__name__}."
iter_packages = pkgutil.walk_packages(
photoshop.__path__, # noqa: WPS609
prefix,
Expand Down