Keep track of globals declarations.
335612
def GLOBAL(self, node):
        
        global_scope_index = 1 if self._in_doctest() else 0
        global_scope = self.scopeStack[global_scope_index]

        # Ignore 'global' statement in global scope.
        if self.scope is not global_scope:

            # One 'global' statement can bind multiple (comma-delimited) names.
            for node_name in node.names:
                node_value = Assignment(node_name, node)

                # Remove UndefinedName messages already reported for this name.
                # TODO: if the global is not used in this scope, it does not
                # become a globally defined name.  See test_unused_global.
                self.messages = [
                    m for m in self.messages if not
                    isinstance(m, messages.UndefinedName) or
                    m.message_args[0] != node_name]

                # Bind name to global scope if it doesn't exist already.
                global_scope.setdefault(node_name, node_value)

                # Bind name to non-global scopes, but as already "used".
                node_value.used = (global_scope, node)
                for scope in self.scopeStack[global_scope_index + 1:]:
                    scope[node_name] = node_value
1006563
public GlobalDescr globalStatement( PackageDescrBuilder pkg ) throws RecognitionException {
        GlobalDescrBuilder global = null;
        try {
            global = helper.start( pkg,
                                   GlobalDescrBuilder.class,
                                   null );

            // 'global'
            match( input,
                   DRL5Lexer.ID,
                   DroolsSoftKeywords.GLOBAL,
                   null,
                   DroolsEditorType.KEYWORD );
            if ( state.failed ) return null;

            // type
            String type = type();
            if ( state.backtracking == 0 ) global.type( type );
            if ( state.failed ) return null;

            // identifier
            Token id = match( input,
                              DRL5Lexer.ID,
                              null,
                              null,
                              DroolsEditorType.IDENTIFIER_TYPE );
            if ( state.failed ) return null;
            if ( state.backtracking == 0 ) {
                global.identifier( id.getText() );
                helper.setParaphrasesValue( DroolsParaphraseTypes.GLOBAL,
                                            id.getText() );
            }

        } catch ( RecognitionException re ) {
            reportError( re );
        } finally {
            helper.end( GlobalDescrBuilder.class,
                        global );
        }
        return (global != null) ? global.getDescr() : null;
    }
1118440
def global_symbols(self):
        

        declared_symbols = self.declared_symbols
        return set(
            s for s in self.referenced_symbols if s not in declared_symbols)
1098004
def cli(ctx):
    """"""
    utils.check_update(ctx, forced=True)
    click.secho("Keep is at its latest version v{}".format(about.__version__), fg='green')
641831
def init():
    
    global LABELS
    global LET_ASSIGNMENT
    global PRINT_IS_USED
    global SYMBOL_TABLE

    global ast
    global data_ast
    global optemps
    global OPTIONS
    global last_brk_linenum

    LABELS = {}
    LET_ASSIGNMENT = False
    PRINT_IS_USED = False
    last_brk_linenum = 0

    ast = None
    data_ast = None  # Global Variables AST
    optemps = OpcodesTemps()

    gl.INITS.clear()
    del gl.FUNCTION_CALLS[:]
    del gl.FUNCTION_LEVEL[:]
    del gl.FUNCTIONS[:]
    SYMBOL_TABLE = gl.SYMBOL_TABLE = api.symboltable.SymbolTable()
    OPTIONS = api.config.OPTIONS

    # DATAs info
    gl.DATA_LABELS.clear()
    gl.DATA_IS_USED = False
    del gl.DATAS[:]
    gl.DATA_PTR_CURRENT = api.utils.current_data_label()
    gl.DATA_FUNCTIONS = []
    gl.error_msg_cache.clear()
194197
def clean_global_runtime_state(reset_subsystem=False):
  
  if reset_subsystem:
    # Reset subsystem state.
    Subsystem.reset()

  # Reset Goals and Tasks.
  Goal.clear()

  # Reset global plugin state.
  BuildConfigInitializer.reset()
246064
def copy_globals(self, cfg):
        
        for name, setting in cfg.settings.items():
            csetting = self.settings.get(name)
            if (setting.is_global and csetting is not None and
                    not csetting.modified):
                csetting.set(setting.get())
333339
public static void closeGlobal()
  {
    ArrayList<EnvLoaderListener> listeners;
    listeners = new ArrayList<>();
    listeners.addAll(_globalLoaderListeners);
    _globalLoaderListeners.clear();

    for (int i = 0; i < listeners.size(); i++) {
      EnvLoaderListener listener = listeners.get(i);

      listener.classLoaderDestroy(null);
    }
  }
1141399
def get_compiler_flags(self):
        
        flags = 0

        for value in self.get_globals().values():
            if isinstance(value, __future__._Feature):
                flags |= value.compiler_flag

        return flags
1101511
def dump_declarations(declarations, file_path):
    

    with open(file_path, "w+") as f:
        print_declarations(declarations, writer=f.write)
985256
def find_all_globals(node, globs):
    """"""
    for n in node:
        if isinstance(n, SyntaxTree):
            globs = find_all_globals(n, globs)
        elif n.kind in read_write_global_ops:
            globs.add(n.pattr)
    return globs
1219991
def GLOBAL(self, node):
        """"""
        if isinstance(self.scope, FunctionScope):
            self.scope.globals.update(node.names)
885190
def find_globals_and_nonlocals(node, globs, nonlocals, code, version):
    """"""
    for n in node:
        if isinstance(n, SyntaxTree):
            globs, nonlocals = find_globals_and_nonlocals(n, globs, nonlocals,
                                                          code, version)
        elif n.kind in read_global_ops:
            globs.add(n.pattr)
        elif (version >= 3.0
              and n.kind in nonglobal_ops
              and n.pattr in code.co_freevars
              and n.pattr != code.co_name
              and code.co_name != '<lambda>'):
            nonlocals.add(n.pattr)
    return globs, nonlocals
938723
def init_debug():
    """"""
    global debug_stats
    global QueueLength
    if debug_stats is None:
        list_defaultdict = partial(defaultdict, list)
        debug_stats = defaultdict(list_defaultdict)
        QueueLength = []
533826
public function addGlobals(array $globals)
    {
        foreach ($globals as $name => $value) {
            $this->addGlobalContext($name, $value);
        }
    }
533435
def global_variable_action(self, text, loc, var):
        """"""
        exshared.setpos(loc, text)
        if DEBUG > 0:
            print("GLOBAL_VAR:",var)
            if DEBUG == 2: self.symtab.display()
            if DEBUG > 2: return
        index = self.symtab.insert_global_var(var.name, var.type)
        self.codegen.global_var(var.name)
        return index
1064475
def __set_locals(self):
        

        for globals in (Constants, RuntimeGlobals, UiConstants):
            self.__locals[globals.__name__] = globals

        self.__locals[Constants.application_name] = self
        self.__locals["application"] = self
        self.__locals["patches_manager"] = self.__patches_manager
        self.__locals["components_manager"] = self.__components_manager
        self.__locals["actions_manager"] = self.__actions_manager
        self.__locals["file_system_events_manager"] = self.__file_system_events_manager
        self.__locals["notifications_manager"] = self.__notifications_manager
        self.__locals["layouts_manager"] = self.__layouts_manager
        self.__locals["LOGGER"] = LOGGER

        LOGGER.debug("> Defined locals: '{0}'.".format(self.__locals))