Return download data by installer name and version.

        :return: dict of cache data; keys are datetime objects, values are
          dict of installer name/version (str) to count (int).
        :rtype: dict
191112
def per_installer_data(self):
        
        ret = {}
        for cache_date in self.cache_dates:
            data = self._cache_get(cache_date)
            ret[cache_date] = {}
            for inst_name, inst_data in data['by_installer'].items():
                for inst_ver, count in inst_data.items():
                    k = self._compound_column_value(
                        inst_name,
                        self._shorten_version(inst_ver)
                    )
                    ret[cache_date][k] = count
            if len(ret[cache_date]) == 0:
                ret[cache_date]['unknown'] = 0
        return ret
772998
def get_installed_version(dist_name, working_set=None):
    """"""
    # Create a requirement that we'll look for inside of setuptools.
    req = pkg_resources.Requirement.parse(dist_name)

    if working_set is None:
        # We want to avoid having this cached, so we need to construct a new
        # working set each time.
        working_set = pkg_resources.WorkingSet()

    # Get the installed distribution from our working set
    dist = working_set.find(req)

    # Check to see if we got an installed distribution or not, if we did
    # we want to return it's version.
    return dist.version if dist else None
537161
def get_version_storage():
    # type: () -> VersionStorage
    
    version_file = conf.get_path('version_file', 'VERSION')
    if version_file.endswith('.py'):
        return PyVersionStorage(version_file)
    elif version_file.endswith('package.json'):
        return NodeVersionStorage(version_file)
    else:
        return RawVersionStorage(version_file)
1129241
def max_version(self):
        
        data = self.version_downloads
        if not data:
            return None, 0
        return max(data.items(), key=lambda item: item[1])
988721
def data(self):
        
        if self.is_obsolete():
            self.update_cache(self.get_data())
        return self.cache_data
585290
def get_versions() -> FileVersionResult:
    

    version_counter = Counter()
    versions_match = False
    version_str = None
    versions_discovered = OrderedDict()

    for version_obj in version_objects:
        discovered = version_obj.get_version()
        versions_discovered[version_obj.key_name] = discovered
        version_counter.update([discovered])

    if len(version_counter) == 1:
        versions_match = True
        version_str = list(version_counter.keys())[0]

    return FileVersionResult(
        uniform=versions_match,
        version_details=versions_discovered,
        version_result=version_str,
    )
507005
def get_package_data():
    

    package_data = {
        '': ['*.xml'],
        'js': ['*.js'],
        LOCALES_DIRECTORY: ['*']
    }

    for directory in os.listdir(LOCALES_DIRECTORY):
        package_data[LOCALES_DIRECTORY + '.' + directory] = ['*.json']
    return package_data
760206
def _load_cache(self):
        """"""
        # If the cached file exist, read-it
        max_refresh_date = timedelta(days=7)
        cached_data = {}
        try:
            with open(self.cache_file, 'rb') as f:
                cached_data = pickle.load(f)
        except Exception as e:
            logger.debug("Cannot read version from cache file: {} ({})".format(self.cache_file, e))
        else:
            logger.debug("Read version from cache file")
            if (cached_data['installed_version'] != self.installed_version() or
                    datetime.now() - cached_data['refresh_date'] > max_refresh_date):
                # Reset the cache if:
                # - the installed version is different
                # - the refresh_date is > max_refresh_date
                cached_data = {}
        return cached_data
66490
def get_cached(path, cache_name=None, **kwargs):
    
    if gw2api.cache_dir and gw2api.cache_time and cache_name is not False:
        if cache_name is None:
            cache_name = path
        cache_file = os.path.join(gw2api.cache_dir, cache_name)
        if mtime(cache_file) >= time.time() - gw2api.cache_time:
            with open(cache_file, "r") as fp:
                return json.load(fp)
    else:
        cache_file = None

    r = gw2api.session.get(gw2api.BASE_URL + path, **kwargs)

    if not r.ok:
        try:
            response = r.json()
        except ValueError:  # pragma: no cover
            response = None
        if isinstance(response, dict) and "text" in response:
            r.reason = response["text"]

    r.raise_for_status()
    data = r.json()

    if cache_file:
        with open(cache_file, "w") as fp:
            json.dump(data, fp, indent=2)

    return data
217173
def download_data():
    
    with urlopen(_retrieve_download_url()) as f:
        with open(os.path.join(CACHE_FOLDER, CACHE_ZIP), "wb") as local_file:
            local_file.write(f.read())
301053
def iter_installable_versions(self):
        
        for name in self._pyenv('install', '--list').out.splitlines():
            try:
                version = Version.parse(name.strip())
            except ValueError:
                continue
            yield version
182429
def get_version(package_name, ignore_cache=False):
    
    if ignore_cache:
        with microcache.temporarily_disabled():
            found = helpers.regex_in_package_file(
                VERSION_SET_REGEX, '_version.py', package_name, return_match=True
            )
    else:
        found = helpers.regex_in_package_file(
            VERSION_SET_REGEX, '_version.py', package_name, return_match=True
        )
    if found is None:
        raise ProjectError('found {}, but __version__ is not defined')
    current_version = found['version']
    return current_version
86420
def get_version():
    
    try:
        version_file = open(os.path.join(ROOT_DIR, 'mollie', 'api', 'version.py'), encoding='utf=8')
    except TypeError:
        # support python 2
        version_file = open(os.path.join(ROOT_DIR, 'mollie', 'api', 'version.py'))
    contents = version_file.read()
    match = re.search(r'VERSION = [\'"]([^\'"]+)', contents)
    if match:
        return match.group(1)
    else:
        raise RuntimeError("Can't determine package version")
1324035
def get_version():
    
    local_results = {}
    version_file_path = os.path.join('pytextql', 'version.py')

    # This is compatible with py3k which removed execfile.
    with open(version_file_path, 'rb') as fin:
        # Compiling instead of passing the text straight to exec
        # associates any errors with the correct file name.
        code = compile(fin.read(), version_file_path, 'exec')
        exec(code, {}, local_results)

    return local_results['__version__']
1207239
def to_dict(self):
        
        data = dict()
        data['max_age'] = self.max_age
        data['cache_dir'] = self.cache_dir
        return data
848121
def acquire(self, **kwargs):
        
        return config.download_data(self.temp_filename, self.url,
                                    self.sha256)
1253351
def data(self):
        
        if self._next_update and datetime.now() > self._next_update:
            self.update()
        return self._data