Find the file handles used by our logger's handlers.
173951
def _get_logger_file_handles(self):
        
        handles = []
        for handler in self.logger.handlers:
            # The following code works for logging's SysLogHandler,
            # StreamHandler, SocketHandler, and their subclasses.
            for attr in ['sock', 'socket', 'stream']:
                try:
                    handle = getattr(handler, attr)
                    if handle:
                        handles.append(handle)
                    break
                except AttributeError:
                    continue
        return handles
331983
def file_handler(self, handler_type, path, prefixed_path, source_storage):
        
        if self.faster:
            if prefixed_path not in self.found_files:
                self.found_files[prefixed_path] = (source_storage, path)

            self.task_queue.put({
                'handler_type': handler_type,
                'path': path,
                'prefixed_path': prefixed_path,
                'source_storage': source_storage
            })
            self.counter += 1
        else:
            if handler_type == 'link':
                super(Command, self).link_file(path, prefixed_path, source_storage)
            else:
                super(Command, self).copy_file(path, prefixed_path, source_storage)
1109371
public function getActionHandlers()
    {
        $handlers = &gplcart_static('image.style.action.handlers');

        if (isset($handlers)) {
            return (array) $handlers;
        }

        $handlers = (array) gplcart_config_get(GC_FILE_CONFIG_IMAGE_ACTION);
        $this->hook->attach('image.style.action.handlers', $handlers, $this);
        return (array) $handlers;
    }
735646
def get_log_stream(logger):
    

    file_stream = None
    log_stream = None
    for handler in logger.handlers:
        if isinstance(handler, logging.FileHandler):
            file_stream = handler.stream
        else:
            log_stream = handler.stream

    if file_stream:
        return file_stream

    return log_stream
1036426
def get_handlers(self):
        
        handlers = []
        self.static_root = self.application.get_app_component(
        ).get_component_path()
        if self.conf:
            if 'maps' in self.conf:
                if self.conf['maps'] is None:
                    logger.warning("Maps configuration is empty. Finish the"
                                   "static maps configuration.")
                    return handlers
                for map_item in self.conf['maps']:
                    logger.debug("Mapping %s handlers." % map_item['name'])
                    self.static_maps[map_item['name']] = {}
                    self.static_maps[
                        map_item['name']]['root'] = self.static_root
                    if 'root' in map_item:
                        if os.path.isabs(map_item['root']):
                            self.static_maps[
                                map_item['name']]['root'] = map_item['root']
                        else:
                            self.static_maps[
                                map_item['name']]['root'] = os.path.abspath(
                                os.path.join(self.static_root,
                                             map_item['root']))
                    if 'handlers' in map_item:
                        if map_item['handlers'] is None:
                            logger.warning("There is no handles mapped in the"
                                           " static maps config file.")
                        else:
                            handlers = handlers + self.get_static_handlers(
                                map_item)
        else:
            logger.warning("No static maps configurations were provided.")
        return handlers
590368
def _get_loggers():
    """"""
    from .. import loader
    modules = loader.get_package_modules('logger')
    return list(loader.get_plugins(modules, [_Logger]))
1086574
def _find_logs(self, compile_workunit):
    """"""
    for idx, workunit in enumerate(compile_workunit.children):
      for output_name, outpath in workunit.output_paths().items():
        if output_name in ('stdout', 'stderr'):
          yield idx, workunit.name, output_name, outpath
784842
def log_handler(self, handler):
        
        if not self.opened():
            handler = handler or util.noop
            self._log_handler = enums.JLinkFunctions.LOG_PROTOTYPE(handler)
            self._dll.JLINKARM_EnableLog(self._log_handler)
245815
def scan_handler(parser, args):
    """"""
    opts = namespace_to_dict(args)
    opts.update({"ftp_debug": args.verbose >= 6})
    target = make_target(args.target, opts)
    target.readonly = True
    root_depth = target.root_dir.count("/")
    start = time.time()
    dir_count = 1
    file_count = 0
    processed_files = set()

    opts = namespace_to_dict(args)
    process_options(opts)

    def _pred(entry):
        """Walker predicate that check match/exclude options."""
        if not match_path(entry, opts):
            return False

    try:
        target.open()
        for e in target.walk(recursive=args.recursive, pred=_pred):
            is_dir = isinstance(e, DirectoryEntry)
            indent = "    " * (target.cur_dir.count("/") - root_depth)

            if is_dir:
                dir_count += 1
            else:
                file_count += 1

            if args.list:
                if is_dir:
                    print(indent, "[{e.name}]".format(e=e))
                else:
                    delta = e.mtime_org - e.mtime
                    dt_modified = pretty_stamp(e.mtime)
                    if delta:
                        prefix = "+" if delta > 0 else ""
                        print(
                            indent,
                            "{e.name:<40} {dt_modified} (system: {prefix}{delta})".format(
                                e=e,
                                prefix=prefix,
                                delta=timedelta(seconds=delta),
                                dt_modified=dt_modified,
                            ),
                        )
                    else:
                        print(
                            indent,
                            "{e.name:<40} {dt_modified}".format(
                                e=e, dt_modified=dt_modified
                            ),
                        )

            if (
                args.remove_meta
                and target.cur_dir_meta
                and target.cur_dir_meta.was_read
            ):
                fspec = target.cur_dir_meta.get_full_path()
                if fspec not in processed_files:
                    processed_files.add(fspec)
                    print("DELETE {}".format(fspec))

            if (
                args.remove_locks
                and not is_dir
                and e.name == DirMetadata.LOCK_FILE_NAME
            ):
                fspec = e.get_rel_path()
                print("DELETE {}".format(fspec))
    finally:
        target.close()

    print(
        "Scanning {:,} files in {:,} directories took {:02.2f} seconds.".format(
            file_count, dir_count, time.time() - start
        )
    )
957060
def remove_all_logger_handlers(logger: logging.Logger) -> None:
    
    while logger.handlers:
        h = logger.handlers[0]
        logger.removeHandler(h)
1132416
def get_handler(self, *args, **options):
        '''
        
        '''
        handler = super().get_handler(*args, **options)
        use_static_handler = options['use_static_handler']
        insecure_serving = options['insecure_serving']
        if use_static_handler and (settings.DEBUG or insecure_serving):
            return CRAStaticFilesHandler(handler)
        return handler
640117
def _get_log_file(self, handler):
        ''' 
        '''
        if 'file_name_pattern' not in handler:
            filename = '%Y-%m-%d-%H-%M-%S-{name}.pcap'
        else:
            filename = handler['file_name_pattern']

        log_file = handler['log_dir']
        if 'path' in handler:
            log_file = os.path.join(log_file, handler['path'], filename)
        else:
            log_file = os.path.join(log_file, filename)

        log_file = time.strftime(log_file, time.gmtime())
        log_file = log_file.format(**handler)

        return log_file
629580
def create_handlers_map(prefix='.*'):
  
  return [
      (prefix + '/output', _BarrierHandler),
      (prefix + '/run', _PipelineHandler),
      (prefix + '/finalized', _PipelineHandler),
      (prefix + '/cleanup', _CleanupHandler),
      (prefix + '/abort', _PipelineHandler),
      (prefix + '/fanout', _FanoutHandler),
      (prefix + '/fanout_abort', _FanoutAbortHandler),
      (prefix + '/callback', _CallbackHandler),
      (prefix + '/rpc/tree', status_ui._TreeStatusHandler),
      (prefix + '/rpc/class_paths', status_ui._ClassPathListHandler),
      (prefix + '/rpc/list', status_ui._RootListHandler),
      (prefix + '(/.+)', status_ui._StatusUiHandler),
      ]
147392
def get_stream_handler(stream=sys.stderr, level=logging.INFO,
                       log_format=log_formats.easy_read):
    
    sh = logging.StreamHandler(stream)
    sh.setLevel(level)
    sh.setFormatter(logging.Formatter(log_format))
    return sh
168772
public static void removeHandlersForRootLogger() {
        java.util.logging.Logger rootLogger = getRootLogger();
        java.util.logging.Handler[] handlers = rootLogger.getHandlers();
        for (int i = 0; i < handlers.length; i++) {
            rootLogger.removeHandler(handlers[i]);
        }
    }
1167037
def _handle_log_rotations(self):
        '''  '''
        for h in self.capture_handlers:
            if self._should_rotate_log(h):
                self._rotate_log(h)
269428
def _loadHandlers(self):
        
        return {handler.name: handler for handler in map(self.createHandler, self.config['handlers'])}