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__glom
glom/matching.py
{ "start": 18702, "end": 24488 }
class ____: """Used as a :class:`dict` key in :class:`~glom.Match()` mode, marks that a key which might otherwise not be required should raise :exc:`~glom.MatchError` if the key in the target does not match. For example:: >>> spec = Match({object: object}) This spec will match any dict, bec...
Required
python
pytorch__pytorch
torch/distributed/elastic/timer/api.py
{ "start": 1569, "end": 2289 }
class ____(abc.ABC): """ Client library to acquire and release countdown timers by communicating with the TimerServer. """ @abc.abstractmethod def acquire(self, scope_id: str, expiration_time: float) -> None: """ Acquires a timer for the worker that holds this client object ...
TimerClient
python
joke2k__faker
tests/providers/test_person.py
{ "start": 66420, "end": 67431 }
class ____(unittest.TestCase): """Test vi_VN person provider methods""" def setUp(self): self.fake = Faker("vi_VN") Faker.seed(0) def test_first_names(self): """simple test to verify that we are pulling gender specific names""" name = self.fake.first_name_female() a...
TestViVn
python
apache__airflow
providers/apache/kafka/tests/unit/apache/kafka/hooks/test_client.py
{ "start": 1158, "end": 4390 }
class ____: @pytest.fixture(autouse=True) def setup_connections(self, create_connection_without_db): create_connection_without_db( Connection( conn_id="kafka_d", conn_type="kafka", extra=json.dumps( {"socket.timeout.ms": 10,...
TestKafkaAdminClientHook
python
apache__avro
lang/py/avro/errors.py
{ "start": 1197, "end": 1292 }
class ____(AvroException): """For invalid numbers of bytes read."""
InvalidAvroBinaryEncoding
python
tiangolo__fastapi
fastapi/openapi/models.py
{ "start": 13030, "end": 13139 }
class ____(BaseModelWithConfig): refreshUrl: Optional[str] = None scopes: Dict[str, str] = {}
OAuthFlow
python
pytorch__pytorch
torch/ao/pruning/_experimental/data_sparsifier/lightning/tests/test_callbacks.py
{ "start": 852, "end": 1588 }
class ____(nn.Module): def __init__(self, iC: int, oC: list[int]): super().__init__() self.linears = nn.Sequential() i = iC for idx, c in enumerate(oC): self.linears.append(nn.Linear(i, c, bias=False)) if idx < len(oC) - 1: self.linears.append(...
DummyModel
python
numba__numba
numba/core/codegen.py
{ "start": 38039, "end": 38685 }
class ____(CPUCodeLibrary): def emit_native_object(self): """ Return this library as a native object (a bytestring) -- for example ELF under Linux. This function implicitly calls .finalize(). """ self._ensure_finalized() return self._codegen._tm.emit_object(...
AOTCodeLibrary
python
plotly__plotly.py
plotly/graph_objs/scattercarpet/unselected/_marker.py
{ "start": 233, "end": 4081 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "scattercarpet.unselected" _path_str = "scattercarpet.unselected.marker" _valid_props = {"color", "opacity", "size"} @property def color(self): """ Sets the marker color of unselected points, applied only when a selecti...
Marker
python
pyca__cryptography
tests/hazmat/primitives/test_ec.py
{ "start": 57572, "end": 62545 }
class ____: def test_key_exchange_with_vectors(self, backend, subtests): vectors = load_vectors_from_file( os.path.join( "asymmetric", "ECDH", "KASValidityTest_ECCStaticUnified_NOKC_ZZOnly_init.fax", ), load_kasvs_ecdh_vecto...
TestECDH
python
kamyu104__LeetCode-Solutions
Python/most-profitable-path-in-a-tree.py
{ "start": 1646, "end": 2585 }
class ____(object): def mostProfitablePath(self, edges, bob, amount): """ :type edges: List[List[int]] :type bob: int :type amount: List[int] :rtype: int """ def dfs(u, ah): lookup[u] = True result = 0 if len(adj[u])+(u == 0) == 1 else ...
Solution2
python
joke2k__faker
faker/providers/person/hy_AM/__init__.py
{ "start": 44, "end": 19591 }
class ____(PersonProvider): formats_male = ("{{first_name_male}} {{last_name}}",) formats_female = ("{{first_name_female}} {{last_name}}",) formats = formats_male + formats_female # Source: https://en.wiktionary.org/wiki/Category:Armenian_male_given_names first_names_male = ( "Սիմոն", ...
Provider
python
modin-project__modin
asv_bench/benchmarks/benchmarks.py
{ "start": 38432, "end": 38778 }
class ____: params = [get_benchmark_shapes("TimeMaskBool")] param_names = ["shape"] def setup(self, shape): self.df = IMPL.DataFrame(np.random.randn(*shape)) self.mask = self.df < 0 execute(self.df), execute(self.mask) def time_frame_mask(self, shape): execute(self.df.m...
TimeMaskBool
python
huggingface__transformers
src/transformers/models/autoformer/modeling_autoformer.py
{ "start": 17532, "end": 18679 }
class ____(nn.Module): """ Returns the trend and the seasonal parts of the time series. Calculated as: x_trend = AvgPool(Padding(X)) and x_seasonal = X - x_trend """ def __init__(self, config: AutoformerConfig): super().__init__() self.kernel_size = config.moving_average ...
AutoformerSeriesDecompositionLayer
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1005120, "end": 1007384 }
class ____(sgqlc.types.Type): """Represents a Git tree entry.""" __schema__ = github_schema __field_names__ = ( "extension", "is_generated", "language", "line_count", "mode", "name", "name_raw", "object", "oid", "path", ...
TreeEntry
python
django__django
tests/auth_tests/test_validators.py
{ "start": 15244, "end": 16542 }
class ____(SimpleTestCase): def test_unicode_validator(self): valid_usernames = ["joe", "René", "ᴮᴵᴳᴮᴵᴿᴰ", "أحمد"] invalid_usernames = [ "o'connell", "عبد ال", "zerowidth\u200bspace", "nonbreaking\u00a0space", "en\u2013dash", "t...
UsernameValidatorsTests
python
python-openxml__python-docx
src/docx/oxml/text/run.py
{ "start": 8052, "end": 8825 }
class ____(BaseOxmlElement): """`<w:ptab>` element, representing an absolute-position tab character within a run. This character advances the rendering position to the specified position regardless of any tab-stops, perhaps for layout of a table-of-contents (TOC) or similar. """ def __str__(self) ...
CT_PTab
python
pyca__cryptography
tests/hazmat/primitives/test_padding.py
{ "start": 303, "end": 4538 }
class ____: @pytest.mark.parametrize("size", [127, 4096, -2]) def test_invalid_block_size(self, size): with pytest.raises(ValueError): padding.PKCS7(size) @pytest.mark.parametrize( ("size", "padded"), [ (128, b"1111"), (128, b"1111111111111111"), ...
TestPKCS7
python
Textualize__textual
docs/examples/guide/layout/dock_layout1_sidebar.py
{ "start": 344, "end": 620 }
class ____(App): CSS_PATH = "dock_layout1_sidebar.tcss" def compose(self) -> ComposeResult: yield Static("Sidebar", id="sidebar") yield Static(TEXT * 10, id="body") if __name__ == "__main__": app = DockLayoutExample() app.run()
DockLayoutExample
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 145290, "end": 146000 }
class ____(sgqlc.types.Input): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ( "pull_request_id", "pull_request_review_id", "event", "body", "client_mutation_id", ) pull_request_id = sgqlc.types.Field(ID, graphql...
SubmitPullRequestReviewInput
python
kubernetes-client__python
kubernetes/client/models/v1_cron_job_status.py
{ "start": 383, "end": 5696 }
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...
V1CronJobStatus
python
django__django
django/contrib/admindocs/views.py
{ "start": 8702, "end": 15866 }
class ____(BaseAdminDocsView): template_name = "admin_doc/model_detail.html" def get_context_data(self, **kwargs): model_name = self.kwargs["model_name"] # Get the model class. try: app_config = apps.get_app_config(self.kwargs["app_label"]) except LookupError: ...
ModelDetailView
python
PrefectHQ__prefect
src/prefect/client/schemas/filters.py
{ "start": 35588, "end": 36069 }
class ____(PrefectBaseModel, OperatorMixin): """Filter by `Variable.tags`.""" all_: Optional[List[str]] = Field( default=None, examples=[["tag-1", "tag-2"]], description=( "A list of tags. Variables will be returned only if their tags are a" " superset of the lis...
VariableFilterTags
python
celery__celery
celery/bin/base.py
{ "start": 6050, "end": 6822 }
class ____(CeleryCommand): """Daemon commands.""" def __init__(self, *args, **kwargs): """Initialize a Celery command with common daemon options.""" super().__init__(*args, **kwargs) self.params.extend(( DaemonOption("--logfile", "-f", help="Log destination; defaults to stde...
CeleryDaemonCommand
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/sensors/bigquery_dts.py
{ "start": 1519, "end": 6478 }
class ____(BaseSensorOperator): """ Waits for Data Transfer Service run to complete. .. seealso:: For more information on how to use this sensor, take a look at the guide: :ref:`howto/operator:BigQueryDataTransferServiceTransferRunSensor` :param expected_statuses: The expected state of...
BigQueryDataTransferServiceTransferRunSensor
python
getlogbook__logbook
tests/test_queues.py
{ "start": 2607, "end": 5827 }
class ____(logbook.TestHandler): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.batches = [] def emit(self, record): super().emit(record) self.batches.append([record]) def emit_batch(self, records, reason): for record in records: ...
BatchTestHandler
python
PyCQA__pylint
tests/functional/u/useless/useless_parent_delegation.py
{ "start": 14224, "end": 14349 }
class ____: choices = ["a", 1, (2, 3)] def draw(self) -> Any: return random.choice(self.choices)
ReturnTypeAny
python
python__mypy
mypyc/test-data/fixtures/ir.py
{ "start": 10230, "end": 11341 }
class ____(Mapping[_K, _V]): @overload def __init__(self, **kwargs: _K) -> None: ... @overload def __init__(self, map: Mapping[_K, _V], **kwargs: _V) -> None: ... @overload def __init__(self, iterable: Iterable[Tuple[_K, _V]], **kwargs: _V) -> None: ... def __getitem__(self, key: _K) -> _V: ...
dict
python
neetcode-gh__leetcode
python/0948-bag-of-tokens.py
{ "start": 0, "end": 521 }
class ____: def bagOfTokensScore(self, tokens: List[int], power: int) -> int: res = score = 0 tokens.sort() l, r = 0, len(tokens) - 1 while (l <= r): if power >= tokens[l]: power -= tokens[l] l += 1 score += 1 ...
Solution
python
pytorch__pytorch
test/typing/test_python_operators.py
{ "start": 974, "end": 5584 }
class ____(TestCase): # Prove that UNARY_OPS, BINARY_OPS, and OPERATORS are correct and complete def test_operators_are_correct_and_complete(self): self.assertFalse(set(OPERATORS).difference(token.EXACT_TOKEN_TYPES)) unary, binary, punctuation = {}, {}, {} for op in token.EXACT_TOKEN_T...
TestPythonOperators
python
cython__cython
Cython/Compiler/FlowControl.py
{ "start": 2482, "end": 2596 }
class ____(ControlBlock): """Non-empty exit point block.""" def empty(self): return False
ExitBlock
python
has2k1__plotnine
plotnine/positions/position_dodge2.py
{ "start": 354, "end": 5661 }
class ____(position_dodge): """ Dodge overlaps and place objects side-by-side This is an enhanced version of [](`~plotnine.positions.position_dodge`) that can deal with rectangular overlaps that do not share a lower x border. Parameters ---------- width : Dodging width, when di...
position_dodge2
python
pandas-dev__pandas
pandas/tests/dtypes/test_dtypes.py
{ "start": 880, "end": 2078 }
class ____: def test_hash(self, dtype): hash(dtype) def test_equality_invalid(self, dtype): assert not dtype == "foo" assert not is_dtype_equal(dtype, np.int64) def test_numpy_informed(self, dtype): # npdev 2020-02-02 changed from "data type not understood" to # "C...
Base
python
spack__spack
lib/spack/spack/externals.py
{ "start": 1190, "end": 5984 }
class ____(TypedDict, total=False): """Dictionary representation of an external spec. This representation mostly follows the one used in the configuration files, with a few exceptions needed to support specific features. """ spec: str prefix: str modules: List[str] extra_attributes: Di...
ExternalDict
python
bokeh__bokeh
src/bokeh/models/selectors.py
{ "start": 1792, "end": 2165 }
class ____(Selector): """ Represents a CSS ID selector query. """ # explicit __init__ to support Init signatures def __init__(self, query: Init[str] = Intrinsic, **kwargs: Any) -> None: super().__init__(query=query, **kwargs) query = Required(String, help=""" Element CSS ID without ``#`` p...
ByID
python
dask__dask
dask/dataframe/dask_expr/_rolling.py
{ "start": 4942, "end": 4998 }
class ____(RollingReduction): how = "mean"
RollingMean
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/hooks/cloud_formation.py
{ "start": 1083, "end": 3414 }
class ____(AwsBaseHook): """ Interact with AWS CloudFormation. Provide thin wrapper around :external+boto3:py:class:`boto3.client("cloudformation") <CloudFormation.Client>`. Additional arguments (such as ``aws_conn_id``) may be specified and are passed down to the underlying AwsBaseHook. ...
CloudFormationHook
python
Pylons__pyramid
src/pyramid/view.py
{ "start": 5909, "end": 11222 }
class ____: """A function, class or method :term:`decorator` which allows a developer to create view registrations nearer to a :term:`view callable` definition than use :term:`imperative configuration` to do the same. For example, this code in a module ``views.py``:: from resources import My...
view_config
python
graphql-python__graphene
graphene/types/tests/test_base.py
{ "start": 88, "end": 1688 }
class ____(BaseType): @classmethod def __init_subclass_with_meta__(cls, **options): _meta = CustomOptions(cls) super(CustomType, cls).__init_subclass_with_meta__(_meta=_meta, **options) def test_basetype(): class MyBaseType(CustomType): pass assert isinstance(MyBaseType._meta,...
CustomType
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 151375, "end": 152089 }
class ____(sgqlc.types.Input): """Information from a check run analysis to specific lines of code.""" __schema__ = github_schema __field_names__ = ("start_line", "start_column", "end_line", "end_column") start_line = sgqlc.types.Field(sgqlc.types.non_null(Int), graphql_name="startLine") """The star...
CheckAnnotationRange
python
huggingface__transformers
src/transformers/models/data2vec/modeling_data2vec_audio.py
{ "start": 2151, "end": 3146 }
class ____(GradientCheckpointingLayer): def __init__(self, config, layer_id=0): super().__init__() self.in_conv_dim = config.conv_dim[layer_id - 1] if layer_id > 0 else 1 self.out_conv_dim = config.conv_dim[layer_id] self.conv = nn.Conv1d( self.in_conv_dim, s...
Data2VecAudioConvLayer
python
kamyu104__LeetCode-Solutions
Python/check-if-every-row-and-column-contains-all-numbers.py
{ "start": 31, "end": 443 }
class ____(object): def checkValid(self, matrix): """ :type matrix: List[List[int]] :rtype: bool """ return all(len(set(row)) == len(matrix) for row in matrix) and all(len(set(matrix[i][j] for i in xrange(len(matrix)))) == len(matrix) for j in xrange(len(matrix[0]))) # Time...
Solution
python
pandas-dev__pandas
pandas/core/arrays/integer.py
{ "start": 6071, "end": 6264 }
class ____(IntegerDtype): type = np.uint16 name: ClassVar[str] = "UInt16" __doc__ = _dtype_docstring.format(dtype="uint16") @register_extension_dtype @set_module("pandas")
UInt16Dtype
python
python-pillow__Pillow
Tests/test_file_avif.py
{ "start": 2355, "end": 20932 }
class ____: def test_version(self) -> None: version = features.version_module("avif") assert version is not None assert re.search(r"^\d+\.\d+\.\d+$", version) def test_codec_version(self) -> None: assert AvifImagePlugin.get_codec_version("unknown") is None for codec_nam...
TestFileAvif
python
tensorflow__tensorflow
tensorflow/python/keras/layers/recurrent.py
{ "start": 43210, "end": 46623 }
class ____(Layer): """Abstract object representing an RNN cell. See [the Keras RNN API guide](https://www.tensorflow.org/guide/keras/rnn) for details about the usage of RNN API. This is the base class for implementing RNN cells with custom behavior. Every `RNNCell` must have the properties below and implem...
AbstractRNNCell
python
pytorch__pytorch
torch/_inductor/analyze_preserves_zero_mask.py
{ "start": 2626, "end": 5490 }
class ____(DefaultHandler): def __init__(self, disallow_fp32_ops: bool = False) -> None: self.disallow_fp32_ops = disallow_fp32_ops self.low_precision_numeric_op = False self.dtype_prop = DtypePropagationOpsHandler() self.non_numeric_ops = ( "to_dtype", "const...
RecordLowPrecisionOps
python
readthedocs__readthedocs.org
readthedocs/audit/migrations/0007_auditlog_data.py
{ "start": 149, "end": 634 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("audit", "0006_add_download_action"), ] operations = [ migrations.AddField( model_name="auditlog", name="data", field=models.JSONField( blank=True, ...
Migration
python
huggingface__transformers
examples/modular-transformers/modeling_roberta.py
{ "start": 19175, "end": 20580 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.config = config self.layer = nn.ModuleList([RobertaLayer(config, layer_idx=i) for i in range(config.num_hidden_layers)]) def forward( self, hidden_states: torch.Tensor, attention_mask: Opt...
RobertaEncoder
python
fabric__fabric
fabric/testing/base.py
{ "start": 3778, "end": 13205 }
class ____: """ A mock remote session of a single connection and 1 or more command execs. Allows quick configuration of expected remote state, and also helps generate the necessary test mocks used by `MockRemote` itself. Only useful when handed into `MockRemote`. The parameters ``cmd``, ``out`...
Session
python
readthedocs__readthedocs.org
readthedocs/redirects/tests/test_views.py
{ "start": 661, "end": 9979 }
class ____(TestCase): def setUp(self): self.user = get(User) self.project = get(Project, slug="test", users=[self.user]) self.redirect = get( Redirect, project=self.project, redirect_type=EXACT_REDIRECT, from_url="/404.html", to_url...
TestViews
python
django__django
django/core/cache/backends/locmem.py
{ "start": 351, "end": 4036 }
class ____(BaseCache): pickle_protocol = pickle.HIGHEST_PROTOCOL def __init__(self, name, params): super().__init__(params) self._cache = _caches.setdefault(name, OrderedDict()) self._expire_info = _expire_info.setdefault(name, {}) self._lock = _locks.setdefault(name, Lock()) ...
LocMemCache
python
ray-project__ray
rllib/env/vector/sync_vector_multi_agent_env.py
{ "start": 396, "end": 8329 }
class ____(VectorMultiAgentEnv): def __init__( self, env_fns: Union[ Iterator[Callable[[], MultiAgentEnv]], Sequence[Callable[[], MultiAgentEnv]] ], copy: bool = True, autoreset_mode: str = "next_step", ): super().__init__() self.env_fns = env...
SyncVectorMultiAgentEnv
python
tensorflow__tensorflow
tensorflow/python/eager/polymorphic_function/tracing_compilation.py
{ "start": 2274, "end": 13642 }
class ____: """Configuration options for tracing.""" # Python function to trace. python_function: Callable[[Any], Any] = lambda *args, **kwargs: None # Name given to the traced function. name: str = "function" # Known FunctionType of the python function. polymorphic_type: Optional[function_type_lib.Func...
TracingOptions
python
readthedocs__readthedocs.org
readthedocs/organizations/tests/test_filters.py
{ "start": 323, "end": 2783 }
class ____: @pytest.fixture(autouse=True) def set_up(self, settings, client): settings.RTD_ALLOW_ORGANIZATIONS = True self.client = client @pytest.fixture def filter_data(request): users = dict( user_a=fixture.get(User), owner_a=fixture.get(User), user_b=fixture.get...
OrganizationFilterTestCase
python
coleifer__peewee
tests/psycopg3_ext.py
{ "start": 1268, "end": 1358 }
class ____(TestModel): d1 = BinaryJSONField() d2 = BinaryJSONField(index=False)
JData
python
h5py__h5py
h5py/tests/test_vds/test_virtual_source.py
{ "start": 74, "end": 6055 }
class ____(ut.TestCase): def test_full_slice(self): dataset = h5.VirtualSource('test','test',(20,30,30)) sliced = dataset[:,:,:] self.assertEqual(dataset.shape,sliced.shape) # def test_full_slice_inverted(self): # dataset = h5.VirtualSource('test','test',(20,30,30)) # sl...
TestVirtualSource
python
pyqtgraph__pyqtgraph
pyqtgraph/opengl/items/GLAxisItem.py
{ "start": 158, "end": 2042 }
class ____(GLGraphicsItem): """ **Bases:** :class:`GLGraphicsItem <pyqtgraph.opengl.GLGraphicsItem.GLGraphicsItem>` Displays three lines indicating origin and orientation of local coordinate system. """ def __init__(self, size=None, antialias=True, glOptions='translucent', parentItem...
GLAxisItem
python
ray-project__ray
python/ray/tests/test_runtime_env_standalone.py
{ "start": 9196, "end": 13181 }
class ____: """Test that no user info (e.g. runtime env env vars) show up in the logs.""" def test_assert_no_user_info_in_logs(self, shutdown_only): """Test assert_no_user_info_in_logs does not spuriously pass.""" ray.init() with pytest.raises(AssertionError): assert_no_user...
TestNoUserInfoInLogs
python
huggingface__transformers
src/transformers/models/levit/modeling_levit.py
{ "start": 1278, "end": 2199 }
class ____(ModelOutput): r""" logits (`torch.FloatTensor` of shape `(batch_size, config.num_labels)`): Prediction scores as the average of the `cls_logits` and `distillation_logits`. cls_logits (`torch.FloatTensor` of shape `(batch_size, config.num_labels)`): Prediction scores of the classif...
LevitForImageClassificationWithTeacherOutput
python
spack__spack
lib/spack/spack/directory_layout.py
{ "start": 1757, "end": 13668 }
class ____: """A directory layout is used to associate unique paths with specs. Different installations are going to want different layouts for their install, and they can use this to customize the nesting structure of spack installs. The default layout is: * <install root>/ * <platform-os-targe...
DirectoryLayout
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/test_alloy_db.py
{ "start": 20634, "end": 26486 }
class ____: def setup_method(self): self.operator = AlloyDBUpdateClusterOperator( task_id=TEST_TASK_ID, cluster_id=TEST_CLUSTER_ID, cluster_configuration=TEST_CLUSTER, update_mask=TEST_UPDATE_MASK, allow_missing=TEST_ALLOW_MISSING, proj...
TestAlloyDBUpdateClusterOperator
python
sqlalchemy__sqlalchemy
examples/inheritance/single.py
{ "start": 1680, "end": 2427 }
class ____(Person): # illustrate a single-inh "conflicting" mapped_column declaration, # where both subclasses want to share the same column that is nonetheless # not "local" to the base class @declared_attr def status(cls) -> Mapped[str50]: return Person.__table__.c.get( "status...
Engineer
python
streamlit__streamlit
lib/streamlit/elements/doc_string.py
{ "start": 1614, "end": 17285 }
class ____: @gather_metrics("help") def help( self, obj: Any = streamlit, *, width: WidthWithoutContent = "stretch" ) -> DeltaGenerator: """Display help and other information for a given object. Depending on the type of object that is passed in, this displays the object's na...
HelpMixin
python
modin-project__modin
modin/core/execution/dispatching/factories/factories.py
{ "start": 22914, "end": 23286 }
class ____(BaseFactory): @classmethod @doc(_doc_factory_prepare_method, io_module_name="``PandasOnDaskIO``") def prepare(cls): from modin.core.execution.dask.implementations.pandas_on_dask.io import ( PandasOnDaskIO, ) cls.io_cls = PandasOnDaskIO @doc(_doc_factory_clas...
PandasOnDaskFactory
python
sympy__sympy
sympy/polys/domains/pythonrationalfield.py
{ "start": 306, "end": 2340 }
class ____(RationalField): """Rational field based on :ref:`MPQ`. This will be used as :ref:`QQ` if ``gmpy`` and ``gmpy2`` are not installed. Elements are instances of :ref:`MPQ`. """ dtype = PythonRational # type: ignore zero = dtype(0) # type: ignore one = dtype(1) # type: ignore ali...
PythonRationalField
python
django__django
django/contrib/gis/db/backends/oracle/features.py
{ "start": 230, "end": 1021 }
class ____(BaseSpatialFeatures, OracleDatabaseFeatures): supports_add_srs_entry = False supports_geometry_field_introspection = False supports_geometry_field_unique_index = False supports_perimeter_geodetic = True supports_dwithin_distance_expr = False supports_tolerance_parameter = True uns...
DatabaseFeatures
python
altair-viz__altair
altair/datasets/_cache.py
{ "start": 3578, "end": 6060 }
class ____(CompressedCache["_Dataset", "Metadata"]): """ `csv`_, `gzip`_ -based, lazy metadata lookup. Used as a fallback for 2 scenarios: 1. ``url(...)`` when no optional dependencies are installed. 2. ``(Loader|load)(...)`` when the backend is missing* ``.parquet`` support. Notes ----- ...
CsvCache
python
doocs__leetcode
solution/1900-1999/1933.Check if String Is Decomposable Into Value-Equal Substrings/Solution.py
{ "start": 0, "end": 404 }
class ____: def isDecomposable(self, s: str) -> bool: i, n = 0, len(s) cnt2 = 0 while i < n: j = i while j < n and s[j] == s[i]: j += 1 if (j - i) % 3 == 1: return False cnt2 += (j - i) % 3 == 2 if cn...
Solution
python
walkccc__LeetCode
solutions/191. Number of 1 Bits/191.py
{ "start": 0, "end": 151 }
class ____: def hammingWeight(self, n: int) -> int: ans = 0 for i in range(32): if (n >> i) & 1: ans += 1 return ans
Solution
python
Textualize__textual
examples/color_command.py
{ "start": 437, "end": 943 }
class ____(Provider): """A command provider to select colors.""" async def search(self, query: str) -> Hits: """Called for each key.""" matcher = self.matcher(query) for color in COLOR_NAME_TO_RGB.keys(): score = matcher.match(color) if score > 0: ...
ColorCommands
python
pytorch__pytorch
torch/_export/db/examples/null_context_manager.py
{ "start": 60, "end": 478 }
class ____(torch.nn.Module): """ Null context manager in Python will be traced out. """ def forward(self, x): """ Null context manager in Python will be traced out. """ ctx = contextlib.nullcontext() with ctx: return x.sin() + x.cos() example_args = ...
NullContextManager
python
allegroai__clearml
clearml/utilities/locks/exceptions.py
{ "start": 25, "end": 253 }
class ____(Exception): # Error codes: LOCK_FAILED = 1 def __init__(self, *args: Any, **kwargs: Any) -> None: self.fh = kwargs.pop("fh", None) Exception.__init__(self, *args, **kwargs)
BaseLockException
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/test_workflows.py
{ "start": 8025, "end": 9131 }
class ____: @mock.patch(BASE_PATH.format("Workflow")) @mock.patch(BASE_PATH.format("WorkflowsHook")) def test_execute(self, mock_hook, mock_object): op = WorkflowsGetWorkflowOperator( task_id="test_task", workflow_id=WORKFLOW_ID, location=LOCATION, pro...
TestWorkflowsGetWorkflowOperator
python
django__django
django/template/base.py
{ "start": 3458, "end": 3653 }
class ____(Exception): def __init__(self, msg, params=()): self.msg = msg self.params = params def __str__(self): return self.msg % self.params
VariableDoesNotExist
python
sympy__sympy
sympy/physics/quantum/state.py
{ "start": 20053, "end": 20227 }
class ____(OrthogonalState, BraBase): """Orthogonal Bra in quantum mechanics. """ @classmethod def dual_class(self): return OrthogonalKet
OrthogonalBra
python
pola-rs__polars
py-polars/src/polars/_typing.py
{ "start": 9986, "end": 10105 }
class ____(Protocol): def execute(self, *args: Any, **kwargs: Any) -> Any: """Execute a query."""
BasicCursor
python
astropy__astropy
astropy/units/enums.py
{ "start": 122, "end": 479 }
class ____(StrEnum): SILENT = auto() WARN = auto() RAISE = auto() CONVERT = auto() @classmethod def _missing_(cls, value) -> Self | None: raise ValueError( f"invalid deprecation handling option: {value!r}. Valid options are " f"{', '.join(repr(opt.value) for opt ...
DeprecatedUnitAction
python
geekcomputers__Python
venv/Lib/site-packages/pip/_vendor/distlib/locators.py
{ "start": 3055, "end": 15781 }
class ____(object): """ A base class for locators - things that locate distributions. """ source_extensions = ('.tar.gz', '.tar.bz2', '.tar', '.zip', '.tgz', '.tbz') binary_extensions = ('.egg', '.exe', '.whl') excluded_extensions = ('.pdf',) # A list of tags indicating which wheels you wan...
Locator
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 315291, "end": 315750 }
class ____(sgqlc.types.Input): """Autogenerated input type of UnfollowUser""" __schema__ = github_schema __field_names__ = ("user_id", "client_mutation_id") user_id = sgqlc.types.Field(sgqlc.types.non_null(ID), graphql_name="userId") """ID of the user to unfollow.""" client_mutation_id = sgqlc...
UnfollowUserInput
python
django__django
django/views/generic/detail.py
{ "start": 4029, "end": 6748 }
class ____(TemplateResponseMixin): template_name_field = None template_name_suffix = "_detail" def get_template_names(self): """ Return a list of template names to be used for the request. May not be called if render_to_response() is overridden. Return a list containing ``te...
SingleObjectTemplateResponseMixin
python
numba__numba
numba/core/typeinfer.py
{ "start": 10554, "end": 10640 }
class ____(_BuildContainerConstraint): container_type = types.Set
BuildSetConstraint
python
PyCQA__pylint
tests/functional/u/used/used_before_assignment_py312.py
{ "start": 405, "end": 592 }
class ____[T: Y]: ... type OtherAlias[T: Y] = T | None # https://github.com/pylint-dev/pylint/issues/9884 def func[T: Y](x: T) -> None: # [redefined-outer-name] FALSE POSITIVE ...
Good
python
plotly__plotly.py
plotly/graph_objs/scattergeo/marker/_gradient.py
{ "start": 233, "end": 4907 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "scattergeo.marker" _path_str = "scattergeo.marker.gradient" _valid_props = {"color", "colorsrc", "type", "typesrc"} @property def color(self): """ Sets the final color of the gradient fill: the center color for radial,...
Gradient
python
openai__gym
gym/spaces/sequence.py
{ "start": 254, "end": 5487 }
class ____(Space[Tuple]): r"""This space represent sets of finite-length sequences. This space represents the set of tuples of the form :math:`(a_0, \dots, a_n)` where the :math:`a_i` belong to some space that is specified during initialization and the integer :math:`n` is not fixed Example:: ...
Sequence
python
mlflow__mlflow
dev/clint/src/clint/linter.py
{ "start": 1664, "end": 2924 }
class ____: """Represents a range in source code with start and end positions.""" def __init__(self, start: Position, end: Position | None = None): self.start = start self.end = end if end is not None else start def __str__(self) -> str: return f"{self.start.line}:{self.start.colum...
Range
python
mlflow__mlflow
mlflow/tensorflow/__init__.py
{ "start": 34406, "end": 35405 }
class ____: def __init__(self, model, signature): self.model = model self.signature = signature def get_raw_model(self): """ Returns the underlying model. """ return self.model def predict( self, data, params: dict[str, Any] | None = ...
_TF2ModuleWrapper
python
catalyst-team__catalyst
catalyst/contrib/losses/recsys.py
{ "start": 1579, "end": 2208 }
class ____(nn.Module): """Base class for listwise loss functions. Listwise approach directly looks at the entire list of documents and comes up with an optimal ordering for it. Input space: document set Output space: permutations - ranking of documents """ @staticmethod def _assert_eq...
ListwiseLoss
python
pennersr__django-allauth
allauth/templatetags/allauth.py
{ "start": 4630, "end": 4894 }
class ____(template.Node): def __init__(self, nodelist, var): self.nodelist = nodelist self.var = var def render(self, context): context[self.var] = mark_safe(self.nodelist.render(context).strip()) # nosec return ""
SetVarNode
python
pytorch__pytorch
test/dynamo/test_higher_order_ops.py
{ "start": 146774, "end": 150748 }
class ____(torch.nn.Module): def forward(self, L_x_: "f32[4, 3]", L_y_: "f32[3, 4]"): l_x_ = L_x_ l_y_ = L_y_ _saved_tensors_hooks_disable = torch._C._autograd._saved_tensors_hooks_disable("torch.func.{grad, vjp, jacrev, hessian} don't yet support saved tensor hooks. Please open an issue wi...
GraphModule
python
Netflix__metaflow
test/core/tests/branch_in_switch.py
{ "start": 63, "end": 1152 }
class ____(MetaflowTest): PRIORITY = 2 ONLY_GRAPHS = ["branch_in_switch"] @steps(0, ["start-branch-in-switch"], required=True) def step_start(self): self.mode = "process" @steps(0, ["process-path"], required=True) def step_process(self): pass @steps(0, ["p1"], required=Tru...
BranchInSwitchTest
python
pypa__pipenv
pipenv/patched/pip/_internal/models/pylock.py
{ "start": 1489, "end": 1724 }
class ____: name: str # (not supported) upload_time: Optional[datetime] url: Optional[str] # (not supported) path: Optional[str] # (not supported) size: Optional[int] hashes: Dict[str, str] @dataclass
PackageSdist
python
apache__airflow
providers/standard/src/airflow/providers/standard/operators/empty.py
{ "start": 1003, "end": 1342 }
class ____(BaseOperator): """ Operator that does literally nothing. It can be used to group tasks in a DAG. The task is evaluated by the scheduler but never processed by the executor. """ ui_color = "#e8f7e4" inherits_from_empty_operator = True def execute(self, context: Context): ...
EmptyOperator
python
PrefectHQ__prefect
tests/utilities/test_callables.py
{ "start": 21882, "end": 23177 }
class ____: def test_raises_parameter_bind_with_no_kwargs(self): def dog(x): pass with pytest.raises(ParameterBindError): callables.get_call_parameters(dog, call_args=(), call_kwargs={}) def test_raises_parameter_bind_with_wrong_kwargs_same_number(self): def dog...
TestGetCallParameters
python
getsentry__sentry
src/sentry/auth/services/auth/model.py
{ "start": 6021, "end": 6125 }
class ____(RpcModel): allow_unlinked: bool = False scim_enabled: bool = False
RpcAuthProviderFlags
python
getsentry__sentry
src/sentry/codecov/endpoints/common/serializers.py
{ "start": 41, "end": 356 }
class ____(serializers.Serializer): """ Serializer for pagination information """ endCursor = serializers.CharField(allow_null=True) startCursor = serializers.CharField(allow_null=True) hasPreviousPage = serializers.BooleanField() hasNextPage = serializers.BooleanField()
PageInfoSerializer
python
ray-project__ray
python/ray/train/tests/test_iter_torch_batches_gpu.py
{ "start": 1997, "end": 2240 }
class ____(TupleArrowBatchCollateFn): """Collate function that returns id and value as a list of tensors.""" def __call__(self, batch: pa.Table) -> List[torch.Tensor]: return list(super().__call__(batch))
ListArrowBatchCollateFn
python
ray-project__ray
python/ray/serve/tests/unit/test_metrics_utils.py
{ "start": 5220, "end": 7453 }
class ____: def test_basics(self): s = InMemoryMetricsStore() s.add_metrics_point({"m1": 1}, timestamp=1) s.add_metrics_point({"m1": 2}, timestamp=2) assert s.aggregate_avg(["m1"]) == (1.5, 1) assert s.get_latest("m1") == 2 def test_out_of_order_insert(self): s =...
TestInMemoryMetricsStore
python
ray-project__ray
python/ray/train/v2/_internal/execution/controller/controller.py
{ "start": 2254, "end": 2944 }
class ____: """The result of a single iteration of the control loop.""" run_attempt_id: str previous_state: TrainControllerState next_state: TrainControllerState training_failed_error: Optional[TrainingFailedError] = None def __repr__(self) -> str: return ( f"TrainControlle...
TrainControllerLoopIterationResult
python
pydata__xarray
xarray/coding/strings.py
{ "start": 9055, "end": 10657 }
class ____(indexing.ExplicitlyIndexedNDArrayMixin): """Wrapper around array-like objects to create a new indexable object where values, when accessed, are automatically stacked along the last dimension. >>> indexer = indexing.BasicIndexer((slice(None),)) >>> np.array(StackedBytesArray(np.array(["a", "b...
StackedBytesArray
python
bokeh__bokeh
src/bokeh/models/plots.py
{ "start": 32624, "end": 34383 }
class ____(LayoutDOM, GridCommon): """ Collection of plots and other layoutables on arranged on a rectangular grid. """ # explicit __init__ to support Init signatures def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) toolbar = Instance(Toolbar, defau...
GridPlot