o
    ]i                     @   sZ  U d Z ddlmZ ddlZddlZd?ddZdddddddd	d
dddZeeedB f e	d< ddddddddZ
eeef e	d< i dddddddddddd d!d"d#d$d%d&d'd(d	d)d*d+d,d-d.d/d
d0dd1d2d3d4d5iZeeef e	d6< eG d7d8 d8Zdeeef fd9d:Zd;eeef ddfd<d=Zed>kre  dS dS )@z Generate the AUTHORS.rst file from git commit history.

This module reads git commit logs and produces a formatted list of contributors
grouped by their contribution count, mapping email aliases and GitHub usernames.
    )	dataclassNreturnc                  C   s   t  } t|  dS )z- Generate and print the AUTHORS.rst content. N)get_git_contributorsprint_contributors)contributors r   X/home/ubuntu/.local/lib/python3.10/site-packages/av-16.1.0.dist-info/licenses/AUTHORS.pymain   s   r	   zgithub@mikeboers.comzdavoudialireza@gmail.comztcaswell@gmail.comxxr@megvii.comdaniel.b.allan@gmail.comzchaudominic2@gmail.com)zgit@mikeboers.comzmboers@keypics.comzmikeb@loftysky.comzmikeb@markmedia.cozwesternx@mikeboers.comzmark@mark-VirtualBox.(none)za.davoudi@aut.ac.irztcaswell@bnl.govzxxr3376@gmail.comzdallan@pha.jhu.eduz-61652821+laggykiller@users.noreply.github.comEMAIL_ALIASESzCasper van der Welz	Dan AllanzManuel Goacolouz	Mark ReidzMoritz KassnerzVidar Tonaas Fauskez	Xinran Xu)zcaspervdw@gmail.comr   zmgoacolou@cls.frmindmark@gmail.commoritzkassner@gmail.comvidartf@gmail.comr
   CANONICAL_NAMESzbilly.shambrook@gmail.combillyshambrookdanielballanadavoudi	mikeboerszjeremy.laine@m4x.orgjlainezkalle.litterfeldt@gmail.comlitterfeldtr   markreidvfxr   mkassnerzrush@logic.czzradek-senfeldzself@brendanlong.combrendanlong	tacaswellzulrik.mikaelsson@magine.comrawlerr   vidartfzwillpatera@gmail.com
willpateraxxr3376laggykillerzwyattblue@auto-editor.com	WyattBluezCurtis@GreenKey.netdotysanGITHUB_USERNAMESc                   @   sf   e Zd ZU dZeed< ee ed< dZedB ed< dZe	ed< e
defd	d
ZdedefddZdS )ContributorzH Represents a contributor with their email, names, and GitHub username. emailnamesNgithubr   commit_countr   c                 C   s   d t| jS )z Return the formatted display name for the contributor.

        Returns:
            Comma-separated sorted list of contributor names.
        z, )joinsortedr%   )selfr   r   r   display_nameN   s   zContributor.display_namebulletc              
   C   sJ   | j r| d| j d| j d| j  d| j  d
S | d| j d| j dS )z Format the contributor line for RST output.

        Args:
            bullet: The bullet character to use (- or *).

        Returns:
            Formatted RST line with contributor info.
         z <z>; `@z <https://github.com/z>`_>)r&   r+   r$   )r*   r,   r   r   r   format_lineX   s   
zContributor.format_line)__name__
__module____qualname____doc__str__annotations__setr&   r'   intpropertyr+   r/   r   r   r   r   r#   E   s   
 	r#   c                  C   s   i } t jg ddd }|D ]7}| dd\}}t||}|s$q|| vr5t|t t	|d| |< | | }|j
| | jd7  _qt D ]\}}|| v rY|h| | _
qK| S )z Parse git log and return contributors grouped by canonical email.

    Returns:
        Dictionary mapping canonical emails to Contributor objects.
    )gitlogz--format=%aN,%aET)text,   )r$   r%   r&   )
subprocesscheck_output
splitlinesstriprsplitr   getr#   r6   r"   r%   addr'   r   items)r   git_loglinenamer$   canonical_emailcontributorcanonical_namer   r   r   r   j   s4   
r   r   c                 C   s   t ddd t|  dd d}d}d}|D ]&}tt|j}|r/||kr/|d	7 }t   |}d
|d  }t || qdS )zPrint contributors grouped by logarithmic order of commits.

    Args:
        contributors: Dictionary of contributors to print.
    zd        Contributors
        ============

        All contributors (by number of commits):
        z         c                 S   s   | j  | jfS )N)r'   r$   )cr   r   r   <lambda>   s    z$print_contributors.<locals>.<lambda>)keyNr   r=   z-*   )	printreplacer)   valuesr7   mathr:   r'   r/   )r   sorted_contributors
last_orderblock_indexrJ   orderr,   r   r   r   r      s$   r   __main__)r   N)r3   dataclassesr   rT   r>   r	   r   dictr4   r5   r   r"   r#   r   r   r0   r   r   r   r   <module>   s    


	
$&%
