Skip to content

Commit

Permalink
rebase and update rust files too
Browse files Browse the repository at this point in the history
  • Loading branch information
zsol committed Dec 28, 2021
1 parent c8a58c7 commit a782a57
Show file tree
Hide file tree
Showing 47 changed files with 121 additions and 36 deletions.
2 changes: 1 addition & 1 deletion libcst/_parser/parso/python/token.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# Copyright (c) Meta Platforms, 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.
Expand Down
2 changes: 1 addition & 1 deletion libcst/_parser/py_whitespace_parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# Copyright (c) Meta Platforms, 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.
Expand Down
2 changes: 1 addition & 1 deletion libcst/_parser/types/py_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# Copyright (c) Meta Platforms, 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.
Expand Down
2 changes: 1 addition & 1 deletion libcst/_parser/types/py_token.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# Copyright (c) Meta Platforms, 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.
Expand Down
2 changes: 1 addition & 1 deletion libcst/_parser/types/py_whitespace_state.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# Copyright (c) Meta Platforms, 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.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# Copyright (c) Meta Platforms, 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.
Expand Down
5 changes: 5 additions & 0 deletions native/libcst/benches/parser_benchmark.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Copyright (c) Meta Platforms, 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

use std::{
path::{Component, PathBuf},
time::Duration,
Expand Down
5 changes: 5 additions & 0 deletions native/libcst/src/bin.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Copyright (c) Meta Platforms, 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

use libcst_native::*;
use std::{
env,
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Facebook, Inc. and its affiliates.
// Copyright (c) Meta Platforms, 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.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/nodes/codegen.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Facebook, Inc. and its affiliates.
// Copyright (c) Meta Platforms, 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.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/nodes/expression.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Facebook, Inc. and its affiliates.
// Copyright (c) Meta Platforms, 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.
Expand Down
5 changes: 5 additions & 0 deletions native/libcst/src/nodes/inflate_helpers.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Copyright (c) Meta Platforms, 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

use crate::{
nodes::traits::Result,
tokenizer::{
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/nodes/macros.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Facebook, Inc. and its affiliates.
// Copyright (c) Meta Platforms, 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.
Expand Down
5 changes: 5 additions & 0 deletions native/libcst/src/nodes/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Copyright (c) Meta Platforms, 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

mod whitespace;
pub use whitespace::{
Comment, EmptyLine, Fakeness, Newline, ParenthesizableWhitespace, ParenthesizedWhitespace,
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/nodes/module.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Facebook, Inc. and its affiliates.
// Copyright (c) Meta Platforms, 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.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/nodes/op.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Facebook, Inc. and its affiliates.
// Copyright (c) Meta Platforms, 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.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/nodes/parser_config.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Facebook, Inc. and its affiliates.
// Copyright (c) Meta Platforms, 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.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/nodes/py_cached.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Facebook, Inc. and its affiliates.
// Copyright (c) Meta Platforms, 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.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/nodes/statement.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Facebook, Inc. and its affiliates.
// Copyright (c) Meta Platforms, 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.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/nodes/test_utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Facebook, Inc. and its affiliates.
// Copyright (c) Meta Platforms, 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.
Expand Down
6 changes: 6 additions & 0 deletions native/libcst/src/nodes/traits.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// Copyright (c) Meta Platforms, 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


use crate::{
tokenizer::whitespace_parser::{Config, WhitespaceError},
Codegen, CodegenState, Comma, EmptyLine, LeftParen, RightParen,
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/nodes/whitespace.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Facebook, Inc. and its affiliates.
// Copyright (c) Meta Platforms, 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.
Expand Down
6 changes: 6 additions & 0 deletions native/libcst/src/parser/errors.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// Copyright (c) Meta Platforms, 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


use pyo3::types::{IntoPyDict, PyModule};
use pyo3::{IntoPy, PyErr, PyErrArguments, Python};

Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/parser/grammar.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Facebook, Inc. and its affiliates.
// Copyright (c) Meta Platforms, 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.
Expand Down
6 changes: 6 additions & 0 deletions native/libcst/src/parser/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// Copyright (c) Meta Platforms, 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


mod errors;
mod grammar;
mod numbers;
Expand Down
6 changes: 6 additions & 0 deletions native/libcst/src/parser/numbers.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// Copyright (c) Meta Platforms, 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


use once_cell::sync::Lazy;
use regex::Regex;

Expand Down
5 changes: 5 additions & 0 deletions native/libcst/src/py.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Copyright (c) Meta Platforms, 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

use pyo3::prelude::*;

#[pymodule]
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/tokenizer/core/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This implementation is Copyright (c) Facebook, Inc. and its affiliates.
// This implementation is Copyright (c) Meta Platforms, Inc. and its affiliates.
//
// CPython 3.10.0a5 and the original C code this is based on is
// Copyright (c) 2001-2021 Python Software Foundation; All Rights Reserved
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/tokenizer/core/string_types.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This implementation is Copyright (c) Facebook, Inc. and its affiliates.
// This implementation is Copyright (c) Meta Platforms, Inc. and its affiliates.
//
// CPython 3.10.0a5 and the original C code this is based on is
// Copyright (c) 2001-2021 Python Software Foundation; All Rights Reserved
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/tokenizer/debug_utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Facebook, Inc. and its affiliates.
// Copyright (c) Meta Platforms, 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.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/tokenizer/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Facebook, Inc. and its affiliates.
// Copyright (c) Meta Platforms, 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.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/tokenizer/operators.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Facebook, Inc. and its affiliates.
// Copyright (c) Meta Platforms, 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.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/tokenizer/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Facebook, Inc. and its affiliates.
// Copyright (c) Meta Platforms, 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.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/tokenizer/text_position/char_width.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Facebook, Inc. and its affiliates.
// Copyright (c) Meta Platforms, 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.
Expand Down
2 changes: 1 addition & 1 deletion native/libcst/src/tokenizer/text_position/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Facebook, Inc. and its affiliates.
// Copyright (c) Meta Platforms, 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.
Expand Down
6 changes: 6 additions & 0 deletions native/libcst/src/tokenizer/whitespace_parser.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// Copyright (c) Meta Platforms, 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


use crate::nodes::{
Comment, EmptyLine, Fakeness, Newline, ParenthesizableWhitespace, ParenthesizedWhitespace,
SimpleWhitespace, TrailingWhitespace,
Expand Down
6 changes: 6 additions & 0 deletions native/libcst/tests/parser_roundtrip.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// Copyright (c) Meta Platforms, 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


use difference::assert_diff;
use itertools::Itertools;
use libcst_native::{parse_module, prettify_error, Codegen};
Expand Down
6 changes: 6 additions & 0 deletions native/libcst_derive/src/codegen.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// Copyright (c) Meta Platforms, 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


use proc_macro::TokenStream;
use quote::{quote, quote_spanned};
use syn::{self, spanned::Spanned, Data, DataEnum, DeriveInput, Fields, FieldsUnnamed};
Expand Down
5 changes: 5 additions & 0 deletions native/libcst_derive/src/inflate.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Copyright (c) Meta Platforms, 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

use proc_macro::TokenStream;
use quote::{quote, quote_spanned};
use syn::{self, spanned::Spanned, Data, DataEnum, DeriveInput, Fields, FieldsUnnamed};
Expand Down
6 changes: 6 additions & 0 deletions native/libcst_derive/src/into_py.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// Copyright (c) Meta Platforms, 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


use proc_macro::TokenStream;
use quote::{format_ident, quote, quote_spanned, ToTokens};
use syn::{
Expand Down
6 changes: 6 additions & 0 deletions native/libcst_derive/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// Copyright (c) Meta Platforms, 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


mod inflate;
use inflate::impl_inflate;
mod parenthesized_node;
Expand Down
6 changes: 6 additions & 0 deletions native/libcst_derive/src/parenthesized_node.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// Copyright (c) Meta Platforms, 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


use proc_macro::TokenStream;
use quote::{quote, quote_spanned};
use syn::{spanned::Spanned, Data, DataEnum, DeriveInput, Fields, FieldsUnnamed};
Expand Down
6 changes: 1 addition & 5 deletions stubs/libcst_native/parser_config.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# Copyright (c) Meta Platforms, 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.
Expand All @@ -14,11 +14,9 @@ class BaseWhitespaceParserConfig:
lines: Sequence[str],
default_newline: str,
) -> BaseWhitespaceParserConfig: ...

lines: Sequence[str]
default_newline: str


class ParserConfig(BaseWhitespaceParserConfig):
def __new__(
cls,
Expand All @@ -31,7 +29,6 @@ class ParserConfig(BaseWhitespaceParserConfig):
version: PythonVersionInfo,
future_imports: FrozenSet[str],
) -> BaseWhitespaceParserConfig: ...

# lines is inherited
encoding: str
default_indent: str
Expand All @@ -40,5 +37,4 @@ class ParserConfig(BaseWhitespaceParserConfig):
version: PythonVersionInfo
future_imports: FrozenSet[str]


def parser_config_asdict(config: ParserConfig) -> Mapping[str, Any]: ...
2 changes: 1 addition & 1 deletion stubs/libcst_native/token_type.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# Copyright (c) Meta Platforms, 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.
Expand Down
2 changes: 1 addition & 1 deletion stubs/libcst_native/tokenize.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# Copyright (c) Meta Platforms, 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.
Expand Down
2 changes: 1 addition & 1 deletion stubs/libcst_native/whitespace_parser.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# Copyright (c) Meta Platforms, 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.
Expand Down
3 changes: 1 addition & 2 deletions stubs/libcst_native/whitespace_state.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) Facebook, Inc. and its affiliates.
# Copyright (c) Meta Platforms, 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.
Expand All @@ -7,7 +7,6 @@ class WhitespaceState:
def __new__(
cls, line: int, column: int, absolute_indent: str, is_parenthesized: bool
) -> WhitespaceState: ...

line: int # one-indexed (to match parso's behavior)
column: int # zero-indexed (to match parso's behavior)
# What to look for when executing `_parse_indent`.
Expand Down

0 comments on commit a782a57

Please sign in to comment.