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
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 226242, "end": 228676 }
class ____(sgqlc.types.Interface): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ( "author", "author_association", "body", "body_html", "body_text", "created_at", "created_via_email", "editor", ...
Comment
python
doocs__leetcode
solution/1600-1699/1668.Maximum Repeating Substring/Solution.py
{ "start": 0, "end": 199 }
class ____: def maxRepeating(self, sequence: str, word: str) -> int: for k in range(len(sequence) // len(word), -1, -1): if word * k in sequence: return k
Solution
python
scikit-learn__scikit-learn
sklearn/model_selection/_split.py
{ "start": 52997, "end": 57979 }
class ____(GroupsConsumerMixin, BaseCrossValidator): """Leave P Group(s) Out cross-validator. Provides train/test indices to split data according to a third-party provided group. This group information can be used to encode arbitrary domain specific stratifications of the samples as integers. For ...
LeavePGroupsOut
python
doocs__leetcode
solution/2100-2199/2150.Find All Lonely Numbers in the Array/Solution.py
{ "start": 0, "end": 215 }
class ____: def findLonely(self, nums: List[int]) -> List[int]: cnt = Counter(nums) return [ x for x, v in cnt.items() if v == 1 and cnt[x - 1] == 0 and cnt[x + 1] == 0 ]
Solution
python
pytorch__pytorch
test/jit/test_typing.py
{ "start": 483, "end": 21075 }
class ____(JitTestCase): def test_dict_in_not_in(self): def test_in_dict(x): # type: (Dict[str, int]) -> bool return "hi" in x self.checkScript(test_in_dict, ({"hi": 2, "bye": 3},)) self.checkScript(test_in_dict, ({"bye": 3},)) # Check evaluation order ...
TestTyping
python
allegroai__clearml
clearml/backend_api/services/v2_20/events.py
{ "start": 69082, "end": 74822 }
class ____(Request): """ Return the debug image per metric and variant for the provided iteration :param task: Task ID :type task: str :param metric: Metric name :type metric: str :param variant: Metric variant :type variant: str :param iteration: The iteration to bring debug image ...
GetDebugImageSampleRequest
python
scipy__scipy
scipy/interpolate/tests/test_fitpack2.py
{ "start": 1050, "end": 17361 }
class ____: def test_linear_constant(self): x = [1,2,3] y = [3,3,3] lut = UnivariateSpline(x,y,k=1) assert_array_almost_equal(lut.get_knots(), [1, 3]) assert_array_almost_equal(lut.get_coeffs(), [3, 3]) assert abs(lut.get_residual()) < 1e-10 assert_array_almos...
TestUnivariateSpline
python
urllib3__urllib3
test/test_collections.py
{ "start": 184, "end": 3032 }
class ____: def test_maxsize(self) -> None: d: Container[int, str] = Container(5) for i in range(5): d[i] = str(i) assert len(d) == 5 for i in range(5): assert d[i] == str(i) d[i + 1] = str(i + 1) assert len(d) == 5 assert 0 not in...
TestLRUContainer
python
pypa__packaging
src/packaging/_musllinux.py
{ "start": 327, "end": 2707 }
class ____(NamedTuple): major: int minor: int def _parse_musl_version(output: str) -> _MuslVersion | None: lines = [n for n in (n.strip() for n in output.splitlines()) if n] if len(lines) < 2 or lines[0][:4] != "musl": return None m = re.match(r"Version (\d+)\.(\d+)", lines[1]) if not ...
_MuslVersion
python
kamyu104__LeetCode-Solutions
Python/find-the-number-of-k-even-arrays.py
{ "start": 1412, "end": 1957 }
class ____(object): def countOfArrays(self, n, m, k): """ :type n: int :type m: int :type k: int :rtype: int """ MOD = 10**9+7 even, odd = m//2, (m+1)//2 dp = [[0]*(k+1) for _ in xrange(2)] dp[0][0], dp[1][0] = even, odd for _ i...
Solution2
python
jazzband__django-simple-history
simple_history/tests/tests/test_models.py
{ "start": 73905, "end": 74416 }
class ____(TestCase): def setUp(self): self.model = ForeignKeyToSelfModel self.history_model = self.model.history.model def test_foreign_key_to_self_using_model_str(self): self.assertEqual( self.model, self.history_model.fk_to_self.field.remote_field.model ) def...
ForeignKeyToSelfTest
python
urllib3__urllib3
test/test_queue_monkeypatch.py
{ "start": 178, "end": 254 }
class ____(Exception): """ This should not be raised. """
BadError
python
scipy__scipy
scipy/stats/tests/test_multivariate.py
{ "start": 49511, "end": 58025 }
class ____: def test_bad_input(self): # Check that bad inputs raise errors num_rows = 4 num_cols = 3 M = np.full((num_rows,num_cols), 0.3) U = 0.5 * np.identity(num_rows) + np.full((num_rows, num_rows), 0.5) V = 0.7 * np.identity(num_cols) + np.full((num_cols, num_co...
TestMatrixNormal
python
tiangolo__fastapi
tests/test_pydantic_v1_v2_mixed.py
{ "start": 564, "end": 620 }
class ____(NewBaseModel): new_sub_name: str
NewSubItem
python
Textualize__textual
tests/test_animation.py
{ "start": 144, "end": 5249 }
class ____(App): CSS = """ #foo { height: 1; } """ def compose(self) -> ComposeResult: yield Static("foo", id="foo") async def test_animate_height() -> None: """Test animating styles.height works.""" # Styles.height is a scalar, which makes it more complicated to animate ...
AnimApp
python
altair-viz__altair
altair/vegalite/v6/schema/core.py
{ "start": 1434164, "end": 1434542 }
class ____(VegaLiteSchema): """ TooltipContent schema wrapper. Parameters ---------- content : Literal['encoding', 'data'] """ _schema = {"$ref": "#/definitions/TooltipContent"} def __init__( self, content: Optional[Literal["encoding", "data"]] = Undefined, **kwds ): ...
TooltipContent
python
keras-team__keras
keras/src/metrics/regression_metrics_test.py
{ "start": 151, "end": 1191 }
class ____(testing.TestCase): def test_config(self): # TODO pass def test_unweighted(self): mse_obj = metrics.MeanSquaredError() y_true = np.array( [[0, 1, 0, 1, 0], [0, 0, 1, 1, 1], [1, 1, 1, 1, 0], [0, 0, 0, 0, 1]] ) y_pred = np.array( [...
MeanSquaredErrorTest
python
numba__numba
numba/tests/npyufunc/test_dufunc.py
{ "start": 4272, "end": 5840 }
class ____(TestCase): @functools.cache def _generate_jit(self, ufunc, kind, identity=None): assert kind in ('reduce', 'reduceat', 'at') if kind == 'reduce': if ufunc.nin == 2: vec = vectorize(identity=identity)(lambda a, b: ufunc(a, b)) else: ...
TestDUFuncMethodsBase
python
has2k1__plotnine
plotnine/scales/scale_color.py
{ "start": 14893, "end": 14962 }
class ____(scale_color_gradient): pass @alias
scale_colour_gradient
python
Netflix__metaflow
metaflow/plugins/cards/card_modules/test_cards.py
{ "start": 4163, "end": 5363 }
class ____(MetaflowCard): """ This card takes components and helps test the `current.card.components["A"].update()` interface """ HTML_TEMPLATE = REFRESHABLE_HTML_TEMPLATE RUNTIME_UPDATABLE = True ALLOW_USER_COMPONENTS = True # Not implementing Reload Policy here since the reload Pol...
TestRefreshComponentCard
python
run-llama__llama_index
llama-index-core/llama_index/core/indices/query/query_transform/base.py
{ "start": 4853, "end": 6873 }
class ____(BaseQueryTransform): """ Decompose query transform. Decomposes query into a subquery given the current index struct. Performs a single step transformation. Args: llm_predictor (Optional[LLM]): LLM for generating hypothetical documents """ def __init__( ...
DecomposeQueryTransform
python
google__jax
tests/pallas/mgpu_collective_matmul_test.py
{ "start": 1294, "end": 5407 }
class ____(jtu.JaxTestCase): def setUp(self): super().setUp() if collective_matmul_mgpu is None: self.skipTest("Mosaic GPU not available.") if (not jtu.test_device_matches(["cuda"]) or not jtu.is_cuda_compute_capability_equal("9.0")): self.skipTest("Only works on GPU with capability s...
CollectiveMatmulTestCase
python
getsentry__sentry
tests/sentry/tasks/test_clear_expired_snoozes.py
{ "start": 437, "end": 3571 }
class ____(TestCase): def test_task_persistent_name(self) -> None: assert clear_expired_snoozes.name == "sentry.tasks.clear_expired_snoozes" @patch("sentry.signals.issue_unignored.send_robust") def test_simple(self, send_robust: MagicMock) -> None: group1 = self.create_group(status=GroupSta...
ClearExpiredSnoozesTest
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/auto_suggest.py
{ "start": 4998, "end": 5798 }
class ____(AutoSuggest): """ Validator class that can dynamically returns any Validator. :param get_validator: Callable that returns a :class:`.Validator` instance. """ def __init__(self, get_auto_suggest: Callable[[], AutoSuggest | None]) -> None: self.get_auto_suggest = get_auto_suggest ...
DynamicAutoSuggest
python
langchain-ai__langchain
libs/partners/qdrant/langchain_qdrant/vectorstores.py
{ "start": 1981, "end": 94727 }
class ____(VectorStore): """`Qdrant` vector store. ```python from qdrant_client import QdrantClient from langchain_qdrant import Qdrant client = QdrantClient() collection_name = "MyCollection" qdrant = Qdrant(client, collection_name, embedding_function) ``` """ CONTENT_KEY: st...
Qdrant
python
openai__openai-python
src/openai/_base_client.py
{ "start": 27818, "end": 28486 }
class ____(httpx.Client): def __init__(self, **kwargs: Any) -> None: kwargs.setdefault("timeout", DEFAULT_TIMEOUT) kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS) kwargs.setdefault("follow_redirects", True) super().__init__(**kwargs) if TYPE_CHECKING: DefaultHttpxClient ...
_DefaultHttpxClient
python
run-llama__llama_index
llama-index-core/tests/prompts/test_mixin.py
{ "start": 190, "end": 653 }
class ____(PromptMixin): def __init__(self) -> None: self._prompt_dict_2 = { "abc": PromptTemplate("{abc} {def}"), } def _get_prompts(self) -> PromptDictType: return self._prompt_dict_2 def _get_prompt_modules(self) -> PromptMixinType: return {} def _update...
MockObject2
python
readthedocs__readthedocs.org
readthedocs/rtd_tests/tests/test_doc_building.py
{ "start": 947, "end": 3312 }
class ____(TestCase): def test_command_not_recorded(self): api_client = mock.MagicMock() build_env = LocalBuildEnvironment(api_client=api_client) with build_env: build_env.run("true", record=False) self.assertEqual(len(build_env.commands), 0) api_client.command.p...
TestLocalBuildEnvironment
python
doocs__leetcode
solution/1400-1499/1466.Reorder Routes to Make All Paths Lead to the City Zero/Solution2.py
{ "start": 0, "end": 495 }
class ____: def minReorder(self, n: int, connections: List[List[int]]) -> int: g = [[] for _ in range(n)] for a, b in connections: g[a].append((b, 1)) g[b].append((a, 0)) q = deque([0]) vis = {0} ans = 0 while q: a = q.popleft() ...
Solution
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_table09.py
{ "start": 315, "end": 2262 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("table09.xlsx") self.ignore_files = [ "xl/calcChain.xml", "[Content_Types].xml", "xl/_rels/workbook.xml.rels...
TestCompareXLSXFiles
python
readthedocs__readthedocs.org
readthedocs/search/api/v3/views.py
{ "start": 1026, "end": 1164 }
class ____(UserRateThrottle): """Rate limit for the search API for authenticated users.""" rate = RATE_LIMIT
SearchUserRateThrottle
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/renderer.py
{ "start": 11015, "end": 11969 }
class ____(Dict[str, bool]): """ Cache for remember which style strings don't render the default output style (default fg/bg, no underline and no reverse and no blink). That way we know that we should render these cells, even when they're empty (when they contain a space). Note: we don't consid...
_StyleStringHasStyleCache
python
numpy__numpy
numpy/_core/arrayprint.py
{ "start": 49849, "end": 50195 }
class ____: def __init__(self, data, **kwargs): # add an extra space so " True" and "False" have the same length and # array elements align nicely when printed, except in 0d arrays self.truestr = ' True' if data.shape != () else 'True' def __call__(self, x): return self.truestr ...
BoolFormat
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/event/attr.py
{ "start": 3297, "end": 7928 }
class ____(RefCollection[_ET]): """Class-level events on :class:`._Dispatch` classes.""" __slots__ = ( "clsname", "name", "arg_names", "has_kw", "legacy_signatures", "_clslevel", "__weakref__", ) clsname: str name: str arg_names: Sequence...
_ClsLevelDispatch
python
huggingface__transformers
src/transformers/models/aya_vision/modular_aya_vision.py
{ "start": 9509, "end": 12817 }
class ____(LlavaForConditionalGeneration): def forward( self, input_ids: Optional[torch.LongTensor] = None, pixel_values: Optional[torch.FloatTensor] = None, attention_mask: Optional[torch.Tensor] = None, position_ids: Optional[torch.LongTensor] = None, past_key_value...
AyaVisionForConditionalGeneration
python
matplotlib__matplotlib
lib/mpl_toolkits/axes_grid1/axes_size.py
{ "start": 1612, "end": 1960 }
class ____(_Base): """ Sum of two sizes. """ def __init__(self, a, b): self._a = a self._b = b def get_size(self, renderer): a_rel_size, a_abs_size = self._a.get_size(renderer) b_rel_size, b_abs_size = self._b.get_size(renderer) return a_rel_size + b_rel_siz...
Add
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/python_test_framework_unittest.py
{ "start": 640, "end": 884 }
class ____(unittest.TestCase): def test_issue(self): # Expected False Negative _test_sink(_test_source()) # Whole file is ignored def false_negative(): # Expected False Negative _test_sink(_test_source())
TestWithIssue
python
getsentry__sentry
tests/sentry/integrations/vsts/test_provider.py
{ "start": 823, "end": 2538 }
class ____(TestCase): @responses.activate def test_exchange_token(self) -> None: view = VSTSOAuth2CallbackView( access_token_url="https://app.vssps.visualstudio.com/oauth2/token", client_id="vsts-client-id", client_secret="vsts-client-secret", ) reques...
TestVSTSOAuthCallbackView
python
anthropics__anthropic-sdk-python
src/anthropic/resources/models.py
{ "start": 11148, "end": 11460 }
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, )
ModelsWithRawResponse
python
marshmallow-code__marshmallow
src/marshmallow/fields.py
{ "start": 44745, "end": 46293 }
class ____(_TemporalField[dt.datetime]): """A formatted datetime string. Example: ``'2014-12-22T03:12:58.019077+00:00'`` :param format: Either ``"rfc"`` (for RFC822), ``"iso"`` (for ISO8601), ``"timestamp"``, ``"timestamp_ms"`` (for a POSIX timestamp) or a date format string. If `None`, de...
DateTime
python
streamlit__streamlit
lib/streamlit/elements/vega_charts.py
{ "start": 3141, "end": 7053 }
class ____(TypedDict, total=False): """ The schema for the Vega-Lite event state. The event state is stored in a dictionary-like object that supports both key and attribute notation. Event states cannot be programmatically changed or set through Session State. Only selection events are support...
VegaLiteState
python
getsentry__sentry
src/sentry/replays/usecases/ingest/event_logger.py
{ "start": 9825, "end": 14467 }
class ____(TypedDict): component_name: str node: dict[str, Any] project_id: int replay_event: dict[str, Any] replay_id: str selector: str timestamp: int url: str def gen_rage_clicks( event_meta: ParsedEventMeta, project_id: int, replay_id: str, replay_event: dict[str, A...
RageClickIssue
python
django__django
tests/generic_views/test_base.py
{ "start": 1236, "end": 1413 }
class ____(TemplateView): template_name = "generic_views/about.html" def get(self, request): return self.render_to_response(context={})
AboutTemplateAttributeView
python
huggingface__transformers
src/transformers/models/sam/modeling_sam.py
{ "start": 36335, "end": 38669 }
class ____(SamVisionAttention): """ Multi-head Attention block with relative position embeddings. Using SDPA instead of the default attention. """ def __init__(self, config, window_size): super().__init__(config, window_size) def forward(self, hidden_states: torch.Tensor, output_attent...
SamVisionSdpaAttention
python
scrapy__scrapy
tests/test_pipelines.py
{ "start": 2404, "end": 5102 }
class ____: @classmethod def setup_class(cls): cls.mockserver = MockServer() cls.mockserver.__enter__() @classmethod def teardown_class(cls): cls.mockserver.__exit__(None, None, None) def _on_item_scraped(self, item): assert isinstance(item, dict) assert ite...
TestPipeline
python
apache__airflow
providers/microsoft/azure/src/airflow/providers/microsoft/azure/hooks/msgraph.py
{ "start": 2673, "end": 4017 }
class ____(ResponseHandler): """DefaultResponseHandler returns JSON payload or content in bytes or response headers.""" @staticmethod def get_value(response: Response) -> Any: with suppress(JSONDecodeError): return response.json() content = response.content if not conten...
DefaultResponseHandler
python
apache__airflow
providers/apache/beam/src/airflow/providers/apache/beam/triggers/beam.py
{ "start": 1053, "end": 2682 }
class ____(BaseTrigger): """Base class for Beam Pipeline Triggers.""" @staticmethod def _get_async_hook(*args, **kwargs) -> BeamAsyncHook: return BeamAsyncHook(*args, **kwargs) @staticmethod def file_has_gcs_path(file_path: str): return file_path.lower().startswith("gs://") @s...
BeamPipelineBaseTrigger
python
urllib3__urllib3
src/urllib3/exceptions.py
{ "start": 470, "end": 624 }
class ____(Warning): """Base warning used by this module.""" _TYPE_REDUCE_RESULT = tuple[typing.Callable[..., object], tuple[object, ...]]
HTTPWarning
python
plotly__plotly.py
plotly/graph_objs/layout/_margin.py
{ "start": 235, "end": 5400 }
class ____(_BaseLayoutHierarchyType): _parent_path_str = "layout" _path_str = "layout.margin" _valid_props = {"autoexpand", "b", "l", "pad", "r", "t"} @property def autoexpand(self): """ Turns on/off margin expansion computations. Legends, colorbars, updatemenus, sliders, ax...
Margin
python
kamyu104__LeetCode-Solutions
Python/count-servers-that-communicate.py
{ "start": 37, "end": 621 }
class ____(object): def countServers(self, grid): """ :type grid: List[List[int]] :rtype: int """ rows, cols = [0]*len(grid), [0]*len(grid[0]) for i in xrange(len(grid)): for j in xrange(len(grid[0])): if grid[i][j]: row...
Solution
python
streamlit__streamlit
lib/streamlit/errors.py
{ "start": 19074, "end": 19600 }
class ____(LocalizableStreamlitException): def __init__( self, color: str | Collection[Any] | tuple[int, int, int, int] ) -> None: super().__init__( "This does not look like a valid color: {color}.\n\n" "Colors must be in one of the following formats:" "* Hex ...
StreamlitInvalidColorError
python
modin-project__modin
asv_bench/benchmarks/benchmarks.py
{ "start": 23628, "end": 24274 }
class ____: param_names = ["shape", "drop", "level"] params = [ get_benchmark_shapes("TimeResetIndex"), [False, True], [None, "level_1"], ] def setup(self, shape, drop, level): self.df = generate_dataframe("int", *shape, RAND_LOW, RAND_HIGH) if level: ...
TimeResetIndex
python
astropy__astropy
astropy/nddata/ccddata.py
{ "start": 2523, "end": 29839 }
class ____(NDDataArray): """A class describing basic CCD data. The CCDData class is based on the NDData object and includes a data array, uncertainty frame, mask frame, flag frame, meta data, units, and WCS information for a single CCD image. Parameters ---------- data : `~astropy.nddata.C...
CCDData
python
mlflow__mlflow
mlflow/tracing/export/async_export_queue.py
{ "start": 959, "end": 6766 }
class ____: """A queue-based asynchronous tracing export processor.""" def __init__(self): self._queue: Queue[Task] = Queue(maxsize=MLFLOW_ASYNC_TRACE_LOGGING_MAX_QUEUE_SIZE.get()) self._lock = threading.RLock() self._max_workers = MLFLOW_ASYNC_TRACE_LOGGING_MAX_WORKERS.get() #...
AsyncTraceExportQueue
python
viewflow__viewflow
tests/json/test_json__basics.py
{ "start": 2866, "end": 3028 }
class ____(Client): approved = jsonstore.BooleanField() personal_phone = jsonstore.CharField(max_length=250) class Meta: proxy = True
VIPClient
python
getsentry__sentry
fixtures/sudo_testutils.py
{ "start": 157, "end": 426 }
class ____: """Stub backend Always authenticates when the password matches self.password """ password = "stub" def authenticate(self, request, username, password): if password == self.password: return User()
StubPasswordBackend
python
getsentry__sentry
src/sentry/db/models/query.py
{ "start": 915, "end": 6580 }
class ____(Exception): pass def resolve_combined_expression(instance: Model, node: CombinedExpression) -> BaseExpression: def _resolve(instance: Model, node: BaseExpression | F) -> BaseExpression: if isinstance(node, Value): return node.value if isinstance(node, F): ret...
CannotResolveExpression
python
scipy__scipy
scipy/io/arff/_arffread.py
{ "start": 19502, "end": 26143 }
class ____: """Small container to keep useful information on a ARFF dataset. Knows about attributes names and types. Examples -------- :: data, meta = loadarff('iris.arff') # This will print the attributes names of the iris.arff dataset for i in meta: print(i) ...
MetaData
python
kubernetes-client__python
kubernetes/base/stream/ws_client.py
{ "start": 1367, "end": 9515 }
class ____: def __init__(self, configuration, url, headers, capture_all, binary=False): """A websocket client with support for channels. Exec command uses different channels for different streams. for example, 0 is stdin, 1 is stdout and 2 is stderr. Some other API calls like po...
WSClient
python
matplotlib__matplotlib
lib/mpl_toolkits/axes_grid1/axes_grid.py
{ "start": 10468, "end": 22631 }
class ____(Grid): """ A grid of Axes for Image display. This class is a specialization of `~.axes_grid1.axes_grid.Grid` for displaying a grid of images. In particular, it forces all axes in a column to share their x-axis and all axes in a row to share their y-axis. It further provides helpers to ...
ImageGrid
python
PrefectHQ__prefect
src/prefect/_versioning.py
{ "start": 12380, "end": 14132 }
class ____(str, Enum): SIMPLE = "prefect:simple" GITHUB = "vcs:github" GITLAB = "vcs:gitlab" BITBUCKET = "vcs:bitbucket" AZUREDEVOPS = "vcs:azuredevops" GIT = "vcs:git" async def get_inferred_version_info( version_type: Optional[str] = None, ) -> VersionInfo | None: """ Attempts to...
VersionType
python
boto__boto3
tests/functional/test_crt.py
{ "start": 1041, "end": 2017 }
class ____(ContextDecorator): """Helper class to simulate a CRT optimized EC2 instance.""" DEFAULT_LOCK_MOCK = mock.Mock() def __init__(self, lock=DEFAULT_LOCK_MOCK, optimized=True): self.acquire_process_lock = mock.patch( 'boto3.crt.acquire_crt_s3_process_lock' ) self....
MockOptimizedInstance
python
xlwings__xlwings
xlwings/constants.py
{ "start": 83472, "end": 83881 }
class ____: xlPasteSpecialOperationAdd = 2 # from enum XlPasteSpecialOperation xlPasteSpecialOperationDivide = 5 # from enum XlPasteSpecialOperation xlPasteSpecialOperationMultiply = 4 # from enum XlPasteSpecialOperation xlPasteSpecialOperationNone = -4142 # from enum XlPasteSpecialOperation xlP...
PasteSpecialOperation
python
readthedocs__readthedocs.org
readthedocs/rtd_tests/tests/test_privacy_urls.py
{ "start": 18216, "end": 18568 }
class ____(URLAccessMixin): def setUp(self): super().setUp() self.default_kwargs.update( { "username": self.tester.username, } ) def test_public_urls(self): from readthedocs.profiles.urls.public import urlpatterns self._test_url(u...
PublicUserProfileMixin
python
pytorch__pytorch
test/distributed/test_p2p_ipc.py
{ "start": 484, "end": 2062 }
class ____(MultiProcContinuousTest): @classmethod def backend_str(cls): return "gloo" def _init_device(self) -> None: # init and pin the process to the device device_module.set_device(self.device) torch.empty(1, device=self.device) @property def device(self) -> torc...
P2PIpcTest
python
kamyu104__LeetCode-Solutions
Python/pyramid-transition-matrix.py
{ "start": 174, "end": 1535 }
class ____(object): def pyramidTransition(self, bottom, allowed): """ :type bottom: str :type allowed: List[str] :rtype: bool """ def pyramidTransitionHelper(bottom, edges, lookup): def dfs(bottom, edges, new_bottom, idx, lookup): if idx ==...
Solution
python
pandas-dev__pandas
pandas/tests/config/test_config.py
{ "start": 195, "end": 17851 }
class ____: @pytest.fixture(autouse=True) def clean_config(self, monkeypatch): with monkeypatch.context() as m: m.setattr(cf, "_global_config", {}) m.setattr(cf, "options", cf.DictWrapper(cf._global_config)) m.setattr(cf, "_deprecated_options", {}) m.setat...
TestConfig
python
jazzband__django-polymorphic
src/polymorphic/tests/models.py
{ "start": 4940, "end": 5020 }
class ____(ModelArticle): name = models.CharField(max_length=300)
ModelPackage
python
ansible__ansible
lib/ansible/plugins/strategy/debug.py
{ "start": 1046, "end": 1205 }
class ____(LinearStrategyModule): def __init__(self, tqm): super(StrategyModule, self).__init__(tqm) self.debugger_active = True
StrategyModule
python
huggingface__transformers
tests/models/bart/test_modeling_bart.py
{ "start": 2236, "end": 8249 }
class ____: def __init__( self, parent, batch_size=13, seq_length=7, is_training=True, use_labels=False, vocab_size=99, hidden_size=16, num_hidden_layers=2, num_attention_heads=4, intermediate_size=4, hidden_act="gelu", ...
BartModelTester
python
pypa__warehouse
warehouse/attestations/models.py
{ "start": 423, "end": 1325 }
class ____(db.Model): """ A table for PEP 740 provenance objects. Provenance objects contain one or more attestation objects. These attestation objects are grouped into "bundles," each of which contains one or more attestations along with the Trusted Publisher identity that produced them. "...
Provenance
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 372531, "end": 373144 }
class ____(sgqlc.types.relay.Connection): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("edges", "nodes", "page_info", "total_count") edges = sgqlc.types.Field( sgqlc.types.list_of("MilestoneEdge"), graphql_name="edges" ) nodes = sgqlc.typ...
MilestoneConnection
python
huggingface__transformers
src/transformers/models/qwen3_vl/processing_qwen3_vl.py
{ "start": 1878, "end": 16041 }
class ____(ProcessorMixin): r""" Constructs a Qwen3VL processor which wraps a Qwen3VL image processor and a Qwen2 tokenizer into a single processor. [`Qwen3VLProcessor`] offers all the functionalities of [`Qwen2VLImageProcessor`] and [`Qwen2TokenizerFast`]. See the [`~Qwen3VLProcessor.__call__`] and [`~...
Qwen3VLProcessor
python
PyCQA__pylint
tests/functional/a/arguments_renamed.py
{ "start": 1023, "end": 1195 }
class ____: def test(self, arg): return arg + 1 def kwargs_test(self, arg, *, var1, var2): print(f"keyword parameters are {var1} and {var2}.")
Parent
python
getsentry__sentry
src/sentry/api/endpoints/project_profiling_profile.py
{ "start": 791, "end": 2435 }
class ____(ProjectProfilingBaseEndpoint): def get(self, request: Request, project: Project, profile_id: str) -> HttpResponse: if not features.has("organizations:profiling", project.organization, actor=request.user): return Response(status=404) response = get_from_profiling_service( ...
ProjectProfilingProfileEndpoint
python
pypa__warehouse
tests/unit/manage/test_views.py
{ "start": 210727, "end": 216544 }
class ____: def test_revoke_invitation(self, db_request, token_service): project = ProjectFactory.create(name="foobar") user = UserFactory.create(username="testuser") RoleInvitationFactory.create(user=user, project=project) owner_user = UserFactory.create() RoleFactory(user=o...
TestRevokeRoleInvitation
python
huggingface__transformers
tests/models/blip/test_modeling_blip.py
{ "start": 10890, "end": 12411 }
class ____(ModelTesterMixin, unittest.TestCase): all_model_classes = (BlipTextModel,) if is_torch_available() else () def setUp(self): self.model_tester = BlipTextModelTester(self) self.config_tester = ConfigTester(self, config_class=BlipTextConfig, hidden_size=37) def test_config(self): ...
BlipTextModelTest
python
getsentry__sentry
src/sentry/search/events/types.py
{ "start": 7948, "end": 9265 }
class ____: auto_fields: bool = False auto_aggregations: bool = False use_aggregate_conditions: bool = False functions_acl: list[str] | None = None equation_config: dict[str, bool] | None = None # This allows queries to be resolved without adding time constraints. Currently this is just # us...
QueryBuilderConfig
python
TheAlgorithms__Python
graphs/edmonds_karp_multiple_source_and_sink.py
{ "start": 0, "end": 1887 }
class ____: def __init__(self, graph, sources, sinks): self.source_index = None self.sink_index = None self.graph = graph self._normalize_graph(sources, sinks) self.vertices_count = len(graph) self.maximum_flow_algorithm = None # make only one source and one sin...
FlowNetwork
python
django-extensions__django-extensions
tests/testapp/models.py
{ "start": 7124, "end": 7283 }
class ____(models.Model): title = models.CharField(max_length=42) slug = OverridedFindUniqueAutoSlugField(populate_from="title")
OverridedFindUniqueModel
python
ethereum__web3.py
web3/types.py
{ "start": 13600, "end": 13728 }
class ____(TypedDict, total=False): gas: int failed: bool returnValue: str structLogs: list[StructLog]
OpcodeTrace
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/dml.py
{ "start": 12297, "end": 12639 }
class ____(DMLState): isdelete = True def __init__(self, statement: Delete, compiler: SQLCompiler, **kw: Any): self.statement = statement self.isdelete = True t, ef = self._make_extra_froms(statement) self._primary_table = t self._extra_froms = ef self.is_multit...
DeleteDMLState
python
sqlalchemy__sqlalchemy
test/orm/inheritance/test_assorted_poly.py
{ "start": 69057, "end": 72935 }
class ____( fixtures.DeclarativeMappedTest, testing.AssertsCompiledSQL ): # test [ticket:4537]'s test case. run_create_tables = run_deletes = None run_setup_classes = run_setup_mappers = run_define_tables = "each" __dialect__ = "default" def _fixture(self, use_correlate_except): Base =...
CorrelateExceptWPolyAdaptTest
python
doocs__leetcode
lcp/LCP 03. 机器人大冒险/Solution.py
{ "start": 0, "end": 646 }
class ____: def robot(self, command: str, obstacles: List[List[int]], x: int, y: int) -> bool: vis = {(0, 0)} i = j = 0 for c in command: match c: case "U": j += 1 case "R": i += 1 vis.add((i, j))...
Solution
python
gevent__gevent
src/greentest/3.13/test_threading.py
{ "start": 3626, "end": 46163 }
class ____(BaseTestCase): maxDiff = 9999 @cpython_only def test_name(self): def func(): pass thread = threading.Thread(name="myname1") self.assertEqual(thread.name, "myname1") # Convert int name to str thread = threading.Thread(name=123) self.assertEqual(th...
ThreadTests
python
scipy__scipy
scipy/signal/tests/test_ltisys.py
{ "start": 39020, "end": 42914 }
class ____: def test_01(self): # Test bode() magnitude calculation (manual sanity check). # 1st order low-pass filter: H(s) = 1 / (s + 1), # cutoff: 1 rad/s, slope: -20 dB/decade # H(s=0.1) ~= 0 dB # H(s=1) ~= -3 dB # H(s=10) ~= -20 dB # H(s=100) ~= -...
Test_bode
python
kubernetes-client__python
kubernetes/client/models/v1_device_counter_consumption.py
{ "start": 383, "end": 5328 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attri...
V1DeviceCounterConsumption
python
walkccc__LeetCode
solutions/2030. Smallest K-Length Subsequence With Occurrences of a Letter/2030.py
{ "start": 0, "end": 889 }
class ____: def smallestSubsequence( self, s: str, k: int, letter: str, repetition: int, ) -> str: stack = [] # running string required = repetition nLetters = s.count(letter) for i, c in enumerate(s): # Make sure the length is sufficient: # Len(stack) := ...
Solution
python
django__django
tests/queries/models.py
{ "start": 8682, "end": 8909 }
class ____(models.Model): food = models.ForeignKey(Food, models.SET_NULL, to_field="name", null=True) meal = models.CharField(max_length=20) def __str__(self): return "%s at %s" % (self.food, self.meal)
Eaten
python
davidhalter__jedi
jedi/inference/compiled/subprocess/__init__.py
{ "start": 17839, "end": 19369 }
class ____: def __init__( self, subprocess: _InferenceStateProcess, access: DirectObjectAccess, id_: int, ) -> None: self.access = access self._subprocess = subprocess self.id = id_ def add_subprocess(self, subprocess): self._subprocess = subp...
AccessHandle
python
trekhleb__learn-python
src/classes/test_inheritance.py
{ "start": 617, "end": 3263 }
class ____(Person): """Example of the derived class The Base Class (in our case Person) must be defined in a scope containing the derived class definition. In place of a base class name, other arbitrary expressions are also allowed. Derived classes may override methods of their base classes. Because m...
Employee
python
airbytehq__airbyte
airbyte-ci/connectors/metadata_service/lib/metadata_service/models/generated/ConnectorMetadataDefinitionV0.py
{ "start": 1899, "end": 2133 }
class ____(BaseModel): __root__: Literal["alpha", "beta", "generally_available", "custom"] = Field( ..., description="enum that describes a connector's release stage", title="ReleaseStage", )
ReleaseStage
python
pydantic__pydantic
pydantic/networks.py
{ "start": 11644, "end": 18194 }
class ____: _constraints: ClassVar[UrlConstraints] = UrlConstraints() _url: _CoreMultiHostUrl def __init__(self, url: str | _CoreMultiHostUrl | _BaseMultiHostUrl) -> None: self._url = _build_type_adapter(self.__class__).validate_python(url)._url @property def scheme(self) -> str: "...
_BaseMultiHostUrl
python
spyder-ide__spyder
installers-conda/utils.py
{ "start": 635, "end": 734 }
class ____( RawDescriptionHelpFormatter, ArgumentDefaultsHelpFormatter ): pass
DocFormatter
python
django__django
tests/postgres_tests/test_indexes.py
{ "start": 6719, "end": 7445 }
class ____(IndexTestMixin, PostgreSQLSimpleTestCase): index_class = GistIndex def test_suffix(self): self.assertEqual(GistIndex.suffix, "gist") def test_deconstruction(self): index = GistIndex( fields=["title"], name="test_title_gist", buffering=False, fillfactor=80 ) ...
GistIndexTests
python
huggingface__transformers
src/transformers/models/glm4v/modeling_glm4v.py
{ "start": 5147, "end": 5968 }
class ____(nn.Module): def __init__(self, dim: int, context_dim: int, hidden_act: str, bias: bool = False) -> None: super().__init__() self.proj = nn.Linear(dim, dim, bias=bias) self.post_projection_norm = LayerNorm(dim) self.gate_proj = nn.Linear(dim, context_dim, bias=bias) ...
Glm4vVisionPatchMerger
python
great-expectations__great_expectations
contrib/capitalone_dataprofiler_expectations/capitalone_dataprofiler_expectations/expectations/expect_column_values_confidence_for_data_label_to_be_less_than_or_equal_to_threshold.py
{ "start": 2565, "end": 7979 }
class ____(ColumnMapExpectation): """Expect the column values to have a DataProfiler confidence threshold less than or equal to the specified threshold for the data label. This function builds upon the custom column map expectations of Great Expectations. This function asks the question a yes/no question of ea...
ExpectColumnValuesConfidenceForDataLabelToBeLessThanOrEqualToThreshold
python
pytorch__pytorch
torch/testing/_internal/common_quantization.py
{ "start": 84135, "end": 84574 }
class ____(nn.Module): def __init__(self) -> None: super().__init__() self.conv1 = FunctionalConv2d() self.relu = nn.ReLU() self.conv2 = FunctionalConv2d() def forward(self, x): x = self.conv1(x) x = self.relu(x) x = self.conv2(x) return x de...
FunctionalConvReluConvModel
python
pyqtgraph__pyqtgraph
pyqtgraph/Qt/__init__.py
{ "start": 1519, "end": 13002 }
class ____(object): """Used to defer ImportErrors until we are sure the module is needed. """ def __init__(self, err): self.err = err def __getattr__(self, attr): raise self.err # Make a loadUiType function like PyQt has # Credit: # http://stackoverflow.com/questions/4442286/...
FailedImport
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/testing/assertsql.py
{ "start": 11677, "end": 12134 }
class ____(AssertRule): def __init__(self, count): self.count = count self._statement_count = 0 def process_statement(self, execute_observed): self._statement_count += 1 def no_more_statements(self): if self.count != self._statement_count: assert False, "desired...
CountStatements