-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Add py39 target in Black's configuration, bump Black to 21.5b2 #38376
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
Conversation
The py39 option is only on Black's master. Close for now. |
Thanks @fangchenli - check #41160, there's some comments there about some things which probably should be manually fixed up |
can you rebase |
cc @MarcoGorelli are we generally ok with this? |
Looks good to me, seems that you made these changes manually: $ git diff HEAD
diff --git a/doc/source/development/contributing_codebase.rst b/doc/source/development/contributing_codebase.rst
index 411b65fdc9..d6ff48ed5f 100644
--- a/doc/source/development/contributing_codebase.rst
+++ b/doc/source/development/contributing_codebase.rst
@@ -169,7 +169,7 @@ submitting code to run the check yourself::
to auto-format your code. Additionally, many editors have plugins that will
apply ``black`` as you edit files.
-You should use a ``black`` version 21.5b0 as previous versions are not compatible
+You should use a ``black`` version 20.8b1 as previous versions are not compatible
with the pandas codebase.
One caveat about ``git diff upstream/master -u -- "*.py" | flake8 --diff``: this
diff --git a/environment.yml b/environment.yml
index 332b853272..bb96235123 100644
--- a/environment.yml
+++ b/environment.yml
@@ -18,7 +18,7 @@ dependencies:
- cython>=0.29.21
# code checks
- - black=21.5b0
+ - black=20.8b1
- cpplint
- flake8=3.9.2
- flake8-bugbear=21.3.2 # used by flake8, find likely bugs
diff --git a/pandas/_libs/algos.pyi b/pandas/_libs/algos.pyi
index 96dfd81153..a2d028250e 100644
--- a/pandas/_libs/algos.pyi
+++ b/pandas/_libs/algos.pyi
@@ -50,15 +50,15 @@ def nancorr(
mat: np.ndarray, # const float64_t[:, :]
cov: bool = False,
minp=None,
-) -> np.ndarray: ... # ndarray[float64_t, ndim=2]
+) -> np.ndarray: ...
def nancorr_spearman(
mat: np.ndarray, # ndarray[float64_t, ndim=2]
minp: int = 1,
-) -> np.ndarray: ... # ndarray[float64_t, ndim=2]
+) -> np.ndarray: ...
def nancorr_kendall(
mat: np.ndarray, # ndarray[float64_t, ndim=2]
minp: int = 1,
-) -> np.ndarray: ... # ndarray[float64_t, ndim=2]
+) -> np.ndarray: ...
# ----------------------------------------------------------------------
diff --git a/pandas/_libs/tslibs/conversion.pyi b/pandas/_libs/tslibs/conversion.pyi
index e74a56a519..10c8a819b9 100644
--- a/pandas/_libs/tslibs/conversion.pyi
+++ b/pandas/_libs/tslibs/conversion.pyi
@@ -12,7 +12,7 @@ class OutOfBoundsTimedelta(ValueError): ...
def precision_from_unit(
unit: str,
-) -> tuple[int, int,]: ... # (int64_t, _)
+) -> tuple[int, int,]: ... # int64_t
def ensure_datetime64ns(
arr: np.ndarray, # np.ndarray[datetime64[ANY]]
copy: bool = ...,
@@ -23,5 +23,5 @@ def ensure_timedelta64ns(
) -> np.ndarray: ... # np.ndarray[timedelta64ns]
def datetime_to_datetime64(
values: np.ndarray, # np.ndarray[object]
-) -> tuple[np.ndarray, tzinfo | None,]: ... # (np.ndarray[dt64ns], _)
+) -> tuple[np.ndarray, tzinfo | None,]: ... # np.ndarray[dt64ns]
def localize_pydatetime(dt: datetime, tz: tzinfo | None) -> datetime: ...
diff --git a/pandas/_libs/window/indexers.pyi b/pandas/_libs/window/indexers.pyi
index f65deae6fd..2dea936222 100644
--- a/pandas/_libs/window/indexers.pyi
+++ b/pandas/_libs/window/indexers.pyi
@@ -7,7 +7,4 @@ def calculate_variable_window_bounds(
center: bool,
closed: str | None,
index: np.ndarray, # const int64_t[:]
-) -> tuple[
- np.ndarray,
- np.ndarray,
-]: ... # (np.ndarray[np.int64] # np.ndarray[np.int64])
+) -> tuple[np.ndarray, np.ndarray,]: ... # np.ndarray[np.int64] # np.ndarray[np.int64]
diff --git a/pyproject.toml b/pyproject.toml
index 3947856d94..01d28777eb 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -14,7 +14,7 @@ requires = [
# build-backend = "setuptools.build_meta"
[tool.black]
-target-version = ['py37', 'py38', 'py39']
+target-version = ['py37', 'py38']
exclude = '''
(
asv_bench/env
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 7f07c499e1..f454bfd152 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -6,7 +6,7 @@ python-dateutil>=2.7.3
pytz
asv
cython>=0.29.21
-black==21.5b0
+black==20.8b1
cpplint
flake8==3.9.2
flake8-bugbear==21.3.2 which I believe address @jbrockmendel 's comments on the other PR |
def value_count_int64( | ||
values: np.ndarray, # const int64_t[:] | ||
dropna: bool, | ||
) -> tuple[ | ||
np.ndarray, # np.ndarray[np.int64] | ||
np.ndarray, # np.ndarray[np.int64] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above re this being multiple lines
np.ndarray, # np.ndarray[np.int64] | ||
]: ... | ||
|
||
) -> tuple[np.ndarray, np.ndarray,]: ... # np.ndarray[np.int64] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is ambiguous which ndarray the comment refers to
np.ndarray, # np.ndarray[object] | ||
np.ndarray, # np.ndarray[np.int64] | ||
]: ... | ||
) -> tuple[np.ndarray, np.ndarray,]: ... # np.ndarray[object] # np.ndarray[np.int64] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this case isnt ambiguous, but it is less obvious
]: ... | ||
|
||
|
||
) -> tuple[int, int,]: ... # (int64_t, _) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
havent seen this pattern elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use this pattern # (comment for A, comment for B)
for the return type of tuple[A, B]
? It's more explicit than the one reformated by black
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @fangchenli can we do this before 1.3.0rc0 or after 1.3.0. updating master during the rc period will potentially make auto backports fail.
…black-py39-target
I'll try to finish this before 1.3.0rc0. |
consensus is to do this before the RC, @fangchenli can you merge master |
thanks @fangchenli (we might need to add this to the development changes in whatsnew but can followup on that) |
No description provided.