Skip to content

Commit

Permalink
[Bugfix] fix invalid excluding of Black (ray-project#24042)
Browse files Browse the repository at this point in the history
- We should use `--force-exclude` when we pass code path explicitly https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html?highlight=--force-exclude#command-line-options
- Recover the files in `python/ray/_private/thirdparty` which has been formatted in the PR ray-project#21975 by mistake.
  • Loading branch information
SongGuyang authored Apr 21, 2022
1 parent 7b0c77d commit 0e6c042
Show file tree
Hide file tree
Showing 7 changed files with 1,101 additions and 1,140 deletions.
10 changes: 5 additions & 5 deletions ci/lint/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ MYPY_FILES=(
)

BLACK_EXCLUDES=(
'--extend-exclude' 'python/ray/cloudpickle/*'
'--extend-exclude' 'python/build/*'
'--extend-exclude' 'python/ray/core/src/ray/gcs/*'
'--extend-exclude' 'python/ray/thirdparty_files/*'
'--extend-exclude' 'python/ray/_private/thirdparty/*'
'--force-exclude' 'python/ray/cloudpickle/*'
'--force-exclude' 'python/build/*'
'--force-exclude' 'python/ray/core/src/ray/gcs/*'
'--force-exclude' 'python/ray/thirdparty_files/*'
'--force-exclude' 'python/ray/_private/thirdparty/*'
)

GIT_LS_EXCLUDES=(
Expand Down
44 changes: 22 additions & 22 deletions python/ray/_private/thirdparty/pathspec/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,28 @@
__copyright__ = "Copyright © 2013-2020 Caleb P. Burns"
__created__ = "2013-10-12"
__credits__ = [
"dahlia <https://github.com/dahlia>",
"highb <https://github.com/highb>",
"029xue <https://github.com/029xue>",
"mikexstudios <https://github.com/mikexstudios>",
"nhumrich <https://github.com/nhumrich>",
"davidfraser <https://github.com/davidfraser>",
"demurgos <https://github.com/demurgos>",
"ghickman <https://github.com/ghickman>",
"nvie <https://github.com/nvie>",
"adrienverge <https://github.com/adrienverge>",
"AndersBlomdell <https://github.com/AndersBlomdell>",
"highb <https://github.com/highb>",
"thmxv <https://github.com/thmxv>",
"wimglenn <https://github.com/wimglenn>",
"hugovk <https://github.com/hugovk>",
"dcecile <https://github.com/dcecile>",
"mroutis <https://github.com/mroutis>",
"jdufresne <https://github.com/jdufresne>",
"groodt <https://github.com/groodt>",
"ftrofin <https://github.com/ftrofin>",
"pykong <https://github.com/pykong>",
"nhhollander <https://github.com/nhhollander>",
"dahlia <https://github.com/dahlia>",
"highb <https://github.com/highb>",
"029xue <https://github.com/029xue>",
"mikexstudios <https://github.com/mikexstudios>",
"nhumrich <https://github.com/nhumrich>",
"davidfraser <https://github.com/davidfraser>",
"demurgos <https://github.com/demurgos>",
"ghickman <https://github.com/ghickman>",
"nvie <https://github.com/nvie>",
"adrienverge <https://github.com/adrienverge>",
"AndersBlomdell <https://github.com/AndersBlomdell>",
"highb <https://github.com/highb>",
"thmxv <https://github.com/thmxv>",
"wimglenn <https://github.com/wimglenn>",
"hugovk <https://github.com/hugovk>",
"dcecile <https://github.com/dcecile>",
"mroutis <https://github.com/mroutis>",
"jdufresne <https://github.com/jdufresne>",
"groodt <https://github.com/groodt>",
"ftrofin <https://github.com/ftrofin>",
"pykong <https://github.com/pykong>",
"nhhollander <https://github.com/nhhollander>",
]
__email__ = "[email protected]"
__license__ = "MPL 2.0"
Expand Down
37 changes: 18 additions & 19 deletions python/ray/_private/thirdparty/pathspec/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,30 @@
import sys

if sys.version_info[0] < 3:
# Python 2.
unicode = unicode
string_types = (basestring,)
# Python 2.
unicode = unicode
string_types = (basestring,)

from collections import Iterable
from itertools import izip_longest
from collections import Iterable
from itertools import izip_longest

def iterkeys(mapping):
return mapping.iterkeys()
def iterkeys(mapping):
return mapping.iterkeys()

else:
# Python 3.
unicode = str
string_types = (unicode,)
# Python 3.
unicode = str
string_types = (unicode,)

from collections.abc import Iterable
from itertools import zip_longest as izip_longest

def iterkeys(mapping):
return mapping.keys()
from collections.abc import Iterable
from itertools import zip_longest as izip_longest

def iterkeys(mapping):
return mapping.keys()

try:
# Python 3.6+.
from collections.abc import Collection
# Python 3.6+.
from collections.abc import Collection
except ImportError:
# Python 2.7 - 3.5.
from collections import Container as Collection
# Python 2.7 - 3.5.
from collections import Container as Collection
Loading

0 comments on commit 0e6c042

Please sign in to comment.