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
pexpect__pexpect
pexpect/exceptions.py
{ "start": 979, "end": 1068 }
class ____(ExceptionPexpect): '''Raised when a read time exceeds the timeout. '''
TIMEOUT
python
getsentry__sentry
tests/sentry/models/test_manager.py
{ "start": 203, "end": 1777 }
class ____(TestCase): def setUp(self) -> None: self.clear() def clear(self) -> None: cache.clear() flush_manager_local_cache() def test_get_cacheable_kv_from_kwargs(self) -> None: org = self.create_organization() assert Organization.objects._get_cacheable_kv_from_kw...
GetFromCacheTest
python
getsentry__sentry
tests/sentry/replays/test_query.py
{ "start": 335, "end": 3984 }
class ____: def save(self, data: Any) -> None: request_url = settings.SENTRY_SNUBA + "/tests/entities/replays/insert" response = requests.post(request_url, json=[data]) assert response.status_code == 200 @pytest.fixture def replay_store() -> ReplayStore: assert requests.post(settings.S...
ReplayStore
python
pytorch__pytorch
benchmarks/operator_benchmark/pt/qbatchnorm_test.py
{ "start": 1039, "end": 1611 }
class ____(QBatchNormBenchmark): def _init(self, M, N, K, device): self.set_module_name("QBatchNorm1d") self.input_one = torch.rand( M, N, K, device=device, requires_grad=self.auto_set() ) def forward( self, q_input_one, weight, bias, ...
QBatchNorm1dBenchmark
python
airbytehq__airbyte
airbyte-integrations/connectors/source-recharge/unit_tests/test_streams.py
{ "start": 7170, "end": 11319 }
class ____: def generate_records(self, stream_name, count) -> Mapping[str, List[Mapping[str, Any]]]: result = [] for i in range(0, count): result.append({f"record_{i}": f"test_{i}"}) return {stream_name: result} @pytest.mark.parametrize( "stream_cls, use_deprecated_a...
TestIncrementalStreams
python
huggingface__transformers
src/transformers/pipelines/image_classification.py
{ "start": 1605, "end": 2411 }
class ____(ExplicitEnum): SIGMOID = "sigmoid" SOFTMAX = "softmax" NONE = "none" @add_end_docstrings( build_pipeline_init_args(has_image_processor=True), r""" function_to_apply (`str`, *optional*, defaults to `"default"`): The function to apply to the model outputs in order to r...
ClassificationFunction
python
google__python-fire
fire/inspectutils.py
{ "start": 699, "end": 11966 }
class ____: """The arguments of a function, as in Python 3's inspect.FullArgSpec.""" def __init__(self, args=None, varargs=None, varkw=None, defaults=None, kwonlyargs=None, kwonlydefaults=None, annotations=None): """Constructs a FullArgSpec with each provided attribute, or the default. Args...
FullArgSpec
python
scikit-learn__scikit-learn
sklearn/datasets/tests/test_base.py
{ "start": 920, "end": 23025 }
class ____: """Minimal class that implements the os.PathLike interface.""" def __init__(self, path): self.path = path def __fspath__(self): return self.path def _remove_dir(path): if os.path.isdir(path): shutil.rmtree(path) @pytest.fixture(scope="module") def data_home(tmpd...
_DummyPath
python
kamyu104__LeetCode-Solutions
Python/the-k-weakest-rows-in-a-matrix.py
{ "start": 794, "end": 1525 }
class ____(object): def kWeakestRows(self, mat, k): """ :type mat: List[List[int]] :type k: int :rtype: List[int] """ lookup = collections.OrderedDict() for j in xrange(len(mat[0])): for i in xrange(len(mat)): if mat[i][j] or i in l...
Solution2
python
huggingface__transformers
src/transformers/models/kosmos2/modeling_kosmos2.py
{ "start": 16089, "end": 18192 }
class ____(GradientCheckpointingLayer): def __init__(self, config: Kosmos2VisionConfig): super().__init__() self.embed_dim = config.hidden_size self.self_attn = Kosmos2VisionAttention(config) self.layer_norm1 = nn.LayerNorm(self.embed_dim, eps=config.layer_norm_eps) self.mlp ...
Kosmos2VisionEncoderLayer
python
psf__requests
src/requests/exceptions.py
{ "start": 3481, "end": 3589 }
class ____(RequestException, BaseHTTPError): """Failed to decode response content."""
ContentDecodingError
python
python__mypy
mypy/test/testsemanal.py
{ "start": 6187, "end": 6482 }
class ____(dict[str, TypeInfo]): def __str__(self) -> str: a: list[str] = ["TypeInfoMap("] for x, y in sorted(self.items()): ti = ("\n" + " ").join(str(y).split("\n")) a.append(f" {x} : {ti}") a[-1] += ")" return "\n".join(a)
TypeInfoMap
python
tensorflow__tensorflow
tensorflow/python/data/kernel_tests/io_test.py
{ "start": 1239, "end": 6073 }
class ____(test_base.DatasetTestBase, parameterized.TestCase): def setUp(self): super(IOTest, self).setUp() tmpdir = self.get_temp_dir() tmpdir = os.path.join(tmpdir, "io_test") os.mkdir(tmpdir) self._test_dir = tmpdir self._checkpoint_prefix = os.path.join(self.get_temp_dir(), "ckpt") os...
IOTest
python
openai__openai-python
src/openai/_qs.py
{ "start": 689, "end": 4339 }
class ____: array_format: ArrayFormat nested_format: NestedFormat def __init__( self, *, array_format: ArrayFormat = "repeat", nested_format: NestedFormat = "brackets", ) -> None: self.array_format = array_format self.nested_format = nested_format de...
Querystring
python
jazzband__django-simple-history
simple_history/tests/external/models.py
{ "start": 1224, "end": 1447 }
class ____(models.Model): """Test model for same-named historical models This model intentionally conflicts with the 'Polls' model in 'tests.models'. """ history = HistoricalRecords(user_related_name="+")
Poll
python
ApeWorX__ape
src/ape/types/private_mempool.py
{ "start": 3326, "end": 3708 }
class ____(BaseModel): """ Specifies what addresses should receive what percent of the overall refund for this bundle, if it is enveloped by another bundle (e.g. a searcher backrun). """ address: AddressType """ The address to refund. """ percent: int """ The minimum percen...
RefundConfig
python
pytorch__pytorch
test/profiler/test_profiler.py
{ "start": 6621, "end": 57194 }
class ____(TestCase): @unittest.skipIf( TEST_WITH_CROSSREF, "crossref intercepts calls and changes the callsite." ) def test_source(self): """Checks that source code attribution works for eager, TS and autograd mode""" # avoid automatic inlining prev_opt = torch._C._get_graph...
TestProfiler
python
pandas-dev__pandas
asv_bench/benchmarks/arithmetic.py
{ "start": 2518, "end": 4530 }
class ____: # Many-columns, mixed dtypes params = [ [ # GH#32779 has discussion of which operators are included here operator.add, operator.floordiv, operator.gt, ], [ # (n_rows, n_columns) (1_000_000, 10), ...
FrameWithFrameWide
python
prabhupant__python-ds
data_structures/graphs/count_edges.py
{ "start": 180, "end": 852 }
class ____: def __init__(self, vertices): self.V = vertices self.graph = [[] for i in range(vertices)] def add_edge(self, u, v): self.graph[u].append(v) self.graph[v].append(u) def count_edges(self): s = 0 for i in range(self.V): s += len(sel...
Graph
python
apache__airflow
providers/apache/tinkerpop/tests/integration/apache/tinkerpop/hooks/test_gremlin.py
{ "start": 1106, "end": 1898 }
class ____: def setup_method(self): os.environ["AIRFLOW_CONN_GREMLIN_DEFAULT"] = AIRFLOW_CONN_GREMLIN_DEFAULT self.hook = GremlinHook() add_query = "g.addV('person').property('id', 'person1').property('name', 'Alice')" self.hook.run(add_query) def teardown_method(self): ...
TestGremlinHook
python
google__jax
jax/experimental/mosaic/gpu/constraints.py
{ "start": 23171, "end": 23290 }
class ____: def __and__(self, other: ConstraintSystem | Unsatisfiable) -> Unsatisfiable: return self
Unsatisfiable
python
getsentry__sentry
src/sentry/api/serializers/models/organization_member/response.py
{ "start": 419, "end": 487 }
class ____(TypedDict): givenName: str familyName: str
SCIMName
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/dataplex.py
{ "start": 149908, "end": 152786 }
class ____(DataplexCatalogBaseOperator): """ Delete an AspectType resource. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:DataplexCatalogDeleteAspectTypeOperator` :param aspect_type_id: Required. AspectType identifier. ...
DataplexCatalogDeleteAspectTypeOperator
python
python-openxml__python-docx
tests/image/test_tiff.py
{ "start": 13735, "end": 14011 }
class ____: def it_can_parse_a_short_int_IFD_entry(self): bytes_ = b"foobaroo\x00\x2a" stream_rdr = StreamReader(io.BytesIO(bytes_), BIG_ENDIAN) val = _ShortIfdEntry._parse_value(stream_rdr, 0, 1, None) assert val == 42
Describe_ShortIfdEntry
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/transfers/test_exasol_to_s3.py
{ "start": 1066, "end": 2603 }
class ____: @mock.patch(BASE_PATH.format("NamedTemporaryFile")) @mock.patch(BASE_PATH.format("ExasolHook")) @mock.patch(BASE_PATH.format("S3Hook")) def test_execute(self, mock_s3_hook, mock_exasol_hook, mock_local_tmp_file): mock_fh = mock_local_tmp_file.return_value.__enter__.return_value ...
TestExasolToS3Operator
python
HypothesisWorks__hypothesis
hypothesis-python/src/hypothesis/internal/cache.py
{ "start": 1087, "end": 9440 }
class ____(Generic[K, V]): """Generic supertype for cache implementations. Defines a dict-like mapping with a maximum size, where as well as mapping to a value, each key also maps to a score. When a write would cause the dict to exceed its maximum size, it first evicts the existing key with the sma...
GenericCache
python
getsentry__sentry
src/sentry/sentry_apps/api/endpoints/sentry_app_authorizations.py
{ "start": 1764, "end": 1927 }
class ____(serializers.Serializer): grant_type = serializers.CharField(required=True, allow_null=False) @control_silo_endpoint
SentryAppClientSecretJWTSerializer
python
apache__airflow
providers/slack/tests/unit/slack/hooks/test_slack_webhook.py
{ "start": 5072, "end": 6117 }
class ____: def test_ok_response(self): """Test OK response.""" @check_webhook_response def decorated(): return MOCK_WEBHOOK_RESPONSE assert decorated() is MOCK_WEBHOOK_RESPONSE @pytest.mark.parametrize( ("status_code", "body"), [ (400, ...
TestCheckWebhookResponseDecorator
python
ray-project__ray
python/ray/autoscaler/_private/node_provider_availability_tracker.py
{ "start": 1995, "end": 5862 }
class ____: """A thread safe, TTL cache of node provider availability. We don't use cachetools.TTLCache because it always sets the expiration time relative to insertion time, but in our case, we want entries to expire relative to when the node creation was attempted (and entries aren't necessarily added...
NodeProviderAvailabilityTracker
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/callbackProtocol2.py
{ "start": 292, "end": 394 }
class ____(Protocol[InputT, OutputT]): def __call__(self, inputs: InputT) -> OutputT: ...
MyCallable
python
gevent__gevent
src/gevent/events.py
{ "start": 16597, "end": 16892 }
class ____(IGeventDidPatchEvent): """ Event emitted after gevent has patched all modules, both builtin and those provided by plugins/subscribers. The values of the *source* and *target* attributes are undefined. """ @implementer(IGeventDidPatchAllEvent)
IGeventDidPatchAllEvent
python
django__django
tests/template_tests/filter_tests/test_ljust.py
{ "start": 856, "end": 1210 }
class ____(SimpleTestCase): def test_ljust(self): self.assertEqual(ljust("test", 10), "test ") self.assertEqual(ljust("test", 3), "test") def test_less_than_string_length(self): self.assertEqual(ljust("test", 3), "test") def test_non_string_input(self): self.assertEqua...
FunctionTests
python
apache__airflow
airflow-core/src/airflow/assets/manager.py
{ "start": 1770, "end": 10925 }
class ____(LoggingMixin): """ A pluggable class that manages operations for assets. The intent is to have one place to handle all Asset-related operations, so different Airflow deployments can use plugins that broadcast Asset events to each other. """ @classmethod def create_assets(cls, as...
AssetManager
python
pytorch__pytorch
torch/utils/hipify/hipify_python.py
{ "start": 1750, "end": 3197 }
class ____: def __init__(self, current_state, hipified_path) -> None: self.current_state = current_state self.hipified_path = hipified_path self.status = "" def __str__(self) -> str: return (f"HipifyResult:: current_state: {self.current_state}, hipified_path : {self.hipified_pat...
HipifyResult
python
encode__django-rest-framework
tests/test_routers.py
{ "start": 1132, "end": 1285 }
class ____(viewsets.ModelViewSet): queryset = RouterTestModel.objects.all() serializer_class = NoteSerializer lookup_field = 'uuid'
NoteViewSet
python
django__django
django/contrib/gis/sitemaps/kml.py
{ "start": 2520, "end": 2573 }
class ____(KMLSitemap): geo_format = "kmz"
KMZSitemap
python
doocs__leetcode
solution/0000-0099/0055.Jump Game/Solution.py
{ "start": 0, "end": 220 }
class ____: def canJump(self, nums: List[int]) -> bool: mx = 0 for i, x in enumerate(nums): if mx < i: return False mx = max(mx, i + x) return True
Solution
python
Textualize__textual
docs/examples/guide/css/nesting01.py
{ "start": 122, "end": 492 }
class ____(App): """App that doesn't have nested CSS.""" CSS_PATH = "nesting01.tcss" def compose(self) -> ComposeResult: with Horizontal(id="questions"): yield Static("Yes", classes="button affirmative") yield Static("No", classes="button negative") if __name__ == "__main...
NestingDemo
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typedDict16.py
{ "start": 173, "end": 350 }
class ____(TypedDict): key: str value: str v1: TD2 = TD1(key="", value="") v2: TD1 = TD2(key="", value="") v3 = [v2] v4: list[TD2] = v3 v5 = [v1] v6: list[TD1] = v5
TD2
python
pytorch__pytorch
test/dynamo/test_precompile_context.py
{ "start": 672, "end": 4021 }
class ____(InductorTestCase): def setUp(self): """ Reset all counters and caches before each unit test """ super().setUp() # Clear PrecompileContext cache artifacts PrecompileContext.clear() @requires_triton() def test_basic(self): """ Test th...
PrecompileContextTests
python
airbytehq__airbyte
airbyte-integrations/connectors/source-zendesk-support/unit_tests/integrations/zs_requests/ticket_metrics_request_builder.py
{ "start": 286, "end": 1613 }
class ____(ZendeskSupportBaseRequestBuilder): @classmethod def stateful_ticket_metrics_endpoint(cls, authenticator: Authenticator, ticket_id: int) -> "TicketMetricsRequestBuilder": return cls("d3v-airbyte", f"tickets/{ticket_id}/metrics").with_authenticator(authenticator) @classmethod def state...
TicketMetricsRequestBuilder
python
django-mptt__django-mptt
tests/myapp/tests.py
{ "start": 13815, "end": 17607 }
class ____(TreeTestCase): """ Tests that the tree structure is maintained appropriately in various deletion scenarios. """ fixtures = ["categories.json"] def test_delete_root_node(self): # Add a few other roots to verify that they aren't affected Category(name="Preceding root")...
DeletionTestCase
python
pandas-dev__pandas
asv_bench/benchmarks/series_methods.py
{ "start": 132, "end": 627 }
class ____: def setup(self): self.idx = date_range( start=datetime(2015, 10, 26), end=datetime(2016, 1, 1), freq="50s" ) self.data = dict(zip(self.idx, range(len(self.idx)), strict=True)) self.array = np.array([1, 2, 3]) self.idx2 = Index(["a", "b", "c"]) def...
SeriesConstructor
python
tensorflow__tensorflow
tensorflow/python/framework/function_def_to_graph_test.py
{ "start": 7345, "end": 12274 }
class ____(test.TestCase): def _build_function_def(self): with ops.Graph().as_default() as g: # Inputs: x y z # |\ | / # | \ | / # | foo_1 list_output # | / \ / \ # | d_1 e_1 a:1 a...
FunctionDefToGraphDefTest
python
ray-project__ray
rllib/env/env_runner.py
{ "start": 1288, "end": 12351 }
class ____(FaultAwareApply, metaclass=abc.ABCMeta): """Base class for distributed RL-style data collection from an environment. The EnvRunner API's core functionalities can be summarized as: - Gets configured via passing a AlgorithmConfig object to the constructor. Normally, subclasses of EnvRunner the...
EnvRunner
python
miyuchina__mistletoe
test/test_block_token.py
{ "start": 5364, "end": 7906 }
class ____(TestToken): def setUp(self): super().setUp() block_token.add_token(block_token.HtmlBlock) self.addCleanup(block_token.reset_tokens) def test_parse(self): lines = ['some\n', 'continuous\n', 'lines\n'] arg = 'some' self._test_match(block_token.Paragraph,...
TestParagraph
python
PrefectHQ__prefect
tests/server/orchestration/api/test_infra_overrides.py
{ "start": 2250, "end": 16250 }
class ____: async def test_creating_flow_run_with_unexpected_vars( self, session, client, ): *_, deployment = await create_objects_for_pool( session, pool_job_config={ "job_configuration": { "thing_one": "{{ expected_var...
TestInfraOverrides
python
kamyu104__LeetCode-Solutions
Python/kth-smallest-product-of-two-sorted-arrays.py
{ "start": 97, "end": 1520 }
class ____(object): def kthSmallestProduct(self, nums1, nums2, k): """ :type nums1: List[int] :type nums2: List[int] :type k: int :rtype: int """ def check(nums1, nums2, k, neg_cnt, target): cnt = 0 left, right = 0, len(nums2)-1 ...
Solution
python
catalyst-team__catalyst
catalyst/metrics/_segmentation.py
{ "start": 13515, "end": 18063 }
class ____(RegionBasedMetric): """ Dice Metric, dice score = 2 * intersection / (intersection + union)) = 2 * tp / (2 * tp + fp + fn) Args: class_dim: indicates class dimention (K) for ``outputs`` and ``targets`` tensors (default = 1) weights: class weights class_names: ...
DiceMetric
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/client_not_foo/package.py
{ "start": 217, "end": 517 }
class ____(Package): """This package has a variant "foo", which is False by default.""" homepage = "http://www.example.com" url = "http://www.example.com/c-1.0.tar.gz" version("1.0", md5="0123456789abcdef0123456789abcdef") variant("foo", default=False, description="")
ClientNotFoo
python
Textualize__textual
docs/examples/widgets/markdown.py
{ "start": 1429, "end": 1688 }
class ____(App): def compose(self) -> ComposeResult: markdown = Markdown(EXAMPLE_MARKDOWN) markdown.code_indent_guides = False yield markdown if __name__ == "__main__": app = MarkdownExampleApp() app.run()
MarkdownExampleApp
python
ray-project__ray
python/ray/autoscaler/v2/instance_manager/storage.py
{ "start": 4010, "end": 6755 }
class ____(Storage): """An in-memory implementation of the Storage interface. This implementation is not durable""" def __init__(self): self._version = 0 self._tables = defaultdict(dict) self._lock = Lock() def batch_update( self, table: str, mutation: D...
InMemoryStorage
python
mlflow__mlflow
tests/utils/test_logging_utils.py
{ "start": 719, "end": 4428 }
class ____: def __init__(self): self.content = None self.flush_count = 0 def write(self, text): self.content = (self.content or "") + text def flush(self): self.flush_count += 1 def reset(self): self.content = None self.flush_count = 0 @pytest.mark.pa...
SampleStream
python
doocs__leetcode
solution/1400-1499/1472.Design Browser History/Solution.py
{ "start": 0, "end": 771 }
class ____: def __init__(self, homepage: str): self.stk1 = [] self.stk2 = [] self.visit(homepage) def visit(self, url: str) -> None: self.stk1.append(url) self.stk2.clear() def back(self, steps: int) -> str: while steps and len(self.stk1) > 1: se...
BrowserHistory
python
keras-team__keras
keras/src/ops/numpy.py
{ "start": 191637, "end": 193086 }
class ____(Operation): def __init__(self, axis=None, keepdims=False, *, name=None): super().__init__(name=name) if isinstance(axis, int): self.axis = [axis] else: self.axis = axis self.keepdims = keepdims def call(self, x): return backend.numpy.st...
Std
python
pexpect__pexpect
pexpect/FSM.py
{ "start": 4176, "end": 4385 }
class ____(Exception): '''This is the FSM Exception class.''' def __init__(self, value): self.value = value def __str__(self): return 'ExceptionFSM: ' + str(self.value)
ExceptionFSM
python
h5py__h5py
h5py/_hl/vds.py
{ "start": 4991, "end": 9468 }
class ____: """Object for building a virtual dataset. Instantiate this class to define a virtual dataset, assign to slices of it (using VirtualSource objects), and then pass it to group.create_virtual_dataset() to add the virtual dataset to a file. This class does not allow access to the data; the...
VirtualLayout
python
run-llama__llama_index
llama-index-integrations/vector_stores/llama-index-vector-stores-mariadb/llama_index/vector_stores/mariadb/base.py
{ "start": 788, "end": 17085 }
class ____(BasePydanticVectorStore): """ MariaDB Vector Store. Examples: `pip install llama-index-vector-stores-mariadb` ```python from llama_index.vector_stores.mariadb import MariaDBVectorStore # Create MariaDBVectorStore instance vector_store = MariaDBVectorStor...
MariaDBVectorStore
python
django-import-export__django-import-export
tests/core/tests/test_resources/test_modelresource/test_resource_fields.py
{ "start": 2605, "end": 3761 }
class ____(TestCase): class MyBookResource(resources.ModelResource): author_email = fields.Field( attribute="author_email", column_name="author_email" ) class Meta: model = Book fields = ("id", "price") exclude = ("author_email",) def set...
ModelResourceExcludeDeclarations
python
aio-libs__aiohttp
aiohttp/web_exceptions.py
{ "start": 8357, "end": 8418 }
class ____(HTTPClientError): status_code = 409
HTTPConflict
python
getsentry__sentry
src/sentry/incidents/endpoints/serializers/workflow_engine_incident.py
{ "start": 7211, "end": 8708 }
class ____(WorkflowEngineIncidentSerializer): def __init__(self, expand=None): if expand is None: expand = [] super().__init__(expand=expand) def serialize(self, obj, attrs, user, **kwargs) -> DetailedIncidentSerializerResponse: base_context = super().serialize(obj, attrs, u...
WorkflowEngineDetailedIncidentSerializer
python
pytransitions__transitions
tests/test_threading.py
{ "start": 7568, "end": 10774 }
class ____(TestNestedTransitions, TestLockedTransitions): def setUp(self): states = ['A', 'B', {'name': 'C', 'children': ['1', '2', {'name': '3', 'children': ['a', 'b', 'c']}]}, 'D', 'E', 'F'] self.machine_cls = LockedHierarchicalMachine # type: Type[LockedHierarchicalMachine] ...
TestLockedHierarchicalTransitions
python
spack__spack
lib/spack/spack/vendor/jinja2/utils.py
{ "start": 26552, "end": 27283 }
class ____(spack.vendor.markupsafe.Markup): def __new__(cls, base="", encoding=None, errors="strict"): # type: ignore warnings.warn( "'spack.vendor.jinja2.Markup' is deprecated and will be removed in Jinja" " 3.1. Import 'spack.vendor.markupsafe.Markup' instead.", Deprec...
Markup
python
realpython__materials
wordcount/tests/task_08.py
{ "start": 878, "end": 1808 }
class ____: def test_uses_consistent_formatting_across_lines( self, wc, small_file, unicode_file, big_file, fake_dir, random_name ): expected = b"".join( [ small_file.format_line(max_digits=3), b" 0 2 10\n", unicode_file.format_line...
Test
python
huggingface__transformers
src/transformers/models/deberta_v2/modeling_deberta_v2.py
{ "start": 29104, "end": 33192 }
class ____(DebertaV2PreTrainedModel): def __init__(self, config): super().__init__(config) self.embeddings = DebertaV2Embeddings(config) self.encoder = DebertaV2Encoder(config) self.z_steps = 0 self.config = config # Initialize weights and apply final processing ...
DebertaV2Model
python
numba__numba
numba/tests/test_extending.py
{ "start": 60100, "end": 61806 }
class ____(TestCase): def test_intrinsic(self): def intrin(context, x): # This intrinsic will return 0xcafe if `x` is a literal `1`. sig = signature(types.intp, x) if isinstance(x, types.IntegerLiteral): # With prefer_literal=False, this branch will not be...
TestIntrinsicPreferLiteral
python
facebookresearch__faiss
contrib/datasets.py
{ "start": 6848, "end": 8430 }
class ____(Dataset): """ See https://github.com/facebookresearch/faiss/tree/main/benchs#getting-deep1b on how to get the data """ def __init__(self, nb=10**9): Dataset.__init__(self) nb_to_name = { 10**5: '100k', 10**6: '1M', 10**7: '10M', ...
DatasetDeep1B
python
networkx__networkx
benchmarks/benchmarks/benchmark_algorithms.py
{ "start": 5000, "end": 7060 }
class ____: timeout = 120 _seed = 42 param_names = ["graph"] _graphs = _make_tournament_benchmark_graphs(_seed) params = list(_graphs) def setup(self, graph): self.G = self._graphs[graph] self.nodes = sorted(self.G) rng = random.Random(self._seed) self.source, s...
ReachabilityBenchmark
python
getsentry__sentry
src/sentry/taskworker/worker.py
{ "start": 1122, "end": 15702 }
class ____: """ A TaskWorker fetches tasks from a taskworker RPC host and handles executing task activations. Tasks are executed in a forked process so that processing timeouts can be enforced. As tasks are completed status changes will be sent back to the RPC host and new tasks will be fetched. ...
TaskWorker
python
scipy__scipy
scipy/stats/_multivariate.py
{ "start": 185168, "end": 199186 }
class ____(multi_rv_generic): r"""A multivariate hypergeometric random variable. Methods ------- pmf(x, m, n) Probability mass function. logpmf(x, m, n) Log of the probability mass function. rvs(m, n, size=1, random_state=None) Draw random samples from a multivariate hyp...
multivariate_hypergeom_gen
python
pappasam__jedi-language-server
tests/lsp_test_client/utils.py
{ "start": 1095, "end": 1773 }
class ____: """Create python file on demand for testing.""" def __init__(self, contents, root): self.contents = contents self.basename = "".join( choice("abcdefghijklmnopqrstuvwxyz") if i < 8 else ".py" for i in range(9) ) self.fullpath = py.path.local(ro...
PythonFile
python
justquick__django-activity-stream
actstream/tests/test_activity.py
{ "start": 498, "end": 12143 }
class ____(DataTestCase): urls = 'actstream.urls' def test_aauser1(self): self.assertSetEqual(self.user1.actor_actions.all(), [ 'admin commented on CoolGroup %s ago' % self.timesince, 'admin started following Two %s ago' % self.timesince, 'admin joined CoolGroup %s a...
ActivityTestCase
python
sphinx-doc__sphinx
sphinx/domains/cpp/_ast.py
{ "start": 98157, "end": 100738 }
class ____(ASTDeclarator): def __init__(self, next: ASTDeclarator, attrs: ASTAttributeList) -> None: assert next self.next = next self.attrs = attrs def __eq__(self, other: object) -> bool: if not isinstance(other, ASTDeclaratorRef): return NotImplemented ret...
ASTDeclaratorRef
python
google__pytype
pytype/abstract/mixin_test.py
{ "start": 754, "end": 1597 }
class ____(unittest.TestCase): def test_wraps_dict(self): # pylint: disable=g-wrong-blank-lines,undefined-variable class A(mixin.PythonDict): def __init__(self, pyval): mixin.PythonDict.init_mixin(self, pyval) # pylint: enable=g-wrong-blank-lines,undefined-variable a = A({"foo": 1, "...
PythonDictTest
python
ApeWorX__ape
src/ape/api/accounts.py
{ "start": 30558, "end": 32608 }
class ____(AccountContainerAPI): """ Test account containers for ``ape test`` (such containers that generate accounts using :class:`~ape.utils.GeneratedDevAccounts`) should implement this API instead of ``AccountContainerAPI`` directly. Then, they show up in the ``accounts`` test fixture. """ @...
TestAccountContainerAPI
python
langchain-ai__langchain
libs/core/langchain_core/language_models/_utils.py
{ "start": 2835, "end": 11046 }
class ____(TypedDict): source_type: Literal["base64"] data: str mime_type: str def _parse_data_uri(uri: str) -> ParsedDataUri | None: """Parse a data URI into its components. If parsing fails, return `None`. If either MIME type or data is missing, return `None`. Example: ```pytho...
ParsedDataUri
python
dask__dask
dask/dataframe/dask_expr/_indexing.py
{ "start": 8158, "end": 8850 }
class ____(LocBase): def _divisions(self): return (self.iindexer, self.iindexer) def _lower(self): if self.frame.npartitions == 1: return part = _get_partitions(self.frame, self.iindexer) return type(self)(Partitions(self.frame, [part]), self.iindexer, self.cindexer...
LocElement
python
rapidsai__cudf
python/cudf/cudf/pandas/fast_slow_proxy.py
{ "start": 27391, "end": 29565 }
class ____(_CallableProxyMixin): """ Proxy for a pair of fast and slow functions. """ __name__: str def __init__( self, fast: Callable | _Unusable, slow: Callable, *, assigned=None, updated=None, _fsproxy_transfer_block: _BlockState | None = ...
_FunctionProxy
python
mlflow__mlflow
tests/pyfunc/test_rag_model.py
{ "start": 374, "end": 2145 }
class ____(mlflow.pyfunc.PythonModel): def predict(self, context, model_input: ChatCompletionRequest): message = model_input.messages[0].content # return the message back return asdict( ChatCompletionResponse( choices=[ChainCompletionChoice(message=Message(role="a...
TestRagModel
python
facebook__pyre-check
client/commands/tests/servers_test.py
{ "start": 367, "end": 1135 }
class ____(socketserver.StreamRequestHandler): def handle(self) -> None: try: while True: _ = self.rfile.readline() self.wfile.write( json.dumps( [ "Info", { ...
MockServerRequestHandler
python
agronholm__apscheduler
src/apscheduler/_exceptions.py
{ "start": 1389, "end": 1779 }
class ____(KeyError): """ Raised when trying to add a schedule to a store that already contains a schedule by that ID, and the conflict policy of ``exception`` is used. """ def __init__(self, schedule_id): super().__init__( f"This data store already contains a schedule with the ...
ConflictingIdError
python
pennersr__django-allauth
allauth/socialaccount/providers/disqus/views.py
{ "start": 181, "end": 1216 }
class ____(OAuth2Adapter): provider_id = "disqus" access_token_url = "https://disqus.com/api/oauth/2.0/access_token/" # nosec authorize_url = "https://disqus.com/api/oauth/2.0/authorize/" profile_url = "https://disqus.com/api/3.0/users/details.json" scope_delimiter = "," def complete_login(sel...
DisqusOAuth2Adapter
python
boto__boto3
tests/unit/resources/test_response.py
{ "start": 959, "end": 3763 }
class ____(BaseTestCase): def test_build_identifier_from_res_path_scalar(self): identifiers = [ Parameter(target='Id', source='response', path='Container.Frob.Id') ] parent = mock.Mock() params = {} response = {'Container': {'Frob': {'Id': 'response-path'}}} ...
TestBuildIdentifiers
python
PrefectHQ__prefect
tests/test_cache_policies.py
{ "start": 327, "end": 683 }
class ____: def test_cache_policy_initializes(self): policy = CachePolicy() assert isinstance(policy, CachePolicy) def test_compute_key_not_implemented(self): policy = CachePolicy() with pytest.raises(NotImplementedError): policy.compute_key(task_ctx=None, inputs=Non...
TestBaseClass
python
scrapy__scrapy
tests/test_downloadermiddleware_httpcache.py
{ "start": 5454, "end": 6219 }
class ____: """Mixin containing policy-specific test methods.""" def test_dont_cache(self): with self._middleware() as mw: self.request.meta["dont_cache"] = True mw.process_response(self.request, self.response) assert mw.storage.retrieve_response(mw.crawler.spider, s...
PolicyTestMixin
python
dask__dask
dask/dataframe/dask_expr/_expr.py
{ "start": 90522, "end": 90661 }
class ____(Binop): _parameters = ["left", "right", "level", "fill_value"] _defaults = {"fill_value": None, "level": None}
BinOpSeries
python
great-expectations__great_expectations
contrib/great_expectations_semantic_types_expectations/great_expectations_semantic_types_expectations/expectations/expect_column_values_to_be_valid_iana_timezone.py
{ "start": 1810, "end": 4305 }
class ____(ColumnMapExpectation): """Expect values in this column to be valid IANA timezone strings. A full list of valid timezones can be viewed by pytz.all_timezones. \ See https://www.iana.org/time-zones for more information. """ # These examples will be shown in the public gallery. # They ...
ExpectColumnValuesToBeValidIanaTimezone
python
airbytehq__airbyte
airbyte-integrations/connectors/source-kyriba/source_kyriba/source.py
{ "start": 7298, "end": 7364 }
class ____(CashBalancesStream): intraday = False
CashBalancesEod
python
boto__boto3
boto3/docs/docstring.py
{ "start": 2056, "end": 2213 }
class ____(LazyLoadedDocstring): def _write_docstring(self, *args, **kwargs): document_collection_method(*args, **kwargs)
CollectionMethodDocstring
python
sqlalchemy__sqlalchemy
test/dialect/postgresql/test_types.py
{ "start": 187838, "end": 187929 }
class ____(_DateTimeTZRangeTests, _RangeTypeRoundTrip): pass
DateTimeTZRangeRoundTripTest
python
pytorch__pytorch
torch/_inductor/template_heuristics/triton.py
{ "start": 92893, "end": 93577 }
class ____(ScaledMMConfigMixin, XPUConfigHeuristic): """Scaled MM template heuristic for XPU (non-TMA)""" def __init__(self) -> None: super().__init__() # Override mm_configs to use scaled_mm_configs self.mm_configs = self.scaled_mm_configs # NOTE: overriding exhaustive configs ...
XPUScaledMMTemplateConfigHeuristic
python
apache__airflow
airflow-core/src/airflow/timetables/trigger.py
{ "start": 6185, "end": 10050 }
class ____(CronMixin, _TriggerTimetable): """ Timetable that triggers DAG runs according to a cron expression. This is different from ``CronDataIntervalTimetable``, where the cron expression specifies the *data interval* of a DAG run. With this timetable, the data intervals are specified independen...
CronTriggerTimetable
python
pypa__pipenv
pipenv/patched/pip/_internal/network/session.py
{ "start": 9930, "end": 10230 }
class ____(HTTPAdapter): def cert_verify( self, conn: ConnectionPool, url: str, verify: Union[bool, str], cert: Optional[Union[str, Tuple[str, str]]], ) -> None: super().cert_verify(conn=conn, url=url, verify=False, cert=cert)
InsecureHTTPAdapter
python
sympy__sympy
sympy/liealgebras/root_system.py
{ "start": 71, "end": 6673 }
class ____(Atom): """Represent the root system of a simple Lie algebra Every simple Lie algebra has a unique root system. To find the root system, we first consider the Cartan subalgebra of g, which is the maximal abelian subalgebra, and consider the adjoint action of g on this subalgebra. There ...
RootSystem
python
tensorflow__tensorflow
tensorflow/python/tools/api/generator2/shared/exported_api.py
{ "start": 1244, "end": 1546 }
class ____(NamedTuple): """Information about an export Module docstring.""" file_name: str line_no: int modules: tuple[str, ...] docstring: str @classmethod def create(cls, *, modules: Sequence[str], **kwargs) -> "ExportedDoc": return cls(modules=tuple(modules), **kwargs)
ExportedDoc
python
pymupdf__PyMuPDF
src/__init__.py
{ "start": 905489, "end": 917417 }
class ____(DeprecationWarning): pass def restore_aliases(): warnings.filterwarnings( "once", category=FitzDeprecation) def showthis(msg, cat, filename, lineno, file=None, line=None): text = warnings.formatwarning(msg, cat, filename, lineno, line=line) s = text.find("FitzDeprecation") ...
FitzDeprecation
python
readthedocs__readthedocs.org
readthedocs/filetreediff/dataclasses.py
{ "start": 3146, "end": 5531 }
class ____: """Difference between two file tree manifests.""" def __init__( self, current_version: Version, current_version_build: Build, base_version: Version, base_version_build: Build, files: list[tuple[str, FileTreeDiffFileStatus]], outdated: bool, ...
FileTreeDiff
python
ray-project__ray
python/ray/tune/search/bohb/bohb_search.py
{ "start": 866, "end": 1140 }
class ____: """Mock object for HpBandSter to process.""" def __init__(self, loss: float, budget: float, config: Dict): self.result = {"loss": loss} self.kwargs = {"budget": budget, "config": config.copy()} self.exception = None
_BOHBJobWrapper
python
pennersr__django-allauth
allauth/socialaccount/providers/windowslive/provider.py
{ "start": 229, "end": 446 }
class ____(ProviderAccount): def to_str(self): email = self.account.extra_data.get("emails", {}).get("preferred") if email: return email return super().to_str()
WindowsLiveAccount
python
anthropics__anthropic-sdk-python
src/anthropic/resources/messages/batches.py
{ "start": 1074, "end": 13641 }
class ____(SyncAPIResource): @cached_property def with_raw_response(self) -> BatchesWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.c...
Batches