Gets hashes for currently checked out version.
    @param versions_file: a common.VersionsFile instance to check against.
    @param base_path: where to look for files. e.g. './.update-workspace/silverstripe/'
    @return: checksums {'file1': 'hash1'}
547964
def hashes_get(versions_file, base_path):
    
    files = versions_file.files_get_all()
    result = {}
    for f in files:
        try:
            result[f] = functions.md5_file(base_path + f)
        except IOError:
            # Not all files exist for all versions.
            pass

    return result
498714
def get_version(path=VERSION_PATH):
    
    namespace = {}
    exec(read(path), namespace)
    return namespace['get_version'](short=True)
1200108
def _get_scope_versions(self, pkg_versions):
        '''
        
        '''
        get_in_versions = []
        for p_version in pkg_versions:
            if fnmatch.fnmatch(p_version, self.version):
                get_in_versions.append(p_version)
        return get_in_versions
290070
def get_fixtures_file_hash(all_fixture_paths: Iterable[str]) -> str:
    
    hasher = hashlib.md5()
    for fixture_path in sorted(all_fixture_paths):
        with open(fixture_path, 'rb') as fixture_file:
            hasher.update(fixture_file.read())
    return hasher.hexdigest()
1254994
def fetch
      VersionsFile.load(read_file(Configuration.versions_file),
                        read_file(Configuration.prerelease_versions_file, true))
    end
78957
def get_version_string(check_name):
    
    version = VERSION.search(read_version_file(check_name))
    if version:
        return version.group(1)
1332859
def __get_file_path(self, path, saltenv='base'):
        '''
        
        '''
        try:
            path = self._check_proto(path)
        except MinionError as err:
            # Local file path
            if not os.path.isfile(path):
                log.warning(
                    'specified file %s is not present to generate hash: %s',
                    path, err
                )
                return None
            else:
                return path
        return self._find_file(path, saltenv)
1097757
def get_version(with_git_hash=True, refresh_hash=False):
    """"""
    version = __version__
    if with_git_hash:
        global INDRA_GITHASH
        if INDRA_GITHASH is None or refresh_hash:
            with open(devnull, 'w') as nul:
                try:
                    ret = check_output(['git', 'rev-parse', 'HEAD'],
                                       cwd=dirname(__file__), stderr=nul)
                except CalledProcessError:
                    ret = 'UNHASHED'
            INDRA_GITHASH = ret.strip().decode('utf-8')
        version = '%s-%s' % (version, INDRA_GITHASH)
    return version
129068
def file_sha1(path):
  
  sha1 = hashlib.sha1()
  with open(path, "rb") as f:
    while True:
      block = f.read(2 ** 10)
      if not block:
        break
      sha1.update(block)
    return sha1.hexdigest()
784508
def commit_hash(self):
        
        commit_hash = None
        branch = None
        branch_file = '.git/HEAD'  # ref: refs/heads/develop

        # get current branch
        if os.path.isfile(branch_file):
            with open(branch_file, 'r') as f:
                try:
                    branch = f.read().strip().split('/')[2]
                except IndexError:
                    pass

            # get commit hash
            if branch:
                hash_file = '.git/refs/heads/{}'.format(branch)
                if os.path.isfile(hash_file):
                    with open(hash_file, 'r') as f:
                        commit_hash = f.read().strip()
        return commit_hash
79567
def hash_file(file_path, block_size = 65536):
    
    sha = hashlib.sha256()
    with open(file_path, 'rb') as h_file:
        file_buffer = h_file.read(block_size)
        while len(file_buffer) > 0:
            sha.update(file_buffer)
            file_buffer = h_file.read(block_size)
    return sha.hexdigest()
862769
def file_checksum(filepath):
    
    checksum = hashlib.md5()
    with open(filepath, 'rb') as f:
        for fragment in iter(lambda: f.read(65536), ''):
            checksum.update(fragment)
    return checksum.hexdigest()
1312823
def get_content_version(cls, abspath):
        
        data = cls.get_content(abspath)
        hasher = hashlib.md5()

        mtime_data = format(cls.get_content_modified_time(abspath), "%Y-%m-%d %H:%M:%S")

        hasher.update(mtime_data.encode())

        if isinstance(data, bytes):
            hasher.update(data)
        else:
            for chunk in data:
                hasher.update(chunk)
        return hasher.hexdigest()
211369
def get_hashes(path, exclude=None):
    '''
    
    '''
    out = {}
    for f in Path(path).rglob('*'):
        if f.is_dir():
            # We want to watch files, not directories.
            continue
        if exclude and re.match(exclude, f.as_posix()):
            retox_log.debug("excluding '{}'".format(f.as_posix()))
            continue
        pytime = f.stat().st_mtime
        out[f.as_posix()] = pytime
    return out
1016440
def rubocop_checksum
      ResultCache.source_checksum ||=
        begin
          lib_root = File.join(File.dirname(__FILE__), '..')
          exe_root = File.join(lib_root, '..', 'exe')

          # These are all the files we have `require`d plus everything in the
          # exe directory. A change to any of them could affect the cop output
          # so we include them in the cache hash.
          source_files = $LOADED_FEATURES + Find.find(exe_root).to_a
          sources = source_files
                    .select { |path| File.file?(path) }
                    .sort
                    .map { |path| IO.read(path, encoding: Encoding::UTF_8) }
          Digest::SHA1.hexdigest(sources.join)
        end
    end
1248062
def versioned_attributes
      json = self.as_json(:root => false).select do |k,_|
        versioned_attribute?(k)
      end

      json.to_hash
    end
486489
def hash_file_contents(requirements_option: RequirementsOptions, path: Path) -> str:
        
        return hashlib.sha256(path.read_bytes() + bytes(
            requirements_option.name + arca.__version__, "utf-8"
        )).hexdigest()