From 4cbfc42cba91e1b51169902ea61bb239651d57c8 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Mon, 4 Nov 2024 15:02:11 +0100 Subject: [PATCH 1/3] Update ruff from 0.7.0 to 0.7.2 --- requirements-ci.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-ci.txt b/requirements-ci.txt index 70917644fd34..be78aa3e97cf 100644 --- a/requirements-ci.txt +++ b/requirements-ci.txt @@ -66,7 +66,7 @@ pytz==2024.2 PyYAML==6.0.2 requests==2.32.3 responses==0.25.3 -ruff==0.7.0 +ruff==0.7.2 s3transfer==0.10.3 service-identity==24.1.0 setuptools-trial==0.6.0 From bec5d6945a0054876185fa66c4dd116b67ecf412 Mon Sep 17 00:00:00 2001 From: Pavol Misik Date: Tue, 5 Nov 2024 17:32:16 +0100 Subject: [PATCH 2/3] Reformat files with ruff 0.7.2 --- common/gather_dependabot.py | 2 +- master/buildbot/changes/github.py | 2 +- master/buildbot/changes/mail.py | 2 +- master/buildbot/config/checks.py | 3 +- master/buildbot/data/base.py | 3 +- master/buildbot/data/resultspec.py | 11 +++---- master/buildbot/db/compression/zstd.py | 18 +++++----- master/buildbot/db/pool.py | 6 ++-- master/buildbot/db/test_result_sets.py | 3 +- master/buildbot/master.py | 2 +- master/buildbot/process/properties.py | 5 ++- master/buildbot/process/users/manual.py | 6 ++-- master/buildbot/reporters/gerrit.py | 2 +- master/buildbot/reporters/gitlab.py | 8 ++--- master/buildbot/reporters/telegram.py | 2 +- master/buildbot/reporters/words.py | 8 ++--- master/buildbot/schedulers/canceller.py | 3 +- master/buildbot/schedulers/forcesched.py | 3 +- master/buildbot/scripts/runner.py | 7 ++-- master/buildbot/scripts/windows_service.py | 5 ++- master/buildbot/steps/master.py | 2 +- master/buildbot/steps/source/base.py | 14 ++++---- master/buildbot/steps/source/svn.py | 5 +-- master/buildbot/steps/trigger.py | 3 +- master/buildbot/steps/vstudio.py | 2 +- .../buildbot/test/integration/test_upgrade.py | 5 ++- master/buildbot/test/steps.py | 4 +-- .../test/unit/process/test_buildstep.py | 3 +- .../test/unit/reporters/test_pushover.py | 3 +- .../test/unit/steps/test_source_git.py | 16 +++------ .../buildbot/test/unit/steps/test_transfer.py | 2 +- .../test/unit/test_test_util_validation.py | 2 +- .../test/unit/util/test_identifiers.py | 2 +- master/buildbot/test/unit/worker/test_ec2.py | 6 ++-- master/buildbot/test/unit/www/test_avatar.py | 33 +++++++------------ .../test/unit/www/test_hooks_github.py | 6 ++-- master/buildbot/test/unit/www/test_ws.py | 3 +- master/buildbot/test/util/interfaces.py | 4 +-- master/buildbot/util/service.py | 5 ++- master/buildbot/util/ssfilter.py | 4 +-- master/buildbot/worker/docker.py | 6 ++-- master/buildbot/worker/ec2.py | 15 ++++----- master/buildbot/worker/manager.py | 2 +- master/buildbot/worker/openstack.py | 4 +-- master/buildbot/worker/protocols/msgpack.py | 3 +- master/buildbot/www/rest.py | 4 +-- master/buildbot/www/service.py | 3 +- master/contrib/bitbucket_buildbot.py | 7 ++-- master/contrib/bzr_buildbot.py | 2 +- master/contrib/generate_changelog.py | 4 +-- master/contrib/git_buildbot.py | 6 ++-- master/contrib/github_buildbot.py | 8 ++--- master/contrib/hgbuildbot.py | 3 +- master/docs/conf.py | 2 +- worker/buildbot_worker/base.py | 3 +- worker/buildbot_worker/commands/utils.py | 6 ++-- worker/buildbot_worker/pb.py | 3 +- worker/buildbot_worker/runprocess.py | 2 +- worker/buildbot_worker/scripts/runner.py | 3 +- www/wsgi_dashboards/setup.py | 2 +- 60 files changed, 124 insertions(+), 189 deletions(-) diff --git a/common/gather_dependabot.py b/common/gather_dependabot.py index 041f556e06ac..93fd15016a12 100755 --- a/common/gather_dependabot.py +++ b/common/gather_dependabot.py @@ -27,7 +27,7 @@ def main(): print(pr['number'], pr['title']) pr_text += f"#{pr['number']}: {pr['title']}\n" os.system( - "git fetch https://github.com/buildbot/buildbot " f"refs/pull/{pr['number']}/head" + f"git fetch https://github.com/buildbot/buildbot refs/pull/{pr['number']}/head" ) os.system("git cherry-pick FETCH_HEAD") diff --git a/master/buildbot/changes/github.py b/master/buildbot/changes/github.py index 48e5c78fef59..d435d745ae6e 100644 --- a/master/buildbot/changes/github.py +++ b/master/buildbot/changes/github.py @@ -130,7 +130,7 @@ def reconfigService( self.project = bytes2unicode(project) def describe(self): - return "GitHubPullrequestPoller watching the " f"GitHub repository {self.owner}/{self.repo}" + return f"GitHubPullrequestPoller watching the GitHub repository {self.owner}/{self.repo}" @defer.inlineCallbacks def _getPullInformation(self, pull_number): diff --git a/master/buildbot/changes/mail.py b/master/buildbot/changes/mail.py index c21ed073464e..20effb3ad8b0 100644 --- a/master/buildbot/changes/mail.py +++ b/master/buildbot/changes/mail.py @@ -55,7 +55,7 @@ def __init__(self, maildir, prefix=None, category='', repository=''): self.repository = repository if prefix and not prefix.endswith("/"): log.msg( - f"MaildirSource: you probably want your prefix=('{prefix}') to end with " "a slash" + f"MaildirSource: you probably want your prefix=('{prefix}') to end with a slash" ) def describe(self): diff --git a/master/buildbot/config/checks.py b/master/buildbot/config/checks.py index 7d98002e2134..53d4d18b9afc 100644 --- a/master/buildbot/config/checks.py +++ b/master/buildbot/config/checks.py @@ -29,8 +29,7 @@ def check_param_length(value, name, max_length): shortest_value = value.fmtstring % interpolations if len(shortest_value) > max_length: error( - f"{name} '{value}' (shortest interpolation) exceeds maximum length of " - f"{max_length}" + f"{name} '{value}' (shortest interpolation) exceeds maximum length of {max_length}" ) diff --git a/master/buildbot/data/base.py b/master/buildbot/data/base.py index b84f5b3b97bb..d5043a9ddd32 100644 --- a/master/buildbot/data/base.py +++ b/master/buildbot/data/base.py @@ -157,8 +157,7 @@ def get_kwargs_from_graphql_parent(self, parent, parent_type): parentid = rtype.keyField else: raise NotImplementedError( - "Collection endpoint should implement " - "get_kwargs_from_graphql or parentMapping" + "Collection endpoint should implement get_kwargs_from_graphql or parentMapping" ) else: parentid = self.parentMapping[parent_type] diff --git a/master/buildbot/data/resultspec.py b/master/buildbot/data/resultspec.py index 65b5ab767794..47f706d68b32 100644 --- a/master/buildbot/data/resultspec.py +++ b/master/buildbot/data/resultspec.py @@ -30,10 +30,7 @@ class NotSupportedFieldTypeError(TypeError): def __init__(self, data, *args: object) -> None: super().__init__( - ( - f"Unsupported data type '{type(data)}': " - "must be an instance of Dict or a Dataclass." - ), + (f"Unsupported data type '{type(data)}': must be an instance of Dict or a Dataclass."), *args, ) @@ -429,9 +426,9 @@ def includeFields(d): # item collection if isinstance(data, base.ListResult): # if pagination was applied, then fields, etc. must be empty - assert ( - not fields and not order and not filters - ), "endpoint must apply fields, order, and filters if it performs pagination" + assert not fields and not order and not filters, ( + "endpoint must apply fields, order, and filters if it performs pagination" + ) offset = data.offset total = data.total limit = data.limit diff --git a/master/buildbot/db/compression/zstd.py b/master/buildbot/db/compression/zstd.py index 2e2c968f89ae..fb9c54244c19 100644 --- a/master/buildbot/db/compression/zstd.py +++ b/master/buildbot/db/compression/zstd.py @@ -129,19 +129,19 @@ def compress(self, data: bytes) -> bytes: self._compressor = ZStdCompressor._compressor_pool.acquire() self._compressobj = self._compressor.compressobj() else: - assert ( - self._compressobj is not None - ), "Programming error: _compressobj is None when _compressor is not" + assert self._compressobj is not None, ( + "Programming error: _compressobj is None when _compressor is not" + ) return self._compressobj.compress(data) def flush(self) -> bytes: - assert ( - self._compressor is not None - ), "Programming error: Flush called without previous compress" - assert ( - self._compressobj is not None - ), "Programming error: _compressobj is None when _compressor is not" + assert self._compressor is not None, ( + "Programming error: Flush called without previous compress" + ) + assert self._compressobj is not None, ( + "Programming error: _compressobj is None when _compressor is not" + ) try: return self._compressobj.flush(flush_mode=zstandard.COMPRESSOBJ_FLUSH_FINISH) diff --git a/master/buildbot/db/pool.py b/master/buildbot/db/pool.py index 388cf7acef85..768db589b236 100644 --- a/master/buildbot/db/pool.py +++ b/master/buildbot/db/pool.py @@ -231,9 +231,9 @@ def __thd( try: try: rv = callable(arg, *args, **kwargs) - assert not isinstance( - rv, self.forbidded_callable_return_type - ), "do not return ResultProxy objects!" + assert not isinstance(rv, self.forbidded_callable_return_type), ( + "do not return ResultProxy objects!" + ) except sa.exc.OperationalError as e: if not self.engine.should_retry(e): log.err(e, 'Got fatal OperationalError on DB') diff --git a/master/buildbot/db/test_result_sets.py b/master/buildbot/db/test_result_sets.py index dfbcf4e720f1..6d75e44ecc0a 100644 --- a/master/buildbot/db/test_result_sets.py +++ b/master/buildbot/db/test_result_sets.py @@ -145,8 +145,7 @@ def thd(conn) -> None: conn.commit() if res.rowcount == 0: raise TestResultSetAlreadyCompleted( - f'Test result set {test_result_setid} ' - f'is already completed or does not exist' + f'Test result set {test_result_setid} is already completed or does not exist' ) return self.db.pool.do(thd) diff --git a/master/buildbot/master.py b/master/buildbot/master.py index d1b126cc6727..84e0927150bd 100644 --- a/master/buildbot/master.py +++ b/master/buildbot/master.py @@ -392,7 +392,7 @@ def reconfig(self): # longer on larger installations and may take a while. self.reconfig_notifier = task.LoopingCall( lambda: log.msg( - "reconfig is ongoing for " f"{self.reactor.seconds() - self.reconfig_active:.3f} s" + f"reconfig is ongoing for {self.reactor.seconds() - self.reconfig_active:.3f} s" ) ) self.reconfig_notifier.start(10, now=False) diff --git a/master/buildbot/process/properties.py b/master/buildbot/process/properties.py index c9fbaeaf3da0..17d86d72eb2c 100644 --- a/master/buildbot/process/properties.py +++ b/master/buildbot/process/properties.py @@ -668,7 +668,7 @@ def _parse_substitution_src(self, arg): repl = None except ValueError: config.error( - "Must specify both codebase and attribute for " f"src Interpolation '{arg}'" + f"Must specify both codebase and attribute for src Interpolation '{arg}'" ) return {}, None, None @@ -763,8 +763,7 @@ def _parseColon_ternary(self, d, kw, repl, defaultWhenFalse=False): truePart, falsePart = self._splitBalancedParen(delim, repl[1:]) except ValueError: config.error( - f"invalid Interpolate ternary expression '{repl[1:]}' " - f"with delimiter '{repl[0]}'" + f"invalid Interpolate ternary expression '{repl[1:]}' with delimiter '{repl[0]}'" ) return None return _Lookup( diff --git a/master/buildbot/process/users/manual.py b/master/buildbot/process/users/manual.py index 642610d5e33d..8523ed18a973 100644 --- a/master/buildbot/process/users/manual.py +++ b/master/buildbot/process/users/manual.py @@ -198,9 +198,9 @@ class CommandlineUserManager(service.AsyncMultiService): def __init__(self, username=None, passwd=None, port=None): super().__init__() - assert ( - username and passwd - ), "A username and password pair must be given to connect and use `buildbot user`" + assert username and passwd, ( + "A username and password pair must be given to connect and use `buildbot user`" + ) self.username = username self.passwd = passwd diff --git a/master/buildbot/reporters/gerrit.py b/master/buildbot/reporters/gerrit.py index de7ffbcf46ae..b2de7d30c43a 100644 --- a/master/buildbot/reporters/gerrit.py +++ b/master/buildbot/reporters/gerrit.py @@ -59,7 +59,7 @@ def _old_add_label(label, value): elif label == GERRIT_LABEL_REVIEWED: return [f"--code-review {int(value)}"] warnings.warn( - 'Gerrit older than 2.6 does not support custom labels. ' f'Setting {label} is ignored.', + f'Gerrit older than 2.6 does not support custom labels. Setting {label} is ignored.', stacklevel=1, ) return [] diff --git a/master/buildbot/reporters/gitlab.py b/master/buildbot/reporters/gitlab.py index 88d6eb4dfd61..84539c6961e8 100644 --- a/master/buildbot/reporters/gitlab.py +++ b/master/buildbot/reporters/gitlab.py @@ -150,8 +150,7 @@ def getProjectId(self, sourcestamp): proj = yield response.json() if response.code not in (200,): log.msg( - 'Unknown (or hidden) gitlab project' - f'{project_full_name}: {proj.get("message")}' + f'Unknown (or hidden) gitlab project{project_full_name}: {proj.get("message")}' ) return None self.project_ids[project_full_name] = proj['id'] @@ -223,8 +222,5 @@ def sendMessage(self, reports): except Exception as e: log.err( e, - ( - f'Failed to send status "{state}" for ' - f'{sourcestamp["repository"]} at {sha}' - ), + (f'Failed to send status "{state}" for {sourcestamp["repository"]} at {sha}'), ) diff --git a/master/buildbot/reporters/telegram.py b/master/buildbot/reporters/telegram.py index f7c2bef0d395..3e9ac03934ea 100644 --- a/master/buildbot/reporters/telegram.py +++ b/master/buildbot/reporters/telegram.py @@ -470,7 +470,7 @@ def command_FORCE(self, args, tquery=None, partial=None, **kwargs): sched = next(iter(forceschedulers)) else: raise UsageError( - "Try '/force' and follow the instructions" f" (no force scheduler {sched})" + f"Try '/force' and follow the instructions (no force scheduler {sched})" ) scheduler = forceschedulers[sched] diff --git a/master/buildbot/reporters/words.py b/master/buildbot/reporters/words.py index b4a5ffc281fc..a0cb7d8c1e6c 100644 --- a/master/buildbot/reporters/words.py +++ b/master/buildbot/reporters/words.py @@ -241,8 +241,7 @@ def validate_notification_event(self, event): def list_notified_events(self): if self.notify_events: yield self.send( - 'The following events are being notified: ' - f'{", ".join(sorted(self.notify_events))}.' + f'The following events are being notified: {", ".join(sorted(self.notify_events))}.' ) else: yield self.send("No events are being notified.") @@ -633,7 +632,7 @@ def command_LIST(self, args, **kwargs): if not args: raise UsageError( - "Try " f"'{self.bot.commandPrefix}list [all|N] builders|workers|changes'." + f"Try '{self.bot.commandPrefix}list [all|N] builders|workers|changes'." ) if args[0] == 'builders': @@ -1041,8 +1040,7 @@ def command_HELP(self, args, **kwargs): self.send("No usage info for " + ' '.join([f"'{arg}'" for arg in args])) command_HELP.usage = ( # type: ignore[attr-defined] - "help [_command_ _arg_ [_subarg_ ...]] - " - "Give help for _command_ or one of it's arguments" + "help [_command_ _arg_ [_subarg_ ...]] - Give help for _command_ or one of it's arguments" ) def command_SOURCE(self, args, **kwargs): diff --git a/master/buildbot/schedulers/canceller.py b/master/buildbot/schedulers/canceller.py index 2bb70e8904f6..316079d1a72a 100644 --- a/master/buildbot/schedulers/canceller.py +++ b/master/buildbot/schedulers/canceller.py @@ -181,8 +181,7 @@ def on_complete_buildrequest(self, brid): br_dict = self.br_by_ss.get(ss_tuple, None) if br_dict is None: raise KeyError( - f'{self.__class__.__name__}: Could not find finished builds ' - f'by tuple {ss_tuple}' + f'{self.__class__.__name__}: Could not find finished builds by tuple {ss_tuple}' ) del br_dict[tracked_br.brid] diff --git a/master/buildbot/schedulers/forcesched.py b/master/buildbot/schedulers/forcesched.py index 5a4b3c5bc104..bdc23c82b9f8 100644 --- a/master/buildbot/schedulers/forcesched.py +++ b/master/buildbot/schedulers/forcesched.py @@ -712,8 +712,7 @@ def __init__( if not self.checkIfListOfType(builderNames, (str,)): config.error( - f"ForceScheduler '{name}': builderNames must be a list of strings: " - f"{builderNames!r}" + f"ForceScheduler '{name}': builderNames must be a list of strings: {builderNames!r}" ) if reason is None: diff --git a/master/buildbot/scripts/runner.py b/master/buildbot/scripts/runner.py index deb9cb55828e..817af749a9ab 100644 --- a/master/buildbot/scripts/runner.py +++ b/master/buildbot/scripts/runner.py @@ -625,7 +625,7 @@ def _checkValidTypes(self, info): for attr_type in user: if attr_type not in valid: raise usage.UsageError( - "Type not a valid attr_type, must be in: " f"{', '.join(valid)}" + f"Type not a valid attr_type, must be in: {', '.join(valid)}" ) def postOptions(self): @@ -637,7 +637,7 @@ def postOptions(self): if not op: raise usage.UsageError("you must specify an operation: add, remove, update, get") if op not in ['add', 'remove', 'update', 'get']: - raise usage.UsageError(f"bad op {op!r}, use 'add', 'remove', 'update', " "or 'get'") + raise usage.UsageError(f"bad op {op!r}, use 'add', 'remove', 'update', or 'get'") if not self.get('username') or not self.get('passwd'): raise usage.UsageError("A username and password must be given") @@ -665,8 +665,7 @@ def postOptions(self): for user in info: if 'identifier' not in user: raise usage.UsageError( - "no ids found in update info; " - "use: --info=id:type=value,type=value,.." + "no ids found in update info; use: --info=id:type=value,type=value,.." ) if op == 'add': for user in info: diff --git a/master/buildbot/scripts/windows_service.py b/master/buildbot/scripts/windows_service.py index 7412eefcb612..7154a0d85c63 100755 --- a/master/buildbot/scripts/windows_service.py +++ b/master/buildbot/scripts/windows_service.py @@ -257,8 +257,7 @@ def SvcDoRun(self): ) self.warning( - f"BuildBot for directory {bbdir!r} terminated with " - f"exit code {status}.\n{output}" + f"BuildBot for directory {bbdir!r} terminated with exit code {status}.\n{output}" ) del child_infos[index] @@ -284,7 +283,7 @@ def SvcDoRun(self): self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) # If necessary, kill it if win32process.GetExitCodeProcess(h) == win32con.STILL_ACTIVE: - self.warning(f"BuildBot process at {bbdir!r} failed to terminate - " "killing it") + self.warning(f"BuildBot process at {bbdir!r} failed to terminate - killing it") win32api.TerminateProcess(h, 3) self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) diff --git a/master/buildbot/steps/master.py b/master/buildbot/steps/master.py index 0126e8b7f136..758812a60ddd 100644 --- a/master/buildbot/steps/master.py +++ b/master/buildbot/steps/master.py @@ -119,7 +119,7 @@ def subst(match): if v is not None: if not isinstance(v, (str, bytes)): raise RuntimeError( - "'env' values must be strings or " f"lists; key '{key}' is incorrect" + f"'env' values must be strings or lists; key '{key}' is incorrect" ) newenv[key] = p.sub(subst, env[key]) diff --git a/master/buildbot/steps/source/base.py b/master/buildbot/steps/source/base.py index e9d582a5bc34..35066a5d8687 100644 --- a/master/buildbot/steps/source/base.py +++ b/master/buildbot/steps/source/base.py @@ -178,16 +178,16 @@ def updateSourceProperty(self, name, value, source=''): source = self.__class__.__name__ if self.codebase != '': - assert not isinstance( - self.getProperty(name, None), str - ), f"Sourcestep {self.name} has a codebase, other sourcesteps don't" + assert not isinstance(self.getProperty(name, None), str), ( + f"Sourcestep {self.name} has a codebase, other sourcesteps don't" + ) property_dict = self.getProperty(name, {}) property_dict[self.codebase] = value super().setProperty(name, property_dict, source) else: - assert not isinstance( - self.getProperty(name, None), dict - ), f"Sourcestep {self.name} does not have a codebase, other sourcesteps do" + assert not isinstance(self.getProperty(name, None), dict), ( + f"Sourcestep {self.name} does not have a codebase, other sourcesteps do" + ) super().setProperty(name, value, source) def computeSourceRevision(self, changes): @@ -296,7 +296,7 @@ def run(self): log.msg(f"No sourcestamp found in build for codebase '{self.codebase}'") self.descriptionDone = f"Codebase {self.codebase} not in build" yield self.addCompleteLog( - "log", "No sourcestamp found in build for " f"codebase '{self.codebase}'" + "log", f"No sourcestamp found in build for codebase '{self.codebase}'" ) return FAILURE diff --git a/master/buildbot/steps/source/svn.py b/master/buildbot/steps/source/svn.py index f76140a09f91..97b2f1164d2b 100644 --- a/master/buildbot/steps/source/svn.py +++ b/master/buildbot/steps/source/svn.py @@ -301,10 +301,7 @@ def parseGotRevision(self): try: revision = stdout_xml.getElementsByTagName('commit')[0].attributes['revision'].value except (KeyError, IndexError): - msg = ( - "SVN.parseGotRevision unable to detect Last Changed Rev in" - " output of svn info" - ) + msg = "SVN.parseGotRevision unable to detect Last Changed Rev in output of svn info" log.msg(msg) # fall through and try to get 'Revision' instead diff --git a/master/buildbot/steps/trigger.py b/master/buildbot/steps/trigger.py index 82706108b252..7623d8b81542 100644 --- a/master/buildbot/steps/trigger.py +++ b/master/buildbot/steps/trigger.py @@ -239,8 +239,7 @@ def addBuildUrls(self, rclist): num = build.number url = getURLForBuild(self.master, builderid, num) yield self.addURL( - f'{statusToString(build.results)}: ' - f'{builderNames[builderid]} #{num}', + f'{statusToString(build.results)}: {builderNames[builderid]} #{num}', url, ) diff --git a/master/buildbot/steps/vstudio.py b/master/buildbot/steps/vstudio.py index b9d042b71621..f49aa70388b1 100644 --- a/master/buildbot/steps/vstudio.py +++ b/master/buildbot/steps/vstudio.py @@ -198,7 +198,7 @@ def getResultSummary(self): return {"step": results.statusToString(self.results)} description = ( - f'compile {self.logobserver.nbProjects} projects {self.logobserver.nbFiles} ' 'files' + f'compile {self.logobserver.nbProjects} projects {self.logobserver.nbFiles} files' ) if self.logobserver.nbWarnings > 0: diff --git a/master/buildbot/test/integration/test_upgrade.py b/master/buildbot/test/integration/test_upgrade.py index 084e9824180b..85b6e8551973 100644 --- a/master/buildbot/test/integration/test_upgrade.py +++ b/master/buildbot/test/integration/test_upgrade.py @@ -173,8 +173,7 @@ def comp(engine): exp_info = dict((idx['name'], idx) for idx in exp) for name in got_names - exp_names: diff.append( - f"got unexpected index {name} on table {tbl.name}: " - f"{got_info[name]!r}" + f"got unexpected index {name} on table {tbl.name}: {got_info[name]!r}" ) for name in exp_names - got_names: diff.append(f"missing index {name} on table {tbl.name}") @@ -242,7 +241,7 @@ def test_emptydb_modelmatches(self): # Default encoding of Windows console is 'cp1252' # which cannot encode the snowman. raise unittest.SkipTest( - "Cannot encode weird unicode " f"on this platform with {os_encoding}" + f"Cannot encode weird unicode on this platform with {os_encoding}" ) from e yield self.db.model.upgrade() diff --git a/master/buildbot/test/steps.py b/master/buildbot/test/steps.py index 441be1c4b5da..bf1d8542298f 100644 --- a/master/buildbot/test/steps.py +++ b/master/buildbot/test/steps.py @@ -435,7 +435,7 @@ def behavior(command): return self def __repr__(self): - return f"ExpectUploadDirectory({self.args['workdir']!r}, " f"{self.args['workersrc']!r})" + return f"ExpectUploadDirectory({self.args['workdir']!r}, {self.args['workersrc']!r})" class ExpectDownloadFile(Expect): @@ -483,7 +483,7 @@ def behavior(command): return self def __repr__(self): - return f"ExpectUploadDirectory({self.args['workdir']!r}, " f"{self.args['workerdest']!r})" + return f"ExpectUploadDirectory({self.args['workdir']!r}, {self.args['workerdest']!r})" class ExpectMkdir(Expect): diff --git a/master/buildbot/test/unit/process/test_buildstep.py b/master/buildbot/test/unit/process/test_buildstep.py index a4c7055d847c..7cf85e36bf28 100644 --- a/master/buildbot/test/unit/process/test_buildstep.py +++ b/master/buildbot/test/unit/process/test_buildstep.py @@ -186,8 +186,7 @@ def test_updateBuildSummaryPolicyBadType(self): updateBuildSummaryPolicy raise ConfigError in case of bad type """ with self.assertRaisesConfigError( - "BuildStep updateBuildSummaryPolicy must be " - "a list of result ids or boolean but it is 2" + "BuildStep updateBuildSummaryPolicy must be a list of result ids or boolean but it is 2" ): buildstep.BuildStep(updateBuildSummaryPolicy=FAILURE) diff --git a/master/buildbot/test/unit/reporters/test_pushover.py b/master/buildbot/test/unit/reporters/test_pushover.py index 797b396e3750..bd8ed88ae179 100644 --- a/master/buildbot/test/unit/reporters/test_pushover.py +++ b/master/buildbot/test/unit/reporters/test_pushover.py @@ -101,8 +101,7 @@ def test_sendRealNotification(self): creds = os.environ.get('TEST_PUSHOVER_CREDENTIALS') if creds is None: raise SkipTest( - "real pushover test runs only if the variable " - "TEST_PUSHOVER_CREDENTIALS is defined" + "real pushover test runs only if the variable TEST_PUSHOVER_CREDENTIALS is defined" ) user, token = creds.split(':') _http = httpclientservice.HTTPSession(self.master.httpservice, 'https://api.pushover.net') diff --git a/master/buildbot/test/unit/steps/test_source_git.py b/master/buildbot/test/unit/steps/test_source_git.py index 1957d89448f5..bcbe71956500 100644 --- a/master/buildbot/test/unit/steps/test_source_git.py +++ b/master/buildbot/test/unit/steps/test_source_git.py @@ -3974,9 +3974,7 @@ def test_mode_full_clean_auth_credential(self, name, use_http_path): 'approve', ], initial_stdin=( - "url=https://example.com/test/test.git\n" - "username=username\n" - "password=token\n" + "url=https://example.com/test/test.git\nusername=username\npassword=token\n" ), ).exit(0), ExpectListdir(dir='wkdir').files(['.git']).exit(0), @@ -4048,9 +4046,7 @@ def test_mode_full_clean_git_credential(self): 'approve', ], initial_stdin=( - "url=https://example.com/test/test.git\n" - "username=username\n" - "password=token\n" + "url=https://example.com/test/test.git\nusername=username\npassword=token\n" ), ).exit(0), ExpectListdir(dir='wkdir').files(['.git']).exit(0), @@ -4579,9 +4575,7 @@ def test_push_auth_credential(self, name, use_http_path): 'approve', ], initial_stdin=( - "url=https://example.com/test/test.git\n" - "username=username\n" - "password=token\n" + "url=https://example.com/test/test.git\nusername=username\npassword=token\n" ), ).exit(0), ExpectShell( @@ -4642,9 +4636,7 @@ def test_push_git_credential(self): 'approve', ], initial_stdin=( - "url=https://example.com/test/test.git\n" - "username=username\n" - "password=token\n" + "url=https://example.com/test/test.git\nusername=username\npassword=token\n" ), ).exit(0), ExpectShell( diff --git a/master/buildbot/test/unit/steps/test_transfer.py b/master/buildbot/test/unit/steps/test_transfer.py index 4f92d22fd226..85ee4843cefc 100644 --- a/master/buildbot/test/unit/steps/test_transfer.py +++ b/master/buildbot/test/unit/steps/test_transfer.py @@ -1047,7 +1047,7 @@ def test_no_file(self): self.expect_outcome( result=FAILURE, - state_string=f"downloading to {os.path.basename(self.destfile)} " "(failure)", + state_string=f"downloading to {os.path.basename(self.destfile)} (failure)", ) self.expect_log_file('stderr', "File 'not existing file' not available at master") yield self.run_step() diff --git a/master/buildbot/test/unit/test_test_util_validation.py b/master/buildbot/test/unit/test_test_util_validation.py index 47c635fc4955..525e40b40e9a 100644 --- a/master/buildbot/test/unit/test_test_util_validation.py +++ b/master/buildbot/test/unit/test_test_util_validation.py @@ -79,7 +79,7 @@ def test_IdentifierValidator(self): # Default encoding of Windows console is 'cp1252' # which cannot encode the snowman. raise unittest.SkipTest( - "Cannot encode weird unicode " f"on this platform with {os_encoding}" + f"Cannot encode weird unicode on this platform with {os_encoding}" ) from e self.doValidationTest( diff --git a/master/buildbot/test/unit/util/test_identifiers.py b/master/buildbot/test/unit/util/test_identifiers.py index 93abaef1d5f8..8543c0e766f6 100644 --- a/master/buildbot/test/unit/util/test_identifiers.py +++ b/master/buildbot/test/unit/util/test_identifiers.py @@ -30,7 +30,7 @@ def test_isIdentifier(self): # Default encoding of Windows console is 'cp1252' # which cannot encode the snowman. raise unittest.SkipTest( - "Cannot encode weird unicode " f"on this platform with {os_encoding}" + f"Cannot encode weird unicode on this platform with {os_encoding}" ) from e good = ["linux", "Linux", "abc123", "a" * 50, '\N{SNOWMAN}'] diff --git a/master/buildbot/test/unit/worker/test_ec2.py b/master/buildbot/test/unit/worker/test_ec2.py index 92d9b26f9dce..f404710c86b8 100644 --- a/master/buildbot/test/unit/worker/test_ec2.py +++ b/master/buildbot/test/unit/worker/test_ec2.py @@ -86,8 +86,7 @@ def botoSetup(self, name='latent_buildbot_worker'): r.create_key_pair(KeyName=name) except NotImplementedError as e: raise unittest.SkipTest( - "KeyPairs.create_key_pair not implemented" - " in this version of moto, please update." + "KeyPairs.create_key_pair not implemented in this version of moto, please update." ) from e r.create_security_group(GroupName=name, Description='the security group') instance = r.create_instances(ImageId=anyImageId(c), MinCount=1, MaxCount=1)[0] @@ -600,8 +599,7 @@ def botoSetup(self): r.create_key_pair(KeyName='test_keypair') except NotImplementedError as e: raise unittest.SkipTest( - "KeyPairs.create_key_pair not implemented" - " in this version of moto, please update." + "KeyPairs.create_key_pair not implemented in this version of moto, please update." ) from e r.create_security_group(GroupName='latent_buildbot_slave', Description='the security group') r.create_security_group(GroupName='test_security_group', Description='other security group') diff --git a/master/buildbot/test/unit/www/test_avatar.py b/master/buildbot/test/unit/www/test_avatar.py index 6b05e46cbe3f..3e9824d6ff47 100644 --- a/master/buildbot/test/unit/www/test_avatar.py +++ b/master/buildbot/test/unit/www/test_avatar.py @@ -332,8 +332,7 @@ def getUserAvatar(self, email, username, size, defaultAvatarUrl): "git/trees{/sha}", "statuses_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" "statuses/{sha}", - "languages_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" - "languages", + "languages_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/languages", "stargazers_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" "stargazers", "contributors_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" @@ -357,18 +356,15 @@ def getUserAvatar(self, email, username, size, defaultAvatarUrl): "merges_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/merges", "archive_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" "{archive_format}{/ref}", - "downloads_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" - "downloads", + "downloads_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/downloads", "issues_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" "issues{/number}", - "pulls_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" - "pulls{/number}", + "pulls_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/pulls{/number}", "milestones_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" "milestones{/number}", "notifications_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" "notifications{?since,all,participating}", - "labels_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" - "labels{/name}", + "labels_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/labels{/name}", "releases_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" "releases{/id}", "deployments_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" @@ -481,8 +477,7 @@ def getUserAvatar(self, email, username, size, defaultAvatarUrl): "git/trees{/sha}", "statuses_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" "statuses/{sha}", - "languages_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" - "languages", + "languages_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/languages", "stargazers_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" "stargazers", "contributors_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" @@ -506,18 +501,15 @@ def getUserAvatar(self, email, username, size, defaultAvatarUrl): "merges_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/merges", "archive_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" "{archive_format}{/ref}", - "downloads_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" - "downloads", + "downloads_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/downloads", "issues_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" "issues{/number}", - "pulls_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" - "pulls{/number}", + "pulls_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/pulls{/number}", "milestones_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" "milestones{/number}", "notifications_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" "notifications{?since,all,participating}", - "labels_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" - "labels{/name}", + "labels_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/labels{/name}", "releases_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" "releases{/id}", "deployments_url": "https://api.github.com/repos/defunkt-org/defunkt-repo/" @@ -646,8 +638,7 @@ def test_email_commit(self): headers={'Accept': 'application/vnd.github.v3+json'}, ) commit_search_endpoint = ( - '/search/commits?' - 'per_page=1&q=author-email%3Adefunkt%40defunkt.com&sort=committer-date' + '/search/commits?per_page=1&q=author-email%3Adefunkt%40defunkt.com&sort=committer-date' ) self._http.expect( 'get', @@ -672,8 +663,7 @@ def test_email_commit_no_user(self): headers={'Accept': 'application/vnd.github.v3+json'}, ) commit_search_endpoint = ( - '/search/commits?' - 'per_page=1&q=author-email%3Adefunkt%40defunkt.com&sort=committer-date' + '/search/commits?per_page=1&q=author-email%3Adefunkt%40defunkt.com&sort=committer-date' ) self._http.expect( 'get', @@ -696,8 +686,7 @@ def test_email_not_found(self): headers={'Accept': 'application/vnd.github.v3+json'}, ) commit_search_endpoint = ( - '/search/commits?' - 'per_page=1&q=author-email%3Anotfound%40defunkt.com&sort=committer-date' + '/search/commits?per_page=1&q=author-email%3Anotfound%40defunkt.com&sort=committer-date' ) self._http.expect( 'get', diff --git a/master/buildbot/test/unit/www/test_hooks_github.py b/master/buildbot/test/unit/www/test_hooks_github.py index a25ecb486f15..331b3d5a66e5 100644 --- a/master/buildbot/test/unit/www/test_hooks_github.py +++ b/master/buildbot/test/unit/www/test_hooks_github.py @@ -584,9 +584,9 @@ def _prepare_request(event, payload, _secret=None, headers=None): request.method = b"GET" request.received_headers = {_HEADER_EVENT: event} - assert isinstance( - payload, (bytes, list) - ), f"payload can only be bytes or list, not {type(payload)}" + assert isinstance(payload, (bytes, list)), ( + f"payload can only be bytes or list, not {type(payload)}" + ) if isinstance(payload, bytes): request.content = BytesIO(payload) diff --git a/master/buildbot/test/unit/www/test_ws.py b/master/buildbot/test/unit/www/test_ws.py index 9158ad3fb36f..852bba736a11 100644 --- a/master/buildbot/test/unit/www/test_ws.py +++ b/master/buildbot/test/unit/www/test_ws.py @@ -125,8 +125,7 @@ def test_no_type_while_graphql(self): self.proto.sendMessage, { "id": None, - "message": "missing 'type' in websocket frame when already started using " - "graphql", + "message": "missing 'type' in websocket frame when already started using graphql", "type": "error", }, ) diff --git a/master/buildbot/test/util/interfaces.py b/master/buildbot/test/util/interfaces.py index b56e66f880e8..b4f803113b78 100644 --- a/master/buildbot/test/util/interfaces.py +++ b/master/buildbot/test/util/interfaces.py @@ -97,9 +97,7 @@ def assertInterfacesImplemented(self, cls): for interface in zope.interface.implementedBy(cls): for attr, template_argspec in interface.namesAndDescriptions(): if not hasattr(cls, attr): - msg = ( - f"Expected: {cls!r}; to implement: {attr} as specified in " f"{interface!r}" - ) + msg = f"Expected: {cls!r}; to implement: {attr} as specified in {interface!r}" self.fail(msg) actual_argspec = getattr(cls, attr) if isinstance(template_argspec, Attribute): diff --git a/master/buildbot/util/service.py b/master/buildbot/util/service.py index f26734c039f9..07f62204afa8 100644 --- a/master/buildbot/util/service.py +++ b/master/buildbot/util/service.py @@ -121,7 +121,7 @@ def stopService(self): def addService(self, service): if service.name is not None: if service.name in self.namedServices: - raise RuntimeError("cannot have two services with same name" f" '{service.name}'") + raise RuntimeError(f"cannot have two services with same name '{service.name}'") self.namedServices[service.name] = service self.services.append(service) if self.running: @@ -493,8 +493,7 @@ def reconfigServiceWithBuildbotConfig(self, new_config): if removed_names or added_names: log.msg( - f"adding {len(added_names)} new {self.config_attr}, " - f"removing {len(removed_names)}" + f"adding {len(added_names)} new {self.config_attr}, removing {len(removed_names)}" ) for n in removed_names: diff --git a/master/buildbot/util/ssfilter.py b/master/buildbot/util/ssfilter.py index 020db8823428..bc9f3beefc56 100644 --- a/master/buildbot/util/ssfilter.py +++ b/master/buildbot/util/ssfilter.py @@ -36,7 +36,7 @@ def extract_filter_values(values, filter_name): def extract_filter_values_branch(values, filter_name): if not isinstance(values, (list, str, type(None))): raise ValueError( - f"Values of filter {filter_name} must be list of strings, " "a string or None" + f"Values of filter {filter_name} must be list of strings, a string or None" ) if isinstance(values, (str, type(None))): values = [values] @@ -50,7 +50,7 @@ def extract_filter_values_branch(values, filter_name): def extract_filter_values_regex(values, filter_name): if not isinstance(values, (list, str, re.Pattern)): raise ValueError( - f"Values of filter {filter_name} must be list of strings, " "a string or regex" + f"Values of filter {filter_name} must be list of strings, a string or regex" ) if isinstance(values, (str, re.Pattern)): values = [values] diff --git a/master/buildbot/worker/docker.py b/master/buildbot/worker/docker.py index 053d837959ba..c27b3a29aa1e 100644 --- a/master/buildbot/worker/docker.py +++ b/master/buildbot/worker/docker.py @@ -167,7 +167,7 @@ def checkConfig( _, __ = volume_string.split(":", 1) except ValueError: config.error( - "Invalid volume definition for docker " f"{volume_string}. Skipping..." + f"Invalid volume definition for docker {volume_string}. Skipping..." ) continue @@ -224,9 +224,7 @@ def _thd_parse_volumes(self, volumes): try: _, volume = volume_string.split(":", 1) except ValueError: - config.error( - "Invalid volume definition for docker " f"{volume_string}. Skipping..." - ) + config.error(f"Invalid volume definition for docker {volume_string}. Skipping...") continue if volume.endswith(':ro') or volume.endswith(':rw'): diff --git a/master/buildbot/worker/ec2.py b/master/buildbot/worker/ec2.py index 9b6690ea027a..36ddfe94fa17 100644 --- a/master/buildbot/worker/ec2.py +++ b/master/buildbot/worker/ec2.py @@ -150,9 +150,9 @@ def __init__( else: self.placement = None if identifier is None: - assert ( - secret_identifier is None - ), 'supply both or neither of identifier, secret_identifier' + assert secret_identifier is None, ( + 'supply both or neither of identifier, secret_identifier' + ) if aws_id_file_path is None: home = os.environ['HOME'] default_path = os.path.join(home, '.ec2', 'aws_id') @@ -168,9 +168,9 @@ def __init__( 'if you supply the identifier and secret_identifier, ' 'do not specify the aws_id_file_path' ) - assert ( - secret_identifier is not None - ), 'supply both or neither of identifier, secret_identifier' + assert secret_identifier is not None, ( + 'supply both or neither of identifier, secret_identifier' + ) region_found = None @@ -413,8 +413,7 @@ def _stop_instance(self, instance, fast): if instance.state['Name'] not in (SHUTTINGDOWN, TERMINATED): instance.terminate() log.msg( - f'{self.__class__.__name__} {self.workername} terminating instance ' - f'{instance.id}' + f'{self.__class__.__name__} {self.workername} terminating instance {instance.id}' ) duration = 0 interval = self._poll_resolution diff --git a/master/buildbot/worker/manager.py b/master/buildbot/worker/manager.py index 31f909c202a6..08bdd65eb9a7 100644 --- a/master/buildbot/worker/manager.py +++ b/master/buildbot/worker/manager.py @@ -118,7 +118,7 @@ def _unregister(self, registration): def newConnection(self, conn, workerName): if workerName in self.connections: log.msg( - f"Got duplication connection from '{workerName}'" " starting arbitration procedure" + f"Got duplication connection from '{workerName}' starting arbitration procedure" ) old_conn = self.connections[workerName] try: diff --git a/master/buildbot/worker/openstack.py b/master/buildbot/worker/openstack.py index 0637560fa139..c8a49cf49c7e 100644 --- a/master/buildbot/worker/openstack.py +++ b/master/buildbot/worker/openstack.py @@ -234,9 +234,7 @@ def _determineVolumeSize(self, source_type, source_uuid): snap = nova.volume_snapshots.get(source_uuid) return snap.size else: - unknown_source = ( - f"The source type '{source_type}' for UUID '{source_uuid}' is " "unknown" - ) + unknown_source = f"The source type '{source_type}' for UUID '{source_uuid}' is unknown" raise ValueError(unknown_source) return None diff --git a/master/buildbot/worker/protocols/msgpack.py b/master/buildbot/worker/protocols/msgpack.py index 799065b897d9..01dec7cfd128 100644 --- a/master/buildbot/worker/protocols/msgpack.py +++ b/master/buildbot/worker/protocols/msgpack.py @@ -253,8 +253,7 @@ def remoteSetBuilderList(self, builders): if paths_to_rmdir: log.msg( - f"Deleting directory '{paths_to_rmdir}' that is not being " - "used by the buildmaster." + f"Deleting directory '{paths_to_rmdir}' that is not being used by the buildmaster." ) # remove leftover directories from worker diff --git a/master/buildbot/www/rest.py b/master/buildbot/www/rest.py index d2d8f8d400a9..fab06d7bf340 100644 --- a/master/buildbot/www/rest.py +++ b/master/buildbot/www/rest.py @@ -299,9 +299,7 @@ def _write_not_found_rest_error( ): self._write_rest_error( request=request, - msg=( - f"not found while getting from {ep!r} with " f"arguments {rspec!r} and {kwargs!s}" - ), + msg=(f"not found while getting from {ep!r} with arguments {rspec!r} and {kwargs!s}"), ) async def _render_raw( diff --git a/master/buildbot/www/service.py b/master/buildbot/www/service.py index df230c481d43..e43b62c41e95 100644 --- a/master/buildbot/www/service.py +++ b/master/buildbot/www/service.py @@ -92,8 +92,7 @@ def _fromToken(self, token): except jwt.exceptions.InvalidSignatureError as e: log.msg( e, - "Web request has been rejected." - "Signature verification failed while decoding JWT.", + "Web request has been rejected.Signature verification failed while decoding JWT.", ) raise KeyError(str(e)) from e except Exception as e: diff --git a/master/contrib/bitbucket_buildbot.py b/master/contrib/bitbucket_buildbot.py index 47dd1e0dc897..72e52043d4af 100755 --- a/master/contrib/bitbucket_buildbot.py +++ b/master/contrib/bitbucket_buildbot.py @@ -152,8 +152,7 @@ def main(): parser.add_option( "-p", "--port", - help="Port the HTTP server listens to for the Bitbucket Service Hook" - " [default: %default]", + help="Port the HTTP server listens to for the Bitbucket Service Hook [default: %default]", default=4000, type=int, dest="port", @@ -168,14 +167,14 @@ def main(): parser.add_option( "-l", "--log", - help="The absolute path, including filename, to save the log to" " [default: %default]", + help="The absolute path, including filename, to save the log to [default: %default]", default=tempfile.gettempdir() + "/bitbucket_buildbot.log", dest="log", ) parser.add_option( "-L", "--level", - help="The logging level: debug, info, warn, error, fatal [default:" " %default]", + help="The logging level: debug, info, warn, error, fatal [default: %default]", default='warn', dest="level", ) diff --git a/master/contrib/bzr_buildbot.py b/master/contrib/bzr_buildbot.py index 71c4c0523f84..854ae9202c81 100644 --- a/master/contrib/bzr_buildbot.py +++ b/master/contrib/bzr_buildbot.py @@ -407,7 +407,7 @@ def send_change(branch, old_revno, old_revid, new_revno, new_revid, hook): # if dry run, stop. if _is_true(config, DRYRUN_KEY): bzrlib.trace.note( - "bzr_buildbot DRY RUN " "(*not* sending changes to %s:%d on %s)", server, port, hook + "bzr_buildbot DRY RUN (*not* sending changes to %s:%d on %s)", server, port, hook ) keys = sorted(change.keys()) for k in keys: diff --git a/master/contrib/generate_changelog.py b/master/contrib/generate_changelog.py index 35eff9373b59..89a4f82ff564 100755 --- a/master/contrib/generate_changelog.py +++ b/master/contrib/generate_changelog.py @@ -37,7 +37,7 @@ def usage(): Prints out usage information to stderr. """ print_err(f'Usage: {sys.argv[0]} git-binary since') - print_err(f'Example: {sys.argv[0]} /usr/bin/git f5067523dfae9c7cdefc82' '8721ec593ac7be62db') + print_err(f'Example: {sys.argv[0]} /usr/bin/git f5067523dfae9c7cdefc828721ec593ac7be62db') def main(args): @@ -60,7 +60,7 @@ def main(args): return 1 # Open a pipe and force the format - pipe = os.popen(git_bin + ' log --pretty="format:%ad %ae%n' ' * %s" ' + since + '..') + pipe = os.popen(git_bin + ' log --pretty="format:%ad %ae%n * %s" ' + since + '..') print(pipe.read()) pipe.close() return 0 diff --git a/master/contrib/git_buildbot.py b/master/contrib/git_buildbot.py index 1451a975c2be..c152333fc855 100755 --- a/master/contrib/git_buildbot.py +++ b/master/contrib/git_buildbot.py @@ -434,11 +434,11 @@ def parse_options(): ) parser.add_option("-p", "--project", action="store", type="string", help="Project to send.") parser.add_option("--codebase", action="store", type="string", help="Codebase to send.") - encoding_help = "Encoding to use when converting strings to " f"unicode. Default is {encoding}." + encoding_help = f"Encoding to use when converting strings to unicode. Default is {encoding}." parser.add_option("-e", "--encoding", action="store", type="string", help=encoding_help) - username_help = "Username used in PB connection auth, defaults to " f"{username}." + username_help = f"Username used in PB connection auth, defaults to {username}." parser.add_option("-u", "--username", action="store", type="string", help=username_help) - auth_help = "Password used in PB connection auth, defaults to " f"{auth}." + auth_help = f"Password used in PB connection auth, defaults to {auth}." # 'a' instead of 'p' due to collisions with the project short option parser.add_option("-a", "--auth", action="store", type="string", help=auth_help) first_parent_help = "If set, don't trigger builds for merged in commits" diff --git a/master/contrib/github_buildbot.py b/master/contrib/github_buildbot.py index b2783bd5c4d6..adf563c79ca2 100755 --- a/master/contrib/github_buildbot.py +++ b/master/contrib/github_buildbot.py @@ -323,7 +323,7 @@ def setup_options(): parser.add_option( "-p", "--port", - help="Port the HTTP server listens to for the GitHub " "Service Hook [default: %default]", + help="Port the HTTP server listens to for the GitHub Service Hook [default: %default]", default=9001, type=int, dest="port", @@ -332,7 +332,7 @@ def setup_options(): parser.add_option( "-m", "--buildmaster", - help="Buildbot Master host and port. ie: localhost:9989 " "[default: %default]", + help="Buildbot Master host and port. ie: localhost:9989 [default: %default]", default="localhost:9989", dest="buildmaster", ) @@ -373,7 +373,7 @@ def setup_options(): parser.add_option( "-L", "--level", - help="The logging level: debug, info, warn, error, " "fatal [default: %default]", + help="The logging level: debug, info, warn, error, fatal [default: %default]", default='warn', dest="level", choices=("debug", "info", "warn", "error", "fatal"), @@ -404,7 +404,7 @@ def setup_options(): parser.add_option( "--filter-push-branch", - help="Only trigger builds for pushes to a given " "branch name.", + help="Only trigger builds for pushes to a given branch name.", default=None, dest="filter_push_branch", ) diff --git a/master/contrib/hgbuildbot.py b/master/contrib/hgbuildbot.py index 09ae292cd0ac..9b99ca09b98a 100644 --- a/master/contrib/hgbuildbot.py +++ b/master/contrib/hgbuildbot.py @@ -160,8 +160,7 @@ def hook(ui, repo, hooktype, node=None, source=None, **kwargs): masters = ui.configlist('hgbuildbot', 'master') if not masters: ui.write( - '* You must add a [hgbuildbot] section to .hg/hgrc in ' - 'order to use the Buildbot hook\n' + '* You must add a [hgbuildbot] section to .hg/hgrc in order to use the Buildbot hook\n' ) return diff --git a/master/docs/conf.py b/master/docs/conf.py index 05b65ea71d2c..0c4ecb8d3d2e 100755 --- a/master/docs/conf.py +++ b/master/docs/conf.py @@ -324,7 +324,7 @@ try: import enchant # noqa: F401 except ImportError as ex: - print("enchant module import failed:\n" f"{ex}\n" "Spell checking disabled.", file=sys.stderr) + print(f"enchant module import failed:\n{ex}\nSpell checking disabled.", file=sys.stderr) else: extensions.append('sphinxcontrib.spelling') diff --git a/worker/buildbot_worker/base.py b/worker/buildbot_worker/base.py index 8548442ecfe3..23f63cdcf509 100644 --- a/worker/buildbot_worker/base.py +++ b/worker/buildbot_worker/base.py @@ -247,8 +247,7 @@ def remote_getWorkerInfo(self): self.numcpus = multiprocessing.cpu_count() except NotImplementedError: log.msg( - "warning: could not detect the number of CPUs for " - "this worker. Assuming 1 CPU." + "warning: could not detect the number of CPUs for this worker. Assuming 1 CPU." ) self.numcpus = 1 files['environ'] = os.environ.copy() diff --git a/worker/buildbot_worker/commands/utils.py b/worker/buildbot_worker/commands/utils.py index b35e7ab5b499..94fa8412f837 100644 --- a/worker/buildbot_worker/commands/utils.py +++ b/worker/buildbot_worker/commands/utils.py @@ -77,10 +77,8 @@ def rmdirRecursive(dir): try: list = os.listdir(dir) except WindowsError as e: - msg = ( - "rmdirRecursive: unable to listdir {} ({}). Trying to " "remove like a dir".format( - dir, e.strerror.decode('mbcs') - ) + msg = "rmdirRecursive: unable to listdir {} ({}). Trying to remove like a dir".format( + dir, e.strerror.decode('mbcs') ) log.msg(msg.encode('utf-8')) os.rmdir(dir) diff --git a/worker/buildbot_worker/pb.py b/worker/buildbot_worker/pb.py index 1ca7e22fa771..cd329d86c3ff 100644 --- a/worker/buildbot_worker/pb.py +++ b/worker/buildbot_worker/pb.py @@ -403,8 +403,7 @@ def remote_setBuilderList(self, wanted): if dir not in wanted_dirs: if self.delete_leftover_dirs: log.msg( - f"Deleting directory '{dir}' that is not being " - "used by the buildmaster" + f"Deleting directory '{dir}' that is not being used by the buildmaster" ) try: shutil.rmtree(dir) diff --git a/worker/buildbot_worker/runprocess.py b/worker/buildbot_worker/runprocess.py index 84703be5f5f3..b3f2c131c578 100644 --- a/worker/buildbot_worker/runprocess.py +++ b/worker/buildbot_worker/runprocess.py @@ -390,7 +390,7 @@ def subst(match): if v is not None: if not isinstance(v, str): raise RuntimeError( - "'env' values must be strings or " f"lists; key '{key}' is incorrect" + f"'env' values must be strings or lists; key '{key}' is incorrect" ) newenv[key] = p.sub(subst, v) diff --git a/worker/buildbot_worker/scripts/runner.py b/worker/buildbot_worker/scripts/runner.py index ebd3b701e802..873ad9464bdb 100644 --- a/worker/buildbot_worker/scripts/runner.py +++ b/worker/buildbot_worker/scripts/runner.py @@ -201,8 +201,7 @@ def validateMasterArgument(self, master_arg): def getSynopsis(self): return ( - "Usage: buildbot-worker create-worker " - "[options] " + "Usage: buildbot-worker create-worker [options] " ) def parseArgs(self, *args): diff --git a/www/wsgi_dashboards/setup.py b/www/wsgi_dashboards/setup.py index ae0300e77539..ea38d63189ff 100644 --- a/www/wsgi_dashboards/setup.py +++ b/www/wsgi_dashboards/setup.py @@ -29,7 +29,7 @@ setup_www_plugin( name='buildbot-wsgi-dashboards', - description='Buildbot plugin to integrate flask or bottle' 'dashboards to buildbot UI (React)', + description='Buildbot plugin to integrate flask or bottledashboards to buildbot UI (React)', author='Buildbot maintainers', author_email='devel@buildbot.net', url='http://buildbot.net/', From 3eb6e9eda6de9f8b95e054adc74ce18b8c96468d Mon Sep 17 00:00:00 2001 From: Pavol Misik Date: Tue, 5 Nov 2024 17:44:29 +0100 Subject: [PATCH 3/3] ruff reformat correction --- www/wsgi_dashboards/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/wsgi_dashboards/setup.py b/www/wsgi_dashboards/setup.py index ea38d63189ff..902a8f1d3384 100644 --- a/www/wsgi_dashboards/setup.py +++ b/www/wsgi_dashboards/setup.py @@ -29,7 +29,7 @@ setup_www_plugin( name='buildbot-wsgi-dashboards', - description='Buildbot plugin to integrate flask or bottledashboards to buildbot UI (React)', + description='Buildbot plugin to integrate flask or bottle dashboards to buildbot UI (React)', author='Buildbot maintainers', author_email='devel@buildbot.net', url='http://buildbot.net/',