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
weaviate__weaviate-python-client
weaviate/embedded.py
{ "start": 11821, "end": 13714 }
class ____(_EmbeddedBase): def is_listening(self) -> bool: up = self.__is_listening() return up[0] and up[1] def __is_listening(self) -> Tuple[bool, bool]: http_listening, grpc_listening = False, False with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: try:...
EmbeddedV4
python
pytorch__pytorch
torch/_inductor/mock_cache.py
{ "start": 4663, "end": 8587 }
class ____(contextlib.AbstractContextManager): @classmethod def setUp(cls): # If this test is using PatchCaches then disable all the caches by # default, letting the tests turn them on explicitly. This is because # tests using PatchCaches will often want to check stats explicitly. ...
PatchCaches
python
tensorflow__tensorflow
tensorflow/python/keras/layers/recurrent.py
{ "start": 102669, "end": 107538 }
class ____(LSTMCell): """Equivalent to LSTMCell class but adds peephole connections. Peephole connections allow the gates to utilize the previous internal state as well as the previous hidden state (which is what LSTMCell is limited to). This allows PeepholeLSTMCell to better learn precise timings over LSTMCel...
PeepholeLSTMCell
python
langchain-ai__langchain
libs/core/tests/unit_tests/runnables/test_runnable.py
{ "start": 6420, "end": 6680 }
class ____(RunnableSerializable[str, int]): hello: str = "" @override def invoke( self, input: str, config: RunnableConfig | None = None, **kwargs: Any, ) -> int: return len(input)
FakeRunnableSerializable
python
matplotlib__matplotlib
lib/matplotlib/_type1font.py
{ "start": 2261, "end": 2369 }
class ____(_Token): kind = 'boolean' def value(self): return self.raw == 'true'
_BooleanToken
python
vyperlang__vyper
vyper/utils.py
{ "start": 11711, "end": 19750 }
class ____: MAX_INT128 = 2**127 - 1 MIN_INT128 = -(2**127) MAX_INT256 = 2**255 - 1 MIN_INT256 = -(2**255) MAXDECIMAL = 2**167 - 1 # maxdecimal as EVM value MINDECIMAL = -(2**167) # mindecimal as EVM value # min decimal allowed as Python value MIN_AST_DECIMAL = -decimal.Decimal(2**167) ...
SizeLimits
python
marshmallow-code__marshmallow
tests/test_error_store.py
{ "start": 243, "end": 5211 }
class ____: def test_merging_none_and_string(self): assert merge_errors(None, "error1") == "error1" def test_merging_none_and_custom_error(self): assert CustomError(123, "error1") == merge_errors( None, CustomError(123, "error1") ) def test_merging_none_and_list(self): ...
TestMergeErrors
python
sqlalchemy__sqlalchemy
test/base/test_except.py
{ "start": 848, "end": 13768 }
class ____(fixtures.TestBase): def test_version_token(self): assert sa_exceptions._version_token in ( "13", "14", "15", "16", "20", "21", "22", ) def _translating_dialect_fixture(self): d = default.Defau...
WrapTest
python
google__jax
jax/_src/api_util.py
{ "start": 26920, "end": 28730 }
class ____: __slots__ = ['val'] def __init__(self, val): self.val = val def __hash__(self): return id(self.val) def __eq__(self, other): return self.val is other.val # TODO(mattjj): make this function faster def check_no_aliased_ref_args(dbg_fn: Callable[[], core.DebugInfo], ...
_HashableByObjectId
python
tensorflow__tensorflow
tensorflow/python/data/experimental/kernel_tests/sql_dataset_test.py
{ "start": 4513, "end": 28130 }
class ____(SqlDatasetTestBase, parameterized.TestCase): # Test that SqlDataset can read from a database table. @combinations.generate(test_base.default_test_combinations()) def testReadResultSet(self): for _ in range(2): # Run twice to verify statelessness of db operations. dataset = self._createSqlDa...
SqlDatasetTest
python
lazyprogrammer__machine_learning_examples
recommenders/rbm_tf_k.py
{ "start": 2251, "end": 8528 }
class ____(object): def __init__(self, D, M, K): self.D = D # input feature size self.M = M # hidden size self.K = K # number of ratings self.build(D, M, K) def build(self, D, M, K): # params self.W = tf.Variable(tf.random.normal(shape=(D, K, M)) * np.sqrt(2.0 /...
RBM
python
allegroai__clearml
clearml/backend_api/services/v2_23/frames.py
{ "start": 133918, "end": 149790 }
class ____(Response): """ Response of frames.get_by_ids endpoint. :param frames: Frames data :type frames: Sequence[Frame] """ _service = "frames" _action = "get_by_ids" _version = "2.23" _schema = { "definitions": { "augmentation": { "propertie...
GetByIdsResponse
python
chroma-core__chroma
chromadb/test/property/strategies.py
{ "start": 24087, "end": 25453 }
class ____(TypedDict): where: Optional[types.Where] ids: Optional[Union[str, List[str]]] where_document: Optional[types.WhereDocument] @st.composite def filters( draw: st.DrawFn, collection_st: st.SearchStrategy[Collection], recordset_st: st.SearchStrategy[RecordSet], include_all_ids: bool...
Filter
python
getsentry__sentry
src/sentry/preprod/analytics.py
{ "start": 473, "end": 652 }
class ____(analytics.Event): organization_id: int project_id: int @analytics.eventclass("preprod_artifact.api.size_analysis_download")
PreprodArtifactApiAssembleGenericEvent
python
PyCQA__pylint
pylint/lint/message_state_handler.py
{ "start": 896, "end": 17960 }
class ____: """Class that handles message disabling & enabling and processing of inline pragma's. """ def __init__(self, linter: PyLinter) -> None: self.linter = linter self.default_enabled_messages: dict[str, MessageDefinitionTuple] = { k: v for k, v in self.lin...
_MessageStateHandler
python
pydata__xarray
xarray/tests/test_utils.py
{ "start": 399, "end": 1438 }
class ____: def test(self): def new_method(): pass old_method = utils.alias(new_method, "old_method") assert "deprecated" in old_method.__doc__ # type: ignore[operator] with pytest.warns(Warning, match="deprecated"): old_method() @pytest.mark.parametrize( ...
TestAlias
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/lambda3.py
{ "start": 332, "end": 563 }
class ____(Protocol): def __call__(self, y: int, a: int = 0) -> bool: ... lambda1: Callable[[int, int], bool] = lambda y, a=0: a == y lambda2: MyCallback = lambda y, a=0: a == y lambda1(20) lambda2(20) lambda2(20, 30)
MyCallback
python
matplotlib__matplotlib
lib/matplotlib/backends/backend_webagg_core.py
{ "start": 14867, "end": 16451 }
class ____(backend_bases.NavigationToolbar2): # Use the standard toolbar items + download button toolitems = [ (text, tooltip_text, image_file, name_of_method) for text, tooltip_text, image_file, name_of_method in (*backend_bases.NavigationToolbar2.toolitems, ('Download', 'D...
NavigationToolbar2WebAgg
python
oauthlib__oauthlib
oauthlib/openid/connect/core/grant_types/base.py
{ "start": 221, "end": 15503 }
class ____: # Just proxy the majority of method calls through to the # proxy_target grant type handler, which will usually be either # the standard OAuth2 AuthCode or Implicit grant types. def __getattr__(self, attr): return getattr(self.proxy_target, attr) def __setattr__(self, attr, valu...
GrantTypeBase
python
huggingface__transformers
tests/models/deepseek_v2/test_modeling_deepseek_v2.py
{ "start": 1798, "end": 7391 }
class ____(CausalLMModelTest, unittest.TestCase): test_all_params_have_gradient = False model_tester_class = DeepseekV2ModelTester model_split_percents = [0.5, 0.7, 0.8] # used in `test_torch_compile_for_training` _torch_compile_train_cls = DeepseekV2ForCausalLM if is_torch_available() else None ...
DeepseekV2ModelTest
python
gevent__gevent
src/greentest/3.14/test_socket.py
{ "start": 234221, "end": 235082 }
class ____(unittest.TestCase): def testExceptionTree(self): self.assertIsSubclass(OSError, Exception) self.assertIsSubclass(socket.herror, OSError) self.assertIsSubclass(socket.gaierror, OSError) self.assertIsSubclass(socket.timeout, OSError) self.assertIs(socket.error, OSEr...
TestExceptions
python
huggingface__transformers
src/transformers/models/lxmert/modeling_lxmert.py
{ "start": 1547, "end": 4777 }
class ____(ModelOutput): r""" language_output (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`): Sequence of hidden-states at the output of the last layer of the language encoder. vision_output (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`): ...
LxmertModelOutput
python
sympy__sympy
sympy/core/relational.py
{ "start": 27701, "end": 29755 }
class ____(Relational): """Internal base class for all *Than types. Each subclass must implement _eval_relation to provide the method for comparing two real numbers. """ __slots__ = () if TYPE_CHECKING: @property def args(self) -> tuple[Expr, Expr]: ... @...
_Inequality
python
google__flatbuffers
tests/MyGame/Example/Referrable.py
{ "start": 176, "end": 1522 }
class ____(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0): n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) x = Referrable() x.Init(buf, n + offset) return x @classmethod def GetRootAsReferrable(cls, buf, offset=0): ...
Referrable
python
pytorch__pytorch
torch/_inductor/fx_passes/group_batch_fusion.py
{ "start": 19915, "end": 25307 }
class ____(BatchFusion): """ Batch linear left-hand side fusion. This pass tries to fuse the following patterns: torch.nn.functional.linear(x, w1), linear(x, w2),... * linear(x, wn) -> torch.mm(x, torch.cat([w1, w2,... * wn]).transpose(0, 1)) We have a separate pass to eliminate contiguous...
BatchLinearLHSFusion
python
django-guardian__django-guardian
example_project/core/migrations/0001_initial.py
{ "start": 150, "end": 4282 }
class ____(migrations.Migration): dependencies = [ ("auth", "0001_initial"), ] operations = [ migrations.CreateModel( name="CustomUser", fields=[ ("id", models.AutoField(verbose_name="ID", serialize=False, auto_created=True, primary_key=True)), ...
Migration
python
huggingface__transformers
src/transformers/models/olmo3/configuration_olmo3.py
{ "start": 1304, "end": 9364 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`Olmo3Model`]. It is used to instantiate an OLMo3 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configur...
Olmo3Config
python
dateutil__dateutil
tests/test_tz.py
{ "start": 94161, "end": 95318 }
class ____(unittest.TestCase): def testNoTzSpecified(self): with self.assertRaises(ValueError): tz.datetime_exists(datetime(2016, 4, 1, 2, 9)) def testInGapNaive(self): tzi = tz.gettz('Australia/Sydney') dt = datetime(2012, 10, 7, 2, 30) self.assertFalse(tz.datetim...
DatetimeExistsTest
python
cython__cython
Cython/Debugger/Tests/test_libcython_in_gdb.py
{ "start": 15247, "end": 15525 }
class ____(DebugTestCase): def test_cyset(self): self.break_and_run('os.path.join("foo", "bar")') gdb.execute('cy set a = $cy_eval("{None: []}")') stringvalue = self.read_var("a", cast_to=str) self.assertEqual(stringvalue, "{None: []}")
CySet
python
walkccc__LeetCode
solutions/300. Longest Increasing Subsequence/300-2.py
{ "start": 0, "end": 351 }
class ____: def lengthOfLIS(self, nums: list[int]) -> int: # tails[i] := the minimum tails of all the increasing subsequences having # length i + 1 tails = [] for num in nums: if not tails or num > tails[-1]: tails.append(num) else: tails[bisect.bisect_left(tails, num)] = ...
Solution
python
doocs__leetcode
solution/1600-1699/1679.Max Number of K-Sum Pairs/Solution.py
{ "start": 0, "end": 383 }
class ____: def maxOperations(self, nums: List[int], k: int) -> int: nums.sort() l, r, ans = 0, len(nums) - 1, 0 while l < r: s = nums[l] + nums[r] if s == k: ans += 1 l, r = l + 1, r - 1 elif s > k: r -= 1 ...
Solution
python
django__django
tests/reverse_lookup/models.py
{ "start": 196, "end": 326 }
class ____(models.Model): question = models.CharField(max_length=200) creator = models.ForeignKey(User, models.CASCADE)
Poll
python
pytorch__pytorch
torch/ao/nn/intrinsic/modules/fused.py
{ "start": 1250, "end": 1817 }
class ____(_FusedModule): r"""This is a sequential container which calls the Conv2d and ReLU modules. During quantization this will be replaced with the corresponding fused module.""" def __init__(self, conv, relu): assert ( type_before_parametrizations(conv) == Conv2d and t...
ConvReLU2d
python
pydantic__pydantic
pydantic-core/tests/validators/test_typed_dict.py
{ "start": 32703, "end": 47957 }
class ____: def test_on_error_bad_omit(self): with pytest.raises(SchemaError, match="Field 'x': 'on_error = omit' cannot be set for required fields"): SchemaValidator( schema=core_schema.typed_dict_schema( fields={ 'x': core_schema.type...
TestOnError
python
apache__airflow
providers/fab/tests/unit/fab/auth_manager/api_endpoints/test_user_endpoint.py
{ "start": 9417, "end": 15484 }
class ____(TestUserEndpoint): @pytest.mark.parametrize( ("url", "expected_usernames"), [ ("/fab/v1/users?limit=1", ["test"]), ("/fab/v1/users?limit=2", ["test", "test_no_permissions"]), ( "/fab/v1/users?offset=5", [ ...
TestGetUsersPagination
python
tensorflow__tensorflow
tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py
{ "start": 42613, "end": 66044 }
class ____(test.TestCase): def _DtypesToTest(self, use_gpu): # double datatype is currently not supported for convolution ops # on the ROCm platform optional_float64 = [] if test.is_built_with_rocm() else [dtypes.float64] if use_gpu and not test_util.GpuSupportsHalfMatMulAndConv(): return [dtyp...
Conv2DTest
python
gevent__gevent
src/gevent/libuv/watcher.py
{ "start": 525, "end": 1915 }
class ____(dict): __slots__ = () def remove(self, obj): try: del self[obj] except KeyError: # pragma: no cover # This has been seen to happen if the module is executed twice # and so the callback doesn't match the storage seen by watcher objects. ...
_ClosingWatchers
python
neetcode-gh__leetcode
python/0215-kth-largest-element-in-an-array.py
{ "start": 160, "end": 492 }
class ____: def findKthLargest(self, nums: List[int], k: int) -> int: heapify(nums) while len(nums) > k: heappop(nums) return nums[0] # Solution: Sorting # Time Complexity: # - Best Case: O(n) # - Average Case: O(n*log(n)) # - Worst Case:O(n*log(n)) # Extra Space Complexit...
Solution
python
has2k1__plotnine
plotnine/themes/themeable.py
{ "start": 56673, "end": 57108 }
class ____(themeable): """ Justification of legends placed on the left Parameters ---------- theme_element : Literal["bottom", "center", "top"] | float How to justify the entire group with 1 or more guides. i.e. How to slide the legend along the left column. If a float, it s...
legend_justification_left
python
ionelmc__pytest-benchmark
src/pytest_benchmark/table.py
{ "start": 341, "end": 7290 }
class ____: def __init__(self, columns, sort, histogram, name_format, logger, scale_unit): self.columns = columns self.sort = sort self.histogram = histogram self.name_format = name_format self.logger = logger self.scale_unit = scale_unit def display(self, tr, gr...
TableResults
python
PrefectHQ__prefect
src/prefect/client/schemas/filters.py
{ "start": 355, "end": 488 }
class ____(AutoEnum): """Operators for combining filter criteria.""" and_ = AutoEnum.auto() or_ = AutoEnum.auto()
Operator
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/postgresql/types.py
{ "start": 3957, "end": 4193 }
class ____(sqltypes.TypeEngine[str]): """Provide the PostgreSQL REGCONFIG type. .. versionadded:: 2.0.0rc1 """ __visit_name__ = "REGCONFIG" operator_classes = OperatorClass.BASE | OperatorClass.COMPARISON
REGCONFIG
python
django__django
tests/model_fields/test_filefield.py
{ "start": 489, "end": 8232 }
class ____(TestCase): def test_clearable(self): """ FileField.save_form_data() will clear its instance attribute value if passed False. """ d = Document(myfile="something.txt") self.assertEqual(d.myfile, "something.txt") field = d._meta.get_field("myfile") ...
FileFieldTests
python
kubernetes-client__python
kubernetes/client/models/v1_persistent_volume_claim_condition.py
{ "start": 383, "end": 9885 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attri...
V1PersistentVolumeClaimCondition
python
Pylons__pyramid
src/pyramid/view.py
{ "start": 18463, "end": 20651 }
class ____: """ .. versionadded:: 1.3 An analogue of :class:`pyramid.view.view_config` which registers a :term:`forbidden view` using :meth:`pyramid.config.Configurator.add_forbidden_view`. The forbidden_view_config constructor accepts most of the same arguments as the constructor of :clas...
forbidden_view_config
python
sanic-org__sanic
sanic/application/motd.py
{ "start": 1307, "end": 1888 }
class ____(MOTD): """A basic MOTD display. This is used when the terminal does not support ANSI escape codes. """ def display(self): if self.logo: logger.debug(self.logo) lines = [f"Sanic v{__version__}"] if self.serve_location: lines.append(f"Goin' Fast...
MOTDBasic
python
pytorch__pytorch
test/torch_np/test_random.py
{ "start": 3619, "end": 4267 }
class ____(TestCase): def test_numpy_global(self): with control_stream(use_numpy=True): tnp.random.seed(12345) x = tnp.random.uniform(0, 1, size=11) # check that the stream is identical to numpy's _np.random.seed(12345) x_np = _np.random.uniform(0, 1, size=11...
TestNumpyGlobal
python
wepe__MachineLearning
DeepLearning Tutorials/mlp/mlp_with_commentate.py
{ "start": 1073, "end": 2825 }
class ____(object): def __init__(self, rng, input, n_in, n_out, W=None, b=None, activation=T.tanh): self.input = input #类HiddenLayer的input即所传递进来的input """ 注释: 代码要兼容GPU,则必须使用 dtype=theano.config.floatX,并且定义为theano.shared 另外,W的初始化有个规则:如果使用tanh函数,则在-sqrt...
HiddenLayer
python
apache__airflow
airflow-core/src/airflow/models/asset.py
{ "start": 32391, "end": 33518 }
class ____(Base): """ Mapping table between AssetPartitionDagRun and AssetEvent. PartitionedAssetKeyLog tells us which events contributed to a particular AssetPartitionDagRun record. """ id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True) asset_id: Mapped[int] = ...
PartitionedAssetKeyLog
python
sqlalchemy__sqlalchemy
test/orm/test_eager_relations.py
{ "start": 167187, "end": 179061 }
class ____(_fixtures.FixtureTest, testing.AssertsCompiledSQL): run_setup_mappers = "once" run_inserts = "once" run_deletes = None __dialect__ = "default" __prefer_backends__ = ("postgresql", "mysql", "oracle") @classmethod def setup_mappers(cls): ( users, Ke...
MixedEntitiesTest
python
getsentry__sentry
src/sentry/integrations/mixins/notifications.py
{ "start": 399, "end": 1448 }
class ____: def send_message(self, channel_id: str, message: str) -> None: """ Send a message through the integration. """ raise NotImplementedError def notify_remove_external_team(self, external_team: ExternalActor, team: Team) -> None: """ Notify through the in...
NotifyBasicMixin
python
django__django
tests/gis_tests/geoapp/test_functions.py
{ "start": 771, "end": 39804 }
class ____(FuncTestMixin, TestCase): """ Testing functions from django/contrib/gis/db/models/functions.py. Area/Distance/Length/Perimeter are tested in distapp/tests. Please keep the tests in function's alphabetic order. """ fixtures = ["initial"] def test_asgeojson(self): if not ...
GISFunctionsTests
python
huggingface__transformers
src/transformers/pipelines/text_to_audio.py
{ "start": 1130, "end": 1387 }
class ____(TypedDict, total=False): """ audio (`AudioInput`): The generated audio waveform. sampling_rate (`int`): The sampling rate of the generated audio waveform. """ audio: AudioInput sampling_rate: int
AudioOutput
python
ray-project__ray
release/nightly_tests/dask_on_ray/large_scale_test.py
{ "start": 3093, "end": 5133 }
class ____: @staticmethod def lazy_load_xarray_one_month(test_spec: TestSpec) -> xarray.Dataset: """ Lazily load an Xarray representing 1 month of data. The Xarray's data variable is a dask.array that's lazily constructed. Therefore, creating the Xarray object doesn't consume an...
LoadRoutines
python
PyCQA__pylint
tests/functional/m/mapping_context.py
{ "start": 1354, "end": 1594 }
class ____: kwargs = None def get_kwargs(self): return self.kwargs def run(self, **kwargs): print(kwargs) def dispatch(self): kws = self.get_kwargs() self.run(**kws) # abstract class
BaseThing
python
sqlalchemy__sqlalchemy
test/sql/test_lambdas.py
{ "start": 58342, "end": 64293 }
class ____( fixtures.TestBase, testing.AssertsExecutionResults, AssertsCompiledSQL ): __dialect__ = "default" @testing.fails("wontfix issue #5767") def test_detect_change_in_binds_no_tracking(self): t1 = table("t1", column("q"), column("p")) t2 = table("t2", column("q"), column("p")) ...
DeferredLambdaElementTest
python
coleifer__peewee
tests/models.py
{ "start": 174628, "end": 177168 }
class ____(ModelTestCase): requires = [VL] _data = [(1, 'one'), (2, 'two'), (3, 'three')] def test_insert_into_select_from_vl(self): vl = ValuesList(self._data) cte = vl.cte('newvals', columns=['n', 's']) res = (VL .insert_from(cte.select(cte.c.n, cte.c.s), fields=[VL...
TestValuesListIntegration
python
dask__distributed
distributed/comm/ucx.py
{ "start": 730, "end": 801 }
class ____(Comm): def __init__(self): _raise_deprecated()
UCX
python
sphinx-doc__sphinx
tests/roots/test-ext-autodoc/target/preserve_defaults.py
{ "start": 1050, "end": 1701 }
class ____: """docstring""" # The properties will raise a silent SyntaxError because "lambda self: 1" # will be detected as a function to update the default values of. However, # only prop3 will not fail because it's on a single line whereas the others # will fail to parse. # fmt: off prop...
MultiLine
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1409970, "end": 1410367 }
class ____(sgqlc.types.Type, Node, AuditEntry, OrganizationAuditEntryData, RepositoryAuditEntryData): """Audit log entry for a repo.remove_member event.""" __schema__ = github_schema __field_names__ = ("visibility",) visibility = sgqlc.types.Field(RepoRemoveMemberAuditEntryVisibility, graphql_name="vis...
RepoRemoveMemberAuditEntry
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/proto/decode_proto_op_test_base.py
{ "start": 1196, "end": 14405 }
class ____(test_base.ProtoOpTestBase, parameterized.TestCase): """Base class for testing proto decoding ops.""" def __init__(self, decode_module, methodName='runTest'): # pylint: disable=invalid-name """DecodeProtoOpTestBase initializer. Args: decode_module: a module containing the `decode_proto_op...
DecodeProtoOpTestBase
python
sympy__sympy
sympy/functions/elementary/complexes.py
{ "start": 21703, "end": 25365 }
class ____(DefinedFunction): r""" Returns the argument (in radians) of a complex number. The argument is evaluated in consistent convention with ``atan2`` where the branch-cut is taken along the negative real axis and ``arg(z)`` is in the interval $(-\pi,\pi]$. For a positive number, the argument is...
arg
python
explosion__spaCy
spacy/errors.py
{ "start": 67510, "end": 68134 }
class ____(ValueError): def __init__(self, key, errors): """Custom error for validating match patterns. key (str): The name of the matcher rule. errors (dict): Validation errors (sequence of strings) mapped to pattern ID, i.e. the index of the added pattern. """ ...
MatchPatternError
python
tensorflow__tensorflow
tensorflow/python/ops/image_grad_d9m_test.py
{ "start": 7632, "end": 10239 }
class ____(test.TestCase): """Test d9m-unimplemented exceptions from CropAndResizeBackprop{Image|Boxes}. Test that tf.errors.UnimplementedError is thrown or not thrown, as appropriate, by the GPU code-paths for CropAndResizeBackprop{Image|Boxes} when deterministic ops are enabled. This test assumes that tes...
CropAndResizeOpDeterminismExceptionsTest
python
numba__numba
numba/cuda/cudadrv/driver.py
{ "start": 81662, "end": 82570 }
class ____(metaclass=ABCMeta): griddim = 1, 1, 1 blockdim = 1, 1, 1 stream = 0 sharedmem = 0 def __init__(self, module, handle, name): self.module = module self.handle = handle self.name = name self.attrs = self.read_func_attr_all() def __repr__(self): r...
Function
python
pytorch__pytorch
torch/_inductor/runtime/caching/interfaces.py
{ "start": 5291, "end": 11302 }
class ____(ABC): def __init__(self) -> None: self._lock: Lock = Lock() def _make_key( self, fn: Callable[P, R], params: Params, ischema: context.IsolationSchema | None = None, custom_params_encoder: Callable[P, Any] | None = None, ) -> Any: callee: st...
_CacheIntf
python
huggingface__transformers
tests/models/phi4_multimodal/test_image_processing_phi4_multimodal.py
{ "start": 1200, "end": 3939 }
class ____: def __init__( self, parent, batch_size=7, num_channels=3, image_size=100, min_resolution=30, max_resolution=400, dynamic_hd=36, do_resize=True, size=None, patch_size=14, do_normalize=True, image_mean=...
Phi4MultimodalImageProcessingTester
python
PyCQA__pylint
tests/regrtest_data/func_block_disable_msg.py
{ "start": 109, "end": 2593 }
class ____: """block-disable test""" def __init__(self): self._test = "42" def meth1(self, arg): """this issues a message""" print(self) def meth2(self, arg): """and this one not""" # pylint: disable=W0613 print(self._test\ + "foo") d...
Foo
python
rapidsai__cudf
python/cudf/cudf_pandas_tests/test_array_function.py
{ "start": 638, "end": 735 }
class ____: def __array_function__(self, func, types, args, kwargs): return "fast"
Fast
python
neetcode-gh__leetcode
python/1472-design-browser-history.py
{ "start": 29, "end": 170 }
class ____: def __init__(self, val, prev=None, next=None): self.val = val self.prev = prev self.next = next
ListNode
python
kamyu104__LeetCode-Solutions
Python/binary-tree-preorder-traversal.py
{ "start": 182, "end": 957 }
class ____(object): def preorderTraversal(self, root): """ :type root: TreeNode :rtype: List[int] """ result, curr = [], root while curr: if curr.left is None: result.append(curr.val) curr = curr.right else: ...
Solution
python
walkccc__LeetCode
solutions/1422. Maximum Score After Splitting a String/1422.py
{ "start": 0, "end": 258 }
class ____: def maxScore(self, s: str) -> int: ans = 0 zeros = 0 ones = s.count('1') for i in range(len(s) - 1): if s[i] == '0': zeros += 1 else: ones -= 1 ans = max(ans, zeros + ones) return ans
Solution
python
google__pytype
pytype/abstract/abstract_test.py
{ "start": 28345, "end": 42317 }
class ____(AbstractTestBase): def _make_func( self, name="_", param_names=None, posonly_count=0, varargs_name=None, kwonly_params=(), kwargs_name=None, defaults=(), annotations=None, ): return abstract.SimpleFunction.build( name, param_names...
SimpleFunctionTest
python
langchain-ai__langchain
libs/core/langchain_core/messages/tool.py
{ "start": 792, "end": 5772 }
class ____(BaseMessage, ToolOutputMixin): """Message for passing the result of executing a tool back to a model. `ToolMessage` objects contain the result of a tool invocation. Typically, the result is encoded inside the `content` field. Example: A `ToolMessage` representing a result of `42` from a too...
ToolMessage
python
tensorflow__tensorflow
tensorflow/examples/custom_ops_doc/multiplex_3/multiplex_3_test.py
{ "start": 1109, "end": 8209 }
class ____(tf.test.TestCase): @test_util.run_in_graph_and_eager_modes def test_sparse_kernel(self): idx0 = tf.constant([], dtype=tf.int64, shape=[0, 1]) val0 = tf.constant([], dtype=tf.int64) val5a = tf.constant([1, 2, 3, 4, 5], dtype=tf.int64) idx5b = tf.constant([[10], [20], [30], [40], [50]], dt...
MultiplexOpRank1Test
python
numba__numba
numba/misc/gdb_print_extension.py
{ "start": 5379, "end": 5550 }
class ____: def __init__(self, val): self.val = val def to_string(self): return "%s+%sj" % (self.val['real'], self.val['imag'])
NumbaComplexPrinter
python
django-extensions__django-extensions
tests/management/commands/test_show_urls.py
{ "start": 363, "end": 628 }
class ____(View): pass urlpatterns = [ path("lambda/view", lambda request: HttpResponse("OK")), path("function/based/", function_based_view, name="function-based-view"), path("class/based/", ClassView.as_view(), name="class-based-view"), ]
ClassView
python
pyca__cryptography
src/cryptography/hazmat/primitives/ciphers/modes.py
{ "start": 1739, "end": 2627 }
class ____(ModeWithTweak): name = "XTS" def __init__(self, tweak: utils.Buffer): utils._check_byteslike("tweak", tweak) if len(tweak) != 16: raise ValueError("tweak must be 128-bits (16 bytes)") self._tweak = tweak @property def tweak(self) -> utils.Buffer: ...
XTS
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typeNarrowingIsinstance20.py
{ "start": 300, "end": 446 }
class ____(Generic[T]): ... def func1(obj: object): if isinstance(obj, ClassA): reveal_type(obj, expected_text="ClassA[Unknown]")
ClassA
python
nedbat__coveragepy
tests/test_html.py
{ "start": 5172, "end": 6370 }
class ____(HTMLParser): """An HTML parser for our HTML reports. Assertions are made about the structure we expect. """ def __init__(self) -> None: super().__init__() self.lines: list[list[str]] = [] self.in_source = False def handle_starttag(self, tag: str, attrs: list[tup...
HtmlReportParser
python
getsentry__sentry
src/sentry/backup/services/import_export/service.py
{ "start": 757, "end": 5113 }
class ____(RpcService): """ A service for bulk importing and exporting models to and from JSON. All import/export operations must be triggered from either a REGION or MONOLITH silo, but never from the CONTROL silo. Unlike most other RPC services, the `..._by_model` methods in this service select their ...
ImportExportService
python
pytorch__pytorch
test/dynamo/test_modules.py
{ "start": 11375, "end": 11742 }
class ____(torch.nn.Module): def __init__(self) -> None: super().__init__() self.l1 = torch.nn.Linear(10, 10) self.l2 = torch.nn.ReLU() self.l3 = torch.nn.Linear(10, 10) self.l4 = torch.nn.ReLU() def forward(self, x): for _, block in self.named_children(): ...
NamedChildren
python
viewflow__viewflow
viewflow/workflow/flow/nodes.py
{ "start": 7839, "end": 8054 }
class ____(mixins.NodeDetailMixin, mixins.NodeCancelMixin, nodes.Obsolete): index_view_class = views.IndexTaskView detail_view_class = views.DetailTaskView cancel_view_class = views.CancelTaskView
Obsolete
python
kamyu104__LeetCode-Solutions
Python/longest-square-streak-in-an-array.py
{ "start": 648, "end": 1123 }
class ____(object): def longestSquareStreak(self, nums): """ :type nums: List[int] :rtype: int """ dp = collections.defaultdict(int) nums.sort() result = -1 for x in nums: sqrt_x = int(x**0.5) if sqrt_x**2 == x: ...
Solution2
python
getsentry__sentry
src/sentry/hybridcloud/models/outbox.py
{ "start": 17152, "end": 17862 }
class ____(RegionOutboxBase): class Meta: app_label = "sentry" db_table = "sentry_regionoutbox" indexes = ( models.Index( fields=( "shard_scope", "shard_identifier", "category", "objec...
RegionOutbox
python
astropy__astropy
astropy/visualization/stretch.py
{ "start": 24406, "end": 25347 }
class ____(BaseStretch): """ Inverse transformation for `~astropy.visualization.HistEqStretch`. Parameters ---------- data : array-like The data defining the equalization. values : array-like, optional The input image values, which should already be normalized to the [0:...
InvertedHistEqStretch
python
django__django
tests/admin_views/admin.py
{ "start": 20823, "end": 20901 }
class ____(admin.ModelAdmin): autocomplete_fields = ["question"]
AnswerAdmin
python
bokeh__bokeh
src/bokeh/models/widgets/buttons.py
{ "start": 4461, "end": 5328 }
class ____(AbstractButton): ''' A two-state toggle button. ''' # explicit __init__ to support Init signatures def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) label = Override(default="Toggle") active = Bool(False, help=""" The state of the...
Toggle
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/py_extension2/package.py
{ "start": 232, "end": 877 }
class ____(PythonPackage): """A package which extends python. It also depends on another package which extends the same package.""" homepage = "http://www.example.com" url = "http://www.example.com/extension2-1.0.tar.gz" # Override settings in base class maintainers = [] extends("python")...
PyExtension2
python
spyder-ide__spyder
spyder/api/preferences.py
{ "start": 553, "end": 1961 }
class ____(BaseConfigTab): """ Widget that represents a tab on a preference page. All calls to :class:`SpyderConfigPage` attributes are resolved via delegation. """ # Name of the tab to display on the configuration page. TITLE = None def __init__(self, parent: SpyderConfigPage): ...
SpyderPreferencesTab
python
django__django
django/contrib/postgres/forms/ranges.py
{ "start": 761, "end": 959 }
class ____(RangeWidget): """A widget that splits input into two <input type="hidden"> inputs.""" def __init__(self, attrs=None): super().__init__(HiddenInput, attrs)
HiddenRangeWidget
python
huggingface__transformers
src/transformers/models/internvl/modeling_internvl.py
{ "start": 17514, "end": 19105 }
class ____(InternVLVisionPreTrainedModel): def __init__(self, config: InternVLVisionConfig) -> None: super().__init__(config) self.config = config self.embeddings = InternVLVisionEmbeddings(config) self.encoder = InternVLVisionEncoder(config) self.layernorm = ( ...
InternVLVisionModel
python
getsentry__sentry
src/sentry/api/endpoints/index.py
{ "start": 320, "end": 906 }
class ____(Endpoint): publish_status = { "GET": ApiPublishStatus.PRIVATE, } permission_classes = () def get(self, request: Request) -> Response: if request.user.is_authenticated: user = User.objects.get(id=request.user.id) user = serialize(user, user) els...
IndexEndpoint
python
euske__pdfminer
pdfminer/pdfparser.py
{ "start": 463, "end": 3981 }
class ____(PSStackParser): """ PDFParser fetch PDF objects from a file stream. It can handle indirect references by referring to a PDF document set by set_document method. It also reads XRefs at the end of every PDF file. Typical usage: parser = PDFParser(fp) parser.read_xref() ...
PDFParser
python
django__django
tests/foreign_object/models/person.py
{ "start": 2081, "end": 3122 }
class ____(models.Model): # Table Column Fields from_friend_country = models.ForeignKey( Country, models.CASCADE, related_name="from_friend_country" ) from_friend_id = models.IntegerField() to_friend_country_id = models.IntegerField() to_friend_id = models.IntegerField(null=True) # ...
Friendship
python
celery__celery
t/unit/utils/test_saferepr.py
{ "start": 2135, "end": 2165 }
class ____(dict): pass
dict2
python
pytorch__pytorch
torch/nn/utils/_expanded_weights/conv_expanded_weights.py
{ "start": 572, "end": 2925 }
class ____(torch.autograd.Function): @staticmethod # pyrefly: ignore [bad-override] def forward( ctx: Any, kwarg_names: list[str], conv_fn: Callable[_P, _R], *expanded_args_and_kwargs: Any, ) -> torch.Tensor: expanded_args, expanded_kwargs = conv_args_and_kwargs( ...
ConvPerSampleGrad
python
gevent__gevent
src/greentest/3.12/test_interpreters.py
{ "start": 4011, "end": 4591 }
class ____(TestBase): def test_main(self): main = interpreters.get_main() current = interpreters.get_current() self.assertEqual(current, main) def test_subinterpreter(self): main = _interpreters.get_main() interp = interpreters.create() out = _run_output(interp,...
GetCurrentTests
python
scipy__scipy
scipy/stats/tests/test_continuous.py
{ "start": 61674, "end": 78833 }
class ____: def test_ContinuousDistribution_only(self): X = stats.Binomial(n=10, p=0.5) # This is applied at the top level TransformedDistribution, # so testing one subclass is enough message = "Transformations are currently only supported for continuous RVs." with pytest.ra...
TestTransforms
python
getsentry__sentry
src/sentry/buffer/redis.py
{ "start": 2726, "end": 4798 }
class ____: def __init__(self, incr_batch_size: int) -> None: self.incr_batch_size = incr_batch_size self.default_pending_buffer = PendingBuffer(self.incr_batch_size) # map of model_key to PendingBufferValue self.pending_buffer_router: dict[str, PendingBufferValue] = dict() def ...
PendingBufferRouter