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
huggingface__transformers
src/transformers/models/clvp/modeling_clvp.py
{ "start": 25837, "end": 26538 }
class ____(nn.Module): def __init__(self, intermediate_size, config): super().__init__() embed_dim = config.hidden_size self.c_fc = Conv1D(intermediate_size, embed_dim) self.c_proj = Conv1D(embed_dim, intermediate_size) self.act = ACT2FN[config.activation_function] se...
ClvpDecoderMLP
python
doocs__leetcode
solution/1100-1199/1103.Distribute Candies to People/Solution.py
{ "start": 0, "end": 297 }
class ____: def distributeCandies(self, candies: int, num_people: int) -> List[int]: ans = [0] * num_people i = 0 while candies: ans[i % num_people] += min(candies, i + 1) candies -= min(candies, i + 1) i += 1 return ans
Solution
python
anthropics__anthropic-sdk-python
src/anthropic/types/base64_image_source_param.py
{ "start": 372, "end": 725 }
class ____(TypedDict, total=False): data: Required[Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]] media_type: Required[Literal["image/jpeg", "image/png", "image/gif", "image/webp"]] type: Required[Literal["base64"]] set_pydantic_config(Base64ImageSourceParam, {"arbitrary_types_al...
Base64ImageSourceParam
python
facebook__pyre-check
client/commands/tests/infer_test.py
{ "start": 14390, "end": 14488 }
class ____: path: str infer_output: infer.RawInferOutputForPath
ExpectedModuleAnnotationItem
python
tensorflow__tensorflow
tensorflow/python/distribute/parameter_server_strategy_v2.py
{ "start": 26179, "end": 45492 }
class ____( parameter_server_strategy.ParameterServerStrategyExtended ): """Extended class for ParameterServerStrategyV2. Please see `tf.distribute.StrategyExtended` doc for more information. """ def __init__( self, container_strategy, cluster_resolver: base_cluster_resolver.ClusterResol...
ParameterServerStrategyV2Extended
python
huggingface__transformers
src/transformers/models/wavlm/modeling_wavlm.py
{ "start": 31162, "end": 32588 }
class ____(nn.Module): """Construct the features from raw audio waveform""" def __init__(self, config): super().__init__() if config.feat_extract_norm == "group": conv_layers = [WavLMGroupNormConvLayer(config, layer_id=0)] + [ WavLMNoLayerNormConvLayer(config, layer...
WavLMFeatureEncoder
python
celery__celery
t/integration/test_canvas.py
{ "start": 6949, "end": 42946 }
class ____: @flaky def test_simple_chain(self, manager): c = add.s(4, 4) | add.s(8) | add.s(16) assert c().get(timeout=TIMEOUT) == 32 @flaky def test_single_chain(self, manager): c = chain(add.s(3, 4))() assert c.get(timeout=TIMEOUT) == 7 @flaky def test_comple...
test_chain
python
huggingface__transformers
src/transformers/models/seamless_m4t/configuration_seamless_m4t.py
{ "start": 788, "end": 23521 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`~SeamlessM4TModel`]. It is used to instantiate an SeamlessM4T model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a sim...
SeamlessM4TConfig
python
pytest-dev__pytest
src/_pytest/outcomes.py
{ "start": 2367, "end": 3037 }
class ____: """Exit testing process. :param reason: The message to show as the reason for exiting pytest. reason has a default value only because `msg` is deprecated. :param returncode: Return code to be used when exiting pytest. None means the same as ``0`` (no error), sa...
_Exit
python
pypa__warehouse
tests/functional/manage/test_project_publishing.py
{ "start": 454, "end": 6530 }
class ____: @responses.activate def test_add_github_publisher_to_existing_project(self, webtest): """ An authenticated user with project ownership can add a GitHub trusted publisher to their existing project. """ # Arrange: Create a user with a project user = User...
TestManageProjectPublishing
python
pytorch__pytorch
torch/_functorch/partitioners.py
{ "start": 5129, "end": 118120 }
class ____: def __repr__(self): return "Invalid Node" InvalidNode = InvalidNodeBase() def _extract_graph_with_inputs_outputs( joint_graph: fx.Graph, inputs: list[fx.Node], outputs: list[fx.Node], outputs_descs: list[AOTOutput], subgraph: Optional[str] = None, ignore_must_be_in_fw...
InvalidNodeBase
python
pytorch__pytorch
torch/distributed/elastic/rendezvous/dynamic_rendezvous.py
{ "start": 32956, "end": 33321 }
class ____: """Represent a rendezvous keep-alive update operation.""" def __call__(self, ctx: _RendezvousContext, deadline: float) -> _Action: if _should_keep_alive(ctx): if time.monotonic() > deadline: return _Action.ERROR_TIMEOUT return _Action.KEEP_ALIVE ...
_RendezvousKeepAliveOp
python
tensorflow__tensorflow
tensorflow/lite/python/analyzer_test.py
{ "start": 1076, "end": 8095 }
class ____(test_util.TensorFlowTestCase): def testTxt(self): model_path = resource_loader.get_path_to_datafile('../testdata/add.bin') mock_stdout = io.StringIO() with test.mock.patch.object(sys, 'stdout', mock_stdout): analyzer.ModelAnalyzer.analyze(model_path=model_path) txt = mock_stdout.getv...
AnalyzerTest
python
more-itertools__more-itertools
tests/test_more.py
{ "start": 204625, "end": 206405 }
class ____(TestCase): def test_no_iterables(self): self.assertEqual(tuple(mi.partial_product()), ((),)) def test_empty_iterable(self): self.assertEqual(tuple(mi.partial_product('AB', '', 'CD')), ()) def test_one_iterable(self): # a single iterable should pass through self.a...
PartialProductTests
python
pydantic__pydantic
pydantic/functional_validators.py
{ "start": 19218, "end": 19777 }
class ____(Protocol[_ModelType]): """A `@model_validator` decorated function signature. This is used when `mode='wrap'` and the function does not have info argument. """ def __call__( # noqa: D102 self, cls: type[_ModelType], # this can be a dict, a model instance # or ...
ModelWrapValidatorWithoutInfo
python
django__django
tests/validation/test_unique.py
{ "start": 409, "end": 3793 }
class ____(unittest.TestCase): def test_unique_fields_get_collected(self): m = UniqueFieldsModel() self.assertEqual( ( [ (UniqueFieldsModel, ("id",)), (UniqueFieldsModel, ("unique_charfield",)), (UniqueFieldsMode...
GetUniqueCheckTests
python
Textualize__textual
src/textual/widgets/_tree.py
{ "start": 2674, "end": 15496 }
class ____(Generic[TreeDataType]): """An object that represents a "node" in a tree control.""" def __init__( self, tree: Tree[TreeDataType], parent: TreeNode[TreeDataType] | None, id: NodeID, label: Text, data: TreeDataType | None = None, *, expan...
TreeNode
python
pypa__warehouse
tests/unit/accounts/test_models.py
{ "start": 9931, "end": 10285 }
class ____: def test_repr(self, db_session): unique_login = UserUniqueLoginFactory.create() assert ( repr(unique_login) == f"<UserUniqueLogin(user={unique_login.user.username!r}, " f"ip_address={unique_login.ip_address!r}, " f"status={unique_login.stat...
TestUserUniqueLogin
python
getsentry__sentry
tests/sentry/dashboards/endpoints/test_organization_dashboard_details.py
{ "start": 165408, "end": 165648 }
class ____( OrganizationDashboardDetailsOnDemandTest ): # Re-run the on-demand tests with the transaction-like widget type widget_type = DashboardWidgetTypes.TRANSACTION_LIKE
OrganizationDashboardDetailsOnDemandTransactionLikeTest
python
coleifer__peewee
tests/cockroachdb.py
{ "start": 618, "end": 689 }
class ____(TestModel): id = UUIDKeyField() title = TextField()
UID
python
gevent__gevent
src/gevent/events.py
{ "start": 7849, "end": 8317 }
class ____(object): def __init__(self, mem_usage, max_allowed, memory_info): self.mem_usage = mem_usage self.max_allowed = max_allowed self.memory_info = memory_info def __repr__(self): return "<%s used=%d max=%d details=%r>" % ( self.__class__.__name__, ...
_AbstractMemoryEvent
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 629103, "end": 629428 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("cursor", "node") cursor = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="cursor") node = sgqlc.types.Field("SponsorableItem", graphql_name="node")
SponsorableItemEdge
python
sympy__sympy
sympy/core/function.py
{ "start": 27393, "end": 27619 }
class ____(Function): """Base class for defined functions like ``sin``, ``cos``, ...""" @cacheit def __new__(cls, *args, **options) -> Expr: # type: ignore return cls._new_(*args, **options)
DefinedFunction
python
neetcode-gh__leetcode
python/0097-interleaving-string.py
{ "start": 0, "end": 576 }
class ____: def isInterleave(self, s1: str, s2: str, s3: str) -> bool: if len(s1) + len(s2) != len(s3): return False dp = [[False] * (len(s2) + 1) for i in range(len(s1) + 1)] dp[len(s1)][len(s2)] = True for i in range(len(s1), -1, -1): for j in range(len(s2...
Solution
python
simplejson__simplejson
simplejson/tests/test_namedtuple.py
{ "start": 1167, "end": 5896 }
class ____(unittest.TestCase): def test_namedtuple_dumps(self): for v in [Value(1), Point(1, 2), DuckValue(1), DuckPoint(1, 2)]: d = v._asdict() self.assertEqual(d, json.loads(json.dumps(v))) self.assertEqual( d, json.loads(json.dumps(v, na...
TestNamedTuple
python
django-debug-toolbar__django-debug-toolbar
tests/test_decorators.py
{ "start": 571, "end": 1718 }
class ____(TestCase): """ Tests require_toolbar functionality and async compatibility. """ def setUp(self): self.factory = RequestFactory() self.async_factory = AsyncRequestFactory() @override_settings(DEBUG=True) def test_require_toolbar_debug_true(self): response = st...
TestRequireToolbar
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/filters/base.py
{ "start": 5230, "end": 5541 }
class ____(Filter): """ Negation of another filter. """ def __init__(self, filter: Filter) -> None: super().__init__() self.filter = filter def __call__(self) -> bool: return not self.filter() def __repr__(self) -> str: return f"~{self.filter!r}"
_Invert
python
pytorch__pytorch
torch/export/decomp_utils.py
{ "start": 854, "end": 5753 }
class ____(dict[torch._ops.OperatorBase, Callable]): """ This is a custom dictionary that is specifically used for handling decomp_table in export. The reason we need this is because in the new world, you can only *delete* an op from decomp table to preserve it. This is problematic for custom ops becaus...
CustomDecompTable
python
walkccc__LeetCode
solutions/432. All O`one Data Structure/432.py
{ "start": 47, "end": 425 }
class ____: def __init__(self, count: int, key: str | None = None): self.count = count self.keys: set[str] = {key} if key else set() self.prev: Node | None = None self.next: Node | None = None def __eq__(self, other) -> bool: if not isinstance(other, Node): return NotImplemented retur...
Node
python
huggingface__transformers
src/transformers/models/qwen2_vl/modeling_qwen2_vl.py
{ "start": 29102, "end": 29572 }
class ____(PreTrainedModel): config: Qwen2VLConfig base_model_prefix = "model" input_modalities = ("image", "video", "text") supports_gradient_checkpointing = True _no_split_modules = ["Qwen2VLDecoderLayer", "Qwen2VLVisionBlock"] _skip_keys_device_placement = "past_key_values" _supports_flas...
Qwen2VLPreTrainedModel
python
dask__distributed
distributed/tests/test_gc.py
{ "start": 305, "end": 4588 }
class ____: """ A mock timer producing random (but monotonic) values. """ def __init__(self): self.last = 0.0 self.timings = [] self.durations = ([], []) self.i_durations = itertools.cycle((0, 1)) self.random = random.Random(42) def __call__(self): d...
RandomTimer
python
astropy__astropy
astropy/io/votable/exceptions.py
{ "start": 42168, "end": 42649 }
class ____(VOWarning, ValueError): """ From VOTable 1.1 and later, ``FIELD`` and ``PARAM`` elements must have a ``datatype`` field. **References**: `1.1 <http://www.ivoa.net/documents/VOTable/20040811/REC-VOTable-1.1-20040811.html#elem:FIELD>`__, `1.2 <http://www.ivoa.net/documents/VOTable/...
E10
python
scikit-learn__scikit-learn
sklearn/tests/metadata_routing_common.py
{ "start": 4779, "end": 5240 }
class ____(list): # This list is used to get a reference to the sub-estimators, which are not # necessarily stored on the metaestimator. We need to override __deepcopy__ # because the sub-estimators are probably cloned, which would result in a # new copy of the list, but we need copy and deep copy both ...
_Registry
python
modin-project__modin
asv_bench/benchmarks/io/parquet.py
{ "start": 923, "end": 1776 }
class ____: shapes = get_benchmark_shapes("TimeReadParquet") data_type = "str_int" param_names = ["shape"] params = [ shapes, ] # test data file should be created only once def setup_cache(self, test_filename="io_test_file"): test_filenames = prepare_io_data_parquet( ...
TimeReadParquet
python
bokeh__bokeh
src/bokeh/document/events.py
{ "start": 4847, "end": 4960 }
class ____: def _session_callback_added(self, event: SessionCallbackAdded) -> None: ...
SessionCallbackAddedMixin
python
coleifer__peewee
tests/fields.py
{ "start": 1362, "end": 1614 }
class ____(TestModel): F_STICKY = 1 F_FAVORITE = 2 F_MINIMIZED = 4 flags = BitField() is_sticky = flags.flag(F_STICKY) is_favorite = flags.flag(F_FAVORITE) is_minimized = flags.flag(F_MINIMIZED) data = BigBitField()
Bits
python
PrefectHQ__prefect
src/prefect/server/orchestration/core_policy.py
{ "start": 57673, "end": 59528 }
class ____(GenericOrchestrationRule): """ Prevents transitions to PENDING. This rule is only used for flow runs. This is intended to prevent race conditions during duplicate submissions of runs. Before a run is submitted to its execution environment, it should be placed in a PENDING state. If ...
PreventPendingTransitions
python
ray-project__ray
python/ray/llm/tests/serve/gpu/deployments/llm/prefill_decode_disagg/test_prefill_decode_disagg_gpu.py
{ "start": 225, "end": 1267 }
class ____: """Test vLLM engine under PD disagg.""" @pytest.mark.asyncio @pytest.mark.parametrize("kv_connector", ["NixlConnector", "LMCacheConnectorV1"]) async def test_pd_disagg_vllm_engine( self, # llm_config is a fixture defined in serve.tests.conftest.py llm_config: LLMConf...
TestPDDisaggVLLMEngine
python
run-llama__llama_index
llama-index-integrations/llms/llama-index-llms-ollama/llama_index/llms/ollama/base.py
{ "start": 2059, "end": 29842 }
class ____(FunctionCallingLLM): """ Ollama LLM. Visit https://ollama.com/ to download and install Ollama. Run `ollama serve` to start a server. Run `ollama pull <name>` to download a model to run. Examples: `pip install llama-index-llms-ollama` ```python from llama_i...
Ollama
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/methodOverride6.py
{ "start": 721, "end": 929 }
class ____(Parent1[str]): @overload def m1(self, x: bool) -> int: ... @overload def m1(self, x: str) -> str: ... def m1(self, x: bool | str) -> int | float | str: return x
Child1_3
python
scrapy__scrapy
tests/test_crawler.py
{ "start": 35544, "end": 36908 }
class ____(TestCrawlerProcessSubprocessBase): @property def script_dir(self) -> Path: return self.get_script_dir("AsyncCrawlerProcess") def test_twisted_reactor_custom_settings_select(self): log = self.run_script("twisted_reactor_custom_settings_select.py") assert "Spider closed (fi...
TestAsyncCrawlerProcessSubprocess
python
streamlit__streamlit
lib/tests/streamlit/elements/exception_test.py
{ "start": 12056, "end": 12655 }
class ____(unittest.TestCase): @parameterized.expand( [ (["a", "b", "c", "-", "d", "e"], 3), (["-", "a", "b", "c", "d", "e"], 0), (["a", "b", "c", "d", "e", "-"], 5), (["a", "b", "c", "d", "e", "f"], 100), (["a", "-", "c", "d", "-", "f"], 1), ...
SplitListTest
python
cython__cython
Cython/Compiler/ExprNodes.py
{ "start": 618707, "end": 619076 }
class ____(ExprNode): # Simple returns the module object type = py_object_type is_temp = False subexprs = [] def analyse_types(self, env): return self def may_be_none(self): return False def calculate_result_code(self): return Naming.module_cname def generate...
ModuleRefNode
python
tensorflow__tensorflow
tensorflow/python/distribute/distribute_coordinator.py
{ "start": 2131, "end": 3336 }
class ____(object): """A reusable barrier class for worker synchronization.""" def __init__(self, num_participants): """Initializes the barrier object. Args: num_participants: an integer which is the expected number of calls of `wait` pass to through this barrier. """ self._num_parti...
_Barrier
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/protocol6.py
{ "start": 538, "end": 602 }
class ____: species: str attributes: list[bytes]
Armadillo
python
plotly__plotly.py
plotly/graph_objs/parcats/_labelfont.py
{ "start": 233, "end": 9886 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "parcats" _path_str = "parcats.labelfont" _valid_props = { "color", "family", "lineposition", "shadow", "size", "style", "textcase", "variant", "weight", } @property d...
Labelfont
python
PrefectHQ__prefect
tests/server/models/test_block_documents.py
{ "start": 59698, "end": 67867 }
class ____: @pytest.fixture() async def secret_block_type_and_schema(self, session): class SecretBlockC(Block): w: SecretDict x: SecretStr y: SecretBytes z: str secret_block_type = await models.block_types.create_block_type( session=se...
TestSecretBlockDocuments
python
readthedocs__readthedocs.org
readthedocs/projects/querysets.py
{ "start": 6600, "end": 6690 }
class ____(SettingsOverrideObject): _default_class = ProjectQuerySetBase
ProjectQuerySet
python
pytorch__pytorch
torch/_inductor/ops_handler.py
{ "start": 26139, "end": 27485 }
class ____: @staticmethod def add(a, b): return f"{a} + {b}" @staticmethod def sub(a, b): return f"{a} - {b}" @staticmethod def mul(a, b): return f"{a} * {b}" @staticmethod def floordiv(a, b): return f"{a} // {b}" @staticmethod def truediv(a, b...
BasicMathOpsMixin
python
pydantic__pydantic
pydantic/experimental/pipeline.py
{ "start": 2873, "end": 22753 }
class ____(Generic[_InT, _OutT]): """Abstract representation of a chain of validation, transformation, and parsing steps.""" _steps: tuple[_Step, ...] def transform( self, func: Callable[[_OutT], _NewOutT], ) -> _Pipeline[_InT, _NewOutT]: """Transform the output of the previous...
_Pipeline
python
run-llama__llama_index
llama-index-packs/llama-index-packs-retry-engine-weaviate/llama_index/packs/retry_engine_weaviate/base.py
{ "start": 645, "end": 2764 }
class ____(BaseLlamaPack): """Weaviate Retry query engine pack.""" def __init__( self, collection_name: str, vector_store_info: VectorStoreInfo, host: str, auth_client_secret: str, nodes: Optional[List[TextNode]] = None, **kwargs: Any, ) -> None: ...
WeaviateRetryEnginePack
python
django__django
tests/admin_views/admin.py
{ "start": 3498, "end": 3759 }
class ____(admin.ModelAdmin): list_filter = ( "chap", "chap__title", "chap__book", "chap__book__name", "chap__book__promo", "chap__book__promo__name", "guest_author__promo__book", )
ChapterXtra1Admin
python
run-llama__llama_index
llama-index-integrations/vector_stores/llama-index-vector-stores-epsilla/llama_index/vector_stores/epsilla/base.py
{ "start": 678, "end": 9973 }
class ____(BasePydanticVectorStore): """ The Epsilla Vector Store. In this vector store we store the text, its embedding and a few pieces of its metadata in a Epsilla collection. This implemnetation allows the use of an already existing collection. It also supports creating a new one if the col...
EpsillaVectorStore
python
pandas-dev__pandas
pandas/core/groupby/generic.py
{ "start": 4937, "end": 54671 }
class ____(GroupBy[Series]): def _wrap_agged_manager(self, mgr: Manager) -> Series: out = self.obj._constructor_from_mgr(mgr, axes=mgr.axes) out._name = self.obj.name return out def _get_data_to_aggregate( self, *, numeric_only: bool = False, name: str | None = None ) -> Sin...
SeriesGroupBy
python
scrapy__scrapy
tests/test_http_response.py
{ "start": 33403, "end": 36623 }
class ____(TestTextResponse): response_class = XmlResponse def test_xml_encoding(self): body = b"<xml></xml>" r1 = self.response_class("http://www.example.com", body=body) self._assert_response_values(r1, self.response_class._DEFAULT_ENCODING, body) body = b"""<?xml version="1....
TestXmlResponse
python
un33k__django-uuslug
uuslug/tests/tests.py
{ "start": 4253, "end": 7335 }
class ____(TestCase): """Tests for Slug - Unique""" def test_manager(self): name = "john" # with PrintQueries("create first john"): # display the SQL queries with self.assertNumQueries(2): # 1. query: SELECT test, if slug 'john' exists # 2. query: INSERT values ...
SlugUniqueTestCase
python
python-openxml__python-docx
src/docx/oxml/simpletypes.py
{ "start": 10075, "end": 10466 }
class ____(XsdBoolean): @classmethod def convert_from_xml(cls, str_value: str) -> bool: if str_value not in ("1", "0", "true", "false", "on", "off"): raise InvalidXmlError( "value must be one of '1', '0', 'true', 'false', 'on', or 'o" "ff', got '%s'" % str_val...
ST_OnOff
python
getsentry__sentry
src/sentry/auth/provider.py
{ "start": 743, "end": 1492 }
class ____(namedtuple("MigratingIdentityId", ["id", "legacy_id"])): """ MigratingIdentityId may be used in the ``id`` field of an identity dictionary to facilitate migrating user identities from one identifying id to another. Context - when google oauth was initially created, the auth_identity key ...
MigratingIdentityId
python
google__pytype
pytype/errors/error_types.py
{ "start": 5455, "end": 5716 }
class ____(ProtocolError): def __init__(self, left_type, other_type, attribute, actual, expected): super().__init__(left_type, other_type) self.attribute_name = attribute self.actual_type = actual self.expected_type = expected
ProtocolTypeError
python
openai__openai-python
src/openai/resources/models.py
{ "start": 9586, "end": 9999 }
class ____: def __init__(self, models: Models) -> None: self._models = models self.retrieve = _legacy_response.to_raw_response_wrapper( models.retrieve, ) self.list = _legacy_response.to_raw_response_wrapper( models.list, ) self.delete = _lega...
ModelsWithRawResponse
python
boto__boto3
tests/unit/dynamodb/test_conditions.py
{ "start": 14332, "end": 21772 }
class ____(unittest.TestCase): def setUp(self): self.builder = ConditionExpressionBuilder() def assert_condition_expression_build( self, condition, ref_string, ref_names, ref_values, is_key_condition=False, ): exp_string, names, values = self....
TestConditionExpressionBuilder
python
django__django
docs/_ext/github_links.py
{ "start": 67, "end": 1847 }
class ____(ast.NodeVisitor): def __init__(self): super().__init__() self.current_path = [] self.node_line_numbers = {} self.import_locations = {} @classmethod def from_code(cls, code): tree = ast.parse(code) locator = cls() locator.visit(tree) ...
CodeLocator
python
walkccc__LeetCode
solutions/3318. Find X-Sum of All K-Long Subarrays I/3318.py
{ "start": 42, "end": 1315 }
class ____: def findXSum(self, nums: list[int], k: int, x: int) -> list[int]: ans = [] windowSum = 0 count = collections.Counter() top = SortedList() bot = SortedList() def update(num: int, freq: int) -> None: """Updates the count of num by freq and the window sum accordingly.""" ...
Solution
python
apache__airflow
devel-common/src/sphinx_exts/operators_and_hooks_ref.py
{ "start": 19289, "end": 19605 }
class ____(BaseJinjaReferenceDirective): """Generate list of deprecated entities""" def render_content(self, *, tags: set[str] | None, header_separator: str = DEFAULT_HEADER_SEPARATOR): return _render_deprecations_content( header_separator=header_separator, )
DeprecationsDirective
python
sqlalchemy__sqlalchemy
test/orm/test_session.py
{ "start": 5372, "end": 13135 }
class ____(_fixtures.FixtureTest): run_inserts = None __prefer_requires__ = ("independent_connections",) def test_no_close_on_flush(self): """Flush() doesn't close a connection the session didn't open""" User, users = self.classes.User, self.tables.users c = testing.db.connect() ...
TransScopingTest
python
walkccc__LeetCode
solutions/3455. Shortest Matching Substring/3455.py
{ "start": 0, "end": 1174 }
class ____: def shortestMatchingSubstring(self, s: str, p: str) -> int: n = len(s) a, b, c = p.split('*') lpsA = self._getLPS(a + '#' + s)[len(a) + 1:] lpsB = self._getLPS(b + '#' + s)[len(b) + 1:] lpsC = self._getLPS(c + '#' + s)[len(c) + 1:] ans = math.inf i = 0 # lpsA's index j = ...
Solution
python
pytorch__pytorch
test/quantization/jit/test_quantize_jit.py
{ "start": 111633, "end": 123563 }
class ____(QuantizationTestCase): def test_prepare_dynamic(self): class M(torch.nn.Module): def __init__(self) -> None: super().__init__() self.fc = torch.nn.Linear(5, 5) def forward(self, x): return self.fc(x) model = torch.j...
TestQuantizeDynamicJitPasses
python
apache__airflow
devel-common/src/tests_common/test_utils/asserts.py
{ "start": 2951, "end": 6163 }
class ____: """ Counts the number of queries sent to Airflow Database in a given context. Does not support multiple processes. When a new process is started in context, its queries will not be included. """ def __init__( self, *, stacklevel: int = 1, stacklevel_...
CountQueries
python
mkdocs__mkdocs
mkdocs/config/defaults.py
{ "start": 833, "end": 1202 }
class ____(_LogLevel): levels: Mapping[str, int] = { **_LogLevel.levels, "relative_to_docs": _AbsoluteLinksValidationValue.RELATIVE_TO_DOCS, } # NOTE: The order here is important. During validation some config options # depend on others. So, if config option A depends on B, then A should be # ...
_AbsoluteLinksValidation
python
aio-libs__aiohttp
aiohttp/tracing.py
{ "start": 7925, "end": 8144 }
class ____: """Parameters sent by the `on_request_exception` signal""" method: str url: URL headers: "CIMultiDict[str]" exception: BaseException @frozen_dataclass_decorator
TraceRequestExceptionParams
python
gevent__gevent
src/gevent/tests/test___config.py
{ "start": 130, "end": 2461 }
class ____(unittest.TestCase): old_resolver = None def setUp(self): if 'GEVENT_RESOLVER' in os.environ: self.old_resolver = os.environ['GEVENT_RESOLVER'] del os.environ['GEVENT_RESOLVER'] def tearDown(self): if self.old_resolver: os.environ['GEVENT_RESO...
TestResolver
python
getsentry__sentry
tests/sentry/notifications/notification_action/metric_alert_registry/test_discord_metric_alert_handler.py
{ "start": 1160, "end": 8434 }
class ____(MetricAlertHandlerBase): def setUp(self) -> None: self.create_models() self.action = self.create_action( type=Action.Type.DISCORD, integration_id=1234567890, config={ "target_identifier": "channel123", "target_type": Acti...
TestDiscordMetricAlertHandler
python
django__django
django/utils/functional.py
{ "start": 75, "end": 1413 }
class ____: """ Decorator that converts a method with a single self argument into a property cached on the instance. A cached property can be made out of an existing method: (e.g. ``url = cached_property(get_absolute_url)``). """ name = None @staticmethod def func(instance): ...
cached_property
python
aimacode__aima-python
learning4e.py
{ "start": 24299, "end": 29412 }
class ____: def __init__(self, clf, decision_function='ovr'): self.clf = clf self.decision_function = decision_function self.n_class, self.classifiers = 0, [] def fit(self, X, y): """ Trains n_class or n_class * (n_class - 1) / 2 classifiers according to the tra...
MultiClassLearner
python
FactoryBoy__factory_boy
factory/declarations.py
{ "start": 18278, "end": 19073 }
class ____(utils.OrderedBase): """A complex parameter, to be used in a Factory.Params section. Must implement: - A "compute" function, performing the actual declaration override - Optionally, a get_revdeps() function (to compute other parameters it may alter) """ def as_declarations(self, fiel...
Parameter
python
django__django
tests/model_forms/tests.py
{ "start": 108545, "end": 116075 }
class ____(TestCase): def test_media_on_modelform(self): # Similar to a regular Form class you can define custom media to be # used on the ModelForm. f = ModelFormWithMedia() self.assertHTMLEqual( str(f.media), '<link href="/some/form/css" media="all" rel="sty...
OtherModelFormTests
python
ray-project__ray
release/cluster_tests/workloads/tune_scale_up_down.py
{ "start": 1482, "end": 2412 }
class ____(tune.Callback): def __init__(self): self.node_counts = [] def on_step_begin(self, iteration, trials, **info): node_count = len([n for n in ray.nodes() if n["Alive"]]) self.node_counts.append(node_count) def main(): ray.init() head_node_ip = ray.util.get_node_ip_add...
NodeCountCallback
python
python__mypy
mypy/build.py
{ "start": 72405, "end": 72512 }
class ____(Exception): """Control flow exception to signal that a module was not found."""
ModuleNotFound
python
ansible__ansible
lib/ansible/_internal/_wrapt.py
{ "start": 3921, "end": 13913 }
class ____(with_metaclass(_ObjectProxyMetaType)): __slots__ = '__wrapped__' def __init__(self, wrapped): object.__setattr__(self, '__wrapped__', wrapped) # Python 3.2+ has the __qualname__ attribute, but it does not # allow it to be overridden using a property and it must instead ...
ObjectProxy
python
apache__airflow
airflow-core/src/airflow/models/asset.py
{ "start": 21482, "end": 23344 }
class ____(Base): """References from a task to an asset that it updates / produces.""" asset_id: Mapped[int] = mapped_column(Integer, primary_key=True, nullable=False) dag_id: Mapped[str] = mapped_column(StringID(), primary_key=True, nullable=False) task_id: Mapped[str] = mapped_column(StringID(), prim...
TaskOutletAssetReference
python
gevent__gevent
src/gevent/monkey/_errors.py
{ "start": 425, "end": 547 }
class ____(RuntimeWarning): """ The type of warnings we issue. .. versionadded:: 1.3a2 """
MonkeyPatchWarning
python
tensorflow__tensorflow
tensorflow/python/framework/ops_test.py
{ "start": 43833, "end": 46479 }
class ____(test_util.TensorFlowTestCase): def testNodeDefArgs(self): g = ops.Graph() op1 = g.create_op("FloatOutput", [], [dtypes.float32], None, name="myop1") with g.device("/device:GPU:0"): op2 = g.create_op( "FloatOutputStringOutput", [], [dtypes.float32, dtypes.string], None, ...
CreateOpTest
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/constructor30.py
{ "start": 370, "end": 426 }
class ____(ABase): ... TA = TypeVar("TA", bound=ABase)
A
python
html5lib__html5lib-python
html5lib/html5parser.py
{ "start": 99753, "end": 101328 }
class ____(Phase): __slots__ = tuple() def processEOF(self): # Stop parsing pass def processComment(self, token): # This is needed because data is to be appended to the <html> element # here and not to whatever is currently open. self.tree.insertComment(token, self....
AfterBodyPhase
python
sympy__sympy
sympy/matrices/expressions/matexpr.py
{ "start": 1200, "end": 18717 }
class ____(Expr): """Superclass for Matrix Expressions MatrixExprs represent abstract matrices, linear transformations represented within a particular basis. Examples ======== >>> from sympy import MatrixSymbol >>> A = MatrixSymbol('A', 3, 3) >>> y = MatrixSymbol('y', 3, 1) >>> x ...
MatrixExpr
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/roles.py
{ "start": 4454, "end": 4531 }
class ____(ExpressionElementRole[_T]): __slots__ = ()
LabeledColumnExprRole
python
getsentry__sentry
tests/sentry/taskworker/test_worker.py
{ "start": 4405, "end": 24535 }
class ____(TestCase): def test_tasks_exist(self) -> None: import sentry.taskworker.tasks.examples as example_tasks assert example_tasks.simple_task assert example_tasks.retry_task assert example_tasks.at_most_once_task def test_fetch_task(self) -> None: taskworker = Tas...
TestTaskWorker
python
patrick-kidger__equinox
equinox/_jit.py
{ "start": 6206, "end": 6442 }
class ____(logging.Filterer): def filter(self, record: logging.LogRecord): return not ( record.name == "jax._src.callback" and record.getMessage() == "jax.pure_callback failed" )
_FilterCallback
python
run-llama__llama_index
llama-index-core/tests/memory/blocks/test_vector.py
{ "start": 577, "end": 2417 }
class ____(BasePydanticVectorStore): """Mock vector store for testing.""" stores_text: bool = True is_embedding_query: bool = True def __init__(self): super().__init__() self._nodes = {} @property def client(self) -> Any: return self @property def nodes(self) ...
MockVectorStore
python
PyCQA__pylint
tests/regrtest_data/max_inferable_limit_for_classes/nodes/roles.py
{ "start": 577, "end": 635 }
class ____(ExpressionElementRole): ...
BinaryElementRole
python
kamyu104__LeetCode-Solutions
Python/unique-word-abbreviation.py
{ "start": 151, "end": 851 }
class ____(object): def __init__(self, dictionary): """ initialize your data structure here. :type dictionary: List[str] """ self.lookup_ = collections.defaultdict(set) for word in dictionary: abbr = self.abbreviation(word) self.lookup_[abbr].a...
ValidWordAbbr
python
pytorch__pytorch
test/jit/test_freezing.py
{ "start": 66969, "end": 118214 }
class ____(JitTestCase): def setUp(self): super().setUp() self.default_dtype = torch.get_default_dtype() torch.set_default_dtype(torch.double) def tearDown(self): torch.set_default_dtype(self.default_dtype) super().tearDown() def test_conv_bn_folding(self): ...
TestFrozenOptimizations
python
pytorch__pytorch
torch/_export/serde/schema.py
{ "start": 2836, "end": 3315 }
class ____(_Union): as_name: Annotated[str, 10] as_int: Annotated[int, 20] # In most cases we will use the "as_name" field to store arguments which are # SymFloats. # The "as_float" field is used in the case where we have a list containing a mix # of SymFloat and float (ex. [1.0, s0, ...]). We will serialize ...
SymIntArgument
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/hooks/dataflow.py
{ "start": 54969, "end": 64746 }
class ____(GoogleBaseAsyncHook, DataflowJobTerminalStateHelper): """Async hook class for dataflow service.""" sync_hook_class = DataflowHook async def initialize_client(self, client_class): """ Initialize object of the given class. Method is used to initialize asynchronous client....
AsyncDataflowHook
python
sphinx-doc__sphinx
sphinx/directives/admonitions.py
{ "start": 1434, "end": 1498 }
class ____(SphinxAdmonition): node_class = nodes.danger
Danger
python
astropy__astropy
astropy/units/physical.py
{ "start": 5830, "end": 22185 }
class ____: """ Represents the physical type(s) that are dimensionally compatible with a set of units. Instances of this class should be accessed through either `get_physical_type` or by using the `~astropy.units.core.UnitBase.physical_type` attribute of units. This class is not intended to...
PhysicalType
python
ApeWorX__ape
src/ape/exceptions.py
{ "start": 19837, "end": 19941 }
class ____(ApeException): """ Raised when issues occur in a query engine. """
QueryEngineError
python
pandas-dev__pandas
pandas/tests/io/formats/test_to_html.py
{ "start": 26547, "end": 38439 }
class ____: def test_html_repr_min_rows_default(self, datapath): # gh-27991 # default setting no truncation even if above min_rows df = DataFrame({"a": range(20)}) result = df._repr_html_() expected = expected_html(datapath, "html_repr_min_rows_default_no_truncation") ...
TestReprHTML
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/operators/test_bedrock.py
{ "start": 7113, "end": 8884 }
class ____: MODEL_ARN = "testProvisionedModelArn" @pytest.fixture def mock_conn(self) -> Generator[BaseAwsConnection, None, None]: with mock.patch.object(BedrockHook, "conn") as _conn: _conn.create_provisioned_model_throughput.return_value = {"provisionedModelArn": self.MODEL_ARN} ...
TestBedrockCreateProvisionedModelThroughputOperator
python
allegroai__clearml
clearml/backend_api/services/v2_20/auth.py
{ "start": 372, "end": 2664 }
class ____(NonStrictDataModel): """ :param access_key: Credentials access key :type access_key: str :param secret_key: Credentials secret key :type secret_key: str :param label: Optional credentials label :type label: str """ _schema = { "properties": { "access_k...
Credentials