deepmd.backend.suffix
=====================

.. py:module:: deepmd.backend.suffix


Functions
---------

.. autoapisummary::

   deepmd.backend.suffix.format_model_suffix


Module Contents
---------------

.. py:function:: format_model_suffix(filename: str, feature: Optional[deepmd.backend.backend.Backend.Feature] = None, preferred_backend: Optional[Union[str, type[deepmd.backend.backend.Backend]]] = None, strict_prefer: Optional[bool] = None) -> str

   
   Check and format the suffixes of a filename.

   When preferred_backend is not given, this method checks the suffix of the filename
   is within the suffixes of the any backends (with the given feature) and doesn't do formatting.
   When preferred_backend is given, strict_prefer must be given.
   If strict_prefer is True and the suffix is not within the suffixes of the preferred backend,
   or strict_prefer is False and the suffix is not within the suffixes of the any backend with the given feature,
   the filename will be formatted with the preferred suffix of the preferred backend.

   :Parameters:

       **filename** : :class:`python:str`
           The filename to be formatted.

       **feature** : :obj:`Backend.Feature`, :obj:`optional`
           The feature of the backend, by default None

       **preferred_backend** : :class:`python:str` or :obj:`type` :obj:`of` :obj:`Backend`, :obj:`optional`
           The preferred backend, by default None

       **strict_prefer** : :ref:`bool <python:bltin-boolean-values>`, :obj:`optional`
           Whether to strictly prefer the preferred backend, by default None



   :Returns:

       :class:`python:str`
           The formatted filename with the correct suffix.




   :Raises:

       :obj:`ValueError`
           When preferred_backend is not given and the filename is not supported by any backend.







   ..
       !! processed by numpydoc !!

