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
weaviate__weaviate-python-client
weaviate/collections/queries/bm25/query/executor.py
{ "start": 866, "end": 14682 }
class ____( Generic[ConnectionType, Properties, References], _BaseExecutor[ConnectionType] ): @overload def bm25( self, query: Optional[str], *, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, op...
_BM25QueryExecutor
python
numpy__numpy
numpy/_core/tests/test_arrayprint.py
{ "start": 7830, "end": 23591 }
class ____: def test_basic(self): """Basic test of array2string.""" a = np.arange(3) assert_(np.array2string(a) == '[0 1 2]') assert_(np.array2string(a, max_line_width=4, legacy='1.13') == '[0 1\n 2]') assert_(np.array2string(a, max_line_width=4) == '[0\n 1\n 2]') def te...
TestArray2String
python
skorch-dev__skorch
skorch/tests/test_helper.py
{ "start": 18409, "end": 26594 }
class ____: @pytest.fixture def transformer_cls(self): from skorch.helper import DataFrameTransformer return DataFrameTransformer @pytest.fixture def df(self): """DataFrame containing float, int, category types""" import pandas as pd df = pd.DataFrame({ ...
TestDataFrameTransformer
python
airbytehq__airbyte
airbyte-integrations/connectors/source-iterable/source_iterable/slice_generators.py
{ "start": 810, "end": 2454 }
class ____(SliceGenerator): """ Split slices into event ranges of 90 days (or less for final slice) from start_date up to current date. """ RANGE_LENGTH_DAYS: int = 90 _slices: List[StreamSlice] = [] def __init__(self, start_date: DateTime, end_date: Optional[DateTime] = None): sup...
RangeSliceGenerator
python
rapidsai__cudf
python/cudf/cudf/pandas/fast_slow_proxy.py
{ "start": 20181, "end": 23285 }
class ____(_FastSlowProxy): """ Proxy type for a pair of fast and slow "final" types for which there is a known conversion from fast to slow, and vice-versa. The conversion between fast and slow types is done using user-provided conversion functions. Do not attempt to use this class directly. I...
_FinalProxy
python
doocs__leetcode
solution/3700-3799/3723.Maximize Sum of Squares of Digits/Solution.py
{ "start": 0, "end": 274 }
class ____: def maxSumOfSquares(self, num: int, sum: int) -> str: if num * 9 < sum: return "" k, s = divmod(sum, 9) ans = "9" * k if s: ans += digits[s] ans += "0" * (num - len(ans)) return ans
Solution
python
readthedocs__readthedocs.org
readthedocs/rtd_tests/tests/test_privacy_urls.py
{ "start": 10109, "end": 12485 }
class ____(PrivateProjectMixin, TestCase): response_data = { # Places where we 302 on success, and 301 for old pages -- These delete pages should probably be 405'ing "/dashboard/import/manual/demo/": {"status_code": 302}, "/dashboard/pip/": {"status_code": 301}, "/dashboard/pip/subpr...
PrivateProjectAdminAccessTest
python
jazzband__django-oauth-toolkit
oauth2_provider/migrations/0013_alter_application_authorization_grant_type_device.py
{ "start": 158, "end": 2210 }
class ____(migrations.Migration): dependencies = [ ('oauth2_provider', '0012_add_token_checksum'), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.AlterField( model_name='application', name='authorization_grant_type', ...
Migration
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/mysql/mysqlconnector.py
{ "start": 3247, "end": 3548 }
class ____(MySQLCompiler): def visit_mod_binary( self, binary: BinaryExpression[Any], operator: Any, **kw: Any ) -> str: return ( self.process(binary.left, **kw) + " % " + self.process(binary.right, **kw) )
MySQLCompiler_mysqlconnector
python
spack__spack
lib/spack/spack/test/conftest.py
{ "start": 23117, "end": 41051 }
class ____: """Build a mock repository in a directory""" _counter = 0 def __init__(self, root_directory: str) -> None: RepoBuilder._counter += 1 namespace = f"test_namespace_{RepoBuilder._counter}" repo_root = os.path.join(root_directory, namespace) os.makedirs(repo_root, e...
RepoBuilder
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/orm/util.py
{ "start": 5279, "end": 5710 }
class ____(Protocol): def __call__( self, cls: Type[Any], annotation: _AnnotationScanType, originating_module: str, *, str_cleanup_fn: Optional[Callable[[str, str], str]] = None, include_generic: bool = False, ) -> _MatchedOnType: ... de_stringify_annota...
_DeStringifyAnnotation
python
spyder-ide__spyder
spyder/plugins/variableexplorer/widgets/arrayeditor.py
{ "start": 15739, "end": 22289 }
class ____(QTableView, SpyderWidgetMixin): """Array view class""" CONF_SECTION = 'variable_explorer' def __init__(self, parent, model, dtype, shape): QTableView.__init__(self, parent) self.setModel(model) self.setItemDelegate(ArrayDelegate(dtype, self)) total_width = 0 ...
ArrayView
python
gevent__gevent
src/greentest/3.10/test_socket.py
{ "start": 25243, "end": 73777 }
class ____(unittest.TestCase): def test_SocketType_is_socketobject(self): import _socket self.assertTrue(socket.SocketType is _socket.socket) s = socket.socket() self.assertIsInstance(s, socket.SocketType) s.close() def test_repr(self): s = socket.socket(socket....
GeneralModuleTests
python
pytorch__pytorch
torch/nn/parallel/distributed.py
{ "start": 7647, "end": 7997 }
class ____: buffer_comm_hook: Callable buffer_comm_hook_state: Any buffer_comm_hook_location: _BufferCommHookLocation # Add a DDPSink to run various functions when backwards starts, such as # queueing call back of out-most backward/graph task, # this helps call back is fired after all gradients' calculati...
_BufferCommHook
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/solverLiteral1.py
{ "start": 404, "end": 868 }
class ____(Generic[_T]): pass TA1 = Callable[[ClassA[_T]], None] def func1(value: _T) -> TA1[_T]: def ret(ctx: ClassA[_T]) -> None: pass return ret def func2() -> TA1[bool]: return func1(True) def func3(value: _T) -> Callable[[_T], None]: ... x: Callable[[tuple[bool]], None] = func3((...
ClassA
python
openai__openai-python
src/openai/resources/beta/threads/threads.py
{ "start": 93285, "end": 94781 }
class ____: def __init__(self, threads: AsyncThreads) -> None: self._threads = threads self.create = ( # pyright: ignore[reportDeprecated] _legacy_response.async_to_raw_response_wrapper( threads.create, # pyright: ignore[reportDeprecated], ) ) ...
AsyncThreadsWithRawResponse
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typeVarTuple23.py
{ "start": 1473, "end": 1701 }
class ____(Generic[*Shape, DType]): ... def insert(values: NDArray[*Shape, DType]) -> NDArray[int, *Shape, DType]: ... def prepend(values: NDArray[*Shape, DType]) -> NDArray[int, *Shape, DType]: return insert(values)
NDArray
python
getsentry__sentry
src/sentry/api/endpoints/organization_traces.py
{ "start": 6638, "end": 36537 }
class ____: def __init__( self, *, dataset: Dataset, snuba_params: SnubaParams, user_queries: list[str], sort: str | None, limit: int, breakdown_slices: int, get_all_projects: Callable[[], list[Project]], ): self.dataset = dataset ...
TracesExecutor
python
pyqtgraph__pyqtgraph
pyqtgraph/graphicsItems/VTickGroup.py
{ "start": 300, "end": 3489 }
class ____(UIGraphicsItem): """ **Bases:** :class:`UIGraphicsItem <pyqtgraph.UIGraphicsItem>` Draws a set of tick marks which always occupy the same vertical range of the view, but have x coordinates relative to the data within the view. """ def __init__(self, xvals=None, yrange=None, ...
VTickGroup
python
ray-project__ray
python/ray/train/xgboost/config.py
{ "start": 474, "end": 1859 }
class ____(BackendConfig): """Configuration for xgboost collective communication setup. Ray Train will set up the necessary coordinator processes and environment variables for your workers to communicate with each other. Additional configuration options can be passed into the `xgboost.collective.Co...
XGBoostConfig
python
numpy__numpy
numpy/lib/tests/test_type_check.py
{ "start": 3287, "end": 4051 }
class ____: def test_real(self): y = np.random.rand(10,) assert_array_equal(y, np.real(y)) y = np.array(1) out = np.real(y) assert_array_equal(y, out) assert_(isinstance(out, np.ndarray)) y = 1 out = np.real(y) assert_equal(y, out) a...
TestReal
python
ApeWorX__ape
src/ape_console/config.py
{ "start": 92, "end": 301 }
class ____(PluginConfig): plugins: list[str] = [] """Additional IPython plugins to include in your session.""" model_config = SettingsConfigDict(extra="allow", env_prefix="APE_CONSOLE_")
ConsoleConfig
python
wandb__wandb
wandb/sdk/artifacts/_generated/fragments.py
{ "start": 6438, "end": 6552 }
class ____(GQLResult): node: Optional[RegistryFragmentArtifactTypesEdgesNode]
RegistryFragmentArtifactTypesEdges
python
scikit-image__scikit-image
benchmarks/benchmark_morphology.py
{ "start": 6584, "end": 8419 }
class ____: # skip rectangle as roughly equivalent to square param_names = ["shape", "dtype"] params = [ ((10, 10), (64, 64), (1200, 1200), (96, 96, 96)), (np.uint8, np.float32, np.float64), ] def setup(self, shape, dtype): rng = np.random.default_rng(123) # make an ...
GrayReconstruction
python
tox-dev__tox
src/tox/util/spinner.py
{ "start": 1310, "end": 1379 }
class ____(NamedTuple): ok: str fail: str skip: str
Outcome
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/datastore.py
{ "start": 1588, "end": 6215 }
class ____(GoogleCloudBaseOperator): """ Export entities from Google Cloud Datastore to Cloud Storage. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:CloudDatastoreExportEntitiesOperator` .. seealso:: https://cloud....
CloudDatastoreExportEntitiesOperator
python
google__jax
tests/pallas/tpu_pallas_test.py
{ "start": 95279, "end": 97498 }
class ____(PallasBaseTest): def setUp(self): super().setUp() if not jtu.is_device_tpu_at_least(4): self.skipTest('DMAs not supported on TPU generations <= 3') def test_simple_tile_aligned_dynamic_size_dma(self): def kernel(size_smem_ref, x_hbm_ref, _, o_hbm_ref, sem): size = size_smem_ref...
PallasCallDynamicDMATest
python
kamyu104__LeetCode-Solutions
Python/graph-connectivity-with-threshold.py
{ "start": 867, "end": 1498 }
class ____(object): def areConnected(self, n, threshold, queries): """ :type n: int :type threshold: int :type queries: List[List[int]] :rtype: List[bool] """ union_find = UnionFind(n) for i in xrange(threshold+1, n+1): # https://stackoverf...
Solution
python
pandas-dev__pandas
pandas/tests/series/methods/test_sort_values.py
{ "start": 7984, "end": 8975 }
class ____: def test_sort_values_key(self): series = Series(np.array(["Hello", "goodbye"])) result = series.sort_values(axis=0) expected = series tm.assert_series_equal(result, expected) result = series.sort_values(axis=0, key=lambda x: x.str.lower()) expected = ser...
TestSeriesSortingKey
python
getsentry__sentry
src/sentry/migrations/0999_add_extrapolation_mode_to_snuba_query.py
{ "start": 155, "end": 1633 }
class ____(CheckedMigration): # This flag is used to mark that a migration shouldn't be automatically run in production. # This should only be used for operations where it's safe to run the migration after your # code has deployed. So this should not be used for most operations that alter the schema # o...
Migration
python
huggingface__transformers
src/transformers/utils/auto_docstring.py
{ "start": 2077, "end": 6971 }
class ____: images = { "description": """ Image to preprocess. Expects a single or batch of images with pixel values ranging from 0 to 255. If passing in images with pixel values between 0 and 1, set `do_rescale=False`. """, "shape": None, } videos = { "description": """...
ImageProcessorArgs
python
ray-project__ray
python/ray/data/_internal/logical/operators/map_operator.py
{ "start": 612, "end": 2988 }
class ____(AbstractOneToOne): """Abstract class for logical operators that should be converted to physical MapOperator. """ def __init__( self, name: str, input_op: Optional[LogicalOperator] = None, num_outputs: Optional[int] = None, *, min_rows_per_bundl...
AbstractMap
python
kamyu104__LeetCode-Solutions
Python/count-substrings-divisible-by-last-digit.py
{ "start": 2902, "end": 3452 }
class ____(object): def countSubstrings(self, s): """ :type s: str :rtype: int """ result = 0 dp = [[0]*10 for _ in xrange(10)] for i in xrange(1, len(s)+1): new_dp = [[0]*10 for _ in xrange(10)] x = ord(s[i-1])-ord('0') for...
Solution3
python
doocs__leetcode
solution/0800-0899/0804.Unique Morse Code Words/Solution.py
{ "start": 0, "end": 713 }
class ____: def uniqueMorseRepresentations(self, words: List[str]) -> int: codes = [ ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", "...
Solution
python
pytorch__pytorch
test/distributed/tensor/test_experimental_ops.py
{ "start": 439, "end": 7978 }
class ____(DTensorTestBase): @property def world_size(self) -> int: # hard code world size to 2 return 2 @with_comms def test_slice(self): device_mesh = self.build_device_mesh() shard_spec = [Replicate()] input_list = torch.rand(ITER_TIME, 1024, 10) grad...
DistOtherOpsTest
python
great-expectations__great_expectations
contrib/great_expectations_geospatial_expectations/great_expectations_geospatial_expectations/expectations/expect_column_values_to_be_lat_lon_in_timezone.py
{ "start": 623, "end": 2358 }
class ____(ColumnMapMetricProvider): # This is the id string that will be used to reference your metric. condition_metric_name = "column_values.lat_lon_in_timezone" condition_value_keys = ("timezone",) # This method implements the core logic for the PandasExecutionEngine @column_condition_partial(e...
ColumnValuesLatLonInTimezone
python
huggingface__transformers
src/transformers/models/persimmon/configuration_persimmon.py
{ "start": 878, "end": 6216 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`PersimmonModel`]. It is used to instantiate an Persimmon model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar ...
PersimmonConfig
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_gridlines07.py
{ "start": 315, "end": 2365 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_gridlines07.xlsx") self.ignore_elements = {"xl/charts/chart1.xml": ["<c:formatCode"]} def test_create_file(self): """Test Xl...
TestCompareXLSXFiles
python
tensorflow__tensorflow
tensorflow/python/feature_column/sequence_feature_column_test.py
{ "start": 13459, "end": 15020 }
class ____( test.TestCase, parameterized.TestCase): @parameterized.named_parameters( {'testcase_name': '2D', 'inputs_args': { 'indices': ((0, 0), (1, 0), (1, 1)), 'values': ('marlo', 'skywalker', 'omar'), 'dense_shape': (2, 2)}, 'expected_args': { '...
SequenceCategoricalColumnWithVocabularyListTest
python
apache__airflow
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/kueue.py
{ "start": 1396, "end": 4208 }
class ____(BaseOperator): """ Installs a Kubernetes Kueue. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:KubernetesInstallKueueOperator` :param kueue_version: The Kubernetes Kueue version to install. :param kubernetes_...
KubernetesInstallKueueOperator
python
kamyu104__LeetCode-Solutions
Python/shortest-subarray-with-sum-at-least-k.py
{ "start": 50, "end": 893 }
class ____(object): def shortestSubarray(self, A, K): """ :type A: List[int] :type K: int :rtype: int """ accumulated_sum = [0]*(len(A)+1) for i in xrange(len(A)): accumulated_sum[i+1] = accumulated_sum[i]+A[i] result = float("inf") ...
Solution
python
huggingface__transformers
src/transformers/models/seed_oss/modeling_seed_oss.py
{ "start": 10352, "end": 12146 }
class ____(GradientCheckpointingLayer): def __init__(self, config: SeedOssConfig, layer_idx: int): super().__init__() self.hidden_size = config.hidden_size self.self_attn = SeedOssAttention(config=config, layer_idx=layer_idx) self.mlp = SeedOssMLP(config) self.input_layerno...
SeedOssDecoderLayer
python
encode__httpx
tests/client/test_auth.py
{ "start": 829, "end": 2474 }
class ____: def __init__( self, algorithm: str = "SHA-256", send_response_after_attempt: int = 1, qop: str = "auth", regenerate_nonce: bool = True, ) -> None: self.algorithm = algorithm self.send_response_after_attempt = send_response_after_attempt ...
DigestApp
python
chroma-core__chroma
chromadb/execution/expression/operator.py
{ "start": 16423, "end": 16489 }
class ____: embeddings: Embeddings fetch: int @dataclass
KNN
python
dagster-io__dagster
python_modules/dagster/dagster/_core/types/dagster_type.py
{ "start": 22948, "end": 23770 }
class ____(DagsterTypeLoader): def __init__(self, inner_dagster_type): self._inner_dagster_type = check.inst_param( inner_dagster_type, "inner_dagster_type", DagsterType ) check.param_invariant(inner_dagster_type.loader, "inner_dagster_type") self._schema_type = Array(inn...
ListInputSchema
python
pyca__cryptography
tests/hazmat/primitives/test_rsa.py
{ "start": 57805, "end": 59311 }
class ____: def test_calculate_max_pss_salt_length(self): with pytest.raises(TypeError): padding.calculate_max_pss_salt_length( object(), # type:ignore[arg-type] hashes.SHA256(), ) def test_invalid_salt_length_not_integer(self): with pyte...
TestPSS
python
doocs__leetcode
solution/0700-0799/0755.Pour Water/Solution.py
{ "start": 0, "end": 540 }
class ____: def pourWater(self, heights: List[int], volume: int, k: int) -> List[int]: for _ in range(volume): for d in (-1, 1): i = j = k while 0 <= i + d < len(heights) and heights[i + d] <= heights[i]: if heights[i + d] < heights[i]: ...
Solution
python
pyparsing__pyparsing
pyparsing/core.py
{ "start": 102310, "end": 102731 }
class ____(Literal): """ An empty token, will always match. """ def __init__(self, match_string="", *, matchString="") -> None: super().__init__("") self._may_return_empty = True self.mayIndexError = False def _generateDefaultName(self) -> str: return "Empty" d...
Empty
python
facebookresearch__faiss
faiss/gpu/test/test_gpu_index.py
{ "start": 16683, "end": 17882 }
class ____(unittest.TestCase): def test_indices_ivfpq(self): res = faiss.StandardGpuResources() d = 128 nb = 5000 nlist = 10 M = 4 nbits = 8 rs = np.random.RandomState(567) xb = rs.rand(nb, d).astype('float32') xb_indices_base = np.arange(nb,...
TestInvalidParams
python
huggingface__transformers
tests/models/stablelm/test_modeling_stablelm.py
{ "start": 1266, "end": 1391 }
class ____(CausalLMModelTest, unittest.TestCase): model_tester_class = StableLmModelTester @require_torch
StableLmModelTest
python
getsentry__sentry
src/sentry/incidents/models/alert_rule.py
{ "start": 1667, "end": 1863 }
class ____(models.TextChoices): STATIC = "static", gettext_lazy("Static") PERCENT = "percent", gettext_lazy("Percent") DYNAMIC = "dynamic", gettext_lazy("Dynamic")
AlertRuleDetectionType
python
astropy__astropy
astropy/coordinates/distances.py
{ "start": 432, "end": 9287 }
class ____(u.SpecificTypeQuantity): """ A one-dimensional distance. This can be initialized by providing one of the following: * Distance ``value`` (array or float) and a ``unit`` * |Quantity| object with dimensionality of length * Redshift and (optionally) a `~astropy.cosmology.Cosmology` ...
Distance
python
pytorch__pytorch
torch/backends/mkldnn/__init__.py
{ "start": 3464, "end": 4324 }
class ____(PropModule): def is_available(self): return is_available() enabled = ContextProp(torch._C._get_mkldnn_enabled, torch._C._set_mkldnn_enabled) deterministic = ContextProp( torch._C._get_mkldnn_deterministic, torch._C._set_mkldnn_deterministic ) allow_tf32 = ContextProp( ...
MkldnnModule
python
encode__httpx
httpx/_urlparse.py
{ "start": 4871, "end": 18546 }
class ____(typing.NamedTuple): scheme: str userinfo: str host: str port: int | None path: str query: str | None fragment: str | None @property def authority(self) -> str: return "".join( [ f"{self.userinfo}@" if self.userinfo else "", ...
ParseResult
python
kamyu104__LeetCode-Solutions
Python/maximum-number-of-accepted-invitations.py
{ "start": 4901, "end": 5925 }
class ____(object): def maximumInvitations(self, grid): """ :type grid: List[List[int]] :rtype: int """ def augment(grid, u, lookup, match): for v in xrange(V): if not get_grid(u, v) or v in lookup: continue look...
Solution2
python
altair-viz__altair
altair/vegalite/v6/schema/channels.py
{ "start": 1099532, "end": 1100259 }
class ____(ValueChannelMixin, core.PositionValueDef): """ YValue schema wrapper. Definition object for a constant value (primitive value or gradient definition) of an encoding channel. Parameters ---------- value : dict, float, :class:`ExprRef`, Literal['height', 'width'] A constan...
YValue
python
sympy__sympy
sympy/assumptions/predicates/matrices.py
{ "start": 1787, "end": 2626 }
class ____(Predicate): """ Invertible matrix predicate. Explanation =========== ``Q.invertible(x)`` is true iff ``x`` is an invertible matrix. A square matrix is called invertible only if its determinant is 0. Examples ======== >>> from sympy import Q, ask, MatrixSymbol >>> X...
InvertiblePredicate
python
fabric__fabric
tests/config.py
{ "start": 324, "end": 6992 }
class ____: def defaults_to_merger_of_global_defaults(self): # I.e. our global_defaults + Invoke's global_defaults c = Config() # From invoke's global_defaults assert c.run.warn is False # From ours assert c.port == 22 def our_global_defaults_can_override_invokes...
Config_
python
apache__airflow
airflow-core/src/airflow/cli/commands/task_command.py
{ "start": 11217, "end": 19429 }
class ____(Protocol): def post_mortem(self) -> None: ... def set_trace(self) -> None: ... SUPPORTED_DEBUGGER_MODULES = [ "pudb", "web_pdb", "pdbr", "ipdb", "pdb", ] def _guess_debugger() -> _SupportedDebugger: """ Try to guess the debugger used by the user. When it doesn't f...
_SupportedDebugger
python
getsentry__sentry
src/sentry/analytics/events/sentryapp_issue_webhooks.py
{ "start": 247, "end": 359 }
class ____(SentryAppIssueEvent): pass @analytics.eventclass("sentry_app.issue.created")
SentryAppIssueAssigned
python
realpython__materials
python-311/scientists.py
{ "start": 802, "end": 1241 }
class ____(NamedTuple): name: str life_span: tuple def dict_to_person(info): """Convert a dictionary to a Person object""" return Person( name=f"{info['name']['first']} {info['name']['last']}", life_span=(info["birth"]["year"], info["death"]["year"]), ) def convert_pair(first, se...
Person
python
getsentry__sentry
src/sentry/rules/conditions/base.py
{ "start": 280, "end": 464 }
class ____(TypedDict): # the ID in the rules registry that maps to a condition class # e.g. "sentry.rules.conditions.every_event.EveryEventCondition" id: str
GenericCondition
python
davidhalter__jedi
jedi/api/classes.py
{ "start": 26551, "end": 27437 }
class ____(Name): """ These signatures are returned by :meth:`BaseName.get_signatures` calls. """ def __init__(self, inference_state, signature): super().__init__(inference_state, signature.name) self._signature = signature @property def params(self): """ Ret...
BaseSignature
python
pytorch__pytorch
test/distributed/checkpoint/test_pg_transport.py
{ "start": 21319, "end": 22702 }
class ____(TestCase): def setUp(self): self.device = torch.device("cpu") self.pg = MagicMock() self.timeout = timedelta(seconds=10) # Mock Work object self.mock_work = MagicMock() self.mock_work.wait = MagicMock() # Setup process group mock to return mock_wo...
TestPGTransportEdgeCases
python
realpython__materials
oop-in-java-vs-python/car.py
{ "start": 108, "end": 334 }
class ____: """The Vehicle class is the parent for all vehicles.""" def __init__(self, color, model): """Define the color and model of our vehicle""" self.color = color self.model = model
Vehicle
python
pyqtgraph__pyqtgraph
pyqtgraph/graphicsItems/UIGraphicsItem.py
{ "start": 104, "end": 4376 }
class ____(GraphicsObject): """ Base class for graphics items with boundaries relative to a GraphicsView or ViewBox. The purpose of this class is to allow the creation of GraphicsItems which live inside a scalable view, but whose boundaries will always stay fixed relative to the view's boundaries. ...
UIGraphicsItem
python
ray-project__ray
python/ray/_private/thirdparty/pynvml/pynvml.py
{ "start": 91944, "end": 92161 }
class ____(_PrintableStructure): _fields_ = [ ('schedulerPolicy', c_uint), ('enableARRMode', c_uint), ('schedulerParams', c_nvmlVgpuSchedulerSetParams_t), ]
c_nvmlVgpuSchedulerSetState_t
python
cython__cython
Cython/Debugger/libpython.py
{ "start": 83580, "end": 83748 }
class ____(ExecutionControlCommandBase): "Execute until function returns to a caller." invoke = dont_suppress_errors(ExecutionControlCommandBase.finish)
PyFinish
python
h5py__h5py
h5py/tests/test_group.py
{ "start": 20773, "end": 23410 }
class ____(BaseGroup): """ Feature: The .get method allows access to objects and metadata """ def test_get_default(self): """ Object is returned, or default if it doesn't exist """ name = make_name() default = object() out = self.f.get('mongoose', default) s...
TestGet
python
MorvanZhou__Reinforcement-learning-with-tensorflow
experiments/2D_car/DDPG.py
{ "start": 1359, "end": 4017 }
class ____(object): def __init__(self, sess, action_dim, action_bound, learning_rate, t_replace_iter): self.sess = sess self.a_dim = action_dim self.action_bound = action_bound self.lr = learning_rate self.t_replace_iter = t_replace_iter self.t_replace_counter = 0 ...
Actor
python
lxml__lxml
src/lxml/html/_difflib.py
{ "start": 29497, "end": 69233 }
class ____: r""" Differ is a class for comparing sequences of lines of text, and producing human-readable differences or deltas. Differ uses SequenceMatcher both to compare sequences of lines, and to compare sequences of characters within similar (near-matching) lines. Each line of a Differ de...
Differ
python
django__django
django/utils/translation/__init__.py
{ "start": 5654, "end": 8878 }
class ____(ContextDecorator): def __init__(self, language, deactivate=False): self.language = language self.deactivate = deactivate def __enter__(self): self.old_language = get_language() if self.language is not None: activate(self.language) else: ...
override
python
Pylons__pyramid
tests/test_urldispatch.py
{ "start": 18419, "end": 24979 }
class ____(unittest.TestCase): def matches(self, pattern, path, expected): from pyramid.urldispatch import _compile_route matcher = _compile_route(pattern)[0] result = matcher(path) self.assertEqual(result, expected) def generates(self, pattern, dict, result): from pyra...
TestCompileRouteFunctional
python
PrefectHQ__prefect
src/prefect/server/events/actions.py
{ "start": 41835, "end": 42989 }
class ____(FlowRunAction): """Resumes a paused or suspended flow run associated with the trigger""" type: Literal["resume-flow-run"] = "resume-flow-run" async def act(self, triggered_action: "TriggeredAction") -> None: flow_run_id = await self.flow_run(triggered_action) self._resulting_re...
ResumeFlowRun
python
kamyu104__LeetCode-Solutions
Python/sort-an-array.py
{ "start": 841, "end": 2344 }
class ____(object): def sortArray(self, nums): """ :type nums: List[int] :rtype: List[int] """ def nth_element(nums, left, n, right, compare=lambda a, b: a < b): def tri_partition(nums, left, right, target): i = left while i <= righ...
Solution2
python
eventlet__eventlet
eventlet/corolocal.py
{ "start": 349, "end": 1382 }
class ____: __slots__ = '_local__args', '_local__greens' def __new__(cls, *args, **kw): self = object.__new__(cls) object.__setattr__(self, '_local__args', (args, kw)) object.__setattr__(self, '_local__greens', weakref.WeakKeyDictionary()) if (args or kw) and (cls.__init__ is ob...
_localbase
python
PrefectHQ__prefect
src/integrations/prefect-databricks/prefect_databricks/models/jobs.py
{ "start": 117709, "end": 118124 }
class ____(BaseModel): """ See source code for the fields' description. """ model_config = ConfigDict(extra="allow", frozen=True) cluster_id: Optional[str] = Field( None, description="Unique identifier for the cluster." ) library_statuses: Optional[List[LibraryFullStatus]] = Field(...
ClusterLibraryStatuses
python
aio-libs__aiohttp
aiohttp/web_protocol.py
{ "start": 1950, "end": 2092 }
class ____(Exception): """Payload was accessed after response was sent.""" _PAYLOAD_ACCESS_ERROR = PayloadAccessError()
PayloadAccessError
python
django__django
tests/test_client_regress/tests.py
{ "start": 55744, "end": 56840 }
class ____(SimpleTestCase): """Regression tests for #15929.""" # These tests are checking that certain middleware don't change certain # global state. Alternatively, from the point of view of a test, they are # ensuring test isolation behavior. So, unusually, it doesn't make sense to # run the test...
RequestFactoryStateTest
python
google__pytype
pytype/datatypes_test.py
{ "start": 9829, "end": 11013 }
class ____(unittest.TestCase): """Test parser wrapper.""" def test_group(self): parser = argparse.ArgumentParser() wrapper = datatypes.ParserWrapper(parser) wrapper.add_argument("--foo", dest="foo") group = wrapper.add_argument_group("test1") group.add_argument("--bar", dest="bar") subgroup...
ParserWrapperTest
python
great-expectations__great_expectations
contrib/great_expectations_zipcode_expectations/great_expectations_zipcode_expectations/expectations/expect_column_values_to_be_valid_new_york_state_zip.py
{ "start": 1797, "end": 4184 }
class ____(ColumnMapExpectation): """Expect values in this column to be valid New York state zipcodes. See https://pypi.org/project/zipcodes/ for more information. """ # These examples will be shown in the public gallery. # They will also be executed as unit tests for your Expectation. example...
ExpectColumnValuesToBeValidNewYorkStateZip
python
pytorch__pytorch
torch/_inductor/remote_cache.py
{ "start": 9954, "end": 11046 }
class ____(RemoteCache[JsonDataTy]): def __init__(self, cache_id: str) -> None: # Special test handling: If we're just going to override the backend # anyway don't require redis if self.__class__.backend_override_cls: # This is totally bogus but it works for now... ba...
RedisRemoteCache
python
davidhalter__jedi
jedi/inference/filters.py
{ "start": 9072, "end": 9516 }
class ____(ValueWrapper): """``Generator.__next__`` ``dict.values`` methods and so on.""" api_type = 'function' def __init__(self, value, method, builtin_func): super().__init__(builtin_func) self._value = value self._method = method def py__call__(self, arguments): # T...
_BuiltinMappedMethod
python
coleifer__peewee
tests/schema.py
{ "start": 1353, "end": 1793 }
class ____(TestModel): name = TextField(unique=True) timestamp = TimestampField() status = IntegerField() flags = IntegerField() Article.add_index(Article.timestamp.desc(), Article.status) idx = (Article .index(Article.name, Article.timestamp, Article.flags.bin_and(4)) .where(Article.st...
Article
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/autoVariance4.py
{ "start": 855, "end": 1085 }
class ____[T](Parent_Contravariant[T]): pass c1: ShouldBeContravariant[int] = ShouldBeContravariant[float]() # This should generate an error. c2: ShouldBeContravariant[float] = ShouldBeContravariant[int]()
ShouldBeContravariant
python
arrow-py__arrow
tests/test_locales.py
{ "start": 153911, "end": 156261 }
class ____: def test_describe(self): assert self.locale.describe("now", only_distance=True) == "nå nettopp" assert self.locale.describe("now", only_distance=False) == "nå nettopp" def test_plurals(self): assert self.locale._format_timeframe("now", 0) == "nå nettopp" assert self....
TestNorwegianLocale
python
django__django
tests/introspection/models.py
{ "start": 3830, "end": 4085 }
class ____(models.Model): fk_db_set_default = models.ForeignKey( Country, on_delete=models.DB_SET_DEFAULT, db_default=models.Value(1) ) class Meta: required_db_features = {"supports_on_delete_db_default"}
DbOnDeleteSetDefaultModel
python
PrefectHQ__prefect
tests/cli/test_deploy.py
{ "start": 121528, "end": 147139 }
class ____: @pytest.mark.usefixtures("project_dir") async def test_deploy_all(self, prefect_client: PrefectClient, work_pool: WorkPool): prefect_file = Path("prefect.yaml") with prefect_file.open(mode="r") as f: contents = yaml.safe_load(f) # Create multiple deployments ...
TestMultiDeploy
python
scipy__scipy
scipy/linalg/tests/test_decomp_update.py
{ "start": 47635, "end": 47698 }
class ____(BaseQRinsert): dtype = np.dtype('d')
TestQRinsert_d
python
dask__distributed
distributed/worker_state_machine.py
{ "start": 3889, "end": 4747 }
class ____(Exception): def __init__( self, key: Key, state: TaskStateState, story: list[tuple], ): self.key = key self.state = state self.story = story def __reduce__(self) -> tuple[Callable, tuple]: return type(self), (self.key, self.state, s...
InvalidTaskState
python
lxml__lxml
src/lxml/html/__init__.py
{ "start": 4245, "end": 7686 }
class ____(MutableSet): """Provides access to an element's class attribute as a set-like collection. Usage:: >>> el = fromstring('<p class="hidden large">Text</p>') >>> classes = el.classes # or: classes = Classes(el.attrib) >>> classes |= ['block', 'paragraph'] >>> el.get('cla...
Classes
python
django__django
tests/i18n/tests.py
{ "start": 86662, "end": 88326 }
class ____(SimpleTestCase): """ A language non present in default Django languages can still be installed/used by a Django project. """ @override_settings( USE_I18N=True, LANGUAGES=[ ("en-us", "English"), ("xxx", "Somelanguage"), ], LANGUAGE_C...
NonDjangoLanguageTests
python
pydantic__pydantic
tests/mypy/outputs/mypy-plugin-very-strict_ini/metaclass_args.py
{ "start": 292, "end": 549 }
class ____(BaseModel, validate_by_name=True): i: int = Field(alias='j') MetaclassArgumentsNoDefault(i=None) # MYPY: error: Argument "i" to "MetaclassArgumentsNoDefault" has incompatible type "None"; expected "int" [arg-type]
MetaclassArgumentsNoDefault
python
getsentry__sentry
tests/apidocs/endpoints/releases/test_project_release_commits.py
{ "start": 230, "end": 1609 }
class ____(APIDocsTestCase): def setUp(self) -> None: project = self.create_project(name="foo") release = self.create_release(project=project, version="1") release.add_project(project) repo = self.create_repo(project=project, name=project.name) commit = Commit.objects.create(...
ProjectReleaseCommitsListDocsTest
python
getsentry__sentry
src/sentry/sentry_apps/utils/webhooks.py
{ "start": 791, "end": 1130 }
class ____(SentryAppActionType): ROOT_CAUSE_STARTED = "root_cause_started" ROOT_CAUSE_COMPLETED = "root_cause_completed" SOLUTION_STARTED = "solution_started" SOLUTION_COMPLETED = "solution_completed" CODING_STARTED = "coding_started" CODING_COMPLETED = "coding_completed" PR_CREATED = "pr_cr...
SeerActionType
python
gevent__gevent
src/greentest/3.14/test_smtplib.py
{ "start": 59143, "end": 59854 }
class ____(SimSMTPChannel): def smtp_AUTH(self, arg): # RFC 4954's AUTH command allows for an optional initial-response. # Not all AUTH methods support this; some require a challenge. AUTH # PLAIN does those, so test that here. See issue #15014. args = arg.split() if args[0...
SimSMTPAUTHInitialResponseChannel
python
getsentry__sentry
src/sentry/uptime/models.py
{ "start": 1329, "end": 4439 }
class ____(BaseRemoteSubscription, DefaultFieldsModelExisting): # TODO: This should be included in export/import, but right now it has no relation to # any projects/orgs. Will fix this in a later pr __relocation_scope__ = RelocationScope.Excluded class SupportedHTTPMethods(models.TextChoices): ...
UptimeSubscription
python
pennersr__django-allauth
allauth/socialaccount/providers/ynab/views.py
{ "start": 181, "end": 1047 }
class ____(OAuth2Adapter): provider_id = "ynab" access_token_url = "https://app.youneedabudget.com/oauth/token" # nosec authorize_url = "https://app.youneedabudget.com/oauth/authorize" profile_url = "https://api.youneedabudget.com/v1/user" def complete_login(self, request, app, token, **kwargs): ...
YNABOAuth2Adapter
python
great-expectations__great_expectations
great_expectations/expectations/metrics/column_map_metrics/column_values_match_json_schema.py
{ "start": 526, "end": 2494 }
class ____(ColumnMapMetricProvider): condition_metric_name = "column_values.match_json_schema" condition_value_keys = ("json_schema",) @column_condition_partial(engine=PandasExecutionEngine) def _pandas(cls, column, json_schema, **kwargs): def matches_json_schema(val): try: ...
ColumnValuesMatchJsonSchema
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_stock01.py
{ "start": 315, "end": 2046 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_stock01.xlsx") self.ignore_elements = {"xl/charts/chart1.xml": ["<c:formatCode"]} def test_create_file(self): """Test the cr...
TestCompareXLSXFiles