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 | microsoft__pyright | packages/pyright-internal/src/tests/samples/typeNarrowingFalsy1.py | {
"start": 284,
"end": 341
} | class ____:
def __bool__(self) -> Literal[False]: ...
| C |
python | getsentry__sentry | src/sentry/workflow_engine/processors/workflow.py | {
"start": 1596,
"end": 21568
} | class ____(StrEnum):
ACTION_FILTER = "action_filter"
WORKFLOW_TRIGGER = "workflow_trigger"
def delete_workflow(workflow: Workflow) -> bool:
with transaction.atomic(router.db_for_write(Workflow)):
action_filters = DataConditionGroup.objects.filter(
workflowdataconditiongroup__workflow=w... | WorkflowDataConditionGroupType |
python | jmcnamara__XlsxWriter | xlsxwriter/test/comparison/test_default_format11.py | {
"start": 315,
"end": 2242
} | class ____(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.set_filename("default_format11.xlsx")
def test_create_file(self):
"""Test the creation of a file with user defined default format"""
workbook = ... | TestCompareXLSXFiles |
python | docker__docker-py | tests/unit/api_test.py | {
"start": 19391,
"end": 20390
} | class ____(unittest.TestCase):
def setUp(self):
self.patcher = mock.patch.object(
APIClient,
'send',
return_value=fake_resp("GET", f"{fake_api.prefix}/version")
)
self.mock_send = self.patcher.start()
def tearDown(self):
self.patcher.stop()
... | UserAgentTest |
python | getsentry__sentry | tests/sentry/api/test_utils.py | {
"start": 8765,
"end": 9946
} | class ____(unittest.TestCase):
def test_no_clamp_if_range_under_max(self) -> None:
start = datetime.datetime(2024, 1, 1)
end = datetime.datetime(2024, 1, 2)
max_timedelta = datetime.timedelta(days=7)
assert clamp_date_range((start, end), max_timedelta) == (start, end)
def test_... | ClampDateRangeTest |
python | apache__airflow | providers/amazon/tests/unit/amazon/aws/operators/test_glue.py | {
"start": 22453,
"end": 27521
} | class ____:
RUN_ID = "1234567890"
DATA_SOURCE = {"GlueTable": {"DatabaseName": "TestDB", "TableName": "TestTable"}}
ROLE = "role_arn"
RULE_SET_NAMES = ["TestRuleSet"]
@pytest.fixture
def mock_conn(self) -> Generator[BaseAwsConnection, None, None]:
with mock.patch.object(GlueDataQualityH... | TestGlueDataQualityRuleSetEvaluationRunOperator |
python | scipy__scipy | scipy/special/tests/test_orthogonal.py | {
"start": 7843,
"end": 8732
} | class ____:
def test_sh_chebyu(self):
# U*_n(x) = U_n(2x-1)
psub = np.poly1d([2,-1])
Us0 = orth.sh_chebyu(0)
Us1 = orth.sh_chebyu(1)
Us2 = orth.sh_chebyu(2)
Us3 = orth.sh_chebyu(3)
Us4 = orth.sh_chebyu(4)
Us5 = orth.sh_chebyu(5)
use0 = orth.che... | TestShChebyu |
python | getsentry__sentry | src/sentry/api/helpers/group_index/validators/in_commit.py | {
"start": 323,
"end": 1665
} | class ____(serializers.Serializer[InCommitResult]):
commit = serializers.CharField(required=True, help_text="The SHA of the resolving commit.")
repository = serializers.CharField(
required=True, help_text="The name of the repository (as it appears in Sentry)."
)
def validate_repository(self, va... | InCommitValidator |
python | joke2k__faker | tests/providers/test_automotive.py | {
"start": 7223,
"end": 7384
} | class ____(_SimpleAutomotiveTestMixin):
license_plate_pattern: Pattern = re.compile(
r"^\d{2,3}[가나다라마거너더러머버서어저고노도로모보소오조구누두루무부수우주]\d{4}$"
)
| TestKoKr |
python | jupyterlab__jupyterlab | jupyterlab/labextensions.py | {
"start": 18331,
"end": 20039
} | class ____(JupyterApp):
"""Base jupyter labextension command entry point"""
name = "jupyter labextension"
version = VERSION
description = "Work with JupyterLab extensions"
examples = _EXAMPLES
subcommands = {
"install": (InstallLabExtensionApp, "Install labextension(s)"),
"upda... | LabExtensionApp |
python | facebook__pyre-check | tools/generate_taint_models/tests/get_models_filtered_by_callable_test.py | {
"start": 409,
"end": 792
} | class ____(Model):
def __init__(self, index: int) -> None:
self.index = index
def __eq__(self, other: "TestModel") -> int:
return self.index == other.index
# pyre-fixme[7]: Expected `int` but got implicit return value of `None`.
def __hash__(self) -> int:
pass
def __str__(... | TestModel |
python | great-expectations__great_expectations | contrib/experimental/great_expectations_experimental/expectations/expect_column_skew_to_be_between.py | {
"start": 5372,
"end": 14107
} | class ____(ColumnAggregateExpectation):
"""Expect column skew to be between. Currently tests against Gamma and Beta distributions."""
# These examples will be shown in the public gallery, and also executed as unit tests for your Expectation
examples = [
{
"data": {
"a": ... | ExpectColumnSkewToBeBetween |
python | PrefectHQ__prefect | src/prefect/cli/transfer/_migratable_resources/variables.py | {
"start": 500,
"end": 2179
} | class ____(MigratableResource[Variable]):
_instances: dict[uuid.UUID, Self] = {}
def __init__(self, variable: Variable):
self.source_variable = variable
self.destination_variable: Variable | None = None
@property
def source_id(self) -> uuid.UUID:
return self.source_variable.id
... | MigratableVariable |
python | realpython__materials | python-textual/layouts.py | {
"start": 164,
"end": 1050
} | class ____(App):
CSS_PATH = "layouts.tcss"
def compose(self):
with Horizontal(id="horizontal"):
yield Static("Left", classes="box")
with HorizontalScroll(id="horizontalscroll"):
for i in range(NUM_BOXES):
yield Static(
... | NestedContainersApp |
python | apache__airflow | airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_providers.py | {
"start": 1694,
"end": 3132
} | class ____:
@pytest.mark.parametrize(
("query_params", "expected_total_entries", "expected_package_name"),
[
# Filters
({}, 2, ["apache-airflow-providers-amazon", "apache-airflow-providers-apache-cassandra"]),
({"limit": 1}, 2, ["apache-airflow-providers-amazon"])... | TestGetProviders |
python | pennersr__django-allauth | allauth/socialaccount/providers/gitea/views.py | {
"start": 228,
"end": 1242
} | class ____(OAuth2Adapter):
provider_id = "gitea"
settings = app_settings.PROVIDERS.get(provider_id, {})
if "GITEA_URL" in settings:
web_url = settings.get("GITEA_URL").rstrip("/")
else:
web_url = "https://gitea.com"
api_url = "{0}/api/v1".format(web_url)
access_token_url = "{0}... | GiteaOAuth2Adapter |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/typeParams6.py | {
"start": 329,
"end": 367
} | class ____[T3](dict[T1, T3]): ...
| ClassA |
python | modin-project__modin | modin/tests/pandas/extensions/test_pd_extensions.py | {
"start": 2508,
"end": 7038
} | class ____:
def test_add_new_function(self):
backend = "Pandas"
expected_string_val = "Some string value"
method_name = "new_method"
@register_pd_accessor(method_name, backend=backend)
def my_method_implementation():
return expected_string_val
with confi... | TestRegisterForOneBackend |
python | huggingface__transformers | src/transformers/models/gemma3n/modeling_gemma3n.py | {
"start": 64297,
"end": 68384
} | class ____(GradientCheckpointingLayer):
def __init__(self, config: Gemma3nTextConfig, layer_idx: int):
super().__init__()
self.config = config
self.hidden_size = config.hidden_size
self.layer_idx = layer_idx
self.attention_type = config.layer_types[layer_idx]
self.sel... | Gemma3nTextDecoderLayer |
python | openai__openai-python | tests/lib/test_pydantic.py | {
"start": 10465,
"end": 10631
} | class ____(BaseModel):
name: str = Field(description="The name of the galaxy.")
largest_star: Star = Field(description="The largest star in the galaxy.")
| Galaxy |
python | sqlalchemy__sqlalchemy | test/orm/test_core_compilation.py | {
"start": 83873,
"end": 90279
} | class ____(
_poly_fixtures._PolymorphicAliasedJoins, RelationshipNaturalInheritedTest
):
# this is the label style for the polymorphic selectable, not the
# outside query
label_style = LABEL_STYLE_TABLENAME_PLUS_COL
straight_company_to_person_expected = (
"SELECT companies.company_id, compa... | RelNaturalAliasedJoinsTest |
python | huggingface__transformers | tests/models/wav2vec2_bert/test_modeling_wav2vec2_bert.py | {
"start": 24523,
"end": 31628
} | class ____(unittest.TestCase):
def test_compute_mask_indices(self):
batch_size = 4
sequence_length = 60
mask_prob = 0.5
mask_length = 1
mask = _compute_mask_indices((batch_size, sequence_length), mask_prob, mask_length)
mask = torch.from_numpy(mask).to(torch_device)
... | Wav2Vec2BertUtilsTest |
python | dask__dask | dask/dataframe/dask_expr/_str_accessor.py | {
"start": 298,
"end": 3379
} | class ____(Accessor):
"""Accessor object for string properties of the Series values.
Examples
--------
>>> s.str.lower() # doctest: +SKIP
"""
_accessor_name = "str"
_accessor_methods = (
"capitalize",
"casefold",
"center",
"contains",
"count",
... | StringAccessor |
python | jazzband__django-model-utils | tests/models.py | {
"start": 2009,
"end": 2118
} | class ____(InheritanceManagerTestChild1):
text_field = models.TextField()
| InheritanceManagerTestGrandChild1 |
python | oauthlib__oauthlib | oauthlib/oauth2/rfc6749/errors.py | {
"start": 11495,
"end": 11856
} | class ____(OAuth2Error):
"""
The Authorization Server requires End-User consent.
This error MAY be returned when the prompt parameter value in the
Authentication Request is none, but the Authentication Request cannot be
completed without displaying a user interface for End-User consent.
"""
... | ConsentRequired |
python | dagster-io__dagster | python_modules/dagster/dagster/_core/definitions/dependency.py | {
"start": 18440,
"end": 19544
} | class ____(NamedTuple("_NodeInput", [("node", Node), ("input_def", InputDefinition)])):
def __new__(cls, node: Node, input_def: InputDefinition):
return super().__new__(
cls,
check.inst_param(node, "node", Node),
check.inst_param(input_def, "input_def", InputDefinition),
... | NodeInput |
python | apache__airflow | helm-tests/tests/helm_tests/airflow_core/test_scheduler.py | {
"start": 44368,
"end": 44876
} | class ____:
"""Tests scheduler deployment creation."""
def test_can_be_disabled(self):
"""
Scheduler should be able to be disabled if the users desires.
For example, user may be disabled when using scheduler and having it deployed on another host.
"""
docs = render_char... | TestSchedulerCreation |
python | apache__airflow | airflow-core/src/airflow/utils/log/non_caching_file_handler.py | {
"start": 2211,
"end": 3042
} | class ____(RotatingFileHandler):
"""
An extension of RotatingFileHandler, advises the Kernel to not cache the file in PageCache when written.
While there is nothing wrong with such cache (it will be cleaned when memory is needed), it
causes ever-growing memory usage when scheduler is running as it keep... | NonCachingRotatingFileHandler |
python | pytorch__pytorch | torch/_dynamo/variables/distributed.py | {
"start": 9963,
"end": 12453
} | class ____(DistributedVariable):
@staticmethod
def is_device_mesh(value: object) -> bool:
# we can't rely on importing/accessing torch distributed, it is not always built.
if not DistributedVariable.is_available():
return False
from torch.distributed.device_mesh import Devic... | DeviceMeshVariable |
python | pyinstaller__pyinstaller | hatch_build.py | {
"start": 932,
"end": 3131
} | class ____(BuildHookInterface):
def initialize(self, version, build_data):
# Inject the platform specifier into the wheel's filename.
if os.environ.get("PYI_WHEEL_TAG"):
build_data["tag"] = "py3-none-" + os.environ["PYI_WHEEL_TAG"]
pyi_platform = os.environ.get("PYI_PLATFORM")
... | CustomBuildHook |
python | sympy__sympy | sympy/stats/crv_types.py | {
"start": 118850,
"end": 120730
} | class ____(SingleContinuousDistribution):
_argnames = ('alpha', 'beta')
set = Interval(0, oo)
@staticmethod
def check(alpha, beta):
_value_check(alpha > 0, "Alpha must be positive")
_value_check(beta > 0, "Beta must be positive")
def pdf(self, x):
alpha, beta = self.alpha,... | WeibullDistribution |
python | pypa__warehouse | tests/unit/oidc/test_services.py | {
"start": 27717,
"end": 38056
} | class ____:
def test_interface_matches(self):
assert verifyClass(
interfaces.IOIDCPublisherService, services.NullOIDCPublisherService
)
def test_warns_on_init(self, monkeypatch):
warnings = pretend.stub(warn=pretend.call_recorder(lambda m, c: None))
monkeypatch.setat... | TestNullOIDCPublisherService |
python | PyCQA__pylint | tests/functional/ext/docparams/parameter/missing_param_doc_required_Google.py | {
"start": 5853,
"end": 6226
} | class ____: # [missing-param-doc, missing-type-doc]
"""test_constr_params_in_class_google
Example of a class with missing constructor parameter documentation
(Google style)
Everything is completely analogous to functions.
Args:
y: bla
missing constructor parameter documentation
"... | ClassFoo |
python | wandb__wandb | wandb/automations/_generated/fragments.py | {
"start": 1879,
"end": 2107
} | class ____(GQLResult):
typename__: Typename[Literal["SlackIntegration"]] = "SlackIntegration"
id: GQLId
team_name: str = Field(alias="teamName")
channel_name: str = Field(alias="channelName")
| SlackIntegrationFields |
python | joke2k__faker | faker/providers/automotive/th_TH/__init__.py | {
"start": 59,
"end": 860
} | class ____(AutomotiveProvider):
"""Implement automotive provider for ``th_TH`` locale.
Sources:
- https://en.wikipedia.org/wiki/Vehicle_registration_plates_of_Thailand
"""
license_formats = (
"# ?? ####",
"# ?? ###",
"# ?? ##",
"# ?? #",
"?? ####",
... | Provider |
python | pytransitions__transitions | tests/test_experimental.py | {
"start": 9022,
"end": 9207
} | class ____(TestExperimental):
def setUp(self):
self.machine_cls = HierarchicalMachine # type: Type[HierarchicalMachine]
self.create_trigger_class()
| TestHSMExperimental |
python | getsentry__sentry | src/sentry/issue_detection/detectors/mn_plus_one_db_span_detector.py | {
"start": 731,
"end": 1507
} | class ____(ABC):
"""Abstract base class for the MNPlusOneDBSpanDetector state machine."""
@abstractmethod
def next(self, span: Span) -> tuple[MNPlusOneState, PerformanceProblem | None]:
raise NotImplementedError
def finish(self) -> PerformanceProblem | None:
return None
def _equiv... | MNPlusOneState |
python | GoogleCloudPlatform__python-docs-samples | appengine/standard/images/guestbook/main.py | {
"start": 3410,
"end": 3867
} | class ____(webapp2.RequestHandler):
def get(self):
greeting_key = ndb.Key(urlsafe=self.request.get("img_id"))
greeting = greeting_key.get()
if greeting.avatar:
self.response.headers["Content-Type"] = "image/png"
self.response.out.write(greeting.avatar)
else:
... | Image |
python | pyca__cryptography | src/cryptography/x509/general_name.py | {
"start": 766,
"end": 2125
} | class ____(GeneralName):
def __init__(self, value: str) -> None:
if isinstance(value, str):
try:
value.encode("ascii")
except UnicodeEncodeError:
raise ValueError(
"RFC822Name values should be passed as an A-label string. "
... | RFC822Name |
python | ray-project__ray | rllib/utils/exploration/per_worker_gaussian_noise.py | {
"start": 256,
"end": 1779
} | class ____(GaussianNoise):
"""A per-worker Gaussian noise class for distributed algorithms.
Sets the `scale` schedules of individual workers to a constant:
0.4 ^ (1 + [worker-index] / float([num-workers] - 1) * 7)
See Ape-X paper.
"""
def __init__(
self,
action_space: Space,
... | PerWorkerGaussianNoise |
python | sympy__sympy | sympy/plotting/tests/test_plot.py | {
"start": 1533,
"end": 1807
} | class ____(Plot):
""" Used to verify if users can create their own backends.
This backend is meant to raise NotImplementedError for methods `show`,
`save`, `close`.
"""
def __new__(cls, *args, **kwargs):
return object.__new__(cls)
| DummyBackendNotOk |
python | Unity-Technologies__ml-agents | ml-agents/mlagents/trainers/torch_entities/components/reward_providers/curiosity_reward_provider.py | {
"start": 2543,
"end": 9339
} | class ____(torch.nn.Module):
EPSILON = 1e-10
def __init__(self, specs: BehaviorSpec, settings: CuriositySettings) -> None:
super().__init__()
self._action_spec = specs.action_spec
state_encoder_settings = settings.network_settings
if state_encoder_settings.memory is not None:
... | CuriosityNetwork |
python | tensorflow__tensorflow | tensorflow/python/ops/linalg/linear_operator_addition.py | {
"start": 9816,
"end": 10983
} | class ____(_Adder):
"""Handles additions resulting in an Identity family member.
The Identity (`LinearOperatorScaledIdentity`, `LinearOperatorIdentity`) family
is closed under addition. This `Adder` respects that, and returns an Identity
"""
def can_add(self, op1, op2):
types = {_type(op1), _type(op2)}... | _AddAndReturnScaledIdentity |
python | mwaskom__seaborn | seaborn/distributions.py | {
"start": 3018,
"end": 86810
} | class ____(VectorPlotter):
wide_structure = {"x": "@values", "hue": "@columns"}
flat_structure = {"x": "@values"}
def __init__(
self,
data=None,
variables={},
):
super().__init__(data=data, variables=variables)
@property
def univariate(self):
"""Return... | _DistributionPlotter |
python | getsentry__sentry | src/sentry/web/frontend/base.py | {
"start": 27997,
"end": 28693
} | class ____(AbstractOrganizationView):
"""
A view which has direct ORM access to organization objects. Only endpoints that exist in the
region silo should use this class.
"""
def _get_organization(self) -> Organization | None:
if not self.active_organization:
return None
... | OrganizationView |
python | eth-brownie__brownie | brownie/exceptions.py | {
"start": 5418,
"end": 5491
} | class ____(AttributeError):
pass
# project/
@final
| NamespaceCollision |
python | ansible__ansible | lib/ansible/_internal/_wrapt.py | {
"start": 1990,
"end": 3448
} | class ____(object):
# We use properties to override the values of __module__ and
# __doc__. If we add these in ObjectProxy, the derived class
# __dict__ will still be setup to have string variants of these
# attributes and the rules of descriptors means that they appear to
# take precedence over th... | _ObjectProxyMethods |
python | walkccc__LeetCode | solutions/1428. Leftmost Column with at Least a One/1428.py | {
"start": 237,
"end": 587
} | class ____:
def leftMostColumnWithOne(self, binaryMatrix: 'BinaryMatrix') -> int:
m, n = binaryMatrix.dimensions()
ans = -1
l = 0
r = n - 1
while l <= r:
mid = (l + r) // 2
if any(binaryMatrix.get(i, mid) for i in range(m)):
ans = mid
r = mid - 1
else:
l ... | Solution |
python | pytorch__pytorch | torch/ao/quantization/observer.py | {
"start": 61996,
"end": 63096
} | class ____(Enum):
"""How floating point number is mapped to integer number
symmetric mapping means floating point range is symmetrically mapped to integer range
let's say we have floating point range (-3.5, 10.2) and integer range (-8, 7) (int4)
we'll use (-10.2, 10.2) as the range for floating point a... | MappingType |
python | walkccc__LeetCode | solutions/3019. Number of Changing Keys/3019.py | {
"start": 0,
"end": 148
} | class ____:
def countKeyChanges(self, s: str) -> int:
return sum(a.lower() != b.lower()
for a, b in itertools.pairwise(s))
| Solution |
python | ApeWorX__ape | src/ape/types/coverage.py | {
"start": 15160,
"end": 34637
} | class ____(BaseModel):
"""
Coverage report schema inspired from coverage.py.
"""
source_folders: list[Path]
"""
All source folders to use. This is needed for codecov.
"""
timestamp: int
"""
The timestamp the report was generated, in milliseconds.
"""
projects: list[Cov... | CoverageReport |
python | walkccc__LeetCode | solutions/2334. Subarray With Elements Greater Than Varying Threshold/2334.py | {
"start": 0,
"end": 758
} | class ____:
# Similar to 907. Sum of Subarray Minimums
def validSubarraySize(self, nums: list[int], threshold: int) -> int:
n = len(nums)
ans = 0
# prev[i] := the index k s.t. nums[k] is the previous minimum in nums[0..n)
prev = [-1] * n
# next[i] := the index k s.t. nums[k] is the next minimum ... | Solution |
python | bokeh__bokeh | tests/unit/bokeh/server/test_server__server.py | {
"start": 2118,
"end": 33040
} | class ____(Handler):
def __init__(self) -> None:
super().__init__()
self.load_count = 0
self.unload_count = 0
self.session_creation_async_value = 0
self.hooks = []
self.periodic_remover = None
def modify_document(self, doc):
# checks that session created ... | HookTestHandler |
python | great-expectations__great_expectations | great_expectations/data_context/types/base.py | {
"start": 46994,
"end": 50799
} | class ____(enum.Enum):
DEFAULT_CONFIG_VERSION = CURRENT_GX_CONFIG_VERSION
UNCOMMITTED = "uncommitted"
DEFAULT_EXPECTATIONS_STORE_NAME = "expectations_store"
EXPECTATIONS_BASE_DIRECTORY = "expectations"
DEFAULT_EXPECTATIONS_STORE_BASE_DIRECTORY_RELATIVE_NAME = f"{EXPECTATIONS_BASE_DIRECTORY}/"
D... | DataContextConfigDefaults |
python | google__jax | jax/experimental/_private_mm/mm.py | {
"start": 1009,
"end": 11435
} | class ____:
"""A generalization of jax.Array that also supports fully remote arrays."""
aval: jax.core.ShapedArray
sharding: Sharding
_complete: Callable[[], jax.Array | tuple] | None
_result: jax.Array | tuple | None = None
def __repr__(self):
remote_str = ', fully-remote' if self.is_f... | MpmdArray |
python | PyCQA__pyflakes | pyflakes/test/test_undefined_names.py | {
"start": 23099,
"end": 23544
} | class ____(TestCase):
"""
Tests for some extra cases of name handling.
"""
def test_impossibleContext(self):
"""
A Name node with an unrecognized context results in a RuntimeError being
raised.
"""
tree = ast.parse("x = 10")
# Make it into something unreco... | NameTests |
python | getlogbook__logbook | src/logbook/handlers.py | {
"start": 62969,
"end": 68640
} | class ____(Handler):
"""This handler wraps another handler and will log everything in
memory until a certain level (`action_level`, defaults to `ERROR`)
is exceeded. When that happens the fingers crossed handler will
activate forever and log all buffered records as well as records
yet to come into ... | FingersCrossedHandler |
python | django__django | tests/model_inheritance/models.py | {
"start": 4355,
"end": 4451
} | class ____(models.Model):
id = models.IntegerField(primary_key=True, default=1)
| CommonAncestor |
python | kamyu104__LeetCode-Solutions | Python/substrings-that-begin-and-end-with-the-same-letter.py | {
"start": 50,
"end": 377
} | class ____(object):
def numberOfSubstrings(self, s):
"""
:type s: str
:rtype: int
"""
result = 0
cnt = collections.Counter()
for c in s:
cnt[c] += 1
result += cnt[c]
return result
# Time: O(n)
# Space: O(1)
import collections... | Solution |
python | tensorflow__tensorflow | tensorflow/python/debug/cli/command_parser_test.py | {
"start": 910,
"end": 3907
} | class ____(test_util.TensorFlowTestCase):
def testParseNoBracketsOrQuotes(self):
command = ""
self.assertEqual([], command_parser.parse_command(command))
command = "a"
self.assertEqual(["a"], command_parser.parse_command(command))
command = "foo bar baz qux"
self.assertEqual(["foo", "bar", ... | ParseCommandTest |
python | matplotlib__matplotlib | lib/matplotlib/backends/backend_gtk3.py | {
"start": 21811,
"end": 22384
} | class ____(backend_tools.ToolCopyToClipboardBase):
def trigger(self, *args, **kwargs):
clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
window = self.canvas.get_window()
x, y, width, height = window.get_geometry()
pb = Gdk.pixbuf_get_from_window(window, x, y, width, height)
... | ToolCopyToClipboardGTK3 |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/event/attr.py | {
"start": 12924,
"end": 16682
} | class ____(_InstanceLevelDispatch[_ET]):
__slots__ = (
"_exec_once_mutex",
"_exec_once",
"_exec_w_sync_once",
"_is_asyncio",
)
_exec_once_mutex: Optional[_MutexProtocol]
parent_listeners: Collection[_ListenerFnType]
listeners: Collection[_ListenerFnType]
_exec_on... | _CompoundListener |
python | scikit-image__scikit-image | benchmarks/benchmark_segmentation.py | {
"start": 2454,
"end": 3696
} | class ____(SlicSegmentation):
"""Benchmark for segmentation routines in scikit-image."""
def setup(self):
try:
mask = np.zeros((64, 64)) > 0
mask[10:-10, 10:-10] = 1
segmentation.slic(np.ones_like(mask), mask=mask, **_channel_kwarg(False))
except TypeError:
... | MaskSlicSegmentation |
python | django__django | tests/forms_tests/tests/test_forms.py | {
"start": 231904,
"end": 232143
} | class ____(BoundField):
def label_tag(self, contents=None, attrs=None, label_suffix=None, tag=None):
return super().label_tag(
contents=contents, attrs=attrs, label_suffix="", tag=None
)
| BoundFieldWithoutColon |
python | mlflow__mlflow | mlflow/telemetry/schemas.py | {
"start": 1633,
"end": 1708
} | class ____:
ingestion_url: str
disable_events: set[str]
| TelemetryConfig |
python | vyperlang__vyper | vyper/codegen/function_definitions/common.py | {
"start": 746,
"end": 2699
} | class ____:
func_t: ContractFunctionT
gas_estimate: Optional[int] = None
frame_info: Optional[FrameInfo] = None
func_ir: Optional["InternalFuncIR"] = None
@property
def visibility(self):
return "internal" if self.func_t.is_internal else "external"
@property
def exit_sequence_la... | _FuncIRInfo |
python | has2k1__plotnine | plotnine/themes/themeable.py | {
"start": 38550,
"end": 38946
} | class ____(themeable):
"""
Horizontal major grid lines
Parameters
----------
theme_element : element_line
"""
def apply_ax(self, ax: Axes):
super().apply_ax(ax)
ax.yaxis.grid(which="major", **blend_alpha(self.properties))
def blank_ax(self, ax: Axes):
super().b... | panel_grid_major_y |
python | plotly__plotly.py | plotly/graph_objs/isosurface/slices/_x.py | {
"start": 233,
"end": 5303
} | class ____(_BaseTraceHierarchyType):
_parent_path_str = "isosurface.slices"
_path_str = "isosurface.slices.x"
_valid_props = {"fill", "locations", "locationssrc", "show"}
@property
def fill(self):
"""
Sets the fill ratio of the `slices`. The default fill value of
the `slices... | X |
python | apache__airflow | task-sdk/src/airflow/sdk/api/datamodels/_generated.py | {
"start": 4994,
"end": 5511
} | class ____(BaseModel):
"""
Schema for response with previous successful DagRun information for Task Template Context.
"""
data_interval_start: Annotated[AwareDatetime | None, Field(title="Data Interval Start")] = None
data_interval_end: Annotated[AwareDatetime | None, Field(title="Data Interval End... | PrevSuccessfulDagRunResponse |
python | huggingface__transformers | src/transformers/models/mm_grounding_dino/modular_mm_grounding_dino.py | {
"start": 1339,
"end": 14384
} | class ____(PreTrainedConfig):
r"""
This is the configuration class to store the configuration of a [`MMGroundingDinoModel`]. It is used to instantiate a
MM Grounding DINO model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yie... | MMGroundingDinoConfig |
python | spyder-ide__spyder | spyder/app/tests/script_outline_2.py | {
"start": 111,
"end": 218
} | class ____:
D = 1
def three(self):
return 3
def four(self):
return 4
| MyOtherClass |
python | PrefectHQ__prefect | src/prefect/client/schemas/sorting.py | {
"start": 1384,
"end": 1687
} | class ____(AutoEnum):
"""Defines deployment sorting options."""
CREATED_DESC = AutoEnum.auto()
UPDATED_DESC = AutoEnum.auto()
NAME_ASC = AutoEnum.auto()
NAME_DESC = AutoEnum.auto()
CONCURRENCY_LIMIT_ASC = AutoEnum.auto()
CONCURRENCY_LIMIT_DESC = AutoEnum.auto()
| DeploymentSort |
python | dagster-io__dagster | python_modules/libraries/dagster-dbt/dagster_dbt/core/dbt_cli_event.py | {
"start": 8213,
"end": 23827
} | class ____(ABC):
"""The representation of a dbt CLI event.
Args:
raw_event (Dict[str, Any]): The raw event dictionary.
See https://docs.getdbt.com/reference/events-logging#structured-logging for more
information.
event_history_metadata (Dict[str, Any]): A dictionary of m... | DbtCliEventMessage |
python | tensorflow__tensorflow | tensorflow/python/ops/io_ops.py | {
"start": 15675,
"end": 16770
} | class ____(ReaderBase):
"""A Reader that outputs the lines of a file delimited by newlines.
Newlines are stripped from the output.
See ReaderBase for supported methods.
@compatibility(eager)
Readers are not compatible with eager execution. Instead, please
use `tf.data` to get data into your model.
@end_... | TextLineReader |
python | viewflow__viewflow | tests/components/test_field_checkbox.py | {
"start": 298,
"end": 949
} | class ____(LiveTestCase):
def test_field_input(self):
self.browser.get(f"{self.live_server_url}/application/form/")
self.assertNoJsErrors()
wrapper = self.browser.find_element(By.CSS_SELECTOR, ".mdc-checkbox")
input = self.browser.find_element(By.CSS_SELECTOR, "vf-field-checkbox inp... | Test |
python | huggingface__transformers | src/transformers/models/metaclip_2/modeling_metaclip_2.py | {
"start": 39079,
"end": 40629
} | class ____(nn.Module):
def __init__(self, config: MetaClip2VisionConfig):
super().__init__()
self.config = config
embed_dim = config.hidden_size
self.embeddings = MetaClip2VisionEmbeddings(config)
self.pre_layrnorm = nn.LayerNorm(embed_dim, eps=config.layer_norm_eps)
... | MetaClip2VisionTransformer |
python | mkdocs__mkdocs | mkdocs/exceptions.py | {
"start": 283,
"end": 457
} | class ____(MkDocsException, SystemExit):
"""Abort the build."""
code = 1
def show(self, *args, **kwargs) -> None:
echo('\n' + self.format_message())
| Abort |
python | PrefectHQ__prefect | tests/server/orchestration/api/test_block_types.py | {
"start": 5974,
"end": 11725
} | class ____:
@pytest.fixture
async def block_types_with_associated_capabilities(self, session):
class CanRun(Block):
_block_schema_capabilities = ["run"]
def run(self):
pass
class CanFly(Block):
_block_schema_capabilities = ["fly"]
... | TestReadBlockTypes |
python | PyCQA__pylint | pylint/checkers/base/pass_checker.py | {
"start": 356,
"end": 1041
} | class ____(_BasicChecker):
"""Check if the pass statement is really necessary."""
msgs = {
"W0107": (
"Unnecessary pass statement",
"unnecessary-pass",
'Used when a "pass" statement can be removed without affecting '
"the behaviour of the code.",
... | PassChecker |
python | gevent__gevent | src/greentest/3.14/test_thread.py | {
"start": 937,
"end": 10999
} | class ____(BasicThreadTest):
def newtask(self):
with self.running_mutex:
self.next_ident += 1
verbose_print("creating task %s" % self.next_ident)
thread.start_new_thread(self.task, (self.next_ident,))
self.created += 1
self.running += 1
def t... | ThreadRunningTests |
python | streamlit__streamlit | lib/tests/streamlit/elements/markdown_test.py | {
"start": 12487,
"end": 14068
} | class ____(DeltaGeneratorTestCase):
"""Test st.markdown text_alignment parameter."""
@parameterized.expand(
[
("left", 1),
("center", 2),
("right", 3),
("justify", 4),
(None, 1), # Default case
]
)
def test_st_markdown_text_al... | StMarkdownTextAlignmentTest |
python | apache__airflow | airflow-ctl/src/airflowctl/api/datamodels/generated.py | {
"start": 26146,
"end": 26546
} | class ____(BaseModel):
"""
Task outlet reference serializer for assets.
"""
model_config = ConfigDict(
extra="forbid",
)
dag_id: Annotated[str, Field(title="Dag Id")]
task_id: Annotated[str, Field(title="Task Id")]
created_at: Annotated[datetime, Field(title="Created At")]
u... | TaskOutletAssetReference |
python | kamyu104__LeetCode-Solutions | Python/vowels-of-all-substrings.py | {
"start": 29,
"end": 277
} | class ____(object):
def countVowels(self, word):
"""
:type word: str
:rtype: int
"""
VOWELS = set("aeiou")
return sum((i-0+1) * ((len(word)-1)-i+1) for i, c in enumerate(word) if c in VOWELS)
| Solution |
python | sphinx-doc__sphinx | sphinx/addnodes.py | {
"start": 14110,
"end": 14238
} | class ____(nodes.Element):
"""Node for specifying tabular columns, used for LaTeX output."""
# inline nodes
| tabular_col_spec |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-bing-ads/unit_tests/integrations/test_custom_report.py | {
"start": 10152,
"end": 17564
} | class ____(HourlyReportsTestWithStateChangesAfterMigration):
stream_name = "custom_report"
report_file = "custom_report_hourly"
records_number = 8
state_file = "hourly_reports_state"
incremental_report_file = "custom_report_hourly_incremental"
report_file_with_records_further_start_date = "cust... | TestCustomReportHourly |
python | django__django | tests/admin_inlines/admin.py | {
"start": 9414,
"end": 9530
} | class ____(admin.StackedInline):
model = Class
extra = 1
filter_vertical = ["person"]
| ClassStackedVertical |
python | ray-project__ray | python/ray/_common/tests/test_ray_option_utils.py | {
"start": 3937,
"end": 6684
} | class ____:
def test_validate_task_options_valid(self):
validate_task_options({"num_cpus": 2, "max_retries": 3}, in_options=False)
def test_validate_task_options_invalid_keyword(self):
with pytest.raises(ValueError, match="Invalid option keyword"):
validate_task_options({"invalid_op... | TestTaskActorOptionValidation |
python | pydantic__pydantic | tests/benchmarks/basemodel_eq_performance.py | {
"start": 1642,
"end": 2759
} | class ____(pydantic.BaseModel, frozen=True):
def __eq__(self, other: Any) -> bool:
if isinstance(other, pydantic.BaseModel):
# When comparing instances of generic types for equality, as long as all field values are equal,
# only require their generic origin types to be equal, rather ... | DictComprehensionEqModel |
python | pyodide__pyodide | src/py/pyodide/http/_exceptions.py | {
"start": 1556,
"end": 1747
} | class ____(XHRError):
"""Network-related XMLHttpRequest error."""
def __init__(self, message: str = "Network error occurred") -> None:
super().__init__(message)
| XHRNetworkError |
python | huggingface__transformers | src/transformers/models/x_clip/modeling_x_clip.py | {
"start": 44758,
"end": 46710
} | class ____(nn.Module):
"""Multi-headed attention from 'Attention Is All You Need' paper"""
def __init__(self, config):
super().__init__()
self.num_heads = config.prompt_num_attention_heads
dim = config.projection_dim
head_dim = dim // self.num_heads
self.scale = head_di... | XCLIPCrossAttention |
python | facebook__pyre-check | pyre_extensions/__init__.py | {
"start": 4255,
"end": 4299
} | class ____(Generic[_Ts], int):
pass
| Length |
python | facebook__pyre-check | source/interprocedural_analyses/taint/test/integration/properties.py | {
"start": 6183,
"end": 6773
} | class ____:
@property
def my_property(self) -> str:
return ""
@my_property.setter
def my_property(self, value: Base) -> None:
value.foo()
if isinstance(value, A):
value.foo()
def test_property_augmented_assign(p: PropertySetterTitoModel):
# We see two calls for... | TestTypeInferenceInSetter |
python | numba__numba | numba/core/utils.py | {
"start": 9629,
"end": 10151
} | class ____(MutableSet[T]):
def __init__(self, iterable: _tp.Iterable[T] = ()):
# Just uses a dictionary under-the-hood to maintain insertion order.
self._data = dict.fromkeys(iterable, None)
def __contains__(self, key):
return key in self._data
def __iter__(self):
return i... | OrderedSet |
python | great-expectations__great_expectations | tests/integration/metrics/column_pair_values/test_in_set.py | {
"start": 1108,
"end": 5688
} | class ____:
@parameterize_batch_for_data_sources(
data_source_configs=PANDAS_DATA_SOURCES + SPARK_DATA_SOURCES + SQL_DATA_SOURCES,
data=DATA_FRAME,
)
def test_success(self, batch_for_datasource: Batch) -> None:
batch = batch_for_datasource
metric = ColumnPairValuesInSetUnexpe... | TestColumnPairValuesInSetUnexpectedValues |
python | mwaskom__seaborn | seaborn/_core/scales.py | {
"start": 13028,
"end": 13123
} | class ____(Scale):
# Numeric, integral, can skip ticks/ticklabels
...
@dataclass
| Discrete |
python | pydata__xarray | xarray/namedarray/_typing.py | {
"start": 6083,
"end": 6359
} | class ____(
_arrayfunction[_ShapeType_co, _DType_co], Protocol[_ShapeType_co, _DType_co]
):
"""
Chunked duck array supporting NEP 18.
Corresponds to np.ndarray.
"""
@property
def chunks(self) -> _Chunks: ...
@runtime_checkable
| _chunkedarrayfunction |
python | psf__black | src/black/parsing.py | {
"start": 3821,
"end": 8824
} | class ____(Exception):
"""Raised when Black's generated code is not equivalent to the old AST."""
def _parse_single_version(
src: str, version: tuple[int, int], *, type_comments: bool
) -> ast.AST:
filename = "<unknown>"
with warnings.catch_warnings():
warnings.simplefilter("ignore", SyntaxWar... | ASTSafetyError |
python | apache__avro | lang/py/avro/errors.py | {
"start": 3777,
"end": 3874
} | class ____(AvroException):
"""Raised when a protocol failed to parse."""
| ProtocolParseException |
python | numba__numba | numba/tests/test_unicode.py | {
"start": 5936,
"end": 7317
} | class ____(MemoryLeakMixin, TestCase):
def setUp(self):
super(BaseTest, self).setUp()
UNICODE_EXAMPLES = [
'',
'ascii',
'12345',
'1234567890',
'¡Y tú quién te crees?',
'🐍⚡',
'大处着眼,小处着手。',
]
UNICODE_ORDERING_EXAMPLES = [
'',
'a'
'aa',
'aaa',
'b',
'aab',... | BaseTest |
python | HypothesisWorks__hypothesis | hypothesis-python/tests/cover/test_lookup_py39.py | {
"start": 4968,
"end": 5481
} | class ____:
__is_annotated_types_grouped_metadata__ = True
def __iter__(self):
return iter([st.just(sentinel)])
@given(...)
def test_grouped_protocol_strategy(x: typing.Annotated[int, LazyStrategyAnnotation()]):
assert x is sentinel
def test_collections_abc_callable_none():
# https://github... | LazyStrategyAnnotation |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.