Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/libcst/__init__.py: 91%
23 statements
« prev ^ index » next coverage.py v7.3.1, created at 2023-09-25 06:43 +0000
« prev ^ index » next coverage.py v7.3.1, created at 2023-09-25 06:43 +0000
1# Copyright (c) Meta Platforms, Inc. and affiliates.
2#
3# This source code is licensed under the MIT license found in the
4# LICENSE file in the root directory of this source tree.
6from libcst._batched_visitor import BatchableCSTVisitor, visit_batched
7from libcst._exceptions import MetadataException, ParserSyntaxError
8from libcst._flatten_sentinel import FlattenSentinel
9from libcst._maybe_sentinel import MaybeSentinel
10from libcst._metadata_dependent import MetadataDependent
11from libcst._nodes.base import CSTNode, CSTValidationError
12from libcst._nodes.expression import (
13 Annotation,
14 Arg,
15 Asynchronous,
16 Attribute,
17 Await,
18 BaseAssignTargetExpression,
19 BaseComp,
20 BaseDelTargetExpression,
21 BaseDict,
22 BaseDictElement,
23 BaseElement,
24 BaseExpression,
25 BaseFormattedStringContent,
26 BaseList,
27 BaseNumber,
28 BaseSet,
29 BaseSimpleComp,
30 BaseSlice,
31 BaseString,
32 BinaryOperation,
33 BooleanOperation,
34 Call,
35 Comparison,
36 ComparisonTarget,
37 CompFor,
38 CompIf,
39 ConcatenatedString,
40 Dict,
41 DictComp,
42 DictElement,
43 Element,
44 Ellipsis,
45 Float,
46 FormattedString,
47 FormattedStringExpression,
48 FormattedStringText,
49 From,
50 GeneratorExp,
51 IfExp,
52 Imaginary,
53 Index,
54 Integer,
55 Lambda,
56 LeftCurlyBrace,
57 LeftParen,
58 LeftSquareBracket,
59 List,
60 ListComp,
61 Name,
62 NamedExpr,
63 Param,
64 Parameters,
65 ParamSlash,
66 ParamStar,
67 RightCurlyBrace,
68 RightParen,
69 RightSquareBracket,
70 Set,
71 SetComp,
72 SimpleString,
73 Slice,
74 StarredDictElement,
75 StarredElement,
76 Subscript,
77 SubscriptElement,
78 Tuple,
79 UnaryOperation,
80 Yield,
81)
82from libcst._nodes.module import Module
83from libcst._nodes.op import (
84 Add,
85 AddAssign,
86 And,
87 AssignEqual,
88 BaseAugOp,
89 BaseBinaryOp,
90 BaseBooleanOp,
91 BaseCompOp,
92 BaseUnaryOp,
93 BitAnd,
94 BitAndAssign,
95 BitInvert,
96 BitOr,
97 BitOrAssign,
98 BitXor,
99 BitXorAssign,
100 Colon,
101 Comma,
102 Divide,
103 DivideAssign,
104 Dot,
105 Equal,
106 FloorDivide,
107 FloorDivideAssign,
108 GreaterThan,
109 GreaterThanEqual,
110 ImportStar,
111 In,
112 Is,
113 IsNot,
114 LeftShift,
115 LeftShiftAssign,
116 LessThan,
117 LessThanEqual,
118 MatrixMultiply,
119 MatrixMultiplyAssign,
120 Minus,
121 Modulo,
122 ModuloAssign,
123 Multiply,
124 MultiplyAssign,
125 Not,
126 NotEqual,
127 NotIn,
128 Or,
129 Plus,
130 Power,
131 PowerAssign,
132 RightShift,
133 RightShiftAssign,
134 Semicolon,
135 Subtract,
136 SubtractAssign,
137)
138from libcst._nodes.statement import (
139 AnnAssign,
140 AsName,
141 Assert,
142 Assign,
143 AssignTarget,
144 AugAssign,
145 BaseCompoundStatement,
146 BaseSmallStatement,
147 BaseStatement,
148 BaseSuite,
149 Break,
150 ClassDef,
151 Continue,
152 Decorator,
153 Del,
154 Else,
155 ExceptHandler,
156 ExceptStarHandler,
157 Expr,
158 Finally,
159 For,
160 FunctionDef,
161 Global,
162 If,
163 Import,
164 ImportAlias,
165 ImportFrom,
166 IndentedBlock,
167 Match,
168 MatchAs,
169 MatchCase,
170 MatchClass,
171 MatchKeywordElement,
172 MatchList,
173 MatchMapping,
174 MatchMappingElement,
175 MatchOr,
176 MatchOrElement,
177 MatchPattern,
178 MatchSequence,
179 MatchSequenceElement,
180 MatchSingleton,
181 MatchStar,
182 MatchTuple,
183 MatchValue,
184 NameItem,
185 Nonlocal,
186 ParamSpec,
187 Pass,
188 Raise,
189 Return,
190 SimpleStatementLine,
191 SimpleStatementSuite,
192 Try,
193 TryStar,
194 TypeAlias,
195 TypeParam,
196 TypeParameters,
197 TypeVar,
198 TypeVarTuple,
199 While,
200 With,
201 WithItem,
202)
203from libcst._nodes.whitespace import (
204 BaseParenthesizableWhitespace,
205 Comment,
206 EmptyLine,
207 Newline,
208 ParenthesizedWhitespace,
209 SimpleWhitespace,
210 TrailingWhitespace,
211)
212from libcst._parser.entrypoints import parse_expression, parse_module, parse_statement
213from libcst._parser.types.config import (
214 KNOWN_PYTHON_VERSION_STRINGS,
215 PartialParserConfig,
216)
217from libcst._removal_sentinel import RemovalSentinel, RemoveFromParent
218from libcst._visitors import CSTNodeT, CSTTransformer, CSTVisitor, CSTVisitorT
220try:
221 from libcst._version import version as LIBCST_VERSION
222except ImportError:
223 LIBCST_VERSION = "unknown"
224from libcst.helpers import ( # from libcst import ensure_type is deprecated, will be removed in 0.4.0
225 ensure_type,
226)
227from libcst.metadata.base_provider import (
228 BaseMetadataProvider,
229 BatchableMetadataProvider,
230 VisitorMetadataProvider,
231)
232from libcst.metadata.wrapper import MetadataWrapper
234__all__ = [
235 "KNOWN_PYTHON_VERSION_STRINGS",
236 "LIBCST_VERSION",
237 "BatchableCSTVisitor",
238 "CSTNodeT",
239 "CSTTransformer",
240 "CSTValidationError",
241 "CSTVisitor",
242 "CSTVisitorT",
243 "FlattenSentinel",
244 "MaybeSentinel",
245 "MetadataException",
246 "ParserSyntaxError",
247 "PartialParserConfig",
248 "RemoveFromParent",
249 "RemovalSentinel",
250 "ensure_type", # from libcst import ensure_type is deprecated, will be removed in 0.4.0
251 "visit_batched",
252 "parse_module",
253 "parse_expression",
254 "parse_statement",
255 "CSTNode",
256 "Module",
257 "Annotation",
258 "Arg",
259 "Asynchronous",
260 "Attribute",
261 "Await",
262 "BaseAssignTargetExpression",
263 "BaseComp",
264 "BaseDelTargetExpression",
265 "BaseDict",
266 "BaseDictElement",
267 "BaseElement",
268 "BaseExpression",
269 "BaseFormattedStringContent",
270 "BaseList",
271 "BaseNumber",
272 "BaseSet",
273 "BaseSimpleComp",
274 "BaseSlice",
275 "BaseString",
276 "BinaryOperation",
277 "BooleanOperation",
278 "Call",
279 "Comparison",
280 "ComparisonTarget",
281 "CompFor",
282 "CompIf",
283 "ConcatenatedString",
284 "Dict",
285 "DictComp",
286 "DictElement",
287 "Element",
288 "Ellipsis",
289 "Float",
290 "FormattedString",
291 "FormattedStringExpression",
292 "FormattedStringText",
293 "From",
294 "GeneratorExp",
295 "IfExp",
296 "Imaginary",
297 "Index",
298 "Integer",
299 "Lambda",
300 "LeftCurlyBrace",
301 "LeftParen",
302 "LeftSquareBracket",
303 "List",
304 "ListComp",
305 "Name",
306 "NamedExpr",
307 "Param",
308 "Parameters",
309 "ParamSlash",
310 "ParamStar",
311 "RightCurlyBrace",
312 "RightParen",
313 "RightSquareBracket",
314 "Set",
315 "SetComp",
316 "SimpleString",
317 "Slice",
318 "StarredDictElement",
319 "StarredElement",
320 "Subscript",
321 "SubscriptElement",
322 "Tuple",
323 "UnaryOperation",
324 "Yield",
325 "Add",
326 "AddAssign",
327 "And",
328 "AssignEqual",
329 "BaseAugOp",
330 "BaseBinaryOp",
331 "BaseBooleanOp",
332 "BaseCompOp",
333 "BaseUnaryOp",
334 "BitAnd",
335 "BitAndAssign",
336 "BitInvert",
337 "BitOr",
338 "BitOrAssign",
339 "BitXor",
340 "BitXorAssign",
341 "Colon",
342 "Comma",
343 "Divide",
344 "DivideAssign",
345 "Dot",
346 "Equal",
347 "FloorDivide",
348 "FloorDivideAssign",
349 "GreaterThan",
350 "GreaterThanEqual",
351 "ImportStar",
352 "In",
353 "Is",
354 "IsNot",
355 "LeftShift",
356 "LeftShiftAssign",
357 "LessThan",
358 "LessThanEqual",
359 "MatrixMultiply",
360 "MatrixMultiplyAssign",
361 "Minus",
362 "Modulo",
363 "ModuloAssign",
364 "Multiply",
365 "MultiplyAssign",
366 "Not",
367 "NotEqual",
368 "NotIn",
369 "Or",
370 "Plus",
371 "Power",
372 "PowerAssign",
373 "RightShift",
374 "RightShiftAssign",
375 "Semicolon",
376 "Subtract",
377 "SubtractAssign",
378 "AnnAssign",
379 "AsName",
380 "Assert",
381 "Assign",
382 "AssignTarget",
383 "AugAssign",
384 "BaseCompoundStatement",
385 "BaseSmallStatement",
386 "BaseStatement",
387 "BaseSuite",
388 "Break",
389 "ClassDef",
390 "Continue",
391 "Decorator",
392 "Del",
393 "Else",
394 "ExceptHandler",
395 "ExceptStarHandler",
396 "Expr",
397 "Finally",
398 "For",
399 "FunctionDef",
400 "Global",
401 "If",
402 "Import",
403 "ImportAlias",
404 "ImportFrom",
405 "IndentedBlock",
406 "Match",
407 "MatchCase",
408 "MatchAs",
409 "MatchClass",
410 "MatchKeywordElement",
411 "MatchList",
412 "MatchMapping",
413 "MatchMappingElement",
414 "MatchOr",
415 "MatchOrElement",
416 "MatchPattern",
417 "MatchSequence",
418 "MatchSequenceElement",
419 "MatchSingleton",
420 "MatchStar",
421 "MatchTuple",
422 "MatchValue",
423 "NameItem",
424 "Nonlocal",
425 "Pass",
426 "Raise",
427 "Return",
428 "SimpleStatementLine",
429 "SimpleStatementSuite",
430 "Try",
431 "TryStar",
432 "While",
433 "With",
434 "WithItem",
435 "BaseParenthesizableWhitespace",
436 "Comment",
437 "EmptyLine",
438 "Newline",
439 "ParenthesizedWhitespace",
440 "SimpleWhitespace",
441 "TrailingWhitespace",
442 "BaseMetadataProvider",
443 "BatchableMetadataProvider",
444 "VisitorMetadataProvider",
445 "MetadataDependent",
446 "MetadataWrapper",
447 "TypeVar",
448 "TypeVarTuple",
449 "ParamSpec",
450 "TypeParam",
451 "TypeParameters",
452 "TypeAlias",
453]