Skip to content

Commit

Permalink
Update noqa comments to use ruff
Browse files Browse the repository at this point in the history
Closes: ray-project#48508
Signed-off-by: Chi-Sheng Liu <[email protected]>
  • Loading branch information
MortalHappiness committed Dec 25, 2024
1 parent 3c15dc7 commit 0438f43
Show file tree
Hide file tree
Showing 99 changed files with 100 additions and 100 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# flake8: noqa
# ruff: noqa
"""
Hyperparameter tuning with Ray Tune
===================================
Expand Down
2 changes: 1 addition & 1 deletion doc/source/data/doc_code/custom_datasource_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
# fmt: off

from typing import Iterator, Union, List
Expand Down
2 changes: 1 addition & 1 deletion doc/source/data/doc_code/key_concepts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# fmt: off
# __resource_allocation_1_begin__
Expand Down
2 changes: 1 addition & 1 deletion doc/source/data/doc_code/preprocessors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
# isort: skip_file

# __preprocessor_setup_start__
Expand Down
2 changes: 1 addition & 1 deletion doc/source/ray-core/doc_code/actor_creator_failure.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# fmt: off
# __actor_creator_failure_begin__
Expand Down
2 changes: 1 addition & 1 deletion doc/source/ray-core/doc_code/actor_restart.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# fmt: off
# __actor_restart_begin__
Expand Down
2 changes: 1 addition & 1 deletion doc/source/ray-core/doc_code/actors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# __cancel_start__
import ray
Expand Down
2 changes: 1 addition & 1 deletion doc/source/ray-core/doc_code/cross_language.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# fmt: off
# __crosslang_init_start__
Expand Down
2 changes: 1 addition & 1 deletion doc/source/ray-core/doc_code/getting_started.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
# __starting_ray_start__
import ray

Expand Down
2 changes: 1 addition & 1 deletion doc/source/ray-core/doc_code/namespaces.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
# fmt: off
# __init_namespace_start__
import ray
Expand Down
2 changes: 1 addition & 1 deletion doc/source/ray-core/doc_code/nested-tasks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# __nested_start__
import ray
Expand Down
2 changes: 1 addition & 1 deletion doc/source/ray-core/doc_code/owners.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
# __owners_begin__
import ray
import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion doc/source/ray-core/doc_code/ray-dag.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# fmt: off
# __dag_tasks_begin__
Expand Down
2 changes: 1 addition & 1 deletion doc/source/ray-core/doc_code/ray_oom_prevention.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
import ray

ray.init(
Expand Down
2 changes: 1 addition & 1 deletion doc/source/ray-core/doc_code/runtime_env_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
"""
This file holds code for the runtime envs documentation.
Expand Down
2 changes: 1 addition & 1 deletion doc/source/ray-core/doc_code/streaming_generator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# fmt: off

Expand Down
2 changes: 1 addition & 1 deletion doc/source/ray-core/doc_code/task_exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# fmt: off
# __task_exceptions_begin__
Expand Down
2 changes: 1 addition & 1 deletion doc/source/ray-core/doc_code/tasks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# __tasks_start__
import ray
Expand Down
2 changes: 1 addition & 1 deletion doc/source/ray-core/doc_code/tasks_fault_tolerance.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# fmt: off
# __tasks_fault_tolerance_retries_begin__
Expand Down
2 changes: 1 addition & 1 deletion doc/source/ray-more-libs/doc_code/dask_on_ray_callbacks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
import ray
import dask.array as da

Expand Down
2 changes: 1 addition & 1 deletion doc/source/ray-observability/doc_code/gotchas.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
# __env_var_start__
import ray
import os
Expand Down
2 changes: 1 addition & 1 deletion doc/source/rllib/doc_code/advanced_api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# __rllib-adv_api_counter_begin__
import ray
Expand Down
2 changes: 1 addition & 1 deletion doc/source/rllib/doc_code/catalog_guide.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
"""
This file holds several examples for the Catalogs API that are used in the catalog
guide.
Expand Down
2 changes: 1 addition & 1 deletion doc/source/rllib/doc_code/checkpoints.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# __rllib-convert-pickle-to-msgpack-checkpoint-begin__
import tempfile
Expand Down
2 changes: 1 addition & 1 deletion doc/source/rllib/doc_code/getting_started.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# __rllib-first-config-begin__
from pprint import pprint
Expand Down
2 changes: 1 addition & 1 deletion doc/source/rllib/doc_code/rllib_in_60s.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# __rllib-in-60s-begin__
from ray.rllib.algorithms.ppo import PPOConfig
Expand Down
2 changes: 1 addition & 1 deletion doc/source/rllib/doc_code/rlmodule_guide.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
from ray.rllib.utils.annotations import override


Expand Down
2 changes: 1 addition & 1 deletion doc/source/rllib/doc_code/sa_episode.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
import copy

# __rllib-sa-episode-01-begin__
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# __create-algo-checkpoint-begin__
# Create a PPO algorithm object using a config object ..
Expand Down
2 changes: 1 addition & 1 deletion doc/source/rllib/doc_code/training.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# __preprocessing_observations_start__
try:
Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/app_builder.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# __begin_untyped_builder__
from typing import Dict
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
# __compile_neuron_code_start__
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch, torch_neuronx
Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/batching_guide.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
# __single_sample_begin__
from ray import serve
from ray.serve.handle import DeploymentHandle
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

import ray

Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/develop_and_deploy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# __deployment_start__
import ray
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

from ray import serve

Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/fault_tolerance/sleepy_pid.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# __start__
# File name: sleepy_pid.py
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# __import_start__
from starlette.requests import Request
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# __deployment_full_start__
# File name: serve_quickstart.py
Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/getting_started/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# __start_translation_model__
# File name: model.py
Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/getting_started/translator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# __start_graph__
# File name: serve_quickstart_composed.py
Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/grpc_proxy/grpc_guide.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
import ray


Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/http_guide/disconnects.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
# fmt: off

import ray
Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/http_guide/http_guide.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# __begin_starlette__
import starlette.requests
Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/http_guide/streaming_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# __begin_example__
import time
Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/http_guide/websockets_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# __websocket_serve_app_start__
from fastapi import FastAPI, WebSocket, WebSocketDisconnect
Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/key_concepts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# __start_my_first_deployment__
from ray import serve
Expand Down
4 changes: 2 additions & 2 deletions doc/source/serve/doc_code/load_shedding.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
# fmt: off

# __example_deployment_start__
Expand Down Expand Up @@ -38,7 +38,7 @@ async def do_request(self) -> int:
first_refs = [r.do_request.remote() for _ in range(2)]
_, pending = ray.wait(first_refs, timeout=1)
assert len(pending) == 2
# 2 will be queued in the proxy.
# 2 will be queued in the proxy.
queued_refs = [r.do_request.remote() for _ in range(2)]
_, pending = ray.wait(queued_refs, timeout=0.1)
assert len(pending) == 2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
# __chaining_example_start__
# File name: chain.py
from ray import serve
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

import requests

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
# __response_to_object_ref_example_start__
# File name: response_to_object_ref.py
import ray
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
# __streaming_example_start__
# File name: stream.py
from typing import AsyncGenerator, Generator
Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/monitoring/logging_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
# __deployment_json_start__
import requests
from ray import serve
Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/monitoring/monitor_deployment.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
# fmt: off

# __monitor_start__
Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/monitoring/monitoring.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# __start__
# File name: monitoring.py
Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/production_guide/text_ml.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# __example_start__
from starlette.requests import Request
Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/requests_best_practices.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
# fmt: off


Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/sklearn_quickstart.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
# fmt: off

# __serve_example_begin__
Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/streaming_tutorial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
# fmt: off

from typing import List
Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/test_service_pb2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
Expand Down
2 changes: 1 addition & 1 deletion doc/source/serve/doc_code/test_service_pb2_grpc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
Expand Down
2 changes: 1 addition & 1 deletion doc/source/train/doc_code/checkpoints.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
# isort: skip_file

# __pytorch_save_start__
Expand Down
2 changes: 1 addition & 1 deletion doc/source/train/doc_code/data_ingest_torch_new.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
# isort: skip_file

# __basic__
Expand Down
2 changes: 1 addition & 1 deletion doc/source/train/doc_code/dl_guide.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa

MOCK = True

Expand Down
2 changes: 1 addition & 1 deletion doc/source/train/doc_code/gbdt_user_guide.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
# isort: skip_file

# __xgboost_start__
Expand Down
Loading

0 comments on commit 0438f43

Please sign in to comment.