For a given namespace and element name, get the list of scopes
for which a new scope should be created and the old one needs to
be pushed onto the scope stack.
547028
private function getScopeTypesToStack( $ns, $name ) {
		if ( $ns === HTMLData::NS_HTML ) {
			switch ( $name ) {
			case 'html':
			case 'table':
			case 'template':
				return self::$allScopes;

			case 'applet':
			case 'caption':
			case 'td':
			case 'th':
			case 'marquee':
			case 'object':
				return self::$nonTableScopes;

			case 'ol':
			case 'ul':
				return self::$listScopes;

			case 'button':
				return self::$buttonScopes;

			case 'option':
			case 'optgroup':
				return [];

			default:
				return self::$selectOnly;
			}
		} elseif ( $ns === HTMLData::NS_MATHML ) {
			if ( isset( self::$mathBreakers[$name] ) ) {
				return self::$nonTableScopes;
			} else {
				return self::$selectOnly;
			}
		} elseif ( $ns === HTMLData::NS_SVG ) {
			if ( isset( self::$svgBreakers[$name] ) ) {
				return self::$nonTableScopes;
			} else {
				return self::$selectOnly;
			}
		} else {
			return self::$selectOnly;
		}
	}
435411
def _lookup_in_all_namespaces(self, symbol):
        
        namespace = self.namespaces
        # Create a stack of namespaces.
        namespace_stack = []
        for current in symbol.namespace_stack:
            namespace = namespace.get(current)
            if namespace is None or not isinstance(namespace, dict):
                break
            namespace_stack.append(namespace)

        # Iterate through the stack in reverse order. Need to go from
        # innermost namespace to outermost.
        for namespace in reversed(namespace_stack):
            try:
                return self._lookup_namespace(symbol, namespace)
            except Error:
                pass
        return None
955884
def _scopes_registered(self):
        
        scopes = []

        for name in dir(self.__class__):
            if name.startswith('scope_'):
                scope = name.split('scope_')[1]
                scopes.append(scope)

        return scopes
629781
<S extends StaticScope> void addScopes(Collection<S> scopes) {
    for (S scope : scopes) {
      createScopeFrom(scope);
    }
  }
407826
def get_names_in_namespace( self, namespace_id, offset=None, count=None ):
        
        if offset is not None and offset < 0:
            offset = None 

        if count is not None and count < 0:
            count = None 

        cur = self.db.cursor()
        names = namedb_get_names_in_namespace( cur, namespace_id, self.lastblock, offset=offset, count=count )
        return names
1306891
def append_scope(self):
        """"""
        self.stack.current.append(Scope(self.stack.current.current))
450737
def new_scope(self, new_scope={}):
        
        old_scopes, self.scopes = self.scopes, self.scopes.new_child(new_scope)
        yield
        self.scopes = old_scopes
645398
def tasks_in_scope(scope)
      prefix = scope.path
      tasks.select { |t|
        /^#{prefix}:/ =~ t.name
      }
    end
118694
def to_names(scope):
    
    return [
        name
        for (name, value) in SCOPE_NAME_DICT.iteritems()
        if check(value, scope)
    ]
46870
def namespace(self, name=None, function=None, recursive=None):
        

        return (
            self._find_single(
                scopedef.scopedef_t._impl_matchers[namespace_t.namespace],
                name=name,
                function=function,
                recursive=recursive)
        )
1213294
def _expand_tasks(self, scopes):
    
    expanded_scopes = set(scopes)
    for scope, info in self._scope_to_info.items():
      if info.category == ScopeInfo.TASK:
        outer = enclosing_scope(scope)
        while outer != GLOBAL_SCOPE:
          if outer in expanded_scopes:
            expanded_scopes.add(scope)
            break
          outer = enclosing_scope(outer)
    return sorted(expanded_scopes)
1330924
public List<String> getScopes(final int scopeIndex) {
    this.checkInitialized();
    return this.scopes.getOrDefault(Integer.valueOf(scopeIndex), SemanticHighlightingRegistry.UNKNOWN_SCOPES);
  }
1118147
def new_scope(names)
      values = names.map { |n| self[n] }
      self.class.new(names, values + extras, self)
    end
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;
    }
1226928
def push(self, new_scope=None):
        
        if new_scope is None:
            new_scope = {
                "types": {},
                "vars": {}
            }
        self._curr_scope = new_scope
        self._dlog("pushing new scope, scope level = {}".format(self.level()))
        self._scope_stack.append(self._curr_scope)
868595
def scopes(self, scopes):
        
        validate_scopes(scopes)
        self._scopes = " ".join(set(scopes)) if scopes else ""
1307201
public static <T extends Model> ScopeBuilder<T> scope(String  scope) {
        return new ScopeBuilder<T>(modelClass(), new String[]{scope});
    }