Update import sorting blacklist, enable sorting for experimental dir (#26101)

Why are these changes needed?
There are directories that we don't lint / format. Ensure they are also the case for the import sorting tool.

Enable sorting for python/experimental to show case how to enable sorting for a directory as we convert more of the directories to be automatically sorted by the tool.
This commit is contained in:
clarng 2022-07-12 21:25:58 -07:00 committed by GitHub
parent 2cdb76789e
commit b2cdd45e7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 62 additions and 57 deletions

View file

@ -9,12 +9,17 @@ use_parentheses=True
float_to_top=True
filter_files=True
# Skip docs/* as these are carefully crafted and aren't strictly code.
# Skip python/ray/__init__.py and python/ray/setup-dev.py, which
# are also carefully crafted.
# Some of the directories need to be kept in the blacklist:
# python/ray/cloudpickle/*
# python/build/*
# python/ray/thirdparty_files/*
# python/ray/_private/thirdparty/*
# doc/*
# python/ray/__init__.py
# python/ray/setup-dev.py
# For the rest we will gradually remove them from the blacklist as we
# reformat the code to follow the style guide.
skip_glob=python/ray/__init__.py,python/ray/setup-dev.py,python/ray/dag/*.py,doc/*,ci/*,python/ray/_raylet*,python/ray/_private/*,python/ray/air/*,python/ray/cloudpickle/*,python/ray/core/*,dashboard/*,python/ray/data/*,python/ray/experimental/*,python/ray/includes/*,python/ray/internal/*,python/ray/ray_operator/*,python/ray/scripts/*,python/ray/serve/*,python/ray/sgd/*,python/ray/serve/__init__.py,python/ray/streaming/*,python/ray/tests/*,python/ray/tests/*,python/ray/train/*,python/ray/tune/*,python/ray/util/*,python/ray/workers/*,python/ray/workflow/*,rllib/*,release/*,
skip_glob=doc/*,python/ray/__init__.py,python/ray/setup-dev.py,python/build/*,python/ray/cloudpickle/*,python/ray/thirdparty_files/*,python/ray/_private/thirdparty/*,python/ray/dag/*.py,ci/*,python/ray/_private/*,python/ray/air/*,python/ray/core/*,dashboard/*,python/ray/data/*,python/ray/includes/*,python/ray/internal/*,python/ray/ray_operator/*,python/ray/scripts/*,python/ray/serve/*,python/ray/serve/__init__.py,python/ray/sgd/*,python/ray/streaming/*,python/ray/tests/*,python/ray/tests/*,python/ray/train/*,python/ray/tune/*,python/ray/util/*,python/ray/workers/*,python/ray/workflow/*,rllib/*,release/*,
known_local_folder=ray
known_afterray=psutil,setproctitle

View file

@ -1,5 +1,5 @@
from ray.experimental.dynamic_resources import set_resource
from ray.experimental.packaging.load_package import load_package
from ray.experimental.locations import get_object_locations
from ray.experimental.packaging.load_package import load_package
__all__ = ["get_object_locations", "set_resource", "load_package"]

View file

@ -1,22 +1,21 @@
from . import random
from . import linalg
from . import linalg, random
from .core import (
BLOCK_SIZE,
DistArray,
assemble,
zeros,
ones,
copy,
eye,
triu,
tril,
blockwise_dot,
dot,
transpose,
add,
subtract,
assemble,
blockwise_dot,
copy,
dot,
eye,
numpy_to_dist,
ones,
subblocks,
subtract,
transpose,
tril,
triu,
zeros,
)
__all__ = [

View file

@ -1,6 +1,7 @@
import numpy as np
import ray.experimental.array.remote as ra
import ray
import ray.experimental.array.remote as ra
BLOCK_SIZE = 10

View file

@ -1,7 +1,7 @@
import numpy as np
import ray.experimental.array.remote as ra
import ray
import ray
import ray.experimental.array.remote as ra
from . import core
__all__ = ["tsqr", "modified_lu", "tsqr_hr", "qr"]

View file

@ -1,7 +1,7 @@
import numpy as np
import ray.experimental.array.remote as ra
import ray
import ray
import ray.experimental.array.remote as ra
from .core import DistArray

View file

@ -1,24 +1,23 @@
from . import random
from . import linalg
from . import linalg, random
from .core import (
zeros,
zeros_like,
ones,
eye,
dot,
vstack,
hstack,
subarray,
copy,
tril,
triu,
diag,
transpose,
add,
copy,
diag,
dot,
eye,
hstack,
ones,
shape,
subarray,
subtract,
sum,
shape,
sum_list,
transpose,
tril,
triu,
vstack,
zeros,
zeros_like,
)
__all__ = [

View file

@ -1,4 +1,5 @@
import numpy as np
import ray

View file

@ -1,4 +1,5 @@
import numpy as np
import ray
__all__ = [

View file

@ -1,4 +1,5 @@
import numpy as np
import ray

View file

@ -1,4 +1,4 @@
from typing import List, Union, Optional
from typing import List, Optional, Union
from ray._private.client_mode_hook import client_mode_hook
from ray._private.gcs_utils import GcsClient

View file

@ -5,11 +5,9 @@ import time
from typing import List, Tuple
import ray
from ray.experimental.raysort import constants, logging_utils
from ray.util.metrics import Gauge, Histogram
from ray.experimental.raysort import constants
from ray.experimental.raysort import logging_utils
HISTOGRAM_BOUNDARIES = list(range(50, 200, 50))

View file

@ -8,7 +8,6 @@ import requests
import ray
from ray.dashboard.modules.dashboard_sdk import SubmissionClient
from ray.experimental.state.common import (
SummaryApiOptions,
DEFAULT_LIMIT,
DEFAULT_LOG_LIMIT,
DEFAULT_RPC_TIMEOUT,
@ -20,12 +19,13 @@ from ray.experimental.state.common import (
NodeState,
ObjectState,
PlacementGroupState,
PredicateType,
StateResource,
SummaryApiOptions,
SummaryResource,
SupportedFilterType,
TaskState,
WorkerState,
SummaryResource,
PredicateType,
)
from ray.experimental.state.exception import RayStateApiException, ServerUnavailable

View file

@ -1,11 +1,11 @@
import logging
from abc import ABC
from dataclasses import dataclass, fields, field
from dataclasses import dataclass, field, fields
from enum import Enum, unique
from typing import List, Optional, Set, Tuple, Union, Dict
from typing import Dict, List, Optional, Set, Tuple, Union
from ray.dashboard.modules.job.common import JobInfo
from ray.core.generated.common_pb2 import TaskType
from ray.dashboard.modules.job.common import JobInfo
logger = logging.getLogger(__name__)

View file

@ -9,21 +9,20 @@ import yaml
import ray
import ray._private.ray_constants as ray_constants
import ray._private.services as services
from ray._private.gcs_utils import GcsClient
from ray.experimental.state.api import (
StateApiClient,
summarize_tasks,
summarize_actors,
summarize_objects,
summarize_tasks,
)
from ray._private.gcs_utils import GcsClient
from ray.experimental.state.common import (
DEFAULT_LIMIT,
DEFAULT_RPC_TIMEOUT,
GetApiOptions,
ListApiOptions,
StateResource,
PredicateType,
StateResource,
SupportedFilterType,
)

View file

@ -22,8 +22,8 @@ from ray.core.generated.gcs_service_pb2 import (
GetAllWorkerInfoRequest,
)
from ray.core.generated.node_manager_pb2 import (
GetObjectsInfoRequest,
GetObjectsInfoReply,
GetObjectsInfoRequest,
GetTasksInfoReply,
GetTasksInfoRequest,
)
@ -40,8 +40,8 @@ from ray.core.generated.runtime_env_agent_pb2 import (
)
from ray.core.generated.runtime_env_agent_pb2_grpc import RuntimeEnvServiceStub
from ray.dashboard.modules.job.common import JobInfo, JobInfoStorageClient
from ray.experimental.state.exception import DataSourceUnavailable
from ray.experimental.state.common import MAX_LIMIT
from ray.experimental.state.exception import DataSourceUnavailable
logger = logging.getLogger(__name__)

View file

@ -1,4 +1,4 @@
from typing import Union, Optional
from typing import Optional, Union
def convert_string_to_type(

View file

@ -1,4 +1,5 @@
from collections import deque, OrderedDict
from collections import OrderedDict, deque
import numpy as np
from ray.rllib.utils import force_list