Skip to content

Commit

Permalink
Black lint
Browse files Browse the repository at this point in the history
  • Loading branch information
xinrong-meng committed Jun 7, 2021
1 parent a75f5b4 commit 7c3efca
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 10 deletions.
2 changes: 2 additions & 0 deletions python/pyspark/pandas/data_type_ops/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
def is_valid_operand_for_numeric_arithmetic(operand: Any, *, allow_bool: bool = True) -> bool:
"""Check whether the operand is valid for arithmetic operations against numerics."""
from pyspark.pandas.base import IndexOpsMixin

if isinstance(operand, numbers.Number) and not isinstance(operand, bool):
return True
elif isinstance(operand, IndexOpsMixin):
Expand All @@ -72,6 +73,7 @@ def transform_boolean_operand_to_numeric(operand: Any, spark_type: types.DataTyp
otherwise return the original operand.
"""
from pyspark.pandas.base import IndexOpsMixin

if isinstance(operand, IndexOpsMixin) and isinstance(operand.spark.data_type, BooleanType):
return operand.spark.transform(lambda scol: scol.cast(spark_type))
else:
Expand Down
2 changes: 1 addition & 1 deletion python/pyspark/pandas/data_type_ops/null_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ class NullOps(DataTypeOps):

@property
def pretty_name(self) -> str:
return 'nulls'
return "nulls"
2 changes: 1 addition & 1 deletion python/pyspark/pandas/data_type_ops/udt_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ class UDTOps(DataTypeOps):

@property
def pretty_name(self) -> str:
return 'user defined types'
return "user defined types"
11 changes: 6 additions & 5 deletions python/pyspark/pandas/internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,8 @@ def arguments_for_restore_index(self) -> Dict:
}
dtypes = [dtype for dtype in self.index_dtypes]
spark_types = [
self.spark_frame.select(scol).schema[0].dataType for scol in self.index_spark_columns]
self.spark_frame.select(scol).schema[0].dataType for scol in self.index_spark_columns
]

for spark_column, column_name, dtype in zip(
self.data_spark_columns, self.data_spark_column_names, self.data_dtypes
Expand Down Expand Up @@ -1081,7 +1082,7 @@ def with_new_sdf(
*,
index_dtypes: Optional[List[Dtype]] = None,
data_columns: Optional[List[str]] = None,
data_dtypes: Optional[List[Dtype]] = None
data_dtypes: Optional[List[Dtype]] = None,
) -> "InternalFrame":
"""Copy the immutable InternalFrame with the updates by the specified Spark DataFrame.
Expand Down Expand Up @@ -1131,7 +1132,7 @@ def with_new_columns(
column_labels: Optional[List[Tuple]] = None,
data_dtypes: Optional[List[Dtype]] = None,
column_label_names: Union[Optional[List[Optional[Tuple]]], _NoValueType] = _NoValue,
keep_order: bool = True
keep_order: bool = True,
) -> "InternalFrame":
"""
Copy the immutable InternalFrame with the updates by the specified Spark Columns or Series.
Expand Down Expand Up @@ -1235,7 +1236,7 @@ def with_new_spark_column(
scol: spark.Column,
*,
dtype: Optional[Dtype] = None,
keep_order: bool = True
keep_order: bool = True,
) -> "InternalFrame":
"""
Copy the immutable InternalFrame with the updates by the specified Spark Column.
Expand Down Expand Up @@ -1283,7 +1284,7 @@ def copy(
column_labels: Union[Optional[List[Tuple]], _NoValueType] = _NoValue,
data_spark_columns: Union[Optional[List[spark.Column]], _NoValueType] = _NoValue,
data_dtypes: Union[Optional[List[Dtype]], _NoValueType] = _NoValue,
column_label_names: Union[Optional[List[Optional[Tuple]]], _NoValueType] = _NoValue
column_label_names: Union[Optional[List[Optional[Tuple]]], _NoValueType] = _NoValue,
) -> "InternalFrame":
"""Copy the immutable InternalFrame.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def test_rpow(self):
self.assertRaises(TypeError, lambda: 1 ** self.psser)

def test_from_to_pandas(self):
data = [b'1', b'2', b'3']
data = [b"1", b"2", b"3"]
pser = pd.Series(data)
psser = ps.Series(data)
self.assert_eq(pser, psser.to_pandas())
Expand Down
3 changes: 2 additions & 1 deletion python/pyspark/pandas/tests/data_type_ops/test_null_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ def test_from_to_pandas(self):

try:
import xmlrunner # type: ignore[import]
testRunner = xmlrunner.XMLTestRunner(output='target/test-reports', verbosity=2)

testRunner = xmlrunner.XMLTestRunner(output="target/test-reports", verbosity=2)
except ImportError:
testRunner = None
unittest.main(testRunner=testRunner, verbosity=2)
3 changes: 2 additions & 1 deletion python/pyspark/pandas/tests/data_type_ops/test_udt_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ def test_from_to_pandas(self):

try:
import xmlrunner # type: ignore[import]
testRunner = xmlrunner.XMLTestRunner(output='target/test-reports', verbosity=2)

testRunner = xmlrunner.XMLTestRunner(output="target/test-reports", verbosity=2)
except ImportError:
testRunner = None
unittest.main(testRunner=testRunner, verbosity=2)

0 comments on commit 7c3efca

Please sign in to comment.