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
Textualize__textual
tests/test_widget_removing.py
{ "start": 4803, "end": 8442 }
class ____(App): def compose(self) -> ComposeResult: yield Button("ABC") yield Label("Outside of vertical.") with Vertical(): for index in range(5): yield Label(str(index)) async def test_widget_remove_children_container(): app = ExampleApp() async with ...
ExampleApp
python
apache__airflow
airflow-core/tests/unit/lineage/test_hook.py
{ "start": 33673, "end": 34362 }
class ____(plugins_manager.AirflowPlugin): name = "FakePluginHavingHookLineageCollector" hook_lineage_readers = [HookLineageReader] @pytest.mark.parametrize( ("has_readers", "expected_class"), [ (True, HookLineageCollector), (False, NoOpCollector), ], ) def test_get_hook_lineage_co...
FakePlugin
python
ray-project__ray
release/ray_release/tests/test_config.py
{ "start": 8606, "end": 13819 }
class ____: def test_does_not_mutate_original(self): test_definition = {"name": "test-{{arg}}"} substituted = _substitute_variable(test_definition, "arg", "1") assert substituted is not test_definition assert test_definition == {"name": "test-{{arg}}"} def test_substitute_vari...
TestSubstituteVariable
python
django__django
django/db/models/functions/math.py
{ "start": 4063, "end": 4416 }
class ____(NumericOutputFieldMixin, Transform): function = "RADIANS" lookup_name = "radians" def as_oracle(self, compiler, connection, **extra_context): return super().as_sql( compiler, connection, template="((%%(expressions)s) * %s / 180)" % math.pi, ...
Radians
python
ethereum__web3.py
web3/_utils/filters.py
{ "start": 6179, "end": 7633 }
class ____(Filter): data_filter_set = None data_filter_set_regex = None data_filter_set_function = None log_entry_formatter = None filter_params: FilterParams = None builder: EventFilterBuilder = None def __init__(self, *args: Any, **kwargs: Any) -> None: self.log_entry_formatter = ...
LogFilter
python
sqlalchemy__sqlalchemy
test/orm/test_attributes.py
{ "start": 1491, "end": 5307 }
class ____(fixtures.MappedTest): def _scalar_obj_fixture(self): class A: pass class B: pass instrumentation.register_class(A) instrumentation.register_class(B) _register_attribute(A, "b", uselist=False, useobject=True) return A, B def _c...
AttributeImplAPITest
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pylint/unnecessary_dunder_call.py
{ "start": 1346, "end": 2621 }
class ____: def __init__(self, v): self.v = v def __add__(self, other): self.v += other return self def get_v(self): return self.v foo = Foo(1) foo.__add__(2).get_v() # PLC2801 # Lambda expressions blah = lambda: a.__add__(1) # PLC2801 # If expressions print(a.__add__...
Foo
python
pypa__pip
src/pip/_vendor/pkg_resources/__init__.py
{ "start": 115429, "end": 115555 }
class ____(_packaging_requirements.InvalidRequirement): "Compatibility wrapper for InvalidRequirement"
RequirementParseError
python
allegroai__clearml
clearml/backend_api/session/jsonmodels/validators.py
{ "start": 5871, "end": 6393 }
class ____(object): """Validator for enums.""" def __init__(self, *choices: Any) -> None: """Init. :param [] choices: Valid choices for the field. """ self.choices = list(choices) def validate(self, value: Any) -> None: if value not in self.choices: tp...
Enum
python
doocs__leetcode
solution/1700-1799/1775.Equal Sum Arrays With Minimum Number of Operations/Solution2.py
{ "start": 0, "end": 532 }
class ____: def minOperations(self, nums1: List[int], nums2: List[int]) -> int: s1, s2 = sum(nums1), sum(nums2) if s1 == s2: return 0 if s1 > s2: return self.minOperations(nums2, nums1) cnt = Counter([6 - v for v in nums1] + [v - 1 for v in nums2]) d =...
Solution
python
ray-project__ray
rllib/examples/centralized_critic.py
{ "start": 8236, "end": 8918 }
class ____(CentralizedValueMixin, PPOTorchPolicy): def __init__(self, observation_space, action_space, config): PPOTorchPolicy.__init__(self, observation_space, action_space, config) CentralizedValueMixin.__init__(self) @override(PPOTorchPolicy) def loss(self, model, dist_class, train_batch...
CCPPOTorchPolicy
python
matplotlib__matplotlib
lib/matplotlib/dviread.py
{ "start": 24722, "end": 32196 }
class ____: """ Encapsulation of a font that a DVI file can refer to. This class holds a font's texname and size, supports comparison, and knows the widths of glyphs in the same units as the AFM file. There are also internal attributes (for use by dviread.py) that are *not* used for comparison....
DviFont
python
numba__numba
numba/core/datamodel/models.py
{ "start": 32687, "end": 33315 }
class ____(StructModel): def __init__(self, dmm, fe_type, need_indices): assert fe_type.array_type.layout == 'C' array_type = fe_type.array_type dtype = array_type.dtype ndim = array_type.ndim members = [('array', array_type), ('stride', types.intp), ...
CContiguousFlatIter
python
openai__openai-python
src/openai/resources/chat/completions/completions.py
{ "start": 161026, "end": 161991 }
class ____: def __init__(self, completions: AsyncCompletions) -> None: self._completions = completions self.parse = _legacy_response.async_to_raw_response_wrapper( completions.parse, ) self.create = _legacy_response.async_to_raw_response_wrapper( completions....
AsyncCompletionsWithRawResponse
python
hyperopt__hyperopt
hyperopt/tests/unit/test_rdists.py
{ "start": 456, "end": 1733 }
class ____(unittest.TestCase): def test_cdf_logcdf(self): check_cdf_logcdf(loguniform_gen(0, 1), (0, 1), "") check_cdf_logcdf(loguniform_gen(0, 1), (-5, 5), "") def test_cdf_ppf(self): check_cdf_ppf(loguniform_gen(0, 1), (0, 1), "") check_cdf_ppf(loguniform_gen(-2, 1), (-5, 5), ...
TestLogUniform
python
doocs__leetcode
solution/1200-1299/1260.Shift 2D Grid/Solution.py
{ "start": 0, "end": 360 }
class ____: def shiftGrid(self, grid: List[List[int]], k: int) -> List[List[int]]: m, n = len(grid), len(grid[0]) ans = [[0] * n for _ in range(m)] for i, row in enumerate(grid): for j, v in enumerate(row): x, y = divmod((i * n + j + k) % (m * n), n) ...
Solution
python
numba__numba
numba/tests/test_num_threads.py
{ "start": 534, "end": 21433 }
class ____(TestCase): _numba_parallel_test_ = False def setUp(self): # Make sure the num_threads is set to the max. This also makes sure # the threads are launched. set_num_threads(config.NUMBA_NUM_THREADS) def check_mask(self, expected, result): # There's no guarantee that...
TestNumThreads
python
weaviate__weaviate-python-client
weaviate/connect/event_loop.py
{ "start": 460, "end": 4227 }
class ____: def __init__(self, loop: Optional[asyncio.AbstractEventLoop] = None) -> None: self.loop = loop def start(self) -> None: if self.loop is not None: return self.loop = self.__start_new_event_loop() _EventLoop.patch_exception_handler(self.loop) def run_u...
_EventLoop
python
python-pillow__Pillow
src/PIL/BlpImagePlugin.py
{ "start": 7948, "end": 9344 }
class ____(ImageFile.ImageFile): """ Blizzard Mipmap Format """ format = "BLP" format_description = "Blizzard Mipmap Format" def _open(self) -> None: self.magic = self.fp.read(4) if not _accept(self.magic): msg = f"Bad BLP magic {repr(self.magic)}" raise...
BlpImageFile
python
pallets__jinja
src/jinja2/nodes.py
{ "start": 26893, "end": 27638 }
class ____(Expr): """Compares an expression with some other expressions. `ops` must be a list of :class:`Operand`\\s. """ fields = ("expr", "ops") expr: Expr ops: list["Operand"] def as_const(self, eval_ctx: EvalContext | None = None) -> t.Any: eval_ctx = get_eval_context(self, ev...
Compare
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 457890, "end": 458334 }
class ____(sgqlc.types.Interface): """Represents a type that can be retrieved by a URL.""" __schema__ = github_schema __field_names__ = ("resource_path", "url") resource_path = sgqlc.types.Field(sgqlc.types.non_null(URI), graphql_name="resourcePath") """The HTML path to this resource.""" url =...
UniformResourceLocatable
python
getsentry__sentry
src/sentry/api/endpoints/auth_index.py
{ "start": 5447, "end": 14302 }
class ____(BaseAuthIndexEndpoint): publish_status = { "DELETE": ApiPublishStatus.PRIVATE, "GET": ApiPublishStatus.PRIVATE, "PUT": ApiPublishStatus.PRIVATE, "POST": ApiPublishStatus.PRIVATE, } """ Manage session authentication Intended to be used by the internal Sentr...
AuthIndexEndpoint
python
pdm-project__pdm
src/pdm/models/reporter.py
{ "start": 458, "end": 836 }
class ____: def report_download(self, link: Any, completed: int, total: int | None) -> None: pass def report_build_start(self, filename: str) -> None: pass def report_build_end(self, filename: str) -> None: pass def report_unpack(self, filename: Path, completed: int, total: in...
CandidateReporter
python
huggingface__transformers
tests/models/esm/test_modeling_esmfold.py
{ "start": 6105, "end": 8341 }
class ____(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): test_mismatched_shapes = False all_model_classes = (EsmForProteinFolding,) if is_torch_available() else () pipeline_model_mapping = {} if is_torch_available() else {} test_sequence_classification_problem_types = False def setUp(...
EsmFoldModelTest
python
huggingface__transformers
src/transformers/tokenization_utils_base.py
{ "start": 45658, "end": 188986 }
class ____(PushToHubMixin): """ Base class for all tokenizer backends. """ vocab_files_names: dict[str, str] = {} pretrained_vocab_files_map: dict[str, dict[str, str]] = {} _auto_class: Optional[str] = None # first name has to correspond to main model input name # to make sure `tokeniz...
PreTrainedTokenizerBase
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typeVarDefaultClass2.py
{ "start": 2380, "end": 2849 }
class ____(Generic[P1, P2, P3]): ... pa1 = ClassPA() reveal_type(pa1, expected_text="ClassPA[..., ..., ...]") pa2 = ClassPA[[str]]() reveal_type(pa2, expected_text="ClassPA[(str), (str), (str)]") pa3 = ClassPA[..., [float]]() reveal_type(pa3, expected_text="ClassPA[..., (float), (float)]") pa4 = ClassPA[..., [int,...
ClassPA
python
numba__numba
numba/tests/test_withlifting.py
{ "start": 34119, "end": 35262 }
class ____(TestCase): # Tests for miscellaneous objmode issues. Run serially. _numba_parallel_test_ = False @linux_only @TestCase.run_test_in_subprocess def test_no_fork_in_compilation(self): # Checks that there is no fork/clone/execve during compilation, see # issue #7881. This ne...
TestMisc
python
readthedocs__readthedocs.org
readthedocs/rtd_tests/tests/test_privacy_urls.py
{ "start": 18778, "end": 18989 }
class ____(PublicUserProfileMixin, TestCase): def login(self): return self.client.login(username="tester", password="test") def is_admin(self): return False
PublicUserProfileUserAccessTest
python
sympy__sympy
sympy/plotting/series.py
{ "start": 49706, "end": 57667 }
class ____(Line2DBaseSeries): """Representation for a line consisting of a SymPy expression over a range.""" def __init__(self, expr, var_start_end, label="", **kwargs): super().__init__(**kwargs) self.expr = expr if callable(expr) else sympify(expr) self._label = str(self.expr) if labe...
LineOver1DRangeSeries
python
PrefectHQ__prefect
src/integrations/prefect-dask/tests/test_client.py
{ "start": 449, "end": 2267 }
class ____: async def test_with_task(self): flow_run_id = None @task def test_task(): return 42 @flow def test_flow(): nonlocal flow_run_id flow_run_id = FlowRunContext.get().flow_run.id with PrefectDaskClient() as client: ...
TestSubmit
python
sphinx-doc__sphinx
sphinx/search/ru.py
{ "start": 193, "end": 596 }
class ____(SearchLanguage): lang = 'ru' language_name = 'Russian' js_stemmer_rawcode = 'russian-stemmer.js' stopwords = RUSSIAN_STOPWORDS def __init__(self, options: dict[str, str]) -> None: super().__init__(options) self.stemmer = snowballstemmer.stemmer('russian') def stem(se...
SearchRussian
python
pyca__cryptography
src/cryptography/hazmat/primitives/asymmetric/ec.py
{ "start": 7902, "end": 8057 }
class ____(EllipticCurve): name = "sect233k1" key_size = 232 group_order = 0x8000000000000000000000000000069D5BB915BCD46EFB1AD5F173ABDF
SECT233K1
python
kamyu104__LeetCode-Solutions
Python/smallest-string-with-swaps.py
{ "start": 1227, "end": 2205 }
class ____(object): def smallestStringWithSwaps(self, s, pairs): """ :type s: str :type pairs: List[List[int]] :rtype: str """ def dfs(i, adj, lookup, component): lookup.add(i) component.append(i) for j in adj[i]: if...
Solution2
python
dagster-io__dagster
python_modules/dagster/dagster/_core/errors.py
{ "start": 15209, "end": 16035 }
class ____(DagsterError, AttributeError): # inherits from AttributeError as it is raised within a __getattr__ call... used to support # object hasattr method """Indicates that an unknown resource was accessed in the body of an execution step. May often happen by accessing a resource in the compute funct...
DagsterUnknownResourceError
python
PrefectHQ__prefect
src/prefect/client/schemas/objects.py
{ "start": 43353, "end": 43584 }
class ____(ObjectBaseModel): """An ORM representation of account info.""" key: str = Field(default=..., description="Account info key") value: dict[str, Any] = Field(default=..., description="Account info")
Configuration
python
pytorch__pytorch
torch/testing/_internal/common_fsdp.py
{ "start": 32211, "end": 34032 }
class ____(nn.Sequential): def __init__(self, mlp_dim: int, *, with_seq_parallel: bool = False): modules: list[nn.Module] = [ # Use multiplier of 3 to exercise uneven case MLP(mlp_dim, dim_multiplier=3), MLP(mlp_dim), MLP(mlp_dim, dim_multiplier=3), ] ...
MLPStack
python
zarr-developers__zarr-python
src/zarr/core/buffer/core.py
{ "start": 609, "end": 986 }
class ____(Protocol): """Protocol for the array-like type that underlie Buffer""" @property def dtype(self) -> np.dtype[Any]: ... @property def ndim(self) -> int: ... @property def size(self) -> int: ... def __getitem__(self, key: slice) -> Self: ... def __setitem__(self, key: s...
ArrayLike
python
PrefectHQ__prefect
src/prefect/server/orchestration/core_policy.py
{ "start": 3547, "end": 4792 }
class ____(TaskRunOrchestrationPolicy): """ Orchestration rules that run against task-run-state transitions in priority order. """ @staticmethod def priority() -> list[ Union[ type[BaseUniversalTransform[orm_models.TaskRun, core.TaskRunPolicy]], type[BaseOrchestratio...
CoreTaskPolicy
python
sqlalchemy__sqlalchemy
test/sql/test_operators.py
{ "start": 33252, "end": 37591 }
class ____(fixtures.TestBase, testing.AssertsCompiledSQL): __dialect__ = "default" def test_contains(self): class MyType(UserDefinedType): cache_ok = True class comparator_factory(UserDefinedType.Comparator): def contains(self, other, **kw): ...
ExtensionOperatorTest
python
scipy__scipy
scipy/stats/_qmc.py
{ "start": 70966, "end": 84703 }
class ____(QMCEngine): """Poisson disk sampling. Parameters ---------- d : int Dimension of the parameter space. radius : float Minimal distance to keep between points when sampling new candidates. hypersphere : {"volume", "surface"}, optional Sampling strategy to genera...
PoissonDisk
python
scrapy__scrapy
tests/test_spidermiddleware.py
{ "start": 13706, "end": 13822 }
class ____: async def process_spider_output_async(self, response, result): yield
UniversalMiddlewareNoSync
python
getsentry__sentry
tests/sentry/users/api/endpoints/test_user_role_details.py
{ "start": 170, "end": 1187 }
class ____(APITestCase): endpoint = "sentry-api-0-user-userrole-details" def setUp(self) -> None: super().setUp() self.user = self.create_user(is_superuser=True) self.login_as(user=self.user, superuser=True) self.add_user_permission(self.user, "users.admin") def test_fails_...
UserUserRolesTest
python
huggingface__transformers
src/transformers/models/mm_grounding_dino/modeling_mm_grounding_dino.py
{ "start": 108811, "end": 118854 }
class ____(ModelOutput): r""" loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` are provided)): Total loss as a linear combination of a negative log-likehood (cross-entropy) for class prediction and a bounding box loss. The latter is defined as a linear combination of...
MMGroundingDinoObjectDetectionOutput
python
huggingface__transformers
src/transformers/models/florence2/modular_florence2.py
{ "start": 70238, "end": 77608 }
class ____(LlavaForConditionalGeneration): _checkpoint_conversion_mapping = {} _tied_weights_keys = { "lm_head.weight": "model.language_model.shared.weight", } def get_image_features(self, pixel_values: torch.Tensor, **kwargs): return self.model.get_image_features(pixel_values=pixel_val...
Florence2ForConditionalGeneration
python
doocs__leetcode
solution/1100-1199/1117.Building H2O/Solution.py
{ "start": 34, "end": 605 }
class ____: def __init__(self): self.h = Semaphore(2) self.o = Semaphore(0) def hydrogen(self, releaseHydrogen: "Callable[[], None]") -> None: self.h.acquire() # releaseHydrogen() outputs "H". Do not change or remove this line. releaseHydrogen() if self.h._value ...
H2O
python
kamyu104__LeetCode-Solutions
Python/circle-and-rectangle-overlapping.py
{ "start": 602, "end": 1162 }
class ____(object): def checkOverlap(self, radius, x_center, y_center, x1, y1, x2, y2): """ :type radius: int :type x_center: int :type y_center: int :type x1: int :type y1: int :type x2: int :type y2: int :rtype: bool """ x1 -=...
Solution2
python
huggingface__transformers
src/transformers/models/vitpose_backbone/modeling_vitpose_backbone.py
{ "start": 11141, "end": 12845 }
class ____(GradientCheckpointingLayer): def __init__(self, config: VitPoseBackboneConfig): super().__init__() self.num_experts = config.num_experts self.attention = VitPoseBackboneAttention(config) self.mlp = VitPoseBackboneMLP(config) if self.num_experts == 1 else VitPoseBackboneMoe...
VitPoseBackboneLayer
python
doocs__leetcode
solution/1700-1799/1714.Sum Of Special Evenly-Spaced Elements In Array/Solution.py
{ "start": 0, "end": 553 }
class ____: def solve(self, nums: List[int], queries: List[List[int]]) -> List[int]: mod = 10**9 + 7 n = len(nums) m = int(sqrt(n)) suf = [[0] * (n + 1) for _ in range(m + 1)] for i in range(1, m + 1): for j in range(n - 1, -1, -1): suf[i][j] = suf...
Solution
python
aio-libs__aiohttp
aiohttp/connector.py
{ "start": 2464, "end": 5163 }
class ____: """Represents a single connection.""" __slots__ = ( "_key", "_connector", "_loop", "_protocol", "_callbacks", "_source_traceback", ) def __init__( self, connector: "BaseConnector", key: "ConnectionKey", protoco...
Connection
python
scipy__scipy
benchmarks/benchmarks/go_benchmark_functions/go_funcs_B.py
{ "start": 8649, "end": 9922 }
class ____(Benchmark): r""" Bohachevsky 1 objective function. The Bohachevsky 1 [1]_ global optimization problem is a multimodal minimization problem defined as follows .. math:: f_{\text{Bohachevsky}}(x) = \sum_{i=1}^{n-1}\left[x_i^2 + 2 x_{i+1}^2 - 0.3 \cos(3 \pi x_i) - 0.4...
Bohachevsky1
python
sympy__sympy
sympy/codegen/fnodes.py
{ "start": 18679, "end": 18756 }
class ____(F95Function): """ Fortran merge function """ nargs = 3
merge
python
getsentry__sentry
tests/sentry/apidocs/test_extensions.py
{ "start": 594, "end": 717 }
class ____(TypedDict, total=False): a: int @extend_schema_serializer(exclude_fields=["excluded"])
BasicSerializerOptional
python
dagster-io__dagster
python_modules/libraries/dagster-aws/dagster_aws/ecs/tasks.py
{ "start": 10947, "end": 15341 }
class ____(Exception): pass def get_task_definition_dict_from_current_task( ecs, family, current_task, image: str, container_name, environment, command=None, secrets=None, include_sidecars=False, task_role_arn=None, execution_role_arn=None, runtime_platform=None, ...
EcsNoTasksFound
python
kamyu104__LeetCode-Solutions
Python/reverse-subarray-to-maximize-array-value.py
{ "start": 29, "end": 677 }
class ____(object): def maxValueAfterReverse(self, nums): """ :type nums: List[int] :rtype: int """ result, add, max_pair, min_pair = 0, 0, float("-inf"), float("inf") for i in xrange(1, len(nums)): result += abs(nums[i-1]-nums[i]) add = max(ad...
Solution
python
pyinstaller__pyinstaller
bootloader/waflib/Tools/qt5.py
{ "start": 7624, "end": 7828 }
class ____(Task.Task): color = 'BLUE' run_str = '${QT_MOC} ${MOC_FLAGS} ${MOCCPPPATH_ST:INCPATHS} ${MOCDEFINES_ST:DEFINES} ${SRC} ${MOC_ST} ${TGT}' def quote_flag(self, x): return x
moc
python
scikit-learn__scikit-learn
examples/bicluster/plot_bicluster_newsgroups.py
{ "start": 1890, "end": 5351 }
class ____(TfidfVectorizer): def build_tokenizer(self): tokenize = super().build_tokenizer() return lambda doc: list(number_normalizer(tokenize(doc))) # exclude 'comp.os.ms-windows.misc' categories = [ "alt.atheism", "comp.graphics", "comp.sys.ibm.pc.hardware", "comp.sys.mac.hardwa...
NumberNormalizingVectorizer
python
pytorch__pytorch
torch/_dynamo/convert_frame.py
{ "start": 76710, "end": 80557 }
class ____: def __init__(self, callback: ConvertFrameProtocol, hooks: Hooks) -> None: functools.wraps(callback)(self) self._torchdynamo_orig_backend = callback self.hooks = hooks def __call__( self, frame: DynamoFrameType, cache_entry: Optional[CacheEntry], ...
CatchErrorsWrapper
python
django__django
tests/middleware/test_security.py
{ "start": 142, "end": 12079 }
class ____(SimpleTestCase): def middleware(self, *args, **kwargs): from django.middleware.security import SecurityMiddleware return SecurityMiddleware(self.response(*args, **kwargs)) @property def secure_request_kwargs(self): return {"wsgi.url_scheme": "https"} def response(se...
SecurityMiddlewareTest
python
eventlet__eventlet
eventlet/green/http/cookies.py
{ "start": 23727, "end": 24189 }
class ____(BaseCookie): """ SimpleCookie supports strings as cookie values. When setting the value using the dictionary assignment notation, SimpleCookie calls the builtin str() to convert the value to a string. Values received from HTTP are kept as strings. """ def value_decode(self, val)...
SimpleCookie
python
apache__airflow
providers/celery/tests/unit/celery/sensors/test_celery_queue.py
{ "start": 949, "end": 2943 }
class ____: def setup_method(self): class TestCeleryqueueSensor(CeleryQueueSensor): def _check_task_id(self, context): return True self.sensor = TestCeleryqueueSensor @patch("celery.app.control.Inspect") def test_poke_success(self, mock_inspect): mock_in...
TestCeleryQueueSensor
python
apache__airflow
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/executors/kubernetes_executor_utils.py
{ "start": 2058, "end": 2213 }
class ____(metaclass=Singleton): """Singleton for tracking resourceVersion from Kubernetes.""" resource_version: dict[str, str] = {}
ResourceVersion
python
mlflow__mlflow
tests/db/test_tracking_operations.py
{ "start": 265, "end": 5909 }
class ____(mlflow.pyfunc.PythonModel): def load_context(self, context): pass def predict(self, context, model_input, params=None): pass def start_run_and_log_data(): with mlflow.start_run(): mlflow.log_param("p", "param") mlflow.log_metric("m", 1.0) mlflow.set_tag(...
Model
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1046867, "end": 1047520 }
class ____(sgqlc.types.Type): """Autogenerated return type of UpdateTeamsRepository""" __schema__ = github_schema __field_names__ = ("client_mutation_id", "repository", "teams") client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId") """A unique identifier for the client per...
UpdateTeamsRepositoryPayload
python
encode__django-rest-framework
rest_framework/viewsets.py
{ "start": 8357, "end": 8632 }
class ____(ViewSetMixin, generics.GenericAPIView): """ The GenericViewSet class does not provide any actions by default, but does include the base set of generic view behavior, such as the `get_object` and `get_queryset` methods. """ pass
GenericViewSet
python
aio-libs__aiohttp
aiohttp/web_protocol.py
{ "start": 2854, "end": 2991 }
class ____: status: int exc: BaseException message: str _MsgType = tuple[RawRequestMessage | _ErrInfo, StreamReader]
_ErrInfo
python
huggingface__transformers
tests/models/owlvit/test_image_processing_owlvit.py
{ "start": 3145, "end": 5059 }
class ____(ImageProcessingTestMixin, unittest.TestCase): image_processing_class = OwlViTImageProcessor if is_vision_available() else None fast_image_processing_class = OwlViTImageProcessorFast if is_torchvision_available() else None def setUp(self): super().setUp() self.image_processor_test...
OwlViTImageProcessingTest
python
modin-project__modin
modin/tests/pandas/test_io.py
{ "start": 112357, "end": 120688 }
class ____: # It's not easy to add infrastructure for `spss` format. # In case of defaulting to pandas, it's enough # to check that the parameters are passed to pandas. def test_read_spss(self): test_args = ("fake_path",) test_kwargs = dict( usecols=["A"], convert_categorical...
TestSpss
python
django__django
django/contrib/postgres/indexes.py
{ "start": 2890, "end": 4030 }
class ____(PostgresIndex): suffix = "brin" def __init__( self, *expressions, autosummarize=None, pages_per_range=None, **kwargs ): if pages_per_range is not None and pages_per_range <= 0: raise ValueError("pages_per_range must be None or a positive integer") self.autosum...
BrinIndex
python
jschneier__django-storages
storages/backends/gcloud.py
{ "start": 1312, "end": 3572 }
class ____(CompressedFileMixin, File): def __init__(self, name, mode, storage): self.name = name self.mime_type, self.mime_encoding = mimetypes.guess_type(name) self._mode = mode self._storage = storage self.blob = storage.bucket.get_blob(name, chunk_size=storage.blob_chunk_s...
GoogleCloudFile
python
kamyu104__LeetCode-Solutions
Python/longest-substring-of-one-repeating-character.py
{ "start": 2456, "end": 3755 }
class ____(object): def __init__(self, N, build_fn=lambda _: float("inf"), query_fn=lambda x, y: y if x is None else x if y is None else min(x, y), update_fn=lambda x: x): self.tree = [None]*(2*2**((N-1).bit_length())) self.base = len(self.tree)//2 ...
SegmentTree2
python
coleifer__peewee
playhouse/dataset.py
{ "start": 14285, "end": 14488 }
class ____(CSVImporter): def load(self, file_obj, header=True, **kwargs): kwargs.setdefault('delimiter', '\t') return super(TSVImporter, self).load(file_obj, header, **kwargs)
TSVImporter
python
getsentry__sentry
src/sentry/models/teamreplica.py
{ "start": 373, "end": 1235 }
class ____(Model): __relocation_scope__ = RelocationScope.Excluded team_id = HybridCloudForeignKey("sentry.Team", on_delete="CASCADE") organization_id = HybridCloudForeignKey("sentry.Organization", on_delete="CASCADE") slug = models.SlugField() name = models.CharField(max_length=64) status = Bo...
TeamReplica
python
sympy__sympy
sympy/polys/agca/homomorphisms.py
{ "start": 17749, "end": 21937 }
class ____(MatrixHomomorphism): """ Concrete class for homomorphism with domain a submodule of a free module or a quotient thereof. Do not instantiate; the constructor does not check that your data is well defined. Use the ``homomorphism`` function instead: >>> from sympy import QQ >>> fro...
SubModuleHomomorphism
python
tensorflow__tensorflow
tensorflow/python/keras/saving/saved_model/layer_serialization.py
{ "start": 6932, "end": 7304 }
class ____(LayerSavedModelSaver): """Index lookup layer serialization.""" @property def python_properties(self): # TODO(kathywu): Add python property validator metadata = self._python_properties_internal() if metadata['config'].get('has_static_table', False): metadata['config']['vocabulary'] = ...
IndexLookupLayerSavedModelSaver
python
sphinx-doc__sphinx
doc/usage/extensions/example_google.py
{ "start": 5387, "end": 9165 }
class ____: """The summary line for a class docstring should fit on one line. If the class has public attributes, they may be documented here in an ``Attributes`` section and follow the same formatting as a function's ``Args`` section. Alternatively, attributes may be documented inline with the att...
ExampleClass
python
fastapi__sqlmodel
sqlmodel/orm/session.py
{ "start": 840, "end": 5763 }
class ____(_Session): @overload def exec( self, statement: Select[_TSelectParam], *, params: Optional[Union[Mapping[str, Any], Sequence[Mapping[str, Any]]]] = None, execution_options: Mapping[str, Any] = util.EMPTY_DICT, bind_arguments: Optional[Dict[str, Any]] = ...
Session
python
huggingface__transformers
tests/models/afmoe/test_modeling_afmoe.py
{ "start": 898, "end": 3298 }
class ____(CausalLMModelTester): if is_torch_available(): base_model_class = AfmoeModel def __init__( self, parent, batch_size=4, seq_length=128, is_training=True, use_input_mask=True, use_token_type_ids=False, use_labels=True, voc...
AfmoeModelTester
python
scrapy__scrapy
tests/test_pipelines.py
{ "start": 1818, "end": 2203 }
class ____: async def process_item(self, item): d1 = Deferred() from twisted.internet import reactor reactor.callLater(0, d1.callback, None) await d1 d2 = Deferred() reactor.callLater(0, d2.callback, None) await maybe_deferred_to_future(d2) item["pipe...
AsyncDefNotAsyncioPipeline
python
numpy__numpy
numpy/_build_utils/tempita/_tempita.py
{ "start": 16639, "end": 16857 }
class ____: def __init__(self, name): self.__name = name self.get = TemplateObjectGetter(self) def __repr__(self): return "<%s %s>" % (self.__class__.__name__, self.__name)
TemplateObject
python
openai__openai-python
src/openai/resources/beta/chatkit/chatkit.py
{ "start": 1646, "end": 2687 }
class ____(AsyncAPIResource): @cached_property def sessions(self) -> AsyncSessions: return AsyncSessions(self._client) @cached_property def threads(self) -> AsyncThreads: return AsyncThreads(self._client) @cached_property def with_raw_response(self) -> AsyncChatKitWithRawRespon...
AsyncChatKit
python
doocs__leetcode
solution/3600-3699/3678.Smallest Absent Positive Greater Than Average/Solution.py
{ "start": 0, "end": 205 }
class ____: def smallestAbsent(self, nums: List[int]) -> int: s = set(nums) ans = max(1, sum(nums) // len(nums) + 1) while ans in s: ans += 1 return ans
Solution
python
django__django
tests/defer_regress/models.py
{ "start": 1081, "end": 1139 }
class ____(Item): class Meta: proxy = True
Proxy
python
pandas-dev__pandas
pandas/_typing.py
{ "start": 2790, "end": 7616 }
class ____(Protocol[_T_co]): __module__: str = "pandas.api.typing.aliases" @overload def __getitem__(self, index: SupportsIndex, /) -> _T_co: ... @overload def __getitem__(self, index: slice, /) -> Sequence[_T_co]: ... def __contains__(self, value: object, /) -> bool: ... def __len__(sel...
SequenceNotStr
python
allegroai__clearml
clearml/backend_api/services/v2_23/tasks.py
{ "start": 500399, "end": 501448 }
class ____(Response): """ Response of tasks.share endpoint. :param changed: The number of updated tasks :type changed: int """ _service = "tasks" _action = "share" _version = "2.23" _schema = { "definitions": {}, "properties": { "changed": { ...
ShareResponse
python
kamyu104__LeetCode-Solutions
Python/circular-sentence.py
{ "start": 38, "end": 314 }
class ____(object): def isCircularSentence(self, sentence): """ :type sentence: str :rtype: bool """ return sentence[0] == sentence[-1] and all(sentence[i-1] == sentence[i+1]for i in xrange(len(sentence)) if sentence[i] == ' ')
Solution
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/context_manager.py
{ "start": 266, "end": 842 }
class ____: def __init__(self): self.value = "" def __enter__(self): self.value = _test_source() return self def __exit__(self, exc_type, exc_value, traceback): return def test_source_on_enter(): c = SourceOnEnter() with c: _test_sink(c.value) # Issue her...
SourceOnEnter
python
redis__redis-py
tests/test_multidb/test_pipeline.py
{ "start": 645, "end": 10559 }
class ____: @pytest.mark.parametrize( "mock_multi_db_config,mock_db, mock_db1, mock_db2", [ ( {}, {"weight": 0.2, "circuit": {"state": CBState.CLOSED}}, {"weight": 0.7, "circuit": {"state": CBState.CLOSED}}, {"weight": 0.5, ...
TestPipeline
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/genericType28.py
{ "start": 3625, "end": 3710 }
class ____(Variadic_TA2[T]): ... # This should generate an error.
VariadicChild_WithTA2
python
ray-project__ray
rllib/utils/replay_buffers/tests/test_reservoir_buffer.py
{ "start": 198, "end": 4023 }
class ____(unittest.TestCase): def test_timesteps_unit(self): """Tests adding, sampling, get-/set state, and eviction with experiences stored by timesteps.""" self.batch_id = 0 def _add_data_to_buffer(_buffer, batch_size, num_batches=5, **kwargs): def _generate_data(): ...
TestReservoirBuffer
python
OmkarPathak__pygorithm
pygorithm/geometry/polygon2.py
{ "start": 188, "end": 22715 }
class ____(object): """ Define a concave polygon defined by a list of points such that each adjacent pair of points form a line, the line from the last point to the first point form a line, and the lines formed from the smaller index to the larger index will walk clockwise around the polygon. ...
Polygon2
python
django__django
tests/i18n/tests.py
{ "start": 18271, "end": 19753 }
class ____(SimpleTestCase): def setUp(self): """Clear translation state.""" self._old_language = get_language() self._old_translations = trans_real._translations deactivate() trans_real._translations = {} def tearDown(self): trans_real._translations = self._old_t...
TranslationLoadingTests
python
wandb__wandb
wandb/sdk/artifacts/_generated/enums.py
{ "start": 149, "end": 246 }
class ____(str, Enum): SEQUENCE = "SEQUENCE" PORTFOLIO = "PORTFOLIO"
ArtifactCollectionType
python
allegroai__clearml
clearml/backend_api/services/v2_23/datasets.py
{ "start": 195848, "end": 204945 }
class ____(Request): """ Gets the version tree of a dataset. :param start_from: Dataset ID :type start_from: str :param dataset: Get versions starting from this time :type dataset: str :param only_fields: List of version fields to fetch :type only_fields: Sequence[str] :param versio...
GetVersionsRequest
python
getsentry__sentry
tests/sentry/api/test_base.py
{ "start": 1540, "end": 1702 }
class ____(Endpoint): permission_classes: tuple[type[BasePermission], ...] = () def get(self, request): return Response({"ok": True})
DummyEndpoint
python
python-excel__xlwt
xlwt/antlr.py
{ "start": 31173, "end": 33621 }
class ____(TokenStreamBasicFilter): def __init__(self,input): TokenStreamBasicFilter.__init__(self,input) self.hideMask = BitSet() self.nextMonitoredToken = None self.lastHiddenToken = None self.firstHidden = None def consume(self): self.nextMonitoredToken = sel...
TokenStreamHiddenTokenFilter
python
redis__redis-py
redis/asyncio/client.py
{ "start": 29415, "end": 32218 }
class ____: """ Monitor is useful for handling the MONITOR command to the redis server. next_command() method returns one command from monitor listen() method yields commands from monitor. """ monitor_re = re.compile(r"\[(\d+) (.*?)\] (.*)") command_re = re.compile(r'"(.*?)(?<!\\)"') d...
Monitor
python
spack__spack
lib/spack/spack/llnl/util/argparsewriter.py
{ "start": 293, "end": 1694 }
class ____: """Parsed representation of a command from argparse. This is a single command from an argparse parser. ``ArgparseWriter`` creates these and returns them from ``parse()``, and it passes one of these to each call to ``format()`` so that we can take an action for a single command. """ ...
Command
python
apache__airflow
airflow-core/src/airflow/models/hitl.py
{ "start": 4298, "end": 6352 }
class ____(Base, HITLDetailPropertyMixin): """Human-in-the-loop request and corresponding response.""" __tablename__ = "hitl_detail" ti_id: Mapped[str] = mapped_column( String(36).with_variant(postgresql.UUID(as_uuid=False), "postgresql"), primary_key=True, nullable=False, ) ...
HITLDetail
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/run_request.py
{ "start": 2595, "end": 11117 }
class ____(IHaveNew, LegacyNamedTupleMixin): """Represents all the information required to launch a single run. Must be returned by a SensorDefinition or ScheduleDefinition's evaluation function for a run to be launched. Args: run_key (Optional[str]): A string key to identify this launched run. Fo...
RunRequest
python
ansible__ansible
lib/ansible/module_utils/_internal/_concurrent/_daemon_threading.py
{ "start": 321, "end": 1085 }
class ____(_threading.Thread): """ Daemon-only Thread subclass; prevents running threads of this type from blocking interpreter shutdown and process exit. The join() method is a no-op. """ def __init__(self, *args, daemon: bool | None = None, **kwargs) -> None: super().__init__(*args, daemo...
_DaemonThread