1. Lynn Rees
  2. callchain

Commits

Lynn Rees  committed 37c615b

- savepoint

  • Participants
  • Parent commits 2af4d23
  • Branches pu

Comments (0)

Files changed (25)

File callchain/active_auto/chain.py

View file
 
 from callchain.chain import RootMixin
 from callchain.config import Defaults
-from callchain.patterns import Pathways, Nameways
+from callchain.patterns import Pathways
 from callchain.keys.core import KThings, KResult
 from callchain.keys.base import KRoot, KCall, KChain
 from callchain.call import ChainMixin, PriorityMixin, inside
 
 
 class thingchain(Pathways):
-
-    class loads(Nameways):
-        key = 'callchain.keys.loads.KLoads'
-        loads = 'callchain.services.loads.Loads'
-
-    class dumps(Nameways):
-        key = 'callchain.keys.dumps.KDumps'
-        loads = 'callchain.services.dumps.Dumps'
-
-    class logger(Nameways):
-        key = 'callchain.keys.core.KLogger'
-        logger = 'callchain.services.core.loglet'
+    loads = 'callchain.services.loads.Loads'
+    dumps = 'callchain.services.dumps.Dumps'
+    logger = 'callchain.services.core.loglet'
 
 
 @appifies(KThings, KRoot, KChain, KCall)
 
 
 class chain(Pathways):
-
-    class loads(Nameways):
-        key = 'callchain.keys.loads.KLoads'
-        loads = 'callchain.services.loads.Loads'
-
-    class dumps(Nameways):
-        key = 'callchain.keys.dumps.KDumps'
-        loads = 'callchain.services.dumps.Dumps'
-
-    class logger(Nameways):
-        key = 'callchain.keys.core.KLogger'
-        logger = 'callchain.services.core.loglet'
-
-    class filter(Nameways):
-        key = 'callchain.keys.filter.KFilter'
-        filter = 'callchain.active_auto.chainlet.filterchain'
-
-    class collect(Nameways):
-        key = 'callchain.keys.filter.KCollect'
-        collect = 'callchain.active_auto.chainlet.collectchain'
-
-    class set(Nameways):
-        key = 'callchain.keys.filter.KSet'
-        set = 'callchain.active_auto.chainlet.setchain'
-
-    class slice(Nameways):
-        key = 'callchain.keys.filter.KSlice'
-        slice = 'callchain.active_auto.chainlet.slicechain'
-
-    class combine(Nameways):
-        key = 'callchain.keys.order.KCombine'
-        combine = 'callchain.active_auto.chainlet.combinechain'
-
-    class map(Nameways):
-        key = 'callchain.keys.map.KMap'
-        map = 'callchain.active_auto.chainlet.mapchain'
-
-    class delay(Nameways):
-        key = 'callchain.keys.map.KDelay'
-        delay = 'callchain.active_auto.chainlet.delaychain'
-
-    class repeat(Nameways):
-        key = 'callchain.keys.map.KRepeat'
-        repeat = 'callchain.active_auto.chainlet.repeatchain'
-
-    class order(Nameways):
-        key = 'callchain.keys.order.KOrder'
-        order = 'callchain.active_auto.chainlet.orderchain'
-
-    class random(Nameways):
-        key = 'callchain.keys.order.KRandom'
-        random = 'callchain.active_auto.chainlet.randomchain'
-
-    class reduce(Nameways):
-        key = 'callchain.keys.reduce.KReduce'
-        reduce = 'callchain.active_auto.chainlet.reducechain'
-
-    class math(Nameways):
-        key = 'callchain.keys.reduce.KMath'
-        math = 'callchain.active_auto.chainlet.mathchain'
-
-    class truth(Nameways):
-        key = 'callchain.keys.reduce.KTruth'
-        truth = 'callchain.active_auto.chainlet.truthchain'
+    loads = 'callchain.services.loads.Loads'
+    dumps = 'callchain.services.dumps.Dumps'
+    logger = 'callchain.services.core.loglet'
+    filter = 'callchain.active_auto.chainlet.filterchain'
+    collect = 'callchain.active_auto.chainlet.collectchain'
+    set = 'callchain.active_auto.chainlet.setchain'
+    slice = 'callchain.active_auto.chainlet.slicechain'
+    combine = 'callchain.active_auto.chainlet.combinechain'
+    map = 'callchain.active_auto.chainlet.mapchain'
+    delay = 'callchain.active_auto.chainlet.delaychain'
+    repeat = 'callchain.active_auto.chainlet.repeatchain'
+    order = 'callchain.active_auto.chainlet.orderchain'
+    random = 'callchain.active_auto.chainlet.randomchain'
+    reduce = 'callchain.active_auto.chainlet.reducechain'
+    math = 'callchain.active_auto.chainlet.mathchain'
+    truth = 'callchain.active_auto.chainlet.truthchain'
 
 
 @appifies(KResult, KRoot, KChain, KCall)

File callchain/active_auto/chainlet.py

View file
 from callchain.keys.base import KCall, KChain, KConfig, KLinked
 from callchain.keys.filter import KCollect, KSet, KSlice, KFilter
 
-__all__ = (
-    'mathchain', 'truthchain', 'reducechain', 'collectchain', 'setchain',
-    'slicechain', 'filterchain', 'delaychain', 'repeatchain', 'mapchain',
-    'randomchain', 'orderchain', 'chainlet', 'combinechain',
-)
-
 
 class chainlet(ChainletMixin, BranchMixin, BranchletMixin, AutoQMixin):
 

File callchain/active_auto/event.py

View file
 from callchain.chain import EventRootMixin
 from callchain.call import EventMixin, einside
 from callchain.keys.core import KThings, KResult
-from callchain.patterns import Pathways, Nameways
+from callchain.patterns import Pathways
 from callchain.keys.base import KEvent, KEventRoot, KEventCall
 
 ###############################################################################
 
 class thingevent(Pathways):
     chain = 'callchain.active_auto.chainlet.chainlink'
-
-    class loads(Nameways):
-        key = 'callchain.keys.loads.KLoads'
-        loads = 'callchain.services.loads.Loads'
-
-    class dumps(Nameways):
-        key = 'callchain.keys.dumps.KDumps'
-        loads = 'callchain.services.dumps.Dumps'
-
-    class logger(Nameways):
-        key = 'callchain.keys.core.KLogger'
-        logger = 'callchain.services.core.loglet'
+    loads = 'callchain.services.loads.Loads'
+    dumps = 'callchain.services.dumps.Dumps'
+    logger = 'callchain.services.core.loglet'
 
 
 @appifies(KThings, KEventRoot, KEvent, KEventCall)
 
 class event(Pathways):
     chain = 'callchain.active_auto.chainlet.chainlink'
-
-    class loads(Nameways):
-        key = 'callchain.keys.loads.KLoads'
-        loads = 'callchain.services.loads.Loads'
-
-    class dumps(Nameways):
-        key = 'callchain.keys.dumps.KDumps'
-        loads = 'callchain.services.dumps.Dumps'
-
-    class logger(Nameways):
-        key = 'callchain.keys.core.KLogger'
-        logger = 'callchain.services.core.loglet'
-
-    class filter(Nameways):
-        key = 'callchain.keys.filter.KFilter'
-        filter = 'callchain.active_auto.eventlet.filterevent'
-
-    class collect(Nameways):
-        key = 'callchain.keys.filter.KCollect'
-        collect = 'callchain.active_auto.eventlet.collectevent'
-
-    class combine(Nameways):
-        key = 'callchain.keys.order.KCombine'
-        combine = 'callchain.active_auto.eventlet.combineevent'
-
-    class set(Nameways):
-        key = 'callchain.keys.filter.KSet'
-        set = 'callchain.active_auto.eventlet.setevent'
-
-    class slice(Nameways):
-        key = 'callchain.keys.filter.KSlice'
-        slice = 'callchain.active_auto.eventlet.sliceevent'
-
-    class map(Nameways):
-        key = 'callchain.keys.map.KMap'
-        map = 'callchain.active_auto.eventlet.mapevent'
-
-    class delay(Nameways):
-        key = 'callchain.keys.map.KDelay'
-        delay = 'callchain.active_auto.eventlet.delayevent'
-
-    class repeat(Nameways):
-        key = 'callchain.keys.map.KRepeat'
-        repeat = 'callchain.active_auto.eventlet.repeatevent'
-
-    class order(Nameways):
-        key = 'callchain.keys.order.KOrder'
-        order = 'callchain.active_auto.eventlet.orderevent'
-
-    class random(Nameways):
-        key = 'callchain.keys.order.KRandom'
-        random = 'callchain.active_auto.eventlet.randomevent'
-
-    class reduce(Nameways):
-        key = 'callchain.keys.reduce.KReduce'
-        reduce = 'callchain.active_auto.eventlet.reduceevent'
-
-    class math(Nameways):
-        key = 'callchain.keys.reduce.KMath'
-        math = 'callchain.active_auto.eventlet.mathevent'
-
-    class truth(Nameways):
-        key = 'callchain.keys.reduce.KTruth'
-        truth = 'callchain.active_auto.eventlet.truthevent'
+    loads = 'callchain.services.loads.Loads'
+    dumps = 'callchain.services.dumps.Dumps'
+    logger = 'callchain.services.core.loglet'
+    filter = 'callchain.active_auto.eventlet.filterevent'
+    collect = 'callchain.active_auto.eventlet.collectevent'
+    combine = 'callchain.active_auto.eventlet.combineevent'
+    set = 'callchain.active_auto.eventlet.setevent'
+    slice = 'callchain.active_auto.eventlet.sliceevent'
+    map = 'callchain.active_auto.eventlet.mapevent'
+    delay = 'callchain.active_auto.eventlet.delayevent'
+    repeat = 'callchain.active_auto.eventlet.repeatevent'
+    order = 'callchain.active_auto.eventlet.orderevent'
+    random = 'callchain.active_auto.eventlet.randomevent'
+    reduce = 'callchain.active_auto.eventlet.reduceevent'
+    math = 'callchain.active_auto.eventlet.mathevent'
+    truth = 'callchain.active_auto.eventlet.truthevent'
 
 
 @appifies(KResult, KEventRoot, KEvent, KEventCall)

File callchain/active_auto/eventlet.py

View file
 from callchain.keys.filter import KCollect, KSet, KSlice, KFilter
 from callchain.keys.base import KEventCall, KEvent, KLinked, KConfig
 
-__all__ = (
-    'mathevent', 'truthevent', 'reduceevent', 'collectevent', 'setevent',
-    'sliceevent', 'filterevent', 'delayevent', 'repeatevent', 'mapevent',
-    'randomevent', 'orderevent', 'eventlet', 'combineevent'
-)
-
 
 class eventlet(ChainletMixin, EventBranchMixin, BranchletMixin, AutoQMixin):
 

File callchain/active_man/chain.py

View file
 
 
 class thingchain(Pathways):
-    
-    class loads(Nameways):
-        key = 'callchain.keys.loads.KLoads'
-        loads = 'callchain.services.loads.Loads'
-
-    class dumps(Nameways):
-        key = 'callchain.keys.dumps.KDumps'
-        loads = 'callchain.services.dumps.Dumps'
-
-    class logger(Nameways):
-        key = 'callchain.keys.core.KLogger'
-        logger = 'callchain.services.core.loglet'
+    loads = 'callchain.services.loads.Loads'
+    dumps = 'callchain.services.dumps.Dumps'
+    logger = 'callchain.services.core.loglet'
 
 
 @appifies(KThings, KRoot, KChain, KCall)
 
 
 class chain(Pathways):
-
-    class loads(Nameways):
-        key = 'callchain.keys.loads.KLoads'
-        loads = 'callchain.services.loads.Loads'
-
-    class dumps(Nameways):
-        key = 'callchain.keys.dumps.KDumps'
-        loads = 'callchain.services.dumps.Dumps'
-
-    class logger(Nameways):
-        key = 'callchain.keys.core.KLogger'
-        logger = 'callchain.services.core.loglet'
-
-    class filter(Nameways):
-        key = 'callchain.keys.filter.KFilter'
-        filter = 'callchain.active_man.chainlet.filterchain'
-
-    class collect(Nameways):
-        key = 'callchain.keys.filter.KCollect'
-        collect = 'callchain.active_man.chainlet.collectchain'
-
-    class set(Nameways):
-        key = 'callchain.keys.filter.KSet'
-        set = 'callchain.active_man.chainlet.setchain'
-
-    class slice(Nameways):
-        key = 'callchain.keys.filter.KSlice'
-        slice = 'callchain.active_man.chainlet.slicechain'
-
-    class combine(Nameways):
-        key = 'callchain.keys.order.KCombine'
-        combine = 'callchain.active_man.chainlet.combinechain'
-
-    class map(Nameways):
-        key = 'callchain.keys.map.KMap'
-        map = 'callchain.active_man.chainlet.mapchain'
-
-    class delay(Nameways):
-        key = 'callchain.keys.map.KDelay'
-        delay = 'callchain.active_man.chainlet.delaychain'
-
-    class repeat(Nameways):
-        key = 'callchain.keys.map.KRepeat'
-        repeat = 'callchain.active_man.chainlet.repeatchain'
-
-    class order(Nameways):
-        key = 'callchain.keys.order.KOrder'
-        order = 'callchain.active_man.chainlet.orderchain'
-
-    class random(Nameways):
-        key = 'callchain.keys.order.KRandom'
-        random = 'callchain.active_man.chainlet.randomchain'
-
-    class reduce(Nameways):
-        key = 'callchain.keys.reduce.KReduce'
-        reduce = 'callchain.active_man.chainlet.reducechain'
-
-    class math(Nameways):
-        key = 'callchain.keys.reduce.KMath'
-        math = 'callchain.active_man.chainlet.mathchain'
-
-    class truth(Nameways):
-        key = 'callchain.keys.reduce.KTruth'
-        truth = 'callchain.active_man.chainlet.truthchain'
+    loads = 'callchain.services.loads.Loads'
+    dumps = 'callchain.services.dumps.Dumps'
+    logger = 'callchain.services.core.loglet'
+    filter = 'callchain.active_man.chainlet.filterchain'
+    collect = 'callchain.active_man.chainlet.collectchain'
+    set = 'callchain.active_man.chainlet.setchain'
+    slice = 'callchain.active_man.chainlet.slicechain'
+    combine = 'callchain.active_man.chainlet.combinechain'
+    map = 'callchain.active_man.chainlet.mapchain'
+    delay = 'callchain.active_man.chainlet.delaychain'
+    repeat = 'callchain.active_man.chainlet.repeatchain'
+    order = 'callchain.active_man.chainlet.orderchain'
+    random = 'callchain.active_man.chainlet.randomchain'
+    reduce = 'callchain.active_man.chainlet.reducechain'
+    math = 'callchain.active_man.chainlet.mathchain'
+    truth = 'callchain.active_man.chainlet.truthchain'
 
 
 @appifies(KResult, KRoot, KChain, KCall)

File callchain/active_man/chainlet.py

View file
 from callchain.keys.base import KCall, KChain, KConfig, KLinked
 from callchain.keys.filter import KCollect, KSet, KSlice, KFilter
 
-__all__ = (
-    'mathchain', 'truthchain', 'reducechain', 'collectchain', 'setchain',
-    'slicechain', 'filterchain', 'delaychain', 'repeatchain', 'mapchain',
-    'randomchain', 'orderchain', 'chainlet', 'combinechain',
-)
-
 
 class chainlet(ChainletMixin, BranchMixin, BranchletMixin, ManQMixin):
 

File callchain/active_man/event.py

View file
 from callchain.chain import EventRootMixin
 from callchain.call import EventMixin, einside
 from callchain.keys.core import KThings, KResult
-from callchain.patterns import Pathways, Nameways
+from callchain.patterns import Pathways
 from callchain.keys.base import KEvent, KEventRoot, KEventCall
 
 ###############################################################################
 
 class thingevent(Pathways):
     chain = 'callchain.active_man.chainlet.chainlink'
-
-    class loads(Nameways):
-        key = 'callchain.keys.loads.KLoads'
-        loads = 'callchain.services.loads.Loads'
-
-    class dumps(Nameways):
-        key = 'callchain.keys.dumps.KDumps'
-        loads = 'callchain.services.dumps.Dumps'
-
-    class logger(Nameways):
-        key = 'callchain.keys.core.KLogger'
-        logger = 'callchain.services.core.loglet'
+    loads = 'callchain.services.loads.Loads'
+    dumps = 'callchain.services.dumps.Dumps'
+    logger = 'callchain.services.core.loglet'
 
 
 @appifies(KThings, KEventRoot, KEvent, KEventCall)
 
 class event(Pathways):
     chain = 'callchain.active_man.chainlet.chainlink'
-
-    class loads(Nameways):
-        key = 'callchain.keys.loads.KLoads'
-        loads = 'callchain.services.loads.Loads'
-
-    class dumps(Nameways):
-        key = 'callchain.keys.dumps.KDumps'
-        loads = 'callchain.services.dumps.Dumps'
-
-    class logger(Nameways):
-        key = 'callchain.keys.core.KLogger'
-        logger = 'callchain.services.core.loglet'
-
-    class filter(Nameways):
-        key = 'callchain.keys.filter.KFilter'
-        filter = 'callchain.active_man.eventlet.filterevent'
-
-    class collect(Nameways):
-        key = 'callchain.keys.filter.KCollect'
-        collect = 'callchain.active_man.eventlet.collectevent'
-
-    class combine(Nameways):
-        key = 'callchain.keys.order.KCombine'
-        combine = 'callchain.active_man.eventlet.combineevent'
-
-    class set(Nameways):
-        key = 'callchain.keys.filter.KSet'
-        set = 'callchain.active_man.eventlet.setevent'
-
-    class slice(Nameways):
-        key = 'callchain.keys.filter.KSlice'
-        slice = 'callchain.active_man.eventlet.sliceevent'
-
-    class map(Nameways):
-        key = 'callchain.keys.map.KMap'
-        map = 'callchain.active_man.eventlet.mapevent'
-
-    class delay(Nameways):
-        key = 'callchain.keys.map.KDelay'
-        delay = 'callchain.active_man.eventlet.delayevent'
-
-    class repeat(Nameways):
-        key = 'callchain.keys.map.KRepeat'
-        repeat = 'callchain.active_man.eventlet.repeatevent'
-
-    class order(Nameways):
-        key = 'callchain.keys.order.KOrder'
-        order = 'callchain.active_man.eventlet.orderevent'
-
-    class random(Nameways):
-        key = 'callchain.keys.order.KRandom'
-        random = 'callchain.active_man.eventlet.randomevent'
-
-    class reduce(Nameways):
-        key = 'callchain.keys.reduce.KReduce'
-        reduce = 'callchain.active_man.eventlet.reduceevent'
-
-    class math(Nameways):
-        key = 'callchain.keys.reduce.KMath'
-        math = 'callchain.active_man.eventlet.mathevent'
-
-    class truth(Nameways):
-        key = 'callchain.keys.reduce.KTruth'
-        truth = 'callchain.active_man.eventlet.truthevent'
+    loads = 'callchain.services.loads.Loads'
+    dumps = 'callchain.services.dumps.Dumps'
+    logger = 'callchain.services.core.loglet'
+    filter = 'callchain.active_man.eventlet.filterevent'
+    collect = 'callchain.active_man.eventlet.collectevent'
+    combine = 'callchain.active_man.eventlet.combineevent'
+    set = 'callchain.active_man.eventlet.setevent'
+    slice = 'callchain.active_man.eventlet.sliceevent'
+    map = 'callchain.active_man.eventlet.mapevent'
+    delay = 'callchain.active_man.eventlet.delayevent'
+    repeat = 'callchain.active_man.eventlet.repeatevent'
+    order = 'callchain.active_man.eventlet.orderevent'
+    random = 'callchain.active_man.eventlet.randomevent'
+    reduce = 'callchain.active_man.eventlet.reduceevent'
+    math = 'callchain.active_man.eventlet.mathevent'
+    truth = 'callchain.active_man.eventlet.truthevent'
 
 
 @appifies(KResult, KEventRoot, KEvent, KEventCall)

File callchain/active_man/eventlet.py

View file
 from callchain.keys.filter import KCollect, KSet, KSlice, KFilter
 from callchain.keys.base import KEventCall, KEvent, KLinked, KConfig
 
-__all__ = (
-    'mathevent', 'truthevent', 'reduceevent', 'collectevent', 'setevent',
-    'sliceevent', 'filterevent', 'delayevent', 'repeatevent', 'mapevent',
-    'randomevent', 'orderevent', 'eventlet', 'combineevent'
-)
-
 
 class eventlet(ChainletMixin, EventBranchMixin, BranchletMixin, ManQMixin):
 

File callchain/chainlets.py

View file
+# -*- coding: utf-8 -*-
+'''root chain mixins'''
+
+from appspace import NoAppError
+
+from callchain.core import ResetLocalMixin, CoreMixin
+
+
+class BranchletMixin(CoreMixin):
+
+    '''chainlet mixin'''
+
+    def _setup(self, root):
+        '''
+        configure chainlet
+
+        @param root: root chain
+        '''
+        super(BranchletMixin, self)._setup(root)
+        # sync with root postitional arguments
+        self._args = root._args
+        # sync with root keyword arguments
+        self._kw = root._kw
+        # sync with root callable
+        self._call = root._call
+        # sync with root incoming things and outgoing things
+        self.inclear().extend(root.incoming).outextend(root.outgoing)
+
+
+class ChainletMixin(ResetLocalMixin):
+
+    '''chainlet mixin'''
+
+    def _load(self, label):
+        '''
+        silent internal switch back...
+
+        @param label: appspaced thing label
+        '''
+        # fetch appspaced thing...
+        try:
+            return super(ChainletMixin, self)._load(label)
+        # ...or revert to root chain
+        except NoAppError:
+            return getattr(self.back(), label)
+
+    def _syncback(self, key, value):
+        '''
+        sync chainlet with root chain
+
+        @param key: key of value
+        @param value: value of value
+        '''
+        self.__dict__[key] = self.root.__dict__[key] = value
+
+    def back(self):
+        '''switch back to root chain'''
+        return self.root.back(self)

File callchain/events.py

-# -*- coding: utf-8 -*-
-'''root chain mixins'''
-
-from itertools import chain
-
-from stuf.utils import OrderedDict, lazy
-
-from callchain.managers import Events
-from callchain.chains import ChainMixin, BranchMixin, RootMixin
-
-
-class EventMixin(ChainMixin):
-
-    '''event chain mixin'''
-
-    @property
-    def _linkedchain(self):
-        '''new linked chain'''
-        return self._M.get('chain', 'event')(self)
-
-    def _events(self, *events):
-        '''calls bound to `events`'''
-        return chain(*tuple(self._imap(self._event, events)))
-
-    def commit(self):
-        '''run event chain'''
-        fire = self.fire
-        try:
-            # 1. "before" event 2. "work" event
-            fire('before', 'work')
-            # everything else
-            super(EventMixin, self).commit()
-            # 3. "change" event 4. "any" event 5. "after" event
-            fire('change', 'any', 'after')
-        except:
-            # 6. "problem" event
-            fire('problem')
-        finally:
-            # 7. event that runs "anyway"
-            return fire('anyway')
-
-    def fire(self, *events):
-        '''
-        run calls bound to `events` **NOW**
-
-        @param *events: event labels
-        '''
-        with self.ctx1(workq=self._WORKVAR):
-            return self.exhaustcall(
-                lambda x: x(), self._xtend(self._events(*events))._iterable,
-            )
-
-    def on(self, event, call, key=False, *args, **kw):
-        '''
-        bind call to `event`
-
-        @param event: event label
-        @param call: label for call or eventspaced thing
-        @param key: key label (default: False)
-        '''
-        self._eventq(event).chain(call, key, *args, **kw)
-        return self
-
-    def off(self, event):
-        '''
-        clear calls bound to `event`
-
-        @param event: event label
-        '''
-        self.E.unset(event)
-        return self
-
-    def trigger(self, *events):
-        '''
-        extend primary call chain with partials bound to `events`
-
-        @param *events: event labels
-        '''
-        self._chain.extend(self._events(*events))
-        return self
-
-    def queues(self, *events):
-        '''
-        ordered mapping of processing queues for `events`
-
-        @param *events: event labels
-        '''
-        return OrderedDict((e, self._eventq(e)) for e in events)
-
-
-class EventRootMixin(RootMixin):
-
-    '''root event mixin'''
-
-    def _eventq(self, event):
-        '''
-        linked chain bound to `event`
-
-        @param event: event label
-        '''
-        key = self.E.event(event)
-        # fetch linked chain bound to event
-        queue = self.E.get(key)
-        if queue is None:
-            # create linked chain if nonexistent
-            queue = self._linkedchain
-            self.E.on(key, queue)
-        return queue
-
-    def _event(self, event):
-        '''
-        calls bound to `event`
-
-        @param event: event label
-        '''
-        return self.E.events(self.E.event(event))
-
-
-class EventBranchMixin(BranchMixin):
-
-    '''event branch mixin'''
-
-    @lazy
-    def E(self):
-        '''local event registry'''
-        return Events('events')
-
-    def _eventq(self, event):
-        '''
-        linked chain bound to `event`
-
-        @param event: event label
-        '''
-        # fetch linked chain bound to event
-        key = self.root.event(event)
-        queue = self.E.get(key)
-        if queue is None:
-            # create linked chain if nonexistent
-            queue = self._linkedchain
-            self.E.on(key, queue)
-        return queue
-
-    def _event(self, event):
-        '''
-        calls bound to `event`
-
-        @param event: event label
-        '''
-        key = self.root.event(event)
-        return chain(self.E.events(key), self.root.E.events(key))

File callchain/keys/__init__.py

View file
 # -*- coding: utf-8 -*-
-'''callchain service keys'''
+'''callchain keys'''

File callchain/keys/base.py

View file
     E = Attribute('local event registry')
 
 
-class KLinked(KBranch):
-
-    '''linked chain mixin'''
-
-    def close():  # @NoSelf
-        '''close out linked chain and switch to root chain'''
-
-
 class KChainletKey(KBranch):
 
     def back():  # @NoSelf

File callchain/keys/core.py

-# -*- coding: utf-8 -*-
-'''callchain contrib keys'''
-
-from appspace.keys import Attribute, AppspaceKey
-
-
-class KThings(KService):
-
-    '''queuing key'''
-
-    incoming = Attribute('incoming queue')
-    outgoing = Attribute('outgoing queue')
-    balanced = Attribute('if incoming and outgoing things are balanced')
-
-    def __len__():  # @NoSelf
-        '''number of incoming things'''
-
-    def outcount():  # @NoSelf
-        '''number of outgoing things'''
-
-    ###########################################################################
-    ## queue clearance ########################################################
-    ###########################################################################
-
-    def clear():  # @NoSelf
-        '''clear every thing'''
-
-    def inclear():  # @NoSelf
-        '''clear incoming things'''
-
-    def outclear():  # @NoSelf
-        '''clear outgoing things'''
-
-    ###########################################################################
-    ## context rotation #######################################################
-    ###########################################################################
-
-    def ctx1(**kw):  # @NoSelf
-        '''swap to one-armed context'''
-
-    def ctx2(**kw):  # @NoSelf
-        '''swap to two-armed context'''
-
-    def ctx3(**kw):  # @NoSelf
-        '''swap to three-armed context'''
-
-    def ctx4(**kw):  # @NoSelf
-        '''swap to four-armed context'''
-
-    def autoctx(**kw):  # @NoSelf
-        '''swap to auto-synchronizing context'''
-
-    def ro():  # @NoSelf
-        '''swap to read-only context'''
-
-    def swap(**kw):  # @NoSelf
-        '''swap contexts'''
-
-    def reswap(self):  # @NoSelfs
-        '''swap to current preferred context'''
-
-    def unswap():  # @NoSelf
-        '''swap to default context'''
-
-    def rw():  # @NoSelf
-        '''swap to default context'''
-
-    ###########################################################################
-    ## current callable management ############################################
-    ###########################################################################
-
-    def args(*args, **kw):  # @NoSelf
-        '''arguments for current callable'''
-
-    def detap():  # @NoSelf
-        '''clear current callable'''
-
-    def wrap(call):  # @NoSelf
-        '''
-        build current callable from factory
-
-        @param call: a callable
-        '''
-
-    def unwrap():  # @NoSelf
-        '''clear factory'''
-
-    ###########################################################################
-    ## things rotation ########################################################
-    ###########################################################################
-
-    def outshift():  # @NoSelf
-        '''shift incoming things to outgoing things'''
-
-    def outsync():  # @NoSelf
-        '''
-        shift incoming things to outgoing things, clearing outgoing things
-        '''
-
-    def reup():  # @NoSelf
-        '''put incoming things in incoming things as one incoming thing'''
-
-    def shift():  # @NoSelf
-        '''shift outgoing things to incoming things'''
-
-    def sync():  # @NoSelf
-        '''
-        shift outgoing things to incoming things, clearing incoming things
-        '''
-
-    ###########################################################################
-    ## things appending #######################################################
-    ###########################################################################
-
-    def append(thing):  # @NoSelf
-        '''
-        append `thing` to right side of incoming things
-
-        @param thing: some thing
-        '''
-
-    def appendleft(thing):  # @NoSelf
-        '''
-        append `thing` to left side of incoming things
-
-        @param thing: some thing
-        '''
-
-    ###########################################################################
-    ## things extension #######################################################
-    ###########################################################################
-
-    def extend(things):  # @NoSelf
-        '''
-        extend right side of incoming things with `things`
-
-        @param thing: some things
-        '''
-
-    def extendleft(things):  # @NoSelf
-        '''
-        extend left side of incoming things with `things`
-
-        @param thing: some things
-        '''
-
-    def outextend(things):  # @NoSelf
-        '''
-        extend right side of outgoing things with `things`
-
-        @param thing: some things
-        '''
-
-    ###########################################################################
-    ## iteration runners ######################################################
-    ###########################################################################
-
-    def __iter__():  # @NoSelf
-        '''yield outgoing things, clearing outgoing things as it iterates'''
-
-    def breakcount(call, length, exception=StopIteration):  # @NoSelf
-        '''
-        rotate through iterator until it reaches its original length
-
-        @param iterable: an iterable to exhaust
-        '''
-
-    def exhaust(iterable, exception=StopIteration):  # @NoSelf
-        '''
-        call next on an iterator until it's exhausted
-
-        @param iterable: iterable to exhaust
-        @param exception: exception marking end of iteration
-        '''
-
-    def exhaustmap(map, call, filter=False, exception=StopIteration):  # @NoSelf @IgnorePep8
-        '''
-        call `next` on an iterator until it's exhausted
-
-        @param mapping: a mapping to exhaust
-        @param call: call to handle what survives the filter
-        @param filter: a filter to apply to mapping (default: `None`)
-        @param exception: exception sentinel (default: `StopIteration`)
-        '''
-
-    def iterexcept(call, exception, start=None):  # @NoSelf
-        '''
-        call a function repeatedly until an exception is raised
-
-        Converts a call-until-exception interface to an iterator interface.
-        Like `iter(call, sentinel)` but uses an exception instead of a sentinel
-        to end the loop.
-
-        Raymond Hettinger, Python Cookbook recipe # 577155
-        '''
-
-
-class KResult(KThings):
-
-    def end():  # @NoSelf
-        '''return outgoing things then clear out everything'''
-
-    def first():  # @NoSelf
-        '''first incoming thing'''
-
-    def last():  # @NoSelf
-        '''last incoming thing'''
-
-    def peek():  # @NoSelf
-        '''results from read-only context'''
-
-    def results():  # @NoSelf
-        '''yield outgoing things, clearing outgoing things as it iterates'''
-
-    def value():  # @NoSelf
-        '''return outgoing things and clear outgoing things'''
-
-
-class KLogger(KService):
-
-    '''logging key'''
-
-    logger = Attribute('the logger')
-
-    def debug(msg):  # @NoSelf
-        '''log debug message'''
-
-    def warning(msg):  # @NoSelf
-        '''log warning message'''
-
-    def info(msg):  # @NoSelf
-        '''log info message'''
-
-    def error(msg):  # @NoSelf
-        '''log error message'''
-
-    def critical(msg):  # @NoSelf
-        '''log critical message'''
-
-    def exception(msg):  # @NoSelf
-        '''log exception message'''

File callchain/keys/queue.py

View file
+# -*- coding: utf-8 -*-
+'''callchain contrib keys'''
+
+from appspace.keys import Attribute, AppspaceKey
+
+
+class KThings(KService):
+
+    '''queuing key'''
+
+    incoming = Attribute('incoming queue')
+    outgoing = Attribute('outgoing queue')
+    balanced = Attribute('if incoming and outgoing things are balanced')
+
+    def __len__():  # @NoSelf
+        '''number of incoming things'''
+
+    def outcount():  # @NoSelf
+        '''number of outgoing things'''
+
+    ###########################################################################
+    ## queue clearance ########################################################
+    ###########################################################################
+
+    def clear():  # @NoSelf
+        '''clear every thing'''
+
+    def inclear():  # @NoSelf
+        '''clear incoming things'''
+
+    def outclear():  # @NoSelf
+        '''clear outgoing things'''
+
+    ###########################################################################
+    ## context rotation #######################################################
+    ###########################################################################
+
+    def ctx1(**kw):  # @NoSelf
+        '''swap to one-armed context'''
+
+    def ctx2(**kw):  # @NoSelf
+        '''swap to two-armed context'''
+
+    def ctx3(**kw):  # @NoSelf
+        '''swap to three-armed context'''
+
+    def ctx4(**kw):  # @NoSelf
+        '''swap to four-armed context'''
+
+    def autoctx(**kw):  # @NoSelf
+        '''swap to auto-synchronizing context'''
+
+    def ro():  # @NoSelf
+        '''swap to read-only context'''
+
+    def swap(**kw):  # @NoSelf
+        '''swap contexts'''
+
+    def reswap(self):  # @NoSelfs
+        '''swap to current preferred context'''
+
+    def unswap():  # @NoSelf
+        '''swap to default context'''
+
+    def rw():  # @NoSelf
+        '''swap to default context'''
+
+    ###########################################################################
+    ## current callable management ############################################
+    ###########################################################################
+
+    def args(*args, **kw):  # @NoSelf
+        '''arguments for current callable'''
+
+    def detap():  # @NoSelf
+        '''clear current callable'''
+
+    def wrap(call):  # @NoSelf
+        '''
+        build current callable from factory
+
+        @param call: a callable
+        '''
+
+    def unwrap():  # @NoSelf
+        '''clear factory'''
+
+    ###########################################################################
+    ## things rotation ########################################################
+    ###########################################################################
+
+    def outshift():  # @NoSelf
+        '''shift incoming things to outgoing things'''
+
+    def outsync():  # @NoSelf
+        '''
+        shift incoming things to outgoing things, clearing outgoing things
+        '''
+
+    def reup():  # @NoSelf
+        '''put incoming things in incoming things as one incoming thing'''
+
+    def shift():  # @NoSelf
+        '''shift outgoing things to incoming things'''
+
+    def sync():  # @NoSelf
+        '''
+        shift outgoing things to incoming things, clearing incoming things
+        '''
+
+    ###########################################################################
+    ## things appending #######################################################
+    ###########################################################################
+
+    def append(thing):  # @NoSelf
+        '''
+        append `thing` to right side of incoming things
+
+        @param thing: some thing
+        '''
+
+    def appendleft(thing):  # @NoSelf
+        '''
+        append `thing` to left side of incoming things
+
+        @param thing: some thing
+        '''
+
+    ###########################################################################
+    ## things extension #######################################################
+    ###########################################################################
+
+    def extend(things):  # @NoSelf
+        '''
+        extend right side of incoming things with `things`
+
+        @param thing: some things
+        '''
+
+    def extendleft(things):  # @NoSelf
+        '''
+        extend left side of incoming things with `things`
+
+        @param thing: some things
+        '''
+
+    def outextend(things):  # @NoSelf
+        '''
+        extend right side of outgoing things with `things`
+
+        @param thing: some things
+        '''
+
+    ###########################################################################
+    ## iteration runners ######################################################
+    ###########################################################################
+
+    def __iter__():  # @NoSelf
+        '''yield outgoing things, clearing outgoing things as it iterates'''
+
+    def breakcount(call, length, exception=StopIteration):  # @NoSelf
+        '''
+        rotate through iterator until it reaches its original length
+
+        @param iterable: an iterable to exhaust
+        '''
+
+    def exhaust(iterable, exception=StopIteration):  # @NoSelf
+        '''
+        call next on an iterator until it's exhausted
+
+        @param iterable: iterable to exhaust
+        @param exception: exception marking end of iteration
+        '''
+
+    def exhaustmap(map, call, filter=False, exception=StopIteration):  # @NoSelf @IgnorePep8
+        '''
+        call `next` on an iterator until it's exhausted
+
+        @param mapping: a mapping to exhaust
+        @param call: call to handle what survives the filter
+        @param filter: a filter to apply to mapping (default: `None`)
+        @param exception: exception sentinel (default: `StopIteration`)
+        '''
+
+    def iterexcept(call, exception, start=None):  # @NoSelf
+        '''
+        call a function repeatedly until an exception is raised
+
+        Converts a call-until-exception interface to an iterator interface.
+        Like `iter(call, sentinel)` but uses an exception instead of a sentinel
+        to end the loop.
+
+        Raymond Hettinger, Python Cookbook recipe # 577155
+        '''
+
+
+class KResult(KThings):
+
+    def end():  # @NoSelf
+        '''return outgoing things then clear out everything'''
+
+    def first():  # @NoSelf
+        '''first incoming thing'''
+
+    def last():  # @NoSelf
+        '''last incoming thing'''
+
+    def peek():  # @NoSelf
+        '''results from read-only context'''
+
+    def results():  # @NoSelf
+        '''yield outgoing things, clearing outgoing things as it iterates'''
+
+    def value():  # @NoSelf
+        '''return outgoing things and clear outgoing things'''
+
+
+class KLogger(KService):
+
+    '''logging key'''
+
+    logger = Attribute('the logger')
+
+    def debug(msg):  # @NoSelf
+        '''log debug message'''
+
+    def warning(msg):  # @NoSelf
+        '''log warning message'''
+
+    def info(msg):  # @NoSelf
+        '''log info message'''
+
+    def error(msg):  # @NoSelf
+        '''log error message'''
+
+    def critical(msg):  # @NoSelf
+        '''log critical message'''
+
+    def exception(msg):  # @NoSelf
+        '''log exception message'''

File callchain/lazy_auto/chain.py

View file
 
 from callchain.chain import RootMixin
 from callchain.config import Defaults
-from callchain.patterns import Pathways, Nameways
+from callchain.patterns import Pathways
 from callchain.keys.core import KThings, KResult
 from callchain.keys.base import KRoot, KCall, KChain
 from callchain.call import ChainMixin, PriorityMixin, inside
 
 
 class thingchain(Pathways):
-    
-    class loads(Nameways):
-        key = 'callchain.keys.loads.KLoads'
-        loads = 'callchain.services.loads.Loads'
-
-    class dumps(Nameways):
-        key = 'callchain.keys.dumps.KDumps'
-        loads = 'callchain.services.dumps.Dumps'
-
-    class logger(Nameways):
-        key = 'callchain.keys.core.KLogger'
-        logger = 'callchain.services.core.loglet'
+    loads = 'callchain.services.loads.Loads'
+    dumps = 'callchain.services.dumps.Dumps'
+    logger = 'callchain.services.core.loglet'
 
 
 @appifies(KThings, KRoot, KChain, KCall)
 
 
 class chain(Pathways):
-
-    class loads(Nameways):
-        key = 'callchain.keys.loads.KLoads'
-        loads = 'callchain.services.loads.Loads'
-
-    class dumps(Nameways):
-        key = 'callchain.keys.dumps.KDumps'
-        loads = 'callchain.services.dumps.Dumps'
-
-    class logger(Nameways):
-        key = 'callchain.keys.core.KLogger'
-        logger = 'callchain.services.core.loglet'
-
-    class filter(Nameways):
-        key = 'callchain.keys.filter.KFilter'
-        filter = 'callchain.lazy_auto.chainlet.filterchain'
-
-    class collect(Nameways):
-        key = 'callchain.keys.filter.KCollect'
-        collect = 'callchain.lazy_auto.chainlet.collectchain'
-
-    class set(Nameways):
-        key = 'callchain.keys.filter.KSet'
-        set = 'callchain.lazy_auto.chainlet.setchain'
-
-    class slice(Nameways):
-        key = 'callchain.keys.filter.KSlice'
-        slice = 'callchain.lazy_auto.chainlet.slicechain'
-
-    class combine(Nameways):
-        key = 'callchain.keys.order.KCombine'
-        combine = 'callchain.lazy_auto.chainlet.combinechain'
-
-    class map(Nameways):
-        key = 'callchain.keys.map.KMap'
-        map = 'callchain.lazy_auto.chainlet.mapchain'
-
-    class delay(Nameways):
-        key = 'callchain.keys.map.KDelay'
-        delay = 'callchain.lazy_auto.chainlet.delaychain'
-
-    class repeat(Nameways):
-        key = 'callchain.keys.map.KRepeat'
-        repeat = 'callchain.lazy_auto.chainlet.repeatchain'
-
-    class order(Nameways):
-        key = 'callchain.keys.order.KOrder'
-        order = 'callchain.lazy_auto.chainlet.orderchain'
-
-    class random(Nameways):
-        key = 'callchain.keys.order.KRandom'
-        random = 'callchain.lazy_auto.chainlet.randomchain'
-
-    class reduce(Nameways):
-        key = 'callchain.keys.reduce.KReduce'
-        reduce = 'callchain.lazy_auto.chainlet.reducechain'
-
-    class math(Nameways):
-        key = 'callchain.keys.reduce.KMath'
-        math = 'callchain.lazy_auto.chainlet.mathchain'
-
-    class truth(Nameways):
-        key = 'callchain.keys.reduce.KTruth'
-        truth = 'callchain.lazy_auto.chainlet.truthchain'
+    loads = 'callchain.services.loads.Loads'
+    dumps = 'callchain.services.dumps.Dumps'
+    logger = 'callchain.services.core.loglet'
+    filter = 'callchain.lazy_auto.chainlet.filterchain'
+    collect = 'callchain.lazy_auto.chainlet.collectchain'
+    set = 'callchain.lazy_auto.chainlet.setchain'
+    slice = 'callchain.lazy_auto.chainlet.slicechain'
+    combine = 'callchain.lazy_auto.chainlet.combinechain'
+    map = 'callchain.lazy_auto.chainlet.mapchain'
+    delay = 'callchain.lazy_auto.chainlet.delaychain'
+    repeat = 'callchain.lazy_auto.chainlet.repeatchain'
+    order = 'callchain.lazy_auto.chainlet.orderchain'
+    random = 'callchain.lazy_auto.chainlet.randomchain'
+    reduce = 'callchain.lazy_auto.chainlet.reducechain'
+    math = 'callchain.lazy_auto.chainlet.mathchain'
+    truth = 'callchain.lazy_auto.chainlet.truthchain'
 
 
 @appifies(KResult, KRoot, KChain, KCall)

File callchain/lazy_auto/chainlet.py

View file
 from callchain.keys.base import KCall, KChain, KConfig, KLinked
 from callchain.keys.filter import KCollect, KSet, KSlice, KFilter
 
-__all__ = (
-    'mathchain', 'truthchain', 'reducechain', 'collectchain', 'setchain',
-    'slicechain', 'filterchain', 'delaychain', 'repeatchain', 'mapchain',
-    'randomchain', 'orderchain', 'chainlet', 'combinechain',
-)
-
 
 class chainlet(ChainletMixin, BranchMixin, BranchletMixin, AutoQMixin):
 

File callchain/lazy_auto/event.py

View file
 
 class thingevent(Pathways):
     chain = 'callchain.lazy_auto.chainlet.chainlink'
-
-    class loads(Nameways):
-        key = 'callchain.keys.loads.KLoads'
-        loads = 'callchain.services.loads.Loads'
-
-    class dumps(Nameways):
-        key = 'callchain.keys.dumps.KDumps'
-        loads = 'callchain.services.dumps.Dumps'
-
-    class logger(Nameways):
-        key = 'callchain.keys.core.KLogger'
-        logger = 'callchain.services.core.loglet'
+    loads = 'callchain.services.loads.Loads'
+    dumps = 'callchain.services.dumps.Dumps'
+    logger = 'callchain.services.core.loglet'
 
 
 @appifies(KThings, KEventRoot, KEvent, KEventCall)
 
 class event(Pathways):
     chain = 'callchain.lazy_auto.chainlet.chainlink'
-
-    class loads(Nameways):
-        key = 'callchain.keys.loads.KLoads'
-        loads = 'callchain.services.loads.Loads'
-
-    class dumps(Nameways):
-        key = 'callchain.keys.dumps.KDumps'
-        loads = 'callchain.services.dumps.Dumps'
-
-    class logger(Nameways):
-        key = 'callchain.keys.core.KLogger'
-        logger = 'callchain.services.core.loglet'
-
-    class filter(Nameways):
-        key = 'callchain.keys.filter.KFilter'
-        filter = 'callchain.lazy_auto.eventlet.filterevent'
-
-    class collect(Nameways):
-        key = 'callchain.keys.filter.KCollect'
-        collect = 'callchain.lazy_auto.eventlet.collectevent'
-
-    class combine(Nameways):
-        key = 'callchain.keys.order.KCombine'
-        combine = 'callchain.lazy_auto.eventlet.combineevent'
-
-    class set(Nameways):
-        key = 'callchain.keys.filter.KSet'
-        set = 'callchain.lazy_auto.eventlet.setevent'
-
-    class slice(Nameways):
-        key = 'callchain.keys.filter.KSlice'
-        slice = 'callchain.lazy_auto.eventlet.sliceevent'
-
-    class map(Nameways):
-        key = 'callchain.keys.map.KMap'
-        map = 'callchain.lazy_auto.eventlet.mapevent'
-
-    class delay(Nameways):
-        key = 'callchain.keys.map.KDelay'
-        delay = 'callchain.lazy_auto.eventlet.delayevent'
-
-    class repeat(Nameways):
-        key = 'callchain.keys.map.KRepeat'
-        repeat = 'callchain.lazy_auto.eventlet.repeatevent'
-
-    class order(Nameways):
-        key = 'callchain.keys.order.KOrder'
-        order = 'callchain.lazy_auto.eventlet.orderevent'
-
-    class random(Nameways):
-        key = 'callchain.keys.order.KRandom'
-        random = 'callchain.lazy_auto.eventlet.randomevent'
-
-    class reduce(Nameways):
-        key = 'callchain.keys.reduce.KReduce'
-        reduce = 'callchain.lazy_auto.eventlet.reduceevent'
-
-    class math(Nameways):
-        key = 'callchain.keys.reduce.KMath'
-        math = 'callchain.lazy_auto.eventlet.mathevent'
-
-    class truth(Nameways):
-        key = 'callchain.keys.reduce.KTruth'
-        truth = 'callchain.lazy_auto.eventlet.truthevent'
+    loads = 'callchain.services.loads.Loads'
+    dumps = 'callchain.services.dumps.Dumps'
+    logger = 'callchain.services.core.loglet'
+    filter = 'callchain.lazy_auto.eventlet.filterevent'
+    collect = 'callchain.lazy_auto.eventlet.collectevent'
+    combine = 'callchain.lazy_auto.eventlet.combineevent'
+    set = 'callchain.lazy_auto.eventlet.setevent'
+    slice = 'callchain.lazy_auto.eventlet.sliceevent'
+    map = 'callchain.lazy_auto.eventlet.mapevent'
+    delay = 'callchain.lazy_auto.eventlet.delayevent'
+    repeat = 'callchain.lazy_auto.eventlet.repeatevent'
+    order = 'callchain.lazy_auto.eventlet.orderevent'
+    random = 'callchain.lazy_auto.eventlet.randomevent'
+    reduce = 'callchain.lazy_auto.eventlet.reduceevent'
+    math = 'callchain.lazy_auto.eventlet.mathevent'
+    truth = 'callchain.lazy_auto.eventlet.truthevent'
 
 
 @appifies(KResult, KEventRoot, KEvent, KEventCall)

File callchain/lazy_auto/eventlet.py

View file
 from callchain.keys.filter import KCollect, KSet, KSlice, KFilter
 from callchain.keys.base import KEventCall, KEvent, KLinked, KConfig
 
-__all__ = (
-    'mathevent', 'truthevent', 'reduceevent', 'collectevent', 'setevent',
-    'sliceevent', 'filterevent', 'delayevent', 'repeatevent', 'mapevent',
-    'randomevent', 'orderevent', 'eventlet', 'combineevent'
-)
-
 
 class eventlet(ChainletMixin, EventBranchMixin, BranchletMixin, AutoQMixin):
 

File callchain/lazy_man/chain.py

View file
 
 
 class thingchain(Pathways):
-    
-    class loads(Nameways):
-        key = 'callchain.keys.loads.KLoads'
-        loads = 'callchain.services.loads.Loads'
-
-    class dumps(Nameways):
-        key = 'callchain.keys.dumps.KDumps'
-        loads = 'callchain.services.dumps.Dumps'
-
-    class logger(Nameways):
-        key = 'callchain.keys.core.KLogger'
-        logger = 'callchain.services.core.loglet'
+    loads = 'callchain.services.loads.Loads'
+    dumps = 'callchain.services.dumps.Dumps'
+    logger = 'callchain.services.core.loglet'
 
 
 @appifies(KThings, KRoot, KChain, KCall)
 
 
 class chain(Pathways):
-
-    class loads(Nameways):
-        key = 'callchain.keys.loads.KLoads'
-        loads = 'callchain.services.loads.Loads'
-
-    class dumps(Nameways):
-        key = 'callchain.keys.dumps.KDumps'
-        loads = 'callchain.services.dumps.Dumps'
-
-    class logger(Nameways):
-        key = 'callchain.keys.core.KLogger'
-        logger = 'callchain.services.core.loglet'
-
-    class filter(Nameways):
-        key = 'callchain.keys.filter.KFilter'
-        filter = 'callchain.lazy_man.chainlet.filterchain'
-
-    class collect(Nameways):
-        key = 'callchain.keys.filter.KCollect'
-        collect = 'callchain.lazy_man.chainlet.collectchain'
-
-    class set(Nameways):
-        key = 'callchain.keys.filter.KSet'
-        set = 'callchain.lazy_man.chainlet.setchain'
-
-    class slice(Nameways):
-        key = 'callchain.keys.filter.KSlice'
-        slice = 'callchain.lazy_man.chainlet.slicechain'
-
-    class combine(Nameways):
-        key = 'callchain.keys.order.KCombine'
-        combine = 'callchain.lazy_man.chainlet.combinechain'
-
-    class map(Nameways):
-        key = 'callchain.keys.map.KMap'
-        map = 'callchain.lazy_man.chainlet.mapchain'
-
-    class delay(Nameways):
-        key = 'callchain.keys.map.KDelay'
-        delay = 'callchain.lazy_man.chainlet.delaychain'
-
-    class repeat(Nameways):
-        key = 'callchain.keys.map.KRepeat'
-        repeat = 'callchain.lazy_man.chainlet.repeatchain'
-
-    class order(Nameways):
-        key = 'callchain.keys.order.KOrder'
-        order = 'callchain.lazy_man.chainlet.orderchain'
-
-    class random(Nameways):
-        key = 'callchain.keys.order.KRandom'
-        random = 'callchain.lazy_man.chainlet.randomchain'
-
-    class reduce(Nameways):
-        key = 'callchain.keys.reduce.KReduce'
-        reduce = 'callchain.lazy_man.chainlet.reducechain'
-
-    class math(Nameways):
-        key = 'callchain.keys.reduce.KMath'
-        math = 'callchain.lazy_man.chainlet.mathchain'
-
-    class truth(Nameways):
-        key = 'callchain.keys.reduce.KTruth'
-        truth = 'callchain.lazy_man.chainlet.truthchain'
+    loads = 'callchain.services.loads.Loads'
+    dumps = 'callchain.services.dumps.Dumps'
+    logger = 'callchain.services.core.loglet'
+    filter = 'callchain.lazy_man.chainlet.filterchain'
+    collect = 'callchain.lazy_man.chainlet.collectchain'
+    set = 'callchain.lazy_man.chainlet.setchain'
+    slice = 'callchain.lazy_man.chainlet.slicechain'
+    combine = 'callchain.lazy_man.chainlet.combinechain'
+    map = 'callchain.lazy_man.chainlet.mapchain'
+    delay = 'callchain.lazy_man.chainlet.delaychain'
+    repeat = 'callchain.lazy_man.chainlet.repeatchain'
+    order = 'callchain.lazy_man.chainlet.orderchain'
+    random = 'callchain.lazy_man.chainlet.randomchain'
+    reduce = 'callchain.lazy_man.chainlet.reducechain'
+    math = 'callchain.lazy_man.chainlet.mathchain'
+    truth = 'callchain.lazy_man.chainlet.truthchain'
 
 
 @appifies(KResult, KRoot, KChain, KCall)

File callchain/lazy_man/chainlet.py

View file
 from callchain.keys.base import KCall, KChain, KConfig, KLinked
 from callchain.keys.filter import KCollect, KSet, KSlice, KFilter
 
-__all__ = (
-    'mathchain', 'truthchain', 'reducechain', 'collectchain', 'setchain',
-    'slicechain', 'filterchain', 'delaychain', 'repeatchain', 'mapchain',
-    'randomchain', 'orderchain', 'chainlet', 'combinechain',
-)
-
 
 class chainlet(ChainletMixin, BranchMixin, BranchletMixin, ManQMixin):
 

File callchain/lazy_man/event.py

View file
 
 class thingevent(Pathways):
     chain = 'callchain.lazy_man.chainlet.chainlink'
-
-    class loads(Nameways):
-        key = 'callchain.keys.loads.KLoads'
-        loads = 'callchain.services.loads.Loads'
-
-    class dumps(Nameways):
-        key = 'callchain.keys.dumps.KDumps'
-        loads = 'callchain.services.dumps.Dumps'
-
-    class logger(Nameways):
-        key = 'callchain.keys.core.KLogger'
-        logger = 'callchain.services.core.loglet'
+    loads = 'callchain.services.loads.Loads'
+    dumps = 'callchain.services.dumps.Dumps'
+    logger = 'callchain.services.core.loglet'
 
 
 @appifies(KThings, KEventRoot, KEvent, KEventCall)
 
 class event(Pathways):
     chain = 'callchain.lazy_man.chainlet.chainlink'
-
-    class loads(Nameways):
-        key = 'callchain.keys.loads.KLoads'
-        loads = 'callchain.services.loads.Loads'
-
-    class dumps(Nameways):
-        key = 'callchain.keys.dumps.KDumps'
-        loads = 'callchain.services.dumps.Dumps'
-
-    class logger(Nameways):
-        key = 'callchain.keys.core.KLogger'
-        logger = 'callchain.services.core.loglet'
-
-    class filter(Nameways):
-        key = 'callchain.keys.filter.KFilter'
-        filter = 'callchain.lazy_man.eventlet.filterevent'
-
-    class collect(Nameways):
-        key = 'callchain.keys.filter.KCollect'
-        collect = 'callchain.lazy_man.eventlet.collectevent'
-
-    class combine(Nameways):
-        key = 'callchain.keys.order.KCombine'
-        combine = 'callchain.lazy_man.eventlet.combineevent'
-
-    class set(Nameways):
-        key = 'callchain.keys.filter.KSet'
-        set = 'callchain.lazy_man.eventlet.setevent'
-
-    class slice(Nameways):
-        key = 'callchain.keys.filter.KSlice'
-        slice = 'callchain.lazy_man.eventlet.sliceevent'
-
-    class map(Nameways):
-        key = 'callchain.keys.map.KMap'
-        map = 'callchain.lazy_man.eventlet.mapevent'
-
-    class delay(Nameways):
-        key = 'callchain.keys.map.KDelay'
-        delay = 'callchain.lazy_man.eventlet.delayevent'
-
-    class repeat(Nameways):
-        key = 'callchain.keys.map.KRepeat'
-        repeat = 'callchain.lazy_man.eventlet.repeatevent'
-
-    class order(Nameways):
-        key = 'callchain.keys.order.KOrder'
-        order = 'callchain.lazy_man.eventlet.orderevent'
-
-    class random(Nameways):
-        key = 'callchain.keys.order.KRandom'
-        random = 'callchain.lazy_man.eventlet.randomevent'
-
-    class reduce(Nameways):
-        key = 'callchain.keys.reduce.KReduce'
-        reduce = 'callchain.lazy_man.eventlet.reduceevent'
-
-    class math(Nameways):
-        key = 'callchain.keys.reduce.KMath'
-        math = 'callchain.lazy_man.eventlet.mathevent'
-
-    class truth(Nameways):
-        key = 'callchain.keys.reduce.KTruth'
-        truth = 'callchain.lazy_man.eventlet.truthevent'
+    loads = 'callchain.services.loads.Loads'
+    dumps = 'callchain.services.dumps.Dumps'
+    logger = 'callchain.services.core.loglet'
+    filter = 'callchain.lazy_man.eventlet.filterevent'
+    collect = 'callchain.lazy_man.eventlet.collectevent'
+    combine = 'callchain.lazy_man.eventlet.combineevent'
+    set = 'callchain.lazy_man.eventlet.setevent'
+    slice = 'callchain.lazy_man.eventlet.sliceevent'
+    map = 'callchain.lazy_man.eventlet.mapevent'
+    delay = 'callchain.lazy_man.eventlet.delayevent'
+    repeat = 'callchain.lazy_man.eventlet.repeatevent'
+    order = 'callchain.lazy_man.eventlet.orderevent'
+    random = 'callchain.lazy_man.eventlet.randomevent'
+    reduce = 'callchain.lazy_man.eventlet.reduceevent'
+    math = 'callchain.lazy_man.eventlet.mathevent'
+    truth = 'callchain.lazy_man.eventlet.truthevent'
 
 
 @appifies(KResult, KEventRoot, KEvent, KEventCall)

File callchain/lazy_man/eventlet.py

View file
 from callchain.keys.filter import KCollect, KSet, KSlice, KFilter
 from callchain.keys.base import KEventCall, KEvent, KLinked, KConfig
 
-__all__ = (
-    'mathevent', 'truthevent', 'reduceevent', 'collectevent', 'setevent',
-    'sliceevent', 'filterevent', 'delayevent', 'repeatevent', 'mapevent',
-    'randomevent', 'orderevent', 'eventlet', 'combineevent'
-)
-
 
 class eventlet(ChainletMixin, EventBranchMixin, BranchletMixin, ManQMixin):
 

File callchain/lets.py

-# -*- coding: utf-8 -*-
-'''root chain mixins'''
-
-import codecs
-
-from itertools import count
-from functools import partial
-
-from appspace import NoAppError
-from twoq.support import isstring
-from appspace.builders import Appspace
-from stuf.utils import lazy, lazy_class
-
-from callchain.keys.base import NoServiceError
-from callchain.core import ResetLocalMixin, CoreMixin, ConfigMixin
-from callchain.support import Empty, Queue, PriorityQueue, total_ordering
-
-
-@total_ordering
-class _Partial(object):
-
-    '''partial wrapper'''
-
-    __slots__ = ('_call', 'count', '__call__')
-
-    counter = count()
-
-    def __init__(self, call, *args, **settings):
-        self.__call__ = partial(call, *args, **settings)
-        priority = settings.pop('priority', None)
-        self.count = next(self.counter) if priority is None else priority
-
-    def __lt__(self, other):
-        return self.count < other
-
-
-class RootMixin(ResetLocalMixin):
-
-    '''root chain mixin'''
-
-    def __init__(self, **kw):
-        super(RootMixin, self).__init__()
-        if self.M is not None:
-            # freeze external appspace global settings
-            self.M.freeze(kw)
-        else:
-            self.M = None
-
-    def __call__(self, *args):
-        '''new chain session'''
-        # clear call chain and queues and extend incoming things
-        return self.clear().extend(args)
-
-    @lazy_class
-    def port(self):
-        '''python 2.x <-> python 3.x porting helper'''
-        from twoq.support import port
-        return port
-
-    def back(self, branch):
-        '''
-        handle switch from branch chain
-
-        @param branch: branch chain
-        '''
-        self.clear()
-        # sync with branch callable
-        self._call = branch._call
-        # sync with branch postitional arguments
-        self._args = branch._args
-        # sync with branch keyword arguments
-        self._kw = branch._kw
-        # sync with branch incoming and outgoing things
-        return self.extend(branch.incoming).outextend(branch.outgoing)
-
-    def read(self, mode='rb', encoding=None, errors='strict', *paths):
-        '''
-        read incoming things from files
-
-        @param mode: mode to open files (default: 'r')
-        @param encoding: encoding for text data (default: `None`)
-        @param errors: error handling in encoding text data (default: 'strict')
-        @param *paths: sequence of filesystem paths
-        '''
-        with self._context:
-            append = self._append
-            for path in paths:
-                with codecs.open(path, mode, encoding) as f:
-                    append(f.read())
-        return self
-
-    def write(self, mode='rb', encoding=None, errors='strict', *paths):
-        '''
-        write outgoing things to files
-
-        @param mode: mode to open files (default: 'r')
-        @param encoding: encoding for text data (default: `None`)
-        @param errors: error handling in encoding text data (default: 'strict')
-        @param *paths: sequence of filesystem paths
-        '''
-        values = self.value()
-        for idx, path in enumerate(paths):
-            with codecs.open(path, mode, encoding) as f:
-                f.write(values[idx])
-        return self
-
-    def join(self, *things):
-        '''
-        join things to session
-
-        @param things: some things
-        '''
-        # root internal global settings
-        G = self.G
-        # root external appspace manager
-        M = self.M
-        for thing in things:
-            # add session
-            thing.root = self
-            # root internal global settings
-            thing.G = G
-            # root external appspace manager
-            thing.M = M
-        return self
-
-
-class BranchMixin(ResetLocalMixin):
-
-    ''''branch mixin'''
-
-    def _setup(self, root):
-        '''
-        configure branch
-
-        @param root: root chain
-        '''
-        super(BranchMixin, self)._setup(root)
-        root.join(self)
-
-
-#    def __init__(self, manager, key):
-#        '''
-#        init
-#
-#        @param manager: main spine
-#        @param key: settings key
-#        '''
-#        super(Spinelet, self).__init__(manager)
-#        # add external application appspace
-#        self.M = manager.M
-#        # add internal application appspace
-#        self._M = manager._M
-#        # add internal application settings
-#        self._G = manager._G
-#        # appspace name
-#        self.appspace = self._G.appspace
-#        # namespace name
-#        self.namespace = self._G[key]
-#
-#    def _configure(self, label):
-#        '''
-#        configure appspace class
-#
-#        @param label: application label
-#        '''
-#        app = self._M.get(label, self.appspace)
-#        # add external application appspace
-#        app.M = self.M
-#        # add external application settings
-#        app.G = self.M.settings.final
-#        return app
-#
-#    @property
-#    def Manager(self):
-#        '''configured manager class'''
-#        app = self._M.get(self.appspace).get(self.namespace.manager)
-#        # add external application appspace
-#        app.M = self.M
-#        return app
-#
-#    def __init__(self, manager):
-#        '''
-#        init
-#
-#        @param manager: main spine
-#        '''
-#        super(Descriptor, self).__init__(manager)
-#        # add internal application appspace
-#        self._M = manager._M
-#        # add internal application settings
-#        self._G = manager._G
-#        # appspace name
-#        self.appspace = self._G.appspace
-#        # namespace name
-#        self.namespace = self._G.base
-#
-#    def _get(self, label):
-#        return self._M.get(label, self.appspace)
-
-
-class BranchletMixin(CoreMixin):
-
-    '''chainlet mixin'''
-
-    def _setup(self, root):
-        '''
-        configure chainlet
-
-        @param root: root chain
-        '''
-        super(BranchletMixin, self)._setup(root)
-        # sync with root postitional arguments
-        self._args = root._args
-        # sync with root keyword arguments
-        self._kw = root._kw
-        # sync with root callable
-        self._call = root._call
-        # sync with root incoming things and outgoing things
-        self.inclear().extend(root.incoming).outextend(root.outgoing)
-
-
-class LinkedMixin(ResetLocalMixin):
-
-    '''linked chain mixin'''
-
-    def close(self):
-        '''close out linked chain and switch to root chain'''
-        return self.root.back(self)
-
-
-class ChainletMixin(ResetLocalMixin):
-
-    '''chainlet mixin'''
-
-    def _load(self, label):
-        '''
-        silent internal switch back...
-
-        @param label: appspaced thing label
-        '''
-        # fetch appspaced thing...
-        try:
-            return super(ChainletMixin, self)._load(label)
-        # ...or revert to root chain
-        except NoAppError:
-            return getattr(self.back(), label)
-
-    def _syncback(self, key, value):
-        '''
-        sync chainlet with root chain
-
-        @param key: key of value
-        @param value: value of value
-        '''
-        self.__dict__[key] = self.root.__dict__[key] = value
-
-    def back(self):
-        '''switch back to root chain'''
-        return self.root.back(self)
-
-
-class CallMixin(ConfigMixin):
-
-    '''chain mixin'''
-
-    def __enter__(self):
-        '''enter execution context'''
-        return self
-
-    def __exit__(self, e, t, b):
-        '''exit execution context'''
-        # invoke call chain
-        self.commit()
-
-    def _load(self, label):
-        '''
-        silent internal switch to...
-
-        @param label: label of appspaced thing
-        '''
-        try:
-            # look up internal appspaced linked call chain...
-            _M = self._M
-            key = _M.service(label)
-            return getattr(_M.get(key, key)(self), label)
-        except NoServiceError:
-            # ...or lookup some other appspaced thing
-            return super(CallMixin, self)._load(label)
-
-    @lazy
-    def space(self):
-        '''external appspace interface'''
-        return Appspace(self.M) if self.M is not None else None
-
-    def _setup(self, root):
-        '''call chain setup'''
-        # call chain queue
-        self._chain = self._queue()
-
-    def chain(self, call, key=False, *args, **kw):
-        '''
-        add `call` or appspaced `call` to call chain, partializing it with any
-        passed arguments
-
-        @param call: call or appspaced call label
-        @param key: appspace key (default: False)
-        '''