Returns a dict with the absolute limits for the current account.
435514
def get_absolute_limits(self):
        
        resp, body = self.method_get("/limits")
        absolute_limits = body.get("limits", {}).get("absolute")
        return absolute_limits
920092
def parse_limits(self):
        """"""

        if 'limits' in self._model:
            if not isinstance(self._model['limits'], list):
                raise ParseError('Expected limits to be a list')

            for limit in parse_limits_list(
                    self._context, self._model['limits']):
                yield limit
286581
def rate_limit_info():
    
    import json
    import time

    r = requests.get(gh_url + "/rate_limit", auth=login.auth())
    out = json.loads(r.text)
    mins = (out["resources"]["core"]["reset"]-time.time())/60
    return out["resources"]["core"]["remaining"], mins
432756
def params(self):
        
        params = {}
        params["access_token"] = self.access_token
        params["account_id"] = self.account_id
        return params
736355
def get_limits(self):
        
        if self.limits != {}:
            return self.limits
        limits = {}
        limits['DB instances'] = AwsLimit(
            'DB instances',
            self,
            40,
            self.warning_threshold,
            self.critical_threshold,
            limit_type='AWS::RDS::DBInstance'
        )
        limits['Reserved Instances'] = AwsLimit(
            'Reserved Instances',
            self,
            40,
            self.warning_threshold,
            self.critical_threshold,
            limit_type='AWS::RDS::DBInstance',
        )
        limits['Storage quota (GB)'] = AwsLimit(
            'Storage quota (GB)',
            self,
            100000,
            self.warning_threshold,
            self.critical_threshold,
            limit_type='AWS::RDS::DBInstance',
        )
        limits['DB snapshots per user'] = AwsLimit(
            'DB snapshots per user',
            self,
            100,
            self.warning_threshold,
            self.critical_threshold,
            limit_type='AWS::RDS::DBSnapshot',
        )
        limits['DB parameter groups'] = AwsLimit(
            'DB parameter groups',
            self,
            50,
            self.warning_threshold,
            self.critical_threshold,
            limit_type='AWS::RDS::DBParameterGroup',
        )
        limits['DB security groups'] = AwsLimit(
            'DB security groups',
            self,
            25,
            self.warning_threshold,
            self.critical_threshold,
            limit_type='AWS::RDS::DBSecurityGroup',
        )
        limits['VPC Security Groups'] = AwsLimit(
            'VPC Security Groups',
            self,
            5,
            self.warning_threshold,
            self.critical_threshold,
            limit_type='AWS::RDS::DBSecurityGroup',
        )
        limits['Subnet Groups'] = AwsLimit(
            'Subnet Groups',
            self,
            50,
            self.warning_threshold,
            self.critical_threshold,
            limit_type='AWS::RDS::DBSubnetGroup',
            ta_limit_name='Subnet groups'
        )
        limits['Subnets per Subnet Group'] = AwsLimit(
            'Subnets per Subnet Group',
            self,
            20,
            self.warning_threshold,
            self.critical_threshold,
            limit_type='AWS::RDS::DBSubnetGroup',
            ta_limit_name='Subnets per subnet group'
        )
        limits['Option Groups'] = AwsLimit(
            'Option Groups',
            self,
            20,
            self.warning_threshold,
            self.critical_threshold,
            limit_type='AWS::RDS::DBOptionGroup',
        )
        limits['Event Subscriptions'] = AwsLimit(
            'Event Subscriptions',
            self,
            20,
            self.warning_threshold,
            self.critical_threshold,
            limit_type='AWS::RDS::DBEventSubscription',
            ta_limit_name='Event subscriptions'
        )
        limits['Read replicas per master'] = AwsLimit(
            'Read replicas per master',
            self,
            5,
            self.warning_threshold,
            self.critical_threshold,
            limit_type='AWS::RDS::DBInstance',
        )
        # this is the number of rules per security group
        limits['Max auths per security group'] = AwsLimit(
            'Max auths per security group',
            self,
            20,
            self.warning_threshold,
            self.critical_threshold,
            limit_type='AWS::RDS::DBSecurityGroup',
            limit_subtype='AWS::RDS::DBSecurityGroupIngress',
        )
        limits['DB Clusters'] = AwsLimit(
            'DB Clusters',
            self,
            40,
            self.warning_threshold,
            self.critical_threshold,
            limit_type='AWS::RDS::DBCluster',
            ta_limit_name='Clusters'
        )
        limits['DB Cluster Parameter Groups'] = AwsLimit(
            'DB Cluster Parameter Groups',
            self,
            50,
            self.warning_threshold,
            self.critical_threshold,
            limit_type='AWS::RDS::DBClusterParameterGroup',
            ta_limit_name='Cluster parameter groups'
        )
        self.limits = limits
        return limits
743798
def Size(self):
        
        return super(AccountState, self).Size() + s.uint160 + s.uint8 + GetVarSize(self.Votes) + GetVarSize(len(self.Balances)) + (len(self.Balances) * (32 + 8))
565299
def all(cls):
        
        account = cls.info()
        creditusage = cls.creditusage()

        if not creditusage:
            return account

        left = account['credits'] / creditusage
        years, hours = divmod(left, 365 * 24)
        months, hours = divmod(hours, 31 * 24)
        days, hours = divmod(hours, 24)

        account.update({'credit_usage': creditusage,
                        'left': (years, months, days, hours)})

        return account
239150
def getLimits(locations, current, sortResults=True, verbose=False):
    
    limit = {}
    for l in locations:
        a, b = current.common(l)
        if a is None:
            continue
        for name, value in b.items():
            f = a[name]
            if name not in limit:
                limit[name] = {}
                limit[name]['<'] = {}
                limit[name]['='] = {}
                limit[name]['>'] = {}
                if f > 0:
                    limit[name]['>'] = {0: [Location()]}
                elif f<0:
                    limit[name]['<'] = {0: [Location()]}
                else:
                    limit[name]['='] = {0: [Location()]}
            if current[name] < value - _EPSILON:
                if value not in limit[name]["<"]:
                    limit[name]["<"][value] = []
                limit[name]["<"][value].append(l)
            elif current[name] > value + _EPSILON:
                if value not in limit[name][">"]:
                    limit[name][">"][value] = []
                limit[name][">"][value].append(l)
            else:
                if value not in limit[name]["="]:
                    limit[name]["="][value] = []
                limit[name]["="][value].append(l)
    if not sortResults:
        return limit
    # now we have all the data, let's sort to the relevant values
    l = {}
    for name, lims in  limit.items():
        less = []
        more = []
        if lims[">"].keys():
            less = sorted(lims[">"].keys())
            lim_min = less[-1]
        else:
            lim_min = None
        if lims["<"].keys():
            more = sorted(lims["<"].keys())
            lim_max = more[0]
        else:
            lim_max = None
        if lim_min is None and lim_max is not None:
            # extrapolation < min
            if len(limit[name]['='])>0:
                l[name] = (None, list(limit[name]['='].keys())[0], None)
            elif len(more) > 1 and len(limit[name]['='])==0:
                # extrapolation
                l[name] = (None,  more[0], more[1])
        elif lim_min is not None and lim_max is None:
            # extrapolation < max
            if len(limit[name]['='])>0:
                # less > 0, M > 0, more = None
                # -> end of a limit
                l[name] = (None, limit[name]['='], None)
            elif len(less) > 1 and len(limit[name]['='])==0:
                # less > 0, M = None, more = None
                # extrapolation
                l[name] = (less[-2], less[-1], None)
        else:
            if len(limit[name]['=']) > 0:
                l[name] = (None, list(limit[name]['='].keys())[0], None)
            else:
                l[name] = (lim_min,  None, lim_max)
    return l
825247
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'name') and self.name is not None:
            _dict['name'] = self.name
        if hasattr(self, 'limit') and self.limit is not None:
            _dict['limit'] = self.limit
        return _dict
302631
def ratelimits(self):
        
        # can't use a dict comprehension because we want python2.6 support
        r = {}
        keys = filter(lambda x: x.startswith("x-ratelimit-"), self.headers.keys())
        for key in keys:
            r[key.replace("x-ratelimit-", "")] = int(self.headers[key])
        return r
222510
def _getActorLimits(self):
        
        actorLimits = []

        for _ in range(self.env.numOffbids):
            for _ in self.env.generators:
                actorLimits.append((0.0, self.env.maxMarkup))

        for _ in range(self.env.numOffbids):
            for _ in self.env.generators:
                if self.env.maxWithhold is not None:
                    actorLimits.append((0.0, self.env.maxWithhold))

        logger.debug("Actor limits: %s" % actorLimits)

        return actorLimits
385537
def get_limits(self):
        
        logger.debug("Getting limits for Lambda")
        if self.limits != {}:
            return self.limits

        self._construct_limits()

        return self.limits
811406
def accounts(self) -> List[Account]:
        
        # use only Assets sub-accounts
        result = (
            [acct for acct in self.security.accounts if acct.fullname.startswith('Assets')]
        )
        return result
580180
def account(self):
        
        data = self.query(Account.key)
        return Account(self, data)
918099
def rate_limits(self):
        """"""
        if not self._rate_limits:
            self._rate_limits = utilities.get_rate_limits(self._response)
        return self._rate_limits
504414
def getActorLimits(self):
        
        generators = [g for g in self.env.case.online_generators
                      if g.bus.type != REFERENCE]
        limits = []
        for g in generators:
            limits.append((g.p_min, g.p_max))

        logger.info("Actor limits: %s" % limits)

        return limits
126862
def view_limits(self, vmin, vmax):
        
        b = self._transform.base
        if vmax < vmin:
            vmin, vmax = vmax, vmin

        if not matplotlib.ticker.is_decade(abs(vmin), b):
            if vmin < 0:
                vmin = -matplotlib.ticker.decade_up(-vmin, b)
            else:
                vmin = matplotlib.ticker.decade_down(vmin, b)
        if not matplotlib.ticker.is_decade(abs(vmax), b):
            if vmax < 0:
                vmax = -matplotlib.ticker.decade_down(-vmax, b)
            else:
                vmax = matplotlib.ticker.decade_up(vmax, b)

        if vmin == vmax:
            if vmin < 0:
                vmin = -matplotlib.ticker.decade_up(-vmin, b)
                vmax = -matplotlib.ticker.decade_down(-vmax, b)
            else:
                vmin = matplotlib.ticker.decade_down(vmin, b)
                vmax = matplotlib.ticker.decade_up(vmax, b)
        result = matplotlib.transforms.nonsingular(vmin, vmax)
        return result