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
scipy__scipy
scipy/sparse/_matrix.py
{ "start": 0, "end": 5022 }
class ____: """This class provides a base class for all sparse matrix classes. It cannot be instantiated. Most of the work is provided by subclasses. """ _allow_nd = (2,) @property def _bsr_container(self): from ._bsr import bsr_matrix return bsr_matrix @property def ...
spmatrix
python
readthedocs__readthedocs.org
readthedocs/search/api/v2/views.py
{ "start": 7008, "end": 7114 }
class ____(SettingsOverrideObject): _default_class = BaseProxiedPageSearchAPIView
ProxiedPageSearchAPIView
python
Pylons__pyramid
tests/test_csrf.py
{ "start": 87, "end": 1739 }
class ____(unittest.TestCase): class MockSession: def __init__(self, current_token='02821185e4c94269bdc38e6eeae0a2f8'): self.current_token = current_token def new_csrf_token(self): self.current_token = 'e5e9e30a08b34ff9842ff7d2b958c14b' return self.current_token ...
TestLegacySessionCSRFStoragePolicy
python
walkccc__LeetCode
solutions/474. Ones and Zeroes/474.py
{ "start": 0, "end": 458 }
class ____: def findMaxForm(self, strs: list[str], m: int, n: int) -> int: # dp[i][j] := the maximum size of the subset given i 0s and j 1s are # available dp = [[0] * (n + 1) for _ in range(m + 1)] for s in strs: zeros = s.count('0') ones = len(s) - zeros for i in range(m, zeros - ...
Solution
python
has2k1__plotnine
plotnine/scales/scale_xy.py
{ "start": 9241, "end": 9407 }
class ____(scale_y_continuous): """ Continuous y position log10 transformed scale """ trans: TransUser = "log10" @dataclass(kw_only=True)
scale_y_log10
python
huggingface__transformers
src/transformers/quantizers/quantizer_torchao.py
{ "start": 3075, "end": 26575 }
class ____(HfQuantizer): """ Quantizer for torchao: https://github.com/pytorch/ao/ """ requires_parameters_quantization = True requires_calibration = False required_packages = ["torchao"] def __init__(self, quantization_config, **kwargs): super().__init__(quantization_config, **kwa...
TorchAoHfQuantizer
python
dask__distributed
distributed/comm/inproc.py
{ "start": 2508, "end": 3715 }
class ____: """ A single-reader, single-writer, non-threadsafe, peekable queue. """ def __init__(self): self._q = deque() self._read_future = None def get_nowait(self): q = self._q if not q: raise QueueEmpty return q.popleft() def get(self):...
Queue
python
django__django
tests/model_inheritance_regress/models.py
{ "start": 690, "end": 911 }
class ____(Place): # The parent_link connector need not be the pk on the model. primary_key = models.AutoField(primary_key=True) parent = models.OneToOneField(Place, models.CASCADE, parent_link=True)
ParkingLot3
python
pytorch__pytorch
torch/jit/frontend.py
{ "start": 3619, "end": 3670 }
class ____(FrontendError): pass
NotSupportedError
python
aio-libs__aiohttp
aiohttp/web_urldispatcher.py
{ "start": 28627, "end": 29487 }
class ____(AbstractRoute): def __init__(self, http_exception: HTTPException) -> None: super().__init__(hdrs.METH_ANY, self._handle) self._http_exception = http_exception def url_for(self, *args: str, **kwargs: str) -> URL: raise RuntimeError(".url_for() is not allowed for SystemRoute") ...
SystemRoute
python
django__django
tests/apps/query_performing_app/apps.py
{ "start": 433, "end": 728 }
class ____(BaseAppConfig): def _perform_query(self): from ..models import TotallyNormal queryset = TotallyNormal.objects.using(self.database) queryset.update_or_create(name="new name") self.query_results = list(queryset.values_list("name"))
ModelQueryAppConfig
python
walkccc__LeetCode
solutions/2202. Maximize the Topmost Element After K Moves/2202.py
{ "start": 0, "end": 516 }
class ____: def maximumTop(self, nums: list[int], k: int) -> int: n = len(nums) # After taking k elements, if we're left something, then we return nums[k] # Otherwise, return -1. if k == 0 or k == 1: return -1 if n == k else nums[k] # Remove then add even number of times. if n == 1: ...
Solution
python
getsentry__sentry
src/sentry/api/endpoints/warmup.py
{ "start": 938, "end": 2012 }
class ____(Endpoint): publish_status = { "GET": ApiPublishStatus.PRIVATE, } owner = ApiOwner.UNOWNED permission_classes = () rate_limits = RateLimitConfig(group="INTERNAL") def get(self, request: Request) -> Response: languages = [lang for lang, _ in settings.LANGUAGES] ...
WarmupEndpoint
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/compiler_wrapper/package.py
{ "start": 407, "end": 10573 }
class ____(Package): """Spack compiler wrapper script. Compiler commands go through this compiler wrapper in Spack builds. The compiler wrapper is a thin layer around the standard compilers. It enables several key pieces of functionality: 1. It allows Spack to swap compilers into and out of builds...
CompilerWrapper
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 908621, "end": 909821 }
class ____(sgqlc.types.Type): """Represents the client's rate limit.""" __schema__ = github_schema __field_names__ = ("cost", "limit", "node_count", "remaining", "reset_at", "used") cost = sgqlc.types.Field(sgqlc.types.non_null(Int), graphql_name="cost") """The point cost for the current query coun...
RateLimit
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 101661, "end": 102560 }
class ____(sgqlc.types.Enum): """The possible actions that GitHub Sponsors activities can represent. Enumeration Choices: * `CANCELLED_SPONSORSHIP`: The activity was cancelling a sponsorship. * `NEW_SPONSORSHIP`: The activity was starting a sponsorship. * `PENDING_CHANGE`: The activity w...
SponsorsActivityAction
python
huggingface__transformers
src/transformers/models/t5gemma/modeling_t5gemma.py
{ "start": 23699, "end": 24249 }
class ____(nn.Module): """Head for sentence-level classification tasks.""" def __init__(self, hidden_size: int, num_labels: int, classifier_dropout_rate: float = 0.0): super().__init__() self.dropout = nn.Dropout(p=classifier_dropout_rate) self.out_proj = nn.Linear(hidden_size, num_labe...
T5GemmaClassificationHead
python
huggingface__transformers
tests/models/layoutlmv2/test_processing_layoutlmv2.py
{ "start": 5701, "end": 22271 }
class ____(unittest.TestCase): @cached_property def get_images(self): # we verify our implementation on 2 document images from the DocVQA dataset from datasets import load_dataset ds = load_dataset("hf-internal-testing/fixtures_docvqa", split="test") return ds[0]["image"].conver...
LayoutLMv2ProcessorIntegrationTests
python
kamyu104__LeetCode-Solutions
Python/smallest-greater-multiple-made-of-two-digits.py
{ "start": 84, "end": 804 }
class ____(object): def findInteger(self, k, digit1, digit2): """ :type k: int :type digit1: int :type digit2: int :rtype: int """ MAX_NUM_OF_DIGITS = 10 INT_MAX = 2**31-1 if digit1 < digit2: digit1, digit2 = digit2, digit1 ...
Solution
python
google__pytype
pytype/tests/test_overload.py
{ "start": 142, "end": 8480 }
class ____(test_base.BaseTest): """Tests for typing.overload.""" def test_simple(self): self.Check(""" from typing import overload @overload def f(x: int) -> int: pass def f(x): return x """) def test_bad_implementation(self): errors = self.CheckWithErrors("""...
OverloadTest
python
openai__openai-python
tests/api_resources/chat/completions/test_messages.py
{ "start": 455, "end": 2571 }
class ____: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_list(self, client: OpenAI) -> None: message = client.chat.completions.messages.list( completion_id="completion_id", ) assert_ma...
TestMessages
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typedDict19.py
{ "start": 269, "end": 317 }
class ____(TypedDict): x: NotRequired[str]
TD1
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/dataproc_metastore.py
{ "start": 31999, "end": 35468 }
class ____(GoogleCloudBaseOperator): """ Get the details of a single service. :param region: Required. The ID of the Google Cloud region that the service belongs to. :param project_id: Required. The ID of the Google Cloud project that the service belongs to. :param service_id: Required. The ID of ...
DataprocMetastoreGetServiceOperator
python
pytest-dev__pytest
src/_pytest/python.py
{ "start": 44650, "end": 60020 }
class ____: """Objects passed to the :hook:`pytest_generate_tests` hook. They help to inspect a test function and to generate tests according to test configuration or values specified in the class or module where a test function is defined. """ def __init__( self, definition: F...
Metafunc
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/hooks/bigquery_dts.py
{ "start": 1765, "end": 11660 }
class ____(GoogleBaseHook): """ Hook for Google Bigquery Transfer API. All the methods in the hook where ``project_id`` is used must be called with keyword arguments rather than positional. """ _conn: Resource | None = None def __init__( self, gcp_conn_id: str = "google_cl...
BiqQueryDataTransferServiceHook
python
kamyu104__LeetCode-Solutions
Python/balanced-k-factor-decomposition.py
{ "start": 1337, "end": 2437 }
class ____(object): def minDifference(self, n, k): """ :type n: int :type k: int :rtype: List[int] """ def factors(n): for i in xrange(1, n+1): if i*i > n: break if n%i: continue ...
Solution2
python
nedbat__coveragepy
coverage/exceptions.py
{ "start": 810, "end": 899 }
class ____(CoverageException): """An error in using a data file.""" pass
DataError
python
miyuchina__mistletoe
test/test_latex_renderer.py
{ "start": 5454, "end": 6589 }
class ____(TestCase): def setUp(self): self.renderer = LaTeXRenderer() self.renderer.__enter__() self.addCleanup(self.renderer.__exit__, None, None, None) def test_footnote_image(self): from mistletoe import Document raw = ['![alt][foo]\n', '\n', '[foo]: bar "title"\n'] ...
TestLaTeXFootnotes
python
matplotlib__matplotlib
lib/matplotlib/_type1font.py
{ "start": 2754, "end": 2812 }
class ____(_Token): kind = 'whitespace'
_WhitespaceToken
python
getsentry__sentry
tests/sentry/integrations/discord/message_builder/test_flags.py
{ "start": 169, "end": 702 }
class ____(TestCase): def assert_bits_are_set(self, value: int, bits: list[int]) -> None: expected = 0 for bit in bits: expected = expected | 1 << bit assert (value & 1 << bit) == 1 << bit assert expected == value def test_none(self) -> None: flags = Disc...
TestDiscordMessageFlags
python
numba__numba
numba/tests/test_interpreter.py
{ "start": 1741, "end": 15412 }
class ____(MemoryLeakMixin, TestCase): """ gh #7812 Tests that check a peephole optimization for Function calls in Python 3.10. The bytecode changes when (n_args / 2) + n_kws > 15, which moves the arguments from the stack into a tuple and dictionary. This peephole optimization updates the ...
TestCallFunctionExPeepHole
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/genericType24.py
{ "start": 377, "end": 445 }
class ____(Parent[T]): def m2(self) -> None: self.m1()
Child
python
django__django
tests/serializers/models/data.py
{ "start": 5267, "end": 5353 }
class ____(models.Model): data = models.IntegerField(primary_key=True)
IntegerPKData
python
pypa__setuptools
setuptools/_vendor/importlib_metadata/__init__.py
{ "start": 8779, "end": 20157 }
class ____(metaclass=abc.ABCMeta): """ An abstract Python distribution package. Custom providers may derive from this class and define the abstract methods to provide a concrete implementation for their environment. Some providers may opt to override the default implementation of some propertie...
Distribution
python
sqlalchemy__sqlalchemy
test/orm/test_versioning.py
{ "start": 61035, "end": 64697 }
class ____(fixtures.DeclarativeMappedTest): @classmethod def setup_classes(cls): Base = cls.DeclarativeBasic class User(Base): __tablename__ = "user" id = Column(Integer, primary_key=True) class Parent(Base): __tablename__ = "parent" id...
PostUpdateVersioningTest
python
bokeh__bokeh
src/bokeh/settings.py
{ "start": 16871, "end": 31237 }
class ____: ''' ''' _config_override: dict[str, Any] _config_user: dict[str, Any] _config_system: dict[str, Any] def __init__(self) -> None: self._config_override = {} self._config_user = self._try_load_config(_config_user_locations) self._config_system = {} # TODO (be...
Settings
python
tensorflow__tensorflow
tensorflow/python/training/server_lib_test.py
{ "start": 1631, "end": 16029 }
class ____(test.TestCase): def __init__(self, methodName="runTest"): # pylint: disable=invalid-name super(GrpcServerTest, self).__init__(methodName) self._cached_server = server_lib.Server.create_local_server() def testRunStep(self): server = self._cached_server with ops.Graph().as_default(): ...
GrpcServerTest
python
django-mptt__django-mptt
tests/myapp/tests.py
{ "start": 61352, "end": 61903 }
class ____(TreeTestCase): def test_unsaved(self): for method in [ "get_ancestors", "get_family", "get_children", "get_descendants", "get_leafnodes", "get_next_sibling", "get_previous_sibling", "get_root", ...
TestUnsaved
python
getsentry__sentry
tests/sentry/incidents/test_logic.py
{ "start": 136086, "end": 136551 }
class ____(BaseAlertRuleTriggerActionTest): def test(self) -> None: assert list(get_actions_for_trigger(self.trigger)) == [] action = create_alert_rule_trigger_action( self.trigger, AlertRuleTriggerAction.Type.EMAIL, AlertRuleTriggerAction.TargetType.USER, ...
GetActionsForTriggerTest
python
pytorch__pytorch
torch/nn/modules/loss.py
{ "start": 15122, "end": 19077 }
class ____(_Loss): r"""Gaussian negative log likelihood loss. The targets are treated as samples from Gaussian distributions with expectations and variances predicted by the neural network. For a ``target`` tensor modelled as having Gaussian distribution with a tensor of expectations ``input`` and ...
GaussianNLLLoss
python
pandas-dev__pandas
pandas/tests/tools/test_to_datetime.py
{ "start": 77421, "end": 84751 }
class ____: @pytest.fixture def df(self): return DataFrame( { "year": [2015, 2016], "month": [2, 3], "day": [4, 5], "hour": [6, 7], "minute": [58, 59], "second": [10, 11], "ms": [1...
TestToDatetimeDataFrame
python
cython__cython
Cython/Compiler/Optimize.py
{ "start": 61490, "end": 64280 }
class ____(Visitor.VisitorTransform, SkipDeclarations): """ This transformation flattens "x in [val1, ..., valn]" into a sequential list of comparisons. """ def visit_PrimaryCmpNode(self, node): self.visitchildren(node) if node.cascade is not None: return node el...
FlattenInListTransform
python
python-markdown__markdown
markdown/extensions/nl2br.py
{ "start": 770, "end": 1102 }
class ____(Extension): def extendMarkdown(self, md): """ Add a `SubstituteTagInlineProcessor` to Markdown. """ br_tag = SubstituteTagInlineProcessor(BR_RE, 'br') md.inlinePatterns.register(br_tag, 'nl', 5) def makeExtension(**kwargs): # pragma: no cover return Nl2BrExtension(**kwargs...
Nl2BrExtension
python
getsentry__sentry
tests/sentry/api/endpoints/test_project_template_detail.py
{ "start": 5198, "end": 7367 }
class ____(ProjectTemplateAPIBase): endpoint = "sentry-api-0-organization-project-template-detail" method = "delete" def test_delete__no_feature(self) -> None: response = self.get_error_response( self.organization.id, self.project_template.id, status_code=404 ) assert re...
ProjectTemplateDetailDeleteTest
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/protocol3.py
{ "start": 2420, "end": 2513 }
class ____(Protocol): @property def bar(self: P6) -> ContextManager[P6]: ...
MockClass6
python
doocs__leetcode
solution/0900-0999/0973.K Closest Points to Origin/Solution3.py
{ "start": 0, "end": 428 }
class ____: def kClosest(self, points: List[List[int]], k: int) -> List[List[int]]: dist = [x * x + y * y for x, y in points] l, r = 0, max(dist) while l < r: mid = (l + r) >> 1 cnt = sum(d <= mid for d in dist) if cnt >= k: r = mid ...
Solution
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 593284, "end": 595040 }
class ____(sgqlc.types.Type): """A User who is an outside collaborator of an enterprise through one or more organizations. """ __schema__ = github_schema __field_names__ = ("cursor", "node", "repositories") cursor = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="cursor") """A...
EnterpriseOutsideCollaboratorEdge
python
redis__redis-py
tests/test_maint_notifications_handling.py
{ "start": 1088, "end": 6862 }
class ____: """Helper class containing static methods for validation in maintenance notifications tests.""" @staticmethod def validate_in_use_connections_state( in_use_connections: List[AbstractConnection], expected_state=MaintenanceState.NONE, expected_should_reconnect: Union[bool,...
Helpers
python
django__django
tests/migrations/test_operations.py
{ "start": 889, "end": 281092 }
class ____(OperationTestBase): """ Tests running the operations and making sure they do what they say they do. Each test looks at their state changing, and then their database operation, both forwards and backwards. """ def test_create_model(self): """ Tests the CreateModel oper...
OperationTests
python
joke2k__faker
faker/providers/company/de_CH/__init__.py
{ "start": 45, "end": 472 }
class ____(CompanyProvider): # Source: https://de.wikipedia.org/wiki/Firma#Schweizerisches_Recht formats = ( "{{last_name}} {{company_suffix}}", "{{last_name}} {{last_name}} {{company_suffix}}", ) company_suffixes = ( "AG", "AG", "AG", "GmbH", "G...
Provider
python
sympy__sympy
sympy/printing/numpy.py
{ "start": 1091, "end": 14025 }
class ____(ArrayPrinter, PythonCodePrinter): """ Numpy printer which handles vectorized piecewise functions, logical operators, etc. """ _module = 'numpy' _kf = _numpy_known_functions _kc = _numpy_known_constants def __init__(self, settings=None): """ `settings` is pass...
NumPyPrinter
python
google__pytype
pytype/tests/test_cmp2.py
{ "start": 383, "end": 1137 }
class ____(test_base.BaseTest): """Tests the __contains__ -> __iter__ -> __getitem__ fallbacks.""" def test_overload_contains(self): self.CheckWithErrors(""" class F: def __contains__(self, x: int): if not isinstance(x, int): raise TypeError("__contains__ only takes int") ...
ContainsFallbackTest
python
numba__numba
numba/core/types/functions.py
{ "start": 22054, "end": 22170 }
class ____(Dispatcher): """Dispatcher subclass that enters objectmode function. """ pass
ObjModeDispatcher
python
kamyu104__LeetCode-Solutions
Python/largest-number.py
{ "start": 33, "end": 314 }
class ____(object): # @param num, a list of integers # @return a string def largestNumber(self, num): num = [str(x) for x in num] num.sort(cmp=lambda x, y: cmp(y + x, x + y)) largest = ''.join(num) return largest.lstrip('0') or '0'
Solution
python
doocs__leetcode
solution/1600-1699/1673.Find the Most Competitive Subsequence/Solution.py
{ "start": 0, "end": 329 }
class ____: def mostCompetitive(self, nums: List[int], k: int) -> List[int]: stk = [] n = len(nums) for i, v in enumerate(nums): while stk and stk[-1] > v and len(stk) + n - i > k: stk.pop() if len(stk) < k: stk.append(v) return...
Solution
python
gevent__gevent
src/gevent/greenlet.py
{ "start": 5525, "end": 39313 }
class ____(greenlet): """ A light-weight cooperatively-scheduled execution unit. """ # pylint:disable=too-many-public-methods,too-many-instance-attributes spawning_stack_limit = 10 # pylint:disable=keyword-arg-before-vararg,super-init-not-called def __init__(self, run=None, *args, **kwargs...
Greenlet
python
walkccc__LeetCode
solutions/2469. Convert the Temperature/2469.py
{ "start": 0, "end": 129 }
class ____: def convertTemperature(self, celsius: float) -> list[float]: return [celsius + 273.15, celsius * 1.8 + 32]
Solution
python
apache__airflow
providers/standard/src/airflow/providers/standard/triggers/file.py
{ "start": 3210, "end": 4877 }
class ____(BaseEventTrigger): """ A trigger that fires exactly once after it finds the requested file and then delete the file. The difference between ``FileTrigger`` and ``FileDeleteTrigger`` is ``FileDeleteTrigger`` can only find a specific file. :param filepath: File (relative to the base path ...
FileDeleteTrigger
python
scrapy__scrapy
tests/test_http_request.py
{ "start": 449, "end": 16007 }
class ____: request_class = Request default_method = "GET" default_headers: dict[bytes, list[bytes]] = {} default_meta: dict[str, Any] = {} def test_init(self): # Request requires url in the __init__ method with pytest.raises(TypeError): self.request_class() # u...
TestRequest
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/key_binding/key_bindings.py
{ "start": 4516, "end": 5987 }
class ____(metaclass=ABCMeta): """ Interface for a KeyBindings. """ @property @abstractmethod def _version(self) -> Hashable: """ For cache invalidation. - This should increase every time that something changes. """ return 0 @abstractmethod def g...
KeyBindingsBase
python
huggingface__transformers
src/transformers/models/data2vec/modeling_data2vec_audio.py
{ "start": 26795, "end": 32762 }
class ____(Data2VecAudioPreTrainedModel): def __init__(self, config: Data2VecAudioConfig): super().__init__(config) self.config = config self.feature_extractor = Data2VecAudioFeatureEncoder(config) self.feature_projection = Data2VecAudioFeatureProjection(config) # model only...
Data2VecAudioModel
python
dagster-io__dagster
python_modules/dagster/dagster/_daemon/daemon.py
{ "start": 14703, "end": 15134 }
class ____(IntervalDaemon): @classmethod def daemon_type(cls) -> str: return "MONITORING" def run_iteration( self, workspace_process_context: IWorkspaceProcessContext, ) -> DaemonIterator: yield from execute_run_monitoring_iteration(workspace_process_context, self._logge...
MonitoringDaemon
python
doocs__leetcode
solution/1900-1999/1992.Find All Groups of Farmland/Solution.py
{ "start": 0, "end": 671 }
class ____: def findFarmland(self, land: List[List[int]]) -> List[List[int]]: m, n = len(land), len(land[0]) ans = [] for i in range(m): for j in range(n): if ( land[i][j] == 0 or (j > 0 and land[i][j - 1] == 1) ...
Solution
python
python__mypy
mypy/patterns.py
{ "start": 2857, "end": 3339 }
class ____(Pattern): keys: list[Expression] values: list[Pattern] rest: NameExpr | None def __init__( self, keys: list[Expression], values: list[Pattern], rest: NameExpr | None ) -> None: super().__init__() assert len(keys) == len(values) self.keys = keys sel...
MappingPattern
python
django__django
tests/generic_views/views.py
{ "start": 7342, "end": 7427 }
class ____(BookSigningConfig, generic.YearArchiveView): pass
BookSigningYearArchive
python
pytorch__pytorch
test/dynamo/test_bytecode_utils.py
{ "start": 21015, "end": 21659 }
class ____(torch._dynamo.test_case.TestCase): def test_bytecode_hook(self): def fn(a, b): return a - b * 10 def hook(code, out_code): print(code) print(out_code) return code torch._dynamo.reset() handle = torch._dynamo.convert_frame.r...
BytecodeHookTests
python
encode__django-rest-framework
tests/test_throttling.py
{ "start": 1479, "end": 1630 }
class ____(APIView): throttle_classes = (User3MinRateThrottle,) def get(self, request): return Response('foo')
MockView_MinuteThrottling
python
scipy__scipy
scipy/special/tests/test_basic.py
{ "start": 172350, "end": 172676 }
class ____: def test_obl_cv_seq(self): obl = special.obl_cv_seq(0,3,1) assert_allclose(obl, array([-0.348602, 1.393206, 5.486800, 11.492120]), atol=1.5e-5, rtol=0)
TestOblCvSeq
python
bokeh__bokeh
src/bokeh/models/dom.py
{ "start": 3635, "end": 3821 }
class ____(Model, Qualified): # explicit __init__ to support Init signatures def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs)
Action
python
doocs__leetcode
solution/2600-2699/2697.Lexicographically Smallest Palindrome/Solution.py
{ "start": 0, "end": 245 }
class ____: def makeSmallestPalindrome(self, s: str) -> str: cs = list(s) i, j = 0, len(s) - 1 while i < j: cs[i] = cs[j] = min(cs[i], cs[j]) i, j = i + 1, j - 1 return "".join(cs)
Solution
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/testing/assertsql.py
{ "start": 12801, "end": 13652 }
class ____(AssertRule): def __init__(self, *rules): self.rules = list(rules) def process_statement(self, execute_observed): if not self.rules: self.is_consumed = True self.consume_statement = False while self.rules: rule = self.rules[0] r...
EachOf
python
ansible__ansible
lib/ansible/modules/hostname.py
{ "start": 23102, "end": 23243 }
class ____(Hostname): platform = 'Linux' distribution = 'Cloudlinuxserver' strategy_class = RedHatStrategy
CloudlinuxserverHostname
python
django-extensions__django-extensions
tests/management/commands/shell_plus_tests/test_import_subclasses.py
{ "start": 614, "end": 5748 }
class ____(AutomaticShellPlusImportsTestCase): def test_imports_no_subclasses(self): self.assert_imports() @override_settings( SHELL_PLUS_SUBCLASSES_IMPORT=[], ) def test_imports_empty_list(self): self.assert_imports() @override_settings( SHELL_PLUS_SUBCLASSES_IMPOR...
ImportSubclassesTestCase
python
docker__docker-py
docker/api/service.py
{ "start": 5046, "end": 19215 }
class ____: @utils.minimum_version('1.24') def create_service( self, task_template, name=None, labels=None, mode=None, update_config=None, networks=None, endpoint_config=None, endpoint_spec=None, rollback_config=None ): """ Create a service. Args:...
ServiceApiMixin
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/links/bigtable.py
{ "start": 1660, "end": 1855 }
class ____(BaseGoogleLink): """Helper class for constructing Bigtable Tables link.""" name = "Bigtable Tables" key = "tables_key" format_str = BIGTABLE_TABLES_LINK
BigtableTablesLink
python
automl__auto-sklearn
autosklearn/pipeline/components/feature_preprocessing/random_trees_embedding.py
{ "start": 534, "end": 4586 }
class ____(AutoSklearnPreprocessingAlgorithm): def __init__( self, n_estimators, max_depth, min_samples_split, min_samples_leaf, min_weight_fraction_leaf, max_leaf_nodes, bootstrap, sparse_output=True, n_jobs=1, random_state=Non...
RandomTreesEmbedding
python
pola-rs__polars
py-polars/src/polars/_typing.py
{ "start": 1374, "end": 1588 }
class ____(Protocol): """Type protocol for Arrow C Stream Interface via Arrow PyCapsule Interface.""" def __arrow_c_stream__(self, requested_schema: object | None = None) -> object: ...
ArrowStreamExportable
python
kamyu104__LeetCode-Solutions
Python/h-index-ii.py
{ "start": 32, "end": 440 }
class ____(object): def hIndex(self, citations): """ :type citations: List[int] :rtype: int """ n = len(citations) left, right = 0, n - 1 while left <= right: mid = (left + right) / 2 if citations[mid] >= n - mid: right ...
Solution
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/testing/suite/test_dialect.py
{ "start": 16110, "end": 19453 }
class ____(fixtures.TestBase): __backend__ = True tough_parameters = testing.combinations( ("boring",), ("per cent",), ("per % cent",), ("%percent",), ("par(ens)",), ("percent%(ens)yah",), ("col:ons",), ("_starts_with_underscore",), ("dot....
DifficultParametersTest
python
pytorch__pytorch
torch/_inductor/mock_cache.py
{ "start": 3690, "end": 4663 }
class ____(RemoteCacheBackend[Any]): def __init__(self, name: str) -> None: self._name = name @staticmethod def with_name(name: str) -> Callable[[], MockBackend]: def wrapper() -> MockBackend: return MockBackend(name) return wrapper @override def _get(self, key...
MockBackend
python
tensorflow__tensorflow
tensorflow/python/debug/cli/debugger_cli_common_test.py
{ "start": 40671, "end": 41508 }
class ____(test_util.TensorFlowTestCase): def testCommandTypeConstructorSucceeds(self): menu_node = debugger_cli_common.MenuItem("water flower", "water_flower") self.assertEqual("water flower", menu_node.caption) self.assertEqual("water_flower", menu_node.content) def testDisableWorks(self): menu...
MenuNodeTest
python
ray-project__ray
python/ray/_private/event/event_logger.py
{ "start": 469, "end": 6184 }
class ____: def __init__(self, source: Event.SourceType, logger: logging.Logger): """Adapter for the Python logger that's used to emit events. When events are emitted, they are aggregated and available via state API and dashboard. This class is thread-safe. """ self...
EventLoggerAdapter
python
jina-ai__jina
tests/integration/docarray_v2/test_issues.py
{ "start": 2966, "end": 5672 }
class ____(Executor): @requests(on="/stream") async def stream( self, doc: InputWithComplexFields, parameters: Optional[Dict] = None, **kwargs, ) -> InputWithComplexFields: for i in range(4): yield InputWithComplexFields(text=f"hello world {doc.text} {i}")...
MyExecutor
python
bokeh__bokeh
src/bokeh/models/widgets/inputs.py
{ "start": 14391, "end": 15406 }
class ____(InputWidget): ''' Single-select widget. ''' # explicit __init__ to support Init signatures def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) options = Either(Options, OptionsGroups, help=""" Available selection options. Options ma...
Select
python
Lightning-AI__lightning
tests/tests_pytorch/strategies/test_model_parallel_integration.py
{ "start": 1069, "end": 2954 }
class ____(nn.Module): def __init__(self): super().__init__() self.w1 = nn.Linear(32, 64) self.w2 = nn.Linear(32, 64) self.w3 = nn.Linear(64, 32) def forward(self, x): return self.w3(F.silu(self.w1(x)) * self.w2(x)) def _parallelize_feed_forward_tp(model, device_mesh):...
FeedForward
python
MongoEngine__mongoengine
mongoengine/context_managers.py
{ "start": 1513, "end": 2806 }
class ____: """switch_db alias context manager. Example :: # Register connections register_connection('default', 'mongoenginetest') register_connection('testdb-1', 'mongoenginetest2') class Group(Document): name = StringField() Group(name='test').save() #...
switch_db
python
getsentry__sentry-python
sentry_sdk/integrations/asyncpg.py
{ "start": 680, "end": 6521 }
class ____(Integration): identifier = "asyncpg" origin = f"auto.db.{identifier}" _record_params = False def __init__(self, *, record_params: bool = False): AsyncPGIntegration._record_params = record_params @staticmethod def setup_once() -> None: # asyncpg.__version__ is a strin...
AsyncPGIntegration
python
PyCQA__pylint
tests/functional/u/used/used_before_assignment.py
{ "start": 402, "end": 3677 }
class ____: # pylint: disable=too-few-public-methods """This test depends on earlier and later defined module-level functions.""" prop = property(redefine_time_import) # [used-before-assignment] prop_defined_earlier = property(outer) calculate(1.01, 2) # [used-before-assignment] def calculate(value1: i...
ClassWithProperty
python
pytest-dev__pytest
src/_pytest/mark/expression.py
{ "start": 1289, "end": 1578 }
class ____(enum.Enum): LPAREN = "left parenthesis" RPAREN = "right parenthesis" OR = "or" AND = "and" NOT = "not" IDENT = "identifier" EOF = "end of input" EQUAL = "=" STRING = "string literal" COMMA = "," @dataclasses.dataclass(frozen=True)
TokenType
python
pola-rs__polars
py-polars/src/polars/_utils/udfs.py
{ "start": 956, "end": 1483 }
class ____(NamedTuple): operator: str operator_arity: int left_operand: str right_operand: str from_module: str | None = None MapTarget: TypeAlias = Literal["expr", "frame", "series"] StackEntry: TypeAlias = Union[str, StackValue] _MIN_PY311 = sys.version_info >= (3, 11) _MIN_PY312 = _MIN_PY311 a...
StackValue
python
celery__celery
t/unit/concurrency/test_eventlet.py
{ "start": 728, "end": 1524 }
class ____(EventletCase): def test_aaa_is_patched(self): with patch('eventlet.monkey_patch', create=True) as monkey_patch: from celery import maybe_patch_concurrency maybe_patch_concurrency(['x', '-P', 'eventlet']) monkey_patch.assert_called_with() @patch('eventlet....
test_aaa_eventlet_patch
python
HypothesisWorks__hypothesis
hypothesis-python/tests/django/toystore/test_given_models.py
{ "start": 5766, "end": 6586 }
class ____(TestCase): @given(from_model(RestrictedFields)) def test_constructs_valid_instance(self, instance): self.assertIsInstance(instance, RestrictedFields) instance.full_clean() self.assertLessEqual(len(instance.text_field_4), 4) self.assertLessEqual(len(instance.char_field_...
TestRestrictedFields
python
OmkarPathak__pygorithm
tests/test_geometry.py
{ "start": 6913, "end": 16747 }
class ____(unittest.TestCase): def setUp(self): random.seed() self.vec_origin = vector2.Vector2(0, 0) self.vec_1_1 = vector2.Vector2(1, 1) self.vec_2_1 = vector2.Vector2(2, 1) self.vec_1_2 = vector2.Vector2(1, 2) self.vec_3_4 = vector2.Vector2(3, 4) s...
TestLine2
python
pytorch__pytorch
test/profiler/test_memory_profiler.py
{ "start": 2350, "end": 3399 }
class ____(torch.utils._python_dispatch.TorchDispatchMode): def __init__(self) -> None: self.results = [] def mark_region(self, name: str): self.results.append((name, (), ())) @staticmethod def flat_ids(args): flat_args = pytree.tree_leaves(args) return tuple( ...
RecordInputOutputDispatchMode
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/memberAccess1.py
{ "start": 1787, "end": 1839 }
class ____(type): y = MetaDescriptorE()
MetaclassE
python
sphinx-doc__sphinx
doc/development/tutorials/examples/autodoc_intenum.py
{ "start": 361, "end": 1920 }
class ____(ClassDocumenter): objtype = 'intenum' directivetype = ClassDocumenter.objtype priority = 10 + ClassDocumenter.priority option_spec = dict(ClassDocumenter.option_spec) option_spec['hex'] = bool_option @classmethod def can_document_member( cls, member: Any, membername: str,...
IntEnumDocumenter
python
walkccc__LeetCode
solutions/964. Least Operators to Express Number/964.py
{ "start": 0, "end": 535 }
class ____: def leastOpsExpressTarget(self, x: int, target: int) -> int: @functools.lru_cache(None) def dfs(target): if x > target: return min(2 * target - 1, 2 * (x - target)) if x == target: return 0 prod = x n = 0 while prod < target: prod *= x ...
Solution
python
getsentry__sentry
src/sentry/notifications/platform/slack/provider.py
{ "start": 1031, "end": 1105 }
class ____(TypedDict): blocks: list[Block] text: str
SlackRenderable
python
pandas-dev__pandas
pandas/core/interchange/utils.py
{ "start": 1914, "end": 5051 }
class ____: """Enum indicating the byte-order of a data-type.""" LITTLE = "<" BIG = ">" NATIVE = "=" NA = "|" def dtype_to_arrow_c_fmt(dtype: DtypeObj) -> str: """ Represent pandas `dtype` as a format string in Apache Arrow C notation. Parameters ---------- dtype : np.dtype ...
Endianness
python
openai__openai-python
src/openai/types/static_file_chunking_strategy_param.py
{ "start": 222, "end": 692 }
class ____(TypedDict, total=False): chunk_overlap_tokens: Required[int] """The number of tokens that overlap between chunks. The default value is `400`. Note that the overlap must not exceed half of `max_chunk_size_tokens`. """ max_chunk_size_tokens: Required[int] """The maximum number of toke...
StaticFileChunkingStrategyParam