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
rapidsai__cudf
python/cudf_polars/cudf_polars/dsl/ir.py
{ "start": 100198, "end": 102417 }
class ____(IR): """Merge sorted operation.""" __slots__ = ("key",) _non_child = ("schema", "key") key: str """Key that is sorted.""" def __init__(self, schema: Schema, key: str, left: IR, right: IR): # Children must be Sort or Repartition(Sort). # The Repartition(Sort) case hap...
MergeSorted
python
encode__django-rest-framework
tests/test_filters.py
{ "start": 20344, "end": 20498 }
class ____(serializers.ModelSerializer): class Meta: model = DjangoFilterOrderingModel fields = '__all__'
DjangoFilterOrderingSerializer
python
apache__airflow
helm-tests/tests/helm_tests/security/test_rbac_pod_log_reader.py
{ "start": 914, "end": 5149 }
class ____: """Tests RBAC Pod Reader.""" @pytest.mark.parametrize( ("webserver", "airflow_version", "expected"), [ (True, "2.9.0", ["release-name-airflow-webserver"]), (False, "2.9.0", []), (True, "3.0.0", ["release-name-airflow-api-server"]), (Fa...
TestPodReader
python
PrefectHQ__prefect
tests/utilities/test_visualization.py
{ "start": 6484, "end": 9817 }
class ____: @pytest.mark.parametrize( "test_flow", [ simple_sync_flow, simple_async_flow_with_async_tasks, simple_async_flow_with_sync_tasks, async_flow_with_subflow, flow_with_task_interaction, flow_with_mixed_tasks, ...
TestFlowVisualise
python
getsentry__sentry
src/sentry/flags/providers.py
{ "start": 12487, "end": 13047 }
class ____(serializers.Serializer): eventName = serializers.CharField(required=True) timestamp = serializers.CharField(required=True) metadata = serializers.DictField(required=True) user = serializers.DictField(required=False, child=serializers.CharField()) userID = serializers.CharField(required=F...
StatsigEventSerializer
python
readthedocs__readthedocs.org
readthedocs/storage/s3_storage.py
{ "start": 3181, "end": 3685 }
class ____(S3StaticStorageMixin, OverrideHostnameMixin, S3Boto3Storage): """ Storage backend for static files used outside Django's static files. This is the same as S3StaticStorage, but without inheriting from S3ManifestStaticStorage, this way we can get the URL of any file in that bucket, even hashed...
NoManifestS3StaticStorage
python
pandas-dev__pandas
pandas/tests/frame/constructors/test_from_dict.py
{ "start": 195, "end": 7988 }
class ____: # Note: these tests are specific to the from_dict method, not for # passing dictionaries to DataFrame.__init__ def test_constructor_list_of_odicts(self): data = [ OrderedDict([["a", 1.5], ["b", 3], ["c", 4], ["d", 6]]), OrderedDict([["a", 1.5], ["b", 3], ["d", 6...
TestFromDict
python
dagster-io__dagster
examples/docs_snippets/docs_snippets/guides/external-systems/apis/minimal_resource.py
{ "start": 108, "end": 581 }
class ____(dg.ConfigurableResource): # highlight-end @property def query_string(self) -> str: latittude = "37.615223" longitude = "-122.389977" time_zone = "America/Los_Angeles" return f"https://api.sunrise-sunset.org/json?lat={latittude}&lng={longitude}&date=today&tzid={time...
SunResource
python
huggingface__transformers
tests/models/prophetnet/test_modeling_prophetnet.py
{ "start": 17190, "end": 26010 }
class ____: def __init__( self, parent, vocab_size=99, batch_size=13, hidden_size=16, encoder_seq_length=7, decoder_seq_length=7, # For common tests is_training=True, is_decoder=True, use_attention_mask=True, add_cross_a...
ProphetNetStandaloneDecoderModelTester
python
rapidsai__cudf
python/cudf/cudf/core/column/decimal.py
{ "start": 18809, "end": 24752 }
class ____(DecimalBaseColumn): _VALID_PLC_TYPES = {plc.TypeId.DECIMAL64} def __init__( self, plc_column: plc.Column, size: int, dtype: Decimal64Dtype, offset: int, null_count: int, exposed: bool, ) -> None: if not isinstance(dtype, Decimal64Dt...
Decimal64Column
python
openai__openai-python
src/openai/resources/beta/threads/messages.py
{ "start": 29640, "end": 30794 }
class ____: def __init__(self, messages: AsyncMessages) -> None: self._messages = messages self.create = ( # pyright: ignore[reportDeprecated] async_to_streamed_response_wrapper( messages.create, # pyright: ignore[reportDeprecated], ) ) self...
AsyncMessagesWithStreamingResponse
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/string_conversion.py
{ "start": 320, "end": 403 }
class ____: def __str__(self): return request.GET["tainted"]
StrIsTainted
python
streamlit__streamlit
lib/tests/streamlit/form_test.py
{ "start": 17556, "end": 18145 }
class ____(DeltaGeneratorTestCase): def test_exception_for_callbacks_on_widgets(self): with pytest.raises(StreamlitAPIException): with st.form("form"): st.radio("radio", ["a", "b", "c"], 0, on_change=lambda x: x) st.form_submit_button() def test_no_exception_...
FormStateInteractionTest
python
aimacode__aima-python
text.py
{ "start": 11838, "end": 14286 }
class ____: """This is a much harder problem than the shift decoder. There are 26! permutations, so we can't try them all. Instead we have to search. We want to search well, but there are many things to consider: Unigram probabilities (E is the most common letter); Bigram probabilities (TH is the mo...
PermutationDecoder
python
pandas-dev__pandas
pandas/tests/io/formats/test_to_html.py
{ "start": 14372, "end": 26547 }
class ____: @pytest.fixture def df(self): index = ["foo", "bar", "baz"] df = DataFrame( {"A": [1, 2, 3], "B": [1.2, 3.4, 5.6], "C": ["one", "two", np.nan]}, columns=["A", "B", "C"], index=index, ) return df @pytest.fixture def expected...
TestHTMLIndex
python
tensorflow__tensorflow
tensorflow/python/trackable/python_state_test.py
{ "start": 1065, "end": 3845 }
class ____(module.Module): """A checkpointable object whose NumPy array attributes are saved/restored. Example usage: ```python arrays = _NumpyState() checkpoint = tf.train.Checkpoint(numpy_arrays=arrays) arrays.x = numpy.zeros([3, 4]) save_path = checkpoint.save("/tmp/ckpt") arrays.x[1, 1] = 4. che...
_NumpyState
python
getsentry__sentry
tests/sentry/models/test_recentsearch.py
{ "start": 651, "end": 1561 }
class ____(TestCase): def test(self) -> None: with patch("sentry.models.recentsearch.MAX_RECENT_SEARCHES", new=1): RecentSearch.objects.create( organization=self.organization, user_id=self.user.id, type=0, query="hello", ...
RemoveExcessRecentSearchesTest
python
ansible__ansible
lib/ansible/_internal/_yaml/_loader.py
{ "start": 1886, "end": 2436 }
class ____(_YamlParser, AnsibleConstructor, Resolver): """Ansible loader which supports Ansible custom behavior such as `Origin` tagging, as well as Ansible-specific YAML tags.""" def __init__(self, stream: str | bytes | _io.IOBase) -> None: _YamlParser.__init__(self, stream) AnsibleConstructo...
AnsibleLoader
python
doocs__leetcode
solution/2700-2799/2751.Robot Collisions/Solution.py
{ "start": 0, "end": 1100 }
class ____: def survivedRobotsHealths( self, positions: List[int], healths: List[int], directions: str ) -> List[int]: n = len(positions) indices = list(range(n)) stack = [] indices.sort(key=lambda i: positions[i]) for currentIndex in indices: if dir...
Solution
python
allegroai__clearml
clearml/backend_api/services/v2_13/organization.py
{ "start": 2971, "end": 5225 }
class ____(Response): """ Response of organization.get_tags endpoint. :param tags: The list of unique tag values :type tags: Sequence[str] :param system_tags: The list of unique system tag values. Returned only if 'include_system' is set to 'true' in the request :type system_tags: Seque...
GetTagsResponse
python
kamyu104__LeetCode-Solutions
Python/maximize-value-of-function-in-a-ball-passing-game.py
{ "start": 100, "end": 2694 }
class ____(object): def getMaxFunctionValue(self, receiver, k): """ :type receiver: List[int] :type k: int :rtype: int """ def find_cycles(adj): result = [] lookup = [0]*len(adj) idx = 0 for u in xrange(len(adj)): ...
Solution
python
pytorch__pytorch
test/distributed/fsdp/test_fsdp_fine_tune.py
{ "start": 1324, "end": 1975 }
class ____(nn.Module): def __init__(self, freeze: bool): super().__init__() self.layer0 = LinearUnusedInput(4, 4) self.layer1_frozen = LinearUnusedInput(4, 4) if freeze: for param in self.layer1_frozen.parameters(): param.requires_grad = False self...
ModelUnusedInput
python
networkx__networkx
networkx/classes/tests/test_special.py
{ "start": 3739, "end": 3893 }
class ____(_TestMultiGraph): def setup_method(self): _TestMultiGraph.setup_method(self) self.Graph = nx.MultiGraph
TestSpecialMultiGraph
python
spack__spack
lib/spack/spack/traverse.py
{ "start": 3683, "end": 26643 }
class ____: """Visits all unique edges of the sub-DAG induced by direct dependencies of type ``direct`` and transitive dependencies of type ``transitive``. An example use for this is traversing build type dependencies non-recursively, and link dependencies recursively.""" def __init__( self, ...
MixedDepthVisitor
python
ansible__ansible
test/lib/ansible_test/_internal/ci/local.py
{ "start": 601, "end": 4196 }
class ____(CIProvider): """CI provider implementation when not using CI.""" priority = 1000 @staticmethod def is_supported() -> bool: """Return True if this provider is supported in the current running environment.""" return True @property def code(self) -> str: """Ret...
Local
python
matplotlib__matplotlib
lib/matplotlib/patches.py
{ "start": 52868, "end": 53670 }
class ____(RegularPolygon): """A polygon-approximation of a circle patch.""" def __str__(self): s = "CirclePolygon((%g, %g), radius=%g, resolution=%d)" return s % (self.xy[0], self.xy[1], self.radius, self.numvertices) @_docstring.interpd def __init__(self, xy, radius=5, *, ...
CirclePolygon
python
weaviate__weaviate-python-client
weaviate/exceptions.py
{ "start": 8525, "end": 8877 }
class ____(WeaviateBaseError): """Is raised when adding an invalid new property.""" def __init__(self, message: str): msg = f"""Could not add the property {message}. Only optional properties or properties with default value are valid""" super().__init__(msg) self.message = messa...
WeaviateAddInvalidPropertyError
python
getsentry__sentry
src/sentry/integrations/discord/webhooks/command.py
{ "start": 1914, "end": 2712 }
class ____(DiscordInteractionHandler): """ Handles logic for Discord Command interactions. Request passed in constructor must be command interaction. """ def handle(self) -> Response: command_name = self.request.get_command_name() cmd_input = CommandInput(command_name) disp...
DiscordCommandHandler
python
joke2k__faker
faker/providers/job/hr_HR/__init__.py
{ "start": 42, "end": 10150 }
class ____(BaseProvider): jobs = [ "Agent posredovanja u prometu nekretnina", "Alatničar", "Arhivist", "Arhivski savjetnik", "Arhivski tehničar", "Autoelektričar", "Autolakirer", "Autolimar", "Automehaničar", "Autoserviser", "Br...
Provider
python
spyder-ide__spyder
spyder/plugins/ipythonconsole/api.py
{ "start": 2226, "end": 2499 }
class ____: SpecialConsoles = 'special_consoles_submenu' Documentation = 'documentation_submenu' EnvironmentConsoles = 'environment_consoles_submenu' ClientContextMenu = 'client_context_menu' TabsContextMenu = 'tabs_context_menu'
IPythonConsoleWidgetMenus
python
huggingface__transformers
src/transformers/models/llama4/convert_llama4_weights_to_hf.py
{ "start": 29268, "end": 38893 }
class ____(TikTokenConverter): def __init__( self, vocab_file, special_tokens: list[str], pattern: str, model_max_length: int = 0, chat_template: Optional[str] = None, **kwargs, ): super().__init__(vocab_file, pattern=pattern) self.addition...
Llama4Converter
python
apache__airflow
providers/microsoft/azure/src/airflow/providers/microsoft/azure/hooks/container_instance.py
{ "start": 1465, "end": 7201 }
class ____(AzureBaseHook): """ A hook to communicate with Azure Container Instances. This hook requires a service principal in order to work. After creating this service principal (Azure Active Directory/App Registrations), you need to fill in the client_id (Application ID) as login, the genera...
AzureContainerInstanceHook
python
django__django
tests/migrations/test_migrations_noop/0001_initial.py
{ "start": 35, "end": 170 }
class ____(migrations.Migration): initial = True operations = [ migrations.RunSQL(sql="", reverse_sql=""), ]
Migration
python
kamyu104__LeetCode-Solutions
Python/binary-tree-inorder-traversal.py
{ "start": 29, "end": 182 }
class ____(object): def __init__(self, x): self.val = x self.left = None self.right = None # Morris Traversal Solution
TreeNode
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/postgresql/named_types.py
{ "start": 13378, "end": 13629 }
class ____(NamedTypeGenerator): def visit_DOMAIN(self, domain): if not self._can_create_type(domain): return with self.with_ddl_events(domain): self.connection.execute(CreateDomainType(domain))
DomainGenerator
python
huggingface__transformers
src/transformers/models/videomae/modeling_videomae.py
{ "start": 3406, "end": 4523 }
class ____(nn.Module): """ Construct the patch and position embeddings. """ def __init__(self, config): super().__init__() self.patch_embeddings = VideoMAEPatchEmbeddings(config) self.num_patches = self.patch_embeddings.num_patches # fixed sin-cos embedding sel...
VideoMAEEmbeddings
python
numpy__numpy
numpy/polynomial/tests/test_hermite_e.py
{ "start": 16726, "end": 17324 }
class ____: def test_100(self): x, w = herme.hermegauss(100) # test orthogonality. Note that the results need to be normalized, # otherwise the huge values that can arise from fast growing # functions like Laguerre can be very confusing. v = herme.hermevander(x, 99) ...
TestGauss
python
joke2k__faker
faker/providers/lorem/th_TH/__init__.py
{ "start": 68, "end": 7475 }
class ____(LoremProvider): """Implement lorem provider for ``th_TH`` locale. Word list is randomly drawn from the Thailand's Ministry of Education, removing compound words and long words, adding common words (like prepositions) and few of regional words. Sources: - http://www.arts.chula.ac.th...
Provider
python
apache__airflow
task-sdk/src/airflow/sdk/api/datamodels/_generated.py
{ "start": 9981, "end": 10365 }
class ____(BaseModel): """ Schema for writing the response part of a Human-in-the-loop detail for a specific task instance. """ ti_id: Annotated[UUID, Field(title="Ti Id")] chosen_options: Annotated[list[str], Field(min_length=1, title="Chosen Options")] params_input: Annotated[dict[str, Any] |...
UpdateHITLDetailPayload
python
spack__spack
lib/spack/spack/directives.py
{ "start": 33370, "end": 33472 }
class ____(DirectiveError): """Raised for errors with patching dependencies."""
DependencyPatchError
python
bokeh__bokeh
src/bokeh/models/tickers.py
{ "start": 2564, "end": 4896 }
class ____(Ticker): ''' Generate tick locations that are computed by a user-defined function. A ``CustomJSTicker`` may be used with either a continuous (numeric) axis, or a categorical axis. However, only basic, non-hierarchical categorical axes (i.e. with a single level of factors) are supported. ...
CustomJSTicker
python
django__django
tests/model_forms/models.py
{ "start": 2126, "end": 2190 }
class ____(Writer): score = models.IntegerField()
BetterWriter
python
has2k1__plotnine
plotnine/geoms/geom_polygon.py
{ "start": 500, "end": 4149 }
class ____(geom): """ Polygon, a filled path {usage} Parameters ---------- {common_parameters} Notes ----- All paths in the same `group` aesthetic value make up a polygon. """ DEFAULT_AES = { "alpha": 1, "color": None, "fill": "#333333", "l...
geom_polygon
python
apache__airflow
providers/common/sql/src/airflow/providers/common/sql/operators/sql.py
{ "start": 16266, "end": 26689 }
class ____(BaseSQLOperator): """ Performs one or more of the templated checks in the column_checks dictionary. Checks are performed on a per-column basis specified by the column_mapping. Each check can take one or more of the following options: * ``equal_to``: an exact value to equal, cannot be u...
SQLColumnCheckOperator
python
jazzband__django-redis
tests/test_backend.py
{ "start": 952, "end": 35733 }
class ____: def test_setnx(self, cache: RedisCache): # we should ensure there is no test_key_nx in redis cache.delete("test_key_nx") res = cache.get("test_key_nx") assert res is None res = cache.set("test_key_nx", 1, nx=True) assert bool(res) is True # test t...
TestDjangoRedisCache
python
cython__cython
Cython/Compiler/UtilNodes.py
{ "start": 1884, "end": 3354 }
class ____(Node): # THIS IS DEPRECATED, USE LetNode instead """ Creates a block which allocates temporary variables. This is used by transforms to output constructs that need to make use of a temporary variable. Simply pass the types of the needed temporaries to the constructor. The variab...
TempsBlockNode
python
run-llama__llama_index
llama-index-core/llama_index/core/instrumentation/events/embedding.py
{ "start": 1311, "end": 1687 }
class ____(BaseEvent): """ EmbeddingEndEvent. Args: chunks (List[str]): List of chunks. embeddings (List[List[float]]): List of embeddings. """ chunks: List[str] embeddings: List[Dict[int, float]] @classmethod def class_name(cls) -> str: """Class name.""" ...
SparseEmbeddingEndEvent
python
scrapy__scrapy
tests/AsyncCrawlerProcess/twisted_reactor_custom_settings_same.py
{ "start": 254, "end": 567 }
class ____(scrapy.Spider): name = "asyncio_reactor2" custom_settings = { "TWISTED_REACTOR": "twisted.internet.asyncioreactor.AsyncioSelectorReactor", } process = AsyncCrawlerProcess() process.crawl(AsyncioReactorSpider1) process.crawl(AsyncioReactorSpider2) process.start()
AsyncioReactorSpider2
python
tensorflow__tensorflow
tensorflow/tools/compatibility/ast_edits.py
{ "start": 5231, "end": 6628 }
class ____: """This class defines the transformations that need to happen. This class must provide the following fields: * `function_keyword_renames`: maps function names to a map of old -> new argument names * `symbol_renames`: maps function names to new function names * `change_to_function`: a set of ...
APIChangeSpec
python
Textualize__textual
docs/examples/widgets/option_list_options.py
{ "start": 147, "end": 1022 }
class ____(App[None]): CSS_PATH = "option_list.tcss" def compose(self) -> ComposeResult: yield Header() yield OptionList( Option("Aerilon", id="aer"), Option("Aquaria", id="aqu"), None, Option("Canceron", id="can"), Option("Caprica", i...
OptionListApp
python
pytorch__pytorch
test/functorch/test_ops.py
{ "start": 12940, "end": 126065 }
class ____(TestCase): @with_tf32_off # https://github.com/pytorch/pytorch/issues/86798 @ops(op_db + additional_op_db + autograd_function_db, allowed_dtypes=(torch.float,)) @skipOps( "TestOperators", "test_grad", vjp_fail.union( { xfail( ...
TestOperators
python
apache__airflow
devel-common/src/tests_common/test_utils/perf/perf_kit/memory.py
{ "start": 1234, "end": 2549 }
class ____: """Trace results of memory,.""" def __init__(self): self.before = 0 self.after = 0 self.value = 0 @contextmanager def trace_memory(human_readable=True, gc_collect=False): """ Decorate function and calculate the amount of difference in free memory before and after s...
TraceMemoryResult
python
tornadoweb__tornado
tornado/websocket.py
{ "start": 29029, "end": 51391 }
class ____(WebSocketProtocol): """Implementation of the WebSocket protocol from RFC 6455. This class supports versions 7 and 8 of the protocol in addition to the final version 13. """ # Bit masks for the first byte of a frame. FIN = 0x80 RSV1 = 0x40 RSV2 = 0x20 RSV3 = 0x10 RSV_...
WebSocketProtocol13
python
streamlit__streamlit
lib/streamlit/elements/widgets/checkbox.py
{ "start": 1830, "end": 13996 }
class ____: @gather_metrics("checkbox") def checkbox( self, label: str, value: bool = False, key: Key | None = None, help: str | None = None, on_change: WidgetCallback | None = None, args: WidgetArgs | None = None, kwargs: WidgetKwargs | None = Non...
CheckboxMixin
python
matplotlib__matplotlib
lib/matplotlib/backends/backend_pdf.py
{ "start": 13097, "end": 13571 }
class ____: """ PDF reference object. Use PdfFile.reserveObject() to create References. """ def __init__(self, id): self.id = id def __repr__(self): return "<Reference %d>" % self.id def pdfRepr(self): return b"%d 0 R" % self.id def write(self, contents, file...
Reference
python
sqlalchemy__sqlalchemy
test/orm/test_eager_relations.py
{ "start": 217238, "end": 218820 }
class ____(fixtures.DeclarativeMappedTest): """test for [ticket:3811] continuing on [ticket:3431]""" @classmethod def setup_classes(cls): Base = cls.DeclarativeBasic class A(Base): __tablename__ = "a" id = Column(Integer, primary_key=True) parent_id = C...
EntityViaMultiplePathTestThree
python
lxml__lxml
src/lxml/tests/dummy_http_server.py
{ "start": 1624, "end": 2162 }
class ____: def __init__(self, response_data, response_code=200, headers=()): self.requests = [] self.response_code = response_code self.response_data = response_data self.headers = list(headers or ()) def __call__(self, environ, start_response): self.requests.append(( ...
HTTPRequestCollector
python
pytorch__pytorch
tools/lldb/pytorch_lldb.py
{ "start": 271, "end": 3443 }
class ____: """ Context-manager to temporarily disable all lldb breakpoints, useful if there is a risk to hit one during the evaluation of one of our custom commands """ def __enter__(self) -> None: target = get_target() if target.DisableAllBreakpoints() is False: p...
DisableBreakpoints
python
numpy__numpy
numpy/_core/tests/test_multiarray.py
{ "start": 387792, "end": 388795 }
class ____: forbidden_types = [ # The builtin scalar super types: np.generic, np.flexible, np.number, np.inexact, np.floating, np.complexfloating, np.integer, np.unsignedinteger, np.signedinteger, # character is a deprecated S1 special case: np.character, ] d...
TestDTypeCoercionForbidden
python
joke2k__faker
tests/providers/test_address.py
{ "start": 90435, "end": 93806 }
class ____: """Test hu_HU address provider methods""" def test_administrative_unit(self, faker, num_samples): for _ in range(num_samples): administrative_unit = faker.administrative_unit() assert isinstance(administrative_unit, str) assert administrative_unit in HuHu...
TestHuHu
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/dagster_types.py
{ "start": 2933, "end": 3639 }
class ____(graphene.Interface): key = graphene.NonNull(graphene.String) name = graphene.String() display_name = graphene.NonNull(graphene.String) description = graphene.String() is_nullable = graphene.NonNull(graphene.Boolean) is_list = graphene.NonNull(graphene.Boolean) is_builtin = graphe...
GrapheneDagsterType
python
huggingface__transformers
src/transformers/models/d_fine/modeling_d_fine.py
{ "start": 75642, "end": 84016 }
class ____(DFinePreTrainedModel): # When using clones, all layers > 0 will be clones, but layer 0 *is* required # We can't initialize the model on meta device as some weights are modified during the initialization _no_split_modules = None _tied_weights_keys = { r"bbox_embed.(?![0])\d+": "bbox_em...
DFineForObjectDetection
python
pydantic__pydantic
pydantic-core/tests/serializers/test_dataclasses.py
{ "start": 390, "end": 9554 }
class ____: a: str b: bytes def test_dataclass(): schema = core_schema.dataclass_schema( Foo, core_schema.dataclass_args_schema( 'Foo', [ core_schema.dataclass_field(name='a', schema=core_schema.str_schema()), core_schema.dataclass_fi...
Foo
python
pytorch__pytorch
test/quantization/core/test_quantized_op.py
{ "start": 368650, "end": 389770 }
class ____(TestCase): """Tests the correctness of the quantized::qnnpack_relu op.""" @given(X=hu.tensor(shapes=hu.array_shapes(1, 5, 1, 5), qparams=hu.qparams(dtypes=torch.quint8, zero_point_min=0, zero_po...
TestQNNPackOps
python
scipy__scipy
benchmarks/benchmarks/go_benchmark_functions/go_funcs_S.py
{ "start": 38092, "end": 39442 }
class ____(Benchmark): r""" StretchedV objective function. This class defines the Stretched V [1]_ global optimization problem. This is a multimodal minimization problem defined as follows: .. math:: f_{\text{StretchedV}}(x) = \sum_{i=1}^{n-1} t^{1/4} [...
StretchedV
python
TheAlgorithms__Python
graphs/bidirectional_breadth_first_search.py
{ "start": 753, "end": 3315 }
class ____: """ # Comment out slow pytests... # 9.15s call graphs/bidirectional_breadth_first_search.py:: \ # graphs.bidirectional_breadth_first_search.BreadthFirstSearch # >>> bfs = BreadthFirstSearch((0, 0), (len(grid) - 1, len(grid[0]) - 1)) # >>> (bfs.start.pos_y + delta[3...
BreadthFirstSearch
python
celery__celery
t/unit/worker/test_control.py
{ "start": 1501, "end": 1985 }
class ____: def test_shutdown(self): with patch('celery.worker.pidbox.ignore_errors') as eig: parent = Mock() pbox = Pidbox(parent) pbox._close_channel = Mock() assert pbox.c is parent pconsumer = pbox.consumer = Mock() cancel = pconsu...
test_Pidbox
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_bugbear/B021.py
{ "start": 372, "end": 487 }
class ____: f"""hello {VARIABLE}!""" def foo1(): "hello world!" def foo2(): f"hello {VARIABLE}!"
bar2
python
great-expectations__great_expectations
great_expectations/expectations/core/expect_column_mean_to_be_between.py
{ "start": 2761, "end": 16692 }
class ____(ColumnAggregateExpectation): __doc__ = f"""{EXPECTATION_SHORT_DESCRIPTION} ExpectColumnMeanToBeBetween is a \ Column Aggregate Expectation. Column Aggregate Expectations are one of the most common types of Expectation. They are evaluated for a single column, and produce an aggregate Met...
ExpectColumnMeanToBeBetween
python
PrefectHQ__prefect
src/integrations/prefect-dbt/prefect_dbt/cli/configs/base.py
{ "start": 319, "end": 4028 }
class ____(Block, abc.ABC): """ Abstract class for other dbt Configs. Attributes: extras: Extra target configs' keywords, not yet exposed in prefect-dbt, but available in dbt; if there are duplicate keys between extras and TargetConfigs, an error will be raised. ...
DbtConfigs
python
kamyu104__LeetCode-Solutions
Python/minimize-max-distance-to-gas-station.py
{ "start": 47, "end": 593 }
class ____(object): def minmaxGasDist(self, stations, K): """ :type stations: List[int] :type K: int :rtype: float """ def check(x): return sum(int(math.ceil((stations[i+1]-stations[i])/x))-1 for i in xrange(len(stations)-1)) <= K left, right = 0,...
Solution
python
tensorflow__tensorflow
tensorflow/core/function/integration_test/side_inputs_manual_api_test.py
{ "start": 912, "end": 6933 }
class ____(parameterized.TestCase): @unittest.skip("Feature not implemented") @parameterized.parameters( (1, tf.constant, 2, tf.constant), (1.0, tf.constant, 2.0, tf.constant), (1, int, 2, int), (1.0, float, 2.0, float), (1, int, 2, tf.constant), (1, tf.constant, 2, int)) def ...
SideInputsTest
python
sqlalchemy__sqlalchemy
test/engine/test_reflection.py
{ "start": 68748, "end": 73997 }
class ____(fixtures.RemovesEvents, fixtures.TablesTest): __sparse_driver_backend__ = True @classmethod def define_tables(cls, metadata): to_reflect = Table( "to_reflect", metadata, Column("x", sa.Integer, primary_key=True, autoincrement=False), Column...
ColumnEventsTest
python
has2k1__plotnine
plotnine/geoms/geom_bin_2d.py
{ "start": 77, "end": 662 }
class ____(geom_rect): """ Heatmap of 2d bin counts {usage} Divides the plane into rectangles, counts the number of cases in each rectangle, and then (by default) maps the number of cases to the rectangle's fill. This is a useful alternative to geom_point in the presence of overplotting. ...
geom_bin_2d
python
arrow-py__arrow
tests/test_arrow.py
{ "start": 20589, "end": 22674 }
class ____: def test_not_attr(self): with pytest.raises(ValueError): arrow.Arrow.utcnow().replace(abc=1) def test_replace(self): arw = arrow.Arrow(2013, 5, 5, 12, 30, 45) assert arw.replace(year=2012) == arrow.Arrow(2012, 5, 5, 12, 30, 45) assert arw.replace(month=1...
TestArrowReplace
python
ray-project__ray
python/ray/data/tests/test_partitioning.py
{ "start": 12345, "end": 37807 }
class ____: def test_read_single_file(self, tmp_path, block_type, ray_start_regular_shared): path = os.path.join(tmp_path, "1970", "fr", "data.csv") write_csv({"number": [1, 2, 3]}, path) ds = read_csv( path, partitioning=Partitioning( "dir", field_na...
TestReadDirPartitionedFiles
python
apache__airflow
providers/standard/tests/unit/standard/operators/test_python.py
{ "start": 81695, "end": 82556 }
class ____(BaseTestBranchPythonVirtualenvOperator): opcls = BranchPythonVirtualenvOperator @staticmethod def default_kwargs(*, python_version=DEFAULT_PYTHON_VERSION, **kwargs): if "do_not_use_caching" in kwargs: kwargs.pop("do_not_use_caching") else: # Caching by def...
TestBranchPythonVirtualenvOperator
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 27468, "end": 27676 }
class ____(sgqlc.types.Enum): """ See source code for more info. """ __schema__ = graphql_schema __choices__ = ("APPROVED", "CHANGES_REQUESTED", "REVIEW_REQUIRED")
PullRequestReviewDecision
python
walkccc__LeetCode
solutions/1745. Palindrome Partitioning IV/1745-2.py
{ "start": 0, "end": 528 }
class ____: def checkPartitioning(self, s: str) -> bool: n = len(s) # dp[i][j] := true if s[i..j] is a palindrome dp = [[False] * (n + 1) for _ in range(n + 1)] for i in range(n): dp[i][i] = True for d in range(1, n): for i in range(n - d): j = i + d if s[i] == s[j]: ...
Solution
python
ray-project__ray
python/ray/dashboard/modules/log/log_manager.py
{ "start": 1298, "end": 17162 }
class ____: def __init__(self, data_source_client: StateDataSourceClient): self.client = data_source_client @property def data_source_client(self) -> StateDataSourceClient: return self.client async def ip_to_node_id(self, node_ip: Optional[str]) -> Optional[str]: """Resolve the...
LogsManager
python
tensorflow__tensorflow
tensorflow/python/eager/polymorphic_function/polymorphic_function_test_cpu_only.py
{ "start": 995, "end": 1715 }
class ____(test.TestCase, parameterized.TestCase): """Test that jit_compile=True correctly throws an exception if XLA is not available. This test should only be run without `--config=cuda`, as that implicitly links in XLA JIT. """ def testJitCompileRaisesExceptionWhenXlaIsUnsupported(self): if test.is_b...
FunctionCpuOnlyTest
python
pytorch__pytorch
test/quantization/fx/test_quantize_fx.py
{ "start": 31701, "end": 275505 }
class ____(QuantizationTestCase): def test_pattern_match(self): """ test MatchAllNode with conv - bn - add - relu pattern """ class M(torch.nn.Module): def __init__(self) -> None: super().__init__() self.conv = nn.Conv2d(1, 1, 1) ...
TestQuantizeFx
python
lepture__authlib
authlib/oauth1/rfc5849/models.py
{ "start": 2904, "end": 3418 }
class ____(dict, TemporaryCredentialMixin): def get_client_id(self): return self.get("client_id") def get_user_id(self): return self.get("user_id") def get_redirect_uri(self): return self.get("oauth_callback") def check_verifier(self, verifier): return self.get("oauth_...
TemporaryCredential
python
explosion__spaCy
spacy/ty.py
{ "start": 918, "end": 1297 }
class ____(Protocol): model: Any listeners: Sequence[Model] listener_map: Dict[str, Sequence[Model]] listening_components: List[str] def add_listener(self, listener: Model, component_name: str) -> None: ... def remove_listener(self, listener: Model, component_name: str) -> bool: ... def f...
ListenedToComponent
python
dagster-io__dagster
scripts/gen_airbyte_classes.py
{ "start": 5410, "end": 21160 }
class ____(SchemaType): def __init__(self, inner: Sequence[SchemaType]): self.inner = inner def __str__(self): return f"Union[{', '.join([str(x) for x in self.inner])}]" def annotation( self, scope: Optional[str] = None, quote: bool = False, hide_default: bool = False ): ...
UnionType
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/linalg/linear_operator_full_matrix_test.py
{ "start": 4930, "end": 8517 }
class ____( linear_operator_test_util.SquareLinearOperatorDerivedClassTest): """Most tests done in the base class LinearOperatorDerivedClassTest. In this test, the operator is constructed with hints that invoke the use of a Cholesky decomposition for solves/determinant. """ def setUp(self): # Increa...
SquareLinearOperatorFullMatrixSymmetricPositiveDefiniteTest
python
bottlepy__bottle
bottle.py
{ "start": 7809, "end": 7914 }
class ____(BottleException): """ This is a base class for all routing related exceptions """
RouteError
python
Textualize__textual
tests/tree/test_tree_clearing.py
{ "start": 206, "end": 245 }
class ____(VerseBody): pass
VerseStar
python
astral-sh__uv
scripts/benchmark/src/benchmark/__init__.py
{ "start": 47, "end": 286 }
class ____(typing.NamedTuple): name: str """The name of the command to benchmark.""" prepare: str | None """The command to run before each benchmark run.""" command: list[str] """The command to benchmark."""
Command
python
getsentry__sentry
src/sentry/overwatch_webhooks/types.py
{ "start": 426, "end": 1136 }
class ____: name: str slug: str id: int region: str github_integration_id: int organization_integration_id: int @classmethod def from_organization_mapping_and_integration( cls, organization_mapping: OrganizationMapping, org_integration: OrganizationIntegration ) -> Organizat...
OrganizationSummary
python
PrefectHQ__prefect
tests/server/orchestration/api/test_validation.py
{ "start": 10079, "end": 14744 }
class ____: async def make_deployment_schema( self, flow_id: UUID, schema_cls: Union[Type[DeploymentCreate], Type[DeploymentUpdate]], ): if schema_cls == DeploymentCreate: params = { "flow_id": flow_id, "name": "test-deployment-2", ...
TestDeploymentValidation
python
pytorch__pytorch
torch/_inductor/fx_passes/group_batch_fusion.py
{ "start": 11532, "end": 14912 }
class ____(GroupFusion): def _addmm_node_can_be_fused(self, node: torch.fx.Node): input_shape = node.args[1].meta["val"].shape # type: ignore[union-attr] weight_shape = node.args[2].meta["val"].shape # type: ignore[union-attr] return ( node.kwargs.get("beta", DEFAULT_BETA) == D...
GroupLinearFusion
python
redis__redis-py
redis/event.py
{ "start": 12099, "end": 14140 }
class ____(EventListenerInterface): def __init__(self): self._connection = None self._connection_pool = None self._client_type = None self._connection_lock = None self._event = None def listen(self, event: AfterPubSubConnectionInstantiationEvent): if isinstance( ...
RegisterReAuthForPubSub
python
doocs__leetcode
solution/1200-1299/1237.Find Positive Integer Solution for a Given Equation/Solution.py
{ "start": 110, "end": 349 }
class ____: # Returns f(x, y) for any given positive integers x and y. # Note that f(x, y) is increasing with respect to both x and y. # i.e. f(x, y) < f(x + 1, y), f(x, y) < f(x, y + 1) def f(self, x, y): """
CustomFunction
python
dagster-io__dagster
python_modules/libraries/dagster-tableau/dagster_tableau/components/tableau_component.py
{ "start": 4722, "end": 19619 }
class ____(StateBackedComponent, Resolvable): """Pulls in the contents of a Tableau workspace into Dagster assets. Example: .. code-block:: yaml # defs.yaml type: dagster_tableau.TableauComponent attributes: workspace: type: cloud ...
TableauComponent
python
numpy__numpy
numpy/_core/tests/test_dtype.py
{ "start": 64374, "end": 65721 }
class ____: def test_simple(self): class dt: dtype = np.dtype("f8") assert np.dtype(dt) == np.float64 assert np.dtype(dt()) == np.float64 def test_recursive(self): # This used to recurse. It now doesn't, we enforce the # dtype attribute to be a dtype (and wi...
TestFromDTypeAttribute
python
PyCQA__pylint
tests/functional/s/super/super_with_arguments.py
{ "start": 22, "end": 126 }
class ____(Foo): def __init__(self): super(Bar, self).__init__() # [super-with-arguments]
Bar
python
giampaolo__psutil
tests/test_contracts.py
{ "start": 12214, "end": 12532 }
class ____(PsutilTestCase): @pytest.mark.skipif(not POSIX, reason="not POSIX") def test_negative_signal(self): p = psutil.Process(self.spawn_subproc().pid) p.terminate() code = p.wait() assert code == -signal.SIGTERM assert isinstance(code, enum.IntEnum)
TestProcessWaitType
python
weaviate__weaviate-python-client
weaviate/collections/classes/config_vector_index.py
{ "start": 4317, "end": 4525 }
class ____(_VectorIndexConfigUpdate): vectorCacheMaxObjects: Optional[int] @staticmethod def vector_index_type() -> VectorIndexType: return VectorIndexType.FLAT
_VectorIndexConfigFlatUpdate
python
zarr-developers__zarr-python
src/zarr/core/dtype/npy/int.py
{ "start": 37008, "end": 42070 }
class ____(BaseInt[np.dtypes.Int64DType, np.int64], HasEndianness): """ A Zarr data type for arrays containing 64-bit signed integers. Wraps the [`np.dtypes.Int64DType`][numpy.dtypes.Int64DType] data type. Scalars for this data type are instances of [`np.int64`][numpy.int64]. Attributes ------...
Int64