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 195 LibCST issues
Sort by recently updated
recently updated
newest added

Below I've attached a real file that has been published on PyPI. It contains an impressively gigantic expression. [huge.txt](https://github.com/Instagram/LibCST/files/12445264/huge.txt) Parsing this file with the current libcst master branch causes a...

Hi, since decorators are sub nodes of `FunctionDef` and `ClassDef` I expected the code range to cover them. Is this intended? ```python import libcst import libcst.metadata as l_metadata metadata_wrapper =...

bug
codemod

https://peps.python.org/pep-0586/#shortening-unions-of-literals The parser is trying to see if the string "r+" refers to some stringified-type and fails to parse it as an expression, but it should just take "r+" as...

bug
codemod

The library can be built on musl with no issues currently. Confirmed by building it using `alpine:3.17` as a base image: ```dockerfile FROM alpine:3.17 AS build WORKDIR /tmp RUN apk...

enhancement

Here is a full repro: ``` python import libcst as cst def f(node: cst.Call) -> cst.Call: arg = node.args[0] new_arg = arg.with_changes(value=cst.Integer(value="2")) return node.deep_replace(arg, new_arg) node = cst.ensure_type(cst.parse_expression("func(1)"), cst.Call) print(f(node))...

bug

```python handcrafted = [ # escaped indentation of some kind? 'fr"\\\n"', 'if _:\n _\n\\\nif _:\ _', # mixed tabs and spaces; many variations here 'if _:\n if _:\n\t _', ]...

bug
parsing

## Summary Fixes #532 ## Test Plan Unit tests added/tweaked for this case, also the remove imports codemod tests serve as an integration test.

CLA Signed

Having access to type information of a node would be hugely beneficial to refactoring. LibCST offers this to [Pyre users via the Pyre Query API](https://libcst.readthedocs.io/en/latest/metadata.html#type-inference-metadata), but not to projects using...

enhancement

Not sure if this should be considered incorrect, but it was surprising for me. With code like this `vmap(a)(b)`, and the tree like this: ``` Call( func=Call( func=Name( value='vmap', ```...

```python handcrafted = [ # various ways to look like you're calling a keyword '(_ if _ else _)in _', '_ if _ else(lambda:_)', '_ if(_ if _ else _)...

bug
parsing