mirror of
https://github.com/Instagram/LibCST.git
synced 2025-12-23 10:35:53 +00:00
Fix code example in metadata documentation. (#703)
Co-authored-by: zzl0 <zhuzhaolong0@mail.com>
This commit is contained in:
parent
4c9728ab12
commit
84da283604
1 changed files with 2 additions and 2 deletions
|
|
@ -18,10 +18,10 @@ numbers of nodes through the :class:`~libcst.metadata.PositionProvider`:
|
|||
.. code-block:: python
|
||||
|
||||
class NamePrinter(cst.CSTVisitor):
|
||||
METADATA_DEPENDENCIES = (cst.PositionProvider,)
|
||||
METADATA_DEPENDENCIES = (cst.metadata.PositionProvider,)
|
||||
|
||||
def visit_Name(self, node: cst.Name) -> None:
|
||||
pos = self.get_metadata(cst.PositionProvider, node).start
|
||||
pos = self.get_metadata(cst.metadata.PositionProvider, node).start
|
||||
print(f"{node.value} found at line {pos.line}, column {pos.column}")
|
||||
|
||||
wrapper = cst.metadata.MetadataWrapper(cst.parse_module("x = 1"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue