LibCST icon indicating copy to clipboard operation
LibCST copied to clipboard

A concrete syntax tree parser and serializer library for Python that preserves many aspects of Python's abstract syntax tree

Results 171 LibCST issues
Sort by recently updated
recently updated
newest added

Codemod to convert typing.Union and typing.Optional to [PEP 604](https://www.python.org/dev/peps/pep-0604/) syntax and add `__future__` as required.

enhancement
codemod

for a function like: ```python def fun(arg): pass ``` the fully qualified name for `arg` will be `fun..arg`, but for any call to the function that chooses to call it...

bug
codemod

``` class X: import random a = [random.lol for _ in ()] ``` `random` here is used by the class body, but gets removed by the codemod. This might be...

bug
codemod

One consequence of the issue mentioned [here](https://github.com/Instagram/LibCST/pull/269#issuecomment-604640756), where CSTTransformer always replaces nodes, is that methods that rely on nodes-by-identity become harder to use in bulk. For example, I'm trying to...

enhancement
machinery

In some lint or codemod use cases, we want to know the super classes of a class to see if it's inherited from a specific class in order to enforce...

codemod

`f"{a or ""}"` this is invalid syntax but LibCST handles it and renders the invalid code. We can either: - automatically escape the string quotes in the inner expression. -...

parsing

`ast` and libcst looks similar but different in many design details. To make it more clear and prevent confusion for users familiar with ast (I'm one of them), it worth...

documentation

Is it possible to parse code that has syntax errors in part of the code? I'd like to refactor code that might still be incomplete (and this, might have syntax...

enhancement
parsing

While working on my [`shed` autoformatter](https://github.com/Zac-HD/shed/), which includes some libcst-based passes, [Hypothesmith](https://github.com/Zac-HD/hypothesmith) uncovered a bug: https://github.com/Instagram/LibCST/blob/c22ed6a4c67e5f16f0b928ca8a0c2944056eb216/libcst/_parser/types/config.py#L20 For example, `'class A:\n\x0c pass\n'` is a valid class-declaration. It can even be parsed...

bug
parsing

This appears to be legal syntax (no space before `as`), found in cpython's `test/test_importlib/source/test_file_loader.py` by accident: ``` with f()as g: pass ```

bug
parsing