Merge 6175335d2361eecd801c223c070e007babd32d68 into 254f6b986720c92ddf97fbb1a6a6465da8e87e29

This commit is contained in:
ゆり 2025-12-25 00:07:17 +00:00 committed by GitHub
commit a083e410e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 6 additions and 6 deletions

View File

@ -108,7 +108,7 @@ class PoolerConfig:
return hash_str
def get_use_activation(o: object):
def get_use_activation(o: object) -> bool | None:
if softmax := getattr(o, "softmax", None) is not None:
logger.warning_once(
"softmax will be deprecated and will be removed in v0.15. "

View File

@ -38,7 +38,7 @@ def rgba_to_rgb(
return converted
def convert_image_mode(image: Image.Image, to_mode: str):
def convert_image_mode(image: Image.Image, to_mode: str) -> Image.Image:
if image.mode == to_mode:
return image
elif image.mode == "RGBA" and to_mode == "RGB":

View File

@ -11,7 +11,7 @@ from torch._C._profiler import _EventType, _ProfilerEvent, _TensorMetadata
#
def trim_string_front(string, width):
def trim_string_front(string: str, width: int) -> str:
if len(string) > width:
offset = len(string) - width + 3
string = string[offset:]
@ -20,7 +20,7 @@ def trim_string_front(string, width):
return string
def trim_string_back(string, width):
def trim_string_back(string: str, width: int) -> str:
if len(string) > width:
offset = len(string) - width + 3
string = string[:-offset]

View File

@ -12,7 +12,7 @@ except Exception as e:
__version_tuple__ = (0, 0, __version__)
def _prev_minor_version_was(version_str):
def _prev_minor_version_was(version_str: str) -> bool:
"""Check whether a given version matches the previous minor version.
Return True if version_str matches the previous minor version.
@ -32,7 +32,7 @@ def _prev_minor_version_was(version_str):
return version_str == f"{__version_tuple__[0]}.{__version_tuple__[1] - 1}"
def _prev_minor_version():
def _prev_minor_version() -> str:
"""For the purpose of testing, return a previous minor version number."""
# In dev tree, this will return "0.-1", but that will work fine"
assert isinstance(__version_tuple__[1], int)