Gets the latest user agent. Back-ups the old version first. it will fail silently if something is wrong...
351652
public static function get() {
        if ($data = @file_get_contents("https://raw.github.com/tobie/ua-parser/master/regexes.yaml")) {
            if (file_exists(__DIR__."/resources/regexes.yaml")) {
                if (!self::$nobackup) { 
                    if (!self::$silent) { print("backing up old YAML file...\n"); }
                        if (!copy(__DIR__."/resources/regexes.yaml", __DIR__."/resources/regexes.".date("Ymdhis").".yaml")) {
                            if (!self::$silent) { print("back-up failed...\n"); }
                                exit;
                        }
                }
            }
            $fp = fopen(__DIR__."/resources/regexes.yaml", "w");
            fwrite($fp, $data);
            fclose($fp);
            if (!self::$silent) { print("success...\n"); }
        } else {
            if (!self::$silent) { print("failed to get the file...\n"); }
        }
    }
556562
public function getUserAgent()
    {
        if ($this->USER_AGENT) {
            return $this->USER_AGENT;
        }

        if ($this->HTTP_USER_AGENT) {
            return $this->HTTP_USER_AGENT;
        }

        return null;
    }
352097
def refresh(self):
        
        newuser = self.bugzilla.getuser(self.email)
        self.__dict__.update(newuser.__dict__)
531775
def current_user_was_last_verifier(analysis):
    
    verifiers = analysis.getVerificators()
    return verifiers and verifiers[:-1] == api.get_current_user().getId()
996823
protected function _getUserAgent()
    {
        $ua = str_replace('%v', self::VERSION, $this->userAgent);
        $ua = str_replace('%m', $this->_getUpdateMethod(), $ua);

        return $ua;
    }
351808
function (browsers, userAgent) {
      return detect(browsers, userAgent).map(function (browser) {
        var version = Version.detect(browser.versionRegexes, userAgent);
        return {
          current: browser.name,
          version: version
        };
      });
    }
18598
def agent_version(self, value):
        
        if value == self._defaults['ai.internal.agentVersion'] and 'ai.internal.agentVersion' in self._values:
            del self._values['ai.internal.agentVersion']
        else:
            self._values['ai.internal.agentVersion'] = value
609317
def last_version():
    
    try:
        last_update, version, success = last_version._cache
    except AttributeError:
        last_update = 0
        version = None
        success = False
    cache_delta = 24 * 3600 if success else 600
    if (time.time() - last_update) < cache_delta:
        return version
    else:
        try:
            req = requests.get(settings.CAS_NEW_VERSION_JSON_URL)
            data = json.loads(req.text)
            version = data["info"]["version"]
            last_version._cache = (time.time(), version, True)
            return version
        except (
            KeyError,
            ValueError,
            requests.exceptions.RequestException
        ) as error:  # pragma: no cover (should not happen unless pypi is not available)
            logger.error(
                "Unable to fetch %s: %s" % (settings.CAS_NEW_VERSION_JSON_URL, error)
            )
            last_version._cache = (time.time(), version, False)
358770
def getVersion(self, agent, word):
        
        version_markers = self.version_markers if \
            isinstance(self.version_markers[0], (list, tuple)) else [self.version_markers]
        version_part = agent.split(word, 1)[-1]
        for start, end in version_markers:
            if version_part.startswith(start) and end in version_part:
                version = version_part[1:]
                if end:  # end could be empty string
                    version = version.split(end)[0]
                if not self.allow_space_in_version:
                    version = version.split()[0]
                return version
1204347
def copy_user_agent_from_driver(self):
        
        selenium_user_agent = self.driver.execute_script("return navigator.userAgent;")
        self.headers.update({"user-agent": selenium_user_agent})
80009
def get_pypi_version(self):
        
        if self.args.disable_check_update:
            return

        # If the cached file exist, read-it
        cached_data = self._load_cache()

        if cached_data == {}:
            # Update needed
            # Update and save the cache
            thread = threading.Thread(target=self._update_pypi_version)
            thread.start()
        else:
            # Update not needed
            self.data['latest_version'] = cached_data['latest_version']
            logger.debug("Get Glances version from cache file")
854209
def reset
      self.user_agent         = DEFAULT_USER_AGENT
      self.api_version        = DEFAULT_API_VERSION
      self.server_url         = DEFAULT_SERVER_URL
      self.client_name        = DEFAULT_CLIENT_NAME
      self.client_key         = DEFAULT_CLIENT_KEY
      self.connection_options = DEFAULT_CONNECTION_OPTIONS
      self.middleware         = DEFAULT_MIDDLEWARE
      self
    end
435853
def up_to_date(self):
        """"""
        VersionInfo = self.get_latest_version()
        CurrentVersion = VersionInfo.get('version')
        LatestVersion = VersionInfo.get('latest_version')
        if  CurrentVersion == LatestVersion:
            log.info('TeamPasswordManager is up-to-date!')
            log.debug('Current Version: {} Latest Version: {}'.format(LatestVersion, LatestVersion))
            return True
        else:
            log.warning('TeamPasswordManager is not up-to-date!')
            log.debug('Current Version: {} Latest Version: {}'.format(LatestVersion, LatestVersion))
            return False
1056011
def restart_agent(self, agent_id, **kwargs):
        ''''''
        host_medium = self.get_medium('host_agent')
        agent = host_medium.get_agent()
        d = host_medium.get_document(agent_id)
        # This is done like this on purpose, we want to ensure that document
        # exists before passing it to the agent (even though he would handle
        # this himself).
        d.addCallback(
            lambda desc: agent.start_agent(desc.doc_id, **kwargs))
        return d
1151701
def get_maintainer(self):
        # type: () -> hdx.data.user.User
        
        return hdx.data.user.User.read_from_hdx(self.data['maintainer'], configuration=self.configuration)
353598
def get_newest_app_version() -> Version:
    
    with urllib3.PoolManager(cert_reqs='CERT_REQUIRED', ca_certs=certifi.where()) as p_man:
        pypi_json = p_man.urlopen('GET', static_data.PYPI_JSON_URL).data.decode('utf-8')
    releases = json.loads(pypi_json).get('releases', [])
    online_version = Version('0.0.0')
    for release in releases:
        cur_version = Version(release)
        if not cur_version.is_prerelease:
            online_version = max(online_version, cur_version)
    return online_version
342879
def get_backends_versions(self):
        
        # We are not always have permission, so find open.
        for i in range(0, len(self.organizations)):
            try:
                backends = self.organizations[i].environments['default'].backends
            except ApiAuthenticationError:
                pass
            else:
                break
        versions = dict([(x['name'], x['version']) for x in backends])
        return versions