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
joke2k__faker
faker/providers/automotive/es_CL/__init__.py
{ "start": 96, "end": 1965 }
class ____(AutomotiveProvider): """Implement automotive provider for ``es`` locale. Sources: - https://en.wikipedia.org/wiki/Vehicle_registration_plates_of_Chile """ license_plate_old_format_first_letters = "ABCDFGHJKLPRSTVWXYZ" license_plate_old_format_second_letters = "ABCDFGHIJKLPRSTVWXYZ...
Provider
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1146139, "end": 1150504 }
class ____(sgqlc.types.Type, Node): """A draft issue within a project.""" __schema__ = github_schema __field_names__ = ( "assignees", "body", "body_html", "body_text", "created_at", "creator", "project_v2_items", "projects_v2", "title"...
DraftIssue
python
mlflow__mlflow
mlflow/entities/model_registry/model_version_tag.py
{ "start": 174, "end": 933 }
class ____(_ModelRegistryEntity): """Tag object associated with a model version.""" def __init__(self, key, value): self._key = key self._value = value def __eq__(self, other): if type(other) is type(self): return self.__dict__ == other.__dict__ return False ...
ModelVersionTag
python
ansible__ansible
lib/ansible/_internal/ansible_collections/ansible/_protomatter/plugins/filter/finalize.py
{ "start": 351, "end": 472 }
class ____: @staticmethod def filters() -> dict[str, t.Callable]: return dict(finalize=finalize)
FilterModule
python
crytic__slither
slither/utils/martin.py
{ "start": 1386, "end": 1548 }
class ____: """Class to hold the information for a section of the report.""" title: str pretty_table: MyPrettyTable txt: str @dataclass
SectionInfo
python
numpy__numpy
numpy/polynomial/tests/test_chebyshev.py
{ "start": 1186, "end": 1496 }
class ____: def test_chebdomain(self): assert_equal(cheb.chebdomain, [-1, 1]) def test_chebzero(self): assert_equal(cheb.chebzero, [0]) def test_chebone(self): assert_equal(cheb.chebone, [1]) def test_chebx(self): assert_equal(cheb.chebx, [0, 1])
TestConstants
python
doocs__leetcode
solution/1900-1999/1900.The Earliest and Latest Rounds Where Players Compete/Solution.py
{ "start": 741, "end": 919 }
class ____: def earliestAndLatest( self, n: int, firstPlayer: int, secondPlayer: int ) -> List[int]: return dfs(firstPlayer - 1, secondPlayer - 1, n)
Solution
python
miyuchina__mistletoe
test/test_html_renderer.py
{ "start": 6228, "end": 6901 }
class ____(TestCase): def setUp(self): self.renderer = HtmlRenderer() self.renderer.__enter__() self.addCleanup(self.renderer.__exit__, None, None, None) def test_footnote_image(self): token = Document(['![alt][foo]\n', '\n', '[foo]: bar "title"\n']) expected = '<p><img ...
TestHtmlRendererFootnotes
python
huggingface__transformers
src/transformers/models/mistral3/modeling_mistral3.py
{ "start": 5481, "end": 7069 }
class ____(ModelOutput): r""" loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Language modeling loss (for next-token prediction). logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`): Prediction scores of the lan...
Mistral3CausalLMOutputWithPast
python
Textualize__textual
tests/snapshot_tests/snapshot_apps/ansi_mapping.py
{ "start": 79, "end": 704 }
class ____(App[None]): def compose(self) -> ComposeResult: ansi_colors = [ "ansi_red", "ansi_green", "ansi_yellow", "ansi_blue", "ansi_magenta", "ansi_cyan", "ansi_white", "ansi_black", ] yield La...
AnsiMappingApp
python
getsentry__sentry
tests/sentry/integrations/api/endpoints/test_organization_integration_serverless_functions.py
{ "start": 8788, "end": 28491 }
class ____(AbstractServerlessTest): method = "post" @responses.activate @patch.object(AwsLambdaIntegration, "get_serialized_lambda_function") @patch("sentry.integrations.aws_lambda.integration.gen_aws_client") def test_enable_node_layer( self, mock_gen_aws_client: MagicMock, mock_get_serial...
OrganizationIntegrationServerlessFunctionsPostTest
python
tornadoweb__tornado
tornado/test/auth_test.py
{ "start": 20315, "end": 21545 }
class ____(RequestHandler, GoogleOAuth2Mixin): def initialize(self, test): self.test = test self._OAUTH_REDIRECT_URI = test.get_url("/client/login") self._OAUTH_AUTHORIZE_URL = test.get_url("/google/oauth2/authorize") self._OAUTH_ACCESS_TOKEN_URL = test.get_url("/google/oauth2/token"...
GoogleLoginHandler
python
networkx__networkx
networkx/algorithms/tests/test_cuts.py
{ "start": 3676, "end": 4077 }
class ____: """Unit tests for the :func:`~networkx.edge_expansion` function.""" def test_graph(self): G = nx.barbell_graph(5, 0) S = set(range(5)) T = set(G) - S expansion = nx.edge_expansion(G, S, T) expected = 1 / 5 assert expected == expansion # Test w...
TestEdgeExpansion
python
mamba-org__mamba
micromamba/tests/test_pkg_cache.py
{ "start": 2909, "end": 9810 }
class ____: def test_extracted_file_deleted( self, tmp_home, tmp_cache_file_in_test_package, tmp_root_prefix ): old_ino = tmp_cache_file_in_test_package.stat().st_ino os.remove(tmp_cache_file_in_test_package) env_name = "some_env" helpers.create(package_to_check_requirem...
TestPkgCache
python
django__django
tests/queries/models.py
{ "start": 17391, "end": 17538 }
class ____(models.Model): field_c0 = models.FloatField() # db_table names have capital letters to ensure they are quoted in queries.
Ticket23605C
python
ray-project__ray
python/ray/experimental/tqdm_ray.py
{ "start": 4646, "end": 6458 }
class ____: """Manages a single virtual progress bar on the driver. The actual position of individual bars is calculated as (pos_offset + position), where `pos_offset` is the position offset determined by the BarManager. """ def __init__(self, state: ProgressBarState, pos_offset: int): """...
_Bar
python
numba__numba
numba/tests/test_npdatetime.py
{ "start": 42736, "end": 43680 }
class ____(TestCase): def test_isinstance_datetime(self): @njit def is_complex(a): return isinstance(a, complex) @njit def is_datetime(a): return isinstance(a, np.datetime64) @njit def is_timedelta(a): return isinstance(a, np.timede...
TestDatetimeTypeOps
python
hynek__structlog
tests/test_testing.py
{ "start": 5587, "end": 6584 }
class ____: def test_factory_caches(self): """ CapturingLoggerFactory returns one CapturingLogger over and over again. """ clf = CapturingLoggerFactory() cl1 = clf() cl2 = clf() assert cl1 is cl2 def test_repr(self): """ repr says how man...
TestCapturingLogger
python
astropy__astropy
astropy/convolution/utils.py
{ "start": 250, "end": 338 }
class ____(Exception): """ Base error class for kernel errors. """
KernelError
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/array_ops/init_ops_test.py
{ "start": 32225, "end": 35010 }
class ____(test.TestCase): @test_util.run_deprecated_v1 def testInitializerIdentical(self): for dtype in [dtypes.float32, dtypes.float64]: init1 = init_ops.convolutional_delta_orthogonal(seed=1, dtype=dtype) init2 = init_ops.convolutional_delta_orthogonal(seed=1, dtype=dtype) self.assertTrue(...
ConvolutionDeltaOrthogonalInitializerTest
python
pytorch__pytorch
torch/_inductor/codegen/cuda/cuda_kernel.py
{ "start": 6507, "end": 20195 }
class ____(CUDAKernel): """ Template kernels defined by CUDA / Cutlass in C++. """ _EXTRA_CPP_ARGS = "size_t* workspace_size, uint8_t* workspace, cudaStream_t stream" def __init__( self, kernel_name: str, runtime_arg_info: list["ArgInfo"], runtime_arg_values: list[A...
CUDATemplateKernel
python
pypa__virtualenv
src/virtualenv/activation/cshell/__init__.py
{ "start": 106, "end": 336 }
class ____(ViaTemplateActivator): @classmethod def supports(cls, interpreter): return interpreter.os != "nt" def templates(self): yield "activate.csh" __all__ = [ "CShellActivator", ]
CShellActivator
python
matplotlib__matplotlib
lib/matplotlib/testing/compare.py
{ "start": 8399, "end": 20122 }
class ____(_SVGConverter): """ A SVG converter which explicitly adds the fonts shipped by Matplotlib to Inkspace's font search path, to better support `svg.fonttype = "none"` (which is in particular used by certain mathtext tests). """ def __call__(self, orig, dest): if not hasattr(self...
_SVGWithMatplotlibFontsConverter
python
anthropics__anthropic-sdk-python
src/anthropic/lib/tools/_beta_functions.py
{ "start": 1427, "end": 1812 }
class ____(ABC): @abstractmethod def to_dict(self) -> BetaToolUnionParam: ... @abstractmethod async def call(self, input: object) -> BetaFunctionToolResultType: ... @property def name(self) -> str: raw = self.to_dict() if "mcp_server_name" in raw: return raw["mcp_se...
BetaAsyncBuiltinFunctionTool
python
pypa__pip
tests/unit/test_link.py
{ "start": 160, "end": 8541 }
class ____: @pytest.mark.parametrize( "url, expected", [ ( "https://user:password@example.com/path/page.html", "<Link https://user:****@example.com/path/page.html>", ), ], ) def test_repr(self, url: str, expected: str) -> None: ...
TestLink
python
fsspec__filesystem_spec
fsspec/implementations/sftp.py
{ "start": 239, "end": 5923 }
class ____(AbstractFileSystem): """Files over SFTP/SSH Peer-to-peer filesystem over SSH using paramiko. Note: if using this with the ``open`` or ``open_files``, with full URLs, there is no way to tell if a path is relative, so all paths are assumed to be absolute. """ protocol = "sftp", "...
SFTPFileSystem
python
getsentry__sentry
src/sentry/search/base.py
{ "start": 547, "end": 1465 }
class ____(Service): __read_methods__ = ("query",) __write_methods__ = () __all__ = tuple(set(__read_methods__ + __write_methods__)) def __init__(self, **options: Mapping[str, Any] | None): pass def query( self, projects: Sequence[Project], environments: Sequence[En...
SearchBackend
python
django__django
tests/check_framework/tests.py
{ "start": 3376, "end": 6013 }
class ____(SimpleTestCase): def test_printing(self): e = Error("Message", hint="Hint", obj=DummyObj()) expected = "obj: Message\n\tHINT: Hint" self.assertEqual(str(e), expected) def test_printing_no_hint(self): e = Error("Message", obj=DummyObj()) expected = "obj: Messag...
MessageTests
python
huggingface__transformers
src/transformers/models/hunyuan_v1_moe/modeling_hunyuan_v1_moe.py
{ "start": 10449, "end": 11191 }
class ____(nn.Module): def __init__(self, config: HunYuanMoEV1Config, layer_idx: Optional[int] = None): super().__init__() self.config = config self.layer_idx = layer_idx num_experts = config.num_experts if isinstance(config.num_experts, int) else config.num_experts[layer_idx] ...
HunYuanMoEV1Gate
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/nn_ops/rnn_cell_test.py
{ "start": 67833, "end": 72043 }
class ____(test.TestCase): def setUp(self): self._seed = 23489 np.random.seed(self._seed) @test_util.run_v1_only("b/124229375") def testMultiDimensionalLSTMAllRNNContainers(self): feature_dims = (3, 4, 5) input_size = feature_dims batch_size = 2 max_length = 8 sequence_length = [4, 6...
MultiDimensionalLSTMTest
python
ansible__ansible
test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/main.py
{ "start": 7936, "end": 8610 }
class ____(metaclass=abc.ABCMeta): """Validator instances are intended to be run on a single object. if you are scanning multiple objects for problems, you'll want to have a separate Validator for each one.""" def __init__(self, reporter=None): self.reporter = reporter @property @abc....
Validator
python
vyperlang__vyper
vyper/compiler/output_bundle.py
{ "start": 4812, "end": 6787 }
class ____: def __init__(self, compiler_data: CompilerData): self.compiler_data = compiler_data @cached_property def bundle(self): return OutputBundle(self.compiler_data) def write_sources(self, sources: dict[str, CompilerInput]): raise NotImplementedError(f"write_sources: {sel...
OutputBundleWriter
python
astropy__astropy
astropy/units/core.py
{ "start": 42617, "end": 50386 }
class ____: """ Manages a registry of the enabled units. """ def __init__(self, init=[], equivalencies=[], aliases={}): if isinstance(init, _UnitRegistry): # If passed another registry we don't need to rebuild everything. # but because these are mutable types we don't wa...
_UnitRegistry
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/class_interval.py
{ "start": 312, "end": 492 }
class ____: def m1(self, x): self.m2(x) def m2(self, x): # TODO(T114456058): Unexpected position -1 in the sinks of # override models pass
A0
python
tensorflow__tensorflow
tensorflow/python/autograph/pyct/cfg.py
{ "start": 3420, "end": 5315 }
class ____( collections.namedtuple( 'Graph', ['entry', 'exit', 'error', 'index', 'stmt_prev', 'stmt_next'])): """A Control Flow Graph. The CFG maintains an index to allow looking up a CFG node by the AST node to which it is associated. The index can also be enumerated in top-down, depth fir...
Graph
python
openai__openai-python
src/openai/_base_client.py
{ "start": 64830, "end": 66840 }
class ____: def __init__(self, name: str) -> None: self.name = name @override def __str__(self) -> str: return f"Other:{self.name}" Platform = Union[ OtherPlatform, Literal[ "MacOS", "Linux", "Windows", "FreeBSD", "OpenBSD", "iOS", ...
OtherPlatform
python
numba__numba
numba/tests/test_dictimpl.py
{ "start": 5639, "end": 6042 }
class ____(types.Type): """this is essentially UniTuple(unicode_type, n) BUT type name is the same for all n""" def __init__(self, value): super(ParametrizedType, self).__init__('ParametrizedType') self.dtype = types.unicode_type self.n = len(value) @property def key(self):...
ParametrizedType
python
ZoranPandovski__al-go-rithms
dp/Shortest common Supersequence/shortest_common_supersequence.py
{ "start": 32, "end": 1384 }
class ____: def shortestCommonSupersequence(self, str1: str, str2: str) -> str: m = len(str1) n = len(str2) t = [[-1]*(n+1) for i in range(m+1)] for i in range(m+1): for j in range(n+1): if(i==0 or j==0): t[i]...
Solution
python
matplotlib__matplotlib
lib/matplotlib/tests/test_units.py
{ "start": 10483, "end": 11657 }
class ____: def __init__(self, array): self._array = np.asanyarray(array) def __array__(self, dtype=None, copy=None): if dtype is not None and dtype != self._array.dtype: if copy is not None and not copy: raise ValueError( f"Converting array from ...
Kernel
python
ipython__ipython
tests/test_zzz_autoreload.py
{ "start": 25862, "end": 39729 }
class ____: # old-style class def foo(self): return 2 """, ) def check_module_contents(): self.assertEqual(mod.x, 10) self.assertFalse(hasattr(mod, "z")) self.assertEqual(old_foo(0), 4) # superreload magic! self.assertEqual(mod.foo(0), 4)...
Bar
python
joke2k__faker
faker/providers/lorem/hy_AM/__init__.py
{ "start": 68, "end": 3810 }
class ____(LoremProvider): """Implement lorem provider for ``hy_AM`` locale. Sources: - https://www.101languages.net/armenian/armenian-word-list """ word_list = ( "ես", "դու", "նա", "մենք", "դուք", "նրանք", "այս", "այն", "այս...
Provider
python
pypa__warehouse
tests/unit/test_views.py
{ "start": 28411, "end": 28713 }
class ____: def test_valid(self): with pytest.raises(HTTPBadRequest): force_status(pretend.stub(matchdict={"status": "400"})) def test_invalid(self): with pytest.raises(HTTPNotFound): force_status(pretend.stub(matchdict={"status": "599"}))
TestForceStatus
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_format25.py
{ "start": 315, "end": 978 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("format25.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file with automatic color.""" workbook = ...
TestCompareXLSXFiles
python
django__django
tests/bulk_create/models.py
{ "start": 1727, "end": 1819 }
class ____(models.Model): id = models.SmallAutoField(primary_key=True)
SmallAutoFieldModel
python
kamyu104__LeetCode-Solutions
Python/check-if-n-and-its-double-exist.py
{ "start": 29, "end": 360 }
class ____(object): def checkIfExist(self, arr): """ :type arr: List[int] :rtype: bool """ lookup = set() for x in arr: if 2*x in lookup or \ (x%2 == 0 and x//2 in lookup): return True lookup.add(x) return...
Solution
python
eventlet__eventlet
tests/dagpool_test.py
{ "start": 4028, "end": 19429 }
class ____: """ This class is intended to capture a sequence (of string messages) to verify that all expected events occurred, and in the expected order. The tricky part is that certain subsequences can occur in arbitrary order and still be correct. Specifically, when posting a particular value...
Capture
python
falconry__falcon
tests/test_request_media.py
{ "start": 6341, "end": 7847 }
class ____(media.BaseHandler): def serialize(self, *args, **kwargs): pass def deserialize(self, *args, **kwargs): pass exhaust_stream = True def test_complete_consumption(asgi): client = create_client(asgi, {'nope/nope': NopeHandler()}) body = b'{"something": "abracadabra"}' ...
NopeHandler
python
numpy__numpy
numpy/f2py/tests/test_array_from_pyobj.py
{ "start": 6994, "end": 11086 }
class ____: def __repr__(self): return (f'Array({self.type}, {self.dims}, {self.intent},' f' {self.obj})|arr={self.arr}') def __init__(self, typ, dims, intent, obj): self.type = typ self.dims = dims self.intent = intent self.obj_copy = copy.deepcopy(obj)...
Array
python
apache__airflow
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dags.py
{ "start": 43197, "end": 45897 }
class ____(TestDagEndpoint): """Unit tests for Get DAG.""" @pytest.mark.parametrize( ("query_params", "dag_id", "expected_status_code", "dag_display_name", "expected_tags"), [ ({}, "fake_dag_id", 404, "fake_dag", []), ({}, DAG2_ID, 200, DAG2_ID, []), ], ) ...
TestGetDag
python
sympy__sympy
sympy/printing/repr.py
{ "start": 468, "end": 11376 }
class ____(Printer): printmethod = "_sympyrepr" _default_settings: dict[str, Any] = { "order": None, "perm_cyclic" : True, } def reprify(self, args, sep): """ Prints each item in `args` and joins them with `sep`. """ return sep.join([self.doprint(item) f...
ReprPrinter
python
tensorflow__tensorflow
tensorflow/python/data/kernel_tests/as_numpy_iterator_test.py
{ "start": 1368, "end": 5598 }
class ____(test_base.DatasetTestBase, parameterized.TestCase): @combinations.generate(test_base.eager_only_combinations()) def testBasic(self): ds = dataset_ops.Dataset.range(3) self.assertEqual([0, 1, 2], list(ds.as_numpy_iterator())) @combinations.generate(test_base.eager_only_combinations()) def te...
AsNumpyIteratorTest
python
realpython__materials
inheritance-and-composition/inheritance/employees.py
{ "start": 1056, "end": 1276 }
class ____(Employee, SecretaryRole, HourlyPolicy): def __init__(self, id, name, hours_worked, hour_rate): HourlyPolicy.__init__(self, hours_worked, hour_rate) super().__init__(id, name)
TemporarySecretary
python
ansible__ansible
test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/module_args.py
{ "start": 1402, "end": 1458 }
class ____(ImportError): pass
AnsibleModuleImportError
python
getsentry__sentry
src/sentry/integrations/slack/unfurl/types.py
{ "start": 616, "end": 692 }
class ____(NamedTuple): url: str args: Mapping[str, Any]
UnfurlableUrl
python
run-llama__llama_index
llama-index-core/llama_index/core/llama_dataset/base.py
{ "start": 1686, "end": 3241 }
class ____(BaseModel): _prediction_type: ClassVar[Type[BaseLlamaExamplePrediction]] predictions: List[BaseLlamaExamplePrediction] = Field( default_factory=list, description="Predictions on train_examples." ) def __getitem__( self, val: Union[slice, int] ) -> Union[Sequence[BaseLlama...
BaseLlamaPredictionDataset
python
pypa__warehouse
tests/unit/legacy/api/test_json.py
{ "start": 17669, "end": 29067 }
class ____: def test_normalizing_redirects(self, db_request): release = ReleaseFactory.create(version="3.0") db_request.matchdict = { "name": release.project.name.swapcase(), "version": "3.0", } db_request.current_route_path = pretend.call_recorder( ...
TestJSONRelease
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/model_query_type_annotation.py
{ "start": 1103, "end": 1218 }
class ____: taint_1: int = 0 taint_2: int = 0 no_taint_1: List[int] = [] no_taint_2: str = ""
Test7_C
python
dateutil__dateutil
src/dateutil/tz/tz.py
{ "start": 3289, "end": 5055 }
class ____(datetime.tzinfo): """ A simple class for representing a fixed offset from UTC. :param name: The timezone name, to be returned when ``tzname()`` is called. :param offset: The time zone offset in seconds, or (since version 2.6.0, represented as a :py:class:`datetime.tim...
tzoffset
python
getsentry__sentry
tests/sentry/notifications/notification_action/test_metric_alert_registry_handlers.py
{ "start": 1794, "end": 2236 }
class ____(BaseMetricAlertHandler): @classmethod def send_alert( cls, notification_context: NotificationContext, alert_context: AlertContext, metric_issue_context: MetricIssueContext, open_period_context: OpenPeriodContext, trigger_status: TriggerStatus, n...
TestHandler
python
astropy__astropy
astropy/timeseries/core.py
{ "start": 1254, "end": 3526 }
class ____(QTable): _required_columns = None _required_columns_enabled = True # If _required_column_relax is True, we don't require the columns to be # present but we do require them to be the correct ones IF present. Note # that this is a temporary state - as soon as the required columns # are...
BaseTimeSeries
python
neetcode-gh__leetcode
python/0231-power-of-two.py
{ "start": 176, "end": 300 }
class ____: def isPowerOfTwo(self, n: int) -> bool: return n > 0 and (n & (n - 1)) == 0 # Bit manipulation
Solution
python
openai__openai-python
src/openai/types/beta/chatkit/thread_delete_response.py
{ "start": 198, "end": 483 }
class ____(BaseModel): id: str """Identifier of the deleted thread.""" deleted: bool """Indicates that the thread has been deleted.""" object: Literal["chatkit.thread.deleted"] """Type discriminator that is always `chatkit.thread.deleted`."""
ThreadDeleteResponse
python
django__django
tests/postgres_tests/test_search.py
{ "start": 18087, "end": 23098 }
class ____(GrailTestData, PostgreSQLTestCase): def test_ranking(self): searched = ( Line.objects.filter(character=self.minstrel) .annotate( rank=SearchRank( SearchVector("dialogue"), SearchQuery("brave sir robin") ), ) ...
TestRankingAndWeights
python
lazyprogrammer__machine_learning_examples
svm_class/svm_gradient.py
{ "start": 1346, "end": 4775 }
class ____: def __init__(self, kernel, C=1.0): self.kernel = kernel self.C = C def _train_objective(self): return np.sum(self.alphas) - 0.5 * np.sum(self.YYK * np.outer(self.alphas, self.alphas)) def fit(self, X, Y, lr=1e-5, n_iters=400): # we need these to make future predictions self.Xtrai...
SVM
python
apache__airflow
providers/apprise/tests/unit/apprise/notifications/test_apprise.py
{ "start": 1065, "end": 4906 }
class ____: @pytest.fixture(autouse=True) def setup_connections(self, create_connection_without_db): extra = {"config": {"path": "http://some_path_that_dont_exist/", "tag": "alert"}} create_connection_without_db( Connection( conn_id="apprise_default", ...
TestAppriseNotifier
python
tensorflow__tensorflow
tensorflow/python/distribute/multi_worker_test_base.py
{ "start": 20149, "end": 20290 }
class ____(object): def __enter__(self): return def __exit__(self, exception_type, exception_value, traceback): pass
DummySession
python
agronholm__apscheduler
src/apscheduler/executors/async_.py
{ "start": 191, "end": 670 }
class ____(JobExecutor): """ Executes functions directly on the event loop thread. If the function returns a coroutine object (or another kind of awaitable), that is awaited on and its return value is used as the job's return value. """ async def run_job(self, func: Callable[..., Any], job: Jo...
AsyncJobExecutor
python
google__pytype
pytype/typegraph/typegraph_serializer.py
{ "start": 1209, "end": 1305 }
class ____: id: VariableId bindings: list[BindingId] @dataclasses.dataclass
SerializedVariable
python
ray-project__ray
release/ray_release/result.py
{ "start": 512, "end": 2721 }
class ____: results: Optional[Dict] = None status: str = ResultStatus.UNKNOWN.value return_code: int = 0 last_logs: Optional[str] = None runtime: Optional[float] = None stable: bool = True smoke_test: bool = False buildkite_url: Optional[str] = None cluster_url: Optional[str] = No...
Result
python
etianen__django-reversion
tests/test_app/tests/test_api.py
{ "start": 574, "end": 719 }
class ____(TestModelMixin, TestBase): def testIsRegistered(self): self.assertTrue(reversion.is_registered(TestModel))
IsRegisteredTest
python
apache__airflow
providers/databricks/src/airflow/providers/databricks/plugins/databricks_workflow.py
{ "start": 17334, "end": 18980 }
class ____(BaseOperatorLink, LoggingMixin): """Construct a link to send a repair request for a single databricks task.""" name = "Repair a single task" def get_link( self, operator, dttm=None, *, ti_key: TaskInstanceKey | None = None, ) -> str: if not ti...
WorkflowJobRepairSingleTaskLink
python
run-llama__llama_index
llama-index-integrations/readers/llama-index-readers-github/llama_index/readers/github/collaborators/github_client.py
{ "start": 254, "end": 685 }
class ____(Protocol): def get_all_endpoints(self) -> Dict[str, str]: ... async def request( self, endpoint: str, method: str, headers: Dict[str, Any] = {}, params: Dict[str, Any] = {}, **kwargs: Any, ) -> Any: ... async def get_collaborators( sel...
BaseGitHubCollaboratorsClient
python
tensorflow__tensorflow
tensorflow/python/autograph/pyct/common_transformers/anf.py
{ "start": 2803, "end": 23477 }
class ____(transformer.Base): """Performs the conversion to A-normal form (ANF).""" # The algorithm is a postorder recursive tree walk. Any given node A may, in # general, require creation of a series B of Assign statements, which compute # and explicitly name the intermediate values needed to compute the val...
AnfTransformer
python
bokeh__bokeh
tests/unit/bokeh/util/test_hex.py
{ "start": 2751, "end": 4136 }
class ____: def test_gaussian_pointytop(self) -> None: bins = buh.hexbin(x, y, 2) np.testing.assert_array_equal(bins.q, [0, 0, 1, 1, 1, 2, 2]) np.testing.assert_array_equal(bins.r, [0, -1, 0, -2, -1, -2, -1]) np.testing.assert_array_equal(bins.counts, [54, 9, 98, 1, 313, 3, 22]) ...
Test_hexbin
python
pyinstaller__pyinstaller
bootloader/waflib/Node.py
{ "start": 1853, "end": 15259 }
class ____(object): dict_class = dict __slots__ = ('name', 'parent', 'children', 'cache_abspath', 'cache_isdir') def __init__(self, name, parent): self.name = name self.parent = parent if parent: if name in parent.children: raise Errors.WafError('node %s ...
Node
python
huggingface__transformers
src/transformers/models/switch_transformers/modeling_switch_transformers.py
{ "start": 5657, "end": 6811 }
class ____(nn.Module): def __init__(self, hidden_size, eps=1e-6): """ Construct a layernorm module in the SWITCH_TRANSFORMERS style. No bias and no subtraction of mean. """ super().__init__() self.weight = nn.Parameter(torch.ones(hidden_size)) self.variance_epsilon = ...
SwitchTransformersLayerNorm
python
langchain-ai__langchain
libs/langchain/langchain_classic/evaluation/criteria/eval_chain.py
{ "start": 18478, "end": 21524 }
class ____(CriteriaEvalChain): """Criteria evaluation chain that requires references.""" @classmethod @override def is_lc_serializable(cls) -> bool: return False @property def requires_reference(self) -> bool: """Whether the evaluation requires a reference text.""" retu...
LabeledCriteriaEvalChain
python
apache__airflow
providers/openlineage/tests/unit/openlineage/plugins/test_listener.py
{ "start": 45894, "end": 92056 }
class ____: @pytest.mark.skip("Rendering fields is not migrated yet in Airflow 3") @patch("airflow.models.BaseOperator.render_template") def test_listener_does_not_change_task_instance(self, render_mock, mock_supervisor_comms, spy_agency): from airflow.sdk.execution_time.task_runner import ( ...
TestOpenLineageListenerAirflow3
python
google__jax
jax/_src/source_info_util.py
{ "start": 2462, "end": 2685 }
class ____(NamedTuple): name: str def wrap(self, stack: list[str]): if stack: stack[-1] = f'{self.name}({stack[-1]})' else: stack.append(f'{self.name}()') @dataclasses.dataclass(frozen=True)
Transform
python
kamyu104__LeetCode-Solutions
Python/clone-n-ary-tree.py
{ "start": 957, "end": 1340 }
class ____(object): def cloneTree(self, root): """ :type root: Node :rtype: Node """ def dfs(node): if not node: return None copy = Node(node.val) for child in node.children: copy.children.append(dfs(child)) ...
Solution2
python
keras-team__keras
keras/src/wrappers/utils.py
{ "start": 835, "end": 2394 }
class ____(TransformerMixin, BaseEstimator): """Convert 1D targets to 2D and back. For use in pipelines with transformers that only accept 2D inputs, like OneHotEncoder and OrdinalEncoder. Attributes: ndim_ : int Dimensions of y that the transformer was trained on. """ def...
TargetReshaper
python
kamyu104__LeetCode-Solutions
Python/painting-the-walls.py
{ "start": 64, "end": 473 }
class ____(object): def paintWalls(self, cost, time): """ :type cost: List[int] :type time: List[int] :rtype: int """ dp = [float("inf")]*(len(cost)+1) dp[0] = 0 for c, t in itertools.izip(cost, time): for j in reversed(xrange(1, len(cost)+...
Solution
python
pypa__virtualenv
src/virtualenv/config/cli/parser.py
{ "start": 1246, "end": 4036 }
class ____(ArgumentParser): """Custom option parser which updates its defaults by checking the configuration files and environmental vars.""" def __init__(self, options=None, env=None, *args, **kwargs) -> None: env = os.environ if env is None else env self.file_config = IniConfig(env) s...
VirtualEnvConfigParser
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/oracle/cx_oracle.py
{ "start": 25969, "end": 26078 }
class ____(oracle.INTERVAL): def get_dbapi_type(self, dbapi): return dbapi.INTERVAL
_OracleInterval
python
pytorch__pytorch
torch/nn/modules/activation.py
{ "start": 16845, "end": 18321 }
class ____(Module): r"""Applies the CELU function element-wise. .. math:: \text{CELU}(x) = \max(0,x) + \min(0, \alpha * (\exp(x/\alpha) - 1)) More details can be found in the paper `Continuously Differentiable Exponential Linear Units`_ . Args: alpha: the :math:`\alpha` value for the ...
CELU
python
readthedocs__readthedocs.org
readthedocs/doc_builder/backends/sphinx.py
{ "start": 8832, "end": 10123 }
class ____(BaseSphinx): sphinx_builder = "epub" relative_output_dir = "epub" def _post_build(self): """Internal post build to cleanup EPUB output directory and leave only one .epub file.""" temp_epub_file = f"/tmp/{self.project.slug}-{self.version.slug}.epub" target_file = os.path.j...
EpubBuilder
python
google__pytype
pytype/rewrite/flow/frame_base.py
{ "start": 714, "end": 808 }
class ____: """Block and opcode indices for a frame step.""" block: int opcode: int
_Step
python
ray-project__ray
python/ray/serve/_private/benchmarks/streaming/streaming_handle_throughput.py
{ "start": 240, "end": 2363 }
class ____(Caller): async def _consume_single_stream(self): method = self._get_remote_method().options( stream=True, ) async for r in method.remote(): # Blackhole the response # self.sink(str(r, 'utf-8')) self.sink(r) @click.command(help="Be...
CallerDeployment
python
getsentry__sentry
tests/apidocs/endpoints/releases/test_organization_release_details.py
{ "start": 172, "end": 1686 }
class ____(APIDocsTestCase): def setUp(self) -> None: user = self.create_user(is_staff=False, is_superuser=False) org = self.organization org2 = self.create_organization() org.flags.allow_joinleave = False org.save() team1 = self.create_team(organization=org) ...
OrganizationReleaseDetailsDocsTest
python
PrefectHQ__prefect
src/prefect/context.py
{ "start": 12677, "end": 13633 }
class ____(ContextModel): """ The base context for a flow or task run. Data in this context will always be available when `get_run_context` is called. Attributes: start_time: The time the run context was entered client: The Prefect client instance being used for API communication ""...
RunContext
python
huggingface__transformers
tests/models/speech_to_text/test_feature_extraction_speech_to_text.py
{ "start": 1407, "end": 3374 }
class ____: def __init__( self, parent, batch_size=7, min_seq_length=400, max_seq_length=2000, feature_size=24, num_mel_bins=24, padding_value=0.0, sampling_rate=16_000, return_attention_mask=True, do_normalize=True, ): ...
Speech2TextFeatureExtractionTester
python
altair-viz__altair
altair/vegalite/v6/schema/channels.py
{ "start": 134084, "end": 139494 }
class ____(ValueChannelMixin, core.StringValueDefWithCondition): """ DescriptionValue schema wrapper. Parameters ---------- condition : dict, :class:`ConditionalMarkPropFieldOrDatumDef`, :class:`ConditionalValueDefstringnullExprRef`, :class:`ConditionalParameterMarkPropFieldOrDatumDef`, :class:`Con...
DescriptionValue
python
getsentry__sentry
src/sentry/api/serializers/models/release.py
{ "start": 4602, "end": 7849 }
class ____(TypedDict): authors: list[Author] def _get_authors_metadata( item_list: list[Release], user: User | RpcUser | AnonymousUser ) -> dict[Release, _AuthorList]: """ Returns a dictionary of release_id => authors metadata, where each commit metadata dict contains an array of authors. ...
_AuthorList
python
tensorflow__tensorflow
tensorflow/python/saved_model/saved_model_test.py
{ "start": 58558, "end": 67643 }
class ____(SavedModelTestBase): def _validate_asset_collection(self, export_dir, graph_collection_def, expected_asset_file_name, expected_asset_file_contents, ...
SavedModelV1Test
python
great-expectations__great_expectations
great_expectations/expectations/core/expect_column_min_to_be_between.py
{ "start": 2769, "end": 16921 }
class ____(ColumnAggregateExpectation): __doc__ = f"""{EXPECTATION_SHORT_DESCRIPTION} ExpectColumnMinToBeBetween is a \ Column Aggregate Expectation. Column Aggregate Expectations are one of the most common types of Expectation. They are evaluated for a single column, and produce an aggregate Metr...
ExpectColumnMinToBeBetween
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_drop_lines03.py
{ "start": 315, "end": 1547 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_drop_lines03.xlsx") def test_create_file(self): """Test the creation of an XlsxWriter file with drop down lines.""" workbook...
TestCompareXLSXFiles
python
MongoEngine__mongoengine
mongoengine/fields.py
{ "start": 51496, "end": 55764 }
class ____(BaseField): """A reference to *any* :class:`~mongoengine.document.Document` subclass that will be automatically dereferenced on access (lazily). Note this field works the same way as :class:`~mongoengine.document.ReferenceField`, doing database I/O access the first time it is accessed (even ...
GenericReferenceField
python
huggingface__transformers
src/transformers/models/gemma3n/processing_gemma3n.py
{ "start": 954, "end": 1084 }
class ____(ProcessingKwargs, total=False): _defaults = { "text_kwargs": {"padding": False}, }
Gemma3nProcessorKwargs
python
kamyu104__LeetCode-Solutions
Python/count-complete-tree-nodes.py
{ "start": 798, "end": 1673 }
class ____(object): def countNodes(self, root): """ :type root: TreeNode :rtype: int """ def check(node, n): base = 1 while base <= n: base <<= 1 base >>= 2 while base: if (n & base) == 0: ...
Solution2
python
getsentry__sentry
src/sentry/tagstore/types.py
{ "start": 2626, "end": 3099 }
class ____(TagType): __slots__ = ("group_id", "key", "values_seen", "count", "top_values") _sort_key = "values_seen" def __init__( self, group_id: int, key: str, values_seen: int | None = None, count: int | None = None, top_values=None, ): self.gr...
GroupTagKey