Filters the 4D hash to find specs for all user visible API
434372
def show_specs(options = {})
      options = {
        mode:              nil,
        spec:              nil,
        type:              nil,
        sub_type:          nil,
        specs_to_be_shown: SpecArray.new,
        owner:             nil,
        symbol:            false,
        creating_spec:     false
      }.update(options)
      options[:symbol] ? symbol = options.delete(:spec) : symbol = nil
      specs_to_be_shown = options[:specs_to_be_shown]
      filter_hash(_specs, options[:spec]).each do |_spec, hash|
        filter_hash(hash, options[:mode]).each do |_mode, hash_|
          filter_hash(hash_, options[:type]).each do |_type, hash__|
            filter_hash(hash__, options[:sub_type]).each do |_sub_type, spec|
              if symbol
                if spec.symbol && (spec.symbol.gsub(/<.*?>/, '').downcase.to_sym == symbol)
                  specs_to_be_shown << spec
                end
              else
                specs_to_be_shown << spec
              end
            end
          end
        end
      end
      # If no specs were found must check the possibility another search
      # should be started with mode set to :local or :global
      if specs_to_be_shown.empty?
        # Don't want to re-call this method if the callee is trying to create a spec and just wants to know
        # if there is a spec with the exact same options
        if options[:creating_spec] == false
          # Doesn't make sense to recall the method however if the mode is already set to :global or :local
          unless [:global, :local, nil].include?(options[:mode])
            # Need to check if there are :global or :local specs that match the filter(s) as well
            if self == Origen.top_level
              options[:mode] = :global
            else
              options[:mode] = :local
            end
            options[:specs_to_be_shown] = specs_to_be_shown
            Origen.log.debug "re-calling show_specs with options #{options}"
            return show_specs(options)
          end
        end
        Origen.log.debug "Returning no specs for options #{options}"
        return nil
      elsif specs_to_be_shown.size == 1
        print_to_console(specs_to_be_shown) if options[:verbose] == true
        Origen.log.debug "returning one spec #{specs_to_be_shown.first.name}"
        return specs_to_be_shown.first
      else
        Origen.log.debug "returning an array of specs during initial search: #{specs_to_be_shown}"
        return specs_to_be_shown
      end
    end
1214720
def hash(self):
        """"""
        return hash(
            self._shape + (
                self.tilewidth, self.tilelength, self.tiledepth,
                self.bitspersample, self.fillorder, self.predictor,
                self.extrasamples, self.photometric, self.compression,
                self.planarconfig))
1170935
private HashSet<Resource> getResources(GeneratorContext context, JClassType userType, FileFilter filter) {
    Map<String, Resource> map = context.getResourcesOracle().getResourceMap();
    final String pack = userType.getPackage().getName().replace('.', '/');
   
    HashSet<Resource> resourceList = new HashSet<Resource>();
    for (Entry<String, Resource> entry : map.entrySet()) {
      String path = entry.getKey();
      if (!path.startsWith(pack))
        continue;
      String ext = getExtension(path);
      if (EXTENSION_MAP.containsKey(ext))
        resourceList.add(entry.getValue());
    }

    return resourceList;
  }
1080912
def filter_results(hash)
      return [] if hash.blank?
      h = []
      hash.each do |k,v|
        h << k if k.post_type != 'autosave'
      end
      h
    end
1177544
function _abstract_solr_filter_template(filters){
	
	var allbuf = new Array();
	for( var filter_key in filters ){

	    var filter_val = filters[filter_key];

	    // If the value looks like an array, iterate over it and
	    // collect.
	    if( filter_val &&
		filter_val != null &&
		typeof filter_val == 'object' &&
		filter_val.length ){

		    for( var i = 0; i < filter_val.length; i++ ){
			var minibuffer = new Array();
			var try_val = filter_val[i];
			if( typeof(try_val) != 'undefined' &&
			try_val != '' ){
			    minibuffer.push('fq=');
			    minibuffer.push(filter_key);
			    minibuffer.push(':');
			    minibuffer.push('"');
			    minibuffer.push(filter_val[i]);
			    minibuffer.push('"');
			    allbuf.push(minibuffer.join(''));
			}
		    }		    
		}else{
		    var minibuf = new Array();
		    if( typeof(filter_val) != 'undefined' &&
			filter_val != '' ){
			    minibuf.push('fq=');
			    minibuf.push(filter_key);
			    minibuf.push(':');
			    minibuf.push('"');
			    minibuf.push(filter_val);
			    minibuf.push('"');
			    allbuf.push(minibuf.join(''));
			}
		}
	}
	return allbuf.join('&');
    }
671489
def spec
      if EasySwaggerUi.cache_enabled
        cache_key = "easy_swagger_ui:spec:#{params[:doc_path]}"
        options = {
          expires_in: EasySwaggerUi.cache_timeout,
          race_condition_ttl: 10,
        }
        spec = EasySwaggerUi.cache_store.fetch(cache_key, options) do
          parse_spec(params[:doc_path])
        end
      else
        spec = parse_spec(params[:doc_path])
      end
      render json: spec
    end
1371964
def to_h
      sanitized_params.each_with_object({}) do |(key, value), hash|
        hash[key] = transform(key, value)
      end
    end
190545
def inspect
      attrs = [
        [ :repository, repository.name ],
        [ :model,      model           ],
        [ :fields,     fields          ],
        [ :links,      links           ],
        [ :conditions, conditions      ],
        [ :order,      order           ],
        [ :limit,      limit           ],
        [ :offset,     offset          ],
        [ :reload,     reload?         ],
        [ :unique,     unique?         ],
      ]

      "#<#{self.class.name} #{attrs.map { |key, value| "@#{key}=#{value.inspect}" }.join(' ')}>"
    end
503981
def filter_params
      @_filter_params ||=
        case params[:filter]
        when Hash, ActionController::Parameters
          default_filters.each_with_object({}) do |field, hash|
            unformatted_field = @request.unformat_key(field)
            hash[unformatted_field] = params[:filter][field]
          end
        end
    end
1314587
def _get_user_hash(self):
        """"""
        if request:
            user_hash = '{ip}-{ua}'.format(ip=request.remote_addr,
                                           ua=self._get_user_agent())
            alg = hashlib.md5()
            alg.update(user_hash.encode('utf8'))
            return alg.hexdigest()
        return None
285498
def filter_to_hash(valid_filters, keys_case=:undescore)
			hashed_filter = {}
			filter.each do |key, value|
				hashed_filter[get_attribute_key(key, keys_case)] = solve_filter_value(key, value)
			end
			return hashed_filter
		end
1063867
def clean_security_hash(self):
        """"""
        security_hash_dict = {
            'content_type': self.data.get("content_type", ""),
            'object_pk': self.data.get("object_pk", ""),
            'timestamp': self.data.get("timestamp", ""),
        }
        expected_hash = self.generate_security_hash(**security_hash_dict)
        actual_hash = self.cleaned_data["security_hash"]
        if not constant_time_compare(expected_hash, actual_hash):
            raise forms.ValidationError("Security hash check failed.")
        return actual_hash
788523
def get(method, hmc, uri, uri_parms, logon_required):
        """"""
        query_str = uri_parms[0]
        try:
            console = hmc.consoles.lookup_by_oid(None)
        except KeyError:
            raise InvalidResourceError(method, uri)
        result_user_patterns = []
        filter_args = parse_query_parms(method, uri, query_str)
        for user_pattern in console.user_patterns.list(filter_args):
            result_user_pattern = {}
            for prop in user_pattern.properties:
                if prop in ('element-uri', 'name', 'type'):
                    result_user_pattern[prop] = user_pattern.properties[prop]
            result_user_patterns.append(result_user_pattern)
        return {'user-patterns': result_user_patterns}
305391
def can_view(self, user):
        """"""
        # Perform simplest checks first
        if user.is_admin or self in user.files:
            return True
        elif user.admin_for:  # Begin more expensive comparisions
            # Single-indirect lookup
            classes = set(x.class_ for x in self.makefile_for_projects)
            if classes.intersection(user.admin_for):
                return True
            # Double indirect lookups
            classes = set(x.project.class_ for x in self.build_files)
            if classes.intersection(user.admin_for):
                return True
            classes = set(x.project.class_ for x in self.execution_files)
            if classes.intersection(user.admin_for):
                return True
            # Triple-indirect lookups
            classes = set(x.testable.project.class_ for x in self.expected_for)
            if classes.intersection(user.admin_for):
                return True
            classes = set(x.testable.project.class_ for x in self.stdin_for)
            if classes.intersection(user.admin_for):
                return True
            classes = set(x.submission.project.class_ for x in
                          self.submission_assocs)
            if classes.intersection(user.admin_for):
                return True
            # 4x-indirect lookups
            classes = set(x.test_case.testable.project.class_ for x
                          in self.test_case_result_for)
            if classes.intersection(user.admin_for):
                return True
        return False
13829
def search_for( spec )
     found = []
      specs_list.each do |name, version, platform|
        up_spec = Stickler::SpecLite.new( name, version, platform )
        found << up_spec if spec =~ up_spec
      end
      return found
    end
1050913
def validate_params

      if params[:encrypted_password].nil? or params[:shared_user_ids].nil? or params[:board].nil?
        render json: {}, status: 422
        return
      end

      result = has_board_access(params[:board][:id])
      if result[:status] != :ok
        render json: {}, status: result[:status]
        return
      else
        if !result[:user_board].is_admin
          render json: {}, status: :forbidden
          return
        end
        @board = result[:board]
        @user_board = result[:user_board]
      end

      if params[:posts]

        params[:posts].each do |post|
          s = has_post_access(params[:board][:id], post[:id])[:status]
          if s != :ok
            render json: {}, status: s
            return
          end

          if post[:comments]
            post[:comments].each do |comment|
              s = has_comment_access(post[:id], comment[:id])[:status]
              if s != :ok
                render json: {}, status: s
                return
              end
            end
          end

        end

      end

    end
577441
def narrow_filter(fi, workitem)

      if fi.is_a?(Array) or fi.respond_to?(:consume) or fi.respond_to?(:filter)

        fi

      elsif fi.is_a?(Hash)

        workitem ? fi['out'] || fi['reply'] : fi['in'] || fi['apply']

      elsif fi.is_a?(String)

        filter =
          lookup_variable(fi) ||
          @context.plist.lookup(fi, workitem || h.applied_workitem)

        if filter.respond_to?(:consume) or filter.respond_to?(:filter)
          (workitem || h.applied_workitem)['participant_name'] = fi
        end

        filter

      else

        nil
      end
    end