Extract a tuple of (major,minor,patch) from a firmware instance
326544
def semver_from_firmware(self, firmware):
        ''''''
        version = firmware.get("mav-firmware-version-major",None)
        if version is None:
            return (None,None,None)
        return (firmware["mav-firmware-version-major"],
                firmware["mav-firmware-version-minor"],
                firmware["mav-firmware-version-patch"])
154680
def get_device_major_minor(dev_path):
    
    stat = os.lstat(dev_path)
    return os.major(stat.st_rdev), os.minor(stat.st_rdev)
1260861
def _split_version_specifier(spec):
    """"""
    m = re.search(r'([<>=]?=?)?\s*([0-9.a-zA-Z]+)', spec)
    return m.group(2), m.group(1)
116475
def _parse_fmdump_verbose(output):
    '''
    
    '''
    result = []
    output = output.split("\n")

    fault = []
    verbose_fault = {}
    for line in output:
        if line.startswith('TIME'):
            fault.append(line)
            if verbose_fault:
                result.append(verbose_fault)
                verbose_fault = {}
        elif len(fault) == 1:
            fault.append(line)
            verbose_fault = _parse_fmdump("\n".join(fault))[0]
            fault = []
        elif verbose_fault:
            if 'details' not in verbose_fault:
                verbose_fault['details'] = ""
            if line.strip() == '':
                continue
            verbose_fault['details'] = '{0}{1}\n'.format(
                verbose_fault['details'],
                line
            )
    if verbose_fault:
        result.append(verbose_fault)

    return result
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)
1338307
def version(major, minor, patch):
        
        return lib.zsys_version(byref(c_int.from_param(major)), byref(c_int.from_param(minor)), byref(c_int.from_param(patch)))
636273
function versionToString(version) {
    if (isObject(version)) {
        try {
            return [version.major, version.minor, version.patch].join('.');
        } catch (e) {}
    }
    return version;
}
128185
def _parse_fmdump(output):
    '''
    
    '''
    result = []
    output = output.split("\n")

    # extract header
    header = [field for field in output[0].lower().split(" ") if field]
    del output[0]

    # parse entries
    for entry in output:
        entry = [item for item in entry.split(" ") if item]
        entry = ['{0} {1} {2}'.format(entry[0], entry[1], entry[2])] + entry[3:]

        # prepare faults
        fault = OrderedDict()
        for field in header:
            fault[field] = entry[header.index(field)]

        result.append(fault)

    return result
1274432
def package_version(filename, varname):
    """"""
    _locals = {}
    with open(filename) as fp:
        exec(fp.read(), None, _locals)
    return _locals[varname]
1283824
def version_tuple(version):
    
    if isinstance(version, str):
        return tuple(int(x) for x in version.split('.'))
    elif isinstance(version, tuple):
        return version
    else:
        raise ValueError("Invalid version: %s" % version)
868770
function extractMDNProperties(mdnEntry) {
  if (mdnEntry.status === 'standard') {
    return {
      syntax: mdnEntry.syntax
    }
  }

  return {
    status: abbreviateStatus(mdnEntry.status),
    syntax: mdnEntry.syntax
  }
}
651785
def tupleize_version(version):
    

    if version is None:
        return (("unknown",),)

    if version.startswith("<unknown"):
        return (("unknown",),)

    split = re.split("(?:\.|(-))", version)
    parsed = tuple(try_fix_num(x) for x in split if x)

    # Put the tuples in groups by "-"
    def is_dash(s):
        return s == "-"
    grouped = groupby(parsed, is_dash)

    return tuple(tuple(group) for dash, group in grouped if not dash)
804369
def bump(oldversion, level)
      major = minor = patch = 0
      if oldversion =~ /^(\d+)\.(\d+)\.(\d+)$/
        major = Regexp.last_match(1).to_i
        minor = Regexp.last_match(2).to_i
        patch = Regexp.last_match(3).to_i
      end
      case level.to_sym
      when :major
        major += 1
        minor = 0
        patch = 0
      when :minor
        minor += 1
        patch = 0
      when :patch
        patch += 1
      end
      version = [major, minor, patch].compact.join('.')
      version
    end
592598
def _router_numbers(self):
        """"""
        return tuple(up for up in self._up2down.keys()
                     if up in self._up2down.values())
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]
712287
def get_sys_info():
    ""

    blob = []

    # get full commit hash
    commit = None
    if os.path.isdir(".git") and os.path.isdir("pandas"):
        try:
            pipe = subprocess.Popen('git log --format="%H" -n 1'.split(" "),
                                    stdout=subprocess.PIPE,
                                    stderr=subprocess.PIPE)
            so, serr = pipe.communicate()
        except (OSError, ValueError):
            pass
        else:
            if pipe.returncode == 0:
                commit = so
                try:
                    commit = so.decode('utf-8')
                except ValueError:
                    pass
                commit = commit.strip().strip('"')

    blob.append(('commit', commit))

    try:
        (sysname, nodename, release,
         version, machine, processor) = platform.uname()
        blob.extend([
            ("python", '.'.join(map(str, sys.version_info))),
            ("python-bits", struct.calcsize("P") * 8),
            ("OS", "{sysname}".format(sysname=sysname)),
            ("OS-release", "{release}".format(release=release)),
            # ("Version", "{version}".format(version=version)),
            ("machine", "{machine}".format(machine=machine)),
            ("processor", "{processor}".format(processor=processor)),
            ("byteorder", "{byteorder}".format(byteorder=sys.byteorder)),
            ("LC_ALL", "{lc}".format(lc=os.environ.get('LC_ALL', "None"))),
            ("LANG", "{lang}".format(lang=os.environ.get('LANG', "None"))),
            ("LOCALE", '.'.join(map(str, locale.getlocale()))),
        ])
    except (KeyError, ValueError):
        pass

    return blob
739144
def iddversiontuple(afile):
    """"""
    def versiontuple(vers):
        """version tuple"""
        return tuple([int(num) for num in vers.split(".")])
    try:
        fhandle = open(afile, 'rb')
    except TypeError:
        fhandle = afile
    line1 = fhandle.readline()
    try:
        line1 = line1.decode('ISO-8859-2')
    except AttributeError:
        pass
    line = line1.strip()
    if line1 == '':
        return (0,)
    vers = line.split()[-1]
    return versiontuple(vers)