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
jmcnamara__XlsxWriter
xlsxwriter/styles.py
{ "start": 553, "end": 24923 }
class ____(xmlwriter.XMLwriter): """ A class for writing the Excel XLSX Styles file. """ ########################################################################### # # Public API. # ########################################################################### def __init__(self) ->...
Styles
python
joerick__pyinstrument
test/fake_time_util.py
{ "start": 1912, "end": 2400 }
class ____: def __init__(self, clock: "MockClock") -> None: self.trio_clock = clock def get_time(self): return self.trio_clock.current_time() def sleep(self, duration): self.trio_clock.jump(duration) @contextlib.contextmanager def fake_time_trio(): from trio.testing import Mo...
FakeClockTrio
python
ipython__ipython
tests/test_interactiveshell.py
{ "start": 25270, "end": 25579 }
class ____(ast.NodeTransformer): """Negates all number literals in an AST.""" def visit_Num(self, node): node.value = -node.value return node def visit_Constant(self, node): if isinstance(node.value, int): return self.visit_Num(node) return node
Negator
python
getsentry__sentry
tests/snuba/tagstore/test_tagstore_backend.py
{ "start": 54048, "end": 55467 }
class ____(BaseSemverTest): KEY = SEMVER_BUILD_ALIAS def test_semver_package(self) -> None: env_2 = self.create_environment() project_2 = self.create_project() self.create_release(version="test@1.0.0.0+123", additional_projects=[project_2]) self.create_release(version="test@1.0....
GetTagValuePaginatorForProjectsSemverBuildTest
python
tensorflow__tensorflow
tensorflow/core/function/trace_type/default_types_test.py
{ "start": 953, "end": 1681 }
class ____(trace.TraceType): def __init__(self, obj): self._object = obj def is_subtype_of(self, other): return self._object == 2 and other._object == 3 def most_specific_common_supertype(self, others): if not others: return self if self._object == 2 and isinstance(others[0]._object, int...
MockSupertypes2With3
python
rapidsai__cudf
python/cudf/cudf/core/udf/masked_typing.py
{ "start": 19974, "end": 20277 }
class ____(AbstractTemplate): key = "MaskedType.replace" def generic(self, args, kws): return nb_signature( MaskedType(managed_udf_string), MaskedType(string_view), MaskedType(string_view), recvr=self.this, )
MaskedStringViewReplace
python
keon__algorithms
algorithms/tree/construct_tree_postorder_preorder.py
{ "start": 795, "end": 2899 }
class ____: def __init__(self, val, left=None, right=None): self.val = val self.left = left self.right = right pre_index = 0 def construct_tree_util(pre: list, post: list, low: int, high: int, size: int): """ Recursive function that constructs tree from preorder and postorder ar...
TreeNode
python
django__django
django/template/defaulttags.py
{ "start": 13517, "end": 13806 }
class ____(Node): def __init__(self, partial_name, inline, nodelist): self.partial_name = partial_name self.inline = inline self.nodelist = nodelist def render(self, context): return self.nodelist.render(context) if self.inline else ""
PartialDefNode
python
pyparsing__pyparsing
examples/statemachine/statemachine.py
{ "start": 390, "end": 8863 }
class ____(Exception): pass ident = pp.Word(pp.alphas + "_", pp.alphanums + "_$") # add parse-time condition to make sure we do not allow any Python keywords to be used as # statemachine identifiers def no_keywords_allowed(s, l, t): wd = t[0] return not keyword.iskeyword(wd) ident.addCondition( no_...
InvalidTransitionException
python
tensorflow__tensorflow
tensorflow/python/debug/cli/cli_config_test.py
{ "start": 999, "end": 5475 }
class ____(test_util.TensorFlowTestCase): def setUp(self): self._tmp_dir = tempfile.mkdtemp() self._tmp_config_path = os.path.join(self._tmp_dir, ".tfdbg_config") self.assertFalse(gfile.Exists(self._tmp_config_path)) super(CLIConfigTest, self).setUp() def tearDown(self): file_io.delete_recursi...
CLIConfigTest
python
ZoranPandovski__al-go-rithms
games/Python/Pong Game/paddle.py
{ "start": 44, "end": 516 }
class ____(Turtle): def __init__(self,x_pos,y_pos): super().__init__() self.penup() # self.speed(0) self.goto(x=x_pos,y=y_pos) self.shape("square") self.color("white") self.shapesize(stretch_wid=HEIGHT,stretch_len=WEIDTH) def move_up(self): new_y=...
Paddle
python
huggingface__transformers
src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py
{ "start": 77044, "end": 78669 }
class ____(nn.Module): def __init__(self, config, layer_id=0): super().__init__() self.in_conv_dim = config.tdnn_dim[layer_id - 1] if layer_id > 0 else config.tdnn_dim[layer_id] self.out_conv_dim = config.tdnn_dim[layer_id] self.kernel_size = config.tdnn_kernel[layer_id] self...
TDNNLayer
python
coleifer__peewee
peewee.py
{ "start": 162757, "end": 163155 }
class ____(Field): def adapt(self, value): if isinstance(value, text_type): return value elif isinstance(value, bytes_type): return value.decode('utf-8') return text_type(value) def __add__(self, other): return StringExpression(self, OP.CONCAT, other) def __r...
_StringField
python
coleifer__peewee
examples/twitter/app.py
{ "start": 2733, "end": 3254 }
class ____(BaseModel): from_user = ForeignKeyField(User, backref='relationships') to_user = ForeignKeyField(User, backref='related_to') class Meta: indexes = ( # Specify a unique multi-column index on from/to-user. (('from_user', 'to_user'), True), ) # a dead simpl...
Relationship
python
Netflix__metaflow
metaflow/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.py
{ "start": 1515, "end": 8302 }
class ____(SecretsProvider): TYPE = "aws-secrets-manager" def get_secret_as_dict(self, secret_id, options={}, role=None): """ Reads a secret from AWS Secrets Manager and returns it as a dictionary of environment variables. The secret payload from AWS is EITHER a string OR a binary blob...
AwsSecretsManagerSecretsProvider
python
PrefectHQ__prefect
src/integrations/prefect-aws/prefect_aws/workers/ecs_worker.py
{ "start": 24643, "end": 24732 }
class ____(BaseWorkerResult): """ The result of an ECS job. """
ECSWorkerResult
python
kubernetes-client__python
kubernetes/client/models/v1beta1_resource_claim_list.py
{ "start": 383, "end": 7093 }
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...
V1beta1ResourceClaimList
python
django__django
tests/model_inheritance/models.py
{ "start": 3639, "end": 3689 }
class ____(models.Model, Mixin): pass
MixinModel
python
tensorflow__tensorflow
tensorflow/python/data/kernel_tests/cache_test.py
{ "start": 1836, "end": 8134 }
class ____(test_base.DatasetTestBase, parameterized.TestCase): def setUp(self): super(FileCacheTest, self).setUp() self.tmp_dir = tempfile.mkdtemp() self.cache_prefix = path.join(self.tmp_dir, "cache") def tearDown(self): if self.tmp_dir: shutil.rmtree(self.tmp_dir, ignore_errors=True) s...
FileCacheTest
python
python-poetry__poetry
src/poetry/utils/env/env_manager.py
{ "start": 2500, "end": 22203 }
class ____: """ Environments manager """ _env = None ENVS_FILE = "envs.toml" def __init__(self, poetry: Poetry, io: None | IO = None) -> None: self._poetry = poetry self._io = io or NullIO() @property def in_project_venv(self) -> Path: venv: Path = self._poetr...
EnvManager
python
Netflix__metaflow
metaflow/datastore/task_datastore.py
{ "start": 1525, "end": 38332 }
class ____(object): """ TaskDataStore is obtained through FlowDataStore.get_datastore_for_task and is used to store three things: - Task artifacts (using save_artifacts and load_artifacts) which will ultimately be stored using ContentAddressedStore's save_blobs and load_blobs. Th...
TaskDataStore
python
mwaskom__seaborn
tests/test_categorical.py
{ "start": 26706, "end": 26809 }
class ____(SharedScatterTests): func = staticmethod(partial(swarmplot, warn_thresh=1))
TestSwarmPlot
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/transfers/test_dynamodb_to_s3.py
{ "start": 1919, "end": 13802 }
class ____: def setup_method(self): self.output_queue = [] def mock_upload_file(self, Filename, Bucket, Key): with open(Filename) as f: lines = f.readlines() for line in lines: self.output_queue.append(json.loads(line)) @patch("airflow.providers.amaz...
TestDynamodbToS3
python
django-extensions__django-extensions
tests/management/commands/test_syncdata.py
{ "start": 2125, "end": 3667 }
class ____(TestCase): """Tests for syncdata command.""" @patch("sys.stdout", new_callable=StringIO) def test_should_print_No_fixtures_found_if_fixture_labels_not_provided( self, m_stdout ): call_command("syncdata", verbosity=2) self.assertEqual("No fixtures found.\n", m_stdout....
SyncDataTests
python
PrefectHQ__prefect
tests/server/orchestration/test_task_concurrency_v2_integration.py
{ "start": 827, "end": 13648 }
class ____: """Test SecureTaskConcurrencySlots with V2 Global Concurrency Limits.""" async def create_v1_concurrency_limit( self, session: AsyncSession, tag: str, limit: int ) -> None: """Helper to create a V1 concurrency limit.""" cl_create = actions.ConcurrencyLimitCreate( ...
TestSecureTaskConcurrencySlotsV2Integration
python
getsentry__sentry
src/sentry/monitors/system_incidents.py
{ "start": 13371, "end": 14090 }
class ____: ts: datetime """ The associated timestamp of the decision. Typically this will be the clock tick when the decision was made. However for a incident start and end transitions this will be the back-dated timestamp of when the state began. INCIDENT_STARTED -> Tick when the incident t...
DecisionResult
python
milvus-io__pymilvus
pymilvus/client/utils.py
{ "start": 10084, "end": 17314 }
class ____: _checked = False # whether scipy.sparse.*_matrix classes exists _matrix_available = False # whether scipy.sparse.*_array classes exists _array_available = False @classmethod def _init(cls): if cls._checked: return scipy_spec = importlib.util.find_spe...
SciPyHelper
python
airbytehq__airbyte
airbyte-ci/connectors/connectors_qa/src/connectors_qa/checks/documentation/documentation.py
{ "start": 17468, "end": 20595 }
class ____(CheckDocumentationContent): required = True expected_section_index = 0 @property def name(self) -> str: return f"'{self.header}' section of the documentation follows our guidelines" @property def description(self) -> str: templates = TemplateContent("CONNECTOR_NAME_F...
CheckSection
python
wandb__wandb
wandb/sdk/artifacts/artifact_ttl.py
{ "start": 81, "end": 122 }
class ____(Enum): INHERIT = 0
ArtifactTTL
python
apache__airflow
helm-tests/tests/helm_tests/airflow_aux/test_remote_logging.py
{ "start": 1397, "end": 8843 }
class ____: """Tests elasticsearch configuration behaviors.""" def test_should_not_generate_secret_document_if_elasticsearch_disabled(self): docs = render_chart( values={"elasticsearch": {"enabled": False}}, show_only=[ES_SECRET_TEMPLATE], ) assert len(docs) == ...
TestElasticsearchConfig
python
mwaskom__seaborn
tests/_marks/test_bar.py
{ "start": 233, "end": 3492 }
class ____: def plot_bars(self, variables, mark_kws, layer_kws): p = Plot(**variables).add(Bar(**mark_kws), **layer_kws).plot() ax = p._figure.axes[0] return [bar for barlist in ax.containers for bar in barlist] def check_bar(self, bar, x, y, width, height): assert bar.get_x(...
TestBar
python
pytorch__pytorch
torch/distributed/distributed_c10d.py
{ "start": 16165, "end": 18566 }
class ____: """ A class to build point-to-point operations for ``batch_isend_irecv``. This class builds the type of P2P operation, communication buffer, peer rank, Process Group, and tag. Instances of this class will be passed to ``batch_isend_irecv`` for point-to-point communications. Args: ...
P2POp
python
davidhalter__jedi
jedi/inference/base_value.py
{ "start": 12212, "end": 12494 }
class ____(Value): def __init__(self, inference_state, parent_context, tree_node): super().__init__(inference_state, parent_context) self.tree_node = tree_node def __repr__(self): return '<%s: %s>' % (self.__class__.__name__, self.tree_node)
TreeValue
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/orm/properties.py
{ "start": 16154, "end": 16623 }
class ____(ColumnProperty[_T], _DeclarativeMapped[_T]): """Declarative front-end for the :class:`.ColumnProperty` class. Public constructor is the :func:`_orm.column_property` function. .. versionchanged:: 2.0 Added :class:`_orm.MappedSQLExpression` as a Declarative compatible subclass for :class:`...
MappedSQLExpression
python
dagster-io__dagster
python_modules/libraries/dagster-deltalake/dagster_deltalake/io_manager.py
{ "start": 1302, "end": 1377 }
class ____(str, Enum): pyarrow = "pyarrow" rust = "rust"
WriterEngine
python
getsentry__sentry
tests/sentry/users/api/endpoints/test_user_authenticator_enroll.py
{ "start": 12929, "end": 22510 }
class ____(APITestCase): endpoint = "sentry-api-0-user-authenticator-enroll" def setUp(self) -> None: self.organization = self.create_organization(owner=self.create_user("foo@example.com")) self.user = self.create_user("bar@example.com", is_superuser=False) self.login_as(user=self.user)...
AcceptOrganizationInviteTest
python
allegroai__clearml
clearml/backend_api/services/v2_20/tasks.py
{ "start": 191973, "end": 194687 }
class ____(Response): """ Response of tasks.dequeue endpoint. :param updated: Number of tasks updated (0 or 1) :type updated: int :param fields: Updated fields names and values :type fields: dict :param dequeued: Number of tasks dequeued (0 or 1) :type dequeued: int """ _servic...
DequeueResponse
python
django__django
tests/order_with_respect_to/models.py
{ "start": 812, "end": 933 }
class ____(models.Model): entity = models.OneToOneField("Entity", primary_key=True, on_delete=models.CASCADE)
Dimension
python
huggingface__transformers
src/transformers/models/blip/processing_blip.py
{ "start": 872, "end": 1338 }
class ____(ProcessingKwargs, total=False): _defaults = { "text_kwargs": { "add_special_tokens": True, "padding": False, "stride": 0, "return_overflowing_tokens": False, "return_special_tokens_mask": False, "return_offsets_mapping": Fals...
BlipProcessorKwargs
python
getsentry__sentry
tests/sentry/api/serializers/test_grouptagvalue.py
{ "start": 170, "end": 716 }
class ____(TestCase): def test_with_user(self) -> None: user = self.create_user() grouptagvalue = GroupTagValue( group_id=0, key="sentry:user", value="username:ted", times_seen=1, first_seen=datetime(2018, 1, 1), last_seen=datet...
GroupTagValueSerializerTest
python
airbytehq__airbyte
airbyte-integrations/connectors/source-gitlab/components.py
{ "start": 2014, "end": 2920 }
class ____(SubstreamPartitionRouter): def stream_slices(self) -> Iterable[StreamSlice]: parent_stream = self.parent_stream_configs[0].stream projects_list = self.config.get("projects_list", []) group_project_ids = [] for partition in parent_stream.generate_partitions(): ...
ProjectStreamsPartitionRouter
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_self/SLF001.py
{ "start": 353, "end": 1763 }
class ____(metaclass=BazMeta): def __init__(self): self.public_thing = "foo" self._private_thing = "bar" self.__really_private_thing = "baz" self.bar = Bar() def __str__(self): return "foo" def get_bar(): if self.bar._private: # SLF001 return N...
Foo
python
tiangolo__fastapi
docs_src/body_updates/tutorial001.py
{ "start": 156, "end": 906 }
class ____(BaseModel): name: Union[str, None] = None description: Union[str, None] = None price: Union[float, None] = None tax: float = 10.5 tags: List[str] = [] items = { "foo": {"name": "Foo", "price": 50.2}, "bar": {"name": "Bar", "description": "The bartenders", "price": 62, "tax": 20....
Item
python
python-attrs__attrs
tests/test_make.py
{ "start": 43174, "end": 46420 }
class ____: """ Tests for attribute conversion. """ def test_converter(self): """ Return value of converter is used as the attribute's value. """ C = make_class( "C", {"x": attr.ib(converter=lambda v: v + 1), "y": attr.ib()} ) c = C(1, 2) ...
TestConverter
python
mkdocs__mkdocs
mkdocs/tests/structure/page_tests.py
{ "start": 31991, "end": 32595 }
class ____(unittest.TestCase): def setUp(self): self.default = os.environ.get('SOURCE_DATE_EPOCH', None) os.environ['SOURCE_DATE_EPOCH'] = '0' def test_source_date_epoch(self): cfg = load_config() fl = File('testing.md', cfg.docs_dir, cfg.site_dir, cfg.use_directory_urls) ...
SourceDateEpochTests
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/logs/events.py
{ "start": 8422, "end": 8608 }
class ____(graphene.ObjectType): class Meta: interfaces = (GrapheneMessageEvent, GrapheneStepEvent) name = "ExecutionStepSuccessEvent"
GrapheneExecutionStepSuccessEvent
python
mlflow__mlflow
mlflow/utils/logging_utils.py
{ "start": 421, "end": 1759 }
class ____: """ A Python stream for use with event logging APIs throughout MLflow (`eprint()`, `logger.info()`, etc.). This stream wraps `sys.stderr`, forwarding `write()` and `flush()` calls to the stream referred to by `sys.stderr` at the time of the call. It also provides capabilities for disabli...
MlflowLoggingStream
python
jazzband__django-polymorphic
src/polymorphic/managers.py
{ "start": 189, "end": 1489 }
class ____(models.Manager): """ Manager for PolymorphicModel Usually not explicitly needed, except if a custom manager or a custom queryset class is to be used. """ queryset_class = PolymorphicQuerySet @classmethod def from_queryset(cls, queryset_class, class_name=None): manag...
PolymorphicManager
python
tensorflow__tensorflow
tensorflow/python/tpu/tpu_embedding_v3_checkpoint_adapter_test.py
{ "start": 2197, "end": 22828 }
class ____(test.TestCase): def test_adapt_unsharded_to_sharded_simple(self): adapter = ( tpu_embedding_v3_checkpoint_adapter.TpuEmbeddingV3CheckpointAdapter( None ) ) layout = create_layout( tables_name="some_feature", stacked_table_name="some_feature", ...
TpuEmbeddingV3CheckpointAdapterTest
python
pydata__xarray
xarray/coding/cftime_offsets.py
{ "start": 15635, "end": 16462 }
class ____(QuarterOffset): # When converting a string to an offset, pandas converts # 'QS' to a QuarterBegin offset starting in the month of # January. When creating a QuarterBegin offset directly # from the constructor, however, the default month is March. # We follow that behavior here. _defa...
QuarterBegin
python
pypa__pip
tests/unit/test_exceptions.py
{ "start": 8320, "end": 14084 }
class ____: def test_complete(self) -> None: err = DiagnosticPipError( reference="test-diagnostic", message="Oh no!\nIt broke. :(", context="Something went wrong\nvery wrong.", note_stmt="You did something wrong, which is what caused this error.", ...
TestDiagnosticPipErrorPresentation_Unicode
python
Textualize__textual
docs/examples/styles/text_style_all.py
{ "start": 420, "end": 1015 }
class ____(App): CSS_PATH = "text_style_all.tcss" def compose(self): yield Grid( Label("none\n" + TEXT, id="lbl1"), Label("bold\n" + TEXT, id="lbl2"), Label("italic\n" + TEXT, id="lbl3"), Label("reverse\n" + TEXT, id="lbl4"), Label("strike\n" ...
AllTextStyleApp
python
tqdm__tqdm
tqdm/utils.py
{ "start": 3151, "end": 3473 }
class ____(object): """ >>> a = FormatReplace('something') >>> f"{a:5d}" 'something' """ # NOQA: P102 def __init__(self, replace=''): self.replace = replace self.format_called = 0 def __format__(self, _): self.format_called += 1 return self.replace
FormatReplace
python
allegroai__clearml
clearml/backend_interface/task/repo/scriptinfo.py
{ "start": 12902, "end": 27517 }
class ____(object): _thread = None _exit_event = None _sync_event = None _sample_frequency = 30.0 _first_sample_frequency = 3.0 _jupyter_history_logger = None _store_notebook_artifact = deferred_config("development.store_jupyter_notebook_artifact", True) @classmethod def _get_logger...
_JupyterObserver
python
pytorch__pytorch
torch/ao/quantization/fx/_model_report/model_report.py
{ "start": 730, "end": 29740 }
class ____: r""" The ModelReport class aims to provide users an easy way to diagnose issues that they run into with their models. The class works with all traceable GraphModules to help diagnose issues, though the requirements on the type of model more-so depends on the specific report the user is t...
ModelReport
python
pytorch__pytorch
torch/distributions/lowrank_multivariate_normal.py
{ "start": 1780, "end": 10163 }
class ____(Distribution): r""" Creates a multivariate normal distribution with covariance matrix having a low-rank form parameterized by :attr:`cov_factor` and :attr:`cov_diag`:: covariance_matrix = cov_factor @ cov_factor.T + cov_diag Example: >>> # xdoctest: +REQUIRES(env:TORCH_DOCTE...
LowRankMultivariateNormal
python
pytorch__pytorch
test/inductor/test_flex_attention.py
{ "start": 235705, "end": 273177 }
class ____(InductorTestCase): def setUp(self): super().setUp() skipCPUIf( LONG_COMPILATION_ON_CPU, "skip UT for CPU due to long compilation time found in CI", ) self.dtype = torch.float32 self.atol = 3e-2 self.rtol = 3e-2 def _init_tensors...
TestLearnableBiases
python
scikit-learn__scikit-learn
sklearn/utils/_param_validation.py
{ "start": 10724, "end": 11022 }
class ____(_Constraint): """Constraint representing the indicator `np.nan`.""" def is_satisfied_by(self, val): return ( not isinstance(val, Integral) and isinstance(val, Real) and math.isnan(val) ) def __str__(self): return "numpy.nan"
_NanConstraint
python
PyCQA__pylint
doc/data/messages/m/match-class-positional-attributes/bad.py
{ "start": 0, "end": 268 }
class ____: __match_args__ = ("title", "year") def __init__(self, title, year): self.title = title self.year = year def func(item: Book): match item: case Book("abc", 2000): # [match-class-positional-attributes] ...
Book
python
joke2k__faker
faker/providers/internet/cs_CZ/__init__.py
{ "start": 46, "end": 802 }
class ____(InternetProvider): user_name_formats = ( "{{last_name_female}}.{{first_name_female}}", "{{last_name_female}}.{{first_name_female}}", "{{last_name_male}}.{{first_name_male}}", "{{last_name_male}}.{{first_name_male}}", "{{first_name_female}}.{{last_name_female}}", ...
Provider
python
tornadoweb__tornado
tornado/test/websocket_test.py
{ "start": 28067, "end": 30742 }
class ____(WebSocketBaseTestCase): def get_app(self): self.handlers: list[WebSocketHandler] = [] test = self class PingHandler(TestWebSocketHandler): def initialize(self, close_future=None, compression_options=None): self.handlers = test.handlers ...
ServerPingTimeoutTest
python
ray-project__ray
python/ray/air/execution/_internal/event_manager.py
{ "start": 192, "end": 4933 }
class ____: """Event manager for Ray futures. The event manager can be used to track futures and invoke callbacks when they resolve. Futures are tracked with :meth:`track_future`. Future can then be awaited with :meth:`wait`. When futures successfully resolve, they trigger an optional ``on_res...
RayEventManager
python
pyqtgraph__pyqtgraph
pyqtgraph/flowchart/library/Filters.py
{ "start": 9705, "end": 10067 }
class ____(CtrlNode): """Removes baseline from data, ignoring anomalous events""" nodeName = 'AdaptiveDetrend' uiTemplate = [ ('threshold', 'doubleSpin', {'value': 3.0, 'min': 0, 'max': 1000000}) ] def processData(self, data): return functions.adaptiveDetrend(data, threshold=sel...
AdaptiveDetrend
python
getsentry__sentry
tests/sentry/sentry_apps/tasks/test_sentry_apps.py
{ "start": 58837, "end": 63278 }
class ____(TestCase): def setUp(self) -> None: self.project = self.create_project() self.user = self.create_user() self.sentry_app = self.create_sentry_app( organization=self.project.organization, events=["comment.updated", "comment.created", "comment.deleted"], ...
TestCommentWebhook
python
ApeWorX__ape
src/ape/api/query.py
{ "start": 4462, "end": 4709 }
class ____(_BaseQuery): """ A ``QueryType`` that collects properties of ``TransactionAPI`` over a range of transactions collected inside the ``BlockAPI` object represented by ``block_id``. """ block_id: Any
BlockTransactionQuery
python
PyCQA__pylint
doc/data/messages/i/invalid-bytes-returned/bad.py
{ "start": 0, "end": 135 }
class ____: """__bytes__ returns <type 'str'>""" def __bytes__(self): # [invalid-bytes-returned] return "123"
CustomBytes
python
PyCQA__pylint
tests/functional/m/member/member_checks.py
{ "start": 4421, "end": 4509 }
class ____(metaclass=MetaWithDynamicGetattr): pass SomeClass.does_not_exist
SomeClass
python
PrefectHQ__prefect
tests/runtime/test_flow_run.py
{ "start": 3515, "end": 4817 }
class ____: """ This class may appear to reproduce some tests from the AttributeAccessPatterns tests but is intended to be copy / pastable for other new attributes to ensure full coverage of feature set for each attribute. """ async def test_id_is_attribute(self): assert "id" in dir(flo...
TestID
python
pandas-dev__pandas
asv_bench/benchmarks/indexing_engines.py
{ "start": 5670, "end": 6372 }
class ____: params = [("monotonic_incr", "monotonic_decr", "non_monotonic")] param_names = ["index_type"] def setup(self, index_type): N = 10**5 values = list("a" * N + "b" * N + "c" * N) arr = { "monotonic_incr": np.array(values, dtype=object), "monotonic_de...
ObjectEngineIndexing
python
pypa__warehouse
warehouse/subscriptions/services.py
{ "start": 13360, "end": 13946 }
class ____(GenericBillingService): @classmethod def create_service(cls, context, request): stripe.api_version = request.registry.settings["billing.api_version"] stripe.api_key = request.registry.settings["billing.secret_key"] publishable_key = request.registry.settings["billing.publishab...
StripeBillingService
python
getsentry__sentry
src/sentry/preprod/migrations/0004_add_django_jsonfield.py
{ "start": 155, "end": 1450 }
class ____(CheckedMigration): # This flag is used to mark that a migration shouldn't be automatically run in production. # This should only be used for operations where it's safe to run the migration after your # code has deployed. So this should not be used for most operations that alter the schema # o...
Migration
python
getsentry__sentry
tests/sentry/hybridcloud/apigateway/test_apigateway_helpers.py
{ "start": 276, "end": 803 }
class ____(ApiGatewayTestCase): @responses.activate def test_verify_request_body(self) -> None: body = {"ab": "cd"} headers = {"header": "nope", "content-type": "application/json"} responses.add_callback( responses.POST, "http://ab.cd.e/test", verify_request_body(body, header...
VerifyRequestBodyTest
python
dagster-io__dagster
python_modules/dagster-test/dagster_test/toys/software_defined_assets.py
{ "start": 216, "end": 1572 }
class ____(IOManager): def handle_output(self, context, obj: DataFrame): assert context assert obj def load_input(self, context): assert context return DataFrame() @asset def daily_temperature_highs(sfo_q2_weather_sample: DataFrame) -> DataFrame: """Computes the temperatur...
DummyIOManager
python
sqlalchemy__sqlalchemy
examples/performance/short_selects.py
{ "start": 676, "end": 6024 }
class ____(Base): __tablename__ = "customer" id = Column(Integer, Identity(), primary_key=True) name = Column(String(255)) description = Column(String(255)) q = Column(Integer) p = Column(Integer) x = deferred(Column(Integer)) y = deferred(Column(Integer)) z = deferred(Column(Integer...
Customer
python
joblib__joblib
joblib/externals/loky/backend/popen_loky_posix.py
{ "start": 685, "end": 5541 }
class ____: method = "loky" DupFd = _DupFd def __init__(self, process_obj): sys.stdout.flush() sys.stderr.flush() self.returncode = None self._fds = [] self._launch(process_obj) def duplicate_for_child(self, fd): self._fds.append(fd) return reduc...
Popen
python
apache__airflow
providers/google/tests/unit/google/cloud/utils/test_credentials_provider.py
{ "start": 25385, "end": 25790 }
class ____: def test_get_project_id_from_service_account_email(self): assert _get_project_id_from_service_account_email(ACCOUNT_3_ANOTHER_PROJECT) == ANOTHER_PROJECT_ID def test_get_project_id_from_service_account_email_wrong_input(self): with pytest.raises(AirflowException): _get_p...
TestGetProjectIdFromServiceAccountEmail
python
HypothesisWorks__hypothesis
hypothesis-python/src/hypothesis/stateful.py
{ "start": 22473, "end": 23344 }
class ____(SearchStrategy): def __init__(self, name: str, *, consume: bool = False): super().__init__() self.name = name self.consume = consume def do_draw(self, data): machine = data.draw(self_strategy) bundle = machine.bundle(self.name) if not bundle: ...
BundleReferenceStrategy
python
numba__numba
numba/experimental/jitclass/base.py
{ "start": 9856, "end": 14208 }
class ____(object): """ A jitclass builder for a mutable jitclass. This will register typing and implementation hooks to the given typing and target contexts. """ class_impl_registry = imputils.Registry('jitclass builder') implemented_methods = set() def __init__(self, class_type, typingct...
ClassBuilder
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/linalg/linalg_ops_test.py
{ "start": 2423, "end": 3818 }
class ____(test.TestCase): def setUp(self): self.rng = np.random.RandomState(42) @test_util.run_deprecated_v1 def test_works_with_five_different_random_pos_def_matrices(self): for n in range(1, 6): for np_dtype, atol in [(np.float32, 0.05), (np.float64, 1e-5), (np.comp...
LogdetTest
python
doocs__leetcode
solution/2800-2899/2809.Minimum Time to Make Array Sum At Most x/Solution.py
{ "start": 0, "end": 589 }
class ____: def minimumTime(self, nums1: List[int], nums2: List[int], x: int) -> int: n = len(nums1) f = [[0] * (n + 1) for _ in range(n + 1)] for i, (a, b) in enumerate(sorted(zip(nums1, nums2), key=lambda z: z[1]), 1): for j in range(n + 1): f[i][j] = f[i - 1][j...
Solution
python
pandas-dev__pandas
pandas/tests/indexing/test_loc.py
{ "start": 91554, "end": 92684 }
class ____: @pytest.mark.parametrize("bool_value", [True, False]) def test_loc_bool_incompatible_index_raises( self, index, frame_or_series, bool_value ): # GH20432 message = f"{bool_value}: boolean label can not be used without a boolean index" if index.inferred_type != "boo...
TestLocBooleanLabelsAndSlices
python
ray-project__ray
python/ray/train/examples/pytorch/torch_linear_example.py
{ "start": 226, "end": 4264 }
class ____(torch.utils.data.Dataset): """y = a * x + b""" def __init__(self, a, b, size=1000): x = np.arange(0, 10, 10 / size, dtype=np.float32) self.x = torch.from_numpy(x) self.y = torch.from_numpy(a * x + b) def __getitem__(self, index): return self.x[index, None], self....
LinearDataset
python
kamyu104__LeetCode-Solutions
Python/count-substrings-with-only-one-distinct-letter.py
{ "start": 29, "end": 372 }
class ____(object): def countLetters(self, S): """ :type S: str :rtype: int """ result = len(S) left = 0 for right in xrange(1, len(S)): if S[right] == S[left]: result += right-left else: left = right ...
Solution
python
plotly__plotly.py
plotly/graph_objs/cone/colorbar/_title.py
{ "start": 233, "end": 3950 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "cone.colorbar" _path_str = "cone.colorbar.title" _valid_props = {"font", "side", "text"} @property def font(self): """ Sets this color bar's title font. The 'font' property is an instance of Font that may be s...
Title
python
django-extensions__django-extensions
django_extensions/management/commands/set_default_site.py
{ "start": 207, "end": 2891 }
class ____(BaseCommand): help = "Set parameters of the default django.contrib.sites Site" def add_arguments(self, parser): super().add_arguments(parser) parser.add_argument( "--name", dest="site_name", default=None, help="Use this as site name." ) parser.add_argument...
Command
python
coleifer__peewee
playhouse/reflection.py
{ "start": 1117, "end": 5006 }
class ____(object): """ Store metadata about a database column. """ primary_key_types = (IntegerField, AutoField) def __init__(self, name, field_class, raw_column_type, nullable, primary_key=False, column_name=None, index=False, unique=False, default=None, extra_pa...
Column
python
astropy__astropy
astropy/utils/iers/iers.py
{ "start": 3083, "end": 3982 }
class ____(IERSWarning): """ Downloaded IERS table may be stale. """ def download_file(*args, **kwargs): """ Overload astropy.utils.data.download_file within iers module to use a custom (longer) wait time. This just passes through ``*args`` and ``**kwargs`` after temporarily setting the d...
IERSStaleWarning
python
openai__openai-python
src/openai/types/chat/chat_completion_content_part_param.py
{ "start": 910, "end": 1259 }
class ____(TypedDict, total=False): file: Required[FileFile] type: Required[Literal["file"]] """The type of the content part. Always `file`.""" ChatCompletionContentPartParam: TypeAlias = Union[ ChatCompletionContentPartTextParam, ChatCompletionContentPartImageParam, ChatCompletionContentPart...
File
python
great-expectations__great_expectations
tests/scripts/test_public_api_report.py
{ "start": 2401, "end": 4784 }
class ____: pass """ @pytest.fixture def sample_markdown_doc_with_yaml() -> str: return """# Title Content. More content. Some yaml: yaml_contents = \"\"\" name: {datasource_name} class_name: Something \"\"\" End of content. """ @pytest.fixture def repo_root(tmp_path) -> pathlib.Path: return tmp_pa...
ExamplePublicAPIClass
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/test_dlp.py
{ "start": 21568, "end": 22372 }
class ____: @mock.patch("airflow.providers.google.cloud.operators.dlp.CloudDLPHook") def test_list_job_triggers(self, mock_hook): mock_hook.return_value.list_job_triggers.return_value = mock.MagicMock() operator = CloudDLPListJobTriggersOperator(project_id=PROJECT_ID, task_id="id") opera...
TestCloudDLPListJobTriggersOperator
python
astropy__astropy
astropy/utils/masked/tests/test_function_helpers.py
{ "start": 13396, "end": 17951 }
class ____(MaskedArraySetup): def test_put(self): ma = self.ma.copy() v = Masked([50, 150], [False, True]) np.put(ma, [0, 2], v) expected = self.a.copy() np.put(expected, [0, 2], [50, 150]) expected_mask = self.mask_a.copy() np.put(expected_mask, [0, 2], [Fals...
TestSettingParts
python
instagram__MonkeyType
tests/test_stubs.py
{ "start": 1284, "end": 1741 }
class ____: def test_merge(self): a = ImportMap() a['module.a'] = {'ClassA', 'ClassB'} a['module.b'] = {'ClassE', 'ClassF'} b = ImportMap() b['module.a'] = {'ClassB', 'ClassC'} b['module.c'] = {'ClassX', 'ClassY'} expected = ImportMap() for mod in ('mo...
TestImportMap
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pycodestyle/E30.py
{ "start": 9729, "end": 9864 }
class ____: pass # ====== Cool constants ======== BANANA = 100 APPLE = 200 # end # https://github.com/astral-sh/ruff/issues/19752
A
python
run-llama__llama_index
llama-index-integrations/tools/llama-index-tools-mcp/llama_index/tools/mcp/tool_spec_mixins.py
{ "start": 377, "end": 3028 }
class ____: def _resolve_field_type( self: "McpToolSpec", field_schema: dict, defs: dict, ) -> Any: """Resolve the Python type from a field schema.""" if "$ref" in field_schema: return self._resolve_reference(field_schema, defs) if "enum" in field_sche...
TypeResolutionMixin
python
pennersr__django-allauth
allauth/account/forms.py
{ "start": 23359, "end": 23799 }
class ____(PasswordVerificationMixin, UserForm): password1 = SetPasswordField(label=_("Password")) password2 = PasswordField(label=_("Password (again)")) def __init__(self, *args, **kwargs): super(SetPasswordForm, self).__init__(*args, **kwargs) self.fields["password1"].user = self.user ...
SetPasswordForm
python
tensorflow__tensorflow
tensorflow/python/ops/variable_scope.py
{ "start": 58988, "end": 77625 }
class ____: """Wrapper allowing functional layers to be used with eager execution. When eager execution is enabled Variables get deleted when they go out of scope, and are not stored in global collections by default. A lot of code (mostly the functional layers in tf.layers) assumes that variables are kept in ...
EagerVariableStore
python
PrefectHQ__prefect
src/integrations/prefect-shell/prefect_shell/commands.py
{ "start": 6450, "end": 15226 }
class ____(JobBlock[list[str]]): """ A block representing a shell operation, containing multiple commands. For long-lasting operations, use the trigger method and utilize the block as a context manager for automatic closure of processes when context is exited. If not, manually call the close method...
ShellOperation
python
fsspec__filesystem_spec
fsspec/callbacks.py
{ "start": 6501, "end": 9210 }
class ____(Callback): """ A callback to display a progress bar using tqdm Parameters ---------- tqdm_kwargs : dict, (optional) Any argument accepted by the tqdm constructor. See the `tqdm doc <https://tqdm.github.io/docs/tqdm/#__init__>`_. Will be forwarded to `tqdm_cls`. ...
TqdmCallback
python
crytic__slither
slither/tools/mutator/mutators/abstract_mutator.py
{ "start": 508, "end": 5653 }
class ____( metaclass=abc.ABCMeta ): # pylint: disable=too-few-public-methods,too-many-instance-attributes NAME = "" HELP = "" def __init__( # pylint: disable=too-many-arguments self, compilation_unit: SlitherCompilationUnit, timeout: int, testing_command: str, ...
AbstractMutator
python
huggingface__transformers
src/transformers/models/esm/openfold_utils/protein.py
{ "start": 1001, "end": 11497 }
class ____: """Protein structure representation.""" # Cartesian coordinates of atoms in angstroms. The atom types correspond to # residue_constants.atom_types, i.e. the first three are N, CA, CB. atom_positions: np.ndarray # [num_res, num_atom_type, 3] # Amino-acid type for each residue represent...
Protein