Return a VersionMode for a mode name.

        When the mode is None, we are working with the 'base' mode.
495374
def _get_version_mode(self, mode=None):
        
        version_mode = self._version_modes.get(mode)
        if not version_mode:
            version_mode = self._version_modes[mode] = VersionMode(name=mode)
        return version_mode
1336006
def versions(mode=None, add_pckg=None, ncol=4):
    
    """
    # Issue warning
    mesg = ("\n    Func `versions` is deprecated and will " +
            "be removed; use Class `Versions` instead.")
    warnings.warn(mesg, DeprecationWarning)

    return Versions(add_pckg, ncol)
285633
def determine_version(self, request, *args, **kwargs):
        
        if self.versioning_class is None:
            return (None, None)
        scheme = self.versioning_class()
        return (scheme.determine_version(request, *args, **kwargs), scheme)
23366
def get_mode(self, old_mode=None):
        
        if self.mode is not None:
            return self.mode
        assert self.can_write, "This format does not have a supported output mode."
        if old_mode is None:
            return self.output_modes[0]
        if old_mode in self.output_modes:
            return old_mode
        # now let's get best mode available from supported
        try:
            idx = PILLOW_MODES.index(old_mode)
        except ValueError:
            # maybe some unknown or uncommon mode
            return self.output_modes[0]
        for mode in PILLOW_MODES[idx+1:]:
            if mode in self.output_modes:
                return mode
        # since there is no better one, lets' look for closest one in opposite direction
        opposite = PILLOW_MODES[:idx]
        opposite.reverse()
        for mode in opposite:
            if mode in self.output_modes:
                return mode
1220125
def mode(self):
        
        if self.changeset:
            mode = self.changeset.get_file_mode(self.path)
        else:
            mode = self._mode
        return mode
841765
def get_version(version):
    ""
    # Now build the two parts of the version number:
    # main = X.Y[.Z]
    # sub = .devN - for pre-alpha releases
    #     | {a|b|c}N - for alpha, beta and rc releases

    main = get_main_version(version)

    sub = ''
    if version[3] != 'final':
        mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'}
        sub = mapping[version[3]] + str(version[4])

    return main + sub
406276
def get_version():
    
    with open(os.path.join(DIR, 'include/libjsonnet.h')) as f:
        for line in f:
            if '#define' in line and 'LIB_JSONNET_VERSION' in line:
                v_code = line.partition('LIB_JSONNET_VERSION')[2].strip('\n "')
                if v_code[0] == "v":
                    v_code = v_code[1:]
                return v_code
557660
def version(self) -> int:
        
        version = self._config.get('version', 1)

        if version not in SUPPORTED_SCENARIO_VERSIONS:
            raise InvalidScenarioVersion(f'Unexpected scenario version {version}')
        return version
619186
def get_version(full=False):
    
    version = '.'.join([str(bit) for bit in __version__[:3]])

    if full:
        version = '-'.join([version] + list(__version__[3:]))

    return version
750864
def post_operations(self, mode=None):
        
        version_mode = self._get_version_mode(mode=mode)
        return version_mode.post_operations
304752
def check_version(self, check, timeout=None, metadata=None,
                      credentials=None):
        """"""
        return self.stub.CheckVersion(check, timeout=timeout,
                                      metadata=metadata,
                                      credentials=credentials)
1223051
def get_version(release_level=True):
    
    vers = ["%(major)i.%(minor)i.%(micro)i" % __version_info__]
    if release_level and __version_info__['releaselevel'] != 'final':
        vers.append('%(releaselevel)s%(serial)i' % __version_info__)
    return ''.join(vers)
377412
def get_version():
    
    VERSION_FILE = os.path.join(module_name, 'version.py')
    txt = open(VERSION_FILE).read()
    mo = re.search(r'^__version__ = [\'"]([^\'"]*)[\'"]', txt, re.M)
    if mo:
        version = mo.group(1)
        bs_version = os.environ.get('MODULEVER', '0.0')
        assert bs_version == "0.0" or bs_version == version, \
            "Version {} specified by the build system doesn't match {} in " \
            "version.py".format(bs_version, version)
        return version
    else:
        raise RuntimeError('Unable to find version string in {0}.'
                           .format(VERSION_FILE))
1356057
def get_os_version(self, version_text):
        """"""
        os_version = None
        if version_text is None:
            return os_version
        match = re.search(self.version_re, version_text, re.MULTILINE)
        if match:
            os_version = match.group(1)

        return os_version
452545
def find_version(
        package_name: str, version_module_name: str = '_version',
        version_variable_name: str = 'VERSION') -> str:
    """"""
    version_module = importlib.import_module(
        '{}.{}'.format(package_name.replace('-', '_'), version_module_name))
    return getattr(version_module, version_variable_name)
548054
def get_container_version():
    """"""
    root_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
    version_file = os.path.join(root_dir, 'VERSION')
    if os.path.exists(version_file):
        with open(version_file) as f:
            return f.read()
    return ''
1138395
def versionString(version):
    
    ver = list(map(str, version))
    numbers, rest = ver[:2 if ver[2] == '0' else 3], ver[3:]
    return '.'.join(numbers) + '-'.join(rest)