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 | pytorch__pytorch | test/fx/test_z3_gradual_types.py | {
"start": 85191,
"end": 87827
} | class ____(unittest.TestCase):
def test_resnet50_unsat(self):
traced = symbolic_trace(models.resnet50())
for n in traced.graph.nodes:
n.type = Dyn
constraints = transform_all_constraints(traced, counter=0)
solver = z3.Solver()
solver.add(constraints)
inpu... | TestResNet |
python | getsentry__sentry | src/sentry/seer/models.py | {
"start": 2116,
"end": 2249
} | class ____(BaseModel):
preference: SeerProjectPreference | None
code_mapping_repos: list[SeerRepoDefinition]
| PreferenceResponse |
python | apache__airflow | helm-tests/tests/helm_tests/other/test_redis.py | {
"start": 20159,
"end": 21553
} | class ____:
"""Tests redis service."""
@pytest.mark.parametrize(
("redis_values", "expected"),
[
({"redis": {"service": {"type": "ClusterIP"}}}, "ClusterIP"),
({"redis": {"service": {"type": "NodePort"}}}, "NodePort"),
({"redis": {"service": {"type": "LoadBal... | TestRedisService |
python | ray-project__ray | python/ray/util/collective/collective.py | {
"start": 1798,
"end": 29043
} | class ____(object):
"""Use this class to manage the collective groups we created so far.
Each process will have an instance of `GroupManager`. Each process
could belong to multiple collective groups. The membership information
and other metadata are stored in the global `_group_mgr` object.
"""
... | GroupManager |
python | tensorflow__tensorflow | tensorflow/python/debug/lib/debug_graphs_test.py | {
"start": 1880,
"end": 2827
} | class ____(test_util.TensorFlowTestCase):
def testIsCopyNode(self):
self.assertTrue(debug_graphs.is_copy_node("__copy_ns1/ns2/node3_0"))
self.assertFalse(debug_graphs.is_copy_node("copy_ns1/ns2/node3_0"))
self.assertFalse(debug_graphs.is_copy_node("_copy_ns1/ns2/node3_0"))
self.assertFalse(debug_gra... | NodeNameChecksTest |
python | pandas-dev__pandas | pandas/tests/libs/test_lib.py | {
"start": 217,
"end": 2433
} | class ____:
def test_max_len_string_array(self):
arr = a = np.array(["foo", "b", np.nan], dtype="object")
assert libwriters.max_len_string_array(arr) == 3
# unicode
arr = a.astype("U").astype(object)
assert libwriters.max_len_string_array(arr) == 3
# bytes for pytho... | TestMisc |
python | doocs__leetcode | solution/1200-1299/1236.Web Crawler/Solution.py | {
"start": 254,
"end": 720
} | class ____:
def crawl(self, startUrl: str, htmlParser: 'HtmlParser') -> List[str]:
def host(url):
url = url[7:]
return url.split('/')[0]
def dfs(url):
if url in ans:
return
ans.add(url)
for next in htmlParser.getUrls(url):
... | Solution |
python | pydantic__pydantic | pydantic-core/python/pydantic_core/core_schema.py | {
"start": 98801,
"end": 100762
} | class ____(TypedDict, total=False):
type: Required[Literal['lax-or-strict']]
lax_schema: Required[CoreSchema]
strict_schema: Required[CoreSchema]
strict: bool
ref: str
metadata: dict[str, Any]
serialization: SerSchema
def lax_or_strict_schema(
lax_schema: CoreSchema,
strict_schema:... | LaxOrStrictSchema |
python | fsspec__filesystem_spec | fsspec/implementations/gist.py | {
"start": 130,
"end": 8528
} | class ____(AbstractFileSystem):
"""
Interface to files in a single GitHub Gist.
Provides read-only access to a gist's files. Gists do not contain
subdirectories, so file listing is straightforward.
Parameters
----------
gist_id: str
The ID of the gist you want to access (the long h... | GistFileSystem |
python | python-attrs__attrs | typing-examples/baseline.py | {
"start": 731,
"end": 857
} | class ____(Exception):
x: int
try:
raise Error(1)
except Error as e:
e.x
e.args
str(e)
@attrs.define
| Error |
python | ray-project__ray | rllib/algorithms/dreamerv3/torch/models/critic_network.py | {
"start": 485,
"end": 7376
} | class ____(nn.Module):
"""The critic network described in [1], predicting values for policy learning.
Contains a copy of itself (EMA net) for weight regularization.
The EMA net is updated after each train step via EMA (using the `ema_decay`
parameter and the actual critic's weights). The EMA net is NOT... | CriticNetwork |
python | jina-ai__jina | jina/proto/docarray_v1/pb/jina_pb2_grpc.py | {
"start": 277,
"end": 762
} | class ____(object):
"""*
jina gRPC service for DataRequests.
"""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.process_data = channel.unary_unary(
'/jina.JinaDataRequestRPC/process_data',
request... | JinaDataRequestRPCStub |
python | keras-team__keras | keras/src/utils/torch_utils.py | {
"start": 371,
"end": 6619
} | class ____(Layer):
"""Torch module wrapper layer.
`TorchModuleWrapper` is a wrapper class that can turn any
`torch.nn.Module` into a Keras layer, in particular by making its
parameters trackable by Keras.
`TorchModuleWrapper` is only compatible with the PyTorch backend and
cannot be used with ... | TorchModuleWrapper |
python | pdm-project__pdm | src/pdm/models/finder.py | {
"start": 919,
"end": 2086
} | class ____(Evaluator):
def __init__(self, *args: Any, env_spec: EnvSpec, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
self.env_spec = env_spec
def check_requires_python(self, link: unearth.Link) -> None:
if link.requires_python:
try:
requires_pyt... | PDMEvaluator |
python | GoogleCloudPlatform__python-docs-samples | appengine/standard/images/api/blobstore.py | {
"start": 1633,
"end": 2389
} | class ____(webapp2.RequestHandler):
def get(self):
blob_key = self.request.get("blob_key")
if blob_key:
blob_info = blobstore.get(blob_key)
if blob_info:
# [START gae_get_serving_url]
url = images.get_serving_url(
blob_key... | ServingUrlRedirect |
python | kubernetes-client__python | kubernetes/client/models/v1_custom_resource_subresources.py | {
"start": 383,
"end": 4885
} | class ____(object):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attri... | V1CustomResourceSubresources |
python | joke2k__faker | faker/providers/ssn/et_EE/__init__.py | {
"start": 948,
"end": 2665
} | class ____(SsnProvider):
scale1 = (1, 2, 3, 4, 5, 6, 7, 8, 9, 1)
scale2 = (3, 4, 5, 6, 7, 8, 9, 1, 2, 3)
def ssn(self, min_age: int = 16, max_age: int = 90) -> str:
"""
Returns 11 character Estonian personal identity code (isikukood, IK).
Age of person is between 16 and 90 years, b... | Provider |
python | Pylons__pyramid | src/pyramid/interfaces.py | {
"start": 42153,
"end": 43327
} | class ____(Interface):
"""An object that offers the ability to verify CSRF tokens and generate
new ones."""
def new_csrf_token(request):
"""Create and return a new, random cross-site request forgery
protection token. The token will be an ascii-compatible unicode
string.
"""... | ICSRFStoragePolicy |
python | openai__openai-python | src/openai/types/chat/chat_completion_content_part_param.py | {
"start": 566,
"end": 910
} | class ____(TypedDict, total=False):
file_data: str
"""
The base64 encoded file data, used when passing the file to the model as a
string.
"""
file_id: str
"""The ID of an uploaded file to use as input."""
filename: str
"""The name of the file, used when passing the file to the mode... | FileFile |
python | jmcnamara__XlsxWriter | xlsxwriter/test/workbook/test_write_workbook_pr.py | {
"start": 299,
"end": 875
} | class ____(unittest.TestCase):
"""
Test the Workbook _write_workbook_pr() method.
"""
def setUp(self):
self.fh = StringIO()
self.workbook = Workbook()
self.workbook._set_filehandle(self.fh)
def test_write_workbook_pr(self):
"""Test the _write_workbook_pr() method""... | TestWriteWorkbookPr |
python | gevent__gevent | src/greentest/3.11/test_httplib.py | {
"start": 60763,
"end": 60964
} | class ____(ExtendedReadTest):
_header, _body = ExtendedReadTest.lines.split('\r\n\r\n', 1)
lines = _header + f'\r\nContent-Length: {len(_body)}\r\n\r\n' + _body
| ExtendedReadTestContentLengthKnown |
python | allegroai__clearml | clearml/backend_api/services/v2_13/events.py | {
"start": 335,
"end": 4834
} | class ____(NonStrictDataModel):
"""
Used for reporting scalar metrics during training task
:param timestamp: Epoch milliseconds UTC, will be set by the server if not set.
:type timestamp: float
:param task: Task ID (required)
:type task: str
:param iter: Iteration
:type iter: int
:p... | MetricsScalarEvent |
python | allegroai__clearml | clearml/backend_api/services/v2_23/datasets.py | {
"start": 245318,
"end": 250276
} | class ____(Request):
"""
Updates an existing dataset object
:param dataset: Dataset ID
:type dataset: str
:param name: Dataset name Unique within the company.
:type name: str
:param comment: Dataset comment
:type comment: str
:param tags: User-defined tags list
:type tags: Seque... | UpdateRequest |
python | pydantic__pydantic | tests/test_validate_call.py | {
"start": 37805,
"end": 38025
} | class ____[T]:
class B:
@validate_call(validate_return=True)
def f(a: T) -> T: ...
class C[S]:
@validate_call(validate_return=True)
def f(a: T) -> S: ...
"""
)
| A |
python | scrapy__scrapy | scrapy/statscollectors.py | {
"start": 368,
"end": 2870
} | class ____:
def __init__(self, crawler: Crawler):
self._dump: bool = crawler.settings.getbool("STATS_DUMP")
self._stats: StatsT = {}
self._crawler: Crawler = crawler
def __getattribute__(self, name):
cached_name = f"_cached_{name}"
try:
return super().__getat... | StatsCollector |
python | pytorch__pytorch | torch/testing/_internal/distributed/_tensor/common_dtensor.py | {
"start": 19086,
"end": 19557
} | class ____(MultiThreadedTestCase):
@property
def world_size(self) -> int:
return NUM_DEVICES
@property
def device_type(self) -> str:
return DEVICE_TYPE
def build_device_mesh(self):
return init_device_mesh(self.device_type, (self.world_size,))
def setUp(self) -> None:
... | DTensorOpTestBase |
python | Pylons__pyramid | tests/test_request.py | {
"start": 13797,
"end": 16739
} | class ____(unittest.TestCase):
def _callFUT(self, request, app):
from pyramid.request import call_app_with_subpath_as_path_info
return call_app_with_subpath_as_path_info(request, app)
def test_it_all_request_and_environment_data_missing(self):
request = DummyRequest({})
respons... | Test_call_app_with_subpath_as_path_info |
python | apache__airflow | airflow-core/src/airflow/api_fastapi/core_api/datamodels/assets.py | {
"start": 2626,
"end": 2763
} | class ____(BaseModel):
"""Asset collection response."""
assets: list[AssetResponse]
total_entries: int
| AssetCollectionResponse |
python | getsentry__sentry | tests/sentry/deletions/tasks/test_scheduled.py | {
"start": 7374,
"end": 8333
} | class ____(RegionalRunScheduleDeletionTest):
@property
def ScheduledDeletion(self) -> type[BaseScheduledDeletion]:
return RegionScheduledDeletion
def run_scheduled_deletions(self) -> None:
return run_scheduled_deletions()
def reattempt_deletions(self) -> None:
return reattempt_... | RunRegionScheduledDeletionTest |
python | scipy__scipy | benchmarks/benchmarks/optimize_lap.py | {
"start": 1500,
"end": 1956
} | class ____(Benchmark):
shape = (100, 100)
param_names = ['threads']
params = [[1, 2, 4]]
def setup(self, threads):
self.cost_matrices = [random_uniform(self.shape) for _ in range(20)]
def time_evaluation(self, threads):
with ThreadPoolExecutor(max_workers=threads) as pool:
... | ParallelLinearAssignment |
python | kamyu104__LeetCode-Solutions | Python/build-array-from-permutation.py | {
"start": 48,
"end": 590
} | class ____(object):
def buildArray(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
for i in xrange(len(nums)):
prev, curr = i, nums[i]
while curr >= 0 and curr != i:
nums[prev], nums[curr] = ~nums[curr], ~nums[prev] if prev... | Solution |
python | jmcnamara__XlsxWriter | xlsxwriter/test/comparison/test_chart_bar19.py | {
"start": 315,
"end": 1494
} | class ____(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.set_filename("chart_bar19.xlsx")
def test_create_file(self):
"""Test the creation of a simple XlsxWriter file."""
workbook = Workbook(self.got_f... | TestCompareXLSXFiles |
python | scikit-learn__scikit-learn | sklearn/manifold/_locally_linear.py | {
"start": 20775,
"end": 30531
} | class ____(
ClassNamePrefixFeaturesOutMixin,
TransformerMixin,
_UnstableArchMixin,
BaseEstimator,
):
"""Locally Linear Embedding.
Read more in the :ref:`User Guide <locally_linear_embedding>`.
Parameters
----------
n_neighbors : int, default=5
Number of neighbors to conside... | LocallyLinearEmbedding |
python | ipython__ipython | IPython/core/formatters.py | {
"start": 25804,
"end": 26381
} | class ____(BaseFormatter):
"""An HTML formatter.
To define the callables that compute the HTML representation of your
objects, define a :meth:`_repr_html_` method or use the :meth:`for_type`
or :meth:`for_type_by_name` methods to register functions that handle
this.
The return value of this fo... | HTMLFormatter |
python | apache__airflow | task-sdk/src/airflow/sdk/definitions/taskgroup.py | {
"start": 2998,
"end": 24751
} | class ____(DAGNode):
"""
A collection of tasks.
When set_downstream() or set_upstream() are called on the TaskGroup, it is applied across
all tasks within the group if necessary.
:param group_id: a unique, meaningful id for the TaskGroup. group_id must not conflict
with group_id of TaskGro... | TaskGroup |
python | spack__spack | lib/spack/spack/vendor/macholib/mach_o.py | {
"start": 35843,
"end": 36846
} | class ____(Structure):
_fields_ = (
("rebase_off", p_uint32),
("rebase_size", p_uint32),
("bind_off", p_uint32),
("bind_size", p_uint32),
("weak_bind_off", p_uint32),
("weak_bind_size", p_uint32),
("lazy_bind_off", p_uint32),
("lazy_bind_size", p_uint3... | dyld_info_command |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 206886,
"end": 208196
} | class ____(sgqlc.types.Input):
"""Autogenerated input type of CreateSponsorships"""
__schema__ = github_schema
__field_names__ = ("sponsor_login", "sponsorships", "receive_emails", "privacy_level", "client_mutation_id")
sponsor_login = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="spons... | CreateSponsorshipsInput |
python | astropy__astropy | astropy/io/votable/exceptions.py | {
"start": 46532,
"end": 47020
} | class ____(VOTableSpecWarning):
"""Incorrect ``system`` attribute on COOSYS element.
The ``system`` attribute must be one of the following::
'eq_FK4', 'eq_FK5', 'ICRS', 'ecl_FK4', 'ecl_FK5', 'galactic',
'supergalactic', 'xy', 'barycentric', 'geo_app'
**References**: `1.1
<http://www.ivoa.... | E16 |
python | numba__numba | numba/core/types/common.py | {
"start": 190,
"end": 266
} | class ____(Dummy):
"""
A type that is a opaque pointer.
"""
| Opaque |
python | PrefectHQ__prefect | tests/test_tasks.py | {
"start": 138600,
"end": 143537
} | class ____:
def test_noniterable_hook_raises(self):
def completion_hook():
pass
with pytest.raises(
TypeError,
match=re.escape(
"Expected iterable for 'on_completion'; got function instead. Please"
" provide a list of hooks to 'on_... | TestTaskHooksOnCompletion |
python | ansible__ansible | lib/ansible/module_utils/facts/hardware/freebsd.py | {
"start": 9910,
"end": 10021
} | class ____(HardwareCollector):
_fact_class = FreeBSDHardware
_platform = 'FreeBSD'
| FreeBSDHardwareCollector |
python | simplejson__simplejson | simplejson/tests/test_namedtuple.py | {
"start": 1041,
"end": 1167
} | class ____(dict):
_asdict = None
CONSTRUCTORS = [
lambda v: v,
lambda v: [v],
lambda v: [{'key': v}],
]
| DeadDict |
python | dagster-io__dagster | python_modules/dagster/dagster/_config/config_type.py | {
"start": 509,
"end": 1768
} | class ____(PythonEnum):
ANY = "ANY"
SCALAR = "SCALAR"
ENUM = "ENUM"
SELECTOR = "SELECTOR"
STRICT_SHAPE = "STRICT_SHAPE"
PERMISSIVE_SHAPE = "PERMISSIVE_SHAPE"
SCALAR_UNION = "SCALAR_UNION"
MAP = "MAP"
# Closed generic types
ARRAY = "ARRAY"
NONEABLE = "NONEABLE"
@static... | ConfigTypeKind |
python | getsentry__sentry | tests/snuba/api/endpoints/test_organization_events_stats_profile_functions.py | {
"start": 189,
"end": 1687
} | class ____(OrganizationEventsEndpointTestBase):
dataset = "profile_functions"
viewname = "sentry-api-0-organization-events-stats"
def setUp(self) -> None:
super().setUp()
self.login_as(user=self.user)
self.start = self.day_ago = before_now(days=1).replace(
hour=10, minut... | OrganizationEventsStatsProfileFunctionsEndpointTest |
python | pytorch__pytorch | torch/_inductor/cudagraph_trees.py | {
"start": 16399,
"end": 21094
} | class ____:
"""
Wrapper around a storage weak ref. Will deallocate it upon expiration if invoked.
"""
__slots__ = ["ref", "_data_ptr", "extra_ref_check"]
storage_ref: Optional[StorageWeakRef]
def __init__(
self,
inp: Union[Tensor, UntypedStorage],
extra_ref_check: Opti... | StorageWeakRefWrapper |
python | google__jax | jax/_src/interpreters/pxla.py | {
"start": 3063,
"end": 14320
} | class ____(list):
pass
unsafe_map, map = map, safe_map # type: ignore
zip, unsafe_zip = safe_zip, zip # type: ignore
logger = logging.getLogger(__name__)
Index = Union[int, slice, tuple[Union[int, slice], ...]]
PyTreeDef = tree_util.PyTreeDef
NoSharding = sharding_specs.NoSharding
Chunked = sharding_specs.Chun... | WeakRefList |
python | doocs__leetcode | solution/0900-0999/0921.Minimum Add to Make Parentheses Valid/Solution2.py | {
"start": 0,
"end": 284
} | class ____:
def minAddToMakeValid(self, s: str) -> int:
ans = cnt = 0
for c in s:
if c == '(':
cnt += 1
elif cnt:
cnt -= 1
else:
ans += 1
ans += cnt
return ans
| Solution |
python | zarr-developers__zarr-python | src/zarr/core/dtype/common.py | {
"start": 6331,
"end": 6513
} | class ____:
"""
A mix-in class for data types with an endianness attribute
"""
endianness: EndiannessStr = "little"
@dataclass(frozen=True, kw_only=True)
| HasEndianness |
python | realpython__materials | python-iterators-iterables/async_iter.py | {
"start": 44,
"end": 491
} | class ____:
def __init__(self, stop):
self.stop = stop
self.index = 0
def __aiter__(self):
return self
async def __anext__(self):
if self.index >= self.stop:
raise StopAsyncIteration
await asyncio.sleep(value := randint(1, 3))
self.index += 1
... | AsyncIterable |
python | getsentry__sentry | src/bitfield/apps.py | {
"start": 36,
"end": 125
} | class ____(AppConfig):
name = "bitfield"
verbose_name = "Bit Field"
| BitFieldAppConfig |
python | plotly__plotly.py | plotly/graph_objs/parcoords/line/_colorbar.py | {
"start": 233,
"end": 61634
} | class ____(_BaseTraceHierarchyType):
_parent_path_str = "parcoords.line"
_path_str = "parcoords.line.colorbar"
_valid_props = {
"bgcolor",
"bordercolor",
"borderwidth",
"dtick",
"exponentformat",
"labelalias",
"len",
"lenmode",
"minexpo... | ColorBar |
python | getsentry__sentry | src/sentry/api/endpoints/organization_sdk_deprecations.py | {
"start": 1087,
"end": 4159
} | class ____(OrganizationEndpoint):
owner = ApiOwner.PROFILING
publish_status = {
"GET": ApiPublishStatus.PRIVATE,
}
def get(self, request: Request, organization: Organization) -> Response:
serializer = SDKDeprecationsSerializer(data=request.GET)
if not serializer.is_valid():
... | OrganizationSdkDeprecationsEndpoint |
python | apache__airflow | providers/openlineage/src/airflow/providers/openlineage/plugins/adapter.py | {
"start": 2561,
"end": 23065
} | class ____(LoggingMixin):
"""Translate Airflow metadata to OpenLineage events instead of creating them from Airflow code."""
def __init__(self, client: OpenLineageClient | None = None, secrets_masker: SecretsMasker | None = None):
super().__init__()
self._client = client
if not secrets_... | OpenLineageAdapter |
python | more-itertools__more-itertools | tests/test_recipes.py | {
"start": 34975,
"end": 35563
} | class ____(TestCase):
def test_empty(self):
it = []
actual = list(mi.transpose(it))
expected = []
self.assertEqual(actual, expected)
def test_basic(self):
it = [(10, 11, 12), (20, 21, 22), (30, 31, 32)]
actual = list(mi.transpose(it))
expected = [(10, 20,... | TransposeTests |
python | spack__spack | lib/spack/spack/vendor/jinja2/nodes.py | {
"start": 27223,
"end": 27975
} | class ____(Expr):
"""Compares an expression with some other expressions. `ops` must be a
list of :class:`Operand`\\s.
"""
fields = ("expr", "ops")
expr: Expr
ops: t.List["Operand"]
def as_const(self, eval_ctx: t.Optional[EvalContext] = None) -> t.Any:
eval_ctx = get_eval_context(s... | Compare |
python | viewflow__viewflow | tests/fsm/test_fsm__model.py | {
"start": 131,
"end": 236
} | class ____(models.Model):
text = models.TextField()
stage = models.CharField(max_length=150)
| Report |
python | PyCQA__pyflakes | pyflakes/checker.py | {
"start": 12020,
"end": 12325
} | class ____(ImportationFrom):
"""
A binding created by a from `__future__` import statement.
`__future__` imports are implicitly used.
"""
def __init__(self, name, source, scope):
super().__init__(name, source, '__future__')
self.used = (scope, source)
| FutureImportation |
python | Netflix__metaflow | test/core/tests/basic_foreach.py | {
"start": 67,
"end": 1100
} | class ____(MetaflowTest):
PRIORITY = 0
SKIP_GRAPHS = [
"simple_switch",
"nested_switch",
"branch_in_switch",
"foreach_in_switch",
"switch_in_branch",
"switch_in_foreach",
"recursive_switch",
"recursive_switch_inside_foreach",
]
@steps(0, [... | BasicForeachTest |
python | openai__openai-python | src/openai/types/fine_tuning/reinforcement_method.py | {
"start": 708,
"end": 958
} | class ____(BaseModel):
grader: Grader
"""The grader used for the fine-tuning job."""
hyperparameters: Optional[ReinforcementHyperparameters] = None
"""The hyperparameters used for the reinforcement fine-tuning job."""
| ReinforcementMethod |
python | python-poetry__poetry | src/poetry/console/commands/debug/resolve.py | {
"start": 467,
"end": 4700
} | class ____(InitCommand):
name = "debug resolve"
description = "Debugs dependency resolution."
arguments: ClassVar[list[Argument]] = [
argument("package", "The packages to resolve.", optional=True, multiple=True)
]
options: ClassVar[list[Option]] = [
option(
"extras",
... | DebugResolveCommand |
python | pytest-dev__pytest | src/_pytest/raises.py | {
"start": 58024,
"end": 58101
} | class ____:
"""Singleton for unchecked values in ResultHolder"""
| NotChecked |
python | Lightning-AI__lightning | src/lightning/fabric/utilities/throughput.py | {
"start": 12091,
"end": 27249
} | class ____(Throughput):
r"""Computes throughput.
This class will automatically keep a count of the number of log calls (``step``). But that can be modified as
desired. For manual logging, using :class:`Throughput` directly might be desired.
Example::
logger = ...
fabric = Fabric(logge... | ThroughputMonitor |
python | airbytehq__airbyte | airbyte-integrations/connectors/source-github/source_github/github_schema.py | {
"start": 562157,
"end": 562518
} | class ____(sgqlc.types.Type):
"""Autogenerated return type of DeleteTeamDiscussionComment"""
__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 muta... | DeleteTeamDiscussionCommentPayload |
python | apache__airflow | scripts/ci/prek/significant_newsfragments_checker.py | {
"start": 1591,
"end": 9428
} | class ____(docutils.nodes.NodeVisitor):
"""Visitor to collect significant newsfragement content."""
TYPES_OF_CHANGE_TITLE = "Types of change"
EXPECTED_TYPE_OF_CHANGES = {
"Dag changes",
"Config changes",
"API changes",
"CLI changes",
"Behaviour changes",
"Plu... | SignificantNewsFragmentVisitor |
python | gevent__gevent | src/gevent/testing/flaky.py | {
"start": 1247,
"end": 1455
} | class ____(AssertionError):
"Re-raised so that we know it's a known-flaky test."
# The next exceptions allow us to raise them in a highly
# greppable way so that we can debug them later.
| FlakyAssertionError |
python | facelessuser__soupsieve | tests/test_level4/test_dir.py | {
"start": 77,
"end": 5331
} | class ____(util.TestCase):
"""Test direction selectors."""
MARKUP = """
<html id="0">
<head></head>
<body>
<div id="1" dir="rtl">
<span id="2">test1</span>
<div id="3" dir="ltr">test2
<div id="4" dir="auto"><!-- comment -->עִבְרִית<span id="5" dir="auto">()</span></div>
... | TestDir |
python | tensorflow__tensorflow | tensorflow/python/util/deprecation_test.py | {
"start": 3254,
"end": 17448
} | class ____(test.TestCase):
@test.mock.patch.object(logging, "warning", autospec=True)
def test_deprecated_once(self, mock_warning):
date = "2016-07-04"
instructions = "This is how you update..."
@deprecation.deprecated(date, instructions, warn_once=True)
def _fn():
pass
_fn()
self.a... | DeprecationTest |
python | econchick__interrogate | tests/functional/sample/partial.py | {
"start": 108,
"end": 1533
} | class ____:
"""Foo class"""
def __init__(self):
"""init method of Foo class"""
self.foo = None
def __str__(self):
"""a documented magic method."""
pass
def __repr__(self):
pass
def _semiprivate_documented(self):
"""a documented semipriate method"""... | Foo |
python | SmileyChris__easy-thumbnails | easy_thumbnails/options.py | {
"start": 44,
"end": 1648
} | class ____(dict):
def __init__(self, *args, **kwargs):
self._prepared_options = None
super().__init__(*args, **kwargs)
if settings.THUMBNAIL_DEFAULT_OPTIONS:
for key, value in settings.THUMBNAIL_DEFAULT_OPTIONS.items():
self.setdefault(key, value)
self.se... | ThumbnailOptions |
python | cython__cython | Cython/Plex/Regexps.py | {
"start": 10606,
"end": 14669
} | class ____(RE):
"""
SwitchCase(re, nocase) is an RE which matches the same strings as RE,
but treating upper and lower case letters according to |nocase|. If
|nocase| is true, case is ignored, otherwise it is not.
"""
re = None
nocase = None
def __init__(self, re, nocase):
self.... | SwitchCase |
python | django__django | tests/user_commands/tests.py | {
"start": 18180,
"end": 20672
} | class ____(AdminScriptTestCase):
"""
Tests that need to run by simulating the command line, not by call_command.
"""
def test_script_prefix_set_in_commands(self):
self.write_settings(
"settings.py",
apps=["user_commands"],
sdict={
"ROOT_URLCON... | CommandRunTests |
python | plotly__plotly.py | plotly/graph_objs/_deprecations.py | {
"start": 18432,
"end": 19267
} | class ____(dict):
"""
plotly.graph_objs.YBins is deprecated.
Please replace it with one of the following more specific types
- plotly.graph_objs.histogram.YBins
- plotly.graph_objs.histogram2d.YBins
"""
def __init__(self, *args, **kwargs):
"""
plotly.graph_o... | YBins |
python | tensorflow__tensorflow | tensorflow/python/kernel_tests/linalg/matrix_inverse_op_test.py | {
"start": 1327,
"end": 6295
} | class ____(test.TestCase):
def _high_precision_matmul(self, a, b, adjoint_b):
"""Do a higher-precision matmul, casting either to float32 or float64."""
if a.dtype == dtypes.float16:
a = math_ops.cast(a, dtypes.float32)
b = math_ops.cast(b, dtypes.float32)
ret = test_util.matmul_without_tf32(... | InverseOpTest |
python | davidhalter__jedi | jedi/api/__init__.py | {
"start": 1967,
"end": 28824
} | class ____:
"""
A Script is the base for completions, goto or whatever you want to do with
Jedi. The counter part of this class is :class:`Interpreter`, which works
with actual dictionaries and can work with a REPL. This class
should be used when a user edits code in an editor.
You can either u... | Script |
python | pyca__cryptography | src/cryptography/hazmat/primitives/twofactor/totp.py | {
"start": 505,
"end": 1652
} | class ____:
def __init__(
self,
key: Buffer,
length: int,
algorithm: HOTPHashTypes,
time_step: int,
backend: typing.Any = None,
enforce_key_length: bool = True,
):
self._time_step = time_step
self._hotp = HOTP(
key, length, algo... | TOTP |
python | tensorflow__tensorflow | tensorflow/python/keras/optimizer_v2/adamax.py | {
"start": 1226,
"end": 7695
} | class ____(optimizer_v2.OptimizerV2):
"""Optimizer that implements the Adamax algorithm.
It is a variant of Adam based on the infinity norm.
Default parameters follow those provided in the paper.
Adamax is sometimes superior to adam, specially in models with embeddings.
Initialization:
```python
m = 0 ... | Adamax |
python | pytorch__pytorch | torch/_inductor/subgraph_lowering.py | {
"start": 4729,
"end": 4802
} | class ____:
dtype: torch.dtype
device: torch.device
| InputDescriptor |
python | huggingface__transformers | src/transformers/models/mm_grounding_dino/modeling_mm_grounding_dino.py | {
"start": 61288,
"end": 62116
} | class ____(ModelOutput):
r"""
intermediate_hidden_states (`torch.FloatTensor` of shape `(batch_size, config.decoder_layers, num_queries, hidden_size)`):
Stacked intermediate hidden states (output of each layer of the decoder).
intermediate_reference_points (`torch.FloatTensor` of shape `(batch_size,... | MMGroundingDinoDecoderOutput |
python | fluentpython__example-code-2e | 24-class-metaprog/slots/slots_timing.py | {
"start": 261,
"end": 472
} | class ____(type):
def __new__(meta_cls, cls_name, bases, cls_dict):
cls_dict['__slots__'] = ('x', 'y')
return super().__new__(
meta_cls, cls_name, bases, cls_dict)
| Correct1 |
python | cython__cython | Cython/Tests/TestTestUtils.py | {
"start": 149,
"end": 2898
} | class ____(unittest.TestCase):
def setUp(self):
super().setUp()
self.temp_dir = tempfile.mkdtemp()
def tearDown(self):
if self.temp_dir and os.path.isdir(self.temp_dir):
shutil.rmtree(self.temp_dir)
super().tearDown()
def _test_path(self, filename):
retu... | TestTestUtils |
python | wandb__wandb | wandb/vendor/pygments/lexers/scripting.py | {
"start": 25282,
"end": 45809
} | class ____(RegexLexer):
"""
For `AppleScript source code
<http://developer.apple.com/documentation/AppleScript/
Conceptual/AppleScriptLangGuide>`_,
including `AppleScript Studio
<http://developer.apple.com/documentation/AppleScript/
Reference/StudioReference>`_.
Contributed by Andreas Am... | AppleScriptLexer |
python | astropy__astropy | astropy/modeling/tests/test_quantities_evaluation.py | {
"start": 2834,
"end": 2993
} | class ____(Model):
n_inputs = 2
n_outputs = 1
def evaluate(self, a, b):
print("a", a)
print("b", b)
return a * b
| MyTestModel |
python | davidhalter__jedi | jedi/inference/gradual/type_var.py | {
"start": 1451,
"end": 3882
} | class ____(BaseTypingValue):
def __init__(self, parent_context, tree_name, var_name, unpacked_args):
super().__init__(parent_context, tree_name)
self._var_name = var_name
self._constraints_lazy_values = []
self._bound_lazy_value = None
self._covariant_lazy_value = None
... | TypeVar |
python | tensorflow__tensorflow | tensorflow/python/kernel_tests/linalg/sparse/csr_sparse_matrix_dense_mat_mul_grad_test.py | {
"start": 1525,
"end": 5337
} | class ____(test.TestCase):
@classmethod
def setUpClass(cls):
super(CSRSparseMatrixDenseMatMulGradTest, cls).setUpClass()
cls._gpu_available = test_util.is_gpu_available()
# TODO(penporn): Make these tests runnable on eager mode.
# (tf.gradients and gradient_checker only run in graph mode.)
@test_uti... | CSRSparseMatrixDenseMatMulGradTest |
python | apache__airflow | providers/amazon/tests/unit/amazon/aws/links/test_datasync.py | {
"start": 1273,
"end": 2121
} | class ____(BaseAwsLinksTestCase):
link_class = DataSyncTaskLink
def test_extra_link(self, mock_supervisor_comms):
task_id = TASK_ID
if AIRFLOW_V_3_0_PLUS and mock_supervisor_comms:
mock_supervisor_comms.send.return_value = XComResult(
key=self.link_class.key,
... | TestDataSyncTaskLink |
python | apache__airflow | task-sdk/tests/task_sdk/definitions/test_asset.py | {
"start": 16581,
"end": 17863
} | class ____:
@pytest.mark.parametrize(("subcls", "group"), ((Model, "model"), (Dataset, "dataset")))
def test_only_name(self, subcls, group):
obj = subcls(name="foobar")
assert obj.name == "foobar"
assert obj.uri == "foobar"
assert obj.group == group
@pytest.mark.parametrize(... | TestAssetSubclasses |
python | tensorflow__tensorflow | tensorflow/python/kernel_tests/array_ops/array_ops_test.py | {
"start": 56553,
"end": 60158
} | class ____(test_util.TensorFlowTestCase):
def testExceptions(self):
with self.cached_session():
with self.assertRaisesRegex(ValueError, "`maxlen` must be scalar"):
array_ops.sequence_mask([10, 20], [10, 20])
def testOneDimensionalWithMaxlen(self):
res = array_ops.sequence_mask(constant_op.co... | SequenceMaskTest |
python | ray-project__ray | python/ray/util/state/common.py | {
"start": 19874,
"end": 21302
} | class ____(StateSchema):
"""PlacementGroup State"""
#: The id of the placement group.
placement_group_id: str = state_column(filterable=True)
#: The name of the placement group if it is given by the name argument.
name: str = state_column(filterable=True)
#: The job id of the placement group.
... | PlacementGroupState |
python | sqlalchemy__sqlalchemy | test/orm/test_froms.py | {
"start": 116742,
"end": 125450
} | class ____(QueryTest):
"""test mappers with SQL-expressions added as column properties."""
run_setup_mappers = None
def test_external_columns_bad(self):
users, User = self.tables.users, self.classes.User
assert_raises_message(
sa_exc.ArgumentError,
"not represented... | ExternalColumnsTest |
python | scipy__scipy | scipy/sparse/_lil.py | {
"start": 486,
"end": 16732
} | class ____(_spbase, IndexMixin):
_format = 'lil'
def __init__(self, arg1, shape=None, dtype=None, copy=False, *, maxprint=None):
_spbase.__init__(self, arg1, maxprint=maxprint)
self.dtype = getdtype(dtype, arg1, default=float)
# First get the shape
if issparse(arg1):
... | _lil_base |
python | Textualize__rich | examples/attrs.py | {
"start": 184,
"end": 257
} | class ____:
x: float
y: float
z: float = 0
@attr.define
| Point3D |
python | pypa__virtualenv | src/virtualenv/create/via_global_ref/builtin/via_global_self_do.py | {
"start": 339,
"end": 475
} | class ____(ViaGlobalRefMeta):
def __init__(self) -> None:
super().__init__()
self.sources = []
| BuiltinViaGlobalRefMeta |
python | docker__docker-py | docker/types/services.py | {
"start": 20646,
"end": 21230
} | class ____(dict):
"""
Indicates which driver to use, as well as its configuration. Can be used
as ``log_driver`` in a :py:class:`~docker.types.ContainerSpec`,
for the `driver_config` in a volume :py:class:`~docker.types.Mount`, or
as the driver object in
:py:meth:`create_secret`.
Args:
... | DriverConfig |
python | has2k1__plotnine | plotnine/iapi.py | {
"start": 4469,
"end": 5324
} | class ____:
"""
Layout information
"""
panel_index: int
panel: int
row: int
col: int
scale_x: int
scale_y: int
axis_x: bool
axis_y: bool
variables: dict[str, Any]
nrow: int
ncol: int
@property
def is_left(self) -> bool:
"""
Return True if... | layout_details |
python | doocs__leetcode | solution/3500-3599/3527.Find the Most Common Response/Solution.py | {
"start": 0,
"end": 362
} | class ____:
def findCommonResponse(self, responses: List[List[str]]) -> str:
cnt = Counter()
for ws in responses:
for w in set(ws):
cnt[w] += 1
ans = responses[0][0]
for w, x in cnt.items():
if cnt[ans] < x or (cnt[ans] == x and w < ans):
... | Solution |
python | allegroai__clearml | clearml/backend_api/session/client/client.py | {
"start": 8884,
"end": 13551
} | class ____(object):
"""
Represent a server object.
Enables calls like:
>>> client = APIClient()
>>> entity = client.service.get_by_id(entity_id)
>>> entity.action(**kwargs)
instead of:
>>> client.service.action(id=entity_id, **kwargs)
"""
@property
@abc.abstractmethod
de... | Entity |
python | pytorch__pytorch | benchmarks/operator_benchmark/pt/conv_test.py | {
"start": 2990,
"end": 4152
} | class ____(op_bench.TorchBenchmarkBase):
def init(self, IC, OC, kernel, stride, N, H, W, G, pad, device):
self.inputs = {"input": torch.rand(N, IC, H, W, device=device)}
self.conv2d = nn.Conv2d(
IC, OC, kernel, stride=stride, groups=G, padding=pad
).to(device=device)
self... | Conv2dBenchmark |
python | astropy__astropy | astropy/table/tests/test_pprint.py | {
"start": 28862,
"end": 36461
} | class ____:
"""Tests of show and hide table columns"""
def setup_method(self):
self.t = simple_table(size=1, cols=4, kinds="i")
@pytest.mark.parametrize("attr", ("pprint_exclude_names", "pprint_include_names"))
def test_basic(self, attr):
t = self.t
assert (
repr(ge... | TestColumnsShowHide |
python | pandas-dev__pandas | pandas/tests/frame/test_query_eval.py | {
"start": 16420,
"end": 31681
} | class ____:
@pytest.fixture
def engine(self):
return "numexpr"
@pytest.fixture
def parser(self):
return "pandas"
def test_date_query_with_attribute_access(self, engine, parser):
skip_if_no_pandas_parser(parser)
df = DataFrame(np.random.default_rng(2).standard_normal... | TestDataFrameQueryNumExprPandas |
python | prompt-toolkit__python-prompt-toolkit | src/prompt_toolkit/layout/containers.py | {
"start": 46309,
"end": 46631
} | class ____(Enum):
"""
Alignment of the Window content.
Note that this is different from `HorizontalAlign` and `VerticalAlign`,
which are used for the alignment of the child containers in respectively
`VSplit` and `HSplit`.
"""
LEFT = "LEFT"
RIGHT = "RIGHT"
CENTER = "CENTER"
| WindowAlign |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.