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
walkccc__LeetCode
solutions/2563. Count the Number of Fair Pairs/2563.py
{ "start": 0, "end": 513 }
class ____: def countFairPairs(self, nums: list[int], lower: int, upper: int) -> int: # nums[i] + nums[j] == nums[j] + nums[i], so the condition that i < j # degrades to i != j and we can sort the array. nums.sort() def countLess(summ: int) -> int: res = 0 i = 0 j = len(nums) - 1 ...
Solution
python
pytorch__pytorch
tools/experimental/torchfuzz/operators/tensor_pointwise.py
{ "start": 3227, "end": 3456 }
class ____(PointwiseOperator): """Operator for element-wise subtraction.""" def __init__(self): super().__init__("sub", "-") @property def torch_op_name(self) -> str: return "torch.sub"
SubOperator
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_button08.py
{ "start": 315, "end": 948 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("button08.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(self.got_file...
TestCompareXLSXFiles
python
django__django
django/contrib/postgres/search.py
{ "start": 12541, "end": 12622 }
class ____(TrigramBase): function = "" arg_joiner = " <-> "
TrigramDistance
python
dask__distributed
distributed/deploy/local.py
{ "start": 529, "end": 10735 }
class ____(SpecCluster): """Create local Scheduler and Workers This creates a "cluster" of a scheduler and workers running on the local machine. Parameters ---------- n_workers: int Number of workers to start memory_limit: str, float, int, or None, default "auto" Sets the m...
LocalCluster
python
eventlet__eventlet
tests/mock.py
{ "start": 62225, "end": 62816 }
class ____: def __init__(self, name, parent): self.name = name self.parent = parent def __call__(self, *args, **kwargs): m = self.create_mock() return m(*args, **kwargs) def create_mock(self): entry = self.name parent = self.parent m = parent._get_ch...
MagicProxy
python
matplotlib__matplotlib
lib/matplotlib/widgets.py
{ "start": 134668, "end": 137288 }
class ____(_SelectorWidget): """ Selection curve of an arbitrary shape. For the selector to remain responsive you must keep a reference to it. The selected path can be used in conjunction with `~.Path.contains_point` to select data points from an image. In contrast to `Lasso`, `LassoSelector`...
LassoSelector
python
celery__celery
celery/worker/autoscale.py
{ "start": 744, "end": 1670 }
class ____(bootsteps.StartStopStep): """Bootstep that starts the autoscaler thread/timer in the worker.""" label = 'Autoscaler' conditional = True requires = (Pool,) def __init__(self, w, **kwargs): self.enabled = w.autoscale w.autoscaler = None def create(self, w): sc...
WorkerComponent
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/triggers/test_emr.py
{ "start": 6992, "end": 7817 }
class ____: def test_serialization(self): application_id = "test_application_id" waiter_delay = 30 waiter_max_attempts = 60 aws_conn_id = "aws_default" trigger = EmrServerlessStartApplicationTrigger( application_id=application_id, waiter_delay=waiter_...
TestEmrServerlessStartApplicationTrigger
python
tiangolo__fastapi
tests/test_openapi_separate_input_output_schemas.py
{ "start": 434, "end": 21216 }
class ____(BaseModel): name: str description: Optional[str] = None sub: Optional[SubItem] = None if PYDANTIC_V2: model_config = {"json_schema_serialization_defaults_required": True} def get_app_client(separate_input_output_schemas: bool = True) -> TestClient: app = FastAPI(separate_input_o...
Item
python
huggingface__transformers
src/transformers/models/lfm2/modular_lfm2.py
{ "start": 8467, "end": 11096 }
class ____(LlamaAttention): def __init__(self, config: Lfm2Config, layer_idx: int): super().__init__(config, layer_idx) self.q_proj = nn.Linear(config.hidden_size, config.num_attention_heads * self.head_dim, bias=False) self.k_proj = nn.Linear(config.hidden_size, config.num_key_value_heads *...
Lfm2Attention
python
xlwings__xlwings
xlwings/main.py
{ "start": 125466, "end": 132022 }
class ____(Collection): """ A collection of all :meth:`picture <Picture>` objects on the specified sheet: >>> import xlwings as xw >>> xw.books['Book1'].sheets[0].pictures Pictures([<Picture 'Picture 1' in <Sheet [Book1]Sheet1>>, <Picture 'Picture 2' in <Sheet [Book1]Sheet1>>]) ....
Pictures
python
PrefectHQ__prefect
tests/server/models/test_work_queues.py
{ "start": 2208, "end": 2705 }
class ____: async def test_read_work_queue_by_id(self, session, work_queue): read_work_queue = await models.work_queues.read_work_queue( session=session, work_queue_id=work_queue.id ) assert read_work_queue.name == work_queue.name async def test_read_work_queue_by_id_returns...
TestReadWorkQueue
python
huggingface__transformers
src/transformers/models/altclip/modeling_altclip.py
{ "start": 4100, "end": 8945 }
class ____(nn.Module): """Construct the embeddings from word, position and token_type embeddings.""" def __init__(self, config): super().__init__() self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, padding_idx=config.pad_token_id) self.token_type_embeddings = nn...
AltRobertaEmbeddings
python
walkccc__LeetCode
solutions/1960. Maximum Product of the Length of Two Palindromic Substrings/1960.py
{ "start": 0, "end": 1009 }
class ____: def maxProduct(self, s: str) -> int: n = len(s) def manacher(s: str) -> list[int]: maxExtends = [0] * n leftToRight = [1] * n center = 0 for i in range(n): r = center + maxExtends[center] - 1 mirrorIndex = center - (i - center) extend = 1 if i > r ...
Solution
python
Lightning-AI__lightning
src/lightning/pytorch/utilities/migration/utils.py
{ "start": 3018, "end": 7951 }
class ____: """Registers legacy artifacts (classes, methods, etc.) that were removed but still need to be included for unpickling old checkpoints. The following patches apply. 1. ``lightning.pytorch.utilities.argparse._gpus_arg_default``: Applies to all checkpoints saved prior to version 1.2...
pl_legacy_patch
python
pennersr__django-allauth
allauth/socialaccount/providers/github/provider.py
{ "start": 528, "end": 1625 }
class ____(OAuth2Provider): id = "github" name = "GitHub" account_class = GitHubAccount oauth2_adapter_class = GitHubOAuth2Adapter def get_default_scope(self): scope = [] if app_settings.QUERY_EMAIL: scope.append("user:email") return scope def extract_uid(se...
GitHubProvider
python
django__django
tests/aggregation/models.py
{ "start": 509, "end": 1031 }
class ____(models.Model): isbn = models.CharField(max_length=9) name = models.CharField(max_length=255) pages = models.IntegerField() rating = models.FloatField() price = models.DecimalField(decimal_places=2, max_digits=6) authors = models.ManyToManyField(Author) contact = models.ForeignKey(...
Book
python
django__django
tests/admin_changelist/tests.py
{ "start": 81565, "end": 97807 }
class ____(AdminSeleniumTestCase): available_apps = ["admin_changelist"] + AdminSeleniumTestCase.available_apps def setUp(self): User.objects.create_superuser(username="super", password="secret", email=None) def test_add_row_selection(self): """ The status line for selected rows ge...
SeleniumTests
python
run-llama__llama_index
llama-index-integrations/llms/llama-index-llms-cloudflare-ai-gateway/llama_index/llms/cloudflare_ai_gateway/base.py
{ "start": 925, "end": 1039 }
class ____(Exception): """Base exception for Cloudflare AI Gateway errors.""" pass
CloudflareAIGatewayError
python
boto__boto3
boto3/dynamodb/conditions.py
{ "start": 6497, "end": 6602 }
class ____(ConditionBase): expression_operator = 'OR' expression_format = '({0} {operator} {1})'
Or
python
astropy__astropy
astropy/modeling/spline.py
{ "start": 587, "end": 6960 }
class ____(FittableModel): """Base class for spline models.""" _knot_names = () _coeff_names = () optional_inputs = {} def __init__( self, knots=None, coeffs=None, degree=None, bounds=None, n_models=None, model_set_axis=None, name=No...
_Spline
python
python-poetry__poetry
src/poetry/utils/password_manager.py
{ "start": 442, "end": 588 }
class ____: username: str | None = dataclasses.field(default=None) password: str | None = dataclasses.field(default=None)
HTTPAuthCredential
python
fastai__fastai
fastai/metrics.py
{ "start": 17345, "end": 17880 }
class ____(Metric): "Dice coefficient metric for binary target in segmentation" def __init__(self, axis=1): self.axis = axis def reset(self): self.inter,self.union = 0,0 def accumulate(self, learn): pred,targ = flatten_check(learn.pred.argmax(dim=self.axis), learn.y) self.inter += (pred*...
Dice
python
FactoryBoy__factory_boy
tests/utils.py
{ "start": 996, "end": 1449 }
class ____(MultiModulePatcher): """A context processor changing the value of date.today().""" def __init__(self, target_date, *target_modules, **kwargs): self.target_date = target_date super().__init__(*target_modules, **kwargs) def _build_patcher(self, target_module): module_datet...
mocked_date_today
python
doocs__leetcode
solution/2800-2899/2831.Find the Longest Equal Subarray/Solution.py
{ "start": 0, "end": 341 }
class ____: def longestEqualSubarray(self, nums: List[int], k: int) -> int: cnt = Counter() l = 0 mx = 0 for r, x in enumerate(nums): cnt[x] += 1 mx = max(mx, cnt[x]) if r - l + 1 - mx > k: cnt[nums[l]] -= 1 l += 1 ...
Solution
python
ansible__ansible
test/lib/ansible_test/_internal/util.py
{ "start": 26359, "end": 29873 }
class ____: """Manages color console output.""" clear = '\033[0m' red = '\033[31m' green = '\033[32m' yellow = '\033[33m' blue = '\033[34m' purple = '\033[35m' cyan = '\033[36m' verbosity_colors = { 0: None, 1: green, 2: blue, 3: cyan, } def...
Display
python
python-attrs__attrs
typing-examples/mypy.py
{ "start": 6909, "end": 7017 }
class ____: x: int def __init__(self, x: int): self.x = x @attr.define(order=True)
AutoDetect
python
plotly__plotly.py
plotly/graph_objs/surface/_colorbar.py
{ "start": 233, "end": 61470 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "surface" _path_str = "surface.colorbar" _valid_props = { "bgcolor", "bordercolor", "borderwidth", "dtick", "exponentformat", "labelalias", "len", "lenmode", "minexponent", ...
ColorBar
python
catalyst-team__catalyst
examples/detection/criterion.py
{ "start": 85, "end": 4703 }
class ____(nn.Module): def __init__(self, num_classes, ignore_class=0): super().__init__() self.num_classes = num_classes self.ignore_class = ignore_class def _hard_negative_mining(self, cls_loss, pos): """Return negative indices that is 3x the number as positive indices. ...
SSDCriterion
python
airbytehq__airbyte
airbyte-integrations/connectors/destination-vectara/destination_vectara/config.py
{ "start": 209, "end": 705 }
class ____(BaseModel): client_id: str = Field(..., title="OAuth Client ID", description="OAuth2.0 client id", order=0) client_secret: str = Field(..., title="OAuth Client Secret", description="OAuth2.0 client secret", airbyte_secret=True, order=1) class Config: title = "OAuth2.0 Credentials" ...
OAuth2
python
airbytehq__airbyte
airbyte-integrations/connectors/source-iterable/source_iterable/streams.py
{ "start": 18102, "end": 18189 }
class ____(IterableExportEventsStreamAdjustableRange): data_field = "smsSend"
SmsSend
python
run-llama__llama_index
llama-index-core/llama_index/core/node_parser/file/html.py
{ "start": 633, "end": 4691 }
class ____(NodeParser): """ HTML node parser. Splits a document into Nodes using custom HTML splitting logic. Args: include_metadata (bool): whether to include metadata in nodes include_prev_next_rel (bool): whether to include prev/next relationships """ tags: List[str] = Fie...
HTMLNodeParser
python
getsentry__sentry
src/sentry/search/events/builder/discover.py
{ "start": 919, "end": 6256 }
class ____(BaseQueryBuilder): """Builds a discover query""" uuid_fields = { "id", "trace", "profile.id", "replay.id", } span_id_fields = { "trace.span", "trace.parent_span", } duration_fields = {"transaction.duration", "span.duration"} def lo...
DiscoverQueryBuilder
python
ipython__ipython
docs/autogen_shortcuts.py
{ "start": 779, "end": 840 }
class ____: handler: Handler shortcut: Shortcut
Binding
python
facebookresearch__faiss
tests/test_contrib.py
{ "start": 7264, "end": 9450 }
class ____(unittest.TestCase): def test_precision_recall(self): Iref = [ [1, 2, 3], [5, 6], [], [] ] Inew = [ [1, 2], [6, 7], [1], [] ] lims_ref = np.cumsum([0] + [len(x) for x i...
TestRangeEval
python
pallets__jinja
src/jinja2/sandbox.py
{ "start": 14258, "end": 14864 }
class ____(Formatter): def __init__(self, env: Environment, **kwargs: t.Any) -> None: self._env = env super().__init__(**kwargs) def get_field( self, field_name: str, args: t.Sequence[t.Any], kwargs: t.Mapping[str, t.Any] ) -> tuple[t.Any, str]: first, rest = formatter_field...
SandboxedFormatter
python
PrefectHQ__prefect
src/prefect/utilities/schema_tools/hydration.py
{ "start": 2833, "end": 2932 }
class ____(KeyNotFound): @property def key(self) -> str: return "value"
ValueNotFound
python
keras-team__keras
keras/src/saving/saving_lib_test.py
{ "start": 34777, "end": 35056 }
class ____: def __init__(self, factor): self.factor = factor def __call__(self, inputs): return inputs * self.factor def get_config(self): return {"factor": self.factor} @keras.saving.register_keras_serializable(package="Complex")
GrowthFactor
python
pytorch__pytorch
test/dynamo/test_repros.py
{ "start": 27793, "end": 29010 }
class ____(nn.Module): def __init__( self, d_model, nhead, dim_feedforward=2048, dropout=0.1, activation=nn.ReLU(), layer_norm_eps=1e-5, ): super().__init__() self.self_attn = nn.MultiheadAttention(d_model, nhead, dropout=dropout) s...
TransformerEncoderLayer
python
dagster-io__dagster
python_modules/libraries/dagster-fivetran/dagster_fivetran/translator.py
{ "start": 1383, "end": 1626 }
class ____(Enum): """Enum representing each setup state for a connector in Fivetran's ontology.""" INCOMPLETE = "incomplete" CONNECTED = "connected" BROKEN = "broken" @whitelist_for_serdes @record
FivetranConnectorSetupStateType
python
rushter__MLAlgorithms
mla/neuralnet/layers/recurrent/rnn.py
{ "start": 257, "end": 3540 }
class ____(Layer, ParamMixin): """Vanilla RNN.""" def __init__( self, hidden_dim, activation="tanh", inner_init="orthogonal", parameters=None, return_sequences=True, ): self.return_sequences = return_sequences self.hidden_dim = hidden_dim ...
RNN
python
ray-project__ray
python/ray/data/_internal/execution/bundle_queue/fifo_bundle_queue.py
{ "start": 377, "end": 4610 }
class ____(BundleQueue): """A bundle queue that follows a first-in-first-out policy.""" def __init__(self): # We manually implement a linked list because we need to remove elements # efficiently, and Python's built-in data structures have O(n) removal time. self._head: Optional[_Node] =...
FIFOBundleQueue
python
pytorch__pytorch
torch/utils/data/datapipes/dataframe/dataframes.py
{ "start": 10085, "end": 10395 }
class ____(Capture): def __init__(self, left, right, ctx) -> None: self.ctx = ctx self.left = left self.right = right def __str__(self) -> str: return f"{self.left} + {self.right}" def execute(self): return get_val(self.left) + get_val(self.right)
CaptureAdd
python
django__django
django/contrib/gis/gdal/raster/source.py
{ "start": 929, "end": 1740 }
class ____(list): indices = { "origin": (0, 3), "scale": (1, 5), "skew": (2, 4), } def __init__(self, raster, prop): x = raster.geotransform[self.indices[prop][0]] y = raster.geotransform[self.indices[prop][1]] super().__init__([x, y]) self._raster = ...
TransformPoint
python
dagster-io__dagster
python_modules/libraries/dagster-aws/dagster_aws/athena/resources.py
{ "start": 8093, "end": 9241 }
class ____(ConfigurableResource): workgroup: str = Field( default="primary", description=( "The Athena WorkGroup to use." " https://docs.aws.amazon.com/athena/latest/ug/manage-queries-control-costs-with-workgroups.html" ), ) polling_interval: int = Field( ...
ResourceWithAthenaConfig
python
scikit-learn__scikit-learn
sklearn/covariance/_shrunk_covariance.py
{ "start": 15767, "end": 23335 }
class ____(EmpiricalCovariance): """LedoitWolf Estimator. Ledoit-Wolf is a particular form of shrinkage, where the shrinkage coefficient is computed using O. Ledoit and M. Wolf's formula as described in "A Well-Conditioned Estimator for Large-Dimensional Covariance Matrices", Ledoit and Wolf, Journ...
LedoitWolf
python
great-expectations__great_expectations
great_expectations/metrics/column/mean.py
{ "start": 128, "end": 179 }
class ____(MetricResult[float]): ...
ColumnMeanResult
python
getsentry__sentry
src/sentry/api/serializers/models/project.py
{ "start": 23611, "end": 23682 }
class ____(TypedDict, total=False): team: TeamResponseDict
_MaybeTeam
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/hooks/dlp.py
{ "start": 2052, "end": 67346 }
class ____(GoogleBaseHook): """ Hook for Google Cloud Data Loss Prevention (DLP) APIs. Cloud DLP allows clients to detect the presence of Personally Identifiable Information (PII) and other privacy-sensitive data in user-supplied, unstructured data streams, like text blocks or images. The service a...
CloudDLPHook
python
pypa__pipenv
pipenv/patched/pip/_internal/exceptions.py
{ "start": 21256, "end": 24180 }
class ____(DiagnosticPipError): """The current environment is externally managed. This is raised when the current environment is externally managed, as defined by `PEP 668`_. The ``EXTERNALLY-MANAGED`` configuration is checked and displayed when the error is bubbled up to the user. :param error: T...
ExternallyManagedEnvironment
python
rq__rq
rq/worker.py
{ "start": 75895, "end": 76244 }
class ____(Worker): """ Modified version of Worker that dequeues jobs from the queues using a round-robin strategy. """ def reorder_queues(self, reference_queue): pos = self._ordered_queues.index(reference_queue) self._ordered_queues = self._ordered_queues[pos + 1 :] + self._ordered_que...
RoundRobinWorker
python
ray-project__ray
python/ray/serve/_private/test_utils.py
{ "start": 5774, "end": 6970 }
class ____: def __init__(self, deployment_name: str, app_name: str = SERVE_DEFAULT_APP_NAME): self._deployment_name = deployment_name self._app_name = app_name self._protocol = RequestProtocol.UNDEFINED self._running_replicas_populated = False self._initialized = False d...
MockDeploymentHandle
python
dagster-io__dagster
python_modules/dagster-pipes/dagster_pipes/__init__.py
{ "start": 1833, "end": 2051 }
class ____(TypedDict): """Payload generated on startup of the external-side `PipesMessageWriter` containing arbitrary information about the external process. """ extras: Mapping[str, Any]
PipesOpenedData
python
catalyst-team__catalyst
catalyst/metrics/_topk_metric.py
{ "start": 184, "end": 3480 }
class ____(ICallbackBatchMetric): """ Base class for `topk` metrics. Args: metric_name: name of the metric metric_function: metric calculation function topk: list of `topk` for metric@topk computing compute_on_call: if True, computes and returns metric value during metric ca...
TopKMetric
python
kamyu104__LeetCode-Solutions
Python/smallest-substring-with-identical-characters-i.py
{ "start": 57, "end": 1035 }
class ____(object): def minLength(self, s, numOps): """ :type s: str :type numOps: int :rtype: int """ def binary_search(left, right, check): while left <= right: mid = left + (right-left)//2 if check(mid): ...
Solution
python
pytorch__pytorch
torch/fx/passes/net_min_base.py
{ "start": 705, "end": 867 }
class ____(Exception): """ Raised if failed to split out a minimize module """ @compatibility(is_backward_compatible=False)
FxNetMinimizerBadModuleError
python
huggingface__transformers
examples/modular-transformers/modeling_dummy_bert.py
{ "start": 21811, "end": 22448 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.transform = DummyBertPredictionHeadTransform(config) # The output weights are the same as the input embeddings, but there is # an output-only bias for each token. self.decoder = nn.Linear(config.hidde...
DummyBertLMPredictionHead
python
weaviate__weaviate-python-client
weaviate/debug/executor.py
{ "start": 315, "end": 1908 }
class ____(Generic[ConnectionType]): def __init__(self, connection: ConnectionType): self._connection = connection def get_object_over_rest( self, collection: str, uuid: UUID, *, consistency_level: Optional[ConsistencyLevel] = None, node_name: Optional[st...
_DebugExecutor
python
walkccc__LeetCode
solutions/2899. Last Visited Integers/2899.py
{ "start": 0, "end": 308 }
class ____: def lastVisitedIntegers(self, words: list[str]) -> list[int]: ans = [] nums = [] k = 0 for word in words: if word == 'prev': k += 1 ans.append(-1 if k > len(nums) else nums[-k]) else: k = 0 nums.append(int(word)) return ans
Solution
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 147215, "end": 147598 }
class ____(sgqlc.types.Input): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("field", "direction") field = sgqlc.types.Field( sgqlc.types.non_null(TeamOrderField), graphql_name="field" ) direction = sgqlc.types.Field( sgqlc.types.n...
TeamOrder
python
faif__python-patterns
patterns/behavioral/observer.py
{ "start": 1609, "end": 1930 }
class ____(Subject): def __init__(self, name: str = "") -> None: super().__init__() self.name = name self._data = 0 @property def data(self) -> int: return self._data @data.setter def data(self, value: int) -> None: self._data = value self.notify() ...
Data
python
neetcode-gh__leetcode
python/0739-daily-temperatures.py
{ "start": 0, "end": 403 }
class ____: def dailyTemperatures(self, temperatures: List[int]) -> List[int]: res = [0] * len(temperatures) stack = [] # pair: [temp, index] for i, t in enumerate(temperatures): while stack and t > stack[-1][0]: stackT, stackInd = stack.pop() re...
Solution
python
pandas-dev__pandas
asv_bench/benchmarks/reshape.py
{ "start": 1514, "end": 2503 }
class ____: params = ["datetime64[ns, US/Pacific]", "Period[s]"] param_names = ["dtype"] def setup(self, dtype): lev = pd.Index(list("ABCDEFGHIJ")) ri = pd.Index(range(1000)) mi = MultiIndex.from_product([lev, ri], names=["foo", "bar"]) index = date_range("2016-01-01", peri...
ReshapeExtensionDtype
python
Pylons__pyramid
tests/test_url.py
{ "start": 53446, "end": 53657 }
class ____: pregenerator = None name = 'route' def __init__(self, result='/1/2/3'): self.result = result def generate(self, kw): self.kw = kw return self.result
DummyRoute
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/hooks/base_aws.py
{ "start": 19483, "end": 44687 }
class ____(BaseHook, Generic[BaseAwsConnection]): """ Generic class for interact with AWS. This class provide a thin wrapper around the boto3 Python library. :param aws_conn_id: The Airflow connection used for AWS credentials. If this is None or empty then the default boto3 behaviour is used. ...
AwsGenericHook
python
wandb__wandb
wandb/jupyter.py
{ "start": 9088, "end": 15829 }
class ____: def __init__(self, settings: wandb.Settings) -> None: self.outputs: dict[int, Any] = {} self.settings = settings self.shell = IPython.get_ipython() def save_display(self, exc_count, data_with_metadata): self.outputs[exc_count] = self.outputs.get(exc_count, []) ...
Notebook
python
automl__auto-sklearn
test/test_pipeline/components/regression/test_mlp.py
{ "start": 187, "end": 2944 }
class ____(BaseRegressionComponentTest): # NOTE: `default_boston` # # Github runners seem to indeterministicly fail `test_boston` # meaning 'default_irish_proba_places' needs to be set. # There are known differences to occur on different platforms. # https://github.com/scikit-learn/scikit-learn/...
MLPComponentTest
python
skorch-dev__skorch
skorch/tests/test_probabilistic.py
{ "start": 2177, "end": 3071 }
class ____(gpytorch.models.ApproximateGP): """GP regression for variational inference""" def __init__(self, inducing_points, eps=1e-6): variational_distribution = gpytorch.variational.CholeskyVariationalDistribution( inducing_points.size(0)) variational_strategy = gpytorch.variationa...
VariationalRegressionModule
python
getsentry__sentry
src/sentry/seer/breakpoints.py
{ "start": 402, "end": 810 }
class ____(TypedDict): project: str # For legacy reasons, the group name is always # transaction even when working with functions. transaction: str aggregate_range_1: float aggregate_range_2: float unweighted_t_value: float unweighted_p_value: float trend_percentage: float absolu...
BreakpointData
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 287486, "end": 288547 }
class ____(sgqlc.types.Input): """Choose which status checks must pass before branches can be merged into a branch that matches this rule. When enabled, commits must first be pushed to another branch, then merged or pushed directly to a branch that matches this rule after status checks have passed. ...
RequiredStatusChecksParametersInput
python
huggingface__transformers
tests/quantization/quark_integration/test_quark.py
{ "start": 1454, "end": 5915 }
class ____(unittest.TestCase): reference_model_name = "unsloth/Meta-Llama-3.1-8B-Instruct" quantized_model_name = "amd/Llama-3.1-8B-Instruct-w-int8-a-int8-sym-test" input_text = "Today I am in Paris and" EXPECTED_OUTPUTS = set() EXPECTED_OUTPUTS.add("Today I am in Paris and I am not in Paris, Fran...
QuarkTest
python
modin-project__modin
modin/core/execution/dispatching/factories/factories.py
{ "start": 23286, "end": 23617 }
class ____(BaseFactory): @classmethod @doc(_doc_factory_prepare_method, io_module_name="``PandasOnUnidistIO``") def prepare(cls): from modin.core.execution.unidist.implementations.pandas_on_unidist.io import ( PandasOnUnidistIO, ) cls.io_cls = PandasOnUnidistIO
PandasOnUnidistFactory
python
keras-team__keras
keras/src/quantizers/quantizers.py
{ "start": 3586, "end": 5728 }
class ____(Quantizer): def __init__( self, axis, value_range=(-127, 127), epsilon=backend.epsilon(), output_dtype="int8", ): Quantizer.__init__(self, output_dtype=output_dtype) if isinstance(axis, int): axis = (axis,) self.axis = tuple(...
AbsMaxQuantizer
python
google__pytype
pytype/pattern_matching.py
{ "start": 4767, "end": 7526 }
class ____: """Tracks a set of match options.""" def __init__(self, match_var, ctx): self.match_var: cfg.Variable = match_var self.ctx = ctx self.options: _OptionSet = _OptionSet() self.could_contain_anything: bool = False # The types of the match var within each case branch self.cases: dic...
_OptionTracker
python
apache__airflow
providers/apache/kafka/tests/unit/apache/kafka/sensors/test_kafka.py
{ "start": 1140, "end": 4883 }
class ____: """ Test Sensors """ @pytest.fixture(autouse=True) def setup_connections(self, create_connection_without_db): create_connection_without_db( Connection( conn_id="kafka_d", conn_type="kafka", extra=json.dumps( ...
TestSensors
python
altair-viz__altair
altair/vegalite/v6/schema/channels.py
{ "start": 316739, "end": 323310 }
class ____(DatumChannelMixin, core.DatumDef): """ LatitudeDatum schema wrapper. Parameters ---------- bandPosition : float Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to ``0...
LatitudeDatum
python
Farama-Foundation__Gymnasium
gymnasium/envs/toy_text/blackjack.py
{ "start": 1279, "end": 12532 }
class ____(gym.Env): """ Blackjack is a card game where the goal is to beat the dealer by obtaining cards that sum to closer to 21 (without going over 21) than the dealers cards. ## Description The game starts with the dealer having one face up and one face down card, while the player has two f...
BlackjackEnv
python
huggingface__transformers
src/transformers/models/esm/modeling_esm.py
{ "start": 2541, "end": 4414 }
class ____(torch.nn.Module): """ Rotary position embeddings based on those in [RoFormer](https://huggingface.co/docs/transformers/model_doc/roformer). Query and keys are transformed by rotation matrices which depend on their relative positions. """ inv_freq: torch.Tensor # fix linting for `reg...
RotaryEmbedding
python
python-markdown__markdown
markdown/blockprocessors.py
{ "start": 21971, "end": 23336 }
class ____(BlockProcessor): """ Process Horizontal Rules. """ # Python's `re` module doesn't officially support atomic grouping. However you can fake it. # See https://stackoverflow.com/a/13577411/866026 RE = r'^[ ]{0,3}(?=(?P<atomicgroup>(-+[ ]{0,2}){3,}|(_+[ ]{0,2}){3,}|(\*+[ ]{0,2}){3,}))(?P=atomicg...
HRProcessor
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/output/base.py
{ "start": 6087, "end": 8348 }
class ____(Output): """ For testing. An output class that doesn't render anything. """ def fileno(self) -> int: "There is no sensible default for fileno()." raise NotImplementedError def encoding(self) -> str: return "utf-8" def write(self, data: str) -> None: ...
DummyOutput
python
pypa__hatch
tests/env/plugin/test_interface.py
{ "start": 30079, "end": 32197 }
class ____: def test_default(self, isolation, isolated_data_dir, platform, global_application): config = {"project": {"name": "my_app", "version": "0.0.1"}} project = Project(isolation, config=config) environment = MockEnvironment( isolation, project.metadata, ...
TestDescription
python
walkccc__LeetCode
solutions/2011. Final Value of Variable After Performing Operations/2011.py
{ "start": 0, "end": 141 }
class ____: def finalValueAfterOperations(self, operations: list[str]) -> int: return sum(op[1] == '+' or -1 for op in operations)
Solution
python
pandas-dev__pandas
pandas/core/methods/selectn.py
{ "start": 978, "end": 1913 }
class ____(Generic[NDFrameT]): def __init__( self, obj: NDFrameT, n: int, keep: Literal["first", "last", "all"] ) -> None: self.obj = obj self.n = n self.keep = keep if self.keep not in ("first", "last", "all"): raise ValueError('keep must be either "first", ...
SelectN
python
python-pillow__Pillow
src/PIL/ImageFont.py
{ "start": 6088, "end": 26820 }
class ____: """FreeType font wrapper (requires _imagingft service)""" font: Font font_bytes: bytes def __init__( self, font: StrOrBytesPath | BinaryIO, size: float = 10, index: int = 0, encoding: str = "", layout_engine: Layout | None = None, ) -> No...
FreeTypeFont
python
run-llama__llama_index
llama-index-core/llama_index/core/readers/file/base.py
{ "start": 5011, "end": 5595 }
class ____: """ Default file metadata function wrapper which stores the fs. Allows for pickling of the function. """ def __init__(self, fs: fsspec.AbstractFileSystem | None = None): self.fs = fs or get_default_fs() def __call__(self, file_path: str) -> dict: return default_file...
_DefaultFileMetadataFunc
python
Pylons__pyramid
tests/test_traversal.py
{ "start": 35919, "end": 38339 }
class ____(unittest.TestCase): def setUp(self): cleanUp() def tearDown(self): cleanUp() def _callFUT(self, resource, request): from pyramid.traversal import virtual_root return virtual_root(resource, request) def _registerTraverser(self, traverser): from pyram...
TestVirtualRoot
python
spack__spack
lib/spack/spack/vendor/ruamel/yaml/tokens.py
{ "start": 9944, "end": 10185 }
class ____(Token): __slots__ = ('value',) id = '<tag>' def __init__(self, value, start_mark, end_mark): # type: (Any, Any, Any) -> None Token.__init__(self, start_mark, end_mark) self.value = value
TagToken
python
plotly__plotly.py
plotly/graph_objs/funnel/marker/colorbar/_tickformatstop.py
{ "start": 233, "end": 8544 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "funnel.marker.colorbar" _path_str = "funnel.marker.colorbar.tickformatstop" _valid_props = {"dtickrange", "enabled", "name", "templateitemname", "value"} @property def dtickrange(self): """ range [*min*, *max*], where "min...
Tickformatstop
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/matchClass1.py
{ "start": 7737, "end": 7834 }
class ____: val1: int val2: str = field(init=False) val3: complex @dataclass
Dataclass1
python
getsentry__sentry
src/sentry/auth/superuser.py
{ "start": 5831, "end": 6030 }
class ____(SentryAPIException): status_code = status.HTTP_400_BAD_REQUEST code = "invalid-superuser-access-json" message = "The request contains invalid json"
SuperuserAccessFormInvalidJson
python
scipy__scipy
scipy/stats/tests/test_generation/reference_distributions.py
{ "start": 57, "end": 10226 }
class ____: """Minimalist distribution infrastructure for generating reference data. The purpose is to generate reference values for unit tests of SciPy distribution accuracy and robustness. Handles array input with standard broadcasting rules, and method implementations are easily compared agains...
ReferenceDistribution
python
wandb__wandb
wandb/vendor/gql-0.2.0/wandb_gql/transport/http.py
{ "start": 0, "end": 172 }
class ____(object): def __init__(self, url, headers=None, cookies=None): self.url = url self.headers = headers self.cookies = cookies
HTTPTransport
python
spyder-ide__spyder
external-deps/qtconsole/qtconsole/kernel_mixins.py
{ "start": 430, "end": 628 }
class ____(MetaQObjectHasTraits('NewBase', (HasTraits, SuperQObject), {})): """ A KernelClient that provides signals and slots. """ kernel_restarted = QtCore.Signal()
QtKernelManagerMixin
python
sqlalchemy__sqlalchemy
test/orm/test_composites.py
{ "start": 24375, "end": 29549 }
class ____(fixtures.MappedTest): @testing.fixture def point_fixture(self, decl_base): def go(active_history): @dataclasses.dataclass class Point: x: int y: int class Edge(decl_base): __tablename__ = "edge" ...
EventsEtcTest
python
streamlit__streamlit
lib/streamlit/elements/widgets/time_widgets.py
{ "start": 11861, "end": 13558 }
class ____: value: Sequence[date] | None is_range: bool max: date min: date @classmethod def from_raw_values( cls, value: DateValue, min_value: NullableScalarDateValue, max_value: NullableScalarDateValue, ) -> _DateInputValues: parsed_value, is_range ...
_DateInputValues
python
bokeh__bokeh
src/bokeh/core/property/data_frame.py
{ "start": 1580, "end": 2223 }
class ____(Property["IntoDataFrame"]): """ Accept eager dataframe supported by Narwhals. This property only exists to support type validation, e.g. for "accepts" clauses. It is not serializable itself, and is not useful to add to Bokeh models directly. """ def validate(self, value: Any, detail...
EagerDataFrame
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_blank07.py
{ "start": 315, "end": 1383 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_blank07.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(self.got...
TestCompareXLSXFiles
python
django-haystack__django-haystack
test_haystack/elasticsearch7_tests/test_backend.py
{ "start": 27486, "end": 29716 }
class ____(TestCase): fixtures = ["base_data.json"] def setUp(self): super().setUp() # Wipe it clean. clear_elasticsearch_index() # Stow. self.old_ui = connections["elasticsearch"].get_unified_index() self.ui = UnifiedIndex() self.smmi = Elasticsearch7M...
LiveElasticsearch7SearchQueryTestCase
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 70181, "end": 70892 }
class ____(sgqlc.types.Input): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ( "project_card_id", "repository_id", "title", "body", "client_mutation_id", ) project_card_id = sgqlc.types.Field( sgqlc.types...
ConvertProjectCardNoteToIssueInput