id
int64
0
328k
repository_name
stringlengths
7
58
file_path
stringlengths
9
302
class_name
stringlengths
5
256
human_written_code
stringlengths
16
2.16M
class_skeleton
stringlengths
18
1.49M
⌀
total_program_units
int64
1
1.76k
total_doc_str
int64
0
771
AvgCountLine
float64
0
7.89k
AvgCountLineBlank
float64
0
297
AvgCountLineCode
float64
0
7.89k
AvgCountLineComment
float64
0
7.89k
AvgCyclomatic
float64
0
130
CommentToCodeRatio
float64
0
168
CountClassBase
float64
0
40
CountClassCoupled
float64
0
583
CountClassCoupledModified
float64
0
575
CountClassDerived
float64
0
5.35k
CountDeclInstanceMethod
float64
0
529
CountDeclInstanceVariable
float64
0
296
CountDeclMethod
float64
0
599
CountDeclMethodAll
float64
0
1.12k
CountLine
float64
1
40.4k
CountLineBlank
float64
0
8.16k
CountLineCode
float64
1
25.7k
CountLineCodeDecl
float64
1
8.15k
CountLineCodeExe
float64
0
24.2k
CountLineComment
float64
0
16.5k
CountStmt
float64
1
9.71k
CountStmtDecl
float64
1
8.15k
CountStmtExe
float64
0
9.69k
MaxCyclomatic
float64
0
759
MaxInheritanceTree
float64
0
16
MaxNesting
float64
0
34
SumCyclomatic
float64
0
2.9k
9,300
ray-project/ray
ci/ray_ci/builder_container.py
builder_container.PythonVersionInfo
from typing import TypedDict class PythonVersionInfo(TypedDict): bin_path: str
class PythonVersionInfo(TypedDict): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
2
0
2
1
1
0
2
1
1
0
1
0
0
9,301
ray-project/ray
doc/source/_ext/callouts.py
callouts.AnnotationsDirective
from sphinx.util.docutils import SphinxDirective class AnnotationsDirective(SphinxDirective): """Annotations directive, which is only used nested within a Callout directive.""" has_content = True def run(self): content = self.content content = _replace_numbers(content) joined_conte...
class AnnotationsDirective(SphinxDirective): '''Annotations directive, which is only used nested within a Callout directive.''' def run(self): pass
2
1
9
2
7
0
1
0.11
1
1
1
0
1
0
1
1
14
4
9
6
7
1
9
6
7
1
1
0
1
9,302
ray-project/ray
doc/source/_ext/callouts.py
callouts.CalloutDirective
from sphinx.util.docutils import SphinxDirective class CalloutDirective(SphinxDirective): """Code callout directive with annotations for Sphinx. Use this `callout` directive by wrapping either `code-block` or `literalinclude` directives. Each line that's supposed to be equipped with an annotation should ...
class CalloutDirective(SphinxDirective): '''Code callout directive with annotations for Sphinx. Use this `callout` directive by wrapping either `code-block` or `literalinclude` directives. Each line that's supposed to be equipped with an annotation should have an inline comment of the form "# <x>" wher...
2
1
10
3
7
0
1
3.44
1
1
1
0
1
0
1
1
62
22
9
5
7
31
9
5
7
1
1
0
1
9,303
ray-project/ray
doc/source/_ext/callouts.py
callouts.CalloutIncludePostTransform
from sphinx.transforms import SphinxTransform class CalloutIncludePostTransform(SphinxTransform): """Code block post-processor for `literalinclude` blocks used in callouts.""" default_priority = 400 def apply(self, **kwargs) -> None: visitor = LiteralIncludeVisitor(self.document) self.docu...
class CalloutIncludePostTransform(SphinxTransform): '''Code block post-processor for `literalinclude` blocks used in callouts.''' def apply(self, **kwargs) -> None: pass
2
1
3
0
3
0
1
0.2
1
1
1
0
1
0
1
1
8
2
5
4
3
1
5
4
3
1
1
0
1
9,304
ray-project/ray
doc/source/_ext/callouts.py
callouts.LiteralIncludeVisitor
from docutils.nodes import Node from docutils import nodes class LiteralIncludeVisitor(nodes.NodeVisitor): """Change a literal block upon visiting it.""" def __init__(self, document: nodes.document) -> None: super().__init__(document) def unknown_visit(self, node: Node) -> None: pass ...
class LiteralIncludeVisitor(nodes.NodeVisitor): '''Change a literal block upon visiting it.''' def __init__(self, document: nodes.document) -> None: pass def unknown_visit(self, node: Node) -> None: pass def unknown_departure(self, node: Node) -> None: pass def visit_doc...
9
1
3
0
3
0
1
0.04
1
4
0
0
8
0
8
8
33
8
24
11
15
1
22
11
13
3
1
2
10
9,305
ray-project/ray
doc/source/_ext/callouts.py
callouts.annotations
from docutils import nodes class annotations(nodes.Element): """Sphinx annotations node.""" pass
class annotations(nodes.Element): '''Sphinx annotations node.''' pass
1
1
0
0
0
0
0
0.5
1
0
0
0
0
0
0
0
4
1
2
1
1
1
2
1
1
0
1
0
0
9,306
ray-project/ray
doc/source/_ext/callouts.py
callouts.callout
from docutils import nodes class callout(nodes.General, nodes.Element): """Sphinx callout node.""" pass
class callout(nodes.General, nodes.Element): '''Sphinx callout node.''' pass
1
1
0
0
0
0
0
0.5
2
0
0
0
0
0
0
0
4
1
2
1
1
1
2
1
1
0
1
0
0
9,307
ray-project/ray
release/nightly_tests/decision_tree/cart_with_tree.py
cart_with_tree.DecisionTreeClassifier
import numpy as np import ray class DecisionTreeClassifier: def __init__(self, max_depth=None, tree_limit=5000, feature_limit=2000): self.max_depth = max_depth self.tree_limit = tree_limit self.feature_limit = feature_limit def fit(self, X, y): """Build decision tree classifie...
class DecisionTreeClassifier: def __init__(self, max_depth=None, tree_limit=5000, feature_limit=2000): pass def fit(self, X, y): '''Build decision tree classifier.''' pass def predict(self, X): '''Predict class for X.''' pass def debug(self, feature_names, cl...
9
5
5
0
4
1
1
0.31
0
2
0
0
8
6
8
8
45
8
29
18
20
9
28
18
19
3
0
2
10
9,308
ray-project/ray
release/nightly_tests/decision_tree/cart_with_tree.py
cart_with_tree.Node
class Node: """A decision tree node.""" def __init__(self, gini, num_samples, num_samples_per_class, predicted_class): self.gini = gini self.num_samples = num_samples self.num_samples_per_class = num_samples_per_class self.predicted_class = predicted_class self.feature_i...
class Node: '''A decision tree node.''' def __init__(self, gini, num_samples, num_samples_per_class, predicted_class): pass def debug(self, feature_names, class_names, show_details): '''Print an ASCII visualization of the tree.''' pass def _debug_aux(self, feature_names, class...
4
2
24
1
22
2
4
0.1
0
2
0
0
3
8
3
3
78
5
67
25
63
7
50
25
46
8
0
1
11
9,309
ray-project/ray
doc/source/serve/doc_code/model_composition/chaining_example.py
chaining_example.Adder
from ray import serve @serve.deployment class Adder: def __init__(self, increment: int): self._increment = increment def __call__(self, val: int) -> int: return val + self._increment
@serve.deployment class Adder: def __init__(self, increment: int): pass def __call__(self, val: int) -> int: pass
4
0
2
0
2
0
1
0
0
1
0
0
2
1
2
2
6
1
5
4
2
0
5
4
2
1
0
0
2
9,310
ray-project/ray
doc/source/serve/doc_code/model_composition/chaining_example.py
chaining_example.Ingress
from ray.serve.handle import DeploymentHandle, DeploymentResponse from ray import serve @serve.deployment class Ingress: def __init__(self, adder: DeploymentHandle, multiplier: DeploymentHandle): self._adder = adder self._multiplier = multiplier async def __call__(self, input: int) -> int: ...
@serve.deployment class Ingress: def __init__(self, adder: DeploymentHandle, multiplier: DeploymentHandle): pass async def __call__(self, input: int) -> int: pass
4
0
6
0
5
1
1
0.2
0
3
2
0
2
2
2
2
13
1
10
7
7
2
8
7
5
1
0
0
2
9,311
ray-project/ray
doc/source/serve/doc_code/model_composition/chaining_example.py
chaining_example.Multiplier
from ray import serve @serve.deployment class Multiplier: def __init__(self, multiple: int): self._multiple = multiple def __call__(self, val: int) -> int: return val * self._multiple
@serve.deployment class Multiplier: def __init__(self, multiple: int): pass def __call__(self, val: int) -> int: pass
4
0
2
0
2
0
1
0
0
1
0
0
2
1
2
2
6
1
5
4
2
0
5
4
2
1
0
0
2
9,312
ray-project/ray
doc/source/train/doc_code/checkpoints.py
checkpoints.CustomRayTrainReportCallback
from ray.train import Checkpoint from tempfile import TemporaryDirectory from ray.train import Checkpoint, ScalingConfig import ray import ray.train from pytorch_lightning.callbacks import Callback import os import ray.train.torch class CustomRayTrainReportCallback(Callback): def on_train_epoch_end(self, trainer,...
class CustomRayTrainReportCallback(Callback): def on_train_epoch_end(self, trainer, pl_module): pass
2
0
23
5
14
4
2
0.27
1
2
1
0
1
0
1
1
24
5
15
8
13
4
15
7
13
2
1
2
2
9,313
ray-project/ray
doc/source/train/doc_code/checkpoints.py
checkpoints.MyLightningModule
import pytorch_lightning as pl class MyLightningModule(pl.LightningModule): def on_validation_epoch_end(self): ... mean_acc = calculate_accuracy() self.log('mean_accuracy', mean_acc, sync_dist=True)
class MyLightningModule(pl.LightningModule): def on_validation_epoch_end(self): pass
2
0
4
0
4
0
1
0.2
1
0
0
0
1
0
1
1
7
1
5
3
3
1
5
3
3
1
1
0
1
9,314
ray-project/ray
doc/source/train/doc_code/checkpoints.py
checkpoints.MyTrainReportCallback
from ray.train import Checkpoint, ScalingConfig import ray import ray.train.torch from ray import train import ray.train from transformers.trainer_callback import TrainerCallback from ray.train import Checkpoint class MyTrainReportCallback(TrainerCallback): def __init__(self): super().__init__() s...
class MyTrainReportCallback(TrainerCallback): def __init__(self): pass def on_log(self, args, state, control, model=None, logs=None, **kwargs): '''Log is called on evaluation step and logging step.''' pass def on_save(self, args, state, control, **kwargs): '''Event called...
4
2
7
1
4
2
1
0.38
1
2
1
0
3
1
3
18
23
5
13
7
9
5
13
7
9
2
1
1
4
9,315
ray-project/ray
ci/repro-ci.py
ci.repro-ci.ReproSession
import threading import yaml import base64 import time from typing import Any, Callable, Dict, List, Optional import paramiko import json import subprocess import os import boto3 from pybuildkite.buildkite import Buildkite import re import click import logging class ReproSession: plugin_default_env = {'docker': {'...
class ReproSession: def __init__(self, buildkite_token: str, instance_name: Optional[str]=None, logger: Optional[logging.Logger]=None): pass def set_session(self, session_url: str): pass def fetch_env_variables(self, overwrite: Optional[Dict[str, Any]]=None): pass def aws_st...
28
0
17
3
14
0
2
0.02
0
5
0
0
24
18
24
24
476
97
374
130
321
8
240
105
212
5
0
3
55
9,316
ray-project/ray
doc/source/conf.py
conf.MockVersion
class MockVersion(Version): def __init__(self, version: str): if isinstance(version, (str, bytes)): super().__init__(version) else: super().__init__('0')
class MockVersion(Version): def __init__(self, version: str): pass
2
0
5
0
5
0
2
0
1
3
0
0
1
0
1
1
6
0
6
2
4
0
5
2
3
2
1
1
2
9,317
ray-project/ray
doc/source/conf.py
conf.MockedClassDocumenter
from sphinx.ext import autodoc class MockedClassDocumenter(autodoc.ClassDocumenter): """Remove note about base class when a class is derived from object.""" def add_line(self, line: str, source: str, *lineno: int) -> None: if line == ' Bases: :py:class:`object`': return super().a...
class MockedClassDocumenter(autodoc.ClassDocumenter): '''Remove note about base class when a class is derived from object.''' def add_line(self, line: str, source: str, *lineno: int) -> None: pass
2
1
4
0
4
0
2
0.2
1
3
0
0
1
0
1
1
7
1
5
2
3
1
5
2
3
2
1
1
2
9,318
ray-project/ray
release/train_tests/benchmark/config.py
config.BenchmarkConfig
from pydantic import BaseModel, Field class BenchmarkConfig(BaseModel): num_workers: int = 1 mock_gpu: bool = False max_failures: int = 0 task: str = 'image_classification' task_config: TaskConfig = Field(default_factory=lambda: TaskConfig()) dataloader_type: DataloaderType = DataloaderType.RAY...
class BenchmarkConfig(BaseModel): pass
1
0
0
0
0
0
0
0.5
1
1
1
0
0
0
0
83
23
5
12
10
11
6
10
10
9
0
5
0
0
9,319
ray-project/ray
release/train_tests/benchmark/config.py
config.DataLoaderConfig
from pydantic import BaseModel, Field class DataLoaderConfig(BaseModel): train_batch_size: int = 32 limit_training_rows: int = 1000000 validation_batch_size: int = 256 limit_validation_rows: int = 50000
class DataLoaderConfig(BaseModel): pass
1
0
0
0
0
0
0
0
1
0
0
1
0
0
0
83
3
0
3
3
2
0
3
3
2
0
5
0
0
9,320
ray-project/ray
release/train_tests/benchmark/config.py
config.DataloaderType
import enum class DataloaderType(enum.Enum): RAY_DATA = 'ray_data' MOCK = 'mock' TORCH = 'torch'
class DataloaderType(enum.Enum): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
49
3
0
3
3
2
0
3
3
2
0
4
0
0
9,321
ray-project/ray
release/train_tests/benchmark/config.py
config.RayDataConfig
class RayDataConfig(DataLoaderConfig): local_buffer_shuffle_size: int = -1 enable_operator_progress_bars: bool = True ray_data_prefetch_batches: int = 4 ray_data_override_num_blocks: int = -1 locality_with_output: bool = False actor_locality_enabled: bool = True enable_shard_locality: bool =...
class RayDataConfig(DataLoaderConfig): pass
1
0
0
0
0
0
0
0.5
1
0
0
0
0
0
0
83
3
0
2
2
1
1
2
2
1
0
6
0
0
9,322
ray-project/ray
ci/ray_ci/container.py
container.Container
from typing import List, Optional, Tuple import subprocess import sys import re import abc class Container(abc.ABC): """ A wrapper for running commands in ray ci docker container """ def __init__(self, docker_tag: str, volumes: Optional[List[str]]=None, envs: Optional[List[str]]=None) -> None: ...
class Container(abc.ABC): ''' A wrapper for running commands in ray ci docker container ''' def __init__(self, docker_tag: str, volumes: Optional[List[str]]=None, envs: Optional[List[str]]=None) -> None: pass def run_script_with_output(self, script: List[str]) -> str: ''' ...
14
7
10
0
7
2
1
0.36
1
2
0
3
9
3
9
29
103
9
69
35
41
25
30
17
20
4
4
1
12
9,323
ray-project/ray
doc/source/ray-core/doc_code/cross_language.py
cross_language.Counter
import ray import ray import ray import ray import ray import ray import ray @ray.remote class Counter(object): def __init__(self): self.value = 0 def increment(self): self.value += 1 return self.value
@ray.remote class Counter(object): def __init__(self): pass def increment(self): pass
4
0
3
0
3
0
1
0
1
0
0
0
2
1
2
2
7
1
6
4
3
0
6
4
3
1
1
0
2
9,324
ray-project/ray
rllib/examples/catalogs/custom_action_distribution.py
custom_action_distribution.CustomPPOCatalog
from ray.rllib.algorithms.ppo.ppo_catalog import PPOCatalog class CustomPPOCatalog(PPOCatalog): def get_action_dist_cls(self, framework): assert framework == 'torch' return CustomTorchCategorical
class CustomPPOCatalog(PPOCatalog): def get_action_dist_cls(self, framework): pass
2
0
4
0
3
1
1
0.25
1
1
1
0
1
0
1
1
5
0
4
2
2
1
4
2
2
1
1
0
1
9,325
ray-project/ray
rllib/examples/catalogs/custom_action_distribution.py
custom_action_distribution.CustomTorchCategorical
import torch from ray.rllib.core.distribution.torch.torch_distribution import TorchDeterministic from ray.rllib.core.distribution.distribution import Distribution class CustomTorchCategorical(Distribution): def __init__(self, logits): self.torch_dist = torch.distributions.categorical.Categorical(logits=lo...
class CustomTorchCategorical(Distribution): def __init__(self, logits): pass def sample(self, sample_shape=torch.Size(), **kwargs): pass def rsample(self, sample_shape=torch.Size(), **kwargs): pass def logp(self, value, **kwargs): pass def entropy(self): ...
12
0
2
0
2
0
1
0.24
1
1
0
0
7
2
9
9
34
8
21
14
9
5
19
11
9
1
1
0
9
9,326
ray-project/ray
doc/source/data/doc_code/custom_datasource_example.py
custom_datasource_example.ImageDatasink
from ray.data.datasource import RowBasedFileDatasink import pyarrow import pyarrow from typing import Any, Dict class ImageDatasink(RowBasedFileDatasink): def __init__(self, path: str, column: str, file_format: str): super().__init__(path, file_format=file_format) self.column = column self...
class ImageDatasink(RowBasedFileDatasink): def __init__(self, path: str, column: str, file_format: str): pass def write_row_to_file(self, row: Dict[str, Any], file: pyarrow.NativeFile): pass
3
0
7
1
6
1
1
0.33
1
3
0
0
2
2
2
21
18
3
12
9
7
4
12
9
7
1
4
0
2
9,327
ray-project/ray
doc/source/data/doc_code/custom_datasource_example.py
custom_datasource_example.ImageDatasource
from ray.data.datasource import FileBasedDatasource from ray.data.block import Block from typing import Iterator, Union, List class ImageDatasource(FileBasedDatasource): def __init__(self, paths: Union[str, List[str]], *, mode: str): super().__init__(paths, file_extensions=['png', 'jpg', 'jpeg', 'bmp', 'g...
class ImageDatasource(FileBasedDatasource): def __init__(self, paths: Union[str, List[str]], *, mode: str): pass def _read_stream(self, f: 'pyarrow.NativeFile', path: str) -> Iterator[Block]: pass
3
0
12
2
10
1
1
0.2
1
3
1
0
2
1
2
18
27
4
20
13
13
4
17
13
10
1
2
0
2
9,328
ray-project/ray
doc/source/custom_directives.py
custom_directives.Contributor
class Contributor(ExampleEnum): RAY_TEAM = 'Maintained by the Ray Team' COMMUNITY = 'Contributed by the Ray Community' @property def tag(self): if self == Contributor.RAY_TEAM: return 'ray-team' return 'community' @classmethod def formatted_name(cls): return...
class Contributor(ExampleEnum): @property def tag(self): pass @classmethod def formatted_name(cls): pass @classmethod def key(cls: type) -> str: pass
7
0
3
0
3
0
1
0
1
2
0
0
1
0
3
57
17
3
14
9
7
0
11
6
7
2
5
1
4
9,329
ray-project/ray
doc/source/custom_directives.py
custom_directives.DownloadAndPreprocessEcosystemDocs
from preprocess_github_markdown import preprocess_github_markdown_file import pathlib import requests import urllib.request import urllib class DownloadAndPreprocessEcosystemDocs: """ This class downloads markdown readme files for various ecosystem libraries, saves them in specified locations and preproces...
class DownloadAndPreprocessEcosystemDocs: ''' This class downloads markdown readme files for various ecosystem libraries, saves them in specified locations and preprocesses them before sphinx build starts. If you have ecosystem libraries that live in a separate repo from Ray, adding them here w...
10
3
6
0
5
0
1
0.24
0
2
0
0
5
2
7
7
59
8
41
22
29
10
27
13
19
2
0
2
10
9,330
ray-project/ray
doc/source/custom_directives.py
custom_directives.Example
from typing import Any, Callable, Dict, List, Optional, Tuple, Union import pathlib class Example: """Class containing metadata about an example to be shown in the example gallery.""" def __init__(self, config: Dict[str, str], library: Library, config_dir: pathlib.Path): self.config_dir = config_dir ...
class Example: '''Class containing metadata about an example to be shown in the example gallery.''' def __init__(self, config: Dict[str, str], library: Library, config_dir: pathlib.Path): pass
2
1
54
8
46
0
11
0.02
0
9
6
0
1
9
1
1
57
9
47
18
43
1
32
16
30
11
0
2
11
9,331
ray-project/ray
doc/source/custom_directives.py
custom_directives.ExampleConfig
from typing import Any, Callable, Dict, List, Optional, Tuple, Union import pathlib import yaml class ExampleConfig: """Object which holds configuration data for a set of library examples.""" def __init__(self, path: Union[pathlib.Path, str], src_dir: Union[pathlib.Path, str]): """Parse a config file ...
class ExampleConfig: '''Object which holds configuration data for a set of library examples.''' def __init__(self, path: Union[pathlib.Path, str], src_dir: Union[pathlib.Path, str]): '''Parse a config file containing examples to display in the example gallery. Parameters ---------- ...
5
4
25
3
15
8
3
0.54
0
10
5
0
4
6
4
4
106
15
59
26
50
32
41
21
36
5
0
2
13
9,332
ray-project/ray
doc/source/custom_directives.py
custom_directives.ExampleEnum
from collections.abc import Iterable from enum import Enum from typing import Any, Callable, Dict, List, Optional, Tuple, Union class ExampleEnum(Enum): """Enum which allows easier enumeration of members for example metadata.""" @classmethod def items(cls: type) -> Iterable[Tuple['ExampleEnum', str]]: ...
class ExampleEnum(Enum): '''Enum which allows easier enumeration of members for example metadata.''' @classmethod def items(cls: type) -> Iterable[Tuple['ExampleEnum', str]]: '''Return an iterable mapping between the enum type and the corresponding value. Returns ------- Dic...
11
5
9
1
3
5
1
1.4
1
4
0
6
0
0
5
54
58
10
20
12
9
28
15
7
9
3
4
2
7
9,333
ray-project/ray
doc/source/custom_directives.py
custom_directives.Framework
class Framework(ExampleEnum): """Framework type for example metadata.""" AWSNEURON = 'AWS Neuron' PYTORCH = 'PyTorch' LIGHTNING = 'Lightning' TRANSFORMERS = 'Transformers' ACCELERATE = 'Accelerate' DEEPSPEED = 'DeepSpeed' TENSORFLOW = 'TensorFlow' HOROVOD = 'Horovod' XGBOOST = 'X...
class Framework(ExampleEnum): '''Framework type for example metadata.''' @classmethod def formatted_name(cls): pass @classmethod def key(cls: type) -> str: pass
5
1
2
0
2
0
1
0.05
1
2
0
0
0
0
2
56
23
3
19
17
14
1
17
15
14
1
5
0
2
9,334
ray-project/ray
doc/source/custom_directives.py
custom_directives.Library
from typing import Any, Callable, Dict, List, Optional, Tuple, Union import pathlib class Library(ExampleEnum): """Library type for example metadata.""" DATA = 'Data' SERVE = 'Serve' TRAIN = 'Train' @classmethod def formatted_name(cls): return 'Library' @classmethod def key(cl...
class Library(ExampleEnum): '''Library type for example metadata.''' @classmethod def formatted_name(cls): pass @classmethod def key(cls: type) -> str: pass @classmethod def from_path(cls, path: Union[pathlib.Path, str]) -> 'Library': '''Instantiate a Library instanc...
7
2
10
2
4
4
2
0.65
1
4
0
0
0
0
3
57
42
9
20
11
13
13
17
8
13
4
5
2
6
9,335
ray-project/ray
doc/source/custom_directives.py
custom_directives.LinkcheckSummarizer
from sphinx.util import logging as sphinx_logging import logging import logging.handlers class LinkcheckSummarizer: """Hook into the logger used by linkcheck to display a summary at the end.""" def __init__(self) -> None: self.logger = None self.queue_handler = None self.log_queue = _B...
class LinkcheckSummarizer: '''Hook into the logger used by linkcheck to display a summary at the end.''' def __init__(self) -> None: pass def add_handler_to_linkcheck(self, *args, **kwargs): '''Adds a handler to the linkcheck logger.''' pass def summarize(self, *args, **kwarg...
4
3
10
1
7
1
2
0.22
0
3
2
0
3
3
3
3
34
6
23
9
19
5
23
9
19
4
0
1
7
9,336
ray-project/ray
doc/source/custom_directives.py
custom_directives.RelatedTechnology
class RelatedTechnology(ExampleEnum): ML_APPLICATIONS = 'ML Applications' LLM_APPLICATIONS = 'LLM Applications' INTEGRATIONS = 'Integrations' AI_ACCELERATORS = 'AI Accelerators' @classmethod def formatted_name(cls): return 'Related Technology' @classmethod def key(cls: type) ->...
class RelatedTechnology(ExampleEnum): @classmethod def formatted_name(cls): pass @classmethod def key(cls: type) -> str: pass
5
0
2
0
2
0
1
0
1
2
0
0
0
0
2
56
12
2
10
8
5
0
8
6
5
1
5
0
2
9,337
ray-project/ray
doc/source/custom_directives.py
custom_directives.SkillLevel
class SkillLevel(ExampleEnum): """Skill level type for example metadata.""" BEGINNER = 'Beginner' INTERMEDIATE = 'Intermediate' ADVANCED = 'Advanced' @classmethod def formatted_name(cls): return 'Skill Level' @classmethod def key(cls: type) -> str: return 'skill_level'
class SkillLevel(ExampleEnum): '''Skill level type for example metadata.''' @classmethod def formatted_name(cls): pass @classmethod def key(cls: type) -> str: pass
5
1
2
0
2
0
1
0.1
1
2
0
0
0
0
2
56
14
3
10
8
5
1
8
6
5
1
5
0
2
9,338
ray-project/ray
doc/source/custom_directives.py
custom_directives._BrokenLinksQueue
from queue import Queue from sphinx.util.console import red import logging.handlers from sphinx.util import logging as sphinx_logging import logging class _BrokenLinksQueue(Queue): """Queue that discards messages about non-broken links.""" def __init__(self, maxsize: int=0) -> None: self._last_line_no...
class _BrokenLinksQueue(Queue): '''Queue that discards messages about non-broken links.''' def __init__(self, maxsize: int=0) -> None: pass def put(self, item: logging.LogRecord, block=True, timeout=None): pass
3
1
9
0
7
2
3
0.27
1
3
0
0
2
2
2
16
21
2
15
6
12
4
15
6
12
4
1
2
5
9,339
ray-project/ray
doc/source/custom_directives.py
custom_directives._QueueHandler
from sphinx.util import logging as sphinx_logging import logging import logging.handlers class _QueueHandler(logging.handlers.QueueHandler): """QueueHandler without modifying the record.""" def prepare(self, record: logging.LogRecord) -> logging.LogRecord: return record
class _QueueHandler(logging.handlers.QueueHandler): '''QueueHandler without modifying the record.''' def prepare(self, record: logging.LogRecord) -> logging.LogRecord: pass
2
1
2
0
2
0
1
0.33
1
1
0
0
1
0
1
25
5
1
3
2
1
1
3
2
1
1
4
0
1
9,340
ray-project/ray
doc/source/rllib/doc_code/custom_gym_env.py
custom_gym_env.SimpleCorridor
import gymnasium as gym import numpy as np class SimpleCorridor(gym.Env): def __init__(self, config): self.end_pos = config['corridor_length'] self.cur_pos = 0.0 self.action_space = gym.spaces.Discrete(2) self.observation_space = gym.spaces.Box(0.0, self.end_pos, shape=(1,)) d...
class SimpleCorridor(gym.Env): def __init__(self, config): pass def reset(self, *, seed=None, options=None): pass def step(self, action): pass
4
0
6
0
6
1
2
0.17
1
0
0
0
3
4
3
3
20
2
18
8
14
3
16
8
12
4
1
1
6
9,341
ray-project/ray
doc/source/serve/doc_code/monitoring/custom_metric_snippet.py
custom_metric_snippet.MyDeployment
from ray.serve import metrics from ray import serve @serve.deployment class MyDeployment: def __init__(self): self.num_requests = 0 self.my_counter = metrics.Counter('my_counter', description='The number of odd-numbered requests to this deployment.', tag_keys=('model',)) self.my_counter.se...
@serve.deployment class MyDeployment: def __init__(self): pass def __call__(self): pass
4
0
6
0
6
0
2
0
0
1
1
0
2
2
2
2
14
1
13
5
10
0
9
5
6
2
0
1
3
9,342
ray-project/ray
doc/source/ray-more-libs/doc_code/dask_on_ray_callbacks.py
dask_on_ray_callbacks.MyPresubmitCallback
from ray.util.dask import RayDaskCallback, ray_dask_get class MyPresubmitCallback(RayDaskCallback): def _ray_presubmit(self, task, key, deps): print(f'About to submit task {key}!')
class MyPresubmitCallback(RayDaskCallback): def _ray_presubmit(self, task, key, deps): pass
2
0
2
0
2
0
1
0
1
0
0
0
1
0
1
13
3
0
3
2
1
0
3
2
1
1
2
0
1
9,343
ray-project/ray
doc/source/ray-more-libs/doc_code/dask_on_ray_callbacks.py
dask_on_ray_callbacks.MyTimerCallback
from ray.util.dask import RayDaskCallback, ray_dask_get from timeit import default_timer as timer class MyTimerCallback(RayDaskCallback): def _ray_pretask(self, key, object_refs): start_time = timer() return start_time def _ray_posttask(self, key, result, pre_state): execution_time = ...
class MyTimerCallback(RayDaskCallback): def _ray_pretask(self, key, object_refs): pass def _ray_posttask(self, key, result, pre_state): pass
3
0
4
0
3
1
1
0.29
1
0
0
0
2
0
2
14
10
1
7
5
4
2
7
5
4
1
2
0
2
9,344
ray-project/ray
doc/source/ray-more-libs/doc_code/dask_on_ray_callbacks.py
dask_on_ray_callbacks.SimpleCacheActor
import ray @ray.remote class SimpleCacheActor: def __init__(self): self.cache = {} def get(self, key): return self.cache[key] def put(self, key, value): self.cache[key] = value
@ray.remote class SimpleCacheActor: def __init__(self): pass def get(self, key): pass def put(self, key, value): pass
5
0
2
0
2
0
1
0.14
0
0
0
0
3
1
3
3
10
2
7
5
3
1
7
5
3
1
0
0
3
9,345
ray-project/ray
doc/source/ray-more-libs/doc_code/dask_on_ray_callbacks.py
dask_on_ray_callbacks.SimpleCacheCallback
import ray from ray.util.dask import RayDaskCallback, ray_dask_get from timeit import default_timer as timer class SimpleCacheCallback(RayDaskCallback): def __init__(self, cache_actor_handle, put_threshold=10): self.cache_actor = cache_actor_handle self.put_threshold = put_threshold def _ray_...
class SimpleCacheCallback(RayDaskCallback): def __init__(self, cache_actor_handle, put_threshold=10): pass def _ray_presubmit(self, task, key, deps): pass def _ray_pretask(self, key, object_refs): pass def _ray_posttask(self, key, result, pre_state): pass
5
0
4
0
4
0
2
0
1
2
0
0
4
2
4
16
19
3
16
9
11
0
16
9
11
2
2
1
6
9,346
ray-project/ray
doc/source/train/doc_code/data_ingest_torch_new.py
data_ingest_torch_new.MyCustomDataConfig
from typing import Dict from ray.actor import ActorHandle import ray from ray.train import DataConfig from ray.data import Dataset, DataIterator, NodeIdStr from typing import Optional, Dict, List class MyCustomDataConfig(DataConfig): def configure(self, datasets: Dict[str, Dataset], world_size: int, worker_handle...
class MyCustomDataConfig(DataConfig): def configure(self, datasets: Dict[str, Dataset], world_size: int, worker_handles: Optional[List[ActorHandle]], worker_node_ids: Optional[List[NodeIdStr]], **kwargs) -> List[Dict[str, DataIterator]]: pass
2
0
21
3
15
3
1
0.19
1
4
2
0
1
0
1
5
22
3
16
11
7
3
7
4
5
1
1
0
1
9,347
ray-project/ray
release/train_tests/benchmark/dataloader_factory.py
dataloader_factory.BaseDataLoaderFactory
import torch from typing import Any, Dict, Iterator, Tuple from config import BenchmarkConfig, DataLoaderConfig from abc import ABC, abstractmethod class BaseDataLoaderFactory(ABC): """Base class for creating and managing dataloaders.""" def __init__(self, benchmark_config: BenchmarkConfig): self.benc...
class BaseDataLoaderFactory(ABC): '''Base class for creating and managing dataloaders.''' def __init__(self, benchmark_config: BenchmarkConfig): pass def get_dataloader_config(self) -> DataLoaderConfig: pass @abstractmethod def get_train_dataloader(self) -> Iterator[Tuple[torch.Te...
8
2
2
0
2
0
1
0.23
1
4
1
2
5
1
5
25
21
5
13
9
5
3
11
7
5
1
4
0
5
9,348
ray-project/ray
release/nightly_tests/dataset/batch_inference_benchmark.py
dataset.batch_inference_benchmark.ApplyTransform
import torch from typing import Any, Dict import numpy as np class ApplyTransform: def __init__(self, transform): self._transform = transform def __call__(self, row: Dict[str, Any]) -> Dict[str, Any]: tensor_batch = torch.as_tensor(np.copy(row['image']), dtype=torch.float) tensor_batc...
class ApplyTransform: def __init__(self, transform): pass def __call__(self, row: Dict[str, Any]) -> Dict[str, Any]: pass
3
0
6
0
4
2
1
0.5
0
3
0
0
2
1
2
2
13
1
8
6
5
4
8
6
5
1
0
0
2
9,349
ray-project/ray
release/nightly_tests/dataset/batch_inference_benchmark.py
dataset.batch_inference_benchmark.LoadImage
import boto3 import numpy as np import io from PIL import Image class LoadImage: def __init__(self): self._client = boto3.client('s3') def __call__(self, row): data = io.BytesIO() self._client.download_fileobj(BUCKET, row['key'], data) image = Image.open(data).convert('RGB') ...
class LoadImage: def __init__(self): pass def __call__(self, row): pass
3
0
4
0
4
0
1
0
0
0
0
0
2
1
2
2
9
1
8
6
5
0
8
6
5
1
0
0
2
9,350
ray-project/ray
release/nightly_tests/dataset/batch_inference_benchmark.py
dataset.batch_inference_benchmark.Predictor
import numpy as np import torch from typing import Any, Dict import ray class Predictor: def __init__(self, model, device): self._model = ray.get(model) self._model.eval() self._model.to(device) self._device = device def __call__(self, batch: Dict[str, np.ndarray]) -> Dict[str...
class Predictor: def __init__(self, model, device): pass def __call__(self, batch: Dict[str, np.ndarray]) -> Dict[str, np.ndarray]: pass
3
0
5
1
5
0
1
0
0
1
0
0
2
2
2
2
12
2
10
6
7
0
10
6
7
1
0
1
2
9,351
ray-project/ray
release/nightly_tests/dataset/benchmark.py
dataset.benchmark.Benchmark
import time import pandas as pd from ray.data.dataset import Dataset import os from typing import Any from typing import Callable, Dict, Union import gc import json import pyarrow as pa class Benchmark: """Runs benchmarks in a way that's compatible with our release test infrastructure. Here's an example of ty...
class Benchmark: '''Runs benchmarks in a way that's compatible with our release test infrastructure. Here's an example of typical usage: .. testcode:: import time from benchmark import Benchmark def sleep(sleep_s) time.sleep(sleep_s) # Return any extra metric...
6
5
26
3
18
6
3
0.52
0
11
2
0
5
1
5
5
162
27
89
43
65
46
57
26
49
7
0
3
15
9,352
ray-project/ray
release/nightly_tests/dataset/benchmark.py
dataset.benchmark.BenchmarkMetric
from enum import Enum class BenchmarkMetric(Enum): RUNTIME = 'time' NUM_ROWS = 'num_rows' THROUGHPUT = 'tput' ACCURACY = 'accuracy'
class BenchmarkMetric(Enum): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
49
5
0
5
5
4
0
5
5
4
0
4
0
0
9,353
ray-project/ray
release/nightly_tests/dataset/image_loader_microbenchmark.py
dataset.image_loader_microbenchmark.MdsDatasource
import numpy as np import os import ray import streaming from typing import TYPE_CHECKING, Iterator, Callable, Any from ray.data._internal.delegating_block_builder import DelegatingBlockBuilder class MdsDatasource(ray.data.datasource.FileBasedDatasource): _FILE_EXTENSIONS = ['mds'] def _read_stream(self, f: '...
class MdsDatasource(ray.data.datasource.FileBasedDatasource): def _read_stream(self, f: 'pyarrow.NativeFile', path: str) -> Iterator[ray.data.block.Block]: pass
2
0
33
2
31
0
3
0
1
3
1
0
1
0
1
1
36
3
33
11
29
0
17
9
15
3
1
2
3
9,354
ray-project/ray
release/nightly_tests/dataset/image_loader_microbenchmark.py
dataset.image_loader_microbenchmark.MosaicDataset
from streaming import LocalDataset, StreamingDataset from typing import TYPE_CHECKING, Iterator, Callable, Any class MosaicDataset(LocalDataset): def __init__(self, local: str, transforms: Callable) -> None: super().__init__(local=local) self.transforms = transforms def __getitem__(self, idx:...
class MosaicDataset(LocalDataset): def __init__(self, local: str, transforms: Callable) -> None: pass def __getitem__(self, idx: int) -> Any: pass
3
0
4
0
4
0
1
0
1
4
0
0
2
1
2
2
10
1
9
7
6
0
9
7
6
1
1
0
2
9,355
ray-project/ray
release/nightly_tests/dataset/image_loader_microbenchmark.py
dataset.image_loader_microbenchmark.S3MosaicDataset
from streaming import LocalDataset, StreamingDataset from typing import TYPE_CHECKING, Iterator, Callable, Any class S3MosaicDataset(StreamingDataset): def __init__(self, s3_bucket: str, num_physical_nodes, cache_dir: str, transforms: Callable, cache_limit=None, epoch_size=None) -> None: super().__init__(...
class S3MosaicDataset(StreamingDataset): def __init__(self, s3_bucket: str, num_physical_nodes, cache_dir: str, transforms: Callable, cache_limit=None, epoch_size=None) -> None: pass def __getitem__(self, idx: int) -> Any: pass
3
0
12
0
12
1
1
0.04
1
4
0
0
2
1
2
2
26
1
24
15
13
1
9
7
6
1
1
0
2
9,356
ray-project/ray
release/nightly_tests/dataset/map_benchmark.py
dataset.map_benchmark.IncrementBatch
import ray class IncrementBatch: def __init__(self, model_ref, map_batches_sleep_ms=0): self.model = ray.get(model_ref) self.map_batches_sleep_ms = map_batches_sleep_ms def __call__(self, batch): return increment_batch(batch, self.map_batches_sleep_ms)
class IncrementBatch: def __init__(self, model_ref, map_batches_sleep_ms=0): pass def __call__(self, batch): pass
3
0
2
0
2
0
1
0
0
0
0
0
1
0
1
1
3
0
3
2
1
0
3
2
1
1
0
0
1
9,357
ray-project/ray
release/nightly_tests/dataset/sort_benchmark.py
dataset.sort_benchmark.RandomIntRowDatasource
from ray.data._internal.util import _check_pyarrow_version, GiB from typing import List import numpy as np from ray.data.block import Block, BlockMetadata from ray.data.datasource import Datasource, ReadTask class RandomIntRowDatasource(Datasource): """An example datasource that generates rows with random int64 ke...
class RandomIntRowDatasource(Datasource): '''An example datasource that generates rows with random int64 keys and a row of the given byte size. Examples: >>> source = RandomIntRowDatasource() >>> ray.data.read_datasource(source, n=10, row_size_bytes=2).take() ... {'c_0': 17177672001...
3
1
30
3
27
0
2
0.18
1
5
2
0
1
0
1
1
60
7
45
14
39
8
17
11
13
2
1
1
3
9,358
ray-project/ray
release/nightly_tests/dataset/stable_diffusion_benchmark.py
dataset.stable_diffusion_benchmark.GenerateImage
import numpy as np import torch from typing import Dict from diffusers import StableDiffusionImg2ImgPipeline class GenerateImage: def __init__(self): device = 'cuda' if torch.cuda.is_available() else 'cpu' self.pipeline = StableDiffusionImg2ImgPipeline.from_pretrained('nitrosocke/Ghibli-Diffusion'...
class GenerateImage: def __init__(self): pass def __call__(self, batch: Dict[str, np.ndarray]): pass
3
0
9
0
9
0
2
0
0
1
0
0
2
1
2
2
19
1
18
6
15
0
8
6
5
2
0
0
3
9,359
ray-project/ray
release/nightly_tests/dataset/streaming_split_benchmark.py
dataset.streaming_split_benchmark.ConsumingActor
import ray from typing import Optional @ray.remote class ConsumingActor: def consume(self, split, max_rows_to_read: Optional[int]=None): rows_read = 0 for _ in split.iter_batches(): if max_rows_to_read is not None: if rows_read >= max_rows_to_read: b...
@ray.remote class ConsumingActor: def consume(self, split, max_rows_to_read: Optional[int]=None): pass def get_location(self): pass
4
0
4
0
4
0
3
0
0
1
0
0
2
0
2
2
10
1
9
5
6
0
9
5
6
4
0
3
5
9,360
ray-project/ray
doc/source/serve/doc_code/delayed_import.py
delayed_import.MyDeployment
from ray import serve @serve.deployment class MyDeployment: def __call__(self, model_path): from my_module import my_model self.model = my_model.load(model_path)
@serve.deployment class MyDeployment: def __call__(self, model_path): pass
3
0
4
1
3
0
1
0
0
0
0
0
1
1
1
1
5
1
4
4
1
0
4
4
1
1
0
0
1
9,361
ray-project/ray
doc/source/serve/doc_code/monitoring/deployment_logger.py
deployment_logger.Counter
from ray import serve @serve.deployment class Counter: def __init__(self): self.count = 0 def __call__(self, request): self.count += 1 logger.info(f'count: {self.count}') return {'count': self.count}
@serve.deployment class Counter: def __init__(self): pass def __call__(self, request): pass
4
0
3
0
3
0
1
0
0
0
0
0
2
1
2
2
8
1
7
4
4
0
7
4
4
1
0
0
2
9,362
ray-project/ray
doc/source/serve/doc_code/develop_and_deploy.py
develop_and_deploy.Translator
from transformers import pipeline from ray import serve @serve.deployment(num_replicas=2, ray_actor_options={'num_cpus': 0.2, 'num_gpus': 0}) @serve.ingress(app) class Translator: def __init__(self): self.model = pipeline('translation_en_to_fr', model='t5-small') @app.post('/') def translate(self...
@serve.deployment(num_replicas=2, ray_actor_options={'num_cpus': 0.2, 'num_gpus': 0}) @serve.ingress(app) class Translator: def __init__(self): pass @app.post('/') def translate(self, text: str) -> str: pass
6
0
6
1
3
2
1
0.38
0
1
0
0
2
1
2
2
14
3
8
7
4
3
7
6
4
1
0
0
2
9,363
ray-project/ray
doc/source/serve/doc_code/http_guide/disconnects.py
disconnects.PrintStorage
import ray from typing import List @ray.remote class PrintStorage: def __init__(self): self.print_storage: List[str] = [] def add(self, s: str): self.print_storage.append(s) def clear(self): self.print_storage.clear() def get(self) -> List[str]: return self.print_sto...
@ray.remote class PrintStorage: def __init__(self): pass def add(self, s: str): pass def clear(self): pass def get(self) -> List[str]: pass
6
0
2
0
2
0
1
0
0
1
0
0
4
1
4
4
12
3
9
6
4
0
9
6
4
1
0
0
4
9,364
ray-project/ray
doc/source/serve/doc_code/http_guide/disconnects.py
disconnects.SnoringSleeper
import asyncio from ray import serve import asyncio from ray import serve @serve.deployment class SnoringSleeper: async def snore(self): await asyncio.sleep(1) print('ZZZ') async def __call__(self): try: print('SnoringSleeper received request!') await asyncio.s...
@serve.deployment class SnoringSleeper: async def snore(self): pass async def __call__(self): pass
4
0
6
1
5
1
2
0.1
0
0
0
0
2
0
2
2
14
3
10
3
7
1
10
3
7
2
0
1
3
9,365
ray-project/ray
doc/source/serve/doc_code/distilbert.py
distilbert.APIIngress
from ray import serve from ray.serve.handle import DeploymentHandle @serve.deployment(num_replicas=1) @serve.ingress(app) class APIIngress: def __init__(self, distilbert_model_handle: DeploymentHandle) -> None: self.handle = distilbert_model_handle @app.get('/classify') async def classify(self, s...
@serve.deployment(num_replicas=1) @serve.ingress(app) class APIIngress: def __init__(self, distilbert_model_handle: DeploymentHandle) -> None: pass @app.get('/classify') async def classify(self, sentence: str): pass
6
0
2
0
2
0
1
0
0
2
1
0
2
1
2
2
7
1
6
5
2
0
5
4
2
1
0
0
2
9,366
ray-project/ray
doc/source/serve/doc_code/distilbert.py
distilbert.DistilBertModel
from transformers import pipeline import torch from ray import serve @serve.deployment(ray_actor_options={'num_gpus': 1}, autoscaling_config={'min_replicas': 0, 'max_replicas': 2}) class DistilBertModel: def __init__(self): self.classifier = pipeline('sentiment-analysis', model='distilbert-base-uncased', ...
@serve.deployment(ray_actor_options={'num_gpus': 1}, autoscaling_config={'min_replicas': 0, 'max_replicas': 2}) class DistilBertModel: def __init__(self): pass def classify(self, sentence: str): pass
4
0
5
0
5
1
1
0.1
0
1
0
0
2
1
2
2
12
1
10
4
7
1
5
4
2
1
0
0
2
9,367
ray-project/ray
ci/ray_ci/docker_container.py
docker_container.DockerContainer
from typing import List from ci.ray_ci.linux_container import LinuxContainer from datetime import datetime import os from ci.ray_ci.builder_container import DEFAULT_ARCHITECTURE, DEFAULT_PYTHON_VERSION class DockerContainer(LinuxContainer): """ Container for building and publishing ray docker images """ ...
class DockerContainer(LinuxContainer): ''' Container for building and publishing ray docker images ''' def __init__(self, python_version: str, platform: str, image_type: str, architecture: str=DEFAULT_ARCHITECTURE, canonical_tag: str=None, upload: bool=False) -> None: pass def _get_image_...
7
3
19
2
13
4
4
0.36
1
5
1
2
6
6
6
40
124
20
78
36
63
28
62
28
55
9
6
4
22
9,368
ray-project/ray
ci/ray_ci/docker_container.py
docker_container.RayType
from enum import Enum class RayType(str, Enum): RAY = 'ray' RAY_EXTRA = 'ray-extra' RAY_ML = 'ray-ml' RAY_LLM = 'ray-llm'
class RayType(str, Enum): pass
1
0
0
0
0
0
0
0
2
0
0
0
0
0
0
115
3
0
3
3
2
0
3
3
2
0
4
0
0
9,369
ray-project/ray
ci/ray_ci/automation/docker_tags_lib.py
docker_tags_lib.AuthTokenException
class AuthTokenException(Exception): """ Exception for failing to retrieve auth token. """ def __init__(self, message: str): super().__init__(f'Failed to retrieve auth token from {message}.')
class AuthTokenException(Exception): ''' Exception for failing to retrieve auth token. ''' def __init__(self, message: str): pass
2
1
2
0
2
0
1
1
1
2
0
0
1
0
1
11
7
1
3
2
1
3
3
2
1
1
3
0
1
9,370
ray-project/ray
ci/ray_ci/automation/docker_tags_lib.py
docker_tags_lib.DockerHubRateLimitException
class DockerHubRateLimitException(Exception): """ Exception for Docker Hub rate limit exceeded. """ def __init__(self): super().__init__('429: Rate limit exceeded for Docker Hub.')
class DockerHubRateLimitException(Exception): ''' Exception for Docker Hub rate limit exceeded. ''' def __init__(self): pass
2
1
2
0
2
0
1
1
1
1
0
0
1
0
1
11
7
1
3
2
1
3
3
2
1
1
3
0
1
9,371
ray-project/ray
ci/ray_ci/automation/docker_tags_lib.py
docker_tags_lib.RetrieveImageConfigException
class RetrieveImageConfigException(Exception): """ Exception for failing to retrieve image config. """ def __init__(self, message: str): super().__init__(f'Failed to retrieve {message}')
class RetrieveImageConfigException(Exception): ''' Exception for failing to retrieve image config. ''' def __init__(self, message: str): pass
2
1
2
0
2
0
1
1
1
2
0
0
1
0
1
11
7
1
3
2
1
3
3
2
1
1
3
0
1
9,372
ray-project/ray
release/train_tests/benchmark/image_classification/factory.py
factory.ImageClassificationFactory
from config import BenchmarkConfig, DataloaderType, ImageClassificationConfig from dataloader_factory import BaseDataLoaderFactory from benchmark_factory import BenchmarkFactory import torchvision import torch class ImageClassificationFactory(BenchmarkFactory): def get_dataloader_factory(self) -> BaseDataLoaderFa...
class ImageClassificationFactory(BenchmarkFactory): def get_dataloader_factory(self) -> BaseDataLoaderFactory: pass def get_model(self) -> torch.nn.Module: pass def get_loss_fn(self) -> torch.nn.Module: pass
4
0
4
0
3
0
1
0
1
3
3
0
3
0
3
3
14
3
11
5
7
0
8
5
4
1
1
0
3
9,373
ray-project/ray
release/train_tests/benchmark/image_classification/factory.py
factory.ImageClassificationMockDataLoaderFactory
from typing import Dict, Tuple, Iterator, Generator, Optional, Union from dataloader_factory import BaseDataLoaderFactory import torch class ImageClassificationMockDataLoaderFactory(BaseDataLoaderFactory): """Factory for creating mock dataloaders for testing. Provides mock implementations of training and vali...
class ImageClassificationMockDataLoaderFactory(BaseDataLoaderFactory): '''Factory for creating mock dataloaders for testing. Provides mock implementations of training and validation dataloaders that generate random image and label tensors. ''' def get_train_dataloader(self) -> Generator[Tuple[torc...
3
3
4
0
4
0
1
0
1
0
0
0
2
0
2
27
10
1
9
3
6
0
5
3
2
1
5
0
2
9,374
ray-project/ray
release/train_tests/benchmark/image_classification/factory.py
factory.ImageClassificationRayDataLoaderFactory
from ray_dataloader_factory import RayDataLoaderFactory import ray.train from config import BenchmarkConfig, DataloaderType, ImageClassificationConfig from ray.data.collate_fn import ArrowBatchCollateFn, CollateFn from typing import Dict, Tuple, Iterator, Generator, Optional, Union import ray import ray.data class Ima...
class ImageClassificationRayDataLoaderFactory(RayDataLoaderFactory): '''Factory for creating Ray DataLoader for image classification tasks.''' def __init__(self, benchmark_config: BenchmarkConfig): pass def _get_collate_fn(self) -> Optional[CollateFn]: pass
3
1
12
2
10
0
1
0
1
2
1
0
2
0
2
33
25
5
20
9
14
0
10
7
6
1
6
0
2
9,375
ray-project/ray
doc/source/serve/doc_code/faker.py
faker.Faker
class Faker: """Mock Faker class to test fake_email_creator.py. Meant to mock https://github.com/joke2k/faker package. """ def email(self) -> str: return 'fake@fake.com'
class Faker: '''Mock Faker class to test fake_email_creator.py. Meant to mock https://github.com/joke2k/faker package. ''' def email(self) -> str: pass
2
1
2
0
2
0
1
1
0
1
0
0
1
0
1
1
8
2
3
2
1
3
3
2
1
1
0
0
1
9,376
ray-project/ray
doc/source/serve/doc_code/fastapi_example.py
fastapi_example.FastAPIDeployment
from ray import serve @serve.deployment @serve.ingress(app) class FastAPIDeployment: @app.get('/hello') def say_hello(self, name: str) -> str: return f'Hello {name}!'
@serve.deployment @serve.ingress(app) class FastAPIDeployment: @app.get('/hello') def say_hello(self, name: str) -> str: pass
5
0
2
0
2
0
1
0.25
0
1
0
0
1
0
1
1
5
0
4
3
1
1
3
2
1
1
0
0
1
9,377
ray-project/ray
doc/source/tune/doc_code/fault_tolerance.py
fault_tolerance.LargeModel
class LargeModel: def __init__(self, model_id): self.model_id = model_id
class LargeModel: def __init__(self, model_id): pass
2
0
2
0
2
0
1
0
0
0
0
0
1
1
1
1
3
0
3
3
1
0
3
3
1
1
0
0
1
9,378
ray-project/ray
doc/source/ray-core/doc_code/fault_tolerance_tips.py
fault_tolerance_tips.Actor
import ray @ray.remote class Actor: def read_only(self): import sys import random rand = random.random() if rand < 0.2: return 2 / 0 elif rand < 0.3: sys.exit(1) return 2
@ray.remote class Actor: def read_only(self): pass
3
0
11
2
9
0
3
0
0
0
0
0
1
0
1
1
12
2
10
5
6
0
9
5
5
3
0
1
3
9,379
ray-project/ray
release/release_logs/fetch_release_logs.py
fetch_release_logs.Artifact
from dataclasses import dataclass @dataclass class Artifact: job: Job id: str
@dataclass class Artifact: pass
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
3
0
3
1
2
0
3
1
2
0
0
0
0
9,380
ray-project/ray
release/release_logs/fetch_release_logs.py
fetch_release_logs.Build
from typing import Any, Dict, List, Optional from dataclasses import dataclass @dataclass class Build: id: str number: int commit: str job_dict_list: List[Dict] pipeline: str = BUILDKITE_PIPELINE organization: str = BUILDKITE_ORGANIZATION
@dataclass class Build: pass
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
8
1
7
3
6
0
7
3
6
0
0
0
0
9,381
ray-project/ray
release/release_logs/fetch_release_logs.py
fetch_release_logs.Job
from dataclasses import dataclass from typing import Any, Dict, List, Optional @dataclass class Job: build: Build id: str name: Optional[str]
@dataclass class Job: pass
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
4
0
4
1
3
0
4
1
3
0
0
0
0
9,382
ray-project/ray
ci/ray_ci/pipeline/gap_filling_scheduler.py
gap_filling_scheduler.GapFillingScheduler
from datetime import datetime, timedelta from pybuildkite.buildkite import Buildkite import subprocess from typing import Any, Dict, List, Optional, Tuple class GapFillingScheduler: """ This buildkite pipeline scheduler is responsible for scheduling gap filling builds when the latest build is failing. ...
class GapFillingScheduler: ''' This buildkite pipeline scheduler is responsible for scheduling gap filling builds when the latest build is failing. ''' def __init__(self, buildkite_organization: str, buildkite_pipeline: str, buildkite_access_token: str, repo_checkout: str, days_ago: int=1): ...
9
3
13
1
12
1
2
0.12
0
6
0
0
8
5
8
8
117
13
93
33
75
11
47
24
38
6
0
3
17
9,383
ray-project/ray
doc/source/ray-core/doc_code/get_or_create.py
get_or_create.Greeter
import ray @ray.remote class Greeter: def __init__(self, value): self.value = value def say_hello(self): return self.value
@ray.remote class Greeter: def __init__(self, value): pass def say_hello(self): pass
4
0
2
0
2
0
1
0
0
0
0
0
2
1
2
2
6
1
5
4
2
0
5
4
2
1
0
0
2
9,384
ray-project/ray
doc/source/ray-core/doc_code/getting_started.py
getting_started.Counter
import ray @ray.remote class Counter: def __init__(self): self.i = 0 def get(self): return self.i def incr(self, value): self.i += value
@ray.remote class Counter: def __init__(self): pass def get(self): pass def incr(self, value): pass
5
0
2
0
2
0
1
0
0
0
0
0
3
1
3
3
9
2
7
5
3
0
7
5
3
1
0
0
3
9,385
ray-project/ray
doc/source/serve/doc_code/gradio-integration-parallel.py
gradio-integration-parallel.MyGradioServer
from ray import serve import gradio as gr import asyncio from ray.serve.handle import DeploymentHandle from ray.serve.gradio_integrations import GradioIngress @serve.deployment class MyGradioServer(GradioIngress): def __init__(self, downstream_model_1: DeploymentHandle, downstream_model_2: DeploymentHandle): ...
@serve.deployment class MyGradioServer(GradioIngress): def __init__(self, downstream_model_1: DeploymentHandle, downstream_model_2: DeploymentHandle): pass async def fanout(self, text): pass
4
0
8
1
7
0
1
0
1
2
1
0
2
2
2
8
17
2
15
7
10
0
8
5
5
1
2
0
2
9,386
ray-project/ray
doc/source/serve/doc_code/gradio-integration-parallel.py
gradio-integration-parallel.TextGenerationModel
from ray import serve from transformers import pipeline @serve.deployment class TextGenerationModel: def __init__(self, model_name): self.generator = pipeline('text-generation', model=model_name) def __call__(self, text): generated_list = self.generator(text, do_sample=True, min_length=20, ma...
@serve.deployment class TextGenerationModel: def __init__(self, model_name): pass def __call__(self, text): pass
4
0
4
0
4
0
1
0
0
0
0
0
2
1
2
2
10
1
9
6
6
0
7
6
4
1
0
0
2
9,387
ray-project/ray
doc/source/serve/doc_code/grpc_proxy/grpc_guide.py
grpc_guide.DataPreprocessor
from torchvision import transforms from PIL import Image from ray import serve @serve.deployment class DataPreprocessor: def __init__(self): self.preprocess = transforms.Compose([transforms.Resize(256), transforms.CenterCrop(224), transforms.ToTensor(), transforms.Normalize(mean=[0.485, 0.456, 0.406], std...
@serve.deployment class DataPreprocessor: def __init__(self): pass def __call__(self, image: Image): pass
4
0
7
0
7
1
1
0.07
0
0
0
0
2
1
2
2
16
1
15
5
12
1
6
5
3
1
0
0
2
9,388
ray-project/ray
doc/source/serve/doc_code/grpc_proxy/grpc_guide.py
grpc_guide.GrpcDeployment
from user_defined_protos_pb2 import UserDefinedMessage2 import time from user_defined_protos_pb2 import UserDefinedMessage, UserDefinedMessage2, UserDefinedResponse, UserDefinedResponse2 from ray import serve from user_defined_protos_pb2 import UserDefinedMessage, UserDefinedResponse from typing import Generator from u...
@serve.deployment class GrpcDeployment: def __call__(self, user_message: UserDefinedMessage) -> UserDefinedResponse: pass @serve.multiplexed(max_num_models_per_replica=1) async def get_model(self, model_id: str) -> str: pass async def Multiplexing(self, user_message: UserDefinedMessage...
7
0
8
0
8
0
1
0
0
2
0
0
4
0
4
4
37
4
33
20
23
0
20
15
15
2
0
1
5
9,389
ray-project/ray
doc/source/serve/doc_code/grpc_proxy/grpc_guide.py
grpc_guide.ImageClassifier
from ray.serve.handle import DeploymentHandle from typing import List import requests from user_defined_protos_pb2 import ImageData from ray import serve import torch @serve.deployment class ImageClassifier: def __init__(self, _image_downloader: DeploymentHandle, _data_preprocessor: DeploymentHandle): sel...
@serve.deployment class ImageClassifier: def __init__(self, _image_downloader: DeploymentHandle, _data_preprocessor: DeploymentHandle): pass def _image_labels(self) -> List[str]: pass async def Predict(self, image_data: ImageData) -> ImageClass: pass def process_model_outputs...
6
0
12
1
10
1
2
0.1
0
4
1
0
4
4
4
4
50
6
40
25
31
4
29
21
24
2
0
1
6
9,390
ray-project/ray
doc/source/serve/doc_code/grpc_proxy/grpc_guide.py
grpc_guide.ImageDownloader
from ray import serve from PIL import Image from io import BytesIO import requests @serve.deployment class ImageDownloader: def __call__(self, image_url: str): image_bytes = requests.get(image_url).content return Image.open(BytesIO(image_bytes)).convert('RGB')
@serve.deployment class ImageDownloader: def __call__(self, image_url: str): pass
3
0
3
0
3
0
1
0
0
1
0
0
1
0
1
1
4
0
4
3
2
0
4
3
2
1
0
0
1
9,391
ray-project/ray
rllib/tuned_examples/impala/heavy_cartpole_impala.py
heavy_cartpole_impala.EnlargeObs
import gymnasium as gym import numpy as np class EnlargeObs(gym.ObservationWrapper): def __init__(self, env): super().__init__(env) self.observation_space = gym.spaces.Box(-10.0, 10.0, shape=(1024,), dtype=np.float32) def observation(self, observation): return np.concatenate([observat...
class EnlargeObs(gym.ObservationWrapper): def __init__(self, env): pass def observation(self, observation): pass
3
0
6
0
6
0
1
0
1
1
0
0
2
1
2
2
14
1
13
4
10
0
6
4
3
1
1
0
2
9,392
ray-project/ray
doc/source/serve/doc_code/http_guide/http_guide.py
http_guide.Counter
from ray import serve import starlette.requests @serve.deployment class Counter: def __call__(self, request: starlette.requests.Request): return request.query_params
@serve.deployment class Counter: def __call__(self, request: starlette.requests.Request): pass
3
0
2
0
2
0
1
0
0
0
0
0
1
0
1
1
3
0
3
2
1
0
3
2
1
1
0
0
1
9,393
ray-project/ray
doc/source/serve/doc_code/http_guide/http_guide.py
http_guide.FastAPIWrapper
from ray import serve @serve.deployment @serve.ingress(app) class FastAPIWrapper: pass
@serve.deployment @serve.ingress(app) class FastAPIWrapper: pass
3
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
0
2
1
1
0
2
1
1
0
0
0
0
9,394
ray-project/ray
doc/source/serve/doc_code/http_guide/http_guide.py
http_guide.MyFastAPIDeployment
from ray import serve @serve.deployment @serve.ingress(app) class MyFastAPIDeployment: @app.get('/') def root(self): return 'Hello, world!'
@serve.deployment @serve.ingress(app) class MyFastAPIDeployment: @app.get('/') def root(self): pass
5
0
2
0
2
0
1
0
0
0
0
0
1
0
1
1
4
0
4
3
1
0
3
2
1
1
0
0
1
9,395
ray-project/ray
doc/source/train/doc_code/hvd_trainer.py
hvd_trainer.NeuralNetwork
import torch.nn as nn class NeuralNetwork(nn.Module): def __init__(self): super(NeuralNetwork, self).__init__() self.layer1 = nn.Linear(input_size, layer_size) self.relu = nn.ReLU() self.layer2 = nn.Linear(layer_size, output_size) def forward(self, input): return self....
class NeuralNetwork(nn.Module): def __init__(self): pass def forward(self, input): pass
3
0
4
0
4
0
1
0
1
1
0
0
2
3
2
12
9
1
8
6
5
0
8
6
5
1
1
0
2
9,396
ray-project/ray
doc/source/serve/doc_code/image_classifier_example.py
image_classifier_example.ImageClassifier
from ray import serve import starlette from ray.serve.handle import DeploymentHandle from transformers import pipeline @serve.deployment class ImageClassifier: def __init__(self, downloader: DeploymentHandle): self.downloader = downloader self.model = pipeline('image-classification', model='google...
@serve.deployment class ImageClassifier: def __init__(self, downloader: DeploymentHandle): pass async def classify(self, image_url: str) -> str: pass async def __call__(self, req: starlette.requests.Request): pass
5
0
4
0
4
0
1
0
0
2
1
0
3
2
3
3
15
2
13
8
9
0
11
8
7
1
0
0
3
9,397
ray-project/ray
doc/source/serve/doc_code/image_classifier_example.py
image_classifier_example.ModifiedImageClassifier
from ray.serve.handle import DeploymentHandle from transformers import pipeline from ray import serve import starlette @serve.deployment class ModifiedImageClassifier: def __init__(self, downloader: DeploymentHandle): self.downloader = downloader self.model = pipeline('image-classification', model...
@serve.deployment class ModifiedImageClassifier: def __init__(self, downloader: DeploymentHandle): pass async def classify(self, image_url: str) -> str: pass async def __call__(self, req: starlette.requests.Request): pass
5
0
6
1
5
0
1
0.06
0
2
1
0
3
2
3
3
22
4
17
10
13
1
15
10
11
2
0
1
4
9,398
ray-project/ray
doc/source/serve/doc_code/intel_gaudi_inference_serve.py
intel_gaudi_inference_serve.LlamaModel
from starlette.responses import StreamingResponse import asyncio import torch from ray import serve from starlette.requests import Request from queue import Empty from functools import partial from typing import Dict, Any @serve.deployment(ray_actor_options={'num_cpus': 10, 'resources': {'HPU': 1}}) class LlamaModel: ...
@serve.deployment(ray_actor_options={'num_cpus': 10, 'resources': {'HPU': 1}}) class LlamaModel: def __init__(self, model_id_or_path: str): pass def tokenize(self, prompt: str): '''Tokenize the input and move to HPU.''' pass def generate(self, prompt: str, **config: Dict[str, Any]...
8
5
19
3
12
3
2
0.25
0
8
0
0
6
4
6
6
117
23
75
30
62
19
51
28
40
4
0
3
11
9,399
ray-project/ray
doc/source/serve/doc_code/intel_gaudi_inference_serve_deepspeed.py
intel_gaudi_inference_serve_deepspeed.DeepSpeedInferenceWorker
from typing import Dict, Any import torch import tempfile import ray @ray.remote(resources={'HPU': 1}) class DeepSpeedInferenceWorker: def __init__(self, model_id_or_path: str, world_size: int, local_rank: int): """An actor that runs a DeepSpeed inference engine. Arguments: model_id_o...
@ray.remote(resources={'HPU': 1}) class DeepSpeedInferenceWorker: def __init__(self, model_id_or_path: str, world_size: int, local_rank: int): '''An actor that runs a DeepSpeed inference engine. Arguments: model_id_or_path: Either a Hugging Face model ID or a path to a c...
11
6
15
3
9
3
1
0.37
0
8
2
0
6
7
6
6
121
25
70
35
49
26
51
30
35
2
0
1
10