From 3d9c9122b13a224ac8d9271eb57bffd3326b107d Mon Sep 17 00:00:00 2001 From: alex_nanou Date: Fri, 24 Nov 2006 12:03:23 +0000 Subject: [PATCH] removed generator imports (style incompatibility with Py25) --- CHANGES | 2 +- PKG-INFO | 2 +- pli/functional.py | 4 +-- pli/importutils.py | 4 +-- pli/objutils.py | 4 +-- pli/pattern/proxy/generic.py | 13 ++++----- pli/pattern/state/fsm.py | 62 ++++++++++++++++++++++++------------------- pli/pattern/store/misc.py | 4 +-- pli/persistance/sql/core.py | 2 +- pli/persistance/sql/shelve.py | 2 +- 10 files changed, 54 insertions(+), 45 deletions(-) diff --git a/CHANGES b/CHANGES index 19c9887..ad5b394 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -# this file was generated on [200607120012] +# this file was generated on [200611241457] pli changes: version 0.0.166 (200512090249): diff --git a/PKG-INFO b/PKG-INFO index cb4d68a..8b943db 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: pli -Version: 0.0.178 +Version: 0.0.180 Summary: PLI: a utility library for the Python language. Home-page: http://pli.sourceforge.net/ Author: Alex A. Naanou diff --git a/pli/functional.py b/pli/functional.py index 6658933..798b057 100644 --- a/pli/functional.py +++ b/pli/functional.py @@ -1,13 +1,13 @@ #======================================================================= __version__ = '''0.5.14''' -__sub_version__ = '''20050331025621''' +__sub_version__ = '''20061124145258''' __copyright__ = '''(c) Alex A. Naanou 2003''' #----------------------------------------------------------------------- -from __future__ import generators +##from __future__ import generators import new ##import pli.pattern.proxy as proxy diff --git a/pli/importutils.py b/pli/importutils.py index 4095776..716da8a 100644 --- a/pli/importutils.py +++ b/pli/importutils.py @@ -1,13 +1,13 @@ #======================================================================= __version__ = '''0.0.19''' -__sub_version__ = '''20051130145500''' +__sub_version__ = '''20061124145335''' __copyright__ = '''(c) Alex A. Naanou 2003''' #----------------------------------------------------------------------- -from __future__ import generators +##from __future__ import generators import os import sys diff --git a/pli/objutils.py b/pli/objutils.py index c4c3019..e82ee86 100644 --- a/pli/objutils.py +++ b/pli/objutils.py @@ -1,13 +1,13 @@ #======================================================================= __version__ = '''0.0.22''' -__sub_version__ = '''20040729152425''' +__sub_version__ = '''20061124145342''' __copyright__ = '''(c) Alex A. Naanou 2003''' #----------------------------------------------------------------------- -from __future__ import generators +##from __future__ import generators import types import new diff --git a/pli/pattern/proxy/generic.py b/pli/pattern/proxy/generic.py index abed111..8c79919 100644 --- a/pli/pattern/proxy/generic.py +++ b/pli/pattern/proxy/generic.py @@ -1,7 +1,7 @@ #======================================================================= __version__ = '''0.1.19''' -__sub_version__ = '''20051212004445''' +__sub_version__ = '''20060718234014''' __copyright__ = '''(c) Alex A. Naanou 2003''' @@ -10,6 +10,9 @@ __copyright__ = '''(c) Alex A. Naanou 2003''' # TODO solve the infinite recursion problem when trying to call the # parents __call__ method (may not be the only one affected) from # a recursive proxy... +# TODO might be a good idea to split this in two: +# generic.py - will contain the generic proxy interface. +# inherit.py - will contain the inherit proxy infrastructure. __doc__ = '''\ this module will define a set of utilities and classes to be used to build @@ -200,7 +203,7 @@ class ComparibleProxyMixin(AbstractProxy): proxy mixin. this will transfer the rich comparison calls directly to the target... ''' - __proxy_target_attr_name__ = 'proxy_target' +## __proxy_target_attr_name__ = 'proxy_target' # these cant be avoided without eval... def __eq__(self, other): @@ -252,7 +255,7 @@ class CachedProxyMixin(AbstractProxy): cls._setcache(source, obj) return obj return super(CachedProxyMixin, cls).__new__(cls, source, *p, **n) -## @classmethod + @classmethod def _getcached(cls, source): ''' ''' @@ -260,14 +263,12 @@ class CachedProxyMixin(AbstractProxy): and source in cls.__proxy_cache__: return cls.__proxy_cache__[source] return None - _getcached = classmethod(_getcached) -## @classmethod + @classmethod def _setcache(cls, source, obj): ''' ''' if hasattr(cls, '__proxy_cache__') and cls.__proxy_cache__ != None: cls.__proxy_cache__[source] = obj - _setcache = classmethod(_setcache) #---------------------------------------------------GetattrProxyMixin--- diff --git a/pli/pattern/state/fsm.py b/pli/pattern/state/fsm.py index 936237f..ac380fd 100644 --- a/pli/pattern/state/fsm.py +++ b/pli/pattern/state/fsm.py @@ -1,7 +1,7 @@ #======================================================================= __version__ = '''0.3.41''' -__sub_version__ = '''20060712001024''' +__sub_version__ = '''20060731164833''' __copyright__ = '''(c) Alex A. Naanou 2003''' @@ -286,42 +286,49 @@ class FiniteStateMachine(state.State): ## raise FiniteStateMachineError, 'can\'t start a raw FSM object (change to a valid state).' # start the loop... if hasattr(self, '__auto_change_state__') and self.__auto_change_state__: - if hasattr(self, '_running') and self._running: + if hasattr(self, '_fsm_running') and self._fsm_running: raise FiniteStateMachineError, 'the %s FSM is already running.' % self - self._running = True try: - while True: - # break on terminal state... - if isterminal(self): - # fire the state stop event... - evt_name = 'onStop' + self.__class__.__name__ - if hasattr(self, evt_name): - getattr(self, evt_name).fire() - # exit... - break -## # handle stops... -## if self._running == False: -## if self._stop_exception != None: -## raise self._stop_exception, self._stop_reason -## return self._stop_reason - if self.__next_state__ != None: - # change state... - tostate = self.__next_state__ - self.__next_state__ = None - self._changestate(tostate) - except FiniteStateMachineStop: - pass - self._running = False + self._fsm_running = True + try: + while True: + # break on terminal state... + if isterminal(self): + # fire the state stop event... + evt_name = 'onStop' + self.__class__.__name__ + if hasattr(self, evt_name): + getattr(self, evt_name).fire() + # exit... + break +## # handle stops... +## if self._fsm_running == False: +## if self._stop_exception != None: +## raise self._stop_exception, self._stop_reason +## return self._stop_reason + if self.__next_state__ != None: + # change state... + tostate = self.__next_state__ + self.__next_state__ = None + self._changestate(tostate) + except FiniteStateMachineStop: + pass + finally: + self._fsm_running = False # fire the fsm stop event... self.onFiniteStateMachineStop.fire() else: raise FiniteStateMachineError, 'can\'t start a manual (non-auto-change-state) FSM.' +## def step(self): +## ''' +## this will step through the fsm. +## ''' +## pass ## def stop(self, reason=None, exception=None): ## ''' ## ''' ## self._stop_exception = exception ## self._stop_reason = reason -## self._running = False +## self._fsm_running = False # TODO automaticly init newly added states per FSM object on their # (event) addition to the FSM class... # ...or do a lazy init (as in RPG.action) @@ -412,6 +419,7 @@ class _StoredState(stored._StoredClass): # TODO error state handler... # TODO "Sub-FSMs" # TODO revise magic method names and function... +# XXX see if this need a redesign... class BasicState(FiniteStateMachine): ''' this is the base state class for the FSM framwork. @@ -534,7 +542,7 @@ class BasicState(FiniteStateMachine): # restart the fsm if __auto_change_state__ is set and we are # not running... if hasattr(self, '__auto_change_state__') and self.__auto_change_state__ \ - and not self._running: + and not self._fsm_running: self.start() def iternextstates(self): ''' diff --git a/pli/pattern/store/misc.py b/pli/pattern/store/misc.py index 4b1ed11..c39db3e 100644 --- a/pli/pattern/store/misc.py +++ b/pli/pattern/store/misc.py @@ -1,13 +1,13 @@ #======================================================================= __version__ = '''0.1.47''' -__sub_version__ = '''20040323153531''' +__sub_version__ = '''20061124145351''' __copyright__ = '''(c) Alex A. Naanou 2003''' #----------------------------------------------------------------------- -from __future__ import generators +##from __future__ import generators import types import pli.functional as func diff --git a/pli/persistance/sql/core.py b/pli/persistance/sql/core.py index ef210a8..d28d355 100755 --- a/pli/persistance/sql/core.py +++ b/pli/persistance/sql/core.py @@ -1,7 +1,7 @@ #======================================================================= __version__ = '''0.0.01''' -__sub_version__ = '''20060204020843''' +__sub_version__ = '''20060901194810''' __copyright__ = '''(c) Alex A. Naanou 2003''' diff --git a/pli/persistance/sql/shelve.py b/pli/persistance/sql/shelve.py index 81866d4..3be1766 100755 --- a/pli/persistance/sql/shelve.py +++ b/pli/persistance/sql/shelve.py @@ -1,7 +1,7 @@ #======================================================================= __version__ = '''0.0.01''' -__sub_version__ = '''20060204024020''' +__sub_version__ = '''20060901194243''' __copyright__ = '''(c) Alex A. Naanou 2003''' -- 2.11.4.GIT