From 7926afbe13760ff7e0b5bca5de4e2f44277144b2 Mon Sep 17 00:00:00 2001 From: Boris Date: Fri, 26 Apr 2024 15:28:40 -0500 Subject: [PATCH] Updated actions, removed flake8, fixed unused vars --- import_specifications/clients/baseclient.py | 16 ++++------------ pyproject.toml | 10 +++++----- staging_service/autodetect/GenerateMappings.py | 6 +++++- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/import_specifications/clients/baseclient.py b/import_specifications/clients/baseclient.py index 77457e2b..8bac630e 100644 --- a/import_specifications/clients/baseclient.py +++ b/import_specifications/clients/baseclient.py @@ -52,8 +52,7 @@ def _get_token(user_id, password, auth_svc): tok = _json.loads(ret.text) elif status == 403: raise Exception( - "Authentication failed: Bad user_id/password " - + "combination for user %s" % (user_id) + "Authentication failed: Bad user_id/password " + "combination for user %s" % (user_id) ) else: raise Exception(ret.text) @@ -61,9 +60,7 @@ def _get_token(user_id, password, auth_svc): def _read_inifile( - file=_os.environ.get( - "KB_DEPLOYMENT_CONFIG", _os.environ["HOME"] + "/.kbase_config" - ), + file=_os.environ.get("KB_DEPLOYMENT_CONFIG", _os.environ["HOME"] + "/.kbase_config"), ): # @ReservedAssignment # Another bandaid to read in the ~/.kbase_config file if one is present authdata = None @@ -102,9 +99,7 @@ def __init__(self, name, code, message, data=None, error=None): # data = JSON RPC 2.0, error = 1.1 def __str__(self): - return ( - self.name + ": " + str(self.code) + ". " + self.message + "\n" + self.data - ) + return self.name + ": " + str(self.code) + ". " + self.message + "\n" + self.data class _JSONObjectEncoder(_json.JSONEncoder): @@ -181,10 +176,7 @@ def __init__( if authdata is not None: if authdata.get("token") is not None: self._headers["AUTHORIZATION"] = authdata["token"] - elif ( - authdata.get("user_id") is not None - and authdata.get("password") is not None - ): + elif authdata.get("user_id") is not None and authdata.get("password") is not None: self._headers["AUTHORIZATION"] = _get_token( authdata["user_id"], authdata["password"], auth_svc ) diff --git a/pyproject.toml b/pyproject.toml index f611d1db..38fb2ca3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ line-length = 100 [tool.ruff] -select = [ +lint.select = [ # core "F", # Pyflakes "E", # pycodestyle errors @@ -27,15 +27,15 @@ select = [ # E203: whitespace before ‘,’, ‘;’, or ‘:’ # E501: line length # W503: line break after binary operator -ignore = [ +lint.ignore = [ "E203", "E501", "S101", ] # Allow autofix for all enabled rules (when `--fix`) is provided. -fixable = ["ALL"] -unfixable = [] +lint.fixable = ["ALL"] +lint.unfixable = [] # Exclude a variety of commonly ignored directories. exclude = [ @@ -67,7 +67,7 @@ exclude = [ "sample_data", "venv", ] -per-file-ignores = { } +lint.per-file-ignores = { } # Same as Black. line-length = 100 diff --git a/staging_service/autodetect/GenerateMappings.py b/staging_service/autodetect/GenerateMappings.py index d9c34b1c..f5af89d6 100644 --- a/staging_service/autodetect/GenerateMappings.py +++ b/staging_service/autodetect/GenerateMappings.py @@ -89,7 +89,11 @@ fastq_reads_interleaved_id, fastq_reads_noninterleaved_id, ] -file_format_to_app_mapping[FASTA] = [assembly_id, gff_genome_id, gff_metagenome_id] +file_format_to_app_mapping[FASTA] = [ + assembly_id, + gff_genome_id, + gff_metagenome_id, +] file_format_to_app_mapping[GENBANK] = [genbank_genome_id] file_format_to_app_mapping[GFF] = [gff_genome_id, gff_metagenome_id] file_format_to_app_mapping[ZIP] = [decompress_id]