Skip to content

pipda.context

module

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.

Classes
class

pipda.context.ContextError()

Bases
Exception BaseException

Any errors related to contexts

abstract class

pipda.context.ContextBase()

The context abstract class, defining howthe Reference objects are evaluated

  • getattr defines how f.A is evaluated. Note that f.A.B will always be evaluated as getattr(f.A, 'B')
  • getitem defines how f[item] is evaluated. Note that the item here is an evaluated value defined by getref.
  • ref here defines how the reference/item in f.item is evaluated. Since we could do f[f.A].
Attributes
  • ref (ContextBase) Defines how item in f[item] is evaluated.
    This function should return a ContextBase object. </>
Methods
  • getattr(parent, ref, level) (Any) Defines how f.A is evaluated</>
  • getitem(parent, ref, level) (Any) Defines how f[item] is evaluated</>
abstract method

getattr(parent, ref, level) → Any

Defines how f.A is evaluated

abstract method

getitem(parent, ref, level) → Any

Defines how f[item] is evaluated

class

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 of ref. However, ref is needed to be
      evaluated by a context returned by getref

Attributes
  • ref (ContextBase) Defines how item in f[item] is evaluated.
    This function should return a ContextBase object. </>
Methods
  • getattr(parent, ref, level) (str) Get the ref directly, regardless of data</>
  • getitem(parent, ref, level) (Any) Get the ref directly, which is already evaluated by f[ref]</>
method

getattr(parent, ref, level) → str

Get the ref directly, regardless of data

method

getitem(parent, ref, level) → Any

Get the ref directly, which is already evaluated by f[ref]

class

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]

Attributes
  • ref (ContextBase) Defines how item in f[item] is evaluated.
    This function should return a ContextBase object. </>
Methods
  • getattr(parent, ref, level) (Any) How to evaluate f.A</>
  • getitem(parent, ref, level) (Any) How to evaluate f[item]</>
method

getattr(parent, ref, level) → Any

How to evaluate f.A

method

getitem(parent, ref, level) → Any

How to evaluate f[item]

class

pipda.context.ContextPending()

Pending context, don't evaluate the expression,awaiting next avaiable context

Attributes
  • ref (ContextBase) Defines how item in f[item] is evaluated.
    This function should return a ContextBase object. </>
Methods
  • getattr(parent, ref, level) (str) Get the ref directly, regardless of data</>
  • getitem(parent, ref, level) (Any) Get the ref directly, which is already evaluated by f[ref]</>
method

getattr(parent, ref, level) → str

Get the ref directly, regardless of data

method

getitem(parent, ref, level) → Any

Get the ref directly, which is already evaluated by f[ref]

class

pipda.context.Context(*values)

Bases
enum.Enum

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

Classes
Methods
class

enum.EnumType(cls, bases, classdict, boundary=None, _simple=False, **kwds)

Metaclass for Enum

Attributes
  • __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. </>
Methods
  • __bool__(cls) classes/types should always be True.</>
  • __call__(cls, value, names, *values, module, qualname, type, start, boundary) Either returns an existing member, or creates a new enum class.</>
  • __contains__(cls, value) Return True if value is in cls.</>
  • __dir__(cls) Specialized dir implementation for types.</>
  • __getitem__(cls, name) Return the member matching name.</>
  • __iter__(cls) Return members in definition order.</>
  • __len__(cls) Return the number of members (no aliases)</>
  • __reversed__(cls) Return members in reverse definition order.</>
  • __setattr__(cls, name, value) Block attempts to reassign Enum members.</>
staticmethod
__bool__(cls)

classes/types should always be True.

staticmethod
__call__(cls, value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

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')).

The value lookup branch is chosen if the enum is final.

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.

staticmethod
__contains__(cls, value)

Return True if value is in cls.

value is in cls if: 1) value is a member of cls, or 2) value is the value of one of the cls's members.

staticmethod
__dir__(cls)

Specialized dir implementation for types.

staticmethod
__getitem__(cls, name)

Return the member matching name.

staticmethod
__iter__(cls)

Return members in definition order.

staticmethod
__len__(cls)

Return the number of members (no aliases)

staticmethod
__reversed__(cls)

Return members in reverse definition order.

staticmethod
__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.

classmethod

__contains__(value)

Return True if value is in cls.

value is in cls if: 1) value is a member of cls, or 2) value is the value of one of the cls's members.

classmethod

__getitem__(name)

Return the member matching name.

classmethod

__iter__()

Return members in definition order.

classmethod

__len__()

Return the number of members (no aliases)