Returns all the latest active terms and conditions
357861
def get_active_terms_list():
        """"""

        active_terms_list = cache.get('tandc.active_terms_list')
        if active_terms_list is None:
            active_terms_list = TermsAndConditions.objects.filter(id__in=TermsAndConditions.get_active_terms_ids()).order_by('slug')
            cache.set('tandc.active_terms_list', active_terms_list, TERMS_CACHE_SECONDS)

        return active_terms_list
771033
def cp(path, term_check = false)
      return "active" if term_check && request.url.include?('terms')
      return "active" if current_page?(path)
    end
16312
def get_current(self):
        
        all_leases = self.get()
        leases = {}
        for lease in all_leases:
            if lease.valid and lease.active:
                if type(lease) is Lease:
                    leases[lease.ethernet] = lease
                elif type(lease) is Lease6:
                    leases['%s-%s' % (lease.type, lease.host_identifier_string)] = lease
        return leases
882010
def get_conditions(self):
        

        # filter just values that are true (means that pod has that condition right now)
        return [PodCondition.get_from_string(c.type) for c in self.get_status().conditions
                if c.status == 'True']
959841
def get_all_conditions(self):
        
        for condition_set in sorted(self.get_condition_sets(), key=lambda x: x.get_group_label()):
            group = unicode(condition_set.get_group_label())
            for field in condition_set.fields.itervalues():
                yield condition_set.get_id(), group, field
671628
def active?(feature, repository)
      feature_active?(feature) or
        (rollout.active?(feature, repository.owner) or
          repository_active?(feature, repository))
    end
427390
def newest(self):
        
        if self._order_by == 'newest':
            return self.first
        if self._order_by == 'oldest':
            return self.last
        return max(self.entries, key=lambda x: (x.date, x.id))
634628
def active(self):
        
        if not os.path.isfile(self._paths['active_file']):
            return False
        return self._loaded
400397
def all(self):
        
        return self._client.get(
            url=self._client.get_full_url(
                self.get_path('collection', realm=self._realm_name)
            )
        )
519445
def is_active(self):
    """"""
    if self._db_connection_provider:
      # The plugin is active if one relevant tag can be found in the database.
      db = self._db_connection_provider()
      cursor = db.execute('''
        SELECT
          1
        FROM Tags
        WHERE Tags.plugin_name = ?
        LIMIT 1
      ''', (metadata.PLUGIN_NAME,))
      return bool(list(cursor))

    return bool(self._multiplexer) and any(self.index_impl().values())
384896
def current_set(self):
        
        assert self.model.KEY_FIELDS != (), "Just use model.current() if there are no KEY_FIELDS"
        return self.get_queryset().filter(
            pk__in=self._current_ids_subquery()
        ).annotate(
            is_active=models.Value(1, output_field=models.IntegerField())
        )
119679
def active_subscriptions(self):
		
		return self.subscriptions.filter(
			status=enums.SubscriptionStatus.active, current_period_end__gt=timezone.now()
		)
640623
def get_current_term():
    
    url = "{}/current.json".format(term_res_url_prefix)
    term = _json_to_term_model(get_resource(url))

    # A term doesn't become "current" until 2 days before the start of
    # classes.  That's too late to be useful, so if we're after the last
    # day of grade submission window, use the next term resource.
    if datetime.now() > term.grade_submission_deadline:
        return get_next_term()

    return term
363046
def get_active_modifiers(self):
        
        keys = ctypes.pointer(charcodemap_t())
        nkeys = ctypes.c_int(0)

        _libxdo.xdo_get_active_modifiers(
            self._xdo, ctypes.byref(keys), ctypes.byref(nkeys))
        return [keys[i] for i in range(nkeys.value)]
1101903
def is_active(self, instance, conditions):
        
        return_value = None
        for name, field in self.fields.iteritems():
            field_conditions = conditions.get(self.get_namespace(), {}).get(name)
            if field_conditions:
                value = self.get_field_value(instance, name)
                for status, condition in field_conditions:
                    exclude = status == EXCLUDE
                    if field.is_active(condition, value):
                        if exclude:
                            return False
                        return_value = True
                    else:
                        if exclude:
                            return_value = True
        return return_value
994800
def active(self):
        
        projects = []
        r = requests.get(self.api,
                         params={'action': 'query', 'list': 'categorymembers', 'cmpageid': self.active_id,
                                 'cmtype': 'page', 'cmlimit': '500', 'format': 'json'},
                         headers=self.header)
        if r.status_code == 200:
            jsd = r.json()
            projects.append([(x['title'], x['pageid']) for x in jsd['query']['categorymembers']])
            if 'query-continue' in jsd:
                while True:
                    r = requests.get(self.api,
                                     params={'action': 'query', 'list': 'categorymembers',
                                             'cmpageid': self.active_id, 'cmtype': 'page', 'cmlimit': '500',
                                             'cmcontinue': jsd['query-continue']['categorymembers']['cmcontinue'],
                                             'format': 'json'},
                                     headers=self.header)
                    if r.status_code == 200:
                        jsd = r.json()
                        projects.append([(x['title'], x['pageid']) for x in jsd['query']['categorymembers']])
                        if 'query-continue' not in jsd:
                            break
                    else:
                        break
        return projects[0]
39787
def active_brokers(self):
        """"""
        return {
            broker
            for broker in self._brokers
            if not broker.inactive and not broker.decommissioned
        }