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 | PyCQA__pylint | pylint/utils/linterstats.py | {
"start": 1677,
"end": 13056
} | class ____:
"""Class used to linter stats."""
def __init__(
self,
bad_names: BadNames | None = None,
by_module: dict[str, ModuleStats] | None = None,
by_msg: dict[str, int] | None = None,
code_type_count: CodeTypeCount | None = None,
dependencies: dict[str, set[s... | LinterStats |
python | plotly__plotly.py | plotly/graph_objs/heatmap/colorbar/_title.py | {
"start": 233,
"end": 3971
} | class ____(_BaseTraceHierarchyType):
_parent_path_str = "heatmap.colorbar"
_path_str = "heatmap.colorbar.title"
_valid_props = {"font", "side", "text"}
@property
def font(self):
"""
Sets this color bar's title font.
The 'font' property is an instance of Font
that ma... | Title |
python | getsentry__sentry | src/sentry/tagstore/types.py | {
"start": 3783,
"end": 3919
} | class ____(TagKeySerializerResponseOptional):
key: str
name: str
@register(GroupTagKey)
@register(TagKey)
| TagKeySerializerResponse |
python | apache__airflow | airflow-core/tests/unit/utils/test_session.py | {
"start": 985,
"end": 2219
} | class ____:
def dummy_session(self, session=None):
return session
def test_raised_provide_session(self):
with pytest.raises(ValueError, match="Function .*dummy has no `session` argument"):
@provide_session
def dummy():
pass
def test_provide_session_... | TestSession |
python | HypothesisWorks__hypothesis | hypothesis-python/src/hypothesis/strategies/_internal/collections.py | {
"start": 4118,
"end": 8361
} | class ____(SearchStrategy[list[Ex]]):
"""A strategy for lists which takes a strategy for its elements and the
allowed lengths, and generates lists with the correct size and contents."""
_nonempty_filters: tuple[Callable[[Any], Any], ...] = (bool, len, tuple, list)
def __init__(
self,
e... | ListStrategy |
python | sphinx-doc__sphinx | sphinx/project.py | {
"start": 544,
"end": 4539
} | class ____:
"""A project is the source code set of the Sphinx document(s)."""
def __init__(
self, srcdir: str | os.PathLike[str], source_suffix: Iterable[str]
) -> None:
#: Source directory.
self.srcdir = _StrPath(srcdir)
#: source_suffix. Same as :confval:`source_suffix`.
... | Project |
python | sqlalchemy__sqlalchemy | examples/inheritance/concrete.py | {
"start": 1858,
"end": 4545
} | class ____(Person):
__tablename__ = "manager"
id: Mapped[int] = mapped_column(primary_key=True)
company_id: Mapped[int] = mapped_column(ForeignKey("company.id"))
name: Mapped[str50]
status: Mapped[str50]
manager_name: Mapped[str50]
company: Mapped[Company] = relationship(back_populates="em... | Manager |
python | PrefectHQ__prefect | src/prefect/events/schemas/deployment_triggers.py | {
"start": 3098,
"end": 4545
} | class ____(BaseDeploymentTrigger, SequenceTrigger):
"""A composite trigger that requires some number of triggers to have fired
within the given time period in a specific order"""
trigger_type: ClassVar[Type[TriggerTypes]] = SequenceTrigger
def deployment_trigger_discriminator(value: Any) -> str:
"""C... | DeploymentSequenceTrigger |
python | scrapy__scrapy | tests/test_downloader_handler_twisted_http2.py | {
"start": 7252,
"end": 7602
} | class ____(TestHttpWithCrawlerBase):
"""HTTP 2.0 test case with MockServer"""
@property
def settings_dict(self) -> dict[str, Any] | None:
return {
"DOWNLOAD_HANDLERS": {
"https": "scrapy.core.downloader.handlers.http2.H2DownloadHandler"
}
}
is_se... | TestHttp2WithCrawler |
python | ipython__ipython | tests/test_interactiveshell.py | {
"start": 33466,
"end": 34563
} | class ____(unittest.TestCase):
"""Check that SyntaxError raised by an input transformer is handled by run_cell()"""
@staticmethod
def transformer(lines):
for line in lines:
pos = line.find("syntaxerror")
if pos >= 0:
e = SyntaxError('input contains "syntaxerr... | TestSyntaxErrorTransformer |
python | conda__conda | conda/core/path_actions.py | {
"start": 6489,
"end": 7452
} | class ____(PrefixPathAction, metaclass=ABCMeta):
# All CreatePathAction subclasses must create a SINGLE new path
# the short/in-prefix version of that path must be returned by execute()
def __init__(
self,
transaction_context,
package_info,
source_prefix,
source_sh... | CreateInPrefixPathAction |
python | getsentry__sentry | tests/sentry/workflow_engine/endpoints/test_organization_detector_workflow_index.py | {
"start": 1918,
"end": 4519
} | class ____(OrganizationDetectorWorkflowAPITestCase):
def test_detector_filter(self) -> None:
response = self.get_success_response(
self.organization.slug,
qs_params={"detector_id": self.detector_1.id},
)
assert len(response.data) == 2
assert response.data == [... | OrganizationDetectorWorkflowIndexGetTest |
python | Textualize__textual | src/textual/widgets/_masked_input.py | {
"start": 15966,
"end": 26291
} | class ____(Input, can_focus=True):
"""A masked text input widget."""
template: Reactive[str] = var("")
"""Input template mask currently in use."""
def __init__(
self,
template: str,
value: str | None = None,
placeholder: str = "",
*,
validators: Validato... | MaskedInput |
python | realpython__materials | django-flashcards-app/source_code_final/cards/views.py | {
"start": 494,
"end": 590
} | class ____(CardCreateView, UpdateView):
success_url = reverse_lazy("card-list")
| CardUpdateView |
python | openai__openai-python | src/openai/types/chat/chat_completion_message.py | {
"start": 991,
"end": 1408
} | class ____(BaseModel):
arguments: str
"""
The arguments to call the function with, as generated by the model in JSON
format. Note that the model does not always generate valid JSON, and may
hallucinate parameters not defined by your function schema. Validate the
arguments in your code before cal... | FunctionCall |
python | coleifer__peewee | peewee.py | {
"start": 146725,
"end": 147987
} | class ____(object):
def __init__(self, db, *args, **kwargs):
self.db = db
self._begin_args = (args, kwargs)
def __call__(self, fn):
@wraps(fn)
def inner(*args, **kwargs):
a, k = self._begin_args
with _transaction(self.db, *a, **k):
return ... | _transaction |
python | scrapy__scrapy | scrapy/spidermiddlewares/referer.py | {
"start": 4746,
"end": 5450
} | class ____(ReferrerPolicy):
"""
https://www.w3.org/TR/referrer-policy/#referrer-policy-same-origin
The "same-origin" policy specifies that a full URL, stripped for use as a referrer,
is sent as referrer information when making same-origin requests from a particular request client.
Cross-origin req... | SameOriginPolicy |
python | walkccc__LeetCode | solutions/747. Largest Number At Least Twice of Others/747.py | {
"start": 0,
"end": 306
} | class ____:
def dominantIndex(self, nums: list[int]) -> int:
mx = 0
secondMax = 0
for i, num in enumerate(nums):
if num > mx:
secondMax = mx
mx = num
ans = i
elif num > secondMax:
secondMax = num
return ans if mx >= 2 * secondMax else -1
| Solution |
python | tensorflow__tensorflow | tensorflow/python/data/experimental/kernel_tests/from_list_test.py | {
"start": 9084,
"end": 10251
} | class ____(
test_base.DatasetTestBase, parameterized.TestCase):
@combinations.generate(
combinations.times(
test_base.default_test_combinations(),
combinations.combine(
dataset_range=[100],
repetitions=[1, 2],
seed=[None, 42],
resh... | FromListGlobalShuffleTest |
python | oauthlib__oauthlib | tests/oauth2/rfc6749/endpoints/test_client_authentication.py | {
"start": 796,
"end": 6821
} | class ____(TestCase):
def inspect_client(self, request, refresh_token=False):
if not request.client or not request.client.client_id:
raise ValueError()
return 'abc'
def setUp(self):
self.validator = mock.MagicMock(spec=RequestValidator)
self.validator.is_pkce_requir... | ClientAuthenticationTest |
python | numba__numba | numba/tests/test_dictobject.py | {
"start": 29450,
"end": 32483
} | class ____(MemoryLeakMixin, TestCase):
def test_basic(self):
d = Dict.empty(int32, float32)
# len
self.assertEqual(len(d), 0)
# setitems
d[1] = 1
d[2] = 2.3
d[3] = 3.4
self.assertEqual(len(d), 3)
# keys
self.assertEqual(list(d.keys()), ... | TestTypedDict |
python | PrefectHQ__prefect | src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py | {
"start": 817027,
"end": 817704
} | class ____(
sgqlc.types.Type, Node, AuditEntry, OrganizationAuditEntryData
):
"""
See source code for more info.
"""
__schema__ = graphql_schema
__field_names__ = (
"blocked_user",
"blocked_user_name",
"blocked_user_resource_path",
"blocked_user_url",
)
b... | OrgBlockUserAuditEntry |
python | falconry__falcon | examples/asgilook/asgilook/cache.py | {
"start": 17,
"end": 1675
} | class ____:
PREFIX = 'asgilook:'
INVALIDATE_ON = frozenset({'DELETE', 'POST', 'PUT'})
CACHE_HEADER = 'X-ASGILook-Cache'
TTL = 3600
def __init__(self, config):
self._config = config
self._redis = self._config.redis_from_url(self._config.redis_host)
async def _serialize_response(... | RedisCache |
python | doocs__leetcode | solution/0500-0599/0522.Longest Uncommon Subsequence II/Solution.py | {
"start": 0,
"end": 526
} | class ____:
def findLUSlength(self, strs: List[str]) -> int:
def check(s: str, t: str):
i = j = 0
while i < len(s) and j < len(t):
if s[i] == t[j]:
i += 1
j += 1
return i == len(s)
ans = -1
for i, s in e... | Solution |
python | getsentry__sentry | src/sentry/models/authidentity.py | {
"start": 666,
"end": 2931
} | class ____(ReplicatedControlModel):
__relocation_scope__ = RelocationScope.Global
category = OutboxCategory.AUTH_IDENTITY_UPDATE
replication_version = 2
# NOTE: not a fk to sentry user
user = FlexibleForeignKey(settings.AUTH_USER_MODEL)
auth_provider = FlexibleForeignKey("sentry.AuthProvider")
... | AuthIdentity |
python | tensorflow__tensorflow | tensorflow/python/kernel_tests/array_ops/spacetobatch_op_test.py | {
"start": 20265,
"end": 22048
} | class ____(test.TestCase, PythonOpImpl):
# Check the gradients.
def _checkGrad(self, x, paddings, block_size):
assert 4 == x.ndim
with self.cached_session():
tf_x = ops.convert_to_tensor(x)
tf_y = self.space_to_batch(tf_x, paddings, block_size)
epsilon = 1e-5
((x_jacob_t, x_jacob_n)... | SpaceToBatchGradientTest |
python | getsentry__sentry | src/sentry/charts/types.py | {
"start": 53,
"end": 1142
} | class ____(Enum):
"""
This enum defines the chart styles we can render.
This directly maps to the chartcuterie configuration [0] in the frontend
code. Be sure to keep these in sync when adding or removing types.
[0]: app/chartcuterie/config.tsx.
"""
SLACK_DISCOVER_TOTAL_PERIOD = "slack:di... | ChartType |
python | tensorflow__tensorflow | tensorflow/python/debug/lib/common_test.py | {
"start": 974,
"end": 2361
} | class ____(test_util.TensorFlowTestCase):
@test_util.run_v1_only("Relies on tensor name, which is unavailable in TF2")
def testOnFeedOneFetch(self):
a = constant_op.constant(10.0, name="a")
b = constant_op.constant(20.0, name="b")
run_key = common.get_run_key({"a": a}, [b])
loaded = json.loads(run_... | CommonTest |
python | readthedocs__readthedocs.org | readthedocs/rtd_tests/tests/projects/test_admin_actions.py | {
"start": 330,
"end": 2826
} | class ____(TestCase):
@classmethod
def setUpTestData(cls):
cls.owner = fixture.get(User)
cls.profile = fixture.get(UserProfile, user=cls.owner, banned=False)
cls.admin = fixture.get(User, is_staff=True, is_superuser=True)
cls.project = fixture.get(
Project,
... | ProjectAdminActionsTest |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 535177,
"end": 535649
} | class ____(sgqlc.types.Type):
"""Autogenerated return type of CreateCheckSuite"""
__schema__ = github_schema
__field_names__ = ("check_suite", "client_mutation_id")
check_suite = sgqlc.types.Field("CheckSuite", graphql_name="checkSuite")
"""The newly created check suite."""
client_mutation_id ... | CreateCheckSuitePayload |
python | pytorch__pytorch | torch/_inductor/fx_passes/group_batch_fusion.py | {
"start": 49028,
"end": 49245
} | class ____(BatchPointwiseOpsPostGradFusion):
def __init__(self, **kwargs) -> None:
super().__init__(aten.tanh.default, **kwargs)
@register_fusion("batch_aten_sigmoid", pre_grad=False)
| BatchTanhPostGradFusion |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 1084040,
"end": 1084568
} | class ____(sgqlc.types.Type, Node):
"""A common weakness enumeration"""
__schema__ = github_schema
__field_names__ = ("cwe_id", "description", "name")
cwe_id = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="cweId")
"""The id of the CWE"""
description = sgqlc.types.Field(sgqlc.ty... | CWE |
python | PyCQA__pylint | doc/data/messages/n/non-parent-init-called/bad.py | {
"start": 0,
"end": 77
} | class ____:
def __init__(self):
self.is_multicellular = True
| Animal |
python | apache__airflow | providers/amazon/tests/unit/amazon/aws/operators/test_dms.py | {
"start": 35185,
"end": 38911
} | class ____:
def mock_describe_replication_response(self, status: str):
return [
{
"ReplicationConfigIdentifier": "string",
"ReplicationConfigArn": "string",
"SourceEndpointArn": "string",
"TargetEndpointArn": "string",
... | TestDmsStartReplicationOperator |
python | PrefectHQ__prefect | tests/cli/test_deploy.py | {
"start": 174102,
"end": 176990
} | class ____:
def test_save_user_inputs_no_existing_prefect_file(self):
prefect_file = Path("prefect.yaml")
prefect_file.unlink()
assert not prefect_file.exists()
invoke_and_assert(
command="deploy flows/hello.py:my_flow",
user_input=(
# Accept ... | TestSaveUserInputs |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-surveycto/source_surveycto/source.py | {
"start": 517,
"end": 1612
} | class ____(HttpStream, ABC):
transformer: TypeTransformer = TypeTransformer(TransformConfig.DefaultSchemaNormalization)
def __init__(self, config: Mapping[str, Any], form_id, schema, **kwargs):
super().__init__()
self.config = config
self.schema = schema
self.server_name = conf... | SurveyStream |
python | falconry__falcon | tests/asgi/test_hello_asgi.py | {
"start": 2791,
"end": 3933
} | class ____:
class Emitter:
def __init__(self, value, divisor):
self._value = value
self._divisor = divisor
self._remainder = None
self.closed = False
async def close(self):
self.closed = True
def __aiter__(self):
if s... | ClosingStreamResource |
python | mlflow__mlflow | tests/models/test_signature.py | {
"start": 12530,
"end": 12662
} | class ____(rag_signatures.ChatCompletionRequest):
custom_input: CustomInput | None = None
@dataclass
| FlexibleChatCompletionRequest |
python | getsentry__sentry | tests/apidocs/endpoints/integration_platform/test_sentry_app_installations.py | {
"start": 291,
"end": 1231
} | class ____(APIDocsTestCase):
def setUp(self) -> None:
self.user = self.create_user("foo@example.com")
self.org = self.create_organization(name="Jessla", owner=None)
self.create_member(user=self.user, organization=self.org, role="owner")
self.sentry_app = self.create_sentry_app(
... | SentryAppInstallationDocsTest |
python | charliermarsh__ruff | crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/class_definition.py | {
"start": 497,
"end": 527
} | class ____((Aaaa)):
...
| Test |
python | django__django | tests/auth_tests/test_login.py | {
"start": 147,
"end": 1056
} | class ____(TestCase):
@classmethod
def setUpTestData(cls):
cls.user = User.objects.create_user(username="testuser", password="password")
def setUp(self):
self.request = HttpRequest()
self.request.session = self.client.session
def test_user_login(self):
auth.login(self.r... | TestLogin |
python | getsentry__sentry | src/sentry/issues/endpoints/organization_group_search_view_visit.py | {
"start": 716,
"end": 1705
} | class ____(OrganizationEndpoint):
publish_status = {
"POST": ApiPublishStatus.PRIVATE,
}
owner = ApiOwner.ISSUES
permission_classes = (MemberPermission,)
def post(self, request: Request, organization: Organization, view_id: str) -> Response:
"""
Update the last_visited times... | OrganizationGroupSearchViewVisitEndpoint |
python | PrefectHQ__prefect | src/integrations/prefect-aws/prefect_aws/observers/ecs.py | {
"start": 2622,
"end": 3050
} | class ____:
def __init__(self, *statuses: EcsTaskLastStatus):
self.statuses = statuses
def is_match(self, last_status: EcsTaskLastStatus) -> bool:
return not self.statuses or last_status in self.statuses
HandlerWithFilters = NamedTuple(
"HandlerWithFilters",
[
("handler", Unio... | LastStatusFilter |
python | tensorflow__tensorflow | tensorflow/python/training/basic_session_run_hooks_test.py | {
"start": 35825,
"end": 37629
} | class ____(test.TestCase):
def setUp(self):
self.model_dir = tempfile.mkdtemp()
self.graph = ops.Graph()
with self.graph.as_default():
self.scaffold = monitored_session.Scaffold()
with variable_scope.variable_scope('foo', use_resource=True):
self.global_step = training_util.get_or_cre... | ResourceCheckpointSaverHookTest |
python | django__django | tests/admin_views/tests.py | {
"start": 297094,
"end": 308491
} | class ____(AdminFieldExtractionMixin, TestCase):
@classmethod
def setUpTestData(cls):
cls.superuser = User.objects.create_superuser(
username="super", password="secret", email="super@example.com"
)
def setUp(self):
self.client.force_login(self.superuser)
def test_re... | ReadonlyTest |
python | dask__dask | dask/tests/test_expr.py | {
"start": 618,
"end": 2306
} | class ____(Expr):
called_cached_property = False
_parameters = ["foo", "bar"]
@property
def baz(self):
return self.foo + self.bar
@functools.cached_property
def cached_property(self):
if MyExprCachedProperty.called_cached_property:
raise RuntimeError("No!")
... | MyExprCachedProperty |
python | kamyu104__LeetCode-Solutions | Python/base-7.py | {
"start": 306,
"end": 613
} | class ____(object):
def convertToBase7(self, num):
"""
:type num: int
:rtype: str
"""
if num < 0:
return '-' + self.convertToBase7(-num)
if num < 7:
return str(num)
return self.convertToBase7(num // 7) + str(num % 7)
| Solution2 |
python | tensorflow__tensorflow | tensorflow/python/keras/layers/advanced_activations.py | {
"start": 8717,
"end": 10985
} | class ____(Layer):
"""Softmax activation function.
Example without mask:
>>> inp = np.asarray([1., 2., 1.])
>>> layer = tf.keras.layers.Softmax()
>>> layer(inp).numpy()
array([0.21194157, 0.5761169 , 0.21194157], dtype=float32)
>>> mask = np.asarray([True, False, True], dtype=bool)
>>> layer(inp, mask... | Softmax |
python | has2k1__plotnine | plotnine/scales/limits.py | {
"start": 3144,
"end": 3496
} | class ____(_lim):
"""
Set y-axis limits
Parameters
----------
*limits :
Min and max limits. Must be of size 2.
You can also pass two values e.g
`ylim(40, 100)`
Notes
-----
If the 2nd value of `limits` is less than
the first, a reversed scale will be created.... | ylim |
python | dagster-io__dagster | python_modules/dagster/dagster/components/resolved/base.py | {
"start": 1148,
"end": 8986
} | class ____:
"""Base class for making a class resolvable from yaml.
This framework is designed to allow complex nested objects to be resolved
from yaml documents. This allows for a single class to be instantiated from
either yaml or python without limiting the types of fields that can exist on
the p... | Resolvable |
python | great-expectations__great_expectations | great_expectations/core/serializer.py | {
"start": 910,
"end": 1709
} | class ____(abc.ABC):
"""Serializer interface.
Note: When mypy coverage is enhanced further, this Abstract class can be replaced with a Protocol.
""" # noqa: E501 # FIXME CoP
def __init__(self, schema: Schema) -> None:
"""
Args:
schema: Marshmallow schema defining raw seria... | AbstractConfigSerializer |
python | ray-project__ray | python/ray/train/v2/tests/util.py | {
"start": 3907,
"end": 4402
} | class ____(FailurePolicy):
def __init__(self, failure_config):
self._decision_queue = []
super().__init__(failure_config)
def make_decision(
self, training_failed_error: TrainingFailedError
) -> FailureDecision:
if self._decision_queue:
return self._decision_que... | MockFailurePolicy |
python | ray-project__ray | python/ray/serve/_private/utils.py | {
"start": 3003,
"end": 8384
} | class ____:
"""Group of custom encoders for common types that's not handled by FastAPI."""
@staticmethod
def encode_np_array(obj):
assert isinstance(obj, np.ndarray)
if obj.dtype.kind == "f": # floats
obj = obj.astype(float)
if obj.dtype.kind in {"i", "u"}: # signed an... | _ServeCustomEncoders |
python | sympy__sympy | sympy/functions/special/elliptic_integrals.py | {
"start": 5661,
"end": 9806
} | class ____(DefinedFunction):
r"""
Called with two arguments $z$ and $m$, evaluates the
incomplete elliptic integral of the second kind, defined by
.. math:: E\left(z\middle| m\right) = \int_0^z \sqrt{1 - m \sin^2 t} dt
Called with a single argument $m$, evaluates the Legendre complete
elliptic... | elliptic_e |
python | dateutil__dateutil | src/dateutil/tz/tz.py | {
"start": 10691,
"end": 28028
} | class ____(_tzinfo):
"""
This is a ``tzinfo`` subclass that allows one to use the ``tzfile(5)``
format timezone files to extract current and historical zone information.
:param fileobj:
This can be an opened file stream or a file name that the time zone
information can be read from.
... | tzfile |
python | ray-project__ray | rllib/examples/envs/classes/multi_agent/footsies/game/constants.py | {
"start": 363,
"end": 560
} | class ____:
NONE: int = 0
LEFT: int = 1 << 0
RIGHT: int = 1 << 1
ATTACK: int = 1 << 2
LEFT_ATTACK: int = LEFT | ATTACK
RIGHT_ATTACK: int = RIGHT | ATTACK
@dataclass
| ActionBits |
python | spack__spack | var/spack/test_repos/spack_repo/builtin_mock/packages/trivial_pkg_with_valid_hash/package.py | {
"start": 217,
"end": 562
} | class ____(Package):
url = "http://www.unit-test-should-replace-this-url/trivial_install-1.0"
version(
"1.0",
sha256="6ae8a75555209fd6c44157c0aed8016e763ff435a19cf186f76863140143ff72",
expand=False,
)
hashed_content = "test content"
def install(self, spec, prefix):
... | TrivialPkgWithValidHash |
python | ansible__ansible | lib/ansible/module_utils/facts/virtual/dragonfly.py | {
"start": 779,
"end": 959
} | class ____(VirtualCollector):
# Note the _fact_class impl is actually the FreeBSDVirtual impl
_fact_class = FreeBSDVirtual
_platform = 'DragonFly'
| DragonFlyVirtualCollector |
python | PrefectHQ__prefect | src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py | {
"start": 979796,
"end": 980464
} | class ____(sgqlc.types.Type, Node):
"""
See source code for more info.
"""
__schema__ = graphql_schema
__field_names__ = (
"as_code_owner",
"database_id",
"pull_request",
"requested_reviewer",
)
as_code_owner = sgqlc.types.Field(
sgqlc.types.non_null(... | ReviewRequest |
python | Pylons__pyramid | tests/test_config/test_predicates.py | {
"start": 21566,
"end": 21957
} | class ____:
def __init__(self):
self.__text__ = 'custom predicate'
def classmethod_predicate(*args): # pragma: no cover
pass
classmethod_predicate.__text__ = 'classmethod predicate'
classmethod_predicate = classmethod(classmethod_predicate)
@classmethod
def classmethod_predic... | DummyCustomPredicate |
python | bokeh__bokeh | src/bokeh/models/formatters.py | {
"start": 10976,
"end": 11743
} | class ____(TickFormatter):
''' Display tick values from continuous ranges as powers
of some base.
Most often useful in conjunction with a ``LogTicker``.
'''
# explicit __init__ to support Init signatures
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **... | LogTickFormatter |
python | streamlit__streamlit | lib/tests/streamlit/components_test.py | {
"start": 13465,
"end": 25874
} | class ____(DeltaGeneratorTestCase):
"""Test invocation of a custom component object."""
def setUp(self):
super().setUp()
self.test_component = components.declare_component("test", url=URL)
def test_only_json_args(self):
"""Test that component with only json args is marshalled corre... | InvokeComponentTest |
python | milvus-io__pymilvus | pymilvus/exceptions.py | {
"start": 3461,
"end": 3548
} | class ____(MilvusException):
"""Raise when one field is invalid"""
| FieldTypeException |
python | doocs__leetcode | solution/2300-2399/2361.Minimum Costs Using the Train Line/Solution.py | {
"start": 0,
"end": 471
} | class ____:
def minimumCosts(
self, regular: List[int], express: List[int], expressCost: int
) -> List[int]:
n = len(regular)
f = [0] * (n + 1)
g = [inf] * (n + 1)
cost = [0] * n
for i, (a, b) in enumerate(zip(regular, express), 1):
f[i] = min(f[i - 1]... | Solution |
python | PrefectHQ__prefect | src/prefect/server/schemas/core.py | {
"start": 32903,
"end": 33527
} | class ____(TimeSeriesBaseModel, ORMBaseModel):
"""An ORM representation of log data."""
name: str = Field(default=..., description="The logger name.")
level: int = Field(default=..., description="The log level.")
message: str = Field(default=..., description="The log message.")
timestamp: DateTime ... | Log |
python | has2k1__plotnine | plotnine/scales/scale_color.py | {
"start": 13084,
"end": 13237
} | class ____(scale_color_cmap_d):
"""
Create color scales using Matplotlib colormaps
"""
_aesthetics = ["fill"]
@dataclass
| scale_fill_cmap_d |
python | huggingface__transformers | src/transformers/models/grounding_dino/image_processing_grounding_dino.py | {
"start": 2213,
"end": 2426
} | class ____(ExplicitEnum):
COCO_DETECTION = "coco_detection"
COCO_PANOPTIC = "coco_panoptic"
SUPPORTED_ANNOTATION_FORMATS = (AnnotationFormat.COCO_DETECTION, AnnotationFormat.COCO_PANOPTIC)
| AnnotationFormat |
python | spack__spack | lib/spack/spack/vendor/jinja2/nodes.py | {
"start": 20936,
"end": 22215
} | class ____(Expr):
"""A conditional expression (inline if expression). (``{{
foo if bar else baz }}``)
"""
fields = ("test", "expr1", "expr2")
test: Expr
expr1: Expr
expr2: t.Optional[Expr]
def as_const(self, eval_ctx: t.Optional[EvalContext] = None) -> t.Any:
eval_ctx = get_ev... | CondExpr |
python | spyder-ide__spyder | spyder/plugins/ipythonconsole/widgets/control.py | {
"start": 3881,
"end": 5264
} | class ____(QTextEdit, BaseEditMixin):
"""
Subclass of QTextEdit with features from Spyder's mixins.BaseEditMixin to
use as the paging widget for IPython widgets
"""
QT_CLASS = QTextEdit
sig_visibility_changed = Signal(bool)
sig_show_find_widget_requested = Signal()
sig_focus_changed = Si... | PageControlWidget |
python | plotly__plotly.py | plotly/graph_objs/scatter/legendgrouptitle/_font.py | {
"start": 233,
"end": 9927
} | class ____(_BaseTraceHierarchyType):
_parent_path_str = "scatter.legendgrouptitle"
_path_str = "scatter.legendgrouptitle.font"
_valid_props = {
"color",
"family",
"lineposition",
"shadow",
"size",
"style",
"textcase",
"variant",
"weight... | Font |
python | jina-ai__jina | tests/unit/orchestrate/deployments/test_deployments.py | {
"start": 3007,
"end": 3061
} | class ____(MyDummyExecutor):
pass
| ChildDummyExecutor |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 561804,
"end": 562157
} | class ____(sgqlc.types.Type):
"""Autogenerated return type of DeleteRepositoryRuleset"""
__schema__ = github_schema
__field_names__ = ("client_mutation_id",)
client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId")
"""A unique identifier for the client performing the mutation... | DeleteRepositoryRulesetPayload |
python | walkccc__LeetCode | solutions/1682. Longest Palindromic Subsequence II/1682-2.py | {
"start": 0,
"end": 575
} | class ____:
def longestPalindromeSubseq(self, s: str) -> int:
n = len(s)
# dp[i][j][k] := the length of LPS(s[i..j]), where the previous letter is
# ('a' + k).
dp = [[[0] * 27 for _ in range(n)] for _ in range(n)]
for d in range(1, n):
for i in range(n - d):
for k in range(27):
... | Solution |
python | sympy__sympy | sympy/matrices/expressions/diagonal.py | {
"start": 4183,
"end": 6328
} | class ____(MatrixExpr):
"""
Turn a vector into a diagonal matrix.
"""
def __new__(cls, vector):
vector = _sympify(vector)
obj = MatrixExpr.__new__(cls, vector)
shape = vector.shape
dim = shape[1] if shape[0] == 1 else shape[0]
if vector.shape[0] != 1:
... | DiagMatrix |
python | nedbat__coveragepy | tests/test_arcs.py | {
"start": 65472,
"end": 66186
} | class ____(CoverageTest):
"""Tools like Jinja run code credited to non-Python files."""
def test_non_python_file(self) -> None:
# Make a code object with branches, and claim it came from an HTML file.
# With sysmon, this used to fail trying to parse the source. #2077
self.make_file("hel... | NonPythonFileTest |
python | ray-project__ray | python/ray/serve/llm/__init__.py | {
"start": 1236,
"end": 1398
} | class ____(_CloudMirrorConfig):
"""The configuration for mirroring an LLM model from cloud storage."""
pass
@PublicAPI(stability="alpha")
| CloudMirrorConfig |
python | jina-ai__jina | jina/clients/http.py | {
"start": 266,
"end": 877
} | class ____(
HTTPBaseClient, PostMixin, ProfileMixin, MutateMixin, HealthCheckMixin
):
"""A client connecting to a Gateway using gRPC protocol.
Instantiate this class through the :meth:`jina.Client` convenience method.
EXAMPLE USAGE
.. code-block:: python
from jina import Client
f... | HTTPClient |
python | yaml__pyyaml | lib/yaml/nodes.py | {
"start": 1385,
"end": 1440
} | class ____(CollectionNode):
id = 'mapping'
| MappingNode |
python | dagster-io__dagster | python_modules/libraries/dagster-databricks/dagster_databricks/components/databricks_asset_bundle/configs.py | {
"start": 6042,
"end": 7860
} | class ____(DatabricksBaseTask[jobs.ConditionTask]):
@property
def task_type(self) -> str:
return "condition"
@property
def task_config_metadata(self) -> Mapping[str, Any]:
task_config_metadata = {}
condition_config = self.task_config["condition_task"]
task_config_metadat... | DatabricksConditionTask |
python | apache__airflow | task-sdk/tests/task_sdk/definitions/test_connection.py | {
"start": 7480,
"end": 9998
} | class ____:
def test_get_connection_secrets_backend(self, mock_supervisor_comms, tmp_path):
"""Tests getting a connection from secrets backend."""
path = tmp_path / "conn.env"
path.write_text("CONN_A=mysql://host_a")
with conf_vars(
{
(
... | TestConnectionsFromSecrets |
python | pennersr__django-allauth | allauth/socialaccount/providers/linkedin_oauth2/views.py | {
"start": 228,
"end": 1866
} | class ____(OAuth2Adapter):
provider_id = "linkedin_oauth2"
access_token_url = "https://www.linkedin.com/oauth/v2/accessToken" # nosec
authorize_url = "https://www.linkedin.com/oauth/v2/authorization"
profile_url = "https://api.linkedin.com/v2/me"
email_url = "https://api.linkedin.com/v2/emailAddres... | LinkedInOAuth2Adapter |
python | huggingface__transformers | src/transformers/models/fnet/modeling_fnet.py | {
"start": 19902,
"end": 23874
} | class ____(FNetPreTrainedModel):
_tied_weights_keys = {
"cls.predictions.decoder.bias": "cls.predictions.bias",
"cls.predictions.decoder.weight": "fnet.embeddings.word_embeddings.weight",
}
def __init__(self, config):
super().__init__(config)
self.fnet = FNetModel(config)
... | FNetForPreTraining |
python | getsentry__sentry | src/sentry/services/eventstore/snuba/backend.py | {
"start": 1639,
"end": 30485
} | class ____(EventStorage):
"""
Eventstore backend backed by Snuba
"""
def get_events_snql(
self,
organization_id: int,
group_id: int,
start: datetime | None,
end: datetime | None,
conditions: Sequence[Condition],
orderby: Sequence[str],
lim... | SnubaEventStorage |
python | conda__conda | tests/plugins/test_solvers.py | {
"start": 783,
"end": 885
} | class ____:
@plugins.hookimpl
def conda_solvers(self):
yield classic_solver
| SolverPlugin |
python | run-llama__llama_index | llama-index-integrations/voice_agents/llama-index-voice-agents-openai/llama_index/voice_agents/openai/types.py | {
"start": 3019,
"end": 3118
} | class ____(BaseVoiceAgentEvent):
delta: Union[str, bytes]
item_id: str
| ConversationDeltaEvent |
python | bottlepy__bottle | bottle.py | {
"start": 99825,
"end": 103358
} | class ____:
""" This class manages a list of search paths and helps to find and open
application-bound resources (files).
:param base: default value for :meth:`add_path` calls.
:param opener: callable used to open resources.
:param cachemode: controls which lookups are cached. One o... | ResourceManager |
python | pypa__pip | src/pip/_vendor/urllib3/poolmanager.py | {
"start": 4791,
"end": 15549
} | class ____(RequestMethods):
"""
Allows for arbitrary requests while transparently keeping track of
necessary connection pools for you.
:param num_pools:
Number of connection pools to cache before discarding the least
recently used pool.
:param headers:
Headers to include wi... | PoolManager |
python | joerick__pyinstrument | pyinstrument/renderers/html.py | {
"start": 4120,
"end": 4956
} | class ____(FrameRenderer):
"""
The HTML takes a special form of JSON-encoded session, which includes
an unprocessed frame tree rather than a list of frame records. This
reduces the amount of parsing code that must be included in the
Typescript renderer.
"""
output_file_extension = "json"
... | JSONForHTMLRenderer |
python | bokeh__bokeh | src/bokeh/models/annotations/legends.py | {
"start": 29719,
"end": 31584
} | class ____(BaseBar):
""" ``SizeBar`` is a visual indicator that allows you to gauge the size of radial glyphs,
like ``Circle`` or ``Ngon``, which essentially allows you to add a third dimension to
2D scatter plots.
"""
# explicit __init__ to support Init signatures
def __init__(self, *args: An... | SizeBar |
python | apache__airflow | airflow-core/tests/unit/executors/test_local_executor.py | {
"start": 1606,
"end": 7731
} | class ____:
TEST_SUCCESS_COMMANDS = 5
def test_sentry_integration(self):
assert not LocalExecutor.sentry_integration
def test_is_local_default_value(self):
assert LocalExecutor.is_local
def test_serve_logs_default_value(self):
assert LocalExecutor.serve_logs
@skip_spawn_m... | TestLocalExecutor |
python | davidhalter__jedi | jedi/api/keywords.py | {
"start": 336,
"end": 1192
} | class ____(AbstractArbitraryName):
api_type = 'keyword'
def py__doc__(self):
return imitate_pydoc(self.string_name)
def imitate_pydoc(string):
"""
It's not possible to get the pydoc's without starting the annoying pager
stuff.
"""
if pydoc_topics is None:
return ''
h ... | KeywordName |
python | dask__dask | dask/dataframe/dask_expr/_expr.py | {
"start": 93250,
"end": 93326
} | class ____(Unaryop):
operation = operator.pos
_operator_repr = "+"
| Pos |
python | xlwings__xlwings | xlwings/constants.py | {
"start": 59335,
"end": 61882
} | class ____:
xlAddIn = 18 # from enum XlFileFormat
xlAddIn8 = 18 # from enum XlFileFormat
xlCSV = 6 # from enum XlFileFormat
xlCSVMSDOS = 24 # from enum XlFileFormat
xlCSVMac = 22 # from enum XlFileFormat
xlCSVWindows = 23 # from enum XlFileFormat
xlCurrentPlatformText = -4158 # from e... | FileFormat |
python | astropy__astropy | astropy/samp/web_profile.py | {
"start": 4228,
"end": 5739
} | class ____(ThreadingXMLRPCServer):
"""
XMLRPC server supporting the SAMP Web Profile.
"""
def __init__(
self,
addr,
log=None,
requestHandler=WebProfileRequestHandler,
logRequests=True,
allow_none=True,
encoding=None,
):
self.clients = ... | WebProfileXMLRPCServer |
python | getsentry__sentry | src/sentry/workflow_engine/processors/detector.py | {
"start": 9333,
"end": 18689
} | class ____(NamedTuple):
events_with_occurrences: list[tuple[GroupEvent, int]]
error_events: list[GroupEvent]
events_missing_detectors: list[GroupEvent]
def _split_events_by_occurrence(
event_list: list[GroupEvent],
) -> _SplitEvents:
events_with_occurrences: list[tuple[GroupEvent, int]] = []
e... | _SplitEvents |
python | dagster-io__dagster | python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/generated/sources.py | {
"start": 33747,
"end": 34283
} | class ____(GeneratedAirbyteSource):
@public
def __init__(self, name: str, api_key: str):
"""Airbyte Source for Persistiq.
Documentation can be found at https://docs.airbyte.com/integrations/sources/persistiq
Args:
name (str): The name of the destination.
api_key... | PersistiqSource |
python | huggingface__transformers | src/transformers/models/whisper/modeling_whisper.py | {
"start": 23996,
"end": 30116
} | class ____(WhisperPreTrainedModel):
"""
Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a
[`WhisperEncoderLayer`].
Args:
config: WhisperConfig
"""
def __init__(self, config: WhisperConfig):
super().__init__(config)
self.dro... | WhisperEncoder |
python | airbytehq__airbyte | airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/test/steps/python_connectors.py | {
"start": 8129,
"end": 8923
} | class ____(PytestStep):
"""A step to run the connector unit tests with Pytest."""
title = "Unit tests"
test_directory_name = "unit_tests"
common_test_dependencies = ["pytest-cov==4.1.0"]
MINIMUM_COVERAGE_FOR_CERTIFIED_CONNECTORS = 90
@property
def default_params(self) -> STEP_PARAMS:
... | UnitTests |
python | huggingface__transformers | src/transformers/models/vitpose_backbone/modeling_vitpose_backbone.py | {
"start": 12845,
"end": 13863
} | class ____(nn.Module):
def __init__(self, config: VitPoseBackboneConfig):
super().__init__()
self.config = config
self.layer = nn.ModuleList([VitPoseBackboneLayer(config) for _ in range(config.num_hidden_layers)])
self.gradient_checkpointing = False
# Ignore copy
def forward... | VitPoseBackboneEncoder |
python | sympy__sympy | sympy/logic/boolalg.py | {
"start": 36165,
"end": 36804
} | class ____(BooleanFunction):
"""
Logical XNOR function.
Returns False if an odd number of the arguments are True and the rest are
False.
Returns True if an even number of the arguments are True and the rest are
False.
Examples
========
>>> from sympy.logic.boolalg import Xnor
... | Xnor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.