LibCST の API リファレンス
LibCST (Instagram/LibCST) の公開 API 140 件 —— クラス 115、関数 13、メソッド 12。実際のソースを静的解析して抽出した正確なシグネチャを掲載しています。
リポジトリ: Instagram/LibCST
| 種別 | 件数 |
|---|---|
| クラス | 115 |
| 関数 | 13 |
| メソッド | 12 |
API 一覧
class
libcst._exceptions.CSTLogicErrorGeneral purpose internal error within LibCST itself.
method
libcst._exceptions.ParserSyntaxError.editor_line() -> intThe expected one-indexed line in the user's editor.
class
libcst._nodes.base.BaseValueTokenRepresents the subset of nodes that only contain a value.
class
libcst._nodes.expression.ArgA single argument to a :class:`Call`.
class
libcst._nodes.expression.AttributeAn attribute reference, such as ``x.y``.
class
libcst._nodes.expression.AwaitAn await expression.
class
libcst._nodes.expression.BaseAssignTargetExpressionAn expression that's valid on the left side of an assignment.
class
libcst._nodes.expression.BaseDictElementAn element of a literal dict.
class
libcst._nodes.expression.BaseElementAn element of a literal list, tuple, or set.
class
libcst._nodes.expression.BaseExpressionAn base class for all expressions.
class
libcst._nodes.expression.ComparisonTargetA target for a :class:`Comparison`.
class
libcst._nodes.expression.DictA literal dictionary.
class
libcst._nodes.expression.DictCompA dictionary comprehension.
class
libcst._nodes.expression.EllipsisAn ellipsis ``...``.
class
libcst._nodes.expression.FormattedStringAn "f-string".
method
libcst._nodes.expression.FormattedString.prefix() -> strReturns the string's prefix, if any exists.
method
libcst._nodes.expression.FormattedString.quote() -> StringQuoteLiteralReturns the quotation used to denote the string.
class
libcst._nodes.expression.FromA ``from x`` stanza in a :class:`Yield` or :class:`Raise`.
class
libcst._nodes.expression.GeneratorExpA generator expression.
class
libcst._nodes.expression.IfExpAn if expression of the form ``body if test else orelse``.
class
libcst._nodes.expression.IndexAny index as passed to a :class:`Subscript`.
class
libcst._nodes.expression.LambdaA lambda expression that creates an anonymous function.
class
libcst._nodes.expression.LeftCurlyBraceUsed by various nodes to denote a dict or set.
class
libcst._nodes.expression.LeftParenUsed by various nodes to denote a parenthesized section.
class
libcst._nodes.expression.ListA mutable literal list.
class
libcst._nodes.expression.ListCompA list comprehension.
class
libcst._nodes.expression.NameA simple variable name.
class
libcst._nodes.expression.ParametersA function or lambda parameter list.
class
libcst._nodes.expression.RightCurlyBraceUsed by various nodes to denote a dict or set.
class
libcst._nodes.expression.RightParenUsed by various nodes to denote a parenthesized section.
class
libcst._nodes.expression.SetA mutable literal set.
class
libcst._nodes.expression.SetCompA set comprehension.
class
libcst._nodes.expression.TemplatedStringAn "t-string".
method
libcst._nodes.expression.TemplatedString.prefix() -> strReturns the string's prefix, if any exists.
method
libcst._nodes.expression.TemplatedString.quote() -> StringQuoteLiteralReturns the quotation used to denote the string.
class
libcst._nodes.expression.TupleAn immutable literal tuple.
class
libcst._nodes.expression.UnaryOperationAny generic unary expression, such as ``not x`` or ``-x``.
func
libcst._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`.
func
libcst._nodes.internal.visit_required(parent:'CSTNode', fieldname:str, node:CSTNodeT, visitor:'CSTVisitorT') -> CSTNodeTGiven a node, visits the node using `visitor`.
method
libcst._nodes.module.Module.code_for_node(node:CSTNode) -> strGenerates the code for the given node in the context of this module.
method
libcst._nodes.module.Module.visit(visitor:CSTVisitorT) -> _ModuleSelfTReturns the result of running a visitor over this module.
class
libcst._nodes.statement.AnnAssignAn assignment statement such as ``x: int = 5`` or ``x: int``.
class
libcst._nodes.statement.AssignAn assignment statement such as ``x = y`` or ``x = y = z``.
class
libcst._nodes.statement.AssignTargetA target for an :class:`Assign`.
class
libcst._nodes.statement.AugAssignAn augmented assignment statement, such as ``x += 5``.
class
libcst._nodes.statement.ClassDefA class definition.
class
libcst._nodes.statement.DelRepresents a ``del`` statement.
class
libcst._nodes.statement.ForA ``for target in iter`` statement.
class
libcst._nodes.statement.FunctionDefA function definition.
class
libcst._nodes.statement.GlobalA ``global`` statement.
class
libcst._nodes.statement.IfAn ``if`` statement.
class
libcst._nodes.statement.ImportAn ``import`` statement.
class
libcst._nodes.statement.ImportAliasAn import, with an optional :class:`AsName`.
class
libcst._nodes.statement.ImportFromA ``from x import y`` statement.
class
libcst._nodes.statement.LazyImportA ``lazy import x`` statement (PEP 810).
class
libcst._nodes.statement.LazyImportFromA ``lazy from x import y`` statement (PEP 810).
class
libcst._nodes.statement.MatchA ``match`` statement.
class
libcst._nodes.statement.MatchAsA match "as-pattern", capture pattern, or wildcard pattern.
class
libcst._nodes.statement.MatchCaseA single ``case`` block of a :class:`Match` statement.
class
libcst._nodes.statement.MatchClassA match class pattern.
class
libcst._nodes.statement.MatchKeywordElementA key=value pair in a :class:`MatchClass`.
class
libcst._nodes.statement.MatchListA list match pattern.
class
libcst._nodes.statement.MatchMappingA match mapping pattern.
class
libcst._nodes.statement.MatchMappingElementA ``key: value`` pair in a match mapping pattern.
class
libcst._nodes.statement.MatchOrA match "or-pattern".
class
libcst._nodes.statement.MatchOrElementAn element in a :class:`MatchOr` node.
class
libcst._nodes.statement.MatchSequenceA match sequence pattern.
class
libcst._nodes.statement.MatchSequenceElementAn element in a sequence match pattern.
class
libcst._nodes.statement.MatchSingletonA match literal pattern that compares by identity.
class
libcst._nodes.statement.MatchStarA starred element in a sequence match pattern.
class
libcst._nodes.statement.MatchTupleA tuple match pattern.
class
libcst._nodes.statement.MatchValueA match literal or value pattern that compares by equality.
class
libcst._nodes.statement.NonlocalA ``nonlocal`` statement.
class
libcst._nodes.statement.ParamSpecA parameter specification.
class
libcst._nodes.statement.PassRepresents a ``pass`` statement.
class
libcst._nodes.statement.RaiseA ``raise exc`` or ``raise exc from cause`` statement.
class
libcst._nodes.statement.ReturnRepresents a ``return`` or a ``return x`` statement.
class
libcst._nodes.statement.SimpleStatementSuiteA simple statement that's used as a suite.
class
libcst._nodes.statement.TryStarA ``try`` statement with ``except*`` blocks.
class
libcst._nodes.statement.TypeAliasA type alias statement.
class
libcst._nodes.statement.TypeParametersType parameters when specified with PEP-695 syntax.
class
libcst._nodes.statement.TypeVarA simple (non-variadic) type variable.
class
libcst._nodes.statement.TypeVarTupleA variadic type variable.
class
libcst._nodes.statement.WhileA ``while`` statement.
class
libcst._nodes.statement.WithA ``with`` statement.
class
libcst._nodes.whitespace.CommentA comment including the leading pound (``#``) character.
class
libcst._nodes.whitespace.EmptyLineRepresents a line with only whitespace/comments.
class
libcst._nodes.whitespace.TrailingWhitespaceThe whitespace at the end of a line after a statement.
class
libcst._parser.base_parser.BaseParserParser engine.
func
libcst._parser.custom_itertools.grouper(iterable:Iterable[_T], n:int, fillvalue:_T=None) -> Iterator[_T]Collect data into fixed-length chunks or blocks
func
libcst._parser.entrypoints.parse_expression(source:str, config:PartialParserConfig=_DEFAULT_PARTIAL_PARSER_CONFIG) -> BaseExpressionAccepts an expression on a single line.
class
libcst._parser.parso.pgen2.grammar_parser.GrammarParserThe parser for Python grammar files.
func
libcst._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).
func
libcst._parser.parso.utils.parse_version_string(version:Optional[str]=None) -> PythonVersionInfoChecks for a valid version number (e.g.
func
libcst._parser.parso.utils.split_lines(string:str, keepends:bool=False) -> Sequence[str]Intended for Python code.
class
libcst._parser.types.config.AutoConfigA sentinel value used in PartialParserConfig
class
libcst._parser.types.py_config.MockWhitespaceParserConfigAn internal type used by unit tests.
class
libcst._visitors.CSTVisitorThe low-level base visitor class for traversing a CST.
class
libcst.codemod._codemod.CodemodAbstract base class that all codemods must subclass from.
method
libcst.codemod._codemod.Codemod.module() -> ModuleReference to the currently-traversed module.
method
libcst.codemod._codemod.Codemod.transform_module_impl(tree:Module) -> ModuleOverride this with your transform.
class
libcst.codemod._dummy_pool.DummyExecutorSynchronous dummy `concurrent.futures.Executor` analogue.
class
libcst.codemod._runner.SkipFileRaise this exception to skip codemodding the current file.
class
libcst.codemod._runner.SkipReasonAn enumeration of all valid reasons for a codemod to skip.
class
libcst.codemod._visitor.ContextAwareTransformerA transformer which visits using LibCST.
class
libcst.codemod._visitor.ContextAwareVisitorA visitor which visits using LibCST.
method
libcst.codemod._visitor.ContextAwareVisitor.module() -> cst.ModuleReference to the currently-traversed module.
class
libcst.codemod.commands.rename.RenameCommandRename all instances of a local or imported object.
class
libcst.codemod.visitors._add_imports.AddImportsVisitorEnsures that given imports exist in a module.
class
libcst.codemod.visitors._apply_type_annotations.FunctionKeyClass representing a funciton name and signature.
class
libcst.codemod.visitors._apply_type_annotations.ImportedSymbolCollectorCollect imported symbols from a stub module.
class
libcst.codemod.visitors._apply_type_annotations.TypeCollectorCollect type annotations from a stub module.
class
libcst.codemod.visitors._imports.ImportItemRepresentation of individual import items for codemods.
func
libcst.helpers.matchers.node_to_matcher(node:CSTNode, *match_syntactic_trivia:bool=False) -> matchers.BaseMatcherNodeConvert a concrete node to a matcher.
func
libcst.helpers.module.insert_header_comments(node:Module, comments:List[str]) -> ModuleInsert comments after last non-empty line in header.
func
libcst.helpers.node_fields.get_field_default_value(field:dataclasses.Field[CSTNode]) -> objectReturns the default value of a CST-node's field.
func
libcst.helpers.node_fields.get_node_fields(node:CSTNode) -> Sequence[dataclasses.Field[CSTNode]]Returns the sequence of a given CST-node's fields.
class
libcst.matchers._matcher_base.AbstractBaseMatcherNodeMetaMetaclass that all matcher nodes uses.
class
libcst.matchers._matcher_base.AllOfMatcher that matches all of its options.
class
libcst.matchers._matcher_base.BaseMatcherNodeBase class that all concrete matchers subclass from.
func
libcst.matchers._matcher_base.DoesNotMatch(obj:_OtherNodeT) -> _OtherNodeTMatcher helper that inverts the match result of its child.
class
libcst.matchers._matcher_base.OneOfMatcher that matches any one of its options.
class
libcst.matchers._matcher_base.TypeOfMatcher that matches any one of the given types.
func
libcst.matchers._visitors.is_property(obj:object, attr_name:str) -> boolCheck if obj.attr is a property without evaluating it.
class
libcst.metadata.base_provider.BaseMetadataProviderThe low-level base class for all metadata providers.
method
libcst.metadata.base_provider.BaseMetadataProvider.set_metadata(node:'CSTNode', value:MaybeLazyMetadataT) -> NoneRecord a metadata value ``value`` for ``node``.
class
libcst.metadata.name_provider.FullyQualifiedNameProviderProvide fully qualified names for CST nodes.
class
libcst.metadata.position_provider.PositionProviderGenerates line and column metadata.
class
libcst.metadata.position_provider.WhitespaceInclusivePositionProviderGenerates line and column metadata.
class
libcst.metadata.scope_provider.AccessAn Access records an access of an assignment.
method
libcst.metadata.scope_provider.Access.referents() -> Collection['BaseAssignment']Return all assignments of the access.
class
libcst.metadata.scope_provider.AccessesA container to provide all accesses in a scope.
class
libcst.metadata.scope_provider.AssignmentAn assignment records the name, CSTNode and its accesses.
class
libcst.metadata.scope_provider.AssignmentsA container to provide all assignments in a scope.
class
libcst.metadata.scope_provider.BuiltinScopeA BuiltinScope represents python builtin declarations.
class
libcst.metadata.scope_provider.ClassScopeWhen a class is defined, it creates a ClassScope.
class
libcst.metadata.scope_provider.FunctionScopeWhen a function is defined, it creates a FunctionScope.
class
libcst.metadata.scope_provider.GlobalScopeA GlobalScope is the scope of module.
class
libcst.metadata.scope_provider.ImportAssignmentAn assignment records the import node and it's alias
class
libcst.metadata.scope_provider.ScopeBase class of all scope classes.
この情報について
掲載しているシグネチャは Instagram/LibCST の公開ソースコードを
Python の ast モジュールで静的解析し、引数名・デフォルト値・
型注釈・戻り値型をそのまま抽出したものです。実装コードは保存していません。
詳しくは仕組みの解説をご覧ください。