Skip to content

Commit 3ad8c24

Browse files
committed
Fix black formatting
1 parent 627c4ca commit 3ad8c24

File tree

4 files changed

+42
-28
lines changed

4 files changed

+42
-28
lines changed

src/mxdev/processing.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,7 @@ def write_dev_sources(fio, packages: dict[str, dict[str, typing.Any]]):
231231
fio.write("\n\n")
232232

233233

234-
def write_dev_overrides(
235-
fio, overrides: dict[str, str], package_keys: list[str]
236-
):
234+
def write_dev_overrides(fio, overrides: dict[str, str], package_keys: list[str]):
237235
"""Create requirements configuration for overridden packages."""
238236
fio.write("#" * 79 + "\n")
239237
fio.write("# mxdev constraint overrides\n")

src/mxdev/vcs/common.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,7 @@ def matches(self) -> bool: ...
106106
def update(self, **kwargs) -> str | None: ...
107107

108108

109-
def yesno(
110-
question: str, default: bool = True, all: bool = True
111-
) -> str | bool:
109+
def yesno(question: str, default: bool = True, all: bool = True) -> str | bool:
112110
if default:
113111
question = f"{question} [Yes/no"
114112
answers: dict[str | bool, tuple] = {
@@ -263,14 +261,18 @@ def _checkout_impl(self, packages: list[str], **kwargs) -> None:
263261
kwargs["update"] = False
264262
else:
265263
logger.error(
266-
"Unknown value '{}' for always-checkout option.".format(kwargs["update"])
264+
"Unknown value '{}' for always-checkout option.".format(
265+
kwargs["update"]
266+
)
267267
)
268268
sys.exit(1)
269269
kwargs.setdefault("submodules", "always")
270270
# XXX: submodules is git related, move to GitWorkingCopy
271271
if kwargs["submodules"] not in ["always", "never", "checkout", "recursive"]:
272272
logger.error(
273-
"Unknown value '{}' for update-git-submodules option.".format(kwargs["submodules"])
273+
"Unknown value '{}' for update-git-submodules option.".format(
274+
kwargs["submodules"]
275+
)
274276
)
275277
sys.exit(1)
276278
for name in packages:
@@ -328,9 +330,7 @@ def matches(self, source: dict[str, str]) -> bool:
328330
logger.exception("Can not get matches!")
329331
sys.exit(1)
330332

331-
def status(
332-
self, source: dict[str, str], **kwargs
333-
) -> str | tuple[str, str]:
333+
def status(self, source: dict[str, str], **kwargs) -> str | tuple[str, str]:
334334
name = source["name"]
335335
if name not in self.sources:
336336
logger.error(f"Status failed. No source defined for '{name}'.")

src/mxdev/vcs/git.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,7 @@ def git_checkout(self, **kwargs) -> str | None:
139139
path = str(self.source["path"])
140140
url = self.source["url"]
141141
if os.path.exists(path):
142-
self.output(
143-
(logger.info, f"Skipped cloning of existing package '{name}'.")
144-
)
142+
self.output((logger.info, f"Skipped cloning of existing package '{name}'."))
145143
return None
146144
msg = f"Cloned '{name}' with git"
147145
if "branch" in self.source:
@@ -205,7 +203,9 @@ def git_switch_branch(
205203
if "rev" in self.source:
206204
# A tag or revision was specified instead of a branch
207205
argv = ["checkout", self.source["rev"]]
208-
self.output((logger.info, "Switching to rev '{}'.".format(self.source["rev"])))
206+
self.output(
207+
(logger.info, "Switching to rev '{}'.".format(self.source["rev"]))
208+
)
209209
elif re.search(rf"^(\*| ) {re.escape(branch)}$", stdout, re.M):
210210
# the branch is local, normal checkout will work
211211
argv = ["checkout", branch]
@@ -322,7 +322,9 @@ def checkout(self, **kwargs) -> str | None:
322322
self.output(
323323
(
324324
logger.warning,
325-
"Checkout URL for existing package '{}' differs. Expected '{}'.".format(name, self.source["url"]),
325+
"Checkout URL for existing package '{}' differs. Expected '{}'.".format(
326+
name, self.source["url"]
327+
),
326328
)
327329
)
328330
return None
@@ -380,13 +382,13 @@ def git_set_pushurl(self, stdout_in, stderr_in) -> tuple[str, str]:
380382

381383
if cmd.returncode != 0:
382384
raise GitError(
383-
"git config remote.{}.pushurl {} \nfailed.\n".format(self._upstream_name, self.source["pushurl"])
385+
"git config remote.{}.pushurl {} \nfailed.\n".format(
386+
self._upstream_name, self.source["pushurl"]
387+
)
384388
)
385389
return (stdout_in + stdout, stderr_in + stderr)
386390

387-
def git_init_submodules(
388-
self, stdout_in, stderr_in
389-
) -> tuple[str, str, list]:
391+
def git_init_submodules(self, stdout_in, stderr_in) -> tuple[str, str, list]:
390392
cmd = self.run_git(["submodule", "init"], cwd=self.source["path"])
391393
stdout, stderr = cmd.communicate()
392394
if cmd.returncode != 0:

src/mxdev/vcs/svn.py

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,15 @@ def _normalized_url_rev(self):
5353
url[2] = path
5454
if "rev" in self.source and "revision" in self.source:
5555
raise ValueError(
56-
"The source definition of '{}' contains duplicate revision options.".format(self.source["name"])
56+
"The source definition of '{}' contains duplicate revision options.".format(
57+
self.source["name"]
58+
)
5759
)
5860
if rev is not None and ("rev" in self.source or "revision" in self.source):
5961
raise ValueError(
60-
"The url of '{}' contains a revision and there is an additional revision option.".format(self.source["name"])
62+
"The url of '{}' contains a revision and there is an additional revision option.".format(
63+
self.source["name"]
64+
)
6165
)
6266
elif rev is None:
6367
rev = self.source.get("revision", self.source.get("rev"))
@@ -101,7 +105,9 @@ def _svn_check_version(self):
101105
sys.exit(1)
102106
if (version < (1, 5)) and not _svn_version_warning:
103107
logger.warning(
104-
"The installed 'svn' command is too old. Expected 1.5 or newer, got {}.".format(".".join([str(x) for x in version]))
108+
"The installed 'svn' command is too old. Expected 1.5 or newer, got {}.".format(
109+
".".join([str(x) for x in version])
110+
)
105111
)
106112
_svn_version_warning = True
107113

@@ -134,7 +140,9 @@ def _svn_error_wrapper(self, f, **kwargs):
134140
common.output_lock.release()
135141
continue
136142
print(
137-
"Authorization needed for '{}' at '{}'".format(self.source["name"], self.source["url"])
143+
"Authorization needed for '{}' at '{}'".format(
144+
self.source["name"], self.source["url"]
145+
)
138146
)
139147
user = input("Username: ")
140148
passwd = getpass.getpass("Password: ")
@@ -181,7 +189,9 @@ def _svn_checkout(self, **kwargs):
181189
stdout, stderr, returncode = self._svn_communicate(args, url, **kwargs)
182190
if returncode != 0:
183191
raise SVNError(
184-
"Subversion checkout for '{}' failed.\n{}".format(name, stderr.decode("utf8"))
192+
"Subversion checkout for '{}' failed.\n{}".format(
193+
name, stderr.decode("utf8")
194+
)
185195
)
186196
if kwargs.get("verbose", False):
187197
return stdout.decode("utf8")
@@ -339,10 +349,14 @@ def checkout(self, **kwargs):
339349
url = self._svn_info().get("url", "")
340350
if url:
341351
msg = f"The current checkout of '{name}' is from '{url}'."
342-
msg += "\nCan't switch package to '{}' because it's dirty.".format(self.source["url"])
352+
msg += (
353+
"\nCan't switch package to '{}' because it's dirty.".format(
354+
self.source["url"]
355+
)
356+
)
343357
else:
344-
msg = (
345-
"Can't switch package '{}' to '{}' because it's dirty.".format(name, self.source["url"])
358+
msg = "Can't switch package '{}' to '{}' because it's dirty.".format(
359+
name, self.source["url"]
346360
)
347361
raise SVNError(msg)
348362
else:

0 commit comments

Comments
 (0)