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
dask__distributed
distributed/diagnostics/graph_layout.py
{ "start": 156, "end": 5201 }
class ____(SchedulerPlugin): """Dynamic graph layout during computation This assigns (x, y) locations to all tasks quickly and dynamically as new tasks are added. This scales to a few thousand nodes. It is commonly used with distributed/dashboard/components/scheduler.py::TaskGraph, which is rende...
GraphLayout
python
huggingface__transformers
src/transformers/models/sam2/modeling_sam2.py
{ "start": 26633, "end": 28417 }
class ____(Sam2PreTrainedModel): config_class = Sam2VisionConfig main_input_name = "pixel_values" _can_record_outputs = { "hidden_states": Sam2MultiScaleBlock, "attentions": Sam2MultiScaleAttention, } def __init__(self, config: Sam2VisionConfig): super().__init__(config) ...
Sam2VisionModel
python
allegroai__clearml
clearml/backend_api/services/v2_20/auth.py
{ "start": 18944, "end": 20455 }
class ____(Request): """ Get a token based on supplied credentials (key/secret). Intended for use by users with key/secret credentials that wish to obtain a token for use with other services. :param expiration_sec: Requested token expiration time in seconds. Not guaranteed, ...
LoginRequest
python
pytorch__pytorch
torch/testing/_internal/distributed/rpc/dist_autograd_test.py
{ "start": 99613, "end": 101859 }
class ____(RpcAgentTestFixture): # Reusing a simplified helper function from DistAutogradTest to ensure # autograd context is successfully cleaned up even when RPCs are failing. def context_cleanup_test_helper(self, rpc_args, func): initialize_pg(self.file_init_method, self.rank, self.world_size) ...
FaultyAgentDistAutogradTest
python
astropy__astropy
astropy/visualization/scripts/tests/test_fits2bitmap.py
{ "start": 395, "end": 2300 }
class ____: def setup_class(self): self.filename = "test.fits" self.array = np.arange(16384).reshape((128, 128)) def test_function(self, tmp_path): filename = tmp_path / self.filename fits.writeto(filename, self.array) fits2bitmap(filename) def test_script(self, tmp...
TestFits2Bitmap
python
walkccc__LeetCode
solutions/3296. Minimum Number of Seconds to Make Mountain Height Zero/3296.py
{ "start": 0, "end": 811 }
class ____: def minNumberOfSeconds( self, mountainHeight: int, workerTimes: list[int] ) -> int: def getReducedHeight(m: int) -> int: """Returns the total height reduced by all workers in `m` seconds.""" # The height `x` that a worker with working time `w` reduces in `m` # sec...
Solution
python
getsentry__sentry
src/sentry/testutils/cases.py
{ "start": 90063, "end": 91600 }
class ____(APITestCase): def setUp(self): super().setUp() self.login_as(self.user) @pytest.fixture(autouse=True) def responses_context(self): with responses.mock: yield def add_create_repository_responses(self, repository_config): raise NotImplementedError(f...
IntegrationRepositoryTestCase
python
tornadoweb__tornado
tornado/test/util_test.py
{ "start": 1787, "end": 1875 }
class ____(TestConfig3): def initialize(self, a=None): self.a = a
TestConfig3A
python
langchain-ai__langchain
libs/core/langchain_core/structured_query.py
{ "start": 2668, "end": 2784 }
class ____(str, Enum): """Enumerator of the operations.""" AND = "and" OR = "or" NOT = "not"
Operator
python
streamlit__streamlit
lib/streamlit/testing/v1/element_tree.py
{ "start": 19251, "end": 19442 }
class ____(Markdown): def __init__(self, proto: MarkdownProto, root: ElementTree) -> None: super().__init__(proto, root) self.type = "caption" @dataclass(repr=False)
Caption
python
django-compressor__django-compressor
compressor/tests/test_offline.py
{ "start": 16111, "end": 16261 }
class ____(OfflineTestCaseMixin, TestCase): templates_dir = "test_templatetag" expected_hash = "2bb88185b4f5"
OfflineCompressTemplateTagTestCase
python
django-extensions__django-extensions
django_extensions/collision_resolvers.py
{ "start": 5282, "end": 5661 }
class ____(AppNameCR): """ Collision resolver which transform pair (app name, model_name) to alias "{app_name}_{model_name}". Model from last application in alphabetical order is selected. Result is different than FullPathCR, when model has app_label other than current app. """ # noqa: E501 MO...
AppNamePrefixCR
python
matplotlib__matplotlib
lib/matplotlib/animation.py
{ "start": 3122, "end": 6836 }
class ____(abc.ABC): """ Abstract base class for writing movies, providing a way to grab frames by calling `~AbstractMovieWriter.grab_frame`. `setup` is called to start the process and `finish` is called afterwards. `saving` is provided as a context manager to facilitate this process as :: ...
AbstractMovieWriter
python
hyperopt__hyperopt
hyperopt/algobase.py
{ "start": 294, "end": 8559 }
class ____: def __init__(self, expr, deepcopy_inputs=False, max_program_len=None, memo_gc=True): """ Parameters ---------- expr - pyll Apply instance to be evaluated deepcopy_inputs - deepcopy inputs to every node prior to calling that node's function on those i...
ExprEvaluator
python
walkccc__LeetCode
solutions/2148. Count Elements With Strictly Smaller and Greater Elements/2148.py
{ "start": 0, "end": 151 }
class ____: def countElements(self, nums: list[int]) -> int: mn = min(nums) mx = max(nums) return sum(mn < num < mx for num in nums)
Solution
python
pypa__pip
src/pip/_internal/network/session.py
{ "start": 8510, "end": 9950 }
class ____: """Mixin to add the ``ssl_context`` constructor argument to HTTP adapters. The additional argument is forwarded directly to the pool manager. This allows us to dynamically decide what SSL store to use at runtime, which is used to implement the optional ``truststore`` backend. """ d...
_SSLContextAdapterMixin
python
ray-project__ray
rllib/utils/exploration/tests/test_explorations.py
{ "start": 1966, "end": 3784 }
class ____(unittest.TestCase): """ Tests all Exploration components and the deterministic flag for compute_action calls. """ @classmethod def setUpClass(cls): ray.init() @classmethod def tearDownClass(cls): ray.shutdown() def test_impala(self): config = ( ...
TestExplorations
python
pypa__pip
tests/lib/requests_mocks.py
{ "start": 617, "end": 1028 }
class ____: request: MockRequest connection: MockConnection url: str def __init__(self, contents: bytes) -> None: self.raw = FakeStream(contents) self.content = contents self.reason = "OK" self.status_code = 200 self.headers = {"Content-Length": str(len(contents)...
MockResponse
python
nedbat__coveragepy
coverage/html.py
{ "start": 7277, "end": 8499 }
class ____: """A file we're considering reporting.""" def __init__(self, fr: FileReporter, analysis: Analysis) -> None: self.fr = fr self.analysis = analysis self.rootname = flat_rootname(fr.relative_filename()) self.html_filename = self.rootname + ".html" self.prev_html...
FileToReport
python
jazzband__django-pipeline
pipeline/compressors/cssmin.py
{ "start": 91, "end": 290 }
class ____(SubProcessCompressor): def compress_css(self, css): command = (settings.CSSMIN_BINARY, settings.CSSMIN_ARGUMENTS) return self.execute_command(command, css)
CSSMinCompressor
python
huggingface__transformers
src/transformers/models/lfm2_moe/modeling_lfm2_moe.py
{ "start": 19383, "end": 22979 }
class ____(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__(self, config: Lfm2MoeConfig, layer_idx: int): super().__init__() self.config = config self.layer_idx = layer_idx self.head_dim = getattr(config, "head_dim", config.hidden_size...
Lfm2MoeAttention
python
simonw__datasette
datasette/filters.py
{ "start": 9064, "end": 9528 }
class ____(InFilter): key = "notin" display = "not in" def where_clause(self, table, column, value, param_counter): values = self.split_value(value) params = [f":p{param_counter + i}" for i in range(len(values))] sql = f"{escape_sqlite(column)} not in ({', '.join(params)})" ...
NotInFilter
python
scipy__scipy
scipy/stats/_continuous_distns.py
{ "start": 51910, "end": 54155 }
class ____(rv_continuous): r"""A double gamma continuous random variable. The double gamma distribution is also known as the reflected gamma distribution [1]_. %(before_notes)s Notes ----- The probability density function for `dgamma` is: .. math:: f(x, a) = \frac{1}{2\Gamma...
dgamma_gen
python
encode__httpx
httpx/_models.py
{ "start": 17449, "end": 37994 }
class ____: def __init__( self, status_code: int, *, headers: HeaderTypes | None = None, content: ResponseContent | None = None, text: str | None = None, html: str | None = None, json: typing.Any = None, stream: SyncByteStream | AsyncByteStream...
Response
python
realpython__materials
python-del-statement/sample.py
{ "start": 0, "end": 173 }
class ____: class_attribute = 0 def __init__(self, arg): self.instance_attribute = arg def method(self): print(self.instance_attribute)
SampleClass
python
keras-team__keras
keras/src/layers/reshaping/up_sampling3d.py
{ "start": 286, "end": 4910 }
class ____(Layer): """Upsampling layer for 3D inputs. Repeats the 1st, 2nd and 3rd dimensions of the data by `size[0]`, `size[1]` and `size[2]` respectively. Example: >>> input_shape = (2, 1, 2, 1, 3) >>> x = np.ones(input_shape) >>> y = keras.layers.UpSampling3D(size=(2, 2, 2))(x) >>...
UpSampling3D
python
jackfrued__Python-100-Days
Day31-35/code/example12.py
{ "start": 690, "end": 901 }
class ____(Employee): """销售员""" def __init__(self, name, sales=0.0): self.sales = sales super().__init__(name) def get_salary(self): return 1800.0 + self.sales * 0.05
Salesman
python
mlflow__mlflow
dev/clint/tests/rules/test_os_chdir_in_test.py
{ "start": 2559, "end": 2895 }
class ____: @staticmethod def chdir(path): pass fake_os = FakeOs() def test_func(): fake_os.chdir("/tmp") # Should not trigger since it's not os.chdir """ config = Config(select={OsChdirInTest.name}) violations = lint_file(Path("test_file.py"), code, config, index_path) assert len(vio...
FakeOs
python
getsentry__sentry
src/sentry/web/frontend/debug/debug_generic_issue.py
{ "start": 557, "end": 2230 }
class ____(View): def get(self, request): org = Organization(id=1, slug="example", name="Example") project = Project(id=1, slug="example", name="Example", organization=org) event = make_generic_event(project) group = event.group rule = Rule(id=1, label="An example rule") ...
DebugGenericIssueEmailView
python
walkccc__LeetCode
solutions/1653. Minimum Deletions to Make String Balanced/1653.py
{ "start": 0, "end": 401 }
class ____: # Same as 926. Flip String to Monotone Increasing def minimumDeletions(self, s: str) -> int: dp = 0 # the number of characters to be deleted to make subso far balanced countB = 0 for c in s: if c == 'a': # 1. Delete 'a'. # 2. Keep 'a' and delete the previous 'b's. ...
Solution
python
huggingface__transformers
tests/models/unispeech/test_modeling_unispeech.py
{ "start": 1431, "end": 11513 }
class ____: def __init__( self, parent, batch_size=13, seq_length=1024, # speech is longer is_training=False, hidden_size=16, feat_extract_norm="group", feat_extract_dropout=0.0, feat_extract_activation="gelu", conv_dim=(32, 32, 32), ...
UniSpeechModelTester
python
pypa__warehouse
warehouse/oidc/forms/_core.py
{ "start": 4402, "end": 4725 }
class ____(wtforms.Form): __params__ = ["publisher_id"] publisher_id = wtforms.StringField( validators=[ wtforms.validators.InputRequired(message=_("Specify a publisher ID")), wtforms.validators.UUID(message=_("Publisher must be specified by ID")), ] )
DeletePublisherForm
python
huggingface__transformers
tests/models/kosmos2_5/test_modeling_kosmos2_5.py
{ "start": 19637, "end": 29293 }
class ____(unittest.TestCase): # This variable is used to determine which CUDA device are we using for our runners (A10 or T4) # Depending on the hardware we get different logits / generations cuda_compute_capability_major_version = None @classmethod def setUpClass(cls): if is_torch_availab...
Kosmos2_5ModelIntegrationTest
python
huggingface__transformers
src/transformers/models/squeezebert/configuration_squeezebert.py
{ "start": 795, "end": 6561 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`SqueezeBertModel`]. It is used to instantiate a SqueezeBERT model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a simil...
SqueezeBertConfig
python
pypa__warehouse
tests/unit/packaging/test_models.py
{ "start": 20469, "end": 43064 }
class ____: def test_getattr(self, db_session): project = DBProjectFactory.create() release = DBReleaseFactory.create(project=project) file = DBFileFactory.create( release=release, filename=f"{release.project.name}-{release.version}.tar.gz", python_version...
TestRelease
python
has2k1__plotnine
plotnine/scales/limits.py
{ "start": 316, "end": 2908 }
class ____: aesthetic = None def __init__(self, *limits): if not limits: msg = "{}lim(), is missing limits" raise PlotnineError(msg.format(self.aesthetic)) elif len(limits) == 1: limits = limits[0] series = pd.Series(limits) # Type of transf...
_lim
python
ipython__ipython
tests/test_formatters.py
{ "start": 620, "end": 672 }
class ____(object): _repr_pretty_ = None
BadPretty
python
doocs__leetcode
solution/1600-1699/1600.Throne Inheritance/Solution.py
{ "start": 0, "end": 771 }
class ____: def __init__(self, kingName: str): self.king = kingName self.dead = set() self.g = defaultdict(list) def birth(self, parentName: str, childName: str) -> None: self.g[parentName].append(childName) def death(self, name: str) -> None: self.dead.add(name) ...
ThroneInheritance
python
google__pytype
pytype/tools/xref/indexer_test.py
{ "start": 9370, "end": 9772 }
class ____(test_base.BaseTest, IndexerTestMixin): def test_type_annotations(self): ix = self.index_code(""" def f(x: int) -> int: return x """.lstrip("\n")) self.assertDef(ix, "module.f", "f", "FunctionDef") self.assertDef(ix, "module.f.x", "x", "Param") self.assertDefLocs(ix, "mo...
IndexerTestPy3
python
pydantic__pydantic
pydantic/_internal/_repr.py
{ "start": 1075, "end": 5172 }
class ____: # Mixin to provide `__str__`, `__repr__`, and `__pretty__` and `__rich_repr__` methods. # `__pretty__` is used by [devtools](https://python-devtools.helpmanual.io/). # `__rich_repr__` is used by [rich](https://rich.readthedocs.io/en/stable/pretty.html). # (this is not a docstring to avoid ad...
Representation
python
wandb__wandb
wandb/vendor/pygments/lexers/markup.py
{ "start": 1750, "end": 3381 }
class ____(RegexLexer): """ For MoinMoin (and Trac) Wiki markup. .. versionadded:: 0.7 """ name = 'MoinMoin/Trac Wiki markup' aliases = ['trac-wiki', 'moin'] filenames = [] mimetypes = ['text/x-trac-wiki'] flags = re.MULTILINE | re.IGNORECASE tokens = { 'root': [ ...
MoinWikiLexer
python
pytorch__pytorch
torch/export/dynamic_shapes.py
{ "start": 16462, "end": 17143 }
class ____(_ConstraintTarget): """ This represents a dim marked with Dim.AUTO/DYNAMIC (i.e. mark_dynamic() or maybe_mark_dynamic()), which leaves relations & min/max ranges for inference, instead of requiring explicit specification. The intention is for constraint violations to not be raised if produce_...
_RelaxedConstraint
python
google__pytype
pytype/errors/error_types.py
{ "start": 4087, "end": 4438 }
class ____(InvalidParameters): """E.g. a function requires parameter 'x' but 'x' isn't passed.""" def __init__(self, sig, passed_args, ctx, missing_parameter): super().__init__(sig, passed_args, ctx) self.missing_parameter = missing_parameter # -------------------------------------------------------- # T...
MissingParameter
python
dagster-io__dagster
python_modules/dagster/dagster/_core/instance/methods/asset_methods.py
{ "start": 2133, "end": 30227 }
class ____: """Mixin class containing asset-related functionality for DagsterInstance. This class consolidates asset operations from both AssetDomain and AssetMixin, providing methods for asset management, materialization tracking, and health monitoring. All methods are implemented as instance methods ...
AssetMethods
python
walkccc__LeetCode
solutions/73. Set Matrix Zeroes/73.py
{ "start": 0, "end": 833 }
class ____: def setZeroes(self, matrix: list[list[int]]) -> None: m = len(matrix) n = len(matrix[0]) shouldFillFirstRow = 0 in matrix[0] shouldFillFirstCol = 0 in list(zip(*matrix))[0] # Store the information in the first row and the first column. for i in range(1, m): for j in range(1,...
Solution
python
python__mypy
mypy/stubtest.py
{ "start": 1186, "end": 1445 }
class ____: """Marker object for things that are missing (from a stub or the runtime).""" def __repr__(self) -> str: return "MISSING" MISSING: Final = Missing() T = TypeVar("T") MaybeMissing: typing_extensions.TypeAlias = T | Missing
Missing
python
automl__auto-sklearn
autosklearn/metalearning/metafeatures/metafeatures.py
{ "start": 10617, "end": 10930 }
class ____(MetaFeature): def _calculate(self, X, y, logger, feat_type): return float(metafeatures["NumberOfFeatures"](X, y, logger).value) / float( metafeatures["NumberOfInstances"](X, y, logger).value ) @metafeatures.define("LogDatasetRatio", dependency="DatasetRatio")
DatasetRatio
python
great-expectations__great_expectations
great_expectations/expectations/expectation_configuration.py
{ "start": 3593, "end": 21536 }
class ____(SerializableDictDot): """Defines the parameters and name of a specific Expectation. Args: type: The name of the expectation class to use in snake case, e.g. `expect_column_values_to_not_be_null`. kwargs: The keyword arguments to pass to the expectation class. meta: A dictiona...
ExpectationConfiguration
python
aio-libs__aiohttp
aiohttp/worker.py
{ "start": 7472, "end": 7813 }
class ____(GunicornWebWorker): def init_process(self) -> None: import uvloop # Setup uvloop policy, so that every # asyncio.get_event_loop() will create an instance # of uvloop event loop. asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) super().init_process(...
GunicornUVLoopWebWorker
python
facebookresearch__faiss
tests/test_index.py
{ "start": 535, "end": 734 }
class ____(unittest.TestCase): def test_version_attribute(self): assert hasattr(faiss, '__version__') assert re.match('^\\d+\\.\\d+\\.\\d+$', faiss.__version__)
TestModuleInterface
python
ray-project__ray
python/ray/train/lightgbm/_lightgbm_utils.py
{ "start": 381, "end": 4744 }
class ____: CHECKPOINT_NAME = "model.txt" def __init__( self, metrics: Optional[Union[str, List[str], Dict[str, str]]] = None, filename: str = CHECKPOINT_NAME, frequency: int = 0, checkpoint_at_end: bool = True, results_postprocessing_fn: Optional[ Ca...
RayReportCallback
python
pytransitions__transitions
transitions/extensions/diagrams_mermaid.py
{ "start": 9593, "end": 11085 }
class ____: def __init__(self, source): self.source = source # pylint: disable=redefined-builtin,unused-argument def draw(self, filename, format=None, prog="dot", args=""): """ Generates and saves an image of the state machine using graphviz. Note that `prog` and `args` are only pa...
DigraphMock
python
google__pytype
pytype/tools/xref/testdata/nested_class.py
{ "start": 101, "end": 691 }
class ____: #- @B defines/binding ClassB #- ClassB.node/kind record #- ClassB.subkind class class B: #- @foo defines/binding FnFoo #- @self defines/binding ArgBSelf #- FnFoo.node/kind function #- FnFoo param.0 ArgBSelf def foo(self): pass #- @bar defines/binding FnBar #- @self def...
A
python
boto__boto3
tests/unit/dynamodb/test_transform.py
{ "start": 18618, "end": 21057 }
class ____(unittest.TestCase): def setUp(self): self.events = mock.Mock() self.client = mock.Mock() self.client.meta.events = self.events self.meta = ResourceMeta('dynamodb') def test_instantiation(self): # Instantiate the class. dynamodb_class = type( ...
TestDynamoDBHighLevelResource
python
apache__airflow
airflow-core/tests/unit/models/test_callback.py
{ "start": 2014, "end": 3771 }
class ____: @pytest.mark.parametrize( ("callback_def", "expected_cb_instance"), [ pytest.param( TEST_ASYNC_CALLBACK, TriggererCallback(callback_def=TEST_ASYNC_CALLBACK), id="triggerer" ), pytest.param( TEST_SYNC_CALLBACK, ...
TestCallback
python
simonw__datasette
datasette/views/database.py
{ "start": 34469, "end": 36010 }
class ____(dict): def __init__(self, sql, data, request, datasette): super().__init__(data) self._sql = sql self._request = request self._magics = dict( itertools.chain.from_iterable( pm.hook.register_magic_parameters(datasette=datasette) ) ...
MagicParameters
python
jupyterlab__jupyterlab
examples/cell/main.py
{ "start": 1667, "end": 2542 }
class ____(LabServerApp): extension_url = "/example" default_url = "/example" app_url = "/example" name = __name__ load_other_extensions = False app_name = "JupyterLab Example Cell" static_dir = os.path.join(HERE, "build") templates_dir = os.path.join(HERE, "templates") app_version =...
ExampleApp
python
has2k1__plotnine
plotnine/scales/scale_color.py
{ "start": 9202, "end": 11211 }
class ____(_scale_color_continuous): """ Sequential and diverging continuous color scales This is a convenience scale around [](`~plotnine.scales.scale_color_gradientn`) with colors from [colorbrewer.org](http://colorbrewer2.org). It smoothly interpolates 7 colors from a brewer palette to creat...
scale_color_distiller
python
getsentry__sentry-python
tests/integrations/grpc/test_grpc.py
{ "start": 6857, "end": 10919 }
class ____(grpc.UnaryUnaryClientInterceptor): call_counter = 0 def intercept_unary_unary(self, continuation, client_call_details, request): self.__class__.call_counter += 1 return continuation(client_call_details, request) @pytest.mark.forked def test_grpc_client_other_interceptor(sentry_init...
MockClientInterceptor
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1478503, "end": 1484857 }
class ____(sgqlc.types.Type, Node): """A GitHub Security Advisory""" __schema__ = github_schema __field_names__ = ( "classification", "cvss", "cwes", "database_id", "description", "ghsa_id", "identifiers", "notifications_permalink", "o...
SecurityAdvisory
python
pytorch__pytorch
test/functorch/dim/test_split.py
{ "start": 219, "end": 16820 }
class ____(TestCase): """Comprehensive tests for first-class dimension split operations.""" def setUp(self): """Set up common test fixtures.""" self.batch, self.height, self.width = dims(3) def test_dim_object_split_all_bound(self): """Test split with all Dim objects bound to speci...
TestSplit
python
apache__airflow
airflow-core/src/airflow/api_fastapi/auth/tokens.py
{ "start": 13234, "end": 20068 }
class ____: """Generate JWT tokens.""" _private_key: AllowedPrivateKeys | None = attrs.field( repr=False, alias="private_key", converter=_pem_to_key, factory=_load_key_from_configured_file ) """ Private key to sign generated tokens. Should be either a private key object from the crypto...
JWTGenerator
python
pytorch__pytorch
torch/ao/quantization/observer.py
{ "start": 63906, "end": 64180 }
class ____: """ Base class for representing the granularity of quantization. This class serves as a parent for specific granularity types used in quantization operations, such as per-tensor or per-axis quantization. """ @dataclass(frozen=True)
Granularity
python
pytorch__pytorch
torch/_inductor/memory.py
{ "start": 10796, "end": 15458 }
class ____: buffer: Union[SchedulerBuffer, FreeableInputBuffer] size_alloc: int size_free: int start_step: int end_step: int def compute_memory_timeline( nodes: list[BaseSchedulerNode], name_to_freeable_input_buf: dict[str, FreeableInputBuffer], graph_outputs: OrderedSet[str], ) -> tup...
BufferInfo
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/dataplex.py
{ "start": 122473, "end": 125335 }
class ____(DataplexCatalogBaseOperator): """ Delete an EntryType resource. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:DataplexCatalogDeleteEntryTypeOperator` :param entry_type_id: Required. EntryType identifier. :pa...
DataplexCatalogDeleteEntryTypeOperator
python
optuna__optuna
optuna/visualization/_hypervolume_history.py
{ "start": 619, "end": 4938 }
class ____(NamedTuple): trial_numbers: list[int] values: list[float] @experimental_func("3.3.0") def plot_hypervolume_history( study: Study, reference_point: Sequence[float], ) -> "go.Figure": """Plot hypervolume history of all trials in a study. Args: study: A :class:`~op...
_HypervolumeHistoryInfo
python
tensorflow__tensorflow
tensorflow/python/autograph/pyct/transformer.py
{ "start": 1140, "end": 1879 }
class ____(object): """Contains information about a source code transformation. This object is mutable, and is updated during conversion. Not thread safe. Attributes: info: EntityInfo, immutable. namer: naming.Namer. current_origin: origin_info.OriginInfo, holds the OriginInfo of the last AST ...
Context
python
sanic-org__sanic
sanic/exceptions.py
{ "start": 26273, "end": 26373 }
class ____(SanicException): """Exception raised when a file cannot be loaded."""
LoadFileException
python
pypa__pipenv
pipenv/vendor/packaging/metadata.py
{ "start": 24340, "end": 32349 }
class ____: """Representation of distribution metadata. Compared to :class:`RawMetadata`, this class provides objects representing metadata fields instead of only using built-in types. Any invalid metadata will cause :exc:`InvalidMetadata` to be raised (with a :py:attr:`~BaseException.__cause__` at...
Metadata
python
scipy__scipy
benchmarks/benchmarks/go_benchmark_functions/go_funcs_M.py
{ "start": 4707, "end": 5810 }
class ____(Benchmark): r""" Miele-Cantrell [1]_ objective function. This class defines the Miele-Cantrell global optimization problem. This is a multimodal minimization problem defined as follows: .. math:: f_{\text{MieleCantrell}}({x}) = (e^{-x_1} - x_2)^4 + 100(x_2 - x_3)^6 + \ta...
MieleCantrell
python
wandb__wandb
wandb/sdk/artifacts/_generated/fetch_linked_artifacts.py
{ "start": 840, "end": 1417 }
class ____(GQLResult): version_index: Optional[int] = Field(alias="versionIndex") aliases: List[ArtifactAliasFragment] artifact_collection: Optional[CollectionInfoFragment] = Field( alias="artifactCollection" ) FetchLinkedArtifacts.model_rebuild() FetchLinkedArtifactsArtifact.model_rebuild() F...
FetchLinkedArtifactsArtifactArtifactMembershipsEdgesNode
python
docker__docker-py
docker/types/containers.py
{ "start": 2925, "end": 4815 }
class ____(DictType): """ Create a ulimit declaration to be used with :py:meth:`~docker.api.container.ContainerApiMixin.create_host_config`. Args: name (str): Which ulimit will this apply to. The valid names can be found in '/etc/security/limits.conf' on a gnu/linux system. ...
Ulimit
python
fastapi__sqlmodel
docs_src/tutorial/insert/tutorial003_py310.py
{ "start": 63, "end": 983 }
class ____(SQLModel, table=True): id: int | None = Field(default=None, primary_key=True) name: str secret_name: str age: int | None = None sqlite_file_name = "database.db" sqlite_url = f"sqlite:///{sqlite_file_name}" engine = create_engine(sqlite_url, echo=True) def create_db_and_tables(): SQLM...
Hero
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/cloud_composer.py
{ "start": 12261, "end": 15252 }
class ____(GoogleCloudBaseOperator): """ Get an existing environment. :param project_id: Required. The ID of the Google Cloud project that the service belongs to. :param region: Required. The ID of the Google Cloud region that the service belongs to. :param environment_id: Required. The ID of the G...
CloudComposerGetEnvironmentOperator
python
huggingface__transformers
src/transformers/models/dpr/modeling_dpr.py
{ "start": 8004, "end": 8267 }
class ____(DPRPreTrainedModel): """ An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models. """ config: DPRConfig base_model_prefix = "ctx_encoder"
DPRPretrainedContextEncoder
python
eventlet__eventlet
tests/__init__.py
{ "start": 3621, "end": 15084 }
class ____(unittest.TestCase): """ Unittest subclass that adds a timeout to all tests. Subclasses must be sure to call the LimitedTestCase setUp and tearDown methods. The default timeout is 1 second, change it by setting TEST_TIMEOUT to the desired quantity.""" TEST_TIMEOUT = 2 def setUp(sel...
LimitedTestCase
python
bokeh__bokeh
tests/unit/bokeh/util/test_hex.py
{ "start": 1277, "end": 2045 }
class ____: def test_default_aspect_pointytop(self) -> None: q = np.array([0, 0, 0, 1, -1, 1, -1]) r = np.array([0, 1, -1, 0, 1, -1, 0]) x, y = buh.axial_to_cartesian(q, r, 1, "pointytop") sq3 = np.sqrt(3) assert list(x) == [0, sq3/2, -sq3/2, sq3, -sq3/2, sq3/2, -sq3] ...
Test_axial_to_cartesian
python
simonw__datasette
datasette/views/row.py
{ "start": 6487, "end": 7392 }
class ____(BaseView): name = "row-delete" def __init__(self, datasette): self.ds = datasette async def post(self, request): ok, resolved = await _resolve_row_and_check_permission( self.ds, request, "delete-row" ) if not ok: return resolved #...
RowDeleteView
python
huggingface__transformers
src/transformers/models/patchtsmixer/modeling_patchtsmixer.py
{ "start": 4598, "end": 6126 }
class ____(nn.Module): """Normalization block Args: config (`PatchTSMixerConfig`): Configuration. """ def __init__(self, config: PatchTSMixerConfig): super().__init__() self.norm_mlp = config.norm_mlp if "batch" in config.norm_mlp.lower(): self...
PatchTSMixerNormLayer
python
pytorch__pytorch
torch/nn/attention/flex_attention.py
{ "start": 10098, "end": 17101 }
class ____(Enum): """Enum for the type of modification function. - SCORE_MOD: score_mod function which accepts a score as the first argument - mask_mod: mask function which does not accept a score and is only used for generating block mask """ SCORE_MOD = 1 MASK_MOD = 2 UNKNOWN = 3 de...
_ModificationType
python
allegroai__clearml
clearml/backend_api/services/v2_23/queues.py
{ "start": 79613, "end": 80916 }
class ____(Response): """ Response of queues.move_task_forward endpoint. :param position: The new position of the task entry in the queue (index, -1 represents bottom of queue) :type position: int """ _service = "queues" _action = "move_task_forward" _version = "2.23" _sche...
MoveTaskForwardResponse
python
numpy__numpy
numpy/_core/tests/test_umath.py
{ "start": 122446, "end": 125648 }
class ____: def test_abs_neg_blocked(self): # simd tests on abs, test all alignments for vz + 2 * (vs - 1) + 1 for dt, sz in [(np.float32, 11), (np.float64, 5)]: for out, inp, msg in _gen_alignment_data(dtype=dt, type='unary', max_size...
TestAbsoluteNegative
python
scrapy__scrapy
tests/spiders.py
{ "start": 14858, "end": 15309 }
class ____(CrawlSpiderWithParseMethod): name = "crawl_spider_with_process_request_cb_kwargs" rules = ( Rule( LinkExtractor(), callback="parse", follow=True, process_request="process_request", ), ) def process_request(self, request, respons...
CrawlSpiderWithProcessRequestCallbackKeywordArguments
python
scipy__scipy
scipy/optimize/tests/test_lsq_linear.py
{ "start": 9430, "end": 9507 }
class ____(BaseMixin): method = 'bvls' lsq_solvers = ['exact']
TestBVLS
python
kamyu104__LeetCode-Solutions
Python/minimum-absolute-difference-queries.py
{ "start": 65, "end": 926 }
class ____(object): def minDifference(self, nums, queries): """ :type nums: List[int] :type queries: List[List[int]] :rtype: List[int] """ INF = float("inf") prefix = [[0]*(max(nums)+1)] for num in nums: prefix.append(prefix[-1][:]) ...
Solution
python
kubernetes-client__python
kubernetes/client/models/v1beta1_ip_address_list.py
{ "start": 383, "end": 6993 }
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...
V1beta1IPAddressList
python
pytorch__pytorch
test/distributed/test_store.py
{ "start": 22103, "end": 23016 }
class ____(TestCase, StoreTestBase): def setUp(self): super().setUp() self.tcpstore = create_tcp_store() self.prefix = "test_prefix" self.tcpstore.set_timeout(timedelta(seconds=300)) def _create_store(self): return dist.PrefixStore(self.prefix, self.tcpstore) # The ...
PrefixTCPStoreTest
python
py-pdf__pypdf
pypdf/filters.py
{ "start": 13488, "end": 15974 }
class ____: """ The RunLengthDecode filter decodes data that has been encoded in a simple byte-oriented format based on run length. The encoded data is a sequence of runs, where each run consists of a length byte followed by 1 to 128 bytes of data. If the length byte is in the range 0 to 127, ...
RunLengthDecode
python
django__django
tests/backends/models.py
{ "start": 1274, "end": 1722 }
class ____(models.Model): primary_key_is_quite_long_zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz = models.AutoField( primary_key=True ) charfield_is_quite_long_zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz = models.CharField( max_length=100 ) m2m_also_quite_long_zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...
VeryLongModelNameZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
python
PrefectHQ__prefect
src/integrations/prefect-databricks/prefect_databricks/rest.py
{ "start": 422, "end": 4600 }
class ____(Enum): """ Available HTTP request methods. """ GET = "get" POST = "post" PUT = "put" DELETE = "delete" PATCH = "patch" def serialize_model(obj: Any) -> Any: """ Recursively serializes `pydantic.BaseModel` into JSON; returns original obj if not a `BaseModel`. ...
HTTPMethod
python
pypa__pip
src/pip/_internal/index/package_finder.py
{ "start": 3709, "end": 12717 }
class ____: """ Responsible for evaluating links for a particular project. """ _py_version_re = re.compile(r"-py([123]\.?[0-9]?)$") # Don't include an allow_yanked default value to make sure each call # site considers whether yanked releases are allowed. This also causes # that decision to...
LinkEvaluator
python
tensorflow__tensorflow
tensorflow/python/data/experimental/kernel_tests/rebatch_dataset_test.py
{ "start": 17926, "end": 18574 }
class ____( checkpoint_test_base.CheckpointTestBase, parameterized.TestCase): @combinations.generate( combinations.times(test_base.default_test_combinations(), checkpoint_test_base.default_test_combinations())) def test(self, verify_fn): def build_dataset(num_elements, batch...
LegacyRebatchDatasetCheckpointTest
python
django__django
tests/utils_tests/test_numberformat.py
{ "start": 153, "end": 7434 }
class ____(SimpleTestCase): def test_format_number(self): self.assertEqual(nformat(1234, "."), "1234") self.assertEqual(nformat(1234.2, "."), "1234.2") self.assertEqual(nformat(1234, ".", decimal_pos=2), "1234.00") self.assertEqual(nformat(1234, ".", grouping=2, thousand_sep=","), "1...
TestNumberFormat
python
pytorch__pytorch
test/torch_np/numpy_tests/lib/test_function_base.py
{ "start": 45467, "end": 57134 }
class ____(TestCase): def test_simple(self): def addsubtract(a, b): if a > b: return a - b else: return a + b f = vectorize(addsubtract) r = f([0, 3, 6, 9], [1, 3, 5, 7]) assert_array_equal(r, [1, 6, 1, 2]) def test_scalar...
TestVectorize
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/sqlite/json.py
{ "start": 303, "end": 1491 }
class ____(sqltypes.JSON): """SQLite JSON type. SQLite supports JSON as of version 3.9 through its JSON1_ extension. Note that JSON1_ is a `loadable extension <https://www.sqlite.org/loadext.html>`_ and as such may not be available, or may require run-time loading. :class:`_sqlite.JSON` is use...
JSON
python
pytorch__pytorch
test/inductor/test_ck_backend.py
{ "start": 895, "end": 14994 }
class ____(TestCase): def setUp(self): # The new inductor cache refresh mechanism # introduced with https://github.com/pytorch/pytorch/pull/122661 # interacts badly with persistent subprocesses during # autotuning. So we need to disable automatic cache refresh # before callin...
TestCKBackend
python
bottlepy__bottle
test/test_formsdict.py
{ "start": 104, "end": 513 }
class ____(unittest.TestCase): def test_attr_access(self): """ FomsDict.attribute returs string values as unicode. """ d = FormsDict(py3='瓶') self.assertEqual('瓶', d.py3) self.assertEqual('瓶', d["py3"]) def test_attr_missing(self): """ FomsDict.attribute returs u'' on mi...
TestFormsDict
python
google__jax
jax/_src/ad_checkpoint.py
{ "start": 17177, "end": 41374 }
class ____: val: Any hash: int hashable: bool def __init__(self, val): self.val = val try: self.hash = hash(val) self.hashable = True except: self.hash = id(val) self.hashable = False def __hash__(self): return self.hash def __eq__(self, other): if isinstance(oth...
WrapHashably
python
sqlalchemy__sqlalchemy
test/ext/test_associationproxy.py
{ "start": 110606, "end": 112175 }
class ____(fixtures.DeclarativeMappedTest): run_create_tables = None @classmethod def setup_classes(cls): Base = cls.DeclarativeBasic class A(Base): __tablename__ = "a" id = Column(Integer, primary_key=True) bs = relationship("B") b_data = ...
ProxyPlainPropertyTest
python
TheAlgorithms__Python
data_structures/linked_list/reverse_k_group.py
{ "start": 192, "end": 3076 }
class ____: def __init__(self, ints: Iterable[int]) -> None: self.head: Node | None = None for i in ints: self.append(i) def __iter__(self) -> Iterator[int]: """ >>> ints = [] >>> list(LinkedList(ints)) == ints True >>> ints = tuple(range(5)) ...
LinkedList