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
mlflow__mlflow
mlflow/legacy_databricks_cli/configure/provider.py
{ "start": 1355, "end": 6827 }
class ____(RuntimeError): @staticmethod def for_profile(profile): if profile is None: return InvalidConfigurationError( "You haven't configured the CLI yet! " f"Please configure by entering `{sys.argv[0]} configure`" ) return InvalidConfigu...
InvalidConfigurationError
python
pytorch__pytorch
torch/_higher_order_ops/scan.py
{ "start": 18724, "end": 35974 }
class ____: """ Wraps over partitioned graph and encapsulates scan-specific implementation details """ def __init__( self, hop_partitioned_graph: HopPartitionedGraph, init, xs, additional_inputs ): self.hop_partitioned_graph = hop_partitioned_graph self.init = init s...
ScanAutogradImpl
python
xlwings__xlwings
xlwings/constants.py
{ "start": 79637, "end": 79775 }
class ____: xlPageBreakFull = 1 # from enum XlPageBreakExtent xlPageBreakPartial = 2 # from enum XlPageBreakExtent
PageBreakExtent
python
bokeh__bokeh
tests/unit/bokeh/core/property/test_datetime.py
{ "start": 1531, "end": 2482 }
class ____: def test_valid(self) -> None: prop = bcpd.Date() assert prop.is_valid(datetime.date(2020, 1,11)) assert prop.is_valid("2020-01-10") def test_invalid(self) -> None: prop = bcpd.Date() assert not prop.is_valid(None) assert not prop.is_valid(datetime.dat...
Test_Date
python
wandb__wandb
tests/system_tests/test_launch/test_launch_kubernetes.py
{ "start": 8060, "end": 8197 }
class ____: def __init__(self, pods): self.pods = pods @property def items(self): return self.pods
MockPodList
python
great-expectations__great_expectations
contrib/great_expectations_geospatial_expectations/great_expectations_geospatial_expectations/expectations/expect_column_average_lat_lon_pairwise_distance_to_be_less_than.py
{ "start": 1599, "end": 6376 }
class ____(ColumnAggregateExpectation): """Expect the average pairwise haversine distance between lat/lon points in a column is less than some value in km. This expectation will compute the pairwise haversine distance between each (latitude, longitude) pair and test that the average is less than some value in ...
ExpectColumnAverageLatLonPairwiseDistanceToBeLessThan
python
kamyu104__LeetCode-Solutions
Python/reverse-words-in-a-string.py
{ "start": 29, "end": 178 }
class ____(object): # @param s, a string # @return a string def reverseWords(self, s): return ' '.join(reversed(s.split()))
Solution
python
tensorflow__tensorflow
tensorflow/python/ops/numpy_ops/np_utils.py
{ "start": 7703, "end": 21463 }
class ____: pass def generate_link(flag, np_fun_name): """Generates link from numpy function name. Args: flag: the flag to control link form. See `set_np_doc_form`. np_fun_name: the numpy function name. Returns: A string. """ # Only adds link in this case if flag == 'dev': template = '...
NoLink
python
pallets__jinja
tests/test_regression.py
{ "start": 2089, "end": 22902 }
class ____: def test_keyword_folding(self, env): env = Environment() env.filters["testing"] = lambda value, some: value + some assert ( env.from_string("{{ 'test'|testing(some='stuff') }}").render() == "teststuff" ) def test_extends_output_bugs(self, env)...
TestBug
python
pytorch__pytorch
torch/distributions/constraints.py
{ "start": 12722, "end": 13159 }
class ____(Constraint): """ Constrain to a real half line `(lower_bound, inf]`. """ def __init__(self, lower_bound): self.lower_bound = lower_bound super().__init__() def check(self, value): return self.lower_bound < value def __repr__(self): fmt_string = self....
_GreaterThan
python
walkccc__LeetCode
solutions/1880. Check if Word Equals Summation of Two Words/1880.py
{ "start": 0, "end": 414 }
class ____: def isSumEqual( self, firstWord: str, secondWord: str, targetWord: str, ) -> bool: first = self._getNumber(firstWord) second = self._getNumber(secondWord) target = self._getNumber(targetWord) return first + second == target def _getNumber(self, word: str) -> in...
Solution
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/operators/ssm.py
{ "start": 5949, "end": 10244 }
class ____(AwsBaseOperator[SsmHook]): """ Retrieves the output and execution details of an SSM command invocation. This operator allows you to fetch the standard output, standard error, execution status, and other details from SSM commands. It can be used to retrieve output from commands executed b...
SsmGetCommandInvocationOperator
python
faif__python-patterns
patterns/dependency_injection.py
{ "start": 650, "end": 1046 }
class ____(object): def __init__(self): self.time_provider = datetime.datetime.now def get_current_time_as_html_fragment(self): current_time = self.time_provider() current_time_as_html_fragment = "<span class=\"tinyBoldText\">{}</span>".format(current_time) return current_time_...
TimeDisplay
python
ray-project__ray
python/ray/train/_internal/state/schema.py
{ "start": 5011, "end": 5093 }
class ____(BaseModel): train_runs: List[TrainRunInfoWithDetails]
TrainRunsResponse
python
apache__airflow
airflow-core/tests/unit/cli/commands/test_triggerer_command.py
{ "start": 987, "end": 3092 }
class ____: """ Tests the CLI interface and that it correctly calls the TriggererJobRunner """ @classmethod def setup_class(cls): cls.parser = cli_parser.get_parser() @mock.patch("airflow.cli.commands.triggerer_command.TriggererJobRunner") @mock.patch("airflow.cli.commands.triggere...
TestTriggererCommand
python
pytorch__pytorch
torch/_subclasses/_fake_tensor_utils.py
{ "start": 6567, "end": 8858 }
class ____: """ State used while building our cache key. """ # We track the SymNodes so when we get the output we can see if it exactly # matches one of the inputs so we can uncache it properly. sym_node_lookup: dict[int, int] # id(SymNode) -> index # This is a list of all seen input symp...
_CacheKeyState
python
palantir__python-language-server
test/plugins/test_definitions.py
{ "start": 236, "end": 1456 }
class ____(object): def __init__(self): self.members = dict() def add_member(self, id, name): self.members[id] = name """ def test_definitions(config, workspace): # Over 'a' in print a cursor_pos = {'line': 3, 'character': 6} # The definition of 'a' def_range = { 'sta...
Directory
python
dagster-io__dagster
python_modules/dagster/dagster/_utils/test/mysql_instance.py
{ "start": 1990, "end": 8283 }
class ____: @staticmethod def dagster_mysql_installed(): try: import dagster_mysql # noqa: F401 except ImportError: return False return True @staticmethod def get_hostname(env_name="MYSQL_TEST_DB_HOST"): # In buildkite we get the ip address from ...
TestMySQLInstance
python
numba__numba
numba/cuda/tests/cudapy/cache_usecases.py
{ "start": 1167, "end": 5036 }
class ____(UseCase): def _call(self, ret, *args): self._func[1, 1](ret, *args) @cuda.jit(cache=True) def add_usecase_kernel(r, x, y): r[()] = x[()] + y[()] + Z @cuda.jit(cache=False) def add_nocache_usecase_kernel(r, x, y): r[()] = x[()] + y[()] + Z add_usecase = CUDAUseCase(add_usecase_kernel...
CUDAUseCase
python
getsentry__sentry
tests/sentry/api/endpoints/test_project_symbol_sources.py
{ "start": 1764, "end": 3368 }
class ____(APITestCase): endpoint = "sentry-api-0-project-symbol-sources" method = "delete" def test_delete_successful(self) -> None: config = { "id": "honk", "name": "honk source", "layout": { "type": "native", }, "type": ...
ProjectSymbolSourcesDeleteTest
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 997221, "end": 998176 }
class ____(sgqlc.types.Type, Node): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("commit", "contexts", "state") commit = sgqlc.types.Field(Commit, graphql_name="commit") contexts = sgqlc.types.Field( sgqlc.types.non_null(StatusCheckRollupCont...
StatusCheckRollup
python
eventlet__eventlet
tests/greenio_test.py
{ "start": 29230, "end": 36146 }
class ____(tests.LimitedTestCase): TEST_TIMEOUT = 10 # the test here might take a while depending on the OS def test_multiple_readers(self): from eventlet.hubs.asyncio import Hub if isinstance(get_hub(), Hub): with pytest.raises(RuntimeError): debug.hub_prevent_mult...
TestGreenIoLong
python
pytorch__pytorch
test/distributed/_composable/fsdp/test_fully_shard_init.py
{ "start": 6018, "end": 6875 }
class ____(FSDPTestMultiThread): """Tests the ``mesh`` argument.""" @property def world_size(self) -> int: return 4 @skip_if_lt_x_gpu(1) def test_invalid_mesh_ndim(self): mesh = init_device_mesh(device_type.type, (self.world_size, 1, 1)) model = MLP(8) regex = r"ful...
TestFullyShardMeshArg
python
pytorch__pytorch
torch/distributions/fishersnedecor.py
{ "start": 376, "end": 3715 }
class ____(Distribution): r""" Creates a Fisher-Snedecor distribution parameterized by :attr:`df1` and :attr:`df2`. Example:: >>> # xdoctest: +IGNORE_WANT("non-deterministic") >>> m = FisherSnedecor(torch.tensor([1.0]), torch.tensor([2.0])) >>> m.sample() # Fisher-Snedecor-distrib...
FisherSnedecor
python
facebookresearch__faiss
faiss/gpu/test/test_cagra.py
{ "start": 379, "end": 3334 }
class ____(unittest.TestCase): def do_compute_GT(self, metric, numeric_type): d = 64 k = 12 if numeric_type == faiss.Int8: data_base_nt = np.random.randint( -128, 128, size=(10000, d), dtype=np.int8) data_query_nt = np.random.randint( ...
TestComputeGT
python
python-markdown__markdown
markdown/inlinepatterns.py
{ "start": 26112, "end": 26829 }
class ____(AsteriskProcessor): """Emphasis processor for handling strong and em matches inside underscores.""" PATTERNS = [ EmStrongItem(re.compile(EM_STRONG2_RE, re.DOTALL | re.UNICODE), 'double', 'strong,em'), EmStrongItem(re.compile(STRONG_EM2_RE, re.DOTALL | re.UNICODE), 'double', 'em,stron...
UnderscoreProcessor
python
pandas-dev__pandas
pandas/core/internals/managers.py
{ "start": 66776, "end": 86289 }
class ____(BaseBlockManager): """manage a single block with""" @property def ndim(self) -> Literal[1]: return 1 _is_consolidated = True _known_consolidated = True __slots__ = () is_single_block = True def __init__( self, block: Block, axis: Index, ...
SingleBlockManager
python
pola-rs__polars
py-polars/src/polars/datatypes/classes.py
{ "start": 9400, "end": 9470 }
class ____(SignedIntegerType): """8-bit signed integer type."""
Int8
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/freshness_policy.py
{ "start": 1013, "end": 8813 }
class ____( NamedTuple( "_FreshnessPolicy", [ ("maximum_lag_minutes", float), ("cron_schedule", Optional[str]), ("cron_schedule_timezone", Optional[str]), ], ) ): """A LegacyFreshnessPolicy specifies how up-to-date you want a given asset to be. ...
LegacyFreshnessPolicy
python
mlflow__mlflow
tests/genai/evaluate/test_utils.py
{ "start": 4943, "end": 19018 }
class ____: @mlflow.trace(span_type=SpanType.AGENT) def predict(self, question: str) -> str: response = self.call_llm(messages=[{"role": "user", "content": question}]) return response["choices"][0]["message"]["content"] @mlflow.trace(span_type=SpanType.LLM) def call_llm(self, messages: ...
TestModel
python
openai__openai-python
src/openai/types/beta/assistant_deleted.py
{ "start": 193, "end": 301 }
class ____(BaseModel): id: str deleted: bool object: Literal["assistant.deleted"]
AssistantDeleted
python
cython__cython
tests/run/test_asyncgen.py
{ "start": 12960, "end": 36108 }
class ____(unittest.TestCase): def setUp(self): self.loop = asyncio.new_event_loop() asyncio.set_event_loop(None) def tearDown(self): self.loop.close() self.loop = None async def to_list(self, gen): res = [] async for i in gen: res.append(i) ...
AsyncGenAsyncioTest
python
google__jax
jax/_src/state/indexing.py
{ "start": 4886, "end": 13929 }
class ____: indices: tuple[DimIndexer, ...] shape: tuple[int, ...] int_indexer_shape: tuple[int | Array, ...] # Off by default to avoid doing validation during pytree operations. validate: bool = False def __post_init__(self): if len(self.indices) != len(self.shape): raise ValueError( f...
NDIndexer
python
fluentpython__example-code
attic/iterables/almost_aritprog_v0.py
{ "start": 383, "end": 831 }
class ____(abc.Iterator): def __init__(self, arithmetic_progression): self._ap = arithmetic_progression self._index = 0 def __next__(self): first = type(self._ap.begin + self._ap.step)(self._ap.begin) result = first + self._ap.step * self._index if result < self._ap.end...
ArithmeticProgressionIterator
python
tensorflow__tensorflow
tensorflow/python/training/monitored_session_test.py
{ "start": 11188, "end": 18929 }
class ____(test.TestCase): """Tests MonitoredTrainingSession.""" def test_saving_restoring_checkpoint(self): logdir = _test_dir(self.get_temp_dir(), 'test_saving_restoring_checkpoint') with ops.Graph().as_default(): gstep = training_util.get_or_create_global_step() do_step = state_ops.assign_ad...
MonitoredTrainingSessionTest
python
scrapy__scrapy
tests/test_utils_python.py
{ "start": 2585, "end": 6179 }
class ____: def test_converting_a_unicode_object_to_an_utf_8_encoded_string(self): assert to_bytes("\xa3 49") == b"\xc2\xa3 49" def test_converting_a_unicode_object_to_a_latin_1_encoded_string(self): assert to_bytes("\xa3 49", "latin-1") == b"\xa3 49" def test_converting_a_regular_bytes_to...
TestToBytes
python
pexpect__pexpect
tests/test_isalive.py
{ "start": 1061, "end": 4611 }
class ____(PexpectTestCase.PexpectTestCase): """Various tests for the running status of processes.""" def test_expect_wait(self): """Ensure consistency in wait() and isalive().""" p = pexpect.spawn('sleep 1') assert p.isalive() assert p.wait() == 0 assert not p.isalive()...
IsAliveTestCase
python
pytorch__pytorch
torch/_dynamo/variables/functions.py
{ "start": 94843, "end": 95185 }
class ____(VariableTracker): # We don't track traceback. A call to any function in this module is a no-op def call_function( # type: ignore[empty-body] self, tx: "InstructionTranslator", args: Sequence[VariableTracker], kwargs: dict[str, VariableTracker], ) -> VariableTracke...
TracebackVariable
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/methodOverride3.py
{ "start": 961, "end": 1030 }
class ____(Generic[_T_E]): def func1(self, a: _T_E) -> None: ...
E1
python
django__django
django/forms/forms.py
{ "start": 15679, "end": 16132 }
class ____(BaseForm, metaclass=DeclarativeFieldsMetaclass): "A collection of Fields, plus their associated data." # This is a separate class from BaseForm in order to abstract the way # self.fields is specified. This class (Form) is the one that does the # fancy metaclass stuff purely for the semantic ...
Form
python
doocs__leetcode
solution/0700-0799/0761.Special Binary String/Solution.py
{ "start": 0, "end": 435 }
class ____: def makeLargestSpecial(self, s: str) -> str: if s == '': return '' ans = [] cnt = 0 i = j = 0 while i < len(s): cnt += 1 if s[i] == '1' else -1 if cnt == 0: ans.append('1' + self.makeLargestSpecial(s[j + 1 : i]) ...
Solution
python
PrefectHQ__prefect
src/prefect/server/schemas/filters.py
{ "start": 27804, "end": 28300 }
class ____(PrefectFilterBaseModel): """Filter by `TaskRun.id`.""" any_: Optional[list[UUID]] = Field( default=None, description="A list of task run ids to include" ) def _get_filter_list( self, db: "PrefectDBInterface" ) -> Iterable[sa.ColumnExpressionArgument[bool]]: filte...
TaskRunFilterId
python
pandas-dev__pandas
pandas/io/formats/format.py
{ "start": 61237, "end": 66877 }
class ____: """ Formats float values according to engineering format. Based on matplotlib.ticker.EngFormatter """ # The SI engineering prefixes ENG_PREFIXES = { -24: "y", -21: "z", -18: "a", -15: "f", -12: "p", -9: "n", -6: "u", -...
EngFormatter
python
dagster-io__dagster
python_modules/dagster-pipes/dagster_pipes/__init__.py
{ "start": 33576, "end": 33925 }
class ____(PipesMessageWriterChannel): """Message writer channel that writes one message per line to a `TextIO` stream.""" def __init__(self, stream: TextIO): self._stream = stream def write_message(self, message: PipesMessage) -> None: self._stream.writelines((json.dumps(message), "\n")) ...
PipesStreamMessageWriterChannel
python
getsentry__sentry
src/sentry/sentry_apps/api/parsers/sentry_app.py
{ "start": 852, "end": 1229 }
class ____(serializers.Field): def to_internal_value(self, data): valid_scopes = ApiScopes() if data is None: return for scope in data: if scope not in valid_scopes: raise ValidationError(f"{scope} not a valid scope") return data @extend_sc...
ApiScopesField
python
getsentry__sentry
src/sentry/integrations/bitbucket_server/integration.py
{ "start": 5620, "end": 6336 }
class ____: """ Collect the OAuth client credentials from the user. """ def dispatch(self, request: HttpRequest, pipeline: IntegrationPipeline) -> HttpResponseBase: if request.method == "POST": form = InstallationForm(request.POST) if form.is_valid(): for...
InstallationConfigView
python
scipy__scipy
scipy/stats/tests/test_distributions.py
{ "start": 39454, "end": 47007 }
class ____: def test_pdf_r(self): # test against R package GeneralizedHyperbolic # x <- seq(-10, 10, length.out = 10) # GeneralizedHyperbolic::dghyp( # x = x, lambda = 2, alpha = 2, beta = 1, delta = 1.5, mu = 0.5 # ) vals_R = np.array([ 2.948956782753...
TestGenHyperbolic
python
coleifer__peewee
peewee.py
{ "start": 161070, "end": 161435 }
class ____(AutoField): def __init__(self, *args, **kwargs): __deprecated__('"PrimaryKeyField" has been renamed to "AutoField". ' 'Please update your code accordingly as this will be ' 'completely removed in a subsequent release.') super(PrimaryKeyField, ...
PrimaryKeyField
python
scikit-learn__scikit-learn
sklearn/multiclass.py
{ "start": 35797, "end": 44511 }
class ____(MetaEstimatorMixin, ClassifierMixin, BaseEstimator): """(Error-Correcting) Output-Code multiclass strategy. Output-code based strategies consist in representing each class with a binary code (an array of 0s and 1s). At fitting time, one binary classifier per bit in the code book is fitted. ...
OutputCodeClassifier
python
openai__openai-python
src/openai/resources/audio/transcriptions.py
{ "start": 25396, "end": 49666 }
class ____(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTranscriptionsWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https:/...
AsyncTranscriptions
python
getsentry__sentry
src/sentry/sentry_apps/external_issues/external_issue_creator.py
{ "start": 450, "end": 1898 }
class ____: install: RpcSentryAppInstallation group: Group web_url: str project: str identifier: str def run(self) -> PlatformExternalIssue: try: with transaction.atomic(using=router.db_for_write(PlatformExternalIssue)): display_name = f"{escape(self.project)...
ExternalIssueCreator
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/test_cloud_run.py
{ "start": 11879, "end": 12755 }
class ____: def test_template_fields(self): operator = CloudRunDeleteJobOperator( task_id=TASK_ID, project_id=PROJECT_ID, region=REGION, job_name=JOB_NAME ) _assert_common_template_fields(operator.template_fields) assert "job_name" in operator.template_fields @mock....
TestCloudRunDeleteJobOperator
python
huggingface__transformers
src/transformers/models/audioflamingo3/modeling_audioflamingo3.py
{ "start": 17435, "end": 26023 }
class ____(AudioFlamingo3PreTrainedModel, GenerationMixin): _keep_in_fp32_modules_strict = None _tp_plan = None _pp_plan = None def __init__(self, config): super().__init__(config) self.vocab_size = config.text_config.vocab_size self.audio_tower = AutoModel.from_config(config.au...
AudioFlamingo3ForConditionalGeneration
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/sensors/test_eks.py
{ "start": 7398, "end": 9902 }
class ____: @pytest.fixture(autouse=True) def _setup_test_cases(self): self.target_state = NodegroupStates.ACTIVE self.sensor = EksNodegroupStateSensor( task_id=TASK_ID, cluster_name=CLUSTER_NAME, nodegroup_name=NODEGROUP_NAME, target_state=self.ta...
TestEksNodegroupStateSensor
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/constructor15.py
{ "start": 290, "end": 414 }
class ____(Generic[_M, _N]): def __new__(cls, m: _M, n: _N) -> "A[_M, _N]": ... a: A[Literal[3], Literal[4]] = A(3, 4)
A
python
numpy__numpy
numpy/_core/tests/test_ufunc.py
{ "start": 2011, "end": 6389 }
class ____: """Test generic loops. The loops to be tested are: PyUFunc_ff_f_As_dd_d PyUFunc_ff_f PyUFunc_dd_d PyUFunc_gg_g PyUFunc_FF_F_As_DD_D PyUFunc_DD_D PyUFunc_FF_F PyUFunc_GG_G PyUFunc_OO_O PyUFunc_OO_O_method PyUFun...
TestUfuncGenericLoops
python
django__django
tests/check_framework/test_security.py
{ "start": 9723, "end": 11045 }
class ____(SimpleTestCase): @override_settings( MIDDLEWARE=["django.middleware.security.SecurityMiddleware"], SECURE_HSTS_PRELOAD=False, SECURE_HSTS_SECONDS=3600, ) def test_no_sts_preload(self): """ Warn if SECURE_HSTS_PRELOAD isn't True. """ self.ass...
CheckStrictTransportSecurityPreloadTest
python
altair-viz__altair
altair/vegalite/v6/schema/channels.py
{ "start": 1016103, "end": 1037431 }
class ____(FieldChannelMixin, core.ScaleFieldDef): r""" XOffset schema wrapper. Parameters ---------- shorthand : str, dict, Sequence[str], :class:`RepeatRef` shorthand for field, aggregate, and type aggregate : dict, :class:`Aggregate`, :class:`ArgmaxDef`, :class:`ArgminDef`, :class:`N...
XOffset
python
pallets__itsdangerous
src/itsdangerous/url_safe.py
{ "start": 313, "end": 1950 }
class ____(Serializer[str]): """Mixed in with a regular serializer it will attempt to zlib compress the string to make it shorter if necessary. It will also base64 encode the string so that it can safely be placed in a URL. """ default_serializer: _PDataSerializer[str] = _CompactJSON def load_...
URLSafeSerializerMixin
python
apache__airflow
task-sdk/src/airflow/sdk/api/datamodels/_generated.py
{ "start": 3972, "end": 4091 }
class ____(BaseModel): """ Schema for DAG Run State response. """ state: DagRunState
DagRunStateResponse
python
altair-viz__altair
altair/vegalite/v6/schema/core.py
{ "start": 258533, "end": 259804 }
class ____( ConditionalValueDefGradientstringnullExprRef ): """ ConditionalParameterValueDefGradientstringnullExprRef schema wrapper. Parameters ---------- param : str, :class:`ParameterName` Filter using a parameter name. value : str, dict, :class:`ExprRef`, :class:`Gradient`, :cla...
ConditionalParameterValueDefGradientstringnullExprRef
python
ray-project__ray
python/ray/data/tests/test_dataset_validation.py
{ "start": 1345, "end": 2973 }
class ____(Exception): """Custom exception used in test_warning_execute_with_no_cpu() and test_nowarning_execute_with_cpu(). Raised when the `logger.warning` method is called, so that we can kick out of `plan.execute()` by catching this Exception and check logging was done properly.""" pass def t...
LoggerWarningCalled
python
giampaolo__psutil
tests/test_testutils.py
{ "start": 13752, "end": 14214 }
class ____(PsutilTestCase): def test_process_namespace(self): p = psutil.Process() ns = process_namespace(p) ns.test() fun = next(x for x in ns.iter(ns.getters) if x[1] == 'ppid')[0] assert fun() == p.ppid() def test_system_namespace(self): ns = system_namespace(...
TestTestingUtils
python
kubernetes-client__python
kubernetes/client/models/v2_container_resource_metric_source.py
{ "start": 383, "end": 5694 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attri...
V2ContainerResourceMetricSource
python
pytorch__pytorch
torch/_inductor/compile_fx.py
{ "start": 5529, "end": 25565 }
class ____: mode: FxCompileMode use_async: bool use_progressive: bool def _fx_compile_mode_default() -> FxCompileConfig: name = "TORCHINDUCTOR_FX_COMPILE_MODE" value = os.environ.get(name) if value is None: return FxCompileConfig(FxCompileMode.NORMAL, False, False) use_async = Fal...
FxCompileConfig
python
automl__auto-sklearn
autosklearn/metrics/__init__.py
{ "start": 3831, "end": 5977 }
class ____(Scorer): def __call__( self, y_true: np.ndarray, y_pred: np.ndarray, *, X_data: Optional[SUPPORTED_XDATA_TYPES] = None, sample_weight: Optional[List[float]] = None, ) -> float: """Evaluate predicted probabilities for X relative to y_true. ...
_ProbaScorer
python
has2k1__plotnine
plotnine/guides/guide_legend.py
{ "start": 913, "end": 10894 }
class ____(guide): """ Legend guide """ nrow: Optional[int] = None """Number of rows of legends.""" ncol: Optional[int] = None """Number of columns of legends.""" byrow: bool = False """Whether to fill the legend row-wise or column-wise.""" override_aes: dict[str, Any] = fiel...
guide_legend
python
PyCQA__pylint
tests/functional/i/invalid/invalid_str_returned.py
{ "start": 522, "end": 581 }
class ____: """Str through the metaclass."""
ThirdGoodStr
python
getsentry__sentry
src/sentry/ingest/inbound_filters.py
{ "start": 7529, "end": 14864 }
class ____(_FilterSerializer): subfilters = serializers.MultipleChoiceField( help_text=""" Specifies which legacy browser filters should be active. Anything excluded from the list will be disabled. The options are: - `ie` - Internet Explorer Version 11 and lower - `edge` - Edge Version 18 and lower - `safar...
_LegacyBrowserFilterSerializer
python
getsentry__sentry
tests/sentry/middleware/test_access_log_middleware.py
{ "start": 1215, "end": 2282 }
class ____(Endpoint): permission_classes = (AllowAny,) def get(self, request): # Rate limit middleware will set metadata to indicate the request is not limited by the endpoint itself request._request.rate_limit_metadata = RateLimitMeta( rate_limit_type=RateLimitType.NOT_LIMITED, ...
SnubaRateLimitedEndpoint
python
huggingface__transformers
src/transformers/models/d_fine/modeling_d_fine.py
{ "start": 84948, "end": 85709 }
class ____(nn.Module): def __init__(self, input_dim: int, hidden_dim: int, output_dim: int, num_layers: int, act: str = "relu"): super().__init__() self.num_layers = num_layers hidden_dims = [hidden_dim] * (num_layers - 1) input_dims = [input_dim] + hidden_dims output_dims = ...
DFineMLP
python
PyCQA__pylint
tests/functional/r/regression/regression_property_no_member_844.py
{ "start": 268, "end": 393 }
class ____(Parent): @Parent.thing.getter def thing(self): return super().thing + '!' print(Child().thing)
Child
python
python-excel__xlwt
xlwt/BIFFRecords.py
{ "start": 16763, "end": 19775 }
class ____(BiffRecord): """ This record stores the text encoding used to write byte strings, stored as MS Windows code page identifier. The CODEPAGE record in BIFF8 always contains the code page 1200 (UTF-16). Therefore it is not possible to obtain the encoding used for a protection passwor...
CodepageBiff8Record
python
numpy__numpy
numpy/matrixlib/tests/test_defmatrix.py
{ "start": 10341, "end": 12399 }
class ____: a = matrix([[1, 2], [3, 4]]) def test_dimesions(self): a = self.a x = a[0] assert_equal(x.ndim, 2) def test_array_from_matrix_list(self): a = self.a x = np.array([a, a]) assert_equal(x.shape, [2, 2, 2]) def test_array_to_list(self): ...
TestNewScalarIndexing
python
tornadoweb__tornado
tornado/test/web_test.py
{ "start": 77356, "end": 77901 }
class ____(SimpleHandlerTestCase): class Handler(RequestHandler): def get(self): try: self.get_argument("foo") self.write({}) except MissingArgumentError as e: self.write({"arg_name": e.arg_name, "log_message": e.log_message}) def ...
GetArgumentErrorTest
python
crytic__slither
slither/core/expressions/super_call_expression.py
{ "start": 70, "end": 122 }
class ____(CallExpression): pass
SuperCallExpression
python
patrick-kidger__equinox
equinox/nn/_conv.py
{ "start": 10583, "end": 11539 }
class ____(Conv): """As [`equinox.nn.Conv`][] with `num_spatial_dims=2`.""" def __init__( self, in_channels: int, out_channels: int, kernel_size: int | Sequence[int], stride: int | Sequence[int] = (1, 1), padding: str | int | Sequence[int] | Sequence[tuple[int, i...
Conv2d
python
Netflix__metaflow
metaflow/plugins/cards/card_modules/basic.py
{ "start": 7810, "end": 8206 }
class ____(DefaultComponent): type = "pythonCode" def __init__(self, data=None): super().__init__(title=None, subtitle=None) self._data = data def render(self): datadict = super().render() datadict["data"] = self._data if self.component_id is not None: ...
PythonCodeComponent
python
sqlalchemy__sqlalchemy
test/sql/test_types.py
{ "start": 5225, "end": 13492 }
class ____(fixtures.TestBase): @testing.combinations(((t,) for t in _types_for_mod(types)), id_="n") def test_uppercase_importable(self, typ): if typ.__name__ == typ.__name__.upper(): assert getattr(sa, typ.__name__) is typ assert typ.__name__ in dir(types) @testing.combinat...
AdaptTest
python
aio-libs__aiohttp
aiohttp/web_exceptions.py
{ "start": 4981, "end": 5041 }
class ____(HTTPSuccessful): status_code = 202
HTTPAccepted
python
google__jax
jax/experimental/jax2tf/tests/flax_models/transformer_nlp_seq.py
{ "start": 5790, "end": 6776 }
class ____(nn.Module): """Transformer Model for sequence tagging.""" config: TransformerConfig @nn.compact def __call__(self, inputs, *, train): """Applies Transformer model on the inputs. Args: inputs: input data train: if it is training. Returns: output of a transformer encod...
Transformer
python
readthedocs__readthedocs.org
readthedocs/api/v2/adapters.py
{ "start": 120, "end": 704 }
class ____: """ Adapter to inject ``timeout`` to all the requests. Allows us to not wait forever when querying our API internally from the builders and make the build fail faster if it goes wrong. https://2.python-requests.org/page/user/advanced/#transport-adapters https://2.python-requests.or...
TimeoutAdapter
python
numba__numba
numba/tests/test_parfors.py
{ "start": 116551, "end": 122941 }
class ____(TestParforsBase): def generate_prange_func(self, pyfunc, patch_instance): """ This function does the actual code augmentation to enable the explicit testing of `prange` calls in place of `range`. """ pyfunc_code = pyfunc.__code__ prange_names = list(pyfun...
TestPrangeBase
python
modin-project__modin
setup.py
{ "start": 1216, "end": 2392 }
class ____(cmdclass["sdist"]): def make_distribution(self): self.filelist.extend(extra_files) return super().make_distribution() cmdclass["build_py"] = AddPthFileBuild cmdclass["sdist"] = AddPthFileSDist setup( name="modin", version=versioneer.get_version(), cmdclass=cmdclass, des...
AddPthFileSDist
python
tensorflow__tensorflow
tensorflow/python/training/saver_test.py
{ "start": 132980, "end": 137598 }
class ____(test.TestCase): # TODO(allenl): Track down python3 reference cycles in these tests. @test_util.run_in_graph_and_eager_modes def testNotSaveableButIsTrackable(self): v = _OwnsAVariableSimple() test_dir = self.get_temp_dir() prefix = os.path.join(test_dir, "ckpt") for saver in (saver_mod...
TrackableCompatibilityTests
python
altair-viz__altair
altair/vegalite/v6/schema/_typing.py
{ "start": 4068, "end": 23651 }
class ____(TypedDict, total=False): bottom: float left: float right: float top: float Temporal: TypeAlias = Union[date, datetime] VegaThemes: TypeAlias = Literal[ "carbong10", "carbong100", "carbong90", "carbonwhite", "dark", "excel", "fivethirtyeight", "ggplot2", ...
PaddingKwds
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/links/workflows.py
{ "start": 1712, "end": 1920 }
class ____(BaseGoogleLink): """Helper class for constructing Workflows Execution Link.""" name = "Workflow Execution" key = "workflow_execution" format_str = EXECUTION_LINK
WorkflowsExecutionLink
python
airbytehq__airbyte
airbyte-integrations/connectors/source-facebook-marketing/unit_tests/integration/pagination.py
{ "start": 304, "end": 934 }
class ____(PaginationStrategy): def __init__(self, request: HttpRequest, next_page_token: str) -> None: self._next_page_token = next_page_token self._next_page_url = f"{urlunparse(request._parsed_url)}&after={self._next_page_token}" def update(self, response: Dict[str, Any]) -> None: # ...
FacebookMarketingPaginationStrategy
python
getsentry__sentry
src/sentry/auth/providers/fly/client.py
{ "start": 223, "end": 394 }
class ____(Exception): def __init__(self, message: str | bytes = "", status: int = 0) -> None: super().__init__(message) self.status = status
FlyApiError
python
pytorch__pytorch
torch/_inductor/cudagraph_utils.py
{ "start": 6917, "end": 8459 }
class ____: value: Optional[int] def set(self, device_idx: Optional[int]) -> None: assert device_idx is None or isinstance(device_idx, int) self.value = device_idx def check_for_mutation_ignore_cuda_graph_managed_tensor( gm: torch.fx.GraphModule, mutated_inputs: OrderedSet[str], m...
BoxedDeviceIndex
python
run-llama__llama_index
llama-index-packs/llama-index-packs-nebulagraph-query-engine/llama_index/packs/nebulagraph_query_engine/base.py
{ "start": 6068, "end": 7300 }
class ____(BaseRetriever): """Custom retriever that performs both Vector search and Knowledge Graph search.""" def __init__( self, vector_retriever: VectorIndexRetriever, kg_retriever: KGTableRetriever, mode: str = "OR", ) -> None: """Init params.""" self._ve...
CustomRetriever
python
kubernetes-client__python
kubernetes/client/models/v1_persistent_volume_claim.py
{ "start": 383, "end": 7526 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attri...
V1PersistentVolumeClaim
python
sympy__sympy
sympy/functions/special/zeta_functions.py
{ "start": 13012, "end": 18389 }
class ____(DefinedFunction): r""" Hurwitz zeta function (or Riemann zeta function). Explanation =========== For $\operatorname{Re}(a) > 0$ and $\operatorname{Re}(s) > 1$, this function is defined as .. math:: \zeta(s, a) = \sum_{n=0}^\infty \frac{1}{(n + a)^s}, where the standard cho...
zeta
python
pytorch__pytorch
torch/_inductor/ops_handler.py
{ "start": 34947, "end": 36258 }
class ____(WrapperHandler): """Wraps the underlying handler with a CSE pass NOTE: Compared to codegen level CSE this is simplified as it doesn't support stores which require load cache invalidation. """ def __init__(self, inner: Any): super().__init__(inner) self.cse_cache: dict[st...
SimpleCSEHandler
python
pyodide__pyodide
src/py/_pyodide/_core_docs.py
{ "start": 41497, "end": 41612 }
class ____(Exception): """An error thrown when conversion between JavaScript and Python fails."""
ConversionError
python
apache__airflow
providers/google/src/airflow/providers/google/leveldb/operators/leveldb.py
{ "start": 1077, "end": 3827 }
class ____(BaseOperator): """ Execute command in LevelDB. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:LevelDBOperator` :param command: command of plyvel(python wrap for leveldb) for DB object e.g. ``"put"...
LevelDBOperator
python
getsentry__sentry
tests/sentry/workflow_engine/processors/test_data_condition_group.py
{ "start": 1071, "end": 4122 }
class ____(TestCase): def test_process_data_condition_group__exists__fails(self) -> None: data_condition_group = self.create_data_condition_group() self.create_data_condition( condition_group=data_condition_group, type=Condition.GREATER, comparison=5 ) expected_result = ...
TestProcessDataConditionGroup
python
pytorch__pytorch
benchmarks/tensorexpr/pt_engine.py
{ "start": 15, "end": 2340 }
class ____: def rand(self, shape, device=None, dtype=None, requires_grad=False): return torch.rand( shape, device=device, dtype=dtype, requires_grad=requires_grad ) def randn(self, shape, device=None, dtype=None, requires_grad=False): return torch.randn( shape, d...
TorchTensorEngine
python
apache__airflow
providers/google/tests/unit/google/cloud/hooks/test_dataproc.py
{ "start": 44296, "end": 49346 }
class ____: def setup_method(self) -> None: self.job_type = "test" self.builder = DataProcJobBuilder( project_id=GCP_PROJECT, task_id=TASK_ID, cluster_name=CLUSTER_NAME, job_type=self.job_type, properties={"test": "test"}, ) @p...
TestDataProcJobBuilder
python
rq__rq
rq/registry.py
{ "start": 23520, "end": 24597 }
class ____(BaseRegistry): key_template = 'rq:canceled:{0}' def get_expired_job_ids(self, timestamp: Optional[float] = None): raise NotImplementedError def clean_registries(queue: 'Queue', exception_handlers: Optional[list] = None): """Cleans StartedJobRegistry, FinishedJobRegistry and FailedJobRe...
CanceledJobRegistry