Skip to content
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
4 changes: 2 additions & 2 deletions src/aignostics/bucket/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

import datetime
import datetime as dt
import json
import sys
from pathlib import Path # noqa: TC003
Expand Down Expand Up @@ -78,7 +78,7 @@ def upload( # noqa: C901
console.print(f"Found {files_count} files with total size of {humanize.naturalsize(total_bytes)}")

username = psutil.Process().username().replace("\\", "_")
timestamp = datetime.datetime.now(tz=datetime.UTC).strftime("%Y%m%d_%H%M%S")
timestamp = dt.datetime.now(tz=dt.UTC).strftime("%Y%m%d_%H%M%S")
base_prefix = destination_prefix.format(username=username, timestamp=timestamp)
base_prefix = base_prefix.strip("/")

Expand Down
6 changes: 4 additions & 2 deletions src/aignostics/bucket/_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,10 @@ def _compute_s3_prefix(
"""
re_meta = re.compile(r"[.+*?^${}()\[\]|\\]")

# S3 prefixes are plain string prefixes, so the character-wise match of commonprefix is intended.

if what_is_key:
prefix = os.path.commonprefix(what)
prefix = os.path.commonprefix(what) # noqa: RUF071
else:
literal_prefixes: list[str] = []
for pattern in what:
Expand All @@ -316,7 +318,7 @@ def _compute_s3_prefix(
if not literal_prefix:
return None
literal_prefixes.append(literal_prefix)
prefix = os.path.commonprefix(literal_prefixes)
prefix = os.path.commonprefix(literal_prefixes) # noqa: RUF071

return prefix or None

Expand Down
2 changes: 1 addition & 1 deletion src/aignostics/dataset/_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ async def _download(source: str) -> None:
try:
await run.io_bound(
Service.download_with_queue, # type: ignore[arg-type]
download_message_queue, # type: ignore[unused-ignore] # type: ignore
download_message_queue, # pyright: ignore[reportArgumentType]
source,
str(download_form.destination),
TARGET_LAYOUT_DEFAULT,
Expand Down
4 changes: 2 additions & 2 deletions src/aignostics/platform/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import base64
import contextlib
import datetime
import datetime as dt
import re
import tempfile
import typing as t
Expand Down Expand Up @@ -168,7 +168,7 @@ def generate_signed_url(url: str, expires_seconds: int = SIGNED_DOWNLOAD_URL_EXP

url = t.cast(
"str",
blob.generate_signed_url(expiration=datetime.timedelta(seconds=expires_seconds), method="GET", version="v4"),
blob.generate_signed_url(expiration=dt.timedelta(seconds=expires_seconds), method="GET", version="v4"),
)
logger.debug(f"Generated signed URL for {url} valid for {expires_seconds} seconds")
return url
Expand Down
4 changes: 2 additions & 2 deletions src/aignostics/system/_service.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""System service."""

import asyncio
import datetime
import datetime as dt
import json
import os
import platform
Expand Down Expand Up @@ -313,7 +313,7 @@ async def info(include_environ: bool = False, mask_secrets: bool = True) -> dict
import psutil # noqa: PLC0415

boot_ts = psutil.boot_time()
bootdatetime = datetime.datetime.fromtimestamp(boot_ts, tz=datetime.UTC)
bootdatetime = dt.datetime.fromtimestamp(boot_ts, tz=dt.UTC)
vmem = psutil.virtual_memory()
swap = psutil.swap_memory()
psutil.cpu_percent(interval=None) # prime the counter
Expand Down
2 changes: 1 addition & 1 deletion src/aignostics/utils/_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def __init__(

def add_drives_toggle(self) -> None:
if platform.system() == "Windows":
import win32api # type: ignore[unused-ignore] # type: ignore # noqa: PLC0415
import win32api # noqa: PLC0415 # pyright: ignore[reportMissingModuleSource]

drives = win32api.GetLogicalDriveStrings().split("\000")[:-1]
self.drives_toggle = ui.toggle(drives, value=drives[0], on_change=self.update_drive)
Expand Down
4 changes: 2 additions & 2 deletions tests/aignostics/system/service_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ async def test_info_uptime_seconds_positive() -> None:
@pytest.mark.asyncio
async def test_info_uptime_boottime_is_iso_string() -> None:
"""info() uptime boottime is a non-empty ISO 8601 string."""
import datetime
import datetime as dt

with _patch_info_dependencies():
result = await Service.info()
Expand All @@ -509,5 +509,5 @@ async def test_info_uptime_boottime_is_iso_string() -> None:
assert isinstance(boottime_str, str)
assert len(boottime_str) > 0
# Must be parseable as an ISO 8601 datetime
parsed = datetime.datetime.fromisoformat(boottime_str)
parsed = dt.datetime.fromisoformat(boottime_str)
assert parsed.tzinfo is not None # timezone-aware (UTC)
4,327 changes: 2,272 additions & 2,055 deletions uv.lock

Large diffs are not rendered by default.

Loading