Item¶
- class Stoner.folders.each.Item(folder: baseFolder)[source]¶
Bases:
object
Provides a proxy object for accessing methods on the inividual members of a Folder.
Notes
The pupose of this class is to allow it to be explicit that we’re calling methods on the members of the folder rather than a collective method. This allows us to work around nameclashes.
Attributes Summary
Return a proxy object for manipulating all the setas objects in a folder.
Methods Summary
__call__
(func, *args, **kargs)Iterate over the baseFolder, calling func on each item.
iter
(func, *args, **kargs)Iterate over the baseFolder, calling func on each item.
Attributes Documentation
- setas¶
Return a proxy object for manipulating all the setas objects in a folder.
Methods Documentation
- __call__(func: Callable, *args, **kargs) Any [source]¶
Iterate over the baseFolder, calling func on each item.
- Parameters
func (callable, str) – Either a callable object, or the name of a callable object (either method or global) that must take a metadataObject type instance as it’s first argument.
- Keyword Arguments
_return (None, bool or str) – Controls how the return value from func is added to the DataFolder
- Returns
A list of the results of evaluating func for each item in the folder.
Notes
If _return is None and the return type of func is the same type as the
baseFolder
is storing, then the return value replaces trhe originalStoner.Core.metadataobject
in thebaseFolder
. If _result is True the return value is added to theStoner.Core.metadataObject
’s metadata under the name of the function. If _result is a string. then return result is stored in the corresponding name.
- iter(func: Union[str, Callable], *args, **kargs) Any [source]¶
Iterate over the baseFolder, calling func on each item.
- Parameters
func (str, callable) – A Callable object that must take a metadataObject type instance as it’s first argument.
- Keyword Arguments
_return (None, bool or str) – Controls how the return value from func is added to the DataFolder
_byname (bool) – Whether to look func up as the name of a function. Defaults to True if func is a string.
_mode (str) –
- Whether to iterate using a parallel iteration scheme. Possible values are:
”serial”,”SingleProcess”: In the same process as the main script “ThreadPool”: Uses a concurrent.futures ThreadPool “ProcessPool”: Uses a concurrent.futures ProcessPool “Dask”: Uses a dask.distributed.Client to distribute the task over an DASK cluster.
- Returns
A list of the results of evaluating func for each item in the folder.
Notes
If _return is None and the return type of func is the same type as the
baseFolder
is storing, then the return value replaces trhe originalStoner.Core.metadataobject
in thebaseFolder
. If _result is True the return value is added to theStoner.Core.metadataObject
’s metadata under the name of the function. If _result is a string. then return result is stored in the corresponding name.