hio.base
hio.base Package
Submodules
Package Contents
Classes
Tymist keeps artificial or simulated or cycle time, called tyme. |
|
Tymee has .tyme property that returns the artificial or simulated or cycle time |
|
Tymer class to measure cycle time given by .tyme property of Tymist instance. |
|
Doist is the root coroutine scheduler |
|
Doer base class for hierarchical structured async coroutine like generators. |
|
DoDoer implements Doist like functionality to allow nested scheduling of Doers. |
|
Filer instances manage file directories and files to hold keri installation |
|
Basic Filer Doer |
Functions
|
Returns decorator that makes decorated generator function Doist compatible. |
|
Returns Doist compatible copy, g, of converted generator function f. |
|
Context manager wrapper Filer instances for managing a filesystem directory |
- class hio.base.Tymist(tyme=0.0, tock=None, **kwa)[source]
Bases:
hio.hioing.MixinTymist keeps artificial or simulated or cycle time, called tyme. Provides relative cycle time, tyme, in seconds with .tyme property in incremets of .tock seconds. .tyme is advanced one .tock increment with .tick method. .tyme may be synchronized with real time by a .tyme manager
- Class Attributes:
.Tock is default .tock
Attributes:
- Properties:
.tyme is float relative cycle time, .tyme is artificial time .tock is float tyme increment of .tick()
- .tick increments .tyme by one .tock or provided tock
- Tock = 0.03125
- property tyme(self)
tyme property getter, get ._tyme .tyme is float cycle time in seconds
- property tock(self)
tock property getter, get ._tock .tock is float cycle time .tyme increment in seconds
- tick(self, tock=None)
Advance cycle time .tyme by tock seconds when provided othewise by .tock and return new .tyme :param tock is float of amount of time in seconds to change .tyme:
- tymen(self)
Returns function wrapper closure tymth, when called tymth() returns .tyme. This enables read only injection of .tyme into any object via tymth() that wants to be on or access this Tymist’s tyme base.
- class hio.base.Tymee(tymth=None, **kwa)[source]
Bases:
hio.hioing.MixinTymee has .tyme property that returns the artificial or simulated or cycle time from its referenced Tymist instance ._tymist.
Attributes:
- Properties:
- .tyme is float relative cycle time of associated Tymist .tyme obtained
via injected .tymth function wrapper closure.
- .tymth is function wrapper closure returned by Tymist .tymeth() method.
When .tymth is called it returns associated Tymist .tyme. .tymth provides injected dependency on Tymist tyme base.
- .wind injects ._tymth dependency from associated Tymist to get its .tyme
- Hidden:
- ._tymth is injected function wrapper closure returned by .tymen() of
associated Tymist instance that returns Tymist .tyme. when called.
- property tyme(self)
tyme property getter, get ._tyme .tyme is float cycle time in seconds
- property tymth(self)
tymth property getter, get ._tymth returns own copy of tymist.tynth function wrapper closure for subsequent injection into related objects that want to be on same tymist tyme base.
- wind(self, tymth)
Inject new tymist.tymth as new ._tymth. Changes tymist.tyme base. Override in subclasses to update any dependencies on a change in tymist.tymth base
- class hio.base.Tymer(duration=None, start=None, **kwa)[source]
Bases:
TymeeTymer class to measure cycle time given by .tyme property of Tymist instance. tyme is relative cycle time either artificial or real
Inherited Attributes
Attributes:
- Inherited Properties:
- .tyme is float relative cycle time of associated Tymist .tyme obtained
via injected .tymth function wrapper closure.
- .tymth is function wrapper closure returned by Tymist .tymeth() method.
When .tymth is called it returns associated Tymist .tyme. .tymth provides injected dependency on Tymist tyme base.
- Properties:
.duration = tyme duration of tymer in seconds from ._start to ._stop .elaspsed = tyme elasped in seconds since ._start .remaining = tyme remaining in seconds until ._stop .expired = True if expired, False otherwise, i.e. .tyme >= ._stop
- Inherited Methods:
.wind is injects ._tymth dependency
- .start() = start tymer at current .tyme
- .restart() = restart tymer at last ._stop so no time lost
- Hidden:
- ._tymth is injected function wrapper closure returned by .tymen() of
associated Tymist instance that returns Tymist .tyme. when called.
._start is start tyme in seconds ._stop is stop tyme in seconds
- Duration = 0.0
- property duration(self)
duration property getter, .duration = ._stop - ._start .duration is float duration tyme
- property elapsed(self)
elapsed tyme property getter, Returns elapsed tyme in seconds (fractional) since ._start.
- property remaining(self)
remaining tyme property getter, Returns remaining tyme in seconds (fractional) before ._stop.
- property expired(self)
Returns True if tymer has expired, False otherwise. .tyme >= ._stop,
- wind(self, tymth)
Inject new ._tymist and any other bundled tymee references Update any dependencies on a change in ._tymist:
starts over itself at new ._tymists time
- start(self, duration=None, start=None)
- Starts Tymer of duration secs at start time start secs.
If duration not provided then uses current duration If start not provided then starts at current .tyme
- restart(self, duration=None)
Lossless restart of Tymer at .tyme = ._stop for duration if provided, current duration otherwise No time lost. Useful to extend Tymer so no time lost
- class hio.base.Doist(real=False, limit=None, doers=None, **kwa)[source]
Bases:
hio.base.tyming.TymistDoist is the root coroutine scheduler Provides relative cycle time in seconds with .tyme property to doers it runs The relative cycle time is advanced in .tock size increments by the by the .tick method. The doist may treat .tyme as artificial time or synchonize it to real time.
- .enter method prepares deeds deque of triples (dog, retyme, doer) where
dog is a doer generator returned by calling doer generator instances, functions, or methods.
- .recur method runs its deeds deque of triples (dog, retyme, doer) once per
invocation. This synchronizes their cycle time .tyme to the Doist’s tyme.
- .do method repeatedly runs .recur until generators are complete
it may either repeat as fast as possbile or repeat at real time increments.
- Inherited Class Attributes:
.Tock is default .tock
- real
True means run in real time, Otherwise as fast as possible.
- Type
boolean
- limit
maximum run tyme limit then closes all doers
- Type
float
- done
True means completed due to limit or all deeds completed False is forced complete due to error
- Type
boolean
- doers
Doer class instances, generator methods or function callables with attributes tock, done, and opts dict(). Used throughout the execution lifecycle.
- Type
list
- deeds
Tuples of form (dog, retyme, doer). Where: dog is generator created by doer retyme is tyme (real or simulated) in seconds when dog should run next doer is associated doer in .doers list used to assign its .done state
given completion state of its dog
Used throughout the execution lifecycle. The normal case is use the default empty initialization performed here and update in .enter().
- Type
deque
- Inherited Properties:
tyme: is float relative cycle time, .tyme is artificial time : is float tyme increment of .tick()
Properties:
- Inherited Methods:
.tick increments .tyme by one .tock or provided tock
- .enter prepare deeds, deque of triples (dog, retyme, doer)
- .recur run through all deeds once
- .do repeadedly call .recur until all dogs in deeds are complete or
times out do to reaching time limit
- do(self, doers=None, limit=None, tyme=None)
Readies deeds deque from .doers or doers if any and then iteratively runs .recur over deeds deque until completion of all deeds. Each entry in deeds is a triple (dog, retyme, doer) where:
dog is generator retyme is tyme (real or simulated) in seconds when dog should run next doer is from .doers list used to assign its .done state given associated completion state of its dog
If interrupted by exception call .close on each dog to force exit context.
Keyboard interrupt (cntl-c) forces exit.
Once finally clause closes a generator it must be reinited before it can be run again
- Parameters
doers (iterable) – generator method or function callables with attributes tock, done, and opts dict(). This may be used to update the .doers attribute which is used throughout the execution lifecycle. If not provided uses .doers. Parameterization here of doers enables some special cases. The normal case is to initialize in .__init__ or here.
limit (float) – is real time limit on execution. Forces close of all dogs.
tyme (float) – is optional starting tyme. Resets .tyme to tyme whe provided. If not provided uses current .tyme
- Returns
None
See: https://stackoverflow.com/questions/40528867/setting-attributes-on-func For setting attributes on bound methods.
- enter(self, doers=None)
Enter context Returns (deque): deeds deque of triples (dog, retyme, doer) where:
dog is generator retyme is tyme (real or simulated) in seconds when dog should run next doer is from .doers list used to assign its .done state given
completion state of its dog
Calls each generator callable (instance or function or method) in .doers to create each generator dog. Injects own tymth function closure, and
generator function’s own tock, and opts.
Runs enter context of each dog by calling next(dog)
- Parameters
attributes (doers is list of generator method or function callables with) – .tock is tyme increment in seconds .done is Boolean completion state .opts is dict() of optional parameters If not provided uses .doers. The normal case is to initialize in .__init__. or .do().
triples (deeds is deque of deed) –
- Returns
A deed is tuple of form (dog, retyme, doer). If not provided uses .deeds.
- Return type
deeds deque()
See: https://stackoverflow.com/questions/40528867/setting-attributes-on-func For setting attributes on bound methods.
- recur(self, deeds=None)
Recur once through deeds deque of tuples (triples) of form (dog, retyme, doer) and update in place
- Each deed is deque of tuples of form (dog, retyme, doer) where:
dog is generator retyme is tyme (real or simulated) in seconds when dog should run next doer is from .doers list used to assign its .done state given associated completion state of its dog
Each cycle checks all generators in deeds deque and runs if retyme past. At end of cycle advances .tyme by one .tock by calling .tick()
- Parameters
deeds (deque) – tuples of form (dog, retyme, doer). Parameterization here of deeds enables some special cases.
The Parameterization here of deeds enables some special cases such as manual testing or iteraton. The normal case is to initialize .doers in .__init__. or .do() and to initialize .deeds in .__init__. and then update in .enter()
- exit(self, deeds=None)
Force exit each still opened deed calling .close on the dog generator which throws a GeneratorExit to the generator. This executes the close context (GeneratorExit) which then excecutes the exit context in the finally caluse. Each dogs exit is responsible for releasing resources Previously aborted or closed dogs have already exited Close any running dogs in reverse order so that enters and exits are nested pairs so that the corresponding exits appear in reverse order to their entes. This preserves nested resource dependencies. For example:
- enter A,
- enter B,
enter C, exit C,
exit B,
exit A
- Parameters
deeds (deque) – tuples of form (dog, retyme, doer). If not provided uses .deeds. Parameterization here of deeds enables some special cases.
- extend(self, doers)
Extend .doers list with doers. Ready deeds from doers and extend .doers and .deeds. Edit deeds in place so not replace deque.
- Parameters
extension. (doers is list of doers to add as) –
- remove(self, doers)
Remove doers from .doers list and any associated deeds from .deeds deque. Force close removed deeds.
- Parameters
remove. (doers is list of doers to) –
- hio.base.doize(tock=0.0, **opts)[source]
Returns decorator that makes decorated generator function Doist compatible. Imbues decorated generator function with attributes used by Doist.enter() or DoDoer.enter(). Only one instance of decorated function with shared attributes is allowed.
Usage: @doize def f():
pass
- Parameters
f (tock is default tock attribute of doized) –
attribute (opts is dictionary of remaining parameters that becomes .opts) – of doized f
- hio.base.doify(f, *, name=None, tock=0.0, **opts)[source]
Returns Doist compatible copy, g, of converted generator function f. Each invoction of doify(f) returns a unique copy of doified function f. Imbues copy, g, of converted generator function, f, with attributes used by Doist.enter() or DoDoer.enter(). Allows multiple instances of copy, g, of generator function, f, each with unique attributes.
Usage: def f():
pass
c = doify(f, name=’c’)
- Parameters
function (f is generator) –
copy (name is new function name for returned doified copy g. Default is to) – f.__name__
g (tock is default tock attribute of doified copy) –
attribute (opts is dictionary of remaining parameters that becomes .opts) – of doified copy g
Based on: https://stackoverflow.com/questions/972/adding-a-method-to-an-existing-object-instance
- class hio.base.Doer(*, tymth=None, tock=0.0, **opts)[source]
Bases:
hio.base.tyming.TymeeDoer base class for hierarchical structured async coroutine like generators. Doer.__call__ on instance returns generator. Interface for Doist etc is generator function like object. Doer is generator method instance creator and has extra methods and attributes that a plain generator function does not
The .do method executes other methods each corresponding to one of the six econtexts:
enter, recur, clean, exit, (unforced) close, abort (forced)
- Actual context order may be one of:
enter, recur, clean, exit enter, recur, close, exit enter, recur, abort, exit enter, abort, exit
- .done is Boolean completion state
True means completed Otherwise incomplete. Incompletion maybe due to close or abort.
- .opts is dict of injected options into its .do generator by scheduler
- Inherited Properties:
- .tyme is float relative cycle time of associated Tymist .tyme obtained
via injected .tymth function wrapper closure.
- .tymth is function wrapper closure returned by Tymist .tymeth() method.
When .tymth is called it returns associated Tymist .tyme. .tymth provides injected dependency on Tymist tyme base.
- Properties:
- .tock is float, desired time in seconds between runs or until next run,
non negative, zero means run asap
- Inherited Methods:
.wind injects ._tymth dependency from associated Tymist to get its .tyme
- .__call__ makes instance callable
Appears as generator function that returns generator
- .do is generator method that returns generator
- .enter is enter context action method
- .recur is recur context action method or generator method
- .clean is clean context action method
- .exit is exit context method
- .close is close context method
- .abort is abort context method
- Hidden:
- ._tymth is injected function wrapper closure returned by .tymen() of
associated Tymist instance that returns Tymist .tyme. when called.
._tock is hidden attribute for .tock property
- __call__(self, **kwa)
Returns generator Does not advance to first yield. The advance to first yield effectively invodes the enter or open context on the generator. To enter either call .next or .send(None) on generator
- property tock(self)
tock property getter, get ._tock .tock is float desired .tyme increment in seconds
- do(self, tymth, *, tock=0.0, **opts)
Generator method to run this doer. Calling this method returns generator. Interface matches generator function for compatibility. To customize create subclasses and override the lifecycle methods:
.enter, .recur, .exit, .close, .abort
- Parameters
of (tymth is injected function wrapper closure returned by .tymen()) – Tymist instance. Calling tymth() returns associated Tymist .tyme.
value (tock is injected initial tock) –
parameters (args is dict of injected optional additional) –
- enter(self)
Do ‘enter’ context actions. Override in subclass. Not a generator method. Set up resources. Comparable to context manager enter.
- recur(self, tyme)
Do ‘recur’ context actions. Override in subclass. Regular method that perform repetitive actions once per invocation. Assumes resource setup in .enter() and resource takedown in .exit() (see ReDoer below for example of .recur that is a generator method)
- Returns completion state of recurrence actions.
True means done False means continue
- Parameters
here. (Doist feeds its .tyme through .send to .do yield which passes it) –
.recur maybe implemented by a subclass either as a non-generator method or a generator method. This stub here is as a non-generator method. The base class .do detects which type:
- If non-generator .do method runs .recur method once per iteration
until .recur returns (True)
- If generator .do method runs .recur with (yield from) until .recur
returns (see ReDoer for example of generator .recur)
- clean(self)
Do ‘clean’ context actions. Override in subclass. Not a generator method. Clean up resources that are unique to a clean exit. Called by else after normal return.
- exit(self)
Do ‘exit’ context actions. Override in subclass. Not a generator method. Clean up resources. Comparable to context manager exit. Called by finally after normal return, close, or abort. After .exit() do returns resulting in StopIteration.
- close(self)
Do ‘close’ context actions. Override in subclass. Not a generator method. Forced close by thrown generator .close() method causing GeneratorExit. .exit() is finally called after .close().
- abort(self, ex)
Do ‘abort’ context actions. Override in subclass. Not a generator method. :param ex is Exception instance that caused abort.:
Unexpected exception that results in generator exiting but not GeneratorExit. .exit() is finally called after .abort().
- class hio.base.DoDoer(doers=None, always=False, **kwa)[source]
Bases:
DoerDoDoer implements Doist like functionality to allow nested scheduling of Doers. Each DoDoer runs a list of doers like a Doist but using the tyme from its
injected tymth for the associated tymist as injected by its ultimate root parent Doist and any intervening parent DoDoer(s).
Scheduling hierarchy: Doist->DoDoer…->DoDoer->Doers
- Inherited Attributes:
- .done is Boolean completion state:
True means completed Otherwise incomplete. Incompletion maybe due to close or abort.
.opts is dict of injected options for its generator .do
Attributes:
- Inherited Properties:
- .tyme is float relative cycle time of associated Tymist .tyme obtained
via injected .tymth function wrapper closure.
- .tymth is function wrapper closure returned by Tymist .tymeth() method.
When .tymth is called it returns associated Tymist .tyme. .tymth provides injected dependency on Tymist tyme base.
- .tock is float, desired time in seconds between runs or until next run,
non negative, zero means run asap
- Properties:
- doers (list): Doer or Doist compatible generator instances,
functions, or methods.
- deeds (deque): tuples of form (dog, retyme, doer) where:
dog is generator created by doer. retyme is tyme in seconds when next should run may be real or simulated. doer is associated doer in .doers list. Used throughout the execution lifecycle. The normal case is use the default empty initialization performed here and update in .enter().
- always (bool): True means keep running even when all dogs in deeds
are complete. Enables dynamically managing extending or removing doers and associated deeds while running.
- Inherited Methods:
.wind injects ._tymth dependency from associated Tymist to get its .tyme .__call__ makes instance callable
Appears as generator function that returns generator
.do is generator method that returns generator .enter is enter context action method .recur is recur context action method or generator method .clean is clean context action method .exit is exit context method .close is close context method .abort is abort context method
- Overidden Methods:
.do .enter .recur .exit
- Hidden:
- ._tymth is injected function wrapper closure returned by .tymen() of
associated Tymist instance that returns Tymist .tyme. when called.
._tock is hidden attribute for .tock property ._always is hidden attribute for .always property ._doers is hidden attribute for .doers property ._deeds is hidden attribute for .deeds property
- property doers(self)
doers property getter, get ._doers .doers is list of doist compatible generator instances, functions, or
methods
- property deeds(self)
deeds property getter, get ._deeds .deeds is deque of triples, each of form (dog, retyme, doer)
- property always(self)
always property getter, get ._always .always is Boolean, True means keep running even when all dogs in deeds
are complete. Enables dynamically managing extending or removing doers and associated deeds while running.
- do(self, tymth, tock=0.0, doers=None, always=None, **opts)
Generator method to run this doer. Equivalent of doist.do Calling this method returns generator Interface matched generator function for compatibility
- Parameters
of (tymth is injected function wrapper closure returned by .tymen()) – Tymist instance. Calling tymth() returns associated Tymist .tyme.
value (tock is injected initial tock) –
attributes (doers is list of generator method or function callables with) – tock, done, and opts dict(). This may be used to update the .doers attribute which is used throughout the execution lifecycle. If not provided uses .doers. Parameterization here of doers enables some special cases. The normal case is to initialize in .__init__.
deeds (always is Boolean. True means keep running even when all dogs in) – are complete. Enables dynamically managing extending or removing doers and associated deeds while running. When not provided use .always.
parameters (opts is dict of injected optional additional) –
- enter(self, doers=None)
Do ‘enter’ context actions. Equivalent of Doist.enter()
- Returns deeds deque of triples (dog, retyme, doer) where:
dog is generator created by doer retyme is tyme in seconds when next should run may be real or simulated doer is doer for dog from doers list
Calls each generator callable (function or method) in .doers to create each generator dog.
Runs enter context of each dog by calling next(dog)
- Parameters
doers (list) – Doer Instance, generator method or function callables with attributes tock, done, and opts dict(). If not provided uses .doers. Parameterization here of doers enables some special cases. The normal case is to initialize in .__init__.
- Returns
A deed is tuple of form (dog, retyme, doer). If not provided uses .deeds.
- Return type
deeds deque()
See: https://stackoverflow.com/questions/40528867/setting-attributes-on-func For setting attributes on bound methods.
- recur(self, tyme, deeds=None)
Do ‘recur’ context actions. Equivalent of Doist.recur
- Parameters
tyme (float) –
- is output of send fed to do yield, The root scheduler
Doist feeds its .tyme which propagates down the chain of DoDoers Because tymist is injected by doist or dodoer, self.tyme is same as tyme. So may use either which is more convenient.
- deeds (deque): tuples of form (dog, retyme, doer).
If not provided uses .deeds. Parameterization here of deeds enables some special cases.
- Returns completion state of recurrence actions.
True means done False means continue
Cycle once through deeds deque and update in place
Each cycle checks all generators dogs in deeds deque and runs if retyme past.
- exit(self, deeds=None)
Do ‘exit’ context actions.
- Parameters
deeds (deque) – of deed tuples of form (dog, retyme, doer) If not provided uses .deeds. Parameterization here of deeds enables some special cases.
See: https://stackoverflow.com/questions/40528867/setting-attributes-on-func For setting attributes on bound methods.
- extend(self, doers)
Extend .doers list with doers. Ready deeds from doers and extend .doers and .deeds. Edit deeds in place so not replace deque.
- Parameters
extension. (doers is list of doers to add as) –
- remove(self, doers)
Remove doers from .doers list and any associated deeds from .deeds deque. Force close removed deeds.
- Parameters
remove. (doers is list of doers to) –
- hio.base.openFiler(cls=None, name='test', temp=True, reopen=True, clear=False, **kwa)[source]
Context manager wrapper Filer instances for managing a filesystem directory and or files in a directory.
Defaults to using temporary directory path. Context ‘with’ statements call .close on exit of ‘with’ block
- Parameters
instance (cls is Class instance of subclass) –
oglers (name is str name of ogler instance for filename so can have multiple) – at different paths thar each use different log file directories
Boolean (temp is) – Otherwise open in persistent directory, do not clear on close
directory (True means open in temporary) – Otherwise open in persistent directory, do not clear on close
close (clear on) – Otherwise open in persistent directory, do not clear on close
Usage:
with openFiler(name=”bob”) as filer:
with openFiler(name=”eve”, cls=FilerSubClass) as filer:
- class hio.base.Filer(name='main', base='', temp=False, headDirPath=None, perm=None, reopen=True, clear=False, reuse=False, clean=False, filed=False, mode=None, fext=None, **kwa)[source]
Filer instances manage file directories and files to hold keri installation specific resources like databases and configuration files.
- name
unique path component used in directory or file path name
- Type
str
- base
another unique path component inserted before name
- Type
str
- temp
True means use /tmp directory
- Type
bool
- headDirPath is head directory path
- path is full directory path
- perm is numeric os permissions for directory and/or file
- Type
s
- filed
True means .path ends in file. False means .path ends in directory
- Type
bool
- mode
file open mode if filed
- Type
str
- fext
file extension if filed
- Type
str
- file
- Type
File
- opened is Boolean, True means directory created and if file then file
is opened. False otherwise
- File/Directory Creation Mode Notes:
.Perm provides default restricted access permissions to directory and/or files stat.S_ISVTX | stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR 0o1700==960
- stat.S_ISVTX is Sticky bit. When this bit is set on a directory it means
that a file in that directory can be renamed or deleted only by the owner of the file, by the owner of the directory, or by a privileged process. When this bit is set on a file it means nothing
stat.S_IRUSR Owner has read permission. stat.S_IWUSR Owner has write permission. stat.S_IXUSR Owner has execute permission.
- HeadDirPath = /usr/local/var
- TailDirPath = hio
- CleanTailDirPath = hio/clean
- AltHeadDirPath = ~
- AltTailDirPath = .hio
- AltCleanTailDirPath = .hio/clean
- TempHeadDir = /tmp
- TempPrefix = hio_
- TempSuffix = _test
- Perm
- Mode = r+
- Fext = text
- reopen(self, temp=None, headDirPath=None, perm=None, clear=False, reuse=False, clean=False, mode=None, fext=None, **kwa)
Open if closed or close and reopen if opened or create and open if not
- Parameters
temp (bool) – assign to .temp True means open in temporary directory, clear on close False means open persistent directory, do not clear on close
headDirPath (str) – optional head directory pathname for main database Default .HeadDirpath
perm (int) – optional numeric os dir permissions for database directory and database files. Default .Perm
clear (bool) – True means remove directory upon close False means do not remove directory upon close
reuse (bool) – True means reuse self.path if already exists False means do not reuse but remake self.path
clean (bool) – True means path uses clean tail variant False means path uses normal tail variant
mode (str) – file open mode when .filed
fext (str) – File extension when .filed
- remake(self, *, name='', base='', temp=None, headDirPath=None, perm=None, clean=False, filed=False, mode=None, fext=None, **kwa)
Make and return (path. file) by opening or creating and opening if not preexistent, directory or file at path
- Parameters
name (str) – unique name alias portion of path
base (str) – optional base inserted before name in path
temp (bool) – optional None means ignore, True means open temporary directory, may clear on close False menans open persistent directory, may not clear on close
headDirPath (str) – optional head directory pathname of main database
perm (int) – directory or file permissions such as stat.S_IRUSR Owner has read permission. stat.S_IWUSR Owner has write permission. stat.S_IXUSR Owner has execute permission.
clean (bool) – True means make path for cleaned version and remove old directory or file at clean path if any. False means make path normally (not clean)
filed (bool) – True means .path is file path not directory path False means .path is directiory path not file path
mode (str) – file open mode when .filed such as “w+”
fext (str) – File extension when .filed
- close(self, clear=False)
Close .file if any and if clear rm directory or file at .path
- Parameters
clear (bool) – True means remove dir or file at .path
- _clearPath(self)
Remove directory/file at end of .path
- class hio.base.FilerDoer(filer, **kwa)[source]
Bases:
hio.base.doing.DoerBasic Filer Doer
- done
completion state: True means completed Otherwise incomplete. Incompletion maybe due to close or abort.
- Type
bool
- Properties:
- tyme (float): relative cycle time of associated Tymist .tyme obtained
via injected .tymth function wrapper closure.
- tymth (func): closure returned by Tymist .tymeth() method.
When .tymth is called it returns associated Tymist .tyme. .tymth provides injected dependency on Tymist tyme base.
- tock (float)): desired time in seconds between runs or until next run,
non negative, zero means run asap
- enter(self)
- exit(self)