mirror of
https://github.com/Instagram/LibCST.git
synced 2025-12-23 10:35:53 +00:00
167 lines
2.9 KiB
Python
167 lines
2.9 KiB
Python
# Copyright (c) Facebook, Inc. and its affiliates.
|
|
#
|
|
# This source code is licensed under the MIT license found in the
|
|
# LICENSE file in the root directory of this source tree.
|
|
|
|
# pyre-strict
|
|
|
|
"""
|
|
This package contains CSTNode and all of the subclasses needed to express Python's full
|
|
grammar in a whitespace-sensitive fashion, forming a "Concrete" Syntax Tree (CST).
|
|
"""
|
|
|
|
# We don't export BaseLeaf/BaseValueToken from _base, because we consider those
|
|
# implementation details. Those base classes shouldn't be useful outside of this
|
|
# package.
|
|
|
|
from libcst.nodes._base import CSTNode, CSTValidationError
|
|
from libcst.nodes._dummy import DummyNode
|
|
from libcst.nodes._expression import (
|
|
Annotation,
|
|
Arg,
|
|
Attribute,
|
|
Await,
|
|
BaseAtom,
|
|
BaseElement,
|
|
BaseExpression,
|
|
BaseFormattedStringContent,
|
|
BinaryOperation,
|
|
BooleanOperation,
|
|
Call,
|
|
Comparison,
|
|
ComparisonTarget,
|
|
ConcatenatedString,
|
|
Element,
|
|
Ellipses,
|
|
ExtSlice,
|
|
Float,
|
|
FormattedString,
|
|
FormattedStringExpression,
|
|
FormattedStringText,
|
|
From,
|
|
IfExp,
|
|
Imaginary,
|
|
Index,
|
|
Integer,
|
|
Lambda,
|
|
LeftParen,
|
|
LeftSquareBracket,
|
|
Name,
|
|
Number,
|
|
Param,
|
|
Parameters,
|
|
ParamStar,
|
|
RightParen,
|
|
RightSquareBracket,
|
|
SimpleString,
|
|
Slice,
|
|
StarredElement,
|
|
Subscript,
|
|
Tuple,
|
|
UnaryOperation,
|
|
Yield,
|
|
)
|
|
from libcst.nodes._module import Module
|
|
from libcst.nodes._op import (
|
|
Add,
|
|
AddAssign,
|
|
And,
|
|
AssignEqual,
|
|
BaseAugOp,
|
|
BaseBinaryOp,
|
|
BaseBooleanOp,
|
|
BaseCompOp,
|
|
BaseUnaryOp,
|
|
BitAnd,
|
|
BitAndAssign,
|
|
BitInvert,
|
|
BitOr,
|
|
BitOrAssign,
|
|
BitXor,
|
|
BitXorAssign,
|
|
Colon,
|
|
Comma,
|
|
Divide,
|
|
DivideAssign,
|
|
Dot,
|
|
Equal,
|
|
FloorDivide,
|
|
FloorDivideAssign,
|
|
GreaterThan,
|
|
GreaterThanEqual,
|
|
ImportStar,
|
|
In,
|
|
Is,
|
|
IsNot,
|
|
LeftShift,
|
|
LeftShiftAssign,
|
|
LessThan,
|
|
LessThanEqual,
|
|
MatrixMultiply,
|
|
MatrixMultiplyAssign,
|
|
Minus,
|
|
Modulo,
|
|
ModuloAssign,
|
|
Multiply,
|
|
MultiplyAssign,
|
|
Not,
|
|
NotEqual,
|
|
NotIn,
|
|
Or,
|
|
Plus,
|
|
Power,
|
|
PowerAssign,
|
|
RightShift,
|
|
RightShiftAssign,
|
|
Semicolon,
|
|
Subtract,
|
|
SubtractAssign,
|
|
)
|
|
from libcst.nodes._statement import (
|
|
AnnAssign,
|
|
AsName,
|
|
Assert,
|
|
Assign,
|
|
AssignTarget,
|
|
Asynchronous,
|
|
AugAssign,
|
|
BaseCompoundStatement,
|
|
BaseSmallStatement,
|
|
BaseSuite,
|
|
Break,
|
|
ClassDef,
|
|
Continue,
|
|
Decorator,
|
|
Del,
|
|
Else,
|
|
ExceptHandler,
|
|
Expr,
|
|
Finally,
|
|
For,
|
|
FunctionDef,
|
|
Global,
|
|
If,
|
|
Import,
|
|
ImportAlias,
|
|
ImportFrom,
|
|
IndentedBlock,
|
|
NameItem,
|
|
Nonlocal,
|
|
Pass,
|
|
Raise,
|
|
Return,
|
|
SimpleStatementLine,
|
|
SimpleStatementSuite,
|
|
Try,
|
|
While,
|
|
With,
|
|
WithItem,
|
|
)
|
|
from libcst.nodes._whitespace import (
|
|
Comment,
|
|
EmptyLine,
|
|
Newline,
|
|
ParenthesizedWhitespace,
|
|
SimpleWhitespace,
|
|
TrailingWhitespace,
|
|
)
|