Skip to content

Commit

Permalink
fs: fix implicitly concatenated strings on a single line
Browse files Browse the repository at this point in the history
Summary:
Similar to D65389031, this diff fixes the implicitly concatenated strings on a
single line.

While it is valid Python syntax to concatenate multiple string or byte literals
implicitly (via whitespace delimiters), it is unnecessary and negatively affects
code readability.

This diff used `ruff` to fix those strings, and then used `arc lint` to fix the
format, and also some manual changes (ruff does not support automatically
fixing mixed usage of f-strings and regular strings).
```
$ ruff check --select ISC001 --fix
$ arc lint
```

Reviewed By: MichaelCuevas

Differential Revision: D66881295

fbshipit-source-id: c977ef66110cb3e7d477f7020e47a1dbcaf56fee
  • Loading branch information
zzl0 authored and facebook-github-bot committed Dec 6, 2024
1 parent 1dd2d3c commit ffbe20a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions eden/fs/cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1387,13 +1387,13 @@ def get_field(key: str) -> str:
if isinstance(value, str):
return value
raise CheckoutConfigCorruptedError(
f"{config_path} is missing {key} in " "[repository]"
f"{config_path} is missing {key} in [repository]"
)

scm_type = get_field("type")
if scm_type not in SUPPORTED_REPOS:
raise CheckoutConfigCorruptedError(
f'repository "{config_path}" has unsupported type ' f'"{scm_type}"'
f'repository "{config_path}" has unsupported type "{scm_type}"'
)

mount_protocol = repository.get("protocol")
Expand Down
10 changes: 4 additions & 6 deletions eden/fs/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,17 +881,15 @@ def run(self, args: argparse.Namespace) -> int:
# mount, but check this here just to fail early if things look wrong.)
try:
for _ in os.listdir(args.path):
print_stderr(f"error: destination path {args.path} " "is not empty")
print_stderr(f"error: destination path {args.path} is not empty")
return 1
except OSError as ex:
if ex.errno == errno.ENOTDIR:
print_stderr(
f"error: destination path {args.path} " "is not a directory"
)
print_stderr(f"error: destination path {args.path} is not a directory")
return 1
elif ex.errno != errno.ENOENT:
print_stderr(
f"error: unable to access destination path " f"{args.path}: {ex}"
f"error: unable to access destination path {args.path}: {ex}"
)
return 1

Expand Down Expand Up @@ -994,7 +992,7 @@ def is_nfs_default():
commit = repo.get_commit_hash(args.rev)
except Exception as ex:
print_stderr(
f"error: unable to find hash for commit " f"{args.rev!r}: {ex}"
f"error: unable to find hash for commit {args.rev!r}: {ex}"
)
return 1
else:
Expand Down
4 changes: 2 additions & 2 deletions eden/fs/cli/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ def __init__(
self._hg_binary = os.environ.get("EDEN_HG_BINARY", "hg")

def __repr__(self) -> str:
return f"HgRepo(source={self.source!r}, " f"working_dir={self.working_dir!r})"
return f"HgRepo(source={self.source!r}, working_dir={self.working_dir!r})"

# pyre-fixme[2]: Parameter must be annotated.
def _run_hg(self, args: List[str], stderr_output=None) -> bytes:
Expand All @@ -420,7 +420,7 @@ def __init__(self, source: str, working_dir: Optional[str] = None) -> None:
super(GitRepo, self).__init__("git", source, working_dir)

def __repr__(self) -> str:
return f"GitRepo(source={self.source!r}, " f"working_dir={self.working_dir!r})"
return f"GitRepo(source={self.source!r}, working_dir={self.working_dir!r})"

def _run_git(self, args: List[str]) -> bytes:
cmd = ["git"] + args
Expand Down

0 comments on commit ffbe20a

Please sign in to comment.