language stringclasses 1
value | repo stringclasses 346
values | path stringlengths 6 201 | class_span dict | source stringlengths 21 2.38M | target stringlengths 1 96 |
|---|---|---|---|---|---|
python | pytorch__pytorch | test/test_sympy_utils.py | {
"start": 34464,
"end": 34826
} | class ____(TestCase):
def test_typed_expr(self):
I = Identity(1)
typed_I = TypedExpr(I, torch.int32)
self.assertEqual(typed_I.expr, 1)
instantiate_parametrized_tests(TestValueRanges)
instantiate_parametrized_tests(TestSympyInterp)
instantiate_parametrized_tests(TestSympySolve)
if __name_... | TestTypedExpr |
python | ipython__ipython | IPython/core/profiledir.py | {
"start": 899,
"end": 8459
} | class ____(LoggingConfigurable):
"""An object to manage the profile directory and its resources.
The profile directory is used by all IPython applications, to manage
configuration, logging and security.
This object knows how to find, create and manage these directories. This
should be used by any ... | ProfileDir |
python | dagster-io__dagster | python_modules/libraries/dagster-aws/dagster_aws_tests/ecs_tests/stubbed_ecs.py | {
"start": 2324,
"end": 2763
} | class ____:
def __init__(self):
self.tasks = defaultdict(list)
self.task_definitions = defaultdict(list)
self.tags = defaultdict(list)
self.account_settings = {}
self.default_account_settings = {"taskLongArnFormat": "enabled"}
self.register_task_definition_locks = de... | StubStorage |
python | run-llama__llama_index | llama-index-integrations/llms/llama-index-llms-monsterapi/llama_index/llms/monsterapi/base.py | {
"start": 608,
"end": 5730
} | class ____(OpenAI):
model_info: dict = Field(
description="Model info field with pricing and other llm model information in json structure.",
default={},
)
"""MonsterAPI LLM.
Monster Deploy enables you to host any vLLM supported large language model (LLM) like Tinyllama, Mixtral, Phi-2... | MonsterLLM |
python | run-llama__llama_index | llama-index-integrations/protocols/llama-index-protocols-ag-ui/llama_index/protocols/ag_ui/events.py | {
"start": 1808,
"end": 1887
} | class ____(RawEvent, Event):
type: EventType = EventType.RAW
| RawWorkflowEvent |
python | encode__django-rest-framework | rest_framework/parsers.py | {
"start": 796,
"end": 907
} | class ____:
def __init__(self, data, files):
self.data = data
self.files = files
| DataAndFiles |
python | Netflix__metaflow | test/cmd/develop/test_stub_generator.py | {
"start": 220,
"end": 290
} | class ____:
"""Test class for stub generation"""
pass
| TestClass |
python | run-llama__llama_index | llama-index-integrations/readers/llama-index-readers-airbyte-gong/llama_index/readers/airbyte_gong/base.py | {
"start": 126,
"end": 680
} | class ____(AirbyteCDKReader):
"""
AirbyteGongReader reader.
Retrieve documents from Gong
Args:
config: The config object for the gong source.
"""
def __init__(
self,
config: Mapping[str, Any],
record_handler: Optional[RecordHandler] = None,
) -> None:
... | AirbyteGongReader |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 957753,
"end": 958485
} | class ____(sgqlc.types.relay.Connection):
"""The connection type for SavedReply."""
__schema__ = github_schema
__field_names__ = ("edges", "nodes", "page_info", "total_count")
edges = sgqlc.types.Field(sgqlc.types.list_of("SavedReplyEdge"), graphql_name="edges")
"""A list of edges."""
nodes = ... | SavedReplyConnection |
python | openai__gym | gym/error.py | {
"start": 3285,
"end": 3371
} | class ____(APIError):
"""Deprecated, to be removed at gym 1.0."""
| APIConnectionError |
python | PrefectHQ__prefect | tests/utilities/test_annotations.py | {
"start": 351,
"end": 2105
} | class ____:
@pytest.mark.parametrize(
"value",
[
"hello",
42,
3.14,
True,
None,
["a", 1, True],
{"some", "set"},
{
"string": "value",
"number": 42,
"list": ... | TestFreeze |
python | python__mypy | mypyc/ir/rtypes.py | {
"start": 34974,
"end": 37681
} | class ____(RType):
"""Fixed-length C array type (for example, int[5]).
Note that the implementation is a bit limited, and these can basically
be only used for local variables that are initialized in one location.
"""
def __init__(self, item_type: RType, length: int) -> None:
self.item_type... | RArray |
python | pyca__cryptography | src/cryptography/hazmat/primitives/asymmetric/ec.py | {
"start": 8057,
"end": 8195
} | class ____(EllipticCurve):
name = "sect163k1"
key_size = 163
group_order = 0x4000000000000000000020108A2E0CC0D99F8A5EF
| SECT163K1 |
python | ethereum__web3.py | web3/geth.py | {
"start": 1642,
"end": 2729
} | class ____(Module):
"""
https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-admin
"""
is_async = False
add_peer: Method[Callable[[EnodeURI], bool]] = Method(
RPC.admin_addPeer,
mungers=[default_root_munger],
)
datadir: Method[Callable[[], str]] = Method(
RP... | GethAdmin |
python | encode__django-rest-framework | rest_framework/renderers.py | {
"start": 37024,
"end": 39913
} | class ____:
def get_schema(self, instance):
CLASS_TO_TYPENAME = {
coreschema.Object: 'object',
coreschema.Array: 'array',
coreschema.Number: 'number',
coreschema.Integer: 'integer',
coreschema.String: 'string',
coreschema.Boolean: 'bool... | _BaseOpenAPIRenderer |
python | google__jax | jax/_src/stages.py | {
"start": 36741,
"end": 38363
} | class ____(Exception):
pass
def _find_arg_mismatch(arg_list, fails, fun_name):
mismatched_args_msg = []
def mismatch(err):
for name, inp_da, aval in arg_list:
if err.m_type == MismatchType.ARG_SHARDING and err.da == inp_da:
mismatched_args_msg.append(
f"argument {name} of {fun_name... | DeviceAssignmentMismatchError |
python | kamyu104__LeetCode-Solutions | Python/find-k-pairs-with-smallest-sums.py | {
"start": 1121,
"end": 1392
} | class ____(object):
def kSmallestPairs(self, nums1, nums2, k):
"""
:type nums1: List[int]
:type nums2: List[int]
:type k: int
:rtype: List[List[int]]
"""
return nsmallest(k, product(nums1, nums2), key=sum)
| Solution2 |
python | great-expectations__great_expectations | contrib/great_expectations_semantic_types_expectations/great_expectations_semantic_types_expectations/expectations/expect_column_values_to_be_ascii.py | {
"start": 790,
"end": 2356
} | class ____(ColumnMapMetricProvider):
"""
Determines whether column values consist only of ascii characters. If value consists of any non-ascii character
then that value will not pass.
"""
# This is the id string that will be used to reference your metric.
# Please see {some doc} for information... | ColumnValuesAreAscii |
python | kamyu104__LeetCode-Solutions | Python/count-stepping-numbers-in-range.py | {
"start": 34,
"end": 1078
} | class ____(object):
def countSteppingNumbers(self, low, high):
"""
:type low: str
:type high: str
:rtype: int
"""
MOD = 10**9+7
def f(s):
dp = [[0]*10 for _ in xrange(2)]
for j in xrange(1, ord(s[0])-ord('0')+1):
dp[0][j... | Solution |
python | cython__cython | Cython/Debugger/libcython.py | {
"start": 5687,
"end": 5993
} | class ____:
def __init__(self, name, cname, qualified_name, type, lineno):
self.name = name
self.cname = cname
self.qualified_name = qualified_name
self.type = type
self.lineno = int(lineno)
def __repr__(self):
return simple_repr(self)
| CythonVariable |
python | google__jax | jax/_src/test_util.py | {
"start": 25417,
"end": 25539
} | class ____:
def __len__(self): return 0
def __getitem__(self, i): raise IndexError(f"index {i} out of range.")
| ScalarShape |
python | optuna__optuna | optuna/storages/_grpc/auto_generated/api_pb2_grpc.py | {
"start": 19470,
"end": 35256
} | class ____(object):
"""*
Optuna storage service defines APIs to interact with the storage.
"""
@staticmethod
def CreateNewStudy(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compr... | StorageService |
python | kamyu104__LeetCode-Solutions | Python/minimum-number-of-operations-to-make-x-and-y-equal.py | {
"start": 43,
"end": 546
} | class ____(object):
def minimumOperationsToMakeEqual(self, x, y):
"""
:type x: int
:type y: int
:rtype: int
"""
def memoization(x):
if y >= x:
return y-x
if x not in lookup:
lookup[x] = min(x-y, min(min(x%d, d-x%... | Solution |
python | kamyu104__LeetCode-Solutions | Python/maximum-points-inside-the-square.py | {
"start": 67,
"end": 604
} | class ____(object):
def maxPointsInsideSquare(self, points, s):
"""
:type points: List[List[int]]
:type s: str
:rtype: int
"""
INF = float("inf")
lookup = [INF for _ in xrange(26)]
d = INF
for c, (x, y) in itertools.izip(s, points):
... | Solution |
python | tensorflow__tensorflow | tensorflow/python/keras/utils/version_utils.py | {
"start": 2447,
"end": 5138
} | class ____(object):
"""Chooses between Keras v1 and v2 TensorBoard callback class."""
def __new__(cls, *args, **kwargs): # pylint: disable=unused-argument
use_v2 = should_use_v2()
start_cls = cls
cls = swap_class(start_cls, callbacks.TensorBoard, callbacks_v1.TensorBoard,
use_v2)
... | TensorBoardVersionSelector |
python | readthedocs__readthedocs.org | readthedocs/proxito/views/serve.py | {
"start": 35839,
"end": 36952
} | class ____(CDNCacheControlMixin, CDNCacheTagsMixin, ServeDocsMixin, View):
"""
Serve static files from the same domain the docs are being served from.
This is basically a proxy for ``STATIC_URL``.
"""
project_cache_tag = "rtd-staticfiles"
# This view can always be cached,
# since these ar... | ServeStaticFiles |
python | tensorflow__tensorflow | tensorflow/python/autograph/pyct/transpiler_test.py | {
"start": 915,
"end": 1095
} | class ____(transformer.Base):
def visit_BinOp(self, node):
if isinstance(node.op, gast.Add):
node.op = gast.Sub()
return self.generic_visit(node)
| FlipSignTransformer |
python | huggingface__transformers | src/transformers/models/auto/modeling_auto.py | {
"start": 82446,
"end": 82720
} | class ____(_BaseAutoModelClass):
_model_mapping = MODEL_FOR_PRETRAINING_MAPPING
AutoModelForPreTraining = auto_class_update(AutoModelForPreTraining, head_doc="pretraining")
# Private on purpose, the public class will add the deprecation warnings.
| AutoModelForPreTraining |
python | kamyu104__LeetCode-Solutions | Python/sort-array-by-absolute-value.py | {
"start": 469,
"end": 675
} | class ____(object):
def sortByAbsoluteValue(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
nums.sort(key=lambda x: abs(x))
return nums
| Solution2 |
python | pytorch__pytorch | test/profiler/test_profiler.py | {
"start": 97254,
"end": 128715
} | class ____(TestCase):
def make_tree(self) -> list[MockNode]:
tree = {
"root_0": {
"1": {"2": {}},
"3": {
"4": {},
"5": {},
},
},
"root_1": {
"6": {},
"7... | TestExperimentalUtils |
python | mlflow__mlflow | dev/clint/src/clint/rules/pytest_mark_repeat.py | {
"start": 84,
"end": 709
} | class ____(Rule):
def _message(self) -> str:
return (
"@pytest.mark.repeat decorator should not be committed. "
"This decorator is meant for local testing only to check for flaky tests."
)
@staticmethod
def check(decorator_list: list[ast.expr], resolver: Resolver) ->... | PytestMarkRepeat |
python | chroma-core__chroma | chromadb/execution/expression/operator.py | {
"start": 33070,
"end": 33267
} | class ____(Rank):
"""Multiplication of multiple ranks"""
ranks: List[Rank]
def to_dict(self) -> Dict[str, Any]:
return {"$mul": [r.to_dict() for r in self.ranks]}
@dataclass
| Mul |
python | getsentry__sentry | src/sentry/analytics/events/monitor_mark_failed.py | {
"start": 88,
"end": 318
} | class ____(analytics.Event):
organization_id: int
monitor_id: str # this is stringified in the caller
project_id: int
environment_id: int
analytics.register(MonitorEnvironmentMarkFailed)
| MonitorEnvironmentMarkFailed |
python | facebook__pyre-check | client/language_server/tests/daemon_connection_test.py | {
"start": 512,
"end": 841
} | class ____(connections.AsyncBytesReader):
def __init__(self, exception: Exception) -> None:
self.exception = exception
async def read_until(self, separator: bytes = b"\n") -> bytes:
raise self.exception
async def read_exactly(self, count: int) -> bytes:
raise self.exception
| RaisingBytesReader |
python | ray-project__ray | python/ray/serve/_private/metrics_utils.py | {
"start": 651,
"end": 751
} | class ____:
task_func: Union[Callable, Callable[[], Awaitable]]
interval_s: float
| _MetricsTask |
python | scipy__scipy | scipy/special/_multiufuncs.py | {
"start": 541,
"end": 19402
} | class ____:
def __init__(self, ufunc_or_ufuncs, name=None, doc=None, *,
force_complex_output=False, **default_kwargs):
if not isinstance(ufunc_or_ufuncs, np.ufunc):
if isinstance(ufunc_or_ufuncs, collections.abc.Mapping):
ufuncs_iter = ufunc_or_ufuncs.values()
... | MultiUFunc |
python | cherrypy__cherrypy | cherrypy/_cpwsgi_server.py | {
"start": 194,
"end": 815
} | class ____(cheroot.server.HTTPRequest):
"""Wrapper for cheroot.server.HTTPRequest.
This is a layer, which preserves URI parsing mode like it which was
before Cheroot v5.8.0.
"""
def __init__(self, server, conn):
"""Initialize HTTP request container instance.
Args:
serv... | CPWSGIHTTPRequest |
python | Textualize__textual | docs/examples/guide/screens/modes01.py | {
"start": 409,
"end": 541
} | class ____(Screen):
def compose(self) -> ComposeResult:
yield Placeholder("Help Screen")
yield Footer()
| HelpScreen |
python | getsentry__sentry | src/sudo/utils.py | {
"start": 405,
"end": 2376
} | class ____(HttpRequest):
_sudo: bool
_sudo_token: str
_sudo_max_age: int
def _allow_sudo_attribute_stuffing(request: HttpRequest) -> _SudoRequest:
# cast to our fake type which allows typesafe attribute stuffing
return cast(_SudoRequest, request)
def grant_sudo_privileges(request: HttpRequest, m... | _SudoRequest |
python | huggingface__transformers | src/transformers/models/llama4/processing_llama4.py | {
"start": 939,
"end": 6248
} | class ____(ProcessingKwargs, total=False):
_defaults = {
"text_kwargs": {
"padding_side": "left",
},
}
chat_template = "{{- bos_token }}\n{%- if custom_tools is defined %}\n {%- set tools = custom_tools %}\n{%- endif %}\n{%- if not tools_in_user_message is defined %}\n {%- se... | Llama4ProcessorKwargs |
python | readthedocs__readthedocs.org | readthedocs/projects/migrations/0021_add-webhook-deprecation-feature.py | {
"start": 143,
"end": 313
} | class ____(migrations.Migration):
safe = Safe.after_deploy()
dependencies = [
("projects", "0020_add-api-project-proxy"),
]
operations = []
| Migration |
python | dagster-io__dagster | python_modules/libraries/dagster-aws/dagster_aws/pipes/clients/ecs.py | {
"start": 1229,
"end": 15482
} | class ____(PipesClient, TreatAsResourceParam):
"""A pipes client for running AWS ECS tasks.
Args:
client (Any): The boto ECS client used to launch the ECS task
context_injector (Optional[PipesContextInjector]): A context injector to use to inject
context into the ECS task. Defaults ... | PipesECSClient |
python | spack__spack | lib/spack/spack/installer.py | {
"start": 4544,
"end": 5382
} | class ____:
def __init__(self, pkg_count: int):
# Counters used for showing status information
self.pkg_num: int = 0
self.pkg_count: int = pkg_count
self.pkg_ids: Set[str] = set()
def next_pkg(self, pkg: "spack.package_base.PackageBase"):
pkg_id = package_id(pkg.spec)
... | InstallStatus |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/pycodestyle/E23.py | {
"start": 2830,
"end": 2930
} | class ____[A: object="foo"[::-1], B: object =[[["foo", "bar"]]], C: object= bytes]:
pass
| PEP696Good |
python | tensorflow__tensorflow | tensorflow/python/checkpoint/checkpoint.py | {
"start": 16368,
"end": 29107
} | class ____:
"""Keeps the status of a name-based checkpoint restore."""
def __init__(self, save_path, dtype_map=None):
self.save_path = save_path
self.dtype_map = dtype_map
# A map from trackable objects to unused attribute names. We don't have
# proto IDs when doing a name-based restore, so the map... | _NameBasedRestoreCoordinator |
python | PyCQA__pylint | tests/functional/a/abstract/abstract_class_instantiated.py | {
"start": 856,
"end": 1147
} | class ____(metaclass=abc.ABCMeta):
@abc.abstractmethod
def __iter__(self):
pass
@abc.abstractmethod
def __len__(self):
pass
@abc.abstractmethod
def __contains__(self, _):
pass
@abc.abstractmethod
def __hash__(self):
pass
| Structure |
python | dagster-io__dagster | python_modules/libraries/dagster-aws/dagster_aws_tests/defs_state_storage_tests/test_defs_state_storage.py | {
"start": 979,
"end": 1968
} | class ____(TestDefsStateStorage):
"""Tests the blob storage state storage implementation."""
__test__ = True
@pytest.fixture(name="storage", scope="function")
def state_storage(self, mock_s3_bucket):
with instance_for_test(
overrides={
"defs_state_storage": {
... | TestS3UPathDefsStateStorage |
python | PyCQA__pylint | doc/data/messages/i/invalid-length-hint-returned/good.py | {
"start": 0,
"end": 121
} | class ____:
"""__length_hint__ returns <type 'int'>"""
def __length_hint__(self):
return 10
| CustomLengthHint |
python | crytic__slither | slither/core/solidity_types/type_alias.py | {
"start": 433,
"end": 1168
} | class ____(Type):
def __init__(self, underlying_type: ElementaryType, name: str) -> None:
super().__init__()
self.name = name
self.underlying_type = underlying_type
self._pattern = "type"
@property
def type(self) -> ElementaryType:
"""
Return the underlying t... | TypeAlias |
python | astropy__astropy | astropy/modeling/projections.py | {
"start": 40864,
"end": 41057
} | class ____(Sky2PixProjection, HEALPix):
r"""
HEALPix polar, aka "butterfly" projection - pixel to sky.
Corresponds to the ``XPH`` projection in FITS WCS.
"""
| Sky2Pix_HEALPixPolar |
python | python__mypy | mypy/test/testutil.py | {
"start": 196,
"end": 915
} | class ____(TestCase):
def test_get_terminal_size_in_pty_defaults_to_80(self) -> None:
# when run using a pty, `os.get_terminal_size()` returns `0, 0`
ret = os.terminal_size((0, 0))
mock_environ = os.environ.copy()
mock_environ.pop("COLUMNS", None)
with mock.patch.object(os, "... | TestGetTerminalSize |
python | Netflix__metaflow | metaflow/decorators.py | {
"start": 8129,
"end": 10401
} | class ____(Decorator):
options = {}
def __init__(self, *args, **kwargs):
super(FlowDecorator, self).__init__(*args, **kwargs)
def flow_init(
self, flow, graph, environment, flow_datastore, metadata, logger, echo, options
):
"""
Called when all decorators have been creat... | FlowDecorator |
python | PrefectHQ__prefect | src/integrations/prefect-databricks/prefect_databricks/models/jobs.py | {
"start": 58611,
"end": 58806
} | class ____(BaseModel):
"""
See source code for the fields' description.
"""
model_config = ConfigDict(extra="allow", frozen=True)
task_key: Optional[str] = None
| TaskDependency |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/pyupgrade/UP008.py | {
"start": 585,
"end": 1532
} | class ____(BaseClass):
def normal(self):
super(MyClass, self).f() # can use super()
super().f()
def different_argument(self, other):
super(MyClass, other).f() # CANNOT use super()
def comprehension_scope(self):
[super(MyClass, self).f() for x in [1]] # CANNOT use super()... | MyClass |
python | pydantic__pydantic | tests/mypy/modules/plugin_fail.py | {
"start": 2613,
"end": 2735
} | class ____(BaseModel):
x: str = Field(..., alias=x_alias)
z: int
DynamicAliasModel(y='y', z='1')
| DynamicAliasModel |
python | django__django | tests/runtests.py | {
"start": 11937,
"end": 27963
} | class ____(argparse.Action):
"""
Validate the comma-separated list of requested browsers.
"""
def __call__(self, parser, namespace, values, option_string=None):
try:
import selenium # NOQA
except ImportError as e:
raise ImproperlyConfigured(f"Error loading selen... | ActionSelenium |
python | scipy__scipy | scipy/_lib/_testutils.py | {
"start": 1202,
"end": 3935
} | class ____:
"""
Run tests for this namespace
``scipy.test()`` runs tests for all of SciPy, with the default settings.
When used from a submodule (e.g., ``scipy.cluster.test()``, only the tests
for that namespace are run.
Parameters
----------
label : {'fast', 'full'}, optional
... | PytestTester |
python | PyCQA__pylint | tests/functional/a/attribute_defined_outside_init.py | {
"start": 376,
"end": 466
} | class ____(A):
def test(self):
self.z = 44 # [attribute-defined-outside-init]
| B |
python | getsentry__sentry | tests/sentry/models/test_release.py | {
"start": 47874,
"end": 56460
} | class ____(TestCase):
def setUp(self) -> None:
self.org = self.create_organization()
self.fake_package = "_fake_package_prj_"
# Project with 10 semver releases
self.proj_1 = self.create_project(organization=self.org)
for i in range(10):
self.create_release(versio... | FollowsSemverVersioningSchemeTestCase |
python | pdm-project__pdm | src/pdm/cli/commands/add.py | {
"start": 694,
"end": 7131
} | class ____(BaseCommand):
"""Add package(s) to pyproject.toml and install them"""
arguments = (
*BaseCommand.arguments,
lockfile_option,
frozen_lockfile_option,
save_strategy_group,
override_option,
update_strategy_group,
prerelease_option,
unconst... | Command |
python | numpy__numpy | benchmarks/benchmarks/bench_random.py | {
"start": 5049,
"end": 5377
} | class ____(Benchmark):
params = [1e3, 1e6, 1e8]
def setup(self, v):
self.a = np.arange(v)
self.rng = np.random.default_rng()
def time_legacy_choice(self, v):
np.random.choice(self.a, 1000, replace=False)
def time_choice(self, v):
self.rng.choice(self.a, 1000, replace=F... | Choice |
python | mkdocs__mkdocs | mkdocs/utils/yaml.py | {
"start": 1061,
"end": 1546
} | class ____(os.PathLike):
def __init__(self, config: MkDocsConfig, suffix: str = ''):
self.config = config
self.suffix = suffix
def value(self) -> str:
raise NotImplementedError
def __fspath__(self) -> str:
"""Can be used as a path."""
return os.path.join(self.value(... | _DirPlaceholder |
python | astropy__astropy | astropy/visualization/lupton_rgb.py | {
"start": 8244,
"end": 9537
} | class ____(Mapping):
"""
A mapping for an asinh stretch (preserving colours independent of brightness).
x = asinh(Q (I - minimum)/stretch)/Q
This reduces to a linear stretch if Q == 0
See https://ui.adsabs.harvard.edu/abs/2004PASP..116..133L
Parameters
----------
minimum : float
... | AsinhMapping |
python | getsentry__sentry | src/sentry/utils/committers.py | {
"start": 6168,
"end": 6270
} | class ____(TypedDict):
author: Author | None
commits: Sequence[tuple[Commit, int]]
| AuthorCommits |
python | mwaskom__seaborn | tests/test_base.py | {
"start": 10770,
"end": 15642
} | class ____:
def test_plotter_default_init(self, long_df):
p = VectorPlotter(
data=long_df,
variables=dict(x="x", y="y"),
)
assert not hasattr(p, "_size_map")
p = VectorPlotter(
data=long_df,
variables=dict(x="x", y="y", size="a"),
... | TestSizeMapping |
python | apache__airflow | providers/google/src/airflow/providers/google/cloud/triggers/dataplex.py | {
"start": 1139,
"end": 4851
} | class ____(BaseTrigger):
"""
DataplexDataQualityJobTrigger runs on the trigger worker and waits for the job to be `SUCCEEDED` state.
:param job_id: Optional. The ID of a Dataplex job.
:param data_scan_id: Required. DataScan identifier.
:param project_id: Google Cloud Project where the job is runnin... | DataplexDataQualityJobTrigger |
python | kamyu104__LeetCode-Solutions | Python/add-one-row-to-tree.py | {
"start": 29,
"end": 154
} | class ____(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
| TreeNode |
python | python-openxml__python-docx | src/docx/table.py | {
"start": 11188,
"end": 12176
} | class ____(Parented):
"""Table column."""
def __init__(self, gridCol: CT_TblGridCol, parent: TableParent):
super(_Column, self).__init__(parent)
self._parent = parent
self._gridCol = gridCol
@property
def cells(self) -> tuple[_Cell, ...]:
"""Sequence of |_Cell| instance... | _Column |
python | PyCQA__pylint | tests/functional/r/regression_02/regression_no_member_7631.py | {
"start": 215,
"end": 250
} | class ____(Base):
attr: int
| Parent |
python | run-llama__llama_index | llama-index-integrations/postprocessor/llama-index-postprocessor-rankllm-rerank/llama_index/postprocessor/rankllm_rerank/base.py | {
"start": 667,
"end": 6575
} | class ____(BaseNodePostprocessor):
"""
RankLLM reranking suite. This class allows access to several reranking models supported by RankLLM. To use a model offered by the RankLLM suite, pass the desired model's hugging face path, found at https://huggingface.co/castorini. e.g., to access LiT5-Distill-base, pass '... | RankLLMRerank |
python | pytorch__pytorch | test/distributed/test_store.py | {
"start": 31104,
"end": 33871
} | class ____(TestCase):
def test_optional_methods_fail(self):
class TestStore(dist.Store):
pass
store = TestStore()
self.assertFalse(store.has_extended_api())
with self.assertRaisesRegex(RuntimeError, "Not implemented."):
store.append("foo", "bar")
with... | TestPythonStore |
python | ray-project__ray | python/ray/data/tests/test_delta_sharing.py | {
"start": 3747,
"end": 5475
} | class ____(unittest.TestCase):
def test_valid_url(self):
url = "profile#share.schema.table"
expected_result = ("profile", "share", "schema", "table")
self.assertEqual(_parse_delta_sharing_url(url), expected_result)
def test_missing_hash(self):
url = "profile-share.schema.table"
... | TestParseDeltaSharingUrl |
python | dagster-io__dagster | python_modules/dagster/dagster_tests/components_tests/integration_tests/lib/duckdb_component/step_one.py | {
"start": 262,
"end": 1410
} | class ____(dg.Component):
"""A component that allows you to write SQL without learning dbt or Dagster's concepts."""
def build_defs(self, context: ComponentLoadContext) -> dg.Definitions:
name = "op_name"
asset_specs = [dg.AssetSpec(key="the_key")]
path = (context.path / Path("raw_custo... | DuckDbComponent |
python | rapidsai__cudf | python/cudf/cudf/pandas/fast_slow_proxy.py | {
"start": 2548,
"end": 3350
} | class ____:
"""
A totally unusable type. When a "fast" object is not available,
it's useful to set it to _Unusable() so that any operations
on it fail, and ensure fallback to the corresponding
"slow" object.
"""
def __call__(self, *args: Any, **kwds: Any) -> Any:
raise NotImplemente... | _Unusable |
python | apache__airflow | providers/amazon/src/airflow/providers/amazon/aws/operators/sqs.py | {
"start": 1205,
"end": 4764
} | class ____(AwsBaseOperator[SqsHook]):
"""
Publish a message to an Amazon SQS queue.
.. seealso::
For more information on how to use this operator, take a look at the guide:
:ref:`howto/operator:SqsPublishOperator`
:param sqs_queue: The SQS queue url (templated)
:param message_conte... | SqsPublishOperator |
python | great-expectations__great_expectations | great_expectations/data_context/types/base.py | {
"start": 5855,
"end": 7372
} | class ____(DictDot):
def __init__( # noqa: PLR0913 # FIXME CoP
self,
name,
class_name=None,
module_name=None,
orderby="asc",
reference_list=None,
order_keys_by=None,
key_reference_list=None,
datetime_format=None,
**kwargs,
) -> Non... | SorterConfig |
python | getsentry__sentry | src/sentry/notifications/notifications/strategies/role_based_recipient_strategy.py | {
"start": 547,
"end": 3415
} | class ____(metaclass=ABCMeta):
member_by_user_id: MutableMapping[int, OrganizationMember] = {}
role: OrganizationRole | None = None
scope: str | None = None
def __init__(self, organization: Organization):
self.organization = organization
def get_member(self, user: RpcUser | Actor) -> Organ... | RoleBasedRecipientStrategy |
python | walkccc__LeetCode | solutions/1976. Number of Ways to Arrive at Destination/1976.py | {
"start": 0,
"end": 874
} | class ____:
def countPaths(self, n: int, roads: list[list[int]]) -> int:
graph = [[] for _ in range(n)]
for u, v, w in roads:
graph[u].append((v, w))
graph[v].append((u, w))
return self._dijkstra(graph, 0, n - 1)
def _dijkstra(
self,
graph: list[list[tuple[int, int]]],
s... | Solution |
python | ray-project__ray | rllib/core/models/specs/specs_base.py | {
"start": 178,
"end": 330
} | class ____:
pass
@Deprecated(
help="The Spec checking APIs have been deprecated and cancelled without "
"replacement.",
error=True,
)
| Spec |
python | pallets__jinja | src/jinja2/sandbox.py | {
"start": 4898,
"end": 13757
} | class ____(Environment):
"""The sandboxed environment. It works like the regular environment but
tells the compiler to generate sandboxed code. Additionally subclasses of
this environment may override the methods that tell the runtime what
attributes or functions are safe to access.
If the templa... | SandboxedEnvironment |
python | scipy__scipy | benchmarks/benchmarks/go_benchmark_functions/go_funcs_Z.py | {
"start": 2694,
"end": 3768
} | class ____(Benchmark):
r"""
Zettl objective function.
This class defines the Zettl [1]_ global optimization problem. This is a
multimodal minimization problem defined as follows:
.. math::
f_{\text{Zettl}}(x) = \frac{1}{4} x_{1} + \left(x_{1}^{2} - 2 x_{1}
+ x... | Zettl |
python | anthropics__anthropic-sdk-python | examples/structured_outputs_streaming.py | {
"start": 196,
"end": 757
} | class ____(pydantic.BaseModel):
product_name: str
price: float
quantity: int
client = anthropic.Anthropic()
prompt = """
Extract the product name, price, and quantity from this customer message:
"Hi, I’d like to order 2 packs of Green Tea for 5.50 dollars each."
"""
with client.beta.messages.stream(
... | Order |
python | kamyu104__LeetCode-Solutions | Python/remove-palindromic-subsequences.py | {
"start": 29,
"end": 376
} | class ____(object):
def removePalindromeSub(self, s):
"""
:type s: str
:rtype: int
"""
def is_palindrome(s):
for i in xrange(len(s)//2):
if s[i] != s[-1-i]:
return False
return True
return 2 - is_pal... | Solution |
python | scipy__scipy | scipy/stats/tests/test_morestats.py | {
"start": 105931,
"end": 112019
} | class ____:
def setup_method(self):
self.x = _old_loggamma_rvs(5, size=50, random_state=12345) + 5
def test_pearsonr(self):
maxlog = stats.boxcox_normmax(self.x)
assert_allclose(maxlog, 1.804465, rtol=1e-6)
def test_mle(self):
maxlog = stats.boxcox_normmax(self.x, method='m... | TestBoxcoxNormmax |
python | apache__airflow | dev/breeze/tests/test_ui_commands.py | {
"start": 6667,
"end": 6875
} | class ____:
def test_locale_files_creation(self):
lf = LocaleFiles(locale="en", files=["test.json", "common.json"])
assert lf.locale == "en"
assert len(lf.files) == 2
| TestLocaleFiles |
python | huggingface__transformers | tests/models/cohere2/test_modeling_cohere2.py | {
"start": 1838,
"end": 2918
} | class ____(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase):
all_model_classes = (Cohere2Model, Cohere2ForCausalLM) if is_torch_available() else ()
pipeline_model_mapping = (
{
"feature-extraction": Cohere2Model,
"text-generation": Cohere2ForCausal... | Cohere2ModelTest |
python | Unity-Technologies__ml-agents | ml-agents/mlagents/trainers/torch_entities/networks.py | {
"start": 18212,
"end": 20050
} | class ____(nn.Module, Critic):
def __init__(
self,
stream_names: List[str],
observation_specs: List[ObservationSpec],
network_settings: NetworkSettings,
encoded_act_size: int = 0,
outputs_per_stream: int = 1,
):
# This is not a typo, we want to call __ini... | ValueNetwork |
python | numba__numba | numba/core/datamodel/models.py | {
"start": 4400,
"end": 5067
} | class ____(DataModel):
"""
A data model for omitted arguments. Only the "argument" representation
is defined, other representations raise a NotImplementedError.
"""
# Omitted arguments are using a dummy value type
def get_value_type(self):
return ir.LiteralStructType([])
# Omitted ... | OmittedArgDataModel |
python | huggingface__transformers | src/transformers/models/deberta/modeling_deberta.py | {
"start": 42107,
"end": 44436
} | class ____(DebertaPreTrainedModel):
def __init__(self, config):
super().__init__(config)
self.num_labels = config.num_labels
self.deberta = DebertaModel(config)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
self.classifier = nn.Linear(config.hidden_size, config.num_l... | DebertaForTokenClassification |
python | weaviate__weaviate-python-client | weaviate/collections/classes/config_vectorizers.py | {
"start": 17617,
"end": 18071
} | class ____(_Multi2VecBase):
vectorizer: Union[Vectorizers, _EnumLikeStr] = Field(
default=Vectorizers.MULTI2MULTI_JINAAI, frozen=True, exclude=True
)
baseURL: Optional[AnyHttpUrl]
model: Optional[str]
def _to_dict(self) -> Dict[str, Any]:
ret_dict = super()._to_dict()
if sel... | _Multi2MultiVecJinaConfig |
python | apache__airflow | providers/google/tests/unit/google/cloud/operators/test_pubsub.py | {
"start": 3843,
"end": 11017
} | class ____:
@mock.patch("airflow.providers.google.cloud.operators.pubsub.PubSubHook")
def test_execute(self, mock_hook):
operator = PubSubCreateSubscriptionOperator(
task_id=TASK_ID, project_id=TEST_PROJECT, topic=TEST_TOPIC, subscription=TEST_SUBSCRIPTION
)
mock_hook.return_... | TestPubSubSubscriptionCreateOperator |
python | dagster-io__dagster | python_modules/automation/automation_tests/dagster_docs_tests/test_path_converters.py | {
"start": 4009,
"end": 5624
} | class ____:
def test_create_converter(self):
converter = simple_package_converter("mypackage")
root = Path("/project")
file_path = root / "submodule.py"
result = converter(file_path, root)
assert result == "mypackage.submodule"
def test_nested_modules(self):
co... | TestSimplePackageConverter |
python | apache__airflow | providers/microsoft/azure/tests/unit/microsoft/azure/operators/test_asb.py | {
"start": 14120,
"end": 16842
} | class ____:
def test_init(self):
"""
Test init by creating ASBCreateSubscriptionOperator with task id, subscription name, topic name and
asserting with value
"""
asb_create_subscription = AzureServiceBusSubscriptionCreateOperator(
task_id="asb_create_subscription"... | TestASBCreateSubscriptionOperator |
python | huggingface__transformers | tests/utils/test_hf_argparser.py | {
"start": 1734,
"end": 1795
} | class ____(Enum):
titi = "titi"
toto = "toto"
| BasicEnum |
python | bokeh__bokeh | src/bokeh/events.py | {
"start": 11355,
"end": 11793
} | class ____(PlotEvent):
''' Announce the end of "interactive level-of-detail" mode on a plot.
During interactive actions such as panning or zooming, Bokeh can
optionally, temporarily draw a reduced set of the data, in order to
maintain high interactive rates. This is referred to as interactive
Level... | LODEnd |
python | PrefectHQ__prefect | src/integrations/prefect-kubernetes/prefect_kubernetes/worker.py | {
"start": 25652,
"end": 38069
} | class ____(
BaseWorker[
"KubernetesWorkerJobConfiguration",
"KubernetesWorkerVariables",
"KubernetesWorkerResult",
]
):
"""Prefect worker that executes flow runs within Kubernetes Jobs."""
type: str = "kubernetes"
job_configuration = KubernetesWorkerJobConfiguration
job_... | KubernetesWorker |
python | huggingface__transformers | tests/models/auto/test_video_processing_auto.py | {
"start": 1212,
"end": 11158
} | class ____(unittest.TestCase):
def setUp(self):
transformers.dynamic_module_utils.TIME_OUT_REMOTE_CODE = 0
def test_video_processor_from_model_shortcut(self):
config = AutoVideoProcessor.from_pretrained("llava-hf/llava-onevision-qwen2-0.5b-ov-hf")
self.assertIsInstance(config, LlavaOnev... | AutoVideoProcessorTest |
python | realpython__materials | python-311/programmers.py | {
"start": 242,
"end": 664
} | class ____:
name: str
life_span: tuple[int, int]
@classmethod
def from_dict(cls, info: Info) -> Self:
return cls(
name=f"{info['name']['first']} {info['name']['last']}",
life_span=(info["birth"]["year"], info["death"]["year"]),
)
def convert_pair(first: Info, s... | Person |
python | huggingface__transformers | src/transformers/models/electra/modeling_electra.py | {
"start": 1901,
"end": 6177
} | class ____(nn.Module):
"""Construct the embeddings from word, position and token_type embeddings."""
def __init__(self, config):
super().__init__()
self.word_embeddings = nn.Embedding(config.vocab_size, config.embedding_size, padding_idx=config.pad_token_id)
self.position_embeddings = n... | ElectraEmbeddings |
python | huggingface__transformers | src/transformers/models/vit_mae/modeling_vit_mae.py | {
"start": 5899,
"end": 11729
} | class ____(nn.Module):
"""
Construct the CLS token, position and patch embeddings.
"""
def __init__(self, config):
super().__init__()
self.cls_token = nn.Parameter(torch.zeros(1, 1, config.hidden_size))
self.patch_embeddings = ViTMAEPatchEmbeddings(config)
self.num_pat... | ViTMAEEmbeddings |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.