A function that returns decorator that set scopes to some class/function

    .. code-block:: python

        @egg()
        @scopes(SINGLETON_SCOPE)
        class DepImpl:
            pass

    :param scope_type: Which scope should be used
    :return:
12123
def scope(scope_type: str) -> Callable:
    

    def dec(egg_: T) -> T:
        egg_.__haps_custom_scope = scope_type
        return egg_

    return dec
1292313
public static Scriptable getFunctionPrototype(Scriptable scope) {
        return TopLevel.getBuiltinPrototype(getTopLevelScope(scope),
                TopLevel.Builtins.Function);
    }
1111281
def in_scope(self, scope: str):
        
        old_scope = self.resolution_scope
        self.resolution_scope = urlparse.urljoin(old_scope, scope)
        try:
            yield
        finally:
            self.resolution_scope = old_scope
1000297
private Scope findScopeForType(TypeElement type) {
    Scope scope = peekScope();
    while (scope != null) {
      if (scope.kind != ScopeKind.METHOD && type.equals(scope.type)) {
        return scope;
      }
      scope = scope.outer;
    }
    return null;
  }
636131
def type(self):
        
        # pylint: disable=no-member
        if self.args.args and self.args.args[0].name == "self":
            if isinstance(self.parent.scope(), ClassDef):
                return "method"
        return "function"
383872
def shutit_method_scope(func):
	
	def wrapper(self, shutit):
		"""Wrapper to call a shutit module method, notifying the ShutIt object.
		"""
		ret = func(self, shutit)
		return ret
	return wrapper
759677
def scoped(self, func):
        
        @wraps(func)
        def wrapper(*args, **kwargs):
            scope = kwargs.get("scope", self.__factory__.default_scope)
            with self.scoped_to(scope):
                return func(*args, **kwargs)
        return wrapper
1324310
def scoped_session_decorator(func):
    """"""

    @wraps(func)
    def wrapper(*args, **kwargs):
        with sessions_scope(session):
            # The session used in func comes from the funcs globals, but
            # it will be a proxied thread local var from the session
            # registry, and will therefore be identical to the one returned
            # by the context manager above.
            logger.debug("Running worker %s in scoped DB session", func.__name__)
            return func(*args, **kwargs)

    return wrapper
1156075
def push_scope(self, callback=None):  # noqa
        

        if callback is not None:
            with self.push_scope() as scope:
                callback(scope)
            return None

        client, scope = self._stack[-1]
        new_layer = (client, copy.copy(scope))
        self._stack.append(new_layer)

        return _ScopeManager(self)
1193916
def scope(cls, f):
        """"""
        if not hasattr(cls, "scopes"):
            cls.scopes = copy(STANDARD_SCOPES)

        cls.scopes.append(f)

        def create_builder(self, *args, **kwargs):
            bldr = ScopeBuilder(cls, cls.scopes)
            return getattr(bldr, f.__name__)(*args, **kwargs)

        setattr(cls, f.__name__, classmethod(create_builder))
        return f
652574
def p_scope_pointer(self, p):
        ''
        scope = () if p[1].var.scope is None else p[1].var.scope.labellist
        p[0] = IdentifierScope(scope + (IdentifierScopeLabel(p[1].var.name,
                                                             p[1].ptr, lineno=p.lineno(1)),), lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
307608
function getCurrentScope(statementType) {
            let currentScope;

            if (statementType === "var") {
                currentScope = functionStack[functionStack.length - 1];
            } else if (statementType === "let") {
                currentScope = blockStack[blockStack.length - 1].let;
            } else if (statementType === "const") {
                currentScope = blockStack[blockStack.length - 1].const;
            }
            return currentScope;
        }
1368607
@SuppressWarnings("unchecked")
    public <S extends Scope> Set<S> getScopesByType(Class<S> scopeType) {
        Set<S> typedScopes = new HashSet<>();
        for (Scope scope : getScopes()) {
            if (scopeType.isInstance(scope)) {
                typedScopes.add((S) scope);
            }
        }
        return typedScopes;
    }
967003
def set_function(self, f):
        

        def samples(self):
            return (('', {}, float(f())),)

        self._child_samples = types.MethodType(samples, self)
900000
def init(scope):
    
    # update globals
    scope['py2q'] = py2q
    scope['q2py'] = q2py
    
    # define wrapper compatibility symbols
    QtCore.THREADSAFE_NONE = None
    
    # define the importable symbols
    scope['QtCore'] = QtCore
    scope['QtGui'] = lazy_import('PyQt4.QtGui')
    scope['QtWebKit'] = lazy_import('PyQt4.QtWebKit')
    scope['QtNetwork'] = lazy_import('PyQt4.QtNetwork')
    scope['QtXml'] = lazy_import('PyQt4.QtXml')
    
    # PyQt4 specific modules
    scope['QtDesigner'] = lazy_import('PyQt4.QtDesigner')
    scope['Qsci'] = lazy_import('PyQt4.Qsci')
    
    scope['uic'] = lazy_import('PyQt4.uic')
    scope['rcc_exe'] = 'pyrcc4'
    
    # map shared core properties
    QtCore.QDate.toPython = lambda x: x.toPyDate()
    QtCore.QDateTime.toPython = lambda x: x.toPyDateTime()
    QtCore.QTime.toPython = lambda x: x.toPyTime()
    
    QtCore.Signal = Signal
    QtCore.Slot = Slot
    QtCore.Property = QtCore.pyqtProperty
    QtCore.SIGNAL = SIGNAL
    QtCore.__version__ = QtCore.QT_VERSION_STR

    if SIP_VERSION == '2':
        QtCore.QStringList = list
        QtCore.QString = unicode
1133954
def for_scope(self, scope, inherit_from_enclosing_scope=True):
    

    # First get enclosing scope's option values, if any.
    if scope == GLOBAL_SCOPE or not inherit_from_enclosing_scope:
      values = OptionValueContainer()
    else:
      values = copy.copy(self.for_scope(enclosing_scope(scope)))

    # Now add our values.
    flags_in_scope = self._scope_to_flags.get(scope, [])
    self._parser_hierarchy.get_parser_by_scope(scope).parse_args(flags_in_scope, values)

    # Check for any deprecation conditions, which are evaluated using `self._flag_matchers`.
    if inherit_from_enclosing_scope:
      self._check_and_apply_deprecations(scope, values)

    return values
857863
def scopes(self):
        
        if not self.__scopes:
            self.__scopes = Scopes(self.__connection)
        return self.__scopes