MekNode#

class pyCGM2.Mek.mek.mekQuery.MekNode(path, obj, kind, depth, lineage)#

A group or a dataset found by a MekQuery.

path#

Path relative to the query root (e.g. "/Session 2/Analysis 1").

Type:

str

name#

Last segment of the path.

Type:

str

obj#

The moveck data_group or data_set.

kind#

"group" or "set".

Type:

str

depth#

Depth relative to the traversal start (1 = direct child).

Type:

int

__init__(path, obj, kind, depth, lineage)#

Methods

__init__(path, obj, kind, depth, lineage)

attribute(name[, default, inherited])

Return the value of an attribute.

has_attribute(name[, inherited])

bool: True if the attribute exists on the node (or on a parent if inherited).

read()

Read the values of a dataset.

Attributes

path

name

obj

kind

depth

attributes

Attributes of the node (read once, then cached).

is_group

is_set

parent_path

Path of the parent group ("" for the query root).

shape

Shape of a dataset, None for a group (cached).

attribute(name, default=<object object>, inherited=False)#

Return the value of an attribute.

Parameters:
  • name (str) – Attribute name.

  • default – Value returned if the attribute is missing. If not given, a KeyError is raised.

  • inherited (bool) – If True and the node does not carry the attribute, look it up on the parent groups (closest first).

property attributes#

Attributes of the node (read once, then cached).

Type:

dict

has_attribute(name, inherited=False)#

bool: True if the attribute exists on the node (or on a parent if inherited).

property parent_path#

Path of the parent group ("" for the query root).

Type:

str

read()#

Read the values of a dataset.

Raises:

TypeError – If the node is a group.

property shape#

Shape of a dataset, None for a group (cached).

Falls back on the shape of the read values when data_set.shape() fails (it raises SystemError with some moveck versions).

Type:

tuple or None