src/use/use.py
def _use_str(
        self,
        name: str,
        /,
        *,
        version: str = None,
        hash_algo=Hash.sha256,
        hashes: Optional[Union[str, list[str]]] = None,
        default=mode.fastfail,
        modes: int = 0,
    ) -> ProxyModule:
        """
        Import a pkg by name.

        https://github.com/amogorkon/justuse/wiki/Use-String

        Args:
            name (str): The name of the pkg to import.
            version (str or Version, optional): The version of the pkg to import. Defaults to None.
            hash_algo (member of Use.Hash, optional): For future compatibility with more modern hashing algorithms. Defaults to Hash.sha256.
            hashes (str | [str]), optional): A single hash or list of hashes of the pkg to import. Defaults to None.
            default (anything, optional): Whatever should be returned in case there's a problem with the import. Defaults to mode.fastfail.
            modes (int, optional): Any combination of Use.modes . Defaults to 0.

        Raises:
            RuntimeWarning: May be raised if the auto-installation of the pkg fails for some reason.

        Returns:
            Optional[ModuleType]: Module if successful, default as specified otherwise.
        """
        package_name, module_name = _parse_name(name)
        return self._use_package(
            name=name,
            package_name=package_name,
            module_name=module_name,
            version=version,
            hash_algo=hash_algo,
            hashes=hashes,
            default=default,
            modes=modes,
        )

        Import a pkg by name.

        https://github.com/amogorkon/justuse/wiki/Use-String

        Args:
            name (str): The name of the pkg to import.
            version (str or Version, optional): The version of the pkg to import. Defaults to None.
            hash_algo (member of Use.Hash, optional): For future compatibility with more modern hashing algorithms. Defaults to Hash.sha256.
            hashes (str | [str]), optional): A single hash or list of hashes of the pkg to import. Defaults to None.
            default (anything, optional): Whatever should be returned in case there's a problem with the import. Defaults to mode.fastfail.
            modes (int, optional): Any combination of Use.modes . Defaults to 0.

        Raises:
            RuntimeWarning: May be raised if the auto-installation of the pkg fails for some reason.

        Returns:
            Optional[ModuleType]: Module if successful, default as specified otherwise.
        
Import a pkg by name.
Import a pkg by name .
def _use_str(
        self,
        name: str,
        /,
        *,
        version: str = None,
        hash_algo=Hash.sha256,
        hashes: Optional[Union[str, list[str]]] = None,
        default=mode.fastfail,
        modes: int = 0,
    ) -> ProxyModule:
        package_name, module_name = _parse_name(name)
        return self._use_package(
            name=name,
            package_name=package_name,
            module_name=module_name,
            version=version,
            hash_algo=hash_algo,
            hashes=hashes,
            default=default,
            modes=modes,
        )
def _use_str ( self , name : str , / , * , version : str = None , hash_algo = Hash . sha256 , hashes : Optional [ Union [ str , list [ str ] ] ] = None , default = mode . fastfail , modes : int = 0 , ) -> ProxyModule : package_name , module_name = _parse_name ( name ) return self . _use_package ( name = name , package_name = package_name , module_name = module_name , version = version , hash_algo = hash_algo , hashes = hashes , default = default , modes = modes , )
Import a pkg by name.
Import a pkg by name .
"""
        Import a pkg by name.

        https://github.com/amogorkon/justuse/wiki/Use-String

        Args:
            name (str): The name of the pkg to import.
            version (str or Version, optional): The version of the pkg to import. Defaults to None.
            hash_algo (member of Use.Hash, optional): For future compatibility with more modern hashing algorithms. Defaults to Hash.sha256.
            hashes (str | [str]), optional): A single hash or list of hashes of the pkg to import. Defaults to None.
            default (anything, optional): Whatever should be returned in case there's a problem with the import. Defaults to mode.fastfail.
            modes (int, optional): Any combination of Use.modes . Defaults to 0.

        Raises:
            RuntimeWarning: May be raised if the auto-installation of the pkg fails for some reason.

        Returns:
            Optional[ModuleType]: Module if successful, default as specified otherwise.
        """
Module if successful, default as specified otherwise.
Module if successful default as specified otherwise .
Optional[ModuleType]
May be raised if the auto-installation of the pkg fails for some reason.
May be raised if the auto - installation of the pkg fails for some reason .
RuntimeWarning
self
name
str
The name of the pkg to import.
The name of the pkg to import .
version
str
The version of the pkg to import. Defaults to None.
The version of the pkg to import . Defaults to None .
None
hash_algo
For future compatibility with more modern hashing algorithms. Defaults to Hash.sha256.
For future compatibility with more modern hashing algorithms . Defaults to Hash . sha256 .
Hash.sha256
hashes
Optional[Union[str, list[str]]]
A single hash or list of hashes of the pkg to import. Defaults to None.
A single hash or list of hashes of the pkg to import . Defaults to None .
None
default
Whatever should be returned in case there's a problem with the import. Defaults to mode.fastfail.
Whatever should be returned in case there ' s a problem with the import . Defaults to mode . fastfail .
mode.fastfail
modes
int
Any combination of Use.modes . Defaults to 0.
Any combination of Use . modes . Defaults to 0 .
0