Get data and format version
170548
function (service, data) {
  switch (service) {
  case 'gh':
    return data[0].tag_name.replace(/^v/, '');
  case 'npm':
    return data.version;
  case 'gem':
    return data.version;
  case 'bower':
    return data[0].tag_name.replace(/^v/, '');
  default:
    console.log(service + 'not found!');
    break;
  }
}
395172
def get_version():
    """"""
    try:
        f = open('eztemplate/version.py', 'r')
    except IOError as e:
        if e.errno != errno.ENOENT:
            raise
        m = None
    else:
        m = re.match('^\s*__version__\s*=\s*(?P<version>.*)$', f.read(), re.M)
        f.close()

    __version__ = ast.literal_eval(m.group('version')) if m else None

    try:
        git_version = subprocess.check_output(['git', 'describe', '--dirty'])
    except:
        if __version__ is None:
            raise ValueError("cannot determine version number")
        return __version__

    m = re.match(r'^\s*'
                 r'(?P<version>\S+?)'
                 r'(-(?P<post>\d+)-(?P<commit>g[0-9a-f]+))?'
                 r'(-(?P<dirty>dirty))?'
                 r'\s*$', git_version.decode())
    if not m:
        raise ValueError("cannot parse git describe output")

    git_version = m.group('version')
    post = m.group('post')
    commit = m.group('commit')
    dirty = m.group('dirty')

    local = []

    if post:
        post = int(post)
        if post:
            git_version += '.post%d' % (post,)
            if commit:
                local.append(commit)

    if dirty:
        local.append(dirty)

    if local:
        git_version += '+' + '.'.join(local)

    if git_version != __version__:
        with open('eztemplate/version.py', 'w') as f:
            f.write("__version__ = %r\n" % (str(git_version),))

    return git_version
1116127
def _get_pdb_format_version(self):
        ''''''
        if not self.format_version:
            version = None
            version_lines = None
            try:
                version_lines = [line for line in self.parsed_lines['REMARK'] if int(line[7:10]) == 4 and line[10:].strip()]
            except: pass
            if version_lines:
                assert(len(version_lines) == 1)
                version_line = version_lines[0]
                version_regex = re.compile('.*?FORMAT V.(.*),')
                mtch = version_regex.match(version_line)
                if mtch and mtch.groups(0):
                    try:
                        version = float(mtch.groups(0)[0])
                    except:
                        pass
            self.format_version = version
979521
def get_version():
    """"""
    contents = read_file(os.path.join('admirarchy', '__init__.py'))
    version = re.search('VERSION = \(([^)]+)\)', contents)
    version = version.group(1).replace(', ', '.').strip()
    return version
167688
def load_version_as_string():
    """"""
    with open(VERSION_PATH, 'r') as rfile:
        contents = rfile.read().strip()

    _, version = contents.split('=')
    version = version.strip()

    # Remove quotes
    return version.strip('"\'')
584113
def get_version(*file_paths):
    """"""
    filename = os.path.join(os.path.dirname(__file__), *file_paths)
    print("Looking for version in: {}".format(filename))
    version_file = open(filename).read()
    version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
    if version_match:
        return version_match.group(1)
    raise RuntimeError('Unable to find version string.')
889928
def get_online_version ():
    """"""
    session = requests.session()
    page = urlopen(UPDATE_URL, session)
    version, url = None, None
    for line in page.text.splitlines():
        if line.startswith(VERSION_TAG):
            version = line.split(':', 1)[1].strip()
        elif line.startswith(URL_TAG):
            url = line.split(':', 1)[1].strip()
            url = url.replace('${version}', version)
    return version, url
379352
def get_version():
    """"""
    config = RawConfigParser()
    config.read(os.path.join('..', 'setup.cfg'))
    return config.get('metadata', 'version')
1034818
def read_version():
    """"""
    finder = VersionFinder()
    finder.visit(ast.parse(local_file('curdling', 'version.py')))
    return finder.version
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()
1064141
def get_version(path):
    """"""

    with open(os.path.join(path, 'VERSION'), 'rb') as f:
        version = f.read().decode('ascii').strip()
    return version.strip()
547393
def version(self):
        """"""
        # requests.get destroys the ?
        import urllib
        with urllib.request.urlopen(URL_VERSION.format(self._url)) as response:
            return response.read().decode('utf-8')
        return False
939606
def version(self):
        """"""

        versions = []
        versions.append("sosreport: %s" % __version__)

        for plugname, plug in self.loaded_plugins:
            versions.append("%s: %s" % (plugname, plug.version))

        self.archive.add_string(content="\n".join(versions),
                                dest='version.txt')
772005
def do_version():
    """"""
    v = ApiPool.ping.model.Version(
        name=ApiPool().current_server_name,
        version=ApiPool().current_server_api.get_version(),
        container=get_container_version(),
    )
    log.info("/version: " + pprint.pformat(v))
    return v
962071
def get_version():
    """"""
    VERSION_FILE = '../malcolm/version.py'
    mo = re.search(r'^__version__ = [\'"]([^\'"]*)[\'"]',
                   open(VERSION_FILE, 'rt').read(), re.M)
    if mo:
        return mo.group(1)
    else:
        raise RuntimeError(
            'Unable to find version string in {0}.'.format(VERSION_FILE))
133913
def _get_version(name, results):
    '''
    
    '''
    for line in salt.utils.itertools.split(results, '\n'):
        if not line:
            continue
        try:
            pkgname, pkgver = line.rsplit('-', 1)
        except ValueError:
            continue
        if pkgname == name:
            return pkgver
    return None
1310772
def _premis_version_from_data(data):
    
    for child in data:
        if isinstance(child, dict):
            version = child.get("version")
            if version:
                return version
    return utils.PREMIS_VERSION