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/llava_next_video/modeling_llava_next_video.py
{ "start": 2095, "end": 3445 }
class ____(BaseModelOutputWithPast): r""" past_key_values (`Cache`, *optional*, returned when `use_cache=True` is passed or when `config.use_cache=True`): It is a [`~cache_utils.Cache`] instance. For more details, see our [kv cache guide](https://huggingface.co/docs/transformers/en/kv_cache). C...
LlavaNextVideoModelOutputWithPast
python
scipy__scipy
scipy/spatial/tests/test_distance.py
{ "start": 63231, "end": 64693 }
class ____: def test_num_obs_y_multi_matrix(self): for n in range(2, 10): X = np.random.rand(n, 4) Y = wpdist_no_const(X) assert_equal(num_obs_y(Y), n) def test_num_obs_y_1(self): # Tests num_obs_y(y) on a condensed distance matrix over 1 # observati...
TestNumObsY
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/logs/events.py
{ "start": 4508, "end": 4677 }
class ____(graphene.ObjectType): class Meta: interfaces = (GrapheneMessageEvent, GrapheneRunEvent) name = "AlertFailureEvent"
GrapheneAlertFailureEvent
python
pypa__pipenv
pipenv/vendor/pipdeptree/_cli.py
{ "start": 5205, "end": 7346 }
class ____(Action): """ Generic action that exists to convert a string into a Enum value that is then added into a `Namespace` object. This custom action exists because argparse doesn't have support for enums. References ---------- - https://github.com/python/cpython/issues/69247#issuecomment-...
EnumAction
python
viewflow__viewflow
viewflow/workflow/admin.py
{ "start": 595, "end": 1648 }
class ____(admin.ModelAdmin): """List all of viewflow process.""" icon = '<i class="material-icons">assignment</i>' actions = None date_hierarchy = "created" list_display = ["pk", "created", "flow_class", "status", "participants", "brief"] list_display_links = ["pk", "created", "flow_class"] ...
ProcessAdmin
python
dagster-io__dagster
python_modules/dagster/dagster/_config/config_type.py
{ "start": 4468, "end": 4757 }
class ____(ConfigScalar): def __init__(self, scalar_kind, description=None): super().__init__( key=type(self).__name__, given_name=type(self).__name__, scalar_kind=scalar_kind, description=description, )
BuiltinConfigScalar
python
PrefectHQ__prefect
tests/cli/test_transfer.py
{ "start": 6614, "end": 8313 }
class ____: """Test resource collection from source profile.""" @patch("prefect.cli.transfer.load_profiles") @patch("prefect.cli.transfer.use_profile") @patch("prefect.cli.transfer.get_client") async def test_transfer_no_resources_found( self, mock_get_client: MagicMock, moc...
TestResourceCollection
python
Textualize__textual
docs/examples/how-to/layout.py
{ "start": 418, "end": 567 }
class ____(Placeholder): DEFAULT_CSS = """ Tweet { height: 5; width: 1fr; border: tall $background; } """
Tweet
python
weaviate__weaviate-python-client
weaviate/exceptions.py
{ "start": 12638, "end": 12952 }
class ____(WeaviateBaseError): """Is raised when a request to Weaviate fails and is retried multiple times.""" def __init__(self, message: str, count: int) -> None: msg = f"""The request to Weaviate failed after {count} retries. Details: {message}""" super().__init__(msg)
WeaviateRetryError
python
walkccc__LeetCode
solutions/2689. Extract Kth Character From The Rope Tree/2689.py
{ "start": 0, "end": 394 }
class ____: def getKthCharacter(self, root: object | None, k: int) -> str: """:type root: RopeTreeNode | None""" if root.len == 0: return root.val[k - 1] leftLen = (0 if not root.left else max(root.left.len, len(root.left.val))) if leftLen >= k: return self.getKthCharacter(r...
Solution
python
google__pytype
pytype/pyc/compiler.py
{ "start": 959, "end": 7380 }
class ____(Exception): """A compilation error.""" def __init__(self, msg): super().__init__(msg) match = _COMPILE_ERROR_RE.match(msg) if match: self.error = match.group(1) self.filename = match.group(2) self.line = int(match.group(3)) else: self.error = msg self.filena...
CompileError
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/orm/collections.py
{ "start": 47913, "end": 48002 }
class ____(Set[_T]): """An instrumented version of the built-in set."""
InstrumentedSet
python
doocs__leetcode
lcof/面试题56 - II. 数组中数字出现的次数 II/Solution.py
{ "start": 0, "end": 262 }
class ____: def singleNumber(self, nums: List[int]) -> int: cnt = [0] * 32 for x in nums: for i in range(32): cnt[i] += x & 1 x >>= 1 return sum(1 << i for i in range(32) if cnt[i] % 3)
Solution
python
tensorflow__tensorflow
tensorflow/python/training/training.py
{ "start": 18555, "end": 25641 }
class ____(typing.NamedTuple): context: Dict[str, Feature] feature_lists: FeatureLists ``` To parse a `SequenceExample` in TensorFlow refer to the `tf.io.parse_sequence_example` function. The `context` contains features which apply to the entire example. The `feature_lists` contain a key, value map where each key...
SequenceExample
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_errorbars07.py
{ "start": 315, "end": 2240 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_errorbars07.xlsx") self.ignore_elements = {"xl/charts/chart1.xml": ["<c:formatCode"]} def test_create_file(self): """Test th...
TestCompareXLSXFiles
python
keras-team__keras
keras/src/optimizers/lion_test.py
{ "start": 178, "end": 3782 }
class ____(testing.TestCase): def test_invalid_beta_1(self): with self.assertRaisesRegex( ValueError, "Argument `beta_1` must be in the \\[0, 1\\] range. Otherwise, the " "optimizer degenerates to SignSGD. Received: beta_1=-0.1.", ): Lion(beta_1=-0.1) ...
LionTest
python
readthedocs__readthedocs.org
readthedocs/projects/migrations/0059_migrate_null_rank.py
{ "start": 321, "end": 543 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("projects", "0058_update_timestamp_fields"), ] operations = [ migrations.RunPython(forwards_func), ]
Migration
python
fastai__fastai
fastai/interpret.py
{ "start": 4482, "end": 7727 }
class ____(Interpretation): "Interpretation methods for classification models." def __init__(self, learn:Learner, dl:DataLoader, # `DataLoader` to run inference over losses:TensorBase, # Losses calculated from `dl` act=None # Activation function for prediction ): s...
ClassificationInterpretation
python
ray-project__ray
python/ray/serve/tests/test_metrics_2.py
{ "start": 1325, "end": 1545 }
class ____: def __init__(self, deployment_name: str, app_name: str): self.handle = DeploymentHandle(deployment_name, app_name) async def call(self, *args): await self.handle.remote(*args)
CallActor
python
django__django
tests/nested_foreign_keys/models.py
{ "start": 353, "end": 450 }
class ____(Event): movie = models.ForeignKey(Movie, models.SET_NULL, null=True)
ScreeningNullFK
python
huggingface__transformers
src/transformers/models/hiera/modeling_hiera.py
{ "start": 44352, "end": 47273 }
class ____(nn.Module): def __init__(self, config: HieraConfig): super().__init__() self.mask_unit_spatial_shape_final = [ i // s ** (config.num_query_pool) for i, s in zip(config.masked_unit_size, config.query_stride) ] self.stage_dimensions = [ int(config.emb...
HieraMultiScaleHead
python
allegroai__clearml
clearml/backend_api/services/v2_20/models.py
{ "start": 111263, "end": 112710 }
class ____(Request): """ Get the list of frameworks used in the company models :param projects: The list of projects which models will be analyzed. If not passed or empty then all the company and public models will be analyzed :type projects: Sequence[str] """ _service = "models" _...
GetFrameworksRequest
python
django__django
tests/m2m_signals/models.py
{ "start": 148, "end": 393 }
class ____(models.Model): name = models.CharField(max_length=20) default_parts = models.ManyToManyField(Part) optional_parts = models.ManyToManyField(Part, related_name="cars_optional") class Meta: ordering = ("name",)
Car
python
getsentry__sentry
src/sentry/auth/services/auth/impl.py
{ "start": 8185, "end": 9217 }
class ____: d: Mapping[str, str | bytes | None] _accessed: set[str] def __init__(self, **d: Any): self.d = d self._accessed = set() @property def accessed(self) -> bool: return bool(self._accessed) def __getitem__(self, item: str) -> str | bytes: self._accessed...
FakeRequestDict
python
weaviate__weaviate-python-client
weaviate/collections/classes/config.py
{ "start": 60180, "end": 60364 }
class ____(_ConfigBase): factor: int async_enabled: bool deletion_strategy: ReplicationDeletionStrategy ReplicationConfig = _ReplicationConfig @dataclass
_ReplicationConfig
python
cython__cython
Cython/Debugger/libcython.py
{ "start": 48248, "end": 48916 }
class ____(CyCName): """ Get the value of a Cython variable. """ @libpython.dont_suppress_errors @require_cython_frame @gdb_function_value_to_unicode def invoke(self, cyname, frame=None): globals_dict = self.get_cython_globals_dict() cython_function = self.get_cython_functio...
CyCValue
python
ray-project__ray
python/ray/serve/tests/test_handle_streaming.py
{ "start": 9263, "end": 10020 }
class ____: def test_app_handle(self, deployment: Deployment): h = serve.run(deployment.bind()).options(stream=True) gen = h.remote(5) assert list(gen) == list(range(5)) def test_deployment_handle(self, deployment: Deployment): @serve.deployment class Delegate: ...
TestGeneratorFunctionDeployment
python
nedbat__coveragepy
tests/test_concurrency.py
{ "start": 23871, "end": 28210 }
class ____(CoverageTest): """Tests of our handling of SIGTERM.""" @pytest.mark.parametrize("sigterm", [False, True]) def test_sigterm_multiprocessing_saves_data(self, sigterm: bool) -> None: # A terminated process should save its coverage data. self.make_file( "clobbered.py", ...
SigtermTest
python
pytorch__pytorch
torch/_dynamo/device_interface.py
{ "start": 1359, "end": 5606 }
class ____: """ This is a simple device runtime interface for Inductor. It enables custom backends to be integrated with Inductor in a device-agnostic semantic. """ class device: def __new__(cls, device: torch.types.Device) -> Any: raise NotImplementedError class Event: ...
DeviceInterface
python
pyinstaller__pyinstaller
PyInstaller/__main__.py
{ "start": 1355, "end": 2501 }
class ____(argparse.HelpFormatter): def _split_lines(self, text, width): if text.startswith('R|'): # The underlying implementation of ``RawTextHelpFormatter._split_lines`` invokes this; mimic it. return text[2:].splitlines() else: # Invoke the usual formatter. ...
_SmartFormatter
python
django__django
tests/migration_test_data_persistence/tests.py
{ "start": 514, "end": 1163 }
class ____(TransactionTestCase): """ Data loaded in migrations is available during class setup if TransactionTestCase.serialized_rollback = True. """ available_apps = ["migration_test_data_persistence"] serialized_rollback = True @classmethod def setUpClass(cls): # Simulate ano...
MigrationDataPersistenceClassSetup
python
GoogleCloudPlatform__python-docs-samples
firestore/cloud-client/distributed_counters.py
{ "start": 1010, "end": 2612 }
class ____: """ A counter stores a collection of shards which are summed to return a total count. This allows for more frequent incrementing than a single document. """ def __init__(self, num_shards): self._num_shards = num_shards # [END firestore_solution_sharded_counter_custom_ty...
Counter
python
networkx__networkx
networkx/algorithms/tests/test_regular.py
{ "start": 2437, "end": 2951 }
class ____: def test_is_k_regular1(self): g = gen.cycle_graph(4) assert reg.is_k_regular(g, 2) assert not reg.is_k_regular(g, 3) def test_is_k_regular2(self): g = gen.complete_graph(5) assert reg.is_k_regular(g, 4) assert not reg.is_k_regular(g, 3) assert...
TestIsKRegular
python
django__django
django/db/backends/postgresql/features.py
{ "start": 251, "end": 6578 }
class ____(BaseDatabaseFeatures): minimum_database_version = (15,) allows_group_by_selected_pks = True can_return_columns_from_insert = True can_return_rows_from_bulk_insert = True can_return_rows_from_update = True has_real_datatype = True has_native_uuid_field = True has_native_duratio...
DatabaseFeatures
python
pypa__virtualenv
src/virtualenv/run/plugin/creators.py
{ "start": 555, "end": 3626 }
class ____(ComponentBuilder): def __init__(self, interpreter, parser) -> None: creators, self.key_to_meta, self.describe, self.builtin_key = self.for_interpreter(interpreter) super().__init__(interpreter, parser, "creator", creators) @classmethod def for_interpreter(cls, interpreter): ...
CreatorSelector
python
scikit-learn__scikit-learn
examples/developing_estimators/sklearn_is_fitted.py
{ "start": 1536, "end": 2607 }
class ____(BaseEstimator, ClassifierMixin): def __init__(self, parameter=1): self.parameter = parameter def fit(self, X, y): """ Fit the estimator to the training data. """ self.classes_ = sorted(set(y)) # Custom attribute to track if the estimator is fitted ...
CustomEstimator
python
ray-project__ray
python/ray/_common/tests/test_wait_for_condition.py
{ "start": 8771, "end": 10671 }
class ____: """Tests for edge cases and boundary conditions.""" def test_zero_timeout(self): """Test behavior with zero timeout.""" def slow_condition(): time.sleep(0.1) return True with pytest.raises(RuntimeError): wait_for_condition(slow_condition...
TestEdgeCases
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_table02.py
{ "start": 315, "end": 1549 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_table02.xlsx") def test_create_file(self): """Test XlsxWriter chart axis table properties.""" workbook = Workbook(self.got_f...
TestCompareXLSXFiles
python
airbytehq__airbyte
airbyte-ci/connectors/metadata_service/lib/metadata_service/models/generated/ConnectorMetadataDefinitionV0.py
{ "start": 7186, "end": 7471 }
class ____(BaseModel): class Config: extra = Extra.allow usage: Optional[Union[str, Literal["low", "medium", "high"]]] = None sync_success_rate: Optional[Union[str, Literal["low", "medium", "high"]]] = None connector_version: Optional[str] = None
ConnectorMetric
python
pexpect__pexpect
pexpect/pxssh.py
{ "start": 1266, "end": 1831 }
class ____(ExceptionPexpect): '''Raised for pxssh exceptions. ''' if sys.version_info > (3, 0): from shlex import quote else: _find_unsafe = re.compile(r'[^\w@%+=:,./-]').search def quote(s): """Return a shell-escaped version of the string *s*.""" if not s: return "''" ...
ExceptionPxssh
python
allegroai__clearml
clearml/utilities/pigar/unpack.py
{ "start": 234, "end": 3870 }
class ____(object): """Archive provides a consistent interface for unpacking compressed file. """ def __init__(self, filename: str, fileobj: Any) -> None: self._filename = filename self._fileobj = fileobj self._file = None self._names = None self._read = None ...
Archive
python
huggingface__transformers
src/transformers/trainer_pt_utils.py
{ "start": 23424, "end": 25327 }
class ____(Sampler): """ Sampler that shards batches between several processes. Dispatches indices batch by batch: on 2 processes with batch size 4, the first two batches are `[0, 1, 2, 3, 4, 5, 6, 7]` and `[8, 9, 10, 11, 12, 13, 14, 15]`, which shard into `[0, 1, 2, 3]` and `[8, 9, 10, 11]` for GPU-0 a...
ShardSampler
python
allegroai__clearml
clearml/backend_api/services/v2_23/projects.py
{ "start": 45767, "end": 51150 }
class ____(Response): """ Response of projects.delete endpoint. :param deleted: Number of projects deleted (0 or 1) :type deleted: int :param disassociated_tasks: Number of tasks disassociated from the deleted project :type disassociated_tasks: int :param urls: The urls of the files...
DeleteResponse
python
conda__conda
conda/common/configuration.py
{ "start": 38976, "end": 41018 }
class ____(Parameter): """Parameter type for a Configuration class that holds a sequence (i.e. list) of Parameters.""" _type = tuple def __init__(self, element_type, default=(), validation=None, string_delimiter=","): """ Args: element_type (Parameter): The Parameter type that ...
SequenceParameter
python
apache__airflow
providers/google/tests/unit/google/cloud/hooks/test_datafusion.py
{ "start": 23395, "end": 28212 }
class ____: @pytest.mark.asyncio @mock.patch(HOOK_STR.format("DataFusionAsyncHook._get_link")) async def test_async_get_pipeline_should_execute_successfully(self, mocked_link, hook_async): await hook_async.get_pipeline( instance_url=INSTANCE_URL, namespace=NAMESPACE, ...
TestDataFusionHookAsynch
python
sympy__sympy
sympy/physics/quantum/boson.py
{ "start": 3145, "end": 3915 }
class ____(Ket): """Fock state ket for a bosonic mode. Parameters ========== n : Number The Fock state number. """ def __new__(cls, n): return Ket.__new__(cls, n) @property def n(self): return self.label[0] @classmethod def dual_class(self): ...
BosonFockKet
python
numpy__numpy
numpy/f2py/tests/test_return_logical.py
{ "start": 1385, "end": 2048 }
class ____(TestReturnLogical): sources = [ util.getpath("tests", "src", "return_logical", "foo77.f"), util.getpath("tests", "src", "return_logical", "foo90.f90"), ] @pytest.mark.slow @pytest.mark.parametrize("name", ["t0", "t1", "t2", "t4", "s0", "s1", "s2", "s4"]) def test_all_f77(...
TestFReturnLogical
python
python-excel__xlwt
xlwt/BIFFRecords.py
{ "start": 89116, "end": 92846 }
class ____(BiffRecord): """ This record is part of a Link Table. It contains the name and the token array of an internal defined name. Token arrays of defined names contain tokens with aberrant token classes. Record NAME, BIFF5/BIFF7: Offset Size Contents 0 2 Option ...
NameRecord
python
pypa__pipenv
pipenv/vendor/tomlkit/items.py
{ "start": 8629, "end": 8888 }
class ____(Enum): """ The type of a Key. Keys can be bare (unquoted), or quoted using basic ("), or literal (') quotes following the same escaping rules as single-line StringType. """ Bare = "" Basic = '"' Literal = "'"
KeyType
python
fabric__fabric
fabric/testing/base.py
{ "start": 17914, "end": 19833 }
class ____: """ Class managing mocked SFTP remote state. Used in start/stop fashion in eg doctests; wrapped in the SFTP fixtures in conftest.py for main use. .. versionadded:: 2.1 """ def __init__(self, autostart=True): if autostart: self.start() def start(self): ...
MockSFTP
python
openai__openai-python
src/openai/types/realtime/realtime_tracing_config_param.py
{ "start": 276, "end": 840 }
class ____(TypedDict, total=False): group_id: str """ The group id to attach to this trace to enable filtering and grouping in the Traces Dashboard. """ metadata: object """ The arbitrary metadata to attach to this trace to enable filtering in the Traces Dashboard. """ work...
TracingConfiguration
python
mlflow__mlflow
mlflow/entities/span_event.py
{ "start": 2934, "end": 3382 }
class ____(json.JSONEncoder): """ Custom encoder to handle json serialization. """ def default(self, o): try: return super().default(o) except TypeError: # convert datetime to string format by default if isinstance(o, datetime): return...
CustomEncoder
python
marshmallow-code__marshmallow
tests/test_schema.py
{ "start": 35776, "end": 38519 }
class ____: @pytest.fixture def schema(self): class GrandChildSchema(Schema): str_dump_only = fields.String() str_load_only = fields.String() str_regular = fields.String() class ChildSchema(Schema): str_dump_only = fields.String() str_...
TestDeeplyNestedLoadOnly
python
falconry__falcon
tests/test_compiled_router.py
{ "start": 2697, "end": 3548 }
class ____: def on_get(self, req, res): pass def on_get_other(self, req, res): pass def test_cannot_replace_compiled(): opt = CompiledRouterOptions() with pytest.raises(AttributeError, match='Cannot set'): opt.converters = {} with pytest.raises(AttributeError, match='objec...
MockResource
python
encode__django-rest-framework
tests/test_renderers.py
{ "start": 25176, "end": 29646 }
class ____(URLPatternsTestCase): class ExampleViewSet(ViewSet): def list(self, request): return Response() @action(detail=False, name="Extra list action") def list_action(self, request): raise NotImplementedError class AuthExampleViewSet(ExampleViewSet): ...
BrowsableAPIRendererTests
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/completion/base.py
{ "start": 639, "end": 4183 }
class ____: """ :param text: The new string that will be inserted into the document. :param start_position: Position relative to the cursor_position where the new text will start. The text will be inserted between the start_position and the original cursor position. :param display: (opti...
Completion
python
django-extensions__django-extensions
tests/testapp/models.py
{ "start": 14447, "end": 14700 }
class ____(models.Model): field_to_update = models.BooleanField(default=True) modified = ModificationDateTimeField() update_modified = False class Meta: app_label = "django_extensions"
DisabledUpdateModelModificationDateTimeField
python
bokeh__bokeh
src/bokeh/models/selections.py
{ "start": 4084, "end": 5042 }
class ____(SelectionPolicy): ''' When a data source is shared between multiple renderers, selecting a point on from any renderer will cause that row in the data source to be selected. The selection is made from the union of hit test results from all renderers. ''' # explicit __init__ to suppor...
UnionRenderers
python
facelessuser__pymdown-extensions
pymdownx/blocks/caption.py
{ "start": 7709, "end": 12139 }
class ____(Block): """Figure captions.""" NAME = '' PREFIX = '' CLASSES = '' ARGUMENT = None OPTIONS = { 'type': ('', type_html_identifier) } def on_init(self): """Initialize.""" self.auto = self.config['auto'] self.prepend = self.config['prepend'] ...
Caption
python
vyperlang__vyper
vyper/venom/passes/algebraic_optimization.py
{ "start": 623, "end": 15012 }
class ____(IRPass): """ This pass reduces algebraic evaluatable expressions. It currently optimizes: - iszero chains - binops - offset adds """ dfg: DFGAnalysis updater: InstUpdater def run_pass(self): self.dfg = self.analyses_cache.request_analysis(DFGAnalysis) ...
AlgebraicOptimizationPass
python
dask__dask
dask/dataframe/dask_expr/_groupby.py
{ "start": 24918, "end": 25038 }
class ____(Head): groupby_chunk = staticmethod(_tail_chunk) groupby_aggregate = staticmethod(_tail_aggregate)
Tail
python
ray-project__ray
python/ray/dashboard/modules/node/datacenter.py
{ "start": 1012, "end": 9137 }
class ____: @staticmethod @async_loop_forever(dashboard_consts.RAY_DASHBOARD_STATS_PURGING_INTERVAL) async def purge(): # Purge data that is out of date. # These data sources are maintained by DashboardHead, # we do not needs to purge them: # * agents # * nodes ...
DataOrganizer
python
pytorch__pytorch
test/dynamo/test_repros.py
{ "start": 29010, "end": 29300 }
class ____(torch.nn.Module): def inner_fn(self, left, right): return tuple(left) == tuple(right) def fn(self, tensor): if type(tensor) is int: return False torch.add(tensor, tensor) return self.inner_fn(tensor.shape, (1, 2, 3))
MockModule
python
spyder-ide__spyder
spyder/utils/snippets/nodes.py
{ "start": 10535, "end": 11018 }
class ____(SnippetASTNode): """ Node that represents a variable snippet. This node represents the expression ${var} or $var, where var is some variable qualified name. """ KIND = SnippetKind.VARIABLE def __init__(self, variable): SnippetASTNode.__init__(self) self.variable...
VariableSnippetNode
python
django__django
tests/delete/models.py
{ "start": 714, "end": 752 }
class ____(RChild): pass
RChildChild
python
coleifer__peewee
tests/apsw_ext.py
{ "start": 716, "end": 985 }
class ____(object): def Filter(self, *a): self.val = 0 def Eof(self): return False def Rowid(self): return self.val def Column(self, col): return self.val def Next(self): self.val += 1 def Close(self): pass
VTCursor
python
PyCQA__flake8
src/flake8/exceptions.py
{ "start": 80, "end": 150 }
class ____(Exception): """Plain Flake8 exception."""
Flake8Exception
python
Textualize__textual
src/textual/renderables/background_screen.py
{ "start": 297, "end": 2975 }
class ____: """Tints a renderable and removes links / meta.""" def __init__( self, screen: Screen, color: Color, ) -> None: """Initialize a BackgroundScreen instance. Args: screen: A Screen instance. color: A color (presumably with alpha). ...
BackgroundScreen
python
scrapy__scrapy
tests/test_engine.py
{ "start": 2697, "end": 2752 }
class ____(MySpider): item_cls = dict
DictItemsSpider
python
Netflix__metaflow
metaflow/cli.py
{ "start": 24339, "end": 25699 }
class ____(object): def __init__(self, flow): self.flow = flow def main(flow, args=None, handle_exceptions=True, entrypoint=None): # Ignore warning(s) and prevent spamming the end-user. # TODO: This serves as a short term workaround for RuntimeWarning(s) thrown # in py3.8 related to log buffer...
CliState
python
langchain-ai__langchain
libs/langchain/langchain_classic/chains/query_constructor/parser.py
{ "start": 1630, "end": 1799 }
class ____(TypedDict): """A datetime in ISO 8601 format (YYYY-MM-DDTHH:MM:SS).""" datetime: str type: Literal["datetime"] @v_args(inline=True)
ISO8601DateTime
python
pypa__warehouse
tests/unit/email/test_init.py
{ "start": 59940, "end": 63295 }
class ____: def test_send_new_organization_approved_email( self, pyramid_request, pyramid_config, monkeypatch ): initiator_user = pretend.stub( id="id", username="username", name="", email="email@example.com", primary_email=pretend.stub...
TestSendNewOrganizationApprovedEmail
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/test_managed_kafka.py
{ "start": 16180, "end": 17372 }
class ____: @mock.patch(MANAGED_KAFKA_PATH.format("types.ConsumerGroup.to_dict")) @mock.patch(MANAGED_KAFKA_PATH.format("ManagedKafkaHook")) def test_execute(self, mock_hook, to_dict_mock): op = ManagedKafkaGetConsumerGroupOperator( task_id=TASK_ID, gcp_conn_id=GCP_CONN_ID, ...
TestManagedKafkaGetConsumerGroupOperator
python
python__mypy
mypy/types.py
{ "start": 8287, "end": 10779 }
class ____(mypy.nodes.Context): """Abstract base class for all types.""" __slots__ = ("_can_be_true", "_can_be_false") # 'can_be_true' and 'can_be_false' mean whether the value of the # expression can be true or false in a boolean context. They are useful # when inferring the type of logic expressi...
Type
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_pattern09.py
{ "start": 315, "end": 2204 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_pattern09.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(self.g...
TestCompareXLSXFiles
python
kamyu104__LeetCode-Solutions
Python/find-the-array-concatenation-value.py
{ "start": 54, "end": 341 }
class ____(object): def findTheArrayConcVal(self, nums): """ :type nums: List[int] :rtype: int """ return sum((nums[i]*10**(int(math.log10(nums[~i]))+1) for i in xrange(len(nums)//2)))+sum(nums[i] for i in xrange(len(nums)//2, len(nums)))
Solution
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/dataclassTransform3.py
{ "start": 2103, "end": 2321 }
class ____(Generic[_T]): not_a_field: _T def __init_subclass__( cls, *, frozen: bool = False, kw_only: bool = True, order: bool = True, ) -> None: ...
GenericModelBase
python
pennersr__django-allauth
tests/projects/common/headless/rest_framework/views.py
{ "start": 188, "end": 471 }
class ____(APIView): authentication_classes = [JWTTokenAuthentication] def get(self, request, *args, **kwargs): data = {"resource": "ok"} if "userinfo" in request.GET: data["user_email"] = request.user.email return Response(data)
ResourceView
python
django__django
tests/backends/sqlite/test_introspection.py
{ "start": 170, "end": 1952 }
class ____(TestCase): def test_get_primary_key_column(self): """ Get the primary key column regardless of whether or not it has quotation. """ testable_column_strings = ( ("id", "id"), ("[id]", "id"), ("`id`", "id"), ('"id"', "i...
IntrospectionTests
python
getsentry__sentry
tests/sentry/seer/similarity/test_utils.py
{ "start": 40116, "end": 49170 }
class ____(TestCase): def setUp(self) -> None: # The `in_app` and `contributes` values of these frames will be determined by the project # stacktrace rules we'll add below self.contributing_system_frame = { "function": "handleRequest", "filename": "/node_modules/expre...
HasTooManyFramesTest
python
redis__redis-py
redis/_parsers/base.py
{ "start": 7913, "end": 10628 }
class ____(Protocol): """Protocol defining RESP3-specific parsing functionality""" pubsub_push_handler_func: Callable invalidation_push_handler_func: Optional[Callable] = None node_moving_push_handler_func: Optional[Callable] = None maintenance_push_handler_func: Optional[Callable] = None def ...
PushNotificationsParser
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/workflows.py
{ "start": 26429, "end": 29232 }
class ____(GoogleCloudBaseOperator): """ Returns an execution for the given ``workflow_id`` and ``execution_id``. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:WorkflowsGetExecutionOperator` :param workflow_id: Required. T...
WorkflowsGetExecutionOperator
python
cython__cython
Tools/dataclass_test_data/test_dataclasses.py
{ "start": 88382, "end": 93406 }
class ____(unittest.TestCase): def test_frozen(self): @dataclass(frozen=True) class C: i: int c = C(10) self.assertEqual(c.i, 10) with self.assertRaises(FrozenInstanceError): c.i = 5 self.assertEqual(c.i, 10) def test_inherit(self): ...
TestFrozen
python
agronholm__apscheduler
src/apscheduler/_enums.py
{ "start": 1771, "end": 2263 }
class ____(Enum): """ Used to indicate what to do when trying to add a schedule whose ID conflicts with an existing schedule. .. attribute:: replace replace the existing schedule with a new one .. attribute:: do_nothing keep the existing schedule as-is and drop the new schedule ...
ConflictPolicy
python
airbytehq__airbyte
airbyte-integrations/connectors/source-jira/unit_tests/integration/config.py
{ "start": 125, "end": 1084 }
class ____: def __init__(self) -> None: self._config: Dict[str, Any] = { "api_token": "any_api_token", "domain": "airbyteio.atlassian.net", "email": "integration-test@airbyte.io", "start_date": "2021-01-01T00:00:00Z", "projects": [], } ...
ConfigBuilder
python
pallets__itsdangerous
src/itsdangerous/signer.py
{ "start": 1362, "end": 2296 }
class ____(SigningAlgorithm): """Provides signature generation using HMACs.""" #: The digest method to use with the MAC algorithm. This defaults to #: SHA1, but can be changed to any other function in the hashlib #: module. default_digest_method: t.Any = staticmethod(_lazy_sha1) def __init__(s...
HMACAlgorithm
python
networkx__networkx
benchmarks/benchmarks/benchmark_classes.py
{ "start": 60, "end": 1316 }
class ____: params = ["Graph", "DiGraph", "MultiGraph", "MultiDiGraph"] param_names = ["graph_type"] def setup(self, graph_type): self.nodes = list(range(1, 1000)) self.edges = [] self.subgraph_nodes = list(range(1, 100)) self.subgraph_nodes_large = list(range(1, 900)) ...
GraphBenchmark
python
sympy__sympy
sympy/solvers/ode/single.py
{ "start": 85599, "end": 89400 }
class ____(SingleODESolver): r""" Solves an `n`\th order linear homogeneous variable-coefficient Cauchy-Euler equidimensional ordinary differential equation. This is an equation with form `0 = a_0 f(x) + a_1 x f'(x) + a_2 x^2 f''(x) \cdots`. These equations can be solved in a general manner, b...
NthLinearEulerEqHomogeneous
python
getsentry__sentry
src/sentry/integrations/api/endpoints/organization_integration_repos.py
{ "start": 895, "end": 3537 }
class ____(RegionOrganizationIntegrationBaseEndpoint): publish_status = { "GET": ApiPublishStatus.PRIVATE, } owner = ApiOwner.ISSUES def get( self, request: Request, organization: Organization, integration_id: int, **kwds: Any, ) -> Response: ...
OrganizationIntegrationReposEndpoint
python
doocs__leetcode
solution/0700-0799/0778.Swim in Rising Water/Solution.py
{ "start": 0, "end": 780 }
class ____: def swimInWater(self, grid: List[List[int]]) -> int: def find(x: int) -> int: if p[x] != x: p[x] = find(p[x]) return p[x] n = len(grid) m = n * n p = list(range(m)) hi = [0] * m for i, row in enumerate(grid): ...
Solution
python
numba__numba
numba/core/typing/npdatetime.py
{ "start": 8119, "end": 8205 }
class ____(DatetimeCmpOp): key = operator.lt @infer_global(operator.le)
DatetimeCmpLt
python
numpy__numpy
numpy/distutils/system_info.py
{ "start": 99450, "end": 99530 }
class ____(_numpy_info): section = 'numpy' modulename = 'numpy'
numpy_info
python
apache__airflow
providers/microsoft/azure/src/airflow/providers/microsoft/azure/triggers/powerbi.py
{ "start": 11338, "end": 13753 }
class ____(BasePowerBITrigger): """ Triggers a call to the API to request the available workspace IDs. :param conn_id: The connection Id to connect to PowerBI. :param timeout: The HTTP timeout being used by the `KiotaRequestAdapter`. Default is 1 week (60s * 60m * 24h * 7d). When no timeout is ...
PowerBIWorkspaceListTrigger
python
django__django
tests/admin_views/models.py
{ "start": 2281, "end": 2554 }
class ____(models.Model): name = models.CharField(max_length=100, verbose_name="¿Name?") book = models.ForeignKey(Book, models.CASCADE) author = models.ForeignKey(User, models.SET_NULL, blank=True, null=True) def __str__(self): return self.name
Promo
python
doocs__leetcode
solution/1500-1599/1572.Matrix Diagonal Sum/Solution.py
{ "start": 0, "end": 246 }
class ____: def diagonalSum(self, mat: List[List[int]]) -> int: ans = 0 n = len(mat) for i, row in enumerate(mat): j = n - i - 1 ans += row[i] + (0 if j == i else row[j]) return ans
Solution
python
jupyterlab__jupyterlab
jupyterlab/extensions/manager.py
{ "start": 4957, "end": 5814 }
class ____(PluginManagerOptions): """Extension manager options. Attributes: allowed_extensions_uris: A list of comma-separated URIs to get the allowed extensions list blocked_extensions_uris: A list of comma-separated URIs to get the blocked extensions list listings_refresh_seconds: The...
ExtensionManagerOptions
python
walkccc__LeetCode
solutions/3081. Replace Question Marks in String to Minimize Its Value/3081.py
{ "start": 0, "end": 715 }
class ____: def minimizeStringValue(self, s: str) -> str: ans = [] count = collections.Counter(s) letters = [] del count['?'] def getMinFreqLetter(count: dict[str, int]) -> str: minFreqLetter = 'a' for c in string.ascii_lowercase: if count[c] < count[minFreqLetter]: ...
Solution
python
pytorch__pytorch
benchmarks/operator_benchmark/pt/qarithmetic_test.py
{ "start": 1991, "end": 2569 }
class ____(_QFunctionalBinaryArithmeticBenchmarkBase): def init(self, N, dtype, contig, op_func): super().setup(N, dtype, contig) self.inputs = {"q_input": self.q_input_a, "scalar_input": 42} self.op_func = op_func def forward(self, q_input, scalar_input: int): return self.op_fu...
QFunctionalScalarBenchmark
python
paramiko__paramiko
tests/test_transport.py
{ "start": 46772, "end": 54217 }
class ____: def test_kex_algos_includes_kex_strict_c(self): with server() as (tc, _): kex = tc._get_latest_kex_init() assert "kex-strict-c-v00@openssh.com" in kex["kex_algo_list"] @mark.parametrize( "server_active,client_active", itertools.product([True, False], ...
TestStrictKex
python
huggingface__transformers
tests/models/albert/test_modeling_albert.py
{ "start": 1411, "end": 9516 }
class ____: def __init__( self, parent, batch_size=13, seq_length=7, is_training=True, use_input_mask=True, use_token_type_ids=True, use_labels=True, vocab_size=32, embedding_size=8, hidden_size=16, num_hidden_layers=2, ...
AlbertModelTester