Skip to content

Commit

Permalink
Corrected typing
Browse files Browse the repository at this point in the history
  • Loading branch information
TimeTravelPenguin authored and TimeTravelPenguin committed Jan 4, 2024
1 parent e2bd6aa commit 1b469ef
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ python_version = 3.12
files = src

install_types = true
ignore_missing_imports = True
cache_fine_grained = True
warn_unused_ignores = True
disallow_untyped_calls = True
Expand Down
2 changes: 1 addition & 1 deletion src/BAET/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def _create_output_filepath(self, file: Path, stream_index: int) -> Path:

def build_job(self, file: Path) -> FFmpegJob:
audio_streams: list[AudioStream] = []
indexed_outputs: MutableMapping[int, Stream] = dict()
indexed_outputs: MutableMapping[int, Stream] = {}

with probe_audio_streams(file) as streams:
for idx, stream in enumerate(streams):
Expand Down
6 changes: 3 additions & 3 deletions src/BAET/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(
self.indexed_outputs: IndexedOutputs = indexed_outputs
self.audio_streams = audio_streams

indexed_audio_streams = dict()
indexed_audio_streams = {}
for stream in audio_streams:
indexed_audio_streams[stream["index"]] = stream
self.indexed_audio_streams: IndexedAudioStream = indexed_audio_streams
Expand All @@ -32,10 +32,10 @@ def stream_duration_ms(cls, stream: AudioStream) -> Millisecond:
return 1_000_000 * float(stream["duration_ts"]) * float(Fraction(stream["time_base"]))

def stream(self, index: StreamIndex) -> AudioStream:
stream: AudioStream = first_true(
stream: AudioStream | None = first_true(
self.audio_streams,
default=None,
pred=lambda st: st["index"] == index,
pred=lambda st: st["index"] == index, # type: ignore
)

if stream is None:
Expand Down

0 comments on commit 1b469ef

Please sign in to comment.