UA parsing not recommended but currently this is the only way to get the Firefox OS version https://developer.mozilla.org/en-US/docs/Gecko_user_agent_string_reference Should be replaced when better conversion to Firefox OS Version is available
428085
function convertVersionNumber (ver) {
    var hashVersion = {
        '18.0': '1.0.1',
        '18.1': '1.1',
        '26.0': '1.2',
        '28.0': '1.3',
        '30.0': '1.4',
        '32.0': '2.0'
    };
    var rver = ver;
    var sStr = ver.substring(0, 4);
    if (hashVersion[sStr]) {
        rver = hashVersion[sStr];
    }
    return (rver);

}
662
function () {
/*Line 35 - 'AtomBrowser.js' */        var nVer = navigator.appVersion;
/*Line 36 - 'AtomBrowser.js' */        var nAgt = navigator.userAgent;
/*Line 37 - 'AtomBrowser.js' */        this.userAgent = nAgt;
/*Line 38 - 'AtomBrowser.js' */        var browserName = navigator.appName;
/*Line 39 - 'AtomBrowser.js' */        var fullVersion = "" + parseFloat(navigator.appVersion);
/*Line 40 - 'AtomBrowser.js' */        var majorVersion = parseInt(navigator.appVersion, 10);
/*Line 41 - 'AtomBrowser.js' */        var nameOffset, verOffset, ix;

/*Line 43 - 'AtomBrowser.js' */        // In Opera, the true version is after "Opera" or after "Version"
/*Line 44 - 'AtomBrowser.js' */        if ((verOffset = nAgt.indexOf("Opera")) != -1) {
/*Line 45 - 'AtomBrowser.js' */            browserName = "Opera";
/*Line 46 - 'AtomBrowser.js' */            fullVersion = nAgt.substring(verOffset + 6);
/*Line 47 - 'AtomBrowser.js' */            if ((verOffset = nAgt.indexOf("Version")) != -1) {
/*Line 48 - 'AtomBrowser.js' */                fullVersion = nAgt.substring(verOffset + 8);
/*Line 49 - 'AtomBrowser.js' */            }
/*Line 50 - 'AtomBrowser.js' */        }
/*Line 51 - 'AtomBrowser.js' */            // In MSIE, the true version is after "MSIE" in userAgent
/*Line 52 - 'AtomBrowser.js' */        else if ((verOffset = nAgt.indexOf("MSIE")) != -1) {
/*Line 53 - 'AtomBrowser.js' */            browserName = "Microsoft Internet Explorer";
/*Line 54 - 'AtomBrowser.js' */            fullVersion = nAgt.substring(verOffset + 5);
/*Line 55 - 'AtomBrowser.js' */        }
/*Line 56 - 'AtomBrowser.js' */                // In Chrome, the true version is after "Chrome"
/*Line 57 - 'AtomBrowser.js' */        else if ((verOffset = nAgt.indexOf("Chrome")) != -1) {
/*Line 58 - 'AtomBrowser.js' */            browserName = "Chrome";
/*Line 59 - 'AtomBrowser.js' */            fullVersion = nAgt.substring(verOffset + 7);
/*Line 60 - 'AtomBrowser.js' */        }
/*Line 61 - 'AtomBrowser.js' */                // In Safari, the true version is after "Safari" or after "Version"
/*Line 62 - 'AtomBrowser.js' */        else if ((verOffset = nAgt.indexOf("Safari")) != -1) {
/*Line 63 - 'AtomBrowser.js' */            browserName = "Safari";
/*Line 64 - 'AtomBrowser.js' */            this.isMobile = nAgt.indexOf("iPhone") != -1;
/*Line 65 - 'AtomBrowser.js' */            fullVersion = nAgt.substring(verOffset + 7);
/*Line 66 - 'AtomBrowser.js' */            if ((verOffset = nAgt.indexOf("Version")) != -1) {
/*Line 67 - 'AtomBrowser.js' */                fullVersion = nAgt.substring(verOffset + 8);
/*Line 68 - 'AtomBrowser.js' */            }
/*Line 69 - 'AtomBrowser.js' */        }
/*Line 70 - 'AtomBrowser.js' */                // In Firefox, the true version is after "Firefox"
/*Line 71 - 'AtomBrowser.js' */        else if ((verOffset = nAgt.indexOf("Firefox")) != -1) {
/*Line 72 - 'AtomBrowser.js' */            browserName = "Firefox";
/*Line 73 - 'AtomBrowser.js' */            fullVersion = nAgt.substring(verOffset + 8);
/*Line 74 - 'AtomBrowser.js' */        }
/*Line 75 - 'AtomBrowser.js' */                // In most other browsers, "name/version" is at the end of userAgent
/*Line 76 - 'AtomBrowser.js' */        else if ((nameOffset = nAgt.lastIndexOf(' ') + 1) <
/*Line 77 - 'AtomBrowser.js' */              (verOffset = nAgt.lastIndexOf('/'))) {
/*Line 78 - 'AtomBrowser.js' */                  browserName = nAgt.substring(nameOffset, verOffset);
/*Line 79 - 'AtomBrowser.js' */                  fullVersion = nAgt.substring(verOffset + 1);
/*Line 80 - 'AtomBrowser.js' */                  if (browserName.toLowerCase() == browserName.toUpperCase()) {
/*Line 81 - 'AtomBrowser.js' */                      browserName = navigator.appName;
/*Line 82 - 'AtomBrowser.js' */                  }
/*Line 83 - 'AtomBrowser.js' */              }
/*Line 84 - 'AtomBrowser.js' */        // trim the fullVersion string at semicolon/space if present
/*Line 85 - 'AtomBrowser.js' */        if ((ix = fullVersion.indexOf(";")) != -1) {
/*Line 86 - 'AtomBrowser.js' */            fullVersion = fullVersion.substring(0, ix);
/*Line 87 - 'AtomBrowser.js' */        }
/*Line 88 - 'AtomBrowser.js' */        if ((ix = fullVersion.indexOf(" ")) != -1) {
/*Line 89 - 'AtomBrowser.js' */            fullVersion = fullVersion.substring(0, ix);
/*Line 90 - 'AtomBrowser.js' */        }

/*Line 92 - 'AtomBrowser.js' */        majorVersion = parseInt('' + fullVersion, 10);
/*Line 93 - 'AtomBrowser.js' */        if (isNaN(majorVersion)) {
/*Line 94 - 'AtomBrowser.js' */            fullVersion = '' + parseFloat(navigator.appVersion);
/*Line 95 - 'AtomBrowser.js' */            majorVersion = parseInt(navigator.appVersion, 10);
/*Line 96 - 'AtomBrowser.js' */        }

/*Line 98 - 'AtomBrowser.js' */        this.browserName = browserName;
/*Line 99 - 'AtomBrowser.js' */        this.majorVersion = majorVersion;
/*Line 100 - 'AtomBrowser.js' */        this.isMobile = /android|mobile|ios|iphone/gi.test(nAgt);
/*Line 101 - 'AtomBrowser.js' */    }
1032076
private static Browser parseBrowser(String userAgentString) {
		for (Browser brower : Browser.browers) {
			if (brower.isMatch(userAgentString)) {
				return brower;
			}
		}
		return Browser.Unknown;
	}
468709
def check_version(chrome_exe):
    '''
    
    '''
    # mac$ /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version
    # Google Chrome 64.0.3282.140 
    # mac$ /Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --version
    # Google Chrome 66.0.3341.0 canary
    # linux$ chromium-browser --version
    # Using PPAPI flash.
    #  --ppapi-flash-path=/usr/lib/adobe-flashplugin/libpepflashplayer.so --ppapi-flash-version=
    # Chromium 61.0.3163.100 Built on Ubuntu , running on Ubuntu 16.04
    cmd = [chrome_exe, '--version']
    out = subprocess.check_output(cmd, timeout=60)
    m = re.search(br'(Chromium|Google Chrome) ([\d.]+)', out)
    if not m:
        sys.exit(
                'unable to parse browser version from output of '
                '%r: %r' % (subprocess.list2cmdline(cmd), out))
    version_str = m.group(2).decode()
    major_version = int(version_str.split('.')[0])
    if major_version < 64:
        sys.exit('brozzler requires chrome/chromium version 64 or '
                 'later but %s reports version %s' % (
                     chrome_exe, version_str))
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()
480835
function getBrowserInformation(userAgent) {
  var browserInfo = _bowser2.default._detect(userAgent);

  for (var browser in prefixByBrowser) {
    if (browserInfo.hasOwnProperty(browser)) {
      var prefix = prefixByBrowser[browser];

      browserInfo.jsPrefix = prefix;
      browserInfo.cssPrefix = '-' + prefix.toLowerCase() + '-';
      break;
    }
  }

  browserInfo.browserName = getBrowserName(browserInfo);

  // For cordova IOS 8 the version is missing, set truncated osversion to prevent NaN
  if (browserInfo.version) {
    browserInfo.browserVersion = parseFloat(browserInfo.version);
  } else {
    browserInfo.browserVersion = parseInt(parseFloat(browserInfo.osversion), 10);
  }

  browserInfo.osVersion = parseFloat(browserInfo.osversion);

  // iOS forces all browsers to use Safari under the hood
  // as the Safari version seems to match the iOS version
  // we just explicitely use the osversion instead
  // https://github.com/rofrischmann/inline-style-prefixer/issues/72
  if (browserInfo.browserName === 'ios_saf' && browserInfo.browserVersion > browserInfo.osVersion) {
    browserInfo.browserVersion = browserInfo.osVersion;
  }

  // seperate native android chrome
  // https://github.com/rofrischmann/inline-style-prefixer/issues/45
  if (browserInfo.browserName === 'android' && browserInfo.chrome && browserInfo.browserVersion > 37) {
    browserInfo.browserName = 'and_chr';
  }

  // For android < 4.4 we want to check the osversion
  // not the chrome version, see issue #26
  // https://github.com/rofrischmann/inline-style-prefixer/issues/26
  if (browserInfo.browserName === 'android' && browserInfo.osVersion < 5) {
    browserInfo.browserVersion = browserInfo.osVersion;
  }

  // Samsung browser are basically build on Chrome > 44
  // https://github.com/rofrischmann/inline-style-prefixer/issues/102
  if (browserInfo.browserName === 'android' && browserInfo.samsungBrowser) {
    browserInfo.browserName = 'and_chr';
    browserInfo.browserVersion = 44;
  }

  return browserInfo;
}
810784
function( ua ) {
		ua = ua.toLowerCase();

		var match = /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
			/(msie) ([\w.]+)/.exec( ua ) ||
			!/compatible/.test( ua ) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) ||
		  	[];

		return { browser: match[1] || "", version: match[2] || "0" };
	}
400624
function findFirefox() {
  if (foundBinary) {
    return foundBinary;
  }

  if (process.platform === 'darwin') {
    var osxExe =  '/Applications/Firefox.app/Contents/MacOS/firefox-bin';
    foundBinary = io.exists(osxExe).then(function(exists) {
      return exists ? osxExe : null;
    });
  } else if (process.platform === 'win32') {
    foundBinary = defaultWindowsLocation();
  } else {
    foundBinary = promise.fulfilled(io.findInPath('firefox'));
  }

  return foundBinary = foundBinary.then(function(found) {
    if (found) {
      return found;
    }
    throw Error('Could not locate Firefox on the current system');
  });
}
1131434
function parse() {
  var msie = /MSIE.(\d+)/i.exec(ua);
  var rv = /Trident.+rv:(\d+)/i.exec(ua);
  var version = msie || rv || undefined;
  return version ? +version[1] : version;
}
1296403
function () {
		var version = 0;

		if ( this.chrome ) {
			version = navigator.userAgent.replace( /(.*chrome\/|safari.*)/gi, "" );
		}
		else if ( this.firefox ) {
			version = navigator.userAgent.replace( /(.*firefox\/)/gi, "" );
		}
		else if ( this.ie ) {
			version = navigator.userAgent.replace(/(.*msie|;.*)/gi, "");
		}
		else if ( this.opera ) {
			version = navigator.userAgent.replace( /(.*version\/|\(.*)/gi, "" );
		}
		else if ( this.safari ) {
			version = navigator.userAgent.replace( /(.*version\/|safari.*)/gi, "" );
		}
		else {
			version = navigator.appVersion || "0";
		}

		version = number.parse( string.trim( version ) );

		if ( isNaN( version ) ) {
			version = 0;
		}

		if ( this.ie && document.documentMode && document.documentMode < version ) {
			version = document.documentMode;
		}

		return version;
	}
372691
function findOS(uaPlatformInfo) {
  var oses = ['Android', 'BSD', 'Linux', 'Windows', 'iPhone OS', 'Mac OS', 'BSD', 'CrOS', 'Darwin', 'Dragonfly', 'Fedora', 'Gentoo', 'Ubuntu', 'debian', 'HP-UX', 'IRIX', 'SunOS', 'Macintosh', 'Win 9x', 'Win98', 'Win95', 'WinNT'];
  for(var os in oses) {
    for(var i in uaPlatformInfo) {
      var item = uaPlatformInfo[i];
      if (contains(item, oses[os])) return item;
    }
  }
  return 'Other';
}
734961
function () {
            var browser = api.browser.name, version = api.browser.version;

            switch (browser) {
                case "ie":
                    return version >= 9;
                    
                case "chrome":
                    return version >= 13;
                    
                case "ff":
                    return version >= 6;
                    
                case "ios":
                    return version >= 5;

                case "android":
                    return false;

                case "webkit":
                    return version >= 5.1;
                    
                case "opera":
                    return version >= 10;
                    
                default:
                    return false;
            }
        }
959654
public static function checkBrowserUC(){
		if ( stripos(self::$userAgentString, 'UBrowser') !== false) {
			$aresult = explode('/', stristr(self::$userAgentString, 'UBrowser') );
			if (isset($aresult[1])) {
				$aversion = explode(' ', $aresult[1]);
				self::$browser->setVersion($aversion[0]);
			}
			self::$browser->setName(Browser::UC);
			return true;
		}

		if ( stripos(self::$userAgentString, 'UCBrowser') !== false) {
			$aresult = explode('/', stristr(self::$userAgentString, 'UCBrowser') );
			if (isset($aresult[1])) {
				$aversion = explode(' ', $aresult[1]);
				self::$browser->setVersion($aversion[0]);
			}
			self::$browser->setName(Browser::UC);
			return true;
		}


		return false;
	}
74402
function() {
            var userAgent = pgwBrowser.userAgent.toLowerCase();

            // Check browser type
            for (i in browserData) {
                var browserRegExp = new RegExp(browserData[i].identifier.toLowerCase());
                var browserRegExpResult = browserRegExp.exec(userAgent);

                if (browserRegExpResult != null && browserRegExpResult[1]) {
                    pgwBrowser.browser.name = browserData[i].name;
                    pgwBrowser.browser.group = browserData[i].group;

                    // Check version
                    if (browserData[i].versionIdentifier) {
                        var versionRegExp = new RegExp(browserData[i].versionIdentifier.toLowerCase());
                        var versionRegExpResult = versionRegExp.exec(userAgent);

                        if (versionRegExpResult != null && versionRegExpResult[1]) {
                            setBrowserVersion(versionRegExpResult[1]);
                        }

                    } else {
                        setBrowserVersion(browserRegExpResult[1]);
                    }

                    break;
                }
            }

            return true;
        }
1333774
def default_user_agent(name="python-requests"):
    """"""
    _implementation = platform.python_implementation()

    if _implementation == 'CPython':
        _implementation_version = platform.python_version()
    elif _implementation == 'PyPy':
        _implementation_version = '%s.%s.%s' % (sys.pypy_version_info.major,
                                                sys.pypy_version_info.minor,
                                                sys.pypy_version_info.micro)
        if sys.pypy_version_info.releaselevel != 'final':
            _implementation_version = ''.join([_implementation_version, sys.pypy_version_info.releaselevel])
    elif _implementation == 'Jython':
        _implementation_version = platform.python_version()  # Complete Guess
    elif _implementation == 'IronPython':
        _implementation_version = platform.python_version()  # Complete Guess
    else:
        _implementation_version = 'Unknown'

    try:
        p_system = platform.system()
        p_release = platform.release()
    except IOError:
        p_system = 'Unknown'
        p_release = 'Unknown'

    return " ".join(['%s/%s' % (name, __version__),
                     '%s/%s' % (_implementation, _implementation_version),
                     '%s/%s' % (p_system, p_release)])
803873
function() {
      var UA = navigator.userAgent
      var browser
      var version
      var verOffset
      var nameOffset

      if ((verOffset = UA.indexOf('Opera')) > -1) {
        browser = 'Opera'
        version = UA.substring(verOffset + 6)
        if ((verOffset = UA.indexOf('Version')) > -1) {
          version = UA.substring(verOffset + 8)
        }
      } else if ((verOffset = UA.indexOf('MSIE')) > -1) {
        browser = 'Internet Explorer'
        version = UA.substring(verOffset + 5)
      } else if ((verOffset = UA.indexOf('Chrome')) > -1) {
        browser = 'Chrome'
        version = UA.substring(verOffset + 7)
      } else if ((verOffset = UA.indexOf('Safari')) > -1) {
        browser = 'Safari'
        version = UA.substring(verOffset + 7)
        if ((verOffset = UA.indexOf('Version')) > -1) {
          version = UA.substring(verOffset + 8)
        }
      } else if ((verOffset = UA.indexOf('Firefox')) > -1) {
        browser = 'Firefox'
        version = UA.substring(verOffset + 8)
      } else if (UA.indexOf('Trident/') > -1) {
        browser = 'Internet Explorer'
        version = UA.substring(UA.indexOf('rv:') + 3)
      } else if ((nameOffset = UA.lastIndexOf(' ') + 1) < (verOffset = UA.lastIndexOf('/'))) {
        browser = UA.substring(nameOffset, verOffset)
        version = UA.substring(verOffset + 1)
        if (browser.toLowerCase() == browser.toUpperCase()) {
          browser = navigator.appName
        }
      }

      return {
        browser: browser,
        version: version,
      }
    }
598852
def get_version():
    """"""
    with io.open('grammar_check/__init__.py', encoding='utf-8') as input_file:
        for line in input_file:
            if line.startswith('__version__'):
                return ast.parse(line).body[0].value.s