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
pydantic__pydantic
pydantic-core/tests/validators/test_model_fields.py
{ "start": 434, "end": 673 }
class ____: def __init__(self, **attributes): for k, v in attributes.items(): setattr(self, k, v) def __repr__(self): return 'Cls({})'.format(', '.join(f'{k}={v!r}' for k, v in self.__dict__.items()))
Cls
python
django-extensions__django-extensions
django_extensions/mongodb/fields/__init__.py
{ "start": 6522, "end": 6965 }
class ____(CreationDateTimeField): """ ModificationDateTimeField By default, sets editable=False, blank=True, default=datetime.now Sets value to datetime.now() on each save of the model. """ def pre_save(self, model, add): value = datetime.datetime.now() setattr(model, self.at...
ModificationDateTimeField
python
plotly__plotly.py
plotly/graph_objs/densitymap/legendgrouptitle/_font.py
{ "start": 233, "end": 9942 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "densitymap.legendgrouptitle" _path_str = "densitymap.legendgrouptitle.font" _valid_props = { "color", "family", "lineposition", "shadow", "size", "style", "textcase", "variant", "...
Font
python
astropy__astropy
astropy/table/table.py
{ "start": 13979, "end": 19699 }
class ____(TableAttribute): """Maintain tuple that controls table column visibility for print output. This is a descriptor that inherits from MetaAttribute so that the attribute value is stored in the table meta['__attributes__']. This gets used for the ``pprint_include_names`` and ``pprint_exclude_na...
PprintIncludeExclude
python
geekcomputers__Python
JARVIS/JARVIS_2.0.py
{ "start": 4548, "end": 9435 }
class ____: def __init__(self, Q): self.query = Q def sub_call(self, exe_file): ''' This method can directly use call method of subprocess module and according to the argument(exe_file) passed it returns the output. exe_file:- must pass the exe file name as str object t...
Jarvis
python
apache__airflow
task-sdk/src/airflow/sdk/definitions/_internal/mixins.py
{ "start": 1338, "end": 4447 }
class ____: """Mixing implementing common dependency setting methods like >> and <<.""" @property def roots(self) -> Iterable[DependencyMixin]: """ List of root nodes -- ones with no upstream dependencies. a.k.a. the "start" of this sub-graph """ raise NotImplemente...
DependencyMixin
python
tensorflow__tensorflow
tensorflow/python/ops/image_ops_test.py
{ "start": 60475, "end": 62318 }
class ____(test_util.TensorFlowTestCase): def _testBrightness(self, x_np, y_np, delta, tol=1e-6): with self.cached_session(): x = constant_op.constant(x_np, shape=x_np.shape) y = image_ops.adjust_brightness(x, delta) y_tf = self.evaluate(y) self.assertAllClose(y_tf, y_np, tol) def test...
AdjustBrightnessTest
python
spyder-ide__spyder
spyder/plugins/run/models.py
{ "start": 13150, "end": 14968 }
class ____(QAbstractListModel): def __init__(self, parent, executor_model: RunExecutorListModel): super().__init__(parent) self.executor_model = executor_model self.executor_configurations: OrderedDict[ str, Set[Tuple[str, str]]] = OrderedDict({}) for input_conf in self....
RunExecutorNamesListModel
python
Pylons__pyramid
tests/test_config/test_actions.py
{ "start": 22018, "end": 31092 }
class ____(unittest.TestCase): def _callFUT(self, actions): from pyramid.config.actions import resolveConflicts return resolveConflicts(actions) def test_it_success_tuples(self): from . import dummyfactory as f result = self._callFUT( [ (None, f), ...
Test_resolveConflicts
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/operators/test_emr_serverless.py
{ "start": 45474, "end": 49853 }
class ____: @mock.patch.object(EmrServerlessHook, "get_waiter") @mock.patch.object(EmrServerlessHook, "conn") def test_delete_application_with_wait_for_completion_successfully(self, mock_conn, mock_get_waiter): mock_get_waiter().wait.return_value = True mock_conn.stop_application.return_valu...
TestEmrServerlessDeleteOperator
python
PyCQA__pylint
tests/functional/b/base_init_vars.py
{ "start": 309, "end": 722 }
class ____(BaseClass): """Inherits from BaseClass """ def __init__(self): BaseClass.__init__(self) self.var = {} def met(self): """Checks that base_var is not seen as defined outsite '__init__' """ self.var[1] = 'one' self.base_var[1] = 'one' ret...
MyClass
python
psf__black
src/blib2to3/pygram.py
{ "start": 900, "end": 3235 }
class ____(Symbols): and_expr: int and_test: int annassign: int arglist: int argument: int arith_expr: int asexpr_test: int assert_stmt: int async_funcdef: int async_stmt: int atom: int augassign: int break_stmt: int case_block: int classdef: int comp_for:...
_python_symbols
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_name01.py
{ "start": 315, "end": 1369 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_name01.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(self.got_...
TestCompareXLSXFiles
python
dagster-io__dagster
python_modules/libraries/dagster-snowflake-pandas/dagster_snowflake_pandas/snowflake_pandas_type_handler.py
{ "start": 2886, "end": 9943 }
class ____(DbTypeHandler[pd.DataFrame]): """Plugin for the Snowflake I/O Manager that can store and load Pandas DataFrames as Snowflake tables. Examples: .. code-block:: python from dagster_snowflake import SnowflakeIOManager from dagster_snowflake_pandas import SnowflakePandas...
SnowflakePandasTypeHandler
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/test_dataflow.py
{ "start": 17000, "end": 19034 }
class ____: @mock.patch("airflow.providers.google.cloud.operators.dataflow.DataflowHook") def test_exec_job_id(self, dataflow_mock): self.dataflow = DataflowStopJobOperator( task_id=TASK_ID, project_id=TEST_PROJECT, job_id=JOB_ID, poll_sleep=POLL_SLEEP, ...
TestDataflowStopJobOperator
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_pyi/PYI034.py
{ "start": 10543, "end": 10677 }
class ____(Generic[T]): def __new__(cls: type[Generic2]) -> Generic2: ... def __enter__(self: Generic2) -> Generic2: ...
Generic2
python
has2k1__plotnine
plotnine/facets/labelling.py
{ "start": 7194, "end": 7781 }
class ____(_core_labeller): """ Use a function turn facet value into a label Parameters ---------- func : callable Function to label an individual string """ def __init__(self, func: Callable[[str], str]): self.func = func def __call__(self, label_info: strip_label_det...
_function_labeller
python
django__django
tests/raw_query/models.py
{ "start": 1271, "end": 1347 }
class ____(models.Model): reviewed = models.ManyToManyField(Book)
Reviewer
python
sympy__sympy
sympy/polys/polyerrors.py
{ "start": 4705, "end": 4744 }
class ____(OptionError): pass
FlagError
python
dask__distributed
distributed/exceptions.py
{ "start": 622, "end": 1482 }
class ____(TimeoutError): """Raised when the expected number of workers to not start within the timeout period.""" #: Number of workers that are available. available_workers: int #: Number of workers that were expected to be available. expected_workers: int #: Timeout period in seconds. t...
WorkerStartTimeoutError
python
django__django
tests/generic_inline_admin/tests.py
{ "start": 9569, "end": 11126 }
class ____(TestDataMixin, TestCase): def setUp(self): self.client.force_login(self.superuser) def test_add(self): category_id = Category.objects.create(name="male").pk prefix = "generic_inline_admin-phonenumber-content_type-object_id" post_data = { "name": "John Doe"...
GenericInlineAdminWithUniqueTogetherTest
python
facebook__pyre-check
client/coverage_data.py
{ "start": 17649, "end": 23545 }
class ____(matchers.MatcherDecoratableVisitor): """ Collects all empty containers in the module. """ # An empty container is: # - an empty list literal # - an empty dict literal # - a call to set(), frozenset(), list(), or dict() with no arguments METADATA_DEPENDENCIES = (PositionProvi...
EmptyContainerCollector
python
lepture__authlib
authlib/oauth2/rfc8628/models.py
{ "start": 301, "end": 827 }
class ____(dict, DeviceCredentialMixin): def get_client_id(self): return self["client_id"] def get_scope(self): return self.get("scope") def get_user_code(self): return self["user_code"] def get_nonce(self): return self.get("nonce") def get_auth_time(self): ...
DeviceCredentialDict
python
wandb__wandb
wandb/sdk/lib/wb_logging.py
{ "start": 683, "end": 4139 }
class ____: """Sentinel for `not_run_specific()`.""" _NOT_RUN_SPECIFIC = _NotRunSpecific() _run_id: contextvars.ContextVar[str | _NotRunSpecific | None] = contextvars.ContextVar( "_run_id", default=None, ) _logger = logging.getLogger("wandb") def configure_wandb_logger() -> None: """Configures th...
_NotRunSpecific
python
jina-ai__jina
tests/unit/jaml/test_type_parse.py
{ "start": 3672, "end": 6957 }
class ____: def __init__(self, envs): self._env_keys_added = envs def __enter__(self): for key, val in self._env_keys_added.items(): os.environ[key] = str(val) def __exit__(self, exc_type, exc_val, exc_tb): for key in self._env_keys_added.keys(): os.unsetenv...
EnvironmentVarCtxtManager
python
getsentry__sentry
src/sentry/types/releaseactivity.py
{ "start": 24, "end": 341 }
class ____(Enum): CREATED = 0 DEPLOYED = 1 FINISHED = 2 ISSUE = 3 CHOICES = tuple( (i.value, i.name.lower()) for i in [ ReleaseActivityType.CREATED, ReleaseActivityType.DEPLOYED, ReleaseActivityType.FINISHED, ReleaseActivityType.ISSUE, ] )
ReleaseActivityType
python
dagster-io__dagster
python_modules/dagster/dagster/_core/types/dagster_type.py
{ "start": 14730, "end": 15633 }
class ____(DagsterType): def __init__( self, key: t.Optional[str], name: t.Optional[str], loader: t.Optional[DagsterTypeLoader] = None, is_builtin: bool = False, description: t.Optional[str] = None, ): super(Anyish, self).__init__( key=key, ...
Anyish
python
scikit-image__scikit-image
benchmarks/benchmark_measure.py
{ "start": 925, "end": 1358 }
class ____: param_names = ['cache'] params = (False, True) def setup(self, cache): self.label_image, self.intensity_image = init_regionprops_data() def time_regionprops_table_all(self, cache): measure.regionprops_table( self.label_image, self.intensity_image, properties=PRO...
RegionpropsTableAll
python
huggingface__transformers
src/transformers/models/mistral3/modular_mistral3.py
{ "start": 4279, "end": 9743 }
class ____(LlavaModel): def get_image_features( self, pixel_values: torch.FloatTensor, image_sizes: torch.Tensor, vision_feature_layer: Optional[Union[int, list[int]]] = None, **kwargs, ): """ Obtains image last hidden states from the vision tower and appl...
Mistral3Model
python
pytorch__pytorch
torch/distributed/_shard/sharded_tensor/metadata.py
{ "start": 166, "end": 302 }
class ____(Enum): TORCH_CONTIGUOUS_FORMAT = 0 TORCH_CHANNELS_LAST = 1 TORCH_PRESERVE_FORMAT = 2 @dataclass
MEM_FORMAT_ENCODING
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/orm/state_changes.py
{ "start": 888, "end": 6806 }
class ____: """Supplies state assertion decorators. The current use case is for the :class:`_orm.SessionTransaction` class. The :class:`_StateChange` class itself is agnostic of the :class:`_orm.SessionTransaction` class so could in theory be generalized for other systems as well. """ _ne...
_StateChange
python
pennersr__django-allauth
allauth/socialaccount/providers/douban/provider.py
{ "start": 219, "end": 430 }
class ____(ProviderAccount): def get_profile_url(self): return self.account.extra_data.get("alt") def get_avatar_url(self): return self.account.extra_data.get("large_avatar")
DoubanAccount
python
has2k1__plotnine
plotnine/iapi.py
{ "start": 3916, "end": 4010 }
class ____: """ Position Scales """ x: scale y: scale @dataclass
pos_scales
python
django__django
tests/postgres_tests/test_array.py
{ "start": 33155, "end": 36854 }
class ____(TransactionTestCase): available_apps = ["postgres_tests"] def test_deconstruct(self): field = ArrayField(models.IntegerField()) name, path, args, kwargs = field.deconstruct() self.assertEqual(kwargs.keys(), {"base_field"}) new = ArrayField(*args, **kwargs) sel...
TestMigrations
python
dask__dask
dask/utils_test.py
{ "start": 362, "end": 4819 }
class ____: """ The GetFunctionTestCase class can be imported and used to test foreign implementations of the `get` function specification. It aims to enforce all known expectations of `get` functions. To use the class, inherit from it and override the `get` function. For example: > from d...
GetFunctionTestMixin
python
airbytehq__airbyte
airbyte-integrations/connectors/source-iterable/source_iterable/streams.py
{ "start": 15913, "end": 16008 }
class ____(IterableExportStreamAdjustableRange): data_field = "emailComplaint"
EmailComplaint
python
simonw__datasette
datasette/utils/asgi.py
{ "start": 731, "end": 924 }
class ____(NotFound): def __init__(self, database_name, table): super().__init__("Table not found") self.database_name = database_name self.table = table
TableNotFound
python
run-llama__llama_index
llama-index-core/llama_index/core/base/llms/types.py
{ "start": 21045, "end": 21929 }
class ____(BaseModel): """ Completion response. Fields: text: Text content of the response if not streaming, or if streaming, the current extent of streamed text. additional_kwargs: Additional information on the response(i.e. token counts, function calling informatio...
CompletionResponse
python
pandas-dev__pandas
pandas/_typing.py
{ "start": 8079, "end": 8302 }
class ____(BaseBuffer, Protocol[AnyStr_co]): __module__: str = "pandas.api.typing.aliases" def read(self, n: int = ..., /) -> AnyStr_co: # for BytesIOWrapper, gzip.GzipFile, bz2.BZ2File ...
ReadBuffer
python
numpy__numpy
numpy/_globals.py
{ "start": 3093, "end": 4155 }
class ____: # A descriptor to store on the ufunc __dict__ that avoids definig a # signature for the ufunc class/type but allows the instance to have one. # This is needed because inspect.signature() chokes on normal properties # (as of 3.14 at least). # We could also set __signature__ on the instanc...
_SignatureDescriptor
python
pytorch__pytorch
test/dynamo/test_higher_order_ops.py
{ "start": 253431, "end": 254974 }
class ____(torch.nn.Module): def forward(self, L_x_: "f32[2, 4, 3]"): l_x_ = L_x_ lazy_load_decompositions = torch._functorch.predispatch.lazy_load_decompositions(); lazy_load_decompositions = None _vmap_increment_nesting = torch._functorch.predispatch._vmap_increment_nesting(2, 'error');...
GraphModule
python
tensorflow__tensorflow
tensorflow/lite/python/optimize/calibrator_test.py
{ "start": 1714, "end": 10752 }
class ____(test_util.TensorFlowTestCase, parameterized.TestCase): @parameterized.named_parameters( # Activation type Int8 ('UseActivationTypeInt8', dtypes.int8), # Activation type Int16 ('UseActivationTypeInt16', dtypes.int16), ) def test_calibration_with_quantization(self, activations_ty...
CalibratorTest
python
huggingface__transformers
src/transformers/models/emu3/modeling_emu3.py
{ "start": 23757, "end": 24241 }
class ____(nn.GroupNorm): """ Same as the torch GroupNorm with the only difference that this ones accepts an optional kwarg `quant_states` which is not used. This class makes it easier to use SpatialNorm or GroupNorm without conditionals """ def __init__(self, **kwargs): super().__init_...
Emu3VQVAEGroupNorm
python
facebook__pyre-check
client/commands/tests/language_server_test.py
{ "start": 4957, "end": 13209 }
class ____(testslide.TestCase): @setup.async_test async def test_try_initialize_success(self) -> None: input_channel = await server_setup.create_input_channel_with_requests( [ json_rpc.Request( id=0, method="initialize", ...
InitializeTest
python
PyCQA__pylint
tests/functional/t/too/too_many_instance_attributes_py37.py
{ "start": 388, "end": 573 }
class ____: a_1: int a_2: int a_3: int a_4: int a_5: int a_6: int a_7: int a_8: InitVar[int] def __post_init__(self, a_8): self.a_1 += a_8
Hello
python
walkccc__LeetCode
solutions/2355. Maximum Number of Books You Can Take/2355.py
{ "start": 0, "end": 864 }
class ____: def maximumBooks(self, books: list[int]) -> int: # dp[i] := the maximum the number of books we can take from books[0..i] with taking all of # books[i] dp = [0] * len(books) stack = [] # the possible indices we can reach for i, book in enumerate(books): # We may take all of book...
Solution
python
openai__openai-python
src/openai/types/evals/create_eval_completions_run_data_source_param.py
{ "start": 4026, "end": 4607 }
class ____(TypedDict, total=False): content: Required[InputMessagesTemplateTemplateEvalItemContent] """Inputs to the model - can contain template strings.""" role: Required[Literal["user", "assistant", "system", "developer"]] """The role of the message input. One of `user`, `assistant`, `system`, ...
InputMessagesTemplateTemplateEvalItem
python
run-llama__llama_index
llama-index-core/llama_index/core/indices/knowledge_graph/base.py
{ "start": 1514, "end": 14513 }
class ____(BaseIndex[KG]): """ Knowledge Graph Index. Build a KG by extracting triplets, and leveraging the KG during query-time. Args: kg_triplet_extract_template (BasePromptTemplate): The prompt to use for extracting triplets. max_triplets_per_chunk (int): The maximum num...
KnowledgeGraphIndex
python
apache__airflow
airflow-core/tests/unit/models/test_renderedtifields.py
{ "start": 2844, "end": 19782 }
class ____: """Unit tests for RenderedTaskInstanceFields.""" @staticmethod def clean_db(): clear_db_runs() clear_db_dags() clear_rendered_ti_fields() def setup_method(self): self.clean_db() def teardown_method(self): self.clean_db() @pytest.mark.parame...
TestRenderedTaskInstanceFields
python
HypothesisWorks__hypothesis
hypothesis-python/tests/nocover/test_stateful.py
{ "start": 3469, "end": 3717 }
class ____(RuleBasedStateMachine): b1 = Bundle("b1") b2 = Bundle("b2") @rule(targets=(b1, b2)) def populate(self): return 1 @rule(x=b1, y=b2) def fail(self, x, y): raise AssertionError
PopulateMultipleTargets
python
chroma-core__chroma
chromadb/proto/utils.py
{ "start": 173, "end": 2570 }
class ____( grpc.UnaryUnaryClientInterceptor, grpc.UnaryStreamClientInterceptor ): """ A gRPC client interceptor that retries RPCs on specific status codes. By default, it retries on UNAVAILABLE and UNKNOWN status codes. This interceptor should be placed after the OpenTelemetry interceptor in the inter...
RetryOnRpcErrorClientInterceptor
python
numpy__numpy
numpy/polynomial/tests/test_hermite.py
{ "start": 9970, "end": 11307 }
class ____: def test_hermder(self): # check exceptions assert_raises(TypeError, herm.hermder, [0], .5) assert_raises(ValueError, herm.hermder, [0], -1) # check that zeroth derivative does nothing for i in range(5): tgt = [0] * i + [1] res = herm.herm...
TestDerivative
python
modin-project__modin
modin/experimental/core/storage_formats/pandas/parsers.py
{ "start": 3755, "end": 4508 }
class ____(PandasParser): @staticmethod @doc(_doc_parse_func, parameters=_doc_parse_parameters_common) def parse(fname, **kwargs): warnings.filterwarnings("ignore") num_splits = 1 single_worker_read = kwargs.pop("single_worker_read", None) df = pandas.read_pickle(fname, **kwa...
ExperimentalPandasPickleParser
python
getsentry__sentry
src/sentry/monitors/processing_errors/errors.py
{ "start": 1521, "end": 1865 }
class ____(TypedDict): """ The guid for the checkin matched a checkin that was related to a different project than the one provided in the DSN """ type: Literal[ProcessingErrorType.CHECKIN_GUID_PROJECT_MISMATCH] guid: str """ The guid which is associated to a different project """ ...
CheckinGuidProjectMismatch
python
ray-project__ray
python/ray/exceptions.py
{ "start": 27724, "end": 28238 }
class ____(RayError): """Raised when a runtime environment fails to be set up. Args: error_message: The error message that explains why runtime env setup has failed. """ def __init__(self, error_message: str = None): self.error_message = error_message def __str__(self)...
RuntimeEnvSetupError
python
ansible__ansible
test/integration/targets/collections/collection_root_user/ansible_collections/testns/testcoll/plugins/filter/filter_subdir/my_subdir_filters.py
{ "start": 126, "end": 258 }
class ____(object): def filters(self): return { 'test_subdir_filter': test_subdir_filter }
FilterModule
python
google__jax
jax/_src/api.py
{ "start": 77723, "end": 103901 }
class ____(NamedTuple): version: int # For forward and backward compatibility xla_executable: xc.LoadedExecutable in_handler: Any out_handler: Any out_pytree_def: Any # Data needed to handle the inputs. input_devices: Sequence[xc.Device] input_indices: Sequence[sharding_specs.Index] input_array_shard...
_PmapFastpathData
python
keras-team__keras
keras/src/losses/losses_test.py
{ "start": 77755, "end": 84894 }
class ____(testing.TestCase): def test_config(self): self.run_class_serialization_test( losses.CategoricalGeneralizedCrossEntropy(name="gce") ) self.run_class_serialization_test( losses.CategoricalGeneralizedCrossEntropy(q=0.1, name="gce") ) def test_basi...
CategoricalGeneralizedCrossEntropyTest
python
allegroai__clearml
clearml/backend_api/services/v2_20/tasks.py
{ "start": 332132, "end": 333253 }
class ____(Request): """ Get the list of task hyper parameters :param tasks: Task IDs :type tasks: Sequence[str] """ _service = "tasks" _action = "get_hyper_params" _version = "2.20" _schema = { "definitions": {}, "properties": { "tasks": { ...
GetHyperParamsRequest
python
ZoranPandovski__al-go-rithms
data_structures/Graphs/prims/python/hemant-mst-prims.py
{ "start": 25, "end": 1363 }
class ____(): # defining the class or data structure def __init__(self, vertices): self.V = vertices self.graph = [[0 for column in range(vertices)] for row in range(vertices)] def printMST(self, parent): print("Edge \tWeight") for i in range(1, self....
Graph
python
scrapy__scrapy
tests/test_utils_reactor.py
{ "start": 250, "end": 1129 }
class ____: def test_is_asyncio_reactor_installed(self, reactor_pytest: str) -> None: # the result should depend only on the pytest --reactor argument assert is_asyncio_reactor_installed() == (reactor_pytest == "asyncio") def test_install_asyncio_reactor(self): from twisted.internet imp...
TestAsyncio
python
huggingface__transformers
src/transformers/models/wav2vec2/modeling_wav2vec2.py
{ "start": 24576, "end": 26313 }
class ____(GradientCheckpointingLayer): def __init__(self, config): super().__init__() self.attention = Wav2Vec2Attention( embed_dim=config.hidden_size, num_heads=config.num_attention_heads, dropout=config.attention_dropout, is_decoder=False, ...
Wav2Vec2EncoderLayerStableLayerNorm
python
dask__dask
dask/diagnostics/profile.py
{ "start": 8507, "end": 12136 }
class ____(Callback): """A profiler for dask execution at the scheduler cache level. Records the following information for each task: 1. Key 2. Task 3. Size metric 4. Cache entry time in seconds since the epoch 5. Cache exit time in seconds since the epoch Examples ...
CacheProfiler
python
geekcomputers__Python
venv/Lib/site-packages/pip/_internal/commands/list.py
{ "start": 1254, "end": 12771 }
class ____(IndexGroupCommand): """ List installed packages, including editables. Packages are listed in a case-insensitive sorted order. """ ignore_require_venv = True usage = """ %prog [options]""" def add_options(self) -> None: self.cmd_opts.add_option( "-o", ...
ListCommand
python
getsentry__sentry
tests/sentry/monitors/test_models.py
{ "start": 7131, "end": 12849 }
class ____(TestCase): @override_settings(MAX_ENVIRONMENTS_PER_MONITOR=2) def test_monitor_environment_limits(self) -> None: monitor = Monitor.objects.create( organization_id=self.organization.id, project_id=self.project.id, name="Unicron", slug="unicron", ...
MonitorEnvironmentTestCase
python
explosion__spaCy
spacy/lang/az/__init__.py
{ "start": 117, "end": 221 }
class ____(BaseDefaults): lex_attr_getters = LEX_ATTRS stop_words = STOP_WORDS
AzerbaijaniDefaults
python
fastai__fastai
fastai/vision/augment.py
{ "start": 36913, "end": 39433 }
class ____(AffineCoordTfm): "Apply a random zoom of at most `max_zoom` with probability `p` to a batch of images" def __init__(self, min_zoom:float=1., # Minimum zoom max_zoom:float=1.1, # Maximum zoom p:float=0.5, # Probability of applying zoom draw:float|MutableSequence|Calla...
Zoom
python
sqlalchemy__sqlalchemy
test/orm/test_mapper.py
{ "start": 88207, "end": 89062 }
class ____(_fixtures.FixtureTest): def setup_test(self): self.buf = logging.handlers.BufferingHandler(100) for log in [logging.getLogger("sqlalchemy.orm")]: log.addHandler(self.buf) self.mapper = registry().map_imperatively def teardown_test(self): for log in [loggi...
ORMLoggingTest
python
openai__openai-python
src/openai/types/fine_tuning/alpha/grader_validate_params.py
{ "start": 598, "end": 875 }
class ____(TypedDict, total=False): grader: Required[Grader] """The grader used for the fine-tuning job.""" Grader: TypeAlias = Union[ StringCheckGraderParam, TextSimilarityGraderParam, PythonGraderParam, ScoreModelGraderParam, MultiGraderParam ]
GraderValidateParams
python
scrapy__scrapy
tests/test_spidermiddleware.py
{ "start": 11458, "end": 11589 }
class ____: async def process_spider_output(self, response, result): return result
ProcessSpiderOutputCoroutineMiddleware
python
tensorflow__tensorflow
tensorflow/python/distribute/parameter_server_strategy_v2_test.py
{ "start": 11989, "end": 26847 }
class ____(test.TestCase, parameterized.TestCase): @classmethod def setUpClass(cls): super(VariablePartitioningTest, cls).setUpClass() cls.cluster = multi_worker_test_base.create_multi_process_cluster( num_workers=2, num_ps=2, rpc_layer="grpc") cls.cluster_resolver = cls.cluster.cluster_resolve...
VariablePartitioningTest
python
kamyu104__LeetCode-Solutions
Python/closest-dessert-cost.py
{ "start": 2096, "end": 2910 }
class ____(object): def closestCost(self, baseCosts, toppingCosts, target): """ :type baseCosts: List[int] :type toppingCosts: List[int] :type target: int :rtype: int """ max_count = 2 combs = set([0]) for t in toppingCosts: combs =...
Solution3
python
run-llama__llama_index
llama-index-core/llama_index/core/indices/property_graph/retriever.py
{ "start": 340, "end": 2402 }
class ____(BaseRetriever): """ A retriever that uses multiple sub-retrievers to retrieve nodes from a property graph. Args: sub_retrievers (List[BasePGRetriever]): The sub-retrievers to use. num_workers (int, optional): The number of workers to use for async retrieva...
PGRetriever
python
apache__airflow
providers/celery/tests/integration/celery/test_celery_executor.py
{ "start": 12476, "end": 18030 }
class ____: bulk_state_fetcher_logger = "airflow.providers.celery.executors.celery_executor_utils.BulkStateFetcher" @mock.patch( "celery.backends.base.BaseKeyValueStoreBackend.mget", return_value=[json.dumps({"status": "SUCCESS", "task_id": "123"})], ) def test_should_support_kv_backend...
TestBulkStateFetcher
python
Textualize__textual
src/textual/_compositor.py
{ "start": 2151, "end": 3654 }
class ____(CompositorUpdate): """A renderable containing the result of a render for a given region.""" def __init__(self, strips: list[Iterable[Strip]], region: Region) -> None: self.strips = strips self.region = region def __rich_console__( self, console: Console, options: Console...
LayoutUpdate
python
jamielennox__requests-mock
tests/base.py
{ "start": 566, "end": 611 }
class ____(testtools.TestCase): pass
TestCase
python
coleifer__peewee
tests/fields.py
{ "start": 34386, "end": 34572 }
class ____(TestModel): ts_0 = TimestampField(resolution=0) ts_1 = TimestampField(resolution=1) ts_10 = TimestampField(resolution=10) ts_2 = TimestampField(resolution=2)
TSR
python
apache__airflow
airflow-core/src/airflow/dag_processing/processor.py
{ "start": 3360, "end": 16117 }
class ____(BaseModel): """ Result of DAG File Parsing. This is the result of a successful DAG parse, in this class, we gather all serialized DAGs, import errors and warnings to send back to the scheduler to store in the DB. """ fileloc: str serialized_dags: list[LazyDeserializedDAG] wa...
DagFileParsingResult
python
numpy__numpy
benchmarks/benchmarks/bench_ufunc.py
{ "start": 4293, "end": 4903 }
class ____(Benchmark): """ Benchmark for the shift methods """ params = [['__lshift__', '__rshift__'], ['intp', 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64']] param_names = ['methods', 'npdtypes'] timeout = 10 def setup(s...
NDArrayLRShifts
python
tox-dev__tox
src/tox/tox_env/python/package.py
{ "start": 961, "end": 1035 }
class ____(PythonPathPackageWithDeps): """wheel package."""
WheelPackage
python
hyperopt__hyperopt
hyperopt/exceptions.py
{ "start": 603, "end": 786 }
class ____(ValueError): """fmin evaluation returned invalid loss value""" def __init__(self, result): ValueError.__init__(self) self.result = result
InvalidLoss
python
prabhupant__python-ds
data_structures/graphs/transpose.py
{ "start": 38, "end": 753 }
class ____: def __init__(self, vertices): self.V = vertices self.graph = defaultdict(list) def add_edge(self, u, v): self.graph[u].append(v) def print_graph(self): for i in self.graph: print(i, " --> ", end=" ") for j in self.graph[i]: ...
Graph
python
celery__celery
t/unit/worker/test_worker.py
{ "start": 2341, "end": 22413 }
class ____(ConsumerCase): def setup_method(self): self.buffer = FastQueue() self.timer = Timer() @self.app.task(shared=False) def foo_task(x, y, z): return x * y * z self.foo_task = foo_task def teardown_method(self): self.timer.stop() def Loop...
test_Consumer
python
weaviate__weaviate-python-client
weaviate/collections/classes/config_vectorizers.py
{ "start": 15317, "end": 15544 }
class ____(BaseModel): """Use this class when defining the fields to use in the `Multi2VecClip` and `Multi2VecBind` vectorizers.""" name: str weight: Optional[float] = Field(default=None, exclude=True)
Multi2VecField
python
huggingface__transformers
src/transformers/models/speech_to_text/modeling_speech_to_text.py
{ "start": 2308, "end": 3707 }
class ____(nn.Module): """ Convolutional subsampler: a stack of 1D convolution (along temporal dimension) followed by non-linear activation via gated linear units (https://huggingface.co/papers/1911.08460) """ def __init__(self, config): super().__init__() self.config = config ...
Conv1dSubsampler
python
jpadilla__pyjwt
jwt/jwks_client.py
{ "start": 409, "end": 4307 }
class ____: def __init__( self, uri: str, cache_keys: bool = False, max_cached_keys: int = 16, cache_jwk_set: bool = True, lifespan: float = 300, headers: Optional[Dict[str, Any]] = None, timeout: float = 30, ssl_context: Optional[SSLContext] =...
PyJWKClient
python
huggingface__transformers
tests/models/idefics2/test_modeling_idefics2.py
{ "start": 1485, "end": 5658 }
class ____: def __init__( self, parent, is_training=True, batch_size=2, num_images=2, seq_length=10, vision_config={ "image_size": 12, "patch_size": 12, "num_channels": 3, "hidden_size": 32, "num_hidd...
Idefics2VisionText2TextModelTester
python
bokeh__bokeh
src/bokeh/io/notebook.py
{ "start": 5251, "end": 24665 }
class ____(TypedDict): load: Load doc: ShowDoc app: ShowApp def install_notebook_hook(notebook_type: NotebookType, load: Load, show_doc: ShowDoc, show_app: ShowApp, overwrite: bool = False) -> None: ''' Install a new notebook display hook. Bokeh comes with support for Jupyter notebooks bui...
Hooks
python
realpython__materials
inheritance-and-composition/choosing/contacts.py
{ "start": 509, "end": 1282 }
class ____: def __init__(self): self._employee_addresses = { 1: Address("121 Admin Rd.", "Concord", "NH", "03301"), 2: Address("67 Paperwork Ave", "Manchester", "NH", "03101"), 3: Address("15 Rose St", "Concord", "NH", "03301", "Apt. B-1"), 4: Address("39 Sole...
_AddressBook
python
davidhalter__jedi
test/refactor/inline.py
{ "start": 2743, "end": 6041 }
class ____: pass #? 5 error test(A) # ++++++++++++++++++++++++++++++++++++++++++++++++++ Cannot inline a class # -------------------------------------------------- function def foo(a): return a + 1 #? 5 error test(foo(1)) # ++++++++++++++++++++++++++++++++++++++++++++++++++ Cannot inline a function # --------------...
A
python
numpy__numpy
numpy/_core/tests/test_umath.py
{ "start": 87735, "end": 90152 }
class ____: def test_exp_float32(self): np.random.seed(42) x_f32 = np.float32(np.random.uniform(low=0.0, high=88.1, size=1000000)) x_f64 = np.float64(x_f32) assert_array_max_ulp(np.exp(x_f32), np.float32(np.exp(x_f64)), maxulp=3) def test_log_float32(self): np.random.see...
TestAVXFloat32Transcendental
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 949914, "end": 950429 }
class ____(sgqlc.types.Type): """Represents a required status check for a protected branch, but not any specific run of that check. """ __schema__ = github_schema __field_names__ = ("app", "context") app = sgqlc.types.Field("App", graphql_name="app") """The App that must provide this status...
RequiredStatusCheckDescription
python
PrefectHQ__prefect
tests/server/api/test_logs.py
{ "start": 1388, "end": 3285 }
class ____: async def test_create_logs_with_flow_run_id_and_returns_number_created( self, session, client, log_data, flow_run_id ): response = await client.post(CREATE_LOGS_URL, json=log_data) assert response.status_code == 201 log_filter = LogFilter(flow_run_id={"any_": [flow_r...
TestCreateLogs
python
encode__django-rest-framework
tests/test_serializer.py
{ "start": 21611, "end": 22186 }
class ____: def test_cache_serializer_data(self): """ Caching serializer data with pickle will drop the serializer info, but does preserve the data itself. """ class ExampleSerializer(serializers.Serializer): field1 = serializers.CharField() field2 = s...
TestCacheSerializerData
python
ray-project__ray
python/ray/experimental/collective/nixl_tensor_transport.py
{ "start": 329, "end": 7153 }
class ____(TensorTransportManager): @property def tensor_transport_backend(self) -> Backend: return Backend.NIXL @staticmethod def is_one_sided() -> bool: return True @staticmethod def can_abort_transport() -> bool: return True def actor_has_tensor_transport(self, ...
NixlTensorTransport
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/class_interval.py
{ "start": 3470, "end": 3642 }
class ____: def bar(self, x): return x def f(self, b: B7): y = b.foo() # Interval: [1,2] return y """ A8: [1,2] B8: [3,4] C8: [5,6] """
A7
python
readthedocs__readthedocs.org
readthedocs/search/admin.py
{ "start": 131, "end": 468 }
class ____(admin.ModelAdmin): raw_id_fields = ("project", "version") list_filter = ("created",) list_display = ("__str__", "created") search_fields = ("project__slug", "version__slug", "query") readonly_fields = ("created", "modified") list_select_related = ("project", "version", "version__proje...
SearchQueryAdmin
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/override_module_templates/package.py
{ "start": 217, "end": 510 }
class ____(Package): homepage = "http://www.fake-spack-example.org" url = "http://www.fake-spack-example.org/downloads/fake-1.0.tar.gz" version("1.0", md5="0123456789abcdef0123456789abcdef") tcl_template = "override.txt" lmod_template = "override.txt"
OverrideModuleTemplates
python
huggingface__transformers
tests/models/nllb_moe/test_modeling_nllb_moe.py
{ "start": 9478, "end": 14369 }
class ____(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (NllbMoeModel, NllbMoeForConditionalGeneration) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": NllbMoeModel, "summarization": NllbM...
NllbMoeModelTest
python
numba__numba
numba/cuda/tests/cudadrv/test_profiler.py
{ "start": 207, "end": 508 }
class ____(ContextResettingTestCase): def test_profiling(self): with cuda.profiling(): a = cuda.device_array(10) del a with cuda.profiling(): a = cuda.device_array(100) del a if __name__ == '__main__': unittest.main()
TestProfiler