Item¶
- class Stoner.folders.each.Item(folder)[source]¶
Bases:
object
Provides a proxy object for accessing methods on the inividual members of a Folder.
Notes
The purpose 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, *args, **kargs)[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 the 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, *args, **kargs)[source]¶
Iterate over the baseFolder, calling func on each item.
- Parameters:
func (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
- 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 the 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.