Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@

## Fixed
* Fix type of `evaluated_value` on string to allow bytes by @ljodal in https://github.com/Instagram/LibCST/pull/721
* Fix Sentinal typo by @kit1980 in https://github.com/Instagram/LibCST/pull/948
* Fix Sentinel typo by @kit1980 in https://github.com/Instagram/LibCST/pull/948
* Allow no whitespace after lambda body in certain cases by @zsol in https://github.com/Instagram/LibCST/pull/939
* Fix whitespace, fstring, walrus related parse errors (#939, #938, #937,
#936, #935, #934, #933, #932, #931) by @zsol in https://github.com/Instagram/LibCST/pull/940
Expand Down Expand Up @@ -346,7 +346,7 @@ the `LIBCST_PARSER_TYPE` environment variable set to `pure`.


## Added
* Python 3.11 rutime support
* Python 3.11 runtime support
* test using python 3.11 beta versions by @zsol in https://github.com/Instagram/LibCST/pull/723
* Python 3.11 wheels by @vfazio in https://github.com/Instagram/LibCST/pull/801
* Raise informative exception when metadata is unresolved in a metadata-based match by @MapleCCC in https://github.com/Instagram/LibCST/pull/757
Expand Down Expand Up @@ -682,7 +682,7 @@ wheels from now on.
## Fixed

- Spaces around walrus operator are not required [#368](https://github.com/Instagram/LibCST/pull/368)
- SaveMachedNode now matches with trailing empty wildcards [#356](https://github.com/Instagram/LibCST/pull/356)
- SaveMatchedNode now matches with trailing empty wildcards [#356](https://github.com/Instagram/LibCST/pull/356)
- Correctly extract wildcard matchers [#355](https://github.com/Instagram/LibCST/pull/355)

# 0.3.9 - 2020-09-07
Expand Down Expand Up @@ -857,7 +857,7 @@ wheels from now on.
## Updated

- Codemod command can now discover codemods in subdirectories of configured modules.
- Updgraded Pyre dependency to 0.0.39.
- Upgraded Pyre dependency to 0.0.39.

## Fixed

Expand Down
4 changes: 2 additions & 2 deletions docs/source/nodes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ checks.
Augmented Assignment Operators
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Nodes that are used with :class:`~libcst.AugAssign` to perform some agumented
Nodes that are used with :class:`~libcst.AugAssign` to perform some augmented
assignment.

.. class:: libcst.AddAssign
Expand All @@ -371,7 +371,7 @@ checks.
Miscellaneous
-------------

Miscelaneous nodes that are purely syntactic trivia. While python requires these nodes
Miscellaneous nodes that are purely syntactic trivia. While python requires these nodes
in order to parse a module, statement or expression they do not carry any meaning on
their own.

Expand Down
2 changes: 1 addition & 1 deletion docs/source/scope_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
"source": [
"Automatically Remove Unused Import\n",
"==================================\n",
"Unused import is a commmon code suggestion provided by lint tool like `flake8 F401 <https://lintlyci.github.io/Flake8Rules/rules/F401.html>`_ ``imported but unused``.\n",
"Unused import is a common code suggestion provided by lint tool like `flake8 F401 <https://lintlyci.github.io/Flake8Rules/rules/F401.html>`_ ``imported but unused``.\n",
"Even though reporting unused imports is already useful, with LibCST we can provide an automatic fix to remove unused imports. That can make the suggestion more actionable and save developer's time.\n",
"\n",
"An import statement may import multiple names, we want to remove those unused names from the import statement. If all the names in the import statement are not used, we remove the entire import.\n",
Expand Down
4 changes: 2 additions & 2 deletions libcst/_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ class ParserSyntaxError(Exception):
# syntax error occurred in the code.
_lines: Sequence[str]

#: The one-indexed line where the error occured.
#: The one-indexed line where the error occurred.
raw_line: int

#: The zero-indexed column as a number of characters from the start of the line
#: where the error occured.
#: where the error occurred.
raw_column: int

def __init__(
Expand Down
2 changes: 1 addition & 1 deletion libcst/_metadata_dependent.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class _UNDEFINED_DEFAULT:
class LazyValue(Generic[_T]):
"""
The class for implementing a lazy metadata loading mechanism that improves the
performance when retriving expensive metadata (e.g., qualified names). Providers
performance when retrieving expensive metadata (e.g., qualified names). Providers
including :class:`~libcst.metadata.QualifiedNameProvider` use this class to load
the metadata of a certain node lazily when calling
:func:`~libcst.MetadataDependent.get_metadata`.
Expand Down
24 changes: 12 additions & 12 deletions libcst/_nodes/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def _safe_to_use_with_word_operator(self, position: ExpressionPosition) -> bool:
such as "not" without space between the operator an ourselves. Examples
where this is true are "not(True)", "(1)in[1,2,3]", etc. This base
function handles parenthesized nodes, but certain nodes such as tuples,
dictionaries and lists will override this to signifiy that they're always
dictionaries and lists will override this to signify that they're always
safe.
"""

Expand Down Expand Up @@ -580,14 +580,14 @@ class SimpleString(_BasePrefixedString):
(f-string), including triple-quoted multi-line strings.
"""

#: The texual representation of the string, including quotes, prefix characters, and
#: The textual representation of the string, including quotes, prefix characters, and
#: any escape characters present in the original source code , such as
#: ``r"my string\n"``. To remove the quotes and interpret any escape characters,
#: use the calculated property :attr:`~SimpleString.evaluated_value`.
value: str

lpar: Sequence[LeftParen] = ()
#: Sequence of parenthesis for precidence dictation.
#: Sequence of parenthesis for precedence dictation.
rpar: Sequence[RightParen] = ()

def _validate(self) -> None:
Expand Down Expand Up @@ -898,7 +898,7 @@ class FormattedString(_BasePrefixedString):
end: Literal['"', "'", '"""', "'''"] = '"'

lpar: Sequence[LeftParen] = ()
#: Sequence of parenthesis for precidence dictation.
#: Sequence of parenthesis for precedence dictation.
rpar: Sequence[RightParen] = ()

def _validate(self) -> None:
Expand Down Expand Up @@ -1145,7 +1145,7 @@ class TemplatedString(_BasePrefixedString):
end: Literal['"', "'", '"""', "'''"] = '"'

lpar: Sequence[LeftParen] = ()
#: Sequence of parenthesis for precidence dictation.
#: Sequence of parenthesis for precedence dictation.
rpar: Sequence[RightParen] = ()

def _validate(self) -> None:
Expand Down Expand Up @@ -1226,7 +1226,7 @@ class ConcatenatedString(BaseString):
right: Union[SimpleString, FormattedString, "ConcatenatedString"]

lpar: Sequence[LeftParen] = ()
#: Sequence of parenthesis for precidence dictation.
#: Sequence of parenthesis for precedence dictation.
rpar: Sequence[RightParen] = ()

#: Whitespace between the ``left`` and ``right`` substrings.
Expand Down Expand Up @@ -1346,7 +1346,7 @@ def _codegen_impl(self, state: CodegenState) -> None:
class Comparison(BaseExpression):
"""
A comparison between multiple values such as ``x < y``, ``x < y < z``, or
``x in [y, z]``. These comparisions typically result in boolean values.
``x in [y, z]``. These comparisons typically result in boolean values.

Unlike :class:`BinaryOperation` and :class:`BooleanOperation`, comparisons are not
restricted to a left and right child. Instead they can contain an arbitrary number
Expand All @@ -1372,7 +1372,7 @@ class Comparison(BaseExpression):
"""

#: The first value in the full sequence of values to compare. This value will be
#: compared against the first value in ``comparisions``.
#: compared against the first value in ``comparisons``.
left: BaseExpression

#: Pairs of :class:`BaseCompOp` operators and expression values to compare. These
Expand Down Expand Up @@ -1503,7 +1503,7 @@ class BinaryOperation(BaseExpression):
nodes, such as ``and`` or ``or``. Instead, those operations are provided by
:class:`BooleanOperation`.

It also does not include support for comparision operators performed with
It also does not include support for comparison operators performed with
:class:`BaseCompOp`, such as ``<``, ``>=``, ``==``, ``is``, or ``in``. Instead,
those operations are provided by :class:`Comparison`.
"""
Expand Down Expand Up @@ -1556,7 +1556,7 @@ class BooleanOperation(BaseExpression):
nodes, such as ``+`` or ``<<``. Instead, those operations are provided by
:class:`BinaryOperation`.

It also does not include support for comparision operators performed with
It also does not include support for comparison operators performed with
:class:`BaseCompOp`, such as ``<``, ``>=``, ``==``, ``is``, or ``in``. Instead,
those operations are provided by :class:`Comparison`.
"""
Expand Down Expand Up @@ -2133,7 +2133,7 @@ class Parameters(CSTNode):
#: parameters with defaults must all be after those without defaults.
posonly_params: Sequence[Param] = ()

#: Optional sentinel that dictates parameters preceeding are positional-only
#: Optional sentinel that dictates parameters preceding are positional-only
#: args.
posonly_ind: Union[ParamSlash, MaybeSentinel] = MaybeSentinel.DEFAULT

Expand Down Expand Up @@ -3450,7 +3450,7 @@ def _validate(self) -> None:
if len(self.elements) == 0:
raise CSTValidationError(
"A literal set must have at least one element. A zero-element set "
+ "would be syntatically ambiguous with an empty dict, `{}`."
+ "would be syntactically ambiguous with an empty dict, `{}`."
)

def _visit_and_replace_children(self, visitor: CSTVisitorT) -> "Set":
Expand Down
20 changes: 10 additions & 10 deletions libcst/_nodes/op.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _get_token(self) -> str: ...
class _BaseTwoTokenOp(CSTNode, ABC):
"""
Any node that ends up as two tokens, so we must preserve the whitespace
in beteween them.
in between them.
"""

__slots__ = ()
Expand Down Expand Up @@ -597,7 +597,7 @@ def _get_token(self) -> str:
@dataclass(frozen=True)
class LessThan(BaseCompOp, _BaseOneTokenOp):
"""
A comparision operator that can be used in a :class:`Comparison` expression.
A comparison operator that can be used in a :class:`Comparison` expression.
"""

#: Any space that appears directly before this operator.
Expand All @@ -614,7 +614,7 @@ def _get_token(self) -> str:
@dataclass(frozen=True)
class GreaterThan(BaseCompOp, _BaseOneTokenOp):
"""
A comparision operator that can be used in a :class:`Comparison` expression.
A comparison operator that can be used in a :class:`Comparison` expression.
"""

#: Any space that appears directly before this operator.
Expand All @@ -631,7 +631,7 @@ def _get_token(self) -> str:
@dataclass(frozen=True)
class Equal(BaseCompOp, _BaseOneTokenOp):
"""
A comparision operator that can be used in a :class:`Comparison` expression.
A comparison operator that can be used in a :class:`Comparison` expression.
"""

#: Any space that appears directly before this operator.
Expand All @@ -648,7 +648,7 @@ def _get_token(self) -> str:
@dataclass(frozen=True)
class LessThanEqual(BaseCompOp, _BaseOneTokenOp):
"""
A comparision operator that can be used in a :class:`Comparison` expression.
A comparison operator that can be used in a :class:`Comparison` expression.
"""

#: Any space that appears directly before this operator.
Expand All @@ -665,7 +665,7 @@ def _get_token(self) -> str:
@dataclass(frozen=True)
class GreaterThanEqual(BaseCompOp, _BaseOneTokenOp):
"""
A comparision operator that can be used in a :class:`Comparison` expression.
A comparison operator that can be used in a :class:`Comparison` expression.
"""

#: Any space that appears directly before this operator.
Expand Down Expand Up @@ -721,7 +721,7 @@ def _get_token(self) -> str:
@dataclass(frozen=True)
class In(BaseCompOp, _BaseOneTokenOp):
"""
A comparision operator that can be used in a :class:`Comparison` expression.
A comparison operator that can be used in a :class:`Comparison` expression.
"""

#: Any space that appears directly before this operator.
Expand All @@ -738,7 +738,7 @@ def _get_token(self) -> str:
@dataclass(frozen=True)
class NotIn(BaseCompOp, _BaseTwoTokenOp):
"""
A comparision operator that can be used in a :class:`Comparison` expression.
A comparison operator that can be used in a :class:`Comparison` expression.

This operator spans two tokens that must be separated by at least one space,
so there is a third whitespace attribute to represent this.
Expand All @@ -761,7 +761,7 @@ def _get_tokens(self) -> Tuple[str, str]:
@dataclass(frozen=True)
class Is(BaseCompOp, _BaseOneTokenOp):
"""
A comparision operator that can be used in a :class:`Comparison` expression.
A comparison operator that can be used in a :class:`Comparison` expression.
"""

#: Any space that appears directly before this operator.
Expand All @@ -778,7 +778,7 @@ def _get_token(self) -> str:
@dataclass(frozen=True)
class IsNot(BaseCompOp, _BaseTwoTokenOp):
"""
A comparision operator that can be used in a :class:`Comparison` expression.
A comparison operator that can be used in a :class:`Comparison` expression.

This operator spans two tokens that must be separated by at least one space,
so there is a third whitespace attribute to represent this.
Expand Down
6 changes: 3 additions & 3 deletions libcst/_nodes/statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def _validate(self) -> None:
raise CSTValidationError(
"All but the last SmallStatement in a SimpleStatementLine or "
+ "SimpleStatementSuite must have a trailing semicolon. Otherwise, "
+ "there's no way to syntatically disambiguate each SmallStatement "
+ "there's no way to syntactically disambiguate each SmallStatement "
+ "on the same line."
)

Expand Down Expand Up @@ -678,7 +678,7 @@ class IndentedBlock(BaseSuite):
indent: Optional[str] = None

#: Any trailing comments or lines after the dedent that are owned by this indented
#: block. Statements own preceeding and same-line trailing comments, but not
#: block. Statements own preceding and same-line trailing comments, but not
#: trailing lines, so it falls on :class:`IndentedBlock` to own it. In the case
#: that a statement follows an :class:`IndentedBlock`, that statement will own the
#: comments and lines that are at the same indent as the statement, and this
Expand Down Expand Up @@ -2751,7 +2751,7 @@ class Match(BaseCompoundStatement):
indent: Optional[str] = None

#: Any trailing comments or lines after the dedent that are owned by this match
#: block. Statements own preceeding and same-line trailing comments, but not
#: block. Statements own preceding and same-line trailing comments, but not
#: trailing lines, so it falls on :class:`Match` to own it. In the case
#: that a statement follows a :class:`Match` block, that statement will own the
#: comments and lines that are at the same indent as the statement, and this
Expand Down
4 changes: 2 additions & 2 deletions libcst/_nodes/tests/test_atom.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,14 +240,14 @@ class AtomTest(CSTNodeTest):
"parser": parse_expression,
"expected_position": CodeRange((1, 1), (1, 7)),
},
# Simple elipses
# Simple ellipses
{
"node": cst.Ellipsis(),
"code": "...",
"parser": parse_expression,
"expected_position": None,
},
# Parenthesized elipses
# Parenthesized ellipses
{
"node": cst.Ellipsis(lpar=(cst.LeftParen(),), rpar=(cst.RightParen(),)),
"code": "(...)",
Expand Down
2 changes: 1 addition & 1 deletion libcst/_nodes/tests/test_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def test_valid(
),
"at least one space around comparison operator",
),
# whitespace around the comparision itself
# whitespace around the comparison itself
# a ifb > c else d
(
lambda: cst.IfExp(
Expand Down
2 changes: 1 addition & 1 deletion libcst/_nodes/tests/test_ifexp.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class IfExpTest(CSTNodeTest):
@data_provider(
(
# Simple if experessions
# Simple if expressions
(
cst.IfExp(
body=cst.Name("foo"), test=cst.Name("bar"), orelse=cst.Name("baz")
Expand Down
2 changes: 1 addition & 1 deletion libcst/_nodes/tests/test_yield.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def test_valid(
),
"Must have at least one space after 'yield' keyword",
),
# MAke sure we have adequate space after from
# Make sure we have adequate space after from
(
lambda: cst.Yield(
cst.From(
Expand Down
4 changes: 2 additions & 2 deletions libcst/_nodes/whitespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class SimpleWhitespace(BaseParenthesizableWhitespace, BaseValueToken):
expression between two tokens. This is the most common type of whitespace.

A simple whitespace cannot contain a newline character unless it is directly
preceeded by a line continuation character (``\\``). It can contain zero or
preceded by a line continuation character (``\\``). It can contain zero or
more spaces or tabs. If you need a newline character without a line continuation
character, use :class:`ParenthesizedWhitespace` instead.

Expand Down Expand Up @@ -291,6 +291,6 @@ def empty(self) -> bool:
:class:`ParenthesizedWhitespace` this will always be ``False``.
"""

# Its not possible to have a ParenthesizedWhitespace with zero characers.
# Its not possible to have a ParenthesizedWhitespace with zero characters.
# If we did, the TrailingWhitespace would not have parsed.
return False
2 changes: 1 addition & 1 deletion libcst/_parser/conversions/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ def convert_atom_basic(
)
else:
raise ParserSyntaxError(
f"Unparseable number {child.string}",
f"Unparsable number {child.string}",
lines=config.lines,
raw_line=0,
raw_column=0,
Expand Down
2 changes: 1 addition & 1 deletion libcst/_parser/conversions/statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ def convert_asyncable_funcdef(config: ParserConfig, children: Sequence[Any]) ->
def convert_funcdef(config: ParserConfig, children: Sequence[Any]) -> Any:
defnode, namenode, param_partial, *annotation, colon, suite = children

# If the trailing paremeter doesn't have a comma, then it owns the trailing
# If the trailing parameter doesn't have a comma, then it owns the trailing
# whitespace before the rpar. Otherwise, the comma owns it (and will have
# already parsed it). We don't check/update ParamStar because if it exists
# then we are guaranteed have at least one kwonly_param.
Expand Down
2 changes: 1 addition & 1 deletion libcst/_parser/parso/pgen2/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def __init__(self, from_rule: str, nfa_set: Set[NFAState], final: NFAState) -> N
self.nonterminal_arcs: Mapping[str, DFAState] = {}

# Transitions are basically the only thing that the parser is using
# with is_final. Everyting else is purely here to create a parser.
# with is_final. Everything else is purely here to create a parser.
self.transitions: Mapping[Union[_TokenTypeT, ReservedString], DFAPlan] = {}
self.is_final = final in nfa_set

Expand Down
Loading
Loading