Skip to content

Enable flake8-datetime plugin for ruff #2335

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions dev/common/dependency_bumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is also this option

f"{datetime.now():%Y_%m_%dT%H_%M_%S}"
'2024_10_25T13_48_28'

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:
Expand Down
10 changes: 5 additions & 5 deletions galaxy_ng/app/api/v1/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions galaxy_ng/tests/integration/api/test_remote_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ select = [
"C4",
# flake8-commas
"COM",
# flake8-datetime
"DTZ",
# flake8-no-pep420
"INP",
# flake8-gettext
Expand Down
Loading