Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Classes | Functions | Variables
pip._vendor.distlib.version Namespace Reference

Classes

class  LegacyMatcher
 
class  LegacyVersion
 
class  Matcher
 
class  NormalizedMatcher
 
class  NormalizedVersion
 
class  SemanticMatcher
 
class  SemanticVersion
 
class  UnsupportedVersionError
 
class  Version
 
class  VersionScheme
 

Functions

 _pep_440_key (s)
 
 _match_prefix (x, y)
 
 _suggest_semantic_version (s)
 
 _suggest_normalized_version (s)
 
 _legacy_key (s)
 
 is_semver (s)
 
 _semantic_key (s)
 
 get_scheme (name)
 

Variables

 logger = logging.getLogger(__name__)
 
 PEP440_VERSION_RE
 
 _normalized_key = _pep_440_key
 
tuple _REPLACEMENTS
 
tuple _SUFFIX_REPLACEMENTS
 
 _NUMERIC_PREFIX = re.compile(r'(\d+(\.\d+)*)')
 
 _VERSION_PART = re.compile(r'([a-z]+|\d+|[\.-])', re.I)
 
dict _VERSION_REPLACE
 
 _SEMVER_RE
 
dict _SCHEMES
 

Detailed Description

Implementation of a flexible versioning scheme providing support for PEP-440,
setuptools-compatible and semantic versioning.

Function Documentation

◆ _suggest_normalized_version()

pip._vendor.distlib.version._suggest_normalized_version (   s)
protected
Suggest a normalized version close to the given version string.

If you have a version string that isn't rational (i.e. NormalizedVersion
doesn't like it) then you might be able to get an equivalent (or close)
rational version from this function.

This does a number of simple normalizations to the given string, based
on observation of versions currently in use on PyPI. Given a dump of
those version during PyCon 2009, 4287 of them:
- 2312 (53.93%) match NormalizedVersion without change
  with the automatic suggestion
- 3474 (81.04%) match when using this suggestion method

@param s {str} An irrational version string.
@returns A rational version string, or None, if couldn't determine one.

◆ _suggest_semantic_version()

pip._vendor.distlib.version._suggest_semantic_version (   s)
protected
Try to suggest a semantic form for a version for which
_suggest_normalized_version couldn't come up with anything.

Variable Documentation

◆ _REPLACEMENTS

tuple pip._vendor.distlib.version._REPLACEMENTS
protected
Initial value:
1= (
2 (re.compile('[.+-]$'), ''), # remove trailing puncts
3 (re.compile(r'^[.](\d)'), r'0.\1'), # .N -> 0.N at start
4 (re.compile('^[.-]'), ''), # remove leading puncts
5 (re.compile(r'^\‍((.*)\‍)$'), r'\1'), # remove parentheses
6 (re.compile(r'^v(ersion)?\s*(\d+)'), r'\2'), # remove leading v(ersion)
7 (re.compile(r'^r(ev)?\s*(\d+)'), r'\2'), # remove leading v(ersion)
8 (re.compile('[.]{2,}'), '.'), # multiple runs of '.'
9 (re.compile(r'\b(alfa|apha)\b'), 'alpha'), # misspelt alpha
10 (re.compile(r'\b(pre-alpha|prealpha)\b'),
11 'pre.alpha'), # standardise
12 (re.compile(r'\‍(beta\‍)$'), 'beta'), # remove parentheses
13)

◆ _SCHEMES

dict pip._vendor.distlib.version._SCHEMES
protected
Initial value:
1= {
2 'normalized': VersionScheme(_normalized_key, NormalizedMatcher,
3 _suggest_normalized_version),
4 'legacy': VersionScheme(_legacy_key, LegacyMatcher, lambda self, s: s),
5 'semantic': VersionScheme(_semantic_key, SemanticMatcher,
6 _suggest_semantic_version),
7}

◆ _SEMVER_RE

pip._vendor.distlib.version._SEMVER_RE
protected
Initial value:
1= re.compile(r'^(\d+)\.(\d+)\.(\d+)'
2 r'(-[a-z0-9]+(\.[a-z0-9-]+)*)?'
3 r'(\+[a-z0-9]+(\.[a-z0-9-]+)*)?$', re.I)

◆ _SUFFIX_REPLACEMENTS

tuple pip._vendor.distlib.version._SUFFIX_REPLACEMENTS
protected
Initial value:
1= (
2 (re.compile('^[:~._+-]+'), ''), # remove leading puncts
3 (re.compile('[,*")([\\]]'), ''), # remove unwanted chars
4 (re.compile('[~:+_ -]'), '.'), # replace illegal chars
5 (re.compile('[.]{2,}'), '.'), # multiple runs of '.'
6 (re.compile(r'\.$'), ''), # trailing '.'
7)

◆ _VERSION_REPLACE

dict pip._vendor.distlib.version._VERSION_REPLACE
protected
Initial value:
1= {
2 'pre': 'c',
3 'preview': 'c',
4 '-': 'final-',
5 'rc': 'c',
6 'dev': '@',
7 '': None,
8 '.': None,
9}

◆ PEP440_VERSION_RE

pip._vendor.distlib.version.PEP440_VERSION_RE
Initial value:
1= re.compile(r'^v?(\d+!)?(\d+(\.\d+)*)((a|alpha|b|beta|c|rc|pre|preview)(\d+)?)?'
2 r'(\.(post|r|rev)(\d+)?)?([._-]?(dev)(\d+)?)?'
3 r'(\+([a-zA-Z\d]+(\.[a-zA-Z\d]+)?))?$', re.I)