Skip to content
This repository was archived by the owner on Feb 1, 2023. It is now read-only.
This repository was archived by the owner on Feb 1, 2023. It is now read-only.

Implement DMPersistentTagsSequence #6

@miile7

Description

@miile7

DMPersistentTagsSequence : collections.abc.Sequence

Motivation

Dealing with persistent tags is the main key in execdmscript but also very complicated since
TagGroups cannot be travelled through on python side (with GMS <= 3.4). This problem should be
solved by this class.

Definition

On each call it checks the structure of the persistent tag group by executing dm-script code if
necessary. Add some optional caching (caching is not reliable here, but if the user decides so it
may help to speed up)

Attributes

`base_path : tuple[str]|None` # The base path in the persistent tags this object represents, if an empty string this is the base, each TagGroup in the persistent TagGroups is represented by another object of this again which is saved here

Methods

  • _getPatFor(key : int|str) -> str # return the path to look in the persistent tags for, append the key to the base_path, list indices are "[]" in dm-script
  • __getitem__() -> any # travel through the persistent tags on python side, uses _getPathFor()
  • __len__() -> int # get the length from the persistent tags if base is "", otherwise check the length on dm-script side (maybe getting the value from the base_path is possible on python, note that assigning taggroups to variables breaks them, try out to get the length)
  • __contains__() -> bool # check if index() returns a value
  • `iter() -> return self
  • __next__() -> any # use getitem with couter in iter
  • __reversed__() -> any # use getitem and reverse the counter in iter
  • index() # travel through taggroup on dm-script side
  • count() # travel through taggroup on dm-script side and count occurances

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions