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,200 | apache/airflow | apache_airflow/providers/teradata/src/airflow/providers/teradata/transfers/teradata_to_teradata.py | teradata.transfers.teradata_to_teradata.TeradataToTeradataOperator | from airflow.providers.teradata.hooks.teradata import TeradataHook
from airflow.providers.teradata.version_compat import BaseOperator
from collections.abc import Sequence
from functools import cached_property
class TeradataToTeradataOperator(BaseOperator):
"""
Moves data from Teradata source database to Terada... |
class TeradataToTeradataOperator(BaseOperator):
'''
Moves data from Teradata source database to Teradata destination database.
.. seealso::
For more information on how to use this operator, take a look at the guide:
:ref:`howto/operator:TeradataToTeradataOperator`
:param dest_teradata_c... | 7 | 1 | 11 | 0 | 11 | 0 | 2 | 0.25 | 1 | 6 | 2 | 0 | 4 | 6 | 4 | 4 | 72 | 7 | 53 | 34 | 36 | 13 | 33 | 21 | 28 | 3 | 1 | 3 | 7 |
9,201 | apache/airflow | apache_airflow/providers/teradata/src/airflow/providers/teradata/triggers/teradata_compute_cluster.py | teradata.triggers.teradata_compute_cluster.TeradataComputeClusterSyncTrigger | from airflow.exceptions import AirflowException
from typing import Any
import asyncio
from airflow.triggers.base import BaseTrigger, TriggerEvent
from airflow.providers.teradata.hooks.teradata import TeradataHook
from airflow.providers.teradata.utils.constants import Constants
from airflow.providers.common.sql.hooks.ha... |
class TeradataComputeClusterSyncTrigger(BaseTrigger):
'''
Fetch the status of the suspend or resume operation for the specified compute cluster.
:param teradata_conn_id: The :ref:`Teradata connection id <howto/connection:teradata>`
reference to a specific Teradata database.
:param compute_prof... | 5 | 4 | 28 | 0 | 27 | 1 | 5 | 0.11 | 1 | 13 | 4 | 0 | 4 | 5 | 4 | 37 | 127 | 5 | 110 | 23 | 98 | 12 | 48 | 15 | 43 | 14 | 5 | 4 | 19 |
9,202 | apache/airflow | apache_airflow/providers/teradata/src/airflow/providers/teradata/utils/constants.py | teradata.utils.constants.Constants | class Constants:
"""Define constants for Teradata Provider."""
CC_CREATE_OPR = 'CREATE'
CC_CREATE_SUSPEND_OPR = 'CREATE_SUSPEND'
CC_DROP_OPR = 'DROP'
CC_SUSPEND_OPR = 'SUSPEND'
CC_RESUME_OPR = 'RESUME'
CC_INITIALIZE_DB_STATUS = 'Initializing'
CC_SUSPEND_DB_STATUS = 'Suspended'
CC_RES... | class Constants:
'''Define constants for Teradata Provider.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.04 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 27 | 1 | 25 | 21 | 24 | 1 | 21 | 21 | 20 | 0 | 0 | 0 | 0 |
9,203 | apache/airflow | apache_airflow/providers/trino/src/airflow/providers/trino/hooks/trino.py | trino.hooks.trino.TrinoException | class TrinoException(Exception):
"""Trino exception.""" | class TrinoException(Exception):
'''Trino exception.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 2 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 3 | 0 | 0 |
9,204 | apache/airflow | apache_airflow/providers/trino/src/airflow/providers/trino/hooks/trino.py | trino.hooks.trino.TrinoHook | from deprecated import deprecated
from airflow.utils.helpers import exactly_one
import json
from trino.transaction import IsolationLevel
from typing import TYPE_CHECKING, Any, TypeVar
from airflow.providers.common.sql.hooks.sql import DbApiHook
import os
from airflow.exceptions import AirflowException, AirflowOptionalP... |
class TrinoHook(DbApiHook):
'''
Interact with Trino through trino package.
>>> ph = TrinoHook()
>>> sql = "SELECT count(1) AS num FROM airflow.static_babynames"
>>> ph.get_records(sql)
[[340698]]
'''
@classmethod
def get_ui_field_behaviour(cls) -> dict[str, Any]:
'''Return c... | 19 | 10 | 16 | 1 | 14 | 2 | 3 | 0.21 | 1 | 15 | 3 | 2 | 10 | 1 | 11 | 72 | 206 | 20 | 158 | 55 | 129 | 33 | 83 | 36 | 69 | 11 | 3 | 3 | 28 |
9,205 | apache/airflow | apache_airflow/providers/trino/src/airflow/providers/trino/transfers/gcs_to_trino.py | trino.transfers.gcs_to_trino.GCSToTrinoOperator | import csv
from airflow.providers.google.cloud.hooks.gcs import GCSHook
from collections.abc import Iterable, Sequence
import json
from tempfile import NamedTemporaryFile
from airflow.providers.trino.version_compat import BaseOperator
from airflow.providers.trino.hooks.trino import TrinoHook
class GCSToTrinoOperator(B... |
class GCSToTrinoOperator(BaseOperator):
'''
Loads a csv file from Google Cloud Storage into a Trino table.
Assumptions:
1. CSV file should not have headers
2. Trino table with requisite columns is already created
3. Optionally, a separate JSON file with headers can be provided
:param source... | 3 | 1 | 26 | 2 | 25 | 0 | 2 | 0.44 | 1 | 8 | 3 | 0 | 2 | 8 | 2 | 2 | 87 | 8 | 55 | 31 | 40 | 24 | 27 | 18 | 24 | 3 | 1 | 2 | 4 |
9,206 | apache/airflow | apache_airflow/scripts/in_container/verify_providers.py | verify_providers.EntityType | from enum import Enum
class EntityType(Enum):
Operators = 'Operators'
Transfers = 'Transfers'
Sensors = 'Sensors'
Hooks = 'Hooks'
Secrets = 'Secrets'
Trigger = 'Trigger'
Notification = 'Notification' |
class EntityType(Enum):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 49 | 8 | 0 | 8 | 8 | 7 | 0 | 8 | 8 | 7 | 0 | 4 | 0 | 0 |
9,207 | apache/airflow | apache_airflow/scripts/in_container/verify_providers.py | verify_providers.EntityTypeSummary | from typing import NamedTuple
class EntityTypeSummary(NamedTuple):
entities: list[str]
new_entities_table: str
wrong_entities: list[tuple[type, str]] |
class EntityTypeSummary(NamedTuple):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 4 | 1 | 3 | 0 | 4 | 1 | 3 | 0 | 1 | 0 | 0 |
9,208 | apache/airflow | apache_airflow/scripts/in_container/verify_providers.py | verify_providers.VerifiedEntities | from typing import NamedTuple
class VerifiedEntities(NamedTuple):
all_entities: set[str]
wrong_entities: list[tuple[type, str]] |
class VerifiedEntities(NamedTuple):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 1 | 2 | 0 | 3 | 1 | 2 | 0 | 1 | 0 | 0 |
9,209 | apache/airflow | apache_airflow/providers/vertica/src/airflow/providers/vertica/hooks/vertica.py | vertica.hooks.vertica.VerticaHook | from vertica_python import connect
from airflow.providers.common.sql.hooks.sql import DbApiHook
from collections.abc import Callable, Iterable, Mapping
from typing import Any, overload
from airflow.providers.common.sql.hooks.handlers import fetch_all_handler
class VerticaHook(DbApiHook):
"""
Interact with Vert... |
class VerticaHook(DbApiHook):
'''
Interact with Vertica.
This hook use a customized version of default fetch_all_handler named vertica_fetch_all_handler.
'''
def get_conn(self) -> connect:
'''Return vertica connection object.'''
pass
@overload
def run(self, sql: str | I... | 7 | 3 | 26 | 2 | 22 | 2 | 5 | 0.11 | 1 | 8 | 0 | 2 | 4 | 0 | 4 | 65 | 121 | 15 | 97 | 45 | 67 | 11 | 47 | 19 | 41 | 15 | 3 | 3 | 19 |
9,210 | apache/airflow | apache_airflow/providers/weaviate/src/airflow/providers/weaviate/hooks/weaviate.py | weaviate.hooks.weaviate.WeaviateHook | from tenacity import Retrying, retry, retry_if_exception, retry_if_exception_type, stop_after_attempt
from airflow.providers.weaviate.version_compat import BaseHook
import contextlib
from weaviate.auth import Auth
from collections.abc import Mapping, Sequence
from functools import cached_property
import weaviate.except... |
class WeaviateHook(BaseHook):
'''
Interact with Weaviate database to store vectors. This hook uses the 'conn_id'.
:param conn_id: The connection id to use when connecting to Weaviate. <howto/connection:weaviate>
'''
def __init__(self, conn_id: str=default_conn_name, *args: Any, **kwargs: Any) -> N... | 40 | 30 | 25 | 2 | 17 | 6 | 3 | 0.34 | 1 | 17 | 1 | 0 | 27 | 1 | 31 | 43 | 824 | 97 | 543 | 217 | 412 | 184 | 275 | 117 | 237 | 20 | 2 | 5 | 91 |
9,211 | apache/airflow | apache_airflow/providers/weaviate/src/airflow/providers/weaviate/operators/weaviate.py | weaviate.operators.weaviate.WeaviateDocumentIngestOperator | from collections.abc import Sequence
from airflow.providers.weaviate.hooks.weaviate import WeaviateHook
from airflow.providers.weaviate.version_compat import BaseOperator
from typing import TYPE_CHECKING, Any
from functools import cached_property
class WeaviateDocumentIngestOperator(BaseOperator):
"""
Create o... |
class WeaviateDocumentIngestOperator(BaseOperator):
'''
Create or replace objects belonging to documents.
In real-world scenarios, information sources like Airflow docs, Stack Overflow, or other issues
are considered 'documents' here. It's crucial to keep the database objects in sync with these sources... | 5 | 3 | 15 | 0 | 13 | 2 | 1 | 0.74 | 1 | 9 | 2 | 0 | 3 | 10 | 3 | 3 | 83 | 10 | 42 | 30 | 24 | 31 | 20 | 16 | 16 | 1 | 1 | 0 | 3 |
9,212 | apache/airflow | apache_airflow/providers/weaviate/src/airflow/providers/weaviate/operators/weaviate.py | weaviate.operators.weaviate.WeaviateIngestOperator | from collections.abc import Sequence
from functools import cached_property
from typing import TYPE_CHECKING, Any
from airflow.providers.weaviate.version_compat import BaseOperator
from airflow.providers.weaviate.hooks.weaviate import WeaviateHook
class WeaviateIngestOperator(BaseOperator):
"""
Operator that st... |
class WeaviateIngestOperator(BaseOperator):
'''
Operator that store vector in the Weaviate class.
.. seealso::
For more information on how to use this operator, take a look at the guide:
:ref:`howto/operator:WeaviateIngestOperator`
Operator that accepts input json or pandas dataframe to... | 5 | 2 | 11 | 0 | 10 | 0 | 1 | 0.47 | 1 | 8 | 2 | 0 | 3 | 7 | 3 | 3 | 58 | 8 | 34 | 23 | 19 | 16 | 18 | 12 | 14 | 2 | 1 | 1 | 4 |
9,213 | apache/airflow | apache_airflow/providers/microsoft/winrm/src/airflow/providers/microsoft/winrm/hooks/winrm.py | winrm.hooks.winrm.WinRMHook | from airflow.utils.platform import getuser
from contextlib import suppress
from airflow.exceptions import AirflowException
from airflow.providers.microsoft.winrm.version_compat import BaseHook
from winrm.exceptions import WinRMOperationTimeoutError
from base64 import b64encode
from winrm.protocol import Protocol
class... | null | 5 | 2 | 72 | 6 | 61 | 6 | 12 | 0.31 | 1 | 10 | 1 | 0 | 3 | 22 | 3 | 15 | 258 | 24 | 183 | 69 | 151 | 56 | 115 | 37 | 111 | 28 | 2 | 4 | 36 |
9,214 | apache/airflow | apache_airflow/providers/microsoft/winrm/src/airflow/providers/microsoft/winrm/operators/winrm.py | winrm.operators.winrm.WinRMOperator | from base64 import b64encode
from airflow.exceptions import AirflowException
from collections.abc import Sequence
from airflow.configuration import conf
from airflow.providers.microsoft.winrm.version_compat import BaseOperator
from airflow.providers.microsoft.winrm.hooks.winrm import WinRMHook
class WinRMOperator(Base... |
class WinRMOperator(BaseOperator):
'''
WinRMOperator to execute commands on given remote host using the winrm_hook.
:param winrm_hook: predefined ssh_hook to use for remote execution
:param ssh_conn_id: connection id from airflow Connections
:param remote_host: remote host to connect
:param com... | 3 | 1 | 31 | 4 | 26 | 1 | 5 | 0.26 | 1 | 7 | 2 | 0 | 2 | 8 | 2 | 2 | 80 | 12 | 54 | 30 | 39 | 14 | 36 | 18 | 33 | 9 | 1 | 2 | 10 |
9,215 | apache/airflow | apache_airflow/providers/yandex/src/airflow/providers/yandex/hooks/dataproc.py | yandex.hooks.dataproc.DataprocHook | from airflow.providers.yandex.hooks.yandex import YandexCloudBaseHook
from deprecated import deprecated
from airflow.exceptions import AirflowProviderDeprecationWarning
class DataprocHook(YandexCloudBaseHook):
"""
A base hook for Yandex.Cloud Data Proc.
:param yandex_conn_id: The connection ID to use when... |
class DataprocHook(YandexCloudBaseHook):
'''
A base hook for Yandex.Cloud Data Proc.
:param yandex_conn_id: The connection ID to use when fetching connection info.
'''
def __init__(self, *args, **kwargs) -> None:
pass
@property
@deprecated(reason='`client` deprecated and will be re... | 7 | 1 | 4 | 0 | 4 | 0 | 1 | 0.22 | 1 | 1 | 0 | 0 | 3 | 3 | 3 | 20 | 26 | 4 | 18 | 9 | 8 | 4 | 9 | 6 | 5 | 1 | 3 | 0 | 3 |
9,216 | apache/airflow | apache_airflow/providers/yandex/src/airflow/providers/yandex/hooks/yandex.py | yandex.hooks.yandex.YandexCloudBaseHook | from airflow.providers.yandex.version_compat import BaseHook
from airflow.providers.yandex.utils.fields import get_field_from_extras
from airflow.providers.yandex.utils.defaults import conn_name_attr, conn_type, default_conn_name, hook_name
import yandexcloud
from typing import Any
from airflow.providers.yandex.utils.c... |
class YandexCloudBaseHook(BaseHook):
'''
A base hook for Yandex.Cloud related tasks.
:param yandex_conn_id: The connection ID to use when fetching connection info
:param default_folder_id: The folder ID to use instead of connection folder ID
:param default_public_ssh_key: The key to use instead of ... | 8 | 3 | 18 | 0 | 18 | 0 | 1 | 0.09 | 1 | 5 | 1 | 2 | 3 | 9 | 5 | 17 | 113 | 9 | 95 | 33 | 78 | 9 | 34 | 25 | 25 | 2 | 2 | 1 | 7 |
9,217 | apache/airflow | apache_airflow/providers/yandex/src/airflow/providers/yandex/hooks/yq.py | yandex.hooks.yq.YQHook | from airflow.providers.yandex.utils.user_agent import provider_user_agent
from airflow.providers.yandex.hooks.yandex import YandexCloudBaseHook
import yandexcloud.auth as yc_auth
from typing import Any
from datetime import timedelta
from yandex_query_client import YQHttpClient, YQHttpClientConfig
class YQHook(YandexCl... |
class YQHook(YandexCloudBaseHook):
'''A hook for Yandex Query.'''
def __init__(self, *args, **kwargs) -> None:
pass
def close(self):
'''Release all resources.'''
pass
def create_query(self, query_text: str | None, name: str | None=None) -> str:
'''
Create and ... | 10 | 8 | 7 | 1 | 3 | 3 | 1 | 0.9 | 1 | 4 | 0 | 0 | 9 | 2 | 9 | 26 | 78 | 19 | 31 | 14 | 21 | 28 | 24 | 13 | 14 | 2 | 3 | 1 | 10 |
9,218 | apache/airflow | apache_airflow/providers/yandex/src/airflow/providers/yandex/links/yq.py | yandex.links.yq.YQLink | from airflow.providers.yandex.version_compat import BaseOperatorLink, XCom
class YQLink(BaseOperatorLink):
"""Web link to query in Yandex Query UI."""
name = 'Yandex Query'
def get_link(self, operator: BaseOperator, *, ti_key: TaskInstanceKey):
return XCom.get_value(key=XCOM_WEBLINK_KEY, ti_key=ti... |
class YQLink(BaseOperatorLink):
'''Web link to query in Yandex Query UI.'''
def get_link(self, operator: BaseOperator, *, ti_key: TaskInstanceKey):
pass
@staticmethod
def persist(context: Context, web_link: str) -> None:
pass | 4 | 1 | 2 | 0 | 2 | 0 | 1 | 0.14 | 1 | 3 | 2 | 0 | 1 | 0 | 2 | 2 | 11 | 3 | 7 | 5 | 3 | 1 | 6 | 4 | 3 | 1 | 1 | 0 | 2 |
9,219 | apache/airflow | apache_airflow/providers/yandex/src/airflow/providers/yandex/operators/dataproc.py | yandex.operators.dataproc.DataprocBaseOperator | from airflow.providers.yandex.version_compat import BaseOperator
from airflow.providers.yandex.hooks.dataproc import DataprocHook
from collections.abc import Iterable, Sequence
class DataprocBaseOperator(BaseOperator):
"""
Base class for DataProc operators working with given cluster.
:param connection_id:... |
class DataprocBaseOperator(BaseOperator):
'''
Base class for DataProc operators working with given cluster.
:param connection_id: ID of the Yandex.Cloud Airflow connection.
:param cluster_id: ID of the cluster to remove. (templated)
'''
def __init__(self, *, yandex_conn_id: str | None=None, cl... | 4 | 1 | 3 | 0 | 3 | 0 | 1 | 0.42 | 1 | 5 | 2 | 5 | 3 | 2 | 3 | 3 | 22 | 5 | 12 | 7 | 8 | 5 | 12 | 7 | 8 | 2 | 1 | 1 | 4 |
9,220 | apache/airflow | apache_airflow/providers/yandex/src/airflow/providers/yandex/operators/dataproc.py | yandex.operators.dataproc.DataprocCreateClusterOperator | from airflow.providers.yandex.version_compat import BaseOperator
from collections.abc import Iterable, Sequence
import yandexcloud
from airflow.providers.yandex.hooks.dataproc import DataprocHook
class DataprocCreateClusterOperator(BaseOperator):
"""
Creates Yandex.Cloud Data Proc cluster.
:param folder_i... |
class DataprocCreateClusterOperator(BaseOperator):
'''
Creates Yandex.Cloud Data Proc cluster.
:param folder_id: ID of the folder in which cluster should be created.
:param cluster_name: Cluster name. Must be unique inside the folder.
:param cluster_description: Cluster description.
:param clus... | 5 | 1 | 48 | 1 | 46 | 0 | 2 | 0.44 | 1 | 9 | 3 | 0 | 3 | 37 | 3 | 3 | 211 | 8 | 141 | 84 | 96 | 62 | 53 | 43 | 49 | 3 | 1 | 1 | 6 |
9,221 | apache/airflow | apache_airflow/providers/yandex/src/airflow/providers/yandex/operators/dataproc.py | yandex.operators.dataproc.DataprocCreateHiveJobOperator | class DataprocCreateHiveJobOperator(DataprocBaseOperator):
"""
Runs Hive job in Data Proc cluster.
:param query: Hive query.
:param query_file_uri: URI of the script that contains Hive queries. Can be placed in HDFS or S3.
:param properties: A mapping of property names to values, used to configure ... | class DataprocCreateHiveJobOperator(DataprocBaseOperator):
'''
Runs Hive job in Data Proc cluster.
:param query: Hive query.
:param query_file_uri: URI of the script that contains Hive queries. Can be placed in HDFS or S3.
:param properties: A mapping of property names to values, used to configure H... | 3 | 1 | 16 | 0 | 16 | 0 | 1 | 0.38 | 1 | 5 | 1 | 0 | 2 | 6 | 2 | 5 | 47 | 3 | 32 | 22 | 17 | 12 | 12 | 10 | 9 | 1 | 2 | 0 | 2 |
9,222 | apache/airflow | apache_airflow/providers/yandex/src/airflow/providers/yandex/operators/dataproc.py | yandex.operators.dataproc.DataprocCreateMapReduceJobOperator | from collections.abc import Iterable, Sequence
class DataprocCreateMapReduceJobOperator(DataprocBaseOperator):
"""
Runs Mapreduce job in Data Proc cluster.
:param main_jar_file_uri: URI of jar file with job.
Can be placed in HDFS or S3. Can be specified instead of main_class.... |
class DataprocCreateMapReduceJobOperator(DataprocBaseOperator):
'''
Runs Mapreduce job in Data Proc cluster.
:param main_jar_file_uri: URI of jar file with job.
Can be placed in HDFS or S3. Can be specified instead of main_class.
:param main_class: Name of the main class o... | 3 | 1 | 19 | 0 | 19 | 0 | 1 | 0.39 | 1 | 5 | 1 | 0 | 2 | 8 | 2 | 5 | 56 | 3 | 38 | 26 | 21 | 15 | 14 | 12 | 11 | 1 | 2 | 0 | 2 |
9,223 | apache/airflow | apache_airflow/providers/yandex/src/airflow/providers/yandex/operators/dataproc.py | yandex.operators.dataproc.DataprocCreatePysparkJobOperator | from collections.abc import Iterable, Sequence
class DataprocCreatePysparkJobOperator(DataprocBaseOperator):
"""
Runs Pyspark job in Data Proc cluster.
:param main_python_file_uri: URI of python file with job. Can be placed in HDFS or S3.
:param python_file_uris: URIs of python files used in the job. ... |
class DataprocCreatePysparkJobOperator(DataprocBaseOperator):
'''
Runs Pyspark job in Data Proc cluster.
:param main_python_file_uri: URI of python file with job. Can be placed in HDFS or S3.
:param python_file_uris: URIs of python files used in the job. Can be placed in HDFS or S3.
:param file_uri... | 3 | 1 | 23 | 0 | 23 | 0 | 1 | 0.4 | 1 | 5 | 1 | 0 | 2 | 11 | 2 | 5 | 69 | 3 | 47 | 32 | 27 | 19 | 17 | 15 | 14 | 1 | 2 | 0 | 2 |
9,224 | apache/airflow | apache_airflow/providers/yandex/src/airflow/providers/yandex/operators/dataproc.py | yandex.operators.dataproc.DataprocCreateSparkJobOperator | from collections.abc import Iterable, Sequence
class DataprocCreateSparkJobOperator(DataprocBaseOperator):
"""
Runs Spark job in Data Proc cluster.
:param main_jar_file_uri: URI of jar file with job. Can be placed in HDFS or S3.
:param main_class: Name of the main class of the job.
:param file_uri... |
class DataprocCreateSparkJobOperator(DataprocBaseOperator):
'''
Runs Spark job in Data Proc cluster.
:param main_jar_file_uri: URI of jar file with job. Can be placed in HDFS or S3.
:param main_class: Name of the main class of the job.
:param file_uris: URIs of files used in the job. Can be placed ... | 3 | 1 | 23 | 0 | 23 | 0 | 1 | 0.4 | 1 | 5 | 1 | 0 | 2 | 11 | 2 | 5 | 69 | 3 | 47 | 32 | 27 | 19 | 17 | 15 | 14 | 1 | 2 | 0 | 2 |
9,225 | apache/airflow | apache_airflow/providers/yandex/src/airflow/providers/yandex/operators/dataproc.py | yandex.operators.dataproc.DataprocDeleteClusterOperator | class DataprocDeleteClusterOperator(DataprocBaseOperator):
"""
Deletes Yandex.Cloud Data Proc cluster.
:param connection_id: ID of the Yandex.Cloud Airflow connection.
:param cluster_id: ID of the cluster to remove. (templated)
"""
def __init__(self, *, connection_id: str | None=None, cluster_... | class DataprocDeleteClusterOperator(DataprocBaseOperator):
'''
Deletes Yandex.Cloud Data Proc cluster.
:param connection_id: ID of the Yandex.Cloud Airflow connection.
:param cluster_id: ID of the cluster to remove. (templated)
'''
def __init__(self, *, connection_id: str | None=None, cluster_i... | 3 | 1 | 3 | 0 | 3 | 0 | 1 | 0.83 | 1 | 3 | 1 | 0 | 2 | 0 | 2 | 5 | 14 | 3 | 6 | 4 | 3 | 5 | 6 | 4 | 3 | 1 | 2 | 0 | 2 |
9,226 | apache/airflow | apache_airflow/providers/yandex/src/airflow/providers/yandex/operators/dataproc.py | yandex.operators.dataproc.InitializationAction | from collections.abc import Iterable, Sequence
from dataclasses import dataclass
@dataclass
class InitializationAction:
"""Data for initialization action to be run at start of DataProc cluster."""
uri: str
args: Iterable[str]
timeout: int | @dataclass
class InitializationAction:
'''Data for initialization action to be run at start of DataProc cluster.'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | 1 | 4 | 1 | 3 | 4 | 4 | 1 | 3 | 0 | 0 | 0 | 0 |
9,227 | apache/airflow | apache_airflow/providers/yandex/src/airflow/providers/yandex/operators/yq.py | yandex.operators.yq.YQExecuteQueryOperator | from airflow.providers.yandex.hooks.yq import YQHook
from airflow.providers.yandex.links.yq import YQLink
from typing import TYPE_CHECKING, Any
from functools import cached_property
from airflow.providers.yandex.version_compat import BaseOperator
from collections.abc import Sequence
class YQExecuteQueryOperator(BaseOp... |
class YQExecuteQueryOperator(BaseOperator):
'''
Executes sql code using Yandex Query service.
:param sql: the SQL code to be executed as a single string
:param name: name of the query in YandexQuery
:param folder_id: cloud folder id where to create query
:param yandex_conn_id: Airflow connectio... | 6 | 2 | 11 | 1 | 9 | 1 | 1 | 0.25 | 1 | 6 | 3 | 0 | 4 | 7 | 4 | 4 | 63 | 9 | 44 | 30 | 28 | 11 | 28 | 19 | 23 | 2 | 1 | 1 | 5 |
9,228 | apache/airflow | apache_airflow/providers/yandex/src/airflow/providers/yandex/secrets/lockbox.py | yandex.secrets.lockbox.LockboxSecretBackend | import yandex.cloud.lockbox.v1.payload_service_pb2 as payload_service_pb
from airflow.utils.log.logging_mixin import LoggingMixin
from typing import Any
import yandex.cloud.lockbox.v1.secret_service_pb2_grpc as secret_service_pb_grpc
import yandex.cloud.lockbox.v1.payload_service_pb2_grpc as payload_service_pb_grpc
fro... |
class LockboxSecretBackend(BaseSecretsBackend, LoggingMixin):
'''
Retrieves connections or variables or configs from Yandex Lockbox.
Configurable via ``airflow.cfg`` like so:
.. code-block:: ini
[secrets]
backend = airflow.providers.yandex.secrets.lockbox.LockboxSecretBackend
ba... | 16 | 5 | 12 | 2 | 9 | 2 | 2 | 0.67 | 2 | 6 | 0 | 0 | 13 | 10 | 13 | 45 | 250 | 48 | 121 | 53 | 93 | 81 | 89 | 39 | 75 | 6 | 5 | 2 | 32 |
9,229 | apache/airflow | apache_airflow/providers/yandex/src/airflow/providers/yandex/utils/credentials.py | yandex.utils.credentials.CredentialsType | from typing import TypedDict
class CredentialsType(TypedDict, total=False):
"""Credentials dict description."""
token: str
service_account_key: dict[str, str] |
class CredentialsType(TypedDict, total=False):
'''Credentials dict description.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.33 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 1 | 3 | 1 | 2 | 1 | 3 | 1 | 2 | 0 | 1 | 0 | 0 |
9,230 | apache/airflow | apache_airflow/providers/ydb/src/airflow/providers/ydb/hooks/ydb.py | ydb.hooks.ydb.YDBConnection | import ydb
from ydb_dbapi import Connection as DbApiConnection
from typing import TYPE_CHECKING, Any
from collections.abc import Mapping, Sequence
class YDBConnection:
"""YDB connection wrapper."""
def __init__(self, database: str, ydb_session_pool: Any, is_ddl: bool):
self.is_ddl = is_ddl
sel... |
class YDBConnection:
'''YDB connection wrapper.'''
def __init__(self, database: str, ydb_session_pool: Any, is_ddl: bool):
pass
def cursor(self) -> YDBCursor:
pass
def begin(self) -> None:
pass
def commit(self) -> None:
pass
def rollback(self) -> None:
... | 10 | 1 | 2 | 0 | 2 | 0 | 1 | 0.04 | 0 | 5 | 1 | 0 | 9 | 2 | 9 | 9 | 33 | 9 | 23 | 12 | 13 | 1 | 20 | 12 | 10 | 1 | 0 | 0 | 9 |
9,231 | apache/airflow | apache_airflow/providers/ydb/src/airflow/providers/ydb/hooks/ydb.py | ydb.hooks.ydb.YDBCursor | from collections.abc import Mapping, Sequence
from airflow.exceptions import AirflowException
from typing import TYPE_CHECKING, Any
class YDBCursor:
"""YDB cursor wrapper."""
def __init__(self, delegatee: DbApiCursor, is_ddl: bool):
self.delegatee: DbApiCursor = delegatee
self.is_ddl: bool = i... |
class YDBCursor:
'''YDB cursor wrapper.'''
def __init__(self, delegatee: DbApiCursor, is_ddl: bool):
pass
def execute(self, sql: str, parameters: Mapping[str, Any] | None=None):
pass
def executemany(self, sql: str, seq_of_parameters: Sequence[Mapping[str, Any]]):
pass
de... | 18 | 1 | 3 | 0 | 2 | 0 | 1 | 0.03 | 0 | 6 | 1 | 0 | 15 | 2 | 15 | 15 | 57 | 17 | 39 | 21 | 21 | 1 | 37 | 19 | 21 | 3 | 0 | 1 | 18 |
9,232 | apache/airflow | apache_airflow/providers/ydb/src/airflow/providers/ydb/hooks/ydb.py | ydb.hooks.ydb.YDBHook | from sqlalchemy.engine import URL
from airflow.providers.common.sql.hooks.sql import DbApiHook
from collections.abc import Mapping, Sequence
from typing import TYPE_CHECKING, Any
from airflow.providers.ydb.utils.defaults import CONN_NAME_ATTR, CONN_TYPE, DEFAULT_CONN_NAME
from ydb_dbapi import Connection as DbApiConnec... |
class YDBHook(DbApiHook):
'''Interact with YDB.'''
def __init__(self, *args, is_ddl: bool=False, **kwargs) -> None:
pass
@classmethod
def get_connection_form_widgets(cls) -> dict[str, Any]:
'''Return connection widgets to add to YDB connection form.'''
pass
@classmethod
... | 14 | 5 | 14 | 1 | 12 | 1 | 1 | 0.09 | 1 | 10 | 1 | 0 | 4 | 3 | 8 | 69 | 136 | 16 | 110 | 36 | 93 | 10 | 44 | 31 | 32 | 3 | 3 | 1 | 10 |
9,233 | apache/airflow | apache_airflow/providers/ydb/src/airflow/providers/ydb/operators/ydb.py | ydb.operators.ydb.YDBExecuteQueryOperator | from airflow.exceptions import AirflowException
from collections.abc import Iterable, Mapping
from airflow.providers.common.sql.operators.sql import SQLExecuteQueryOperator
class YDBExecuteQueryOperator(SQLExecuteQueryOperator):
"""
Executes sql code in a specific YDB database.
:param sql: the SQL code to... |
class YDBExecuteQueryOperator(SQLExecuteQueryOperator):
'''
Executes sql code in a specific YDB database.
:param sql: the SQL code to be executed as a single string, or
a list of str (sql statements), or a reference to a template file.
Template references are recognized by str ending in '.s... | 2 | 1 | 16 | 2 | 14 | 0 | 3 | 0.63 | 1 | 7 | 1 | 0 | 1 | 0 | 1 | 13 | 30 | 5 | 16 | 11 | 7 | 10 | 9 | 4 | 7 | 3 | 3 | 1 | 3 |
9,234 | apache/airflow | apache_airflow/providers/zendesk/src/airflow/providers/zendesk/hooks/zendesk.py | zendesk.hooks.zendesk.ZendeskHook | from typing import TYPE_CHECKING, Any
from airflow.providers.zendesk.version_compat import BaseHook
from zenpy import Zenpy
class ZendeskHook(BaseHook):
"""
Interact with Zendesk. This hook uses the Zendesk conn_id.
:param zendesk_conn_id: The Airflow connection used for Zendesk credentials.
"""
c... |
class ZendeskHook(BaseHook):
'''
Interact with Zendesk. This hook uses the Zendesk conn_id.
:param zendesk_conn_id: The Airflow connection used for Zendesk credentials.
'''
@classmethod
def get_ui_field_behaviour(cls) -> dict[str, Any]:
pass
def __init__(self, zendesk_conn_id: str=... | 11 | 8 | 9 | 1 | 4 | 4 | 1 | 1 | 1 | 7 | 0 | 0 | 8 | 5 | 9 | 21 | 100 | 18 | 41 | 26 | 30 | 41 | 37 | 25 | 27 | 2 | 2 | 1 | 10 |
9,235 | ray-project/ray | python/ray/llm/_internal/batch/processor/base.py | _internal.batch.processor.base.Processor | from ray.data import Dataset
from collections import OrderedDict
from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
from ray.llm._internal.batch.stages import StatefulStage, wrap_postprocess, wrap_preprocess
import ray
from ray.util.annotations import DeveloperAPI, PublicAPI
from ray.data.block ... | @PublicAPI(stability='alpha')
class Processor:
'''A processor is composed of a preprocess stage, followed by one or more
processing stages, and finally a postprocess stage. We use processor as a
paradigm for processing data using LLMs.
Args:
config: The processor config.
preprocess: An o... | 8 | 6 | 18 | 2 | 9 | 6 | 3 | 0.88 | 0 | 7 | 2 | 0 | 5 | 4 | 5 | 5 | 111 | 19 | 49 | 22 | 37 | 43 | 34 | 16 | 28 | 4 | 0 | 1 | 13 |
9,236 | ray-project/ray | python/ray/llm/_internal/batch/processor/base.py | _internal.batch.processor.base.ProcessorBuilder | from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
from ray.util.annotations import DeveloperAPI, PublicAPI
@DeveloperAPI
class ProcessorBuilder:
"""Build a processor based on the configuration."""
_registry: Dict[str, Callable] = {}
@classmethod
def register(cls, config_type: ... | @DeveloperAPI
class ProcessorBuilder:
'''Build a processor based on the configuration.'''
@classmethod
def register(cls, config_type: Type[ProcessorConfig], builder: Callable) -> None:
'''A decorator to associate a particular pipeline config
with its build function.
'''
pass
... | 6 | 3 | 17 | 1 | 11 | 5 | 3 | 0.42 | 0 | 4 | 2 | 0 | 0 | 0 | 2 | 2 | 42 | 5 | 26 | 15 | 16 | 11 | 16 | 8 | 13 | 4 | 0 | 2 | 6 |
9,237 | ray-project/ray | python/ray/llm/_internal/batch/processor/base.py | _internal.batch.processor.base.ProcessorConfig | from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union
from pydantic import Field, field_validator
from ray.llm._internal.common.base_pydantic import BaseModelExtended
class ProcessorConfig(BaseModelExtended):
"""The processor configuration."""
batch_size: int = Field(default=32, descriptio... |
class ProcessorConfig(BaseModelExtended):
'''The processor configuration.'''
@field_validator('concurrency')
def validate_concurrency(cls, concurrency: Union[int, Tuple[int, int]]) -> Union[int, Tuple[int, int]]:
'''Validate that `concurrency` is either:
- a positive int, or
- a 2-t... | 6 | 3 | 0 | 0 | 0 | 0 | 0 | 0.05 | 1 | 0 | 0 | 3 | 0 | 0 | 0 | 83 | 23 | 2 | 20 | 7 | 18 | 1 | 7 | 7 | 5 | 0 | 5 | 0 | 0 |
9,238 | ray-project/ray | python/ray/llm/_internal/batch/processor/http_request_proc.py | _internal.batch.processor.http_request_proc.HttpRequestProcessorConfig | from typing import Any, Dict, Optional
from ray.llm._internal.batch.processor.base import Processor, ProcessorBuilder, ProcessorConfig
from pydantic import Field
class HttpRequestProcessorConfig(ProcessorConfig):
"""The configuration for the HTTP request processor."""
batch_size: int = Field(default=64, descri... |
class HttpRequestProcessorConfig(ProcessorConfig):
'''The configuration for the HTTP request processor.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.05 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 83 | 21 | 1 | 19 | 5 | 18 | 1 | 5 | 5 | 4 | 0 | 6 | 0 | 0 |
9,239 | ray-project/ray | python/ray/llm/_internal/batch/stages/base.py | _internal.batch.stages.base.StatefulStage | from pydantic import BaseModel, Field
from typing import Any, AsyncIterator, Callable, Dict, List, Optional, Type
class StatefulStage(BaseModel):
"""
A basic building block to compose a Processor.
"""
fn: Type[StatefulStageUDF] = Field(description='The well-optimized stateful UDF for this stage.')
... |
class StatefulStage(BaseModel):
'''
A basic building block to compose a Processor.
'''
def get_required_input_keys(self) -> Dict[str, str]:
'''The required input keys of the stage and their descriptions.'''
pass
def get_optional_input_keys(self) -> Dict[str, str]:
'''The o... | 5 | 4 | 34 | 4 | 22 | 8 | 3 | 0.31 | 1 | 4 | 0 | 7 | 1 | 0 | 1 | 84 | 53 | 7 | 35 | 14 | 28 | 11 | 18 | 10 | 15 | 3 | 5 | 1 | 3 |
9,240 | ray-project/ray | python/ray/llm/_internal/batch/stages/base.py | _internal.batch.stages.base.StatefulStageUDF | from typing import Any, AsyncIterator, Callable, Dict, List, Optional, Type
import pyarrow
class StatefulStageUDF:
"""A stage UDF wrapper that processes the input and output columns
before and after the UDF.
Args:
data_column: The internal data column name of the processor. The
... |
class StatefulStageUDF:
'''A stage UDF wrapper that processes the input and output columns
before and after the UDF.
Args:
data_column: The internal data column name of the processor. The
__call__ method takes the data column as the input of the UDF
method,... | 5 | 3 | 29 | 3 | 11 | 15 | 3 | 1.41 | 0 | 7 | 0 | 8 | 5 | 1 | 5 | 5 | 166 | 24 | 59 | 18 | 52 | 83 | 44 | 17 | 38 | 9 | 0 | 2 | 17 |
9,241 | ray-project/ray | python/ray/llm/_internal/batch/stages/chat_template_stage.py | _internal.batch.stages.chat_template_stage.ChatTemplateStage | from ray.llm._internal.batch.stages.base import StatefulStage, StatefulStageUDF
from typing import TYPE_CHECKING, Any, AsyncIterator, Dict, List, Optional, Type, Union
class ChatTemplateStage(StatefulStage):
"""
A stage that applies chat template.
"""
fn: Type[StatefulStageUDF] = ChatTemplateUDF
d... |
class ChatTemplateStage(StatefulStage):
'''
A stage that applies chat template.
'''
def get_required_input_keys(self) -> Dict[str, str]:
'''The required input keys of the stage and their descriptions.'''
pass | 2 | 2 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 84 | 10 | 1 | 6 | 3 | 5 | 3 | 4 | 3 | 3 | 0 | 6 | 0 | 0 |
9,242 | ray-project/ray | python/ray/llm/_internal/batch/stages/chat_template_stage.py | _internal.batch.stages.chat_template_stage.ChatTemplateUDF | from typing import TYPE_CHECKING, Any, AsyncIterator, Dict, List, Optional, Type, Union
from ray.llm._internal.batch.stages.base import StatefulStage, StatefulStageUDF
from ray.llm._internal.common.utils.download_utils import NodeModelDownloadable, download_model_files
class ChatTemplateUDF(StatefulStageUDF):
def... |
class ChatTemplateUDF(StatefulStageUDF):
def __init__(self, data_column: str, expected_input_keys: List[str], model: str, chat_template: Optional[str]=None, chat_template_kwargs: Optional[Dict[str, Any]]=None):
'''
Initialize the ChatTemplateUDF.
Args:
data_column: The data col... | 4 | 3 | 14 | 2 | 7 | 5 | 1 | 0.58 | 1 | 5 | 0 | 0 | 3 | 1 | 3 | 8 | 45 | 7 | 24 | 13 | 14 | 14 | 12 | 8 | 7 | 2 | 1 | 1 | 4 |
9,243 | ray-project/ray | python/ray/llm/_internal/batch/stages/http_request_stage.py | _internal.batch.stages.http_request_stage.HttpRequestStage | from ray.llm._internal.batch.stages.base import StatefulStage, StatefulStageUDF
from typing import Any, AsyncIterator, Callable, Dict, List, Optional, Type
class HttpRequestStage(StatefulStage):
"""
A stage that sends HTTP requests.
"""
fn: Type[StatefulStageUDF] = HttpRequestUDF
def get_required_... |
class HttpRequestStage(StatefulStage):
'''
A stage that sends HTTP requests.
'''
def get_required_input_keys(self) -> Dict[str, str]:
'''The required input keys of the stage and their descriptions.'''
pass | 2 | 2 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 84 | 10 | 1 | 6 | 3 | 5 | 3 | 4 | 3 | 3 | 0 | 6 | 0 | 0 |
9,244 | ray-project/ray | python/ray/llm/_internal/batch/stages/http_request_stage.py | _internal.batch.stages.http_request_stage.HttpRequestUDF | import time
import aiohttp
from aiohttp.client_exceptions import ClientPayloadError
import aiohttp.web_exceptions
import asyncio
from ray.llm._internal.batch.stages.base import StatefulStage, StatefulStageUDF
from typing import Any, AsyncIterator, Callable, Dict, List, Optional, Type
import numpy as np
import traceback... |
class HttpRequestUDF(StatefulStageUDF):
def __init__(self, data_column: str, expected_input_keys: List[str], url: str, additional_header: Optional[Dict[str, Any]]=None, qps: Optional[int]=None, max_retries: int=0, base_retry_wait_time_in_s: float=1.0, session_factory: Optional[Callable[[], aiohttp.ClientSession]]... | 3 | 2 | 39 | 4 | 26 | 10 | 5 | 0.38 | 1 | 6 | 0 | 0 | 2 | 4 | 2 | 7 | 80 | 8 | 52 | 27 | 43 | 20 | 32 | 18 | 29 | 8 | 1 | 4 | 9 |
9,245 | ray-project/ray | python/ray/llm/_internal/batch/stages/prepare_image_stage.py | _internal.batch.stages.prepare_image_stage.HTTPConnection | from urllib.parse import urlparse
from pathlib import Path
import aiohttp
from typing import TYPE_CHECKING, Any, AsyncIterator, Dict, List, Mapping, MutableMapping, Optional, Union
import requests
class HTTPConnection:
"""Adapted from vllm.connections.HTTPConnection.
Helper class to send HTTP requests.
"""... |
class HTTPConnection:
'''Adapted from vllm.connections.HTTPConnection.
Helper class to send HTTP requests.
'''
def __init__(self, *, reuse_client: bool=True) -> None:
pass
def get_sync_client(self) -> requests.Session:
pass
async def get_async_client(self) -> aiohttp.Clie... | 16 | 1 | 9 | 1 | 8 | 0 | 1 | 0.04 | 0 | 10 | 0 | 0 | 15 | 3 | 15 | 15 | 154 | 34 | 115 | 76 | 57 | 5 | 68 | 24 | 52 | 2 | 0 | 3 | 20 |
9,246 | ray-project/ray | python/ray/llm/_internal/batch/stages/prepare_image_stage.py | _internal.batch.stages.prepare_image_stage.ImageProcessor | import importlib
from typing import TYPE_CHECKING, Any, AsyncIterator, Dict, List, Mapping, MutableMapping, Optional, Union
import base64
from io import BytesIO
import asyncio
class ImageProcessor:
"""Download and load images."""
def __init__(self):
self.Image = importlib.import_module('PIL.Image')
... |
class ImageProcessor:
'''Download and load images.'''
def __init__(self):
pass
async def download_image_from_url(self, image_url: str) -> Optional[bytes]:
'''Download the image from the Internet with up to 3 retries.
Args:
image_url: The image URL to download.
... | 8 | 5 | 16 | 2 | 9 | 4 | 3 | 0.52 | 0 | 7 | 1 | 0 | 5 | 2 | 5 | 5 | 111 | 20 | 60 | 20 | 50 | 31 | 45 | 18 | 37 | 7 | 0 | 2 | 18 |
9,247 | ray-project/ray | python/ray/llm/_internal/batch/stages/prepare_image_stage.py | _internal.batch.stages.prepare_image_stage.PrepareImageStage | from typing import TYPE_CHECKING, Any, AsyncIterator, Dict, List, Mapping, MutableMapping, Optional, Union
from ray.llm._internal.batch.stages.base import StatefulStage, StatefulStageUDF
class PrepareImageStage(StatefulStage):
"""A stage to prepare images from OpenAI chat template messages."""
fn: StatefulStag... |
class PrepareImageStage(StatefulStage):
'''A stage to prepare images from OpenAI chat template messages.'''
def get_required_input_keys(self) -> Dict[str, str]:
'''The required input keys of the stage and their descriptions.'''
pass | 2 | 2 | 0 | 0 | 0 | 0 | 0 | 0.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 84 | 8 | 1 | 6 | 3 | 5 | 1 | 4 | 3 | 3 | 0 | 6 | 0 | 0 |
9,248 | ray-project/ray | python/ray/llm/_internal/batch/stages/prepare_image_stage.py | _internal.batch.stages.prepare_image_stage.PrepareImageUDF | from typing import TYPE_CHECKING, Any, AsyncIterator, Dict, List, Mapping, MutableMapping, Optional, Union
import importlib
from ray.llm._internal.batch.stages.base import StatefulStage, StatefulStageUDF
class PrepareImageUDF(StatefulStageUDF):
def __init__(self, data_column: str, expected_input_keys: List[str]):... |
class PrepareImageUDF(StatefulStageUDF):
def __init__(self, data_column: str, expected_input_keys: List[str]):
pass
def extract_image_info(self, messages: List[Dict]) -> List[_ImageType]:
'''Extract vision information such as image and video from chat messages.
Args:
messa... | 4 | 1 | 15 | 1 | 11 | 3 | 3 | 0.26 | 1 | 7 | 1 | 0 | 4 | 2 | 4 | 9 | 66 | 8 | 46 | 22 | 40 | 12 | 36 | 21 | 31 | 6 | 1 | 3 | 11 |
9,249 | ray-project/ray | python/ray/llm/_internal/batch/stages/tokenize_stage.py | _internal.batch.stages.tokenize_stage.DetokenizeStage | from ray.llm._internal.batch.stages.base import StatefulStage, StatefulStageUDF
from typing import Any, AsyncIterator, Dict, List, Type
class DetokenizeStage(StatefulStage):
"""
A stage that detokenizes the input.
"""
fn: Type[StatefulStageUDF] = DetokenizeUDF
def get_required_input_keys(self) -> ... |
class DetokenizeStage(StatefulStage):
'''
A stage that detokenizes the input.
'''
def get_required_input_keys(self) -> Dict[str, str]:
'''The required input keys of the stage and their descriptions.'''
pass | 2 | 2 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 84 | 10 | 1 | 6 | 3 | 5 | 3 | 4 | 3 | 3 | 0 | 6 | 0 | 0 |
9,250 | ray-project/ray | python/ray/llm/_internal/batch/stages/tokenize_stage.py | _internal.batch.stages.tokenize_stage.DetokenizeUDF | from typing import Any, AsyncIterator, Dict, List, Type
from ray.llm._internal.batch.utils import get_cached_tokenizer
from ray.llm._internal.batch.stages.base import StatefulStage, StatefulStageUDF
from ray.llm._internal.common.utils.download_utils import NodeModelDownloadable, download_model_files
class DetokenizeUD... |
class DetokenizeUDF(StatefulStageUDF):
def __init__(self, data_column: str, expected_input_keys: List[str], model: str):
'''
Initialize the DetokenizeUDF.
Args:
data_column: The data column name.
expected_input_keys: The expected input keys of the stage.
... | 3 | 2 | 13 | 1 | 7 | 5 | 1 | 0.58 | 1 | 5 | 0 | 0 | 3 | 1 | 3 | 8 | 44 | 6 | 24 | 12 | 14 | 14 | 10 | 7 | 5 | 2 | 1 | 1 | 4 |
9,251 | ray-project/ray | python/ray/llm/_internal/batch/stages/tokenize_stage.py | _internal.batch.stages.tokenize_stage.TokenizeStage | from typing import Any, AsyncIterator, Dict, List, Type
from ray.llm._internal.batch.stages.base import StatefulStage, StatefulStageUDF
class TokenizeStage(StatefulStage):
"""
A stage that tokenizes the input.
"""
fn: Type[StatefulStageUDF] = TokenizeUDF
def get_required_input_keys(self) -> Dict[s... |
class TokenizeStage(StatefulStage):
'''
A stage that tokenizes the input.
'''
def get_required_input_keys(self) -> Dict[str, str]:
'''The required input keys of the stage and their descriptions.'''
pass | 2 | 2 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 84 | 10 | 1 | 6 | 3 | 5 | 3 | 4 | 3 | 3 | 0 | 6 | 0 | 0 |
9,252 | ray-project/ray | python/ray/llm/_internal/batch/stages/tokenize_stage.py | _internal.batch.stages.tokenize_stage.TokenizeUDF | from typing import Any, AsyncIterator, Dict, List, Type
from ray.llm._internal.batch.stages.base import StatefulStage, StatefulStageUDF
from ray.llm._internal.common.utils.download_utils import NodeModelDownloadable, download_model_files
from ray.llm._internal.batch.utils import get_cached_tokenizer
class TokenizeUDF(... |
class TokenizeUDF(StatefulStageUDF):
def __init__(self, data_column: str, expected_input_keys: List[str], model: str):
'''
Initialize the TokenizeUDF.
Args:
data_column: The data column name.
expected_input_keys: The expected input keys of the stage.
mod... | 3 | 2 | 12 | 1 | 6 | 5 | 1 | 0.67 | 1 | 5 | 0 | 0 | 3 | 1 | 3 | 8 | 41 | 6 | 21 | 12 | 11 | 14 | 10 | 7 | 5 | 2 | 1 | 1 | 4 |
9,253 | ray-project/ray | doc/source/ray-core/doc_code/actor-http-server.py | actor-http-server.Counter | import asyncio
from aiohttp import web
import ray
@ray.remote
class Counter:
async def __init__(self):
self.counter = 0
asyncio.get_running_loop().create_task(self.run_http_server())
async def run_http_server(self):
app = web.Application()
app.add_routes([web.get('/', self.get... | @ray.remote
class Counter:
async def __init__(self):
pass
async def run_http_server(self):
pass
async def get(self, request):
pass
async def increment(self):
pass | 6 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 4 | 1 | 4 | 4 | 18 | 3 | 15 | 9 | 10 | 0 | 15 | 9 | 10 | 1 | 0 | 0 | 4 |
9,254 | ray-project/ray | doc/source/ray-core/doc_code/actor-pool.py | actor-pool.Actor | import ray
@ray.remote
class Actor:
def double(self, n):
return n * 2 | @ray.remote
class Actor:
def double(self, n):
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,255 | ray-project/ray | doc/source/ray-core/doc_code/actor-repr.py | actor-repr.MyActor | import ray
@ray.remote
class MyActor:
def __init__(self, index):
self.index = index
def foo(self):
print('hello there')
def __repr__(self):
return f'MyActor(index={self.index})' | @ray.remote
class MyActor:
def __init__(self, index):
pass
def foo(self):
pass
def __repr__(self):
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,256 | ray-project/ray | doc/source/ray-core/doc_code/actor-sync.py | actor-sync.SignalActor | import asyncio
import ray
@ray.remote(num_cpus=0)
class SignalActor:
def __init__(self):
self.ready_event = asyncio.Event()
def send(self, clear=False):
self.ready_event.set()
if clear:
self.ready_event.clear()
async def wait(self, should_wait=True):
if should... | @ray.remote(num_cpus=0)
class SignalActor:
def __init__(self):
pass
def send(self, clear=False):
pass
async def wait(self, should_wait=True):
pass | 5 | 0 | 3 | 0 | 3 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 12 | 2 | 10 | 5 | 6 | 0 | 10 | 5 | 6 | 2 | 0 | 1 | 5 |
9,257 | ray-project/ray | doc/source/ray-core/doc_code/actor_checkpointing.py | actor_checkpointing.Controller | import ray
class Controller:
def __init__(self):
self.worker = Worker.remote()
self.worker_state = ray.get(self.worker.checkpoint.remote())
def execute_task_with_fault_tolerance(self):
i = 0
while True:
i = i + 1
try:
ray.get(self.worker... |
class Controller:
def __init__(self):
pass
def execute_task_with_fault_tolerance(self):
pass | 3 | 0 | 9 | 0 | 8 | 1 | 2 | 0.13 | 0 | 1 | 1 | 0 | 2 | 2 | 2 | 2 | 19 | 1 | 16 | 6 | 13 | 2 | 16 | 6 | 13 | 3 | 0 | 2 | 4 |
9,258 | ray-project/ray | doc/source/ray-core/doc_code/actor_checkpointing.py | actor_checkpointing.ImmortalActor | import ray
import json
import sys
import os
@ray.remote(max_restarts=-1, max_task_retries=-1)
class ImmortalActor:
def __init__(self, checkpoint_file):
self.checkpoint_file = checkpoint_file
if os.path.exists(self.checkpoint_file):
with open(self.checkpoint_file, 'r') as f:
... | @ray.remote(max_restarts=-1, max_task_retries=-1)
class ImmortalActor:
def __init__(self, checkpoint_file):
pass
def update(self, key, value):
pass
def get(self, key):
pass | 5 | 0 | 7 | 1 | 5 | 1 | 2 | 0.12 | 0 | 0 | 0 | 0 | 3 | 2 | 3 | 3 | 25 | 6 | 17 | 9 | 12 | 2 | 16 | 7 | 11 | 2 | 0 | 2 | 5 |
9,259 | ray-project/ray | doc/source/ray-core/doc_code/actor_checkpointing.py | actor_checkpointing.Worker | import sys
import ray
@ray.remote(num_cpus=1)
class Worker:
def __init__(self):
self.state = {'num_tasks_executed': 0}
def execute_task(self, crash=False):
if crash:
sys.exit(1)
self.state['num_tasks_executed'] = self.state['num_tasks_executed'] + 1
def checkpoint(sel... | @ray.remote(num_cpus=1)
class Worker:
def __init__(self):
pass
def execute_task(self, crash=False):
pass
def checkpoint(self):
pass
def restore(self, state):
pass | 6 | 0 | 4 | 1 | 3 | 1 | 1 | 0.27 | 0 | 0 | 0 | 0 | 4 | 1 | 4 | 4 | 19 | 5 | 11 | 6 | 6 | 3 | 11 | 6 | 6 | 2 | 0 | 1 | 5 |
9,260 | ray-project/ray | doc/source/ray-core/doc_code/actor_creator_failure.py | actor_creator_failure.Actor | import ray
@ray.remote(max_restarts=-1)
class Actor:
def ping(self):
return 'hello' | @ray.remote(max_restarts=-1)
class Actor:
def ping(self):
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,261 | ray-project/ray | doc/source/ray-core/doc_code/actor_creator_failure.py | actor_creator_failure.Parent | import os
import ray
@ray.remote
class Parent:
def generate_actors(self):
self.child = Actor.remote()
self.detached_actor = Actor.options(name='actor', lifetime='detached').remote()
return (self.child, self.detached_actor, os.getpid()) | @ray.remote
class Parent:
def generate_actors(self):
pass | 3 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 2 | 1 | 1 | 5 | 0 | 5 | 4 | 3 | 0 | 5 | 4 | 3 | 1 | 0 | 0 | 1 |
9,262 | ray-project/ray | release/long_running_tests/workloads/actor_deaths.py | actor_deaths.Child | import numpy as np
import ray
import sys
@ray.remote
class Child(object):
def __init__(self, death_probability):
self.death_probability = death_probability
def ping(self):
exit_chance = np.random.rand()
if exit_chance > self.death_probability:
sys.exit(-1) | @ray.remote
class Child(object):
def __init__(self, death_probability):
pass
def ping(self):
pass | 4 | 0 | 4 | 0 | 3 | 1 | 2 | 0.14 | 1 | 0 | 0 | 0 | 2 | 1 | 2 | 2 | 9 | 1 | 7 | 5 | 4 | 1 | 7 | 5 | 4 | 2 | 1 | 1 | 3 |
9,263 | ray-project/ray | release/long_running_tests/workloads/actor_deaths.py | actor_deaths.Parent | import ray
import time
@ray.remote
class Parent(object):
def __init__(self, num_children, death_probability):
self.death_probability = death_probability
self.children = [Child.remote(death_probability) for _ in range(num_children)]
def ping(self, num_pings):
children_outputs = []
... | @ray.remote
class Parent(object):
def __init__(self, num_children, death_probability):
pass
def ping(self, num_pings):
pass
def kill(self):
pass | 5 | 0 | 7 | 0 | 6 | 1 | 2 | 0.21 | 1 | 3 | 1 | 0 | 3 | 2 | 3 | 3 | 25 | 2 | 19 | 9 | 15 | 4 | 19 | 8 | 15 | 3 | 1 | 1 | 6 |
9,264 | ray-project/ray | doc/source/ray-core/doc_code/actor_restart.py | actor_restart.Actor | import os
import ray
@ray.remote(max_restarts=4, max_task_retries=-1)
class Actor:
def __init__(self):
self.counter = 0
def increment_and_possibly_fail(self):
if self.counter == 10:
os._exit(0)
self.counter += 1
return self.counter | @ray.remote(max_restarts=4, max_task_retries=-1)
class Actor:
def __init__(self):
pass
def increment_and_possibly_fail(self):
pass | 4 | 0 | 4 | 0 | 4 | 1 | 2 | 0.13 | 0 | 0 | 0 | 0 | 2 | 1 | 2 | 2 | 10 | 1 | 8 | 4 | 5 | 1 | 8 | 4 | 5 | 2 | 0 | 1 | 3 |
9,265 | ray-project/ray | doc/source/ray-core/doc_code/actors.py | actors.Actor | import ray
import asyncio
@ray.remote
class Actor:
async def f(self):
try:
await asyncio.sleep(5)
except asyncio.CancelledError:
print('Actor task canceled.') | @ray.remote
class Actor:
async def f(self):
pass | 3 | 0 | 5 | 0 | 5 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 6 | 0 | 6 | 2 | 4 | 0 | 6 | 2 | 4 | 2 | 0 | 1 | 2 |
9,266 | ray-project/ray | doc/source/ray-core/doc_code/actors.py | actors.FooActor | import ray
@ray.remote
class FooActor:
@ray.method(enable_task_events=False)
def foo(self):
pass | @ray.remote
class FooActor:
@ray.method(enable_task_events=False)
def foo(self):
pass | 4 | 0 | 2 | 0 | 2 | 0 | 1 | 0.25 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 6 | 1 | 4 | 3 | 1 | 1 | 3 | 2 | 1 | 1 | 0 | 0 | 1 |
9,267 | ray-project/ray | doc/source/rllib/doc_code/advanced_api.py | advanced_api.Counter | import ray
@ray.remote
class Counter:
def __init__(self):
self.count = 0
def inc(self, n):
self.count += n
def get(self):
return self.count | @ray.remote
class Counter:
def __init__(self):
pass
def inc(self, n):
pass
def get(self):
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,268 | ray-project/ray | doc/source/ray-core/doc_code/anti_pattern_global_variables.py | anti_pattern_global_variables.Actor | import ray
@ray.remote
class Actor:
def f(self):
return global_var + 3 | @ray.remote
class Actor:
def f(self):
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,269 | ray-project/ray | doc/source/ray-core/doc_code/anti_pattern_global_variables.py | anti_pattern_global_variables.GlobalVarActor | import ray
@ray.remote
class GlobalVarActor:
def __init__(self):
self.global_var = 3
def set_global_var(self, var):
self.global_var = var
def get_global_var(self):
return self.global_var | @ray.remote
class GlobalVarActor:
def __init__(self):
pass
def set_global_var(self, var):
pass
def get_global_var(self):
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,270 | ray-project/ray | doc/source/ray-core/doc_code/anti_pattern_return_ray_put.py | anti_pattern_return_ray_put.Actor | import ray
import numpy as np
@ray.remote
class Actor:
def task_with_single_return_value_bad(self):
single_return_value = np.zeros(9 * 1024 * 1024)
return ray.put(single_return_value)
def task_with_single_return_value_good(self):
return np.zeros(9 * 1024 * 1024) | @ray.remote
class Actor:
def task_with_single_return_value_bad(self):
pass
def task_with_single_return_value_good(self):
pass | 4 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 7 | 1 | 6 | 4 | 3 | 0 | 6 | 4 | 3 | 1 | 0 | 0 | 2 |
9,271 | ray-project/ray | ci/ray_ci/anyscale_docker_container.py | anyscale_docker_container.AnyscaleDockerContainer | from ray_release.configs.global_config import get_global_config
from ci.ray_ci.docker_container import DockerContainer
from ci.ray_ci.container import _DOCKER_ECR_REPO, _DOCKER_GCP_REGISTRY
class AnyscaleDockerContainer(DockerContainer):
"""
Container for building and publishing anyscale docker images
"""
... |
class AnyscaleDockerContainer(DockerContainer):
'''
Container for building and publishing anyscale docker images
'''
def run(self) -> None:
'''
Build and publish anyscale docker images
'''
pass
def _should_upload(self) -> bool:
pass | 3 | 2 | 13 | 1 | 10 | 2 | 2 | 0.32 | 1 | 2 | 0 | 0 | 3 | 0 | 3 | 43 | 47 | 6 | 31 | 16 | 27 | 10 | 21 | 16 | 17 | 3 | 7 | 2 | 6 |
9,272 | ray-project/ray | ci/ray_ci/doc/api.py | api.API | import importlib
from typing import Dict, List, Optional, Set, Tuple
from dataclasses import dataclass
import inspect
import re
@dataclass
class API:
name: str
annotation_type: AnnotationType
code_type: CodeType
@staticmethod
def from_autosummary(doc: str, current_module: Optional[str]=None) -> Li... | @dataclass
class API:
@staticmethod
def from_autosummary(doc: str, current_module: Optional[str]=None) -> List['API']:
'''
Parse API from the following autosummary sphinx block.
.. autosummary::
:option_01
:option_02
api_01
api_02
... | 12 | 7 | 19 | 2 | 12 | 6 | 4 | 0.47 | 0 | 4 | 2 | 0 | 4 | 0 | 7 | 7 | 150 | 21 | 88 | 30 | 73 | 41 | 63 | 23 | 55 | 10 | 0 | 2 | 25 |
9,273 | ray-project/ray | ci/ray_ci/doc/api.py | api.CodeType | from enum import Enum
class CodeType(Enum):
CLASS = 'Class'
FUNCTION = 'Function' |
class CodeType(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,274 | ray-project/ray | doc/source/templates/03_serving_stable_diffusion/app.py | app.APIIngress | from ray import serve
from io import BytesIO
from fastapi.responses import Response
@serve.deployment(num_replicas=1)
@serve.ingress(app)
class APIIngress:
def __init__(self, diffusion_model_handle) -> None:
self.handle = diffusion_model_handle
@app.get('/imagine', responses={200: {'content': {'image... | @serve.deployment(num_replicas=1)
@serve.ingress(app)
class APIIngress:
def __init__(self, diffusion_model_handle) -> None:
pass
@app.get('/imagine', responses={200: {'content': {'image/png': {}}}}, response_class=Response)
async def generate(self, prompt: str, img_size: int=512):
pass | 6 | 0 | 5 | 1 | 4 | 0 | 1 | 0 | 0 | 2 | 0 | 0 | 2 | 1 | 2 | 2 | 16 | 2 | 14 | 11 | 6 | 0 | 9 | 6 | 6 | 1 | 0 | 0 | 2 |
9,275 | ray-project/ray | doc/source/templates/03_serving_stable_diffusion/app.py | app.StableDiffusionV2 | from diffusers import EulerDiscreteScheduler, StableDiffusionPipeline
import torch
from ray import serve
@serve.deployment(ray_actor_options={'num_gpus': 1, 'num_cpus': 1}, max_ongoing_requests=2, autoscaling_config={'min_replicas': 1, 'max_replicas': 3, 'target_ongoing_requests': 1})
class StableDiffusionV2:
def... | @serve.deployment(ray_actor_options={'num_gpus': 1, 'num_cpus': 1}, max_ongoing_requests=2, autoscaling_config={'min_replicas': 1, 'max_replicas': 3, 'target_ongoing_requests': 1})
class StableDiffusionV2:
def __init__(self):
pass
def generate(self, prompt: str, img_size: int=512):
pass | 4 | 0 | 8 | 1 | 7 | 0 | 1 | 0 | 0 | 2 | 0 | 0 | 2 | 1 | 2 | 2 | 17 | 2 | 15 | 7 | 12 | 0 | 11 | 7 | 8 | 1 | 0 | 0 | 2 |
9,276 | ray-project/ray | doc/source/serve/doc_code/app_builder.py | app_builder.ComposedArgs | from pydantic import BaseModel
class ComposedArgs(BaseModel):
model1_uri: str
model2_uri: str |
class ComposedArgs(BaseModel):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 83 | 3 | 0 | 3 | 1 | 2 | 0 | 3 | 1 | 2 | 0 | 5 | 0 | 0 |
9,277 | ray-project/ray | doc/source/serve/doc_code/app_builder.py | app_builder.HelloWorld | from ray import serve
@serve.deployment
class HelloWorld:
def __init__(self, message: str):
self._message = message
print('Message:', self._message)
def __call__(self, request):
return self._message | @serve.deployment
class HelloWorld:
def __init__(self, message: str):
pass
def __call__(self, request):
pass | 4 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 | 1 | 2 | 2 | 7 | 1 | 6 | 4 | 3 | 0 | 6 | 4 | 3 | 1 | 0 | 0 | 2 |
9,278 | ray-project/ray | doc/source/serve/doc_code/app_builder.py | app_builder.HelloWorldArgs | from pydantic import BaseModel
class HelloWorldArgs(BaseModel):
message: str |
class HelloWorldArgs(BaseModel):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 83 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 5 | 0 | 0 |
9,279 | ray-project/ray | doc/source/ray-observability/doc_code/app_logging.py | app_logging.Actor | import ray
@ray.remote
class Actor:
def ready(self):
print('actor') | @ray.remote
class Actor:
def ready(self):
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,280 | ray-project/ray | ci/ray_ci/doc/autodoc.py | autodoc.Autodoc | import re
import os
from ci.ray_ci.doc.api import _SPHINX_AUTOCLASS_HEADER, _SPHINX_AUTOSUMMARY_HEADER, API
from typing import List, Set
class Autodoc:
"""
Autodoc class represents the top level sphinx autodoc landing page and finds
autodoc APIs that would be generated from sphinx from all sub-pages.
"... |
class Autodoc:
'''
Autodoc class represents the top level sphinx autodoc landing page and finds
autodoc APIs that would be generated from sphinx from all sub-pages.
'''
def __init__(self, head_rst_file: str):
'''
Args:
head_rst_file: The path to the landing page RST fil... | 7 | 5 | 23 | 4 | 13 | 6 | 5 | 0.51 | 0 | 3 | 1 | 0 | 6 | 3 | 6 | 6 | 149 | 27 | 81 | 24 | 74 | 41 | 77 | 22 | 70 | 8 | 0 | 5 | 27 |
9,281 | ray-project/ray | doc/source/serve/doc_code/autoscale_model_comp_example.py | autoscale_model_comp_example.Driver | from ray import serve
from ray.serve.handle import DeploymentHandle
@serve.deployment
class Driver:
def __init__(self, a_handle, b_handle):
self.a_handle: DeploymentHandle = a_handle
self.b_handle: DeploymentHandle = b_handle
async def __call__(self) -> str:
a_future = self.a_handle.r... | @serve.deployment
class Driver:
def __init__(self, a_handle, b_handle):
pass
async def __call__(self) -> str:
pass | 4 | 0 | 4 | 1 | 4 | 0 | 1 | 0 | 0 | 2 | 1 | 0 | 2 | 2 | 2 | 2 | 10 | 2 | 8 | 7 | 5 | 0 | 8 | 7 | 5 | 1 | 0 | 0 | 2 |
9,282 | ray-project/ray | doc/source/serve/doc_code/autoscale_model_comp_example.py | autoscale_model_comp_example.HeavyLoad | import time
from ray import serve
@serve.deployment
class HeavyLoad:
async def __call__(self) -> str:
start = time.time()
while time.time() - start < 0.2:
pass
return 'heavy' | @serve.deployment
class HeavyLoad:
async def __call__(self) -> str:
pass | 3 | 0 | 6 | 1 | 5 | 0 | 2 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 7 | 1 | 6 | 3 | 4 | 0 | 6 | 3 | 4 | 2 | 0 | 1 | 2 |
9,283 | ray-project/ray | doc/source/serve/doc_code/autoscale_model_comp_example.py | autoscale_model_comp_example.LightLoad | import time
from ray import serve
@serve.deployment
class LightLoad:
async def __call__(self) -> str:
start = time.time()
while time.time() - start < 0.1:
pass
return 'light' | @serve.deployment
class LightLoad:
async def __call__(self) -> str:
pass | 3 | 0 | 6 | 1 | 5 | 0 | 2 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 7 | 1 | 6 | 3 | 4 | 0 | 6 | 3 | 4 | 2 | 0 | 1 | 2 |
9,284 | ray-project/ray | doc/source/serve/doc_code/aws_neuron_core_inference_serve.py | aws_neuron_core_inference_serve.APIIngress | from ray import serve
from ray.serve.handle import DeploymentHandle
@serve.deployment(num_replicas=1)
@serve.ingress(app)
class APIIngress:
def __init__(self, bert_base_model_handle: DeploymentHandle) -> None:
self.handle = bert_base_model_handle
@app.get('/infer')
async def infer(self, sentence:... | @serve.deployment(num_replicas=1)
@serve.ingress(app)
class APIIngress:
def __init__(self, bert_base_model_handle: DeploymentHandle) -> None:
pass
@app.get('/infer')
async def infer(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,285 | ray-project/ray | doc/source/serve/doc_code/aws_neuron_core_inference_serve.py | aws_neuron_core_inference_serve.BertBaseModel | from ray import serve
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch
import torch
@serve.deployment(ray_actor_options={'resources': {'neuron_cores': 1}}, autoscaling_config={'min_replicas': 1, 'max_replicas': 2})
class BertBaseModel:
def __init__(self):
import torc... | @serve.deployment(ray_actor_options={'resources': {'neuron_cores': 1}}, autoscaling_config={'min_replicas': 1, 'max_replicas': 2})
class BertBaseModel:
def __init__(self):
pass
def infer(self, sentence: str):
pass | 4 | 0 | 13 | 1 | 13 | 1 | 1 | 0.04 | 0 | 2 | 0 | 0 | 2 | 3 | 2 | 2 | 28 | 2 | 26 | 11 | 21 | 1 | 12 | 11 | 7 | 1 | 0 | 0 | 2 |
9,286 | ray-project/ray | doc/source/serve/doc_code/aws_neuron_core_inference_serve_stable_diffusion.py | aws_neuron_core_inference_serve_stable_diffusion.APIIngress | from fastapi.responses import Response
from io import BytesIO
from ray import serve
@serve.deployment(num_replicas=1, route_prefix='/')
@serve.ingress(app)
class APIIngress:
def __init__(self, diffusion_model_handle) -> None:
self.handle = diffusion_model_handle
@app.get('/imagine', responses={200: {... | @serve.deployment(num_replicas=1, route_prefix='/')
@serve.ingress(app)
class APIIngress:
def __init__(self, diffusion_model_handle) -> None:
pass
@app.get('/imagine', responses={200: {'content': {'image/png': {}}}}, response_class=Response)
async def generate(self, prompt: str):
pass | 6 | 0 | 5 | 1 | 4 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 | 1 | 2 | 2 | 16 | 2 | 14 | 12 | 6 | 0 | 9 | 7 | 6 | 1 | 0 | 0 | 2 |
9,287 | ray-project/ray | doc/source/serve/doc_code/aws_neuron_core_inference_serve_stable_diffusion.py | aws_neuron_core_inference_serve_stable_diffusion.StableDiffusionV2 | from ray import serve
@serve.deployment(ray_actor_options={'resources': {'neuron_cores': neuron_cores}}, autoscaling_config={'min_replicas': 1, 'max_replicas': 2})
class StableDiffusionV2:
def __init__(self):
from optimum.neuron import NeuronStableDiffusionXLPipeline
compiled_model_id = 'aws-neuro... | @serve.deployment(ray_actor_options={'resources': {'neuron_cores': neuron_cores}}, autoscaling_config={'min_replicas': 1, 'max_replicas': 2})
class StableDiffusionV2:
def __init__(self):
pass
async def generate(self, prompt: str):
pass | 4 | 0 | 6 | 1 | 5 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 | 1 | 2 | 2 | 14 | 3 | 11 | 7 | 7 | 0 | 9 | 7 | 5 | 1 | 0 | 0 | 2 |
9,288 | ray-project/ray | doc/source/serve/doc_code/batching_guide.py | batching_guide.Model | from ray import serve
@serve.deployment
class Model:
def __call__(self, single_sample: int) -> int:
return single_sample * 2 | @serve.deployment
class Model:
def __call__(self, single_sample: int) -> int:
pass | 3 | 0 | 3 | 0 | 3 | 1 | 1 | 0.14 | 0 | 1 | 0 | 0 | 2 | 0 | 2 | 2 | 9 | 1 | 7 | 4 | 3 | 1 | 6 | 3 | 3 | 1 | 0 | 0 | 2 |
9,289 | ray-project/ray | doc/source/serve/doc_code/batching_guide.py | batching_guide.StreamingResponder | from starlette.responses import StreamingResponse
from starlette.requests import Request
from ray import serve
from typing import AsyncGenerator
import asyncio
from typing import List, AsyncGenerator, Union
@serve.deployment
class StreamingResponder:
async def generate_numbers(self, max: str) -> AsyncGenerator[st... | @serve.deployment
class StreamingResponder:
async def generate_numbers(self, max: str) -> AsyncGenerator[str, None]:
pass
def __call__(self, request: Request) -> StreamingResponse:
pass | 4 | 0 | 4 | 0 | 4 | 0 | 2 | 0 | 0 | 3 | 0 | 0 | 2 | 0 | 2 | 2 | 10 | 1 | 9 | 5 | 6 | 0 | 9 | 5 | 6 | 2 | 0 | 1 | 3 |
9,290 | ray-project/ray | ci/ray_ci/bazel_sharding.py | bazel_sharding.BazelRule | from dataclasses import dataclass
from typing import Iterable, List, Optional, Set, Tuple
import xml.etree.ElementTree as ET
@dataclass
class BazelRule:
"""
Dataclass representing a bazel py_test rule (BUILD entry).
Only the subset of fields we care about is included.
"""
name: str
size: str
... | @dataclass
class BazelRule:
'''
Dataclass representing a bazel py_test rule (BUILD entry).
Only the subset of fields we care about is included.
'''
def __post_init__(self):
pass
@property
def actual_timeout_s(self) -> float:
pass
def __lt__(self, other: 'BazelRule') -> ... | 9 | 2 | 9 | 0 | 8 | 1 | 3 | 0.22 | 0 | 4 | 0 | 0 | 4 | 0 | 5 | 5 | 64 | 8 | 46 | 13 | 38 | 10 | 34 | 11 | 28 | 9 | 0 | 1 | 13 |
9,291 | ray-project/ray | rllib/tuned_examples/dqn/benchmark_dqn_atari.py | benchmark_dqn_atari.BenchmarkStopper | from ray.tune import Stopper
from ray.rllib.utils.metrics import ENV_RUNNER_RESULTS, EPISODE_RETURN_MEAN, NUM_ENV_STEPS_SAMPLED_LIFETIME
class BenchmarkStopper(Stopper):
def __init__(self, benchmark_envs):
self.benchmark_envs = benchmark_envs
def __call__(self, trial_id, result):
if result[EN... |
class BenchmarkStopper(Stopper):
def __init__(self, benchmark_envs):
pass
def __call__(self, trial_id, result):
pass
def stop_all(self):
pass | 4 | 0 | 7 | 0 | 6 | 1 | 2 | 0.2 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 26 | 2 | 20 | 5 | 16 | 4 | 10 | 5 | 6 | 3 | 1 | 1 | 5 |
9,292 | ray-project/ray | rllib/tuned_examples/bc/benchmark_rlunplugged_atari_pong_bc.py | benchmark_rlunplugged_atari_pong_bc.DecodeObservations | import gymnasium as gym
from typing import Optional
from ray.rllib.connectors.connector_v2 import ConnectorV2
import cv2
import numpy as np
from ray.rllib.core.columns import Columns
from ray.rllib.utils.annotations import override
class DecodeObservations(ConnectorV2):
def __init__(self, input_observation_space:... |
class DecodeObservations(ConnectorV2):
def __init__(self, input_observation_space: Optional[gym.Space]=None, input_action_space: Optional[gym.Space]=None, *, multi_agent: bool=False, as_learner_connector: bool=True, **kwargs):
'''Decodes observation from PNG to numpy array.
Note, `rl_unplugged`'s ... | 7 | 1 | 29 | 2 | 22 | 5 | 1 | 0.25 | 1 | 4 | 0 | 0 | 2 | 2 | 2 | 2 | 83 | 7 | 61 | 27 | 39 | 15 | 14 | 9 | 10 | 2 | 1 | 1 | 4 |
9,293 | ray-project/ray | rllib/tuned_examples/sac/benchmark_sac_mujoco.py | benchmark_sac_mujoco.BenchmarkStopper | from ray.rllib.utils.metrics import ENV_RUNNER_RESULTS, EPISODE_RETURN_MEAN, NUM_ENV_STEPS_SAMPLED_LIFETIME
from ray.tune import Stopper
class BenchmarkStopper(Stopper):
def __init__(self, benchmark_envs):
self.benchmark_envs = benchmark_envs
def __call__(self, trial_id, result):
if result[EN... |
class BenchmarkStopper(Stopper):
def __init__(self, benchmark_envs):
pass
def __call__(self, trial_id, result):
pass
def stop_all(self):
pass | 4 | 0 | 7 | 0 | 6 | 1 | 2 | 0.2 | 1 | 0 | 0 | 0 | 3 | 1 | 3 | 3 | 26 | 2 | 20 | 5 | 16 | 4 | 10 | 5 | 6 | 3 | 1 | 1 | 5 |
9,294 | ray-project/ray | release/air_tests/air_benchmarks/workloads/benchmark_util.py | benchmark_util.CommandRunner | import ray
import subprocess
from typing import List, Dict, Union, Callable
@ray.remote
class CommandRunner:
def run_command(self, cmd: str):
return subprocess.check_call(cmd)
def run_fn(self, fn: Callable, *args, **kwargs):
return fn(*args, **kwargs) | @ray.remote
class CommandRunner:
def run_command(self, cmd: str):
pass
def run_fn(self, fn: Callable, *args, **kwargs):
pass | 4 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 | 0 | 2 | 2 | 6 | 1 | 5 | 3 | 2 | 0 | 5 | 3 | 2 | 1 | 0 | 0 | 2 |
9,295 | ray-project/ray | release/benchmark-worker-startup/benchmark_worker_startup.py | benchmark_worker_startup.MetricsActor | import ray
from ray._private.test_utils import safe_write_to_results_json
from collections import defaultdict
import statistics
@ray.remote(num_cpus=0)
class MetricsActor:
"""
Actor which tests will report metrics to.
"""
def __init__(self, expected_measurements_per_test: int):
self.measuremen... | @ray.remote(num_cpus=0)
class MetricsActor:
'''
Actor which tests will report metrics to.
'''
def __init__(self, expected_measurements_per_test: int):
pass
def submit(self, test_name: str, latency: float):
pass
@staticmethod
def create_results_dict_from_measurements(all_mea... | 6 | 1 | 14 | 2 | 13 | 0 | 2 | 0.07 | 0 | 4 | 0 | 0 | 2 | 2 | 3 | 3 | 51 | 8 | 40 | 15 | 33 | 3 | 22 | 12 | 18 | 3 | 0 | 2 | 5 |
9,296 | ray-project/ray | release/benchmark-worker-startup/benchmark_worker_startup.py | benchmark_worker_startup.TestConfiguration | from dataclasses import dataclass
@dataclass(eq=True, frozen=True)
class TestConfiguration:
num_jobs: int
num_runs_per_job: int
num_tasks_or_actors_per_run: int
with_gpu: bool
with_tasks: bool
with_runtime_env: bool
import_to_try: str
num_cpus_in_cluster: int
num_gpus_in_cluster: in... | @dataclass(eq=True, frozen=True)
class TestConfiguration:
def __repr__(self):
pass | 3 | 0 | 26 | 1 | 25 | 0 | 7 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 38 | 2 | 36 | 8 | 34 | 0 | 19 | 8 | 17 | 7 | 0 | 0 | 7 |
9,297 | ray-project/ray | ci/ray_ci/bisect/bisector.py | bisector.Bisector | import subprocess
from ci.ray_ci.bisect.validator import Validator
from typing import List, Optional
from ci.ray_ci.utils import logger
from ray_release.test import Test
class Bisector:
def __init__(self, test: Test, passing_revision: str, failing_revision: str, validator: Validator, git_dir: str) -> None:
... | null | 5 | 2 | 14 | 0 | 12 | 2 | 2 | 0.14 | 0 | 4 | 2 | 0 | 4 | 5 | 4 | 4 | 60 | 4 | 49 | 19 | 37 | 7 | 24 | 12 | 19 | 4 | 0 | 2 | 7 |
9,298 | ray-project/ray | ci/ray_ci/doc/build_cache.py | build_cache.BuildCache | from typing import Set
import subprocess
import boto3
import tempfile
import pickle
import os
from ray_release.util import get_write_state_machine_aws_bucket
from ci.ray_ci.utils import logger
class BuildCache:
"""
BuildCache represents the build artifacts generated from the doc build process,
massaged to ... |
class BuildCache:
'''
BuildCache represents the build artifacts generated from the doc build process,
massaged to be used as a cache for the next build process
'''
def __init__(self, cache_dir: str):
'''
Args:
cache_dir: The directory where the build artifacts are store... | 7 | 6 | 13 | 2 | 9 | 3 | 2 | 0.43 | 0 | 2 | 0 | 0 | 6 | 1 | 6 | 6 | 91 | 15 | 53 | 20 | 46 | 23 | 39 | 18 | 32 | 3 | 0 | 3 | 9 |
9,299 | ray-project/ray | ci/ray_ci/builder_container.py | builder_container.BuilderContainer | from ci.ray_ci.linux_container import LinuxContainer
import os
class BuilderContainer(LinuxContainer):
def __init__(self, python_version: str, build_type: str, architecture: str, upload: bool=False) -> None:
super().__init__('manylinux' if architecture == 'x86_64' else f'manylinux-{architecture}', volumes... |
class BuilderContainer(LinuxContainer):
def __init__(self, python_version: str, build_type: str, architecture: str, upload: bool=False) -> None:
pass
def run(self) -> None:
pass | 3 | 0 | 18 | 1 | 16 | 1 | 4 | 0.03 | 1 | 3 | 0 | 0 | 2 | 3 | 2 | 36 | 37 | 3 | 33 | 14 | 24 | 1 | 20 | 8 | 17 | 5 | 6 | 1 | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.