Return a copy of the version, possibly with less tokens.

        Args:
            len_ (int): New version length. If >= current length, an
                unchanged copy of the version is returned.
326411
def trim(self, len_):
        
        other = Version(None)
        other.tokens = self.tokens[:len_]
        other.seps = self.seps[:len_ - 1]
        return other
889
def get_pretty_version(self, diff_to_increase_ratio):
        
        version = self.get_version(diff_to_increase_ratio)
        build = self.get_last_commit_hash()
        return str(version) + " (" + build + ")"
119693
def version_parts(version):
    
    m = re.match(r'(\d+(?:\.\d+)*)([.%]|$)(.*)', version)
    if m:
        numver = m.group(1)
        rest = m.group(2) + m.group(3)
        return numver, rest
    else:
        return version, ''
282599
def version(self, version_str: str) -> None:
        
        ver = []
        for i in version_str.split('.'):
            ver.append(int(i))
            self.filter_negatives(int(i))
        self._major, self._minor, self._patch = ver[0], ver[1], ver[2]
1014658
def get_version(string):
    
    flags = re.S
    pattern = r".*__version__ = '(.*?)'"
    match = re.match(pattern=pattern, string=string, flags=flags)

    if match:
        return match.group(1)

    raise RuntimeError('No version string could be matched')
1185570
def _get_version(ctx, _, value):
    """"""

    if not value or ctx.resilient_parsing:
        return
    message = 'Zsl %(version)s\nPython %(python_version)s'
    click.echo(message % {
        'version': version,
        'python_version': sys.version,
    }, color=ctx.color)
    ctx.exit()
637076
def version(short):
    
    if short:
        print(get_system_spec()['raiden'])
    else:
        print(json.dumps(
            get_system_spec(),
            indent=2,
        ))
604615
def version(self) -> str:
        
        version: str = (
            str(self._major) + '.' +
            str(self._minor) + '.' +
            str(self._patch)
        )
        return version
972543
def version(self):
        
        git_rev = len(os.popen('git rev-list HEAD').readlines())
        if git_rev != 0:
            self.version_list[-1] = '%d' % git_rev
        version = '.'.join(self.version_list)
        return version
724199
def get_lipd_version(L):
    
    version = 1.0
    _keys = ["LipdVersion", "LiPDVersion", "lipdVersion", "liPDVersion"]
    for _key in _keys:
        if _key in L:
            version = L[_key]
            # Cast the version number to a float
            try:
                version = float(version)
            except AttributeError:
                # If the casting failed, then something is wrong with the key so assume version is 1.0
                version = 1.0
            L.pop(_key)
    return L, version
1028391
def version_parser(version_string):
    
    version, commit, branch = version_string.split('-', 3)

    # Remove the "v"
    version_number = version[1:]
    version_number = int(version_number)

    return Version(version_number, commit, branch)
734608
def ver(self, revision):
        """"""

        c = self.clone()

        c.version = self._parse_version(self.version)

        return c
646425
def get_version(self, diff_to_increase_ratio):
        
        diffs = self.get_diff_amounts()
        version = Version()

        for diff in diffs:
            version.increase_by_changes(diff, diff_to_increase_ratio)

        return version
1187700
def version(i):
    

    o=i.get('out','')

    r=get_version({})
    if r['return']>0: return r
    version_str=r['version_str']

    if o=='con':
       out('V'+version_str)

    return r
534686
def versioned_url(self):
        ''''''
        if self.url is None:
            return None
        return self.url.format(version=self.version)
1205318
def get_version(module):
    
    init_py = open('{0}.py'.format(module)).read()
    return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
402860
def version_tuple(self):
    """"""
    try:
      return tuple([int(digit, 10) for digit in self.version.split('.')])
    except (AttributeError, TypeError, ValueError):
      return None