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
RaRe-Technologies__gensim
gensim/test/test_phrases.py
{ "start": 19344, "end": 20366 }
class ____: """This mixin permits to reuse tests with the connector_words option.""" sentences = [ ['human', 'interface', 'with', 'computer'], ['survey', 'of', 'user', 'computer', 'system', 'lack', 'of', 'interest'], ['eps', 'user', 'interface', 'system'], ['system', 'and', 'hum...
CommonTermsPhrasesData
python
allegroai__clearml
clearml/backend_interface/logger.py
{ "start": 6994, "end": 7668 }
class ____(object): def __init__(self, logger: logging.Logger) -> None: self._logger = logger def __call__(self, original_format_func: Callable, *args: Any) -> Any: # hack get back original function, so we can remove it if all(a is None for a in args): return original_format...
HandlerFormat
python
PrefectHQ__prefect
tests/cli/test_flow_run.py
{ "start": 11346, "end": 15430 }
class ____: @pytest.mark.parametrize( "state", [ Running, Pending, Retrying, ], ) async def test_non_terminal_states_set_to_cancelling( self, prefect_client: PrefectClient, state: State ): """Should set the state of the flow to ...
TestCancelFlowRun
python
getsentry__sentry
src/sentry/integrations/opsgenie/analytics.py
{ "start": 176, "end": 308 }
class ____(BaseNotificationSent): pass analytics.register(OpsgenieIntegrationNotificationSent)
OpsgenieIntegrationNotificationSent
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/array_ops/batchtospace_op_test.py
{ "start": 2442, "end": 2523 }
class ____(BatchToSpaceDepthToSpace, CppOpImpl): pass
BatchToSpaceDepthToSpaceCpp
python
Unity-Technologies__ml-agents
ml-agents/mlagents/trainers/poca/optimizer_torch.py
{ "start": 1698, "end": 27898 }
class ____(TorchOptimizer): class POCAValueNetwork(torch.nn.Module, Critic): """ The POCAValueNetwork uses the MultiAgentNetworkBody to compute the value and POCA baseline for a variable number of agents in a group that all share the same observation and action space. """ ...
TorchPOCAOptimizer
python
scipy__scipy
scipy/spatial/tests/test_spherical_voronoi.py
{ "start": 3003, "end": 14500 }
class ____: def setup_method(self): self.points = np.array([ [-0.78928481, -0.16341094, 0.59188373], [-0.66839141, 0.73309634, 0.12578818], [0.32535778, -0.92476944, -0.19734181], [-0.90177102, -0.03785291, -0.43055335], [0.71781344, 0.68428936, 0...
TestSphericalVoronoi
python
ray-project__ray
python/ray/data/tests/test_streaming_executor.py
{ "start": 20741, "end": 37375 }
class ____(unittest.TestCase): def test_multi_threading(self): num_blocks = 5_000 num_splits = 8 num_per_split = num_blocks // num_splits ref_bundles = make_ref_bundles([[[i]] for i in range(num_blocks)]) queue = OpBufferQueue() for i, ref_bundle in enumerate(ref_bun...
OpBufferQueueTest
python
pytorch__pytorch
torch/distributed/checkpoint/_extension.py
{ "start": 1665, "end": 2762 }
class ____(Extension): """ An extension which performs transformation on a byte stream, such as compression or encryption. Implementations should try to be memory friendly and performant. For example, don't read the whole input, then transform it, and write it back. If at all possible, do it in ...
StreamTransformExtension
python
pypa__warehouse
tests/common/db/ip_addresses.py
{ "start": 196, "end": 599 }
class ____(WarehouseFactory): class Meta: model = IpAddress # TODO: Replace when factory_boy supports `unique`. # See https://github.com/FactoryBoy/factory_boy/pull/997 ip_address = factory.Sequence(lambda _: fake.unique.ipv4_private()) hashed_ip_address = factory.LazyAttribute( l...
IpAddressFactory
python
getsentry__sentry
src/sentry/incidents/models/alert_rule.py
{ "start": 2036, "end": 2673 }
class ____(models.TextChoices): """All combinations of multi select fields for anomaly detection alerts We do not anticipate adding more """ AUTO = "auto", gettext_lazy("Auto") HOURLY = "hourly", gettext_lazy("Hourly") DAILY = "daily", gettext_lazy("Daily") WEEKLY = "weekly", gettext_lazy("...
AlertRuleSeasonality
python
great-expectations__great_expectations
contrib/great_expectations_semantic_types_expectations/great_expectations_semantic_types_expectations/expectations/expect_column_values_to_be_valid_http_methods.py
{ "start": 117, "end": 2422 }
class ____(SetBasedColumnMapExpectation): """Expect column values to be valid HTTP methods. GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE, PATCH """ # These values will be used to configure the metric created by your expectation set_ = [ "GET", "HEAD", "POST", ...
ExpectColumnValuesToBeValidHTTPMethods
python
django__django
tests/migrations/test_migrations_fake_split_initial/0002_second.py
{ "start": 43, "end": 583 }
class ____(migrations.Migration): initial = True dependencies = [ ("migrations", "0001_initial"), ] operations = [ migrations.AddField("Author", "rating", models.IntegerField(default=0)), migrations.CreateModel( "Book", [ ("id", models.Au...
Migration
python
readthedocs__readthedocs.org
readthedocs/projects/migrations/0086_is_spam.py
{ "start": 149, "end": 925 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("projects", "0085_subscribe_old_webhooks_to_events"), ] operations = [ migrations.AddField( model_name="historicalproject", name="is_spam", field=models.NullBooleanField( ...
Migration
python
facebook__pyre-check
client/language_server/protocol.py
{ "start": 12181, "end": 12295 }
class ____(json_mixins.CamlCaseAndExcludeJsonMixin): text: str @dataclasses.dataclass(frozen=True)
ContentChange
python
has2k1__plotnine
plotnine/themes/themeable.py
{ "start": 44602, "end": 45343 }
class ____(MixinSequenceOfValues): """ Panel border Parameters ---------- theme_element : element_rect """ _omit = ["facecolor"] def apply_figure(self, figure: Figure, targets: ThemeTargets): super().apply_figure(figure, targets) if not (rects := targets.panel_border):...
panel_border
python
huggingface__transformers
tests/models/idefics/test_modeling_idefics.py
{ "start": 11911, "end": 25679 }
class ____(ModelTesterMixin, PipelineTesterMixin, GenerationTesterMixin, unittest.TestCase): all_model_classes = (IdeficsModel, IdeficsForVisionText2Text) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": IdeficsModel, "image-text-to-text": Idefic...
IdeficsModelTest
python
airbytehq__airbyte
airbyte-integrations/connectors/source-amazon-seller-partner/components.py
{ "start": 9123, "end": 9941 }
class ____(TypeTransformer): def __init__(self, *args, **kwargs): config = TransformConfig.DefaultSchemaNormalization | TransformConfig.CustomSchemaNormalization super().__init__(config) self.registerCustomTransform(self.get_transform_function()) @staticmethod def get_transform_func...
MerchantListingsFypReportTypeTransformer
python
ethereum__web3.py
web3/main.py
{ "start": 3550, "end": 9533 }
class ____: _strict_bytes_type_checking = True # Managers RequestManager = DefaultRequestManager manager: DefaultRequestManager # mypy types eth: Eth | AsyncEth net: Net | AsyncNet geth: Geth | AsyncGeth @property def middleware_onion(self) -> MiddlewareOnion: return c...
BaseWeb3
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_bugbear/class_as_data_structure.py
{ "start": 578, "end": 658 }
class ____: # B903 c: int def __init__(self,d:list): self.d = d
C
python
ApeWorX__ape
src/ape/utils/basemodel.py
{ "start": 8844, "end": 11618 }
class ____(EthpmTypesBaseModel): """ A class for defining extra model attributes. """ model_config = ConfigDict(arbitrary_types_allowed=True) name: str """ The name of the attributes. This is important in instances such as when an attribute is missing, we can show a more accurate e...
ExtraModelAttributes
python
pytorch__pytorch
test/jit/test_backends.py
{ "start": 1664, "end": 3605 }
class ____(JitTestCase): """ A common base class for JIT backend tests that contains common utility functions for output comparison and serialization/deserialization. """ def setUp(self): super().setUp() lib_file_path = find_library_location("libjitbackend_test.so") torch.op...
JitBackendTestCase
python
tensorflow__tensorflow
tensorflow/python/training/localhost_cluster_performance_test.py
{ "start": 1239, "end": 2256 }
class ____(test.TestCase): @test_util.run_v1_only("b/120545219") def testCreateLocalCluster(self): workers, _ = test.create_local_cluster(num_workers=2, num_ps=2) worker_sessions = [session_lib.Session(w.target) for w in workers] with ops.device("/job:ps/task:0"): var0 = variables.Variable(0.0) ...
CreateLocalClusterTest
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/control_flow/py_func_test.py
{ "start": 1831, "end": 2906 }
class ____(test.TestCase): def verifyExceptionHandling(self, py_exp, tf_exp, eager=False): def inner_exception(): raise py_exp("blah") # pylint: disable=not-callable def raise_exception(): inner_exception() expected_regexp = r": blah.*" # Error at the top expected_regexp...
PyFuncTestBase
python
walkccc__LeetCode
solutions/1950. Maximum of Minimum Values in All Subarrays/1950.py
{ "start": 0, "end": 1038 }
class ____: # Similar to 1950. Maximum of Minimum Values in All Subarrays def findMaximums(self, nums: list[int]) -> list[int]: n = len(nums) ans = [0] * n # prevMin[i] := the index k s.t. # nums[k] is the previous minimum in nums[0..n) prevMin = [-1] * n # nextMin[i] := the index k s.t. ...
Solution
python
django__django
tests/basic/tests.py
{ "start": 33035, "end": 41428 }
class ____(TestCase): def test_refresh(self): a = Article.objects.create(pub_date=datetime.now()) Article.objects.create(pub_date=datetime.now()) Article.objects.filter(pk=a.pk).update(headline="new headline") with self.assertNumQueries(1): a.refresh_from_db() ...
ModelRefreshTests
python
getsentry__sentry-python
tests/test_conftest.py
{ "start": 1926, "end": 3427 }
class ____(Animal): pass @pytest.mark.parametrize( "test_obj, type_and_attrs_result, type_only_result, attrs_only_result", [ # type matches (Dog("Maisey", 7, "silly"), True, True, True), # full attr containment (Dog("Maisey", 7), True, True, True), # type and attr equality ...
Cat
python
Netflix__metaflow
metaflow/plugins/secrets/__init__.py
{ "start": 37, "end": 349 }
class ____(abc.ABC): TYPE = None @abc.abstractmethod def get_secret_as_dict(self, secret_id, options={}, role=None) -> Dict[str, str]: """Retrieve the secret from secrets backend, and return a dictionary of environment variables.""" from .secrets_func import get_secret
SecretsProvider
python
ansible__ansible
test/integration/targets/collections/collections/ansible_collections/testns/content_adj/plugins/cache/custom_jsonfile.py
{ "start": 1405, "end": 1894 }
class ____(BaseFileCacheModule): """ A caching module backed by json files. """ def _load(self, filepath): # Valid JSON is always UTF-8 encoded. with codecs.open(filepath, 'r', encoding='utf-8') as f: return json.load(f, cls=AnsibleJSONDecoder) def _dump(self, value, fi...
CacheModule
python
doocs__leetcode
solution/0500-0599/0530.Minimum Absolute Difference in BST/Solution.py
{ "start": 192, "end": 602 }
class ____: def getMinimumDifference(self, root: Optional[TreeNode]) -> int: def dfs(root: Optional[TreeNode]): if root is None: return dfs(root.left) nonlocal pre, ans ans = min(ans, root.val - pre) pre = root.val dfs(r...
Solution
python
pypa__pipenv
pipenv/shells.py
{ "start": 5820, "end": 6100 }
class ____(CmderEmulatedShell): def fork(self, venv, cwd, args): rc_path = Path(os.path.expandvars("%CMDER_ROOT%\\vendor\\init.bat")) if rc_path.exists(): self.args.extend(["/k", str(rc_path)]) super().fork(venv, cwd, args)
CmderCommandPrompt
python
ansible__ansible
lib/ansible/plugins/connection/ssh.py
{ "start": 17523, "end": 25263 }
class ____(AnsibleError): """ ControlPersist broken pipe """ pass def _handle_error( remaining_retries: int, command: bytes, return_tuple: tuple[int, bytes, bytes], no_log: bool, host: str, display: Display = display, ) -> None: # sshpass errors if command == b'sshpass': ...
AnsibleControlPersistBrokenPipeError
python
bokeh__bokeh
src/bokeh/models/glyphs.py
{ "start": 55101, "end": 56590 }
class ____(Glyph, FillGlyph, HatchGlyph): ''' Render a vertically directed area between two equal length sequences of y-coordinates with the same x-coordinates using step lines. ''' # explicit __init__ to support Init signatures def __init__(self, *args: Any, **kwargs: Any) -> None: super(...
VAreaStep
python
sphinx-doc__sphinx
sphinx/directives/admonitions.py
{ "start": 1874, "end": 2794 }
class ____(SphinxAdmonition): """An admonition mentioning things to look at as reference.""" node_class = addnodes.seealso def setup(app: Sphinx) -> ExtensionMetadata: app.add_directive('admonition', Admonition, override=True) app.add_directive('attention', Attention, override=True) app.add_direc...
SeeAlso
python
django__django
django/test/utils.py
{ "start": 31353, "end": 31960 }
class ____: def __init__(self): self.records = collections.defaultdict(list) @contextmanager def timed(self, name): self.records[name] start_time = time.perf_counter() try: yield finally: end_time = time.perf_counter() - start_time ...
TimeKeeper
python
allegroai__clearml
clearml/backend_api/services/v2_23/events.py
{ "start": 30480, "end": 32621 }
class ____(Response): """ :param scroll_id: Scroll ID for getting more results :type scroll_id: str :param metrics: Debug image events grouped by tasks and iterations :type metrics: Sequence[DebugImagesResponseTaskMetrics] """ _service = "events" _action = "debug_images" _version = ...
DebugImagesResponse
python
pyparsing__pyparsing
pyparsing/core.py
{ "start": 208269, "end": 209774 }
class ____(_MultipleMatch): """ Repetition of one or more of the given expression. Parameters: - ``expr`` - expression that must match one or more times - ``stop_on`` - (default= ``None``) - expression for a terminating sentinel (only required if the sentinel would ordinarily match the repet...
OneOrMore
python
django__django
django/contrib/staticfiles/storage.py
{ "start": 20966, "end": 21167 }
class ____(ManifestFilesMixin, StaticFilesStorage): """ A static file system storage backend which also saves hashed copies of the files it saves. """ pass
ManifestStaticFilesStorage
python
ray-project__ray
python/ray/serve/tests/test_healthcheck.py
{ "start": 356, "end": 655 }
class ____: def __init__(self): self._count = 0 def get(self): return self._count def inc(self): self._count += 1 return self._count def reset(self): self._count = 0 @serve.deployment(health_check_period_s=1, health_check_timeout_s=1)
Counter
python
pyinstaller__pyinstaller
tests/unit/test_modulegraph/test_relimport2.py
{ "start": 158, "end": 1351 }
class ____ (unittest.TestCase): if not hasattr(unittest.TestCase, 'assertIsInstance'): def assertIsInstance(self, value, types): if not isinstance(value, types): self.fail("%r is not an instance of %r"%(value, types)) def setUp(self): self.root = os.path.join( ...
TestModuleGraphImport
python
huggingface__transformers
src/transformers/models/flava/image_processing_flava.py
{ "start": 1753, "end": 7049 }
class ____(ImagesKwargs, total=False): """ return_image_mask (`bool`, *optional*, defaults to `False`): Whether to return the image mask. Can be overridden by the `return_image_mask` parameter in `preprocess`. input_size_patches (`int`, *optional*, defaults to 14): Number of patches in the i...
FlavaImageProcessorKwargs
python
numba__llvmlite
llvmlite/ir/values.py
{ "start": 15515, "end": 16223 }
class ____(_StrCaching, _StringReferenceCaching, Value): """ An argument value to a function taking metadata arguments. This can wrap any other kind of LLVM value. Do not instantiate directly, Builder.call() will create these automatically. """ def __init__(self, value): assert isi...
MetaDataArgument
python
kamyu104__LeetCode-Solutions
Python/sort-list.py
{ "start": 255, "end": 1165 }
class ____(object): # @param head, a ListNode # @return a ListNode def sortList(self, head): if head == None or head.next == None: return head fast, slow, prev = head, head, None while fast != None and fast.next != None: prev, fast, slow = slow, fast.next.nex...
Solution
python
kamyu104__LeetCode-Solutions
Python/minimize-manhattan-distances.py
{ "start": 36, "end": 818 }
class ____(object): def minimumDistance(self, points): """ :type points: List[List[int]] :rtype: int """ def max_distance(exclude): max_sum = max((x+y, i) for i, (x, y) in enumerate(points) if i != exclude) min_sum = min((x+y, i) for i, (x, y) in enume...
Solution
python
django__django
tests/admin_views/admin.py
{ "start": 23324, "end": 23545 }
class ____(admin.StackedInline): model = RelatedPrepopulated extra = 1 prepopulated_fields = { "slug1": ["name", "pubdate"], "slug2": ["status"], }
RelatedPrepopulatedStackedInlineNoFieldsets
python
google__pytype
pytype/tools/merge_pyi/test_data/heuristics.py
{ "start": 223, "end": 416 }
class ____: def __init__(self, x): pass @staticmethod def f2(): pass @staticmethod def f3(x, y): pass @classmethod def f4(cls): pass
C
python
kamyu104__LeetCode-Solutions
Python/count-odd-letters-from-number.py
{ "start": 46, "end": 449 }
class ____(object): def countOddLetters(self, n): """ :type n: int :rtype: int """ lookup = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"] cnt = [0]*26 while n: n, d = divmod(n, 10) for x in lookup[d]: ...
Solution
python
huggingface__transformers
src/transformers/models/zamba/modeling_zamba.py
{ "start": 40227, "end": 48125 }
class ____(ZambaPreTrainedModel): """ Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`ZambaDecoderLayer`] Args: config: ZambaConfig """ def __init__(self, config: ZambaConfig): super().__init__(config) self.padding_idx = config.pad_tok...
ZambaModel
python
milvus-io__pymilvus
tests/test_decorators.py
{ "start": 6013, "end": 6507 }
class ____(MilvusException): def __init__(self, code=ErrorCode.RATE_LIMIT, message="rate limit"): super(MilvusException, self).__init__(message) self._code = code self._message = message self._compatible_code = common_pb2.RateLimit @property def code(self): return se...
MockRateLimitError
python
numba__numba
numba/cuda/cudadrv/driver.py
{ "start": 67657, "end": 69375 }
class ____(AutoFreePointer): """A memory pointer that refers to a buffer on the host that is mapped into device memory. :param context: The context in which the pointer was mapped. :type context: Context :param pointer: The address of the buffer. :type pointer: ctypes.c_void_p :param size: ...
MappedMemory
python
xlwings__xlwings
xlwings/constants.py
{ "start": 57883, "end": 57988 }
class ____: xlCap = 1 # from enum XlEndStyleCap xlNoCap = 2 # from enum XlEndStyleCap
EndStyleCap
python
django__django
tests/backends/mysql/tests.py
{ "start": 3843, "end": 4507 }
class ____(TestCase): @mock.patch.object(connection, "get_database_version") def test_check_database_version_supported(self, mocked_get_database_version): if connection.mysql_is_mariadb: mocked_get_database_version.return_value = (10, 5) msg = "MariaDB 10.6 or later is required (...
Tests
python
huggingface__transformers
src/transformers/models/perceiver/modeling_perceiver.py
{ "start": 103996, "end": 107475 }
class ____(PerceiverAbstractPositionEncoding): """Trainable position encoding.""" def __init__(self, index_dims, num_channels=128): super().__init__() self._num_channels = num_channels self._index_dims = index_dims index_dim = np.prod(index_dims) self.position_embeddings...
PerceiverTrainablePositionEncoding
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pycodestyle/E30.py
{ "start": 468, "end": 603 }
class ____: pass # end # No error # comment def func(): pass # end # no error def foo(): pass def bar(): pass
Class
python
crytic__slither
slither/visitors/expression/expression.py
{ "start": 2544, "end": 12289 }
class ____: def __init__(self, expression: Expression) -> None: super().__init__() # Inherited class must declare their variables prior calling super().__init__ self._expression = expression self._visit_expression(self.expression) @property def expression(self) -> Expression...
ExpressionVisitor
python
aio-libs__aiohttp
aiohttp/client_exceptions.py
{ "start": 6943, "end": 7018 }
class ____(ClientError): """Response payload error."""
ClientPayloadError
python
getsentry__sentry
tests/sentry/tasks/test_assemble.py
{ "start": 6918, "end": 29386 }
class ____(BaseAssembleTest): def test_artifacts_with_debug_ids(self) -> None: bundle_file = self.create_artifact_bundle_zip( fixture_path="artifact_bundle_debug_ids", project=self.project.id ) blob1 = FileBlob.from_file_with_organization(ContentFile(bundle_file), self.organizati...
AssembleArtifactsTest
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_display_units04.py
{ "start": 315, "end": 1210 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_display_units04.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(...
TestCompareXLSXFiles
python
aimacode__aima-python
probability.py
{ "start": 16208, "end": 21905 }
class ____: """A factor in a joint distribution.""" def __init__(self, variables, cpt): self.variables = variables self.cpt = cpt def pointwise_product(self, other, bn): """Multiply two factors, combining their variables.""" variables = list(set(self.variables) | set(other....
Factor
python
doocs__leetcode
solution/0200-0299/0229.Majority Element II/Solution.py
{ "start": 0, "end": 481 }
class ____: def majorityElement(self, nums: List[int]) -> List[int]: n1 = n2 = 0 m1, m2 = 0, 1 for m in nums: if m == m1: n1 += 1 elif m == m2: n2 += 1 elif n1 == 0: m1, n1 = m, 1 elif n2 == 0: ...
Solution
python
scrapy__scrapy
scrapy/core/downloader/handlers/http11.py
{ "start": 22227, "end": 22587 }
class ____: def __init__(self, body: bytes): self.body = body self.length = len(body) def startProducing(self, consumer: IConsumer) -> Deferred[None]: consumer.write(self.body) return succeed(None) def pauseProducing(self) -> None: pass def stopProducing(self) ...
_RequestBodyProducer
python
anthropics__anthropic-sdk-python
src/anthropic/_streaming.py
{ "start": 4219, "end": 5024 }
class ____(abc.ABCMeta): @override def __instancecheck__(self, instance: Any) -> bool: # we override the `isinstance()` check for `AsyncStream` # as a previous version of the `AsyncMessageStream` class # inherited from `AsyncStream` & without this workaround, # changing it to not...
_AsyncStreamMeta
python
vyperlang__vyper
vyper/builtins/functions.py
{ "start": 44095, "end": 44821 }
class ____(BuiltinFunctionT): _id = "raw_revert" _inputs = [("data", BytesT.any())] _return_type = None _is_terminus = True def fetch_call_return(self, node): return None def infer_arg_types(self, node, expected_return_typ=None): self._validate_arg_types(node) data_type...
RawRevert
python
readthedocs__readthedocs.org
readthedocs/profiles/views.py
{ "start": 3198, "end": 4440 }
class ____(PrivateViewMixin, SuccessMessageMixin, FormView): form_class = UserDeleteForm template_name = "profiles/private/delete_account.html" success_message = _("You have successfully deleted your account") def get_object(self): return User.objects.get(pk=self.request.user.pk) def form_...
AccountDelete
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/testing/suite/test_dialect.py
{ "start": 1304, "end": 2767 }
class ____(fixtures.TestBase): """test that all visit_XYZ() in :class:`_sql.Compiler` subclasses have ``**kw``, for #8988. This test uses runtime code inspection. Does not need to be a ``__backend__`` test as it only needs to run once provided all target dialects have been imported. For thir...
ArgSignatureTest
python
pytorch__pytorch
torch/_dynamo/eval_frame.py
{ "start": 40763, "end": 41176 }
class ____(_TorchDynamoContext): def __init__(self) -> None: # cudagraph trees relies on generation increment def on_enter() -> None: torch._dynamo.mutation_guard.GenerationTracker.generation += 1 super().__init__(callback=False, on_enter=on_enter) def __reduce__(self) -> t...
RunOnlyContext
python
realpython__materials
inheritance-and-composition/choosing/productivity.py
{ "start": 960, "end": 1276 }
class ____: def perform_duties(self, hours): return f"manufactures gadgets for {hours} hours." _productivity_system = _ProductivitySystem() def get_role(role_id): return _productivity_system.get_role(role_id) def track(employees, hours): _productivity_system.track(employees, hours)
FactoryRole
python
networkx__networkx
networkx/exception.py
{ "start": 551, "end": 645 }
class ____(NetworkXException): """Exception for a serious error in NetworkX"""
NetworkXError
python
tiangolo__fastapi
tests/test_security_api_key_cookie_optional.py
{ "start": 264, "end": 2146 }
class ____(BaseModel): username: str def get_current_user(oauth_header: Optional[str] = Security(api_key)): if oauth_header is None: return None user = User(username=oauth_header) return user @app.get("/users/me") def read_current_user(current_user: User = Depends(get_current_user)): if ...
User
python
huggingface__transformers
src/transformers/models/sam/modeling_sam.py
{ "start": 42652, "end": 43554 }
class ____(nn.Module): def __init__(self, config: SamVisionConfig): super().__init__() self.config = config self.conv1 = nn.Conv2d(config.hidden_size, config.output_channels, kernel_size=1, bias=False) self.layer_norm1 = SamLayerNorm(config.output_channels, data_format="channels_fir...
SamVisionNeck
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/constructors.py
{ "start": 1011, "end": 1221 }
class ____: def __init__(self): self.x = _test_source() self.y = 0 def test_source_in_constructor(): c = SourceInConstructor() _test_sink(c.x) _test_sink(c.y)
SourceInConstructor
python
docker__docker-py
docker/models/images.py
{ "start": 312, "end": 4183 }
class ____(Model): """ An image on the server. """ def __repr__(self): tag_str = "', '".join(self.tags) return f"<{self.__class__.__name__}: '{tag_str}'>" @property def labels(self): """ The labels of an image as dictionary. """ result = self.attr...
Image
python
redis__redis-py
tests/test_maint_notifications.py
{ "start": 14280, "end": 16067 }
class ____: """Test the NodeFailedOverNotification class.""" def test_init(self): """Test NodeFailedOverNotification initialization.""" with patch("time.monotonic", return_value=1000): notification = NodeFailedOverNotification(id=1) assert notification.id == 1 ...
TestNodeFailedOverNotification
python
plotly__plotly.py
plotly/graph_objs/layout/updatemenu/_pad.py
{ "start": 235, "end": 4072 }
class ____(_BaseLayoutHierarchyType): _parent_path_str = "layout.updatemenu" _path_str = "layout.updatemenu.pad" _valid_props = {"b", "l", "r", "t"} @property def b(self): """ The amount of padding (in px) along the bottom of the component. The 'b' property is a num...
Pad
python
django__django
tests/cache/tests.py
{ "start": 52375, "end": 52904 }
class ____: def __init__(self, cache): self.cache = cache self.locked = False def __getstate__(self): self.locked = self.cache._lock.locked() return {} limit_locmem_entries = override_settings( CACHES=caches_setting_for_tests( BACKEND="django.core.cache.backends.lo...
PicklingSideEffect
python
ray-project__ray
doc/source/serve/doc_code/model_composition/chaining_example.py
{ "start": 362, "end": 551 }
class ____: def __init__(self, multiple: int): self._multiple = multiple def __call__(self, val: int) -> int: return val * self._multiple @serve.deployment
Multiplier
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/test_functions.py
{ "start": 2506, "end": 25504 }
class ____: @pytest.mark.parametrize(("body", "message"), _prepare_test_bodies()) @mock.patch("airflow.providers.google.cloud.operators.functions.CloudFunctionsHook") def test_missing_fields(self, mock_hook, body, message): op = CloudFunctionDeployFunctionOperator( project_id="test_proje...
TestGcfFunctionDeploy
python
getsentry__sentry
tests/sentry/utils/mockdata/test_core.py
{ "start": 1589, "end": 2967 }
class ____(SnubaTestCase, TestCase): @pytest.mark.skip(reason="Skipping for now (10/29) while we investigate") def test_main_skip_default_setup(self) -> None: self.create_user(is_superuser=True) mockdata.main(skip_default_setup=True, num_events=0) user = User.objects.get(is_superuser=F...
TestMockData
python
automl__auto-sklearn
autosklearn/pipeline/components/regression/k_nearest_neighbors.py
{ "start": 420, "end": 2378 }
class ____(AutoSklearnRegressionAlgorithm): def __init__(self, n_neighbors, weights, p, random_state=None): self.n_neighbors = n_neighbors self.weights = weights self.p = p self.random_state = random_state def fit(self, X, y): import sklearn.neighbors self.n_nei...
KNearestNeighborsRegressor
python
getsentry__sentry
tests/sentry/rules/conditions/test_new_high_priority_issue.py
{ "start": 302, "end": 1250 }
class ____(RuleTestCase): rule_cls = NewHighPriorityIssueCondition def setUp(self) -> None: self.rule = Rule(environment_id=1, project=self.project, label="label") def test_applies_correctly(self) -> None: self.project.save() rule = self.get_rule(rule=self.rule) # This wil...
NewHighPriorityIssueConditionTest
python
tensorflow__tensorflow
tensorflow/python/ops/numpy_ops/tests/test_util.py
{ "start": 10266, "end": 10392 }
class ____: def __len__(self): return 0 def __getitem__(self, i): raise IndexError(f'index {i} out of range.')
ScalarShape
python
networkx__networkx
networkx/classes/tests/test_multidigraph.py
{ "start": 13763, "end": 14667 }
class ____(_TestMultiGraphEdgeSubgraph): """Unit tests for the :meth:`MultiDiGraph.edge_subgraph` method.""" def setup_method(self): # Create a quadruply-linked path graph on five nodes. G = nx.MultiDiGraph() nx.add_path(G, range(5)) nx.add_path(G, range(5)) nx.add_path(...
TestEdgeSubgraph
python
scipy__scipy
scipy/signal/tests/test_filter_design.py
{ "start": 173793, "end": 192863 }
class ____: @xfail_xp_backends("cupy", reason="dtypes do not match") def test_degenerate(self, xp): # 0-order filter is just a passthrough # Even-order filters have DC gain of -rp dB # Stopband ripple factor doesn't matter b, a = ellip(0, 10*math.log10(2), 123.456, xp.asarray(1....
TestEllip
python
numba__numba
numba/tests/test_tuples.py
{ "start": 17777, "end": 18191 }
class ____(TestCase, MemoryLeakMixin): def test_return(self): # Check returning a namedtuple with a list inside it pyfunc = make_point_nrt cfunc = jit(nopython=True)(pyfunc) for arg in (3, 0): expected = pyfunc(arg) got = cfunc(arg) self.assertIs...
TestNamedTupleNRT
python
jmcnamara__XlsxWriter
xlsxwriter/test/worksheet/test_prepare_table_formula.py
{ "start": 301, "end": 1372 }
class ____(unittest.TestCase): """ Test the _prepare_table_formula Worksheet method for different formula types. """ def test_prepare_table_formula(self): self.fh = StringIO() self.worksheet = Worksheet() self.worksheet._set_filehandle(self.fh) testcases = [ ...
TestPrepareTableFormula
python
allegroai__clearml
clearml/backend_api/services/v2_20/tasks.py
{ "start": 410428, "end": 413729 }
class ____(Response): """ Response of tasks.unarchive_many endpoint. :param succeeded: :type succeeded: Sequence[dict] :param failed: :type failed: Sequence[dict] """ _service = "tasks" _action = "unarchive_many" _version = "2.20" _schema = { "definitions": {}, ...
UnarchiveManyResponse
python
huggingface__transformers
src/transformers/models/olmo3/modular_olmo3.py
{ "start": 9501, "end": 9665 }
class ____(Olmo2RMSNorm): pass # Olmo3 attention is identical to OLMo 2 attention except: # - Sliding window attention is used for 3 out of 4 layers.
Olmo3RMSNorm
python
numba__numba
numba/misc/help/inspector.py
{ "start": 3016, "end": 5602 }
class ____(object): """For gathering simple statistic of (un)supported functions""" def __init__(self): self.supported = 0 self.unsupported = 0 @property def total(self): total = self.supported + self.unsupported return total @property def ratio(self): r...
_Stat
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1597742, "end": 1597907 }
class ____(sgqlc.types.Union): """An object which has a renamable title""" __schema__ = github_schema __types__ = (Issue, PullRequest)
RenamedTitleSubject
python
huggingface__transformers
src/transformers/models/gemma2/modeling_gemma2.py
{ "start": 24144, "end": 24407 }
class ____(GenericForTokenClassification, Gemma2PreTrainedModel): pass __all__ = [ "Gemma2ForCausalLM", "Gemma2Model", "Gemma2PreTrainedModel", "Gemma2ForSequenceClassification", "Gemma2ForTokenClassification", ]
Gemma2ForTokenClassification
python
django__django
django/contrib/postgres/operations.py
{ "start": 3323, "end": 3449 }
class ____(CreateExtension): def __init__(self, hints=None): super().__init__("hstore", hints=hints)
HStoreExtension
python
pandas-dev__pandas
pandas/tests/frame/methods/test_to_records.py
{ "start": 258, "end": 18595 }
class ____: def test_to_records_timeseries(self): index = date_range("1/1/2000", periods=10, unit="ns") df = DataFrame( np.random.default_rng(2).standard_normal((10, 3)), index=index, columns=["a", "b", "c"], ) result = df.to_records() ass...
TestDataFrameToRecords
python
pyqtgraph__pyqtgraph
pyqtgraph/parametertree/parameterTypes/color.py
{ "start": 556, "end": 980 }
class ____(SimpleParameter): itemClass = ColorParameterItem def _interpretValue(self, v): return fn.mkColor(v) def value(self): value = super().value() if value is None: return None return fn.mkColor(value) def saveState(self, filter=None): state = ...
ColorParameter
python
getsentry__sentry
src/sentry/testutils/cases.py
{ "start": 131793, "end": 139795 }
class ____(SpanTestCase): def setUp(self): self.day_ago = before_now(days=1).replace(hour=10, minute=0, second=0, microsecond=0) self.root_span_ids = [uuid4().hex[:16] for _ in range(3)] self.trace_id = uuid4().hex def get_start_end_from_day_ago(self, milliseconds: int) -> tuple[datetim...
TraceTestCase
python
apache__airflow
providers/fab/src/airflow/providers/fab/www/airflow_flask_app.py
{ "start": 1151, "end": 1258 }
class ____(Flask): """Airflow Flask Application.""" dag_bag: DagBag api_auth: list[Any]
AirflowApp
python
pytorch__pytorch
torch/_dynamo/comptime.py
{ "start": 6034, "end": 12089 }
class ____: """ This context class provides access to a public API for Dynamo's internals. If there is something here you would find useful that is missing, please file a feature request at https://github.com/pytorch/pytorch/ """ def __init__(self, tx: InstructionTranslatorBase) -> None: ...
ComptimeContext
python
nedbat__coveragepy
tests/test_testing.py
{ "start": 8326, "end": 9325 }
class ____(CoverageTest): """Tests of CheckUniqueFilenames.""" run_in_temp_dir = False class Stub: """A stand-in for the class we're checking.""" def __init__(self, x: int) -> None: self.x = x def method( self, filename: str, a: int...
CheckUniqueFilenamesTest
python
django__django
tests/auth_tests/test_forms.py
{ "start": 56050, "end": 62696 }
class ____(TestDataMixin, TestCase): @mock.patch("django.contrib.auth.password_validation.password_changed") def test_success(self, password_changed): user = User.objects.get(username="testclient") data = { "password1": "test123", "password2": "test123", } ...
AdminPasswordChangeFormTest
python
kubernetes-client__python
kubernetes/client/models/v1_device.py
{ "start": 383, "end": 18552 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attri...
V1Device
python
bokeh__bokeh
src/bokeh/core/property/instance.py
{ "start": 4579, "end": 6508 }
class ____(Generic[I]): """ Provide a deferred initializer for Instance defaults. This is useful for Bokeh models with Instance properties that should have unique default values for every model instance. Using an InstanceDefault will afford better user-facing documentation than a lambda initializer. ...
InstanceDefault