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
numpy__numpy
benchmarks/benchmarks/bench_reduce.py
{ "start": 607, "end": 1063 }
class ____(Benchmark): def setup(self): # avoid np.zeros's lazy allocation that would # cause page faults during benchmark self.zeros = np.full(100000, 0, bool) self.ones = np.full(100000, 1, bool) def time_all_fast(self): self.zeros.all() def time_all_slow(self): ...
AnyAll
python
kamyu104__LeetCode-Solutions
Python/prison-cells-after-n-days.py
{ "start": 424, "end": 1111 }
class ____(object): def prisonAfterNDays(self, cells, N): """ :type cells: List[int] :type N: int :rtype: List[int] """ cells = tuple(cells) lookup = {} while N: lookup[cells] = N N -= 1 cells = tuple([0] + [cells[i ...
Solution2
python
qdrant__qdrant-client
qdrant_client/http/models/models.py
{ "start": 150677, "end": 150971 }
class ____(str, Enum): """ Storage in chunked mmap files, appendable Search performance is defined by disk speed and the fraction of vectors that fit in memory. """ def __str__(self) -> str: return str(self.value) CHUNKEDMMAP = "ChunkedMmap"
VectorStorageTypeOneOf2
python
getsentry__sentry
tests/sentry/auth/test_helper.py
{ "start": 21341, "end": 23397 }
class ____(TestCase): def setUp(self) -> None: self.provider = "dummy" self.auth_provider_inst = AuthProvider.objects.create( organization_id=self.organization.id, provider=self.provider ) self.auth_key = "test_auth_key" self.request = _set_up_request() s...
AuthHelperTest
python
Unity-Technologies__ml-agents
ml-agents/mlagents/trainers/subprocess_env_manager.py
{ "start": 9459, "end": 22762 }
class ____(EnvManager): def __init__( self, env_factory: Callable[[int, List[SideChannel]], BaseEnv], run_options: RunOptions, n_env: int = 1, ): super().__init__() self.env_workers: List[UnityEnvWorker] = [] self.step_queue: Queue = Queue() self.w...
SubprocessEnvManager
python
scrapy__scrapy
tests/test_utils_datatypes.py
{ "start": 428, "end": 5504 }
class ____(ABC): @property @abstractmethod def dict_class(self) -> type[MutableMapping]: raise NotImplementedError def test_init_dict(self): seq = {"red": 1, "black": 3} d = self.dict_class(seq) assert d["red"] == 1 assert d["black"] == 3 def test_init_pair_...
TestCaseInsensitiveDictBase
python
django__django
tests/validation/test_constraints.py
{ "start": 264, "end": 3786 }
class ____(TestCase): @skipUnlessDBFeature("supports_table_check_constraints") def test_full_clean_with_check_constraints(self): product = Product(price=10, discounted_price=15) with self.assertRaises(ValidationError) as cm: product.full_clean() self.assertEqual( ...
PerformConstraintChecksTest
python
kamyu104__LeetCode-Solutions
Python/max-chunks-to-make-sorted-ii.py
{ "start": 51, "end": 543 }
class ____(object): def maxChunksToSorted(self, arr): """ :type arr: List[int] :rtype: int """ result, increasing_stk = 0, [] for num in arr: max_num = num if not increasing_stk else max(increasing_stk[-1], num) while increasing_stk and increas...
Solution
python
django__django
tests/migrations/migrations_test_apps/with_generic_model/models.py
{ "start": 499, "end": 549 }
class ____(typing.Generic[T1, T2]): pass
Parent1
python
pandas-dev__pandas
pandas/core/arrays/integer.py
{ "start": 5504, "end": 5693 }
class ____(IntegerDtype): type = np.int32 name: ClassVar[str] = "Int32" __doc__ = _dtype_docstring.format(dtype="int32") @register_extension_dtype @set_module("pandas")
Int32Dtype
python
pydantic__pydantic
pydantic/v1/errors.py
{ "start": 15668, "end": 15769 }
class ____(PydanticValueError): msg_template = 'value is not a valid IPv4 network'
IPv4NetworkError
python
kamyu104__LeetCode-Solutions
Python/maximum-consecutive-floors-without-special-floors.py
{ "start": 40, "end": 446 }
class ____(object): def maxConsecutive(self, bottom, top, special): """ :type bottom: int :type top: int :type special: List[int] :rtype: int """ special.sort() result = max(special[0]-bottom, top-special[-1]) for i in xrange(1, len(special)): ...
Solution
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/paramSpec3.py
{ "start": 939, "end": 1576 }
class ____(Generic[P, R]): def __init__(self, func: Callable[P, R]): self.func = func def func4(f: Callable[P, R]) -> ClassA[P, R]: return ClassA(f) T1 = TypeVar("T1") T2 = TypeVar("T2") def decorator2(f: Callable[P, R]) -> Callable[P, R]: return f def func5(f: Callable[[], list[T1]]) -> Cal...
ClassA
python
viewflow__viewflow
viewflow/templatetags/viewflow.py
{ "start": 4280, "end": 5714 }
class ____(template.Node): """ Render a django form using google material-components-web library. Example: {% render_form form [layout] %} """ default_layout = FormLayout() def __init__(self, parser, token): bits = token.split_contents() layout_expr = None if...
FormNode
python
pdm-project__pdm
src/pdm/exceptions.py
{ "start": 401, "end": 447 }
class ____(PdmUsageError): pass
PublishError
python
django-guardian__django-guardian
guardian/testapp/models.py
{ "start": 1073, "end": 1434 }
class ____(models.Model): name = models.CharField(max_length=128, unique=True) created_at = models.DateTimeField(default=timezone.now) class Meta: get_latest_by = "created_at" def __str__(self): return self.name Project.not_a_relation_descriptor = DynamicAccessor() # Simple model f...
Project
python
pytorch__pytorch
benchmarks/functional_autograd_benchmark/torchaudio_models.py
{ "start": 12789, "end": 14581 }
class ____(nn.Module): r"""Inject some information about the relative or absolute position of the tokens in the sequence. The positional encodings have the same dimension as the embeddings, so that the two can be summed. Here, we use sine and cosine functions of different frequencies. .....
PositionalEncoding
python
cython__cython
Cython/Compiler/ModuleNode.py
{ "start": 3690, "end": 7618 }
class ____: """ Class responsible for generating code that imports and exports shared utility functions. Mark the positions where the functions should be called with `call_import_code()`/`call_export_code()`. The function calls and import/export functions are generated when `generate_exporting_function...
SharedUtilityExporter
python
sqlalchemy__sqlalchemy
test/orm/test_lockmode.py
{ "start": 4652, "end": 12096 }
class ____(_fixtures.FixtureTest, AssertsCompiledSQL): """run some compile tests, even though these are redundant.""" run_inserts = None @classmethod def setup_mappers(cls): User, users = cls.classes.User, cls.tables.users Address, addresses = cls.classes.Address, cls.tables.addresses ...
CompileTest
python
numba__numba
numba/tests/doc_examples/test_numpy_generators.py
{ "start": 127, "end": 1099 }
class ____(unittest.TestCase): def test_numpy_gen_usage(self): # magictoken.npgen_usage.begin x = np.random.default_rng(1) y = np.random.default_rng(1) size = 10 @numba.njit def do_stuff(gen): return gen.random(size=int(size / 2)) original = x....
NumpyGeneratorUsageTest
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 954761, "end": 955505 }
class ____(sgqlc.types.relay.Connection): """The connection type for ReviewRequest.""" __schema__ = github_schema __field_names__ = ("edges", "nodes", "page_info", "total_count") edges = sgqlc.types.Field(sgqlc.types.list_of("ReviewRequestEdge"), graphql_name="edges") """A list of edges.""" no...
ReviewRequestConnection
python
python__mypy
mypy/test/testparse.py
{ "start": 2498, "end": 3710 }
class ____(DataSuite): required_out_section = True base_path = "." files = ["parse-errors.test"] def run_case(self, testcase: DataDrivenTestCase) -> None: test_parse_error(testcase) def test_parse_error(testcase: DataDrivenTestCase) -> None: try: options = parse_options("\n".join(...
ParseErrorSuite
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/protocol3.py
{ "start": 2143, "end": 2213 }
class ____: @property def real(self: _Self) -> _Self: ...
Class5
python
apache__airflow
airflow-core/tests/unit/models/test_dag.py
{ "start": 96975, "end": 113688 }
class ____: def setup_method(self) -> None: clear_db_runs() clear_db_dags() clear_db_dag_bundles() def teardown_method(self) -> None: clear_db_runs() clear_db_dags() clear_db_dag_bundles() @pytest.mark.parametrize("tasks_count", [3, 12]) def test_count_n...
TestQueries
python
sanic-org__sanic
sanic/http/tls/creators.py
{ "start": 5280, "end": 7907 }
class ____(CertCreator): def check_supported(self) -> None: try: subprocess.run( # nosec B603 B607 ["mkcert", "-help"], check=True, stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL, ) except Exception as e: ...
MkcertCreator
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 8892, "end": 9308 }
class ____(sgqlc.types.Enum): """The possible base permissions for repositories. Enumeration Choices: * `ADMIN`: Can read, write, and administrate repos by default * `NONE`: No access * `READ`: Can read repos by default * `WRITE`: Can read and write repos by default """ __schema__ = g...
DefaultRepositoryPermissionField
python
ansible__ansible
lib/ansible/plugins/lookup/password.py
{ "start": 12856, "end": 17554 }
class ____(LookupBase): def _parse_parameters(self, term): """Hacky parsing of params See https://github.com/ansible/ansible-modules-core/issues/1968#issuecomment-136842156 and the first_found lookup For how we want to fix this later """ first_split = term.split(' ', 1) ...
LookupModule
python
modin-project__modin
modin/experimental/torch/datasets.py
{ "start": 1016, "end": 2779 }
class ____: "A self explainatory class to convert a DataFrame into a DataLoader that batches rows." def __init__( self, df: DataFrame | ModinDataFrame, batch_size: int, features: Sequence[Hashable] = (), sampler: Type[Sampler] | Sampler = SequentialSampler, ) -> None...
ModinDataLoader
python
spyder-ide__spyder
external-deps/spyder-remote-services/spyder_remote_services/services/files/base.py
{ "start": 535, "end": 10514 }
class ____(WebSocketHandler): """ WebSocket handler for opening files and streaming data. The protocol on message receive (JSON messages): { "method": "read", # "write", "seek", etc. (required) "kwargs": {...}, (optional) "data": "<base64-encoded chunk>", # all data is base...
FileWebSocketHandler
python
Netflix__metaflow
metaflow/plugins/azure/includefile_support.py
{ "start": 150, "end": 4298 }
class ____(object): TYPE = "azure" @classmethod def get_root_from_config(cls, echo, create_on_absent=True): from metaflow.metaflow_config import DATATOOLS_AZUREROOT return DATATOOLS_AZUREROOT def __init__(self): # This local directory is used to house any downloaded blobs, for...
Azure
python
spack__spack
lib/spack/spack/bootstrap/clingo.py
{ "start": 1616, "end": 9142 }
class ____: def __init__(self, configuration): _add_compilers_if_missing() self.host_platform = spack.platforms.host() self.host_os = self.host_platform.default_operating_system() self.host_target = spack.vendor.archspec.cpu.host().family self.host_architecture = spack.spec.A...
ClingoBootstrapConcretizer
python
dagster-io__dagster
python_modules/libraries/dagster-spark/dagster_spark/resources.py
{ "start": 341, "end": 2055 }
class ____: def __init__(self, logger): self.logger = check.inst_param(logger, "logger", DagsterLogManager) def run_spark_job(self, config, main_class): check.dict_param(config, "config") check.str_param(main_class, "main_class") # Extract parameters from config ( ...
SparkResource
python
getsentry__sentry
tests/acceptance/test_project_ownership.py
{ "start": 117, "end": 900 }
class ____(AcceptanceTestCase): def setUp(self) -> None: super().setUp() self.login_as(self.user) self.path = f"/settings/{self.organization.slug}/projects/{self.project.slug}/ownership/" def test_simple(self) -> None: self.browser.get(self.path) self.browser.wait_until_...
ProjectOwnershipTest
python
openai__openai-python
src/openai/types/beta/realtime/input_audio_buffer_clear_event.py
{ "start": 232, "end": 489 }
class ____(BaseModel): type: Literal["input_audio_buffer.clear"] """The event type, must be `input_audio_buffer.clear`.""" event_id: Optional[str] = None """Optional client-generated ID used to identify this event."""
InputAudioBufferClearEvent
python
getsentry__sentry
src/sentry/issues/endpoints/event_grouping_info.py
{ "start": 698, "end": 2261 }
class ____(ProjectEndpoint): owner = ApiOwner.ISSUES publish_status = { "GET": ApiPublishStatus.PRIVATE, } def get(self, request: HttpRequest, project, event_id) -> HttpResponse: """ Returns the grouping information for an event ``````````````````````````````````````````...
EventGroupingInfoEndpoint
python
xlwings__xlwings
xlwings/constants.py
{ "start": 52488, "end": 52906 }
class ____: xlDay = 1 # from enum XlDataSeriesDate xlMonth = 3 # from enum XlDataSeriesDate xlWeekday = 2 # from enum XlDataSeriesDate xlYear = 4 # from enum XlDataSeriesDate xlAutoFill = 4 # from enum XlDataSeriesType xlChronological = 3 # from enum XlDataSeriesType xlDataSeriesLinear...
DataSeriesDate
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1500078, "end": 1501452 }
class ____(sgqlc.types.Type, Node): """An update sent to sponsors of a user or organization on GitHub Sponsors. """ __schema__ = github_schema __field_names__ = ("author", "body", "created_at", "is_published", "sponsorable", "subject", "updated_at") author = sgqlc.types.Field("User", graphql_na...
SponsorshipNewsletter
python
pytorch__pytorch
torch/_export/serde/schema_check.py
{ "start": 14137, "end": 15057 }
class ____ {{ static_assert(!std::is_reference_v<T>, "ForwardRef cannot be a reference type"); public: ForwardRef(): ptr_(std::make_unique<T>()) {{}} ForwardRef(ForwardRef<T>&&); ForwardRef(const ForwardRef<T>& other): ptr_(std::make_unique<T>(*other.ptr_)) {{}} ForwardRef<T>& operator=(ForwardRef<T>&&); ...
ForwardRef
python
apache__thrift
lib/py/src/protocol/TBinaryProtocol.py
{ "start": 6451, "end": 7091 }
class ____(TProtocolFactory): def __init__(self, strictRead=False, strictWrite=True, **kwargs): self.strictRead = strictRead self.strictWrite = strictWrite self.string_length_limit = kwargs.get('string_length_limit', None) self.container_length_limit = kwargs.get('container_length_li...
TBinaryProtocolFactory
python
tensorflow__tensorflow
tensorflow/python/tpu/tests/tpu_embedding_v2_hd_invalid_input_test.py
{ "start": 1070, "end": 3378 }
class ____(tpu_embedding_base_test.TPUEmbeddingBaseTest): def test_build_incorrect_output_shapes(self): _, mid_level_api, _ = self._create_strategy_and_mid_level('sgd') # Output shapes is set in the mid_level_api, but build with incorrect output # shapes. mid_level_api._output_shapes = [TensorShape((...
TPUEmbeddingTest
python
pytorch__pytorch
torch/testing/_internal/opinfo/core.py
{ "start": 3688, "end": 11141 }
class ____: """Represents sample inputs to a function.""" __slots__ = [ "input", "args", "kwargs", "output_process_fn_grad", "broadcasts_input", "name", ] def __init__( self, input, *var_args, args=None, kwargs=Non...
SampleInput
python
sympy__sympy
sympy/polys/domains/powerseriesring.py
{ "start": 2029, "end": 6415 }
class ____(Ring[PowerSeriesElement[Er]], CompositeDomain): """A Domain class for representing univariate power series rings. Notes ===== This class is at experimental stage. Proper domain methods should be added to integrate with SymPy's existing domain framework. """ is_PowerSeriesRing =...
PowerSeriesRing
python
Farama-Foundation__Gymnasium
gymnasium/wrappers/transform_observation.py
{ "start": 13344, "end": 15814 }
class ____( TransformObservation[WrapperObsType, ActType, ObsType], gym.utils.RecordConstructorArgs, ): """Resizes image observations using OpenCV to a specified shape. A vector version of the wrapper exists :class:`gymnasium.wrappers.vector.ResizeObservation`. Example: >>> import gymnasiu...
ResizeObservation
python
coleifer__peewee
examples/anomaly_detection.py
{ "start": 329, "end": 1697 }
class ____(object): def __init__(self): self.n = 0 self.values = [] def step(self, value): self.n += 1 self.values.append(value) def finalize(self): if self.n < 2: return 0 mean = sum(self.values) / self.n sqsum = sum((i - mean) ** 2 for ...
StdDev
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/bzip2/package.py
{ "start": 218, "end": 586 }
class ____(Package): """This packagae has the variants shared defaulted to True""" homepage = "https://example.com" url = "https://example.com/bzip2-1.0.8tar.gz" version("1.0.8", sha256="ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269") variant("shared", default=True, descrip...
Bzip2
python
huggingface__transformers
src/transformers/models/swin2sr/modeling_swin2sr.py
{ "start": 37850, "end": 39370 }
class ____(nn.Module): def __init__(self, config, num_features): super().__init__() self.upscale = config.upscale self.conv_bicubic = nn.Conv2d(config.num_channels, num_features, 3, 1, 1) self.conv_before_upsample = nn.Conv2d(config.embed_dim, num_features, 3, 1, 1) self.act...
PixelShuffleAuxUpsampler
python
scipy__scipy
scipy/_lib/tests/test__util.py
{ "start": 16209, "end": 23719 }
class ____: def kmeans(self, **kwargs): rng = np.random.default_rng(3458934594269824562) return cluster.vq.kmeans2(rng.random(size=(20, 3)), 3, **kwargs) def kmeans2(self, **kwargs): rng = np.random.default_rng(3458934594269824562) return cluster.vq.kmeans2(rng.random(size=(20, ...
TestTransitionToRNG
python
numba__numba
numba/tests/test_mixed_tuple_unroller.py
{ "start": 40186, "end": 48347 }
class ____(MemoryLeakMixin, TestCase): def test_01(self): @njit def foo(): a = [12, 12.7, 3j, 4] acc = 0 for i in range(len(literal_unroll(a))): acc += a[i] if acc.real < 26: acc -= 1 else: ...
TestConstListUnroll
python
Netflix__metaflow
metaflow/cli_args.py
{ "start": 1279, "end": 3584 }
class ____(object): def __init__(self): self._top_kwargs = {} self._step_kwargs = {} def _set_step_kwargs(self, kwargs): self._step_kwargs = kwargs def _set_top_kwargs(self, kwargs): self._top_kwargs = kwargs @property def top_kwargs(self): return self._top...
CLIArgs
python
facebookresearch__faiss
benchs/bench_gpu_1bn.py
{ "start": 4625, "end": 22386 }
class ____: """a pre-processor is either a faiss.VectorTransform or an IndentPreproc""" def __init__(self, d): self.d_in = self.d_out = d def apply_py(self, x): return x def sanitize(x): """ convert array to a c-contiguous float array """ return np.ascontiguousarray(x.astype('flo...
IdentPreproc
python
pandas-dev__pandas
pandas/io/formats/printing.py
{ "start": 16352, "end": 16511 }
class ____(dict[_KT, _VT]): """Dict extension to support abbreviated __repr__""" def __repr__(self) -> str: return pprint_thing(self)
PrettyDict
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/callables.py
{ "start": 637, "end": 951 }
class ____(AbstractEventProcessor[EPInputType, EPOutputType]): async def async_run(self) -> None: _test_sink(self.benign) async def async_call_tainted(self) -> None: _test_sink(self.tainted) PIInputType = TypeVar("PIInputType") PIOutputType = TypeVar("PIOutputType")
ConcreteEventProcessor
python
coleifer__peewee
tests/psycopg3_ext.py
{ "start": 1214, "end": 1268 }
class ____(TestModel): data = BinaryJSONField()
BJson
python
kamyu104__LeetCode-Solutions
Python/find-the-largest-almost-missing-integer.py
{ "start": 63, "end": 687 }
class ____(object): def largestInteger(self, nums, k): """ :type nums: List[int] :type k: int :rtype: int """ if k == len(nums): return max(nums) cnt = collections.defaultdict(int) for x in nums: cnt[x] += 1 if k == 1: ...
Solution
python
apache__airflow
providers/apache/spark/tests/unit/apache/spark/hooks/test_spark_sql.py
{ "start": 1356, "end": 8816 }
class ____: _config = { "conn_id": "spark_default", "executor_cores": 4, "executor_memory": "22g", "keytab": "privileged_user.keytab", "name": "spark-job", "num_executors": 10, "verbose": True, "sql": " /path/to/sql/file.sql ", "conf": {"key": ...
TestSparkSqlHook
python
matplotlib__matplotlib
lib/matplotlib/colors.py
{ "start": 3044, "end": 19963 }
class ____(Mapping): r""" Container for sequences of colors that are known to Matplotlib by name. The universal registry instance is `matplotlib.color_sequences`. There should be no need for users to instantiate `.ColorSequenceRegistry` themselves. Read access uses a dict-like interface mappin...
ColorSequenceRegistry
python
ansible__ansible
lib/ansible/_internal/_ssh/_ssh_agent.py
{ "start": 15881, "end": 16106 }
class ____(PublicKeyMsg): type: KeyAlgo enc_a: binary_string comments: unicode_string = dataclasses.field(default=unicode_string(''), compare=False) @dataclasses.dataclass(order=True, slots=True)
Ed25519PublicKeyMsg
python
streamlit__streamlit
lib/tests/streamlit/elements/date_input_test.py
{ "start": 1190, "end": 19224 }
class ____(DeltaGeneratorTestCase): """Test ability to marshall date_input protos.""" def test_just_label(self): """Test that it can be called with no value.""" st.date_input("the label") c = self.get_delta_from_queue().new_element.date_input assert c.label == "the label" ...
DateInputTest
python
django-import-export__django-import-export
tests/core/tests/test_base_formats.py
{ "start": 7468, "end": 8318 }
class ____(TestCase): def setUp(self): self.format = base_formats.TSV() def test_import_mac(self): filename = os.path.join( os.path.dirname(__file__), os.path.pardir, "exports", "books-mac.tsv" ) with open(filename, self.format.get_read_mode()) as in_stream: ...
TSVTest
python
django__django
tests/admin_views/forms.py
{ "start": 193, "end": 520 }
class ____(AdminAuthenticationForm): class Media: css = {"all": ("path/to/media.css",)} def clean_username(self): username = self.cleaned_data.get("username") if username == "customform": raise ValidationError("custom form error") return username
CustomAdminAuthenticationForm
python
fastai__fastai
fastai/torch_core.py
{ "start": 20265, "end": 20417 }
class ____(TensorBase): pass TensorImage.register_func(F.grid_sample, TensorImageBase, TensorFlowField) # %% ../nbs/00_torch_core.ipynb 119
TensorFlowField
python
pytorch__pytorch
test/torch_np/numpy_tests/lib/test_type_check.py
{ "start": 7329, "end": 7980 }
class ____(TestCase): def test_goodvalues(self): z = np.array((-1.0, 0.0, 1.0)) res = np.isnan(z) == 0 assert_all(np.all(res, axis=0)) def test_posinf(self): assert_all(np.isnan(np.array((1.0,)) / 0.0) == 0) def test_neginf(self): assert_all(np.isnan(np.array((-1.0,...
TestIsnan
python
Pylons__pyramid
tests/test_config/test_actions.py
{ "start": 20198, "end": 22018 }
class ____(unittest.TestCase): def _makeConfigurator(self, *arg, **kw): from pyramid.config import Configurator config = Configurator(*arg, **kw) return config def test_functional(self): def add_auto_route(config, name, view): def register(): config....
Test_reentrant_action_functional
python
getsentry__sentry
tests/sentry/utils/test_query.py
{ "start": 6304, "end": 6447 }
class ____(RangeQuerySetWrapperTest): range_wrapper = RangeQuerySetWrapperWithProgressBarApprox
RangeQuerySetWrapperWithProgressBarApproxTest
python
huggingface__transformers
src/transformers/models/emu3/modeling_emu3.py
{ "start": 24241, "end": 25756 }
class ____(nn.Module): def __init__(self, config, in_channels, quant_channels=None): super().__init__() self.block_1 = Emu3VQVAEResnetBlock( in_channels=in_channels, out_channels=in_channels, quant_channels=quant_channels, ) self.attn_1 = Emu3VQVA...
Emu3VQVAEMiddleBlock
python
apache__airflow
helm-tests/tests/helm_tests/redis/test_labels_serviceaccount.py
{ "start": 900, "end": 4328 }
class ____: """Tests redis service account labels.""" AIRFLOW_EXECUTOR = "CeleryExecutor" TEMPLATE_FILE = "templates/redis/redis-serviceaccount.yaml" def test_should_add_global_labels(self): """Test adding only .Values.labels.""" docs = render_chart( values={ ...
TestRedisServiceAccount
python
cython__cython
tests/run/test_named_expressions.py
{ "start": 2989, "end": 9995 }
class ____(unittest.TestCase): def test_named_expression_invalid_01(self): code = """x := 0""" with self.assertRaisesRegex(SyntaxError, "invalid syntax"): exec(code, {}, {}) def test_named_expression_invalid_02(self): code = """x = y := 0""" with self.assertRaises...
NamedExpressionInvalidTest
python
kamyu104__LeetCode-Solutions
Python/flip-equivalent-binary-trees.py
{ "start": 227, "end": 1110 }
class ____(object): def flipEquiv(self, root1, root2): """ :type root1: TreeNode :type root2: TreeNode :rtype: bool """ dq1, dq2 = collections.deque([root1]), collections.deque([root2]) while dq1 and dq2: node1, node2 = dq1.pop(), dq2.pop() ...
Solution
python
networkx__networkx
networkx/classes/tests/test_reportviews.py
{ "start": 1836, "end": 5362 }
class ____: @classmethod def setup_class(cls): cls.G = nx.path_graph(9) cls.nv = NodeDataView(cls.G) cls.ndv = cls.G.nodes.data(True) cls.nwv = cls.G.nodes.data("foo") def test_viewtype(self): nv = self.G.nodes ndvfalse = nv.data(False) assert nv is n...
TestNodeDataView
python
pytorch__pytorch
torch/_inductor/codegen/cuda/cutlass_lib_extensions/cutlass_mock_imports/cuda/cuda.py
{ "start": 162, "end": 204 }
class ____: CUDA_SUCCESS = True
CUresult
python
bokeh__bokeh
src/bokeh/util/callback_manager.py
{ "start": 4349, "end": 7653 }
class ____: ''' A mixin class to provide an interface for registering and triggering callbacks. ''' document: Document | None _callbacks: dict[str, list[PropertyCallback]] def __init__(self, *args: Any, **kw: Any) -> None: super().__init__(*args, **kw) self._callbacks = {} ...
PropertyCallbackManager
python
getsentry__sentry
tests/sentry/uptime/autodetect/test_ranking.py
{ "start": 7980, "end": 8386 }
class ____(UptimeTestCase): def test(self) -> None: assert should_autodetect_for_project(self.project) self.project.update_option("sentry:uptime_autodetection", False) assert not should_autodetect_for_project(self.project) self.project.update_option("sentry:uptime_autodetection", Tru...
ShouldDetectForProjectTest
python
Lightning-AI__lightning
tests/tests_pytorch/models/test_hparams.py
{ "start": 9890, "end": 10107 }
class ____: any_other_loss = torch.nn.CrossEntropyLoss() def __init__(self, *args, subclass_arg=1200, **kwargs): super().__init__(*args, **kwargs) self.save_hyperparameters()
MixinForBoringModel
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/runs.py
{ "start": 3139, "end": 3348 }
class ____(graphene.Interface): results = non_null_list("dagster_graphql.schema.pipelines.pipeline.GrapheneRun") count = graphene.Int() class Meta: name = "PipelineRuns"
GraphenePipelineRuns
python
pytorch__pytorch
test/test_mps.py
{ "start": 362029, "end": 370577 }
class ____(TestCaseMPS): def _wrap_tensor(self, x, device="cpu", dtype=None, requires_grad=False): return torch.tensor(x, device=device, dtype=dtype, requires_grad=requires_grad) def test_logical_not(self): def helper(x): cpu_x = x x = cpu_x.detach().clone().to('mps') ...
TestLogical
python
numpy__numpy
numpy/_core/tests/test_defchararray.py
{ "start": 4623, "end": 6190 }
class ____: def A(self): return np.array([['abc', 'abcc', '123'], ['789', 'abc', 'xyz']]).view(np.char.chararray) def B(self): return np.array([['efg', 'efg', '123 '], ['051', 'efgg', 'tuv']]).view(np.char.chararray) def test_not_equal(sel...
TestComparisons
python
spack__spack
var/spack/test_repos/spack_repo/edges_test/packages/conditional_edge/package.py
{ "start": 216, "end": 825 }
class ____(Package): """This package has a variant that triggers a condition only if a required dependency is providing a virtual. """ homepage = "http://www.example.com" url = "http://www.example.com/a-1.0.tar.gz" version("2.0", md5="abcdef0123456789abcdef0123456789") version("1.0", md5="...
ConditionalEdge
python
getsentry__sentry
src/sentry/snuba/metrics/fields/base.py
{ "start": 8857, "end": 8996 }
class ____(MetricObjectDefinition): raw_metric_mri: str filters: Callable[..., Function] | None = None
AliasedDerivedMetricDefinition
python
django-import-export__django-import-export
tests/core/tests/admin_integration/test_action_export.py
{ "start": 17499, "end": 18910 }
class ____(AdminTestMixin, TestCase): """ Test config values when export is initiated from the 'Export' action in the action menu. """ def setUp(self): super().setUp() self.cat1 = Category.objects.create(name="Cat 1") self.queryset = Category.objects.all() self.model...
TestSkipExportFormFromAction
python
doocs__leetcode
lcof2/剑指 Offer II 107. 矩阵中的距离/Solution.py
{ "start": 0, "end": 693 }
class ____: def updateMatrix(self, mat: List[List[int]]) -> List[List[int]]: m, n = len(mat), len(mat[0]) ans = [[-1] * n for _ in range(m)] q = deque() for i, row in enumerate(mat): for j, v in enumerate(row): if v == 0: ans[i][j] = 0 ...
Solution
python
django__django
tests/utils_tests/test_http.py
{ "start": 14717, "end": 15045 }
class ____(unittest.TestCase): def test(self): tests = ( ("//example.com", "/%2Fexample.com"), ("//", "/%2F"), ) for url, expected in tests: with self.subTest(url=url): self.assertEqual(escape_leading_slashes(url), expected)
EscapeLeadingSlashesTests
python
coleifer__peewee
tests/models.py
{ "start": 113330, "end": 121335 }
class ____(BaseTestCase): def test_field_inheritance(self): class BaseModel(Model): class Meta: database = get_in_memory_db() class BasePost(BaseModel): content = TextField() timestamp = TimestampField() class Photo(BasePost): ...
TestFieldInheritance
python
sympy__sympy
sympy/physics/biomechanics/tests/test_musculotendon.py
{ "start": 15510, "end": 21367 }
class ____: @pytest.fixture(autouse=True) def _musculotendon_tendon_force_explicit_fixture( self, musculotendon_concrete, curve, ): self.name = 'name' self.N = ReferenceFrame('N') self.q = dynamicsymbols('q') self.origin = Point('pO') self.ins...
TestTendonForceExplicit
python
getsentry__responses
responses/__init__.py
{ "start": 21448, "end": 21602 }
class ____(BaseResponse): def __init__(self, *args: Any, **kwargs: Any): super().__init__(*args, passthrough=True, **kwargs)
PassthroughResponse
python
astropy__astropy
astropy/table/index.py
{ "start": 36358, "end": 37865 }
class ____(list): """ List-subclass of table indices allowing for retrieval by column name(s). Parameters ---------- lst : list List of indices """ def __init__(self, lst): super().__init__(lst) def __getitem__(self, item) -> Index: """ Retrieve an item...
TableIndices
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 487482, "end": 488234 }
class ____(sgqlc.types.relay.Connection): """The connection type for CheckAnnotation.""" __schema__ = github_schema __field_names__ = ("edges", "nodes", "page_info", "total_count") edges = sgqlc.types.Field(sgqlc.types.list_of("CheckAnnotationEdge"), graphql_name="edges") """A list of edges.""" ...
CheckAnnotationConnection
python
PyCQA__pylint
pylint/testutils/pyreverse.py
{ "start": 2646, "end": 2773 }
class ____(TypedDict): source_roots: list[str] output_formats: list[str] command_line_args: list[str]
TestFileOptions
python
sqlalchemy__sqlalchemy
test/orm/test_deprecations.py
{ "start": 78614, "end": 80270 }
class ____(_fixtures.FixtureTest): """test the noload stratgegy which unlike others doesn't use lazyloader to set up instrumentation""" def test_o2m(self): users, Address, addresses, User = ( self.tables.users, self.classes.Address, self.tables.addresses, ...
NoLoadBackPopulates
python
cython__cython
Cython/Compiler/ParseTreeTransforms.py
{ "start": 125553, "end": 130233 }
class ____(CythonTransform, SkipDeclarations): """ Adjust function and class definitions by the decorator directives: @cython.cfunc @cython.cclass @cython.ccall @cython.inline @cython.nogil @cython.critical_section """ # list of directives that cause conversion to cclass con...
AdjustDefByDirectives
python
plotly__plotly.py
plotly/graph_objs/ohlc/decreasing/_line.py
{ "start": 233, "end": 4158 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "ohlc.decreasing" _path_str = "ohlc.decreasing.line" _valid_props = {"color", "dash", "width"} @property def color(self): """ Sets the line color. The 'color' property is a color and may be specified as: - A ...
Line
python
tornadoweb__tornado
tornado/test/iostream_test.py
{ "start": 34169, "end": 34924 }
class ____(TestIOStreamMixin): def _make_server_iostream(self, connection, **kwargs): ssl_ctx = ssl_options_to_context(_server_ssl_options(), server_side=True) connection = ssl_ctx.wrap_socket( connection, server_side=True, do_handshake_on_connect=False, )...
TestIOStreamSSL
python
wandb__wandb
wandb/integration/fastai/__init__.py
{ "start": 1462, "end": 9261 }
class ____(TrackerCallback): """Callback for saving model topology, losses & metrics. Optionally logs weights, gradients, sample predictions and best trained model. Args: learn (fastai.basic_train.Learner): the fast.ai learner to hook. log (str): "gradients", "parameters", "all", or None. ...
WandbCallback
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1597907, "end": 1598074 }
class ____(sgqlc.types.Union): """Types that can be requested reviewers.""" __schema__ = github_schema __types__ = (Mannequin, Team, User)
RequestedReviewer
python
django__django
tests/select_for_update/models.py
{ "start": 925, "end": 1042 }
class ____(models.Model): person = models.OneToOneField(Person, models.CASCADE, related_name="profile")
PersonProfile
python
tiangolo__fastapi
docs_src/body_multiple_params/tutorial004_an_py310.py
{ "start": 234, "end": 643 }
class ____(BaseModel): username: str full_name: str | None = None @app.put("/items/{item_id}") async def update_item( *, item_id: int, item: Item, user: User, importance: Annotated[int, Body(gt=0)], q: str | None = None, ): results = {"item_id": item_id, "item": item, "user": user,...
User
python
urllib3__urllib3
src/urllib3/exceptions.py
{ "start": 6624, "end": 6720 }
class ____(SecurityWarning): """Warned when using unsupported SSL library"""
NotOpenSSLWarning
python
django__django
tests/i18n/test_compilation.py
{ "start": 12744, "end": 13712 }
class ____(ProjectAndAppTests): def setUp(self): super().setUp() gettext_module._translations = {} # flush cache or test will be useless def test_nofuzzy_compiling(self): with override_settings(LOCALE_PATHS=[os.path.join(self.test_dir, "locale")]): call_command("compilemess...
FuzzyTranslationTest
python
kubernetes-client__python
kubernetes/base/dynamic/exceptions.py
{ "start": 2693, "end": 2795 }
class ____(Exception): """ Parameters given matched multiple API resources """
ResourceNotUniqueError
python
ahupp__python-magic
magic/__init__.py
{ "start": 541, "end": 689 }
class ____(Exception): def __init__(self, message): super(Exception, self).__init__(message) self.message = message
MagicException
python
numba__numba
numba/core/typing/templates.py
{ "start": 46440, "end": 48639 }
class ____(object): """ A registry of typing declarations. The registry stores such declarations for functions, attributes and globals. """ def __init__(self): self.functions = [] self.attributes = [] self.globals = [] def register(self, item): assert issubclas...
Registry