
    i2              
       |    d dl mZ d dlmZmZ d dlmZmZ 	 ddedede	dee	   fdZ
dedee   fd	Zd
edede	fdZy)    )Optional)InvalidSpecifierSpecifierSet)InvalidVersionVersionversion
constraintprereleasesreturnc                     |d   j                         rd| }	 t        |      }t        |       } ||_        | |v S # t        t        f$ r Y yw xY w)a  Check if a version (e.g. "2.0.0") is compatible given a version
    constraint (e.g. ">=1.9.0,<2.2.1"). If the constraint is a specific version,
    it's interpreted as =={version}.

    version (str): The version to check.
    constraint (str): The constraint string.
    prereleases (bool): Whether to allow prereleases. If set to False,
        prerelease versions will be considered incompatible.
    RETURNS (bool / None): Whether the version is compatible, or None if the
        version or constraint are invalid.
    r   z==N)isdigitr   r   r   r   r
   )r   r	   r
   specs       e/var/www/vps2.regionflexible.com/Desarrollo/venv/lib/python3.12/site-packages/weasel/util/versions.pyis_compatible_versionr      sf     !}*&
J''" #Dd? n- s   ; AAc                 z    	 t        |       }|j                   d|j                   S # t        t        f$ r Y yw xY w)zGet the major + minor version (without patch or prerelease identifiers).

    version (str): The version.
    RETURNS (str): The major + minor version or None if version is invalid.
    N.)r   	TypeErrorr   majorminor)r   vs     r   get_minor_versionr   !   sE    G ggYay!! ~& s   ( ::	version_a	version_bc                 P    t        |       }t        |      }|duxr |duxr ||k(  S )aN  Compare two versions and check if they match in major and minor, without
    patch or prerelease identifiers. Used internally for compatibility checks
    that should be insensitive to patch releases.

    version_a (str): The first version
    version_b (str): The second version.
    RETURNS (bool): Whether the versions match.
    N)r   )r   r   abs       r   is_minor_version_matchr   .   s4     	)$A)$AD=5Qd]5qAv5    N)T)typingr   packaging.specifiersr   r   packaging.versionr   r   strboolr   r   r    r   r   <module>r%      sm     ? 5 8<!04d^4
"s 
"x} 
"6c 6c 6d 6r   