mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-15 21:45:10 +00:00
refactor(core)!: drop leading underscores from internal definitions
Renames 314 defs and 41 module/class-level constants. Keeps 11 names underscored where the stripped form collides in scope, plus 5.5.0 shims for the three symbols external service repos call.
This commit is contained in:
@@ -45,7 +45,7 @@ class Subtitle:
|
||||
self.bitrate = None
|
||||
|
||||
|
||||
def _noop(**kwargs):
|
||||
def noop(**kwargs):
|
||||
pass
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ def test_weight_video_over_audio_over_subtitle():
|
||||
def test_weighting_makes_video_dominate_progress():
|
||||
updates: list[dict] = []
|
||||
video, sub = Video(bitrate=4_000_000), Subtitle()
|
||||
cbs = build_job_progress_callables([video, sub], [_noop, _noop], updates.append)
|
||||
cbs = build_job_progress_callables([video, sub], [noop, noop], updates.append)
|
||||
|
||||
# subtitle fully done, video untouched -> progress is tiny (subtitle barely weighted)
|
||||
cbs[1](downloaded="Downloaded")
|
||||
@@ -80,7 +80,7 @@ def test_weighting_makes_video_dominate_progress():
|
||||
|
||||
def test_active_tracks_labels_reported_and_cleared_on_done():
|
||||
updates: list[dict] = []
|
||||
cbs = build_job_progress_callables([Video(2160, "DV"), Audio("en-US", "2.0")], [_noop, _noop], updates.append)
|
||||
cbs = build_job_progress_callables([Video(2160, "DV"), Audio("en-US", "2.0")], [noop, noop], updates.append)
|
||||
|
||||
cbs[0](total=100, completed=10) # video downloading
|
||||
assert updates[-1]["active_tracks"] == ["video 2160p DV"]
|
||||
@@ -121,7 +121,7 @@ def test_aggregate_progress_is_monotonic_with_counts():
|
||||
def test_all_tracks_done_reaches_download_ceiling():
|
||||
# Downloads fill up to the ceiling; dl.result drives muxing the rest of the way to 100.
|
||||
updates: list[dict] = []
|
||||
cbs = build_job_progress_callables([Audio(bitrate=1000), Audio(bitrate=1000)], [_noop, _noop], updates.append)
|
||||
cbs = build_job_progress_callables([Audio(bitrate=1000), Audio(bitrate=1000)], [noop, noop], updates.append)
|
||||
|
||||
cbs[0](total=10, completed=10, downloaded="Downloaded")
|
||||
assert updates[-1]["progress"] < DOWNLOAD_PROGRESS_CEILING
|
||||
@@ -136,7 +136,7 @@ def test_finished_track_does_not_dip_when_callable_reused_for_decrypt():
|
||||
"""A track hits 100% (then decrypt reuses the callable with completed=0); the aggregate must
|
||||
hold, never dip - even before the terminal 'Downloaded'/'Decrypted' string arrives."""
|
||||
updates: list[dict] = []
|
||||
cbs = build_job_progress_callables([Video(bitrate=1000), Video(bitrate=1000)], [_noop, _noop], updates.append)
|
||||
cbs = build_job_progress_callables([Video(bitrate=1000), Video(bitrate=1000)], [noop, noop], updates.append)
|
||||
|
||||
cbs[0](total=100, completed=100) # download hits 100% BEFORE any terminal string -> 50%
|
||||
cbs[0](total=200, completed=0) # decrypt phase resets counts, still no terminal string
|
||||
@@ -151,7 +151,7 @@ def test_finished_track_does_not_dip_when_callable_reused_for_decrypt():
|
||||
|
||||
def test_skipped_subtitle_counts_as_done():
|
||||
updates: list[dict] = []
|
||||
cbs = build_job_progress_callables([Subtitle()], [_noop], updates.append)
|
||||
cbs = build_job_progress_callables([Subtitle()], [noop], updates.append)
|
||||
cbs[0](downloaded="[yellow]SKIPPED")
|
||||
assert updates[-1]["completed_tracks"] == 1
|
||||
assert updates[-1]["progress"] == pytest.approx(DOWNLOAD_PROGRESS_CEILING)
|
||||
|
||||
Reference in New Issue
Block a user