diff --git a/dev/common/dependency_bumper.py b/dev/common/dependency_bumper.py index 0f33ddc21b..b2d9f1e7fa 100644 --- a/dev/common/dependency_bumper.py +++ b/dev/common/dependency_bumper.py @@ -192,15 +192,16 @@ def main(): # make a unique checkout for this new patch branch_checkout = os.path.join(workdir, f'galaxy_ng.{cfg.branch}') - ts = datetime.datetime.now().isoformat().split('.')[0].replace('-', '_').replace(':', '_') + ts = datetime.datetime.now().strftime("%Y_%m_%dT%H_%M_%S") # noqa: DTZ005 new_branch = f'BUMP_DEPS_{ts}_{cfg.branch}'.replace('-', '_').replace('.', '_') construct_checkout(branch_checkout, base_branch=cfg.branch, new_branch=new_branch) # assemble the container internal script - commands = [] - commands.append(f'source /venv-{cfg.python}/bin/activate') - commands.append(f'/venv-{cfg.python}/bin/pip install --upgrade pip=={cfg.pip}') - commands.append(f'/venv-{cfg.python}/bin/pip install pip-tools=={cfg.pip_tools}') + commands = [ + f'source /venv-{cfg.python}/bin/activate', + f'/venv-{cfg.python}/bin/pip install --upgrade pip=={cfg.pip}', + f'/venv-{cfg.python}/bin/pip install pip-tools=={cfg.pip_tools}', + ] # be smarter than the makefile for RF in REQUIREMENTS_FILES: diff --git a/galaxy_ng/app/api/v1/tasks.py b/galaxy_ng/app/api/v1/tasks.py index 0fc9ecf485..bcad9cc205 100644 --- a/galaxy_ng/app/api/v1/tasks.py +++ b/galaxy_ng/app/api/v1/tasks.py @@ -238,7 +238,7 @@ def compute_all_versions(this_role, gitrepo): if str(tag.name) in current_tags: continue - ts = datetime.datetime.now().isoformat() + ts = datetime.datetime.now().isoformat() # noqa: DTZ005 vdata = { 'id': str(uuid.uuid4()), 'tag': tag.name, @@ -497,7 +497,7 @@ def legacy_role_import( galaxy_info = result["metadata"]["galaxy_info"] new_full_metadata = { - 'imported': datetime.datetime.now().isoformat(), + 'imported': datetime.datetime.now().isoformat(), # noqa: DTZ005 'clone_url': clone_url, 'tags': galaxy_info.get("galaxy_tags", []), 'github_user': real_github_user, @@ -642,9 +642,9 @@ def legacy_sync_from_upstream( role_dependencies = sfields.get('dependencies', []) role_min_ansible = rdata.get('min_ansible_version') role_company = rdata.get('company') - role_imported = rdata.get('imported', datetime.datetime.now().isoformat()) - role_created = rdata.get('created', datetime.datetime.now().isoformat()) - role_modified = rdata.get('modified', datetime.datetime.now().isoformat()) + role_imported = rdata.get('imported', datetime.datetime.now().isoformat()) # noqa: DTZ005 + role_created = rdata.get('created', datetime.datetime.now().isoformat()) # noqa: DTZ005 + role_modified = rdata.get('modified', datetime.datetime.now().isoformat()) # noqa: DTZ005 role_type = rdata.get('role_type', 'ANS') role_download_count = rdata.get('download_count', 0) diff --git a/galaxy_ng/app/management/commands/sync-collection-download-counts.py b/galaxy_ng/app/management/commands/sync-collection-download-counts.py index 521dcafada..d7e6a83179 100644 --- a/galaxy_ng/app/management/commands/sync-collection-download-counts.py +++ b/galaxy_ng/app/management/commands/sync-collection-download-counts.py @@ -39,7 +39,7 @@ def handle(self, *args, **options): upstream = options['upstream'] limit = options['limit'] - now = datetime.datetime.now() + now = datetime.datetime.now() # noqa: DTZ005 collection_count = 0 collection_total = Collection.objects.count() diff --git a/galaxy_ng/tests/integration/api/test_remote_sync.py b/galaxy_ng/tests/integration/api/test_remote_sync.py index c81fd5dfb1..828678632b 100644 --- a/galaxy_ng/tests/integration/api/test_remote_sync.py +++ b/galaxy_ng/tests/integration/api/test_remote_sync.py @@ -30,8 +30,8 @@ def test_api_ui_v1_remote_sync(galaxy_client): 'token': None, 'policy': 'immediate', 'requirements_file': REQUIREMENTS_FILE, - 'created_at': str(datetime.now()), - 'updated_at': str(datetime.now()), + 'created_at': str(datetime.now()), # noqa: DTZ005 + 'updated_at': str(datetime.now()), # noqa: DTZ005 'username': None, 'password': None, 'tls_validation': False, diff --git a/pyproject.toml b/pyproject.toml index 051aa96e83..6c13401d34 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -113,6 +113,8 @@ select = [ "C4", # flake8-commas "COM", + # flake8-datetime + "DTZ", # flake8-no-pep420 "INP", # flake8-gettext