sdkagent

LibCST API reference

140 public APIs from LibCST (Instagram/LibCST) — 115 classes, 13 functions, 12 methods. Signatures extracted by static analysis of the actual source.

Repository: Instagram/LibCST

KindCount
Classes115
Functions13
Methods12

API list

classlibcst._exceptions.CSTLogicError
General purpose internal error within LibCST itself.
methodlibcst._exceptions.ParserSyntaxError.editor_line() -> int
The expected one-indexed line in the user's editor.
classlibcst._nodes.base.BaseValueToken
Represents the subset of nodes that only contain a value.
classlibcst._nodes.expression.Arg
A single argument to a :class:`Call`.
classlibcst._nodes.expression.Attribute
An attribute reference, such as ``x.y``.
classlibcst._nodes.expression.Await
An await expression.
classlibcst._nodes.expression.BaseAssignTargetExpression
An expression that's valid on the left side of an assignment.
classlibcst._nodes.expression.BaseDictElement
An element of a literal dict.
classlibcst._nodes.expression.BaseElement
An element of a literal list, tuple, or set.
classlibcst._nodes.expression.BaseExpression
An base class for all expressions.
classlibcst._nodes.expression.ComparisonTarget
A target for a :class:`Comparison`.
classlibcst._nodes.expression.Dict
A literal dictionary.
classlibcst._nodes.expression.DictComp
A dictionary comprehension.
classlibcst._nodes.expression.Ellipsis
An ellipsis ``...``.
classlibcst._nodes.expression.FormattedString
An "f-string".
methodlibcst._nodes.expression.FormattedString.prefix() -> str
Returns the string's prefix, if any exists.
methodlibcst._nodes.expression.FormattedString.quote() -> StringQuoteLiteral
Returns the quotation used to denote the string.
classlibcst._nodes.expression.From
A ``from x`` stanza in a :class:`Yield` or :class:`Raise`.
classlibcst._nodes.expression.GeneratorExp
A generator expression.
classlibcst._nodes.expression.IfExp
An if expression of the form ``body if test else orelse``.
classlibcst._nodes.expression.Index
Any index as passed to a :class:`Subscript`.
classlibcst._nodes.expression.Lambda
A lambda expression that creates an anonymous function.
classlibcst._nodes.expression.LeftCurlyBrace
Used by various nodes to denote a dict or set.
classlibcst._nodes.expression.LeftParen
Used by various nodes to denote a parenthesized section.
classlibcst._nodes.expression.List
A mutable literal list.
classlibcst._nodes.expression.ListComp
A list comprehension.
classlibcst._nodes.expression.Name
A simple variable name.
classlibcst._nodes.expression.Parameters
A function or lambda parameter list.
classlibcst._nodes.expression.RightCurlyBrace
Used by various nodes to denote a dict or set.
classlibcst._nodes.expression.RightParen
Used by various nodes to denote a parenthesized section.
classlibcst._nodes.expression.Set
A mutable literal set.
classlibcst._nodes.expression.SetComp
A set comprehension.
classlibcst._nodes.expression.TemplatedString
An "t-string".
methodlibcst._nodes.expression.TemplatedString.prefix() -> str
Returns the string's prefix, if any exists.
methodlibcst._nodes.expression.TemplatedString.quote() -> StringQuoteLiteral
Returns the quotation used to denote the string.
classlibcst._nodes.expression.Tuple
An immutable literal tuple.
classlibcst._nodes.expression.UnaryOperation
Any generic unary expression, such as ``not x`` or ``-x``.
funclibcst._nodes.internal.visit_optional(parent:'CSTNode', fieldname:str, node:Optional[CSTNodeT], visitor:'CSTVisitorT') -> Optional[CSTNodeT]
Given an optional node, visits the node if it exists with `visitor`.
funclibcst._nodes.internal.visit_required(parent:'CSTNode', fieldname:str, node:CSTNodeT, visitor:'CSTVisitorT') -> CSTNodeT
Given a node, visits the node using `visitor`.
methodlibcst._nodes.module.Module.code_for_node(node:CSTNode) -> str
Generates the code for the given node in the context of this module.
methodlibcst._nodes.module.Module.visit(visitor:CSTVisitorT) -> _ModuleSelfT
Returns the result of running a visitor over this module.
classlibcst._nodes.statement.AnnAssign
An assignment statement such as ``x: int = 5`` or ``x: int``.
classlibcst._nodes.statement.Assign
An assignment statement such as ``x = y`` or ``x = y = z``.
classlibcst._nodes.statement.AssignTarget
A target for an :class:`Assign`.
classlibcst._nodes.statement.AugAssign
An augmented assignment statement, such as ``x += 5``.
classlibcst._nodes.statement.ClassDef
A class definition.
classlibcst._nodes.statement.Del
Represents a ``del`` statement.
classlibcst._nodes.statement.For
A ``for target in iter`` statement.
classlibcst._nodes.statement.FunctionDef
A function definition.
classlibcst._nodes.statement.Global
A ``global`` statement.
classlibcst._nodes.statement.If
An ``if`` statement.
classlibcst._nodes.statement.Import
An ``import`` statement.
classlibcst._nodes.statement.ImportAlias
An import, with an optional :class:`AsName`.
classlibcst._nodes.statement.ImportFrom
A ``from x import y`` statement.
classlibcst._nodes.statement.LazyImport
A ``lazy import x`` statement (PEP 810).
classlibcst._nodes.statement.LazyImportFrom
A ``lazy from x import y`` statement (PEP 810).
classlibcst._nodes.statement.Match
A ``match`` statement.
classlibcst._nodes.statement.MatchAs
A match "as-pattern", capture pattern, or wildcard pattern.
classlibcst._nodes.statement.MatchCase
A single ``case`` block of a :class:`Match` statement.
classlibcst._nodes.statement.MatchClass
A match class pattern.
classlibcst._nodes.statement.MatchKeywordElement
A key=value pair in a :class:`MatchClass`.
classlibcst._nodes.statement.MatchList
A list match pattern.
classlibcst._nodes.statement.MatchMapping
A match mapping pattern.
classlibcst._nodes.statement.MatchMappingElement
A ``key: value`` pair in a match mapping pattern.
classlibcst._nodes.statement.MatchOr
A match "or-pattern".
classlibcst._nodes.statement.MatchOrElement
An element in a :class:`MatchOr` node.
classlibcst._nodes.statement.MatchSequence
A match sequence pattern.
classlibcst._nodes.statement.MatchSequenceElement
An element in a sequence match pattern.
classlibcst._nodes.statement.MatchSingleton
A match literal pattern that compares by identity.
classlibcst._nodes.statement.MatchStar
A starred element in a sequence match pattern.
classlibcst._nodes.statement.MatchTuple
A tuple match pattern.
classlibcst._nodes.statement.MatchValue
A match literal or value pattern that compares by equality.
classlibcst._nodes.statement.Nonlocal
A ``nonlocal`` statement.
classlibcst._nodes.statement.ParamSpec
A parameter specification.
classlibcst._nodes.statement.Pass
Represents a ``pass`` statement.
classlibcst._nodes.statement.Raise
A ``raise exc`` or ``raise exc from cause`` statement.
classlibcst._nodes.statement.Return
Represents a ``return`` or a ``return x`` statement.
classlibcst._nodes.statement.SimpleStatementSuite
A simple statement that's used as a suite.
classlibcst._nodes.statement.TryStar
A ``try`` statement with ``except*`` blocks.
classlibcst._nodes.statement.TypeAlias
A type alias statement.
classlibcst._nodes.statement.TypeParameters
Type parameters when specified with PEP-695 syntax.
classlibcst._nodes.statement.TypeVar
A simple (non-variadic) type variable.
classlibcst._nodes.statement.TypeVarTuple
A variadic type variable.
classlibcst._nodes.statement.While
A ``while`` statement.
classlibcst._nodes.statement.With
A ``with`` statement.
classlibcst._nodes.whitespace.Comment
A comment including the leading pound (``#``) character.
classlibcst._nodes.whitespace.EmptyLine
Represents a line with only whitespace/comments.
classlibcst._nodes.whitespace.TrailingWhitespace
The whitespace at the end of a line after a statement.
classlibcst._parser.base_parser.BaseParser
Parser engine.
funclibcst._parser.custom_itertools.grouper(iterable:Iterable[_T], n:int, fillvalue:_T=None) -> Iterator[_T]
Collect data into fixed-length chunks or blocks
funclibcst._parser.entrypoints.parse_expression(source:str, config:PartialParserConfig=_DEFAULT_PARTIAL_PARSER_CONFIG) -> BaseExpression
Accepts an expression on a single line.
classlibcst._parser.parso.pgen2.grammar_parser.GrammarParser
The parser for Python grammar files.
funclibcst._parser.parso.python.tokenize.tokenize(code:str, version_info:PythonVersionInfo, start_pos:Tuple[int, int]=(1, 0)) -> Generator[PythonToken, None, None]
Generate tokens from a source code (string).
funclibcst._parser.parso.utils.parse_version_string(version:Optional[str]=None) -> PythonVersionInfo
Checks for a valid version number (e.g.
funclibcst._parser.parso.utils.split_lines(string:str, keepends:bool=False) -> Sequence[str]
Intended for Python code.
classlibcst._parser.types.config.AutoConfig
A sentinel value used in PartialParserConfig
classlibcst._parser.types.py_config.MockWhitespaceParserConfig
An internal type used by unit tests.
classlibcst._visitors.CSTVisitor
The low-level base visitor class for traversing a CST.
classlibcst.codemod._codemod.Codemod
Abstract base class that all codemods must subclass from.
methodlibcst.codemod._codemod.Codemod.module() -> Module
Reference to the currently-traversed module.
methodlibcst.codemod._codemod.Codemod.transform_module_impl(tree:Module) -> Module
Override this with your transform.
classlibcst.codemod._dummy_pool.DummyExecutor
Synchronous dummy `concurrent.futures.Executor` analogue.
classlibcst.codemod._runner.SkipFile
Raise this exception to skip codemodding the current file.
classlibcst.codemod._runner.SkipReason
An enumeration of all valid reasons for a codemod to skip.
classlibcst.codemod._visitor.ContextAwareTransformer
A transformer which visits using LibCST.
classlibcst.codemod._visitor.ContextAwareVisitor
A visitor which visits using LibCST.
methodlibcst.codemod._visitor.ContextAwareVisitor.module() -> cst.Module
Reference to the currently-traversed module.
classlibcst.codemod.commands.rename.RenameCommand
Rename all instances of a local or imported object.
classlibcst.codemod.visitors._add_imports.AddImportsVisitor
Ensures that given imports exist in a module.
classlibcst.codemod.visitors._apply_type_annotations.FunctionKey
Class representing a funciton name and signature.
classlibcst.codemod.visitors._apply_type_annotations.ImportedSymbolCollector
Collect imported symbols from a stub module.
classlibcst.codemod.visitors._apply_type_annotations.TypeCollector
Collect type annotations from a stub module.
classlibcst.codemod.visitors._imports.ImportItem
Representation of individual import items for codemods.
funclibcst.helpers.matchers.node_to_matcher(node:CSTNode, *match_syntactic_trivia:bool=False) -> matchers.BaseMatcherNode
Convert a concrete node to a matcher.
funclibcst.helpers.module.insert_header_comments(node:Module, comments:List[str]) -> Module
Insert comments after last non-empty line in header.
funclibcst.helpers.node_fields.get_field_default_value(field:dataclasses.Field[CSTNode]) -> object
Returns the default value of a CST-node's field.
funclibcst.helpers.node_fields.get_node_fields(node:CSTNode) -> Sequence[dataclasses.Field[CSTNode]]
Returns the sequence of a given CST-node's fields.
classlibcst.matchers._matcher_base.AbstractBaseMatcherNodeMeta
Metaclass that all matcher nodes uses.
classlibcst.matchers._matcher_base.AllOf
Matcher that matches all of its options.
classlibcst.matchers._matcher_base.BaseMatcherNode
Base class that all concrete matchers subclass from.
funclibcst.matchers._matcher_base.DoesNotMatch(obj:_OtherNodeT) -> _OtherNodeT
Matcher helper that inverts the match result of its child.
classlibcst.matchers._matcher_base.OneOf
Matcher that matches any one of its options.
classlibcst.matchers._matcher_base.TypeOf
Matcher that matches any one of the given types.
funclibcst.matchers._visitors.is_property(obj:object, attr_name:str) -> bool
Check if obj.attr is a property without evaluating it.
classlibcst.metadata.base_provider.BaseMetadataProvider
The low-level base class for all metadata providers.
methodlibcst.metadata.base_provider.BaseMetadataProvider.set_metadata(node:'CSTNode', value:MaybeLazyMetadataT) -> None
Record a metadata value ``value`` for ``node``.
classlibcst.metadata.name_provider.FullyQualifiedNameProvider
Provide fully qualified names for CST nodes.
classlibcst.metadata.position_provider.PositionProvider
Generates line and column metadata.
classlibcst.metadata.position_provider.WhitespaceInclusivePositionProvider
Generates line and column metadata.
classlibcst.metadata.scope_provider.Access
An Access records an access of an assignment.
methodlibcst.metadata.scope_provider.Access.referents() -> Collection['BaseAssignment']
Return all assignments of the access.
classlibcst.metadata.scope_provider.Accesses
A container to provide all accesses in a scope.
classlibcst.metadata.scope_provider.Assignment
An assignment records the name, CSTNode and its accesses.
classlibcst.metadata.scope_provider.Assignments
A container to provide all assignments in a scope.
classlibcst.metadata.scope_provider.BuiltinScope
A BuiltinScope represents python builtin declarations.
classlibcst.metadata.scope_provider.ClassScope
When a class is defined, it creates a ClassScope.
classlibcst.metadata.scope_provider.FunctionScope
When a function is defined, it creates a FunctionScope.
classlibcst.metadata.scope_provider.GlobalScope
A GlobalScope is the scope of module.
classlibcst.metadata.scope_provider.ImportAssignment
An assignment records the import node and it's alias
classlibcst.metadata.scope_provider.Scope
Base class of all scope classes.

About this data

These signatures were extracted from the public source of Instagram/LibCST using Python's ast module. Argument names, default values, type annotations and return types are taken verbatim from the code. Implementation bodies are never stored. See how it works for details.

Back to all 805 libraries