lammps_utils.utils package
This package contains utility functions and classes that are used throughout the project.
The functions and classes in this package are designed to be reusable and modular, making it easy to incorporate them into different parts of the project. These utilities are intended to simplify common tasks, such as checking if a package is installed, iterating with a dummy progress bar, and verifying function arguments.
- class lammps_utils.utils.dummy_tqdm(_dummy_tqdm__iterable: Iterable[T], *args, **kwargs)
Bases:
Iterable
,Generic
[T
]A dummy class that mimics the behavior of ‘tqdm’ for testing or placeholder purposes.
This class allows you to use a tqdm-like interface in cases where the progress bar functionality is not needed or when testing code without depending on the actual tqdm library.
- Parameters:
__iterable (Iterable[T]) – An iterable object that will be wrapped and returned by the class.
- __iter__() Iterator[T]
Returns an iterator for the provided iterable.
- __getattr__(name: str) Callable[..., None]
Returns a no-operation function for unsupported attributes.
- lammps_utils.utils.is_argument(__callable: Callable[[...], Any], arg_name: str) bool
Check if a given argument name is present in the callable’s signature.
This function checks whether the specified argument name is part of the parameters in the callable’s signature. It can be used to verify if a function or method accepts a specific argument.
- Parameters:
__callable (Callable) – The callable (function or method) whose signature is inspected.
arg_name (str) – The name of the argument to check for in the callable’s signature.
- Returns:
True if the argument name is found in the callable’s parameters, False otherwise.
- Return type:
bool
- lammps_utils.utils.is_installed(package_name: str) bool
Check whether a given Python package is installed.
Uses importlib.util.find_spec to determine if the specified package can be imported.
- Parameters:
package_name (str) – The name of the package (e.g., “sklearn”).
- Returns:
True if the package is installed, False otherwise.
- Return type:
bool