Returns the first occurrence of the bank in your :class:`.PluginsManager`
190270
def index(self):
        
        if self.manager is None:
            raise IndexError('Bank not contains a manager')

        return self.manager.banks.index(self)
680916
def first(self):
        
        self.params['limit'] = 1
        result = self.all()
        return result.items[0] if result.total > 0 else None
967162
def get_balance_context(self):
        """"""
        bank_account = Account.objects.get(name='Bank')

        return dict(
            bank=bank_account,
            retained_earnings_accounts=Account.objects.filter(parent__name='Retained Earnings'),
        )
719197
def first(self):
        

        if self.total and self.limit < self.total:
            return {'page[offset]': 0, 'page[limit]': self.limit}
        else:
            return None
669386
def popfirst(self):
        """"""

        with self.lock:

            try:
                tup = self.data.popleft()
            except IndexError as ex:
                ex.args = ('DEPQ is already empty',)
                raise

            self_items = self.items

            try:
                self_items[tup[0]] -= 1
                if self_items[tup[0]] == 0:
                    del self_items[tup[0]]
            except TypeError:
                r = repr(tup[0])
                self_items[r] -= 1
                if self_items[r] == 0:
                    del self_items[r]

            return tup
921817
def bank_name(self):
        """"""
        entry = registry.get('bic').get(self.compact)
        if entry:
            return entry.get('name')
777826
def getFirstUrn(self, reference=None):
        
        if reference is not None:
            if ":" in reference:
                urn = reference
            else:
                urn = "{}:{}".format(
                    str(URN(str(self.urn)).upTo(URN.NO_PASSAGE)),
                    str(reference)
                )
        else:
            urn = str(self.urn)
        _first = _SharedMethod.firstUrn(
            self.retriever.getFirstUrn(
                urn
            )
        )
        return _first
64559
def initialize_plugin_in_mainwindow_layout(self):
        
        if self.get_option('first_time', True):
            try:
                self.on_first_registration()
            except NotImplementedError:
                return
            self.set_option('first_time', False)
73414
def first(self):
        
        self.reset()
        value = next(self, None)
        if value is None:
            raise ConstraintViolation("{} did not find any results.".format(self.mode.capitalize()))
        return value
1015681
def first_with(self, x):
        """"""

        def _find(x):
            try:
                for arg in self.all:
                    if x in arg:
                        return self.all.index(arg)
            except ValueError:
                return None

        if is_collection(x):
            for item in x:
                found = _find(item)
                if found:
                    return found
            return None
        else:
            return _find(x)
1130516
def first_or_create(self, _attributes=None, **attributes):
        
        if _attributes is not None:
            attributes.update(_attributes)

        instance = self.where(attributes).first()

        if instance is None:
            instance = self.create(**attributes)

        return instance
482269
def first(self, **kwargs):
        
        result = result = self._get(limit=1, **kwargs)
        if result:
            return result[0]
        else:
            raise self.source_class.DoesNotExist(repr(kwargs))
989795
def get_first(self, table=None):
        """"""
        if table is None: table = self.main_table
        query = 'SELECT * FROM "%s" LIMIT 1;' % table
        return self.own_cursor.execute(query).fetchone()
292617
def firstId(self):
        
        if self._first is False:
            # Request the next urn
            self._first = self.getFirstUrn()
        return self._first
1228988
def firstvalue(self, *fieldspecs, **kwargs):
        
        default = kwargs.get('default', None)
        values = [val for val in self.itervalues(*fieldspecs, **kwargs)]
        if values:
            return values[0]
        else:
            return default
72099
def first(self):
        """"""
        if self._results_cache:
            return self._results_cache[0]

        query = PaginatedResponse(func=self._func, lwrap_type=self._lwrap_type, **self._kwargs)
        try:
            return next(query)
        except StopIteration:
            return None
1041972
def order_by_first_occurrence(self):
        
        def _key(e):
            try:
                return e.occurrence_list[0].start
            except IndexError: # no occurrences; put last
                return localize(datetime.max - timedelta(days=365))

        return sorted(list(self), key=_key)