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
dagster-io__dagster
python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/generated/destinations.py
{ "start": 84877, "end": 85981 }
class ____(GeneratedAirbyteDestination): @public def __init__( self, name: str, username: str, jdbc_url: str, password: Optional[str] = None, schema: Optional[str] = None, ): """Airbyte Destination for Jdbc. Documentation can be found at https...
JdbcDestination
python
wandb__wandb
wandb/apis/public/jobs.py
{ "start": 9517, "end": 16946 }
class ____: """A single queued run associated with an entity and project. Args: entity: The entity associated with the queued run. project (str): The project where runs executed by the queue are logged to. queue_name (str): The name of the queue. run_queue_item_id (int): The id ...
QueuedRun
python
django__django
django/contrib/gis/db/models/lookups.py
{ "start": 4140, "end": 4376 }
class ____(GISLookup): """ The 'overlaps_below' operator returns true if A's bounding box overlaps or is below B's bounding box. """ lookup_name = "overlaps_below" @BaseSpatialField.register_lookup
OverlapsBelowLookup
python
apache__airflow
providers/microsoft/psrp/src/airflow/providers/microsoft/psrp/hooks/psrp.py
{ "start": 1555, "end": 10988 }
class ____(BaseHook): """ Hook for PowerShell Remoting Protocol execution. When used as a context manager, the runspace pool is reused between shell sessions. :param psrp_conn_id: Required. The name of the PSRP connection. :param logging_level: Logging level for message streams which a...
PsrpHook
python
apache__airflow
airflow-core/src/airflow/cli/commands/config_command.py
{ "start": 2922, "end": 3052 }
class ____(NamedTuple): """Represents a configuration parameter.""" section: str option: str @dataclass
ConfigParameter
python
scipy__scipy
benchmarks/benchmarks/go_benchmark_functions/go_funcs_C.py
{ "start": 10366, "end": 11521 }
class ____(Benchmark): r""" Cosine Mixture objective function. This class defines the Cosine Mixture global optimization problem. This is a multimodal minimization problem defined as follows: .. math:: f_{\text{CosineMixture}}(x) = -0.1 \sum_{i=1}^n \cos(5 \pi x_i) + \sum_{i=1}^n ...
CosineMixture
python
tensorflow__tensorflow
tensorflow/python/ops/io_ops.py
{ "start": 20054, "end": 20907 }
class ____(ReaderBase): """A Reader that outputs the queued work as both the key and value. To use, enqueue strings in a Queue. Read will take the front work string and output (work, work). See ReaderBase for supported methods. @compatibility(eager) Readers are not compatible with eager execution. Inste...
IdentityReader
python
wandb__wandb
wandb/sdk/wandb_alerts.py
{ "start": 113, "end": 193 }
class ____(Enum): INFO = "INFO" WARN = "WARN" ERROR = "ERROR"
AlertLevel
python
pymupdf__PyMuPDF
src/table.py
{ "start": 19529, "end": 49160 }
class ____: def __init__( self, x_tolerance=DEFAULT_X_TOLERANCE, y_tolerance=DEFAULT_Y_TOLERANCE, keep_blank_chars: bool = False, use_text_flow=False, horizontal_ltr=True, # Should words be read left-to-right? vertical_ttb=False, # Should vertical words be r...
WordExtractor
python
Textualize__textual
tests/text_area/test_selection_bindings.py
{ "start": 316, "end": 11197 }
class ____(App): def __init__(self, read_only: bool = False): super().__init__() self.read_only = read_only def compose(self) -> ComposeResult: yield TextArea(TEXT, show_line_numbers=True, read_only=self.read_only) @pytest.fixture(params=[True, False]) async def app(request): """E...
TextAreaApp
python
django-haystack__django-haystack
test_haystack/whoosh_tests/test_whoosh_query.py
{ "start": 266, "end": 7513 }
class ____(WhooshTestCase): def setUp(self): super().setUp() self.sq = connections["whoosh"].get_query() def test_build_query_all(self): self.assertEqual(self.sq.build_query(), "*") def test_build_query_single_word(self): self.sq.add_filter(SQ(content="hello")) sel...
WhooshSearchQueryTestCase
python
eventlet__eventlet
eventlet/event.py
{ "start": 100, "end": 192 }
class ____: def __repr__(self): return 'NOT_USED' NOT_USED = NOT_USED()
NOT_USED
python
modin-project__modin
modin/core/io/column_stores/hdf_dispatcher.py
{ "start": 965, "end": 3478 }
class ____(ColumnStoreDispatcher): # pragma: no cover """ Class handles utils for reading hdf data. Inherits some common for columnar store files util functions from `ColumnStoreDispatcher` class. """ @classmethod def _validate_hdf_format(cls, path_or_buf): """ Validate `p...
HDFDispatcher
python
tornadoweb__tornado
tornado/test/netutil_test.py
{ "start": 563, "end": 1377 }
class ____(AsyncTestCase): resolver = None # type: typing.Any @gen_test def test_localhost(self): addrinfo = yield self.resolver.resolve("localhost", 80, socket.AF_UNSPEC) # Most of the time localhost resolves to either the ipv4 loopback # address alone, or ipv4+ipv6. But some vers...
_ResolverTestMixin
python
walkccc__LeetCode
solutions/1106. Parsing A Boolean Expression/1106.py
{ "start": 0, "end": 868 }
class ____: def parseBoolExpr(self, expression: str) -> bool: def dfs(s: int, e: int) -> list[str]: if s == e: return True if expression[s] == 't' else False exps = [] layer = 0 for i in range(s, e + 1): c = expression[i] if layer == 0 and c in '!&|': op...
Solution
python
spack__spack
lib/spack/spack/repo.py
{ "start": 16008, "end": 16442 }
class ____(Indexer): """Lifecycle methods for a TagIndex on a Repo.""" def _create(self) -> spack.tag.TagIndex: return spack.tag.TagIndex() def read(self, stream): self.index = spack.tag.TagIndex.from_json(stream) def update(self, pkg_fullname): self.index.update_package(pkg_f...
TagIndexer
python
pytorch__pytorch
test/dynamo/cpython/3_13/test_set.py
{ "start": 56037, "end": 56337 }
class ____(_TestOnlySetsInBinaryOps, __TestCase): def setUp(self): self.set = set((1, 2, 3)) self.other = operator.add self.otherIsIterable = False super().setUp() #------------------------------------------------------------------------------
TestOnlySetsOperator
python
ethereum__web3.py
web3/_utils/events.py
{ "start": 14479, "end": 15557 }
class ____(ABC): _match_values: tuple[Any, ...] = None _immutable = False def __init__(self, arg_type: TypeStr) -> None: self.arg_type = arg_type def match_single(self, value: Any) -> None: if self._immutable: raise Web3ValueError( "Setting values is forbidd...
BaseArgumentFilter
python
huggingface__transformers
src/transformers/models/clip/modeling_clip.py
{ "start": 14905, "end": 16063 }
class ____(GradientCheckpointingLayer): def __init__(self, config: Union[CLIPVisionConfig, CLIPTextConfig]): super().__init__() self.embed_dim = config.hidden_size self.self_attn = CLIPAttention(config) self.layer_norm1 = nn.LayerNorm(self.embed_dim, eps=config.layer_norm_eps) ...
CLIPEncoderLayer
python
oauthlib__oauthlib
oauthlib/oauth2/rfc6749/endpoints/authorization.py
{ "start": 357, "end": 4584 }
class ____(BaseEndpoint): """Authorization endpoint - used by the client to obtain authorization from the resource owner via user-agent redirection. The authorization endpoint is used to interact with the resource owner and obtain an authorization grant. The authorization server MUST first verify...
AuthorizationEndpoint
python
numpy__numpy
numpy/lib/tests/test_shape_base.py
{ "start": 22595, "end": 25306 }
class ____: def test_basic(self): # Using 0-dimensional ndarray a = np.array(1) b = np.array([[1, 2], [3, 4]]) k = np.array([[1, 2], [3, 4]]) assert_array_equal(np.kron(a, b), k) a = np.array([[1, 2], [3, 4]]) b = np.array(1) assert_array_equal(np.kron...
TestKron
python
wandb__wandb
wandb/sdk/internal/sample.py
{ "start": 29, "end": 2470 }
class ____: def __init__(self, min_samples=None): self._samples = min_samples or 64 # force power of 2 samples self._samples = 2 ** int(math.ceil(math.log(self._samples, 2))) # target oversample by factor of 2 self._samples2 = self._samples * 2 # max size of each buff...
UniformSampleAccumulator
python
getsentry__sentry
src/sentry/replays/lib/new_query/conditions.py
{ "start": 9951, "end": 10896 }
class ____(GenericArray): """String array condition class.""" @staticmethod def visit_match(expression: Expression, value: str) -> Condition: v = f"(?i){value[1:-1]}" return Condition( Function( "arrayExists", parameters=[ Lamb...
StringArray
python
pydantic__pydantic
pydantic-core/python/pydantic_core/core_schema.py
{ "start": 134071, "end": 136014 }
class ____(TypedDict, total=False): type: Required[Literal['custom-error']] schema: Required[CoreSchema] custom_error_type: Required[str] custom_error_message: str custom_error_context: dict[str, Union[str, int, float]] ref: str metadata: dict[str, Any] serialization: SerSchema def cus...
CustomErrorSchema
python
google__pytype
pytype/pytd/parse/parser_test_base.py
{ "start": 280, "end": 3698 }
class ____(test_base.UnitTest): """Test utility class. Knows how to parse PYTD and compare source code.""" loader: load_pytd.Loader @classmethod def setUpClass(cls): super().setUpClass() cls.loader = load_pytd.Loader( config.Options.create(python_version=cls.python_version)) def setUp(self)...
ParserTest
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 18945, "end": 19187 }
class ____(sgqlc.types.Enum): """ See source code for more info. """ __schema__ = graphql_schema __choices__ = ("BILLING_MANAGER", "OUTSIDE_COLLABORATOR", "UNAFFILIATED")
OrgRemoveOutsideCollaboratorAuditEntryMembershipType
python
google__pytype
pytype/tools/xref/testdata/class_def.py
{ "start": 924, "end": 968 }
class ____: pass def f(): global Quux
Quux
python
dagster-io__dagster
python_modules/dagster/dagster/_utils/schedules.py
{ "start": 997, "end": 37778 }
class ____(_croniter): """Lightweight shim to enable caching certain values that may be calculated many times.""" @classmethod @functools.lru_cache(maxsize=128) def expand(cls, *args, **kwargs): # pyright: ignore[reportIncompatibleMethodOverride] return super().expand(*args, **kwargs) def _i...
CroniterShim
python
scrapy__scrapy
tests/test_scheduler.py
{ "start": 8506, "end": 9662 }
class ____: reopen = False @property def priority_queue_cls(self) -> str: return "scrapy.pqueues.DownloaderAwarePriorityQueue" def test_logic(self): for url, slot in _URLS_WITH_SLOTS: request = Request(url) request.meta[Downloader.DOWNLOAD_SLOT] = slot ...
DownloaderAwareSchedulerTestMixin
python
pymupdf__PyMuPDF
src/table.py
{ "start": 11532, "end": 12729 }
class ____(float): pass NON_NEGATIVE_SETTINGS = [ "snap_tolerance", "snap_x_tolerance", "snap_y_tolerance", "join_tolerance", "join_x_tolerance", "join_y_tolerance", "edge_min_length", "min_words_vertical", "min_words_horizontal", "intersection_tolerance", "intersection...
UnsetFloat
python
davidhalter__jedi
jedi/inference/base_value.py
{ "start": 5515, "end": 10860 }
class ____(HelperValueMixin): """ To be implemented by subclasses. """ tree_node = None # Possible values: None, tuple, list, dict and set. Here to deal with these # very important containers. array_type = None api_type = 'not_defined_please_report_bug' def __init__(self, inference_...
Value
python
encode__httpx
httpx/_status_codes.py
{ "start": 84, "end": 5639 }
class ____(IntEnum): """HTTP status codes and reason phrases Status codes from the following RFCs are all observed: * RFC 7231: Hypertext Transfer Protocol (HTTP/1.1), obsoletes 2616 * RFC 6585: Additional HTTP Status Codes * RFC 3229: Delta encoding in HTTP * RFC 4918: HTTP Ex...
codes
python
encode__httpx
httpx/_transports/wsgi.py
{ "start": 617, "end": 1032 }
class ____(SyncByteStream): def __init__(self, result: typing.Iterable[bytes]) -> None: self._close = getattr(result, "close", None) self._result = _skip_leading_empty_chunks(result) def __iter__(self) -> typing.Iterator[bytes]: for part in self._result: yield part def ...
WSGIByteStream
python
sympy__sympy
sympy/physics/quantum/tests/test_operator.py
{ "start": 1147, "end": 8417 }
class ____(HermitianOperator): @classmethod def default_args(self): return ("T",) t_ket = CustomKet() t_op = CustomOp() def test_operator(): A = Operator('A') B = Operator('B') C = Operator('C') assert isinstance(A, Operator) assert isinstance(A, QExpr) assert A.label == (Sy...
CustomOp
python
jazzband__django-model-utils
model_utils/tracker.py
{ "start": 4403, "end": 4653 }
class ____(DescriptorWrapper[T]): """ Wrapper for descriptors with all three descriptor methods. """ def __delete__(self, obj: models.Model) -> None: cast(FullDescriptor[T], self.descriptor).__delete__(obj)
FullDescriptorWrapper
python
sympy__sympy
sympy/core/basic.py
{ "start": 73251, "end": 76719 }
class ____(Basic): """ A parent class for atomic things. An atom is an expression with no subexpressions. Examples ======== Symbol, Number, Rational, Integer, ... But not: Add, Mul, Pow, ... """ is_Atom = True __slots__ = () def matches(self, expr, repl_dict=None, old=False)...
Atom
python
FactoryBoy__factory_boy
tests/test_utils.py
{ "start": 616, "end": 1846 }
class ____(unittest.TestCase): def test_nothing(self): txt = str(utils.log_pprint()) self.assertEqual('', txt) def test_only_args(self): txt = str(utils.log_pprint((1, 2, 3))) self.assertEqual('1, 2, 3', txt) def test_only_kwargs(self): txt = str(utils.log_pprint(kw...
LogPPrintTestCase
python
python-attrs__attrs
tests/test_validators.py
{ "start": 29124, "end": 30178 }
class ____: """ Tests for `_subclass_of`. """ def test_success(self): """ Nothing happens if classes match. """ v = _subclass_of(int) v(None, simple_attr("test"), int) def test_subclass(self): """ Subclasses are accepted too. """ ...
TestSubclassOf
python
pypa__pip
src/pip/_vendor/urllib3/connectionpool.py
{ "start": 1689, "end": 2909 }
class ____(object): """ Base class for all connection pools, such as :class:`.HTTPConnectionPool` and :class:`.HTTPSConnectionPool`. .. note:: ConnectionPool.urlopen() does not normalize or percent-encode target URIs which is useful if your target server doesn't support percent-encoded ...
ConnectionPool
python
google__pytype
pytype/overlays/classgen.py
{ "start": 6353, "end": 11217 }
class ____(abstract.PyTDFunction): """Implements constructors for fields.""" def get_kwarg(self, args, name, default): if name not in args.namedargs: return default try: return abstract_utils.get_atomic_python_constant(args.namedargs[name]) except abstract_utils.ConversionError: self....
FieldConstructor
python
getsentry__sentry
src/sentry/api/endpoints/artifact_lookup.py
{ "start": 11046, "end": 11863 }
class ____: def __init__(self, request: Request, project: Project): if is_system_auth(request.auth): self.base_url = get_internal_artifact_lookup_source_url(project) else: self.base_url = request.build_absolute_uri(request.path) def url_for_file_id(self, download_id: str...
UrlConstructor
python
openai__openai-python
src/openai/resources/conversations/conversations.py
{ "start": 16992, "end": 17747 }
class ____: def __init__(self, conversations: AsyncConversations) -> None: self._conversations = conversations self.create = _legacy_response.async_to_raw_response_wrapper( conversations.create, ) self.retrieve = _legacy_response.async_to_raw_response_wrapper( ...
AsyncConversationsWithRawResponse
python
kamyu104__LeetCode-Solutions
Python/reformat-the-string.py
{ "start": 50, "end": 925 }
class ____(object): def reformat(self, s): """ :type s: str :rtype: str """ def char_gen(start, end, count): for c in xrange(ord(start), ord(end)+1): c = chr(c) for i in xrange(count[c]): yield c yiel...
Solution
python
django__django
tests/admin_inlines/models.py
{ "start": 5991, "end": 6118 }
class ____(models.Model): name = models.CharField(max_length=40) novel = models.ForeignKey(Novel, models.CASCADE)
Chapter
python
walkccc__LeetCode
solutions/2798. Number of Employees Who Met the Target/2798.py
{ "start": 0, "end": 146 }
class ____: def numberOfEmployeesWhoMetTarget(self, hours: list[int], target: int) -> int: return sum(hour >= target for hour in hours)
Solution
python
altair-viz__altair
altair/vegalite/v6/schema/core.py
{ "start": 1595079, "end": 1596904 }
class ____(VegaLiteSchema): """ WindowFieldDef schema wrapper. Parameters ---------- op : :class:`AggregateOp`, :class:`WindowOnlyOp`, Literal['argmax', 'argmin', 'average', 'count', 'distinct', 'max', 'mean', 'median', 'min', 'missing', 'product', 'q1', 'q3', 'ci0', 'ci1', 'stderr', 'stdev', 'stde...
WindowFieldDef
python
EpistasisLab__tpot
tpot/builtin_modules/arithmetictransformer.py
{ "start": 9435, "end": 10121 }
class ____(TransformerMixin, BaseEstimator): def __init__(self): """ A transformer that takes checks if all elements in a row are greater than or equal to 0. """ pass def fit(self, X, y=None): return self def transform(self, X): transformed_X = np.array(sel...
GETransformer
python
getsentry__sentry
tests/sentry/api/endpoints/test_chunk_upload.py
{ "start": 885, "end": 17808 }
class ____(APITestCase): @pytest.fixture(autouse=True) def _restore_upload_url_options(self): options.delete("system.upload-url-prefix") def setUp(self) -> None: self.organization = self.create_organization(owner=self.user) with assume_test_silo_mode(SiloMode.CONTROL): s...
ChunkUploadTest
python
keras-team__keras
keras/src/ops/numpy.py
{ "start": 147712, "end": 149158 }
class ____(Operation): def __init__(self, axis=None, keepdims=False, *, name=None): super().__init__(name=name) if isinstance(axis, int): axis = [axis] self.axis = axis self.keepdims = keepdims def call(self, x): return backend.numpy.median(x, axis=self.axis,...
Median
python
getsentry__sentry
src/sentry/api/serializers/models/discoversavedquery.py
{ "start": 1018, "end": 1330 }
class ____(DiscoverSavedQueryResponseOptional): id: str name: str projects: list[int] version: int queryDataset: str datasetSource: str expired: bool dateCreated: str dateUpdated: str createdBy: UserSerializerResponse @register(DiscoverSavedQuery)
DiscoverSavedQueryResponse
python
python__mypy
mypy/test/testformatter.py
{ "start": 127, "end": 2639 }
class ____(TestCase): def test_trim_source(self) -> None: assert trim_source_line("0123456789abcdef", max_len=16, col=5, min_width=2) == ( "0123456789abcdef", 0, ) # Locations near start. assert trim_source_line("0123456789abcdef", max_len=7, col=0, min_width...
FancyErrorFormattingTestCases
python
getsentry__sentry
src/sentry/replays/usecases/ingest/event_logger.py
{ "start": 1406, "end": 1582 }
class ____(TypedDict): environment: str clicks: list[ReplayActionsEventPayloadClick] replay_id: str type: Literal["replay_actions"]
ReplayActionsEventClickPayload
python
scipy__scipy
scipy/stats/_continuous_distns.py
{ "start": 19076, "end": 28886 }
class ____(rv_continuous): r"""A beta continuous random variable. %(before_notes)s Notes ----- The probability density function for `beta` is: .. math:: f(x, a, b) = \frac{\Gamma(a+b) x^{a-1} (1-x)^{b-1}} {\Gamma(a) \Gamma(b)} for :math:`0 <= x <= 1`, :...
beta_gen
python
great-expectations__great_expectations
great_expectations/expectations/metrics/query_metrics/query_column.py
{ "start": 641, "end": 2995 }
class ____(QueryMetricProvider): metric_name = "query.column" value_keys = ( "column", "query", ) @metric_value(engine=SqlAlchemyExecutionEngine) def _sqlalchemy( cls, execution_engine: SqlAlchemyExecutionEngine, metric_domain_kwargs: dict, metric_val...
QueryColumn
python
huggingface__transformers
src/transformers/utils/dummy_detectron2_objects.py
{ "start": 116, "end": 340 }
class ____: def __init__(self, *args, **kwargs): requires_backends(self, ["detectron2"]) @classmethod def from_pretrained(cls, *args, **kwargs): requires_backends(cls, ["detectron2"])
LayoutLMv2Model
python
ethereum__web3.py
tests/integration/go_ethereum/test_goethereum_http.py
{ "start": 5011, "end": 5096 }
class ____(GoEthereumAsyncDebugModuleTest): pass
TestGoEthereumAsyncDebugModuleTest
python
xlwings__xlwings
xlwings/pro/_xlcalamine.py
{ "start": 2199, "end": 2578 }
class ____(base_classes.Apps): def __init__(self): self._apps = [App(self)] def __iter__(self): return iter(self._apps) def __len__(self): return len(self._apps) def __getitem__(self, index): return self._apps[index] def add(self, **kwargs): self._apps.ins...
Apps
python
pallets__jinja
src/jinja2/nodes.py
{ "start": 31123, "end": 31659 }
class ____(Expr): """Mark the wrapped expression as safe (wrap it as `Markup`) but only if autoescaping is active. .. versionadded:: 2.5 """ fields = ("expr",) expr: Expr def as_const(self, eval_ctx: EvalContext | None = None) -> Markup | t.Any: eval_ctx = get_eval_context(self, e...
MarkSafeIfAutoescape
python
gevent__gevent
src/gevent/tests/test__util.py
{ "start": 397, "end": 580 }
class ____(local.local): # pylint:disable=disallowed-name def __init__(self, foo): self.foo = foo @greentest.skipOnPyPy("5.10.x is *very* slow formatting stacks")
MyLocal
python
coleifer__peewee
tests/schema.py
{ "start": 31759, "end": 31910 }
class ____(TestModel): key = CharField() val = IntegerField() class Meta: primary_key = False table_name = 'tmkv_new'
TMKVNew
python
streamlit__streamlit
lib/streamlit/components/v2/component_registry.py
{ "start": 10657, "end": 17059 }
class ____: """Registry for bidirectional components V2. The registry stores and updates :class:`BidiComponentDefinition` instances in a thread-safe mapping guarded by a lock. """ def __init__(self) -> None: """Initialize the component registry with an empty, thread-safe store.""" ...
BidiComponentRegistry
python
pytransitions__transitions
transitions/extensions/asyncio.py
{ "start": 36223, "end": 36544 }
class ____(dict): def __init__(self, item): super().__init__() self._value = item def __setitem__(self, key, item): self._value = item def __getitem__(self, key): return self._value def __repr__(self): return repr("{{'*': {0}}}".format(self._value))
_DictionaryMock
python
django__django
tests/auth_tests/test_models.py
{ "start": 24105, "end": 24351 }
class ____(TestCase): def test_str(self): p = Permission.objects.get(codename="view_customemailfield") self.assertEqual( str(p), "Auth_Tests | custom email field | Can view custom email field" )
PermissionTests
python
kamyu104__LeetCode-Solutions
Python/number-of-people-that-can-be-seen-in-a-grid.py
{ "start": 1025, "end": 2065 }
class ____(object): def seePeople(self, heights): """ :type heights: List[List[int]] :rtype: List[List[int]] """ def count(heights, i, stk): cnt = 0 while stk and heights(stk[-1]) < heights(i): stk.pop() cnt += 1 ...
Solution2
python
django__django
tests/admin_views/models.py
{ "start": 10919, "end": 11114 }
class ____(models.Model): code = models.CharField(max_length=10, primary_key=True) owner = models.ForeignKey(Collector, models.CASCADE) name = models.CharField(max_length=100)
DooHickey
python
PyCQA__pylint
pylint/config/exceptions.py
{ "start": 438, "end": 713 }
class ____(Exception): """Raised if an ArgumentManager instance tries to parse an option that is unknown. """ def __init__(self, options: list[str], *args: object) -> None: self.options = options super().__init__(*args)
_UnrecognizedOptionError
python
gevent__gevent
src/greentest/3.10/test_asyncore.py
{ "start": 14973, "end": 25347 }
class ____: def tearDown(self): asyncore.close_all(ignore_all=True) def loop_waiting_for_flag(self, instance, timeout=5): timeout = float(timeout) / 100 count = 100 while asyncore.socket_map and count > 0: asyncore.loop(timeout=0.01, count=1, use_poll=self.use_poll)...
BaseTestAPI
python
getsentry__sentry
src/sentry/issue_detection/detectors/mn_plus_one_db_span_detector.py
{ "start": 9861, "end": 11375 }
class ____(PerformanceDetector): """ Detects N+1 DB query issues where the repeated query is interspersed with other spans (which may or may not be other queries) that all repeat together (hence, MN+1). Currently does not consider parent or source spans, and only looks for a repeating pattern o...
MNPlusOneDBSpanDetector
python
PrefectHQ__prefect
src/prefect/client/schemas/filters.py
{ "start": 12301, "end": 12474 }
class ____(PrefectBaseModel): any_: Optional[List[str]] = Field( default=None, description="A list of task run state names to include" )
TaskRunFilterStateName
python
ansible__ansible
test/lib/ansible_test/_internal/commands/coverage/__init__.py
{ "start": 12988, "end": 14440 }
class ____: """Checks code coverage paths to verify they are valid and reports on the findings.""" def __init__(self, args: CoverageConfig, collection_search_re: t.Optional[t.Pattern] = None) -> None: self.args = args self.collection_search_re = collection_search_re self.invalid_paths: ...
PathChecker
python
kamyu104__LeetCode-Solutions
Python/xor-after-range-multiplication-queries-ii.py
{ "start": 144, "end": 1131 }
class ____(object): def xorAfterQueries(self, nums, queries): """ :type nums: List[int] :type queries: List[List[int]] :rtype: int """ MOD = 10**9+7 def inv(x): return pow(x, MOD-2, MOD) block_size = int(len(nums)**0.5)+1 diffs = c...
Solution
python
astropy__astropy
astropy/units/tests/test_quantity_non_ufuncs.py
{ "start": 7068, "end": 8444 }
class ____(BasicTestSetup): def test_take_along_axis(self): indices = np.expand_dims(np.argmax(self.q, axis=0), axis=0) out = np.take_along_axis(self.q, indices, axis=0) expected = np.take_along_axis(self.q.value, indices, axis=0) * self.q.unit assert np.all(out == expected) def...
TestAlongAxis
python
HypothesisWorks__hypothesis
hypothesis-python/tests/cover/test_lookup.py
{ "start": 17226, "end": 17933 }
class ____(typing.NamedTuple): a: str @given(st.builds(AnnotatedNamedTuple)) def test_infers_args_for_namedtuple_builds(thing): assert isinstance(thing.a, str) @given(st.from_type(AnnotatedNamedTuple)) def test_infers_args_for_namedtuple_from_type(thing): assert isinstance(thing.a, str) @given(st.buil...
AnnotatedNamedTuple
python
huggingface__transformers
src/transformers/models/mra/modeling_mra.py
{ "start": 50438, "end": 53606 }
class ____(MraPreTrainedModel): def __init__(self, config): super().__init__(config) config.num_labels = 2 self.num_labels = config.num_labels self.mra = MraModel(config) self.qa_outputs = nn.Linear(config.hidden_size, config.num_labels) # Initialize weights and ap...
MraForQuestionAnswering
python
pandas-dev__pandas
pandas/tests/series/methods/test_astype.py
{ "start": 17550, "end": 18963 }
class ____: @pytest.mark.parametrize( "data, dtype", [ ([True, NA], "boolean"), (["A", NA], "category"), (["2020-10-10", "2020-10-10"], "datetime64[ns]"), (["2020-10-10", "2020-10-10", NaT], "datetime64[ns]"), ( ["2012-01-01...
TestAstypeString
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/vertex_ai/experiment_service.py
{ "start": 15654, "end": 18311 }
class ____(GoogleCloudBaseOperator): """ Use the Vertex AI SDK to delete experiment run. :param project_id: Required. The ID of the Google Cloud project that the service belongs to. :param location: Required. The ID of the Google Cloud location that the service belongs to. :param experiment_name: R...
DeleteExperimentRunOperator
python
kamyu104__LeetCode-Solutions
Python/water-bottles-ii.py
{ "start": 48, "end": 443 }
class ____(object): def maxBottlesDrunk(self, numBottles, numExchange): """ :type numBottles: int :type numExchange: int :rtype: int """ result = numBottles while numBottles >= numExchange: numBottles -= numExchange numExchange += 1 ...
Solution
python
huggingface__transformers
tests/models/smollm3/test_modeling_smollm3.py
{ "start": 1634, "end": 2048 }
class ____(CausalLMModelTester): config_class = SmolLM3Config if is_torch_available(): base_model_class = SmolLM3Model causal_lm_class = SmolLM3ForCausalLM question_answering_class = SmolLM3ForQuestionAnswering sequence_classification_class = SmolLM3ForSequenceClassification ...
SmolLM3ModelTester
python
sqlalchemy__sqlalchemy
test/ext/test_associationproxy.py
{ "start": 93090, "end": 93288 }
class ____( ScalarRemoveTest, fixtures.DeclarativeMappedTest ): run_create_tables = None useobject = True cascade_scalar_deletes = True uselist = True
ScalarRemoveListObjectCascade
python
pypa__warehouse
warehouse/legacy/api/xmlrpc/cache/services.py
{ "start": 636, "end": 1877 }
class ____: def __init__( self, redis_url, purger, redis_db=0, name="lru", expires=None, metric_reporter=None, ): self.redis_conn = redis.StrictRedis.from_url(redis_url, db=redis_db) self.redis_lru = cache.RedisLru( self.redis_c...
RedisXMLRPCCache
python
numpy__numpy
numpy/_core/_exceptions.py
{ "start": 786, "end": 945 }
class ____(TypeError): """ Base class for all ufunc exceptions """ def __init__(self, ufunc): self.ufunc = ufunc @_display_as_base
UFuncTypeError
python
matplotlib__matplotlib
lib/matplotlib/_mathtext.py
{ "start": 62570, "end": 64579 }
class ____: """ Parser state. States are pushed and popped from a stack as necessary, and the "current" state is always at the top of the stack. Upon entering and leaving a group { } or math/non-math, the stack is pushed and popped accordingly. """ def __init__(self, fontset: Fonts, f...
ParserState
python
apache__airflow
airflow-core/src/airflow/utils/state.py
{ "start": 847, "end": 1256 }
class ____(str, Enum): """States that a Task Instance can be in that indicate it has reached a terminal state.""" SUCCESS = "success" FAILED = "failed" SKIPPED = "skipped" # A user can raise a AirflowSkipException from a task & it will be marked as skipped UPSTREAM_FAILED = "upstream_failed" R...
TerminalTIState
python
kamyu104__LeetCode-Solutions
Python/optimal-account-balancing.py
{ "start": 86, "end": 997 }
class ____(object): def minTransfers(self, transactions): """ :type transactions: List[List[int]] :rtype: int """ accounts = collections.defaultdict(int) for src, dst, amount in transactions: accounts[src] += amount accounts[dst] -= amount ...
Solution
python
django__django
tests/staticfiles_tests/test_templatetags.py
{ "start": 134, "end": 1076 }
class ____(StaticFilesTestCase): def test_template_tag(self): self.assertStaticRenders("does/not/exist.png", "/static/does/not/exist.png") self.assertStaticRenders("testfile.txt", "/static/testfile.txt") self.assertStaticRenders( "special?chars&quoted.html", "/static/special%3Fch...
TestTemplateTag
python
apache__airflow
task-sdk/tests/task_sdk/api/test_client.py
{ "start": 40723, "end": 42827 }
class ____: @pytest.mark.parametrize( "request_params", [ ({"name": "this_asset"}), ({"uri": "s3://bucket/key"}), ], ) def test_by_name_get_success(self, request_params): def handle_request(request: httpx.Request) -> httpx.Response: if requ...
TestAssetOperations
python
django-crispy-forms__django-crispy-forms
crispy_forms/bootstrap.py
{ "start": 5948, "end": 8110 }
class ____(PrependedAppendedText): """ Layout object for rendering a field with prepended text. Attributes ---------- template : str The default template which this Layout Object will be rendered with. attrs : dict Attributes to be applied to the field. These are convert...
PrependedText
python
huggingface__transformers
src/transformers/models/sam2_video/modeling_sam2_video.py
{ "start": 41628, "end": 43400 }
class ____(GradientCheckpointingLayer): def __init__(self, config: Sam2VideoConfig): super().__init__() self.depthwise_conv = nn.Conv2d( config.memory_fuser_embed_dim, config.memory_fuser_embed_dim, kernel_size=config.memory_fuser_kernel_size, padding=...
Sam2VideoMemoryFuserCXBlock
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/vertex_ai/auto_ml.py
{ "start": 15407, "end": 21606 }
class ____(AutoMLTrainingJobBaseOperator): """Create Auto ML Tabular Training job.""" template_fields = ( "parent_model", "dataset_id", "region", "impersonation_chain", ) operator_extra_links = (VertexAIModelLink(), VertexAITrainingLink()) def __init__( self...
CreateAutoMLTabularTrainingJobOperator
python
astropy__astropy
astropy/io/fits/tests/test_checksum.py
{ "start": 1021, "end": 22120 }
class ____(BaseChecksumTests): # All checksums have been verified against CFITSIO def test_sample_file(self): hdul = fits.open(self.data("checksum.fits"), checksum=True) assert hdul._read_all hdul.close() def test_image_create(self): n = np.arange(100, dtype=np.int64) ...
TestChecksumFunctions
python
walkccc__LeetCode
solutions/1550. Three Consecutive Odds/1550.py
{ "start": 0, "end": 209 }
class ____: def threeConsecutiveOdds(self, arr: list[int]) -> bool: count = 0 for a in arr: count = 0 if a % 2 == 0 else count + 1 if count == 3: return True return False
Solution
python
airbytehq__airbyte
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/migrate_to_inline_schemas/pipeline.py
{ "start": 3092, "end": 4378 }
class ____(Step): context: ConnectorContext title = "Restore original state" def __init__(self, context: ConnectorContext) -> None: super().__init__(context) self.manifest_path = context.connector.manifest_path self.original_manifest = None if self.manifest_path.is_file(): ...
RestoreInlineState
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/hooks/test_ses.py
{ "start": 3038, "end": 4703 }
class ____: """The mock_aws decorator uses `moto` which does not currently support async SES so we mock it manually.""" @pytest.fixture def mock_async_client(self): return mock.AsyncMock() @pytest.fixture def mock_get_async_conn(self, mock_async_client): with mock.patch.object(SesH...
TestAsyncSesHook
python
huggingface__transformers
src/transformers/models/moshi/modeling_moshi.py
{ "start": 77469, "end": 122770 }
class ____(MoshiPreTrainedModel, GenerationMixin): config: MoshiConfig output_modalities = ("audio", "text") main_input_name = "input_ids" supports_gradient_checkpointing = True _supports_flash_attn = True _supports_sdpa = True def __init__(self, config: MoshiConfig): super().__init...
MoshiForConditionalGeneration
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 472966, "end": 473434 }
class ____(sgqlc.types.Type): """Autogenerated return type of ArchiveProjectV2Item""" __schema__ = github_schema __field_names__ = ("client_mutation_id", "item") client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId") """A unique identifier for the client performing the muta...
ArchiveProjectV2ItemPayload
python
getsentry__sentry
src/sentry/api/serializers/models/team.py
{ "start": 5686, "end": 11086 }
class ____(Serializer): expand: Sequence[str] | None collapse: Sequence[str] | None access: Access | None def __init__( self, collapse: Sequence[str] | None = None, expand: Sequence[str] | None = None, access: Access | None = None, ): self.collapse = collapse...
BaseTeamSerializer
python
PrefectHQ__prefect
src/prefect/events/clients.py
{ "start": 5372, "end": 5542 }
class ____(EventsClient): """A Prefect Events client implementation that does nothing""" async def _emit(self, event: Event) -> None: pass
NullEventsClient
python
crytic__slither
slither/slithir/operations/high_level_call.py
{ "start": 768, "end": 7178 }
class ____(Call, OperationWithLValue): """ High level message call """ # pylint: disable=too-many-arguments,too-many-instance-attributes def __init__( self, destination: SourceMapping, function_name: Constant, nbr_arguments: int, result: Optional[Union[Tempor...
HighLevelCall
python
Netflix__metaflow
metaflow/plugins/pypi/micromamba.py
{ "start": 327, "end": 773 }
class ____(MetaflowException): headline = "Micromamba ran into an error while setting up environment" def __init__(self, error): if isinstance(error, (list,)): error = "\n".join(error) msg = "{error}".format(error=error) super(MicromambaException, self).__init__(msg) GLIBC...
MicromambaException
python
pytest-dev__pytest
testing/code/test_excinfo.py
{ "start": 18060, "end": 68277 }
class ____: @pytest.fixture def importasmod(self, tmp_path: Path, _sys_snapshot): def importasmod(source): source = textwrap.dedent(source) modpath = tmp_path.joinpath("mod.py") tmp_path.joinpath("__init__.py").touch() modpath.write_text(source, encoding="...
TestFormattedExcinfo