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 | dagster-io__dagster | python_modules/libraries/dagster-dask/dagster_dask/executor.py | {
"start": 5921,
"end": 12402
} | class ____(Executor):
def __init__(self, cluster_type, cluster_configuration):
self.cluster_type = check.opt_str_param(cluster_type, "cluster_type", default="local")
self.cluster_configuration = check.opt_dict_param(
cluster_configuration, "cluster_configuration"
)
@property... | DaskExecutor |
python | cherrypy__cherrypy | cherrypy/_cprequest.py | {
"start": 35175,
"end": 35679
} | class ____(object):
"""A delayed UUID4 string maker."""
def __str__(self):
"""Return UUID4 and keep it for future calls."""
return str(self.uuid4)
@property
def uuid4(self):
"""Provide unique id on per-request basis using UUID4.
It's evaluated lazily on render.
... | LazyUUID4 |
python | dagster-io__dagster | python_modules/dagster/dagster/_core/definitions/partitions/subset/time_window.py | {
"start": 2129,
"end": 3618
} | class ____(NamedTupleSerializer):
# TimeWindowPartitionsSubsets have custom logic to delay calculating num_partitions until it
# is needed to improve performance. When serializing, we want to serialize the number of
# partitions, so we force calculation.
def before_pack(self, value: "TimeWindowPartition... | TimeWindowPartitionsSubsetSerializer |
python | django__django | tests/gis_tests/distapp/models.py | {
"start": 1002,
"end": 1157
} | class ____(NamedModel):
"Model for a few South Texas ZIP codes."
poly = models.PolygonField(srid=32140, null=gisfield_may_be_null)
| SouthTexasZipcode |
python | getsentry__sentry | src/sentry/hybridcloud/services/control_organization_provisioning/service.py | {
"start": 570,
"end": 4652
} | class ____(RpcService):
key = "control_org_provisioning"
local_mode = SiloMode.CONTROL
@abstractmethod
@rpc_method
def provision_organization(
self, *, region_name: str, org_provision_args: OrganizationProvisioningOptions
) -> RpcOrganizationSlugReservation:
"""
Provisio... | ControlOrganizationProvisioningRpcService |
python | langchain-ai__langchain | libs/langchain_v1/langchain/chat_models/base.py | {
"start": 21579,
"end": 36525
} | class ____(Runnable[LanguageModelInput, Any]):
def __init__(
self,
*,
default_config: dict | None = None,
configurable_fields: Literal["any"] | list[str] | tuple[str, ...] = "any",
config_prefix: str = "",
queued_declarative_operations: Sequence[tuple[str, tuple, dict... | _ConfigurableModel |
python | pyqtgraph__pyqtgraph | pyqtgraph/widgets/RemoteGraphicsView.py | {
"start": 3571,
"end": 4153
} | class ____(QtGui.QEnterEvent):
@staticmethod
def get_state(obj):
lpos = obj.position() if hasattr(obj, 'position') else obj.localPos()
wpos = obj.scenePosition() if hasattr(obj, 'scenePosition') else obj.windowPos()
gpos = obj.globalPosition() if hasattr(obj, 'globalPosition') else obj.s... | EnterEvent |
python | dagster-io__dagster | python_modules/dagster/dagster/_grpc/types.py | {
"start": 28001,
"end": 28267
} | class ____(NamedTuple("_CanCancelExecutionRequest", [("run_id", str)])):
def __new__(cls, run_id: str):
return super().__new__(
cls,
run_id=check.str_param(run_id, "run_id"),
)
@whitelist_for_serdes
| CanCancelExecutionRequest |
python | python-openxml__python-docx | src/docx/oxml/shape.py | {
"start": 4226,
"end": 4368
} | class ____(BaseOxmlElement):
"""``<pic:cNvPicPr>`` element, specifies picture locking and resize behaviors."""
| CT_NonVisualPictureProperties |
python | pypa__warehouse | warehouse/sponsors/models.py | {
"start": 195,
"end": 1893
} | class ____(db.Model):
__tablename__ = "sponsors"
__repr__ = make_repr("name")
name: Mapped[str]
service: Mapped[str | None]
activity_markdown: Mapped[str | None]
link_url: Mapped[str]
color_logo_url: Mapped[str]
white_logo_url: Mapped[str | None]
# control flags
# TODO: These ... | Sponsor |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-genesys/source_genesys/source.py | {
"start": 425,
"end": 1901
} | class ____(HttpStream, ABC):
page_size = 500
@property
def url_base(self):
if self._api_base_url is not None:
return self._api_base_url + "/api/v2/"
return None
def __init__(self, api_base_url, *args, **kwargs):
self._api_base_url = api_base_url
super().__in... | GenesysStream |
python | mlflow__mlflow | tests/pyfunc/sample_code/streamable_model_code.py | {
"start": 76,
"end": 362
} | class ____(PythonModel):
def __init__(self):
pass
def predict(self, context, model_input, params=None):
pass
def predict_stream(self, context, model_input, params=None):
yield "test1"
yield "test2"
set_model(StreamableModel())
| StreamableModel |
python | kamyu104__LeetCode-Solutions | Python/number-of-atoms.py | {
"start": 60,
"end": 790
} | class ____(object):
def countOfAtoms(self, formula):
"""
:type formula: str
:rtype: str
"""
parse = re.findall(r"([A-Z][a-z]*)(\d*)|(\()|(\))(\d*)", formula)
stk = [collections.Counter()]
for name, m1, left_open, right_open, m2 in parse:
if name:
... | Solution |
python | streamlit__streamlit | e2e_playwright/st_help.py | {
"start": 3259,
"end": 3659
} | class ____:
"""My docstring."""
def __init__(self):
self.my_var_1 = 123
def my_func_1(self, a: int, b: bool = False) -> None:
"""Func with doc."""
def my_func_2(self):
# Func without doc.
pass
st.container(key="help_mixed_docs").help(FooWithMixedDocs())
# Create a ... | FooWithMixedDocs |
python | ray-project__ray | python/ray/data/_internal/iterator/stream_split_iterator.py | {
"start": 4448,
"end": 11021
} | class ____:
"""Coordinator actor for routing blocks to output splits.
This actor runs a streaming executor locally on its main thread. Clients can
retrieve results via actor calls running on other threads.
"""
def __init__(
self,
dataset_wrapper: _DatasetWrapper,
n: int,
... | SplitCoordinator |
python | viewflow__viewflow | viewflow/contrib/auth.py | {
"start": 4657,
"end": 15773
} | class ____(Viewset):
"""
Class-based URL configuration for `django.contrib.auth`.
This viewset provides URL patterns for user authentication, including login,
logout, and password management views.
.. code-block:: python
urlpatterns = [
path('accounts/', AuthViewset(
... | AuthViewset |
python | walkccc__LeetCode | solutions/1080. Insufficient Nodes in Root to Leaf Paths/1080.py | {
"start": 0,
"end": 444
} | class ____:
def sufficientSubset(
self,
root: TreeNode | None,
limit: int
) -> TreeNode | None:
if not root:
return None
if not root.left and not root.right:
return None if root.val < limit else root
root.left = self.sufficientSubset(root.left, limit - root.val)
root.ri... | Solution |
python | psf__black | tests/data/cases/preview_long_strings__regression.py | {
"start": 27187,
"end": 28015
} | class ____:
def foo():
some_func_call(
"xx {xxxxxxxxxxx}/xxxxxxxxxxx.xxx xxxx.xxx && xxxxxx -x "
"xxxx, ('xxxxxxx xxxxxx xxxx, xxxx') xxxxxx_xxxxx xxxxxx xxxx; "
"xxxx.xxxx_xxxxxx(['xxxx.xxx'], xxxx.xxxxxxx().xxxxxxxxxx)\" ",
None,
("xxxxxxxxxxx",)... | A |
python | kamyu104__LeetCode-Solutions | Python/smallest-missing-integer-greater-than-sequential-prefix-sum.py | {
"start": 42,
"end": 431
} | class ____(object):
def missingInteger(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
total = nums[0]
for i in xrange(1, len(nums)):
if nums[i] != nums[i-1]+1:
break
total += nums[i]
lookup = set(nums)
wh... | Solution |
python | networkx__networkx | networkx/algorithms/isomorphism/tests/test_ismags.py | {
"start": 15543,
"end": 19400
} | class ____:
def test_mcis(self):
# Example graphs from DOI: 10.1002/spe.588
graph1 = nx.Graph()
graph1.add_edges_from([(1, 2), (2, 3), (2, 4), (3, 4), (4, 5)])
graph1.nodes[1]["color"] = 0
graph2 = nx.Graph()
graph2.add_edges_from(
[(1, 2), (2, 3), (2, 4)... | TestLargestCommonSubgraph |
python | huggingface__transformers | src/transformers/models/granitemoehybrid/modular_granitemoehybrid.py | {
"start": 3957,
"end": 4096
} | class ____(GraniteMoeSharedMLP):
def __init__(self, config: GraniteMoeHybridConfig):
super().__init__(config)
| GraniteMoeHybridMLP |
python | apache__airflow | providers/google/tests/unit/google/cloud/hooks/test_dataflow.py | {
"start": 4667,
"end": 6630
} | class ____:
def test_support_project_id_parameter(self):
mock_instance = mock.MagicMock()
class FixtureFallback:
@_fallback_to_project_id_from_variables
def test_fn(self, *args, **kwargs):
mock_instance(*args, **kwargs)
FixtureFallback().test_fn(proj... | TestFallbackToVariables |
python | readthedocs__readthedocs.org | readthedocs/organizations/managers.py | {
"start": 1324,
"end": 1816
} | class ____(models.Manager):
"""Manager for queries on team members."""
def sorted(self):
"""
Return sorted list of members and invites.
Return list of members and invites sorted by members first, and null
members (invites) last.
"""
return (
self.get... | TeamMemberManager |
python | tensorflow__tensorflow | tensorflow/python/autograph/pyct/testing/codegen.py | {
"start": 888,
"end": 1118
} | class ____(object):
sample_map = None
def sample(self):
nodes, magnitudes = zip(*self.sample_map.items())
return np.random.choice(
nodes, p=np.array(magnitudes, dtype='float32') / np.sum(magnitudes))
| NodeSampler |
python | google__jax | jax/_src/pallas/mosaic_gpu/core.py | {
"start": 7533,
"end": 12796
} | class ____(enum.Enum):
"""Thread semantics for a primitives at the Pallas user-level."""
Warp = enum.auto()
Warpgroup = enum.auto()
# Convenience constants for (lowering, primitive) thread semantics pairs.
LANExWG_SEMANTICS = (
mgpu.LoweringSemantics.Lane, PrimitiveSemantics.Warpgroup)
LANExWARP_SEMANTICS ... | PrimitiveSemantics |
python | great-expectations__great_expectations | great_expectations/core/metric_domain_types.py | {
"start": 103,
"end": 614
} | class ____(enum.Enum):
"""Enum type, whose members signify the data "Domain", on which a metric can be computed.
A wide variety of "Domain" types can be defined with applicable metrics associated with their respective "Domain"
types. The "Domain" types currently in use (`TABLE`, `COLUMN`, `COLUMN_PAIR`, a... | MetricDomainTypes |
python | microsoft__pyright | packages/pyright-internal/src/tests/samples/typeNarrowingLiteralMember1.py | {
"start": 2568,
"end": 2644
} | class ____:
@property
def type(self) -> Literal[0]:
return 0
| E |
python | apache__airflow | task-sdk/src/airflow/sdk/exceptions.py | {
"start": 4551,
"end": 5027
} | class ____(AirflowException):
"""
Raise when the task should be re-scheduled at a later time.
:param reschedule_date: The date when the task should be rescheduled
"""
def __init__(self, reschedule_date):
super().__init__()
self.reschedule_date = reschedule_date
def serialize(s... | AirflowRescheduleException |
python | falconry__falcon | tests/asgi/test_middleware_asgi.py | {
"start": 31,
"end": 134
} | class ____:
async def process_request(self, req, resp):
pass
| MiddlewareIncompatibleWithWSGI_A |
python | sqlalchemy__sqlalchemy | test/sql/test_syntax_extensions.py | {
"start": 2728,
"end": 2984
} | class ____(SyntaxExtension, ClauseElement):
_traverse_internals = []
def apply_to_insert(self, insert_stmt):
insert_stmt.apply_syntax_extension_point(
lambda existing: [self],
"post_values",
)
| PostValuesClause |
python | pyca__cryptography | tests/x509/test_ocsp.py | {
"start": 6738,
"end": 12627
} | class ____:
def test_add_cert_twice(self):
cert, issuer = _cert_and_issuer()
builder = ocsp.OCSPRequestBuilder()
builder = builder.add_certificate(cert, issuer, hashes.SHA1())
# Fails calling a second time
with pytest.raises(ValueError):
builder.add_certificate(ce... | TestOCSPRequestBuilder |
python | numba__numba | numba/core/typing/collections.py | {
"start": 3136,
"end": 4025
} | class ____(AttributeTemplate):
key = types.NamedTupleClass
def resolve___call__(self, classty):
"""
Resolve the named tuple constructor, aka the class's __call__ method.
"""
instance_class = classty.instance_class
pysig = utils.pysignature(instance_class)
def ty... | NamedTupleClassAttribute |
python | ansible__ansible | test/units/galaxy/test_collection_install.py | {
"start": 1006,
"end": 48759
} | class ____():
def __init__(self):
self.candidates = []
def func_wrapper(self, func):
def run(*args, **kwargs):
self.candidates = func(*args, **kwargs)
return self.candidates
return run
def call_galaxy_cli(args):
orig = co.GlobalCLIArgs._Singleton__instance
... | RequirementCandidates |
python | dagster-io__dagster | python_modules/dagster/dagster/_utils/container.py | {
"start": 4432,
"end": 13515
} | class ____(TypedDict):
num_allocated_cores: Optional[int]
cpu_usage: Optional[float] # CPU usage in seconds
cpu_cfs_quota_us: Optional[float] # CPU quota per period in microseconds
cpu_cfs_period_us: Optional[float] # CPU period in microseconds
memory_usage: Optional[float] # Memory usage in byt... | ContainerUtilizationMetrics |
python | EpistasisLab__tpot | tpot/builtin_modules/arithmetictransformer.py | {
"start": 8744,
"end": 9435
} | class ____(TransformerMixin, BaseEstimator):
def __init__(self):
"""
A transformer that takes checks if all elements in a row are not equal.
"""
pass
def fit(self, X, y=None):
return self
def transform(self, X):
transformed_X = np.array(self.transform_hel... | NETransformer |
python | getsentry__sentry | tests/sentry/api/bases/test_project.py | {
"start": 1243,
"end": 12359
} | class ____(ProjectPermissionBase):
def test_regular_user(self) -> None:
user = self.create_user(is_superuser=False)
assert not self.has_object_perm("GET", self.project, user=user)
assert not self.has_object_perm("POST", self.project, user=user)
assert not self.has_object_perm("PUT", ... | ProjectPermissionTest |
python | gevent__gevent | src/greentest/3.11/test_ftplib.py | {
"start": 9037,
"end": 16612
} | class ____(asyncore.dispatcher, threading.Thread):
handler = DummyFTPHandler
def __init__(self, address, af=socket.AF_INET, encoding=DEFAULT_ENCODING):
threading.Thread.__init__(self)
asyncore.dispatcher.__init__(self)
self.daemon = True
self.create_socket(af, socket.SOCK_STREA... | DummyFTPServer |
python | huggingface__transformers | tests/models/deepseek_v3/test_modeling_deepseek_v3.py | {
"start": 15233,
"end": 18516
} | class ____(unittest.TestCase):
def tearDown(self):
# See LlamaIntegrationTest.tearDown(). Can be removed once LlamaIntegrationTest.tearDown() is removed.
cleanup(torch_device, gc_collect=False)
@slow
@require_torch_accelerator
@pytest.mark.torch_compile_test
@require_read_token
... | DeepseekV3IntegrationTest |
python | modin-project__modin | modin/tests/pandas/test_io.py | {
"start": 109724,
"end": 110322
} | class ____:
@pytest.mark.skip(reason="No clipboard in CI")
def test_read_clipboard(self):
setup_clipboard()
eval_io(fn_name="read_clipboard")
@pytest.mark.skip(reason="No clipboard in CI")
def test_to_clipboard(self):
modin_df, pandas_df = create_test_dfs(TEST_DATA)
mo... | TestClipboard |
python | scikit-learn__scikit-learn | sklearn/externals/array_api_compat/common/_typing.py | {
"start": 2762,
"end": 2868
} | class ____(TypedDict):
bool: DType
# `__array_namespace_info__.dtypes(kind="signed integer")`
| DTypesBool |
python | huggingface__transformers | src/transformers/models/bros/modeling_bros.py | {
"start": 1525,
"end": 2363
} | class ____(ModelOutput):
r"""
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Classification loss.
initial_token_logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.num_labels)`):
Classification scores for entity initial toke... | BrosSpadeOutput |
python | jazzband__django-waffle | test_app/models.py | {
"start": 809,
"end": 2408
} | class ____(AbstractUserFlag):
FLAG_COMPANIES_CACHE_KEY = 'FLAG_COMPANIES_CACHE_KEY'
FLAG_COMPANIES_CACHE_KEY_DEFAULT = 'flag:%s:companies'
companies = models.ManyToManyField(
Company,
blank=True,
help_text=_('Activate this flag for these companies.'),
)
def get_flush_keys(s... | CompanyAwareFlag |
python | celery__celery | celery/worker/consumer/consumer.py | {
"start": 4215,
"end": 30773
} | class ____:
"""Consumer blueprint."""
Strategies = dict
#: Optional callback called the first time the worker
#: is ready to receive tasks.
init_callback = None
#: The current worker pool instance.
pool = None
#: A timer used for high-priority internal tasks, such
#: as sending h... | Consumer |
python | mitmproxy__pdoc | test/testdata/visibility.py | {
"start": 127,
"end": 859
} | class ____:
# Not shown because no docstring.
pass
def public_func_marked_private():
"""
This is a public method that's not shown because it's marked as @private.
"""
def _protected_func():
"""
This is a protected method that's not shown because its name starts with _.
"""
def __pr... | Undocumented |
python | encode__django-rest-framework | tests/test_middleware.py | {
"start": 2691,
"end": 3946
} | class ____(APITestCase):
@override_settings(MIDDLEWARE=('tests.test_middleware.RequestUserMiddleware',))
def test_middleware_can_access_user_when_processing_response(self):
user = User.objects.create_user('john', 'john@example.com', 'password')
key = 'abcd1234'
Token.objects.create(key=... | TestMiddleware |
python | walkccc__LeetCode | solutions/1827. Minimum Operations to Make the Array Increasing/1827.py | {
"start": 0,
"end": 198
} | class ____:
def minOperations(self, nums: list[int]) -> int:
ans = 0
last = 0
for num in nums:
ans += max(0, last - num + 1)
last = max(num, last + 1)
return ans
| Solution |
python | huggingface__transformers | tests/utils/test_modeling_utils.py | {
"start": 125497,
"end": 130968
} | class ____(unittest.TestCase):
@unittest.skip("Just a bit annoying")
def test_error_no_sdpa_available(self):
with self.assertRaises(ValueError) as cm:
_ = AutoModel.from_pretrained("hf-tiny-model-private/tiny-random-MCTCTModel", attn_implementation="sdpa")
self.assertTrue(
... | TestAttentionImplementation |
python | jazzband__django-pipeline | tests/tests/test_compiler.py | {
"start": 1668,
"end": 1978
} | class ____(SubProcessCompiler):
output_extension = "junk"
def match_file(self, path):
return path.endswith(".coffee")
def compile_file(self, infile, outfile, outdated=False, force=False):
command = ("cp", infile, outfile)
return self.execute_command(command)
| CopyingCompiler |
python | xlwings__xlwings | xlwings/_xlwindows.py | {
"start": 55288,
"end": 55334
} | class ____(Collection):
_wrap = Shape
| Shapes |
python | pydantic__pydantic | tests/test_type_adapter.py | {
"start": 850,
"end": 924
} | class ____(BaseModel, Generic[T]):
x: NestedList[T]
| GenericPydanticModel |
python | PyCQA__flake8 | src/flake8/formatting/default.py | {
"start": 1996,
"end": 2128
} | class ____(SimpleFormatter):
"""Pylint formatter for Flake8."""
error_format = "%(path)s:%(row)d: [%(code)s] %(text)s"
| Pylint |
python | Textualize__textual | docs/examples/widgets/static.py | {
"start": 80,
"end": 245
} | class ____(App):
def compose(self) -> ComposeResult:
yield Static("Hello, world!")
if __name__ == "__main__":
app = StaticApp()
app.run()
| StaticApp |
python | pyca__cryptography | src/cryptography/hazmat/primitives/asymmetric/ec.py | {
"start": 6959,
"end": 7115
} | class ____(EllipticCurve):
name = "sect233r1"
key_size = 233
group_order = 0x1000000000000000000000000000013E974E72F8A6922031D2603CFE0D7
| SECT233R1 |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 821480,
"end": 822262
} | class ____(sgqlc.types.relay.Connection):
"""The connection type for OrganizationAuditEntry."""
__schema__ = github_schema
__field_names__ = ("edges", "nodes", "page_info", "total_count")
edges = sgqlc.types.Field(sgqlc.types.list_of("OrganizationAuditEntryEdge"), graphql_name="edges")
"""A list of... | OrganizationAuditEntryConnection |
python | rapidsai__cudf | python/cudf/cudf/core/indexed_frame.py | {
"start": 7531,
"end": 220652
} | class ____(Frame):
"""A frame containing an index.
This class encodes the common behaviors for core user-facing classes like
DataFrame and Series that consist of a sequence of columns along with a
special set of index columns.
Parameters
----------
data : dict
An dict mapping colum... | IndexedFrame |
python | python-poetry__poetry | src/poetry/factory.py | {
"start": 1348,
"end": 12367
} | class ____(BaseFactory):
"""
Factory class to create various elements needed by Poetry.
"""
def _ensure_valid_poetry_version(self, cwd: Path | None) -> None:
poetry_file = self.locate(cwd)
pyproject = PyProjectTOML(path=poetry_file)
poetry_config = pyproject.data.get("tool", {})... | Factory |
python | numba__llvmlite | llvmlite/tests/customize.py | {
"start": 8097,
"end": 8442
} | class ____(runner.TextTestRunner):
resultclass = RefleakTestResult
def _flatten_suite(test):
"""Expand suite into list of tests
"""
if isinstance(test, unittest.TestSuite):
tests = []
for x in test:
tests.extend(_flatten_suite(x))
return tests
else:
retu... | RefleakTestRunner |
python | plotly__plotly.py | plotly/graph_objs/histogram2dcontour/_line.py | {
"start": 233,
"end": 5274
} | class ____(_BaseTraceHierarchyType):
_parent_path_str = "histogram2dcontour"
_path_str = "histogram2dcontour.line"
_valid_props = {"color", "dash", "smoothing", "width"}
@property
def color(self):
"""
Sets the color of the contour level. Has no effect if
`contours.coloring` ... | Line |
python | apache__airflow | providers/google/src/airflow/providers/google/cloud/operators/tasks.py | {
"start": 26494,
"end": 29756
} | class ____(GoogleCloudBaseOperator):
"""
Resumes a queue in Cloud Tasks.
.. seealso::
For more information on how to use this operator, take a look at the guide:
:ref:`howto/operator:CloudTasksQueueResumeOperator`
:param location: The location name in which the queue will be resumed.
... | CloudTasksQueueResumeOperator |
python | pypa__setuptools | setuptools/_vendor/jaraco/context.py | {
"start": 8550,
"end": 9552
} | class ____(contextlib.ContextDecorator):
"""
Replace a KeyboardInterrupt with SystemExit(1)
>>> def do_interrupt():
... raise KeyboardInterrupt()
>>> on_interrupt('error')(do_interrupt)()
Traceback (most recent call last):
...
SystemExit: 1
>>> on_interrupt('error', code=255)(do... | on_interrupt |
python | tiangolo__fastapi | tests/test_filter_pydantic_sub_model/app_pv1.py | {
"start": 127,
"end": 172
} | class ____(BaseModel):
username: str
| ModelB |
python | bokeh__bokeh | src/bokeh/models/layouts.py | {
"start": 14539,
"end": 15237
} | class ____(LayoutDOM, GridCommon):
""" A CSS grid-based grid container. """
# explicit __init__ to support Init signatures
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
children = List(Either(
Tuple(Instance(UIElement), Int, Int),
Tupl... | GridBox |
python | streamlit__streamlit | lib/streamlit/runtime/caching/storage/local_disk_cache_storage.py | {
"start": 3518,
"end": 4531
} | class ____(CacheStorageManager):
def create(self, context: CacheStorageContext) -> CacheStorage:
"""Creates a new cache storage instance wrapped with in-memory cache layer."""
persist_storage = LocalDiskCacheStorage(context)
return InMemoryCacheStorageWrapper(
persist_storage=per... | LocalDiskCacheStorageManager |
python | charliermarsh__ruff | crates/ruff_linter/resources/test/fixtures/pyupgrade/UP046_0.py | {
"start": 1457,
"end": 1499
} | class ____(A[int], Generic[T]):
var: T
| D |
python | prompt-toolkit__python-prompt-toolkit | src/prompt_toolkit/completion/filesystem.py | {
"start": 270,
"end": 3533
} | class ____(Completer):
"""
Complete for Path variables.
:param get_paths: Callable which returns a list of directories to look into
when the user enters a relative path.
:param file_filter: Callable which takes a filename and returns whether
this file shoul... | PathCompleter |
python | cython__cython | Cython/Compiler/Code.py | {
"start": 50405,
"end": 50879
} | class ____:
"""Global info about a Python string constant held by GlobalState.
"""
# cname string
# encoding string
# intern boolean
# is_unicode boolean
def __init__(self, cname, encoding, intern=False, is_unicode=False):
self.cname = cname
self.encoding = en... | PyStringConst |
python | spyder-ide__spyder | spyder/utils/snippets/nodes.py | {
"start": 766,
"end": 961
} | class ____:
TABSTOP = 'tabstop'
PLACEHOLDER = 'placeholder'
CHOICE = 'choice'
VARIABLE = 'variable'
VARIABLE_PLACEHOLDER = 'variable_placeholder'
REGEX = 'regex'
| SnippetKind |
python | apache__airflow | devel-common/src/sphinx_exts/docroles.py | {
"start": 1009,
"end": 3512
} | class ____(Exception):
"""Exception for roles extension"""
def get_template_field(env, fullname) -> list[str]:
"""
Gets template fields for specific operator class.
:param env: env config
:param fullname: Full path to operator class.
For example: ``airflow.providers.google.cloud.operators... | RoleException |
python | chroma-core__chroma | chromadb/api/types.py | {
"start": 21059,
"end": 21261
} | class ____(TypedDict):
ids: IDs
embeddings: Embeddings
metadatas: Optional[Metadatas]
documents: Optional[Documents]
uris: Optional[URIs]
# Upsert result doesn't exist.
| UpsertRequest |
python | django-haystack__django-haystack | test_haystack/elasticsearch5_tests/test_inputs.py | {
"start": 77,
"end": 3508
} | class ____(TestCase):
def setUp(self):
super().setUp()
self.query_obj = connections["elasticsearch"].get_query()
def test_raw_init(self):
raw = inputs.Raw("hello OR there, :you")
self.assertEqual(raw.query_string, "hello OR there, :you")
self.assertEqual(raw.kwargs, {})
... | Elasticsearch5InputTestCase |
python | huggingface__transformers | src/transformers/models/ernie4_5/modular_ernie4_5.py | {
"start": 4896,
"end": 5630
} | class ____(LlamaForCausalLM):
@can_return_tuple
@auto_docstring
def forward(self, **super_kwargs):
r"""
labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
... | Ernie4_5ForCausalLM |
python | dagster-io__dagster | python_modules/dagster/dagster/_core/errors.py | {
"start": 23907,
"end": 24034
} | class ____(DagsterUserCodeExecutionError):
"""Error raised during the execution of a user-defined hook."""
| HookExecutionError |
python | oauthlib__oauthlib | tests/oauth1/rfc5849/endpoints/test_signature_only.py | {
"start": 237,
"end": 1957
} | class ____(TestCase):
def setUp(self):
self.validator = MagicMock(wraps=RequestValidator())
self.validator.check_client_key.return_value = True
self.validator.allowed_signature_methods = ['HMAC-SHA1']
self.validator.get_client_secret.return_value = 'bar'
self.validator.times... | SignatureOnlyEndpointTest |
python | marshmallow-code__marshmallow | performance/benchmark.py | {
"start": 1609,
"end": 3859
} | class ____:
def __init__(
self,
id,
author,
content,
posted_at,
book_name,
page_number,
line_number,
col_number,
):
self.id = id
self.author = author
self.content = content
self.posted_at = posted_at
... | Quote |
python | sqlalchemy__sqlalchemy | lib/sqlalchemy/event/base.py | {
"start": 13914,
"end": 14905
} | class ____(Generic[_ET]):
"""Descriptor used by target classes to
deliver the _Dispatch class at the class level
and produce new _Dispatch instances for target
instances.
"""
def __init__(self, events: Type[_HasEventsDispatch[_ET]]):
self.dispatch = events.dispatch
self.events ... | dispatcher |
python | allegroai__clearml | clearml/automation/trigger.py | {
"start": 3379,
"end": 4201
} | class ____(BaseTrigger):
_task_param = "${model.id}"
_key = "models"
_update_field = "last_update"
_change_field = "last_change"
on_publish = attrib(type=bool, default=None)
on_archive = attrib(type=bool, default=None)
def build_query(self, ref_time: datetime, client: Optional[APIClient] =... | ModelTrigger |
python | jazzband__django-oauth-toolkit | oauth2_provider/models.py | {
"start": 16970,
"end": 17111
} | class ____(AbstractAccessToken):
class Meta(AbstractAccessToken.Meta):
swappable = "OAUTH2_PROVIDER_ACCESS_TOKEN_MODEL"
| AccessToken |
python | pytorch__pytorch | test/inductor/test_utils.py | {
"start": 459,
"end": 8078
} | class ____(TestCase):
def test_zip_schema(self):
def foo(x: torch.Tensor) -> None:
pass
result = torch.library.custom_op("mylib::foo", foo, mutates_args={"x"})
schema = result._opoverload._schema
g = torch.tensor([11, 2])
found = False
for arg, val in tor... | TestUtils |
python | facebook__pyre-check | client/language_server/protocol.py | {
"start": 8850,
"end": 8998
} | class ____(json_mixins.CamlCaseAndExcludeJsonMixin):
did_save: bool = False
@dataclasses.dataclass(frozen=True)
| TextDocumentSyncClientCapabilities |
python | huggingface__transformers | src/transformers/models/hiera/modeling_hiera.py | {
"start": 21348,
"end": 24716
} | class ____(GradientCheckpointingLayer):
def __init__(
self,
config,
depth: int,
hidden_size: int,
hidden_size_output: int,
num_heads: int,
drop_path: list[float],
query_stride: list[int],
window_size: int,
use_mask_unit_attn: bool,
... | HieraStage |
python | ansible__ansible | test/units/_internal/templating/fixtures/valid_collection/ansible_collections/valid/also_valid/plugins/filter/correct.py | {
"start": 203,
"end": 316
} | class ____:
@property
def accept_args_markers(self) -> t.NoReturn:
raise NotImplementedError()
| Bomb |
python | pytorch__pytorch | torch/utils/benchmark/examples/compare.py | {
"start": 202,
"end": 2931
} | class ____:
"""Emulate different versions of pytorch.
In normal circumstances this would be done with multiple processes
writing serialized measurements, but this simplifies that model to
make the example clearer.
"""
def __init__(self, real_torch, extra_ns_per_element) -> None:
self._r... | FauxTorch |
python | ray-project__ray | python/ray/data/_internal/logical/rules/configure_map_task_memory.py | {
"start": 349,
"end": 2591
} | class ____(Rule, abc.ABC):
def apply(self, plan: PhysicalPlan) -> PhysicalPlan:
for op in plan.dag.post_order_iter():
if not isinstance(op, MapOperator):
continue
def ray_remote_args_fn(
op: MapOperator = op, original_ray_remote_args_fn=op._ray_remote... | ConfigureMapTaskMemoryRule |
python | huggingface__transformers | src/transformers/models/sam2/modeling_sam2.py | {
"start": 40893,
"end": 42986
} | class ____(nn.Module):
def __init__(self, config: Sam2MaskDecoderConfig):
super().__init__()
self.config = config
self.num_hidden_layers = config.num_hidden_layers
self.layers = nn.ModuleList()
for i in range(self.num_hidden_layers):
self.layers.append(Sam2TwoWa... | Sam2TwoWayTransformer |
python | django__django | django/contrib/admin/widgets.py | {
"start": 643,
"end": 1651
} | class ____(forms.SelectMultiple):
"""
A SelectMultiple with a JavaScript filter interface.
Note that the resulting JavaScript assumes that the jsi18n
catalog has been loaded in the page
"""
class Media:
js = [
"admin/js/core.js",
"admin/js/SelectBox.js",
... | FilteredSelectMultiple |
python | encode__django-rest-framework | tests/test_permissions.py | {
"start": 11331,
"end": 11530
} | class ____(serializers.ModelSerializer):
class Meta:
model = BasicPermModel
fields = '__all__'
# Custom object-level permission, that includes 'view' permissions
| BasicPermSerializer |
python | facelessuser__soupsieve | tests/test_level3/test_enabled.py | {
"start": 52,
"end": 4203
} | class ____(util.TestCase):
"""Test enabled selectors."""
MARKUP = """
<body>
<form action="#">
<fieldset id='a' disabled>
<legend>
Simple fieldset <input type="radio" id="1" checked>
<fieldset id='b' disabled>
<legend>Simple fieldset <input type="radio" id=... | TestEnabled |
python | pytorch__pytorch | torch/_inductor/tiling_utils.py | {
"start": 8768,
"end": 21600
} | class ____:
"""
Finds a Pointwise, Reduction Split that compatible with all nodes in a SchedulerNode.
"""
def __init__(
self,
node: Union["FusedSchedulerNode", "SchedulerNode"],
):
self.node = node
self.pointwise_numel: sympy.Expr = node.group[1][0]
self.red_... | NodeSplitGetter |
python | getsentry__sentry | tests/sentry/new_migrations/monkey/test_executor.py | {
"start": 636,
"end": 10249
} | class ____:
@pytest.fixture(autouse=True)
def _mock_getsentry_if_not_registered(self) -> Generator[None]:
if "getsentry" in settings.INSTALLED_APPS:
yield
return
with (
patch.dict(apps.app_configs, {"getsentry": DummyGetsentryAppConfig("getsentry", None)}),
... | TestSentryMigrationExecutor |
python | Netflix__metaflow | metaflow/plugins/cards/card_modules/test_cards.py | {
"start": 1649,
"end": 1915
} | class ____(MetaflowCard):
type = "test_mock_card"
def __init__(self, options={"key": "dummy_key"}, **kwargs):
self._key = options["key"]
def render(self, task):
task_data = task[self._key].data
return "%s" % task_data
| TestMockCard |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 1055683,
"end": 1056322
} | class ____(sgqlc.types.Type, Node):
"""Represents a 'added_to_project' event on a given issue or pull
request.
"""
__schema__ = github_schema
__field_names__ = ("actor", "created_at", "database_id")
actor = sgqlc.types.Field(Actor, graphql_name="actor")
"""Identifies the actor who performed... | AddedToProjectEvent |
python | pandas-dev__pandas | pandas/tests/arrays/categorical/test_operators.py | {
"start": 183,
"end": 4553
} | class ____:
def test_categories_none_comparisons(self):
factor = Categorical(["a", "b", "b", "a", "a", "c", "c", "c"], ordered=True)
tm.assert_categorical_equal(factor, factor)
def test_comparisons(self):
factor = Categorical(["a", "b", "b", "a", "a", "c", "c", "c"], ordered=True)
... | TestCategoricalOpsWithFactor |
python | lepture__authlib | authlib/integrations/django_oauth2/authorization_server.py | {
"start": 531,
"end": 4463
} | class ____(_AuthorizationServer):
"""Django implementation of :class:`authlib.oauth2.rfc6749.AuthorizationServer`.
Initialize it with client model and token model::
from authlib.integrations.django_oauth2 import AuthorizationServer
from your_project.models import OAuth2Client, OAuth2Token
... | AuthorizationServer |
python | zostera__django-bootstrap4 | src/bootstrap4/renderers.py | {
"start": 7170,
"end": 20928
} | class ____(BaseRenderer):
"""Default field renderer."""
# These widgets will not be wrapped in a form-control class
WIDGETS_NO_FORM_CONTROL = (CheckboxInput, RadioSelect, CheckboxSelectMultiple, FileInput)
def __init__(self, field, *args, **kwargs):
if not isinstance(field, BoundField):
... | FieldRenderer |
python | cython__cython | Cython/Compiler/ParseTreeTransforms.py | {
"start": 130233,
"end": 132149
} | class ____(CythonTransform):
"""
This class takes the signatures from a .pxd file and applies them to
the def methods in a .py file.
"""
def visit_ModuleNode(self, node):
self.scope = node.scope
self.visitchildren(node)
return node
def visit_PyClassDefNode(self, node):
... | AlignFunctionDefinitions |
python | wandb__wandb | wandb/errors/errors.py | {
"start": 688,
"end": 782
} | class ____(Error):
"""Raised when an invalid usage of the SDK API is detected."""
| UsageError |
python | pypa__setuptools | setuptools/_distutils/errors.py | {
"start": 602,
"end": 689
} | class ____(Exception):
"""The root of all Distutils evil."""
pass
| DistutilsError |
python | giampaolo__psutil | psutil/_psbsd.py | {
"start": 18463,
"end": 29275
} | class ____:
"""Wrapper class around underlying C implementation."""
__slots__ = ["_cache", "_name", "_ppid", "pid"]
def __init__(self, pid):
self.pid = pid
self._name = None
self._ppid = None
def _assert_alive(self):
"""Raise NSP if the process disappeared on us."""
... | Process |
python | pola-rs__polars | py-polars/src/polars/io/database/_arrow_registry.py | {
"start": 67,
"end": 3015
} | class ____(TypedDict):
# name of the method that fetches all arrow data; tuple form
# calls the fetch_all method with the given chunk size (int)
fetch_all: str
# name of the method that fetches arrow data in batches
fetch_batches: str | None
# indicate whether the given batch size is respected e... | ArrowDriverProperties |
python | cython__cython | tests/run/py_classbody.py | {
"start": 423,
"end": 820
} | class ____(object):
"""
>>> TestCdefAttr.cdefvar # doctest: +ELLIPSIS
Traceback (most recent call last):
AttributeError: ...TestCdefAttr...has no attribute 'cdefvar'...
>>> TestCdefAttr.cdefval1
11
>>> #TestCdefAttr.cdefval2
"""
cdefvar = 11
cdefval1 = cdefvar
del cdefvar
... | TestCdefAttr |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.