Skip to content

Commit a80f689

Browse files
authored
refac: docstrings in import_utils.py (#9583)
* refac: docstrings in import_utils.py * Update import_utils.py
1 parent 2cb383f commit a80f689

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

src/diffusers/utils/import_utils.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -668,8 +668,9 @@ def __getattr__(cls, key):
668668
# This function was copied from: https://github.com/huggingface/accelerate/blob/874c4967d94badd24f893064cc3bef45f57cadf7/src/accelerate/utils/versions.py#L319
669669
def compare_versions(library_or_version: Union[str, Version], operation: str, requirement_version: str):
670670
"""
671-
Args:
672671
Compares a library version to some requirement using a given operation.
672+
673+
Args:
673674
library_or_version (`str` or `packaging.version.Version`):
674675
A library name or a version to check.
675676
operation (`str`):
@@ -688,8 +689,9 @@ def compare_versions(library_or_version: Union[str, Version], operation: str, re
688689
# This function was copied from: https://github.com/huggingface/accelerate/blob/874c4967d94badd24f893064cc3bef45f57cadf7/src/accelerate/utils/versions.py#L338
689690
def is_torch_version(operation: str, version: str):
690691
"""
691-
Args:
692692
Compares the current PyTorch version to a given reference with an operation.
693+
694+
Args:
693695
operation (`str`):
694696
A string representation of an operator, such as `">"` or `"<="`
695697
version (`str`):
@@ -700,8 +702,9 @@ def is_torch_version(operation: str, version: str):
700702

701703
def is_transformers_version(operation: str, version: str):
702704
"""
703-
Args:
704705
Compares the current Transformers version to a given reference with an operation.
706+
707+
Args:
705708
operation (`str`):
706709
A string representation of an operator, such as `">"` or `"<="`
707710
version (`str`):
@@ -714,8 +717,9 @@ def is_transformers_version(operation: str, version: str):
714717

715718
def is_accelerate_version(operation: str, version: str):
716719
"""
717-
Args:
718720
Compares the current Accelerate version to a given reference with an operation.
721+
722+
Args:
719723
operation (`str`):
720724
A string representation of an operator, such as `">"` or `"<="`
721725
version (`str`):
@@ -728,8 +732,9 @@ def is_accelerate_version(operation: str, version: str):
728732

729733
def is_peft_version(operation: str, version: str):
730734
"""
731-
Args:
732735
Compares the current PEFT version to a given reference with an operation.
736+
737+
Args:
733738
operation (`str`):
734739
A string representation of an operator, such as `">"` or `"<="`
735740
version (`str`):
@@ -742,8 +747,9 @@ def is_peft_version(operation: str, version: str):
742747

743748
def is_k_diffusion_version(operation: str, version: str):
744749
"""
745-
Args:
746750
Compares the current k-diffusion version to a given reference with an operation.
751+
752+
Args:
747753
operation (`str`):
748754
A string representation of an operator, such as `">"` or `"<="`
749755
version (`str`):
@@ -756,8 +762,9 @@ def is_k_diffusion_version(operation: str, version: str):
756762

757763
def get_objects_from_module(module):
758764
"""
759-
Args:
760765
Returns a dict of object names and values in a module, while skipping private/internal objects
766+
767+
Args:
761768
module (ModuleType):
762769
Module to extract the objects from.
763770
@@ -775,7 +782,9 @@ def get_objects_from_module(module):
775782

776783

777784
class OptionalDependencyNotAvailable(BaseException):
778-
"""An error indicating that an optional dependency of Diffusers was not found in the environment."""
785+
"""
786+
An error indicating that an optional dependency of Diffusers was not found in the environment.
787+
"""
779788

780789

781790
class _LazyModule(ModuleType):

0 commit comments

Comments
 (0)