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
celery__celery
t/unit/app/test_log.py
{ "start": 10490, "end": 11531 }
class ____(test_default_logger): def setup_method(self): logger = self.logger = get_logger('celery.task') logger.handlers = [] logging.root.manager.loggerDict.pop(logger.name, None) self.uid = uuid() @self.app.task(shared=False) def test_task(): pass ...
test_task_logger
python
PyCQA__pylint
tests/functional/ext/docparams/return/missing_return_doc_Numpy.py
{ "start": 1779, "end": 2111 }
class ____: """test_ignores_return_in_abstract_method_numpy Example of an abstract method documenting the return type that an implementation should return.""" @abc.abstractmethod def foo(self): """docstring ... Returns ------- int Ten """ ...
Foo
python
kamyu104__LeetCode-Solutions
Python/bitwise-ors-of-subarrays.py
{ "start": 34, "end": 322 }
class ____(object): def subarrayBitwiseORs(self, A): """ :type A: List[int] :rtype: int """ result, curr = set(), {0} for i in A: curr = {i} | {i | j for j in curr} result |= curr return len(result)
Solution
python
spack__spack
lib/spack/spack/vendor/jinja2/ext.py
{ "start": 22235, "end": 26721 }
class ____(Extension): """A ``{% debug %}`` tag that dumps the available variables, filters, and tests. .. code-block:: html+jinja <pre>{% debug %}</pre> .. code-block:: text {'context': {'cycler': <class 'spack.vendor.jinja2.utils.Cycler'>, ..., ...
DebugExtension
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/postgresql/base.py
{ "start": 67371, "end": 85597 }
class ____(compiler.SQLCompiler): def visit_to_tsvector_func(self, element, **kw): return self._assert_pg_ts_ext(element, **kw) def visit_to_tsquery_func(self, element, **kw): return self._assert_pg_ts_ext(element, **kw) def visit_plainto_tsquery_func(self, element, **kw): return s...
PGCompiler
python
urllib3__urllib3
test/with_dummyserver/test_socketlevel.py
{ "start": 1575, "end": 2411 }
class ____(SocketDummyServerTestCase): def test_multi_setcookie(self) -> None: def multicookie_response_handler(listener: socket.socket) -> None: sock = listener.accept()[0] buf = b"" while not buf.endswith(b"\r\n\r\n"): buf += sock.recv(65536) ...
TestCookies
python
pydata__xarray
xarray/backends/scipy_.py
{ "start": 1680, "end": 3474 }
class ____(BackendArray): def __init__(self, variable_name, datastore): self.datastore = datastore self.variable_name = variable_name array = self.get_variable().data self.shape = array.shape self.dtype = np.dtype(array.dtype.kind + str(array.dtype.itemsize)) def get_var...
ScipyArrayWrapper
python
django__django
tests/migrations/migrations_test_apps/migrated_unapplied_app/models.py
{ "start": 31, "end": 347 }
class ____(models.Model): id = models.AutoField(primary_key=True) name = models.CharField(max_length=255) slug = models.SlugField(null=True) age = models.IntegerField(default=0) silly_field = models.BooleanField(default=False) class Meta: app_label = "migrated_unapplied_app"
OtherAuthor
python
pydantic__pydantic
tests/test_discriminated_union.py
{ "start": 13931, "end": 85775 }
class ____(str, Enum): pass ENUM_TEST_CASES = [ pytest.param(Enum, {'a': 1, 'b': 2}), pytest.param(Enum, {'a': 'v_a', 'b': 'v_b'}), (FooIntEnum, {'a': 1, 'b': 2}), (IntEnum, {'a': 1, 'b': 2}), (FooStrEnum, {'a': 'v_a', 'b': 'v_b'}), ] if sys.version_info >= (3, 11): from enum import StrEnu...
FooStrEnum
python
pytorch__pytorch
torch/testing/_internal/distributed/distributed_test.py
{ "start": 8685, "end": 9129 }
class ____(nn.Module): def __init__(self, affine=True): super().__init__() self.fc1 = nn.Linear(2, 40, bias=False) self.bn = nn.BatchNorm1d(4, affine=affine) self.fc2 = nn.Linear(40, 4, bias=False) def forward(self, x): x = torch.reshape(self.fc1(x), (-1, 4, 10)) ...
BatchNormNet
python
facebook__pyre-check
tools/upgrade/commands/support_sqlalchemy.py
{ "start": 1098, "end": 6080 }
class ____(ErrorSuppressingCommand): def __init__( self, command_arguments: CommandArguments, *, local_root: Path, paths: Sequence[Path], repository: Repository, ) -> None: super().__init__(command_arguments, repository=repository) self._local_root...
SupportSqlalchemy
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1212808, "end": 1213570 }
class ____(sgqlc.types.Type, Node): """Represents a 'locked' event on a given issue or pull request.""" __schema__ = github_schema __field_names__ = ("actor", "created_at", "lock_reason", "lockable") actor = sgqlc.types.Field(Actor, graphql_name="actor") """Identifies the actor who performed the ev...
LockedEvent
python
Pylons__pyramid
tests/test_url.py
{ "start": 44327, "end": 45597 }
class ____(unittest.TestCase): def _callFUT(self, path, request, **kw): from pyramid.url import static_url return static_url(path, request, **kw) def _makeRequest(self): class Request: def static_url(self, path, **kw): self.path = path self.k...
Test_static_url
python
getsentry__sentry
tests/sentry/preprod/api/endpoints/test_organization_preprod_artifact_assemble.py
{ "start": 13644, "end": 40160 }
class ____(APITestCase): """Integration tests for the full endpoint - requires database.""" def setUp(self) -> None: self.organization = self.create_organization(owner=self.user) with assume_test_silo_mode(SiloMode.CONTROL): self.token = ApiToken.objects.create(user=self.user, scope...
ProjectPreprodArtifactAssembleTest
python
pytorch__pytorch
torch/jit/_check.py
{ "start": 112, "end": 9772 }
class ____(ast.NodeVisitor): """Check the ``__init__`` method of a given ``nn.Module``. It ensures that all instance-level attributes can be properly initialized. Specifically, we do type inference based on attribute values...even if the attribute in question has already been typed using Python3-s...
AttributeTypeIsSupportedChecker
python
ethereum__web3.py
tests/integration/go_ethereum/test_goethereum_http.py
{ "start": 1841, "end": 2693 }
class ____(GoEthereumAdminModuleTest): @pytest.mark.xfail( reason="running geth with the --nodiscover flag doesn't allow peer addition" ) def test_admin_peers(self, w3: "Web3") -> None: super().test_admin_peers(w3) def test_admin_start_stop_http(self, w3: "Web3") -> None: # This...
TestGoEthereumAdminModuleTest
python
django__django
tests/template_tests/test_autoreloader.py
{ "start": 5324, "end": 6109 }
class ____(SimpleTestCase): def test_watch_for_template_changes(self): mock_reloader = mock.MagicMock() autoreload.watch_for_template_changes(mock_reloader) self.assertSequenceEqual( sorted(mock_reloader.watch_dir.call_args_list), [ mock.call(ROOT / "t...
Jinja2TemplateReloadTests
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 414020, "end": 415183 }
class ____(sgqlc.types.Interface): """Common fields across different project field types""" __schema__ = github_schema __field_names__ = ("created_at", "data_type", "database_id", "id", "name", "project", "updated_at") created_at = sgqlc.types.Field(sgqlc.types.non_null(DateTime), graphql_name="created...
ProjectV2FieldCommon
python
python-excel__xlwt
xlwt/BIFFRecords.py
{ "start": 72195, "end": 72810 }
class ____(BiffRecord): """ This record specifies the default column width for columns that do not have a specific width set using the record COLINFO or COLWIDTH. This record has no effect, if a STANDARDWIDTH record is present in the file. Record DEFCOLWIDTH, BIFF2-BIFF8: Offset Size Conte...
DefColWidthRecord
python
davidhalter__jedi
test/completion/usages.py
{ "start": 5273, "end": 7061 }
class ____(): def foo(self): return def check(instance): #< 13 (-5,8), (0,13) instance.foo() check(DynamicParam()) # ----------------- # Compiled Objects # ----------------- import _sre # TODO reenable this, it's currently not working, because of 2/3 # inconsistencies in typeshed (_sre exists i...
DynamicParam
python
openai__openai-python
src/openai/types/image_generate_params.py
{ "start": 4517, "end": 4885 }
class ____(ImageGenerateParamsBase, total=False): stream: Optional[Literal[False]] """Generate the image in streaming mode. Defaults to `false`. See the [Image generation guide](https://platform.openai.com/docs/guides/image-generation) for more information. This parameter is only supported for `gpt...
ImageGenerateParamsNonStreaming
python
scrapy__scrapy
tests/AsyncCrawlerProcess/caching_hostname_resolver_ipv6.py
{ "start": 63, "end": 558 }
class ____(scrapy.Spider): """ Finishes without a twisted.internet.error.DNSLookupError exception """ name = "caching_hostname_resolver_spider" start_urls = ["http://[::1]"] if __name__ == "__main__": process = AsyncCrawlerProcess( settings={ "RETRY_ENABLED": False, ...
CachingHostnameResolverSpider
python
keras-team__keras
keras/src/random/random_test.py
{ "start": 16842, "end": 19318 }
class ____(testing.TestCase): """Test the dtype to verify that the behavior matches JAX.""" INT_DTYPES = [x for x in dtypes.INT_TYPES if x not in ("uint64", "int64")] FLOAT_DTYPES = [x for x in dtypes.FLOAT_TYPES if x not in ("float64",)] if backend.backend() == "torch": INT_DTYPES = [x for x i...
RandomDTypeTest
python
django__django
django/contrib/auth/validators.py
{ "start": 173, "end": 481 }
class ____(validators.RegexValidator): regex = r"^[\w.@+-]+\Z" message = _( "Enter a valid username. This value may contain only unaccented lowercase a-z " "and uppercase A-Z letters, numbers, and @/./+/-/_ characters." ) flags = re.ASCII @deconstructible
ASCIIUsernameValidator
python
dagster-io__dagster
python_modules/libraries/dagster-dbt/dagster_dbt/components/dbt_project/component.py
{ "start": 19520, "end": 20599 }
class ____( create_component_translator_cls(DbtProjectComponent, DagsterDbtTranslator), ComponentTranslator[DbtProjectComponent], ): def __init__( self, component: DbtProjectComponent, settings: Optional[DagsterDbtComponentTranslatorSettings], ): self._component = compone...
DbtProjectComponentTranslator
python
explosion__spaCy
spacy/lang/az/__init__.py
{ "start": 221, "end": 329 }
class ____(Language): lang = "az" Defaults = AzerbaijaniDefaults __all__ = ["Azerbaijani"]
Azerbaijani
python
sqlalchemy__sqlalchemy
test/typing/plain_files/orm/dataclass_transforms_one.py
{ "start": 793, "end": 1315 }
class ____(MappedAsDataclass, Base): __tablename__ = "ticket_9628" id: Mapped[int] = mapped_column(primary_key=True, init=False) data: Mapped[str] = mapped_column() d2: Mapped[str] = column_property(data + "Asdf") d3: Mapped[str] = query_expression(data + "Asdf") # d2 and d3 are not required, as...
TestTicket9628
python
scrapy__scrapy
tests/test_cmdline_crawl_with_pipeline/test_spider/pipelines.py
{ "start": 0, "end": 131 }
class ____: def open_spider(self, spider): pass def process_item(self, item): return item
TestSpiderPipeline
python
run-llama__llama_index
llama-index-integrations/readers/llama-index-readers-oxylabs/llama_index/readers/oxylabs/amazon_bestsellers.py
{ "start": 135, "end": 917 }
class ____(OxylabsBaseReader): """ Get data from Amazon Best Sellers pages. https://developers.oxylabs.io/scraper-apis/web-scraper-api/targets/amazon/best-sellers """ top_level_header: str = "Bestsellers" def __init__(self, username: str, password: str, **data) -> None: super().__init...
OxylabsAmazonBestsellersReader
python
dagster-io__dagster
python_modules/dagster-pipes/dagster_pipes/__init__.py
{ "start": 55606, "end": 69611 }
class ____: """The context for a Dagster Pipes process. This class is analogous to :py:class:`~dagster.OpExecutionContext` on the Dagster side of the Pipes connection. It provides access to information such as the asset key(s) and partition key(s) in scope for the current step. It also provides methods...
PipesContext
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/py_test_callback/package.py
{ "start": 328, "end": 998 }
class ____(Python): """A package for testing stand-alone test methods as a callback.""" homepage = "http://www.example.com" url = "http://www.example.com/test-callback-1.0.tar.gz" #: This attribute is used in UI queries that need to know the build #: system base class build_system_class = "PyT...
PyTestCallback
python
ray-project__ray
python/ray/tests/test_batch_node_provider_unit.py
{ "start": 3619, "end": 19107 }
class ____: """Utility to test BatchingNodeProvider.""" def __init__(self): self.node_provider = MockBatchingNodeProvider( provider_config={ DISABLE_LAUNCH_CONFIG_CHECK_KEY: True, DISABLE_NODE_UPDATERS_KEY: True, FOREGROUND_NODE_LAUNCH_KEY: Tr...
BatchingNodeProviderTester
python
gevent__gevent
src/gevent/events.py
{ "start": 7234, "end": 7849 }
class ____(Interface): """ The event emitted when the memory usage threshold is exceeded. This event is emitted only while memory continues to grow above the threshold. Only if the condition or stabilized is corrected (memory usage drops) will the event be emitted in the future. This event is ...
IMemoryUsageThresholdExceeded
python
sphinx-doc__sphinx
sphinx/domains/cpp/_ast.py
{ "start": 102996, "end": 106842 }
class ____(ASTDeclarator): def __init__( self, className: ASTNestedName, const: bool, volatile: bool, next: ASTDeclarator ) -> None: assert className assert next self.className = className self.const = const self.volatile = volatile self.next = next d...
ASTDeclaratorMemPtr
python
kamyu104__LeetCode-Solutions
Python/identify-the-largest-outlier-in-an-array.py
{ "start": 42, "end": 568 }
class ____(object): def getLargestOutlier(self, nums): """ :type nums: List[int] :rtype: int """ result = float("-inf") total = sum(nums) cnt = collections.defaultdict(int) for x in nums: cnt[x] += 1 for x in nums: if (t...
Solution
python
apache__airflow
providers/fab/src/airflow/providers/fab/www/session.py
{ "start": 1904, "end": 2087 }
class ____(SessionExemptMixin, SqlAlchemySessionInterface): """Session interface that exempts some routes and stores session data in the database."""
AirflowDatabaseSessionInterface
python
plotly__plotly.py
plotly/graph_objs/layout/_ternary.py
{ "start": 235, "end": 7494 }
class ____(_BaseLayoutHierarchyType): _parent_path_str = "layout" _path_str = "layout.ternary" _valid_props = {"aaxis", "baxis", "bgcolor", "caxis", "domain", "sum", "uirevision"} @property def aaxis(self): """ The 'aaxis' property is an instance of Aaxis that may be specifi...
Ternary
python
huggingface__transformers
src/transformers/models/x_clip/processing_x_clip.py
{ "start": 700, "end": 1514 }
class ____(ProcessorMixin): r""" Constructs an X-CLIP processor which wraps a VideoMAE image processor and a CLIP tokenizer into a single processor. [`XCLIPProcessor`] offers all the functionalities of [`CLIPImageProcessor`] and [`CLIPTokenizerFast`]. See the [`~XCLIPProcessor.__call__`] and [`~XCLIPPr...
XCLIPProcessor
python
apache__airflow
task-sdk/src/airflow/sdk/api/datamodels/_generated.py
{ "start": 11339, "end": 11601 }
class ____(RootModel[JsonValue]): root: Annotated[ JsonValue, Field( description="XCom schema with minimal structure for index-based access.", title="XComSequenceIndexResponse", ), ]
XComSequenceIndexResponse
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_autofilter05.py
{ "start": 315, "end": 2615 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("autofilter05.xlsx") self.set_text_file("autofilter_data.txt") def test_create_file(self): """ Test the creation of a simple...
TestCompareXLSXFiles
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/orm/path_registry.py
{ "start": 24841, "end": 26007 }
class ____(_AbstractEntityRegistry): # for long lived mapper, return dict based caching # version that creates reference cycles __slots__ = ("_cache",) inherit_cache = True def __init__( self, parent: Union[RootRegistry, _PropRegistry], entity: _InternalEntityType[Any], ...
_CachingEntityRegistry
python
getsentry__sentry
src/sentry/uptime/subscriptions/subscriptions.py
{ "start": 3491, "end": 22831 }
class ____(Exception): """ Indicates that the quotes system is unable to allocate a seat for the new uptime monitor. """ result: SeatAssignmentResult def __init__(self, result: SeatAssignmentResult) -> None: super().__init__() self.result = result def create_uptime_subscripti...
UptimeMonitorNoSeatAvailable
python
getsentry__sentry
src/sentry/search/events/fields.py
{ "start": 38928, "end": 43001 }
class ____(ColumnArg): measurement_aliases = { MEASUREMENTS_FRAMES_SLOW_RATE, MEASUREMENTS_FRAMES_FROZEN_RATE, MEASUREMENTS_STALL_PERCENTAGE, } numeric_array_columns = { "measurements_value", "span_op_breakdowns_value", "spans_exclusive_time", } def ...
NumericColumn
python
readthedocs__readthedocs.org
readthedocs/profiles/views.py
{ "start": 6612, "end": 6666 }
class ____(TokenMixin, ListView): pass
TokenListView
python
great-expectations__great_expectations
great_expectations/datasource/fluent/data_connector/filesystem_data_connector.py
{ "start": 494, "end": 574 }
class ____(pydantic.BaseModel): glob_directive: str = "**/*"
FilesystemOptions
python
django__django
tests/modeladmin/test_checks.py
{ "start": 2002, "end": 4546 }
class ____(CheckTestCase): def test_not_iterable(self): class TestModelAdmin(ModelAdmin): raw_id_fields = 10 self.assertIsInvalid( TestModelAdmin, ValidationTestModel, "The value of 'raw_id_fields' must be a list or tuple.", "admin.E001", ...
RawIdCheckTests
python
conda__conda
conda/cli/condarc.py
{ "start": 2402, "end": 5765 }
class ____: """ Groups configuration parameters by their parameter type. Organizes configuration parameters from a Configuration instance into sequence and map parameters, handling both regular and plugin parameters separately. This is primarily used by ConfigurationFile to efficiently determine w...
ParameterTypeGroups
python
gevent__gevent
src/gevent/_semaphore.py
{ "start": 1109, "end": 1331 }
class ____(object): __slots__ = ( 'lock', ) def __init__(self, lock): self.lock = lock def __call__(self, _): self.lock.release() _UNSET = object() _MULTI = object()
_LockReleaseLink
python
django-haystack__django-haystack
test_haystack/test_managers.py
{ "start": 1102, "end": 8826 }
class ____(TestCase): fixtures = ["bulk_data.json"] def setUp(self): super().setUp() self.search_index = BasicMockModelSearchIndex # Update the "index". backend = connections["default"].get_backend() backend.clear() backend.update(self.search_index(), MockModel....
ManagerTestCase
python
django-haystack__django-haystack
test_haystack/solr_tests/test_solr_backend.py
{ "start": 56703, "end": 58321 }
class ____(TestCase): def setUp(self): super().setUp() # Wipe it clean. clear_solr_index() # Stow. self.old_ui = connections["solr"].get_unified_index() self.ui = UnifiedIndex() self.srtsi = SolrRoundTripSearchIndex() self.ui.build(indexes=[self.srts...
LiveSolrRoundTripTestCase
python
pytorch__pytorch
torch/ao/quantization/pt2e/duplicate_dq_pass.py
{ "start": 1550, "end": 3129 }
class ____(PassBase): def call(self, graph_module: torch.fx.GraphModule) -> PassResult: for node in graph_module.graph.nodes: if node.op == "call_function" and node.target in _DEQUANTIZE_OPS: dq_users = _filter_sym_size_users(node) if len(dq_users) <= 1: ...
DuplicateDQPass
python
pytorch__pytorch
test/dynamo/test_dicts.py
{ "start": 34914, "end": 38816 }
class ____(LoggingTestCase): thetype = dict @make_logging_test(recompiles=True) def test_popitem(self, records): d = self.thetype() d[1] = 2 d[3] = 4 @torch.compile(backend="eager", fullgraph=True) def fn(x): k, v = d.popitem() if k == 3 and ...
DictGuardTests
python
pytorch__pytorch
torch/_functorch/_aot_autograd/schemas.py
{ "start": 30719, "end": 33168 }
class ____: # A copy of all forward metadata, but computed on the *dense* tensor forward (after desugaring subclasses) # So for example, if the user had a model containing two `TwoTensor` inputs, # Then `SubclassMeta.fw_metadata.input_infos` would have length 4 here. fw_metadata: ViewAndMutationMeta ...
SubclassMeta
python
openai__openai-python
src/openai/types/responses/web_search_preview_tool.py
{ "start": 917, "end": 1469 }
class ____(BaseModel): type: Literal["web_search_preview", "web_search_preview_2025_03_11"] """The type of the web search tool. One of `web_search_preview` or `web_search_preview_2025_03_11`. """ search_context_size: Optional[Literal["low", "medium", "high"]] = None """High level guidance for ...
WebSearchPreviewTool
python
tensorflow__tensorflow
tensorflow/lite/python/lite_v2_test.py
{ "start": 186865, "end": 191345 }
class ____(lite_v2_test_util.ModelTest): def _createGraphWithCustomOp(self): # Create a graph that has one double op. np.random.seed(0) saved_model_dir = os.path.join(self.get_temp_dir(), 'double_model') with ops.Graph().as_default(): with tf.compat.v1.Session() as sess: in_tensor = tf...
CalibrateAndQuantizeWithCustomOpTest
python
fastai__fastai
fastai/optimizer.py
{ "start": 697, "end": 3731 }
class ____(): "Common functionality between `Optimizer` and `OptimWrapper`" def all_params(self, n:slice|int=slice(None), # Extended slicing over the optimizer `param_lists` with_grad:bool=False # Get all param tuples. If `True` select only those with a gradient ): res = L((p,pg,self...
_BaseOptimizer
python
coleifer__peewee
peewee.py
{ "start": 53955, "end": 54622 }
class ____(Node): def __init__(self, expr, of=None, nowait=None): expr = 'FOR UPDATE' if expr is True else expr if expr.lower().endswith('nowait'): expr = expr[:-7] # Strip off the "nowait" bit. nowait = True self._expr = expr if of is not None and not isins...
ForUpdate
python
kamyu104__LeetCode-Solutions
Python/reverse-integer.py
{ "start": 39, "end": 849 }
class ____(object): def reverse(self, x): """ :type x: int :rtype: int """ if x < 0: return -self.reverse(-x) result = 0 while x: result = result * 10 + x % 10 x //= 10 return result if result <= 0x7fffffff else 0 ...
Solution
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/methodOverride1.py
{ "start": 10070, "end": 10162 }
class ____: pass _T2A = TypeVar("_T2A", bound=Foo) _T2B = TypeVar("_T2B", bound=Foo)
Foo
python
apache__airflow
helm-tests/tests/helm_tests/airflow_aux/test_annotations.py
{ "start": 17921, "end": 18826 }
class ____: """Tests Redis Annotations.""" def test_redis_annotations_are_added(self): # Test Case values = {"redis": {"annotations": {"example": "redis"}}} show_only = "templates/redis/redis-statefulset.yaml" expected_annotations = {"example": "redis"} k8s_objects = re...
TestRedisAnnotations
python
PrefectHQ__prefect
tests/utilities/test_callables.py
{ "start": 402, "end": 15724 }
class ____: def test_simple_function_with_no_arguments(self): def f(): pass schema = callables.parameter_schema(f) assert schema.model_dump_for_openapi() == { "properties": {}, "title": "Parameters", "type": "object", "definitions"...
TestFunctionToSchema
python
tensorflow__tensorflow
tensorflow/python/keras/saving/saved_model/save_impl.py
{ "start": 24446, "end": 29182 }
class ____(object): """Function that triggers traces of other functions in the same collection.""" def __init__(self, call_collection, call_fn, name, input_signature): """Initializes a LayerCall object. Args: call_collection: a LayerCallCollection, which contains the other layer call functio...
LayerCall
python
viewflow__viewflow
viewflow/workflow/nodes/switch.py
{ "start": 1082, "end": 2699 }
class ____(Node): """ Gateway that selects one of the outgoing node. Activates first node with matched condition. Example:: select_responsible_person = ( flow.Switch() .Case(this.dean_approval, lambda act: a.process.need_dean) .Case(this.head_approval, lamb...
Switch
python
crytic__slither
slither/tools/upgradeability/__main__.py
{ "start": 7214, "end": 13249 }
class ____(argparse.Action): # pylint: disable=too-few-public-methods def __call__( self, parser: Any, args: Any, values: Optional[Union[str, Sequence[Any]]], option_string: Any = None, ) -> Any: # pylint: disable=signature-differs checks = _get_checks() ...
OutputWiki
python
huggingface__transformers
src/transformers/models/speecht5/modeling_speecht5.py
{ "start": 19207, "end": 20786 }
class ____(nn.Module): """Construct the features from raw audio waveform""" def __init__(self, config): super().__init__() if config.feat_extract_norm == "group": conv_layers = [SpeechT5GroupNormConvLayer(config, layer_id=0)] + [ SpeechT5NoLayerNormConvLayer(config,...
SpeechT5FeatureEncoder
python
coleifer__peewee
tests/manytomany.py
{ "start": 7199, "end": 19171 }
class ____(ModelTestCase): database = get_in_memory_db() requires = [User, Note, NoteUserThrough, AltNote, AltThroughModel] user_to_note = { 'gargie': [1, 2], 'huey': [2, 3], 'mickey': [3, 4], 'zaizee': [4, 5], } def setUp(self): super(TestManyToMany, self)....
TestManyToMany
python
readthedocs__readthedocs.org
readthedocs/redirects/migrations/0005_allow_to_force_redirects.py
{ "start": 149, "end": 657 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("redirects", "0004_denormalize-from-url"), ] operations = [ migrations.AddField( model_name="redirect", name="force", field=models.BooleanField( default=Fal...
Migration
python
walkccc__LeetCode
solutions/2262. Total Appeal of A String/2262.py
{ "start": 0, "end": 486 }
class ____: def appealSum(self, s: str) -> int: ans = 0 # the total appeal of all substrings ending in the index so far dp = 0 lastSeen = {} for i, c in enumerate(s): # the total appeal of all substrings ending in s[i] # = the total appeal of all substrings ending in s[i - 1] ...
Solution
python
gevent__gevent
src/greentest/3.9/test_asyncore.py
{ "start": 891, "end": 2290 }
class ____: def __init__(self): self.error_handled = False def handle_read_event(self): raise Exception() handle_write_event = handle_read_event handle_close = handle_read_event handle_expt_event = handle_read_event def handle_error(self): self.error_handled = True # ...
crashingdummy
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/hooks/sns.py
{ "start": 2351, "end": 6046 }
class ____(AwsBaseHook): """ Interact with Amazon Simple Notification Service. Provide thin wrapper around :external+boto3:py:class:`boto3.client("sns") <SNS.Client>`. Additional arguments (such as ``aws_conn_id``) may be specified and are passed down to the underlying AwsBaseHook. .. seealso...
SnsHook
python
eth-brownie__brownie
brownie/network/gas/bases.py
{ "start": 2709, "end": 3343 }
class ____(GasABC): """ Abstract base class for simple gas strategies. Simple gas strategies are called once to provide a gas price at the time a transaction is broadcasted. Transactions using simple gas strategies are not automatically rebroadcasted. Subclass from this ABC to implement your o...
SimpleGasStrategy
python
getsentry__sentry
tests/sentry/rules/processing/test_delayed_processing.py
{ "start": 2590, "end": 5449 }
class ____(CreateEventTestCase): def setUp(self) -> None: super().setUp() self.project = self.create_project() self.environment = self.create_environment(project=self.project) self.event = self.create_event( self.project.id, FROZEN_TIME, "group-1", self.environment.name ...
BulkFetchEventsTest
python
PrefectHQ__prefect
src/integrations/prefect-databricks/prefect_databricks/models/jobs.py
{ "start": 34356, "end": 34550 }
class ____(RootModel[Union[CanManage, CanManageRun, CanView]]): """ See source code for the fields' description. """ model_config = ConfigDict(frozen=True)
PermissionLevelForGroup
python
openai__openai-python
src/openai/types/beta/thread_create_params.py
{ "start": 2209, "end": 2417 }
class ____(TypedDict, total=False): file_id: str """The ID of the file to attach to the message.""" tools: Iterable[MessageAttachmentTool] """The tools to add this file to."""
MessageAttachment
python
django__django
tests/model_forms/tests.py
{ "start": 3956, "end": 4063 }
class ____(forms.ModelForm): class Meta: model = TextFile fields = "__all__"
TextFileForm
python
doocs__leetcode
lcof/面试题64. 求1+2+…+n/Solution.py
{ "start": 0, "end": 101 }
class ____: def sumNums(self, n: int) -> int: return n and (n + self.sumNums(n - 1))
Solution
python
getsentry__sentry
src/sentry/models/releases/util.py
{ "start": 787, "end": 922 }
class ____( namedtuple("SemverVersion", "major minor patch revision prerelease_case prerelease") ): pass @dataclass
SemverVersion
python
cython__cython
Cython/Compiler/Code.py
{ "start": 48147, "end": 50405 }
class ____: """Global info about a C string constant held by GlobalState. """ # cname string # text EncodedString or BytesLiteral # escaped_value str The string value as C code byte sequence. # py_strings {(identifier, encoding) : PyStringConst} # c_use...
StringConst
python
qdrant__qdrant-client
qdrant_client/local/async_qdrant_local.py
{ "start": 1024, "end": 38805 }
class ____(AsyncQdrantBase): """ Everything Qdrant server can do, but locally. Use this implementation to run vector search without running a Qdrant server. Everything that works with local Qdrant will work with server Qdrant as well. Use for small-scale data, demos, and tests. If you need mor...
AsyncQdrantLocal
python
mkdocs__mkdocs
mkdocs/config/config_options.py
{ "start": 15211, "end": 15349 }
class ____(NamedTuple): host: str port: int def __str__(self) -> str: return f'{self.host}:{self.port}'
_IpAddressValue
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/nn_ops/rnn_cell_test.py
{ "start": 72043, "end": 76849 }
class ____(test.TestCase): def setUp(self): self._seed = 23489 np.random.seed(self._seed) @test_util.run_v1_only("b/124229375") def testNestedIOLSTMAllRNNContainers(self): input_size = 5 batch_size = 2 state_size = 6 max_length = 8 sequence_length = [4, 6] with self.session(graph...
NestedLSTMTest
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/test_tasks.py
{ "start": 8623, "end": 9766 }
class ____: @mock.patch("airflow.providers.google.cloud.operators.tasks.CloudTasksHook") def test_create_task(self, mock_hook): mock_hook.return_value.create_task.return_value = TEST_TASK operator = CloudTasksTaskCreateOperator( location=LOCATION, queue_name=QUEUE_ID, task=Task(), ta...
TestCloudTasksTaskCreate
python
davidhalter__jedi
test/completion/inheritance.py
{ "start": 450, "end": 1069 }
class ____: class Test2: def __init__(self): self.foo_nested = 0 #? ['foo_nested'] self.foo_ #? self.foo_here def __init__(self, self2): self.foo_here = 3 #? ['foo_here', 'foo_in_func'] self.foo_ #? int() ...
Test1
python
pydantic__pydantic
tests/mypy/modules/plugin_success.py
{ "start": 405, "end": 772 }
class ____(BaseModel): submodel: Optional['SelfReferencingModel'] @property def prop(self) -> None: ... SelfReferencingModel.model_rebuild() model = Model(x=1, y='y') Model(x=1, y='y', z='z') model.x = 2 model.model_validate(model) self_referencing_model = SelfReferencingModel(submodel=SelfRefe...
SelfReferencingModel
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_optimize09.py
{ "start": 315, "end": 898 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("optimize09.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook( ...
TestCompareXLSXFiles
python
streamlit__streamlit
lib/streamlit/runtime/scriptrunner/exec_code.py
{ "start": 1333, "end": 5799 }
class ____: # noqa: N801 """A context for prepending a directory to sys.path for a second. Code inspired by IPython: Source: https://github.com/ipython/ipython/blob/master/IPython/utils/syspathcontext.py#L42 """ def __init__(self, main_script_path: str) -> None: self._main_script_path = m...
modified_sys_path
python
ipython__ipython
docs/autogen_shortcuts.py
{ "start": 982, "end": 3064 }
class ____(Filter): """Protocol reflecting non-public prompt_toolkit's `_Invert`.""" filter: Filter conjunctions_labels = {"_AndList": "&", "_OrList": "|"} ATOMIC_CLASSES = {"Never", "Always", "Condition"} HUMAN_NAMES_FOR_FILTERS = { filter_: name for name, filter_ in KEYBINDING_FILTERS.items() } de...
_Invert
python
pytorch__pytorch
test/functorch/test_ac_knapsack.py
{ "start": 13801, "end": 16657 }
class ____(TestCase): def setUp(self): # (memory, runtime, max_memory, expected_runtime, expected_saved, expected_recomputable) self.test_cases = [ ([2, 3, 2, 4, 1], [1, 2, 1, 3, 2], 5, 5.0, [3, 4], [2, 1, 0]), ([1, 1, 1], [1, 2, 3], 3, 6.0, [0, 1, 2], []), ([10, ...
TestActivationCheckpointingKnapsack
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/orm/dynamic.py
{ "start": 1561, "end": 2371 }
class ____(WriteOnlyHistory[_T]): def __init__( self, attr: _DynamicAttributeImpl, state: InstanceState[_T], passive: PassiveFlag, apply_to: Optional[DynamicCollectionHistory[_T]] = None, ) -> None: if apply_to: coll = AppenderQuery(attr, state).autofl...
DynamicCollectionHistory
python
pexpect__pexpect
tests/test_pxssh.py
{ "start": 882, "end": 12126 }
class ____(SSHTestBase): def test_fake_ssh(self): ssh = pxssh.pxssh() #ssh.logfile_read = sys.stdout # DEBUG ssh.login('server', 'me', password='s3cret') ssh.sendline('ping') ssh.expect('pong', timeout=10) assert ssh.prompt(timeout=10) ssh.logout() def t...
PxsshTestCase
python
scipy__scipy
benchmarks/benchmarks/go_benchmark_functions/go_funcs_M.py
{ "start": 2352, "end": 3571 }
class ____(Benchmark): r""" Meyer [1]_ objective function. ..[1] https://www.itl.nist.gov/div898/strd/nls/data/mgh10.shtml TODO NIST regression standard """ def __init__(self, dimensions=3): Benchmark.__init__(self, dimensions) self._bounds = list(zip([0., 100., 100.], ...
Meyer
python
lepture__authlib
authlib/oauth1/rfc5849/errors.py
{ "start": 1693, "end": 1850 }
class ____(OAuth1Error): error = "invalid_token" description = 'Invalid or expired "oauth_token" in parameters' status_code = 401
InvalidTokenError
python
realpython__materials
solid-principles-python/file_manager_srp.py
{ "start": 909, "end": 1270 }
class ____: def __init__(self, filename): self.path = Path(filename) def compress(self): with ZipFile(self.path.with_suffix(".zip"), mode="w") as archive: archive.write(self.path) def decompress(self): with ZipFile(self.path.with_suffix(".zip"), mode="r") as archive: ...
ZipFileManager
python
getsentry__sentry
tests/sentry/workflow_engine/buffer/test_batch_client.py
{ "start": 9276, "end": 12033 }
class ____: @pytest.fixture def mock_buffer(self): """Create a mock buffer for testing.""" return Mock(spec=RedisHashSortedSetBuffer) @pytest.fixture def project_client(self, mock_buffer): """Create a ProjectDelayedWorkflowClient with mocked buffer.""" return DelayedWork...
TestProjectDelayedWorkflowClient
python
pydata__xarray
xarray/core/_aggregations.py
{ "start": 285932, "end": 337564 }
class ____: _obj: DataArray def reduce( self, func: Callable[..., Any], dim: Dims = None, *, axis: int | Sequence[int] | None = None, keep_attrs: bool | None = None, keepdims: bool = False, **kwargs: Any, ) -> DataArray: raise NotImple...
DataArrayResampleAggregations
python
pytest-dev__pytest-asyncio
pytest_asyncio/plugin.py
{ "start": 16909, "end": 17277 }
class ____(PytestAsyncioFunction): """ Pytest item that is a coroutine or an asynchronous generator decorated with staticmethod """ @staticmethod def _can_substitute(item: Function) -> bool: func = item.obj return isinstance(func, staticmethod) and _is_coroutine_or_asyncgen( ...
AsyncStaticMethod
python
airbytehq__airbyte
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/publish/pipeline.py
{ "start": 4434, "end": 6630 }
class ____(Step): context: PublishConnectorContext title = "Upload connector dependencies list to GCS." key_prefix = "connector_dependencies" async def _run(self, built_containers_per_platform: Dict[Platform, Container]) -> StepResult: assert self.context.connector.language in [ Con...
UploadDependenciesToMetadataService
python
tensorflow__tensorflow
tensorflow/python/debug/cli/debugger_cli_common_test.py
{ "start": 22465, "end": 25206 }
class ____(test_util.TensorFlowTestCase): def setUp(self): self._orig_screen_output = debugger_cli_common.RichTextLines( ["Roses are red", "Violets are blue"]) def testRegexFindWithoutExistingFontAttrSegs(self): new_screen_output = debugger_cli_common.regex_find(self._orig_screen_output, ...
RegexFindTest
python
pdm-project__pdm
src/pdm/cli/commands/publish/repository.py
{ "start": 1110, "end": 6965 }
class ____: def __init__(self, project: Project, config: RepositoryConfig) -> None: self.url = cast(str, config.url) self.session = project.environment._build_session([config]) self._credentials_to_save: tuple[str, str, str] | None = None self.ui = project.core.ui username, ...
Repository
python
walkccc__LeetCode
solutions/3440. Reschedule Meetings for Maximum Free Time II/3440.py
{ "start": 0, "end": 1026 }
class ____: def maxFreeTime( self, eventTime: int, startTime: list[int], endTime: list[int] ) -> int: n = len(startTime) gaps = ([startTime[0]] + [startTime[i] - endTime[i - 1] for i in range(1, len(startTime))] + [eventTime - endTime[-1]]) ans = 0 max...
Solution