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
python-excel__xlrd
xlrd/xldate.py
{ "start": 1080, "end": 1165 }
class ____(ValueError): "A base class for all datetime-related errors."
XLDateError
python
pypa__pipenv
pipenv/vendor/click/types.py
{ "start": 25137, "end": 31872 }
class ____(ParamType): """The ``Path`` type is similar to the :class:`File` type, but returns the filename instead of an open file. Various checks can be enabled to validate the type of file and permissions. :param exists: The file or directory needs to exist for the value to be valid. If this ...
Path
python
dask__dask
dask/bag/core.py
{ "start": 12681, "end": 65067 }
class ____(DaskMethodsMixin): """Parallel collection of Python objects Examples -------- Create Bag from sequence >>> import dask.bag as db >>> b = db.from_sequence(range(5)) >>> list(b.filter(lambda x: x % 2 == 0).map(lambda x: x * 10)) [0, 20, 40] Create Bag from filename or glo...
Bag
python
plotly__plotly.py
plotly/graph_objs/scatterpolargl/marker/colorbar/_title.py
{ "start": 233, "end": 4070 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "scatterpolargl.marker.colorbar" _path_str = "scatterpolargl.marker.colorbar.title" _valid_props = {"font", "side", "text"} @property def font(self): """ Sets this color bar's title font. The 'font' property is an inst...
Title
python
matplotlib__matplotlib
lib/matplotlib/legend_handler.py
{ "start": 18613, "end": 18908 }
class ____(HandlerRegularPolyCollection): r"""Handler for `.CircleCollection`\s.""" def create_collection(self, orig_handle, sizes, offsets, offset_transform): return type(orig_handle)( sizes, offsets=offsets, offset_transform=offset_transform)
HandlerCircleCollection
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_merge_range04.py
{ "start": 315, "end": 905 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("merge_range04.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(self.got...
TestCompareXLSXFiles
python
apache__airflow
kubernetes-tests/tests/kubernetes_tests/test_kubernetes_pod_operator.py
{ "start": 3968, "end": 58813 }
class ____: @pytest.fixture(autouse=True) def setup_tests(self, test_label): self.api_client = ApiClient() self.labels = {"test_label": test_label} self.expected_pod = { "apiVersion": "v1", "kind": "Pod", "metadata": { "namespace": "def...
TestKubernetesPodOperatorSystem
python
pallets__click
src/click/types.py
{ "start": 16469, "end": 19122 }
class ____(_NumberParamTypeBase): def __init__( self, min: float | None = None, max: float | None = None, min_open: bool = False, max_open: bool = False, clamp: bool = False, ) -> None: self.min = min self.max = max self.min_open = min_open...
_NumberRangeBase
python
great-expectations__great_expectations
contrib/great_expectations_semantic_types_expectations/great_expectations_semantic_types_expectations/expectations/expect_column_values_url_hostname_match_with_cert.py
{ "start": 2074, "end": 4637 }
class ____(ColumnMapExpectation): """Expect provided url's hostname match with cert.""" # These examples will be shown in the public gallery. # They will also be executed as unit tests for your Expectation. examples = [ { "data": { "all_valid": [ ...
ExpectColumnValuesUrlHostnameMatchWithCert
python
TheAlgorithms__Python
other/word_search.py
{ "start": 489, "end": 15112 }
class ____: """ >>> ws = WordSearch(WORDS, WIDTH, HEIGHT) >>> ws.board # doctest: +ELLIPSIS [[None, ..., None], ..., [None, ..., None]] >>> ws.generate_board() """ def __init__(self, words: list[str], width: int, height: int) -> None: self.words = words self.width = width ...
WordSearch
python
django__django
tests/test_utils/tests.py
{ "start": 80868, "end": 83536 }
class ____(SimpleTestCase): def test_disallowed_database_connections(self): expected_message = ( "Database connections to 'default' are not allowed in SimpleTestCase " "subclasses. Either subclass TestCase or TransactionTestCase to " "ensure proper test isolation or add '...
DisallowedDatabaseQueriesTests
python
readthedocs__readthedocs.org
readthedocs/subscriptions/forms.py
{ "start": 218, "end": 1075 }
class ____(forms.Form): """Form to create a subscription after the previous one has ended.""" plan = forms.ChoiceField() def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) products_id = [product.stripe_id for product in get_listed_products()] stripe_prices = ( ...
PlanForm
python
davidhalter__jedi
test/completion/async_.py
{ "start": 1472, "end": 1776 }
class ____: def some_method(): pass async def __aenter__(self): return self async def __aexit__(self, *args): pass async def asyncctxmgr(): async with AsyncCtxMgr() as acm: #? AsyncCtxMgr() acm #? ['some_method'] acm.som
AsyncCtxMgr
python
kamyu104__LeetCode-Solutions
Python/spiral-matrix-iv.py
{ "start": 172, "end": 828 }
class ____(object): def spiralMatrix(self, m, n, head): """ :type m: int :type n: int :type head: Optional[ListNode] :rtype: List[List[int]] """ directions = [(0, 1), (1, 0), (0, -1), (-1, 0)] result = [[-1]*n for _ in xrange(m)] i = j = d = 0 ...
Solution
python
spack__spack
lib/spack/spack/vendor/jinja2/nativetypes.py
{ "start": 2703, "end": 3969 }
class ____(Template): environment_class = NativeEnvironment def render(self, *args: t.Any, **kwargs: t.Any) -> t.Any: """Render the template to produce a native Python type. If the result is a single node, its value is returned. Otherwise, the nodes are concatenated as strings. If the r...
NativeTemplate
python
getsentry__sentry
src/sentry/models/options/project_template_option.py
{ "start": 3378, "end": 4138 }
class ____(Model): """ A ProjectTemplateOption is a templated version of a project It is used to store the values that are shared between different projects across the organization. """ __relocation_scope__ = RelocationScope.Organization project_template = FlexibleForeignKey("sentry.Proje...
ProjectTemplateOption
python
google__pytype
pytype/pyi/modules.py
{ "start": 322, "end": 539 }
class ____: """Result of processing an import statement.""" pytd_node: Any name: str new_name: str qualified_name: str = "" def pytd_alias(self): return pytd.Alias(self.new_name, self.pytd_node)
Import
python
django__django
tests/forms_tests/widget_tests/test_multiwidget.py
{ "start": 1608, "end": 2293 }
class ____(MultiWidget): """ Used to test MultiWidget.__deepcopy__(). """ def __init__(self, choices=[]): widgets = [ RadioSelect(choices=choices), TextInput, ] super().__init__(widgets) def _set_choices(self, choices): """ When choic...
DeepCopyWidget
python
pennersr__django-allauth
tests/apps/socialaccount/providers/robinhood/tests.py
{ "start": 246, "end": 594 }
class ____(OAuth2TestsMixin, TestCase): provider_id = RobinhoodProvider.id def get_mocked_response(self): return MockedResponse( HTTPStatus.OK, """ { "username": "test_username", "id": "1234-5678-910" } """, ) def get_expected_to_str(self): retur...
RobinhoodTests
python
great-expectations__great_expectations
contrib/great_expectations_semantic_types_expectations/great_expectations_semantic_types_expectations/expectations/expect_column_values_are_in_language.py
{ "start": 1903, "end": 6539 }
class ____(ColumnMapExpectation): """Expect the column to be in a specified language. Args: column (str): \ The column name language (str): \ One of 97 ISO 639-1 language codes, e.g. af, am, an, ar, as, az, be, bg, bn, br, bs, ca, cs, cy, da, \ de, dz, el, en...
ExpectColumnValuesAreInLanguage
python
kamyu104__LeetCode-Solutions
Python/diameter-of-binary-tree.py
{ "start": 184, "end": 1113 }
class ____(object): def diameterOfBinaryTree(self, root): """ :type root: TreeNode :rtype: int """ def iter_dfs(node): result = 0 stk = [(1, [node, [0]])] while stk: step, params = stk.pop() if step == 1: ...
Solution
python
pytorch__pytorch
test/torch_np/numpy_tests/core/test_numeric.py
{ "start": 77510, "end": 77841 }
class ____(TestCase): def test_basic(self): A = np.array([1, 1.0j, -1, -1.0j]) real_var = 1 assert_almost_equal(np.var(A), real_var) assert_almost_equal(np.std(A) ** 2, real_var) def test_scalars(self): assert_equal(np.var(1j), 0) assert_equal(np.std(1j), 0)
TestStdVarComplex
python
tornadoweb__tornado
tornado/routing.py
{ "start": 890, "end": 6268 }
class ____ match on more criteria than `.Application`, or the `Router` interface can be subclassed for maximum customization. `Router` interface extends `~.httputil.HTTPServerConnectionDelegate` to provide additional routing capabilities. This also means that any `Router` implementation can be used directly as a ``req...
can
python
google__jax
tests/pallas/tpu_pallas_test.py
{ "start": 25919, "end": 57686 }
class ____(PallasBaseTest): def setUp(self): super().setUp() if not jtu.is_device_tpu_at_least(4): self.skipTest('DMAs not supported on TPU generations <= 3') def test_can_have_unspecified_memory_spaces(self): def kernel(x_ref, y_ref): # Just test whether things compile del x_ref, y_...
PallasCallDMATest
python
pytorch__pytorch
torch/distributed/fsdp/_fully_shard/_fsdp_state.py
{ "start": 2402, "end": 18049 }
class ____(_State): def __init__(self) -> None: super().__init__() self._fsdp_param_group: Optional[FSDPParamGroup] = None self._is_root: Optional[bool] = None # root set during lazy init self._state_ctx = FSDPStateContext() self._comm_ctx = FSDPCommContext() self._t...
FSDPState
python
spack__spack
lib/spack/spack/vendor/pyrsistent/_pdeque.py
{ "start": 163, "end": 12216 }
class ____(object): """ Persistent double ended queue (deque). Allows quick appends and pops in both ends. Implemented using two persistent lists. A maximum length can be specified to create a bounded queue. Fully supports the Sequence and Hashable protocols including indexing and slicing but ...
PDeque
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 24754, "end": 25020 }
class ____(sgqlc.types.Enum): """ See source code for more info. """ __schema__ = graphql_schema __choices__ = ( "AUTOMATED_KANBAN_V2", "AUTOMATED_REVIEWS_KANBAN", "BASIC_KANBAN", "BUG_TRIAGE", )
ProjectTemplate
python
huggingface__transformers
src/transformers/models/doge/modeling_doge.py
{ "start": 2499, "end": 3220 }
class ____(nn.Module): def __init__(self, hidden_size, eps=1e-6): """ DogeRMSNorm is equivalent to T5LayerNorm """ super().__init__() self.weight = nn.Parameter(torch.ones(hidden_size)) self.variance_epsilon = eps def forward(self, hidden_states): input_d...
DogeRMSNorm
python
wandb__wandb
wandb/errors/errors.py
{ "start": 368, "end": 604 }
class ____(Error): """Error communicating with W&B servers.""" def __init__(self, msg: str, exc: Exception | None = None) -> None: self.exc = exc self.message = msg super().__init__(self.message)
CommError
python
huggingface__transformers
tests/models/deepseek_vl/test_processing_deepseek_vl.py
{ "start": 840, "end": 2725 }
class ____(ProcessorTesterMixin, unittest.TestCase): processor_class = DeepseekVLProcessor @classmethod def _setup_tokenizer(cls): tokenizer_class = cls._get_component_class_from_processor("tokenizer") return tokenizer_class( vocab_file=SAMPLE_VOCAB, extra_special_to...
DeepseekVLProcessorTest
python
pytorch__pytorch
torch/_inductor/utils.py
{ "start": 52804, "end": 53646 }
class ____(IndentedBuffer): def __init__(self) -> None: super().__init__() def __getattribute__(self, name: str) -> Any: if name == "__class__": # Allow access to the class attribute return object.__getattribute__(self, name) raise RuntimeError( f"Tried to call ...
FakeIndentedBuffer
python
encode__starlette
tests/middleware/test_base.py
{ "start": 6204, "end": 42823 }
class ____(BaseHTTPMiddleware): async def dispatch( self, request: Request, call_next: RequestResponseEndpoint, ) -> Response: ctxvar.set("set by middleware") resp = await call_next(request) assert ctxvar.get() == "set by endpoint" return resp # pragma: n...
CustomMiddlewareUsingBaseHTTPMiddleware
python
tiangolo__fastapi
fastapi/responses.py
{ "start": 1216, "end": 1761 }
class ____(JSONResponse): """ JSON response using the high-performance orjson library to serialize data to JSON. Read more about it in the [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/). """ def render(self, content: Any)...
ORJSONResponse
python
spack__spack
var/spack/test_repos/spack_repo/builder_test/packages/gmake/package.py
{ "start": 217, "end": 539 }
class ____(Package): """Dummy GMake Package""" homepage = "https://www.gnu.org/software/make" url = "https://ftpmirror.gnu.org/make/make-4.4.tar.gz" version("4.4", sha256="ce35865411f0490368a8fc383f29071de6690cbadc27704734978221f25e2bed") def do_stage(self): mkdirp(self.stage.source_path)...
Gmake
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/tasks.py
{ "start": 37368, "end": 41210 }
class ____(GoogleCloudBaseOperator): """ Lists the tasks in Cloud Tasks. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:CloudTasksTasksListOperator` :param location: The location name in which the tasks were created. :p...
CloudTasksTasksListOperator
python
apache__airflow
providers/yandex/src/airflow/providers/yandex/operators/dataproc.py
{ "start": 14862, "end": 15463 }
class ____(DataprocBaseOperator): """ Deletes Yandex.Cloud Data Proc cluster. :param connection_id: ID of the Yandex.Cloud Airflow connection. :param cluster_id: ID of the cluster to remove. (templated) """ def __init__(self, *, connection_id: str | None = None, cluster_id: str | None = None, ...
DataprocDeleteClusterOperator
python
getsentry__sentry
src/sentry/backup/services/import_export/model.py
{ "start": 3961, "end": 5254 }
class ____(RpcModel): """ Shadows `sentry.backup.helpers.ImportFlags` for the purpose of passing it over an RPC boundary. """ merge_users: bool = False overwrite_configs: bool = False import_uuid: str | None = None # TODO(azaslavsky): Remove `None` variant once rolled out, set default to `F...
RpcImportFlags
python
great-expectations__great_expectations
contrib/great_expectations_geospatial_expectations/great_expectations_geospatial_expectations/expectations/expect_column_values_to_have_elevation.py
{ "start": 565, "end": 1894 }
class ____(ColumnMapMetricProvider): # This is the id string that will be used to reference your metric. # Please see {some doc} for information on how to choose an id string for your Metric. condition_metric_name = "column_values.elevated" condition_value_keys = () # This method defines the busine...
ColumnValuesHaveElevation
python
readthedocs__readthedocs.org
readthedocs/proxito/views/mixins.py
{ "start": 1122, "end": 1208 }
class ____(Exception): """An invalid path was passed to storage."""
InvalidPathError
python
bokeh__bokeh
src/bokeh/models/tiles.py
{ "start": 5360, "end": 5747 }
class ____(MercatorTileSource): ''' Has the same tile origin as the ``WMTSTileSource`` but requests tiles using a `quadkey` argument instead of X, Y, Z e.g. ``http://your.quadkey.tile.host/{Q}.png`` ''' # explicit __init__ to support Init signatures def __init__(self, *args: Any, **kwargs: Any...
QUADKEYTileSource
python
milvus-io__pymilvus
tests/test_bulk_writer_stage.py
{ "start": 7994, "end": 14566 }
class ____: """Test StageFileManager class.""" @pytest.fixture def stage_file_manager(self) -> StageFileManager: """Create a StageFileManager instance.""" return StageFileManager( cloud_endpoint="https://api.cloud.zilliz.com", api_key="test_api_key", stag...
TestStageFileManager
python
facebook__pyre-check
client/configuration/search_path.py
{ "start": 3338, "end": 4155 }
class ____(RawElement): root: str subdirectory: str def expand_global_root(self, global_root: str) -> "SubdirectoryRawElement": return SubdirectoryRawElement( root=filesystem.expand_global_root(self.root, global_root=global_root), subdirectory=self.subdirectory, ) ...
SubdirectoryRawElement
python
pytorch__pytorch
torch/distributions/categorical.py
{ "start": 317, "end": 6221 }
class ____(Distribution): r""" Creates a categorical distribution parameterized by either :attr:`probs` or :attr:`logits` (but not both). .. note:: It is equivalent to the distribution that :func:`torch.multinomial` samples from. Samples are integers from :math:`\{0, \ldots, K-1\}`...
Categorical
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/links/translate.py
{ "start": 3754, "end": 4107 }
class ____(BaseGoogleLink): """ Helper class for constructing Translation Legacy Model Predict link. Legacy Models are created and managed by AutoML API. """ name = "Translation Legacy Model Predict" key = "translation_legacy_model_predict" format_str = TRANSLATION_LEGACY_MODEL_PREDICT_LIN...
TranslationLegacyModelPredictLink
python
numba__numba
numba/core/typing/templates.py
{ "start": 16986, "end": 17197 }
class ____(InternalError): def __init__(self, reason): super(_EmptyImplementationEntry, self).__init__( "_EmptyImplementationEntry({!r})".format(reason), )
_EmptyImplementationEntry
python
doocs__leetcode
solution/0900-0999/0940.Distinct Subsequences II/Solution2.py
{ "start": 0, "end": 230 }
class ____: def distinctSubseqII(self, s: str) -> int: mod = 10**9 + 7 dp = [0] * 26 for c in s: i = ord(c) - ord('a') dp[i] = sum(dp) % mod + 1 return sum(dp) % mod
Solution
python
facebook__pyre-check
client/commands/tests/infer_test.py
{ "start": 14488, "end": 26199 }
class ____(testslide.TestCase): maxDiff = 2000 def test_module_annotations_from_infer_output(self) -> None: def assert_result( path: str, infer_output: infer.RawInferOutputForPath, options: infer.StubGenerationOptions, expected: infer.ModuleAnnotations, ...
ModuleAnnotationTest
python
pytorch__pytorch
test/test_datapipe.py
{ "start": 21650, "end": 22537 }
class ____(IterDataPipe): def __init__(self, input_dp): super().__init__() self.input_dp = input_dp # Prevent in-place modification def __iter__(self): input_dp = ( self.input_dp if isinstance(self.input_dp, IterDataPipe) else copy.deepcopy(self.i...
IDP_NoLen
python
pytorch__pytorch
test/nn/attention/test_fa4.py
{ "start": 4095, "end": 10014 }
class ____(TestCase): @classmethod def setUpClass(cls): super().setUpClass() if not _fa4_dependencies_available(): return # This might pollute tests.. TODO activate_flash_attention_impl("FA4") @unittest.skipUnless(_fa4_dependencies_available(), "FA4 backend unava...
TestFlashAttentionFA4
python
keras-team__keras
keras/src/trainers/data_adapters/generator_data_adapter_test.py
{ "start": 874, "end": 8528 }
class ____(testing.TestCase): @parameterized.named_parameters( named_product( [ {"testcase_name": "use_weight", "use_sample_weight": True}, {"testcase_name": "no_weight", "use_sample_weight": False}, ], generator_type=["np", "tf", "jax", "t...
GeneratorDataAdapterTest
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/sparse_ops/sparse_tensor_dense_matmul_op_d9m_test.py
{ "start": 2528, "end": 3860 }
class ____(test.TestCase): """Test d9m-unimplemented exceptions from SparseTensorDenseMatmulOp. Test that tf.errors.UnimplementedError is thrown, as appropriate, by the GPU-specific code-paths through SparseTensorDenseMatmulOp when deterministic ops are enabled. This test assumes that sparse_tensor_dense_ma...
SparseTensorDenseMatmulOpDeterminismExceptionsTest
python
spyder-ide__spyder
spyder/utils/syntaxhighlighters.py
{ "start": 67666, "end": 68689 }
class ____(GenericSH): """gettext Syntax Highlighter""" # Syntax highlighting rules: PROG = re.compile(make_gettext_patterns(), re.S) #============================================================================== # yaml highlighter #=========================================================================...
GetTextSH
python
mamba-org__mamba
micromamba/tests/test_config.py
{ "start": 3153, "end": 6558 }
class ____: @pytest.mark.parametrize( "rc_file", (("home", "dummy.yaml"), ("home", ".mambarc")), indirect=True ) @pytest.mark.parametrize("rc_file_args", ({"override_channels_enabled": True},), indirect=True) @pytest.mark.parametrize("quiet_flag", ["-q", "--quiet"]) @pytest.mark.parametrize(...
TestConfigSources
python
ray-project__ray
python/ray/autoscaler/_private/gcp/node.py
{ "start": 5176, "end": 5888 }
class ____(GCPNode): """Abstraction around compute nodes""" # https://cloud.google.com/compute/docs/instances/instance-life-cycle NON_TERMINATED_STATUSES = {"PROVISIONING", "STAGING", "RUNNING"} TERMINATED_STATUSES = {"TERMINATED", "SUSPENDED"} RUNNING_STATUSES = {"RUNNING"} STATUS_FIELD = "sta...
GCPComputeNode
python
matplotlib__matplotlib
galleries/examples/widgets/menu.py
{ "start": 400, "end": 2639 }
class ____(artist.Artist): padx = 0.05 # inches pady = 0.05 def __init__(self, fig, labelstr, props=None, hoverprops=None, on_select=None): super().__init__() self.set_figure(fig) self.labelstr = labelstr self.props = props if props is not None else ItemP...
MenuItem
python
doocs__leetcode
solution/2900-2999/2908.Minimum Sum of Mountain Triplets I/Solution.py
{ "start": 0, "end": 446 }
class ____: def minimumSum(self, nums: List[int]) -> int: n = len(nums) right = [inf] * (n + 1) for i in range(n - 1, -1, -1): right[i] = min(right[i + 1], nums[i]) ans = left = inf for i, x in enumerate(nums): if left < x and right[i + 1] < x: ...
Solution
python
langchain-ai__langchain
libs/langchain/langchain_classic/chains/conversational_retrieval/base.py
{ "start": 2439, "end": 2695 }
class ____(BaseModel): """Input type for ConversationalRetrievalChain.""" question: str """The question to answer.""" chat_history: list[CHAT_TURN_TYPE] = Field(default_factory=list) """The chat history to use for retrieval."""
InputType
python
scipy__scipy
scipy/special/tests/test_basic.py
{ "start": 62438, "end": 68800 }
class ____: def test_ellipj_nan(self): """Regression test for #912.""" special.ellipj(0.5, np.nan) def test_ellipj(self): el = special.ellipj(0.2,0) rel = [sin(0.2),cos(0.2),1.0,0.20] assert_allclose(el, rel, atol=1.5e-13, rtol=0) def test_ellipk(self): elk ...
TestEllip
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1028138, "end": 1028857 }
class ____(sgqlc.types.Type): """Autogenerated return type of UpdateEnterpriseTeamDiscussionsSetting """ __schema__ = github_schema __field_names__ = ("client_mutation_id", "enterprise", "message") client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId") """A unique i...
UpdateEnterpriseTeamDiscussionsSettingPayload
python
Pylons__pyramid
src/pyramid/authentication.py
{ "start": 27342, "end": 40771 }
class ____: """ A helper class for security policies that obtains data from an "auth ticket" cookie. Constructor Arguments ``secret`` The secret (a string) used for auth_tkt cookie signing. This value should be unique across all values provided to Pyramid for various subsyst...
AuthTktCookieHelper
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/links/test_batch.py
{ "start": 2140, "end": 2977 }
class ____(BaseAwsLinksTestCase): link_class = BatchJobDetailsLink def test_extra_link(self, mock_supervisor_comms): if AIRFLOW_V_3_0_PLUS and mock_supervisor_comms: mock_supervisor_comms.send.return_value = XComResult( key=self.link_class.key, value={ ...
TestBatchJobDetailsLink
python
aimacode__aima-python
logic4e.py
{ "start": 31810, "end": 32561 }
class ____: def __init__(self, x, y, orientation): self.X = x self.Y = y self.orientation = orientation def get_location(self): return self.X, self.Y def set_location(self, x, y): self.X = x self.Y = y def get_orientation(self): return self.orie...
WumpusPosition
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/roots/mutation.py
{ "start": 31819, "end": 32186 }
class ____(graphene.Mutation): """Store whether we've shown the nux to any user and they've dismissed or submitted it.""" Output = graphene.NonNull(graphene.Boolean) class Meta: name = "SetNuxSeenMutation" @capture_error def mutate(self, _graphene_info): set_nux_seen() ret...
GrapheneSetNuxSeenMutation
python
kamyu104__LeetCode-Solutions
Python/cracking-the-safe.py
{ "start": 33, "end": 609 }
class ____(object): def crackSafe(self, n, k): """ :type n: int :type k: int :rtype: str """ M = k**(n-1) P = [q*k+i for i in xrange(k) for q in xrange(M)] # rotate: i*k^(n-1) + q => q*k + i result = [str(k-1)]*(n-1) for i in xrange(k**n): ...
Solution
python
redis__redis-py
tests/test_asyncio/test_multidb/test_failure_detector.py
{ "start": 412, "end": 5190 }
class ____: @pytest.mark.asyncio @pytest.mark.parametrize( "min_num_failures,failure_rate_threshold,circuit_state", [ (2, 0.4, CBState.OPEN), (2, 0, CBState.OPEN), (0, 0.4, CBState.OPEN), (3, 0.4, CBState.CLOSED), (2, 0.41, CBState.CLOS...
TestFailureDetectorAsyncWrapper
python
more-itertools__more-itertools
tests/test_more.py
{ "start": 174251, "end": 175872 }
class ____(TestCase): def test_r_less_than_n(self): iterable = 'abcdefg' r = 4 first_index = {} for index, element in enumerate(permutations(iterable, r)): actual = mi.permutation_index(element, iterable) expected = first_index.setdefault(element, index) ...
PermutationIndexTests
python
mitmproxy__pdoc
test/test_snapshot.py
{ "start": 301, "end": 7433 }
class ____: id: str specs: list[str] render_options: dict with_output_directory: bool min_version: tuple[int, int] warnings: list[str] def __init__( self, id: str, specs: list[str] | None = None, render_options: dict | None = None, with_output_directo...
Snapshot
python
pennersr__django-allauth
allauth/socialaccount/providers/battlenet/views.py
{ "start": 2059, "end": 4749 }
class ____(OAuth2Adapter): """ OAuth2 adapter for Battle.net https://dev.battle.net/docs/read/oauth Region is set to us by default, but can be overridden with the `region` GET parameter when performing a login. Can be any of eu, us, kr, sea, tw or cn """ provider_id = "battlenet" ...
BattleNetOAuth2Adapter
python
sphinx-doc__sphinx
sphinx/ext/autodoc/_legacy_class_based/_documenters.py
{ "start": 42451, "end": 43770 }
class ____(Documenter): """Specialized Documenter subclass for objects on class level (methods, attributes). """ def resolve_name( self, modname: str | None, parents: Any, path: str, base: str ) -> tuple[str | None, list[str]]: if modname is not None: return modname, [*p...
ClassLevelDocumenter
python
astropy__astropy
astropy/extern/ply/yacc.py
{ "start": 10276, "end": 53858 }
class ____: def __init__(self, lrtab, errorf): self.productions = lrtab.lr_productions self.action = lrtab.lr_action self.goto = lrtab.lr_goto self.errorfunc = errorf self.set_defaulted_states() self.errorok = True def errok(self): self.errorok = True ...
LRParser
python
huggingface__transformers
examples/modular-transformers/modeling_dummy_bert.py
{ "start": 5644, "end": 8771 }
class ____(nn.Module): def __init__(self, config, is_causal=False, layer_idx=None): super().__init__() if config.hidden_size % config.num_attention_heads != 0 and not hasattr(config, "embedding_size"): raise ValueError( f"The hidden size ({config.hidden_size}) is not a mu...
DummyBertSelfAttention
python
kamyu104__LeetCode-Solutions
Python/watering-plants-ii.py
{ "start": 29, "end": 803 }
class ____(object): def minimumRefill(self, plants, capacityA, capacityB): """ :type plants: List[int] :type capacityA: int :type capacityB: int :rtype: int """ result = 0 left, right = 0, len(plants)-1 canA, canB = capacityA, capacityB ...
Solution
python
dagster-io__dagster
python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/generated/sources.py
{ "start": 211435, "end": 212433 }
class ____(GeneratedAirbyteSource): @public def __init__( self, name: str, application_id: str, application_secret: str, token: str, start_date: str ): """Airbyte Source for Linnworks. Documentation can be found at https://docs.airbyte.com/integrations/sources/linnworks Arg...
LinnworksSource
python
Pylons__pyramid
src/pyramid/interfaces.py
{ "start": 25126, "end": 25415 }
class ____(Interface): """A utility which generates a response""" def __call__(request): """Return a response object implementing IResponse, e.g. :class:`pyramid.response.Response`). It should handle the case when ``request`` is ``None``."""
IResponseFactory
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/initsubclass1.py
{ "start": 428, "end": 542 }
class ____(ClassA, param1=0, param2=4): pass # This should generate two errors because param2 is missing.
ClassB
python
google__jax
jax/experimental/mosaic/gpu/core.py
{ "start": 8835, "end": 8986 }
class ____: collective_dims: Sequence[gpu.Dimension] arrival_count: int = 1 num_barriers: int = 1 @dataclasses.dataclass(frozen=True)
ClusterBarrier
python
PrefectHQ__prefect
src/integrations/prefect-snowflake/prefect_snowflake/credentials.py
{ "start": 1115, "end": 1193 }
class ____(Exception): """Invalid PEM Format Certificate"""
InvalidPemFormat
python
mwaskom__seaborn
seaborn/_core/plot.py
{ "start": 4222, "end": 6223 }
class ____(mpl.RcParams): """ Configuration object for the Plot.theme, using matplotlib rc parameters. """ THEME_GROUPS = [ "axes", "figure", "font", "grid", "hatch", "legend", "lines", "mathtext", "markers", "patch", "savefig", "scatter", "xaxis", "xtick", "yaxis", "ytick", ...
ThemeConfig
python
django__django
django/db/models/lookups.py
{ "start": 28249, "end": 28305 }
class ____(UUIDTextMixin, IEndsWith): pass
UUIDIEndsWith
python
django__django
tests/model_forms/models.py
{ "start": 10079, "end": 10201 }
class ____(models.Model): name = models.CharField(max_length=10) markup = MarkupField()
CustomFieldForExclusionModel
python
neetcode-gh__leetcode
python/0605-can-place-flowers.py
{ "start": 420, "end": 1119 }
class ____: def canPlaceFlowers(self, flowerbed: List[int], n: int) -> bool: # Another solution with O(1) space complexity for i in range(len(flowerbed)): if n == 0: return True if ((i == 0 or flowerbed[i - 1] == 0) # If at the first element or the previous el...
Solution2
python
google__pytype
pytype/overlays/fiddle_overlay.py
{ "start": 9976, "end": 13228 }
class ____(Buildable): """An instantiation of a fiddle.Partial with a particular template.""" def __init__(self, *args, **kwargs): super().__init__("Partial", *args, **kwargs) def _convert_type(typ, subst, ctx): """Helper function for recursive type conversion of fields.""" if isinstance(typ, abstract.Ty...
Partial
python
pyodide__pyodide
src/py/pyodide/console.py
{ "start": 7366, "end": 9047 }
class ____(Future[Any]): # TODO: Figure out proper SKIPIF syntax for Firefox and Safari """ A future with extra fields used as the return value for :py:class:`Console` APIs. Example: >>> from pyodide.console import Console # doctest: +SKIP >>> console = Console() # doctest: +SKIP ...
ConsoleFuture
python
sanic-org__sanic
tests/benchmark/test_route_resolution_benchmark.py
{ "start": 240, "end": 2214 }
class ____: @mark.asyncio async def test_resolve_route_no_arg_string_path( self, sanic_router, route_generator, benchmark ): simple_routes = route_generator.generate_random_direct_route( max_route_depth=4 ) router, simple_routes = sanic_router(route_details=simple...
TestSanicRouteResolution
python
sympy__sympy
sympy/integrals/manualintegrate.py
{ "start": 3984, "end": 4310 }
class ____(Rule): """integrate(a*f(x), x) -> a*integrate(f(x), x)""" constant: Expr other: Expr substep: Rule def eval(self) -> Expr: return self.constant * self.substep.eval() def contains_dont_know(self) -> bool: return self.substep.contains_dont_know() @dataclass
ConstantTimesRule
python
ray-project__ray
python/ray/data/tests/conftest.py
{ "start": 14239, "end": 17511 }
class ____: def __init__(self, task_count=None, object_store_stats=None, actor_count=None): self.task_count = task_count self.object_store_stats = object_store_stats self.actor_count = actor_count def get_task_count(self): return self.task_count def get_object_store_stats(s...
CoreExecutionMetrics
python
run-llama__llama_index
llama-index-core/tests/memory/test_memory_blocks_base.py
{ "start": 226, "end": 573 }
class ____(BaseMemoryBlock[str]): """Memory block that returns text content.""" async def _aget(self, messages: List[ChatMessage], **kwargs: Any) -> str: return "Simple text content from TextMemoryBlock" async def _aput(self, messages: List[ChatMessage]) -> None: # Just a no-op for testing...
TextMemoryBlock
python
crytic__slither
slither/detectors/operations/unchecked_send_return_value.py
{ "start": 314, "end": 1411 }
class ____(UnusedReturnValues): """ If the return value of a send is not checked, it might lead to losing ether """ ARGUMENT = "unchecked-send" HELP = "Unchecked send" IMPACT = DetectorClassification.MEDIUM CONFIDENCE = DetectorClassification.MEDIUM WIKI = "https://github.com/crytic/sl...
UncheckedSend
python
pennersr__django-allauth
allauth/account/models.py
{ "start": 6922, "end": 10994 }
class ____: """ Represents a user that is in the process of logging in. Keyword arguments: signup -- Indicates whether or not sending the email is essential (during signup), or if it can be skipped (e.g. in case email verification is optional and we are only logging in). """ # Optiona...
Login
python
getsentry__sentry
src/sentry/web/frontend/debug/debug_new_user_feedback_email.py
{ "start": 402, "end": 1635 }
class ____(View): def get(self, request: HttpRequest) -> HttpResponse: org = Organization(id=1, slug="organization", name="My Company") project = Project(id=1, organization=org, slug="project", name="My Project") event = create_sample_event( project=project, platform="python", e...
DebugNewUserFeedbackEmailView
python
spyder-ide__spyder
spyder/plugins/debugger/plugin.py
{ "start": 1541, "end": 24083 }
class ____(SpyderDockablePlugin, ShellConnectPluginMixin, RunExecutor): """Debugger plugin.""" NAME = 'debugger' REQUIRES = [Plugins.IPythonConsole, Plugins.Preferences, Plugins.Run] OPTIONAL = [Plugins.Editor, Plugins.MainMenu, Plugins.Toolbar] TABIFY = [Plugins.VariableExplorer, Plugins.Help] ...
Debugger
python
pytorch__pytorch
torch/distributions/mixture_same_family.py
{ "start": 317, "end": 8689 }
class ____(Distribution): r""" The `MixtureSameFamily` distribution implements a (batch of) mixture distribution where all component are from different parameterizations of the same distribution type. It is parameterized by a `Categorical` "selecting distribution" (over `k` component) and a componen...
MixtureSameFamily
python
qdrant__qdrant-client
qdrant_client/client_base.py
{ "start": 132, "end": 12301 }
class ____: def __init__(self, **kwargs: Any): pass def search_matrix_offsets( self, collection_name: str, query_filter: Optional[types.Filter] = None, limit: int = 3, sample: int = 10, using: Optional[str] = None, **kwargs: Any, ) -> types.Se...
QdrantBase
python
numba__numba
numba/tests/pdlike_usecase.py
{ "start": 1959, "end": 3851 }
class ____(types.ArrayCompatible): """ The type class for Series objects. """ array_priority = 1000 def __init__(self, dtype, index): assert isinstance(index, IndexType) self.dtype = dtype self.index = index self.values = types.Array(self.dtype, 1, 'C') name ...
SeriesType
python
doocs__leetcode
solution/0900-0999/0925.Long Pressed Name/Solution.py
{ "start": 0, "end": 535 }
class ____: def isLongPressedName(self, name: str, typed: str) -> bool: m, n = len(name), len(typed) i = j = 0 while i < m and j < n: if name[i] != typed[j]: return False x = i + 1 while x < m and name[x] == name[i]: x += 1 ...
Solution
python
doocs__leetcode
solution/1700-1799/1737.Change Minimum Characters to Satisfy One of Three Conditions/Solution.py
{ "start": 0, "end": 610 }
class ____: def minCharacters(self, a: str, b: str) -> int: def f(cnt1, cnt2): for i in range(1, 26): t = sum(cnt1[i:]) + sum(cnt2[:i]) nonlocal ans ans = min(ans, t) m, n = len(a), len(b) cnt1 = [0] * 26 cnt2 = [0] * 26 ...
Solution
python
geekcomputers__Python
venv/Lib/site-packages/pip/_internal/exceptions.py
{ "start": 20923, "end": 23832 }
class ____(DiagnosticPipError): """The current environment is externally managed. This is raised when the current environment is externally managed, as defined by `PEP 668`_. The ``EXTERNALLY-MANAGED`` configuration is checked and displayed when the error is bubbled up to the user. :param error: T...
ExternallyManagedEnvironment
python
huggingface__transformers
src/transformers/models/visual_bert/modeling_visual_bert.py
{ "start": 18343, "end": 18837 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.predictions = VisualBertLMPredictionHead(config) self.seq_relationship = nn.Linear(config.hidden_size, 2) def forward(self, sequence_output, pooled_output): prediction_scores = self.predictions(sequence_o...
VisualBertPreTrainingHeads
python
coleifer__peewee
tests/fields.py
{ "start": 43427, "end": 43547 }
class ____(TestModel): schedule = ForeignKeyField(Schedule) name = TextField() last_run = DateTimeField()
Task
python
spack__spack
lib/spack/spack/vendor/macholib/mach_o.py
{ "start": 43697, "end": 46822 }
class ____(Structure): _fields_ = ( ("cputype", cpu_type_t), ("cpusubtype", cpu_subtype_t), ("offset", p_uint64), ("size", p_uint64), ("align", p_uint32), ("reserved", p_uint32), ) REBASE_TYPE_POINTER = 1 # noqa: E221 REBASE_TYPE_TEXT_ABSOLUTE32 = 2 # noqa: E2...
fat_arch64