Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(102)  |  Call(81)  |  Derive(0)  |  Import(21)

src/k/n/kninfra-HEAD/kn/planning/entities.py   kninfra(Download)
import datetime
 
from kn.leden.date import now
from kn.leden.mongo import  db, SONWrapper, son_property, _id
import kn.leden.entities as Es
    def all_in_pool(cls, p):
        for m in wcol.find({'pools':  _id(p)}):
            yield cls.from_data(m)
 
    @classmethod
    def by_id(cls, id):
        return cls.from_data(wcol.find_one({'_id':  _id(id)}))
    def set_user(self, x):
        self.user_id = _id(x)
    user = property(get_user, set_user)
 
    @property
    def last_shift_in(self, pool):
        self.last_shift = None
        for v in vcol.find({'assignee': _id(self), 'pool': _id(pool)},
                sort=[('begin', DESCENDING)], limit=1):
            return Vacancy(v).begin.date()

src/k/n/kninfra-HEAD/kn/leden/entities.py   kninfra(Download)
 
from kn.leden.date import now
from kn.leden.mongo import db, SONWrapper, _id, son_property
from kn.settings import DT_MIN, DT_MAX, MAILDOMAIN
from kn.base._random import pseudo_randstr
def by_id(n):
    """ Finds an entity by id """
    return entity(ecol.find_one({'_id': _id(n)}))
 
def by_study(study):
    """ Finds entities by studies.study """
    for m in ecol.find({'studies.study': _id(study)}):
def by_institute(institute):
    """ Finds entities by studies.insitute """
    for m in ecol.find({'studies.institute': _id(institute)}):
        yield entity(m)
 
    if 'secretariaat' in user.cached_groups_names:
        return True
    if _id(rel['who']) == _id(user) and \
            rel['how'] is None and \
            by_id(rel['with']).has_tag(id_by_name('!free-to-join', True)):

src/k/n/kninfra-HEAD/kn/poll/entities.py   kninfra(Download)
from django.db.models import permalink
 
from kn.leden.mongo import db, SONWrapper, _id, son_property
import kn.leden.entities as Es
 
def poll_by_id(__id):
    tmp =  pcol.find_one({'_id': _id(__id)})
    return None if tmp is None else Poll(tmp)
def filling_by_user_and_poll(user, poll):
    tmp = fcol.find_one({'poll': _id(poll),
                         'user': _id(user)})
    return None if tmp is None else Filling(tmp)
def filling_by_poll(poll):
    for tmp in fcol.find({'poll': _id(poll)}):

src/k/n/kninfra-HEAD/kn/moderation/entities.py   kninfra(Download)
from kn.leden.mongo import  db, SONWrapper, son_property, _id
 
import kn.leden.entities as Es
 
mcol = db['moderation_records']
    def set_by(self, x):
        self._data['by'] = _id(x)
    by = property(get_by, set_by)
 
def by_name(name):

src/k/n/kninfra-HEAD/kn/reglementen/entities.py   kninfra(Download)
from regl.model import Document
 
from kn.leden.mongo import db, SONWrapper, _id, son_property, ObjectId
import kn.leden.entities as Es
 
        return None
    tmp = vcol.find_one({'name': version_name,
                         'reglement': _id(regl.id)})
    return None if tmp is None else ReglementVersion(tmp)
 
def reglement_by_id(the_id):
    tmp = rcol.find_one({'_id': _id(the_id)})
    return None if tmp is None else Reglement(tmp)
 
class Reglement(SONWrapper):

src/k/n/kninfra-HEAD/kn/subscriptions/entities.py   kninfra(Download)
from django.utils.html import escape
 
from kn.leden.mongo import db, SONWrapper, _id, son_property, ObjectId
import kn.leden.entities as Es
 
def event_by_id(__id):
    tmp = ecol.find_one({'_id': _id(__id)})
    return None if tmp is None else Event(tmp)
def subscription_by_id(__id):
    tmp =  scol.find_one({'_id': _id(__id)})
    def get_subscription_of(self, user):
        d = scol.find_one({
            'event': self._data['_id'],
            'user': _id(user)})
        if d is None:

src/k/n/kninfra-HEAD/kn/planning/views.py   kninfra(Download)
from kn.base.http import JsonHttpResponse
from kn.leden.date import date_to_dt, now, date_to_midnight
from kn.leden.mongo import _id
 
from kn.planning.forms import *
    events = dict()
    for e in Event.all_in_future():
        eid = _id(e)
        vacancies = list(e.vacancies(pool=pool))
        events[eid] = {'vacancies': vacancies, 'date': e.date.date(),
                'name': e.name, 'kind': e.kind, 'id': eid}
        posted = False
        events[eid]['vacancies'].sort(key=lambda v: v.begin)
        if request.method == 'POST' and _id(request.POST['eid']) == eid:
                else:
                    if vacancy.assignee_id == None or \
                            _id(vacancy.assignee_id) != _id(worker):
                        delta = datetime.timedelta(days=5)
                        vacancy.reminder_needed = now() + delta < e.date

src/k/n/kninfra-HEAD/utils/planning/sync-workers.py   kninfra(Download)
import kn.leden.entities as Es
from kn.settings import DT_MIN, DT_MAX
from kn.leden.mongo import _id
from kn.leden.date import now
from kn.planning.entities import Pool, Worker, Vacancy
    del w.pools[:]
for type in ['tappers', 'bestuur', 'barco', 'draai', 'cocks']:
    poolid = _id(pools[type])
    group = Es.by_name(type)
    relations = group.get_rrelated(None, dt, dt, True, None, None)
            workers[gm['who']] = Worker({
                'pools': [ poolid ],
                'user': _id(gm['who'])})
print "saving ..."
for w in workers.itervalues():

src/k/n/kninfra-HEAD/utils/planning/add-dranktelling.py   kninfra(Download)
 
import kn.leden.entities as Es
from kn.leden.mongo import _id
from kn.settings import DT_MIN, DT_MAX
from kn.planning.entities import Pool, Worker, Event, Vacancy
    v = Vacancy({
        'name': 'Teller %d' % p,
        'event': _id(e),
        'begin': begin,
        'end': begin + datetime.timedelta(seconds=1800),
        'pool': _id(pool),

src/k/n/kninfra-HEAD/utils/leden/graphs-iriss.py   kninfra(Download)
import kn.leden.entities as Es
from kn.settings import DT_MIN, DT_MAX
from kn.leden.mongo import _id
 
llut = dict()
comms_lut = {}
for c in comms:
    comms_lut[_id(c)] = c
for l in leden:
    clut[l] = (DT_MAX, None)
    llut[l] = DT_MAX
    leden_lut[_id(l)] = l

  1 | 2 | 3  Next