Skip to content

Commit db98afe

Browse files
committed
lint: tilfredsstiller hevet pedantri
1 parent 5201036 commit db98afe

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

app/converter/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ProfileMetadata(BaseModel):
1010

1111

1212
class Converter:
13-
DESIRED_FORMATS = ["large_thumb"]
13+
DESIRED_FORMATS = ("large_thumb",)
1414
env = Environment(loader=PackageLoader("ingest"), autoescape=select_autoescape())
1515

1616
@staticmethod

app/django_api/service.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
class DjangoApiService:
1515
client: AuthenticatedClient
1616

17-
def __init__(self, state: AuthenticatedClient = Depends(get_client_from_app_state)):
18-
self.client = state
17+
def __init__(self, client: AuthenticatedClient = None):
18+
if client is None:
19+
client = Depends(get_client_from_app_state)
20+
self.client = client
1921

2022
async def set_video_duration(self, video_id: str, duration: str):
2123
return videos_partial_update.asyncio(video_id, client=self.client, body=PatchedVideoRequest(duration=duration))

app/interactive.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,15 @@ async def update_existing_file(video_id: str, archive_path: Path):
3939

4040

4141
def pretty_duration(duration):
42-
min, sec = divmod(duration, 60)
43-
hours, _ = divmod(min, 60)
44-
return f"{int(hours):d}:{int(min):02d}:{sec:02f}"
42+
mins, secs = divmod(duration, 60)
43+
hours, _ = divmod(mins, 60)
44+
return f"{int(hours):d}:{int(mins):02d}:{secs:02f}"
4545

4646

47-
async def register_video_files(video_id: str, video_path: Path, django_api=DjangoApiService()):
47+
async def register_video_files(video_id: str, video_path: Path, django_api=None):
48+
if django_api is None:
49+
django_api = DjangoApiService()
50+
4851
logging.info("Registering files for video %s in folder %s", video_id, video_path)
4952

5053
files = await django_api.get_files_for_video(video_id)

app/util/path_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ def get_single_file_from_directory(from_dir: Path) -> Path:
1414
[file_name] = [x for x in from_dir.iterdir()]
1515
return file_name
1616
except ValueError:
17-
raise SkippableError(f"Found no file in {from_dir}")
17+
raise SkippableError(f"Found no file in {from_dir}") from None

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ dev = [
2828

2929
[tool.ruff]
3030
line-length = 120
31+
# generated code files
32+
exclude = ["app/tus_hook/hook_schema.py", "app/ffprobe/ffprobe_schema.py"]
3133
[tool.ruff.lint]
3234
extend-select = [
3335
"I", # isort: import sorting

0 commit comments

Comments
 (0)