mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-01 15:37:32 +08:00
Enable flake8-implicit-str-concat ruff rules
See https://docs.astral.sh/ruff/rules/#flake8-implicit-str-concat-isc
This commit is contained in:
@@ -12,7 +12,7 @@ try:
|
||||
except ImportError:
|
||||
print(
|
||||
"Could not import the requests module. See http://docs.python-requests.org/en/latest/"
|
||||
+ " or install with 'pip install requests'"
|
||||
" or install with 'pip install requests'"
|
||||
)
|
||||
raise
|
||||
|
||||
@@ -46,7 +46,7 @@ if __name__ == "__main__":
|
||||
if len(sys.argv) < 5:
|
||||
print(
|
||||
"history_upload.py <api key> <galaxy base url> <history id> <filepath to upload>\n"
|
||||
+ " (where galaxy base url is just the root url where your Galaxy is served; e.g. 'localhost:8080')"
|
||||
" (where galaxy base url is just the root url where your Galaxy is served; e.g. 'localhost:8080')"
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ def main():
|
||||
help="config file (legacy, use --config instead)",
|
||||
)
|
||||
parser.add_argument("-d", "--days", dest="days", action="store", type=int, help="number of days (60)", default=60)
|
||||
parser.add_argument("--tool_id", default=None, help="Text to match against tool_id" "Default: match all")
|
||||
parser.add_argument("--tool_id", default=None, help="Text to match against tool_id. Default: match all")
|
||||
parser.add_argument(
|
||||
"--template",
|
||||
default=None,
|
||||
@@ -121,10 +121,10 @@ def main():
|
||||
default=False,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--smtp", default=None, help="SMTP Server to use to send email. " "Default: [read from galaxy config file]"
|
||||
"--smtp", default=None, help="SMTP Server to use to send email. Default: [read from galaxy config file]"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--fromaddr", default=None, help="From address to use to send email. " "Default: [read from galaxy config file]"
|
||||
"--fromaddr", default=None, help="From address to use to send email. Default: [read from galaxy config file]"
|
||||
)
|
||||
populate_config_args(parser)
|
||||
|
||||
@@ -138,14 +138,12 @@ def main():
|
||||
if args.smtp is not None:
|
||||
app_properties["smtp_server"] = args.smtp
|
||||
if app_properties.get("smtp_server") is None:
|
||||
parser.error("SMTP Server must be specified as an option (--smtp) " "or in the config file (smtp_server)")
|
||||
parser.error("SMTP Server must be specified as an option (--smtp) or in the config file (smtp_server)")
|
||||
|
||||
if args.fromaddr is not None:
|
||||
app_properties["email_from"] = args.fromaddr
|
||||
if app_properties.get("email_from") is None:
|
||||
parser.error(
|
||||
"From address must be specified as an option " "(--fromaddr) or in the config file " "(email_from)"
|
||||
)
|
||||
parser.error("From address must be specified as an option (--fromaddr) or in the config file (email_from)")
|
||||
|
||||
scriptdir = os.path.dirname(os.path.abspath(__file__))
|
||||
template_file = args.template
|
||||
@@ -262,7 +260,7 @@ def administrative_delete_datasets(
|
||||
# Mark the HistoryDatasetAssociation as deleted
|
||||
hda.deleted = True
|
||||
app.sa_session.add(hda)
|
||||
print("Marked HistoryDatasetAssociation id %d as " "deleted" % hda.id)
|
||||
print("Marked HistoryDatasetAssociation id %d as deleted" % hda.id)
|
||||
session = app.sa_session()
|
||||
with transaction(session):
|
||||
session.commit()
|
||||
@@ -270,7 +268,7 @@ def administrative_delete_datasets(
|
||||
emailtemplate = Template(filename=template_file)
|
||||
for email, dataset_list in user_notifications.items():
|
||||
msgtext = emailtemplate.render(email=email, datasets=dataset_list, cutoff=cutoff_days)
|
||||
subject = "Galaxy Server Cleanup " "- %d datasets DELETED" % len(dataset_list)
|
||||
subject = "Galaxy Server Cleanup - %d datasets DELETED" % len(dataset_list)
|
||||
fromaddr = config.email_from
|
||||
print()
|
||||
print(f"From: {fromaddr}")
|
||||
|
||||
+1
-1
@@ -22,6 +22,6 @@ from docutils.core import (
|
||||
publish_cmdline,
|
||||
)
|
||||
|
||||
description = "Generates (X)HTML documents from standalone reStructuredText " "sources. " + default_description
|
||||
description = "Generates (X)HTML documents from standalone reStructuredText sources. " + default_description
|
||||
|
||||
publish_cmdline(writer_name="html", description=description)
|
||||
|
||||
@@ -82,20 +82,20 @@ def parse_arguments():
|
||||
"--like",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help="Use SQL `LIKE` operator to find " "a shed-installed tool using the tool's " '"short" id',
|
||||
help='Use SQL `LIKE` operator to find a shed-installed tool using the tool\'s "short" id',
|
||||
)
|
||||
populate_config_args(parser)
|
||||
parser.add_argument("-d", "--debug", action="store_true", default=False, help="Print extra info")
|
||||
parser.add_argument("-m", "--min", type=int, default=-1, help="Ignore runtimes less than MIN seconds")
|
||||
parser.add_argument("-M", "--max", type=int, default=-1, help="Ignore runtimes greater than MAX seconds")
|
||||
parser.add_argument("-u", "--user", help="Return stats for only this user (id, email, " "or username)")
|
||||
parser.add_argument("-u", "--user", help="Return stats for only this user (id, email, or username)")
|
||||
parser.add_argument(
|
||||
"-s", "--source", default="metrics", help="Runtime data source (SOURCES: {})".format(", ".join(DATA_SOURCES))
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.like and "/" in args.tool_id:
|
||||
print("ERROR: Do not use --like with a tool shed tool id (the tool " "id should not contain `/` characters)")
|
||||
print("ERROR: Do not use --like with a tool shed tool id (the tool id should not contain `/` characters)")
|
||||
sys.exit(2)
|
||||
|
||||
args.source = args.source.lower()
|
||||
|
||||
@@ -106,8 +106,8 @@ def send_mail_to_owner(app, owner, email, repositories_deprecated, days=14):
|
||||
subject = f"Regarding your tool shed repositories at {url}"
|
||||
message_body_template = (
|
||||
"The tool shed automated repository checker has discovered that one or more of your repositories hosted "
|
||||
+ "at this tool shed url ${url} have remained empty for over ${days} days, so they have been marked as deprecated. If you have plans "
|
||||
+ "for these repositories, you can mark them as un-deprecated at any time."
|
||||
"at this tool shed url ${url} have remained empty for over ${days} days, so they have been marked as deprecated. If you have plans "
|
||||
"for these repositories, you can mark them as un-deprecated at any time."
|
||||
)
|
||||
message_template = string.Template(message_body_template)
|
||||
body = "\n".join(textwrap.wrap(message_template.safe_substitute(days=days, url=url), width=95))
|
||||
|
||||
Reference in New Issue
Block a user