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
scrapy__scrapy
tests/test_request_attribute_binding.py
{ "start": 610, "end": 905 }
class ____: def process_exception(self, request, exception): return Response( url="http://localhost/", body=b"Caught " + exception.__class__.__name__.encode("utf-8"), request=Request(OVERRIDDEN_URL), )
CatchExceptionOverrideRequestMiddleware
python
kamyu104__LeetCode-Solutions
Python/n-queens-ii.py
{ "start": 30, "end": 719 }
class ____(object): def totalNQueens(self, n): """ :type n: int :rtype: int """ def dfs(row): if row == n: return 1 result = 0 for i in xrange(n): if cols[i] or main_diag[row+i] or anti_diag[row-i+(n-1)]: ...
Solution
python
realpython__materials
python-t-strings/logging_message.py
{ "start": 132, "end": 1066 }
class ____: def __init__(self, template): if not isinstance(template, Template): raise TypeError("t-string expected") self.template = template @property def message(self): parts = [] for item in self.template: if isinstance(item, str): ...
TemplateMessage
python
getsentry__sentry
tests/sentry/integrations/slack/threads/activity_notifications/__init__.py
{ "start": 93, "end": 207 }
class ____(TestCase): def setUp(self) -> None: self.activity.type = ActivityType.CREATE_ISSUE
BaseTestCase
python
scikit-learn__scikit-learn
sklearn/preprocessing/_encoders.py
{ "start": 818, "end": 18882 }
class ____(TransformerMixin, BaseEstimator): """ Base class for encoders that includes the code to categorize and transform the input features. """ def _check_X(self, X, ensure_all_finite=True): """ Perform custom check_array: - convert list of strings to object dtype ...
_BaseEncoder
python
Pylons__pyramid
docs/tutorials/wiki2/src/tests/tests/test_views.py
{ "start": 2210, "end": 3523 }
class ____: def _callFUT(self, request): from tutorial.views.default import add_page return add_page(request) def _makeContext(self, pagename): from tutorial.routes import NewPage return NewPage(pagename) def _addRoutes(self, config): config.add_route('add_page', '/...
Test_add_page
python
explosion__spaCy
spacy/lang/hy/__init__.py
{ "start": 218, "end": 317 }
class ____(Language): lang = "hy" Defaults = ArmenianDefaults __all__ = ["Armenian"]
Armenian
python
getsentry__sentry
tests/sentry/issue_detection/test_db_main_thread_detector.py
{ "start": 627, "end": 3802 }
class ____(TestCase): def setUp(self) -> None: super().setUp() self._settings = get_detection_settings() def find_problems(self, event: dict[str, Any]) -> list[PerformanceProblem]: detector = DBMainThreadDetector(self._settings, event) run_detector_on_data(detector, event) ...
DBMainThreadDetectorTest
python
jazzband__django-polymorphic
src/polymorphic/tests/models.py
{ "start": 3344, "end": 3448 }
class ____(One2OneRelatingModel): field2 = models.CharField(max_length=30)
One2OneRelatingModelDerived
python
PyCQA__pycodestyle
testing/data/E21.py
{ "start": 195, "end": 226 }
class ____ (Bar, Baz): pass
Foo
python
charliermarsh__ruff
crates/ruff_python_parser/resources/inline/ok/non_duplicate_type_parameter_names.py
{ "start": 60, "end": 150 }
class ____[T, U, V]: ... type Alias[T, U: str, V: (str, bytes), *Ts, **P, D = default] = ...
C
python
apache__airflow
dev/breeze/src/airflow_breeze/commands/testing_commands.py
{ "start": 50867, "end": 60256 }
class ____: def __init__(self, shell_params: ShellParams, terminated_on_timeout_output_list: list[bool]): # Initialize the timeout handler with shell parameters and a list to track terminated outputs # The terminated_on_timeout_output_list list is used to signal to the outside world that the ...
TimeoutHandler
python
facebookresearch__faiss
tests/test_graph_based.py
{ "start": 6926, "end": 7903 }
class ____(unittest.TestCase): def test_issue3684(self): np.random.seed(1234) # For reproducibility d = 256 # Example dimension nb = 10 # Number of database vectors nq = 2 # Number of query vectors xb = np.random.random((nb, d)).astype('float32') xq = np.random....
Issue3684
python
pytorch__pytorch
test/distributed/elastic/events/lib_test.py
{ "start": 595, "end": 2096 }
class ____(TestCase): def assert_event(self, actual_event, expected_event): self.assertEqual(actual_event.name, expected_event.name) self.assertEqual(actual_event.source, expected_event.source) self.assertEqual(actual_event.timestamp, expected_event.timestamp) self.assertDictEqual(ac...
EventLibTest
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/selectable.py
{ "start": 84763, "end": 99547 }
class ____(roles.HasCTERole, SelectsRows): """Mixin that declares a class to include CTE support.""" _has_ctes_traverse_internals: _TraverseInternalsType = [ ("_independent_ctes", InternalTraversal.dp_clauseelement_list), ("_independent_ctes_opts", InternalTraversal.dp_plain_obj), ] _i...
HasCTE
python
doocs__leetcode
solution/3300-3399/3309.Maximum Possible Number by Binary Concatenation/Solution.py
{ "start": 0, "end": 234 }
class ____: def maxGoodNumber(self, nums: List[int]) -> int: ans = 0 for arr in permutations(nums): num = int("".join(bin(i)[2:] for i in arr), 2) ans = max(ans, num) return ans
Solution
python
numpy__numpy
numpy/_core/arrayprint.py
{ "start": 54017, "end": 65084 }
class ____: """ Formatter for structured np.void objects. This does not work on structured alias types like np.dtype(('i4', 'i2,i2')), as alias scalars lose their field information, and the implementation relies upon np.void.__getitem__. """ def __init__(self, format_functions): sel...
StructuredVoidFormat
python
joke2k__faker
tests/providers/test_isbn.py
{ "start": 672, "end": 1259 }
class ____: def test_check_digit_is_correct(self): isbn = ISBN13(ean="978", group="1", registrant="4516", publication="7331") assert isbn.check_digit == "9" isbn = ISBN13(ean="978", group="1", registrant="59327", publication="599") assert isbn.check_digit == "0" isbn = ISBN13...
TestISBN13
python
kamyu104__LeetCode-Solutions
Python/minimum-flips-to-make-a-or-b-equal-to-c.py
{ "start": 450, "end": 877 }
class ____(object): def minFlips(self, a, b, c): """ :type a: int :type b: int :type c: int :rtype: int """ result = 0 for i in xrange(31): a_i, b_i, c_i = map(lambda x: x&1, [a, b, c]) if (a_i | b_i) != c_i: res...
Solution2
python
django-crispy-forms__django-crispy-forms
crispy_forms/bootstrap.py
{ "start": 13254, "end": 16490 }
class ____(Div): """ A layout object for rendering a single field with any number of buttons. Attributes ---------- template : str The default template which this Layout Object will be rendered with. css_class : str, optional CSS classes to be applied to the wrapping ``<...
FieldWithButtons
python
scikit-learn__scikit-learn
sklearn/utils/_set_output.py
{ "start": 10975, "end": 14812 }
class ____: """Mixin that dynamically wraps methods to return container based on config. Currently `_SetOutputMixin` wraps `transform` and `fit_transform` and configures it based on `set_output` of the global configuration. `set_output` is only defined if `get_feature_names_out` is defined and `au...
_SetOutputMixin
python
readthedocs__readthedocs.org
readthedocs/organizations/models.py
{ "start": 13541, "end": 15567 }
class ____(models.Model): """Intermediate table for Team <-> Member/Invite relationships.""" class Meta: unique_together = ( ("team", "member", "invite"), ("team", "member"), ("team", "invite"), ) team = models.ForeignKey( Team, on_delete...
TeamMember
python
allegroai__clearml
clearml/backend_api/services/v2_23/datasets.py
{ "start": 250276, "end": 252029 }
class ____(Response): """ Response of datasets.update endpoint. :param updated: Number of datasets updated (0 or 1) :type updated: int :param fields: Updated fields names names and values :type fields: dict """ _service = "datasets" _action = "update" _version = "2.23" _sc...
UpdateResponse
python
pytorch__pytorch
torch/_functorch/_aot_autograd/descriptors.py
{ "start": 24467, "end": 24733 }
class ____(AOTOutput): """The world token output for side-effectful calls, returned so we cannot DCE it, forward only""" idx: int def expr(self) -> str: return f"__forward_token{self.idx}" @dataclasses.dataclass(frozen=True)
ForwardTokenAOTOutput
python
apache__airflow
airflow-ctl/src/airflowctl/api/datamodels/generated.py
{ "start": 32462, "end": 32714 }
class ____(BaseModel): """ Asset alias collection response. """ asset_aliases: Annotated[list[AssetAliasResponse], Field(title="Asset Aliases")] total_entries: Annotated[int, Field(title="Total Entries")]
AssetAliasCollectionResponse
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/callable3.py
{ "start": 235, "end": 267 }
class ____(Generic[R]): ...
ClassA
python
google__jax
tests/jax_numpy_error_test.py
{ "start": 930, "end": 9366 }
class ____(jtu.JaxTestCase): def setUp(self): # TODO(b/408148001): Fix thread safety issue. if jtu.TEST_NUM_THREADS.value > 1: self.skipTest("Test does not work with multiple threads") super().setUp() @parameterized.product(jit=[True, False]) def test_set_error_if_nan(self, jit): def f(x): ...
JaxNumpyErrorTests
python
django__django
django/forms/widgets.py
{ "start": 34990, "end": 41292 }
class ____(Widget): """ A widget that splits date input into three <select> boxes. This also serves as an example of a Widget that has more than one HTML element and hence implements value_from_datadict. """ none_value = ("", "---") month_field = "%s_month" day_field = "%s_day" yea...
SelectDateWidget
python
realpython__materials
python-314/repl/test_dummy.py
{ "start": 18, "end": 116 }
class ____(unittest.TestCase): def test_dummy(self): self.assertEqual(2 + 2, 22)
TestDummy
python
run-llama__llama_index
llama-index-integrations/vector_stores/llama-index-vector-stores-azurepostgresql/llama_index/vector_stores/azure_postgres/common/_shared.py
{ "start": 6612, "end": 6807 }
class ____(str, Enum): """Enumeration for vector types used in vector similarity search.""" bit = "bit" halfvec = "halfvec" sparsevec = "sparsevec" vector = "vector"
VectorType
python
streamlit__streamlit
lib/tests/streamlit/elements/echo_test.py
{ "start": 1565, "end": 2826 }
class ____: def do_x(self): pass def do_y(self): pass""" element = self.get_delta_from_queue(echo_index).new_element assert echo_str == element.code.code_text element = self.get_delta_from_queue(output_index).new_element assert element.markdown.body == "Hello" ...
MyClass
python
apache__airflow
providers/apache/kafka/src/airflow/providers/apache/kafka/sensors/kafka.py
{ "start": 4704, "end": 8992 }
class ____(BaseSensorOperator): """ Defer until a specific message is published to Kafka, trigger a registered function, then resume waiting. The behavior of the consumer for this trigger is as follows: - poll the Kafka topics for a message - if no message returned, sleep - process the message ...
AwaitMessageTriggerFunctionSensor
python
celery__celery
examples/eventlet/bulk_task_producer.py
{ "start": 141, "end": 529 }
class ____: result = None def __init__(self, callback=None): self.callback = callback self.ready = Event() def finished(self, result): self.result = result if self.callback: self.callback(result) self.ready.send() def wait(self, timeout=None): ...
Receipt
python
bokeh__bokeh
src/bokeh/events.py
{ "start": 17859, "end": 18907 }
class ____(PointEvent): ''' Announce a mouse wheel event on a Bokeh plot. Attributes: delta (float) : the (signed) scroll speed sx (float) : x-coordinate of the event in *screen* space sy (float) : y-coordinate of the event in *screen* space x (float) : x-coordinate of the event...
MouseWheel
python
pytorch__pytorch
test/dynamo/cpython/3_13/test_with.py
{ "start": 1755, "end": 2774 }
class ____(object): def __init__(self, *managers): self.managers = managers self.entered = None def __enter__(self): if self.entered is not None: raise RuntimeError("Context is not reentrant") self.entered = deque() vars = [] try: for mgr...
Nested
python
run-llama__llama_index
llama-index-integrations/storage/docstore/llama-index-storage-docstore-couchbase/llama_index/storage/docstore/couchbase/base.py
{ "start": 251, "end": 2592 }
class ____(KVDocumentStore): """ Couchbase Document (Node) store. A documents store for Document and Node objects using Couchbase. """ def __init__( self, couchbase_kvstore: CouchbaseKVStore, namespace: Optional[str] = None, batch_size: int = DEFAULT_BATCH_SIZE, ...
CouchbaseDocumentStore
python
getsentry__sentry
tests/sentry/workflow_engine/processors/test_workflow.py
{ "start": 30849, "end": 37729 }
class ____(BaseWorkflowTest): def setUp(self) -> None: ( self.workflow, self.detector, self.detector_workflow, self.workflow_triggers, ) = self.create_detector_and_workflow() self.action_group, self.action = self.create_workflow_action(workflo...
TestEvaluateWorkflowActionFilters
python
pennersr__django-allauth
allauth/account/migrations/0001_initial.py
{ "start": 170, "end": 3325 }
class ____(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name="EmailAddress", fields=[ ( "id", models.AutoField( ...
Migration
python
google__jax
tests/pallas/mgpu_ragged_dot_test.py
{ "start": 2196, "end": 5760 }
class ____(jtu.JaxTestCase): def setUp(self): super().setUp() if ragged_dot_mgpu is None: self.skipTest("Mosaic GPU not available.") if (not jtu.test_device_matches(["cuda"]) or not jtu.is_cuda_compute_capability_equal("9.0")): self.skipTest("Only works on GPU with capability sm90a") ...
RaggedDotTestCase
python
getsentry__sentry
tests/sentry/integrations/jira_server/test_integration.py
{ "start": 1881, "end": 3430 }
class ____(APITestCase): def setUp(self) -> None: super().setUp() self.min_ago = before_now(minutes=1).isoformat() ( self.integration, self.org_integration, self.identity, self.identity_provider, ) = self.create_identity_integration( ...
JiraServerIntegrationBaseTest
python
run-llama__llama_index
llama-index-integrations/llms/llama-index-llms-featherlessai/llama_index/llms/featherlessai/base.py
{ "start": 98, "end": 1419 }
class ____(OpenAILike): """ Featherless LLM. Examples: `pip install llama-index-llms-featherlessai` ```python from llama_index.llms.featherlessai import FeatherlessLLM # set api key in env or in llm # import os # os.environ["FEATHERLESS_API_KEY"] = "your api ...
FeatherlessLLM
python
django__django
tests/queries/models.py
{ "start": 2833, "end": 2925 }
class ____(models.Model): report = models.ForeignKey(Report, models.CASCADE)
ReportComment
python
tensorflow__tensorflow
tensorflow/python/tools/saved_model_cli_sanitize_list_test.py
{ "start": 401, "end": 882 }
class ____(test.TestCase, parameterized.TestCase): def test_trims_and_drops_empty_and_none(self): self.assertEqual( smcli._sanitize_nonempty_str_list( [' a ', '', '\t', None, 'b '], 'field' ), ['a', 'b'], ) def test_raises_on_all_empty_like_inputs(self): with self.a...
SanitizeNonEmptyStrListTest
python
getsentry__sentry
src/sentry/migrations/0931_add_hit_counter_columns_to_grouptombstone.py
{ "start": 194, "end": 1726 }
class ____(CheckedMigration): # This flag is used to mark that a migration shouldn't be automatically run in production. # This should only be used for operations where it's safe to run the migration after your # code has deployed. So this should not be used for most operations that alter the schema # o...
Migration
python
sqlalchemy__sqlalchemy
test/orm/test_cascade.py
{ "start": 96518, "end": 100984 }
class ____(fixtures.MappedTest): """Test orphan behavior on an entity that requires two parents via one-to-many (many-to-one reference to the orphan). """ @classmethod def define_tables(cls, metadata): Table( "addresses", metadata, Column( ...
DoubleParentM2OOrphanTest
python
kamyu104__LeetCode-Solutions
Python/climbing-stairs.py
{ "start": 827, "end": 1064 }
class ____(object): """ :type n: int :rtype: int """ def climbStairs(self, n): prev, current = 0, 1 for i in xrange(n): prev, current = current, prev + current, return current
Solution2
python
docker__docker-py
docker/transport/npipesocket.py
{ "start": 6098, "end": 6585 }
class ____(io.RawIOBase): def __init__(self, npipe_socket): self.sock = npipe_socket def close(self): super().close() self.sock = None def fileno(self): return self.sock.fileno() def isatty(self): return False def readable(self): return True d...
NpipeFileIOBase
python
etianen__django-reversion
tests/test_app/tests/test_api.py
{ "start": 2248, "end": 2438 }
class ____(TestBase): def testUnregisterNotRegistered(self): with self.assertRaises(reversion.RegistrationError): reversion.unregister(User)
UnregisterUnregisteredTest
python
keras-team__keras
keras/src/metrics/hinge_metrics_test.py
{ "start": 96, "end": 1348 }
class ____(testing.TestCase): def test_config(self): hinge_obj = hinge_metrics.Hinge(name="hinge", dtype="int32") self.assertEqual(hinge_obj.name, "hinge") self.assertEqual(hinge_obj._dtype, "int32") # Check save and restore config hinge_obj2 = hinge_metrics.Hinge.from_confi...
HingeTest
python
tox-dev__tox
src/tox/tox_env/python/api.py
{ "start": 12704, "end": 13008 }
class ____(Fail): """could not find interpreter.""" def __init__(self, base_pythons: list[str]) -> None: self.base_pythons = base_pythons def __str__(self) -> str: return f"could not find python interpreter matching any of the specs {', '.join(self.base_pythons)}"
NoInterpreter
python
python-openxml__python-docx
tests/oxml/test_xmlchemy.py
{ "start": 27253, "end": 27364 }
class ____(BaseBuilder): __tag__ = "w:zomChild" __nspfxs__ = ("w",) __attrs__ = ()
CT_ZomChildBuilder
python
sympy__sympy
sympy/core/relational.py
{ "start": 30099, "end": 30432 }
class ____(_Inequality): """Not intended for general use. _Less is only used so that LessThan and StrictLessThan may subclass it for the .gts and .lts properties. """ __slots__ = () @property def gts(self): return self._args[1] @property def lts(self): return self...
_Less
python
pypa__warehouse
tests/unit/legacy/api/xmlrpc/test_cache.py
{ "start": 9733, "end": 13395 }
class ____: @pytest.mark.parametrize( ("service_available", "xmlrpc_cache"), [(True, True), (True, False), (False, True), (False, False)], ) def test_deriver(self, service_available, xmlrpc_cache, mockredis): context = pretend.stub() purger = pretend.call_recorder(lambda tags...
TestDeriver
python
protocolbuffers__protobuf
python/google/protobuf/runtime_version.py
{ "start": 504, "end": 1024 }
class ____(Enum): GOOGLE_INTERNAL = 1 PUBLIC = 2 # The versions of this Python Protobuf runtime to be changed automatically by # the Protobuf release process. Do not edit them manually. # These OSS versions are not stripped to avoid merging conflicts. OSS_DOMAIN = Domain.PUBLIC OSS_MAJOR = 6 OSS_MINOR = 34 OSS_PA...
Domain
python
pytorch__pytorch
torch/distributed/checkpoint/stateful.py
{ "start": 149, "end": 1061 }
class ____(Protocol): """ Stateful protocol for objects that can be checkpointed and restored. """ def state_dict(self) -> dict[str, Any]: """ Objects should return their state_dict representation as a dictionary. The output of this function will be checkpointed, and later resto...
Stateful
python
getsentry__sentry
src/sentry/uptime/endpoints/validators.py
{ "start": 4411, "end": 13242 }
class ____(CamelSnakeSerializer): name = serializers.CharField( required=True, max_length=128, help_text="Name of the uptime monitor.", ) status = serializers.ChoiceField( choices=list(zip(MONITOR_STATUSES.keys(), MONITOR_STATUSES.keys())), default="active", h...
UptimeMonitorValidator
python
pyca__cryptography
tests/hazmat/primitives/test_ssh.py
{ "start": 72850, "end": 73317 }
class ____: @staticmethod def ssh_str(application): data = ( len(application).to_bytes(length=4, byteorder="big") + application.encode() ) return memoryview(data) def test_load_application(self): ssh.load_application(self.ssh_str("ssh:test")) def...
TestSSHSK
python
jazzband__django-oauth-toolkit
tests/db_router.py
{ "start": 1644, "end": 2486 }
class ____: # alpha is where the core Django models are stored including user. To keep things # simple this is where the oauth2 provider models are stored as well because they # have a foreign key to User. def db_for_read(self, model, **hints): if model._meta.model_name == "accesstoken": ...
CrossDatabaseRouter
python
ray-project__ray
python/ray/tests/test_autoscaler.py
{ "start": 5166, "end": 6315 }
class ____(StandardAutoscaler): """Test autoscaler constructed to verify the property that each autoscaler update issues at most one provider.non_terminated_nodes call. """ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fail_to_find_ip_during_drain = False ...
MockAutoscaler
python
numpy__numpy
numpy/f2py/tests/util.py
{ "start": 8122, "end": 9761 }
class ____(MesonBackend): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def compile(self): self.write_meson_build(self.build_dir) self.run_meson(self.build_dir) def build_meson(source_files, module_name=None, **kwargs): """ Build a module via Meson and...
SimplifiedMesonBackend
python
pytorch__pytorch
test/test_stateless.py
{ "start": 642, "end": 1015 }
class ____(torch.nn.Module): def __init__(self) -> None: super().__init__() self.l1 = torch.nn.Linear(1, 1) self.tied_bias = self.l1.bias self.buffer = torch.nn.Buffer(torch.ones(1)) self.tied_buffer = self.buffer def forward(self, x): return self.l1(x) + self.ti...
MockTiedModule
python
pydantic__pydantic
pydantic-core/tests/validators/test_union.py
{ "start": 4215, "end": 29990 }
class ____: class ModelA: pass class ModelB: pass @pytest.fixture(scope='class') def schema_validator(self) -> SchemaValidator: return SchemaValidator( schema=core_schema.union_schema( choices=[ core_schema.model_schema( ...
TestModelClassSimilar
python
huggingface__transformers
src/transformers/models/blt/modular_blt.py
{ "start": 11691, "end": 13748 }
class ____(MllamaTextCrossAttention): """Cross-attention module for Blt, following transformers style""" def __init__(self, config: BltConfig, layer_idx: int, hidden_size: Optional[int] = None): super().__init__() self.is_causal = False self.q_norm = BltRMSNorm(self.hidden_size, eps=con...
BltCrossAttention
python
langchain-ai__langchain
libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_file_search.py
{ "start": 11775, "end": 12369 }
class ____: """Tests for _match_include_pattern helper function.""" def test_match_pattern_with_braces(self) -> None: """Test matching with brace expansion.""" assert _match_include_pattern("test.py", "*.{py,txt}") assert _match_include_pattern("test.txt", "*.{py,txt}") assert n...
TestMatchIncludePattern
python
mlflow__mlflow
tests/pyfunc/docker/test_docker.py
{ "start": 2002, "end": 5699 }
class ____: expected_dockerfile: str env_manager: str | None = None mlflow_home: str | None = None install_mlflow: bool = False enable_mlserver: bool = False # If True, image is built with --model-uri param specify_model_uri: bool = True @pytest.mark.parametrize( "params", [ ...
Param
python
facebookresearch__faiss
faiss/gpu/test/test_gpu_basics.py
{ "start": 4322, "end": 7078 }
class ____(unittest.TestCase): def do_test(self, metric, metric_arg=0): res = faiss.StandardGpuResources() d = 32 nb = 1000 nq = 100 rs = np.random.RandomState(123) xb = rs.rand(nb, d).astype('float32') xq = rs.rand(nq, d).astype('float32') index_re...
TestAlternativeDistances
python
explosion__spaCy
spacy/errors.py
{ "start": 1559, "end": 13811 }
class ____(metaclass=ErrorsWithCodes): W005 = ("Doc object not parsed. This means displaCy won't be able to " "generate a dependency visualization for it. Make sure the Doc " "was processed with a model that supports dependency parsing, and " "not just a language class like `Engl...
Warnings
python
pytorch__pytorch
torch/ao/nn/quantized/modules/normalization.py
{ "start": 6099, "end": 8075 }
class ____(torch.nn.InstanceNorm2d): r"""This is the quantized version of :class:`~torch.nn.InstanceNorm2d`. Additional args: * **scale** - quantization scale of the output, type: double. * **zero_point** - quantization zero point of the output, type: long. """ def __init__( s...
InstanceNorm2d
python
dagster-io__dagster
python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/generated/sources.py
{ "start": 99150, "end": 100270 }
class ____(GeneratedAirbyteSource): @public def __init__( self, name: str, project_id: str, credentials_json: str, dataset_id: Optional[str] = None ): """Airbyte Source for Bigquery. Documentation can be found at https://docs.airbyte.com/integrations/sources/bigquery Args: ...
BigquerySource
python
getsentry__sentry
src/sentry/sentry_metrics/querying/units.py
{ "start": 3592, "end": 6140 }
class ____(UnitMetadata): """ Represents the unit medata of a QueryExpression with a unit. """ unit_family: UnitFamily reference_unit: str unit: Unit from_formula: bool = False @property def scaling_factor(self) -> int | float | None: if self.from_formula: retur...
WithUnit
python
django__django
tests/prefetch_related/tests.py
{ "start": 17750, "end": 19024 }
class ____(TestDataMixin, TestCase): def test_basic(self): with self.assertNumQueries(2): books = Book.objects.raw( "SELECT * FROM prefetch_related_book WHERE id = %s", (self.book1.id,) ).prefetch_related("authors") book1 = list(books)[0] with sel...
RawQuerySetTests
python
tornadoweb__tornado
tornado/test/websocket_test.py
{ "start": 4771, "end": 5461 }
class ____(TestWebSocketHandler): def initialize(self, **kwargs): # type: ignore[override] super().initialize(**kwargs) self.select_subprotocol_called = False def select_subprotocol(self, subprotocols): if self.select_subprotocol_called: raise Exception("select_subprotocol ...
SubprotocolHandler
python
kamyu104__LeetCode-Solutions
Python/minimum-edge-weight-equilibrium-queries-in-a-tree.py
{ "start": 1202, "end": 2773 }
class ____(object): # Time: O(N), Space: O(N + Q), N is the number of nodes def __init__(self, adj, pairs): def preprocess(u, p, w): # modified # depth of the node i D[u] = 1 if p == -1 else D[p]+1 if w != -1: # added cnt[w] += 1 CNT[u] = cn...
TreeInfos
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 631141, "end": 632350 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("sponsorships",) sponsorships = sgqlc.types.Field( sgqlc.types.non_null("SponsorshipConnection"), graphql_name="sponsorships", args=sgqlc.types.ArgDict( ...
SponsorsTierAdminInfo
python
huggingface__transformers
src/transformers/models/sam3/modeling_sam3.py
{ "start": 78206, "end": 79307 }
class ____(nn.Module): """ MLP that embeds object queries for mask prediction. Similar to MaskFormer's mask embedder. """ def __init__(self, config: Sam3MaskDecoderConfig): super().__init__() self.config = config hidden_size = config.hidden_size self.layers = nn.Mod...
Sam3MaskEmbedder
python
great-expectations__great_expectations
great_expectations/execution_engine/sqlite_execution_engine.py
{ "start": 1061, "end": 2652 }
class ____(BaseColumnStandardDeviation): """MetricProvider Class for Aggregate Standard Deviation metric for SQLite databases.""" # We should change this decorator to compute this metric a completely new way @column_aggregate_partial(engine=SqliteExecutionEngine) @override def _sqlalchemy(cls, colu...
ColumnStandardDeviation
python
PrefectHQ__prefect
src/prefect/server/models/block_schemas.py
{ "start": 889, "end": 31900 }
class ____(Exception): """Raised when the block type corresponding to a block schema cannot be found""" @db_injector async def create_block_schema( db: PrefectDBInterface, session: AsyncSession, block_schema: Union[ schemas.actions.BlockSchemaCreate, schemas.core.BlockSchema, "...
MissingBlockTypeException
python
fastapi__sqlmodel
docs_src/tutorial/one/tutorial007_py310.py
{ "start": 71, "end": 1601 }
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
spyder-ide__spyder
spyder/plugins/debugger/widgets/framesbrowser.py
{ "start": 10389, "end": 12418 }
class ____(QTreeWidgetItem, SpyderFontsMixin): def __init__(self, parent, index, filename, line, lineno, name): self.index = index self.filename = filename self.text = line self.lineno = lineno self.context = name QTreeWidgetItem.__init__( self, parent, [...
LineFrameItem
python
django__django
tests/backends/sqlite/test_features.py
{ "start": 200, "end": 1258 }
class ____(TestCase): def test_supports_json_field_operational_error(self): if hasattr(connection.features, "supports_json_field"): del connection.features.supports_json_field msg = "unable to open database file" with mock.patch.object( connection, "cursor...
FeaturesTests
python
PrefectHQ__prefect
tests/test_transactions.py
{ "start": 1655, "end": 3683 }
class ____: class TestTransaction: def test_get_transaction(self): assert get_transaction() is None with Transaction() as txn: assert get_transaction() == txn assert get_transaction() is None def test_nested_get_transaction(self): asse...
TestGetTxn
python
django__django
tests/postgres_tests/array_default_migrations/0002_integerarraymodel_field_2.py
{ "start": 81, "end": 498 }
class ____(migrations.Migration): dependencies = [ ("postgres_tests", "0001_initial"), ] operations = [ migrations.AddField( model_name="integerarraydefaultmodel", name="field_2", field=django.contrib.postgres.fields.ArrayField( models.Int...
Migration
python
Lightning-AI__lightning
src/lightning/fabric/_graveyard/tpu.py
{ "start": 1371, "end": 2007 }
class ____(SingleDeviceXLAStrategy): """Legacy class. Use :class:`~lightning.fabric.strategies.single_xla.SingleDeviceXLAStrategy` instead. """ def __init__(self, *args: Any, **kwargs: Any) -> None: rank_zero_deprecation("The 'single_tpu' strategy is deprecated. Use 'single_xla' instead.") ...
SingleTPUStrategy
python
nryoung__algorithms
tests/test_data_structures.py
{ "start": 17215, "end": 17601 }
class ____(unittest.TestCase): """ Test Stack Implementation """ def test_stack(self): self.sta = stack.Stack() self.sta.add(5) self.sta.add(8) self.sta.add(10) self.sta.add(2) self.assertEqual(self.sta.remove(), 2) self.assertEqual(self.sta.is_em...
TestStack
python
pytorch__pytorch
torch/_inductor/codegen/pallas.py
{ "start": 1759, "end": 1879 }
class ____(RuntimeError): """Exception raised when an operation is not supported by the Pallas backend."""
Unsupported
python
walkccc__LeetCode
solutions/3197. Find the Minimum Area to Cover All Ones II/3197.py
{ "start": 1, "end": 2180 }
class ____: def minimumSum(self, grid: list[list[int]]) -> int: m = len(grid) n = len(grid[0]) ans = m * n for i in range(m): top = self._minimumArea(grid, 0, i, 0, n - 1) for j in range(n): ans = min(ans, top + self._minimumArea(grid, i + 1, m - 1, 0, j) + ...
Solution
python
great-expectations__great_expectations
tests/integration/fixtures/partition_and_sample_data/sampler_test_cases_and_fixtures.py
{ "start": 785, "end": 964 }
class ____: sampling_method_name: str sampling_kwargs: dict num_expected_batch_definitions: int num_expected_rows_in_first_batch_definition: int
TaxiSamplingTestCase
python
ray-project__ray
rllib/evaluation/tests/test_rollout_worker.py
{ "start": 2715, "end": 33631 }
class ____(unittest.TestCase): @classmethod def setUpClass(cls): ray.init(num_cpus=5) @classmethod def tearDownClass(cls): ray.shutdown() @staticmethod def _from_existing_env_runner(local_env_runner, remote_workers=None): workers = EnvRunnerGroup( env_creato...
TestRolloutWorker
python
django__django
tests/forms_tests/field_tests/test_regexfield.py
{ "start": 139, "end": 3553 }
class ____(SimpleTestCase): def test_regexfield_1(self): f = RegexField("^[0-9][A-F][0-9]$") self.assertEqual("2A2", f.clean("2A2")) self.assertEqual("3F3", f.clean("3F3")) with self.assertRaisesMessage(ValidationError, "'Enter a valid value.'"): f.clean("3G3") wi...
RegexFieldTest
python
pandas-dev__pandas
pandas/tests/test_multilevel.py
{ "start": 184, "end": 11877 }
class ____: def test_reindex_level(self, multiindex_year_month_day_dataframe_random_data): # axis=0 ymd = multiindex_year_month_day_dataframe_random_data month_sums = ymd.groupby("month").sum() result = month_sums.reindex(ymd.index, level=1) expected = ymd.groupby(level="mon...
TestMultiLevel
python
lxml__lxml
src/lxml/tests/test_elementpath.py
{ "start": 15536, "end": 15671 }
class ____(EtreeElementPathTestCase): _empty_namespaces = {} # empty dict as opposed to None
EtreeElementPathEmptyNamespacesTestCase
python
spyder-ide__spyder
spyder/plugins/console/widgets/console.py
{ "start": 3647, "end": 4481 }
class ____(object): def __init__(self, foregroundcolor, backgroundcolor, bold, italic, underline): self.foregroundcolor = foregroundcolor self.backgroundcolor = backgroundcolor self.bold = bold self.italic = italic self.underline = underline self.form...
ConsoleFontStyle
python
getsentry__sentry
src/sentry/issues/endpoints/organization_group_search_view_starred_order.py
{ "start": 1085, "end": 2469 }
class ____(OrganizationEndpoint): publish_status = {"PUT": ApiPublishStatus.EXPERIMENTAL} owner = ApiOwner.ISSUES permission_classes = (MemberPermission,) def put(self, request: Request, organization: Organization) -> Response: if not request.user.is_authenticated: return Response(s...
OrganizationGroupSearchViewStarredOrderEndpoint
python
sqlalchemy__sqlalchemy
test/orm/dml/test_orm_upd_del_inheritance.py
{ "start": 699, "end": 12523 }
class ____(fixtures.DeclarativeMappedTest): run_inserts = "each" run_deletes = "each" __sparse_driver_backend__ = True @classmethod def setup_classes(cls): Base = cls.DeclarativeBasic class Person(Base): __tablename__ = "person" id = Column( ...
InheritTest
python
tqdm__tqdm
tests/tests_tqdm.py
{ "start": 684, "end": 2782 }
class ____(Exception): pass # Ensure we can use `with closing(...) as ... :` syntax if getattr(StringIO, '__exit__', False) and getattr(StringIO, '__enter__', False): def closing(arg): return arg else: from contextlib import closing nt_and_no_colorama = False if os.name == 'nt': try: ...
DeprecationError
python
kamyu104__LeetCode-Solutions
Python/minimum-operations-to-transform-string.py
{ "start": 38, "end": 216 }
class ____(object): def minOperations(self, s): """ :type s: str :rtype: int """ return max((26-(ord(x)-ord('a')))%26 for x in s)
Solution
python
astropy__astropy
astropy/modeling/projections.py
{ "start": 24208, "end": 24538 }
class ____(Pix2SkyProjection, PseudoCylindrical): r""" Parabolic projection - pixel to sky. Corresponds to the ``PAR`` projection in FITS WCS. .. math:: \phi &= \frac{180^\circ}{\pi} \frac{x}{1 - 4(y / 180^\circ)^2} \\ \theta &= 3 \sin^{-1}\left(\frac{y}{180^\circ}\right) """
Pix2Sky_Parabolic
python
matplotlib__matplotlib
lib/matplotlib/tests/test_ticker.py
{ "start": 65417, "end": 77336 }
class ____: percent_data = [ # Check explicitly set decimals over different intervals and values (100, 0, '%', 120, 100, '120%'), (100, 0, '%', 100, 90, '100%'), (100, 0, '%', 90, 50, '90%'), (100, 0, '%', -1.7, 40, '-2%'), (100, 1, '%', 90.0, 100, '90.0%'), (...
TestPercentFormatter
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 614148, "end": 614530 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("ecosystem", "name") ecosystem = sgqlc.types.Field( sgqlc.types.non_null(SecurityAdvisoryEcosystem), graphql_name="ecosystem" ) name = sgqlc.types.Field(sgqlc.type...
SecurityAdvisoryPackage
python
getsentry__sentry
src/sentry/integrations/api/bases/integration.py
{ "start": 1012, "end": 1481 }
class ____(ControlSiloOrganizationEndpoint): """ Baseclass for integration endpoints in control silo that need integration exception handling """ def handle_exception_with_details( self, request: Request, exc: Exception, *args: Any, **kwds: Any, ) -> Response...
IntegrationEndpoint