Returns a specific scope name details from CPNR server.
559490
def get_scope(self, scope_name):
        """"""
        request_url = self._build_url(['Scope', scope_name])
        return self._do_request('GET', request_url)
708843
public String getScopes() {
        final StringBuilder sb = new StringBuilder();
        for (final Scope scope : Scope.values()) {
            sb.append(scope);
            sb.append(", ");
        }
        final String scopes = sb.toString().trim();
        return scopes.substring(0, scopes.length() - 1);
    }
259667
def get_current_name_scope():
  """"""
  # pylint: disable=protected-access
  g = tf.get_default_graph()
  # TODO(eiderman): Remove this hack once TF update is released.
  if isinstance(g._name_stack, tuple):
    return g._name_stack[0] + '/'
  else:
    return g._name_stack + '/'
1330728
def _is_scope_prefix(scope_name, prefix_name):
  """"""

  if not prefix_name:
    return True

  if not scope_name.endswith("/"):
    scope_name += "/"

  if not prefix_name.endswith("/"):
    prefix_name += "/"

  return scope_name.startswith(prefix_name)
1101930
def get_scopes_information(self):
        
        scopes = StandardScopeClaims.get_scopes_info(self.params['scope'])
        if settings.get('OIDC_EXTRA_SCOPE_CLAIMS'):
            scopes_extra = settings.get(
                'OIDC_EXTRA_SCOPE_CLAIMS', import_str=True).get_scopes_info(self.params['scope'])
            for index_extra, scope_extra in enumerate(scopes_extra):
                for index, scope in enumerate(scopes[:]):
                    if scope_extra['scope'] == scope['scope']:
                        del scopes[index]
        else:
            scopes_extra = []

        return scopes + scopes_extra
275160
def get_parent_var(name, global_ok=False, default=None, skip_frames=0):
    

    scope = get_parent_scope_from_var(name, global_ok=global_ok, skip_frames=skip_frames + 1)

    if not scope:
        return default

    if name in scope.locals:
        return scope.locals.get(name, default)

    return scope.globals.get(name, default)
692564
public static short getMembershipScope(String scope) {
        if (scope != null) {
            scope = scope.trim();
            if (LdapConstants.LDAP_DIRECT_GROUP_MEMBERSHIP_STRING.equalsIgnoreCase(scope)) {
                return LdapConstants.LDAP_DIRECT_GROUP_MEMBERSHIP;
            } else if (LdapConstants.LDAP_NESTED_GROUP_MEMBERSHIP_STRING.equalsIgnoreCase(scope)) {
                return LdapConstants.LDAP_NESTED_GROUP_MEMBERSHIP;
            } else if (LdapConstants.LDAP_ALL_GROUP_MEMBERSHIP_STRING.equalsIgnoreCase(scope)) {
                return LdapConstants.LDAP_ALL_GROUP_MEMBERSHIP;
            } else {
                return LdapConstants.LDAP_DIRECT_GROUP_MEMBERSHIP;
            }
        } else {
            return LdapConstants.LDAP_DIRECT_GROUP_MEMBERSHIP;
        }
    }
980944
def scopes(self, **kwargs):
        """"""
        return self._client.scopes(team=self.id, **kwargs)
851948
def get_by_name(self, name):
        
        scopes = self._client.get_all()
        result = [x for x in scopes if x['name'] == name]
        return result[0] if result else None
1287652
def get_scope_by_id(self, scope_id):
        
        route_values = {}
        if scope_id is not None:
            route_values['scopeId'] = self._serialize.url('scope_id', scope_id, 'str')
        response = self._send(http_method='GET',
                              location_id='4e11e2bf-1e79-4eb5-8f34-a6337bd0de38',
                              version='5.0-preview.2',
                              route_values=route_values)
        return self._deserialize('IdentityScope', response)
172229
public static int getScopeId(String scope) throws JspTagException {
		if(scope==null || PAGE.equals(scope)) return PageContext.PAGE_SCOPE;
		else if(REQUEST.equals(scope)) return PageContext.REQUEST_SCOPE;
		else if(SESSION.equals(scope)) return PageContext.SESSION_SCOPE;
		else if(APPLICATION.equals(scope)) return PageContext.APPLICATION_SCOPE;
		else throw new LocalizedJspTagException(ApplicationResources.accessor, "Scope.scope.invalid", scope);
	}
872490
function getAuthorizedScopes (req, res, next) {
  // Get the scopes authorized for the verified and decoded token
  var scopeNames = req.claims.scope && req.claims.scope.split(' ')

  Scope.get(scopeNames, function (err, scopes) {
    if (err) { return next(err) }
    req.scopes = scopes
    next()
  })
}
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
368697
def scope_name_for_picker(scope, global_name)
      return global_name unless scope

      name = translated_attribute(scope.name)
      name << " (#{translated_attribute(scope.scope_type.name)})" if scope.scope_type
      name
    end
1090102
public function getClassNamesByScope($scope)
    {
        if (!isset($this->cachedClassNamesByScope[$scope])) {
            foreach ($this->objects as $objectName => $information) {
                if ($information['s'] === $scope) {
                    if (isset($information['c'])) {
                        $this->cachedClassNamesByScope[$scope][] = $information['c'];
                    } else {
                        $this->cachedClassNamesByScope[$scope][] = $objectName;
                    }
                }
            }
        }
        return $this->cachedClassNamesByScope[$scope];
    }
299660
@Override
    public List<String> getScopeNames() {
	List<String> scopeNames = new ArrayList<String>();

	if (checkArguments) {
	    scopeNames.add("local");
	    scopeNames.add("arguments");
	}
	scopeNames.add("variables");

	// thread scopes
	if (pc.hasFamily()) {
	    String[] names = pc.getThreadScopeNames();
	    for (int i = 0; i < names.length; i++)
		scopeNames.add(i, names[i]);
	}

	for (int i = 0; i < scopes.length; i++) {
	    scopeNames.add((scopes[i]).getTypeAsString());
	}
	return scopeNames;
    }

    @Override
    public Object getCollection(Key key) throws PageException {
	Object rtn = null;

	if (checkArguments) {
	    rtn = local.get(key, NullSupportHelper.NULL());
	    if (rtn != NullSupportHelper.NULL()) return rtn;
	    rtn = argument.getFunctionArgument(key, NullSupportHelper.NULL());
	    if (rtn != NullSupportHelper.NULL()) {
		if (debug) debugCascadedAccess(pc, argument.getTypeAsString(), key);
		return rtn;
	    }
	}

	// get data from queries
	if (allowImplicidQueryCall && pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML && !qryStack.isEmpty()) {
	    rtn = qryStack.getColumnFromACollection(key);
	    if (rtn != null) {
		if (debug) debugCascadedAccess(pc, "query", key);
		return rtn;
	    }
	}

	// variable
	rtn = variable.get(key, NullSupportHelper.NULL());
	if (rtn != NullSupportHelper.NULL()) {
	    if (debug && checkArguments) debugCascadedAccess(pc, variable, rtn, key);
	    return rtn;
	}

	// thread scopes
	if (pc.hasFamily()) {
	    rtn = pc.getThreadScope(key, NullSupportHelper.NULL());
	    if (rtn != NullSupportHelper.NULL()) {
		if (debug) debugCascadedAccess(pc, "thread", key);
		return rtn;
	    }
	}

	// get a scope value (only CFML is searching addioanl scopes)
	if (pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML) {
	    for (int i = 0; i < scopes.length; i++) {
		rtn = scopes[i].get(key, NullSupportHelper.NULL());
		if (rtn != NullSupportHelper.NULL()) {
		    if (debug) debugCascadedAccess(pc, scopes[i].getTypeAsString(), key);
		    return rtn;
		}
	    }
	}
	throw new ExpressionException("variable [" + key.getString() + "] doesn't exist");
    }

    @Override
    public Object get(Collection.Key key, Object defaultValue) {
	Object rtn = null;
	if (checkArguments) {
	    rtn = local.get(key, NullSupportHelper.NULL());
	    if (rtn != NullSupportHelper.NULL()) return rtn;

	    rtn = argument.getFunctionArgument(key, NullSupportHelper.NULL());
	    if (rtn != NullSupportHelper.NULL()) {
		if (debug) debugCascadedAccess(pc, argument.getTypeAsString(), key);
		return rtn;
	    }
	}

	// get data from queries
	if (allowImplicidQueryCall && pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML && !qryStack.isEmpty()) {
	    rtn = qryStack.getDataFromACollection(pc, key, NullSupportHelper.NULL());
	    if (rtn != NullSupportHelper.NULL()) {
		if (debug) debugCascadedAccess(pc, "query", key);
		return rtn;
	    }
	}

	// variable
	rtn = variable.get(key, NullSupportHelper.NULL());
	if (rtn != NullSupportHelper.NULL()) {
	    if (debug && checkArguments) debugCascadedAccess(pc, variable, rtn, key);
	    return rtn;
	}

	// thread scopes
	if (pc.hasFamily()) {
	    rtn = pc.getThreadScope(key, NullSupportHelper.NULL());
	    if (rtn != NullSupportHelper.NULL()) {
		if (debug && checkArguments) debugCascadedAccess(pc, "thread", key);
		return rtn;
	    }
	}

	// get a scope value (only CFML is searching additional scopes)
	if (pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML) {
	    for (int i = 0; i < scopes.length; i++) {
		rtn = scopes[i].get(key, NullSupportHelper.NULL());
		if (rtn != NullSupportHelper.NULL()) {
		    if (debug) debugCascadedAccess(pc, scopes[i].getTypeAsString(), key);
		    return rtn;
		}
	    }
	}

	return defaultValue;
    }

    @Override
    public Object getCascading(Collection.Key key) {
	throw new RuntimeException("this method is no longer supported, use getCascading(Collection.Key key, Object defaultValue) instead");
    }

    @Override
    public Object getCascading(Collection.Key key, Object defaultValue) {
	Object rtn;

	// get a scope value (only CFML is searching additional scopes)
	if (pc.getCurrentTemplateDialect() == CFMLEngine.DIALECT_CFML) {
	    for (int i = 0; i < scopes.length; i++) {
		rtn = scopes[i].get(key, NullSupportHelper.NULL());
		if (rtn != NullSupportHelper.NULL()) {
		    return rtn;
		}
	    }
	}
	return defaultValue;
    }

    @Override
    public Object setEL(Collection.Key key, Object value) {
	if (checkArguments) {
	    if (localAlways || local.containsKey(key)) return local.setEL(key, value);
	    if (argument.containsFunctionArgumentKey(key)) {
		if (debug) debugCascadedAccess(pc, argument.getTypeAsString(), key);
		return argument.setEL(key, value);
	    }
	}

	if (debug && checkArguments) debugCascadedAccess(pc, variable.getTypeAsString(), key);
	return variable.setEL(key, value);
    }

    @Override
    public Object set(Collection.Key key, Object value) throws PageException {
	if (checkArguments) {
	    if (localAlways || local.containsKey(key)) return local.set(key, value);
	    if (argument.containsFunctionArgumentKey(key)) {
		if (debug) debugCascadedAccess(pc, argument.getTypeAsString(), key);
		return argument.set(key, value);
	    }

	}
	if (debug && checkArguments) debugCascadedAccess(pc, variable.getTypeAsString(), key);
	return variable.set(key, value);
    }

    @Override
    public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
	return variable.toDumpData(pageContext, maxlevel, dp);
    }

    @Override
    public Iterator<Collection.Key> keyIterator() {
	return variable.keyIterator();
    }

    @Override
    public Iterator<String> keysAsStringIterator() {
	return variable.keysAsStringIterator();
    }

    @Override
    public Iterator<Entry<Key, Object>> entryIterator() {
	return variable.entryIterator();
    }

    @Override
    public Iterator<Object> valueIterator() {
	return variable.valueIterator();
    }

    @Override
    public boolean isInitalized() {
	return isInit;
    }

    @Override
    public void initialize(PageContext pc) {
	// if(isInitalized()) return;
	isInit = true;
	variable = pc.variablesScope();
	argument = pc.argumentsScope();
	local = pc.localScope();
	allowImplicidQueryCall = pc.getConfig().allowImplicidQueryCall();
	type = ((PageContextImpl) pc).getScopeCascadingType();
	debug = pc.getConfig().debug() && ((ConfigImpl) pc.getConfig()).hasDebugOptions(ConfigImpl.DEBUG_IMPLICIT_ACCESS);

	// Strict
	if (type == Config.SCOPE_STRICT) {
	    // print.ln("strict");
	    scopes = new Scope[] {};
	}
	// small
	else if (type == Config.SCOPE_SMALL) {
	    // print.ln("small");
	    if (pc.getConfig().mergeFormAndURL()) {
		scopes = new Scope[] { pc.formScope() };
	    }
	    else {
		scopes = new Scope[] { pc.urlScope(), pc.formScope() };
	    }
	}
	// standard
	else {
	    reinitialize(pc);
	}

    }

    @Override
    public void reinitialize(PageContext pc) {
	if (type != Config.SCOPE_STANDARD) return;
	Client cs = pc.clientScopeEL();
	// print.ln("standard");
	if (pc.getConfig().mergeFormAndURL()) {
	    scopes = new Scope[cs == null ? 3 : 4];
	    scopes[0] = pc.cgiScope();
	    scopes[1] = pc.formScope();
	    scopes[2] = pc.cookieScope();
	    if (cs != null) scopes[3] = cs;
	}
	else {
	    scopes = new Scope[cs == null ? 4 : 5];
	    scopes[0] = pc.cgiScope();
	    scopes[1] = pc.urlScope();
	    scopes[2] = pc.formScope();
	    scopes[3] = pc.cookieScope();
	    if (cs != null) scopes[4] = cs;
	}
    }

    @Override
    public final void release(PageContext pc) {
	isInit = false;
	argument = null;
	local = null;
	variable = null;
	scopes = null;
	checkArguments = false;
	localAlways = false;
	if (allowImplicidQueryCall) qryStack.clear();
    }

    @Override
    public Collection duplicate(boolean deepCopy) {
	UndefinedImpl dupl = new UndefinedImpl(pc, type);
	dupl.allowImplicidQueryCall = allowImplicidQueryCall;
	dupl.checkArguments = checkArguments;
	dupl.argument = deepCopy ? (Argument) Duplicator.duplicate(argument, deepCopy) : argument;
	dupl.isInit = isInit;
	dupl.local = deepCopy ? (Local) Duplicator.duplicate(local, deepCopy) : local;
	dupl.localAlways = localAlways;
	dupl.qryStack = (deepCopy ? (QueryStackImpl) Duplicator.duplicate(qryStack, deepCopy) : qryStack);

	dupl.variable = deepCopy ? (Variables) Duplicator.duplicate(variable, deepCopy) : variable;
	dupl.pc = pc;
	dupl.debug = debug;

	// scopes
	if (deepCopy) {
	    dupl.scopes = new Scope[scopes.length];
	    for (int i = 0; i < scopes.length; i++) {
		dupl.scopes[i] = (Scope) Duplicator.duplicate(scopes[i], deepCopy);
	    }
	}
	else dupl.scopes = scopes;

	return dupl;
    }

    @Override
    public boolean containsKey(Key key) {
	return get(key, null) != null;
    }

    @Override
    public String castToString() throws ExpressionException {
	throw new ExpressionException("Can't cast Complex Object Type Struct to String", "Use Built-In-Function \"serialize(Struct):String\" to create a String from Struct");
    }

    @Override
    public String castToString(String defaultValue) {
	return defaultValue;
    }

    @Override
    public boolean castToBooleanValue() throws ExpressionException {
	throw new ExpressionException("Can't cast Complex Object Type Struct to a boolean value");
    }

    @Override
    public Boolean castToBoolean(Boolean defaultValue) {
	return defaultValue;
    }

    @Override
    public double castToDoubleValue() throws ExpressionException {
	throw new ExpressionException("Can't cast Complex Object Type Struct to a number value");
    }

    @Override
    public double castToDoubleValue(double defaultValue) {
	return defaultValue;
    }

    @Override
    public DateTime castToDateTime() throws ExpressionException {
	throw new ExpressionException("Can't cast Complex Object Type Struct to a Date");
    }

    @Override
    public DateTime castToDateTime(DateTime defaultValue) {
	return defaultValue;
    }

    @Override
    public int compareTo(boolean b) throws ExpressionException {
	throw new ExpressionException("can't compare Complex Object Type Struct with a boolean value");
    }

    @Override
    public int compareTo(DateTime dt) throws PageException {
	throw new ExpressionException("can't compare Complex Object Type Struct with a DateTime Object");
    }

    @Override
    public int compareTo(double d) throws PageException {
	throw new ExpressionException("can't compare Complex Object Type Struct with a numeric value");
    }

    @Override
    public int compareTo(String str) throws PageException {
	throw new ExpressionException("can't compare Complex Object Type Struct with a String");
    }

    @Override
    public void setVariableScope(Variables scope) {
	variable = scope;
    }

    @Override
    public int getType() {
	return SCOPE_UNDEFINED;
    }

    @Override
    public String getTypeAsString() {
	return "undefined";
    }

    /**
     * @return the allowImplicidQueryCall
     */
    public boolean isAllowImplicidQueryCall() {
	return allowImplicidQueryCall;
    }

    /**
     * @param allowImplicidQueryCall the allowImplicidQueryCall to set
     */
    @Override
    public boolean setAllowImplicidQueryCall(boolean allowImplicidQueryCall) {
	boolean old = this.allowImplicidQueryCall;
	this.allowImplicidQueryCall = allowImplicidQueryCall;
	return old;
    }

    /**
     * @return the checkArguments
     */
    @Override
    public boolean getCheckArguments() {
	return checkArguments;
    }

    @Override
    public Object call(PageContext pc, final Key methodName, Object[] args) throws PageException {
	Object obj = get(methodName, null); // every none UDF value is fine as default argument
	if (obj instanceof UDFPlus) {
	    return ((UDFPlus) obj).call(pc, methodName, args, false);
	}
	UDF udf = getUDF(pc, methodName);
	if (udf instanceof UDFPlus) {
	    return ((UDFPlus) udf).call(pc, methodName, args, false);
	}
	throw new ExpressionException("No matching function [" + methodName + "] found");
    }

    @Override
    public Object callWithNamedValues(PageContext pc, Key methodName, Struct args) throws PageException {
	Object obj = get(methodName, null);
	if (obj instanceof UDFPlus) {
	    return ((UDFPlus) obj).callWithNamedValues(pc, methodName, args, false);
	}
	UDF udf = getUDF(pc, methodName);
	if (udf instanceof UDFPlus) {
	    return ((UDFPlus) udf).callWithNamedValues(pc, methodName, args, false);
	}
	throw new ExpressionException("No matching function [" + methodName + "] found");
    }

    private UDF getUDF(PageContext pc, Key methodName) throws PageException {
	ApplicationContextSupport ac = (ApplicationContextSupport) pc.getApplicationContext();
	if (ac != null) {
	    List<Resource> dirs = ac.getFunctionDirectories();
	    Resource[] files;
	    if (dirs != null && dirs.size() > 0) {
		Resource file = null;
		Iterator<Resource> it = dirs.iterator();
		Resource dir;
		while (it.hasNext()) {
		    dir = it.next();
		    files = dir.listResources(new ResourceNameFilter() {
			@Override
			public boolean accept(Resource dir, String name) {
			    String[] exts = Constants.getTemplateExtensions();
			    for (String ex: exts) {
				if (name.equalsIgnoreCase(methodName + "." + ex)) return true;
			    }
			    return false;
			}
		    });
		    if (files != null && files.length > 0) {
			file = files[0];
			break;
		    }
		}
		if (file != null) {
		    return CFFunction.loadUDF(pc, file, methodName, pc.getConfig() instanceof ConfigWeb, false);
		}
	    }
	}
	return null;
    }

    public short getScopeCascadingType() {
	return type;
    }
562489
def _get_scopes(self):
        
        if self._read_only:
            scopes = (READ_ONLY_SCOPE,)
        else:
            scopes = (DATA_SCOPE,)

        if self._admin:
            scopes += (ADMIN_SCOPE,)

        return scopes