o
    &b                     @   s   d Z ddlZddlZddlZdZdZdd ZefddZeeZeeZ	e	d	 Z
d
ZdZdjeedZG dd dZdddZdZe	d ZeeeZdjeedZdZdZdS )u<    Package metadata for the ‘python-daemon’ distribution.     Nzpython-daemonzversion_info.jsonc                 C   s,   d}zt | }W |S  t jy   Y |S w )z Get the `Distribution` instance for distribution `name`.

        :param name: The distribution name for the query.
        :return: The `pkg_resources.Distribution` instance, or
            ``None`` if the distribution instance is not found.
        N)pkg_resourcesget_distributionDistributionNotFound)namedistribution r   4usr/lib/python3.10/site-packages/daemon/_metadata.pyr      s   r   c                 C   s6   dddd}| dur|  |r| |}t|}|S )a=   Get the version info from the installed distribution.

        :param distribution: The `pkg_resources.Distribution` instance
            representing the Python package to interrogate.
        :param filename: Base filename of the version info resource.
        :return: The version info as a mapping of fields.

        The version info is stored as a metadata file in the
        `distribution`.

        If the `distribution` is ``None``, or the version info
        metadata file is not found, the return value mapping fields
        have placeholder values.
        UNKNOWN)release_dateversion
maintainerN)has_metadataget_metadatajsonloads)r   filenameversion_infocontentr   r   r   get_distribution_version_info$   s   


r   r   z
Ben Finneyzben+python@benfinney.id.auz{name} <{email}>)r   emailc                   @   s"   e Zd ZdZdddZdd ZdS )	YearRangez% A range of years spanning a period. Nc                 C   s   || _ || _d S Nbeginend)selfr   r   r   r   r   __init__P   s   
zYearRange.__init__c                 C   s2   dj | d}| jd ur| j| jkrdj | d}|S )Nz{range.begin:04d})rangeu#   {range.begin:04d}–{range.end:04d})formatr   r   )r   textr   r   r   __str__T   s
   
zYearRange.__str__r   )__name__
__module____qualname____doc__r   r    r   r   r   r   r   M   s    
r   c              	   C   sL   t | } z	tj|d}W n ttfy   d}Y nw |j}t| |d}|S )a   Construct the year range given a start and possible end date.

        :param begin_year: The beginning year (text, 4 digits) for the
            range.
        :param end_date: The end date (text, ISO-8601 format) for the
            range, or a non-date token string.
        :return: The range of years as a `YearRange` instance.

        If the `end_date` is not a valid ISO-8601 date string, the
        range has ``None`` for the end year.
        z%Y-%m-%dNr   )intdatetimestrptime	TypeError
ValueErroryearr   )
begin_yearend_dateend_year
year_ranger   r   r   make_year_range\   s   r/   2001r
   u-   Copyright © {year_range} {author} and others)r.   authorzApache-2z https://pagure.io/python-daemon/r   )r$   r&   r   r   distribution_nameversion_info_filenamer   r   r   r   version_installedauthor_nameauthor_emailr   r1   r   r/   copyright_year_begin
build_datecopyright_year_range	copyrightlicenseurlr   r   r   r   <module>   s2   


