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
ipython__ipython
tests/test_handlers.py
{ "start": 626, "end": 772 }
class ____(object): def __getitem__(self, idx): return True def __call__(self, *args, **kws): return True
CallableIndexable
python
TheAlgorithms__Python
data_structures/stacks/stack_using_two_queues.py
{ "start": 120, "end": 2251 }
class ____: """ https://www.geeksforgeeks.org/implement-stack-using-queue/ >>> stack = StackWithQueues() >>> stack.push(1) >>> stack.push(2) >>> stack.push(3) >>> stack.peek() 3 >>> stack.pop() 3 >>> stack.peek() 2 >>> stack.pop() 2 >>> stack.pop() 1 ...
StackWithQueues
python
numpy__numpy
numpy/ma/tests/test_core.py
{ "start": 167962, "end": 194464 }
class ____: # Test class for miscellaneous functions. def test_masked_where_bool(self): x = [1, 2] y = masked_where(False, x) assert_equal(y, [1, 2]) assert_equal(y[1], 2) def test_masked_equal_wlist(self): x = [1, 2, 3] mx = masked_equal(x, 3) assert...
TestMaskedArrayFunctions
python
google__pytype
third_party/cpython/umarshal.py
{ "start": 1302, "end": 2289 }
class ____: def __init__(self, **kwds: Any): self.__dict__.update(kwds) def __repr__(self) -> str: return f"Code(**{self.__dict__})" co_localsplusnames: Tuple[str] co_localspluskinds: Tuple[int] def get_localsplus_names(self, select_kind: int) -> Tuple[str, ...]: varnames:...
Code
python
pydantic__pydantic
tests/benchmarks/basemodel_eq_performance.py
{ "start": 2759, "end": 3918 }
class ____(pydantic.BaseModel, frozen=True): def __eq__(self, other: Any) -> bool: if isinstance(other, pydantic.BaseModel): # When comparing instances of generic types for equality, as long as all field values are equal, # only require their generic origin types to be equal, rather ...
ItemGetterEqModel
python
encode__httpx
httpx/_models.py
{ "start": 12179, "end": 17449 }
class ____: def __init__( self, method: str, url: URL | str, *, params: QueryParamTypes | None = None, headers: HeaderTypes | None = None, cookies: CookieTypes | None = None, content: RequestContent | None = None, data: RequestData | None = Non...
Request
python
django__django
tests/multiple_database/tests.py
{ "start": 75395, "end": 77644 }
class ____(TestCase): databases = {"default", "other"} def test_auth_manager(self): "The methods on the auth manager obey database hints" # Create one user using default allocation policy User.objects.create_user("alice", "alice@example.com") # Create another user, explicitly s...
AuthTestCase
python
sympy__sympy
sympy/solvers/diophantine/diophantine.py
{ "start": 30323, "end": 30877 }
class ____(DiophantineEquationType): """ Representation of a homogeneous general quadratic. No solver is currently implemented for this equation type. """ name = 'homogeneous_general_quadratic' def matches(self): if not (self.total_degree == 2 and self.dimension >= 3): r...
HomogeneousGeneralQuadratic
python
PrefectHQ__prefect
tests/test_serializers.py
{ "start": 13171, "end": 15401 }
class ____: @pytest.mark.parametrize("data", SERIALIZER_TEST_CASES) def test_simple_roundtrip(self, data: Any): serializer = CompressedSerializer(serializer="pickle") serialized = serializer.dumps(data) assert serializer.loads(serialized) == data @pytest.mark.parametrize("lib", ["bz...
TestCompressedSerializer
python
google__pytype
pytype/file_utils_test.py
{ "start": 6594, "end": 7751 }
class ____(unittest.TestCase): def test_ignore_file(self): with test_utils.Tempdir() as d: d.create_file(".ignore.py") self.assertEqual(file_utils.expand_source_files(".", cwd=d.path), set()) def test_find_file(self): with test_utils.Tempdir() as d: d.create_file(".find.py") self.a...
TestExpandHiddenFiles
python
gevent__gevent
src/gevent/tests/test__pool.py
{ "start": 16987, "end": 17508 }
class ____(greentest.TestCase): error_fatal = False def test(self): p = gevent.pool.Pool(3) self.assertRaises(ExpectedException, p.map, lambda x: None, error_iter()) gevent.sleep(0.001) def test_unordered(self): p = gevent.pool.Pool(3) def unordered(): ...
TestErrorInIterator
python
apache__airflow
task-sdk/src/airflow/sdk/api/client.py
{ "start": 5616, "end": 13155 }
class ____: __slots__ = ("client",) def __init__(self, client: Client): self.client = client def start(self, id: uuid.UUID, pid: int, when: datetime) -> TIRunContext: """Tell the API server that this TI has started running.""" body = TIEnterRunningPayload(pid=pid, hostname=get_host...
TaskInstanceOperations
python
matplotlib__matplotlib
lib/matplotlib/backends/backend_qt.py
{ "start": 22053, "end": 22222 }
class ____(QtWidgets.QMainWindow): closing = QtCore.Signal() def closeEvent(self, event): self.closing.emit() super().closeEvent(event)
MainWindow
python
doocs__leetcode
solution/2800-2899/2840.Check if Strings Can be Made Equal With Operations II/Solution.py
{ "start": 0, "end": 183 }
class ____: def checkStrings(self, s1: str, s2: str) -> bool: return sorted(s1[::2]) == sorted(s2[::2]) and sorted(s1[1::2]) == sorted( s2[1::2] )
Solution
python
tensorflow__tensorflow
tensorflow/compiler/tests/reverse_ops_test.py
{ "start": 1014, "end": 2539 }
class ____(xla_test.XLATestCase): def testReverseOneDim(self): shape = (7, 5, 9, 11) for revdim in range(-len(shape), len(shape)): self._AssertReverseEqual([revdim], shape) def testReverseMoreThanOneDim(self): shape = (7, 5, 9, 11) # The offset is used to test various (but not all) combinati...
ReverseOpsTest
python
getsentry__sentry
src/sentry/seer/autofix/utils.py
{ "start": 3179, "end": 3350 }
class ____(BaseModel): status: CodingAgentStatus | None = None agent_url: str | None = None results: list[CodingAgentResult] | None = None
CodingAgentStateUpdate
python
aio-libs__aiohttp
examples/basic_auth_middleware.py
{ "start": 681, "end": 1644 }
class ____: """Middleware that adds Basic Authentication to all requests.""" def __init__(self, username: str, password: str) -> None: self.username = username self.password = password self._auth_header = self._encode_credentials() def _encode_credentials(self) -> str: """E...
BasicAuthMiddleware
python
apache__airflow
airflow-core/src/airflow/api_fastapi/execution_api/datamodels/taskinstance.py
{ "start": 8270, "end": 8607 }
class ____(BaseModel): """Schema for TaskInstance model with minimal required fields needed for Runtime.""" id: uuid.UUID task_id: str dag_id: str run_id: str try_number: int dag_version_id: uuid.UUID map_index: int = -1 hostname: str | None = None context_carrier: dict | None ...
TaskInstance
python
great-expectations__great_expectations
tests/integration/test_utils/data_source_config/redshift.py
{ "start": 705, "end": 1323 }
class ____(BaseSettings): # BaseSettings will retrieve this environment variable REDSHIFT_DATABASE: str REDSHIFT_HOST: str REDSHIFT_PASSWORD: str REDSHIFT_PORT: int REDSHIFT_USERNAME: str REDSHIFT_SSLMODE: str @property def connection_string(self) -> RedshiftDsn: return Reds...
RedshiftConnectionConfig
python
apache__airflow
airflow-core/src/airflow/api_fastapi/core_api/datamodels/plugins.py
{ "start": 4094, "end": 4237 }
class ____(BaseModel): """Plugin Collection serializer.""" plugins: list[PluginResponse] total_entries: int
PluginCollectionResponse
python
scipy__scipy
scipy/special/tests/test_legendre.py
{ "start": 2307, "end": 12690 }
class ____: @pytest.mark.parametrize("shape", [(10,), (4, 9), (3, 5, 7, 10)]) @pytest.mark.parametrize("m_max", [5, 4]) @pytest.mark.parametrize("n_max", [7, 10]) def test_lpmn(self, shape, n_max, m_max): rng = np.random.default_rng(1234) x = rng.uniform(-0.99, 0.99, shape) p_al...
TestAssocLegendreP
python
ray-project__ray
python/ray/tests/test_runtime_env_packaging.py
{ "start": 11436, "end": 13225 }
class ____: def test_valid_removal(self, random_zip_file_with_top_level_dir): # This test copies the TOP_LEVEL_DIR_NAME directory, and then it # shifts the contents of the copied directory into the base tmp_path # directory. Then it compares the contents of tmp_path with the # TOP_LE...
TestRemoveDirFromFilepaths
python
spack__spack
lib/spack/spack/llnl/util/lang.py
{ "start": 30979, "end": 31802 }
class ____: """A contextmanager to capture exceptions and forward them to a GroupedExceptionHandler.""" def __init__(self, context: str, handler: GroupedExceptionHandler, base: type): self._context = context self._handler = handler self._base = base def __enter__(self): ...
GroupedExceptionForwarder
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/assets/graph/remote_asset_graph.py
{ "start": 2496, "end": 5788 }
class ____(BaseAssetNode, ABC): @abstractmethod def resolve_to_singular_repo_scoped_node(self) -> "RemoteRepositoryAssetNode": ... @abstractmethod def resolve_to_repo_scoped_node( self, repository_selector: "RepositorySelector" ) -> Optional["RemoteRepositoryAssetNode"]: ... @property ...
RemoteAssetNode
python
pydantic__pydantic
pydantic/v1/errors.py
{ "start": 15567, "end": 15668 }
class ____(PydanticValueError): msg_template = 'value is not a valid IPv6 address'
IPv6AddressError
python
python__mypy
mypy/checker.py
{ "start": 8726, "end": 375034 }
class ____(NodeVisitor[None], TypeCheckerSharedApi): """Mypy type checker. Type check mypy source files that have been semantically analyzed. You must create a separate instance for each source file. """ # Are we type checking a stub? is_stub = False # Error message reporter errors: E...
TypeChecker
python
pypa__pip
src/pip/_internal/resolution/resolvelib/factory.py
{ "start": 2373, "end": 2530 }
class ____(NamedTuple): requirements: list[Requirement] constraints: dict[str, Constraint] user_requested: dict[str, int]
CollectedRootRequirements
python
huggingface__transformers
src/transformers/models/got_ocr2/modular_got_ocr2.py
{ "start": 5615, "end": 9348 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`GotOcr2ForConditionalGeneration`]. It is used to instantiate a GotOcr2 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yi...
GotOcr2Config
python
google__jax
tests/pallas/indexing_test.py
{ "start": 9417, "end": 24680 }
class ____(PallasBaseTest): def test_multi_indexing_interpreter_only(self): if not self.INTERPRET: self.skipTest("Only supported in interpret mode") # Interpret only test! YMMV actually compiling this. def permute(left, right, left_out_ref, right_out_ref): left_out = jnp.zeros_like(left) ...
IndexerOpsTest
python
keras-team__keras
keras/src/layers/regularization/gaussian_noise_test.py
{ "start": 125, "end": 1071 }
class ____(testing.TestCase): @pytest.mark.requires_trainable_backend def test_gaussian_noise_basics(self): self.run_layer_test( layers.GaussianNoise, init_kwargs={ "stddev": 0.2, }, input_shape=(2, 3), call_kwargs={"training": ...
GaussianNoiseTest
python
getsentry__sentry
src/sentry/sentry_metrics/querying/data/preparation/units_normalization.py
{ "start": 271, "end": 2164 }
class ____(PreparationStep): """ Represents a step which performs units normalization on a collection of intermediate queries. Unit normalization refers to the process of making sure all components of a query have the values on the same scale. For example, if you have 100 ms * 100 s the normalizat...
UnitsNormalizationStep
python
doocs__leetcode
solution/2200-2299/2295.Replace Elements in an Array/Solution.py
{ "start": 0, "end": 252 }
class ____: def arrayChange(self, nums: List[int], operations: List[List[int]]) -> List[int]: d = {x: i for i, x in enumerate(nums)} for x, y in operations: nums[d[x]] = y d[y] = d[x] return nums
Solution
python
ansible__ansible
lib/ansible/modules/hostname.py
{ "start": 22858, "end": 22979 }
class ____(Hostname): platform = 'Linux' distribution = 'Centos' strategy_class = RedHatStrategy
CentOSHostname
python
spack__spack
lib/spack/spack/vendor/archspec/cpu/microarchitecture.py
{ "start": 16179, "end": 16354 }
class ____(ArchspecError, ValueError): """Raised if a compiler version does not support optimization for a given micro-architecture. """
UnsupportedMicroarchitecture
python
viewflow__viewflow
viewflow/workflow/flow/nodes.py
{ "start": 2499, "end": 5148 }
class ____( mixins.NodeDetailMixin, mixins.NodeCancelMixin, mixins.NodeUndoMixin, mixins.NodeReviveMixin, nodes.View, ): """ Represents a user-interaction node within a flow .. code-block:: python class MyFlow(flow.Flow): ... approve = ( ...
View
python
jina-ai__jina
jina/serve/runtimes/monitoring.py
{ "start": 319, "end": 1057 }
class ____: """The Monitoring Mixin for pods""" def _setup_monitoring(self, monitoring: bool, port_monitoring: Union[int, str]): """ Wait for the monitoring server to start :param monitoring: flag indicating whether monitoring has to be activated :param port_monitoring: port whe...
MonitoringMixin
python
bokeh__bokeh
tests/unit/bokeh/core/property/test_dataspec.py
{ "start": 17225, "end": 17804 }
class ____: def test_strict_key_values(self) -> None: class FooSpatialUnits(HasProps): x = bcpd.DistanceSpec("x") f = FooSpatialUnits() f.x = dict(field="foo", units="screen") with pytest.raises(ValueError): f.x = dict(field="foo", units="junk", foo="crap") ...
Test_UnitSpec
python
pennersr__django-allauth
allauth/socialaccount/providers/okta/views.py
{ "start": 228, "end": 1687 }
class ____(OAuth2Adapter): provider_id = "okta" settings = app_settings.PROVIDERS.get(provider_id, {}) okta_base_url = settings.get("OKTA_BASE_URL") @property def access_token_url(self): return "https://{}/oauth2/v1/token".format(self.okta_base_url) @property def authorize_url(sel...
OktaOAuth2Adapter
python
getsentry__sentry
src/sentry/testutils/cases.py
{ "start": 130375, "end": 131793 }
class ____(BaseTestCase, TraceItemTestCase): def create_profile_function( self, organization: Organization | None = None, project: Project | None = None, timestamp: datetime | None = None, trace_id: str | None = None, attributes: dict[str, Any] | None = None, ) ->...
ProfileFunctionsTestCase
python
SmileyChris__easy-thumbnails
demoproject/mainapp/migrations/0001_initial.py
{ "start": 123, "end": 849 }
class ____(migrations.Migration): initial = True dependencies = [] operations = [ migrations.CreateModel( name="TestImage", fields=[ ( "id", models.BigAutoField( auto_created=True, ...
Migration
python
pydantic__pydantic
.github/actions/people/people.py
{ "start": 3711, "end": 3843 }
class ____(BaseModel): """Container for discussion comment nodes.""" nodes: list[DiscussionsCommentsNode]
DiscussionsComments
python
spack__spack
lib/spack/spack/vendor/attr/validators.py
{ "start": 15953, "end": 16793 }
class ____: min_length = attrib() def __call__(self, inst, attr, value): """ We use a callable class to be able to change the ``__repr__``. """ if len(value) < self.min_length: raise ValueError( "Length of '{name}' must be => {min}: {len}".format( ...
_MinLengthValidator
python
keras-team__keras
keras/src/layers/rnn/simple_rnn.py
{ "start": 8520, "end": 17527 }
class ____(RNN): """Fully-connected RNN where the output is to be fed back as the new input. Args: units: Positive integer, dimensionality of the output space. activation: Activation function to use. Default: hyperbolic tangent (`tanh`). If you pass None, no activation i...
SimpleRNN
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/executors/ecs/test_ecs_executor.py
{ "start": 14788, "end": 52951 }
class ____: """Tests the AWS ECS Executor.""" @mock.patch("airflow.providers.amazon.aws.executors.ecs.ecs_executor.AwsEcsExecutor.change_state") def test_execute(self, change_state_mock, mock_airflow_key, mock_executor, mock_cmd): """Test execution from end-to-end.""" airflow_key = mock_air...
TestAwsEcsExecutor
python
TheAlgorithms__Python
electronics/circular_convolution.py
{ "start": 688, "end": 3456 }
class ____: """ This class stores the first and second signal and performs the circular convolution """ def __init__(self) -> None: """ First signal and second signal are stored as 1-D array """ self.first_signal = [2, 1, 2, -1] self.second_signal = [1, 2, 3, 4]...
CircularConvolution
python
getlogbook__logbook
src/logbook/queues.py
{ "start": 5756, "end": 7979 }
class ____(Handler): """A handler that acts as a ZeroMQ publisher, which publishes each record as json dump. Requires the pyzmq library. The queue will be filled with JSON exported log records. To receive such log records from a queue you can use the :class:`ZeroMQSubscriber`. If `multi` is set ...
ZeroMQHandler
python
huggingface__transformers
src/transformers/models/qwen2_5_omni/modular_qwen2_5_omni.py
{ "start": 75388, "end": 76709 }
class ____(Qwen2AudioEncoderLayer): def __init__(self, config: Qwen2_5OmniAudioEncoderConfig): super().__init__(config) self.self_attn = Qwen2_5OmniAudioAttention(config) def forward( self, hidden_states: torch.Tensor, cu_seqlens: torch.Tensor, attention_mask: Op...
Qwen2_5OmniAudioEncoderLayer
python
PyCQA__pylint
tests/functional/n/no/no_warning_docstring.py
{ "start": 521, "end": 881 }
class ____(BBBB): ''' class CCCC ''' def __init__(self): BBBB.__init__(self) # should ignore docstring since CCCC is inherited from BBBB which is # inherited from AAAA containing method2 if __revision__: def method2(self): AAAA.method2(self) else: def method...
CCCC
python
Pylons__pyramid
src/pyramid/config/adapters.py
{ "start": 276, "end": 13920 }
class ____: @action_method def add_subscriber(self, subscriber, iface=None, **predicates): """Add an event :term:`subscriber` for the event stream implied by the supplied ``iface`` interface. The ``subscriber`` argument represents a callable object (or a :term:`dotted Python nam...
AdaptersConfiguratorMixin
python
doocs__leetcode
solution/1100-1199/1133.Largest Unique Number/Solution.py
{ "start": 0, "end": 173 }
class ____: def largestUniqueNumber(self, nums: List[int]) -> int: cnt = Counter(nums) return max((x for x, v in cnt.items() if v == 1), default=-1)
Solution
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/check_ops_test.py
{ "start": 4127, "end": 5804 }
class ____(test.TestCase): @test_util.run_in_graph_and_eager_modes def test_single_tensor_raises(self): tensor = constant_op.constant(1) with self.assertRaisesRegex(TypeError, "proper"): check_ops.assert_proper_iterable(tensor) @test_util.run_in_graph_and_eager_modes def test_single_sparse_tenso...
AssertProperIterableTest
python
huggingface__transformers
src/transformers/models/speech_encoder_decoder/modeling_speech_encoder_decoder.py
{ "start": 2190, "end": 24598 }
class ____(PreTrainedModel, GenerationMixin): r""" [`SpeechEncoderDecoderModel`] is a generic model class that will be instantiated as a transformer architecture with one of the base model classes of the library as encoder and another one as decoder when created with the :meth*~transformers.AutoModel.fr...
SpeechEncoderDecoderModel
python
run-llama__llama_index
llama-index-integrations/agent/llama-index-agent-azure/llama_index/agent/azure_foundry_agent/base.py
{ "start": 918, "end": 17969 }
class ____(BaseWorkflowAgent): """ Workflow-compatible Azure Foundry Agent for multi-agent orchestration. Inherits from BaseWorkflowAgent. Implements async methods for workflow integration using the async Azure SDK. """ def __init__( self, endpoint: str, model: str = "gp...
AzureFoundryAgent
python
openai__openai-python
src/openai/resources/beta/chatkit/threads.py
{ "start": 19067, "end": 19556 }
class ____: def __init__(self, threads: Threads) -> None: self._threads = threads self.retrieve = to_streamed_response_wrapper( threads.retrieve, ) self.list = to_streamed_response_wrapper( threads.list, ) self.delete = to_streamed_response_wr...
ThreadsWithStreamingResponse
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 419529, "end": 421644 }
class ____(sgqlc.types.Interface): """Represents a subject that can be reacted on.""" __schema__ = github_schema __field_names__ = ("database_id", "id", "reaction_groups", "reactions", "viewer_can_react") database_id = sgqlc.types.Field(Int, graphql_name="databaseId") """Identifies the primary key ...
Reactable
python
getsentry__sentry
src/sentry/search/eap/types.py
{ "start": 2506, "end": 2626 }
class ____(TypedDict): name: str type: Literal["string", "number"] value: str | int | float
TraceItemAttribute
python
huggingface__transformers
src/transformers/models/beit/modeling_beit.py
{ "start": 29448, "end": 32382 }
class ____(BeitPreTrainedModel): def __init__(self, config: BeitConfig, add_pooling_layer: bool = True) -> None: r""" add_pooling_layer (bool, *optional*, defaults to `True`): Whether to add a pooling layer """ super().__init__(config) self.config = config ...
BeitModel
python
mlflow__mlflow
tests/projects/test_databricks.py
{ "start": 16002, "end": 18532 }
class ____: def __init__(self, profile): assert profile == "my-profile" def get_config(self): return DatabricksConfig.from_password("host", "user", "pass", insecure=False) def test_databricks_http_request_integration(): """Confirms that the databricks http request params can in fact be us...
MockProfileConfigProvider
python
weaviate__weaviate-python-client
weaviate/gql/filter.py
{ "start": 19883, "end": 32956 }
class ____(Filter): """Where filter class used to filter weaviate objects.""" def __init__(self, content: dict): """Initialize a Where filter class instance. Args: content: The content of the `where` filter clause. Raises: TypeError: If 'content' is not of type...
Where
python
numba__numba
numba/core/ir.py
{ "start": 28411, "end": 28746 }
class ____(Inst): def __init__(self, value, loc, index): assert isinstance(value, Var) assert isinstance(loc, Loc) self.value = value self.loc = loc self.index = index def __str__(self): return 'yield %s' % (self.value,) def list_vars(self): return [...
Yield
python
scipy__scipy
scipy/signal/tests/test_dltisys.py
{ "start": 11554, "end": 12602 }
class ____: def test_initialization(self): # Check that all initializations work dt = 0.05 StateSpace(1, 1, 1, 1, dt=dt) StateSpace([1], [2], [3], [4], dt=dt) StateSpace(np.array([[1, 2], [3, 4]]), np.array([[1], [2]]), np.array([[1, 0]]), np.array([[0]]), ...
TestStateSpaceDisc
python
kamyu104__LeetCode-Solutions
Python/find-right-interval.py
{ "start": 49, "end": 543 }
class ____(object): def findRightInterval(self, intervals): """ :type intervals: List[Interval] :rtype: List[int] """ sorted_intervals = sorted((interval.start, i) for i, interval in enumerate(intervals)) result = [] for interval in intervals: idx ...
Solution
python
walkccc__LeetCode
solutions/919. Complete Binary Tree Inserter/919.py
{ "start": 0, "end": 544 }
class ____: def __init__(self, root: TreeNode | None): self.tree = [root] for node in self.tree: if node.left: self.tree.append(node.left) if node.right: self.tree.append(node.right) def insert(self, v: int) -> int: n = len(self.tree) self.tree.append(TreeNode(v)) pa...
CBTInserter
python
huggingface__transformers
src/transformers/models/evolla/modeling_evolla.py
{ "start": 2959, "end": 7954 }
class ____(nn.Module): """ Same as BertEmbeddings with a tiny tweak for positional embeddings indexing. """ def __init__(self, config): super().__init__() self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, padding_idx=config.pad_token_id) if config.emb_l...
EvollaSaProtEmbeddings
python
uqfoundation__dill
dill/tests/test_recursive.py
{ "start": 864, "end": 946 }
class ____(object): def __init__(self): super(obj1, self).__init__()
obj1
python
kamyu104__LeetCode-Solutions
Python/longest-common-suffix-queries.py
{ "start": 46, "end": 1544 }
class ____(object): def stringIndices(self, wordsContainer, wordsQuery): """ :type wordsContainer: List[str] :type wordsQuery: List[str] :rtype: List[int] """ INF = float("INF") class Trie(object): def __init__(self): self.__nodes =...
Solution
python
getsentry__sentry
src/sentry/issues/endpoints/group_similar_issues_embeddings.py
{ "start": 1317, "end": 1442 }
class ____(TypedDict): exception: float shouldBeGrouped: str @region_silo_endpoint
FormattedSimilarIssuesEmbeddingsData
python
realpython__materials
python-selenium/src/bandcamp/web/base.py
{ "start": 311, "end": 438 }
class ____: album: str artist: str genre: str url: str def __str__(self): return pformat(self)
Track
python
wandb__wandb
wandb/sdk/data_types/trace_tree.py
{ "start": 938, "end": 1116 }
class ____(str, Enum): LLM = "LLM" CHAIN = "CHAIN" AGENT = "AGENT" TOOL = "TOOL" def __str__(self) -> str: return str(self.value) @dataclass()
SpanKind
python
Netflix__metaflow
metaflow/packaging_sys/backend.py
{ "start": 111, "end": 3534 }
class ____(ABC): _mappings = {} type = "none" def __init_subclass__(cls, **kwargs): super().__init_subclass__(**kwargs) if cls.type in cls._mappings: raise ValueError(f"PackagingBackend {cls.type} already exists") cls._mappings[cls.type] = cls @classmethod def g...
PackagingBackend
python
allegroai__clearml
clearml/backend_api/services/v2_23/projects.py
{ "start": 155980, "end": 161018 }
class ____(Response): """ Response of projects.validate_delete endpoint. :param tasks: The total number of tasks under the project and all its children :type tasks: int :param non_archived_tasks: The total number of non-archived tasks under the project and all its children :type non_arc...
ValidateDeleteResponse
python
ansible__ansible
test/lib/ansible_test/_internal/diff.py
{ "start": 3306, "end": 7311 }
class ____: """Parse diff lines.""" def __init__(self, lines: list[str]) -> None: self.lines = lines self.files: list[FileDiff] = [] self.action = self.process_start self.line_number = 0 self.previous_line: t.Optional[str] = None self.line: t.Optional[str] = Non...
DiffParser
python
astropy__astropy
astropy/io/ascii/ipac.py
{ "start": 11568, "end": 11687 }
class ____(fixedwidth.FixedWidthSplitter): delimiter = " " delimiter_pad = "" bookend = True
IpacDataSplitter
python
coleifer__peewee
tests/db_tests.py
{ "start": 16738, "end": 16922 }
class ____(TestModel): first = CharField() last = CharField() email = CharField() class Meta: indexes = ( (('last', 'first'), False), )
Person
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 44469, "end": 44832 }
class ____(sgqlc.types.Input): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("owner_id", "client_mutation_id") owner_id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name="ownerId") client_mutation_id = sgqlc.types.Field(String, graphql_name="...
AbortQueuedMigrationsInput
python
apache__airflow
task-sdk/src/airflow/sdk/execution_time/context.py
{ "start": 20689, "end": 23657 }
class ____(Sequence["AssetEventResult"]): _after: str | datetime | None _before: str | datetime | None _ascending: bool _limit: int | None _asset_name: str | None _asset_uri: str | None _alias_name: str | None def __init__( self, asset_name: str | None = None, asset_uri: str | N...
InletEventsAccessor
python
openai__openai-python
src/openai/types/moderation_image_url_input_param.py
{ "start": 375, "end": 622 }
class ____(TypedDict, total=False): image_url: Required[ImageURL] """Contains either an image URL or a data URL for a base64 encoded image.""" type: Required[Literal["image_url"]] """Always `image_url`."""
ModerationImageURLInputParam
python
plotly__plotly.py
plotly/graph_objs/layout/_coloraxis.py
{ "start": 235, "end": 14577 }
class ____(_BaseLayoutHierarchyType): _parent_path_str = "layout" _path_str = "layout.coloraxis" _valid_props = { "autocolorscale", "cauto", "cmax", "cmid", "cmin", "colorbar", "colorscale", "reversescale", "showscale", } @prop...
Coloraxis
python
allegroai__clearml
clearml/backend_api/services/v2_13/queues.py
{ "start": 61476, "end": 63771 }
class ____(Request): """ :param queue: Queue id :type queue: str :param task: Task id :type task: str :param count: Number of positions in the queue to move the task forward relative to the current position. Optional, the default value is 1. :type count: int """ _service = "...
MoveTaskBackwardRequest
python
scipy__scipy
benchmarks/benchmarks/go_benchmark_functions/go_funcs_L.py
{ "start": 87, "end": 1617 }
class ____(Benchmark): r""" Langermann objective function. This class defines the Langermann [1]_ global optimization problem. This is a multimodal minimization problem defined as follows: .. math:: f_{\text{Langermann}}(x) = - \sum_{i=1}^{5} \frac{c_i \cos\left\{\pi \left[\left...
Langermann
python
huggingface__transformers
src/transformers/models/visual_bert/modeling_visual_bert.py
{ "start": 7633, "end": 10635 }
class ____(nn.Module): def __init__(self, config): super().__init__() if config.hidden_size % config.num_attention_heads != 0 and not hasattr(config, "embedding_size"): raise ValueError( f"The hidden size ({config.hidden_size}) is not a multiple of the number of attention...
VisualBertSelfAttention
python
huggingface__transformers
src/transformers/models/lilt/configuration_lilt.py
{ "start": 775, "end": 5972 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`LiltModel`]. It is used to instantiate a LiLT model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configurati...
LiltConfig
python
google__jax
tests/sparsify_test.py
{ "start": 1602, "end": 23283 }
class ____(jtu.JaxTestCase): @classmethod def sparsify(cls, f): return sparsify(f, use_tracer=False) def testNotImplementedMessages(self): x = BCOO.fromdense(jnp.arange(5.0)) # Test a densifying primitive with self.assertRaisesRegex(NotImplementedError, r"^sparse rule for cos is not imple...
SparsifyTest
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": 8507, "end": 8948 }
class ____(BaseModel): @abstractmethod def search_settings(self, exclude_none: bool = True) -> dict[str, Any]: """Return the specific index search settings for the algorithm. :param exclude_none: Whether to exclude keys with None values in the dictionary. :type exclude_none: bool ...
SearchParams
python
run-llama__llama_index
llama-index-core/llama_index/core/postprocessor/metadata_replacement.py
{ "start": 236, "end": 1067 }
class ____(BaseNodePostprocessor): target_metadata_key: str = Field( description="Target metadata key to replace node content with." ) def __init__(self, target_metadata_key: str) -> None: super().__init__(target_metadata_key=target_metadata_key) @classmethod def class_name(cls) ->...
MetadataReplacementPostProcessor
python
django__django
tests/model_fields/models.py
{ "start": 4726, "end": 4953 }
class ____(models.Model): """Model with FKs to models with {Null,}BooleanField's, #15040""" bf = models.ForeignKey(BooleanModel, models.CASCADE) nbf = models.ForeignKey(NullBooleanModel, models.CASCADE)
FksToBooleans
python
sqlalchemy__sqlalchemy
test/dialect/postgresql/test_types.py
{ "start": 187929, "end": 193671 }
class ____(AssertsCompiledSQL, fixtures.TestBase): __dialect__ = "postgresql" # operator tests @classmethod def setup_test_class(cls): table = Table( "data_table", MetaData(), Column("multirange", cls._col_type, primary_key=True), ) cls.col =...
_MultiRangeTypeCompilation
python
great-expectations__great_expectations
contrib/great_expectations_semantic_types_expectations/great_expectations_semantic_types_expectations/expectations/expect_column_values_to_be_valid_meid.py
{ "start": 855, "end": 1842 }
class ____(ColumnMapMetricProvider): # This is the id string that will be used to reference your metric. condition_metric_name = "column_values.to_be_valid_meid" # This method implements the core logic for the PandasExecutionEngine @column_condition_partial(engine=PandasExecutionEngine) def _pandas...
ColumnValuesToBeValidMeid
python
getsentry__sentry
tests/sentry/utils/test_http.py
{ "start": 2816, "end": 9060 }
class ____(unittest.TestCase): def isValidOrigin(self, origin, inputs): with mock.patch("sentry.utils.http.get_origins") as get_origins: get_origins.return_value = inputs project = mock.Mock() result = is_valid_origin(origin, project) get_origins.assert_called...
IsValidOriginTestCase
python
numba__numba
numba/core/typing/builtins.py
{ "start": 10511, "end": 10592 }
class ____(BitwiseLogicOperation): pass @infer_global(operator.iand)
BitwiseAnd
python
apache__airflow
helm-tests/tests/helm_tests/airflow_core/test_scheduler.py
{ "start": 41701, "end": 44368 }
class ____: """Tests scheduler service account.""" def test_should_add_component_specific_labels(self): docs = render_chart( values={ "scheduler": { "serviceAccount": {"create": True}, "labels": {"test_label": "test_label_value"}, ...
TestSchedulerServiceAccount
python
pytorch__pytorch
torch/_inductor/codegen/simd.py
{ "start": 9696, "end": 12211 }
class ____(IterationRanges): def __init__( self, name: str, divisor: sympy.Expr, length: sympy.Expr, expr: sympy.Expr, parent: IterationRanges, ) -> None: super().__init__( name=name, numel=parent.numel / length, var_lis...
IterationRangesEntry
python
pandas-dev__pandas
asv_bench/benchmarks/strings.py
{ "start": 1638, "end": 4217 }
class ____(Dtypes): def time_center(self, dtype): self.s.str.center(100) def time_count(self, dtype): self.s.str.count("A") def time_endswith(self, dtype): self.s.str.endswith("A") def time_extract(self, dtype): with warnings.catch_warnings(record=True): se...
Methods
python
getsentry__sentry
tests/sentry/relocation/tasks/test_process.py
{ "start": 55539, "end": 61580 }
class ____(RelocationTaskTestCase): def setUp(self) -> None: super().setUp() self.relocation.step = Relocation.Step.PREPROCESSING.value self.relocation.latest_task = OrderedTask.PREPROCESSING_COMPLETE.name self.relocation.want_usernames = ["testuser"] self.relocation.want_org...
ValidatingStartTest
python
kamyu104__LeetCode-Solutions
Python/checking-existence-of-edge-length-limited-paths-ii.py
{ "start": 3223, "end": 4275 }
class ____(object): def __init__(self, n, edgeList): """ :type n: int :type edgeList: List[List[int]] """ edgeList.sort(key = lambda x:x[2]) self.__uf = UnionFind(n) self.__adj = [[] for _ in xrange(n)] for index, (i, j, weight) in enumerate(edgeList)...
DistanceLimitedPathsExist
python
apache__airflow
airflow-core/src/airflow/callbacks/callback_requests.py
{ "start": 1129, "end": 1777 }
class ____(BaseModel): """ Base Class with information about the callback to be executed. :param msg: Additional Message that can be used for logging """ filepath: str """File Path to use to run the callback""" bundle_name: str bundle_version: str | None msg: str | None = None ...
BaseCallbackRequest
python
walkccc__LeetCode
solutions/2570. Merge Two 2D Arrays by Summing Values/2570.py
{ "start": 0, "end": 398 }
class ____: def mergeArrays(self, nums1: list[list[int]], nums2: list[list[int]]) -> list[list[int]]: count = [0] * (1001) self._addCount(nums1, count) self._addCount(nums2, count) return [[i, c] for i, c in enumerate(count) if c > 0] def _addCount(self, nums: list[list[int]], cou...
Solution
python
spyder-ide__spyder
spyder/plugins/editor/widgets/window.py
{ "start": 2537, "end": 12423 }
class ____(QSplitter, SpyderConfigurationObserver): """Main widget to show in EditorMainWindow.""" CONF_SECTION = 'editor' SPLITTER_WIDTH = "7px" def __init__(self, parent, main_widget, menu_actions, outline_plugin): super().__init__(parent) self.setAttribute(Qt.WA_DeleteOnClose) ...
EditorWidget
python
dask__distributed
distributed/worker_memory.py
{ "start": 2573, "end": 14879 }
class ____: """Management of worker memory usage Parameters ---------- worker Worker to manage For meaning of the remaining parameters, see the matching parameter names in :class:`~.distributed.worker.Worker`. Notes ----- If data is a callable and has the argument ``worke...
WorkerMemoryManager
python
airbytehq__airbyte
airbyte-integrations/connectors/source-amazon-seller-partner/components.py
{ "start": 2840, "end": 3449 }
class ____(Decoder): """ Decoder strategy that returns the json-encoded content of a response, if any. """ parameters: InitVar[Mapping[str, Any]] def is_stream_response(self) -> bool: return False def decode(self, response: requests.Response) -> Generator[MutableMapping[str, Any], Non...
GzipCsvDecoder