
    ˆh              	           S r SSKJr  SSKr\R                  " S5      rSSSSSSSSS	.rS
S
S
S
SSSSS	.rSSSS.r " S S\" S/ SQ5      5      r	S r
\	" SSSS5      r\R                  5       rg)zMeta related things.    )
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                   N   ^  \ rS rSrSrS
U 4S jjrS rS rS rS r	S r
S	rU =r$ )Version'   a  
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, "alpha", pre=4)             1.2a4
Version(1, 2, 0, "beta", pre=4)              1.2b4
Version(1, 2, 0, "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
```

c           
        > XX5U4 H)  n[        U[        5      (       a  US:  a  M   [        S5      e   U[        ;  a  [        SR	                  U5      5      eSUs=:  a  S:  a9  O  O6US:X  a  [        S5      eU(       a  [        S5      eU(       a  [        S5      eOTUS	:  a*  US
:  a  US:X  a  [        S5      eU(       a  [        S5      eO$U(       a  [        S5      eU(       a  [        S5      e[
        T	U ]  XX#XEXg5      $ )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.)
isinstanceint
ValueErrorREL_MAPformatsuper__new__)
clsmajorminormicroreleaseprepostdevvalue	__class__s
            J/opt/services/DDDS/venv/lib/python3.13/site-packages/materialx/__meta__.pyr   Version.__new__R   s    E5Euc**uz !YZZ 6 '!@GGPQQ g//ax !EFF !HII !STT  wC1H !DEE !STT 
  !@AA !HIIws5tQQ    c                 2    [        U R                  S:  5      $ )zIs prerelease.r   )boolr   selfs    r#   _is_preVersion._is_prev   s     DHHqL!!r%   c                 2    [        U R                  S:  5      $ )zIs development.r
   )r'   r   r(   s    r#   _is_devVersion._is_dev{   s     DLL7*++r%   c                 2    [        U R                  S:  5      $ )zIs post.r   )r'   r   r(   s    r#   _is_postVersion._is_post   s     DIIM""r%   c                 (    [         U R                     $ )zGet development status string.)
DEV_STATUSr   r(   s    r#   _get_dev_statusVersion._get_dev_status   s     $,,''r%   c                 L   U R                   S:X  a7  U R                  S:w  a'  SR                  U R                  U R                  5      nO1SR                  U R                  U R                  U R                   5      nU R	                  5       (       a0  USR                  [
        U R                     U R                  5      -  nU R                  5       (       a  USR                  U R                  5      -  nU R                  5       (       a  USR                  U R                  5      -  nU$ )z Get the canonical output string.r   z{}.{}z{}.{}.{}z{}{}z.post{}z.dev{})r   r   r   r   r*   r   r   r   r0   r   r-   r    )r)   vers     r#   _get_canonicalVersion._get_canonical   s     ::?tzzQ..TZZ8C##DJJ

DJJGC<<>>6==!6AAC==??9##DII..C<<>>8??488,,C
r%    )r   r   r   r   )__name__
__module____qualname____firstlineno____doc__r   r*   r-   r0   r4   r8   __static_attributes____classcell__)r"   s   @r#   r   r   '   s.    (T"RH"
,
#
(
 r%   r   )r   r   r   r   r   r   r    c           	      P   [         R                  U 5      nUc  [        SR                  U 5      5      e[	        UR                  S5      5      nUR                  S5      (       a  [	        UR                  S5      5      OSnUR                  S5      (       a  [	        UR                  S5      5      OSnUR                  S5      (       a3  [        UR                  S5         n[	        UR                  S5      5      nOSnSnUR                  S	5      (       a  UR                  S	5      OSnUR                  S	5      (       a)  [	        UR                  S	5      5      nU(       a  S
U-   OSnOSnUR                  S5      (       a  [	        UR                  S5      5      OSn[        X#XEXhU5      $ )z.Parse version into a comparable Version tuple.z'{}' is not a valid versionr   r   r   r   typer   r   r    z.dev-r   r   )RE_VERmatchr   r   r   groupPRE_REL_MAPr   )	r7   mr   r   r   r   r   r    r   s	            r#   parse_versionrI      sH    	SAy6==cBCC  !E%&WWW%5%5C !1E%&WWW%5%5C !1E 	wwvaggfo.!''%.! GGENN!''%.Cwwu~~!''%.!'*'G# $%776??3qwwvD5C@@r%         r   )r?   collectionsr   recompilerD   r   r3   rG   r   rI   __version_info__r8   __version__r:   r%   r#   <module>rQ      s     " 		
 	 ! %$	
 &<rj$`a rj AF 1aG, --/r%   