object

maci data object

The maci data object is a custom data type that provides unique functionality to perform useful operations on attribute names in the object and is responsible for holding all stored data during the runtime of the code.

Type name representation: MaciDataObj

building a maci data object

To build a maci data object in code, you may run the simple build function (See maci.build). This will return an empty maci object.

Example creating an empty maci data object using the maci build function

data = maci.build()

creating and setting attribute names with data

Whether loaded from a file (See maci.load) or in code, you can create and set attribute names and assign data to them on the object in code like you normally would expect in python.

Example creating and setting attributes names in code with basic data

data.attr1 = 1
data.attr2 = 2
data.attr3 = 3

See maci.load and language section for loading data from a file

object view

You may view the representation of the object by printing the object directly, or calling the str() or repr() functions on the object. The resulting output will display all attribute names and their currently assigned values. Example output showing current attribute names and their respective data

MaciDataObj(attr1=1, attr2=2, attr3=3)

If the object is empty, it will show like so:

MaciDataObj()

object operators and built-in behavior

maci version 1.0.0

equality

Compare maci objects to each other in code to check for equality. This will check if the data inside the object is exactly the same.

Example comparing maci objects

maci_obj1 == maci_obj2

bool

Call the bool built-in function on the object in code to check if the object is empty or not.

Example calling built-in bool function on maci object

bool(maci_obj)

object methods

Perform varying operations on the attribute names or data for the object using the built-in methods. You can set attribute names to be locked like a constant, or map attribute names to another like a pointer, get views of the object data and their states, and more.

See the object's api methods section for all useful functionality

object hinting

maci version 1.0.0

Typing for the MaciDataObj is currently supported if needed for type checkers. This is being currently tested using mypy for type safety. Updates may be made in the future for uncaught scenarios that is not passing mypy or other type checkers.

Conveniently, you can access the MaciDataObj type to hint it in your code from the maci module.

Example accessing the MaciDataObj type for hinting

maci.hint.MaciDataObj

See hints section for more on this and other types

Last updated