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
charliermarsh__ruff
scripts/ty_benchmark/src/benchmark/tool.py
{ "start": 4128, "end": 5918 }
class ____(Tool): path: Path def __init__(self, *, path: Path | None = None): if path: self.path = path else: if sys.platform == "win32": self.path = Path("./node_modules/.bin/pyright.cmd").resolve() else: self.path = Path("./n...
Pyright
python
ApeWorX__ape
src/ape/utils/basemodel.py
{ "start": 11618, "end": 12756 }
class ____(EthpmTypesBaseModel): """ An ape-pydantic BaseModel. """ model_config = ConfigDict(arbitrary_types_allowed=True) def model_copy( self: "Model", *, update: Optional[Mapping[str, Any]] = None, deep: bool = False, cache_clear: Optional[Sequence[str]]...
BaseModel
python
ray-project__ray
python/ray/llm/_internal/serve/serving_patterns/data_parallel/builder.py
{ "start": 2496, "end": 4979 }
class ____(BaseModelExtended): """Schema for DP OpenAI serving args.""" llm_config: Union[str, dict, LLMConfig] = Field( description="The LLM configuration", ) ingress_cls_config: Union[dict, IngressClsConfig] = Field( default_factory=IngressClsConfig, description="The configura...
DPOpenAiServingArgs
python
getsentry__sentry
src/sentry/api/serializers/models/release.py
{ "start": 14404, "end": 14678 }
class ____(TypedDict): id: int slug: str | None name: str new_groups: int | None platform: str | None platforms: list[str] health_data: NotRequired[ReleaseHealthOverview | None] has_health_data: NotRequired[bool] @register(Release)
_ProjectDict
python
pytest-dev__pytest-django
tests/test_unittest.py
{ "start": 155, "end": 474 }
class ____(TestCase): fixtures = ("items",) def test_fixtures(self) -> None: assert Item.objects.count() == 1 assert Item.objects.get().name == "Fixture item" def test_fixtures_again(self) -> None: """Ensure fixtures are only loaded once.""" self.test_fixtures()
TestFixtures
python
django__django
tests/model_forms/tests.py
{ "start": 3113, "end": 3224 }
class ____(forms.ModelForm): class Meta: model = Category fields = "__all__"
BaseCategoryForm
python
dagster-io__dagster
python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/generated/sources.py
{ "start": 227024, "end": 228339 }
class ____(GeneratedAirbyteSource): @public def __init__( self, name: str, access_token: str, gocardless_environment: str, gocardless_version: str, start_date: str, ): """Airbyte Source for Gocardless. Documentation can be found at https://doc...
GocardlessSource
python
walkccc__LeetCode
solutions/1268. Search Suggestions System/1268.py
{ "start": 0, "end": 117 }
class ____: def __init__(self): self.children: dict[str, TrieNode] = {} self.word: str | None = None
TrieNode
python
pallets__werkzeug
src/werkzeug/middleware/lint.py
{ "start": 3035, "end": 3567 }
class ____: def __init__(self, stream: t.IO[str]) -> None: self._stream = stream def write(self, s: str) -> None: check_type("wsgi.error.write()", s, str) self._stream.write(s) def flush(self) -> None: self._stream.flush() def writelines(self, seq: t.Iterable[str]) -> ...
ErrorStream
python
great-expectations__great_expectations
great_expectations/expectations/core/expect_column_values_to_be_unique.py
{ "start": 2072, "end": 12954 }
class ____(ColumnMapExpectation): __doc__ = f"""{EXPECTATION_SHORT_DESCRIPTION} This expectation detects duplicates. All duplicated values are counted as exceptions. For example, [1, 2, 3, 3, 3] will return [3, 3, 3] in result.exceptions_list, with \ unexpected_percent = 60.0. ExpectColumnValuesT...
ExpectColumnValuesToBeUnique
python
nedbat__coveragepy
lab/hack_pyc.py
{ "start": 336, "end": 2860 }
class ____: def read(self, f): if isinstance(f, basestring): f = open(f, "rb") self.magic = f.read(4) self.modtime = f.read(4) self.code = marshal.load(f) def write(self, f): if isinstance(f, basestring): f = open(f, "wb") f.write(self.mag...
PycFile
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/metadata/metadata_value.py
{ "start": 24466, "end": 24776 }
class ____(MetadataValue[Optional[int]]): """Container class for int metadata entry data. Args: value (Optional[int]): The int value. """ value: PublicAttr[Optional[int]] # type: ignore @whitelist_for_serdes(storage_name="BoolMetadataEntryData") @record(kw_only=False)
IntMetadataValue
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_pyi/PYI041_1.py
{ "start": 1181, "end": 1728 }
class ____: def good(self, arg: int) -> None: ... def bad(self, arg: int | float | complex) -> None: ... def bad2(self, arg: int | Union[float, complex]) -> None: ... def bad3(self, arg: Union[Union[float, complex], int]) -> None: ... def bad4(self, arg: Union[f...
Foo
python
sqlalchemy__sqlalchemy
test/sql/test_compare.py
{ "start": 5312, "end": 5383 }
class ____(TypeDecorator): cache_ok = True impl = Integer
MyType2
python
pyca__cryptography
tests/hazmat/primitives/test_aes.py
{ "start": 6991, "end": 7992 }
class ____: test_cfb = generate_encrypt_test( load_nist_vectors, os.path.join("ciphers", "AES", "CFB"), [ "CFB128GFSbox128.rsp", "CFB128GFSbox192.rsp", "CFB128GFSbox256.rsp", "CFB128KeySbox128.rsp", "CFB128KeySbox192.rsp", ...
TestAESModeCFB
python
matplotlib__matplotlib
doc/sphinxext/mock_gui_toolkits.py
{ "start": 49, "end": 256 }
class ____(MagicMock): __name__ = "cairocffi" def setup(app): sys.modules.update( cairocffi=MyCairoCffi(), ) return {'parallel_read_safe': True, 'parallel_write_safe': True}
MyCairoCffi
python
kamyu104__LeetCode-Solutions
Python/rearrange-k-substrings-to-form-target-string.py
{ "start": 63, "end": 460 }
class ____(object): def isPossibleToRearrange(self, s, t, k): """ :type s: str :type t: str :type k: int :rtype: bool """ cnt = collections.defaultdict(int) l = len(s)//k for i in xrange(0, len(s), l): cnt[s[i:i+l]] += 1 ...
Solution
python
pytorch__pytorch
torch/testing/_internal/common_methods_invocations.py
{ "start": 408473, "end": 420421 }
class ____: def __init__( self, arity: int, rightmost_supports_scalar: bool, rightmost_supports_scalarlist: bool, rightmost_supports_tensor: bool = False, ) -> None: self.arity = arity self._set_rightmost_arg_types( rightmost_supports_scalar, r...
foreach_inputs_sample_func
python
ray-project__ray
python/ray/serve/tests/test_fastapi.py
{ "start": 4120, "end": 4247 }
class ____(BaseModel): name: str price: float = Field(None, gt=1.0, description="High price!") nests: Nested
BodyType
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/events.py
{ "start": 676, "end": 18312 }
class ____(event.Events[SchemaEventTarget]): """ Define event listeners for schema objects, that is, :class:`.SchemaItem` and other :class:`.SchemaEventTarget` subclasses, including :class:`_schema.MetaData`, :class:`_schema.Table`, :class:`_schema.Column`, etc. **Create / Drop Events** Ev...
DDLEvents
python
PrefectHQ__prefect
src/prefect/server/schemas/filters.py
{ "start": 68460, "end": 68967 }
class ____(PrefectFilterBaseModel): """Filter by `WorkPool.type`.""" any_: Optional[list[str]] = Field( default=None, description="A list of work pool types to include" ) def _get_filter_list( self, db: "PrefectDBInterface" ) -> Iterable[sa.ColumnExpressionArgument[bool]]: ...
WorkPoolFilterType
python
django__django
tests/generic_relations/models.py
{ "start": 3254, "end": 3518 }
class ____(models.Model): content_type = models.ForeignKey(ContentType, models.CASCADE) object_id = models.PositiveIntegerField() obj = GenericForeignKey(for_concrete_model=False) title = models.CharField(max_length=255, null=True)
ForProxyModelModel
python
huggingface__transformers
src/transformers/models/data2vec/modeling_data2vec_text.py
{ "start": 40892, "end": 45352 }
class ____(Data2VecTextPreTrainedModel): def __init__(self, config): super().__init__(config) self.data2vec_text = Data2VecTextModel(config) self.dropout = nn.Dropout(config.hidden_dropout_prob) self.classifier = nn.Linear(config.hidden_size, 1) # Initialize weights and app...
Data2VecTextForMultipleChoice
python
walkccc__LeetCode
solutions/683. K Empty Slots/683.py
{ "start": 0, "end": 652 }
class ____: def kEmptySlots(self, bulbs: list[int], k: int) -> int: n = len(bulbs) ans = math.inf # day[i] := the day when bulbs[i] is turned on day = [0] * n for i, bulb in enumerate(bulbs): day[bulb - 1] = i + 1 # Find a subarray of day[l..r], where its length is k + 2. # For eac...
Solution
python
Netflix__metaflow
test/core/tests/basic_include.py
{ "start": 67, "end": 2225 }
class ____(MetaflowTest): PRIORITY = 1 SKIP_GRAPHS = [ "simple_switch", "nested_switch", "branch_in_switch", "foreach_in_switch", "switch_in_branch", "switch_in_foreach", "recursive_switch", "recursive_switch_inside_foreach", ] INCLUDE_FILE...
BasicIncludeTest
python
matplotlib__matplotlib
lib/matplotlib/patheffects.py
{ "start": 7832, "end": 10050 }
class ____(AbstractPathEffect): """A simple shadow via a filled patch.""" def __init__(self, offset=(2, -2), shadow_rgbFace=None, alpha=None, rho=0.3, **kwargs): """ Parameters ---------- offset : (float, float), default: (2, -2) The...
SimplePatchShadow
python
getsentry__sentry
tests/sentry/workflow_engine/models/test_detector.py
{ "start": 378, "end": 6807 }
class ____(BaseWorkflowTest): def setUp(self) -> None: self.detector = self.create_detector() def test_queryset(self) -> None: """ Test that we filter out objects with statuses other than 'active' """ assert Detector.objects.filter(id=self.detector.id).exists() s...
DetectorTest
python
joblib__joblib
examples/memory_basic_usage.py
{ "start": 3481, "end": 4698 }
class ____(object): """A class which is using the previous function.""" def __init__(self, column=0): self.column = column def transform(self, data): costly_compute = memory.cache(_costly_compute_cached) return costly_compute(data, self.column) transformer = Algorithm() start = t...
Algorithm
python
getsentry__sentry
src/sentry/analytics/events/ai_autofix_pr_events.py
{ "start": 244, "end": 349 }
class ____(AiAutofixPrEvent): pass @analytics.eventclass("ai.autofix.pr.merged")
AiAutofixPrClosedEvent
python
bokeh__bokeh
src/bokeh/plotting/contour.py
{ "start": 3118, "end": 3431 }
class ____(LineCoords): ''' Complete geometry data for contour lines over a whole sequence of contour levels. ''' levels: ArrayLike def asdict(self): # Convert to dict using shallow copy. dataclasses.asdict uses deep copy. return dict(entries(self)) @dataclass(frozen=True)
LineData
python
pytorch__pytorch
test/inductor/test_cache.py
{ "start": 4962, "end": 12307 }
class ____(TestMixin, TestCase): @parametrize("cache_type", TestMixin.cache_types()) @parametrize("key_type", TestMixin.key_types()) @parametrize("value_type", TestMixin.value_types()) def test_get( self: Self, cache_type: type[icache.Cache], key_type: type[icache.Key], v...
CacheTest
python
walkccc__LeetCode
solutions/1901. Find a Peak Element II/1901.py
{ "start": 0, "end": 277 }
class ____: def findPeakGrid(self, mat: list[list[int]]) -> list[int]: l = 0 r = len(mat) - 1 while l < r: m = (l + r) // 2 if max(mat[m]) >= max(mat[m + 1]): r = m else: l = m + 1 return [l, mat[l].index(max(mat[l]))]
Solution
python
pyqtgraph__pyqtgraph
pyqtgraph/GraphicsScene/exportDialog.py
{ "start": 467, "end": 5415 }
class ____(QtWidgets.QWidget): def __init__(self, scene): QtWidgets.QWidget.__init__(self) self.setVisible(False) self.setWindowTitle("Export") self.shown = False self.currentExporter = None self.scene = scene self.selectBox = QtWidgets.QGraphicsRectItem() ...
ExportDialog
python
pandas-dev__pandas
pandas/errors/__init__.py
{ "start": 10949, "end": 11736 }
class ____(ValueError): """ Exception raised in ``pd.read_csv`` when empty data or header is encountered. This error is typically encountered when attempting to read an empty file or an invalid file where no data or headers are present. See Also -------- read_csv : Read a comma-separated v...
EmptyDataError
python
walkccc__LeetCode
solutions/1997. First Day Where You Have Been in All the Rooms/1997.py
{ "start": 0, "end": 788 }
class ____: def firstDayBeenInAllRooms(self, nextVisit: list[int]) -> int: MOD = 1_000_000_007 n = len(nextVisit) # dp[i] := the number of days to visit room i for the first time dp = [0] * n # Whenever we visit i, visit times of room[0..i - 1] are all even. # Therefore, the rooms before i ca...
Solution
python
h5py__h5py
h5py/tests/test_h5t.py
{ "start": 1703, "end": 6595 }
class ____(TestCase): """Test TypeFloatID.""" def test_custom_float_promotion(self): """Custom floats are correctly promoted to standard floats on read.""" # This test uses the low-level API, so we need names as byte strings test_filename = self.mktemp().encode() dataset = b'DS...
TestTypeFloatID
python
doocs__leetcode
solution/2100-2199/2160.Minimum Sum of Four Digit Number After Splitting Digits/Solution.py
{ "start": 0, "end": 233 }
class ____: def minimumSum(self, num: int) -> int: nums = [] while num: nums.append(num % 10) num //= 10 nums.sort() return 10 * (nums[0] + nums[1]) + nums[2] + nums[3]
Solution
python
tensorflow__tensorflow
tensorflow/python/ops/nn_test.py
{ "start": 60486, "end": 63070 }
class ____(test_lib.TestCase): def test1DTensor(self): x = array_ops.ones([3, 6, 5]) ksize = 2 strides = 2 y1 = nn_ops.avg_pool_v2(x, ksize, strides, "SAME") y2 = nn_ops.avg_pool1d(x, ksize, strides, "SAME") self.assertAllEqual(self.evaluate(y1), self.evaluate(y2)) def test1DNumpy(self):...
AvgPoolTest
python
PyCQA__pylint
tests/functional/u/unexpected_special_method_signature.py
{ "start": 3317, "end": 3477 }
class ____: def __init_subclass__(cls, default_name, **kwargs): super().__init_subclass__(**kwargs) cls.default_name = default_name
Philosopher
python
facebook__pyre-check
client/coverage_data.py
{ "start": 13347, "end": 13515 }
class ____(json_mixins.SnakeCaseAndExcludeJsonMixin): kind: SuppressionKind location: Location error_codes: Optional[Sequence[ErrorCode]]
TypeErrorSuppression
python
graphql-python__graphene
graphene/types/tests/test_union.py
{ "start": 203, "end": 1453 }
class ____(ObjectType): pass def test_generate_union(): class MyUnion(Union): """Documentation""" class Meta: types = (MyObjectType1, MyObjectType2) assert MyUnion._meta.name == "MyUnion" assert MyUnion._meta.description == "Documentation" assert MyUnion._meta.types =...
MyObjectType2
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 286195, "end": 286792 }
class ____(sgqlc.types.Input): """Choose which environments must be successfully deployed to before branches can be merged into a branch that matches this rule. """ __schema__ = github_schema __field_names__ = ("required_deployment_environments",) required_deployment_environments = sgqlc.types....
RequiredDeploymentsParametersInput
python
tiangolo__fastapi
scripts/sponsors.py
{ "start": 1118, "end": 1220 }
class ____(BaseModel): cursor: str node: SponsorshipAsMaintainerNode
SponsorshipAsMaintainerEdge
python
walkccc__LeetCode
solutions/1178. Number of Valid Words for Each Puzzle/1178.py
{ "start": 0, "end": 666 }
class ____: def findNumOfValidWords( self, words: list[str], puzzles: list[str], ) -> list[int]: ans = [] binaryCount = collections.Counter() for word in words: mask = 0 for c in word: mask |= 1 << ord(c) - ord('a') binaryCount[mask] += 1 for puzzle in p...
Solution
python
pypa__pip
src/pip/_vendor/rich/traceback.py
{ "start": 8278, "end": 8317 }
class ____: stacks: List[Stack]
Trace
python
airbytehq__airbyte
airbyte-integrations/connectors/source-appsflyer/source_appsflyer/source.py
{ "start": 13741, "end": 13809 }
class ____(RetargetingMixin, GeoReport): pass
RetargetingGeoReport
python
django__django
tests/model_forms/tests.py
{ "start": 83981, "end": 89043 }
class ____(TestCase): def test_modelform_onetoonefield(self): class ImprovedArticleForm(forms.ModelForm): class Meta: model = ImprovedArticle fields = "__all__" class ImprovedArticleWithParentLinkForm(forms.ModelForm): class Meta: ...
ModelOneToOneFieldTests
python
pytorch__pytorch
test/test_ops_gradients.py
{ "start": 679, "end": 4251 }
class ____(TestGradients): # Tests that gradients are computed correctly @_gradcheck_ops(op_db + hop_db + custom_op_db) def test_fn_grad(self, device, dtype, op): # This is verified by test_dtypes in test_ops.py if dtype not in op.supported_backward_dtypes(torch.device(device).type): ...
TestBwdGradients
python
huggingface__transformers
tests/models/superpoint/test_modeling_superpoint.py
{ "start": 1280, "end": 4095 }
class ____: def __init__( self, parent, batch_size=3, image_width=80, image_height=60, encoder_hidden_sizes: list[int] = [32, 32, 64, 64], decoder_hidden_size: int = 128, keypoint_decoder_dim: int = 65, descriptor_decoder_dim: int = 128, ...
SuperPointModelTester
python
huggingface__transformers
tests/models/lfm2_vl/test_image_processing_lfm2_vl.py
{ "start": 3479, "end": 11566 }
class ____(ImageProcessingTestMixin, unittest.TestCase): test_slow_image_processor = False fast_image_processing_class = Lfm2VlImageProcessorFast if is_torchvision_available() else None def setUp(self): super().setUp() self.image_processor_tester = Lfm2VlImageProcessingTester(self) @pr...
Lfm2VlImageProcessingTest
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/mysql/reflection.py
{ "start": 864, "end": 1317 }
class ____: """Stores raw information about a SHOW CREATE TABLE statement.""" charset: Optional[str] def __init__(self) -> None: self.columns: list[ReflectedColumn] = [] self.table_options: dict[str, str] = {} self.table_name: Optional[str] = None self.keys: list[dict[str, ...
ReflectedState
python
scipy__scipy
scipy/linalg/tests/test_decomp_update.py
{ "start": 66231, "end": 66294 }
class ____(BaseQRupdate): dtype = np.dtype('f')
TestQRupdate_f
python
bokeh__bokeh
src/bokeh/models/widgets/inputs.py
{ "start": 17620, "end": 17968 }
class ____(InputWidget): ''' Color picker widget. ''' # explicit __init__ to support Init signatures def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) color = ColorHex(default='#000000', help=""" The initial color of the picked color (named or he...
ColorPicker
python
huggingface__transformers
src/transformers/testing_utils.py
{ "start": 55532, "end": 55710 }
class ____(CaptureStd): """Same as CaptureStd but captures only stderr""" def __init__(self, replay=True): super().__init__(out=False, replay=replay)
CaptureStderr
python
conda__conda
conda/gateways/repodata/jlap/fetch.py
{ "start": 1353, "end": 5502 }
class ____(LookupError): pass def process_jlap_response(response: Response, pos=0, iv=b""): # if response is 304 Not Modified, could return a buffer with only the # cached footer... if response.status_code == 304: raise Jlap304NotModified() def lines() -> Iterator[bytes]: yield fr...
JlapPatchNotFound
python
astropy__astropy
astropy/modeling/projections.py
{ "start": 7092, "end": 7649 }
class ____(Projection): r"""Base class for all Zenithal projections. Zenithal (or azimuthal) projections map the sphere directly onto a plane. All zenithal projections are specified by defining the radius as a function of native latitude, :math:`R_\theta`. The pixel-to-sky transformation is defin...
Zenithal
python
tensorflow__tensorflow
tensorflow/examples/custom_ops_doc/multiplex_1/multiplex_1_test.py
{ "start": 1133, "end": 5151 }
class ____(tf.test.TestCase): @test_util.run_in_graph_and_eager_modes def test_multiplex_int(self): a = tf.constant([1, 2, 3, 4, 5]) b = tf.constant([10, 20, 30, 40, 50]) cond = tf.constant([True, False, True, False, True], dtype=bool) expect = np.where(self.evaluate(cond), self.evaluate(a), self.e...
MultiplexOpRank1Test
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typeVar10.py
{ "start": 122, "end": 174 }
class ____: def method(self, x: "A") -> "A": ...
A
python
joke2k__faker
tests/providers/test_bank.py
{ "start": 12430, "end": 12505 }
class ____(TestEnPh): """Test fil_PH bank provider""" pass
TestFilPh
python
urllib3__urllib3
src/urllib3/exceptions.py
{ "start": 8601, "end": 8686 }
class ____(HTTPError): """The header provided was somehow invalid."""
InvalidHeader
python
huggingface__transformers
src/transformers/models/rt_detr_v2/modeling_rt_detr_v2.py
{ "start": 79810, "end": 80858 }
class ____(nn.Module): """ Very simple multi-layer perceptron (MLP, also called FFN), used to predict the normalized center coordinates, height and width of a bounding box w.r.t. an image. Copied from https://github.com/facebookresearch/detr/blob/master/models/detr.py Origin from https://github.com...
RTDetrV2MLPPredictionHead
python
plotly__plotly.py
plotly/express/_special_inputs.py
{ "start": 0, "end": 590 }
class ____(object): """ `dict`-like object which acts as if the value for any key is the key itself. Objects of this class can be passed in to arguments like `color_discrete_map` to use the provided data values as colors, rather than mapping them to colors cycled from `color_discrete_sequence`. This...
IdentityMap
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/vision.py
{ "start": 17594, "end": 21981 }
class ____(GoogleCloudBaseOperator): """ Create and return a new product resource. Possible errors regarding the ``Product`` object provided: - Returns ``INVALID_ARGUMENT`` if ``display_name`` is missing or longer than 4096 characters. - Returns ``INVALID_ARGUMENT`` if ``description`` is longer th...
CloudVisionCreateProductOperator
python
pyinstaller__pyinstaller
tests/functional/scripts/pyi_osx_aevent_logger_carbon.py
{ "start": 3780, "end": 11725 }
class ____: def __init__(self): # Get runtime from command-line (first and only positional argument; filter our -psn_*** if it is present). self.runtime = 15 filtered_args = [arg for arg in sys.argv[1:] if not arg.startswith('-psn')] if filtered_args: try: ...
Application
python
numpy__numpy
numpy/lib/_index_tricks_impl.py
{ "start": 8755, "end": 10299 }
class ____(nd_grid): """ An instance which returns an open multi-dimensional "meshgrid". An instance which returns an open (i.e. not fleshed out) mesh-grid when indexed, so that only one dimension of each returned array is greater than 1. The dimension and number of the output arrays are equal...
OGridClass
python
falconry__falcon
tests/asgi/test_asgi_servers.py
{ "start": 979, "end": 6830 }
class ____: def test_get(self, server_base_url, requests): resp = requests.get(server_base_url, timeout=_REQUEST_TIMEOUT) assert resp.status_code == 200 assert resp.text == '127.0.0.1' def test_put(self, server_base_url, requests): body = '{}' resp = requests.put(server_...
TestASGIServer
python
airbytehq__airbyte
airbyte-integrations/connectors/source-adjust/source_adjust/components.py
{ "start": 265, "end": 980 }
class ____(JsonFileSchemaLoader): config: Mapping[str, Any] def get_json_schema(self) -> Mapping[str, Any]: """ Prune the schema to only include selected fields to synchronize. """ schema = source_adjust.model.Report.schema() properties = schema["properties"] re...
AdjustSchemaLoader
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 581707, "end": 582064 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("client_mutation_id", "labelable") client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId") labelable = sgqlc.types.Field(Labelable, graphql_name="label...
RemoveLabelsFromLabelablePayload
python
tensorflow__tensorflow
tensorflow/python/client/session_test.py
{ "start": 3138, "end": 83472 }
class ____(test_util.TensorFlowTestCase): def setUp(self): super(SessionTest, self).setUp() warnings.simplefilter('always') def testUseExistingGraph(self): with ops.Graph().as_default() as g, ops.device('/cpu:0'): a = constant_op.constant(6.0, shape=[1, 1]) b = constant_op.constant(7.0, sh...
SessionTest
python
ansible__ansible
lib/ansible/plugins/strategy/__init__.py
{ "start": 52263, "end": 55157 }
class ____(cmd.Cmd): prompt_continuous = '> ' # multiple lines def __init__(self, task, host, task_vars, play_context, result, next_action): # cmd.Cmd is old-style class cmd.Cmd.__init__(self) self.prompt = '[%s] %s (debug)> ' % (host, task) self.intro = None self.scop...
Debugger
python
walkccc__LeetCode
solutions/2157. Groups of Strings/2157.py
{ "start": 530, "end": 1554 }
class ____: def groupStrings(self, words: list[str]) -> list[int]: uf = UnionFind(len(words)) def getMask(s: str) -> int: mask = 0 for c in s: mask |= 1 << ord(c) - ord('a') return mask def getAddedMasks(mask: int): for i in range(26): if not (mask >> i & 1): ...
Solution
python
plotly__plotly.py
plotly/graph_objs/ohlc/legendgrouptitle/_font.py
{ "start": 233, "end": 9911 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "ohlc.legendgrouptitle" _path_str = "ohlc.legendgrouptitle.font" _valid_props = { "color", "family", "lineposition", "shadow", "size", "style", "textcase", "variant", "weight", ...
Font
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/class_interval.py
{ "start": 2632, "end": 2755 }
class ____: def m1(self): return self.m0() # Interval: [2,5] /\ [1,8] = [2,5] def m0(self): pass
A6
python
PrefectHQ__prefect
src/prefect/exceptions.py
{ "start": 3119, "end": 3313 }
class ____(PrefectException): """ Raised when a result is missing from a state; often when result persistence is disabled and the state is retrieved from the API. """
MissingResult
python
cython__cython
Cython/Compiler/Nodes.py
{ "start": 268265, "end": 268656 }
class ____(StatNode): # Nonlocal variable declaration via the 'nonlocal' keyword. # # names [string] child_attrs = [] def analyse_declarations(self, env): for name in self.names: env.declare_nonlocal(name, self.pos) def analyse_expressions(self, env): return sel...
NonlocalNode
python
wandb__wandb
wandb/automations/_filters/run_metrics.py
{ "start": 6969, "end": 11821 }
class ____(GQLBase, ABC, extra="forbid"): def gt(self, value: int | float, /) -> MetricThresholdFilter: """Returns a filter that watches for `metric_expr > threshold`.""" return self > value def lt(self, value: int | float, /) -> MetricThresholdFilter: """Returns a filter that watches f...
BaseMetricOperand
python
python__mypy
mypy/errors.py
{ "start": 12233, "end": 48473 }
class ____: """Container for compile errors. This class generates and keeps tracks of compile errors and the current error context (nested imports). """ # Map from files to generated error messages. Is an OrderedDict so # that it can be used to order messages based on the order the # files...
Errors
python
encode__django-rest-framework
rest_framework/validators.py
{ "start": 3775, "end": 8529 }
class ____: """ Validator that corresponds to `unique_together = (...)` on a model class. Should be applied to the serializer class, not to an individual field. """ message = _('The fields {field_names} must make a unique set.') missing_message = _('This field is required.') requires_contex...
UniqueTogetherValidator
python
python-openxml__python-docx
src/docx/oxml/simpletypes.py
{ "start": 10736, "end": 10783 }
class ____(XsdString): pass
ST_RelationshipId
python
allegroai__clearml
clearml/backend_api/services/v2_9/projects.py
{ "start": 54213, "end": 57404 }
class ____(Response): """ Response of projects.get_by_id endpoint. :param project: Project info :type project: Project """ _service = "projects" _action = "get_by_id" _version = "2.9" _schema = { "definitions": { "project": { "properties": { ...
GetByIdResponse
python
kamyu104__LeetCode-Solutions
Python/longest-consecutive-sequence.py
{ "start": 29, "end": 531 }
class ____(object): # @param num, a list of integer # @return an integer def longestConsecutive(self, num): result, lengths = 1, {key: 0 for key in num} for i in num: if lengths[i] == 0: lengths[i] = 1 left, right = lengths.get(i - 1, 0), lengths.g...
Solution
python
sympy__sympy
sympy/functions/combinatorial/numbers.py
{ "start": 2519, "end": 7094 }
class ____(DefinedFunction): r""" Carmichael Numbers: Certain cryptographic algorithms make use of big prime numbers. However, checking whether a big number is prime is not so easy. Randomized prime number checking tests exist that offer a high degree of confidence of accurate determination at ...
carmichael
python
getsentry__sentry
src/sentry/deletions/manager.py
{ "start": 272, "end": 1571 }
class ____: def __init__(self, default_task: type[BaseDeletionTask[Any]] | None = None) -> None: self.tasks: MutableMapping[type[Model], type[BaseDeletionTask[Any]]] = {} self.default_task = default_task def exec_sync(self, instance: Model) -> None: task = self.get( model=ty...
DeletionTaskManager
python
pytest-dev__pytest
doc/en/example/fixtures/test_fixtures_request_different_scope.py
{ "start": 166, "end": 341 }
class ____: @pytest.fixture def inner(self, order): order.append("one") def test_order(self, order, outer): assert order == ["one", "outer"]
TestOne
python
PyCQA__pylint
tests/functional/c/consider/consider_using_enumerate.py
{ "start": 449, "end": 1807 }
class ____: def __iter__(self): iterable = [1, 2, 3] for i in range(len(iterable)): # [consider-using-enumerate] yield iterable[i] def test(self): for i in range(len(self)): # [consider-using-enumerate] yield self[i] def good(): iterable = other_obj = [1, ...
Bad
python
django__django
tests/model_package/tests.py
{ "start": 382, "end": 2624 }
class ____(TestCase): def test_m2m_tables_in_subpackage_models(self): """ Regression for #12168: models split into subpackages still get M2M tables. """ p = Publication.objects.create(title="FooBar") site = Site.objects.create(name="example.com") a = Article...
ModelPackageTests
python
astropy__astropy
astropy/units/tests/test_quantity_non_ufuncs.py
{ "start": 100874, "end": 100965 }
class ____(CheckSignatureCompatibilityBase): pass
TestFunctionHelpersSignatureCompatibility
python
prompt-toolkit__python-prompt-toolkit
examples/prompts/custom-lexer.py
{ "start": 251, "end": 727 }
class ____(Lexer): def lex_document(self, document): colors = sorted(NAMED_COLORS, key=NAMED_COLORS.get) def get_line(lineno): return [ (colors[i % len(colors)], c) for i, c in enumerate(document.lines[lineno]) ] return get_line def...
RainbowLexer
python
pypa__setuptools
setuptools/config/_validate_pyproject/extra_validations.py
{ "start": 691, "end": 2858 }
class ____(ValidationError): _DESC = """An included dependency group must exist and must not be cyclic. """ __doc__ = _DESC _URL = "https://peps.python.org/pep-0735/" def validate_project_dynamic(pyproject: T) -> T: project_table = pyproject.get("project", {}) dynamic = project_table.get("dyna...
IncludedDependencyGroupMustExist
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/inspection.py
{ "start": 2495, "end": 5051 }
class ____(Protocol[_TCov]): """a protocol defining a method that's used when an instance is passed to inspect(). """ def _sa_inspect_instance(self) -> _TCov: ... @overload def inspect( subject: Type[_InspectableTypeProtocol[_IN]], raiseerr: bool = True ) -> _IN: ... @overload def inspect( ...
_InspectableProtocol
python
tensorflow__tensorflow
tensorflow/python/autograph/utils/tensors_test.py
{ "start": 1058, "end": 2605 }
class ____(test.TestCase): def _simple_tensor_array(self): return tensor_array_ops.TensorArray(dtypes.int32, size=3) def _simple_tensor_list(self): return list_ops.empty_tensor_list( element_shape=constant_op.constant([1]), element_dtype=dtypes.int32) def _simple_list_of_tensors(self): retu...
TensorsTest
python
patrick-kidger__equinox
equinox/internal/_noinline.py
{ "start": 11163, "end": 15289 }
class ____(Module): dynamic_index: Int[Array | np.ndarray, ""] abstract_fn: Callable = field(static=True) dynamic_fn: Any @property def __wrapped__(self): return self.abstract_fn def __call__(self, *args, **kwargs): return filter_primitive_bind( noinline_p, ...
_NoInlineWrapper
python
spack__spack
lib/spack/spack/test/repo.py
{ "start": 12593, "end": 18053 }
class ____: def test_creation_from_string(self, mock_test_cache): repo = spack.repo.RepoPath.from_descriptors( spack.repo.RepoDescriptors( { "builtin_mock": spack.repo.LocalRepoDescriptor( "builtin_mock", spack.paths.mock_packages_path ...
TestRepoPath
python
plotly__plotly.py
plotly/graph_objs/_ohlc.py
{ "start": 215, "end": 64394 }
class ____(_BaseTraceType): _parent_path_str = "" _path_str = "ohlc" _valid_props = { "close", "closesrc", "customdata", "customdatasrc", "decreasing", "high", "highsrc", "hoverinfo", "hoverinfosrc", "hoverlabel", "hover...
Ohlc
python
python__mypy
mypyc/rt_subtype.py
{ "start": 1037, "end": 2448 }
class ____(RTypeVisitor[bool]): """Is left a runtime subtype of right? A few special cases such as right being 'object' are handled in is_runtime_subtype and don't need to be covered here. """ def __init__(self, right: RType) -> None: self.right = right def visit_rinstance(self, left:...
RTSubtypeVisitor
python
sqlalchemy__sqlalchemy
test/ext/test_hybrid.py
{ "start": 22879, "end": 24023 }
class ____(fixtures.TestBase, AssertsCompiledSQL): __dialect__ = "default" def _fixture(self, assignable): Base = declarative_base() class A(Base): __tablename__ = "a" id = Column(Integer, primary_key=True) _value = Column("value", String) @hybr...
PropertyValueTest
python
pypa__pipenv
pipenv/patched/pip/_internal/index/sources.py
{ "start": 829, "end": 1409 }
class ____: @property def link(self) -> Optional[Link]: """Returns the underlying link, if there's one.""" raise NotImplementedError() def page_candidates(self) -> FoundCandidates: """Candidates found by parsing an archive listing HTML file.""" raise NotImplementedError() ...
LinkSource
python
huggingface__transformers
tests/models/dia/test_processing_dia.py
{ "start": 1291, "end": 11393 }
class ____(unittest.TestCase): def setUp(self): self.checkpoint = "AntonV/Dia-1.6B" self.audio_tokenizer_checkpoint = "descript/dac_44khz" self.tmpdirname = tempfile.mkdtemp() # Audio tokenizer is a bigger model so we will reuse this if possible self.processor = DiaProcessor...
DiaProcessorTest
python
scikit-learn__scikit-learn
sklearn/feature_selection/_variance_threshold.py
{ "start": 431, "end": 4688 }
class ____(SelectorMixin, BaseEstimator): """Feature selector that removes all low-variance features. This feature selection algorithm looks only at the features (X), not the desired outputs (y), and can thus be used for unsupervised learning. Read more in the :ref:`User Guide <variance_threshold>`. ...
VarianceThreshold
python
Pylons__pyramid
src/pyramid/interfaces.py
{ "start": 24448, "end": 24598 }
class ____(Interface): """*internal only* interface used as in a utility lookup to find route-specific interfaces. Not an API."""
IRouteRequest