summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorSylvain Th?nault <sylvain.thenault@logilab.fr>2013-06-18 18:19:18 +0200
committerSylvain Th?nault <sylvain.thenault@logilab.fr>2013-06-18 18:19:18 +0200
commit00723a2a842a9526f24f22a55950662cff3b2d89 (patch)
treeb8b64179a8e0b4290b7e40e861167d7b7723515b /doc
parent603897f04b9f5c702e7fbe877207b1ff1dee25b3 (diff)
downloadastroid-00723a2a842a9526f24f22a55950662cff3b2d89.tar.gz
start some documentation for the new transformation API
Diffstat (limited to 'doc')
-rw-r--r--doc/extending.rst28
1 files changed, 28 insertions, 0 deletions
diff --git a/doc/extending.rst b/doc/extending.rst
new file mode 100644
index 0000000..da3b4e6
--- /dev/null
+++ b/doc/extending.rst
@@ -0,0 +1,28 @@
+Extending Astroid Syntax Tree
+=============================
+
+Sometimes Astroid will miss some potentially important information you may wish
+you add, as content of the standard library `hashlib` module. In some other
+cases, you may want to customize the way inference work, for instance to explain
+Astroid that `collections.namedtuple` is returning a class with some known
+attributes.
+
+The good news is that you can do it using the transformation API. You'll find
+examples in the `brain/` subdirectory. Those come from the `pylint-brain`_ project.
+
+Transformation functions are registered using the `register_transform` method of
+the Astroid manager:
+
+.. automethod:: astroid.manager.AstroidManager.register_transform
+
+You may want to use :class:`astroid.AsStringRegexpPredicate` predicate objects
+to filter on the `as_string` representation of the node.
+
+.. autoclass:: astroid.AsStringRegexpPredicate
+
+Last but not least, the :func:`inference_tip` function is there to register
+custom inference function.
+
+.. autofunction:: astroid.inference_tip
+
+.. _`pylint-brain`: https://bitbucket.org/logilab/pylint-brain \ No newline at end of file