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
mahmoud__boltons
boltons/tableutils.py
{ "start": 6314, "end": 6740 }
class ____(InputType): def check_type(self, obj): return hasattr(obj, '_fields') and isinstance(obj, tuple) def guess_headers(self, obj): return list(obj._fields) def get_entry(self, obj, headers): return [getattr(obj, h, None) for h in headers] def get_entry_seq(self, obj_seq...
NamedTupleInputType
python
milvus-io__pymilvus
pymilvus/orm/iterator.py
{ "start": 17074, "end": 31202 }
class ____: def __init__( self, connection: Connections, collection_name: str, data: Union[List, utils.SparseMatrixInputType], ann_field: str, param: Dict, batch_size: Optional[int] = 1000, limit: Optional[int] = UNLIMITED, expr: Optional[str] ...
SearchIterator
python
protocolbuffers__protobuf
python/google/protobuf/internal/field_mask.py
{ "start": 362, "end": 5322 }
class ____(object): """Class for FieldMask message type.""" __slots__ = () def ToJsonString(self): """Converts FieldMask to string according to ProtoJSON spec.""" camelcase_paths = [] for path in self.paths: camelcase_paths.append(_SnakeCaseToCamelCase(path)) return ','.join(camelcase_path...
FieldMask
python
numba__numba
numba/core/datamodel/packer.py
{ "start": 1915, "end": 4973 }
class ____(object): """ Compute the position for each high-level typed argument. It flattens every composite argument into primitive types. It maintains a position map for unflattening the arguments. Since struct (esp. nested struct) have specific ABI requirements (e.g. alignment, pointer addre...
ArgPacker
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 362534, "end": 363121 }
class ____(sgqlc.types.relay.Connection): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("edges", "nodes", "page_info", "total_count") edges = sgqlc.types.Field(sgqlc.types.list_of("LabelEdge"), graphql_name="edges") nodes = sgqlc.types.Field(sgqlc.typ...
LabelConnection
python
scikit-learn__scikit-learn
sklearn/externals/array_api_extra/_lib/_at.py
{ "start": 1243, "end": 15327 }
class ____: # pylint: disable=invalid-name # numpydoc ignore=PR02 """ Update operations for read-only arrays. This implements ``jax.numpy.ndarray.at`` for all writeable backends (those that support ``__setitem__``) and routes to the ``.at[]`` method for JAX arrays. Parameters ---------- ...
at
python
qdrant__qdrant-client
qdrant_client/http/models/models.py
{ "start": 43562, "end": 43611 }
class ____(str, Enum): GEO = "geo"
GeoIndexType
python
Textualize__textual
src/textual/_log.py
{ "start": 24, "end": 298 }
class ____(Enum): """A log group is a classification of the log message (*not* a level).""" UNDEFINED = 0 # Mainly for testing EVENT = 1 DEBUG = 2 INFO = 3 WARNING = 4 ERROR = 5 PRINT = 6 SYSTEM = 7 LOGGING = 8 WORKER = 9
LogGroup
python
getsentry__sentry
src/sentry/utils/snuba.py
{ "start": 13788, "end": 14432 }
class ____(SnubaError): """ Exception raised when a query cannot be executed due to rate limits. """ def __init__( self, message: str | None = None, policy: str | None = None, quota_unit: str | None = None, storage_key: str | None = None, quota_used: int ...
RateLimitExceeded
python
sympy__sympy
sympy/testing/runtests.py
{ "start": 3263, "end": 40429 }
class ____(Exception): pass def _indent(s, indent=4): """ Add the given number of space characters to the beginning of every non-blank line in ``s``, and return the result. If the string ``s`` is Unicode, it is encoded using the stdout encoding and the ``backslashreplace`` error handler. "...
DependencyError
python
celery__celery
t/unit/tasks/test_result.py
{ "start": 31306, "end": 32044 }
class ____: def setup_method(self): self.size = 11 self.app.conf.result_serializer = 'pickle' results = make_mock_group(self.app, 10) failed = mock_task('ts11', states.FAILURE, KeyError('Baz')) save_result(self.app, failed) failed_res = self.app.AsyncResult(failed['i...
test_failed_AsyncResult
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/ruff/RUF009.py
{ "start": 3150, "end": 3248 }
class ____: c: C = C() # https://github.com/astral-sh/ruff/issues/20266 @dataclass(frozen=True)
E
python
sympy__sympy
sympy/physics/control/lti.py
{ "start": 61768, "end": 78651 }
class ____(TransferFunctionBase): r""" A class for representing LTI (Linear, time-invariant) systems that can be strictly described by ratio of polynomials in the z-transform complex variable. The arguments are ``num``, ``den``, ``var``, and ``sampling_time``, where ``num`` and ``den`` are numer...
DiscreteTransferFunction
python
sanic-org__sanic
sanic/cli/arguments.py
{ "start": 5121, "end": 6146 }
class ____(Group): name = "TLS certificate" def attach(self): self.container.add_argument( "--cert", dest="cert", type=str, help="Location of fullchain.pem, bundle.crt or equivalent", ) self.container.add_argument( "--key", ...
TLSGroup
python
jazzband__django-oauth-toolkit
tests/test_application_views.py
{ "start": 700, "end": 2822 }
class ____(BaseTest): @pytest.mark.oauth2_settings({"APPLICATION_MODEL": "tests.SampleApplication"}) def test_get_form_class(self): """ Tests that the form class returned by the "get_form_class" method is bound to custom application model defined in the "OAUTH2_PROVIDER_APPLICATI...
TestApplicationRegistrationView
python
getsentry__sentry
src/sentry/rules/match.py
{ "start": 87, "end": 3132 }
class ____(StrEnum): CONTAINS = "co" ENDS_WITH = "ew" EQUAL = "eq" GREATER_OR_EQUAL = "gte" GREATER = "gt" IS_SET = "is" IS_IN = "in" LESS_OR_EQUAL = "lte" LESS = "lt" NOT_CONTAINS = "nc" NOT_ENDS_WITH = "new" NOT_EQUAL = "ne" NOT_SET = "ns" NOT_STARTS_WITH = "nsw...
MatchType
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/linalg/linear_operator_permutation_test.py
{ "start": 1465, "end": 4107 }
class ____( linear_operator_test_util.SquareLinearOperatorDerivedClassTest): """Most tests done in the base class LinearOperatorDerivedClassTest.""" def tearDown(self): config.enable_tensor_float_32_execution(self.tf32_keep_) def setUp(self): self.tf32_keep_ = config.tensor_float_32_execution_enable...
LinearOperatorPermutationTest
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/clipboard/base.py
{ "start": 304, "end": 622 }
class ____: """ Text on the clipboard. :param text: string :param type: :class:`~prompt_toolkit.selection.SelectionType` """ def __init__( self, text: str = "", type: SelectionType = SelectionType.CHARACTERS ) -> None: self.text = text self.type = type
ClipboardData
python
tensorflow__tensorflow
tensorflow/python/ops/custom_gradient.py
{ "start": 11930, "end": 30651 }
class ____: """When called evaluates `d(f, args, kwargs)` but supports binding `f`. >>> @Bind.decorator ... def my_decorator(f, args, kwargs): ... print("my_decorator called with", args, kwargs) ... return f(*args, **kwargs) >>> class Foo: ... @my_decorator ... def bar(self, a, b, c): ... ...
Bind
python
ray-project__ray
rllib/connectors/agent/state_buffer.py
{ "start": 694, "end": 4361 }
class ____(AgentConnector): def __init__(self, ctx: ConnectorContext, states: Any = None): super().__init__(ctx) self._initial_states = ctx.initial_states self._action_space_struct = get_base_struct_from_space(ctx.action_space) self._states = defaultdict(lambda: defaultdict(lambda:...
StateBufferConnector
python
kamyu104__LeetCode-Solutions
Python/path-with-minimum-effort.py
{ "start": 2130, "end": 3199 }
class ____(object): def minimumEffortPath(self, heights): """ :type heights: List[List[int]] :rtype: int """ def index(n, i, j): return i*n + j diffs = [] for i in xrange(len(heights)): for j in xrange(len(heights[0])): ...
Solution2
python
openai__openai-python
src/openai/types/beta/threads/file_citation_delta_annotation.py
{ "start": 451, "end": 873 }
class ____(BaseModel): index: int """The index of the annotation in the text content part.""" type: Literal["file_citation"] """Always `file_citation`.""" end_index: Optional[int] = None file_citation: Optional[FileCitation] = None start_index: Optional[int] = None text: Optional[st...
FileCitationDeltaAnnotation
python
sympy__sympy
sympy/utilities/codegen.py
{ "start": 39217, "end": 39267 }
class ____(CCodeGen): standard = 'C89'
C89CodeGen
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/datacatalog.py
{ "start": 52963, "end": 57171 }
class ____(GoogleCloudBaseOperator): """ Gets an entry group. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:CloudDataCatalogGetEntryGroupOperator` :param location: Required. The location of the entry group to get. :par...
CloudDataCatalogGetEntryGroupOperator
python
openai__openai-python
src/openai/_types.py
{ "start": 3132, "end": 3404 }
class ____(TypedDict, total=False): headers: Headers max_retries: int timeout: float | Timeout | None params: Query extra_json: AnyMapping idempotency_key: str follow_redirects: bool # Sentinel class used until PEP 0661 is accepted
RequestOptions
python
doocs__leetcode
solution/2200-2299/2285.Maximum Total Importance of Roads/Solution.py
{ "start": 0, "end": 260 }
class ____: def maximumImportance(self, n: int, roads: List[List[int]]) -> int: deg = [0] * n for a, b in roads: deg[a] += 1 deg[b] += 1 deg.sort() return sum(i * v for i, v in enumerate(deg, 1))
Solution
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/test_kubernetes_engine.py
{ "start": 3744, "end": 6275 }
class ____: @pytest.mark.parametrize( ( "use_dns_endpoint", "use_internal_ip", "endpoint", "private_endpoint", "dns_endpoint", "expected_cluster_url", ), [ ( False, False, ...
TestGKEClusterAuthDetails
python
pypa__setuptools
setuptools/warnings.py
{ "start": 3084, "end": 3420 }
class ____(SetuptoolsWarning): """Currently there is no clear way of displaying messages to the users that use the setuptools backend directly via ``pip``. The only thing that might work is a warning, although it is not the most appropriate tool for the job... See pypa/packaging-problems#558. "...
InformationOnly
python
pytorch__pytorch
torch/_guards.py
{ "start": 40308, "end": 43828 }
class ____(Source): base: Source def is_dict_key(self) -> bool: # Recurse until you either hit a ConstDictKey or a Source return self.base.is_dict_key() def is_ephemeral(self) -> bool: return self.base.is_ephemeral() def get_base(self) -> Source: current: Source = self...
ChainedSource
python
qdrant__qdrant-client
qdrant_client/http/api_client.py
{ "start": 1284, "end": 2016 }
class ____(Generic[AsyncClientT]): def __init__(self, host: str, **kwargs: Any): self.client = AsyncApiClient(host, **kwargs) self.aliases_api = AsyncAliasesApi(self.client) self.beta_api = AsyncBetaApi(self.client) self.collections_api = AsyncCollectionsApi(self.client) sel...
AsyncApis
python
langchain-ai__langchain
libs/core/tests/unit_tests/output_parsers/test_openai_tools.py
{ "start": 22610, "end": 22683 }
class ____(BaseModel): age: int hair_color: str job: str
Person
python
tensorflow__tensorflow
tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py
{ "start": 140262, "end": 141897 }
class ____(test.TestCase): def _tf_reduce(self, x, reduction_axes, keepdims): raise NotImplementedError() def _np_reduce(self, x, reduction_axes, keepdims): raise NotImplementedError() def _makeIncremental(self, shape, dtype): data = np.arange(np.prod(shape)).reshape(shape).astype(dtype.as_numpy_dt...
BaseReductionTest
python
pytorch__pytorch
torch/_dynamo/debug_utils.py
{ "start": 4534, "end": 11074 }
class ____: safe_reprs = [ torch.nn.Linear, torch.nn.Conv1d, torch.nn.Conv2d, torch.nn.Conv3d, torch.nn.BatchNorm1d, torch.nn.BatchNorm2d, torch.nn.BatchNorm3d, torch.nn.LayerNorm, torch.nn.Dropout, torch.nn.Softmax, torch.nn.Re...
NNModuleToString
python
getsentry__sentry
src/sentry/api/serializers/models/project_template.py
{ "start": 832, "end": 2496 }
class ____(Serializer): def __init__(self, expand: Iterable[ProjectTemplateAttributes] | None = None) -> None: self.expand = expand def _expand(self, key: ProjectTemplateAttributes) -> bool: return self.expand is not None and key in self.expand def get_attrs( self, item_lis...
ProjectTemplateSerializer
python
django__django
django/contrib/gis/gdal/driver.py
{ "start": 309, "end": 3154 }
class ____(GDALBase): """ Wrap a GDAL/OGR Data Source Driver. For more information, see the C API documentation: https://gdal.org/api/vector_c_api.html https://gdal.org/api/raster_c_api.html """ # Case-insensitive aliases for some GDAL/OGR Drivers. # For a complete list of original driv...
Driver
python
huggingface__transformers
src/transformers/models/mask2former/modeling_mask2former.py
{ "start": 3230, "end": 5334 }
class ____(BaseModelOutputWithCrossAttentions): r""" hidden_states (`tuple(torch.FloatTensor)`, *optional*): Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`. Hidden-states of the model at...
Mask2FormerMaskedAttentionDecoderOutput
python
google__pytype
pytype/pattern_matching.py
{ "start": 7888, "end": 9137 }
class ____: """Tracks branches of match statements.""" def __init__(self, ast_matches): self.start_to_end = {} # match_line : match_end_line self.end_to_starts = collections.defaultdict(list) self.match_cases = {} # opcode_line : match_line self.defaults = set() # lines with defaults self.as...
_Matches
python
cython__cython
Cython/Tests/TestCythonUtils.py
{ "start": 383, "end": 471 }
class ____: @cached_method def cached_next(self, x): return next(x)
Cached
python
ray-project__ray
python/ray/serve/_private/application_state.py
{ "start": 7679, "end": 44357 }
class ____: """Manage single application states with all operations""" def __init__( self, name: str, deployment_state_manager: DeploymentStateManager, autoscaling_state_manager: AutoscalingStateManager, endpoint_state: EndpointState, logging_config: LoggingConfi...
ApplicationState
python
langchain-ai__langchain
libs/langchain/langchain_classic/chains/combine_documents/reduce.py
{ "start": 433, "end": 643 }
class ____(Protocol): """Interface for the combine_docs method.""" def __call__(self, docs: list[Document], **kwargs: Any) -> str: """Interface for the combine_docs method."""
CombineDocsProtocol
python
apache__airflow
airflow-core/src/airflow/api_fastapi/execution_api/datamodels/dagrun.py
{ "start": 1245, "end": 1352 }
class ____(BaseModel): """Schema for DAG Run State response.""" state: DagRunState
DagRunStateResponse
python
gevent__gevent
src/gevent/ssl.py
{ "start": 7469, "end": 34772 }
class ____(socket): """ gevent `ssl.SSLSocket <https://docs.python.org/3/library/ssl.html#ssl-sockets>`_ for Python 3. """ # pylint:disable=too-many-instance-attributes,too-many-public-methods def __init__(self, sock=None, keyfile=None, certfile=None, server_side=False, ce...
SSLSocket
python
streamlit__streamlit
lib/tests/streamlit/elements/progress_test.py
{ "start": 888, "end": 4003 }
class ____(DeltaGeneratorTestCase): """Test DeltaGenerator Progress.""" def test_progress_int(self): """Test Progress with int values.""" values = [0, 42, 100] for value in values: st.progress(value) element = self.get_delta_from_queue().new_element ...
DeltaGeneratorProgressTest
python
pypa__setuptools
setuptools/_distutils/errors.py
{ "start": 1297, "end": 1458 }
class ____(DistutilsError): """Raised by fancy_getopt in response to getopt.error -- ie. an error in the command line usage.""" pass
DistutilsArgError
python
sympy__sympy
sympy/stats/stochastic_process_types.py
{ "start": 65766, "end": 73026 }
class ____: """ Internal class to handle the queries of expectation and probability by substitution. """ @staticmethod def _rvindexed_subs(expr, condition=None): """ Substitutes the RandomIndexedSymbol with the RandomSymbol with same name, distribution and probability as...
_SubstituteRV
python
pyca__cryptography
tests/test_cryptography_utils.py
{ "start": 256, "end": 1667 }
class ____: def test_simple(self): class T: @utils.cached_property def t(self): accesses.append(None) return 14 accesses: typing.List[typing.Optional[T]] = [] assert T.t t = T() assert t.t == 14 assert len(acce...
TestCachedProperty
python
huggingface__transformers
src/transformers/models/siglip/modeling_siglip.py
{ "start": 28166, "end": 36291 }
class ____(SiglipPreTrainedModel): config: SiglipConfig def __init__(self, config: SiglipConfig): super().__init__(config) if not isinstance(config.text_config, SiglipTextConfig): raise TypeError( "config.text_config is expected to be of type SiglipTextConfig but is...
SiglipModel
python
pypa__warehouse
warehouse/events/tags.py
{ "start": 1262, "end": 9074 }
class ____: class Account(EventTagEnum): """Tags for User events.""" # Name = "source_type:subject_type:action" APITokenAdded = "account:api_token:added" APITokenRemoved = "account:api_token:removed" APITokenRemovedLeak = "account:api_token:removed_leak" AccountCreat...
EventTag
python
getsentry__sentry
src/sentry/notifications/platform/types.py
{ "start": 6576, "end": 6753 }
class ____(NotificationBodyFormattingBlock): type: Literal[NotificationBodyFormattingBlockType.PARAGRAPH] blocks: list[NotificationBodyTextBlock] @dataclass
ParagraphBlock
python
kamyu104__LeetCode-Solutions
Python/maximum-of-absolute-value-expression.py
{ "start": 29, "end": 1254 }
class ____(object): def maxAbsValExpr(self, arr1, arr2): """ :type arr1: List[int] :type arr2: List[int] :rtype: int """ # 1. max(|arr1[i]-arr1[j]| + |arr2[i]-arr2[j]| + |i-j| for i > j) # = max(|arr1[i]-arr1[j]| + |arr2[i]-arr2[j]| + |i-j| for j > i) ...
Solution
python
doocs__leetcode
lcof/面试题33. 二叉搜索树的后序遍历序列/Solution2.py
{ "start": 0, "end": 313 }
class ____: def verifyPostorder(self, postorder: List[int]) -> bool: mx = inf stk = [] for x in postorder[::-1]: if x > mx: return False while stk and stk[-1] > x: mx = stk.pop() stk.append(x) return True
Solution
python
python__mypy
mypy/checker.py
{ "start": 375034, "end": 377844 }
class ____(SemanticAnalyzerCoreInterface): """ Adapts TypeChecker to the SemanticAnalyzerCoreInterface, allowing most type expressions to be parsed during the TypeChecker pass. See ExpressionChecker.try_parse_as_type_expression() to understand how this class is used. """ _chk: TypeChecker ...
TypeCheckerAsSemanticAnalyzer
python
django__django
tests/sitemaps_tests/test_https.py
{ "start": 1479, "end": 2929 }
class ____(SitemapTestsBase): extra = {"wsgi.url_scheme": "https"} def test_sitemap_index_with_https_request(self): "A sitemap index requested in HTTPS is rendered with HTTPS links" response = self.client.get("/simple/index.xml", **self.extra) expected_content = """<?xml version="1.0" e...
HTTPSDetectionSitemapTests
python
huggingface__transformers
tests/models/mbart/test_modeling_mbart.py
{ "start": 7965, "end": 15261 }
class ____(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = ( (MBartModel, MBartForConditionalGeneration, MBartForSequenceClassification, MBartForQuestionAnswering) if is_torch_available() else () ) pipeline_model_mapping = ( ...
MBartModelTest
python
matplotlib__matplotlib
galleries/examples/user_interfaces/embedding_webagg_sgskip.py
{ "start": 3505, "end": 8988 }
class ____(tornado.web.Application): class MainPage(tornado.web.RequestHandler): """ Serves the main HTML page. """ def get(self): manager = self.application.manager ws_uri = f"ws://{self.request.host}/" content = html_content % { ...
MyApplication
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/partitions/snap/snap.py
{ "start": 7731, "end": 7993 }
class ____: name: str partitions: PartitionsSnap @whitelist_for_serdes( storage_name="ExternalMultiPartitionsDefinitionData", storage_field_names={"partition_dimensions": "external_partition_dimension_definitions"}, ) @record
PartitionDimensionSnap
python
huggingface__transformers
src/transformers/models/xlm_roberta/modeling_xlm_roberta.py
{ "start": 50356, "end": 53961 }
class ____(XLMRobertaPreTrainedModel): def __init__(self, config): super().__init__(config) self.num_labels = config.num_labels self.qa_outputs = nn.Linear(config.hidden_size, config.num_labels) self.roberta = XLMRobertaModel(config, add_pooling_layer=False) # Initialize we...
XLMRobertaForQuestionAnswering
python
matplotlib__matplotlib
lib/matplotlib/ticker.py
{ "start": 47952, "end": 55526 }
class ____(ScalarFormatter): """ Format axis values using engineering prefixes to represent powers of 1000, plus a specified unit, e.g., 10 MHz instead of 1e7. """ # The SI engineering prefixes ENG_PREFIXES = { -30: "q", -27: "r", -24: "y", -21: "z", -18:...
EngFormatter
python
django__django
tests/builtin_server/tests.py
{ "start": 5667, "end": 6198 }
class ____(TestCase): """ The ServerHandler chunks data properly. Tests for #18972: The logic that performs the math to break data into 32MB (MAX_SOCKET_CHUNK_SIZE) chunks was flawed, BUT it didn't actually cause any problems. """ def test_chunked_data(self): env = {"SERVER_PROTOCO...
ServerHandlerChunksProperly
python
wandb__wandb
wandb/sdk/artifacts/_generated/fragments.py
{ "start": 3861, "end": 3945 }
class ____(GQLResult): file: DeferredManifestFragmentFile
DeferredManifestFragment
python
plotly__plotly.py
plotly/graph_objs/bar/_error_y.py
{ "start": 233, "end": 14355 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "bar" _path_str = "bar.error_y" _valid_props = { "array", "arrayminus", "arrayminussrc", "arraysrc", "color", "symmetric", "thickness", "traceref", "tracerefminus", "type",...
ErrorY
python
pytorch__pytorch
test/ao/sparsity/test_structured_sparsifier.py
{ "start": 2142, "end": 4963 }
class ____(TestCase): def test_saliency_pruner_update_mask(self): """Test that we prune out the row with the lowest saliency (first row)""" model = SimpleLinear() with torch.no_grad(): model.linear1.weight = nn.Parameter( torch.Tensor([[1, 1, 1, 1], [2, 2, 2, 2], ...
TestSaliencyPruner
python
django__django
tests/invalid_models_tests/test_ordinary_fields.py
{ "start": 36780, "end": 37728 }
class ____(TestCase): def test_choices_named_group(self): class Model(models.Model): field = models.UUIDField( choices=[ [ "knights", [ [ uuid.UUID("5c8...
UUIDFieldTests
python
getsentry__sentry
fixtures/sudo_testutils.py
{ "start": 426, "end": 496 }
class ____(StubPasswordBackend): password = "foo"
FooPasswordBackend
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/postgresql/psycopg.py
{ "start": 11196, "end": 20203 }
class ____(_PGDialect_common_psycopg): driver = "psycopg" supports_statement_cache = True supports_server_side_cursors = True default_paramstyle = "pyformat" supports_sane_multi_rowcount = True execution_ctx_cls = PGExecutionContext_psycopg statement_compiler = PGCompiler_psycopg prepa...
PGDialect_psycopg
python
tensorflow__tensorflow
tensorflow/python/distribute/input_lib_test.py
{ "start": 66581, "end": 76630 }
class ____(DistributedIteratorTestBase, parameterized.TestCase): """Tests for PER_WORKER and PER_REPLICA's InputOptions variants.""" @combinations.generate( combinations.combine( input_options=[ distribute_lib.InputOptions( expe...
DistributedIteratorPerDeviceTest
python
python-attrs__attrs
src/attr/_make.py
{ "start": 94233, "end": 101670 }
class ____: """ Stores a converter callable. Allows for the wrapped converter to take additional arguments. The arguments are passed in the order they are documented. Args: converter (Callable): A callable that converts the passed value. takes_self (bool): Pass the par...
Converter
python
dagster-io__dagster
helm/dagster/schema/schema/charts/dagster/subschema/global_.py
{ "start": 33, "end": 203 }
class ____(BaseModel): postgresqlSecretName: str dagsterHome: str serviceAccountName: str celeryConfigSecretName: str dagsterInstanceConfigMap: str
Global
python
django__django
django/contrib/gis/db/models/lookups.py
{ "start": 8368, "end": 8428 }
class ____(GISLookup): lookup_name = "within"
WithinLookup
python
kamyu104__LeetCode-Solutions
Python/minimum-operations-to-make-the-array-increasing.py
{ "start": 29, "end": 387 }
class ____(object): def minOperations(self, nums): """ :type nums: List[int] :rtype: int """ result = prev = 0 for curr in nums: if prev < curr: prev = curr continue prev += 1 result += prev-curr ...
Solution
python
plotly__plotly.py
plotly/graph_objs/histogram2dcontour/legendgrouptitle/_font.py
{ "start": 233, "end": 9982 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "histogram2dcontour.legendgrouptitle" _path_str = "histogram2dcontour.legendgrouptitle.font" _valid_props = { "color", "family", "lineposition", "shadow", "size", "style", "textcase", "var...
Font
python
django-haystack__django-haystack
haystack/exceptions.py
{ "start": 916, "end": 1028 }
class ____(HaystackError): "Raised when incorrect arguments have been provided for stats" pass
StatsError
python
altair-viz__altair
altair/vegalite/v6/schema/core.py
{ "start": 1180789, "end": 1180988 }
class ____(VegaLiteSchema): """ShapeDef schema wrapper.""" _schema = {"$ref": "#/definitions/ShapeDef"} def __init__(self, *args, **kwds): super().__init__(*args, **kwds)
ShapeDef
python
lazyprogrammer__machine_learning_examples
nlp_class2/recursive_theano.py
{ "start": 1016, "end": 9927 }
class ____: def __init__(self, V, D, K): self.V = V self.D = D self.K = K def fit(self, trees, learning_rate=3*1e-3, mu=0.99, reg=1e-4, epochs=15, activation=T.nnet.relu, train_inner_nodes=False): D = self.D V = self.V K = self.K self.f = activation ...
RecursiveNN
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_bar24.py
{ "start": 315, "end": 1316 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_bar24.xlsx") self.ignore_elements = {"xl/workbook.xml": ["<fileVersion", "<calcPr"]} def test_create_file(self): """Test the...
TestCompareXLSXFiles
python
sqlalchemy__sqlalchemy
test/dialect/postgresql/test_reflection.py
{ "start": 4733, "end": 7303 }
class ____(fixtures.TablesTest, AssertsExecutionResults): # partitioned table reflection, issue #4237 __only_on__ = "postgresql >= 10" __sparse_driver_backend__ = True @classmethod def define_tables(cls, metadata): # the actual function isn't reflected yet dv = Table( "...
PartitionedReflectionTest
python
huggingface__transformers
tests/utils/test_modeling_utils.py
{ "start": 132425, "end": 135370 }
class ____(TestCasePlus): """ This test checks that a model can be saved and loaded that uses the torch extra state API. https://pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module.get_extra_state. Currently, only tensor-valued extra_states are supported. """ def test_save_a...
TestSaveAndLoadModelWithExtraState
python
Unity-Technologies__ml-agents
ml-agents/mlagents/trainers/torch_entities/conditioning.py
{ "start": 2777, "end": 5134 }
class ____(torch.nn.Module): def __init__( self, input_size, output_size, hyper_input_size, layer_size, num_layers ): """ Hyper Network module. This module will use the hyper_input tensor to generate the weights of the main network. The main network is a single fully connected ...
HyperNetwork
python
django-guardian__django-guardian
guardian/testapp/models.py
{ "start": 647, "end": 786 }
class ____(UserObjectPermissionBase): content_object = models.ForeignKey("Project", on_delete=models.CASCADE)
ProjectUserObjectPermission
python
scipy__scipy
benchmarks/benchmarks/signal.py
{ "start": 5259, "end": 5864 }
class ____(Benchmark): param_names = ['up', 'down'] params = [ [1, 4], [1, 4] ] def setup(self, up, down): rng = np.random.default_rng(1234) # sample a bunch of pairs of 2d arrays pairs = [] for nfilt in [8, ]: for n in [32, 128, 512, 2048]: ...
Upfirdn1D
python
PyCQA__pylint
tests/functional/i/invalid/invalid_repr_returned.py
{ "start": 851, "end": 1029 }
class ____: """ __repr__ returns node which does not have 'value' in AST """ def __repr__(self): # [invalid-repr-returned] return lambda: "some repr"
ThirdBadRepr
python
sphinx-doc__sphinx
sphinx/ext/autodoc/_property_types.py
{ "start": 5661, "end": 6281 }
class ____(_ItemProperties): obj_type: Literal['attribute', 'data'] value: object annotation: str class_var: bool instance_var: bool _obj_is_generic_alias: bool _obj_is_attribute_descriptor: bool _obj_is_mock: bool _obj_is_sentinel: ( RUNTIME_INSTANCE_ATTRIBUTE_T | SLOTS_A...
_AssignStatementProperties
python
altair-viz__altair
altair/vegalite/v6/schema/core.py
{ "start": 1512451, "end": 1514857 }
class ____(Transform): """ FilterTransform schema wrapper. Parameters ---------- filter : str, dict, :class:`Predicate`, :class:`FieldGTPredicate`, :class:`FieldLTPredicate`, :class:`FieldGTEPredicate`, :class:`FieldLTEPredicate`, :class:`LogicalOrPredicate`, :class:`ParameterPredicate`, :class:`Fi...
FilterTransform
python
kamyu104__LeetCode-Solutions
Python/minimum-number-of-operations-to-make-word-k-periodic.py
{ "start": 63, "end": 362 }
class ____(object): def minimumOperationsToMakeKPeriodic(self, word, k): """ :type word: str :type k: int :rtype: int """ cnt = collections.Counter(word[i:i+k]for i in xrange(0, len(word), k)) return len(word)//k-max(cnt.itervalues())
Solution
python
doocs__leetcode
solution/0800-0899/0879.Profitable Schemes/Solution2.py
{ "start": 0, "end": 661 }
class ____: def profitableSchemes( self, n: int, minProfit: int, group: List[int], profit: List[int] ) -> int: mod = 10**9 + 7 m = len(group) f = [[[0] * (minProfit + 1) for _ in range(n + 1)] for _ in range(m + 1)] for j in range(n + 1): f[0][j][0] = 1 ...
Solution
python
run-llama__llama_index
llama-index-core/tests/test_utils.py
{ "start": 996, "end": 9664 }
class ____(Exception): """Exception that contains retry attribute.""" def __init__(self, should_retry: bool) -> None: """Initialize with parameters.""" self.should_retry = should_retry def test_retry_on_exceptions_with_backoff() -> None: """Make sure retry function has accurate number of ...
ConditionalException
python
getsentry__sentry
src/sentry/notifications/notifications/digest.py
{ "start": 1727, "end": 11871 }
class ____(ProjectNotification): message_builder = "DigestNotificationMessageBuilder" metrics_key = "digest" template_path = "sentry/emails/digests/body" def __init__( self, project: Project, digest: DigestInfo, target_type: ActionTargetType, target_identifier: i...
DigestNotification
python
getsentry__sentry
src/sentry/search/events/builder/profile_functions.py
{ "start": 846, "end": 1079 }
class ____(Protocol): @property def config(self) -> ProfileFunctionsDatasetConfig: ... @property def params(self) -> SnubaParams: ... def column(self, name: str) -> Column: ...
ProfileFunctionsQueryBuilderProtocol
python
huggingface__transformers
tests/models/mobilenet_v2/test_modeling_mobilenet_v2.py
{ "start": 6698, "end": 10190 }
class ____(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): """ Here we also overwrite some of the tests of test_modeling_common.py, as MobileNetV2 does not use input_ids, inputs_embeds, attention_mask and seq_length. """ all_model_classes = ( (MobileNetV2Model, MobileNetV2ForImag...
MobileNetV2ModelTest
python
pallets__jinja
src/jinja2/lexer.py
{ "start": 7666, "end": 8503 }
class ____(t.NamedTuple): lineno: int type: str value: str def __str__(self) -> str: return describe_token(self) def test(self, expr: str) -> bool: """Test a token against a token expression. This can either be a token type or ``'token_type:token_value'``. This can only t...
Token
python
huggingface__transformers
src/transformers/modelcard.py
{ "start": 3067, "end": 13621 }
class ____: r""" Structured Model Card class. Store model card as well as methods for loading/downloading/saving model cards. Please read the following paper for details and explanation on the sections: "Model Cards for Model Reporting" by Margaret Mitchell, Simone Wu, Andrew Zaldivar, Parker Barnes, L...
ModelCard
python
pytorch__pytorch
test/onnx/test_pytorch_onnx_shape_inference.py
{ "start": 16471, "end": 23083 }
class ____(pytorch_test_common.ExportTestCase): def setUp(self): super().setUp() self.opset_version = _constants.ONNX_TORCHSCRIPT_EXPORTER_MAX_OPSET def test_setType_maintains_output_shape_for_single_custom_op(self): self.addCleanup(torch.onnx.unregister_custom_op_symbolic, "::linalg_in...
TestONNXCustomOpShapeInference
python
HypothesisWorks__hypothesis
hypothesis-python/src/hypothesis/strategies/_internal/regex.py
{ "start": 3399, "end": 6726 }
class ____: """Helper object that allows to configure `characters` strategy with various unicode categories and characters. Also allows negation of configured set. :param negate: If True, configure :func:`hypothesis.strategies.characters` to match anything other than configured character set ...
CharactersBuilder
python
streamlit__streamlit
lib/tests/streamlit/runtime/secrets_test.py
{ "start": 2423, "end": 11460 }
class ____(unittest.TestCase): """Tests for st.secrets with a single secrets.toml file""" def setUp(self) -> None: # st.secrets modifies os.environ, so we save it here and # restore in tearDown. self._prev_environ = dict(os.environ) # Run tests on our own Secrets instance to red...
SecretsTest
python
facelessuser__pymdown-extensions
pymdownx/tilde.py
{ "start": 5677, "end": 7333 }
class ____(Extension): """Add delete and/or subscript extension to Markdown class.""" def __init__(self, *args, **kwargs): """Initialize.""" self.config = { 'smart_delete': [True, "Treat ~~connected~~words~~ intelligently - Default: True"], 'delete': [True, "Enable dele...
DeleteSubExtension
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/dataclass8.py
{ "start": 231, "end": 276 }
class ____(ParentA): pass @dataclass
ChildA
python
pytorch__pytorch
test/distributed/fsdp/test_fsdp_optim_state.py
{ "start": 1687, "end": 1926 }
class ____(Enum): """Method for communicating the optimizer state dict for internal tests.""" BROADCAST_OBJECT_LIST = auto() SCATTER_FULL_OSD = auto() FLATTEN_SHARDED_OSD = auto() OPTIM_STATE_DICT = auto()
_OSDCommMethod
python
getsentry__sentry
src/sentry/replays/endpoints/organization_replay_count.py
{ "start": 1273, "end": 1658 }
class ____(serializers.Serializer): query = serializers.CharField(required=True) data_source = serializers.ChoiceField( choices=(Dataset.Discover.value, Dataset.IssuePlatform.value), default=Dataset.Discover.value, ) returnIds = serializers.BooleanField(default=False) @region_silo_endp...
ReplayCountQueryParamsValidator
python
pandas-dev__pandas
pandas/tests/indexes/multi/test_lexsort.py
{ "start": 626, "end": 1358 }
class ____: def test_lexsort_depth(self): # Test that lexsort_depth return the correct sortorder # when it was given to the MultiIndex const. # GH#28518 levels = [[0, 1], [0, 1, 2]] index = MultiIndex( levels=levels, codes=[[0, 0, 0, 1, 1, 1], [0, 1, 2, 0, 1, 2]...
TestLexsortDepth
python
apache__thrift
lib/py/src/protocol/TProtocol.py
{ "start": 946, "end": 1317 }
class ____(TException): """Custom Protocol Exception class""" UNKNOWN = 0 INVALID_DATA = 1 NEGATIVE_SIZE = 2 SIZE_LIMIT = 3 BAD_VERSION = 4 NOT_IMPLEMENTED = 5 DEPTH_LIMIT = 6 INVALID_PROTOCOL = 7 def __init__(self, type=UNKNOWN, message=None): TException.__init__(self,...
TProtocolException