Get the names of the claims supported by the handlers for the requested scope.
509740
def _collect_names(handlers, scopes, user, client):
    

    results = set()

    data = {'user': user, 'client': client}

    def visitor(_scope_name, func):
        claim_names = func(data)
        # If the claim_names is None, it means that the scope is not authorized.
        if claim_names is not None:
            results.update(claim_names)

    _visit_handlers(handlers, visitor, 'scope', scopes)

    return results
1241584
def get_option_scope_help_info(self, option_registrations_iter):
    """"""
    basic_options = []
    recursive_options = []
    advanced_options = []
    # Sort the arguments, so we display the help in alphabetical order.
    for args, kwargs in sorted(option_registrations_iter):
      ohi = self.get_option_help_info(args, kwargs)
      if kwargs.get('advanced'):
        advanced_options.append(ohi)
      elif kwargs.get('recursive') and not kwargs.get('recursive_root'):
        recursive_options.append(ohi)
      else:
        basic_options.append(ohi)

    return OptionScopeHelpInfo(scope=self._scope,
                               basic=basic_options,
                               recursive=recursive_options,
                               advanced=advanced_options)
765851
def get_values(self):
		
		return [self._cache.get(i.name,None) for i in self._original_evals]
1272228
def get_scope_by_name(self, scope_name):
        
        query_parameters = {}
        if scope_name is not None:
            query_parameters['scopeName'] = self._serialize.query('scope_name', scope_name, 'str')
        response = self._send(http_method='GET',
                              location_id='4e11e2bf-1e79-4eb5-8f34-a6337bd0de38',
                              version='5.0-preview.2',
                              query_parameters=query_parameters)
        return self._deserialize('IdentityScope', response)
817616
def get_params(self):
    

    if hasattr(self, 'params'):
      return list(self.params)

    # Catch eager execution and assert function overload.
    try:
      if tf.executing_eagerly():
        raise NotImplementedError("For Eager execution - get_params "
                                  "must be overridden.")
    except AttributeError:
      pass

    # For graph-based execution
    scope_vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES,
                                   self.scope + "/")

    if len(scope_vars) == 0:
      self.make_params()
      scope_vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES,
                                     self.scope + "/")
      assert len(scope_vars) > 0

    # Make sure no parameters have been added or removed
    if hasattr(self, "num_params"):
      if self.num_params != len(scope_vars):
        print("Scope: ", self.scope)
        print("Expected " + str(self.num_params) + " variables")
        print("Got " + str(len(scope_vars)))
        for var in scope_vars:
          print("\t" + str(var))
        assert False
    else:
      self.num_params = len(scope_vars)

    return scope_vars
199910
def _get_stack_info_for_trace(
        self,
        frames,
        library_frame_context_lines=None,
        in_app_frame_context_lines=None,
        with_locals=True,
        locals_processor_func=None,
    ):
        """"""
        return list(
            iterate_with_template_sources(
                frames,
                with_locals=with_locals,
                library_frame_context_lines=library_frame_context_lines,
                in_app_frame_context_lines=in_app_frame_context_lines,
                include_paths_re=self.include_paths_re,
                exclude_paths_re=self.exclude_paths_re,
                locals_processor_func=locals_processor_func,
            )
        )
158213
def get_params_for_handler(self, class_scope, pyfunc):
        """"""
        try:
            cls, signal = self.handlers[class_scope][pyfunc.get_name()]
        except KeyError:
            return {}

        attrs = {}

        idx = 0
        names = pyfunc.get_param_names(False)
        if pyfunc.get_kind() in ('method', 'classmethod'):
            names = names[1:]
            idx += 1

        if names:
            attrs[idx] = self.get_type(self.get_pygtk_class_name(cls)).get_object()
            names = names[1:]
            idx += 1

        if names:
            for t in gobject.signal_query(signal, str(cls))[-1]:
                try:
                    tname = self.get_type(self.get_pygtk_class_name(t.name))
                    if tname:
                        attrs[idx] = tname.get_object()
                except ModuleNotFoundError:
                    pass

                idx += 1

        return attrs
697250
def userinfo_claims(self, access_token, scope_request, claims_request):
        
        id_token = oidc.userinfo(access_token, scope_request, claims_request)
        return id_token.claims
706218
public function resolveClaims()
    {
        $resolved = [];
        foreach ($this->claims as $name => $value) {
            $resolved[] = $this->claimFactory->get($name, $value);
        }

        return $resolved;
    }
877118
public Operations getOperationsForScope(OperationScope... scopes) {
        final Operations result = new Operations();
        final List<Operation> r = new ArrayList<Operation>();
        if (getOperations() != null) {
            for (Operation op : getOperations()) {
                if (op.getScope() != null) {
                    String s = op.getScope().trim();
                    for (int i = 0; i < scopes.length; i++) {
                        OperationScope scope = scopes[i];
                        if (scope.is(s)) {
                            r.add(op);
                            break;
                        }
                    }
                }
            }
            result.setOperations(r);
        }
        return result;
    }
331738
def _fill_scope_refs(name, scope):
        
        symbol = scope.resolve(name)
        if symbol is None:
            return

        orig_scope = symbol.scope
        scope.refs[name] = orig_scope
        while scope is not orig_scope:
            scope = scope.get_enclosing_scope()
            scope.refs[name] = orig_scope
296284
def _visit_handlers(handlers, visitor, prefix, suffixes):
    

    results = []
    for handler in handlers:
        for suffix in suffixes:
            func = getattr(handler, '{}_{}'.format(prefix, suffix).lower(), None)
            if func:
                results.append(visitor(suffix, func))

    return results
21912
def protected_resource_view(scopes=None):
    
    if scopes is None:
        scopes = []

    def wrapper(view):
        def view_wrapper(request,  *args, **kwargs):
            access_token = extract_access_token(request)

            try:
                try:
                    kwargs['token'] = Token.objects.get(access_token=access_token)
                except Token.DoesNotExist:
                    logger.debug('[UserInfo] Token does not exist: %s', access_token)
                    raise BearerTokenError('invalid_token')

                if kwargs['token'].has_expired():
                    logger.debug('[UserInfo] Token has expired: %s', access_token)
                    raise BearerTokenError('invalid_token')

                if not set(scopes).issubset(set(kwargs['token'].scope)):
                    logger.debug('[UserInfo] Missing openid scope.')
                    raise BearerTokenError('insufficient_scope')
            except BearerTokenError as error:
                response = HttpResponse(status=error.status)
                response['WWW-Authenticate'] = 'error="{0}", error_description="{1}"'.format(
                    error.code, error.description)
                return response

            return view(request,  *args, **kwargs)

        return view_wrapper

    return wrapper
282832
def validate_scopes(self, request):
        
        if not request.scopes:
            request.scopes = utils.scope_to_list(request.scope) or utils.scope_to_list(
                self.request_validator.get_default_scopes(request.client_id, request))
        log.debug('Validating access to scopes %r for client %r (%r).',
                  request.scopes, request.client_id, request.client)
        if not self.request_validator.validate_scopes(request.client_id,
                                                      request.scopes, request.client, request):
            raise errors.InvalidScopeError(request=request)
749074
def GetHandlers(self):
    
    handlers = []

    if self.ssl_context:
      handlers.append(urllib2.HTTPSHandler(context=self.ssl_context))

    if self.proxies:
      handlers.append(urllib2.ProxyHandler(self.proxies))

    return handlers
254589
def get_user_claims(self, access_token, claims=None, token_type='Bearer'):
        """"""
        data = self.get_json(
            self.USER_INFO_URL,
            headers={'Authorization': '{token_type} {token}'.format(token_type=token_type, token=access_token)}
        )

        if claims:
            claims_names = set(claims)
            data = {k: v for (k, v) in six.iteritems(data) if k in claims_names}

        return data
781040
def _prefix_scope(self, scope):
        
        if self.protocol_scope_prefix:
            if isinstance(scope, tuple):
                return scope[0]
            elif scope.startswith(self.protocol_scope_prefix):
                return scope
            else:
                return '{}{}'.format(self.protocol_scope_prefix, scope)
        else:
            if isinstance(scope, tuple):
                return scope[0]
            else:
                return scope