hermes.utils
============

.. py:module:: hermes.utils


Attributes
----------

.. autoapisummary::

   hermes.utils.hermes_metadata
   hermes.utils.hermes_name
   hermes.utils.hermes_version
   hermes.utils.hermes_urls
   hermes.utils.hermes_homepage
   hermes.utils.hermes_doi
   hermes.utils.hermes_concept_doi
   hermes.utils.hermes_user_agent


Functions
---------

.. autoapisummary::

   hermes.utils.retrieve_project_urls
   hermes.utils.guess_file_type
   hermes.utils.mask_options_values


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

.. py:function:: retrieve_project_urls(metadata_urls: list[str]) -> dict[str, str]

   Extracts the keys and values from the project.urls section in distribution package metadata
   and converts them into a dictionary.

   :param metadata_urls: The list of urls to extract from (from distribution metadata)
   :return: A dictionary mapping URL names to URLs


.. py:data:: hermes_metadata

.. py:data:: hermes_name

.. py:data:: hermes_version

.. py:data:: hermes_urls

.. py:data:: hermes_homepage

.. py:data:: hermes_doi
   :value: '10.5281/zenodo.13311079'


.. py:data:: hermes_concept_doi
   :value: '10.5281/zenodo.13221383'


   Fix "concept" DOI that always refers to the newest version.

.. py:data:: hermes_user_agent
   :value: 'Uninferable/Uninferable (Uninferable)'


.. py:function:: guess_file_type(path: pathlib.Path)

   File type detection for non-standardised formats.

   Custom detection for file types not yet supported by Python's ``guess_type``
   function.


.. py:function:: mask_options_values(args: argparse.Namespace) -> argparse.Namespace

   Masks potentially sensitive values in the 'options' argument
   in the passed argparse.Namespace.

   The main use case for this is preventing potentially sensitive
   data/secrets being included in raw args logging.

   :param args: The argparse.Namespace to mask.
   :return: A copy of the namespace with masked sensitive values.


