Miscellaneous Visitors

Miscellaneous visitors to apply to an estimate.

For all of these visitors, given a project task called ESTIMATE and a visitor function named visitor, you apply the visitor as follows:

ESTIMATE.apply_visitor(visitor)
ballparker.visitors.anonymize(task, parent=None)[source]

Visit with a visitor that replaces task descriptions with systematic but anonymous names.

Replaces each description with a dotted-decimal “item number”.

Useful for sharing test cases, bug reproductions, etc: the overall structure of the estimate remains, but the contents of each task’s description is removed.

Use like: ESTIMATE.apply_visitor(anonymize)

>>> from ballparker.dsl import *
>>> estimate = project(
...     "a",
...     grouping("b",
...              "bc",
...              ("bd", S)))
>>> estimate.apply_visitor(anonymize)
>>> estimate.to_dsl()
"project(\n    ('1'),\n    grouping('2',\n            ('2.1'),\n            ('2.2', S)))"