Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: emnoor-reef <[email protected]>
  • Loading branch information
mjurbanski-reef and emnoor-reef authored Mar 28, 2024
1 parent 75b7f2b commit e1064d3
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions b2/_internal/_cli/autocomplete_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ class ZshAutocompleteInstaller(BashLikeAutocompleteInstaller):
def get_rc_section(self, completion_script: Path) -> str:
return textwrap.dedent(
f"""\
if [[ -z "$_comps" ]] && [[ -t 0 ]]; then autoload -Uz compinit && compinit -i -D; fi
source {quote(str(completion_script))}
"""
if [[ -z "$_comps" ]] && [[ -t 0 ]]; then autoload -Uz compinit && compinit -i -D; fi
source {quote(str(completion_script))}
"""
)

def get_script_path(self) -> Path:
Expand Down Expand Up @@ -259,7 +259,8 @@ def _silent_success_run(cmd: list[str], timeout: int = 30, env: dict | None = No
stdout, stderr = p.communicate(timeout=1)
logger.warning("Command %r timed out, stdout: %r, stderr: %r", cmd, stdout, stderr)
else:
(logger.debug if p.returncode == 0 else logger.warning)(
logger.log(
logging.DEBUG if p.returncode == 0 else logging.WARNING,
"Command %r exited with code %r, stdout: %r, stderr: %r", cmd, p.returncode, stdout,
stderr
)
Expand Down Expand Up @@ -288,8 +289,10 @@ def _silent_success_run_with_pty(
finally:
child.close()

(logger.debug if child.exitstatus == 0 else logger.warning
)("Command %r exited with code %r, output: %r", cmd, child.exitstatus, output.getvalue())
logger.log(
logging.DEBUG if child.exitstatus == 0 else logging.WARNING,
"Command %r exited with code %r, output: %r", cmd, child.exitstatus, output.getvalue()
)
return child.exitstatus == 0


Expand Down

0 comments on commit e1064d3

Please sign in to comment.