pipda.context
Provides the context to evaluate f.A and f['A']
By default, 1. in the context of select, both f.A and f['A'] return 'A' 2. in the context of evaluation, f.A returns data.A and f['A'] returns data['A'] 3. when it is pending, you will need to evaluate args and kwargs yourself.
ContextError
— Any errors related to contexts</>ContextBase
(
)
— The context abstract class, defining howthe Reference objects are evaluated </>ContextSelect
— Context used in a select context</>ContextEval
— Context used in a data-evaluation context</>ContextPending
— Pending context, don't evaluate the expression,awaiting next avaiable context </>Context
— Context to solve f.A and f['A']</>
pipda.context.
ContextError
(
)
Any errors related to contexts
pipda.context.
ContextBase
(
)
The context abstract class, defining howthe Reference objects are evaluated
getattr
defines howf.A
is evaluated. Note thatf.A.B
will always be evaluated asgetattr(f.A, 'B')
getitem
defines howf[item]
is evaluated. Note that theitem
here is an evaluated value defined bygetref
.ref
here defines how the reference/item inf.item
is evaluated. Since we could dof[f.A]
.
ref
(ContextBase) — Defines howitem
inf[item]
is evaluated.
This function should return aContextBase
object. </>
pipda.context.
ContextSelect
(
)
Context used in a select context
In this kind of context,
- -
f.A
works as a shortcut of'A'
; - -
f[ref]
works as a shortcut ofref
. However,ref
is needed to be
evaluated by a context returned bygetref
ref
(ContextBase) — Defines howitem
inf[item]
is evaluated.
This function should return aContextBase
object. </>
pipda.context.
ContextEval
(
)
Context used in a data-evaluation context
In this kind of context, the expression is evaluated as-is. That is,
f.A
is evaluated as f.A
and f[item]
is evaluated as f[item]
ref
(ContextBase) — Defines howitem
inf[item]
is evaluated.
This function should return aContextBase
object. </>
pipda.context.
ContextPending
(
)
Pending context, don't evaluate the expression,awaiting next avaiable context
ref
(ContextBase) — Defines howitem
inf[item]
is evaluated.
This function should return aContextBase
object. </>
pipda.context.
Context
(
value
, names=None
, module=None
, qualname=None
, type=None
, start=1
)
Context to solve f.A and f['A']
PENDING: Context to leave the arguments to be evaluated inside the function SELECT: It select-based context EVAL: It evaluation-based context
enum.
EnumMeta
(
cls
, bases
, classdict
, **kwds
)
Metaclass for Enum
__members__
— Returns a mapping of member name->value.
This mapping lists all enum members, including aliases. Note that this is a read-only view of the internal mapping. </>
__bool__
(
)
— classes/types should always be True.</>__call__
(
cls
,value
,names
,module
,qualname
,type
,start
)
— Either returns an existing member, or creates a new enum class.</>__dir__
(
)
— Specialized dir implementation for types.</>__getattr__
(
cls
,name
)
— Return the enum member matchingname
</>__iter__
(
cls
)
— Returns members in definition order.</>__reversed__
(
cls
)
— Returns members in reverse definition order.</>__setattr__
(
cls
,name
,value
)
— Block attempts to reassign Enum members.</>
__bool__
(
)
classes/types should always be True.
__call__
(
cls
, value
, names=None
, module=None
, qualname=None
, type=None
, start=1
)
Either returns an existing member, or creates a new enum class.
This method is used both when an enum class is given a value to match to an enumeration member (i.e. Color(3)) and for the functional API (i.e. Color = Enum('Color', names='RED GREEN BLUE')).
When used for the functional API:
value
will be the name of the new class.
names
should be either a string of white-space/comma delimited names
(values will start at start
), or an iterator/mapping of name, value pairs.
module
should be set to the module this class is being created in;
if it is not set, an attempt to find that module will be made, but if
it fails the class will not be picklable.
qualname
should be set to the actual location this class can be found
at in its module; by default it is set to the global scope. If this is
not correct, unpickling will fail in some circumstances.
type
, if set, will be mixed in as the first base class.
__dir__
(
)
Specialized dir implementation for types.
__getattr__
(
cls
, name
)
Return the enum member matching name
We use getattr instead of descriptors or inserting into the enum
class' dict in order to support name
and value
being both
properties for enum members (which live in the class' dict) and
enum members themselves.
__iter__
(
cls
)
Returns members in definition order.
__reversed__
(
cls
)
Returns members in reverse definition order.
__setattr__
(
cls
, name
, value
)
Block attempts to reassign Enum members.
A simple assignment to the class namespace only changes one of the several possible ways to get an Enum member from the Enum class, resulting in an inconsistent Enumeration.