o
    ¹iº  ã                	   @  s¤   d Z ddlmZ ddlmZ ddlZe d¡Zdddd	ddd	dd
œZddddddddd
œZ	ddddœZ
G dd„ dedg d¢ƒƒZddd„ZeddddƒZe ¡ ZdS )zMeta related things.é    )Úannotations)Ú
namedtupleNz¤(?x)
    (?P<major>\d+)(?:\.(?P<minor>\d+))?(?:\.(?P<micro>\d+))?
    (?:(?P<type>a|b|rc)(?P<pre>\d+))?
    (?:\.post(?P<post>\d+))?
    (?:\.dev(?P<dev>\d+))?
    Ú ÚaÚbÚrc)ú.devz
.dev-alphaz	.dev-betaú.dev-candidateÚalphaÚbetaÚ	candidateÚfinalz2 - Pre-Alphaz	3 - Alphaz4 - Betaz5 - Production/Stabler
   r   r   )r   r   r   c                      sZ   e Zd ZdZ		dd‡ fdd„Zddd„Zddd„Zddd„Zddd„Zddd„Z	‡  Z
S )ÚVersional  
    Get the version (PEP 440).

    A biased approach to the PEP 440 semantic version.

    Provides a tuple structure which is sorted for comparisons `v1 > v2` etc.
      (major, minor, micro, release type, pre-release build, post-release build, development release build)
    Release types are named in is such a way they are comparable with ease.
    Accessors to check if a development, pre-release, or post-release build. Also provides accessor to get
    development status for setup files.

    How it works (currently):

    - You must specify a release type as either `final`, `alpha`, `beta`, or `candidate`.
    - To define a development release, you can use either `.dev`, `.dev-alpha`, `.dev-beta`, or `.dev-candidate`.
      The dot is used to ensure all development specifiers are sorted before `alpha`.
      You can specify a `dev` number for development builds, but do not have to as implicit development releases
      are allowed.
    - You must specify a `pre` value greater than zero if using a prerelease as this project (not PEP 440) does not
      allow implicit prereleases.
    - You can optionally set `post` to a value greater than zero to make the build a post release. While post releases
      are technically allowed in prereleases, it is strongly discouraged, so we are rejecting them. It should be
      noted that we do not allow `post0` even though PEP 440 does not restrict this. This project specifically
      does not allow implicit post releases.
    - It should be noted that we do not support epochs `1!` or local versions `+some-custom.version-1`.

    Acceptable version releases:

    ```
    Version(1, 0, 0, "final")                    1.0
    Version(1, 2, 0, "final")                    1.2
    Version(1, 2, 3, "final")                    1.2.3
    Version(1, 2, 0, ".dev-alpha", pre=4)        1.2a4
    Version(1, 2, 0, ".dev-beta", pre=4)         1.2b4
    Version(1, 2, 0, ".dev-candidate", pre=4)    1.2rc4
    Version(1, 2, 0, "final", post=1)            1.2.post1
    Version(1, 2, 3, ".dev")                     1.2.3.dev0
    Version(1, 2, 3, ".dev", dev=1)              1.2.3.dev1
    ```

    r   r   ÚmajorÚintÚminorÚmicroÚreleaseÚstrÚpreÚpostÚdevÚreturnc           	   
     sê   |||||fD ]}t |tƒr|dkstdƒ‚q|tvr"td |¡ƒ‚d|  k r,dk rCn n|dkr6tdƒ‚|r<tdƒ‚|rBtdƒ‚n#|d	k rZ|d
krS|dkrStdƒ‚|rYtdƒ‚n|r`tdƒ‚|rftdƒ‚tt| ƒ | |||||||¡S )zValidate version info.r   z6All version parts except 'release' should be integers.z!'{}' is not a valid release type.r	   r   z"Implicit pre-releases not allowed.z%Version is not a development release.z0Post-releases are not allowed with pre-releases.r
   r   z!Implicit pre-release not allowed.zVersion is not a pre-release.)Ú
isinstancer   Ú
ValueErrorÚREL_MAPÚformatÚsuperr   Ú__new__)	Úclsr   r   r   r   r   r   r   Úvalue©Ú	__class__© úM/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/soupsieve/__meta__.pyr   S   s2   ÿÿÿzVersion.__new__Úboolc                 C  ó   t | jdkƒS )zIs prerelease.r   )r%   r   ©Úselfr#   r#   r$   Ú_is_pre{   ó   zVersion._is_prec                 C  s   t | jdk ƒS )zIs development.r
   )r%   r   r'   r#   r#   r$   Ú_is_dev€   r*   zVersion._is_devc                 C  r&   )zIs post.r   )r%   r   r'   r#   r#   r$   Ú_is_post…   r*   zVersion._is_postc                 C  s
   t | j S )zGet development status string.)Ú
DEV_STATUSr   r'   r#   r#   r$   Ú_get_dev_statusŠ   s   
zVersion._get_dev_statusc                 C  s„   | j dkrd | j| j¡}n
d | j| j| j ¡}|  ¡ r(|d t| j | j¡7 }|  ¡ r4|d | j	¡7 }|  
¡ r@|d | j¡7 }|S )z Get the canonical output string.r   z{}.{}z{}.{}.{}z{}{}z.post{}z.dev{})r   r   r   r   r)   r   r   r   r,   r   r+   r   )r(   Úverr#   r#   r$   Ú_get_canonical   s   
zVersion._get_canonical)r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r   r%   )r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r)   r+   r,   r.   r0   Ú__classcell__r#   r#   r!   r$   r   (   s    ,ý
(


r   )r   r   r   r   r   r   r   r/   r   r   c           	      C  s  t  | ¡}|du rtd | ¡ƒ‚t| d¡ƒ}| d¡r#t| d¡ƒnd}| d¡r1t| d¡ƒnd}| d¡rGt| d¡ }t| d¡ƒ}nd	}d}| d
¡rU| d
¡nd}| d
¡rlt| d
¡ƒ}|rid| nd}nd}| d¡rzt| d¡ƒnd}t|||||||ƒS )z.Parse version into a comparable Version tuple.Nz'{}' is not a valid versionr   r   r   r   Útyper   r   r   z.dev-r   r   )ÚRE_VERÚmatchr   r   r   ÚgroupÚPRE_REL_MAPr   )	r/   Úmr   r   r   r   r   r   r   r#   r#   r$   Úparse_version¡   s$   


r<   é   é   r   )r/   r   r   r   )r4   Ú
__future__r   Úcollectionsr   ÚreÚcompiler7   r   r-   r:   r   r<   Ú__version_info__r0   Ú__version__r#   r#   r#   r$   Ú<module>   s<    ÿ
øø
y#