returns a hash from all sources to the toolchain that should be used for a source
333118
def collect_sources_and_toolchains
      sources_to_build = {}

      exclude_files = Set.new
      exclude_sources.each do |p|
        if p.include?("..")
          Printer.printError "Error: Exclude source file pattern '#{p}' must not include '..'"
          return nil
        end

        Dir.glob(p).each {|f| exclude_files << f}
      end
      files = Set.new  # do not build the same file twice

      add_to_sources_to_build(sources_to_build, exclude_files, sources)

      source_patterns.each do |p|
        if p.include?("..")
          Printer.printError "Error: Source file pattern '#{p}' must not include '..'"
          return nil
        end

        globRes = Dir.glob(p)
        if (globRes.length == 0)
          Printer.printWarning "Warning: Source file pattern '#{p}' did not match to any file"
        end
        add_to_sources_to_build(sources_to_build, exclude_files, globRes, tcs4source(p))
      end
      return sources_to_build
    end
1093064
def make_mash_with_consistent_hash(obj)
        m = Hashie::Mash.new(obj)
        def m.hash
          inspect.hash
        end
        return m
      end
234507
def hash(self):
        """"""
        if 'digest' not in self._p4dict:
            self._p4dict = self._connection.run(['fstat', '-m', '1', '-Ol', self.depotFile])[0]

        return self._p4dict['digest']
127117
def hash_hook(path, options):
    """"""
    with open(path, 'r') as f:
        data = f.read()
        for key in sorted(iterkeys(options)):
            data += '\n#{}={}'.format(key, options.get(key))
        return hashlib.md5(data.encode()).hexdigest()
113717
def get_hash(name)
      file_name = File.join(@db_dir, name + '.json')
      return ::Hash.new unless File.exist?(file_name)

      begin
        json = File.read(file_name)
      rescue => e
        PEROBS.log.fatal "Cannot read hash file '#{file_name}': #{e.message}"
      end
      JSON.parse(json, :create_additions => true)
    end
648914
def get_hash(self, source_geo_def=None, target_geo_def=None, **kwargs):
        """"""
        if source_geo_def is None:
            source_geo_def = self.source_geo_def
        if target_geo_def is None:
            target_geo_def = self.target_geo_def
        the_hash = source_geo_def.update_hash()
        target_geo_def.update_hash(the_hash)
        hash_dict(kwargs, the_hash)
        return the_hash.hexdigest()
15776
def hash(self):
        
        hash_request = etcdrpc.HashRequest()
        return self.maintenancestub.Hash(hash_request).hash
587391
def get_all_importing_namespace_hashes( self ):
        
        cur = self.db.cursor()
        namespace_hashes = namedb_get_all_importing_namespace_hashes( cur, self.lastblock )
        return namespace_hashes
268613
def to_hash
            index_hash = {}
            index_hash['json_claz'] = self.class.name
            index_hash['id'] = id
            index_hash['name'] = name
            index_hash['tosca_type'] = tosca_type
            index_hash['inputs'] = inputs
            index_hash['outputs'] = outputs
            index_hash['envs'] = envs
            index_hash['artifacts'] = artifacts
            index_hash['related_components'] = related_components
            index_hash['operations'] = operations
            index_hash['status'] = status
            index_hash['state'] = state
            index_hash['repo'] = repo
            index_hash['created_at'] = created_at
            index_hash
        end
393039
def get_hash_of_files(root_path, directories=None):
    """"""
    if not directories:
        directories = [{'path': './'}]

    files_to_hash = []
    for i in directories:
        ignorer = get_ignorer(os.path.join(root_path, i['path']),
                              i.get('exclusions'))

        with change_dir(root_path):
            for root, dirs, files in os.walk(i['path'], topdown=True):
                if (root != './') and ignorer.is_ignored(root, True):
                    dirs[:] = []
                    files[:] = []
                else:
                    for filename in files:
                        filepath = os.path.join(root, filename)
                        if not ignorer.is_ignored(filepath):
                            files_to_hash.append(
                                filepath[2:] if filepath.startswith('./') else filepath  # noqa
                            )

    return calculate_hash_of_files(files_to_hash, root_path)
1314617
def to_hash
      config = { database: database, hosts: hosts }
      if username && password
        config.merge!(username: username, password: password)
      end
      config
    end
102006
def to_hash
      {
        :repository   => repository.name,
        :model        => model.name,
        :fields       => fields,
        :links        => links,
        :conditions   => conditions,
        :offset       => offset,
        :limit        => limit,
        :order        => order,
        :unique       => unique?,
        :add_reversed => add_reversed?,
        :reload       => reload?,
      }
    end
34539
def api_hash(replace = nil)
      self.replace = replace unless replace.nil?
      {
        url:          href,
        description:  description,
        extended:     extended,
        tags:         tag.join(" "),
        replace:      replace,
        shared:       shared,
        toread:       toread
      }.select { |key, value| ! value.nil? }
    end
1216082
def to_hash(retain_references=false)
      if retain_references then
        canton        = @canton
        agglomeration = @agglomeration
      else
        canton        = @canton && @canton.license_tag
        agglomeration = @agglomeration && @agglomeration.community_number
      end

      {
        :community_number => @community_number,
        :name             => @name,
        :canton           => canton,
        :agglomeration    => agglomeration,
      }
    end
695218
def _get_address_by_hash(self, block_hash):
        
        address_key = address_prefix + block_hash
        return self.db.get(address_key)
417285
def addrs_for_hash(self, h):
        
        if h not in self._hash_mapping:
            return

        self._mark_updated_mapping(self._hash_mapping, h)

        to_discard = set()
        for e in self._hash_mapping[h]:
            try:
                if h == hash(self[e].object): yield e
                else: to_discard.add(e)
            except KeyError:
                to_discard.add(e)
        self._hash_mapping[h] -= to_discard
495246
def find_sources(*args)
      return to_enum(__method__, *args) unless block_given?

      if environment
        find(*args).each do |asset|
          yield asset.source
        end
      else
        args.each do |path|
          asset = assets[path]
          yield File.binread(File.join(dir, asset)) if asset
        end
      end
    end