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
tensorflow__tensorflow
tensorflow/python/kernel_tests/strings_ops/unicode_transcode_op_test.py
{ "start": 1214, "end": 16861 }
class ____(test.TestCase, parameterized.TestCase): def test_transcode_utf8_simple(self): strings = [[b"a", b"abc"], [b"ABC", b"DEF"]] with self.cached_session() as sess: outputs = string_ops.unicode_transcode( strings, input_encoding="UTF-8", output_encoding="UTF-8", ...
UnicodeTranscodeOpTest
python
huggingface__transformers
src/transformers/models/edgetam/modular_edgetam.py
{ "start": 6165, "end": 6235 }
class ____(Sam2VisionEncoderOutput): pass
EdgeTamVisionEncoderOutput
python
pypa__pipenv
pipenv/patched/pip/_internal/exceptions.py
{ "start": 13258, "end": 13934 }
class ____(InstallationError): """Multiple HashError instances rolled into one for reporting""" def __init__(self) -> None: self.errors: List[HashError] = [] def append(self, error: "HashError") -> None: self.errors.append(error) def __str__(self) -> str: lines = [] se...
HashErrors
python
airbytehq__airbyte
airbyte-integrations/connectors/source-firebase-realtime-database/source_firebase_realtime_database/firebase_rtdb.py
{ "start": 142, "end": 1228 }
class ____: def __init__(self, path="", buffer_size=10000): self._path = path self._buffer_size = buffer_size def initialize(self, database_name, google_application_credentials): database_url = f"https://{database_name}.firebaseio.com" sa_key = json.loads(google_application_cred...
Client
python
plotly__plotly.py
plotly/graph_objs/densitymap/colorbar/_title.py
{ "start": 233, "end": 3992 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "densitymap.colorbar" _path_str = "densitymap.colorbar.title" _valid_props = {"font", "side", "text"} @property def font(self): """ Sets this color bar's title font. The 'font' property is an instance of Font t...
Title
python
dask__dask
dask/dataframe/tseries/resample.py
{ "start": 6212, "end": 6270 }
class ____(ResampleReduction): how = "last"
ResampleLast
python
django__django
tests/m2m_through_regress/models.py
{ "start": 2296, "end": 2393 }
class ____(Competitor): person = models.ForeignKey(Person, models.CASCADE)
IndividualCompetitor
python
django__django
tests/model_fields/models.py
{ "start": 20067, "end": 20497 }
class ____(GeneratedModelVirtualBase): class Meta: required_db_features = { "supports_virtual_generated_columns", "supports_table_check_constraints", } constraints = [ models.CheckConstraint( condition=models.Q(a__gt=0), nam...
GeneratedModelCheckConstraintVirtual
python
scipy__scipy
benchmarks/benchmarks/go_benchmark_functions/go_funcs_univariate.py
{ "start": 14052, "end": 14940 }
class ____(Benchmark): """ Univariate Problem20 objective function. This class defines the Univariate Problem20 global optimization problem. This is a multimodal minimization problem defined as follows: .. math:: f_{\\text{Problem20}}(x) = -[x-\\sin(x)]e^{-x^2} Bound constraints: :ma...
Problem20
python
PrefectHQ__prefect
tests/server/models/test_flow_run_states.py
{ "start": 10562, "end": 11382 }
class ____: async def test_read_flow_run_state(self, flow_run, session): # create a flow run to read flow_run_state = ( await models.flow_runs.set_flow_run_state( session=session, flow_run_id=flow_run.id, state=Running(), ) ...
TestReadFlowRunState
python
geekcomputers__Python
venv/Lib/site-packages/pip/_vendor/truststore/_windows.py
{ "start": 3999, "end": 17891 }
class ____(Structure): _fields_ = ( ("cbSize", DWORD), ("hRestrictedRoot", HCERTSTORE), ("hRestrictedTrust", HCERTSTORE), ("hRestrictedOther", HCERTSTORE), ("cAdditionalStore", DWORD), ("rghAdditionalStore", c_void_p), ("dwFlags", DWORD), ("dwUrlRetrie...
CERT_CHAIN_ENGINE_CONFIG
python
facebook__pyre-check
client/commands/servers.py
{ "start": 1092, "end": 3682 }
class ____: pid: int version: str global_root: str flavor: str relative_local_root: Optional[str] = None @staticmethod def from_json( input_json: Dict[str, object], flavor: identifiers.PyreFlavor ) -> "RunningServerStatus": pid = input_json.get("pid", None) if no...
RunningServerStatus
python
chroma-core__chroma
chromadb/utils/read_write_lock.py
{ "start": 1239, "end": 1624 }
class ____: def __init__(self, rwLock: ReadWriteLock): self.rwLock = rwLock def __enter__(self) -> None: self.rwLock.acquire_read() def __exit__( self, exc_type: Optional[Type[BaseException]], exc_value: Optional[BaseException], traceback: Optional[Traceback...
ReadRWLock
python
django-haystack__django-haystack
test_haystack/spatial/test_spatial.py
{ "start": 366, "end": 3602 }
class ____(TestCase): def test_ensure_geometry(self): from django.contrib.gis.geos import GEOSGeometry, Point self.assertRaises( SpatialError, ensure_geometry, [38.97127105172941, -95.23592948913574] ) ensure_geometry(GEOSGeometry("POLYGON((-95 38, -96 40, -97 42, -95 38...
SpatialUtilitiesTestCase
python
run-llama__llama_index
llama-index-integrations/vector_stores/llama-index-vector-stores-lantern/llama_index/vector_stores/lantern/base.py
{ "start": 673, "end": 3675 }
class ____(NamedTuple): node_id: str # FIXME: verify this type hint text: str metadata: dict similarity: float _logger = logging.getLogger(__name__) def get_data_model( base: Type, index_name: str, schema_name: str, hybrid_search: bool, text_search_config: str, cache_okay: b...
DBEmbeddingRow
python
pyqtgraph__pyqtgraph
pyqtgraph/parametertree/parameterTypes/action.py
{ "start": 121, "end": 1768 }
class ____(QtWidgets.QPushButton): settableAttributes = { "title", "tip", "icon", "shortcut", "enabled", "visible" } def __init__(self, parameter=None, parent=None): super().__init__(parent) if not parameter: return parameter.sigNameChanged.connect(self.onNameCha...
ParameterControlledButton
python
pytorch__pytorch
torchgen/api/translate.py
{ "start": 2562, "end": 19297 }
class ____(RuntimeError): pass # Given a set of in-scope bindings and a set of target bindings, synthesize # a list of expressions that uses only the in-scope bindings (bindings) that # have all of the types of goals. You may want to use this function if # you're generating code for a function like: # # void f...
UnsatError
python
run-llama__llama_index
llama-index-integrations/readers/llama-index-readers-github/llama_index/readers/github/repository/github_client.py
{ "start": 2238, "end": 2902 }
class ____(DataClassJsonMixin): """ Dataclass for the response from the Github API's getCommit endpoint. Attributes: - tree (Tree): Tree object for the commit. """ @dataclass class Commit(DataClassJsonMixin): """Dataclass for the commit object in the commit. (commit.commit).""...
GitCommitResponseModel
python
PyCQA__pylint
tests/pyreverse/functional/class_diagrams/relationships/comprehensions.py
{ "start": 1190, "end": 1755 }
class ____: """Comprehensions creating new objects - composition.""" def __init__(self): # Composition: comprehensions creating new objects self.components: list[Component] = [Component(f"component_{i}") for i in range(3)] self.component_dict: dict[int, Component] = {i: Component(f"dict_...
CompositionContainer
python
h5py__h5py
h5py/_hl/vds.py
{ "start": 578, "end": 2115 }
class ____(namedtuple('VDSmap', ('vspace', 'file_name', 'dset_name', 'src_space'))): '''Defines a region in a virtual dataset mapping to part of a source dataset ''' vds_support = True def _convert_space_for_key(space, key): """ Converts the space with the given ke...
VDSmap
python
kamyu104__LeetCode-Solutions
Python/sum-of-two-integers.py
{ "start": 29, "end": 2025 }
class ____(object): def getSum(self, a, b): """ :type a: int :type b: int :rtype: int """ bit_length = 32 neg_bit, mask = (1 << bit_length) >> 1, ~(~0 << bit_length) a = (a | ~mask) if (a & neg_bit) else (a & mask) b = (b | ~mask) if (b & neg_...
Solution
python
huggingface__transformers
tests/models/blt/test_modeling_blt.py
{ "start": 6375, "end": 8812 }
class ____(CausalLMModelTest, unittest.TestCase): model_tester_class = BltModelTester # Need to use `0.8` instead of `0.9` for `test_cpu_offload` # This is because we are hitting edge cases with the causal_mask buffer model_split_percents = [0.5, 0.7, 0.8] # used in `test_torch_compile_for_trainin...
BltModelTest
python
sqlalchemy__sqlalchemy
test/sql/test_select.py
{ "start": 17885, "end": 20554 }
class ____(fixtures.TestBase, AssertsCompiledSQL): """tests related to #8285.""" __dialect__ = "default" def test_c_collection_as_from(self): stmt = select(parent.c) # this works because _all_selected_columns expands out # ClauseList. it does so in the same way that it works for ...
ColumnCollectionAsSelectTest
python
getsentry__sentry
tests/sentry/middleware/test_health.py
{ "start": 274, "end": 1926 }
class ____(TestCase): middleware = cached_property(HealthCheck) @cached_property def factory(self): return RequestFactory() @patch("sentry.status_checks.check_all") def test_other_url(self, check_all: MagicMock) -> None: req = self.factory.get("/") resp = self.middleware.pr...
HealthCheckTest
python
fastai__fastai
fastai/layers.py
{ "start": 19326, "end": 22171 }
class ____(Module): "Resnet block from `ni` to `nh` with `stride`" @delegates(ConvLayer.__init__) def __init__(self, expansion, ni, nf, stride=1, groups=1, reduction=None, nh1=None, nh2=None, dw=False, g2=1, sa=False, sym=False, norm_type=NormType.Batch, act_cls=defaults.activation, ndim=2,...
ResBlock
python
pytorch__pytorch
torch/_inductor/select_algorithm.py
{ "start": 59950, "end": 60046 }
class ____(NamedTuple): code: str extra: str events: list[Any]
GeneratedCodeCacheEntry
python
huggingface__transformers
src/transformers/models/glm4v/modular_glm4v.py
{ "start": 30834, "end": 32982 }
class ____(GradientCheckpointingLayer): def __init__(self, config: Glm4vTextConfig, layer_idx: int): super().__init__() self.hidden_size = config.hidden_size self.self_attn = Glm4vTextAttention(config, layer_idx) self.mlp = Glm4vTextMLP(config) self.input_layernorm = Glm4vRMS...
Glm4vTextDecoderLayer
python
pandas-dev__pandas
asv_bench/benchmarks/frame_methods.py
{ "start": 17852, "end": 18541 }
class ____: def setup(self): n = 1 << 20 t = date_range("2015-01-01", freq="s", periods=(n // 64)) xs = np.random.randn(n // 64).round(2) self.df = DataFrame( { "a": np.random.randint(-1 << 8, 1 << 8, n), "b": np.random.choice(t, n), ...
Duplicated
python
pyinstaller__pyinstaller
bootloader/waflib/Tools/qt5.py
{ "start": 8050, "end": 20211 }
class ____(Task.Task): color = 'BLUE' after = 'ts2qm' def run(self): txt = '\n'.join(['<file>%s</file>' % k.path_from(self.outputs[0].parent) for k in self.inputs]) code = '<!DOCTYPE RCC><RCC version="1.0">\n<qresource>\n%s\n</qresource>\n</RCC>' % txt self.outputs[0].write(code) ...
qm2rcc
python
airbytehq__airbyte
airbyte-ci/connectors/metadata_service/lib/metadata_service/models/generated/ConnectorBreakingChanges.py
{ "start": 587, "end": 785 }
class ____(BaseModel): __root__: StreamBreakingChangeScope = Field( ..., description="A scope that can be used to limit the impact of a breaking change.", )
BreakingChangeScope
python
urllib3__urllib3
test/with_dummyserver/test_https.py
{ "start": 46672, "end": 46819 }
class ____(BaseTestHTTPS): tls_protocol_name = "TLSv1.2" certs = TLSv1_2_CERTS @pytest.mark.usefixtures("requires_tlsv1_3")
TestHTTPS_TLSv1_2
python
readthedocs__readthedocs.org
readthedocs/notifications/messages.py
{ "start": 18727, "end": 19939 }
class ____: def __init__(self): self.messages = {} def add(self, messages): if not isinstance(messages, list): if not isinstance(messages, Message): raise ValueError("A message should be instance of Message or a list of Messages.") messages = [messages] ...
MessagesRegistry
python
huggingface__transformers
tests/models/bamba/test_modeling_bamba.py
{ "start": 21837, "end": 27861 }
class ____(unittest.TestCase): model = None tokenizer = None # This variable is used to determine which CUDA device are we using for our runners (A10 or T4) # Depending on the hardware we get different logits / generations device_properties: DeviceProperties = (None, None, None) @classmethod ...
BambaModelIntegrationTest
python
huggingface__transformers
src/transformers/models/maskformer/modeling_maskformer.py
{ "start": 6082, "end": 9445 }
class ____(ModelOutput): r""" encoder_last_hidden_state (`torch.FloatTensor` of shape `(batch_size, num_channels, height, width)`): Last hidden states (final feature map) of the last stage of the encoder model (backbone). pixel_decoder_last_hidden_state (`torch.FloatTensor` of shape `(batch_size, nu...
MaskFormerModelOutput
python
django__django
django/contrib/gis/db/models/sql/conversion.py
{ "start": 1366, "end": 2433 }
class ____(models.FloatField): "Wrapper for Distance values." def __init__(self, geo_field): super().__init__() self.geo_field = geo_field def get_prep_value(self, value): if isinstance(value, Distance): return value return super().get_prep_value(value) def...
DistanceField
python
great-expectations__great_expectations
great_expectations/expectations/core/expect_column_values_to_match_regex_list.py
{ "start": 2425, "end": 16389 }
class ____(ColumnMapExpectation): __doc__ = f"""{EXPECTATION_SHORT_DESCRIPTION} Matches can be anywhere in the string. ExpectColumnValuesToMatchRegexList is a \ Column Map Expectation. Column Map Expectations are one of the most common types of Expectation. They are evaluated for a single col...
ExpectColumnValuesToMatchRegexList
python
apache__airflow
providers/ftp/tests/unit/ftp/hooks/test_ftp.py
{ "start": 4722, "end": 8409 }
class ____: @pytest.fixture(autouse=True) def setup_connections(self, create_connection_without_db): from airflow.models import Connection create_connection_without_db( Connection(conn_id="ftp_passive", conn_type="ftp", host="localhost", extra='{"passive": true}') ) ...
TestIntegrationFTPHook
python
great-expectations__great_expectations
tests/core/test_expectation_suite.py
{ "start": 31407, "end": 34070 }
class ____: @pytest.mark.unit def test_equality_to_unsupported_class_is_false( self, suite_with_single_expectation: ExpectationSuite ): """If we are not comparing to an ExpectationSuite or dict then we should return False.""" class UnsupportedClass: pass return_...
TestEqDunder
python
wandb__wandb
wandb/vendor/pygments/lexers/markup.py
{ "start": 3381, "end": 10588 }
class ____(RegexLexer): """ For `reStructuredText <http://docutils.sf.net/rst.html>`_ markup. .. versionadded:: 0.7 Additional options accepted: `handlecodeblocks` Highlight the contents of ``.. sourcecode:: language``, ``.. code:: language`` and ``.. code-block:: language`` ...
RstLexer
python
pypa__pipenv
pipenv/patched/pip/_internal/metadata/base.py
{ "start": 1341, "end": 2691 }
class ____(Protocol): @property def name(self) -> str: raise NotImplementedError() @property def value(self) -> str: raise NotImplementedError() @property def group(self) -> str: raise NotImplementedError() def _convert_installed_files_path( entry: Tuple[str, ...]...
BaseEntryPoint
python
allegroai__clearml
clearml/backend_api/services/v2_9/tasks.py
{ "start": 140439, "end": 160937 }
class ____(Request): """ Edit task's details. :param task: ID of the task :type task: str :param force: If not true, call fails if the task status is not 'created' :type force: bool :param name: Task name Unique within the company. :type name: str :param tags: User-defined tags list...
EditRequest
python
huggingface__transformers
src/transformers/models/idefics3/modeling_idefics3.py
{ "start": 16784, "end": 17799 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.scale_factor = config.scale_factor self.modality_projection = Idefics3SimpleMLP(config) def pixel_shuffle(self, x, scale_factor=2): bsz, seq, embed_dim = x.size() height = width = int(seq**0.5) ...
Idefics3Connector
python
weaviate__weaviate-python-client
weaviate/collections/aggregate.py
{ "start": 499, "end": 668 }
class ____( _HybridAsync, _NearImageAsync, _NearObjectAsync, _NearTextAsync, _NearVectorAsync, _OverAllAsync, ): pass
_AggregateCollectionAsync
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/backfill.py
{ "start": 2965, "end": 3187 }
class ____(graphene.ObjectType): backfill_id = graphene.NonNull(graphene.String) launched_run_ids = graphene.List(graphene.String) class Meta: name = "LaunchBackfillSuccess"
GrapheneLaunchBackfillSuccess
python
kamyu104__LeetCode-Solutions
Python/remove-all-adjacent-duplicates-in-string.py
{ "start": 29, "end": 347 }
class ____(object): def removeDuplicates(self, S): """ :type S: str :rtype: str """ result = [] for c in S: if result and result[-1] == c: result.pop() else: result.append(c) return "".join(result)
Solution
python
kubernetes-client__python
kubernetes/client/models/v1alpha1_mutation.py
{ "start": 383, "end": 5570 }
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...
V1alpha1Mutation
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/partitions/snap/snap.py
{ "start": 1102, "end": 2451 }
class ____(ABC): @classmethod def from_def(cls, partitions_def: "PartitionsDefinition") -> "PartitionsSnap": from dagster._core.definitions.partitions.definition import ( DynamicPartitionsDefinition, MultiPartitionsDefinition, StaticPartitionsDefinition, T...
PartitionsSnap
python
django__django
tests/admin_views/admin.py
{ "start": 26078, "end": 26203 }
class ____(admin.ModelAdmin): list_display = ["choice"] readonly_fields = ["choice"] fields = ["choice"]
ChoiceList
python
prabhupant__python-ds
data_structures/graphs/two_cliques.py
{ "start": 667, "end": 2008 }
class ____: def __init__(self, vertices): self.graph = defaultdict(list) self.cgraph = defaultdict(list) self.vertices = vertices def add_edge(self, u, v): self.graph[u].append(v) self.graph[v].append(u) def is_bipartite(self): colors = [-1] * self.v...
Graph
python
kubernetes-client__python
kubernetes/client/models/v1_device_class_list.py
{ "start": 383, "end": 6934 }
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...
V1DeviceClassList
python
walkccc__LeetCode
solutions/1088. Confusing Number II/1088.py
{ "start": 0, "end": 536 }
class ____: def confusingNumberII(self, n: int) -> int: digitToRotated = [(0, 0), (1, 1), (6, 9), (8, 8), (9, 6)] def dfs(num: int, rotatedNum: int, unit: int) -> int: ans = 0 if num == rotatedNum else 1 # Add one more digit for digit, rotated in digitToRotated: if digit == 0 and nu...
Solution
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/mysql/enumerated.py
{ "start": 4044, "end": 10146 }
class ____(_StringType): """MySQL SET type.""" __visit_name__ = "SET" def __init__(self, *values: str, **kw: Any): """Construct a SET. E.g.:: Column("myset", SET("foo", "bar", "baz")) The list of potential values is required in the case that this set will be us...
SET
python
sanic-org__sanic
sanic/errorpages.py
{ "start": 1245, "end": 4326 }
class ____: """Base class that all renderers must inherit from. This class defines the structure for rendering objects, handling the core functionality that specific renderers may extend. Attributes: request (Request): The incoming request object that needs rendering. exception (Exception)...
BaseRenderer
python
google__jax
jax/_src/path.py
{ "start": 730, "end": 2162 }
class ____(Protocol): """A factory that creates a PurePath.""" def __call__(self, *pathsegments: str | os.PathLike) -> pathlib.Path: ... Path: PathProtocol # If etils.epath (aka etils[epath] to pip) is present, we prefer it because it # can read and write to, e.g., GCS buckets. Otherwise we use the builtin # ...
PathProtocol
python
numpy__numpy
numpy/_typing/_nbit_base.py
{ "start": 228, "end": 2288 }
class ____: """ A type representing `numpy.number` precision during static type checking. Used exclusively for the purpose of static type checking, `NBitBase` represents the base of a hierarchical set of subclasses. Each subsequent subclass is herein used for representing a lower level of preci...
NBitBase
python
pydata__xarray
xarray/tests/test_ufuncs.py
{ "start": 6524, "end": 9472 }
class ____: @pytest.fixture(autouse=True) def setUp(self): self.x = xr.DataArray([1, 2, 3]) self.xd = xr.DataArray(DuckArray([1, 2, 3])) self.xd2 = xr.DataArray(DuckArray2([1, 2, 3])) self.xt = xr.DataArray(np.datetime64("2021-01-01", "ns")) @pytest.mark.filterwarnings("igno...
TestXarrayUfuncs
python
vyperlang__vyper
tests/evm_backends/base_env.py
{ "start": 863, "end": 938 }
class ____(Exception): """Exception raised when a call fails."""
EvmError
python
huggingface__transformers
tests/models/qwen2_moe/test_modeling_qwen2_moe.py
{ "start": 1338, "end": 4238 }
class ____(CausalLMModelTest, unittest.TestCase): test_all_params_have_gradient = False model_tester_class = Qwen2MoeModelTester # TODO (ydshieh): Check this. See https://app.circleci.com/pipelines/github/huggingface/transformers/79245/workflows/9490ef58-79c2-410d-8f51-e3495156cf9c/jobs/1012146 def is_...
Qwen2MoeModelTest
python
scipy__scipy
scipy/sparse/linalg/_eigen/arpack/tests/test_arpack.py
{ "start": 8756, "end": 11014 }
class ____: def __init__(self): self.eigs = eigsh self.which = ['LM', 'SM', 'LA', 'SA', 'BE'] self.mattypes = [csr_array, aslinearoperator, np.asarray] self.sigmas_modes = {None: ['normal'], 0.5: ['normal', 'buckling', 'cayley']} # generate matri...
SymmetricParams
python
run-llama__llama_index
llama-index-integrations/storage/docstore/llama-index-storage-docstore-redis/llama_index/storage/docstore/redis/base.py
{ "start": 244, "end": 1608 }
class ____(KVDocumentStore): """ Redis Document (Node) store. A Redis store for Document and Node objects. Args: redis_kvstore (RedisKVStore): Redis key-value store namespace (str): namespace for the docstore """ def __init__( self, redis_kvstore: RedisKVStore...
RedisDocumentStore
python
giampaolo__psutil
tests/test_connections.py
{ "start": 20510, "end": 21136 }
class ____(PsutilTestCase): def test_net_connection_constants(self): ints = [] strs = [] for name in dir(psutil): if name.startswith('CONN_'): num = getattr(psutil, name) str_ = str(num) assert str_.isupper(), str_ a...
TestMisc
python
getsentry__sentry
src/sentry/plugins/bases/releasetracking.py
{ "start": 45, "end": 236 }
class ____(Plugin2): def get_plugin_type(self) -> str: return "release-tracking" def get_release_doc_html(self, hook_url): raise NotImplementedError
ReleaseTrackingPlugin
python
great-expectations__great_expectations
tests/data_context/test_data_context_state_management.py
{ "start": 1082, "end": 1688 }
class ____(ExpectationsStore): def __init__(self) -> None: self.save_count = 0 super().__init__() def add(self, key, value, **kwargs): ret = super().add(key=key, value=value, **kwargs) self.save_count += 1 return ret def update(self, key, value, **kwargs): r...
ExpectationsStoreSpy
python
sqlalchemy__sqlalchemy
test/orm/test_unitofwork.py
{ "start": 17825, "end": 22448 }
class ____(fixtures.MappedTest): __requires__ = ("foreign_keys",) @classmethod def define_tables(cls, metadata): Table( "mytable", metadata, Column( "id", Integer, primary_key=True, test_needs_autoincrement=True ), Column("...
PassiveDeletesTest
python
django__django
tests/i18n/test_extraction.py
{ "start": 46148, "end": 48398 }
class ____(ExtractorTests): work_subdir = "project_dir" def test_no_locale_raises(self): msg = ( "Unable to find a locale path to store translations for file " "__init__.py. Make sure the 'locale' directory exists in an app " "or LOCALE_PATHS setting is set." ...
CustomLayoutExtractionTests
python
jazzband__django-simple-history
simple_history/tests/models.py
{ "start": 6792, "end": 7009 }
class ____(PollParentWithManyToMany): restaurants = models.ManyToManyField( "Restaurant", related_name="restaurants_poll_child" ) _history_m2m_fields = [restaurants]
PollChildRestaurantWithManyToMany
python
pytorch__pytorch
test/dynamo/test_metrics_context.py
{ "start": 153, "end": 4044 }
class ____(TestCase): def setUp(self): super().setUp() self.metrics = {} def _on_exit(self, start_ns, end_ns, metrics, exc_type, exc_value): # Save away the metrics to be validated in the test. self.metrics = metrics.copy() def test_context_exists(self): """ ...
TestMetricsContext
python
Pylons__pyramid
src/pyramid/config/actions.py
{ "start": 10966, "end": 18584 }
class ____: def __init__(self): # keep a set of resolved discriminators to test against to ensure # that a new action does not conflict with something already executed self.resolved_ainfos = {} # actions left over from a previous iteration self.remaining_actions = [] ...
ConflictResolverState
python
tensorflow__tensorflow
tensorflow/python/ops/math_ops_test.py
{ "start": 1859, "end": 6757 }
class ____(test_util.TensorFlowTestCase): def testReduceAllDims(self): x = np.array([[1, 2, 3], [4, 5, 6]], dtype=np.int32) with test_util.device(use_gpu=True): y_tf = self.evaluate(math_ops.reduce_sum(x)) self.assertEqual(y_tf, 21) def testReduceExtendType(self): in_f32 = np.random.randn(...
ReduceTest
python
explosion__spaCy
spacy/lang/ko/__init__.py
{ "start": 3327, "end": 4181 }
class ____(Language): lang = "ko" Defaults = KoreanDefaults def try_mecab_import() -> None: try: from natto import MeCab return MeCab except ImportError: raise ImportError( 'The Korean tokenizer ("spacy.ko.KoreanTokenizer") requires ' "[mecab-ko](https:...
Korean
python
pytorch__pytorch
test/dynamo/test_higher_order_ops.py
{ "start": 114816, "end": 123659 }
class ____( torch._dynamo.test_case.TestCaseWithNestedGraphBreaks, LoggingTestCase ): @make_logging_test(recompiles=True) def test_vmap_grad_guard_ok(self, records): vmap = torch.vmap grad = torch.func.grad def g(x): return vmap(grad(torch.sin))(x) @torch.compil...
HigherOrderOpVmapGuardTests
python
realpython__materials
python-textual/horizontal_scroll.py
{ "start": 129, "end": 513 }
class ____(App): def compose(self): with HorizontalScroll(): for i in range(NUM_BOXES): static = Static(f"Static {i + 1}") static.styles.border = ("solid", "green") static.styles.width = "10%" yield static if __name__ == "__main__...
HorizontalScrollApp
python
getsentry__sentry
tests/apidocs/endpoints/projects/test_service_hook_details.py
{ "start": 136, "end": 1098 }
class ____(APIDocsTestCase): def setUp(self) -> None: hook = self.create_service_hook(project=self.project, events=("event.created",)) self.url = reverse( "sentry-api-0-project-service-hook-details", kwargs={ "organization_id_or_slug": self.organization.slug,...
ProjectServiceHookDetailsDocs
python
wandb__wandb
wandb/vendor/graphql-core-1.1/wandb_graphql/language/ast.py
{ "start": 29957, "end": 31063 }
class ____(TypeDefinition): __slots__ = ('loc', 'name', 'values', 'directives',) _fields = ('name', 'values',) def __init__(self, name, values, loc=None, directives=None): self.loc = loc self.name = name self.values = values self.directives = directives def __eq__(self,...
EnumTypeDefinition
python
mlflow__mlflow
mlflow/types/chat.py
{ "start": 219, "end": 939 }
class ____(BaseModel): """ Represents an image URL. Attributes: url: Either a URL of an image or base64 encoded data. https://platform.openai.com/docs/guides/vision?lang=curl#uploading-base64-encoded-images detail: The level of resolution for the image when the model receives it...
ImageUrl
python
tensorflow__tensorflow
tensorflow/python/saved_model/load_test.py
{ "start": 123547, "end": 124018 }
class ____(module.Module): def __init__(self, rows, cols): super().__init__() self.rows = rows self.cols = cols self.table = None def __call__(self, x): with ops.device("/cpu:0"): self.table = variables.Variable( constant_op.constant(1.0, shape=[self.rows, self.cols]) ) ...
_TestModel
python
networkx__networkx
benchmarks/benchmarks/benchmark_algorithms.py
{ "start": 7060, "end": 7881 }
class ____: """Benchmark for shortest path algorithms on various weighted graphs.""" timeout = 120 _seed = 42 param_names = ["graph"] _graphs = _make_weighted_benchmark_graphs(_seed) params = list(_graphs) def setup(self, graph): f, args, kwargs = self._graphs[graph] self....
WeightedGraphBenchmark
python
numba__numba
numba/tests/test_parallel_backend.py
{ "start": 5593, "end": 8866 }
class ____(TestCase): """ Base class for testing the parallel backends """ all_impls = [ jit_runner(nopython=True), jit_runner(nopython=True, cache=True), jit_runner(nopython=True, nogil=True), linalg_runner(nopython=True), linalg_runner(nopython=True, nogil=True...
TestParallelBackendBase
python
numba__numba
numba/core/typeinfer.py
{ "start": 15480, "end": 16214 }
class ____(object): def __init__(self, target, pair, loc): self.target = target self.pair = pair self.loc = loc def __call__(self, typeinfer): with new_error_context("typing of pair-first at {loc}", loc=self.loc): typevars = typeinfer.t...
PairFirstConstraint
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/isinstance6.py
{ "start": 532, "end": 591 }
class ____(Protocol): def other(self) -> None: ...
Proto2
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 588086, "end": 588503 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("about", "name", "url") about = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="about") name = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="name...
RepositoryContactLink
python
huggingface__transformers
src/transformers/models/hgnet_v2/modular_hgnet_v2.py
{ "start": 21188, "end": 24392 }
class ____(HGNetV2PreTrainedModel): def __init__(self, config: HGNetV2Config): super().__init__(config) self.num_labels = config.num_labels self.embedder = HGNetV2Embeddings(config) self.encoder = HGNetV2Encoder(config) self.avg_pool = nn.AdaptiveAvgPool2d((1, 1)) sel...
HGNetV2ForImageClassification
python
ray-project__ray
release/ray_release/tests/test_cluster_manager.py
{ "start": 30477, "end": 31671 }
class ____(unittest.TestCase): def setUp(self) -> None: self.sdk = get_anyscale_sdk() self.cluster_compute = TEST_CLUSTER_COMPUTE self.cluster_manager = FullClusterManager( project_id=UNIT_TEST_PROJECT_ID, sdk=self.sdk, test_name=f"unit_test__{self.__cla...
LiveSessionManagerTest
python
google__jax
jax/_src/sharding_impls.py
{ "start": 18265, "end": 19169 }
class ____: """A hardware axis context for parallel computations that use the GSPMD partitioner. This includes the mesh that will later by used to execute this computation, as well as a set of mesh axes that are currently lowered in the MANUAL sharding mode. """ mesh: mesh_lib.Mesh manual_axes: frozenset...
SPMDAxisContext
python
automl__auto-sklearn
autosklearn/pipeline/components/data_preprocessing/categorical_encoding/__init__.py
{ "start": 949, "end": 4429 }
class ____(AutoSklearnChoice): @classmethod def get_components(cls: BaseEstimator) -> Dict[str, BaseEstimator]: components: Dict[str, BaseEstimator] = OrderedDict() components.update(_ohes) components.update(additional_components.components) return components def get_hyperpa...
OHEChoice
python
pyinstaller__pyinstaller
PyInstaller/depend/imphook.py
{ "start": 938, "end": 9732 }
class ____(dict): """ Cache of lazily loadable hook script objects. This cache is implemented as a `dict` subclass mapping from the fully-qualified names of all modules with at least one hook script to lists of `ModuleHook` instances encapsulating these scripts. As a `dict` subclass, all cached mod...
ModuleHookCache
python
tornadoweb__tornado
tornado/test/websocket_test.py
{ "start": 26886, "end": 27539 }
class ____(WebSocketBaseTestCase): def get_app(self): class PingHandler(TestWebSocketHandler): def on_pong(self, data): self.write_message("got pong") return Application( [("/", PingHandler)], websocket_ping_interval=0.01, websocket_pi...
ServerPeriodicPingTest
python
doocs__leetcode
solution/2800-2899/2867.Count Valid Paths in a Tree/Solution.py
{ "start": 0, "end": 750 }
class ____: def __init__(self, n): self.p = list(range(n)) self.size = [1] * n def find(self, x): if self.p[x] != x: self.p[x] = self.find(self.p[x]) return self.p[x] def union(self, a, b): pa, pb = self.find(a), self.find(b) if pa == pb: ...
UnionFind
python
scipy__scipy
benchmarks/benchmarks/stats.py
{ "start": 28817, "end": 29185 }
class ____(Benchmark): param_names = ["size", "d"] params = [ [10_000, 100_000, 1_000_000], [1, 100] ] def setup(self, size, d): self.rng = np.random.default_rng(2475928) n = size // d self.x = self.rng.uniform(size=(d, n)) def time_quantile(self, size, d): ...
Quantile
python
readthedocs__readthedocs.org
readthedocs/projects/migrations/0085_subscribe_old_webhooks_to_events.py
{ "start": 698, "end": 918 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("projects", "0084_create_webhook_events"), ] operations = [ migrations.RunPython(forwards_func), ]
Migration
python
sqlalchemy__sqlalchemy
test/ext/test_extendedattr.py
{ "start": 17131, "end": 18598 }
class ____(_ExtBase, fixtures.ORMTest): def test_standard(self): class A: pass register_class(A) eq_(type(manager_of_class(A)), instrumentation.ClassManager) def test_nativeext_interfaceexact(self): class A: __sa_instrumentation_manager__ = ( ...
FinderTest
python
PrefectHQ__prefect
src/prefect/server/database/orm_models.py
{ "start": 52805, "end": 53202 }
class ____(BaseORMConfiguration): """SQLite specific orm configuration""" @property def versions_dir(self) -> Path: """Directory containing migrations""" import prefect.server.database return ( Path(prefect.server.database.__file__).parent / "_migrations" ...
AioSqliteORMConfiguration
python
PyCQA__pylint
tests/functional/r/regression/regression_4680.py
{ "start": 223, "end": 311 }
class ____(metaclass=foo.sob.Metaclass): pass assert foo.sub.value is None
FailedThree
python
docker__docker-py
tests/integration/api_client_test.py
{ "start": 912, "end": 1569 }
class ____(unittest.TestCase): def setUp(self): self.timeout = 0.5 self.client = docker.api.APIClient( version=docker.constants.MINIMUM_DOCKER_API_VERSION, base_url='http://192.168.10.2:4243', timeout=self.timeout ) def test_timeout(self): sta...
ConnectionTimeoutTest
python
coleifer__peewee
peewee.py
{ "start": 185872, "end": 187159 }
class ____(Field): _unresolved = set() def __init__(self, rel_model_name, **kwargs): self.field_kwargs = kwargs self.rel_model_name = rel_model_name.lower() DeferredForeignKey._unresolved.add(self) super(DeferredForeignKey, self).__init__( column_name=kwargs.get('col...
DeferredForeignKey
python
numba__numba
numba/tests/test_array_exprs.py
{ "start": 19182, "end": 20934 }
class ____(MemoryLeakMixin, unittest.TestCase): # same as above, but the Optional resolves to None and TypeError's def test_optional_scalar_type_exception_on_none(self): self.disable_leak_check() @njit def arr_expr(x, y): return x + y @njit def do_call(x, ...
TestOptionalsExceptions
python
huggingface__transformers
src/transformers/models/superglue/modeling_superglue.py
{ "start": 20137, "end": 32583 }
class ____(SuperGluePreTrainedModel): """SuperGlue feature matching middle-end Given two sets of keypoints and locations, we determine the correspondences by: 1. Keypoint Encoding (normalization + visual feature and location fusion) 2. Graph Neural Network with multiple self and cross-attention...
SuperGlueForKeypointMatching
python
plotly__plotly.py
_plotly_utils/basevalidators.py
{ "start": 19758, "end": 20531 }
class ____(BaseValidator): """ "boolean": { "description": "A boolean (true/false) value.", "requiredOpts": [], "otherOpts": [ "dflt" ] }, """ def __init__(self, plotly_name, parent_name, **kwargs): super(BooleanValidator, self).__init__( ...
BooleanValidator
python
walkccc__LeetCode
solutions/61. Rotate List/61.py
{ "start": 0, "end": 414 }
class ____: def rotateRight(self, head: ListNode, k: int) -> ListNode: if not head or not head.next or k == 0: return head tail = head length = 1 while tail.next: tail = tail.next length += 1 tail.next = head # Circle the list. t = length - k % length for _ in range(t)...
Solution
python
kubernetes-client__python
kubernetes/client/models/v1_non_resource_policy_rule.py
{ "start": 383, "end": 5783 }
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...
V1NonResourcePolicyRule