Skip to content

STYLE: run pre-commit filters on the repo #27915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Aug 30, 2019
Merged
36 changes: 20 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
repos:
- repo: https://github.com/python/black
rev: stable
hooks:
- id: black
language_version: python3.7
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.7
hooks:
- id: flake8
language: python_venv
additional_dependencies: [flake8-comprehensions]
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.20
hooks:
- id: isort
language: python_venv
- repo: https://github.com/python/black
rev: stable
hooks:
- id: black
language_version: python3.7
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.7
hooks:
- id: flake8
language: python_venv
additional_dependencies: [flake8-comprehensions]
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.20
hooks:
- id: isort
language: python_venv
- repo: https://github.com/asottile/seed-isort-config
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gave the README a quick glance on this but can you explain what this is doing here?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rev: v1.9.2
hooks:
- id: seed-isort-config
3 changes: 2 additions & 1 deletion asv_bench/benchmarks/attrs_caching.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np

from pandas import DataFrame

try:
Expand Down Expand Up @@ -32,4 +33,4 @@ def time_cache_readonly(self):
self.obj.prop


from .pandas_vb_common import setup # noqa: F401
from .pandas_vb_common import setup # noqa: F401 isort:skip
3 changes: 2 additions & 1 deletion asv_bench/benchmarks/binary_ops.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np

from pandas import DataFrame, Series, date_range
from pandas.core.algorithms import checked_add_with_arr

Expand Down Expand Up @@ -155,4 +156,4 @@ def time_add_overflow_both_arg_nan(self):
)


from .pandas_vb_common import setup # noqa: F401
from .pandas_vb_common import setup # noqa: F401 isort:skip
6 changes: 4 additions & 2 deletions asv_bench/benchmarks/categoricals.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import warnings

import numpy as np

import pandas as pd
import pandas.util.testing as tm
import warnings

try:
from pandas.api.types import union_categoricals
Expand Down Expand Up @@ -280,4 +282,4 @@ def time_sort_values(self):
self.index.sort_values(ascending=False)


from .pandas_vb_common import setup # noqa: F401
from .pandas_vb_common import setup # noqa: F401 isort:skip
5 changes: 3 additions & 2 deletions asv_bench/benchmarks/ctors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import numpy as np

from pandas import DatetimeIndex, Index, MultiIndex, Series, Timestamp
import pandas.util.testing as tm
from pandas import Series, Index, DatetimeIndex, Timestamp, MultiIndex


def no_change(arr):
Expand Down Expand Up @@ -113,4 +114,4 @@ def time_multiindex_from_iterables(self):
MultiIndex.from_product(self.iterables)


from .pandas_vb_common import setup # noqa: F401
from .pandas_vb_common import setup # noqa: F401 isort:skip
10 changes: 5 additions & 5 deletions asv_bench/benchmarks/dtypes.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import numpy as np

from pandas.api.types import pandas_dtype

import numpy as np
from .pandas_vb_common import (
numeric_dtypes,
datetime_dtypes,
string_dtypes,
extension_dtypes,
numeric_dtypes,
string_dtypes,
)


_numpy_dtypes = [
np.dtype(dtype) for dtype in (numeric_dtypes + datetime_dtypes + string_dtypes)
]
Expand Down Expand Up @@ -40,4 +40,4 @@ def time_pandas_dtype_invalid(self, dtype):
pass


from .pandas_vb_common import setup # noqa: F401
from .pandas_vb_common import setup # noqa: F401 isort:skip
3 changes: 2 additions & 1 deletion asv_bench/benchmarks/eval.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np

import pandas as pd

try:
Expand Down Expand Up @@ -62,4 +63,4 @@ def time_query_with_boolean_selection(self):
self.df.query("(a >= @self.min_val) & (a <= @self.max_val)")


from .pandas_vb_common import setup # noqa: F401
from .pandas_vb_common import setup # noqa: F401 isort:skip
5 changes: 3 additions & 2 deletions asv_bench/benchmarks/frame_ctor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import numpy as np

from pandas import DataFrame, MultiIndex, Series, Timestamp, date_range
import pandas.util.testing as tm
from pandas import DataFrame, Series, MultiIndex, Timestamp, date_range

try:
from pandas.tseries.offsets import Nano, Hour
Expand Down Expand Up @@ -104,4 +105,4 @@ def time_frame_from_lists(self):
self.df = DataFrame(self.data)


from .pandas_vb_common import setup # noqa: F401
from .pandas_vb_common import setup # noqa: F401 isort:skip
4 changes: 2 additions & 2 deletions asv_bench/benchmarks/frame_methods.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import warnings
import string
import warnings

import numpy as np

Expand Down Expand Up @@ -609,4 +609,4 @@ def time_dataframe_describe(self):
self.df.describe()


from .pandas_vb_common import setup # noqa: F401
from .pandas_vb_common import setup # noqa: F401 isort:skip
9 changes: 5 additions & 4 deletions asv_bench/benchmarks/gil.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import numpy as np
import pandas.util.testing as tm
from pandas import DataFrame, Series, read_csv, factorize, date_range

from pandas import DataFrame, Series, date_range, factorize, read_csv
from pandas.core.algorithms import take_1d
import pandas.util.testing as tm

try:
from pandas import (
Expand Down Expand Up @@ -36,7 +37,7 @@ def wrapper(fname):
return wrapper


from .pandas_vb_common import BaseIO
from .pandas_vb_common import BaseIO # noqa: E402 isort:skip


class ParallelGroupbyMethods:
Expand Down Expand Up @@ -301,4 +302,4 @@ def time_loop(self, threads):
self.loop()


from .pandas_vb_common import setup # noqa: F401
from .pandas_vb_common import setup # noqa: F401 isort:skip
3 changes: 1 addition & 2 deletions asv_bench/benchmarks/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
)
import pandas.util.testing as tm


method_blacklist = {
"object": {
"median",
Expand Down Expand Up @@ -626,4 +625,4 @@ def time_first(self):
self.df_nans.groupby("key").transform("first")


from .pandas_vb_common import setup # noqa: F401
from .pandas_vb_common import setup # noqa: F401 isort:skip
14 changes: 8 additions & 6 deletions asv_bench/benchmarks/index_object.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import gc

import numpy as np
import pandas.util.testing as tm

from pandas import (
Series,
date_range,
DatetimeIndex,
Index,
RangeIndex,
Float64Index,
Index,
IntervalIndex,
RangeIndex,
Series,
date_range,
)
import pandas.util.testing as tm


class SetOperations:
Expand Down Expand Up @@ -243,4 +245,4 @@ def peakmem_gc_instances(self, N):
gc.enable()


from .pandas_vb_common import setup # noqa: F401
from .pandas_vb_common import setup # noqa: F401 isort:skip
17 changes: 9 additions & 8 deletions asv_bench/benchmarks/indexing.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import warnings

import numpy as np
import pandas.util.testing as tm

from pandas import (
Series,
CategoricalIndex,
DataFrame,
MultiIndex,
Int64Index,
UInt64Index,
Float64Index,
IntervalIndex,
CategoricalIndex,
IndexSlice,
Int64Index,
IntervalIndex,
MultiIndex,
Series,
UInt64Index,
concat,
date_range,
option_context,
period_range,
)
import pandas.util.testing as tm


class NumericSeriesIndexing:
Expand Down Expand Up @@ -371,4 +372,4 @@ def time_chained_indexing(self, mode):
df2["C"] = 1.0


from .pandas_vb_common import setup # noqa: F401
from .pandas_vb_common import setup # noqa: F401 isort:skip
7 changes: 4 additions & 3 deletions asv_bench/benchmarks/inference.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import numpy as np
import pandas.util.testing as tm

from pandas import DataFrame, Series, to_numeric
import pandas.util.testing as tm

from .pandas_vb_common import numeric_dtypes, lib
from .pandas_vb_common import lib, numeric_dtypes


class NumericInferOps:
Expand Down Expand Up @@ -120,4 +121,4 @@ def time_convert(self, data):
lib.maybe_convert_numeric(data, set(), coerce_numeric=False)


from .pandas_vb_common import setup # noqa: F401
from .pandas_vb_common import setup # noqa: F401 isort:skip
7 changes: 4 additions & 3 deletions asv_bench/benchmarks/io/csv.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from io import StringIO
import random
import string

import numpy as np

from pandas import Categorical, DataFrame, date_range, read_csv, to_datetime
import pandas.util.testing as tm
from pandas import DataFrame, Categorical, date_range, read_csv, to_datetime
from io import StringIO

from ..pandas_vb_common import BaseIO

Expand Down Expand Up @@ -406,4 +407,4 @@ def time_to_datetime_format_DD_MM_YYYY(self, cache_dates):
to_datetime(df["date"], cache=cache_dates, format="%d-%m-%Y")


from ..pandas_vb_common import setup # noqa: F401
from ..pandas_vb_common import setup # noqa: F401 isort:skip
6 changes: 4 additions & 2 deletions asv_bench/benchmarks/io/excel.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from io import BytesIO

import numpy as np
from pandas import DataFrame, date_range, ExcelWriter, read_excel

from pandas import DataFrame, ExcelWriter, date_range, read_excel
import pandas.util.testing as tm


Expand Down Expand Up @@ -35,4 +37,4 @@ def time_write_excel(self, engine):
writer_write.save()


from ..pandas_vb_common import setup # noqa: F401
from ..pandas_vb_common import setup # noqa: F401 isort:skip
5 changes: 3 additions & 2 deletions asv_bench/benchmarks/io/hdf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy as np
from pandas import DataFrame, date_range, HDFStore, read_hdf

from pandas import DataFrame, HDFStore, date_range, read_hdf
import pandas.util.testing as tm

from ..pandas_vb_common import BaseIO
Expand Down Expand Up @@ -127,4 +128,4 @@ def time_write_hdf(self, format):
self.df.to_hdf(self.fname, "df", format=format)


from ..pandas_vb_common import setup # noqa: F401
from ..pandas_vb_common import setup # noqa: F401 isort:skip
5 changes: 3 additions & 2 deletions asv_bench/benchmarks/io/json.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import numpy as np

from pandas import DataFrame, concat, date_range, read_json, timedelta_range
import pandas.util.testing as tm
from pandas import DataFrame, date_range, timedelta_range, concat, read_json

from ..pandas_vb_common import BaseIO

Expand Down Expand Up @@ -214,4 +215,4 @@ def peakmem_float(self, frames):
df.to_json()


from ..pandas_vb_common import setup # noqa: F401
from ..pandas_vb_common import setup # noqa: F401 isort:skip
4 changes: 3 additions & 1 deletion asv_bench/benchmarks/io/msgpack.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import warnings

import numpy as np

from pandas import DataFrame, date_range, read_msgpack
import pandas.util.testing as tm

Expand Down Expand Up @@ -27,4 +29,4 @@ def time_write_msgpack(self):
self.df.to_msgpack(self.fname)


from ..pandas_vb_common import setup # noqa: F401
from ..pandas_vb_common import setup # noqa: F401 isort:skip
3 changes: 2 additions & 1 deletion asv_bench/benchmarks/io/pickle.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np

from pandas import DataFrame, date_range, read_pickle
import pandas.util.testing as tm

Expand All @@ -25,4 +26,4 @@ def time_write_pickle(self):
self.df.to_pickle(self.fname)


from ..pandas_vb_common import setup # noqa: F401
from ..pandas_vb_common import setup # noqa: F401 isort:skip
7 changes: 4 additions & 3 deletions asv_bench/benchmarks/io/sql.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import sqlite3

import numpy as np
import pandas.util.testing as tm
from pandas import DataFrame, date_range, read_sql_query, read_sql_table
from sqlalchemy import create_engine

from pandas import DataFrame, date_range, read_sql_query, read_sql_table
import pandas.util.testing as tm


class SQL:

Expand Down Expand Up @@ -141,4 +142,4 @@ def time_read_sql_table_column(self, dtype):
read_sql_table(self.table_name, self.con, columns=[dtype])


from ..pandas_vb_common import setup # noqa: F401
from ..pandas_vb_common import setup # noqa: F401 isort:skip
Loading