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
dagster-io__dagster
python_modules/dagster/dagster/_utils/aiodataloader.py
{ "start": 1007, "end": 1277 }
class ____(Generic[KeyT, ReturnT]): def __init__( self, batch_load_fn: Callable[[Iterable[KeyT]], Coroutine[Any, Any, Iterable[ReturnT]]], max_batch_size: Optional[int] = None, ): self.max_batch_size = max_batch_size
_BaseDataLoader
python
pydantic__pydantic
tests/mypy/outputs/mypy-plugin_ini/decorator_implicit_classmethod.py
{ "start": 181, "end": 1099 }
class ____(BaseModel): a: int @field_validator('a') def f_val(cls, value: int) -> int: reveal_type(cls) # MYPY: note: Revealed type is "type[tests.mypy.modules.decorator_implicit_classmethod.Model]" return value @model_validator(mode='before') def m_val_before(cls, values: dict[str...
Model
python
numba__numba
numba/tests/test_npdatetime.py
{ "start": 8983, "end": 21434 }
class ____(TestCase): jitargs = dict(forceobj=True) def jit(self, pyfunc): return jit(**self.jitargs)(pyfunc) def test_add(self): f = self.jit(add_usecase) def check(a, b, expected): self.assertPreciseEqual(f(a, b), expected) self.assertPreciseEqual(f(b, a)...
TestTimedeltaArithmetic
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/hooks/dataproc.py
{ "start": 52843, "end": 87303 }
class ____(GoogleBaseAsyncHook): """ Asynchronous interaction with Google Cloud Dataproc APIs. All the methods in the hook where project_id is used must be called with keyword arguments rather than positional. """ sync_hook_class = DataprocHook def __init__( self, gcp_conn...
DataprocAsyncHook
python
getsentry__sentry
src/sentry/users/services/user_option/model.py
{ "start": 315, "end": 500 }
class ____(RpcModel): id: int = -1 user_id: int = -1 value: Any = None key: str = "" project_id: int | None = None organization_id: int | None = None
RpcUserOption
python
airbytehq__airbyte
airbyte-integrations/connectors/source-iterable/source_iterable/streams.py
{ "start": 17985, "end": 18102 }
class ____(IterableExportEventsStreamAdjustableRange): data_field = "inboxMessageImpression"
InboxMessageImpression
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/cloud_batch.py
{ "start": 7699, "end": 10084 }
class ____(GoogleCloudBaseOperator): """ List Cloud Batch jobs. :param project_id: Required. The ID of the Google Cloud project that the service belongs to. :param region: Required. The ID of the Google Cloud region that the service belongs to. :param gcp_conn_id: The connection ID used to connect ...
CloudBatchListJobsOperator
python
kevin1024__vcrpy
vcr/errors.py
{ "start": 0, "end": 1849 }
class ____(Exception): def __init__(self, *args, **kwargs): self.cassette = kwargs["cassette"] self.failed_request = kwargs["failed_request"] message = self._get_message(kwargs["cassette"], kwargs["failed_request"]) super().__init__(message) @staticmethod def _get_message(ca...
CannotOverwriteExistingCassetteException
python
PrefectHQ__prefect
src/integrations/prefect-dbt/tests/cloud/test_jobs.py
{ "start": 17421, "end": 24020 }
class ____: async def test_run_steps_override_error(self, dbt_cloud_credentials): with pytest.raises(ValueError, match="Do not set `steps_override"): await retry_dbt_cloud_job_run_subset_and_wait_for_completion( dbt_cloud_credentials=dbt_cloud_credentials, trigger...
TestRetryDbtCloudRunJobSubsetAndWaitForCompletion
python
apache__airflow
providers/apache/flink/tests/unit/apache/flink/sensors/test_flink_kubernetes.py
{ "start": 38775, "end": 54014 }
class ____: @pytest.fixture(autouse=True) def setup_connections(self, create_connection_without_db): create_connection_without_db( Connection(conn_id="kubernetes_default", conn_type="kubernetes", extra=json.dumps({})) ) create_connection_without_db( Connection( ...
TestFlinkKubernetesSensor
python
PyCQA__pylint
tests/functional/u/used/used_before_assignment_py311.py
{ "start": 247, "end": 541 }
class ____(Enum): """A lovely enum.""" VAL1 = 1 VAL2 = 2 def do_thing(val: MyEnum) -> None: """Do a thing.""" if val is MyEnum.VAL1: note = 'got 1' elif val is MyEnum.VAL2: note = 'got 2' else: assert_never(val) print('Note:', note)
MyEnum
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/triggers/bedrock.py
{ "start": 5423, "end": 7332 }
class ____(AwsBaseWaiterTrigger): """ Trigger when a Bedrock ingestion job reaches the COMPLETE state. :param knowledge_base_id: The unique identifier of the knowledge base for which to get information. :param data_source_id: The unique identifier of the data source in the ingestion job. :param ing...
BedrockIngestionJobTrigger
python
altair-viz__altair
altair/vegalite/v6/schema/core.py
{ "start": 1480339, "end": 1480566 }
class ____(TopLevelSpec): """TopLevelRepeatSpec schema wrapper.""" _schema = {"$ref": "#/definitions/TopLevelRepeatSpec"} def __init__(self, *args, **kwds): super().__init__(*args, **kwds)
TopLevelRepeatSpec
python
tensorflow__tensorflow
tensorflow/python/compiler/mlir/mlir_test.py
{ "start": 1214, "end": 4233 }
class ____(test.TestCase): def testImport(self): """Tests the basic flow of `tf.mlir.experimental.convert_graph_def`.""" mlir_module = mlir.convert_graph_def('') # An empty graph should contain at least an empty main function. self.assertIn('func @main', mlir_module) def testInvalidPbtxt(self): ...
MLIRGraphDefImportTest
python
spack__spack
lib/spack/spack/test/cmd/uninstall.py
{ "start": 7303, "end": 15146 }
class ____: """Tests an installation with two environments e1 and e2, which each have shared package installations: e1 has diamond-link-left -> diamond-link-bottom e2 has diamond-link-right -> diamond-link-bottom """ env = SpackCommand("env") add = SpackCommand("add") concretize = Spa...
TestUninstallFromEnv
python
milvus-io__pymilvus
pymilvus/client/abstract.py
{ "start": 6159, "end": 7480 }
class ____: def __init__(self, raw: Any): self._raw = raw self.name = None self.description = None self.type = None self.params = {} self.input_field_names = [] self.input_field_ids = [] self.output_field_names = [] self.output_field_ids = [] ...
FunctionSchema
python
great-expectations__great_expectations
contrib/great_expectations_zipcode_expectations/great_expectations_zipcode_expectations/expectations/expect_column_values_to_be_valid_missouri_zip.py
{ "start": 747, "end": 1751 }
class ____(ColumnMapMetricProvider): # This is the id string that will be used to reference your metric. condition_metric_name = "column_values.valid_missouri_zip" # This method implements the core logic for the PandasExecutionEngine @column_condition_partial(engine=PandasExecutionEngine) def _pand...
ColumnValuesToBeValidMissouriZip
python
ray-project__ray
python/ray/dashboard/modules/job/tests/test_cli.py
{ "start": 17533, "end": 18048 }
class ____: def test_address(self, mock_sdk_client): _job_cli_group_test_address(mock_sdk_client, "delete", "fake_job_id") def test_delete(self, mock_sdk_client): runner = CliRunner() mock_client_instance = mock_sdk_client.return_value with set_env_var("RAY_ADDRESS", "env_addr"...
TestDelete
python
dagster-io__dagster
python_modules/dagster/dagster/components/testing/utils.py
{ "start": 4265, "end": 14297 }
class ____: """A sandbox for testing components. This sandbox provides a number of utilities for scaffolding, modifying, and loading components from a temporary defs folder. This makes it easy to test components in isolation. """ project_root: Path defs_folder_path: Path project_name: str ...
DefsFolderSandbox
python
numpy__numpy
numpy/_core/tests/test_scalar_ctors.py
{ "start": 2336, "end": 2807 }
class ____: def test_intp(self): # Ticket #99 assert_equal(1024, np.intp(1024)) def test_uint64_from_negative(self): with pytest.raises(OverflowError): np.uint64(-2) int_types = [np.byte, np.short, np.intc, np.long, np.longlong] uint_types = [np.ubyte, np.ushort, np.uintc,...
TestFromInt
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/translate.py
{ "start": 6082, "end": 12018 }
class ____(GoogleCloudBaseOperator): """ Translate text content of moderate amount, for larger volumes of text please use the TranslateTextBatchOperator. Wraps the Google cloud Translate Text (Advanced) functionality. See https://cloud.google.com/translate/docs/advanced/translating-text-v3 For mor...
TranslateTextOperator
python
django__django
tests/admin_views/test_nav_sidebar.py
{ "start": 313, "end": 814 }
class ____(admin.AdminSite): enable_nav_sidebar = False site_with_sidebar = AdminSiteWithSidebar(name="test_with_sidebar") site_without_sidebar = AdminSiteWithoutSidebar(name="test_without_sidebar") site_with_sidebar.register(User) site_with_sidebar.register(Héllo) urlpatterns = [ path("test_sidebar/admin/"...
AdminSiteWithoutSidebar
python
django__django
tests/check_framework/template_test_apps/different_tags_app/apps.py
{ "start": 36, "end": 147 }
class ____(AppConfig): name = "check_framework.template_test_apps.different_tags_app"
DifferentTagsAppAppConfig
python
walkccc__LeetCode
solutions/420. Strong Password Checker/420.py
{ "start": 0, "end": 1638 }
class ____: def strongPasswordChecker(self, password: str) -> int: n = len(password) missing = self._getMissing(password) # the number of replacements to deal with 3 repeating characters replaces = 0 # the number of sequences that can be substituted with 1 deletions, # (3k)-seqs oneSeq = 0...
Solution
python
catalyst-team__catalyst
catalyst/core/callback.py
{ "start": 4254, "end": 4382 }
class ____(IMetricCallback): """Criterion callback interface, abstraction over criterion step.""" pass
ICriterionCallback
python
numba__numba
numba/core/errors.py
{ "start": 19472, "end": 20025 }
class ____(TypingError): def __init__(self, value, attr, loc=None): module = getattr(value, 'pymod', None) if module is not None and module == np: # unsupported numpy feature. msg = ("Use of unsupported NumPy function 'numpy.%s' " "or unsupported use of the...
UntypedAttributeError
python
pypa__pip
src/pip/_vendor/rich/console.py
{ "start": 9274, "end": 10224 }
class ____: """Context manager to capture the result of printing to the console. See :meth:`~rich.console.Console.capture` for how to use. Args: console (Console): A console instance to capture output. """ def __init__(self, console: "Console") -> None: self._console = console ...
Capture
python
getsentry__sentry
src/sentry/replays/usecases/ingest/__init__.py
{ "start": 2029, "end": 2108 }
class ____(msgspec.Struct, gc=False, tag_field="type", tag=4): pass
MetaEvent
python
pydantic__pydantic
tests/test_validate_call.py
{ "start": 38025, "end": 38495 }
class ____(BaseModel): z: int M = M0 def test_uses_local_ns(): class M1(BaseModel): y: int M = M1 # noqa: F841 def foo(): class M2(BaseModel): z: int M = M2 # noqa: F841 @validate_call(validate_return=True) def bar(m: 'M') -> 'M': ...
M0
python
bokeh__bokeh
src/bokeh/core/property/json.py
{ "start": 1276, "end": 2588 }
class ____(String): """ Accept JSON string values. The value is transmitted and received by BokehJS as a *string* containing JSON content. i.e., you must use ``JSON.parse`` to unpack the value into a JavaScript hash. Args: default (string, optional) : A default value for attrib...
JSON
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/hooks/test_comprehend.py
{ "start": 986, "end": 6467 }
class ____: @pytest.mark.parametrize( ("test_hook", "service_name"), [pytest.param(ComprehendHook(), "comprehend", id="comprehend")], ) def test_comprehend_hook(self, test_hook, service_name): comprehend_hook = ComprehendHook() assert comprehend_hook.conn is not None @mo...
TestComprehendHook
python
ray-project__ray
rllib/utils/spaces/space_utils.py
{ "start": 195, "end": 17983 }
class ____(np.ndarray): """A ndarray-wrapper the usage of which indicates that there a batch dim exists. This is such that our `batch()` utility can distinguish between having to stack n individual batch items (each one w/o any batch dim) vs having to concatenate n already batched items (each one possi...
BatchedNdArray
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_django/DJ001.py
{ "start": 137, "end": 543 }
class ____(models.Model): charfield = models.CharField(max_length=255, null=True) textfield = models.TextField(max_length=255, null=True) slugfield = models.SlugField(max_length=255, null=True) emailfield = models.EmailField(max_length=255, null=True) filepathfield = models.FilePathField(max_length=...
IncorrectModel
python
kubernetes-client__python
kubernetes/client/models/v1beta2_resource_claim_status.py
{ "start": 383, "end": 7596 }
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...
V1beta2ResourceClaimStatus
python
pypa__pip
tests/lib/__init__.py
{ "start": 42822, "end": 43414 }
class ____: def pip(self, *args: str | pathlib.Path) -> InMemoryPipResult: orig_stdout = sys.stdout stdout = StringIO() sys.stdout = stdout try: returncode = pip_entry_point([os.fspath(a) for a in args]) except SystemExit as e: if isinstance(e.code, in...
InMemoryPip
python
spack__spack
lib/spack/spack/modules/tcl.py
{ "start": 2370, "end": 2615 }
class ____(BaseModuleFileWriter): """Writer class for tcl module files.""" default_template = "modules/modulefile.tcl" modulerc_header = ["#%Module4.7"] hide_cmd_format = "module-hide --soft --hidden-loaded %s"
TclModulefileWriter
python
dask__dask
dask/dataframe/tseries/resample.py
{ "start": 6542, "end": 6604 }
class ____(ResampleReduction): how = "median"
ResampleMedian
python
walkccc__LeetCode
solutions/2646. Minimize the Total Price of the Trips/2646.py
{ "start": 0, "end": 1513 }
class ____: def minimumTotalPrice(self, n: int, edges: list[list[int]], price: list[int], trips: list[list[int]]) -> int: graph = [[] for _ in range(n)] for u, v in edges: graph[u].append(v) graph[v].append(u) # count[i] := the number of times i is traversed count...
Solution
python
pallets__werkzeug
src/werkzeug/wrappers/response.py
{ "start": 1044, "end": 31166 }
class ____(_SansIOResponse): """Represents an outgoing WSGI HTTP response with body, status, and headers. Has properties and methods for using the functionality defined by various HTTP specs. The response body is flexible to support different use cases. The simple form is passing bytes, or a string...
Response
python
doocs__leetcode
solution/3100-3199/3183.The Number of Ways to Make the Sum/Solution.py
{ "start": 0, "end": 419 }
class ____: def numberOfWays(self, n: int) -> int: mod = 10**9 + 7 coins = [1, 2, 6] f = [0] * (n + 1) f[0] = 1 for x in coins: for j in range(x, n + 1): f[j] = (f[j] + f[j - x]) % mod ans = f[n] if n >= 4: ans = (ans + ...
Solution
python
pypa__warehouse
dev/flake8/checkers.py
{ "start": 857, "end": 6513 }
class ____(ast.NodeVisitor): def __init__(self, filename: str) -> None: self.errors: list[tuple[int, int, str]] = [] self.filename = filename def check_for_backref(self, node) -> None: def _check_keywords(keywords: list[ast.keyword]) -> None: for kw in keywords: ...
WarehouseVisitor
python
facebook__pyre-check
client/tests/daemon_socket_test.py
{ "start": 467, "end": 5144 }
class ____(testslide.TestCase): def test_get_md5_short(self) -> None: # Test different servers are differentiable project_root = Path("project_root") relative_local_root_a = Path("my/project") relative_local_root_b = Path("my/otherproject") md5_hash_a = get_md5_short( ...
SocketTest
python
plotly__plotly.py
plotly/graph_objs/waterfall/_decreasing.py
{ "start": 233, "end": 2458 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "waterfall" _path_str = "waterfall.decreasing" _valid_props = {"marker"} @property def marker(self): """ The 'marker' property is an instance of Marker that may be specified as: - An instance of :class:`plotly...
Decreasing
python
kubernetes-client__python
kubernetes/client/models/v1beta1_mutation.py
{ "start": 383, "end": 5548 }
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...
V1beta1Mutation
python
PrefectHQ__prefect
src/prefect/runner/storage.py
{ "start": 28592, "end": 33647 }
class ____: """ Sets the working directory in the local filesystem. Parameters: Path: Local file path to set the working directory for the flow Examples: Sets the working directory for the local path to the flow: ```python from prefect.runner.storage import Localstorage ...
LocalStorage
python
matplotlib__matplotlib
lib/matplotlib/_mathtext.py
{ "start": 27374, "end": 27849 }
class ____(DejaVuFonts): """ A font handling class for the DejaVu Serif fonts If a glyph is not found it will fallback to Stix Serif """ _fontmap = { 'rm': 'DejaVu Serif', 'it': 'DejaVu Serif:italic', 'bf': 'DejaVu Serif:weight=bold', 'bfit': 'DejaVu Serif:italic:bol...
DejaVuSerifFonts
python
realpython__materials
hashtable/05_separate_chaining/hashtable.py
{ "start": 137, "end": 3385 }
class ____: @classmethod def from_dict(cls, dictionary, capacity=None): hash_table = cls(capacity or len(dictionary)) for key, value in dictionary.items(): hash_table[key] = value return hash_table def __init__(self, capacity=8, load_factor_threshold=0.6): if cap...
HashTable
python
pypa__warehouse
tests/unit/integration/vulnerabilities/osv/test_views.py
{ "start": 186, "end": 5349 }
class ____: def test_report_vulnerabilities(self, pyramid_request, metrics, monkeypatch): pyramid_request.headers = { "VULN-PUBLIC-KEY-IDENTIFIER": "vuln_pub_key_id", "VULN-PUBLIC-KEY-SIGNATURE": "vuln_pub_key_sig", } pyramid_request.body = """[{ "project": "vuln_p...
TestReportVulnerabilities
python
joke2k__faker
tests/providers/test_phone_number.py
{ "start": 12621, "end": 13206 }
class ____: """Test es_CO phone number provider methods""" def test_phone_number(self, faker, num_samples): pattern: Pattern = re.compile( r"((\+?57|\(\+57\))?60\d)?\d{7}|" r"((\+?57 |\(\+57\) )?60\d )?\d{3} \d{2} \d{2}|" r"(\+?57|\(\+57\))?3[012]\d{8}|" ...
TestEsCo
python
pytorch__pytorch
benchmarks/instruction_counts/execution/runner.py
{ "start": 3122, "end": 10365 }
class ____: def __init__( self, work_items: tuple[WorkOrder, ...], core_pool: Optional[CorePool] = None, cadence: float = 1.0, ) -> None: self._work_items: tuple[WorkOrder, ...] = work_items self._core_pool: CorePool = core_pool or CorePool(0, CPU_COUNT - 4) ...
Runner
python
pypa__pipenv
pipenv/vendor/tomlkit/items.py
{ "start": 9918, "end": 11216 }
class ____(Key): """A single key""" def __init__( self, k: str, t: KeyType | None = None, sep: str | None = None, original: str | None = None, ) -> None: if t is None: if not k or any( c not in string.ascii_letters + string.digits ...
SingleKey
python
pandas-dev__pandas
pandas/tests/series/methods/test_isin.py
{ "start": 214, "end": 9236 }
class ____: def test_isin(self): s = Series(["A", "B", "C", "a", "B", "B", "A", "C"]) result = s.isin(["A", "C"]) expected = Series([True, False, True, False, False, False, True, True]) tm.assert_series_equal(result, expected) # GH#16012 # This specific issue has to...
TestSeriesIsIn
python
ray-project__ray
release/ray_release/tests/test_state_machine.py
{ "start": 2674, "end": 2762 }
class ____: def unblock_job(self, *args, **kwargs): return {}
MockBuildkiteJob
python
rapidsai__cudf
python/cudf/cudf_pandas_tests/test_array_function.py
{ "start": 540, "end": 638 }
class ____: def __array_function__(self, func, types, args, kwargs): return "slow"
Slow2
python
joke2k__faker
faker/providers/misc/en_PH/__init__.py
{ "start": 42, "end": 4397 }
class ____(MiscProvider): """ Provider for miscellaneous data for en_PH locale This class also houses all other provider methods that would have otherwise been weird to place in another provider. """ gemstone_names = ( "Agate", "Amber", "Amethyst", "Aquamarine", ...
Provider
python
kamyu104__LeetCode-Solutions
Python/maximize-number-of-subsequences-in-a-string.py
{ "start": 48, "end": 513 }
class ____(object): def maximumSubsequenceCount(self, text, pattern): """ :type text: str :type pattern: str :rtype: int """ result = cnt1 = cnt2 = 0 for c in text: if c == pattern[1]: result += cnt1 cnt2 += 1 ...
Solution
python
huggingface__transformers
tests/models/fastspeech2_conformer/test_modeling_fastspeech2_conformer.py
{ "start": 24928, "end": 34184 }
class ____(ModelTesterMixin, unittest.TestCase): all_model_classes = (FastSpeech2ConformerWithHifiGan,) if is_torch_available() else () test_resize_embeddings = False is_encoder_decoder = True def setUp(self): self.model_tester = FastSpeech2ConformerWithHifiGanTester(self) def test_model(...
FastSpeech2ConformerWithHifiGanTest
python
walkccc__LeetCode
solutions/2812. Find the Safest Path in a Grid/2812.py
{ "start": 0, "end": 1632 }
class ____: def maximumSafenessFactor(self, grid: list[list[int]]) -> int: self.DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0)) n = len(grid) distToThief = self._getDistToThief(grid) def hasValidPath(safeness: int) -> bool: if distToThief[0][0] < safeness: return False q = collections....
Solution
python
doocs__leetcode
solution/2400-2499/2433.Find The Original Array of Prefix Xor/Solution.py
{ "start": 0, "end": 127 }
class ____: def findArray(self, pref: List[int]) -> List[int]: return [a ^ b for a, b in pairwise([0] + pref)]
Solution
python
gevent__gevent
src/gevent/testing/support.py
{ "start": 1627, "end": 1829 }
class ____(object): # A descriptor-like object that will # only be used if the actual stdlib module # doesn't have the value. def __init__(self, value): self.value = value
_Default
python
django__django
tests/admin_utils/models.py
{ "start": 872, "end": 940 }
class ____(Article): class Meta: proxy = True
ArticleProxy
python
huggingface__transformers
src/transformers/models/t5gemma/modular_t5gemma.py
{ "start": 15005, "end": 15383 }
class ____(Gemma2MLP): def __init__(self, config): super().__init__(config) self.dropout = nn.Dropout(config.dropout_rate) def forward(self, x): hidden_states = self.act_fn(self.gate_proj(x)) * self.up_proj(x) hidden_states = self.dropout(hidden_states) down_proj = self....
T5GemmaMLP
python
sanic-org__sanic
sanic/cli/arguments.py
{ "start": 7049, "end": 8298 }
class ____(Group): name = "Development" def attach(self): self.container.add_argument( "--debug", dest="debug", action="store_true", help="Run the server in debug mode", ) self.container.add_argument( "-r", "--reloa...
DevelopmentGroup
python
huggingface__transformers
src/transformers/models/align/modeling_align.py
{ "start": 25925, "end": 26815 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.self = AlignTextSelfAttention(config) self.output = AlignTextSelfOutput(config) def forward( self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor] = None, ...
AlignTextAttention
python
tornadoweb__tornado
tornado/test/web_test.py
{ "start": 91580, "end": 93998 }
class ____: def get_httpserver_options(self): # Use a small chunk size so flow control is relevant even though # all the data arrives at once. return dict(chunk_size=10, decompress_request=True) def get_http_client(self): # simple_httpclient only: curl doesn't support body_produ...
BaseStreamingRequestFlowControlTest
python
pypa__setuptools
setuptools/_vendor/zipp/__init__.py
{ "start": 3690, "end": 5999 }
class ____(InitializedState, SanitizedNames, zipfile.ZipFile): """ A ZipFile subclass that ensures that implied directories are always included in the namelist. >>> list(CompleteDirs._implied_dirs(['foo/bar.txt', 'foo/bar/baz.txt'])) ['foo/', 'foo/bar/'] >>> list(CompleteDirs._implied_dirs(['fo...
CompleteDirs
python
pypa__warehouse
tests/common/db/packaging.py
{ "start": 4702, "end": 5057 }
class ____(WarehouseFactory): class Meta: model = JournalEntry name = factory.Faker("word") version = factory.Sequence(lambda n: str(n) + ".0") submitted_date = factory.Faker( "date_time_between_dates", datetime_start=datetime.datetime(2008, 1, 1) ) submitted_by = factory.SubFac...
JournalEntryFactory
python
django__django
tests/messages_tests/urls.py
{ "start": 1847, "end": 2020 }
class ____(SuccessMessageMixin, FormView): form_class = ContactForm success_url = show success_message = "%(name)s was created successfully"
ContactFormViewWithMsg
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 94753, "end": 95114 }
class ____(sgqlc.types.Input): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("project_id", "client_mutation_id") project_id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name="projectId") client_mutation_id = sgqlc.types.Field(String, graphql_...
DeleteProjectInput
python
plotly__plotly.py
plotly/graph_objs/heatmap/colorbar/_tickformatstop.py
{ "start": 233, "end": 8514 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "heatmap.colorbar" _path_str = "heatmap.colorbar.tickformatstop" _valid_props = {"dtickrange", "enabled", "name", "templateitemname", "value"} @property def dtickrange(self): """ range [*min*, *max*], where "min", "max" - d...
Tickformatstop
python
scipy__scipy
scipy/special/tests/test_legendre.py
{ "start": 12690, "end": 21309 }
class ____: @pytest.mark.parametrize("shape", [(1000,), (4, 9), (3, 5, 7)]) @pytest.mark.parametrize("branch_cut", [2, 3]) @pytest.mark.parametrize("z_min, z_max", [(-10 - 10j, 10 + 10j), (-1, 1), (-10j, 10j)]) @pytest.mark.parametrize("norm", [True, False]) def test_specific(self, shape, br...
TestMultiAssocLegendreP
python
realpython__materials
python-mcp-client/source-code-final/mcp_client/handlers.py
{ "start": 122, "end": 3597 }
class ____: """Handle OpenAI API interaction and MCP tool execution.""" def __init__(self, client_session: ClientSession): self.client_session = client_session if not (api_key := os.getenv("OPENAI_API_KEY")): raise RuntimeError( "Error: OPENAI_API_KEY environment var...
OpenAIQueryHandler
python
great-expectations__great_expectations
great_expectations/data_context/store/validation_definition_store.py
{ "start": 677, "end": 3791 }
class ____(Store): _key_class = StringKey def __init__( self, store_backend: dict | None = None, runtime_environment: dict | None = None, store_name: str = "no_store_name", ) -> None: store_backend_class = self._determine_store_backend_class(store_backend) if...
ValidationDefinitionStore
python
Pylons__pyramid
tests/test_session.py
{ "start": 12576, "end": 17963 }
class ____(SharedCookieSessionTests, unittest.TestCase): def _makeOne(self, request, **kw): from pyramid.session import SignedCookieSessionFactory kw.setdefault('secret', 'secret') return SignedCookieSessionFactory(**kw)(request) def _serialize(self, value, salt=b'pyramid.session.', ha...
TestSignedCookieSession
python
PyCQA__pylint
tests/functional/u/unused/unused_private_member.py
{ "start": 9245, "end": 9453 }
class ____: """Regression test for issue 5569""" @classmethod def b(cls) -> None: cls.__a = '' # [unused-private-member] def a(self): return type(self).__a
TypeSelfCallInMethod
python
numpy__numpy
benchmarks/benchmarks/bench_core.py
{ "start": 52, "end": 2635 }
class ____(Benchmark): def setup(self): self.l100 = range(100) self.l50 = range(50) self.float_l1000 = [float(i) for i in range(1000)] self.float64_l1000 = [np.float64(i) for i in range(1000)] self.int_l1000 = list(range(1000)) self.l = [np.arange(1000), np.arange(100...
Core
python
sqlalchemy__sqlalchemy
test/sql/test_metadata.py
{ "start": 207014, "end": 209642 }
class ____(fixtures.TestBase): @contextmanager def _fixture(self): from sqlalchemy.engine.default import DefaultDialect class CopyDialectOptionsTestDialect(DefaultDialect): construct_arguments = [ (Table, {"some_table_arg": None}), (Column, {"some_col...
CopyDialectOptionsTest
python
readthedocs__readthedocs.org
readthedocs/api/v3/serializers.py
{ "start": 36368, "end": 37514 }
class ____(serializers.ModelSerializer): project = serializers.SlugRelatedField(slug_field="slug", read_only=True) _links = EnvironmentVariableLinksSerializer(source="*", read_only=True) class Meta: model = EnvironmentVariable fields = [ "pk", "created", ...
EnvironmentVariableSerializer
python
RaRe-Technologies__gensim
gensim/test/test_fasttext.py
{ "start": 51693, "end": 52000 }
class ____(unittest.TestCase): def test_compatibility_true(self): m = FT_gensim.load(datapath('compatible-hash-true.model')) self.assertTrue(m.wv.compatible_hash) def test_hash_native(self): m = load_native() self.assertTrue(m.wv.compatible_hash)
HashCompatibilityTest
python
pydantic__pydantic
pydantic/_internal/_decorators_v1.py
{ "start": 4282, "end": 6185 }
class ____(Protocol): """V2 validator with mode='after'.""" def __call__( self, __fields_tuple: RootValidatorFieldsTuple, __info: core_schema.ValidationInfo ) -> RootValidatorFieldsTuple: ... def make_v1_generic_root_validator( validator: V1RootValidatorFunction, pre: bool ) -> V2CoreBeforeRo...
V2CoreAfterRootValidator
python
matplotlib__matplotlib
lib/matplotlib/backend_bases.py
{ "start": 124995, "end": 132356 }
class ____: """ Base class for all tool containers, e.g. toolbars. Attributes ---------- toolmanager : `.ToolManager` The tools with which this `ToolContainerBase` wants to communicate. """ _icon_extension = '.png' """ Toolcontainer button icon image format extension *...
ToolContainerBase
python
getsentry__sentry
tests/relay_integration/lang/javascript/test_plugin.py
{ "start": 2084, "end": 103049 }
class ____(RelayStoreHelper): @pytest.fixture(autouse=True) def initialize(self, default_projectkey, default_project, set_sentry_option, live_server): self.project = default_project self.projectkey = default_projectkey self.organization = self.project.organization self.min_ago = ...
TestJavascriptIntegration
python
ray-project__ray
python/ray/util/collective/const.py
{ "start": 530, "end": 865 }
class ____(Enum): """ray.util.collective environment variables.""" NCCL_USE_MULTISTREAM = auto(), lambda v: (v or "True") == "True" @property def val(self): """Return the output of the lambda against the system's env value.""" _, default_fn = self.value return default_fn(os.get...
ENV
python
pennersr__django-allauth
allauth/headless/socialaccount/views.py
{ "start": 1009, "end": 1911 }
class ____(APIView): input_class = SignupInput def handle(self, request, *args, **kwargs): self.sociallogin = flows.signup.get_pending_signup(self.request) if not self.sociallogin: return ConflictResponse(request) if not get_socialaccount_adapter().is_open_for_signup( ...
ProviderSignupView
python
huggingface__transformers
src/transformers/models/roformer/tokenization_roformer.py
{ "start": 10140, "end": 20534 }
class ____(PreTrainedTokenizer): r""" Construct a RoFormer tokenizer. Based on [Rust Jieba](https://pypi.org/project/rjieba/). This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to this superclass for more information regarding those methods...
RoFormerTokenizer
python
bokeh__bokeh
src/bokeh/application/handlers/notebook.py
{ "start": 2099, "end": 5228 }
class ____(CodeHandler): ''' A Handler that uses code in a Jupyter notebook for modifying Bokeh Documents. ''' _logger_text = "%s: call to %s() ignored when running notebooks with the 'bokeh' command." _origin = "Notebook" def __init__(self, *, filename: PathLike, argv: list[str] = [], packa...
NotebookHandler
python
optuna__optuna
optuna/artifacts/exceptions.py
{ "start": 44, "end": 334 }
class ____(OptunaError): """Exception raised when an artifact is not found. It is typically raised while calling :meth:`~optuna.artifacts._protocol.ArtifactStore.open_reader` or :meth:`~optuna.artifacts._protocol.ArtifactStore.remove` methods. """ ...
ArtifactNotFound
python
cherrypy__cherrypy
cherrypy/process/servers.py
{ "start": 3477, "end": 3555 }
class ____: """Timeout constants.""" occupied = 5 free = 1
Timeouts
python
milvus-io__pymilvus
tests/test_async_grpc_handler.py
{ "start": 243, "end": 19592 }
class ____: """Test cases for AsyncGrpcHandler class""" @pytest.mark.asyncio async def test_load_partitions_refresh_attribute(self) -> None: """ Test that load_partitions correctly accesses request.refresh instead of request.is_refresh. This test verifies the fix for issue #2796. ...
TestAsyncGrpcHandler
python
pypa__warehouse
warehouse/packaging/interfaces.py
{ "start": 2414, "end": 2537 }
class ____(Exception): """Base exception for project name unavailability errors.""" pass
ProjectNameUnavailableError
python
huggingface__transformers
src/transformers/models/sam3_tracker/modeling_sam3_tracker.py
{ "start": 5335, "end": 5891 }
class ____(PreTrainedModel): config_class = Sam3TrackerConfig base_model_prefix = "sam3_tracker" main_input_name = "pixel_values" input_modalities = ("image",) _supports_sdpa = True _supports_flash_attn_2 = True _supports_attention_backend = True @torch.no_grad() def _init_weights(s...
Sam3TrackerPreTrainedModel
python
apache__airflow
airflow-core/src/airflow/ti_deps/deps/mapped_task_expanded.py
{ "start": 880, "end": 1412 }
class ____(BaseTIDep): """Checks that a mapped task has been expanded before its TaskInstance can run.""" NAME = "Task has been mapped" IGNORABLE = False IS_TASK_DEP = False def _get_dep_statuses(self, ti, session, dep_context): if dep_context.ignore_unmapped_tasks: return ...
MappedTaskIsExpanded
python
apache__airflow
providers/segment/src/airflow/providers/segment/operators/segment_track_event.py
{ "start": 1100, "end": 2708 }
class ____(BaseOperator): """ Send Track Event to Segment for a specified user_id and event. :param user_id: The ID for this user in your database. (templated) :param event: The name of the event you're tracking. (templated) :param properties: A dictionary of properties for the event. (templated) ...
SegmentTrackEventOperator
python
dask__dask
dask/config.py
{ "start": 10722, "end": 24734 }
class ____: """Temporarily set configuration values within a context manager Parameters ---------- arg : mapping or None, optional A mapping of configuration key-value pairs to set. **kwargs : Additional key-value pairs to set. If ``arg`` is provided, values set in ``arg`` w...
set
python
tensorflow__tensorflow
tensorflow/python/keras/optimizer_v1.py
{ "start": 10384, "end": 12940 }
class ____(Optimizer): """Adagrad optimizer. Adagrad is an optimizer with parameter-specific learning rates, which are adapted relative to how frequently a parameter gets updated during training. The more updates a parameter receives, the smaller the updates. It is recommended to leave the parameters of t...
Adagrad
python
ray-project__ray
python/ray/air/_internal/device_manager/npu.py
{ "start": 617, "end": 3478 }
class ____(TorchDeviceManager): """Ascend NPU device manager""" @staticmethod def register_custom_torch_dist_backend(): if NPU_TORCH_PACKAGE_AVAILABLE: import torch_npu # noqa: F401, F811 def is_available(self) -> bool: if not NPU_TORCH_PACKAGE_AVAILABLE: retur...
NPUTorchDeviceManager
python
huggingface__transformers
src/transformers/models/pegasus_x/modeling_pegasus_x.py
{ "start": 1680, "end": 2845 }
class ____: """Wrapper for dimension info.""" batch_size: int # batch size seq_len: int # token length block_size: int # block size num_heads: int # num heads hidden_dim: int # hidden dim dim_per_head: int # dim per head num_blocks: int # num blocks global_len: int # global ...
DimensionInfo
python
lepture__authlib
authlib/jose/rfc7518/jws_algs.py
{ "start": 1065, "end": 1993 }
class ____(JWSAlgorithm): """HMAC using SHA algorithms for JWS. Available algorithms: - HS256: HMAC using SHA-256 - HS384: HMAC using SHA-384 - HS512: HMAC using SHA-512 """ SHA256 = hashlib.sha256 SHA384 = hashlib.sha384 SHA512 = hashlib.sha512 def __init__(self, sha_type): ...
HMACAlgorithm
python
scipy__scipy
scipy/linalg/tests/test_basic.py
{ "start": 86944, "end": 90335 }
class ____: def test_basic1(self): c = np.array([1, 2, 3, 5]) b = np.array([1, -1, 1, 0]) x = solve_circulant(c, b) y = solve(circulant(c), b) assert_allclose(x, y) def test_basic2(self): # b is a 2-d matrix. c = np.array([1, 2, -3, -5]) b = np.a...
TestSolveCirculant
python
google__jax
jax/_src/export/shape_poly.py
{ "start": 9152, "end": 13828 }
class ____: """Represents a multiplication of factors. The representation is a sequence of _DimFactor factors along with their integer exponents (>= 1). The empty sequence represents the constant 1. """ __slots__ = ["_factors", "_hash", "_size"] def __init__(self, sorted_factors: SortedFactors): self._...
_DimTerm