API Primitives

Several parts of Avulto are useful with all of its APIs.

class avulto.TypePath

A DM typepath.

TypePath wraps type paths and provides several useful methods and properties for manipulating and comparing paths.

property abs: str

Returns the absolute representation of the path, rooted at /datum.

>>> p('/obj/foo').abs
'/datum/atom/movable/obj/foo'

>>> p('/foo').abs
'/datum/foo'
property rel: str

Returns the relative or declared representation of the path.

>>> p('/obj/foo').rel
'/obj/foo'

>>> p('/datum/foo').rel
'/datum/foo'

>>> p('/foo').rel
'/foo'
property parent: TypePath

The parent path.

property stem: str

The final part of the path.

property is_root: bool

Whether or not the path is /.

parent_of(other: Any, strict: bool = False) → bool

Returns whether the path is a parent of other.

If strict is true, the current path will not be considered a parent of itself.

child_of(other: Any, strict: bool = False) → bool

Returns whether the path is a child of other.

If strict is true, the current path will not be considered a child of itself.

class avulto.SourceLoc

Information about the location of a source token in the tree.

SourceLoc contains source file information about types, procs, and vars. This is useful for tasks like linters which want to show line and column-level information about a finding.

property file_path: pathlib.Path | None

The file path of the source location.

property line: int

The line number, starting at 1.

property column: int

The column number, starting at 1.

class avulto.Coord3

A three-dimensional integer coordinate. These are currently only returned by certain DMM properties, and are not constructable.

property x: int
property y: int
property z: int
class avulto.Dmlist

A primitive, read-only representation of a DM list. This is used when returning constant values of lists from the AST walker, and prefab values from the DMM reader. They are not constructable.

Dmlists only support iterating over keys, and indexing with keys.

keys() → collections.abc.Iterator[Any]

Returns an iterator over the keys in the list.

class avulto.Dir(*args, **kwds)

The directions BYOND uses for atoms and icon states. Each member has the same integer value as the matching BYOND constant, so Dir.NORTH == 1 is True.

property NORTH
property SOUTH
property EAST
property WEST
property NORTHEAST
property NORTHWEST
property SOUTHEAST
property SOUTHWEST