Load the stats limits (except the one in the exclude list).
540725
def load_limits(self, config=None):
        """"""
        # For each plugins, call the load_limits method
        for p in self._plugins:
            self._plugins[p].load_limits(config)
139920
def _setup_stats(self):
        '''
        
        '''
        # stats setup
        self.stats_dict = {}

        if self.settings['STATS_TOTAL']:
            self._setup_stats_total()

        if self.settings['STATS_PLUGINS']:
            self._setup_stats_plugins()
121214
def max_entries(self):
        
        self._debug_log.info('Removing maximum entries restriction')
        self._log_entries(deque(self._log_entries))
876165
def _clear_stats(self):
        
        for stat in (STAT_BYTES_RECEIVED,
                     STAT_BYTES_SENT,
                     STAT_MSG_RECEIVED,
                     STAT_MSG_SENT,
                     STAT_CLIENTS_MAXIMUM,
                     STAT_CLIENTS_CONNECTED,
                     STAT_CLIENTS_DISCONNECTED,
                     STAT_PUBLISH_RECEIVED,
                     STAT_PUBLISH_SENT):
            self._stats[stat] = 0
427983
def _prevent_core_dump(cls):
        """"""
        try:
            # Try to get the current limit
            resource.getrlimit(resource.RLIMIT_CORE)
        except ValueError:
            # System doesn't support the RLIMIT_CORE resource limit
            return
        else:
            # Set the soft and hard limits for core dump size to zero
            resource.setrlimit(resource.RLIMIT_CORE, (0, 0))
736200
def reset_stats(self):
        """"""
        # Note: not using self.Profile, since pstats.Stats() fails then
        self.stats = pstats.Stats(Profile())
        self.ncalls = 0
        self.skipped = 0
1227145
def _setup_stats(self):
        '''
        
        '''
        self.stats_dict = {}

        redis_conn = redis.Redis(host=self.settings['REDIS_HOST'],
                                 port=self.settings['REDIS_PORT'],
                                 db=self.settings.get('REDIS_DB'))

        try:
            redis_conn.info()
            self.logger.debug("Connected to Redis in StatsCollector Setup")
            self.redis_conn = redis_conn
        except ConnectionError:
            self.logger.warn("Failed to connect to Redis in StatsCollector"
                             " Setup, no stats will be collected")
            return

        if self.settings['STATS_TOTAL']:
            self._setup_stats_total(redis_conn)

        if self.settings['STATS_PLUGINS']:
            self._setup_stats_plugins(redis_conn)
1316670
def load_data(limit=0, split=0.8):
    """"""
    # Partition off part of the train data for evaluation
    train_data, _ = thinc.extra.datasets.imdb()
    random.shuffle(train_data)
    train_data = train_data[-limit:]
    texts, labels = zip(*train_data)
    cats = [{"POSITIVE": bool(y), "NEGATIVE": not bool(y)} for y in labels]
    split = int(len(train_data) * split)
    return (texts[:split], cats[:split]), (texts[split:], cats[split:])
687711
def unpickle_stats(stats):
    """"""
    stats = cPickle.loads(stats)
    stats.stream = True
    return stats
1184622
def load_more_data(self, value, rows=False, columns=False):
        """"""
        try:
            if rows and value == self.verticalScrollBar().maximum():
                self.model().fetch_more(rows=rows)
                self.sig_fetch_more_rows.emit()
            if columns and value == self.horizontalScrollBar().maximum():
                self.model().fetch_more(columns=columns)
                self.sig_fetch_more_columns.emit()

        except NameError:
            # Needed to handle a NameError while fetching data when closing
            # See issue 7880
            pass
110752
def only(names)
      filtered_stats = @stats.select do |stat|
        names.include? stat[:name]
      end
      StatsRegistry.new(filtered_stats)
    end
260814
def update(self, stats):
        
        if not self.export_enable:
            return False

        # Get all the stats & limits
        all_stats = stats.getAllExportsAsDict(plugin_list=self.plugins_to_export())
        all_limits = stats.getAllLimitsAsDict(plugin_list=self.plugins_to_export())

        # Loop over plugins to export
        for plugin in self.plugins_to_export():
            if isinstance(all_stats[plugin], dict):
                all_stats[plugin].update(all_limits[plugin])
            elif isinstance(all_stats[plugin], list):
                # TypeError: string indices must be integers (Network plugin) #1054
                for i in all_stats[plugin]:
                    i.update(all_limits[plugin])
            else:
                continue
            export_names, export_values = self.__build_export(all_stats[plugin])
            self.export(plugin, export_names, export_values)

        return True
641449
def _load_stats(self):
        
        for attempt in range(0, 3):
            try:
                with self.stats_file.open() as f:
                    return json.load(f)
            except ValueError:
                # If we failed to parse the JSON, it's possible that the
                # webpack process is writing to it concurrently and it's in a
                # bad state. Sleep and retry.
                if attempt < 2:
                    time.sleep(attempt * 0.2)
                else:
                    raise
            except IOError:
                raise IOError(
                    "Could not read stats file {0}. Make sure you are using the "
                    "webpack-bundle-tracker plugin" .format(self.stats_file))
382797
def get_limits(self):
        
        if self.limits != {}:
            return self.limits
        limits = {}
        limits.update(self._get_limits_instances())
        limits.update(self._get_limits_networking())
        limits.update(self._get_limits_spot())
        self.limits = limits
        return self.limits
1269489
def _update_limits_from_api(self):
        
        self.connect()
        logger.debug("Querying ELB DescribeAccountLimits for limits")
        attribs = self.conn.describe_account_limits()
        name_to_limits = {
            'classic-load-balancers': 'Active load balancers',
            'classic-listeners': 'Listeners per load balancer',
            'classic-registered-instances':
                'Registered instances per load balancer'
        }
        for attrib in attribs['Limits']:
            if int(attrib.get('Max', 0)) == 0:
                continue
            name = attrib.get('Name', 'unknown')
            if name not in name_to_limits:
                continue
            self.limits[name_to_limits[name]]._set_api_limit(int(attrib['Max']))
        # connect to ELBv2 API as well
        self.conn2 = client('elbv2', **self._boto3_connection_kwargs)
        logger.debug("Connected to %s in region %s",
                     'elbv2', self.conn2._client_config.region_name)
        logger.debug("Querying ELBv2 (ALB) DescribeAccountLimits for limits")
        attribs = self.conn2.describe_account_limits()
        name_to_limits = {
            'target-groups': 'Target groups',
            'listeners-per-application-load-balancer':
                'Listeners per application load balancer',
            'rules-per-application-load-balancer':
                'Rules per application load balancer',
            'network-load-balancers': 'Network load balancers',
            'listeners-per-network-load-balancer':
                'Listeners per network load balancer'
        }
        for attrib in attribs['Limits']:
            if int(attrib.get('Max', 0)) == 0:
                continue
            name = attrib.get('Name', 'unknown')
            if name not in name_to_limits:
                continue
            self.limits[name_to_limits[name]]._set_api_limit(int(attrib['Max']))
        logger.debug("Done setting limits from API")
1340955
def load_stats(self, cache=None, wait=None):
        
        if cache is None:
            cache = not self.debug
        if wait is None:
            wait = self.debug
        if not cache or self._stats is None:
            self._stats = self._load_stats()
            start = time.time()
            while wait and self._stats.get('status') == 'compiling':
                if self.timeout and (time.time() - start > self.timeout):
                    raise RuntimeError("Webpack {0!r} timed out while compiling"
                                       .format(self.stats_file.path))
                time.sleep(0.1)
                self._stats = self._load_stats()
        return self._stats
1239189
def loadalldatas():
    """"""
    dependency_order = ['common', 'profiles', 'blog', 'democomments']
    for app in dependency_order:
        project.recursive_load(os.path.join(paths.project_paths.manage_root, app))