loads maci data from a file

loading a file

Loads any plain text file that contains maci data that follows the maci language syntax (See language), and returns a MaciDataObj.

maci.load -> MaciDataObj

Basic Example of loading a file using default positional parameter

data = maci.load('')

In this example, we simply load maci data from a file using the load function and pass a string of the filepath to the file as an argument to the function to load the maci data, and assign the returned data object to a variable.

Access the data by their individual and respective attribute names like you normally would on an object in python.

Example accessing and viewing the data


You may also view all maci data simply by printing or viewing the repr of the object (See object)

parameters & arguments

Describes all parameter functionality and accepted data types

filename: str | Path

First and only required positional argument. Accepts strings and Path objects

Use this parameter to point to your filepath

attr_name_dedup: bool

Optional parameter. Accepts booleans. Default = True

Use this parameter to enable/disable Attribute Name Deduplication. The default setting is enabled.

This feature protects against having duplicate attribute names loaded from a file. This is helpful if a name has already been defined in the file previously and you do not want it to be overwritten accidentally. This ensures attribute names are unique in your file especially when loading large data sets having thousands of names where it may be hard to keep track. It will also protect against re-assigning an already existing method name in the maci data object. You may disable this feature by setting this parameter to False if you need names to be overwritten, but it is recommended to leave it on and write names uniquely.

encoding: str | None

Optional parameter. Accepts strings or None. Default = None

Use this parameter to load the data with the desired codec of the encoded data if needed. The default uses the default of python, so you don't have to use this, but you can if the data is using a specific codec.

_ignore_maci_attr_check: bool

Private optional parameter. Accepts booleans. Default = False

It is not recommended to use this as it may break the internal functionality of the maci object or may not allow you to change the name at all still. With that said, use this parameter to enable using names that match names the maci object is already using. For example "_MaciDataObjConstructor__assignment_hard_locked_attribs". It is a very low chance to have such a name collision, but if you do, just name it with a number or extra underscore or something instead of disabling this.

This must be used in combination with the attr_name_dedup parameter set to False in order to potentially work.

Last updated