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
apache__airflow
airflow-core/src/airflow/utils/thread_safe_dict.py
{ "start": 840, "end": 1635 }
class ____: """Dictionary that uses a lock during operations, to ensure thread safety.""" def __init__(self): self.sync_dict = {} self.thread_lock = threading.Lock() def set(self, key, value): with self.thread_lock: self.sync_dict[key] = value def get(self, key): ...
ThreadSafeDict
python
kamyu104__LeetCode-Solutions
Python/count-of-integers.py
{ "start": 70, "end": 991 }
class ____(object): def count(self, num1, num2, min_sum, max_sum): """ :type num1: str :type num2: str :type min_sum: int :type max_sum: int :rtype: int """ MOD = 10**9+7 def f(x): dp = [[0]*(max_sum+1) for _ in xrange(2)] ...
Solution
python
python-excel__xlwt
tests/test_biff_records.py
{ "start": 119, "end": 506 }
class ____(unittest.TestCase): def test_shared_string_table(self): expected_result = b'\xfc\x00\x11\x00\x01\x00\x00\x00\x01\x00\x00\x00\x03\x00\x01\x1e\x04;\x04O\x04' string_record = xlwt.BIFFRecords.SharedStringTable(encoding='cp1251') string_record.add_str('Оля') self.assertEqual(e...
TestSharedStringTable
python
Unity-Technologies__ml-agents
ml-agents-envs/mlagents_envs/exception.py
{ "start": 872, "end": 991 }
class ____(UnityException): """ Related to errors with side channels. """ pass
UnitySideChannelException
python
numba__numba
numba/cuda/tests/cudapy/test_vectorize_complex.py
{ "start": 185, "end": 548 }
class ____(CUDATestCase): def test_vectorize_complex(self): @vectorize(['complex128(complex128)'], target='cuda') def vcomp(a): return a * a + 1. A = np.arange(5, dtype=np.complex128) B = vcomp(A) self.assertTrue(np.allclose(A * A + 1., B)) if __name__ == '__ma...
TestVectorizeComplex
python
spyder-ide__spyder
spyder/api/plugins/new_api.py
{ "start": 32327, "end": 47862 }
class ____(SpyderPluginV2): """ A Spyder plugin to enhance functionality with a dockable widget. """ # ---- API: Mandatory attributes # ------------------------------------------------------------------------- # This is the main widget of the dockable plugin. # It needs to be a subclass of P...
SpyderDockablePlugin
python
pytorch__pytorch
test/dynamo/test_higher_order_ops.py
{ "start": 176446, "end": 179106 }
class ____(torch.nn.Module): def forward(self, L_x_: "f32[3, 3, 3]"): l_x_ = L_x_ _saved_tensors_hooks_disable = torch._C._autograd._saved_tensors_hooks_disable("torch.func.{grad, vjp, jacrev, hessian} don't yet support saved tensor hooks. Please open an issue with your use case."); _saved_tensors...
GraphModule
python
ray-project__ray
python/ray/util/metrics.py
{ "start": 8304, "end": 10869 }
class ____(Metric): """Tracks the size and number of events in buckets. Histograms allow you to calculate aggregate quantiles such as 25, 50, 95, 99 percentile latency for an RPC. This corresponds to Prometheus' histogram metric: https://prometheus.io/docs/concepts/metric_types/#histogram Arg...
Histogram
python
doocs__leetcode
solution/0400-0499/0435.Non-overlapping Intervals/Solution.py
{ "start": 0, "end": 303 }
class ____: def eraseOverlapIntervals(self, intervals: List[List[int]]) -> int: intervals.sort(key=lambda x: x[1]) ans = len(intervals) pre = -inf for l, r in intervals: if pre <= l: ans -= 1 pre = r return ans
Solution
python
pyodide__pyodide
src/py/_pyodide/_core_docs.py
{ "start": 40359, "end": 41497 }
class ____(JsProxy, Exception): """A JavaScript Error. These are pickleable unlike other JsProxies. """ # Note: Unlike many of these classes, this one is never actually seen by the # user IN_BROWSER (it's replaced by a different JsException in # pyodide._core). We use it to unpickle errors so ...
JsException
python
sympy__sympy
sympy/parsing/mathematica.py
{ "start": 6134, "end": 44146 }
class ____: """ An instance of this class converts a string of a Wolfram Mathematica expression to a SymPy expression. The main parser acts internally in three stages: 1. tokenizer: tokenizes the Mathematica expression and adds the missing * operators. Handled by ``_from_mathematica_to_tok...
MathematicaParser
python
PrefectHQ__prefect
tests/test_tasks.py
{ "start": 105548, "end": 113307 }
class ____: def test_with_options_allows_override_of_task_settings(self): def first_cache_key_fn(*_): return "first cache hit" def second_cache_key_fn(*_): return "second cache hit" block = LocalFileSystem(basepath="foo") block.save("foo-test", _sync=True) ...
TestTaskWithOptions
python
pytorch__pytorch
torch/_numpy/_dtypes.py
{ "start": 2513, "end": 2625 }
class ____(complexfloating): name = "complex64" typecode = "F" torch_dtype = torch.complex64
complex64
python
google__pytype
pytype/tests/test_tuple1.py
{ "start": 69, "end": 5364 }
class ____(test_base.BaseTest): """Tests for builtins.tuple.""" def test_getitem_int(self): ty = self.Infer(""" t = ("", 42) v1 = t[0] v2 = t[1] v3 = t[2] v4 = t[-1] """) self.assertTypesMatchPytd( ty, """ from typing import Tuple, Union t = ......
TupleTest
python
explosion__spaCy
spacy/cli/convert.py
{ "start": 1011, "end": 9389 }
class ____(str, Enum): json = "json" spacy = "spacy" @app.command("convert") def convert_cli( # fmt: off input_path: str = Arg(..., help="Input file or directory", exists=True), output_dir: Path = Arg("-", help="Output directory. '-' for stdout.", allow_dash=True, exists=True), file_type: File...
FileTypes
python
celery__celery
celery/backends/rpc.py
{ "start": 2533, "end": 12077 }
class ____(base.Backend, AsyncBackendMixin): """Base class for the RPC result backend.""" Exchange = kombu.Exchange Producer = kombu.Producer ResultConsumer = ResultConsumer #: Exception raised when there are too many messages for a task id. BacklogLimitExceeded = BacklogLimitExceeded per...
RPCBackend
python
pypa__pip
src/pip/_vendor/pkg_resources/__init__.py
{ "start": 63398, "end": 64048 }
class ____(NullProvider): """Provider based on a virtual filesystem""" def __init__(self, module: _ModuleLike): super().__init__(module) self._setup_prefix() def _setup_prefix(self): # Assume that metadata may be nested inside a "basket" # of multiple eggs and use module_pa...
EggProvider
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/orm/util.py
{ "start": 5886, "end": 16336 }
class ____(FrozenSet[str]): """Keeps track of the options sent to :paramref:`.relationship.cascade`""" _add_w_all_cascades = all_cascades.difference( ["all", "none", "delete-orphan"] ) _allowed_cascades = all_cascades _viewonly_cascades = ["expunge", "all", "none", "refresh-expire", "m...
CascadeOptions
python
streamlit__streamlit
lib/streamlit/runtime/state/common.py
{ "start": 3985, "end": 5527 }
class ____(Generic[T]): """Metadata associated with a single widget. Immutable.""" id: str deserializer: WidgetDeserializer[T] = field(repr=False) serializer: WidgetSerializer[T] = field(repr=False) value_type: ValueFieldName # An optional user-code callback invoked when the widget's value cha...
WidgetMetadata
python
getsentry__sentry
tests/sentry/seer/assisted_query/test_discover_tools.py
{ "start": 5002, "end": 15095 }
class ____(APITestCase, SnubaTestCase): def setUp(self): super().setUp() self.min_ago = before_now(minutes=1) def test_get_event_filter_key_values_tag_key(self): """Test getting values for a tag key""" # Create events with the same tag key but different values self.stor...
TestGetEventFilterKeyValues
python
apache__airflow
airflow-core/src/airflow/api_fastapi/common/parameters.py
{ "start": 10592, "end": 10943 }
class ____(Enum): """Filter options for FilterParam.""" EQUAL = "eq" NOT_EQUAL = "ne" LESS_THAN = "lt" LESS_THAN_EQUAL = "le" GREATER_THAN = "gt" GREATER_THAN_EQUAL = "ge" IN = "in" NOT_IN = "not_in" ANY_EQUAL = "any_eq" ALL_EQUAL = "all_eq" IS_NONE = "is_none" CONTA...
FilterOptionEnum
python
arrow-py__arrow
tests/test_locales.py
{ "start": 17586, "end": 20725 }
class ____: def test_plurals(self): assert self.locale._format_timeframe("seconds", 0) == "0 sekund" assert self.locale._format_timeframe("second", 1) == "sekundę" assert self.locale._format_timeframe("seconds", 2) == "2 sekundy" assert self.locale._format_timeframe("seconds", 5) == ...
TestPolishLocale
python
coleifer__peewee
tests/fields.py
{ "start": 41335, "end": 41529 }
class ____(TextField): def db_value(self, value): return ','.join(value) if value else '' def python_value(self, value): return value.split(',') if value else []
ListField
python
numba__numba
numba/tests/npyufunc/test_gufunc.py
{ "start": 18511, "end": 28798 }
class ____(MemoryLeakMixin, TestCase): target = 'cpu' def check_add_gufunc(self, gufunc): @jit(nopython=True) def jit_add(x, y, res): gufunc(x, y, res) x = np.arange(40, dtype='i8').reshape(4, 2, 5) y = np.int32(100) res = np.zeros_like(x) jit_add(x,...
TestGUVectorizeJit
python
mitmproxy__pdoc
test/testdata/misc.py
{ "start": 6036, "end": 6245 }
class ____: def __repr__(self): return "°<script>alert(1)</script>" def repr_not_syntax_highlightable(x=CustomRepr()): """The default value for x fails to highlight with pygments."""
CustomRepr
python
run-llama__llama_index
llama-index-integrations/protocols/llama-index-protocols-ag-ui/llama_index/protocols/ag_ui/events.py
{ "start": 809, "end": 929 }
class ____(TextMessageChunkEvent, Event): type: EventType = EventType.TEXT_MESSAGE_CHUNK
TextMessageChunkWorkflowEvent
python
apache__airflow
airflow-core/src/airflow/serialization/serialized_objects.py
{ "start": 9760, "end": 19380 }
class ____(AirflowException): def __init__(self, type_string: str) -> None: self.type_string = type_string def __str__(self) -> str: return ( f"Priority weight strategy class {self.type_string!r} is not registered or " "you have a top level database access that disrupted...
_PriorityWeightStrategyNotRegistered
python
numpy__numpy
numpy/_core/tests/test_array_coercion.py
{ "start": 6418, "end": 14957 }
class ____: def test_void_special_case(self): # Void dtypes with structures discover tuples as elements arr = np.array((1, 2, 3), dtype="i,i,i") assert arr.shape == () arr = np.array([(1, 2, 3)], dtype="i,i,i") assert arr.shape == (1,) def test_char_special_case(self): ...
TestScalarDiscovery
python
django__django
tests/apps/query_performing_app/apps.py
{ "start": 2568, "end": 2672 }
class ____(StoredProcedureQueryAppConfig): database = "other"
QueryOtherDatabaseStoredProcedureAppConfig
python
scikit-learn__scikit-learn
sklearn/manifold/_classical_mds.py
{ "start": 508, "end": 6381 }
class ____(BaseEstimator): """Classical multidimensional scaling (MDS). This is also known as principal coordinates analysis (PCoA) or Torgerson's scaling. It is a version of MDS that has exact solution in terms of eigendecomposition. If the input dissimilarity matrix consists of the pairwise Eucli...
ClassicalMDS
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/asset_condition_evaluations.py
{ "start": 7227, "end": 8529 }
class ____(graphene.ObjectType): rootUniqueId = graphene.NonNull(graphene.String) evaluationNodes = non_null_list(GrapheneAssetConditionEvaluationNode) class Meta: name = "AssetConditionEvaluation" def __init__( self, root_evaluation: AutomationConditionEvaluation, part...
GrapheneAssetConditionEvaluation
python
kamyu104__LeetCode-Solutions
Python/lonely-pixel-i.py
{ "start": 671, "end": 961 }
class ____(object): def findLonelyPixel(self, picture): """ :type picture: List[List[str]] :type N: int :rtype: int """ return sum(col.count('B') == 1 == picture[col.index('B')].count('B') \ for col in zip(*picture))
Solution2
python
PrefectHQ__prefect
src/prefect/context.py
{ "start": 8660, "end": 10614 }
class ____(ContextModel): """ A context for managing the sync Prefect client instances. Clients were formerly tracked on the TaskRunContext and FlowRunContext, but having two separate places and the addition of both sync and async clients made it difficult to manage. This context is intended to be ...
SyncClientContext
python
pandas-dev__pandas
pandas/io/pytables.py
{ "start": 13574, "end": 65692 }
class ____: """ Dict-like IO interface for storing pandas objects in PyTables. Either Fixed or Table format. .. warning:: Pandas uses PyTables for reading and writing HDF5 files, which allows serializing object-dtype data with pickle when using the "fixed" format. Loading pickled...
HDFStore
python
getsentry__sentry
src/sentry/hybridcloud/rpc/service.py
{ "start": 1310, "end": 1560 }
class ____(Exception): def __init__(self, service_name: str, method_name: str | None, message: str) -> None: name = f"{service_name}.{method_name}" if method_name else service_name super().__init__(f"{name}: {message}")
RpcException
python
urllib3__urllib3
test/with_dummyserver/test_connectionpool.py
{ "start": 44774, "end": 51691 }
class ____(HypercornDummyServerTestCase): def test_max_retry(self) -> None: with HTTPConnectionPool(self.host, self.port) as pool: with pytest.raises(MaxRetryError): pool.request("GET", "/redirect", fields={"target": "/"}, retries=0) def test_disabled_retry(self) -> None: ...
TestRetry
python
pytorch__pytorch
torch/ao/quantization/_correct_bias.py
{ "start": 1226, "end": 5415 }
class ____(ns.Logger): """Mean Logger for a Shadow module. A logger for a Shadow module whose purpose is to record the rolling mean of the data passed to the floating point and quantized models """ def __init__(self): """Set up initial values for float and quantized stats, count, float sum...
MeanShadowLogger
python
kubernetes-client__python
kubernetes/client/models/v1_node_system_info.py
{ "start": 383, "end": 15034 }
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...
V1NodeSystemInfo
python
has2k1__plotnine
plotnine/scales/scale_shape.py
{ "start": 1512, "end": 1821 }
class ____(scale_shape): """ Scale for shapes """ _aesthetics = ["shape"] def __post_init__(self, unfilled): warn( "Using shapes for an ordinal variable is not advised.", PlotnineWarning, ) super().__post_init__(unfilled)
scale_shape_ordinal
python
apache__airflow
airflow-core/src/airflow/exceptions.py
{ "start": 3701, "end": 3839 }
class ____(AirflowException): """Raise when there is a violation of a Cluster Policy in DAG definition."""
AirflowClusterPolicyViolation
python
cython__cython
tests/run/methodmangling_T5.py
{ "start": 8887, "end": 9146 }
class ____(__NameWithDunder): """ Compile check that it can find the base class >>> x = Inherits() """ pass def regular_function(__x, dummy=None): # as before, dummy stops Cython creating a 1 arg, non-keyword call return __x
Inherits
python
pypa__pipenv
pipenv/project.py
{ "start": 4095, "end": 60324 }
class ____: """docstring for Project""" _lockfile_encoder = _LockFileEncoder() def __init__(self, python_version=None, chdir=True): self._name = None self._virtualenv_location = None self._download_location = None self._proper_names_db_path = None self._pipfile_loca...
Project
python
pola-rs__polars
py-polars/src/polars/datatypes/classes.py
{ "start": 12703, "end": 12754 }
class ____(DataType): """Boolean type."""
Boolean
python
getsentry__sentry
src/sentry/search/eap/columns.py
{ "start": 8611, "end": 8797 }
class ____(ResolvedAggregate): metric_name: str | None metric_type: MetricType | None metric_unit: str | None @dataclass(frozen=True, kw_only=True)
ResolvedTraceMetricAggregate
python
facebook__pyre-check
client/commands/report.py
{ "start": 2462, "end": 5976 }
class ____(json_mixins.SnakeCaseAndExcludeJsonMixin): path: str mode: coverage_data.ModuleModeInfo suppressions: Sequence[coverage_data.TypeErrorSuppression] functions: Sequence[coverage_data.FunctionAnnotationInfo] empty_containers: Sequence[coverage_data.EmptyContainerInfo] @staticmethod ...
ModuleData
python
huggingface__transformers
src/transformers/models/wav2vec2_conformer/modeling_wav2vec2_conformer.py
{ "start": 17754, "end": 24885 }
class ____(nn.Module): """Construct an Wav2Vec2ConformerSelfAttention object. Can be enhanced with rotary or relative position embeddings. """ def __init__(self, config): super().__init__() self.head_size = config.hidden_size // config.num_attention_heads self.num_heads = confi...
Wav2Vec2ConformerSelfAttention
python
ray-project__ray
python/ray/train/tests/test_tensorflow_checkpoint.py
{ "start": 1173, "end": 4614 }
class ____(unittest.TestCase): def setUp(self): self.model = get_model() self.preprocessor = DummyPreprocessor(1) def test_from_model(self): checkpoint = TensorflowCheckpoint.from_model( self.model, preprocessor=DummyPreprocessor(1) ) loaded_model = checkpoin...
TestFromModel
python
scikit-learn__scikit-learn
sklearn/preprocessing/_data.py
{ "start": 80862, "end": 88255 }
class ____(ClassNamePrefixFeaturesOutMixin, TransformerMixin, BaseEstimator): r"""Center an arbitrary kernel matrix :math:`K`. Let define a kernel :math:`K` such that: .. math:: K(X, Y) = \phi(X) . \phi(Y)^{T} :math:`\phi(X)` is a function mapping of rows of :math:`X` to a Hilbert space a...
KernelCenterer
python
great-expectations__great_expectations
great_expectations/data_context/cloud_constants.py
{ "start": 500, "end": 946 }
class ____(str, Enum): ACCOUNTS_ME = "accounts/me" CHECKPOINT = "checkpoint" DATASOURCE = "datasource" DATA_ASSET = "data_asset" DATA_CONTEXT = "data_context_configuration" DATA_CONTEXT_VARIABLES = "data_context_variables" EXPECTATION_SUITE = "expectation_suite" RENDERED_DATA_DOC = "rend...
GXCloudRESTResource
python
dagster-io__dagster
python_modules/libraries/dagster-dbt/dagster_dbt/errors.py
{ "start": 305, "end": 505 }
class ____(DagsterDbtError, DagsterInvariantViolationError): """Represents an error when a dbt Cloud job is not supported by the ``dagster-dbt`` library."""
DagsterDbtCloudJobInvariantViolationError
python
h5py__h5py
h5py/tests/test_dataset.py
{ "start": 1907, "end": 4648 }
class ____(BaseDataset): """ Feature: Datasets can be created from a shape only """ def test_create_scalar(self): """ Create a scalar dataset """ dset = self.f.create_dataset(make_name(), ()) self.assertEqual(dset.shape, ()) def test_create_simple(self): """ Cr...
TestCreateShape
python
donnemartin__interactive-coding-challenges
online_judges/longest_abs_file_path/test_length_longest_path.py
{ "start": 18, "end": 644 }
class ____(unittest.TestCase): def test_length_longest_path(self): solution = Solution() self.assertRaises(TypeError, solution.length_longest_path, None) self.assertEqual(solution.length_longest_path(''), 0) file_system = 'dir\n\tsubdir1\n\t\tfile1.ext\n\t\tsubsubdir1\n\tsubdir2\n\t...
TestSolution
python
allegroai__clearml
clearml/backend_api/services/v2_13/workers.py
{ "start": 58049, "end": 60197 }
class ____(Response): """ Response of workers.get_metric_keys endpoint. :param categories: List of unique metric categories found in the statistics of the requested workers. :type categories: Sequence[MetricsCategory] """ _service = "workers" _action = "get_metric_keys" _versio...
GetMetricKeysResponse
python
kamyu104__LeetCode-Solutions
Python/number-of-unique-flavors-after-sharing-k-candies.py
{ "start": 50, "end": 565 }
class ____(object): def shareCandies(self, candies, k): """ :type candies: List[int] :type k: int :rtype: int """ cnt = collections.Counter(candies[i] for i in xrange(k, len(candies))) result = curr = len(cnt) for i in xrange(k, len(candies)): ...
Solution
python
ray-project__ray
python/ray/autoscaler/_private/cluster_dump.py
{ "start": 1359, "end": 1797 }
class ____: """Node (as in "machine")""" def __init__( self, host: str, ssh_user: str = "ubuntu", ssh_key: str = "~/ray_bootstrap_key.pem", docker_container: Optional[str] = None, is_head: bool = False, ): self.host = host self.ssh_user = ssh_...
Node
python
doocs__leetcode
solution/2000-2099/2002.Maximum Product of the Length of Two Palindromic Subsequences/Solution.py
{ "start": 0, "end": 855 }
class ____: def maxProduct(self, s: str) -> int: n = len(s) p = [True] * (1 << n) for k in range(1, 1 << n): i, j = 0, n - 1 while i < j: while i < j and (k >> i & 1) == 0: i += 1 while i < j and (k >> j & 1) == 0: ...
Solution
python
jazzband__django-waffle
waffle/tests/test_testutils.py
{ "start": 3570, "end": 3806 }
class ____(OverrideSwitchMixin, TransactionTestCase): """ Run tests with Django TransactionTestCase """ def req(): r = RequestFactory().get('/') r.user = AnonymousUser() return r
OverrideSwitchTransactionTestCase
python
Pylons__pyramid
tests/test_scripts/test_ptweens.py
{ "start": 1834, "end": 2092 }
class ____(unittest.TestCase): def _callFUT(self, argv): from pyramid.scripts.ptweens import main return main(argv, quiet=True) def test_it(self): result = self._callFUT(['ptweens']) self.assertEqual(result, 2)
Test_main
python
google__pytype
pytype/pyc/opcodes.py
{ "start": 6959, "end": 7463 }
class ____(Opcode): # Even though dis documentation says that END_ASYNC_FOR may reraise an # exception, we do not include NO_NEXT in the flags because doing so would # cause the return statement for an async method to be skipped, leading to # an incorrect return type. # See tests/test_stdlib2:StdlibTestsFeatu...
END_ASYNC_FOR
python
django__django
tests/admin_inlines/admin.py
{ "start": 5831, "end": 6020 }
class ____(admin.TabularInline): model = FootNote form = FootNoteForm def has_change_permission(self, request, obj=None): return False
FootNoteNonEditableInlineCustomForm
python
spyder-ide__spyder
spyder/api/preferences.py
{ "start": 1961, "end": 6406 }
class ____(SpyderConfigPage): """ Widget to expose the options a plugin offers for configuration as an entry in Spyder's Preferences dialog. """ # TODO: Temporal attribute to handle which appy_settings method to use # the one of the conf page or the one in the plugin, while the config # dia...
PluginConfigPage
python
geekcomputers__Python
CliYoutubeDownloader/CliYoutubeDownloader.py
{ "start": 41, "end": 2527 }
class ____: def __init__(self): self.url = str(input("Enter the URL of video : ")) self.youtube = pytube.YouTube( self.url, on_progress_callback=YouTubeDownloder.onProgress ) self.showTitle() def showTitle(self): print("title : {0}\n".format(self.youtube.titl...
YouTubeDownloder
python
readthedocs__readthedocs.org
readthedocs/organizations/tests/test_filters.py
{ "start": 10974, "end": 14133 }
class ____(OrganizationFilterTestCase): def get_filterset_for_user(self, user, organization, data=None, **kwargs): self.client.force_login(user) url = reverse("organization_team_list", kwargs={"slug": organization.slug}) resp = self.client.get(url, data=data) return resp.context_data...
TestOrganizationTeamListFilterSet
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/coercions.py
{ "start": 36105, "end": 36738 }
class ____(_SelectIsNotFrom, _NoTextCoercion, RoleImpl): __slots__ = () def _implicit_coercions( self, element: Any, resolved: Any, argname: Optional[str] = None, *, explicit_subquery: bool = False, **kw: Any, ) -> Any: if resolved._is_select_...
FromClauseImpl
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/hooks/test_mwaa.py
{ "start": 1163, "end": 12629 }
class ____: @pytest.fixture def mock_conn(self): with mock.patch.object(MwaaHook, "conn") as m: yield m def setup_method(self): self.hook = MwaaHook() def test_init(self): assert self.hook.client_type == "mwaa" @mock_aws def test_get_conn(self): ass...
TestMwaaHook
python
huggingface__transformers
src/transformers/models/blip_2/modeling_blip_2.py
{ "start": 25802, "end": 26466 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.intermediate_size) if isinstance(config.hidden_act, str): self.intermediate_act_fn = ACT2FN[config.hidden_act] else: self.intermediate_act_f...
Blip2QFormerIntermediate
python
numba__numba
numba/core/typed_passes.py
{ "start": 10611, "end": 12867 }
class ____(FunctionPass): _name = "parfor_pass" def __init__(self): FunctionPass.__init__(self) def run_pass(self, state): """ Convert data-parallel computations into Parfor nodes """ # Ensure we have an IR and type information. assert state.func_ir ...
ParforPass
python
pytorch__pytorch
torch/_dynamo/types.py
{ "start": 1402, "end": 1624 }
class ____(NamedTuple): # A string repr of the piece of failed guard code we eval-ed reason: str # A code object where we failed a guard orig_code: types.CodeType @dataclasses.dataclass(frozen=True)
GuardFail
python
google__flatbuffers
tests/namespace_test/NamespaceA/NamespaceB/StructInNestedNS.py
{ "start": 181, "end": 908 }
class ____(object): __slots__ = ['_tab'] @classmethod def SizeOf(cls): return 8 # StructInNestedNS def Init(self, buf, pos): self._tab = flatbuffers.table.Table(buf, pos) # StructInNestedNS def A(self): return self._tab.Get( flatbuffers.number_types.Int32Flags, self._tab.Pos...
StructInNestedNS
python
numpy__numpy
numpy/_core/tests/test_umath.py
{ "start": 43539, "end": 43918 }
class ____: def test_cbrt_scalar(self): assert_almost_equal((np.cbrt(np.float32(-2.5)**3)), -2.5) def test_cbrt(self): x = np.array([1., 2., -3., np.inf, -np.inf]) assert_almost_equal(np.cbrt(x**3), x) assert_(np.isnan(np.cbrt(np.nan))) assert_equal(np.cbrt(np.inf), np....
TestCbrt
python
sympy__sympy
sympy/polys/domains/gmpyintegerring.py
{ "start": 418, "end": 3037 }
class ____(IntegerRing): """Integer ring based on GMPY's ``mpz`` type. This will be the implementation of :ref:`ZZ` if ``gmpy`` or ``gmpy2`` is installed. Elements will be of type ``gmpy.mpz``. """ dtype = GMPYInteger zero = dtype(0) one = dtype(1) tp = type(one) alias = 'ZZ_gmpy' ...
GMPYIntegerRing
python
cherrypy__cherrypy
cherrypy/lib/httputil.py
{ "start": 17505, "end": 18160 }
class ____(object): """An internet address. name Should be the client's host name. If not available (because no DNS lookup is performed), the IP address should be used instead. """ ip = '0.0.0.0' port = 80 name = 'unknown.tld' def __init__(self, ip, port, name=None): ...
Host
python
pytorch__pytorch
test/dynamo/test_subclasses.py
{ "start": 103278, "end": 104367 }
class ____(torch.nn.Module): def forward(self, primals_5: "Sym(3)", primals_6: "Sym(4)", tangents_1: "f32[12]", tangents_2: "f32[12]"): view_2: "f32[3, 4]" = torch.ops.aten.view.default(tangents_1, [primals_5, primals_6]); tangents_1 = None view_3: "f32[3, 4]" = torch.ops.aten.view.default(tangents...
GraphModule
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/ruff/RUF053.py
{ "start": 1717, "end": 1799 }
class ____[T, _C: (str, bytes)](Generic[_D]): ... # TODO: Type parameter defaults
C
python
pypa__pipenv
pipenv/patched/pip/_vendor/rich/styled.py
{ "start": 225, "end": 1288 }
class ____: """Apply a style to a renderable. Args: renderable (RenderableType): Any renderable. style (StyleType): A style to apply across the entire renderable. """ def __init__(self, renderable: "RenderableType", style: "StyleType") -> None: self.renderable = renderable ...
Styled
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typeVarDefault3.py
{ "start": 525, "end": 752 }
class ____(dict[T2, T1], Generic[T1, T2]): ... # This should generate an error because T1 is after T2. def funcA(a: T2, b: T1) -> T1 | T2: ... # This should generate an error because T1 is after T2. TA_A = dict[T2, T1]
ClassC
python
sqlalchemy__sqlalchemy
test/orm/test_dynamic.py
{ "start": 67848, "end": 67924 }
class ____(_WriteOnlyFixture, DynamicHistoryTest): pass
WriteOnlyHistoryTest
python
getsentry__sentry
src/sentry/relocation/api/endpoints/recover.py
{ "start": 1245, "end": 5462 }
class ____(Endpoint): owner = ApiOwner.HYBRID_CLOUD publish_status = { # TODO(getsentry/team-ospo#214): Stabilize before GA. "PUT": ApiPublishStatus.EXPERIMENTAL, } permission_classes = (SuperuserOrStaffFeatureFlaggedPermission,) def _recover(self, request: Request, relocation: Relo...
RelocationRecoverEndpoint
python
pytorch__pytorch
tools/test/test_codegen.py
{ "start": 17699, "end": 20145 }
class ____(unittest.TestCase): def setUp(self) -> None: self.backend_indices: dict[DispatchKey, dict[OperatorName, BackendMetadata]] = ( defaultdict(dict) ) yaml_entry = """ - func: op.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!) dispatch: CompositeExplicitAutograd: op...
TestStaticDispatchGeneratrion
python
django__django
tests/syndication_tests/feeds.py
{ "start": 3144, "end": 3260 }
class ____(TestRss2Feed): feed_type = feedgenerator.Atom1Feed subtitle = TestRss2Feed.description
TestAtomFeed
python
apache__airflow
providers/microsoft/azure/tests/unit/microsoft/azure/triggers/test_wasb.py
{ "start": 5230, "end": 9002 }
class ____: TRIGGER = WasbPrefixSensorTrigger( container_name=TEST_DATA_STORAGE_CONTAINER_NAME, prefix=TEST_DATA_STORAGE_BLOB_PREFIX, wasb_conn_id=TEST_WASB_CONN_ID, poke_interval=POKE_INTERVAL, check_options={"delimiter": "/", "include": None}, ) def test_serializat...
TestWasbPrefixSensorTrigger
python
streamlit__streamlit
lib/streamlit/testing/v1/element_tree.py
{ "start": 19633, "end": 19820 }
class ____(Markdown): def __init__(self, proto: MarkdownProto, root: ElementTree) -> None: super().__init__(proto, root) self.type = "latex" @dataclass(repr=False)
Latex
python
dagster-io__dagster
python_modules/libraries/dagster-dg-cli/dagster_dg_cli/api_layer/schemas/agent.py
{ "start": 841, "end": 954 }
class ____(BaseModel): """GET /api/agents response.""" items: list[DgApiAgent] total: int
DgApiAgentList
python
ansible__ansible
test/integration/targets/ansible-doc/collections/ansible_collections/testns/testcol/plugins/filter/filter_subdir/in_subdir.py
{ "start": 356, "end": 537 }
class ____(object): """ Ansible core jinja2 filters """ def filters(self): return { 'noop': nochange, 'nested': nochange, }
FilterModule
python
doocs__leetcode
solution/2700-2799/2764.Is Array a Preorder of Some ‌Binary Tree/Solution.py
{ "start": 0, "end": 406 }
class ____: def isPreorder(self, nodes: List[List[int]]) -> bool: def dfs(i: int) -> int: nonlocal k if i != nodes[k][0]: return False k += 1 return all(dfs(j) for j in g[i]) g = defaultdict(list) for i, p in nodes: ...
Solution
python
getsentry__sentry-python
tests/test_monitor.py
{ "start": 258, "end": 2806 }
class ____(HealthyTestTransport): def is_healthy(self): return False def test_no_monitor_if_disabled(sentry_init): sentry_init( transport=HealthyTestTransport(), enable_backpressure_handling=False, ) assert sentry_sdk.get_client().monitor is None def test_monitor_if_enabled(...
UnhealthyTestTransport
python
allegroai__clearml
clearml/backend_api/services/v2_9/queues.py
{ "start": 42156, "end": 45997 }
class ____(Request): """ Returns metrics of the company queues. The metrics are avaraged in the specified interval. :param from_date: Starting time (in seconds from epoch) for collecting metrics :type from_date: float :param to_date: Ending time (in seconds from epoch) for collecting metrics :t...
GetQueueMetricsRequest
python
sqlalchemy__sqlalchemy
test/dialect/postgresql/test_types.py
{ "start": 47774, "end": 53126 }
class ____( AssertsCompiledSQL, fixtures.TestBase, AssertsExecutionResults ): __sparse_driver_backend__ = True __only_on__ = "postgresql > 8.3" @testing.requires.postgresql_working_nullable_domains def test_domain_type_reflection(self, metadata, connection): positive_int = DOMAIN( ...
DomainTest
python
tensorflow__tensorflow
tensorflow/python/ops/math_ops_test.py
{ "start": 36449, "end": 40040 }
class ____(test_util.TensorFlowTestCase, parameterized.TestCase): _SUPPORTED_DTYPES = [dtypes.int8, dtypes.uint8, dtypes.int16, dtypes.uint16, dtypes.int32, dtypes.uint32, dtypes.int64, dtypes.uint64, dtypes.bfloat16, dtypes....
DivNoNanTest
python
pypa__hatch
tests/backend/metadata/test_core.py
{ "start": 21797, "end": 25290 }
class ____: def test_dynamic(self, isolation): metadata = ProjectMetadata(str(isolation), None, {"project": {"license": 9000, "dynamic": ["license"]}}) with pytest.raises( ValueError, match="Metadata field `license` cannot be both statically defined and listed in field `proj...
TestLicense
python
getsentry__responses
responses/__init__.py
{ "start": 21602, "end": 43817 }
class ____: DELETE: Literal["DELETE"] = "DELETE" GET: Literal["GET"] = "GET" HEAD: Literal["HEAD"] = "HEAD" OPTIONS: Literal["OPTIONS"] = "OPTIONS" PATCH: Literal["PATCH"] = "PATCH" POST: Literal["POST"] = "POST" PUT: Literal["PUT"] = "PUT" Response: Type[Response] = Response # Mak...
RequestsMock
python
getsentry__sentry
src/sentry/issues/endpoints/group_notes_details.py
{ "start": 863, "end": 4372 }
class ____(GroupEndpoint): publish_status = { "DELETE": ApiPublishStatus.PRIVATE, "PUT": ApiPublishStatus.PRIVATE, } # We explicitly don't allow a request with an ApiKey # since an ApiKey is bound to the Organization, not # an individual. Not sure if we'd want to allow an ApiKey ...
GroupNotesDetailsEndpoint
python
django__django
tests/migrations/test_migrations_squashed_complex/3_auto.py
{ "start": 35, "end": 188 }
class ____(migrations.Migration): dependencies = [("migrations", "2_auto")] operations = [migrations.RunPython(migrations.RunPython.noop)]
Migration
python
pytorch__pytorch
test/xpu/test_gemm.py
{ "start": 4011, "end": 60324 }
class ____(TestCase): def _test_addmm_addmv( self, f, t, m, v, *, alpha=None, beta=None, transpose_out=False, activation=None ): dtype = t.dtype numpy_dtype = dtype if dtype in {torch.bfloat16, torch.half}: numpy_dtype = torch.float if dtype.is_complex: ...
TestBasicGEMM
python
spyder-ide__spyder
spyder/plugins/findinfiles/plugin.py
{ "start": 786, "end": 940 }
class ____: FindInFiles = 'find in files' # --- Plugin # ----------------------------------------------------------------------------
FindInFilesActions
python
allegroai__clearml
clearml/binding/fire_bind.py
{ "start": 859, "end": 15785 }
class ____: _args = {} _command_type = "fire.Command" _command_arg_type_template = "fire.Arg@%s" _shared_arg_type = "fire.Arg.shared" _section_name = "Args" _args_sep = "/" _commands_sep = "." _current_task = None __remote_task_params = None __remote_task_params_dict = {} __p...
PatchFire
python
apache__airflow
providers/apache/hive/tests/unit/apache/hive/transfers/test_vertica_to_hive.py
{ "start": 1349, "end": 2313 }
class ____: def setup_method(self): args = {"owner": "airflow", "start_date": datetime.datetime(2017, 1, 1)} self.dag = DAG("test_dag_id", schedule=None, default_args=args) @pytest.mark.db_test @mock.patch( "airflow.providers.apache.hive.transfers.vertica_to_hive.VerticaHook.get_con...
TestVerticaToHiveTransfer
python
realpython__materials
python-property/circle_v2.py
{ "start": 0, "end": 409 }
class ____: def __init__(self, radius): self._radius = radius @property def radius(self): """The radius property.""" print("Get radius") return self._radius @radius.setter def radius(self, value): print("Set radius") self._radius = value @radius...
Circle
python
doocs__leetcode
solution/1800-1899/1826.Faulty Sensor/Solution.py
{ "start": 0, "end": 428 }
class ____: def badSensor(self, sensor1: List[int], sensor2: List[int]) -> int: i, n = 0, len(sensor1) while i < n - 1: if sensor1[i] != sensor2[i]: break i += 1 while i < n - 1: if sensor1[i + 1] != sensor2[i]: return 1 ...
Solution
python
altair-viz__altair
altair/vegalite/v6/schema/core.py
{ "start": 858687, "end": 858876 }
class ____(VegaLiteSchema): """ParseValue schema wrapper.""" _schema = {"$ref": "#/definitions/ParseValue"} def __init__(self, *args): super().__init__(*args)
ParseValue