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-graphql/dagster_graphql/schema/instance.py
{ "start": 9518, "end": 14030 }
class ____(graphene.ObjectType): id = graphene.NonNull(graphene.String) info = graphene.Field(graphene.String) runLauncher = graphene.Field(GrapheneRunLauncher) runQueuingSupported = graphene.NonNull(graphene.Boolean) runQueueConfig = graphene.Field(GrapheneRunQueueConfig) executablePath = graph...
GrapheneInstance
python
apache__airflow
task-sdk/src/airflow/sdk/definitions/xcom_arg.py
{ "start": 2022, "end": 7449 }
class ____(ResolveMixin, DependencyMixin): """ Reference to an XCom value pushed from another operator. The implementation supports:: xcomarg >> op xcomarg << op op >> xcomarg # By BaseOperator code op << xcomarg # By BaseOperator code **Example**: The moment you get...
XComArg
python
django__django
tests/admin_views/admin.py
{ "start": 38756, "end": 39261 }
class ____(admin.ModelAdmin): def get_urls(self): # Opt-out of append slash for single model. urls = super().get_urls() for pattern in urls: pattern.callback = no_append_slash(pattern.callback) return urls site9 = admin.AdminSite(name="admin9") site9.register(Article, A...
ActorAdmin9
python
walkccc__LeetCode
solutions/79. Word Search/79.py
{ "start": 0, "end": 713 }
class ____: def exist(self, board: list[list[str]], word: str) -> bool: m = len(board) n = len(board[0]) def dfs(i: int, j: int, s: int) -> bool: if i < 0 or i == m or j < 0 or j == n: return False if board[i][j] != word[s] or board[i][j] == '*': return False if s == len...
Solution
python
huggingface__transformers
src/transformers/models/siglip/modeling_siglip.py
{ "start": 2823, "end": 3616 }
class ____(ModelOutput): r""" image_embeds (`torch.FloatTensor` of shape `(batch_size, output_dim)` *optional* returned when model is initialized with `with_projection=True`): The image embeddings obtained by applying the projection layer to the pooler_output. """ image_embeds: Optional[torch.F...
SiglipVisionModelOutput
python
apache__airflow
airflow-core/src/airflow/api_fastapi/core_api/datamodels/pools.py
{ "start": 1226, "end": 1434 }
class ____(BaseModel): """Base serializer for Pool.""" pool: str = Field(serialization_alias="name") slots: int description: str | None = Field(default=None) include_deferred: bool
BasePool
python
oauthlib__oauthlib
oauthlib/oauth2/rfc6749/errors.py
{ "start": 3933, "end": 4001 }
class ____(OAuth2Error): error = 'token_expired'
TokenExpiredError
python
getsentry__sentry
tests/sentry/integrations/vsts/test_issues.py
{ "start": 27416, "end": 27895 }
class ____(VstsIssueBase): @responses.activate def test_raise_error_api_unauthorized(self) -> None: error_message = "According to Microsoft Entra, your Identity xxx is currently Deleted within the following Microsoft Entra tenant: xxx Please contact your Microsoft Entra administrator to resolve this." ...
VstsIssueRaiseErrorTest
python
altair-viz__altair
altair/utils/server.py
{ "start": 709, "end": 4100 }
class ____: def __init__(self, ip_port, Handler): Handler(MockRequest(), ip_port[0], self) def serve_forever(self): pass def server_close(self): pass def generate_handler(html, files=None): if files is None: files = {} class MyHandler(server.BaseHTTPRequestHandle...
MockServer
python
doocs__leetcode
lcof2/剑指 Offer II 117. 相似的字符串/Solution.py
{ "start": 0, "end": 474 }
class ____: def numSimilarGroups(self, strs: List[str]) -> int: def find(x): if p[x] != x: p[x] = find(p[x]) return p[x] n, l = len(strs), len(strs[0]) p = list(range(n)) for i in range(n): for j in range(i + 1, n): ...
Solution
python
HypothesisWorks__hypothesis
hypothesis-python/tests/cover/test_searchstrategy.py
{ "start": 4774, "end": 5239 }
class ____: inner: Inner def test_jsonable_to_json_nested(): obj = Outer(Inner(42)) assert to_jsonable(obj, avoid_realization=False) == {"inner": "custom"} assert to_jsonable(obj, avoid_realization=True) == "<symbolic>" recursive_list = [] recursive_list.append(recursive_list) recursive_dict = {} r...
Outer
python
jazzband__django-model-utils
tests/test_fields/test_monitor_field.py
{ "start": 4089, "end": 4969 }
class ____(TestCase): def setUp(self) -> None: DoubleMonitored.objects.create(name='Charlie', name2='Charlie2') def test_recursion_error_with_only(self) -> None: # Any field passed to only() is generating a recursion error list(DoubleMonitored.objects.only('id')) def test_recursio...
MonitorDoubleFieldTests
python
walkccc__LeetCode
solutions/1481. Least Number of Unique Integers after K Removals/1481.py
{ "start": 0, "end": 361 }
class ____: def findLeastNumOfUniqueInts(self, arr: list[int], k: int) -> int: minHeap = list(collections.Counter(arr).values()) heapq.heapify(minHeap) # Greedily remove the k least frequent numbers to have the least number of unique integers. while k > 0: k -= heapq.heappop(minHeap) retur...
Solution
python
dagster-io__dagster
python_modules/libraries/dagster-sling/dagster_sling/resources.py
{ "start": 4034, "end": 26262 }
class ____(ConfigurableResource): """Resource for interacting with the Sling package. This resource can be used to run Sling replications. Args: connections (List[SlingConnectionResource]): A list of connections to use for the replication. Examples: .. code-block:: python from...
SlingResource
python
apache__airflow
helm-tests/tests/helm_tests/other/test_git_sync_scheduler.py
{ "start": 914, "end": 19123 }
class ____: """Test git sync scheduler. This is ignored when Airflow >=3 or a separate dag processor is used.""" def test_should_add_dags_volume(self): docs = render_chart( values={"airflowVersion": "2.10.5", "dags": {"gitSync": {"enabled": True}}}, show_only=["templates/schedul...
TestGitSyncSchedulerTest
python
tornadoweb__tornado
tornado/httpclient.py
{ "start": 5047, "end": 13299 }
class ____(Configurable): """An non-blocking HTTP client. Example usage:: async def f(): http_client = AsyncHTTPClient() try: response = await http_client.fetch("http://www.google.com") except Exception as e: print("Error: %s" % e) ...
AsyncHTTPClient
python
django__django
tests/expressions_case/tests.py
{ "start": 50868, "end": 56323 }
class ____(TestCase): @classmethod def setUpTestData(cls): Client.objects.create( name="Jane Doe", account_type=Client.REGULAR, registered_on=date.today() - timedelta(days=36), ) Client.objects.create( name="James Smith", accoun...
CaseDocumentationExamples
python
pandas-dev__pandas
asv_bench/benchmarks/categoricals.py
{ "start": 6506, "end": 7082 }
class ____: def setup(self): N = 1000 self.c = pd.CategoricalIndex(list("a" * N + "b" * N + "c" * N)) self.s = pd.Series(self.c) def time_categorical_index_is_monotonic_increasing(self): self.c.is_monotonic_increasing def time_categorical_index_is_monotonic_decreasing(self)...
IsMonotonic
python
django__django
tests/utils_tests/test_lorem_ipsum.py
{ "start": 121, "end": 5452 }
class ____(unittest.TestCase): def test_negative_words(self): """words(n) returns n + 19 words, even if n is negative.""" self.assertEqual( words(-5), "lorem ipsum dolor sit amet consectetur adipisicing elit sed do " "eiusmod tempor incididunt ut", ) ...
LoremIpsumTests
python
dagster-io__dagster
python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/generated/sources.py
{ "start": 221094, "end": 223066 }
class ____(GeneratedAirbyteSource): class APIToken: @public def __init__(self, email: str, api_token: str, auth_type: Optional[str] = None): self.auth_type = check.opt_str_param(auth_type, "auth_type") self.email = check.str_param(email, "email") self.api_token = ...
ZendeskTalkSource
python
fluentpython__example-code
16-coroutine/coro_exc_demo.py
{ "start": 1189, "end": 1641 }
class ____(Exception): """An exception type for the demonstration.""" def demo_exc_handling(): print('-> coroutine started') while True: try: x = yield except DemoException: # <1> print('*** DemoException handled. Continuing...') else: # <2> pri...
DemoException
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/dt_diamond_right/package.py
{ "start": 217, "end": 593 }
class ____(Package): """This package has an indirect diamond dependency on dt-diamond-bottom""" homepage = "http://www.example.com" url = "http://www.example.com/dt-diamond-right-1.0.tar.gz" version("1.0", md5="0123456789abcdef0123456789abcdef") depends_on("dt-diamond-bottom", type=("build", "lin...
DtDiamondRight
python
pdm-project__pdm
src/pdm/models/markers.py
{ "start": 1209, "end": 5440 }
class ____: inner: BaseMarker def __and__(self, other: Any) -> Marker: if not isinstance(other, Marker): return NotImplemented return type(self)(self.inner & other.inner) def __or__(self, other: Any) -> Marker: if not isinstance(other, Marker): return NotImp...
Marker
python
airbytehq__airbyte
airbyte-integrations/connectors/source-surveycto/source_surveycto/source.py
{ "start": 1612, "end": 3713 }
class ____(SurveyStream, IncrementalMixin): primary_key = "KEY" cursor_field = "SubmissionDate" _cursor_value = None @property def state(self) -> Mapping[str, Any]: if self._cursor_value: return {self.cursor_field: self._cursor_value} else: return {self.curso...
SurveyctoStream
python
celery__celery
t/unit/apps/test_multi.py
{ "start": 1689, "end": 6148 }
class ____: @patch('celery.apps.multi.os.mkdir') @patch('celery.apps.multi.gethostname') def test_parse(self, gethostname, mkdirs_mock): gethostname.return_value = 'example.com' p = NamespacedOptionParser([ '-c:jerry,elaine', '5', '--loglevel:kramer=DEBUG', ...
test_multi_args
python
huggingface__transformers
src/transformers/models/mistral/modeling_mistral.py
{ "start": 21242, "end": 21351 }
class ____(GenericForSequenceClassification, MistralPreTrainedModel): pass
MistralForSequenceClassification
python
hyperopt__hyperopt
hyperopt/pyll/base.py
{ "start": 588, "end": 688 }
class ____: """Object to represent a missing argument to a function application"""
MissingArgument
python
urllib3__urllib3
dummyserver/socketserver.py
{ "start": 2519, "end": 2583 }
class ____(HTTPWarning): "IPv6 is not available"
NoIPv6Warning
python
bokeh__bokeh
src/bokeh/models/annotations/html/toolbars.py
{ "start": 1318, "end": 2148 }
class ____(HTMLAnnotation): # TODO: this shouldn't be an annotation # explicit __init__ to support Init signatures def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) toolbar = Instance(".models.tools.Toolbar", help=""" A toolbar to display. """) #----...
ToolbarPanel
python
google__jax
jax/_src/interpreters/pxla.py
{ "start": 14320, "end": 18258 }
class ____(NamedTuple): backend: str | None devices: Sequence[Any] | None def _emap_impl(fun: lu.WrappedFun, *args, backend: str | None, axis_name: core.AxisName, axis_size: int, global_axis_size: int, devices: Sequence[Any] | None, ...
EmapInfo
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/vertex_ai/test_feature_store.py
{ "start": 2183, "end": 3622 }
class ____: @mock.patch(VERTEX_AI_PATH.format("feature_store.FeatureStoreHook")) def test_execute(self, mock_hook_class): # Create the mock hook and set up its return value mock_hook = mock.MagicMock() mock_hook_class.return_value = mock_hook # Set up the return value for sync_fe...
TestSyncFeatureViewOperator
python
pytorch__pytorch
torch/_export/db/examples/specialized_attribute.py
{ "start": 101, "end": 520 }
class ____(torch.nn.Module): """ Model attributes are specialized. """ def __init__(self) -> None: super().__init__() self.a = "moo" self.b = 4 def forward(self, x): if self.a == Animal.COW.value: return x * x + self.b else: raise Val...
SpecializedAttribute
python
great-expectations__great_expectations
contrib/great_expectations_zipcode_expectations/great_expectations_zipcode_expectations/expectations/expect_column_values_to_be_valid_vermont_zip.py
{ "start": 742, "end": 1743 }
class ____(ColumnMapMetricProvider): # This is the id string that will be used to reference your metric. condition_metric_name = "column_values.valid_vermont_zip" # This method implements the core logic for the PandasExecutionEngine @column_condition_partial(engine=PandasExecutionEngine) def _panda...
ColumnValuesToBeValidVermontZip
python
django-extensions__django-extensions
django_extensions/db/fields/__init__.py
{ "start": 3122, "end": 10498 }
class ____(UniqueFieldMixin, SlugField): """ AutoSlugField By default, sets editable=False, blank=True. Required arguments: populate_from Specifies which field, list of fields, or model method the slug will be populated from. populate_from can traverse a ForeignKey relati...
AutoSlugField
python
plotly__plotly.py
plotly/graph_objs/layout/yaxis/_unifiedhovertitle.py
{ "start": 235, "end": 5090 }
class ____(_BaseLayoutHierarchyType): _parent_path_str = "layout.yaxis" _path_str = "layout.yaxis.unifiedhovertitle" _valid_props = {"text"} @property def text(self): """ Template string used for rendering the title that appear on x or y unified hover box. Variables are inse...
Unifiedhovertitle
python
ansible__ansible
test/integration/targets/collections/collection_root_user/ansible_collections/testns/testcoll/plugins/test/mytests.py
{ "start": 90, "end": 197 }
class ____(object): def tests(self): return { 'testtest': testtest }
TestModule
python
sphinx-doc__sphinx
sphinx/writers/latex.py
{ "start": 1725, "end": 1812 }
class ____(SphinxError): category = 'Markup is unsupported in LaTeX'
UnsupportedError
python
encode__django-rest-framework
tests/test_relations.py
{ "start": 9892, "end": 11154 }
class ____(APISimpleTestCase): def setUp(self): self.instance = MockObject(pk=1, name='foo') self.field = serializers.HyperlinkedIdentityField(view_name='example') self.field.reverse = mock_reverse self.field._context = {'request': True} def test_representation(self): re...
TestHyperlinkedIdentityField
python
kamyu104__LeetCode-Solutions
Python/strobogrammatic-number.py
{ "start": 29, "end": 408 }
class ____(object): lookup = {'0':'0', '1':'1', '6':'9', '8':'8', '9':'6'} # @param {string} num # @return {boolean} def isStrobogrammatic(self, num): n = len(num) for i in xrange((n+1) / 2): if num[n-1-i] not in self.lookup or \ num[i] != self.lookup[num[n-1-...
Solution
python
pypa__warehouse
tests/unit/manage/test_forms.py
{ "start": 2308, "end": 3934 }
class ____: @pytest.mark.parametrize( ("is_team", "team_name", "team_choices", "username", "user_choices", "errors"), [ # Team validators ("true", "", [], "", [], {"team_name": ["This field is required."]}), ("true", "team", [], "", [], {"team_name": ["Not a valid...
TestCreateInternalRoleForm
python
tensorflow__tensorflow
tensorflow/python/data/ops/interleave_op.py
{ "start": 2024, "end": 3715 }
class ____(dataset_ops.UnaryDataset): """A `Dataset` that interleaves the result of transformed inputs.""" def __init__(self, input_dataset, map_func, cycle_length, block_length, name=None): """See `Dataset.interleave()` for details."""...
_InterleaveDataset
python
davidhalter__jedi
test/completion/descriptors.py
{ "start": 2771, "end": 3130 }
class ____(): def __init__(self, func): self.func = func def __get__(self, obj, objtype): if obj is None: return self.func return partial(self, obj) def __call__(self, *args, **kwargs): # We don't do caching here, but that's what would normally happen. ...
Memoize
python
getsentry__sentry
src/sentry/rules/processing/buffer_processing.py
{ "start": 593, "end": 671 }
class ____: model: type[models.Model] filters: FilterKeys
BufferHashKeys
python
getsentry__sentry
tests/sentry/core/endpoints/test_project_index.py
{ "start": 772, "end": 10424 }
class ____(APITestCase): endpoint = "sentry-api-0-projects" def test_member_constraints(self) -> None: user = self.create_user(is_superuser=True) org = self.create_organization() team = self.create_team(organization=org, members=[user]) project = self.create_project(teams=[team]...
ProjectsListTest
python
astropy__astropy
astropy/units/tests/test_quantity_array_methods.py
{ "start": 5545, "end": 14959 }
class ____: """ Test statistical functions """ def test_mean(self): q1 = np.array([1.0, 2.0, 4.0, 5.0, 6.0]) * u.m assert_array_equal(np.mean(q1), 3.6 * u.m) assert_array_equal(np.mean(q1, keepdims=True), [3.6] * u.m) def test_mean_inplace(self): q1 = np.array([1.0,...
TestQuantityStatsFuncs
python
pandas-dev__pandas
pandas/tests/arrays/sparse/test_indexing.py
{ "start": 4281, "end": 9973 }
class ____: def test_take_scalar_raises(self, arr): msg = "'indices' must be an array, not a scalar '2'." with pytest.raises(ValueError, match=msg): arr.take(2) def test_take(self, arr_data, arr): exp = SparseArray(np.take(arr_data, [2, 3])) tm.assert_sp_array_equal(...
TestTake
python
walkccc__LeetCode
solutions/1938. Maximum Genetic Difference Query/1938.py
{ "start": 0, "end": 113 }
class ____: def __init__(self): self.children: list[TrieNode | None] = [None] * 2 self.count = 0
TrieNode
python
django-mptt__django-mptt
tests/myapp/tests.py
{ "start": 25535, "end": 33263 }
class ____(TreeTestCase): def setUp(self): self.a = ConcreteModel.objects.create(name="a") self.b = ConcreteModel.objects.create(name="b", parent=self.a) self.c = ConcreteModel.objects.create(name="c", parent=self.a) self.d = ConcreteModel.objects.create(name="d") self.z = Co...
DelayedUpdatesTestCase
python
sqlalchemy__sqlalchemy
test/engine/test_reflection.py
{ "start": 57978, "end": 66027 }
class ____(fixtures.TestBase): __sparse_driver_backend__ = True @testing.requires.schemas def test_has_schema(self): with testing.db.connect() as conn: eq_( testing.db.dialect.has_schema( conn, testing.config.test_schema ), ...
SchemaTest
python
fastapi__sqlmodel
docs_src/tutorial/update/tutorial004_py310.py
{ "start": 71, "end": 2357 }
class ____(SQLModel, table=True): id: int | None = Field(default=None, primary_key=True) name: str = Field(index=True) secret_name: str age: int | None = Field(default=None, index=True) sqlite_file_name = "database.db" sqlite_url = f"sqlite:///{sqlite_file_name}" engine = create_engine(sqlite_url, ec...
Hero
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/hooks/test_cloud_formation.py
{ "start": 957, "end": 3694 }
class ____: def setup_method(self, _): self.hook = CloudFormationHook(aws_conn_id="aws_default") def create_stack(self, stack_name): timeout = 15 template_body = json.dumps( { "Resources": { "myResource": { "Type": ...
TestCloudFormationHook
python
pytorch__pytorch
.github/scripts/generate_ci_workflows.py
{ "start": 1323, "end": 1397 }
class ____(TypedDict): num_shards: int runner: str @dataclass
Config
python
doocs__leetcode
solution/1000-1099/1034.Coloring A Border/Solution.py
{ "start": 0, "end": 749 }
class ____: def colorBorder( self, grid: List[List[int]], row: int, col: int, color: int ) -> List[List[int]]: def dfs(i: int, j: int, c: int) -> None: vis[i][j] = True for a, b in pairwise((-1, 0, 1, 0, -1)): x, y = i + a, j + b if 0 <= x ...
Solution
python
dask__dask
dask/delayed.py
{ "start": 28609, "end": 30465 }
class ____(Delayed): __slots__ = ("_obj", "_attr") def __init__(self, obj, attr): key = f"getattr-{tokenize(obj, attr, pure=True)}" super().__init__(key, None) self._obj = obj self._attr = attr def __getattr__(self, attr): # Calling np.dtype(dask.delayed(...)) used ...
DelayedAttr
python
getsentry__sentry
src/sentry/api/endpoints/organization_releases.py
{ "start": 10777, "end": 37459 }
class ____(OrganizationReleasesBaseEndpoint, ReleaseAnalyticsMixin): publish_status = { "GET": ApiPublishStatus.UNKNOWN, "POST": ApiPublishStatus.UNKNOWN, } rate_limits = RateLimitConfig( limit_overrides={ "GET": { RateLimitCategory.IP: RateLimit(limit=40...
OrganizationReleasesEndpoint
python
apache__airflow
task-sdk/src/airflow/sdk/execution_time/secrets/execution_api.py
{ "start": 1041, "end": 6653 }
class ____(BaseSecretsBackend): """ Secrets backend for client contexts (workers, DAG processors, triggerers). Routes connection and variable requests through SUPERVISOR_COMMS to the Execution API server. This backend should only be registered in client processes, not in API server/scheduler proces...
ExecutionAPISecretsBackend
python
numba__numba
numba/core/types/misc.py
{ "start": 14411, "end": 14609 }
class ____(SimpleIteratorType): def __init__(self, dtype): name = "iter_unicode" self.data = dtype super(UnicodeIteratorType, self).__init__(name, dtype)
UnicodeIteratorType
python
pdm-project__pdm
src/pdm/formats/base.py
{ "start": 895, "end": 1321 }
class ____(type): def __init__(cls, name: str, bases: tuple[type, ...], ns: dict[str, Any]) -> None: super().__init__(name, bases, ns) cls._converters = {} _default = object() for key, value in ns.items(): if getattr(value, "_convert_from", _default) is not _default: ...
_MetaConverterMeta
python
apache__airflow
airflow-ctl/src/airflowctl/api/operations.py
{ "start": 4029, "end": 6079 }
class ____: """ Base class for operations. This class is used to decorate all callable methods with a check for ServerResponseError. Set exit_in_error false to not exit. """ __slots__ = ("client", "response", "exit_in_error") def __init__(self, client: Client, response=None, exit_in_error...
BaseOperations
python
davidhalter__jedi
test/refactor/extract_variable.py
{ "start": 2779, "end": 2902 }
class ____(foo.Bar): pass # ++++++++++++++++++++++++++++++++++++++++++++++++++ #? 12 text {'new_name': 'x'} x = foo.Bar
Foo
python
charliermarsh__ruff
crates/ty_python_semantic/resources/corpus/88_regression_generic_method_with_nested_function.py
{ "start": 109, "end": 211 }
class ____: def method[T](self, x: T) -> T: def inner(): self.attr = 1 C().attr
C
python
scipy__scipy
scipy/signal/tests/test_dltisys.py
{ "start": 20190, "end": 21567 }
class ____: """Test private conversions between 'z' and 'z**-1' polynomials.""" def test_full(self): # Numerator and denominator same order num = np.asarray([2.0, 3, 4]) den = np.asarray([5.0, 6, 7]) num2, den2 = TransferFunction._z_to_zinv(num, den) xp_assert_equal(num,...
TestTransferFunctionZConversion
python
sanic-org__sanic
sanic/worker/reloader.py
{ "start": 387, "end": 3955 }
class ____: INTERVAL = 1.0 # seconds def __init__( self, publisher: Connection, interval: float, reload_dirs: set[Path], app_loader: AppLoader, ): self._publisher = publisher self.interval = interval or self.INTERVAL self.reload_dirs = reload...
Reloader
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/overloads.py
{ "start": 455, "end": 715 }
class ____: def call_me(self, x): _test_sink(x) @overload def g(o: A) -> None: pass @overload def g(o: int) -> None: pass def g(o): x = _test_source() if isinstance(o, A): o.call_me(x) # Requires type refinement on `o`.
A
python
weaviate__weaviate-python-client
weaviate/collections/classes/config.py
{ "start": 64345, "end": 64491 }
class ____(_ConfigBase): model: Dict[str, Any] reranker: Union[Rerankers, str] RerankerConfig = _RerankerConfig @dataclass
_RerankerConfig
python
tensorflow__tensorflow
tensorflow/python/data/kernel_tests/shard_test.py
{ "start": 8170, "end": 9368 }
class ____( test_base.DatasetTestBase, parameterized.TestCase): @combinations.generate( combinations.times( test_base.default_test_combinations(), combinations.combine( dataset_range=[100], num_shards=[1, 3, 5], shard_index=[0, 1, 2, 4], ...
ShardGlobalShuffleTest
python
has2k1__plotnine
plotnine/mapping/aes.py
{ "start": 1504, "end": 13766 }
class ____(Dict[str, Any]): """ Create aesthetic mappings Parameters ---------- x : str | array_like | scalar x aesthetic mapping y : str | array_like | scalar y aesthetic mapping **kwargs : Any Other aesthetic mappings Notes ----- Only the **x** and **y...
aes
python
ray-project__ray
python/ray/dashboard/modules/metrics/dashboards/common.py
{ "start": 12934, "end": 13295 }
class ____: """Defines a Grafana row that can contain multiple panels. Attributes: title: The title of the row panels: List of panels contained in this row collapsed: Whether the row should be collapsed by default """ title: str id: int panels: List[Panel] collapsed...
Row
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_permissions.py
{ "start": 3685, "end": 3874 }
class ____: @require_permission_check(Permissions.LAUNCH_PARTITION_BACKFILL) async def mutate(self, graphene_info, **_kwargs): pass
EndpointMissingRequiredPermissionCheckAsync
python
TheAlgorithms__Python
sorts/external_sort.py
{ "start": 109, "end": 1103 }
class ____: BLOCK_FILENAME_FORMAT = "block_{0}.dat" def __init__(self, filename): self.filename = filename self.block_filenames = [] def write_block(self, data, block_number): filename = self.BLOCK_FILENAME_FORMAT.format(block_number) with open(filename, "w") as file: ...
FileSplitter
python
django__django
tests/admin_views/admin.py
{ "start": 38151, "end": 38250 }
class ____(admin.ModelAdmin): list_display = ("title", "book") sortable_by = ()
ChapterAdmin6
python
celery__celery
celery/backends/cache.py
{ "start": 2340, "end": 4831 }
class ____(KeyValueStoreBackend): """Cache result backend.""" servers = None supports_autoexpire = True supports_native_join = True implements_incr = True def __init__(self, app, expires=None, backend=None, options=None, url=None, **kwargs): options = {} if not options...
CacheBackend
python
pytorch__pytorch
test/torch_np/test_ufuncs_basic.py
{ "start": 873, "end": 4259 }
class ____(TestCase): def get_x(self, ufunc): return np.arange(5, dtype="float64") @parametrize_unary_ufuncs def test_scalar(self, ufunc): # check that ufunc accepts a scalar and the result is convertible to scalar x = self.get_x(ufunc)[0] float(ufunc(x)) @skip(True, re...
TestUnaryUfuncs
python
numba__numba
numba/np/arrayobj.py
{ "start": 33562, "end": 257882 }
class ____(object): """ Perform fancy indexing on the given array. """ def __init__(self, context, builder, aryty, ary, index_types, indices): self.context = context self.builder = builder self.aryty = aryty self.shapes = cgutils.unpack_tuple(builder, ary.shape, aryty.nd...
FancyIndexer
python
django__django
tests/generic_views/views.py
{ "start": 1667, "end": 1787 }
class ____(generic.ListView): template_name = "generic_views/list.html" queryset = Artist.objects.all()
ArtistList
python
h5py__h5py
h5py/tests/test_group.py
{ "start": 14847, "end": 15397 }
class ____(BaseMapping): """ Feature: You can iterate over group members via "for x in y", etc. """ def test_iter(self): """ "for x in y" iteration """ lst = [x for x in self.f] self.assertSameElements(lst, self.groups) def test_iter_zero(self): """ Iteration w...
TestIter
python
sympy__sympy
sympy/physics/quantum/kind.py
{ "start": 1191, "end": 1484 }
class ____(Kind): """A kind for quantum bras.""" def __new__(cls): obj = super().__new__(cls) return obj def __repr__(self): return "BraKind" # Create an instance as many situations need this. BraKind = _BraKind() from sympy.core.kind import Kind
_BraKind
python
numba__llvmlite
llvmlite/binding/ffi.py
{ "start": 2356, "end": 3622 }
class ____: """A Lock to guarantee thread-safety for the LLVM C-API. This class implements __enter__ and __exit__ for acquiring and releasing the lock as a context manager. Also, callbacks can be attached so that every time the lock is acquired and released the corresponding callbacks will be invo...
_LLVMLock
python
dask__distributed
distributed/active_memory_manager.py
{ "start": 20045, "end": 21743 }
class ____(ActiveMemoryManagerPolicy): """Make sure that in-memory tasks are not replicated on more workers than desired; drop the excess replicas. """ def run(self) -> SuggestionGenerator: nkeys = 0 ndrop = 0 for ts in self.manager.scheduler.replicated_tasks: desir...
ReduceReplicas
python
altair-viz__altair
tools/markup.py
{ "start": 1454, "end": 1941 }
class ____(_RSTRenderer): def __init__(self) -> None: super().__init__() def inline_html(self, token: Token, state: BlockState) -> str: html = token["raw"] if html == "<br/>": return "\n" # HACK: https://github.com/vega/altair/pull/3787#discussion_r1939885356 ...
RSTRenderer
python
jina-ai__jina
jina/proto/docarray_v1/pb/jina_pb2_grpc.py
{ "start": 5808, "end": 6900 }
class ____(object): """* jina gRPC service for DataRequests. This is used to send requests to Executors when a list of requests is not needed """ def stream_doc(self, request, context): """Used for streaming one document to the Executors""" context.set_code(grpc.StatusCode.UNIMPLEME...
JinaSingleDocumentRequestRPCServicer
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_bugbear/B024.py
{ "start": 766, "end": 849 }
class ____(ABC): @abstractaoeuaoeuaoeu def method(self): foo()
Base_6
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typeVarDefault2.py
{ "start": 548, "end": 585 }
class ____[T: int = float]: ...
ClassT3
python
sqlalchemy__sqlalchemy
test/engine/test_ddlevents.py
{ "start": 17402, "end": 17972 }
class ____(DDLEventWCreateHarness, fixtures.TestBase): creates_implicitly_with_table = False drops_implicitly_with_table = True supports_standalone_create = False @testing.fixture def produce_subject(self): return Index("my_idx", "key") @testing.fixture def produce_table_integrated...
IndexDDLEventTest
python
dagster-io__dagster
python_modules/libraries/dagster-dbt/dagster_dbt/cloud/resources.py
{ "start": 915, "end": 1240 }
class ____(str, Enum): QUEUED = "Queued" STARTING = "Starting" RUNNING = "Running" SUCCESS = "Success" ERROR = "Error" CANCELLED = "Cancelled" # TODO: This resource should be a wrapper over an existing client for a accessing dbt Cloud, # rather than using requests to the API directly.
DbtCloudRunStatus
python
scipy__scipy
scipy/sparse/tests/test_base.py
{ "start": 101207, "end": 102051 }
class ____: def test_solve(self): # Test whether the lu_solve command segfaults, as reported by Nils # Wagner for a 64-bit machine, 02 March 2005 (EJS) n = 20 np.random.seed(0) # make tests repeatable A = zeros((n,n), dtype=complex) x = np.random.rand(n) y = ...
_TestSolve
python
walkccc__LeetCode
solutions/2767. Partition String Into Minimum Beautiful Substrings/2767.py
{ "start": 0, "end": 619 }
class ____: def minimumBeautifulSubstrings(self, s: str) -> int: n = len(s) # dp[i] := the minimum number of beautiful substrings for the first i chars dp = [0] + [n + 1] * n for i in range(1, n + 1): if s[i - 1] == '0': continue num = 0 # the number of s[i - 1..j - 1] for ...
Solution
python
chroma-core__chroma
sample_apps/generative_benchmarking/functions/types.py
{ "start": 470, "end": 534 }
class ____: lookup: Dict[str, QueryItem] @dataclass
QueryLookup
python
run-llama__llama_index
llama-index-integrations/vector_stores/llama-index-vector-stores-clickhouse/llama_index/vector_stores/clickhouse/base.py
{ "start": 1469, "end": 3344 }
class ____: """ ClickHouse Client Configuration. Args: table (str): Table name to operate on. database (str): Database name to find the table. engine (str): Engine. Options are "MergeTree" and "Memory". Default is "MergeTree". index_type (str): Index type string. met...
ClickHouseSettings
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/dlp.py
{ "start": 107744, "end": 111851 }
class ____(GoogleCloudBaseOperator): """ Updates the InspectTemplate. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:CloudDLPUpdateInspectTemplateOperator` :param template_id: The ID of the inspect template to be updated. ...
CloudDLPUpdateInspectTemplateOperator
python
scipy__scipy
scipy/stats/tests/test_stats.py
{ "start": 86310, "end": 98837 }
class ____: def test_linregressBIGX(self): # W.II.F. Regress BIG on X. result = stats.linregress(X, BIG) assert_almost_equal(result.intercept, 99999990) assert_almost_equal(result.rvalue, 1.0) # The uncertainty ought to be almost zero # since all points lie on a line...
TestRegression
python
walkccc__LeetCode
solutions/230. Kth Smallest Element in a BST/230-2.py
{ "start": 0, "end": 390 }
class ____: def kthSmallest(self, root: TreeNode | None, k: int) -> int: rank = 0 ans = 0 def traverse(root: TreeNode | None) -> None: nonlocal rank nonlocal ans if not root: return traverse(root.left) rank += 1 if rank == k: ans = root.val ret...
Solution
python
pytorch__pytorch
test/quantization/core/experimental/test_floatx.py
{ "start": 15120, "end": 16750 }
class ____(TestCase): """ Test of mul implementation NOTE: this is CPU-only for now because adding it to CUDA requires adding yet another C++ dtype macro, and there is no use case yet for unscaled float8 multiplication - doesn't seem worth it. """ @dtypes(*CUDA_FLOAT8_DTYPES) def test_...
TestFloat8DtypeCPUOnly
python
GoogleCloudPlatform__python-docs-samples
appengine/standard_python3/bundled-services/deferred/wsgi/main.py
{ "start": 2131, "end": 2637 }
class ____: def __call__(self, environ, start_response): path = environ.get("PATH_INFO", "").lstrip("/") for regex, handler in routes.items(): match = re.search(regex, path) if match is not None: return handler(environ, start_response) start_response(...
WSGIApplication
python
getsentry__sentry
src/sentry/relocation/api/serializers/relocation.py
{ "start": 605, "end": 1395 }
class ____: """ Some useful info to collect about a relocation when serving it. """ # Maps the creator/owner's (aka "meta" users) `id`s to their respective `username`. meta_users: Mapping[int, RpcUser] # List the ids of the imported `User` models. imported_user_ids: list[int] # List t...
RelocationMetadata
python
gevent__gevent
src/greentest/3.12/test_socket.py
{ "start": 201880, "end": 206379 }
class ____(FileObjectClassTestCase): """Repeat the tests from FileObjectClassTestCase with bufsize==0. In this case (and in this case only), it should be possible to create a file object, read a line from it, create another file object, read another line from it, without loss of data in the first ...
UnbufferedFileObjectClassTestCase
python
python-openxml__python-docx
src/docx/opc/constants.py
{ "start": 132, "end": 8549 }
class ____: """Content type URIs (like MIME-types) that specify a part's format.""" BMP = "image/bmp" DML_CHART = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml" DML_CHARTSHAPES = "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml" DML_DIAGRAM_COLORS = "app...
CONTENT_TYPE
python
Lightning-AI__lightning
tests/tests_pytorch/callbacks/test_spike.py
{ "start": 381, "end": 1346 }
class ____(LightningModule): def __init__(self, spike_global_rank: int, spike_value): super().__init__() self.layer = torch.nn.Linear(1, 1, bias=False) self.spike_global_rank = spike_global_rank self.spike_value = spike_value def training_step(self, batch, batch_idx: int): ...
IdentityModule
python
Textualize__textual
src/textual/widgets/_header.py
{ "start": 2644, "end": 6295 }
class ____(Widget): """A header widget with icon and clock.""" DEFAULT_CSS = """ Header { dock: top; width: 100%; background: $panel; color: $foreground; height: 1; } Header.-tall { height: 3; } """ DEFAULT_CLASSES = "" tall: Reactiv...
Header
python
google__pytype
pytype/abstract/_classes.py
{ "start": 4350, "end": 13323 }
class ____(_instance_base.SimpleValue, class_mixin.Class): """An abstract wrapper for user-defined class objects. These are the abstract value for class objects that are implemented in the program. """ def __init__( self, name: str, bases: list[cfg.Variable], members: dict[str, cfg.V...
InterpreterClass