Skip to content

Commit

Permalink
ci(pre-commit.ci): 🎨 Auto format from pre-commit.com hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Nov 13, 2023
1 parent 004a94a commit 6db194e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion micropy/app/stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def _get_desc(name: str, cfg: dict):
pyb.run_script(create_stubs, DevicePath(dev_path))
except Exception as e:
# TODO: Handle more usage cases
log.error(f"Failed to execute script: {str(e)}", exception=e)
log.error(f"Failed to execute script: {e!s}", exception=e)
raise
log.success("Done!")
log.info("Copying stubs...")
Expand Down
2 changes: 1 addition & 1 deletion micropy/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class StubValidationError(StubError):
"""Raised when a stub fails validation."""

def __init__(self, path, errors, *args, **kwargs):
msg = f"Stub at[{str(path)}] encountered" f" the following validation errors: {str(errors)}"
msg = f"Stub at[{path!s}] encountered" f" the following validation errors: {errors!s}"
super().__init__(msg, *args, **kwargs)

def __str__(self):
Expand Down
2 changes: 1 addition & 1 deletion micropy/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def exception(self, error, **kwargs):
"""
name = type(error).__name__
msg = f"{name}: {str(error)}"
msg = f"{name}: {error!s}"
return self.echo(msg, log="exception", title_color="red", fg="red", accent="red", **kwargs)

def success(self, msg, **kwargs):
Expand Down
8 changes: 4 additions & 4 deletions micropy/project/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def render_to(self, name, parent_dir, *args, **kwargs):
"""
template = self.get(name, **kwargs)
self.log.debug(f"Loaded: {str(template)}")
self.log.debug(f"Loaded: {template!s}")
if self.run_checks:
self.log.debug(f"Verifying {template} requirements...")
template.run_checks()
Expand All @@ -305,7 +305,7 @@ def render_to(self, name, parent_dir, *args, **kwargs):
self.log.debug(f"Create: {out_dir}")
parent_dir.mkdir(exist_ok=True)
out_dir.parent.mkdir(exist_ok=True, parents=True)
self.log.debug(f"Rendered: {name} to {str(out_dir)}")
self.log.debug(f"Rendered: {name} to {out_dir!s}")
self.log.info(f"$[{name.capitalize()}] File Generated!")
stream = template.render_stream()
return stream.dump(str(out_dir))
Expand All @@ -326,13 +326,13 @@ def update(self, name, root_dir, **kwargs):
"""
template = self.get(name, **kwargs)
self.log.debug(f"Loaded: {str(template)}")
self.log.debug(f"Loaded: {template!s}")
try:
template.update(root_dir)
except FileNotFoundError:
self.log.debug("Template does not exist!")
return self.render_to(name, root_dir, **kwargs)
self.log.debug(f"Updated: {str(template)}")
self.log.debug(f"Updated: {template!s}")
return template

@property
Expand Down
4 changes: 2 additions & 2 deletions micropy/pyd/backend_upydevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def write_file(
target_path = self.resolve_path(target_path)
self._pydevice.cmd("import gc")
self._pydevice.cmd("import ubinascii")
self._pydevice.cmd(f"f = open('{str(target_path)}', 'wb')")
self._pydevice.cmd(f"f = open('{target_path!s}', 'wb')")

content_iter = (
iterutils.chunked_iter(contents, self.BUFFER_SIZE)
Expand All @@ -212,7 +212,7 @@ def write_file(
)

content_size = len(contents)
consumer.on_start(name=f"Writing {str(target_path)}", size=content_size)
consumer.on_start(name=f"Writing {target_path!s}", size=content_size)

for chunk in content_iter:
cmd = (
Expand Down

0 comments on commit 6db194e

Please sign in to comment.