Skip to content

Commit 0f841ef

Browse files
rokpaddyroddy
andcommitted
GH-10: [Python] Fix invalid-assignment error (#33)
* Add py.typed file to signify that the library is typed See the relevant PEP https://peps.python.org/pep-0561 * Prepare `pyarrow-stubs` for history merging MINOR: [Python] Prepare `pyarrow-stubs` for history merging Co-authored-by: ZhengYu, Xu <zen-xu@outlook.com> * Add `ty` configuration and suppress error codes * One line per rule * Add licence header from original repo for all `.pyi` files * Revert "Add licence header from original repo for all `.pyi` files" This reverts commit 1631f39. * Prepare for licence merging * Exclude `stubs` from `rat` test * Add Apache licence clause to `py.typed` * Reduce list * Add `ty` as a step in the action * Run in the correct directory * Remove `check` from `pip` * Fix `unresolved-reference` error * Revert "Fix `unresolved-reference` error" This reverts commit 7ee3d2f. * Fix invalid-assignment --------- Co-authored-by: Patrick J. Roddy <patrickjamesroddy@gmail.com>
1 parent 5b10460 commit 0f841ef

33 files changed

+51
-51
lines changed

python/pyarrow/pandas_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
try:
3434
import numpy as np
3535
except ImportError:
36-
np = None
36+
np = None # type: ignore[assignment]
3737
import pyarrow as pa
3838
from pyarrow.lib import _pandas_api, frombytes, is_threading_enabled # noqa
3939

python/pyarrow/tests/interchange/test_conversion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
try:
2424
import numpy as np
2525
except ImportError:
26-
np = None
26+
pass
2727

2828
import pyarrow.interchange as pi
2929
from pyarrow.interchange.column import (

python/pyarrow/tests/interchange/test_interchange_spec.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020
import hypothesis.strategies as st
2121

2222
import pytest
23+
np = None
2324
try:
2425
import numpy as np
2526
except ImportError:
26-
np = None
27+
pass
2728
import pyarrow as pa
2829
import pyarrow.tests.strategies as past
2930

python/pyarrow/tests/parquet/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
try:
2121
import numpy as np
2222
except ImportError:
23-
np = None
23+
np = None # type: ignore[assignment]
2424

2525
import pyarrow as pa
2626
from pyarrow.tests import util

python/pyarrow/tests/parquet/test_basic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@
4444
from pyarrow.tests.pandas_examples import dataframe_with_lists
4545
from pyarrow.tests.parquet.common import alltypes_sample
4646
except ImportError:
47-
pd = tm = None
47+
pd = tm = None # type: ignore[assignment]
4848

4949
try:
5050
import numpy as np
5151
except ImportError:
52-
np = None
52+
np = None # type: ignore[assignment]
5353

5454
# Marks all of the tests in this module
5555
# Ignore these with pytest ... -m 'not parquet'

python/pyarrow/tests/parquet/test_compliant_nested_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
from pyarrow.tests.parquet.common import _roundtrip_pandas_dataframe
3434
except ImportError:
35-
pd = tm = None
35+
pd = tm = None # type: ignore[assignment]
3636

3737

3838
# Marks all of the tests in this module

python/pyarrow/tests/parquet/test_data_types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
try:
2323
import numpy as np
2424
except ImportError:
25-
np = None
25+
np = None # type: ignore[assignment]
2626
import pytest
2727

2828
import pyarrow as pa
@@ -44,7 +44,7 @@
4444
dataframe_with_lists)
4545
from pyarrow.tests.parquet.common import alltypes_sample
4646
except ImportError:
47-
pd = tm = None
47+
pd = tm = None # type: ignore[assignment]
4848

4949

5050
# Marks all of the tests in this module

python/pyarrow/tests/parquet/test_dataset.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
try:
2525
import numpy as np
2626
except ImportError:
27-
np = None
27+
np = None # type: ignore[assignment]
2828
import pytest
2929
import unittest.mock as mock
3030

@@ -48,7 +48,7 @@
4848
import pandas.testing as tm
4949

5050
except ImportError:
51-
pd = tm = None
51+
pd = tm = None # type: ignore[assignment]
5252

5353

5454
# Marks all of the tests in this module

python/pyarrow/tests/parquet/test_datetime.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
try:
2323
import numpy as np
2424
except ImportError:
25-
np = None
25+
np = None # type: ignore[assignment]
2626
import pytest
2727

2828
import pyarrow as pa
@@ -41,7 +41,7 @@
4141

4242
from pyarrow.tests.parquet.common import _roundtrip_pandas_dataframe
4343
except ImportError:
44-
pd = tm = None
44+
pd = tm = None # type: ignore[assignment]
4545

4646

4747
# Marks all of the tests in this module

python/pyarrow/tests/parquet/test_metadata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
try:
2424
import numpy as np
2525
except ImportError:
26-
np = None
26+
np = None # type: ignore[assignment]
2727
import pytest
2828

2929
import pyarrow as pa
@@ -44,7 +44,7 @@
4444

4545
from pyarrow.tests.parquet.common import alltypes_sample
4646
except ImportError:
47-
pd = tm = None
47+
pd = tm = None # type: ignore[assignment]
4848

4949

5050
# Marks all of the tests in this module

0 commit comments

Comments
 (0)