API Primitives¶
Several parts of Avulto are useful with all of its APIs.
- class Path¶
Path
wraps type paths and provides several useful methods and properties for manipulating and comparing paths:>>> from avulto import Path as p >>> p('/obj/machinery').parent_of('/obj/machinery/oven') True >>> p('/turf').child_of('/turf', strict=True) False >>> p('/obj/machinery') / 'microwave' /obj/machinery/microwave >>> p('/obj/machinery/microwave').parent /obj/machinery >>> p('/obj/machinery/microwave').stem "microwave"
- 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'
- class SourceLoc¶
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¶
The file path of the source location.
- class Coord3¶
A three-dimensional integer coordinate. These are currently only returned by certain
DMM
properties, and are not constructable.
- class 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()¶
Returns an interator over the list’s keys.