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
celery__celery
t/unit/utils/test_time.py
{ "start": 7695, "end": 8349 }
class ____: def test_get_timezone_with_zoneinfo(self): assert timezone.get_timezone('UTC') def test_tz_or_local(self): assert timezone.tz_or_local() == timezone.local assert timezone.tz_or_local(timezone.utc) def test_to_local(self): assert timezone.to_local(make_aware(dat...
test_timezone
python
anthropics__anthropic-sdk-python
src/anthropic/types/beta/beta_memory_tool_20250818_delete_command.py
{ "start": 212, "end": 396 }
class ____(BaseModel): command: Literal["delete"] """Command type identifier""" path: str """Path to the file or directory to delete"""
BetaMemoryTool20250818DeleteCommand
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/postgresql/_psycopg_common.py
{ "start": 2605, "end": 3070 }
class ____(PGExecutionContext): def create_server_side_cursor(self): # use server-side cursors: # psycopg # https://www.psycopg.org/psycopg3/docs/advanced/cursors.html#server-side-cursors # psycopg2 # https://www.psycopg.org/docs/usage.html#server-side-cursors ident =...
_PGExecutionContext_common_psycopg
python
xlwings__xlwings
xlwings/constants.py
{ "start": 46153, "end": 46385 }
class ____: xlCommandUnderlinesAutomatic = -4105 # from enum XlCommandUnderlines xlCommandUnderlinesOff = -4146 # from enum XlCommandUnderlines xlCommandUnderlinesOn = 1 # from enum XlCommandUnderlines
CommandUnderlines
python
spack__spack
var/spack/test_repos/spack_repo/find/packages/d0/package.py
{ "start": 217, "end": 317 }
class ____(Package): version("1.2") version("1.1") depends_on("c0") depends_on("e0")
D0
python
pytorch__pytorch
torch/_inductor/select_algorithm.py
{ "start": 97860, "end": 152136 }
class ____(PersistentCache): """ A persistent cache for algorithm selection results used in autotuning of GEMMs and convolutions. This classes includes precompilation and benchmarking of the kernels. The cache is keyed by input characteristics (sizes, strides, dtypes, etc.) but doesn't depend ...
AlgorithmSelectorCache
python
mlflow__mlflow
mlflow/genai/evaluation/context.py
{ "start": 1031, "end": 1418 }
class ____(Context): """ A context that does nothing. """ def get_mlflow_experiment_id(self) -> str | None: raise NotImplementedError("Context is not set") def get_mlflow_run_id(self) -> str | None: raise NotImplementedError("Context is not set") def get_user_name(self) -> str...
NoneContext
python
tornadoweb__tornado
tornado/test/auth_test.py
{ "start": 5516, "end": 5656 }
class ____(RequestHandler): def get(self): self.write(dict(access_token="asdf", expires_in=3600))
FacebookServerAccessTokenHandler
python
ray-project__ray
doc/source/ray-overview/examples/e2e-rag/notebooks/rag_utils.py
{ "start": 3270, "end": 11596 }
class ____: """ A class to query a Chroma database collection and return formatted search results. """ def __init__( self, chroma_path: str, chroma_collection_name: str, score_threshold: float = 0.8, # Define a default threshold value if needed. ): """ ...
ChromaQuerier
python
spyder-ide__spyder
spyder/api/widgets/menus.py
{ "start": 897, "end": 980 }
class ____: Top = 'top_section' Bottom = 'bottom_section'
OptionsMenuSections
python
huggingface__transformers
src/transformers/models/llama4/modeling_llama4.py
{ "start": 43935, "end": 49047 }
class ____(Llama4PreTrainedModel): base_model_prefix = "vision_model" input_modalities = ("image",) _no_split_modules = ["Llama4VisionEncoderLayer"] config: Llama4VisionConfig def __init__(self, config: Llama4VisionConfig): super().__init__(config) self.image_size = config.image_siz...
Llama4VisionModel
python
kamyu104__LeetCode-Solutions
Python/minimum-cost-for-cutting-cake-i.py
{ "start": 792, "end": 1565 }
class ____(object): def minimumCost(self, m, n, horizontalCut, verticalCut): """ :type m: int :type n: int :type horizontalCut: List[int] :type verticalCut: List[int] :rtype: int """ horizontalCut.sort(reverse=True) verticalCut.sort(reverse=Tru...
Solution2
python
RaRe-Technologies__gensim
gensim/models/hdpmodel.py
{ "start": 38339, "end": 46954 }
class ____: """Helper class for :class:`gensim.models.hdpmodel.HdpModel` to format the output of topics.""" (STYLE_GENSIM, STYLE_PRETTY) = (1, 2) def __init__(self, dictionary=None, topic_data=None, topic_file=None, style=None): """Initialise the :class:`gensim.models.hdpmodel.HdpTopicFormatter` an...
HdpTopicFormatter
python
allegroai__clearml
clearml/backend_api/services/v2_13/queues.py
{ "start": 52788, "end": 54413 }
class ____(Response): """ Response of queues.get_next_task endpoint. :param entry: Entry information :type entry: Entry """ _service = "queues" _action = "get_next_task" _version = "2.13" _schema = { "definitions": { "entry": { "properties": { ...
GetNextTaskResponse
python
doocs__leetcode
solution/1400-1499/1442.Count Triplets That Can Form Two Arrays of Equal XOR/Solution.py
{ "start": 0, "end": 296 }
class ____: def countTriplets(self, arr: List[int]) -> int: ans, n = 0, len(arr) for i, x in enumerate(arr): s = x for k in range(i + 1, n): s ^= arr[k] if s == 0: ans += k - i return ans
Solution
python
bokeh__bokeh
src/bokeh/models/canvas.py
{ "start": 1358, "end": 2451 }
class ____(UIElement): """ """ # explicit __init__ to support Init signatures def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) hidpi = Bool(default=True, help=""" Whether to use HiDPI mode when available. """) output_backend = Enum(OutputBac...
Canvas
python
PrefectHQ__prefect
src/prefect/client/schemas/objects.py
{ "start": 3726, "end": 3896 }
class ____(PrefectBaseModel): """ Class for storing the concurrency config in database. """ collision_strategy: ConcurrencyLimitStrategy
ConcurrencyOptions
python
sympy__sympy
sympy/printing/pycode.py
{ "start": 24040, "end": 26840 }
class ____(PythonCodePrinter): """ Lambda printer for mpmath which maintains precision for floats """ printmethod = "_mpmathcode" language = "Python with mpmath" _kf = dict(chain( _known_functions.items(), [(k, 'mpmath.' + v) for k, v in _known_functions_mpmath.items()] )) ...
MpmathPrinter
python
getsentry__sentry
tests/acceptance/test_project_detail.py
{ "start": 270, "end": 3381 }
class ____(AcceptanceTestCase): def setUp(self) -> None: super().setUp() self.user = self.create_user("foo@example.com") self.org = self.create_organization(name="Rowdy Tiger", owner=None) self.team1 = self.create_team(organization=self.org, name="Mariachi Band 1") self.team...
ProjectDetailTest
python
getsentry__sentry
src/sentry/sentry_metrics/querying/types.py
{ "start": 1835, "end": 2130 }
class ____(Enum): """ Represents the type of query that can be run. Due to storage limitations we are not allowing querying series only, but we might work around this limitation in case there will be a product need for it. """ TOTALS_AND_SERIES = 0 TOTALS = 1
QueryType
python
walkccc__LeetCode
solutions/1184. Distance Between Bus Stops/1184.py
{ "start": 0, "end": 441 }
class ____: def distanceBetweenBusStops( self, distance: list[int], start: int, destination: int, ) -> int: clockwise = 0 counterclockwise = 0 if start > destination: start, destination = destination, start for i, d in enumerate(distance): if i >= start and i < destin...
Solution
python
walkccc__LeetCode
solutions/2207. Maximize Number of Subsequences in a String/2207.py
{ "start": 0, "end": 478 }
class ____: def maximumSubsequenceCount(self, text: str, pattern: str) -> int: ans = 0 count0 = 0 # the count of the letter pattern[0] count1 = 0 # the count of the letter pattern[1] for c in text: if c == pattern[1]: ans += count0 count1 += 1 if c == pattern[0]: ...
Solution
python
ipython__ipython
IPython/core/builtin_trap.py
{ "start": 299, "end": 378 }
class ____: pass BuiltinUndefined = __BuiltinUndefined()
__BuiltinUndefined
python
pytorch__pytorch
torch/backends/_nnapi/serializer.py
{ "start": 8364, "end": 83074 }
class ____: def __init__(self, config, use_int16_for_qint16=False): self.operands = [] self.values = [] self.operations = [] self.value_data = [] self.operation_args = [] self.inputs = [] self.outputs = [] self.flexible_shape_computation_lines = [] ...
_NnapiSerializer
python
django-crispy-forms__django-crispy-forms
crispy_forms/layout.py
{ "start": 32189, "end": 33674 }
class ____(Field): """ Layout object. For fields with :class:`~django.forms.MultiWidget` as ``widget``, you can pass additional attributes to each widget. Attributes ---------- template : str The default template which this Layout Object will be rendered with. Parameters ...
MultiWidgetField
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/auth_manager/avp/entities.py
{ "start": 1015, "end": 2163 }
class ____(Enum): """Enum of Amazon Verified Permissions entities.""" ACTION = "Action" GROUP = "Group" USER = "User" # Resource types ASSET = "Asset" ASSET_ALIAS = "AssetAlias" BACKFILL = "Backfill" CONFIGURATION = "Configuration" CONNECTION = "Connection" CUSTOM = "Custom...
AvpEntities
python
python-attrs__attrs
src/attr/_make.py
{ "start": 84046, "end": 87612 }
class ____: """ Intermediate representation of attributes that uses a counter to preserve the order in which the attributes have been defined. *Internal* data structure of the attrs library. Running into is most likely the result of a bug like a forgotten `@attr.s` decorator. """ __slots_...
_CountingAttr
python
dagster-io__dagster
python_modules/dagster/dagster/_core/captured_log_api.py
{ "start": 122, "end": 1656 }
class ____(NamedTuple): """Representation of a log line cursor, to keep track of the place in the logs. The captured logs are stored in multiple files in the same direcotry. The cursor keeps track of the file name and the number of lines read so far. line=-1 means that the entire file has been read and...
LogLineCursor
python
walkccc__LeetCode
solutions/1942. The Number of the Smallest Unoccupied Chair/1942.py
{ "start": 0, "end": 803 }
class ____: def smallestChair(self, times: list[list[int]], targetFriend: int) -> int: nextUnsatChair = 0 emptyChairs = [] occupied = [] # (leaving, chair) for i in range(len(times)): times[i].append(i) times.sort(key=lambda x: x[0]) for arrival, leaving, i in times: while len(...
Solution
python
numba__numba
numba/core/typed_passes.py
{ "start": 9636, "end": 10611 }
class ____(FunctionPass): _name = "pre_parfor_pass" def __init__(self): FunctionPass.__init__(self) def run_pass(self, state): """ Preprocessing for data-parallel computations. """ # Ensure we have an IR and type information. assert state.func_ir pr...
PreParforPass
python
py-pdf__pypdf
pypdf/filters.py
{ "start": 19979, "end": 23441 }
class ____: """ §7.4.6, CCITTFaxDecode filter (ISO 32000). Either Group 3 or Group 4 CCITT facsimile (fax) encoding. CCITT encoding is bit-oriented, not byte-oriented. §7.4.6, optional parameters for the CCITTFaxDecode filter. """ @staticmethod def _get_parameters( parameters:...
CCITTFaxDecode
python
pytorch__pytorch
torch/package/package_exporter.py
{ "start": 2996, "end": 3539 }
class ____: """Holds :class:`PackageExporter`-specific info about how to execute matches against""" # What action to take on a module that matches this pattern. action: _ModuleProviderAction # The value of `allow_empty` the user gave when specifying the pattern. allow_empty: bool # Whether this...
_PatternInfo
python
viewflow__viewflow
viewflow/workflow/nodes/split.py
{ "start": 5451, "end": 7172 }
class ____( Split, ): """ Parallel split, as soon as the first task is completed, the remaining tasks are cancelled. """ activation_class = SplitFirstActivation def _ready(self): task_finished.connect(self.on_task_done, sender=self.flow_class) def _cancel_active_tasks(self, ac...
SplitFirst
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/optionals.py
{ "start": 330, "end": 533 }
class ____: def get_instance(self) -> Optional[Client]: return Client() client: ClientSingleton = ClientSingleton() def test(): client.get_instance().offer(_test_source())
ClientSingleton
python
qdrant__qdrant-client
qdrant_client/http/models/models.py
{ "start": 96520, "end": 99134 }
class ____(BaseModel, extra="forbid"): shard_key: Optional["ShardKeySelector"] = Field( default=None, description="Specify in which shards to look for the points, if not specified - look in all shards", ) positive: Optional[List["RecommendExample"]] = Field(default=[], description="Look for ...
RecommendGroupsRequest
python
airbytehq__airbyte
airbyte-integrations/bases/base-normalization/unit_tests/test_transform_config.py
{ "start": 355, "end": 20142 }
class ____: """ This class is testing the transform config functionality that converts a destination_config.json into the adequate profiles.yml file for dbt to use """ @pytest.fixture(scope="class", autouse=True) def before_all_tests(self, request): # This makes the test run whether it is e...
TestTransformConfig
python
django__django
tests/template_tests/filter_tests/test_upper.py
{ "start": 163, "end": 968 }
class ____(SimpleTestCase): """ The "upper" filter messes up entities (which are case-sensitive), so it's not safe for non-escaping purposes. """ @setup( { "upper01": ( "{% autoescape off %}{{ a|upper }} {{ b|upper }}{% endautoescape %}" ) } ...
UpperTests
python
spack__spack
lib/spack/spack/database.py
{ "start": 72710, "end": 72819 }
class ____(SpackError): """Raised when errors are found while reading the database."""
CorruptDatabaseError
python
pytorch__pytorch
torch/testing/_internal/common_device_type.py
{ "start": 59188, "end": 60359 }
class ____: def __init__(self, d): assert isinstance(d, dict), ( "precisionOverride not given a dtype : precision dict!" ) for dtype in d: assert isinstance(dtype, torch.dtype), ( f"precisionOverride given unknown dtype {dtype}" ) ...
precisionOverride
python
hyperopt__hyperopt
hyperopt/tests/integration/test_spark.py
{ "start": 2094, "end": 2847 }
class ____(unittest.TestCase, BaseSparkContext): @classmethod def setUpClass(cls): cls.setup_spark() @classmethod def tearDownClass(cls): cls.teardown_spark() def test_spark_context(self): rdd1 = self.sc.parallelize(range(10), 10) rdd2 = rdd1.map(lambda x: x + 1) ...
TestSparkContext
python
coleifer__peewee
tests/postgres.py
{ "start": 21027, "end": 22996 }
class ____(BaseBinaryJsonFieldTestCase, ModelTestCase): M = BJson N = Normal database = db requires = [BJson, Normal] @skip_unless(pg10(), 'jsonb remove support requires pg >= 10') def test_remove_data(self): BJson.delete().execute() # Clear out db. BJson.create(data={ ...
TestBinaryJsonField
python
getsentry__sentry
tests/sentry_plugins/github/endpoints/test_installation_repo_install_event.py
{ "start": 283, "end": 2577 }
class ____(APITestCase): def test_simple(self) -> None: project = self.project # force creation url = "/plugins/github/installations/webhook/" with assume_test_silo_mode(SiloMode.CONTROL): integration = self.create_provider_integration( provider="github_apps", ...
InstallationRepoInstallEventWebhookTest
python
facebookresearch__faiss
faiss/gpu/test/test_gpu_basics.py
{ "start": 373, "end": 3403 }
class ____(unittest.TestCase): d = 16 xb = np.random.rand(256, d).astype('float32') nlist = 128 d_bin = 256 xb_bin = np.random.randint(256, size=(10000, d_bin // 8)).astype('uint8') xq_bin = np.random.randint(256, size=(1000, d_bin // 8)).astype('uint8') def test_proxy(self): inde...
ReferencedObject
python
kamyu104__LeetCode-Solutions
Python/divide-an-array-into-subarrays-with-minimum-cost-ii.py
{ "start": 71, "end": 1724 }
class ____(object): def minimumCost(self, nums, k, dist): """ :type nums: List[int] :type k: int :type dist: int :rtype: int """ def get_top(heap, total): while abs(heap[0][1]) < i-(1+dist): heapq.heappop(heap) total...
Solution
python
numpy__numpy
numpy/distutils/system_info.py
{ "start": 76799, "end": 76901 }
class ____(blas_ilp64_opt_info): symbol_prefix = '' symbol_suffix = ''
blas_ilp64_plain_opt_info
python
cython__cython
Cython/Compiler/ParseTreeTransforms.py
{ "start": 61047, "end": 67343 }
class ____(CythonTransform, SkipDeclarations): """ Transform cython.parallel stuff. The parallel_directives come from the module node, set there by InterpretCompilerDirectives. x = cython.parallel.threadavailable() -> ParallelThreadAvailableNode with nogil, cython.parallel.parallel(): -> ...
ParallelRangeTransform
python
realpython__materials
inheritance-and-composition/inheritance/hr.py
{ "start": 334, "end": 506 }
class ____: def __init__(self, weekly_salary): self.weekly_salary = weekly_salary def calculate_payroll(self): return self.weekly_salary
SalaryPolicy
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 566635, "end": 568331 }
class ____(sgqlc.types.Interface): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ( "database_id", "id", "reaction_groups", "reactions", "viewer_can_react", ) database_id = sgqlc.types.Field(Int, graphql_name="dat...
Reactable
python
django__django
tests/admin_views/models.py
{ "start": 13276, "end": 13346 }
class ____(Post): class Meta: proxy = True
FieldOverridePost
python
getsentry__sentry
src/sentry/integrations/jira/models/create_issue_metadata.py
{ "start": 885, "end": 1279 }
class ____(str, Enum): string = "string" option = "option" array = "array" user = "user" issue_type = "issuetype" issue_link = "issuelink" project = "project" date = "date" team = "team" number = "number" json = "json" version = "version" component = "component" p...
JiraSchemaTypes
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pycodestyle/E30.py
{ "start": 7430, "end": 7523 }
class ____: # comment # another comment def test(self): pass # end # E303
Test
python
Netflix__metaflow
metaflow/runner/metaflow_runner.py
{ "start": 6388, "end": 7625 }
class ____(ExecutingProcess): """ This class contains a reference to a `metaflow.Task` object representing the currently executing or finished task, as well as metadata related to the process. `ExecutingTask` is returned by methods in `Runner` and `NBRunner`. It is not meant to be instantiated d...
ExecutingTask
python
keras-team__keras
keras/src/ops/nn.py
{ "start": 76348, "end": 78811 }
class ____(Operation): def __init__(self, axis=-1, order=2, epsilon=None, *, name=None): super().__init__(name=name) self.axis = axis self.order = order self.epsilon = epsilon def compute_output_spec(self, x): return KerasTensor(shape=x.shape) def call(self, x): ...
Normalize
python
redis__redis-py
tests/test_asyncio/test_pubsub.py
{ "start": 17354, "end": 18022 }
class ____: async def my_handler(self, message): self.message = ["my handler", message] async def test_push_handler(self, r): if get_protocol_version(r) in [2, "2", None]: return p = r.pubsub(push_handler_func=self.my_handler) await p.subscribe("foo") assert ...
TestPubSubRESP3Handler
python
pypa__packaging
src/packaging/markers.py
{ "start": 8474, "end": 12086 }
class ____: def __init__(self, marker: str) -> None: # Note: We create a Marker object without calling this constructor in # packaging.requirements.Requirement. If any additional logic is # added here, make sure to mirror/adapt Requirement. try: self._markers ...
Marker
python
ray-project__ray
python/ray/serve/config.py
{ "start": 13104, "end": 13224 }
class ____(str, Enum): MEAN = "mean" MAX = "max" MIN = "min" @PublicAPI(stability="alpha")
AggregationFunction
python
tensorflow__tensorflow
tensorflow/python/ops/nn_test.py
{ "start": 2010, "end": 3596 }
class ____(test_lib.TestCase): def _ZeroFraction(self, x): assert x.shape total_elements = np.prod(x.shape) nonzeros = np.count_nonzero(x.flatten()) return 1.0 - nonzeros / total_elements @test_util.run_deprecated_v1 def testZeroFraction(self): x_shape = [5, 17] x_np = np.random.randint(...
ZeroFractionTest
python
pydata__xarray
xarray/tests/test_formatting.py
{ "start": 299, "end": 506 }
class ____(Index): names: tuple[str, ...] def __init__(self, names: tuple[str, ...]): self.names = names def __repr__(self): return f"CustomIndex(coords={self.names})"
CustomIndex
python
pytest-dev__pytest-django
tests/test_db_setup.py
{ "start": 14875, "end": 19184 }
class ____: """Tests for Django Migrations.""" def test_no_migrations(self, django_pytester: DjangoPytester) -> None: django_pytester.create_test_module( """ import pytest @pytest.mark.django_db def test_inner_migrations(): from .app.mode...
TestMigrations
python
pytorch__pytorch
test/functorch/test_eager_transforms.py
{ "start": 93606, "end": 98571 }
class ____(TestCase): @dtypes(torch.float) def test_linearize_basic(self, device, dtype): x_p = make_tensor((3, 1), device=device, dtype=dtype) x_t = make_tensor((3, 1), device=device, dtype=dtype) def fn(x): return x.cos() actual_output, jvp_fn = linearize(fn, x_p)...
TestLinearize
python
altair-viz__altair
altair/vegalite/v6/schema/core.py
{ "start": 1399859, "end": 1400409 }
class ____(TickCount): """ TimeIntervalStep schema wrapper. Parameters ---------- interval : :class:`TimeInterval`, Literal['millisecond', 'second', 'minute', 'hour', 'day', 'week', 'month', 'year'] step : float """ _schema = {"$ref": "#/definitions/TimeIntervalStep"} def __init...
TimeIntervalStep
python
pandas-dev__pandas
asv_bench/benchmarks/reshape.py
{ "start": 7697, "end": 8115 }
class ____: def setup(self): categories = list(string.ascii_letters[:12]) s = pd.Series( np.random.choice(categories, size=1000000), dtype=CategoricalDtype(categories), ) self.s = s def time_get_dummies_1d(self): pd.get_dummies(self.s, sparse=Fals...
GetDummies
python
more-itertools__more-itertools
tests/test_more.py
{ "start": 63838, "end": 64654 }
class ____(TestCase): def test_empty_iterable(self): slice_length = 3 iterable = iter([]) actual = mi.take(slice_length, mi.repeat_last(iterable)) expected = [None] * slice_length self.assertEqual(actual, expected) def test_default_value(self): slice_length = 3 ...
RepeatLastTests
python
django__django
tests/gis_tests/layermap/models.py
{ "start": 1223, "end": 1322 }
class ____(CityBase): dt = models.DateField() class Meta(CityBase.Meta): pass
ICity1
python
pytorch__pytorch
torch/distributed/checkpoint/_experimental/checkpoint_process.py
{ "start": 1084, "end": 1213 }
class ____(Enum): PING = "ping" WRITE_CHECKPOINT = "write_checkpoint" TERMINATE_PROCESS = "exit" @dataclass
RequestType
python
ansible__ansible
lib/ansible/galaxy/collection/gpg.py
{ "start": 6391, "end": 6578 }
class ____(GpgBaseError): """This is the counterpart to SUCCESS and used to indicate a program failure.""" location: str code: int @dataclass(frozen=True, slots=True)
GpgFailure
python
plotly__plotly.py
plotly/graph_objs/densitymap/_legendgrouptitle.py
{ "start": 233, "end": 2960 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "densitymap" _path_str = "densitymap.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 s...
Legendgrouptitle
python
PrefectHQ__prefect
tests/test_flows.py
{ "start": 139853, "end": 147636 }
class ____: @property def flow(self): @flow def test_flow(): pass return test_flow @pytest.fixture(autouse=True) async def mock_runner_start(self, monkeypatch): mock = AsyncMock() monkeypatch.setattr("prefect.cli.flow.Runner.start", mock) ret...
TestFlowServe
python
PyCQA__flake8
src/flake8/formatting/default.py
{ "start": 2128, "end": 2806 }
class ____(SimpleFormatter): """Only print filenames, e.g., flake8 -q.""" error_format = "%(path)s" def after_init(self) -> None: """Initialize our set of filenames.""" self.filenames_already_printed: set[str] = set() def show_source(self, error: Violation) -> str | None: """D...
FilenameOnly
python
altair-viz__altair
altair/vegalite/v6/schema/_typing.py
{ "start": 3750, "end": 4068 }
class ____(TypedDict, Generic[T], total=False): """ A `Generic`_ two-item ``dict``. Parameters ---------- column: T row: T Returns ------- dict .. _Generic: https://typing.readthedocs.io/en/latest/spec/generics.html#generics """ column: T row: T
RowColKwds
python
dagster-io__dagster
python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/generated/sources.py
{ "start": 150729, "end": 152088 }
class ____(GeneratedAirbyteSource): @public def __init__( self, name: str, lat: str, lon: str, appid: str, units: Optional[str] = None, lang: Optional[str] = None, ): """Airbyte Source for Openweather. Args: name (str): The...
OpenweatherSource
python
jschneier__django-storages
storages/backends/azure_storage.py
{ "start": 3633, "end": 14079 }
class ____(BaseStorage): def __init__(self, **settings): super().__init__(**settings) self._service_client = None self._client = None self._user_delegation_key = None self._user_delegation_key_expiry = datetime.utcnow() if self.connection_string and (not self.account_...
AzureStorage
python
gevent__gevent
src/greentest/3.14/test_urllib2.py
{ "start": 17556, "end": 19019 }
class ____(urllib.request.BaseHandler): # useful for testing redirections and auth # sends supplied headers and code as first response # sends 200 OK as second response def __init__(self, code, headers): self.code = code self.headers = headers self.reset() def reset(self): ...
MockHTTPHandlerRedirect
python
pytorch__pytorch
test/distributed/test_c10d_nccl.py
{ "start": 8527, "end": 9993 }
class ____(MultiProcessTestCase): device_type = "cuda" def setUp(self): super().setUp() self._spawn_processes() def tearDown(self): super().tearDown() try: os.remove(self.file_name) except OSError: pass @property def world_size(self)...
ProcessGroupNCCLInitTest
python
pytorch__pytorch
torch/_inductor/lookup_table/choices.py
{ "start": 693, "end": 16073 }
class ____(InductorChoices): """ InductorChoices subclass that uses lookup table when available, otherwise falls back to parent. All lookup functionality is contained within this class and can be customized by overriding methods. """ def _get_lookup_table(self) -> dict[str, list[dict[str, Any]]]: ...
LookupTableChoices
python
doocs__leetcode
solution/0400-0499/0472.Concatenated Words/Solution.py
{ "start": 356, "end": 1079 }
class ____: def findAllConcatenatedWordsInADict(self, words: List[str]) -> List[str]: def dfs(w): if not w: return True node = trie for i, c in enumerate(w): idx = ord(c) - ord('a') if node.children[idx] is None: ...
Solution
python
run-llama__llama_index
llama-index-integrations/readers/llama-index-readers-gitlab/llama_index/readers/gitlab/issues/base.py
{ "start": 277, "end": 8057 }
class ____(BaseReader): """ GitLab issues reader. """ class IssueState(enum.Enum): """ Issue type. Used to decide what issues to retrieve. Attributes: - OPEN: Issues that are open. - CLOSED: Issues that are closed. - ALL: All issues,...
GitLabIssuesReader
python
sqlalchemy__sqlalchemy
test/typing/plain_files/orm/declared_attr_two.py
{ "start": 497, "end": 785 }
class ____(HasRelatedDataMixin, Base): @declared_attr.directive def __tablename__(cls) -> str: return "user" @declared_attr.directive def __mapper_args__(cls) -> typing.Dict[str, typing.Any]: return {} id = mapped_column(Integer, primary_key=True)
User
python
kamyu104__LeetCode-Solutions
Python/count-partitions-with-max-min-difference-at-most-k.py
{ "start": 109, "end": 1096 }
class ____(object): def countPartitions(self, nums, k): """ :type nums: List[int] :type k: int :rtype: int """ MOD = 10**9+7 max_dq, min_dq = collections.deque(), collections.deque() dp = [0]*(len(nums)+1) dp[0] = 1 left = suffix = 0 ...
Solution
python
apache__airflow
providers/google/tests/unit/google/cloud/utils/test_external_token_supplier.py
{ "start": 1376, "end": 4981 }
class ____: def test_get_subject_token_success(self): token_supplier = ClientCredentialsGrantFlowTokenSupplier( oidc_issuer_url=MOCK_URL1, client_id=CLIENT_ID, client_secret=CLIENT_SECRET, ) with requests_mock.Mocker() as m: m.post(MOCK_URL1, ...
TestClientCredentialsGrantFlowTokenSupplier
python
run-llama__llama_index
llama-index-integrations/readers/llama-index-readers-azstorage-blob/llama_index/readers/azstorage_blob/base.py
{ "start": 1660, "end": 11232 }
class ____( BasePydanticReader, ResourcesReaderMixin, FileSystemReaderMixin ): """ General reader for any Azure Storage Blob file or directory. Args: container_name (str): name of the container for the blob. blob (Optional[str]): name of the file to download. If none specified ...
AzStorageBlobReader
python
qdrant__qdrant-client
qdrant_client/conversions/conversion.py
{ "start": 5387, "end": 107270 }
class ____: @classmethod def convert_condition(cls, model: grpc.Condition) -> rest.Condition: name = model.WhichOneof("condition_one_of") if name is None: raise ValueError(f"invalid Condition model: {model}") # pragma: no cover val = getattr(model, name) if name == ...
GrpcToRest
python
kamyu104__LeetCode-Solutions
Python/maximum-number-of-balloons.py
{ "start": 50, "end": 396 }
class ____(object): def maxNumberOfBalloons(self, text): """ :type text: str :rtype: int """ TARGET = "balloon" source_count = collections.Counter(text) target_count = collections.Counter(TARGET) return min(source_count[c]//target_count[c] for c in tar...
Solution
python
pyca__cryptography
tests/hazmat/primitives/test_rsa.py
{ "start": 13398, "end": 30533 }
class ____: @pytest.mark.supported( only_if=lambda backend: backend.rsa_padding_supported( padding.PKCS1v15() ), skip_message="Does not support PKCS1v1.5.", ) @pytest.mark.supported( only_if=lambda backend: backend.signature_hash_supported( hashes.SHA1...
TestRSASignature
python
wandb__wandb
wandb/sdk/wandb_init.py
{ "start": 4706, "end": 61072 }
class ____: def __init__( self, wl: wandb_setup._WandbSetup, telemetry: telemetry.TelemetryRecord, ) -> None: self._wl = wl self._telemetry = telemetry """Telemetry gathered before creating a run. After the run is created, `telemetry.context()` is used i...
_WandbInit
python
pytorch__pytorch
tools/test/test_gb_registry_linter.py
{ "start": 226, "end": 14282 }
class ____(unittest.TestCase): """ Test the graph break registry linter functionality """ def setUp(self): script_dir = Path(__file__).resolve() self.test_data_dir = script_dir.parent / "graph_break_registry_linter_testdata" self.test_data_dir.mkdir(parents=True, exist_ok=True) ...
TestGraphBreakRegistryLinter
python
apache__airflow
airflow-core/src/airflow/models/asset.py
{ "start": 12414, "end": 14374 }
class ____(Base): """ Collection of active assets. An asset is considered active if it is declared by the user in any DAG files. AssetModel entries that are not active (also called orphaned in some parts of the code base) are still kept in the database, but have their corresponding entries in t...
AssetActive
python
spyder-ide__spyder
spyder/plugins/variableexplorer/widgets/arrayeditor.py
{ "start": 4151, "end": 13900 }
class ____(QAbstractTableModel, SpyderFontsMixin): """ Array Editor Table Model Attributes ---------- bgcolor_enabled : bool If True, vary backgrond color depending on cell value _format_spec : str Format specification for floats """ ROWS_TO_LOAD = 500 COLS_TO_LOAD ...
ArrayModel
python
dagster-io__dagster
python_modules/libraries/dagster-sigma/dagster_sigma/resource.py
{ "start": 4373, "end": 4904 }
class ____(str, Enum): """Enumeration of Sigma API base URLs for different cloud providers. https://help.sigmacomputing.com/reference/get-started-sigma-api#identify-your-api-request-url """ AWS_US = "https://aws-api.sigmacomputing.com" AWS_CANADA = "https://api.ca.aws.sigmacomputing.com" AWS_E...
SigmaBaseUrl
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1592555, "end": 1592728 }
class ____(sgqlc.types.Union): """Used for argument of CreateProjectV2 mutation.""" __schema__ = github_schema __types__ = (Organization, User)
OrganizationOrUser
python
astropy__astropy
astropy/coordinates/builtin_frames/ecliptic.py
{ "start": 1913, "end": 3116 }
class ____(BaseCoordinateFrame): """ A base class for frames that have names and conventions like that of ecliptic frames. .. warning:: In the current version of astropy, the ecliptic frames do not yet have stringent accuracy tests. We recommend you test to "known-good" cases ...
BaseEclipticFrame
python
getsentry__sentry
src/sentry/api/endpoints/organization_stats_summary.py
{ "start": 4968, "end": 5142 }
class ____(TypedDict): start: str end: str projects: list[_ProjectSummaryStats] @extend_schema(tags=["Organizations"]) @region_silo_endpoint
StatsSummaryApiResponse
python
OmkarPathak__pygorithm
tests/test_searching.py
{ "start": 2759, "end": 3109 }
class ____(TestSearchingAlgorithm): def test_ternary_search(self): self.assertEqual(ternary_search.search(self.array, 0, len(self.array), 7), 7) alpha_result = ternary_search.search(self.alphaArray, 0, len(self.alphaArray), 'n') self.assertIs(alpha_result, 5) if __name__ == '__main__': ...
TestTernarySearch
python
huggingface__transformers
tests/models/switch_transformers/test_modeling_switch_transformers.py
{ "start": 32323, "end": 33702 }
class ____(ModelTesterMixin, unittest.TestCase): all_model_classes = (SwitchTransformersEncoderModel,) if is_torch_available() else () test_resize_embeddings = False test_model_parallel = False test_head_masking = False def setUp(self): self.model_tester = SwitchTransformersEncoderOnlyMode...
SwitchTransformersEncoderOnlyModelTest
python
tensorflow__tensorflow
tensorflow/compiler/tests/scatter_nd_op_test.py
{ "start": 7401, "end": 8499 }
class ____(xla_test.XLATestCase): def _runScatter(self, op): indices_np = np.array([[4], [3], [1], [7]], dtype=np.int32) updates_np = np.array([9, 10, 11, 12], dtype=np.float32) with self.session() as sess, self.test_scope(): indices = array_ops.placeholder(indices_np.dtype, shape=indices_np.shape)...
ScatterNdTensorTest
python
gevent__gevent
src/greentest/3.10/test_ftplib.py
{ "start": 9048, "end": 16599 }
class ____(asyncore.dispatcher, threading.Thread): handler = DummyFTPHandler def __init__(self, address, af=socket.AF_INET, encoding=DEFAULT_ENCODING): threading.Thread.__init__(self) asyncore.dispatcher.__init__(self) self.daemon = True self.create_socket(af, socket.SOCK_STREA...
DummyFTPServer
python
ethereum__web3.py
web3/contract/async_contract.py
{ "start": 6944, "end": 7194 }
class ____(BaseContractEvents[AsyncContractEvent]): def __init__( self, abi: ABI, w3: "AsyncWeb3[Any]", address: ChecksumAddress | None = None ) -> None: super().__init__(abi, w3, AsyncContractEvent, address)
AsyncContractEvents
python
ray-project__ray
python/ray/tests/test_ray_init.py
{ "start": 5157, "end": 5258 }
class ____(grpc.ChannelCredentials): def __init__(self, name): self.name = name
Credentials
python
scipy__scipy
scipy/stats/_continuous_distns.py
{ "start": 281521, "end": 282928 }
class ____(rv_continuous): r"""A power normal continuous random variable. %(before_notes)s Notes ----- The probability density function for `powernorm` is: .. math:: f(x, c) = c \phi(x) (\Phi(-x))^{c-1} where :math:`\phi` is the normal pdf, :math:`\Phi` is the normal cdf, :m...
powernorm_gen
python
getsentry__sentry
src/sentry/search/snuba/backend.py
{ "start": 12892, "end": 13428 }
class ____: def __init__(self, conditions: Mapping[str, Condition]): self.conditions = conditions def build( self, queryset: BaseQuerySet[Group, Group], search_filters: Sequence[SearchFilter] ) -> BaseQuerySet[Group, Group]: for search_filter in search_filters: name = se...
QuerySetBuilder