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
sphinx-doc__sphinx
sphinx/builders/linkcheck.py
{ "start": 1446, "end": 1986 }
class ____(StrEnum): BROKEN = 'broken' IGNORED = 'ignored' RATE_LIMITED = 'rate-limited' REDIRECTED = 'redirected' TIMEOUT = 'timeout' UNCHECKED = 'unchecked' UNKNOWN = 'unknown' WORKING = 'working' logger = logging.getLogger(__name__) # matches to foo:// and // (a protocol relative U...
_Status
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/pubsub.py
{ "start": 27517, "end": 32447 }
class ____(GoogleCloudBaseOperator): """ Publish messages to a PubSub topic. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:PubSubPublishMessageOperator` Each Task publishes all provided messages to the same topic in a ...
PubSubPublishMessageOperator
python
scipy__scipy
scipy/io/tests/test_wavfile.py
{ "start": 12301, "end": 19094 }
class ____: def __init__(self, fp): self.fp = fp def seekable(self): return False def read(self, size=-1, /): return self.fp.read(size) def close(self): self.fp.close() def test_streams(): for filename in ['test-44100Hz-le-1ch-4bytes.wav', ...
Nonseekable
python
google__pytype
pytype/tests/test_methods1.py
{ "start": 134, "end": 25909 }
class ____(test_base.BaseTest): """Tests for methods.""" def test_flow_and_replacement_sanity(self): self.Check(""" def f(x): if x: x = 42 y = x x = 1 return x + 4 assert_type(f(4), int) """) def test_multiple_returns(self): self.Check(""" ...
MethodsTest
python
apache__airflow
airflow-core/tests/unit/models/test_cleartasks.py
{ "start": 1800, "end": 27998 }
class ____: @pytest.fixture(autouse=True, scope="class") def clean(self): db.clear_db_runs() db.clear_db_serialized_dags() yield db.clear_db_runs() db.clear_db_serialized_dags() def test_clear_task_instances(self, dag_maker): # Explicitly needs catchup as T...
TestClearTasks
python
kamyu104__LeetCode-Solutions
Python/find-resultant-array-after-removing-anagrams.py
{ "start": 516, "end": 947 }
class ____(object): def removeAnagrams(self, words): """ :type words: List[str] :rtype: List[str] """ result = [] prev = None for x in words: s = sorted(x) if prev and prev == s: continue prev = s ...
Solution2
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/postgresql/json.py
{ "start": 7597, "end": 14430 }
class ____(JSON): """Represent the PostgreSQL JSONB type. The :class:`_postgresql.JSONB` type stores arbitrary JSONB format data, e.g.:: data_table = Table( "data_table", metadata, Column("id", Integer, primary_key=True), Column("data", JSONB), ...
JSONB
python
modin-project__modin
modin/core/execution/python/common/engine_wrapper.py
{ "start": 849, "end": 2810 }
class ____: """Python engine wrapper serving for the compatibility purpose with other engines.""" @classmethod def deploy(cls, func, f_args=None, f_kwargs=None, num_returns=1): """ Run the passed function. Parameters ---------- func : callable f_args : seque...
PythonWrapper
python
pexpect__pexpect
tests/test_which.py
{ "start": 169, "end": 10913 }
class ____(PexpectTestCase.PexpectTestCase): " Tests for pexpect.which(). " def test_which_finds_ls(self): " which() can find ls(1). " exercise = pexpect.which("ls") assert exercise is not None assert exercise.startswith('/') def test_path_from_env(self): " executab...
TestCaseWhich
python
apache__airflow
task-sdk/src/airflow/sdk/api/datamodels/_generated.py
{ "start": 1191, "end": 1437 }
class ____(BaseModel): """ Schema for AssetAliasModel used in AssetEventDagRunReference. """ model_config = ConfigDict( extra="forbid", ) name: Annotated[str, Field(title="Name")]
AssetAliasReferenceAssetEventDagRun
python
google__pytype
pytype/tests/test_tracebacks1.py
{ "start": 95, "end": 2363 }
class ____(test_base.BaseTest): """Tests for tracebacks in error messages.""" def test_no_traceback(self): errors = self.CheckWithErrors(""" def f(x): "hello" + 42 # unsupported-operands[e] f("world") """) self.assertErrorRegexes(errors, {"e": r"expects str$"}) def test_same_tra...
TracebackTest
python
Textualize__textual
docs/examples/guide/screens/screen01.py
{ "start": 643, "end": 840 }
class ____(App): CSS_PATH = "screen01.tcss" SCREENS = {"bsod": BSOD} BINDINGS = [("b", "push_screen('bsod')", "BSOD")] if __name__ == "__main__": app = BSODApp() app.run()
BSODApp
python
doocs__leetcode
solution/1100-1199/1136.Parallel Courses/Solution.py
{ "start": 0, "end": 659 }
class ____: def minimumSemesters(self, n: int, relations: List[List[int]]) -> int: g = defaultdict(list) indeg = [0] * n for prev, nxt in relations: prev, nxt = prev - 1, nxt - 1 g[prev].append(nxt) indeg[nxt] += 1 q = deque(i for i, v in enumerate...
Solution
python
getsentry__sentry
src/sentry/flags/models.py
{ "start": 2092, "end": 3494 }
class ____(Model): __relocation_scope__ = RelocationScope.Excluded ACTION_TYPES = ( (ActionEnum.CREATED, "created"), (ActionEnum.UPDATED, "updated"), (ActionEnum.DELETED, "deleted"), ) CREATED_BY_TYPE_TYPES = ( (CreatedByTypeEnum.EMAIL, "email"), (CreatedByTypeEn...
FlagAuditLogModel
python
apache__airflow
shared/secrets_masker/src/airflow_shared/secrets_masker/secrets_masker.py
{ "start": 6182, "end": 22123 }
class ____(logging.Filter): """Redact secrets from logs.""" replacer: Pattern | None = None patterns: set[str] ALREADY_FILTERED_FLAG = "__SecretsMasker_filtered" MAX_RECURSION_DEPTH = 5 _has_warned_short_secret = False mask_secrets_in_logs = False min_length_to_mask = 5 secret_mas...
SecretsMasker
python
pytest-dev__pytest
src/_pytest/_code/code.py
{ "start": 45900, "end": 46703 }
class ____(ExceptionRepr): chain: Sequence[tuple[ReprTraceback, ReprFileLocation | None, str | None]] def __init__( self, chain: Sequence[tuple[ReprTraceback, ReprFileLocation | None, str | None]], ) -> None: # reprcrash and reprtraceback of the outermost (the newest) exception ...
ExceptionChainRepr
python
doocs__leetcode
solution/1100-1199/1156.Swap For Longest Repeated Character Substring/Solution.py
{ "start": 0, "end": 475 }
class ____: def maxRepOpt1(self, text: str) -> int: cnt = Counter(text) n = len(text) ans = i = 0 while i < n: j = i while j < n and text[j] == text[i]: j += 1 l = j - i k = j + 1 while k < n and text[k] == t...
Solution
python
huggingface__transformers
tests/models/qwen3_vl/test_modeling_qwen3_vl.py
{ "start": 6196, "end": 11860 }
class ____(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): """ Model tester for `Qwen3VLForConditionalGeneration`. """ all_model_classes = ( ( Qwen3VLModel, Qwen3VLForConditionalGeneration, ) if is_torch_available() else () ) ...
Qwen3VLModelTest
python
pola-rs__polars
py-polars/src/polars/lazyframe/engine_config.py
{ "start": 214, "end": 1925 }
class ____: """ Configuration options for the GPU execution engine. Use this if you want control over details of the execution. Parameters ---------- device : int, default None Select the GPU used to run the query. If not provided, the query uses the current CUDA device. me...
GPUEngine
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/memberAccess14.py
{ "start": 1174, "end": 1440 }
class ____(C[float]): ... reveal_type(C.prop, expected_text="CachedSlotProperty[C[Unknown], int]") reveal_type(D.prop, expected_text="CachedSlotProperty[D, int]") c = C("") reveal_type(c.prop, expected_text="int") d = D(1) reveal_type(d.prop, expected_text="int")
D
python
huggingface__transformers
tests/models/blt/test_modeling_blt.py
{ "start": 8812, "end": 18339 }
class ____(unittest.TestCase): def setup(self): cleanup(torch_device, gc_collect=True) def tearDown(self): # TODO (joao): automatic compilation, i.e. compilation when `cache_implementation="static"` is used, leaves # some memory allocated in the cache, which means some object is not bei...
BltIntegrationTest
python
pytorch__pytorch
test/dynamo/test_modules.py
{ "start": 23968, "end": 24333 }
class ____(torch.nn.Module): def __init__(self) -> None: super().__init__() self.linear1 = torch.nn.Linear(10, 10) def forward(self, x): if self.__class__.__name__ == "ABC": return 10 if self.linear1.__class__.__name__ == "Linear": return F.relu(self.line...
ModuleNameString
python
FactoryBoy__factory_boy
factory/builder.py
{ "start": 10091, "end": 12923 }
class ____: """Resolve a set of declarations. Attributes are set at instantiation time, values are computed lazily. Attributes: __initialized (bool): whether this object's __init__ as run. If set, setting any attribute will be prevented. __declarations (dict): maps attribute na...
Resolver
python
Netflix__metaflow
metaflow/flowspec.py
{ "start": 2176, "end": 2378 }
class ____(Enum): FLOW_MUTATORS = 1 FLOW_DECORATORS = 2 CONFIGS = 3 CACHED_PARAMETERS = 4 SET_CONFIG_PARAMETERS = 5 # Parameters that now have a ConfigValue (converted)
FlowStateItems
python
optuna__optuna
optuna/samplers/_partial_fixed.py
{ "start": 472, "end": 3862 }
class ____(BaseSampler): """Sampler with partially fixed parameters. Example: After several steps of optimization, you can fix the value of ``y`` and re-optimize it. .. testcode:: import optuna def objective(trial): x = trial.suggest_float("x", -1, 1...
PartialFixedSampler
python
encode__django-rest-framework
tests/test_permissions.py
{ "start": 941, "end": 1209 }
class ____(generics.RetrieveUpdateDestroyAPIView): queryset = BasicModel.objects.all() serializer_class = BasicSerializer authentication_classes = [authentication.BasicAuthentication] permission_classes = [permissions.DjangoModelPermissions]
InstanceView
python
falconry__falcon
tests/asgi/test_request_body_asgi.py
{ "start": 308, "end": 3597 }
class ____: def test_empty_body(self, client, resource): client.app.add_route('/', resource) client.simulate_request(path='/', body='') stream = resource.captured_req.stream assert stream.tell() == 0 def test_tiny_body(self, client, resource): client.app.add_route('/', r...
TestRequestBody
python
sqlalchemy__sqlalchemy
test/sql/test_metadata.py
{ "start": 75060, "end": 80909 }
class ____(fixtures.TestBase): def test_multi_integer_no_autoinc(self): pk = PrimaryKeyConstraint(Column("a", Integer), Column("b", Integer)) t = Table("t", MetaData()) t.append_constraint(pk) is_(pk._autoincrement_column, None) def test_multi_integer_multi_autoinc(self): ...
PKAutoIncrementTest
python
plotly__plotly.py
plotly/graph_objs/layout/mapbox/_bounds.py
{ "start": 235, "end": 4635 }
class ____(_BaseLayoutHierarchyType): _parent_path_str = "layout.mapbox" _path_str = "layout.mapbox.bounds" _valid_props = {"east", "north", "south", "west"} @property def east(self): """ Sets the maximum longitude of the map (in degrees East) if `west`, `south` and `north` ...
Bounds
python
readthedocs__readthedocs.org
readthedocs/notifications/migrations/0003_notification_indexes.py
{ "start": 148, "end": 691 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("notifications", "0002_notification_format_values"), ] operations = [ migrations.AlterModelOptions( name="notification", options={}, ), migrations.AddIndex( ...
Migration
python
pytorch__pytorch
tools/test/heuristics/test_interface.py
{ "start": 349, "end": 1169 }
class ____(unittest.TestCase): def assert_test_scores_almost_equal( self, d1: dict[TestRun, float], d2: dict[TestRun, float] ) -> None: # Check that dictionaries are the same, except for floating point errors self.assertEqual(set(d1.keys()), set(d2.keys())) for k, v in d1.items()...
TestTD
python
django-import-export__django-import-export
tests/core/tests/test_resources/test_modelresource/test_resource_transactions.py
{ "start": 340, "end": 4414 }
class ____(TransactionTestCase): @skipUnlessDBFeature("supports_transactions") def test_m2m_import_with_transactions(self): resource = BookResource() cat1 = Category.objects.create(name="Cat 1") headers = ["id", "name", "categories"] row = [None, "FooBook", str(cat1.pk)] ...
ModelResourceTransactionTest
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/dagster_types.py
{ "start": 3639, "end": 3792 }
class ____(graphene.ObjectType): class Meta: interfaces = (GrapheneDagsterType,) name = "RegularDagsterType"
GrapheneRegularDagsterType
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/orm/bulk_persistence.py
{ "start": 65889, "end": 73478 }
class ____(_BulkUDCompileState, DeleteDMLState): @classmethod def create_for_statement(cls, statement, compiler, **kw): self = cls.__new__(cls) dml_strategy = statement._annotations.get( "dml_strategy", "unspecified" ) if ( dml_strategy == "core_only" ...
_BulkORMDelete
python
rapidsai__cudf
python/dask_cudf/dask_cudf/_expr/collection.py
{ "start": 567, "end": 2452 }
class ____(FrameBase): def _prepare_cov_corr(self, min_periods, numeric_only): # Upstream version of this method sets min_periods # to 2 by default (which is not supported by cudf) # TODO: Remove when cudf supports both min_periods # and numeric_only # See: https://github.com...
CudfFrameBase
python
mkdocs__mkdocs
mkdocs/config/config_options.py
{ "start": 10199, "end": 10858 }
class ____(ListOfItems[LegacyConfig]): """ Deprecated: Use `ListOfItems(SubConfig(...))` instead of `ConfigItems(...)`. Validates a list of mappings that all must match the same set of options. """ @overload def __init__(self, *config_options: PlainConfigSchemaItem): ... @over...
ConfigItems
python
kamyu104__LeetCode-Solutions
Python/rectangle-overlap.py
{ "start": 29, "end": 455 }
class ____(object): def isRectangleOverlap(self, rec1, rec2): """ :type rec1: List[int] :type rec2: List[int] :rtype: bool """ def intersect(p_left, p_right, q_left, q_right): return max(p_left, q_left) < min(p_right, q_right) return (intersect(re...
Solution
python
kubernetes-client__python
kubernetes/client/models/v1_weighted_pod_affinity_term.py
{ "start": 383, "end": 4882 }
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...
V1WeightedPodAffinityTerm
python
openai__openai-python
tests/test_transform.py
{ "start": 1247, "end": 1286 }
class ____(TypedDict): bar: Bar2
Foo2
python
scipy__scipy
scipy/stats/_continuous_distns.py
{ "start": 347596, "end": 349337 }
class ____(rv_continuous): r"""A Tukey-Lamdba continuous random variable. %(before_notes)s Notes ----- A flexible distribution, able to represent and interpolate between the following distributions: - Cauchy (:math:`lambda = -1`) - logistic (:math:`lambda =...
tukeylambda_gen
python
getlogbook__logbook
src/logbook/ticketing.py
{ "start": 3187, "end": 10725 }
class ____(BackendBase): """Implements a backend that is writing into a database SQLAlchemy can interface. This backend takes some additional options: `table_prefix` an optional table prefix for all tables created by the logbook ticketing handler. `metadata` an optional SQ...
SQLAlchemyBackend
python
facebookresearch__faiss
tests/test_clustering.py
{ "start": 5332, "end": 7765 }
class ____(unittest.TestCase): def test_redo(self): d = 64 n = 1000 rs = np.random.RandomState(123) x = rs.uniform(size=(n, d)).astype('float32') # make sure that doing 10 redos yields a better objective than just 1 clus = faiss.Clustering(d, 20) clus.nred...
TestCompositeClustering
python
PrefectHQ__prefect
src/prefect/serializers.py
{ "start": 4517, "end": 5445 }
class ____(Serializer[D]): """ Serializes objects using the pickle protocol. - Uses `cloudpickle` by default. See `picklelib` for using alternative libraries. - Stores the version of the pickle library to check for compatibility during deserialization. - Wraps pickles in base64 for safe tra...
PickleSerializer
python
huggingface__transformers
src/transformers/models/switch_transformers/configuration_switch_transformers.py
{ "start": 777, "end": 9054 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`SwitchTransformersModel`]. It is used to instantiate a SwitchTransformers model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will...
SwitchTransformersConfig
python
urllib3__urllib3
test/test_no_ssl.py
{ "start": 380, "end": 729 }
class ____: @classmethod def setup_class(cls) -> None: sys.modules.pop("ssl", None) sys.modules.pop("_ssl", None) module_stash.stash() sys.meta_path.insert(0, ssl_blocker) @classmethod def teardown_class(cls) -> None: sys.meta_path.remove(ssl_blocker) mo...
TestWithoutSSL
python
pydata__xarray
xarray/backends/memory.py
{ "start": 207, "end": 1525 }
class ____(AbstractWritableDataStore): """ Stores dimensions, variables and attributes in ordered dictionaries, making this store fast compared to stores which save to disk. This store exists purely for internal testing purposes. """ def __init__(self, variables=None, attributes=None): ...
InMemoryDataStore
python
django-compressor__django-compressor
compressor/exceptions.py
{ "start": 684, "end": 812 }
class ____(Exception): """ This exception is raised when a template does not exist. """ pass
TemplateDoesNotExist
python
plotly__plotly.py
plotly/graph_objs/_deprecations.py
{ "start": 4554, "end": 5461 }
class ____(dict): """ plotly.graph_objs.ColorBar is deprecated. Please replace it with one of the following more specific types - plotly.graph_objs.scatter.marker.ColorBar - plotly.graph_objs.surface.ColorBar - etc. """ def __init__(self, *args, **kwargs): """ ...
ColorBar
python
getsentry__sentry
src/sentry/integrations/opsgenie/integration.py
{ "start": 4922, "end": 9533 }
class ____(IntegrationInstallation): def get_keyring_client(self, keyid: int | str) -> OpsgenieClient: org_integration = self.org_integration assert org_integration, "OrganizationIntegration is required" team = get_team(team_id=keyid, org_integration=org_integration) assert team, "Ca...
OpsgenieIntegration
python
astropy__astropy
astropy/convolution/tests/test_convolve.py
{ "start": 14928, "end": 24946 }
class ____: def test_list(self): """ Test that convolve works correctly when inputs are lists """ x = [[1, 1, 1], [1, 1, 1], [1, 1, 1]] z = convolve(x, x, boundary="fill", fill_value=1, normalize_kernel=True) assert_array_almost_equal_nulp(z, x, 10) z = convo...
TestConvolve2D
python
walkccc__LeetCode
solutions/461. Hamming Distance/461.py
{ "start": 0, "end": 182 }
class ____: def hammingDistance(self, x: int, y: int) -> int: ans = 0 while x > 0 or y > 0: ans += (x & 1) ^ (y & 1) x >>= 1 y >>= 1 return ans
Solution
python
jina-ai__jina
jina/proto/docarray_v1/pb/jina_pb2_grpc.py
{ "start": 4250, "end": 5205 }
class ____(object): """* jina gRPC service for DataRequests. This is used to send requests to Executors when a list of requests is not needed """ @staticmethod def process_single_data( request, target, options=(), channel_credentials=None, call_credential...
JinaSingleDataRequestRPC
python
Lightning-AI__lightning
src/lightning/fabric/plugins/precision/amp.py
{ "start": 1155, "end": 5052 }
class ____(Precision): """Plugin for Automatic Mixed Precision (AMP) training with ``torch.autocast``. Args: precision: Whether to use ``torch.float16`` (``'16-mixed'``) or ``torch.bfloat16`` (``'bf16-mixed'``). device: The device for ``torch.autocast``. scaler: An optional :class:`torc...
MixedPrecision
python
dagster-io__dagster
python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/generated/sources.py
{ "start": 104717, "end": 106018 }
class ____(GeneratedAirbyteSource): @public def __init__( self, name: str, username: str, password: str, database: str, account: Optional[str] = None, host: Optional[str] = None, engine: Optional[str] = None, ): """Airbyte Source for Fi...
FireboltSource
python
jazzband__django-polymorphic
example/orders/models.py
{ "start": 175, "end": 517 }
class ____(models.Model): """ An example order that has polymorphic relations """ title = models.CharField(_("Title"), max_length=200) class Meta: verbose_name = _("Organisation") verbose_name_plural = _("Organisations") ordering = ("title",) def __str__(self): ...
Order
python
dagster-io__dagster
examples/docs_snippets/docs_snippets/concepts/ops_jobs_graphs/unit_tests.py
{ "start": 49, "end": 99 }
class ____(dg.Config): num: int = 1
AddOneConfig
python
PrefectHQ__prefect
tests/utilities/schema_tools/test_validation.py
{ "start": 14841, "end": 15998 }
class ____: @pytest.fixture def schema(self) -> dict: return { "title": "Parameters", "type": "object", "properties": { "param": {"title": "param", "position": 0, "type": "array", "items": {}} }, "required": ["param"], }...
TestArray
python
fluentpython__example-code-2e
11-pythonic-obj/vector2d_v3_slots.py
{ "start": 1749, "end": 3319 }
class ____: __match_args__ = ('x', 'y') # <1> __slots__ = ('__x', '__y') # <2> typecode = 'd' # end::VECTOR2D_V3_SLOTS[] def __init__(self, x, y): self.__x = float(x) self.__y = float(y) @property def x(self): return self.__x @property def y(self): r...
Vector2d
python
walkccc__LeetCode
solutions/2134. Minimum Swaps to Group All 1's Together II/2134.py
{ "start": 0, "end": 415 }
class ____: def minSwaps(self, nums: list[int]) -> int: n = len(nums) k = nums.count(1) ones = 0 # the number of ones in the window maxOnes = 0 # the maximum number of ones in the window for i in range(n * 2): if i >= k and nums[i % n - k]: # Magic in Python :) ones -= 1 if...
Solution
python
doocs__leetcode
solution/2300-2399/2341.Maximum Number of Pairs in Array/Solution.py
{ "start": 0, "end": 187 }
class ____: def numberOfPairs(self, nums: List[int]) -> List[int]: cnt = Counter(nums) s = sum(v // 2 for v in cnt.values()) return [s, len(nums) - s * 2]
Solution
python
langchain-ai__langchain
libs/partners/huggingface/langchain_huggingface/chat_models/huggingface.py
{ "start": 10862, "end": 44566 }
class ____(BaseChatModel): r"""Hugging Face LLM's as ChatModels. Works with `HuggingFaceTextGenInference`, `HuggingFaceEndpoint`, `HuggingFaceHub`, and `HuggingFacePipeline` LLMs. Upon instantiating this class, the model_id is resolved from the url provided to the LLM, and the appropriate tokenize...
ChatHuggingFace
python
celery__celery
t/unit/tasks/test_canvas.py
{ "start": 12956, "end": 29452 }
class ____(CanvasCase): def test_chain_of_chain_with_a_single_task(self): s = self.add.s(1, 1) assert chain([chain(s)]).tasks == list(chain(s).tasks) @pytest.mark.parametrize("chain_type", (_chain, chain_subclass)) def test_clone_preserves_state(self, chain_type): x = chain_type(se...
test_chain
python
mlflow__mlflow
dev/proto_to_graphql/code_generator.py
{ "start": 443, "end": 1839 }
class ____: def __init__(self): self.queries = set() # method_descriptor self.mutations = set() # method_descriptor self.inputs = [] # field_descriptor self.outputs = set() # field_descriptor self.types = [] # field_descriptor self.enums = set() # enum_descripto...
GenerateSchemaState
python
getsentry__sentry
src/sentry/identity/slack/provider.py
{ "start": 284, "end": 2778 }
class ____(OAuth2Provider): key = IntegrationProviderSlug.SLACK.value name = "Slack" # This identity provider is used for authorizing the Slack application # through their Bot token (or legacy Workspace Token if enabled) flow. oauth_scopes = ("identity.basic", "identity.email") # Only used du...
SlackIdentityProvider
python
walkccc__LeetCode
solutions/932. Beautiful Array/932.py
{ "start": 0, "end": 576 }
class ____: def beautifulArray(self, n: int) -> list[int]: arr = [i for i in range(1, n + 1)] def partition(l: int, r: int, mask: int) -> int: nextSwapped = l for i in range(l, r + 1): if arr[i] & mask: arr[i], arr[nextSwapped] = arr[nextSwapped], arr[i] nextSwapped +=...
Solution
python
numba__numba
numba/core/typing/mathdecl.py
{ "start": 1960, "end": 2039 }
class ____(Math_converter): pass @infer_global(math.copysign)
Math_floor_ceil
python
pytorch__pytorch
test/export/test_export.py
{ "start": 5287, "end": 5371 }
class ____: x: Tensor y: List[Tensor] z: Dict[str, Tensor] @dataclass
Inp1
python
tensorflow__tensorflow
tensorflow/python/ops/gradients_test.py
{ "start": 27335, "end": 28589 }
class ____(test_util.TensorFlowTestCase): @test_util.run_v1_only("b/120545219") def testHessianVectorProduct(self): # Manually compute the Hessian explicitly for a low-dimensional problem # and check that HessianVectorProduct matches multiplication by the # explicit Hessian. # Specifically, the Hes...
HessianVectorProductTest
python
getsentry__sentry
src/sentry/backup/comparators.py
{ "start": 25172, "end": 26466 }
class ____(JSONScrubbingComparator): """ Some exports from earlier sentry versions encode simple option values as string integers, while newer versions of sentry encode those values as string. If either side is a string, cast both to strings and compare. """ def compare(self, on: InstanceID, l...
OptionValueComparator
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/operators/test_sagemaker_notebook.py
{ "start": 4480, "end": 5626 }
class ____: @mock.patch.object(SageMakerHook, "conn") def test_stop_notebook_without_wait_for_completion(self, mock_hook_conn, hook): operator = SageMakerStopNotebookOperator( task_id="stop_test", instance_name=INSTANCE_NAME, wait_for_completion=False ) operator.execute(None)...
TestSageMakerStopNotebookOperator
python
encode__django-rest-framework
tests/test_filters.py
{ "start": 13780, "end": 13924 }
class ____(serializers.ModelSerializer): class Meta: model = SearchFilterModelM2M fields = '__all__'
SearchFilterM2MSerializer
python
apache__airflow
airflow-e2e-tests/tests/airflow_e2e_tests/e2e_test_utils/clients.py
{ "start": 4723, "end": 5207 }
class ____: """Client for interacting with the Task SDK API.""" def __init__(self): pass @cached_property def client(self): from airflow.sdk.api.client import Client client = Client(base_url=f"http://{DOCKER_COMPOSE_HOST_PORT}/execution", token="not-a-token") return cl...
TaskSDKClient
python
tensorflow__tensorflow
tensorflow/python/data/kernel_tests/snapshot_test.py
{ "start": 16923, "end": 38451 }
class ____(tf_record_test_base.TFRecordTestBase, parameterized.TestCase): def setUp(self): super(LegacySnapshotTest, self).setUp() self.removeTFRecords() tmpdir = self.get_temp_dir() tmpdir = os.path.join(tmpdir, "snapshot") os.mkdir(tmpdir) self.snapshot_dir = tmpdir...
LegacySnapshotTest
python
simonw__datasette
datasette/views/__init__.py
{ "start": 0, "end": 60 }
class ____: "Base class for all documented contexts"
Context
python
dask__dask
dask/dataframe/dask_expr/_groupby.py
{ "start": 21207, "end": 22107 }
class ____(GroupByReduction): _parameters = [ "frame", "ddof", "numeric_only", "split_out", "split_every", "sort", "dropna", "observed", "shuffle_method", ] _defaults = { "split_out": 1, "sort": None, "observed":...
Var
python
eventlet__eventlet
tests/greendns_test.py
{ "start": 19872, "end": 30730 }
class ____(tests.LimitedTestCase): def _make_mock_resolve_cname(self): """A stubbed out cname function""" class ResolveCname: qname = None cname = 'cname.example.com' def __call__(self, host): self.qname = host return self.cname ...
TestGetaddrinfo
python
mwaskom__seaborn
seaborn/_core/properties.py
{ "start": 5305, "end": 5709 }
class ____(Property): """The position of visual marks with respect to the axes of the plot.""" legend = False normed = False # =================================================================================== # # Properties with numeric values where scale range can be defined as an interval # ==========...
Coordinate
python
huggingface__transformers
src/transformers/utils/generic.py
{ "start": 35614, "end": 37088 }
class ____(MutableMapping): """ Dict-like object keeping track of a class-wide mapping, as well as a local one. Allows to have library-wide modifications though the class mapping, as well as local modifications in a single file with the local mapping. """ # Class instance object, so that a call to ...
GeneralInterface
python
automl__auto-sklearn
autosklearn/experimental/askl2.py
{ "start": 4547, "end": 21391 }
class ____(AutoSklearnClassifier): def __init__( self, time_left_for_this_task: int = 3600, per_run_time_limit=None, ensemble_size: int | None = None, ensemble_class: AbstractEnsemble | None = EnsembleSelection, ensemble_kwargs: Dict[str, Any] | None = None, e...
AutoSklearn2Classifier
python
apache__airflow
providers/fab/tests/unit/fab/auth_manager/test_fab_auth_manager.py
{ "start": 5479, "end": 30235 }
class ____: @mock.patch("flask_login.utils._get_user") def test_get_user(self, mock_current_user, minimal_app_for_auth_api, auth_manager): user = Mock() user.is_anonymous.return_value = True mock_current_user.return_value = user with minimal_app_for_auth_api.app_context(): ...
TestFabAuthManager
python
jazzband__django-simple-history
simple_history/tests/tests/test_utils.py
{ "start": 14600, "end": 19021 }
class ____(TestCase): def setUp(self): self.data = [ Poll(id=1, question="Question 1", pub_date=timezone.now()), Poll(id=2, question="Question 2", pub_date=timezone.now()), Poll(id=3, question="Question 3", pub_date=timezone.now()), Poll(id=4, question="Questi...
BulkUpdateWithHistoryTestCase
python
scrapy__scrapy
tests/test_downloadermiddleware_useragent.py
{ "start": 181, "end": 2114 }
class ____: def get_spider_and_mw(self, default_useragent): crawler = get_crawler(Spider, {"USER_AGENT": default_useragent}) spider = crawler._create_spider("foo") return spider, UserAgentMiddleware.from_crawler(crawler) def test_default_agent(self): _, mw = self.get_spider_and_...
TestUserAgentMiddleware
python
django__django
tests/model_fields/models.py
{ "start": 4069, "end": 4172 }
class ____(models.Model): title = models.CharField(max_length=100) body = models.TextField()
Post
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 578235, "end": 578554 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("cursor", "node") cursor = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="cursor") node = sgqlc.types.Field("ReleaseAsset", graphql_name="node")
ReleaseAssetEdge
python
weaviate__weaviate-python-client
weaviate/collections/classes/internal.py
{ "start": 6620, "end": 6883 }
class ____(Generic[P, R]): """A group of objects returned in a group by query.""" name: str min_distance: float max_distance: float number_of_objects: int objects: List[GroupByObject[P, R]] rerank_score: Optional[float] @dataclass
Group
python
pypa__pip
tests/lib/__init__.py
{ "start": 6084, "end": 6875 }
class ____(Mapping[StrPath, FoundFile]): def __init__(self, paths: Mapping[str, FoundFile]) -> None: self._paths = {pathlib.Path(k): v for k, v in paths.items()} def __contains__(self, o: object) -> bool: if isinstance(o, pathlib.Path): return o in self._paths elif isinstanc...
FoundFiles
python
bottlepy__bottle
bottle.py
{ "start": 5527, "end": 6442 }
class ____: """ Property that maps to a key in a local dict-like attribute. """ def __init__(self, attr, key=None, read_only=False): self.attr, self.key, self.read_only = attr, key, read_only def __call__(self, func): functools.update_wrapper(self, func, updated=[]) self.getter, se...
DictProperty
python
PyCQA__bandit
tests/unit/formatters/test_yaml.py
{ "start": 386, "end": 3605 }
class ____(testtools.TestCase): def setUp(self): super().setUp() conf = config.BanditConfig() self.manager = manager.BanditManager(conf, "file") (tmp_fd, self.tmp_fname) = tempfile.mkstemp() self.context = { "filename": self.tmp_fname, "lineno": 4, ...
YamlFormatterTests
python
psf__black
tests/data/cases/preview_long_strings__regression.py
{ "start": 37239, "end": 39299 }
class ____(xxxx.xxxxxxxxxxxxx): def xxxxxxx_xxxxxx(xxxx): assert xxxxxxx_xxxx in [ x.xxxxx.xxxxxx.xxxxx.xxxxxx, x.xxxxx.xxxxxx.xxxxx.xxxx, ], ( "xxxxxxxxxxx xxxxxxx xxxx (xxxxxx xxxx) %x xxx xxxxx" % xxxxxxx_xxxx ) value.__dict__[key] = ( "test" # s...
xxxxxxxxxxxxxxxxxxxxx
python
sphinx-doc__sphinx
sphinx/domains/cpp/__init__.py
{ "start": 16694, "end": 16757 }
class ____(CPPObject): object_type = 'member'
CPPMemberObject
python
spyder-ide__spyder
spyder/plugins/application/widgets/status.py
{ "start": 2376, "end": 5180 }
class ____(BaseTimerStatus): """Status bar widget for current file read/write mode.""" ID = "inapp_appeal_status" CONF_SECTION = "main" INTERACT_ON_CLICK = True DAYS_TO_SHOW_AGAIN = 15 def __init__(self, parent=None): super().__init__(parent) self._is_shown = False se...
InAppAppealStatus
python
plotly__plotly.py
plotly/graph_objs/violin/_legendgrouptitle.py
{ "start": 233, "end": 2932 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "violin" _path_str = "violin.legendgrouptitle" _valid_props = {"font", "text"} @property def font(self): """ Sets this legend group's title font. The 'font' property is an instance of Font that may be specified...
Legendgrouptitle
python
pandas-dev__pandas
asv_bench/benchmarks/frame_methods.py
{ "start": 22553, "end": 22937 }
class ____: params = ( [True, False], ["float64", "Float64", "float64[pyarrow]"], ) param_names = ["dtype"] def setup(self, inplace, dtype): self.df = DataFrame(np.random.randn(100_000, 10), dtype=dtype) self.mask = self.df < 0 def time_where(self, inplace, dtype): ...
Where
python
pypa__warehouse
tests/unit/macaroons/test_caveats.py
{ "start": 5078, "end": 6048 }
class ____: def test_verify_not_before(self): not_before = int(time.time()) + 60 expiry = not_before + 60 caveat = Expiration(expires_at=expiry, not_before=not_before) result = caveat.verify(pretend.stub(), pretend.stub(), pretend.stub()) assert result == Failure("token is ...
TestExpirationCaveat
python
Lightning-AI__lightning
tests/tests_pytorch/checkpointing/test_model_checkpoint.py
{ "start": 35546, "end": 35718 }
class ____(BoringModel): def on_validation_end(self): if not self.trainer.sanity_checking: raise RuntimeError("Trouble!")
TroubledModelOnValidationEnd
python
tiangolo__fastapi
docs_src/dependencies/tutorial008c.py
{ "start": 71, "end": 657 }
class ____(Exception): pass def get_username(): try: yield "Rick" except InternalError: print("Oops, we didn't raise again, Britney 😱") @app.get("/items/{item_id}") def get_item(item_id: str, username: str = Depends(get_username)): if item_id == "portal-gun": raise InternalE...
InternalError
python
getsentry__sentry
tests/sentry/preprod/test_models.py
{ "start": 708, "end": 7363 }
class ____(PreprodArtifactModelTestBase): """Tests for get_sibling_artifacts_for_commit method.""" def test_get_sibling_artifacts_for_commit_single_artifact(self): """Test getting artifacts when there's only one artifact for the commit.""" commit_comparison = CommitComparison.objects.create( ...
PreprodArtifactSiblingArtifactsTest
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/partition_sets.py
{ "start": 2584, "end": 2902 }
class ____(graphene.Union): class Meta: types = ( GrapheneAddDynamicPartitionSuccess, GrapheneUnauthorizedError, GraphenePythonError, GrapheneDuplicateDynamicPartitionError, ) name = "AddDynamicPartitionResult"
GrapheneAddDynamicPartitionResult
python
realpython__materials
build-a-rest-api-frontend/source_code_final/models.py
{ "start": 101, "end": 422 }
class ____(db.Model): __tablename__ = "note" id = db.Column(db.Integer, primary_key=True) person_id = db.Column(db.Integer, db.ForeignKey("person.id")) content = db.Column(db.String, nullable=False) timestamp = db.Column( db.DateTime, default=datetime.utcnow, onupdate=datetime.utcnow ) ...
Note
python
kamyu104__LeetCode-Solutions
Python/finding-the-number-of-visible-mountains.py
{ "start": 46, "end": 670 }
class ____(object): def visibleMountains(self, peaks): """ :type peaks: List[List[int]] :rtype: int """ peaks.sort(key=lambda x: (x[0]-x[1], -(x[0]+x[1]))) # rotate points by 45 degrees and we only care the largest new y in the same new x result = mx = 0 for ...
Solution