Skip to content

Commit 78e72c9

Browse files
authored
Apply import ordering in ruff check (apache#1001)
1 parent dfe4242 commit 78e72c9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+221
-189
lines changed

benchmarks/db-benchmark/groupby-datafusion.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,23 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
import os
1918
import gc
19+
import os
2020
import timeit
21+
2122
import datafusion as df
23+
import pyarrow
2224
from datafusion import (
23-
col,
24-
functions as f,
2525
RuntimeEnvBuilder,
2626
SessionConfig,
2727
SessionContext,
28+
col,
29+
)
30+
from datafusion import (
31+
functions as f,
2832
)
29-
import pyarrow
3033
from pyarrow import csv as pacsv
3134

32-
3335
print("# groupby-datafusion.py", flush=True)
3436

3537
exec(open("./_helpers/helpers.py").read())

benchmarks/db-benchmark/join-datafusion.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
import os
1918
import gc
19+
import os
2020
import timeit
21+
2122
import datafusion as df
22-
from datafusion import functions as f
2323
from datafusion import col
24+
from datafusion import functions as f
2425
from pyarrow import csv as pacsv
2526

26-
2727
print("# join-datafusion.py", flush=True)
2828

2929
exec(open("./_helpers/helpers.py").read())

benchmarks/tpch/tpch.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
# under the License.
1717

1818
import argparse
19-
from datafusion import SessionContext
2019
import time
2120

21+
from datafusion import SessionContext
22+
2223

2324
def bench(data_path, query_path):
2425
with open("results.csv", "w") as results:

dev/release/generate-changelog.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616
# limitations under the License.
1717

1818
import argparse
19-
import sys
20-
from github import Github
2119
import os
2220
import re
2321
import subprocess
22+
import sys
23+
24+
from github import Github
2425

2526

2627
def print_pulls(repo_name, title, pulls):

examples/export.py

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import datafusion
1919

20-
2120
# create a context
2221
ctx = datafusion.SessionContext()
2322

examples/ffi-table-provider/python/tests/_test_table_provider.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18+
import pyarrow as pa
1819
from datafusion import SessionContext
1920
from ffi_table_provider import MyTableProvider
20-
import pyarrow as pa
2121

2222

2323
def test_table_loading():

examples/import.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616
# under the License.
1717

1818
import datafusion
19-
import pyarrow as pa
2019
import pandas as pd
2120
import polars as pl
22-
21+
import pyarrow as pa
2322

2423
# Create a context
2524
ctx = datafusion.SessionContext()

examples/python-udaf.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18+
import datafusion
1819
import pyarrow
1920
import pyarrow.compute
20-
import datafusion
21-
from datafusion import udaf, Accumulator
22-
from datafusion import col
21+
from datafusion import Accumulator, col, udaf
2322

2423

2524
class MyAccumulator(Accumulator):

examples/python-udf-comparisons.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
from datafusion import SessionContext, col, lit, udf, functions as F
1918
import os
19+
import time
20+
2021
import pyarrow as pa
2122
import pyarrow.compute as pc
22-
import time
23+
from datafusion import SessionContext, col, lit, udf
24+
from datafusion import functions as F
2325

2426
path = os.path.dirname(os.path.abspath(__file__))
2527
filepath = os.path.join(path, "./tpch/data/lineitem.parquet")

examples/python-udf.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
# under the License.
1717

1818
import pyarrow
19-
from datafusion import udf, SessionContext, functions as f
19+
from datafusion import SessionContext, udf
20+
from datafusion import functions as f
2021

2122

2223
def is_null(array: pyarrow.Array) -> pyarrow.Array:

examples/python-udwf.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
import pyarrow as pa
1918
import datafusion
20-
from datafusion import udwf, functions as f, col, lit
21-
from datafusion.udf import WindowEvaluator
19+
import pyarrow as pa
20+
from datafusion import col, lit, udwf
21+
from datafusion import functions as f
2222
from datafusion.expr import WindowFrame
23+
from datafusion.udf import WindowEvaluator
2324

2425
# This example creates five different examples of user defined window functions in order
2526
# to demonstrate the variety of ways a user may need to implement.

examples/query-pyarrow-data.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
# under the License.
1717

1818
import datafusion
19-
from datafusion import col
2019
import pyarrow
21-
20+
from datafusion import col
2221

2322
# create a context
2423
ctx = datafusion.SessionContext()

examples/sql-parquet-s3.py

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# under the License.
1717

1818
import os
19+
1920
import datafusion
2021
from datafusion.object_store import AmazonS3
2122

examples/sql-to-pandas.py

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
from datafusion import SessionContext
1919

20-
2120
# Create a DataFusion context
2221
ctx = SessionContext()
2322

examples/sql-using-python-udaf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
from datafusion import udaf, SessionContext, Accumulator
1918
import pyarrow as pa
19+
from datafusion import Accumulator, SessionContext, udaf
2020

2121

2222
# Define a user-defined aggregation function (UDAF)

examples/sql-using-python-udf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
from datafusion import udf, SessionContext
1918
import pyarrow as pa
19+
from datafusion import SessionContext, udf
2020

2121

2222
# Define a user-defined function (UDF)

examples/tpch/_tests.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
import pytest
1918
from importlib import import_module
19+
2020
import pyarrow as pa
21-
from datafusion import DataFrame, col, lit, functions as F
21+
import pytest
22+
from datafusion import DataFrame, col, lit
23+
from datafusion import functions as F
2224
from util import get_answer_file
2325

2426

examples/tpch/convert_data_to_parquet.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
"""
2424

2525
import os
26-
import pyarrow
26+
2727
import datafusion
28+
import pyarrow
2829

2930
ctx = datafusion.SessionContext()
3031

examples/tpch/q01_pricing_summary_report.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"""
3131

3232
import pyarrow as pa
33-
from datafusion import SessionContext, col, lit, functions as F
33+
from datafusion import SessionContext, col, lit
34+
from datafusion import functions as F
3435
from util import get_data_path
3536

3637
ctx = SessionContext()

examples/tpch/q02_minimum_cost_supplier.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"""
3131

3232
import datafusion
33-
from datafusion import SessionContext, col, lit, functions as F
33+
from datafusion import SessionContext, col, lit
34+
from datafusion import functions as F
3435
from util import get_data_path
3536

3637
# This is the part we're looking for. Values selected here differ from the spec in order to run

examples/tpch/q03_shipping_priority.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
as part of their TPC Benchmark H Specification revision 2.18.0.
2828
"""
2929

30-
from datafusion import SessionContext, col, lit, functions as F
30+
from datafusion import SessionContext, col, lit
31+
from datafusion import functions as F
3132
from util import get_data_path
3233

3334
SEGMENT_OF_INTEREST = "BUILDING"

examples/tpch/q04_order_priority_checking.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@
2727
"""
2828

2929
from datetime import datetime
30+
3031
import pyarrow as pa
31-
from datafusion import SessionContext, col, lit, functions as F
32+
from datafusion import SessionContext, col, lit
33+
from datafusion import functions as F
3234
from util import get_data_path
3335

3436
# Ideally we could put 3 months into the interval. See note below.

examples/tpch/q05_local_supplier_volume.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@
3030
"""
3131

3232
from datetime import datetime
33+
3334
import pyarrow as pa
34-
from datafusion import SessionContext, col, lit, functions as F
35+
from datafusion import SessionContext, col, lit
36+
from datafusion import functions as F
3537
from util import get_data_path
3638

37-
3839
DATE_OF_INTEREST = "1994-01-01"
3940
INTERVAL_DAYS = 365
4041
REGION_OF_INTEREST = "ASIA"

examples/tpch/q06_forecasting_revenue_change.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@
3030
"""
3131

3232
from datetime import datetime
33+
3334
import pyarrow as pa
34-
from datafusion import SessionContext, col, lit, functions as F
35+
from datafusion import SessionContext, col, lit
36+
from datafusion import functions as F
3537
from util import get_data_path
3638

3739
# Variables from the example query

examples/tpch/q07_volume_shipping.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@
2929
"""
3030

3131
from datetime import datetime
32+
3233
import pyarrow as pa
33-
from datafusion import SessionContext, col, lit, functions as F
34+
from datafusion import SessionContext, col, lit
35+
from datafusion import functions as F
3436
from util import get_data_path
3537

3638
# Variables of interest to query over

examples/tpch/q08_market_share.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@
2828
"""
2929

3030
from datetime import datetime
31+
3132
import pyarrow as pa
32-
from datafusion import SessionContext, col, lit, functions as F
33+
from datafusion import SessionContext, col, lit
34+
from datafusion import functions as F
3335
from util import get_data_path
3436

3537
supplier_nation = lit("BRAZIL")

examples/tpch/q09_product_type_profit_measure.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"""
3131

3232
import pyarrow as pa
33-
from datafusion import SessionContext, col, lit, functions as F
33+
from datafusion import SessionContext, col, lit
34+
from datafusion import functions as F
3435
from util import get_data_path
3536

3637
part_color = lit("green")

examples/tpch/q10_returned_item_reporting.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@
3030
"""
3131

3232
from datetime import datetime
33+
3334
import pyarrow as pa
34-
from datafusion import SessionContext, col, lit, functions as F
35+
from datafusion import SessionContext, col, lit
36+
from datafusion import functions as F
3537
from util import get_data_path
3638

3739
DATE_START_OF_QUARTER = "1993-10-01"

examples/tpch/q11_important_stock_identification.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
as part of their TPC Benchmark H Specification revision 2.18.0.
2828
"""
2929

30-
from datafusion import SessionContext, WindowFrame, col, lit, functions as F
30+
from datafusion import SessionContext, WindowFrame, col, lit
31+
from datafusion import functions as F
3132
from util import get_data_path
3233

3334
NATION = "GERMANY"

examples/tpch/q12_ship_mode_order_priority.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@
3030
"""
3131

3232
from datetime import datetime
33+
3334
import pyarrow as pa
34-
from datafusion import SessionContext, col, lit, functions as F
35+
from datafusion import SessionContext, col, lit
36+
from datafusion import functions as F
3537
from util import get_data_path
3638

3739
SHIP_MODE_1 = "MAIL"

examples/tpch/q13_customer_distribution.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
as part of their TPC Benchmark H Specification revision 2.18.0.
2929
"""
3030

31-
from datafusion import SessionContext, col, lit, functions as F
31+
from datafusion import SessionContext, col, lit
32+
from datafusion import functions as F
3233
from util import get_data_path
3334

3435
WORD_1 = "special"

examples/tpch/q14_promotion_effect.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@
2727
"""
2828

2929
from datetime import datetime
30+
3031
import pyarrow as pa
31-
from datafusion import SessionContext, col, lit, functions as F
32+
from datafusion import SessionContext, col, lit
33+
from datafusion import functions as F
3234
from util import get_data_path
3335

3436
DATE = "1995-09-01"

0 commit comments

Comments
 (0)