Skip to content

Commit

Permalink
add type ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
getzze committed Oct 22, 2024
1 parent 6f0fd95 commit 4939310
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions subliminal/converters/addic7ed.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def convert(self, alpha3: str, country: str | None = None, script: str | None =
if (alpha3, None, None) in self.to_addic7ed:
return self.to_addic7ed[(alpha3, None, None)]

return self.name_converter.convert(alpha3, country, script)
return self.name_converter.convert(alpha3, country, script) # type: ignore[no-any-return]

def reverse(self, code: str) -> LanguageTuple:
"""Reverse a custom code into alpha3, country and script code."""
Expand All @@ -65,4 +65,4 @@ def reverse(self, code: str) -> LanguageTuple:
# if len(ret) == 3:
return ret

return self.name_converter.reverse(code)
return self.name_converter.reverse(code) # type: ignore[no-any-return]
4 changes: 2 additions & 2 deletions subliminal/converters/opensubtitles.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(self) -> None:

def convert(self, alpha3: str, country: str | None = None, script: str | None = None) -> str:
"""Convert an alpha3 language code with an alpha2 country code and a script code into a custom code."""
alpha3b = self.alpha3b_converter.convert(alpha3, country, script)
alpha3b = self.alpha3b_converter.convert(alpha3, country, script) # type: ignore[no-any-return]
if (alpha3b, country, script) in self.to_opensubtitles:
return self.to_opensubtitles[(alpha3b, country, script)]
return alpha3b
Expand All @@ -71,7 +71,7 @@ def reverse(self, code: str) -> LanguageTuple:
for conv in [self.alpha3b_converter, self.alpha2_converter]:
conv = cast(LanguageReverseConverter, conv)
try:
return conv.reverse(code)
return conv.reverse(code) # type: ignore[no-any-return]
except LanguageReverseError:
pass
raise LanguageReverseError(code)
4 changes: 2 additions & 2 deletions subliminal/converters/opensubtitlescom.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ def convert(self, alpha3: str, country: str | None = None, script: str | None =
if (alpha3, None) in self.to_opensubtitlescom:
return self.to_opensubtitlescom[(alpha3, None)]

return self.alpha2_converter.convert(alpha3, country, script)
return self.alpha2_converter.convert(alpha3, country, script) # type: ignore[no-any-return]

def reverse(self, code: str) -> LanguageTuple:
"""Reverse a custom code into alpha3, country and script code."""
code_lower = code.lower()
if code_lower in self.from_opensubtitlescom:
return (*self.from_opensubtitlescom[code_lower], None)

return self.alpha2_converter.reverse(code)
return self.alpha2_converter.reverse(code) # type: ignore[no-any-return]
4 changes: 2 additions & 2 deletions subliminal/converters/tvsubtitles.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ def convert(self, alpha3: str, country: str | None = None, script: str | None =
if (alpha3, None) in self.to_tvsubtitles:
return self.to_tvsubtitles[(alpha3, None)]

return self.alpha2_converter.convert(alpha3, country, script)
return self.alpha2_converter.convert(alpha3, country, script) # type: ignore[no-any-return]

def reverse(self, code: str) -> LanguageTuple:
"""Reverse a custom code into alpha3, country and script code."""
if code in self.from_tvsubtitles:
return (*self.from_tvsubtitles[code], None)

return self.alpha2_converter.reverse(code)
return self.alpha2_converter.reverse(code) # type: ignore[no-any-return]

0 comments on commit 4939310

Please sign in to comment.