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
sphinx-doc__sphinx
sphinx/ext/autodoc/_dynamic/_member_finder.py
{ "start": 1658, "end": 31515 }
class ____: """A member of object. This is used for the result of `_get_members_to_document()` to represent each member of the object. """ __slots__ = '__name__', 'object', 'docstring', 'class_' __name__: str object: Any docstring: Sequence[str] | None class_: Any skipped: boo...
ObjectMember
python
doocs__leetcode
solution/0000-0099/0052.N-Queens II/Solution.py
{ "start": 0, "end": 587 }
class ____: def totalNQueens(self, n: int) -> int: def dfs(i: int): if i == n: nonlocal ans ans += 1 return for j in range(n): a, b = i + j, i - j + n if cols[j] or dg[a] or udg[b]: co...
Solution
python
doocs__leetcode
solution/0500-0599/0562.Longest Line of Consecutive One in Matrix/Solution.py
{ "start": 0, "end": 717 }
class ____: def longestLine(self, mat: List[List[int]]) -> int: m, n = len(mat), len(mat[0]) a = [[0] * (n + 2) for _ in range(m + 2)] b = [[0] * (n + 2) for _ in range(m + 2)] c = [[0] * (n + 2) for _ in range(m + 2)] d = [[0] * (n + 2) for _ in range(m + 2)] ans = 0...
Solution
python
great-expectations__great_expectations
great_expectations/data_context/types/base.py
{ "start": 59120, "end": 60860 }
class ____(BaseStoreBackendDefaults): """Default store configs for in memory backends. This is useful for testing without persistence. """ def __init__( self, init_temp_docs_sites: bool = False, ) -> None: # Initialize base defaults super().__init__() self....
InMemoryStoreBackendDefaults
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/mssql/base.py
{ "start": 41518, "end": 41717 }
class ____(_DateTimeBase, sqltypes.DateTime): __visit_name__ = "DATETIME2" def __init__(self, precision=None, **kw): super().__init__(**kw) self.precision = precision
DATETIME2
python
dagster-io__dagster
python_modules/dagster-pipes/dagster_pipes/__init__.py
{ "start": 14459, "end": 15408 }
class ____(logging.Handler): def __init__(self, context: "PipesContext") -> None: super().__init__() self._context = context def emit(self, record: logging.LogRecord) -> None: self._context._write_message( # noqa: SLF001 "log", {"message": record.getMessage(), "level": reco...
_PipesLoggerHandler
python
getsentry__sentry
src/sentry/issue_detection/detectors/sql_injection_detector.py
{ "start": 1666, "end": 11111 }
class ____(PerformanceDetector): type = DetectorType.SQL_INJECTION settings_key = DetectorType.SQL_INJECTION def __init__(self, settings: dict[DetectorType, Any], event: dict[str, Any]) -> None: super().__init__(settings, event) self.stored_problems = {} self.request_parameters: li...
SQLInjectionDetector
python
Pylons__pyramid
tests/test_config/test_predicates.py
{ "start": 22297, "end": 22488 }
class ____: package = 'dummy package' registry = 'dummy registry' def get_settings(self): return {} def maybe_dotted(self, thing): return thing
DummyConfigurator
python
patrick-kidger__equinox
equinox/nn/_embedding.py
{ "start": 4012, "end": 10617 }
class ____(Module): """A rotary positional encoding module, as described in the paper "RoFormer: Enhanced Transformer with Rotary Position Embedding". While this module can be used in any context, it is particularly useful for providing positional information to transformer models. !!! Example ...
RotaryPositionalEmbedding
python
fastai__fastai
fastai/torch_core.py
{ "start": 21652, "end": 23304 }
class ____: "Slice and int indexing into a list of lists" def __init__(self, chunks, lens=None): self.chunks = chunks self.lens = L(map(len,self.chunks) if lens is None else lens) self.cumlens = np.cumsum(0+self.lens) self.totlen = self.cumlens[-1] def __getitem__(self,i): ...
Chunks
python
great-expectations__great_expectations
contrib/great_expectations_zipcode_expectations/great_expectations_zipcode_expectations/expectations/expect_column_values_to_be_valid_georgia_zip.py
{ "start": 742, "end": 1743 }
class ____(ColumnMapMetricProvider): # This is the id string that will be used to reference your metric. condition_metric_name = "column_values.valid_georgia_zip" # This method implements the core logic for the PandasExecutionEngine @column_condition_partial(engine=PandasExecutionEngine) def _panda...
ColumnValuesToBeValidGeorgiaZip
python
gawel__pyquery
pyquery/pyquery.py
{ "start": 3852, "end": 4976 }
class ____(object): """property to allow a flexible api""" def __init__(self, pget, pset=no_default, pdel=no_default): self.pget = pget self.pset = pset self.pdel = pdel def __get__(self, instance, klass): class _element(object): """real element to support set/ge...
FlexibleElement
python
ansible__ansible
test/lib/ansible_test/_internal/commands/integration/filters.py
{ "start": 9528, "end": 9654 }
class ____(RemoteTargetFilter[NetworkRemoteConfig]): """Target filter for remote network hosts."""
NetworkRemoteTargetFilter
python
kamyu104__LeetCode-Solutions
Python/longest-common-prefix-between-adjacent-strings-after-removals.py
{ "start": 46, "end": 891 }
class ____(object): def longestCommonPrefix(self, words): """ :type words: List[str] :rtype: List[int] """ def lcp(i, j): if i < 0 or j >= len(words): return 0 s1, s2 = words[i], words[j] for k in xrange(min(len(s1), len(s2)...
Solution
python
py-pdf__pypdf
pypdf/generic/_base.py
{ "start": 2327, "end": 7021 }
class ____(PdfObjectProtocol): # function for calculating a hash value hash_func: Callable[..., "hashlib._Hash"] = hashlib.sha1 indirect_reference: Optional["IndirectObject"] def hash_bin(self) -> int: """ Used to detect modified object. Returns: Hash considering ty...
PdfObject
python
doocs__leetcode
lcci/16.02.Words Frequency/Solution.py
{ "start": 0, "end": 291 }
class ____: def __init__(self, book: List[str]): self.cnt = Counter(book) def get(self, word: str) -> int: return self.cnt[word] # Your WordsFrequency object will be instantiated and called as such: # obj = WordsFrequency(book) # param_1 = obj.get(word)
WordsFrequency
python
pexpect__pexpect
tests/test_missing_command.py
{ "start": 1023, "end": 1407 }
class ____ (PexpectTestCase.PexpectTestCase): def testMissingCommand(self): try: i = pexpect.spawn ('ZXQYQZX') except Exception: pass else: self.fail('Expected an Exception.') if __name__ == '__main__': unittest.main() suite = unittest.TestLoader().l...
MissingCommandTestCase
python
ray-project__ray
python/ray/tests/test_gcs_fault_tolerance.py
{ "start": 36152, "end": 40841 }
class ____(RuntimeEnvPlugin): name = MyPlugin async def create( self, uri, runtime_env, ctx, logger, # noqa: F821 ) -> float: signal_path = runtime_env[self.name].get("signal_path") if signal_path is not None: with open(signal_path, "w") ...
HangPlugin
python
marshmallow-code__apispec
src/apispec/exceptions.py
{ "start": 381, "end": 508 }
class ____(APISpecError): """Raised when registering a parameter already existing in a given scope"""
DuplicateParameterError
python
huggingface__transformers
src/transformers/models/mlcd/modeling_mlcd.py
{ "start": 4096, "end": 9607 }
class ____(nn.Module): def __init__(self, config: MLCDVisionConfig): super().__init__() self.config = config self.embed_dim = config.hidden_size self.image_size = config.image_size self.patch_size = config.patch_size self.class_embedding = nn.Parameter(torch.randn(se...
MLCDVisionEmbeddings
python
conda__conda
conda/api.py
{ "start": 10278, "end": 14511 }
class ____: """ **Beta** While in beta, expect both major and minor changes across minor releases. High-level management and usage of package caches. """ def __init__(self, pkgs_dir): """ **Beta** While in beta, expect both major and minor changes across minor releases. Ar...
PackageCacheData
python
sympy__sympy
sympy/stats/crv.py
{ "start": 10463, "end": 17094 }
class ____(PSpace): """ Continuous Probability Space Represents the likelihood of an event space defined over a continuum. Represented with a ContinuousDomain and a PDF (Lambda-Like) """ is_Continuous = True is_real = True @property def pdf(self): return self.density(*self.do...
ContinuousPSpace
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_excel2003_style05.py
{ "start": 315, "end": 1117 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("excel2003_style05.xlsx") self.ignore_elements = { "xl/drawings/drawing1.xml": [ "<xdr:cNvPr", "<a:p...
TestCompareXLSXFiles
python
kamyu104__LeetCode-Solutions
Python/string-without-aaa-or-bbb.py
{ "start": 33, "end": 583 }
class ____(object): def strWithout3a3b(self, A, B): """ :type A: int :type B: int :rtype: str """ result = [] put_A = None while A or B: if len(result) >= 2 and result[-1] == result[-2]: put_A = result[-1] == 'b' ...
Solution
python
django__django
tests/bulk_create/models.py
{ "start": 668, "end": 746 }
class ____(ProxyCountry): class Meta: proxy = True
ProxyProxyCountry
python
django__django
tests/signals/models.py
{ "start": 701, "end": 818 }
class ____(models.Model): book = models.ForeignKey(Book, on_delete=models.CASCADE) text = models.TextField()
Page
python
python-pillow__Pillow
src/PIL/ImageFile.py
{ "start": 23616, "end": 23897 }
class ____: def __init__(self) -> None: self.xsize = 0 self.ysize = 0 self.xoff = 0 self.yoff = 0 def extents(self) -> tuple[int, int, int, int]: return self.xoff, self.yoff, self.xoff + self.xsize, self.yoff + self.ysize
PyCodecState
python
doocs__leetcode
solution/2100-2199/2140.Solving Questions With Brainpower/Solution2.py
{ "start": 0, "end": 308 }
class ____: def mostPoints(self, questions: List[List[int]]) -> int: n = len(questions) f = [0] * (n + 1) for i in range(n - 1, -1, -1): p, b = questions[i] j = i + b + 1 f[i] = max(f[i + 1], p + (0 if j > n else f[j])) return f[0]
Solution
python
eriklindernoren__ML-From-Scratch
mlfromscratch/supervised_learning/particle_swarm_optimization.py
{ "start": 80, "end": 5985 }
class ____(): """ Particle Swarm Optimization of Neural Network. Parameters: ----------- n_individuals: int The number of neural networks that are allowed in the population at a time. model_builder: method A method which returns a user specified NeuralNetwork instance. inertia_w...
ParticleSwarmOptimizedNN
python
django__django
django/db/backends/ddl_references.py
{ "start": 7355, "end": 8619 }
class ____(TableColumns): def __init__(self, table, expressions, compiler, quote_value): self.compiler = compiler self.expressions = expressions self.quote_value = quote_value columns = [ col.target.column for col in self.compiler.query._gen_cols([self.express...
Expressions
python
ipython__ipython
tests/test_interactiveshell.py
{ "start": 30347, "end": 30730 }
class ____(ast.NodeTransformer): """Throws an InputRejected when it sees a string literal. Used to verify that NodeTransformers can signal that a piece of code should not be executed by throwing an InputRejected. """ def visit_Constant(self, node): if isinstance(node.value, str): ...
StringRejector
python
eventlet__eventlet
tests/mock.py
{ "start": 9801, "end": 9988 }
class ____: "A unique, named, sentinel object." def __init__(self, name): self.name = name def __repr__(self): return 'sentinel.%s' % self.name
_SentinelObject
python
getsentry__sentry
src/sentry/digests/types.py
{ "start": 348, "end": 424 }
class ____(StrEnum): RULE = "rule" WORKFLOW = "workflow"
IdentifierKey
python
getsentry__sentry
src/sentry/models/dashboard_widget.py
{ "start": 2324, "end": 4496 }
class ____(Enum): """ Ambiguous queries that haven't been or couldn't be categorized into a specific dataset. """ UNKNOWN = 0 """ Dataset inferred by either running the query or using heuristics. """ INFERRED = 1 """ Canonical dataset, user explicitly selected it. """ ...
DatasetSourcesTypes
python
openai__openai-python
src/openai/resources/responses/input_tokens.py
{ "start": 1002, "end": 7228 }
class ____(SyncAPIResource): @cached_property def with_raw_response(self) -> InputTokensWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.gith...
InputTokens
python
spack__spack
lib/spack/spack/test/binary_distribution.py
{ "start": 40470, "end": 50359 }
class ____(NamedTuple): manifest_contents: Dict[str, Any] index_contents: str index_hash: str manifest_path: str index_path: str manifest_etag: str fetched_blob: Callable[[], bool] @pytest.fixture def mock_index(tmp_path: pathlib.Path, monkeypatch) -> IndexInformation: mirror_root = tm...
IndexInformation
python
scrapy__scrapy
tests/test_pipeline_files.py
{ "start": 22671, "end": 24834 }
class ____: @inlineCallbacks def test_persist(self): uri = os.environ.get("GCS_TEST_FILE_URI") if not uri: pytest.skip("No GCS URI available for testing") data = b"TestGCSFilesStore: \xe2\x98\x83" buf = BytesIO(data) meta = {"foo": "bar"} path = "full/...
TestGCSFilesStore
python
HypothesisWorks__hypothesis
hypothesis-python/tests/cover/test_pretty.py
{ "start": 16498, "end": 16617 }
class ____(Flag): A = 1 B = 2 def __repr__(self): return "can't parse this nonsense"
EvilReprOptions
python
huggingface__transformers
src/transformers/models/timesfm/modeling_timesfm.py
{ "start": 10562, "end": 11651 }
class ____(nn.Module): """Transformer layer.""" def __init__(self, config: TimesFmConfig, layer_idx: int): super().__init__() self.self_attn = TimesFmAttention(config, layer_idx=layer_idx) self.mlp = TimesFmMLP(config) self.input_layernorm = TimesFmRMSNorm(config.hidden_size, e...
TimesFmDecoderLayer
python
kubernetes-client__python
kubernetes/client/models/v1_photon_persistent_disk_volume_source.py
{ "start": 383, "end": 4940 }
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...
V1PhotonPersistentDiskVolumeSource
python
numba__numba
numba/core/types/npytypes.py
{ "start": 18284, "end": 19667 }
class ____(Array): """ A NestedArray is an array nested within a structured type (which are "void" type in NumPy parlance). Unlike an Array, the shape, and not just the number of dimensions is part of the type of a NestedArray. """ def __init__(self, dtype, shape): if isinstance(dtype, ...
NestedArray
python
django__django
tests/fixtures/models.py
{ "start": 1377, "end": 1860 }
class ____(models.Model): name = models.CharField(max_length=100) tagged_type = models.ForeignKey( ContentType, models.CASCADE, related_name="fixtures_tag_set" ) tagged_id = models.PositiveIntegerField(default=0) tagged = GenericForeignKey(ct_field="tagged_type", fk_field="tagged_id") d...
Tag
python
wandb__wandb
wandb/vendor/pygments/lexers/robotframework.py
{ "start": 2486, "end": 3419 }
class ____(object): def tokenize(self, string, token): var = VariableSplitter(string, identifiers='$@%&') if var.start < 0 or token in (COMMENT, ERROR): yield string, token return for value, token in self._tokenize(var, string, token): if value: ...
VariableTokenizer
python
dask__distributed
distributed/worker_state_machine.py
{ "start": 23981, "end": 25379 }
class ____(ExecuteDoneEvent): run_id: int # FIXME: Utilize the run ID in all ExecuteDoneEvents value: object start: float stop: float nbytes: int type: type | None __slots__ = tuple(__annotations__) def to_loggable(self, *, handled: float) -> StateMachineEvent: out = copy(self)...
ExecuteSuccessEvent
python
kamyu104__LeetCode-Solutions
Python/simplified-fractions.py
{ "start": 58, "end": 420 }
class ____(object): def simplifiedFractions(self, n): """ :type n: int :rtype: List[str] """ lookup = set() for b in xrange(1, n+1): for a in xrange(1, b): g = fractions.gcd(a, b) lookup.add((a//g, b//g)) return map(...
Solution
python
scikit-learn__scikit-learn
sklearn/compose/tests/test_target.py
{ "start": 9658, "end": 10002 }
class ____(TransformerMixin, BaseEstimator): def fit(self, X, y=None): assert isinstance(X, np.ndarray) return self def transform(self, X): assert isinstance(X, np.ndarray) return X def inverse_transform(self, X): assert isinstance(X, np.ndarray) return X
DummyCheckerArrayTransformer
python
keras-team__keras
keras/src/callbacks/remote_monitor.py
{ "start": 260, "end": 2727 }
class ____(Callback): """Callback used to stream events to a server. Requires the `requests` library. Events are sent to `root + '/publish/epoch/end/'` by default. Calls are HTTP POST, with a `data` argument which is a JSON-encoded dictionary of event data. If `send_as_json=True`, the content t...
RemoteMonitor
python
doocs__leetcode
solution/3000-3099/3032.Count Numbers With Unique Digits II/Solution2.py
{ "start": 0, "end": 149 }
class ____: def numberCount(self, a: int, b: int) -> int: return sum(len(set(str(num))) == len(str(num)) for num in range(a, b + 1))
Solution
python
altair-viz__altair
altair/vegalite/v6/schema/core.py
{ "start": 224168, "end": 224494 }
class ____(ConditionalMarkPropFieldOrDatumDef): """ConditionalParameterMarkPropFieldOrDatumDef schema wrapper.""" _schema = {"$ref": "#/definitions/ConditionalParameter<MarkPropFieldOrDatumDef>"} def __init__(self, *args, **kwds): super().__init__(*args, **kwds)
ConditionalParameterMarkPropFieldOrDatumDef
python
getsentry__sentry
src/sentry/apidocs/examples/issue_alert_examples.py
{ "start": 51, "end": 7378 }
class ____: GET_PROJECT_RULE = [ OpenApiExample( "Get detailed view about an issue alert rule", value={ "id": "7", "conditions": [ { "id": "sentry.rules.conditions.regression_event.RegressionEventCondition", ...
IssueAlertExamples
python
walkccc__LeetCode
solutions/1952. Three Divisors/1952.py
{ "start": 0, "end": 320 }
class ____: def isThree(self, n: int) -> bool: if n == 1: return False # The numbers with exactly three divisors are perfect squares of a prime # number. root = math.isqrt(n) return (root**2 == n and all(root % i != 0 for i in range(2, math.isqrt(root) + 1)))
Solution
python
tensorflow__tensorflow
tensorflow/python/distribute/v1/input_lib.py
{ "start": 9029, "end": 11077 }
class ____(DistributedIteratorV1): """Iterator created from input dataset.""" def __init__(self, dataset, input_workers, strategy, num_replicas_in_sync=None, input_context=None): """Make an iterator for the dataset on given devices. ...
DatasetIterator
python
pydantic__pydantic
tests/benchmarks/shared.py
{ "start": 1617, "end": 1695 }
class ____(IntEnum): spanner = 1 wrench = 2 screwdriver = 3
ToolEnum
python
walkccc__LeetCode
solutions/3016. Minimum Number of Pushes to Type Word II/3016.py
{ "start": 0, "end": 256 }
class ____: # Same as 3014. Minimum Number of Pushes to Type Word I def minimumPushes(self, word: str) -> int: freqs = sorted(collections.Counter(word).values(), reverse=True) return sum(freq * (i // 8 + 1) for i, freq in enumerate(freqs))
Solution
python
spyder-ide__spyder
spyder/plugins/tours/tours.py
{ "start": 9161, "end": 9254 }
class ____: IntroductionTour = "introduction_tour" TestTour = "test_tour"
TourIdentifiers
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/oracle/oracledb.py
{ "start": 23108, "end": 23209 }
class ____( _cx_oracle.OracleExecutionContext_cx_oracle ): pass
OracleExecutionContext_oracledb
python
doocs__leetcode
solution/3500-3599/3574.Maximize Subarray GCD Score/Solution.py
{ "start": 0, "end": 649 }
class ____: def maxGCDScore(self, nums: List[int], k: int) -> int: n = len(nums) cnt = [0] * n for i, x in enumerate(nums): while x % 2 == 0: cnt[i] += 1 x //= 2 ans = 0 for l in range(n): g = 0 mi = inf ...
Solution
python
kamyu104__LeetCode-Solutions
Python/path-with-maximum-probability.py
{ "start": 240, "end": 1287 }
class ____(object): def maxProbability(self, n, edges, succProb, start, end): """ :type n: int :type edges: List[List[int]] :type succProb: List[float] :type start: int :type end: int :rtype: float """ adj = collections.defaultdict(list) ...
Solution
python
pyqtgraph__pyqtgraph
pyqtgraph/parametertree/parameterTypes/action.py
{ "start": 1768, "end": 2700 }
class ____(ParameterItem): """ParameterItem displaying a clickable button.""" def __init__(self, param, depth): ParameterItem.__init__(self, param, depth) self.layoutWidget = QtWidgets.QWidget() self.layout = QtWidgets.QHBoxLayout() self.layout.setContentsMargins(0, 0, 0, 0) ...
ActionParameterItem
python
facebookresearch__faiss
benchs/distributed_ondisk/search_server.py
{ "start": 489, "end": 1820 }
class ____(rpc.Server): """ Assign version that can be exposed via RPC """ def __init__(self, s, index): rpc.Server.__init__(self, s) self.index = index def __getattr__(self, f): return getattr(self.index, f) def main(): parser = argparse.ArgumentParser() def aa(*args, **...
MyServer
python
pennersr__django-allauth
allauth/socialaccount/providers/draugiem/provider.py
{ "start": 759, "end": 1511 }
class ____(Provider): id = "draugiem" name = "Draugiem" account_class = DraugiemAccount def get_login_url(self, request, **kwargs): url = reverse(self.id + "_login") if kwargs: url = url + "?" + urlencode(kwargs) return url def extract_uid(self, data): r...
DraugiemProvider
python
scrapy__scrapy
tests/test_exporters.py
{ "start": 21218, "end": 21943 }
class ____(TestBaseItemExporter): def _get_exporter(self, **kwargs): kwargs["encoding"] = "latin" return JsonItemExporter(self.output, **kwargs) def test_two_items_with_failure_between(self): i1 = MyItem(name="Joseph", age="22") i2 = MyItem(name="\u263a", age="11") i3 = ...
TestJsonItemExporterToBytes
python
hynek__structlog
src/structlog/processors.py
{ "start": 16008, "end": 17567 }
class ____: """ A timestamper that only adds a timestamp if there is none. This allows you to overwrite the ``timestamp`` key in the event dict for example when the event is coming from another system. It takes the same arguments as `TimeStamper`. .. versionadded:: 23.2.0 """ __slots...
MaybeTimeStamper
python
django__django
tests/fixtures/models.py
{ "start": 2242, "end": 2369 }
class ____(PersonManager): def get_queryset(self): return super().get_queryset().filter(cover_blown=False)
SpyManager
python
numba__numba
numba/core/types/containers.py
{ "start": 2053, "end": 2522 }
class ____(Type): """ Convenience base class for some container payloads. Derived classes must implement the *container_class* attribute. """ def __init__(self, container): assert isinstance(container, self.container_class) self.container = container name = "payload(%s)" % ...
BaseContainerPayload
python
sympy__sympy
sympy/diffgeom/diffgeom.py
{ "start": 29826, "end": 33855 }
class ____(Expr): r"""Base vector field over a manifold for a given coordinate system. Explanation =========== A vector field is an operator taking a scalar field and returning a directional derivative (which is also a scalar field). A base vector field is the same type of operator, however th...
BaseVectorField
python
pypa__warehouse
tests/common/db/accounts.py
{ "start": 3858, "end": 4027 }
class ____(WarehouseFactory): class Meta: model = UserUniqueLogin user = factory.SubFactory(UserFactory) ip_address = REMOTE_ADDR
UserUniqueLoginFactory
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/contrib/telnet/server.py
{ "start": 7848, "end": 13461 }
class ____: """ Telnet server implementation. Example:: async def interact(connection): connection.send("Welcome") session = PromptSession() result = await session.prompt_async(message="Say something: ") connection.send(f"You said: {result}\n") ...
TelnetServer
python
ray-project__ray
python/ray/data/exceptions.py
{ "start": 873, "end": 3926 }
class ____(Exception): """Represents an Exception originating from Ray Data internal code or Ray Core private code paths, as opposed to user code. When Exceptions of this form are raised, it likely indicates a bug in Ray Data or Ray Core.""" pass @DeveloperAPI def omit_traceback_stdout(fn: Callab...
SystemException
python
pytorch__pytorch
torch/fx/passes/infra/partitioner.py
{ "start": 2031, "end": 17472 }
class ____: def __init__( self, graph_module: GraphModule, operator_support: OperatorSupportBase, allows_single_node_partition: bool = False, non_compute_ops: Optional[Sequence[str]] = None, allowed_single_node_partition_ops: Optional[Sequence[str]] = None, ) -> N...
CapabilityBasedPartitioner
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 655377, "end": 655807 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("actor", "client_mutation_id", "unlocked_record") actor = sgqlc.types.Field(Actor, graphql_name="actor") client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMut...
UnlockLockablePayload
python
pytorch__pytorch
torch/testing/_internal/distributed/nn/api/remote_module_test.py
{ "start": 3949, "end": 18550 }
class ____(CommonRemoteModuleTest): @dist_utils.dist_init def test_bad_module(self): if self.rank != 0: return dst_worker_name = dist_utils.worker_name((self.rank + 1) % self.world_size) remote_device = f"{dst_worker_name}/cpu" args = (1,) kwargs = dict(first_...
RemoteModuleTest
python
huggingface__transformers
tests/models/bart/test_modeling_bart.py
{ "start": 87684, "end": 95530 }
class ____: def __init__( self, parent, vocab_size=99, batch_size=13, d_model=16, decoder_seq_length=7, is_training=True, is_decoder=True, use_attention_mask=True, use_cache=False, use_labels=True, decoder_start_token_id...
BartStandaloneDecoderModelTester
python
astropy__astropy
astropy/coordinates/calculation.py
{ "start": 394, "end": 7138 }
class ____(ValueError): pass def get_sign(dt): """ """ if (int(dt.month) == 12 and int(dt.day) >= 22) or ( int(dt.month) == 1 and int(dt.day) <= 19 ): zodiac_sign = "capricorn" elif (int(dt.month) == 1 and int(dt.day) >= 20) or ( int(dt.month) == 2 and int(dt.day) <= 17 ...
CelestialError
python
huggingface__transformers
src/transformers/feature_extraction_utils.py
{ "start": 8252, "end": 28367 }
class ____(PushToHubMixin): """ This is a feature extraction mixin used to provide saving/loading functionality for sequential and audio feature extractors. """ _auto_class = None def __init__(self, **kwargs): """Set elements of `kwargs` as attributes.""" # Pop "processor_class...
FeatureExtractionMixin
python
doocs__leetcode
solution/2500-2599/2576.Find the Maximum Number of Marked Indices/Solution.py
{ "start": 0, "end": 241 }
class ____: def maxNumOfMarkedIndices(self, nums: List[int]) -> int: nums.sort() i, n = 0, len(nums) for x in nums[(n + 1) // 2 :]: if nums[i] * 2 <= x: i += 1 return i * 2
Solution
python
numpy__numpy
numpy/testing/tests/test_utils.py
{ "start": 45280, "end": 47686 }
class ____: def test_warn(self): def f(): warnings.warn("yo") return 3 before_filters = sys.modules['warnings'].filters[:] assert_equal(assert_warns(UserWarning, f), 3) after_filters = sys.modules['warnings'].filters assert_raises(AssertionError, as...
TestWarns
python
Lightning-AI__lightning
tests/tests_pytorch/checkpointing/test_model_checkpoint.py
{ "start": 42709, "end": 42896 }
class ____(Callback): def on_validation_end(self, trainer, pl_module): if not trainer.sanity_checking: raise RuntimeError("Trouble!")
TroubledCallbackOnValidationEnd
python
tornadoweb__tornado
tornado/test/web_test.py
{ "start": 115754, "end": 116980 }
class ____(WebTestCase): def get_handlers(self): class RemoveSlashHandler(RequestHandler): @removeslash def get(self): pass class AddSlashHandler(RequestHandler): @addslash def get(self): pass return [("/remove...
DecoratorTest
python
getsentry__sentry
src/sentry/integrations/cursor/models.py
{ "start": 341, "end": 436 }
class ____(BaseModel): url: str secret: str | None = None
CursorAgentLaunchRequestWebhook
python
ansible__ansible
lib/ansible/module_utils/facts/network/generic_bsd.py
{ "start": 790, "end": 12595 }
class ____(Network): """ This is a generic BSD subclass of Network using the ifconfig command. It defines - interfaces (a list of interface names) - interface_<name> dictionary of ipv4, ipv6, and mac address information. - all_ipv4_addresses and all_ipv6_addresses: lists of all configured addres...
GenericBsdIfconfigNetwork
python
dagster-io__dagster
python_modules/libraries/dagster-msteams/dagster_msteams/resources.py
{ "start": 243, "end": 3771 }
class ____(ConfigurableResource): """This resource is for connecting to Microsoft Teams. Provides a `dagster_msteams.TeamsClient` which can be used to interface with the MS Teams API. By configuring this resource, you can post messages to MS Teams from any Dagster op, asset, schedule, or sensor: ...
MSTeamsResource
python
kamyu104__LeetCode-Solutions
Python/all-ancestors-of-a-node-in-a-directed-acyclic-graph.py
{ "start": 911, "end": 1877 }
class ____(object): def getAncestors(self, n, edges): """ :type n: int :type edges: List[List[int]] :rtype: List[List[int]] """ def bfs(adj, i, result): lookup = [False]*len(adj) q = [i] lookup[i] = True while q: ...
Solution2
python
google__jax
jax/_src/api.py
{ "start": 103901, "end": 109463 }
class ____: idx: int primal: bool si_vjp = saved_input_vjp def vjp3(f, *primals, has_aux=False): dbg = debug_info("vjp", f, primals, {}) fun = lu.wrap_init(f, debug_info=dbg) return _vjp3(fun, *primals, has_aux=has_aux) def _vjp3(fun, *primals, has_aux=False): canon = lambda x: x if isinstance(x, core.T...
RSpec
python
PrefectHQ__prefect
tests/cli/cloud/test_cloud.py
{ "start": 36912, "end": 45420 }
class ____: @pytest.fixture def workspaces(self, respx_mock: respx.MockRouter): foo_workspace = gen_test_workspace( account_handle="test1", workspace_handle="foo" ) bar_workspace = gen_test_workspace( account_handle="test2", workspace_handle="bar" ) ...
TestCloudWorkspaceLs
python
sympy__sympy
sympy/physics/quantum/circuitplot.py
{ "start": 1163, "end": 10742 }
class ____: """A class for managing a circuit plot.""" scale = 1.0 fontsize = 20.0 linewidth = 1.0 control_radius = 0.05 not_radius = 0.15 swap_delta = 0.05 labels: list[str] = [] inits: dict[str, str] = {} label_buffer = 0.5 def __init__(self, c, nqubits, **kwargs): ...
CircuitPlot
python
numpy__numpy
numpy/ma/tests/test_core.py
{ "start": 200761, "end": 202359 }
class ____: def test_getitem(self): arr = np.ma.array([None, None]) for dt in [float, object]: a0 = np.eye(2).astype(dt) a1 = np.eye(3).astype(dt) arr[0] = a0 arr[1] = a1 assert_(arr[0] is a0) assert_(arr[1] is a1) ...
TestMaskedObjectArray
python
tensorflow__tensorflow
tensorflow/python/ops/numpy_ops/np_random_test.py
{ "start": 4597, "end": 4849 }
class ____(RandomTestBase): def setUp(self): self.np_func = np_random.rand self.onp_func = onp.random.rand super(RandTest, self).setUp() @parameterized.parameters((), (1,), (1, 2)) def test(self, *size): self._test(*size)
RandTest
python
walkccc__LeetCode
solutions/1114. Print in Order/1114.py
{ "start": 29, "end": 536 }
class ____: def __init__(self): self.firstDone = Lock() self.secondDone = Lock() self.firstDone.acquire() self.secondDone.acquire() def first(self, printFirst: 'Callable[[], None]') -> None: printFirst() self.firstDone.release() def second(self, printSecond: 'Callable[[], None]') -> None...
Foo
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/sensors/eks.py
{ "start": 8574, "end": 10795 }
class ____(EksBaseSensor): """ Check the state of an EKS managed node group until it reaches the target state or another terminal state. .. seealso:: For more information on how to use this sensor, take a look at the guide: :ref:`howto/sensor:EksNodegroupStateSensor` :param cluster_nam...
EksNodegroupStateSensor
python
spyder-ide__spyder
external-deps/qtconsole/qtconsole/ansi_code_processor.py
{ "start": 12261, "end": 15692 }
class ____(AnsiCodeProcessor): """ Translates ANSI escape codes into QTextCharFormats. """ # A map from ANSI color codes to SVG color names or RGB(A) tuples. darkbg_color_map = { 0 : 'black', # black 1 : 'darkred', # red 2 : 'darkgreen', # green 3 : 'gold...
QtAnsiCodeProcessor
python
bokeh__bokeh
src/bokeh/command/subcommands/serve.py
{ "start": 17966, "end": 37848 }
class ____(Subcommand): ''' Subcommand to launch the Bokeh server. ''' #: name for this subcommand name = "serve" help = "Run a Bokeh server hosting one or more applications" args = ( *base_serve_args, ('files', Argument( metavar = 'DIRECTORY-OR-SCRIPT', ...
Serve
python
huggingface__transformers
src/transformers/models/lightglue/image_processing_lightglue.py
{ "start": 2059, "end": 5381 }
class ____(ImagesKwargs, total=False): r""" do_grayscale (`bool`, *optional*, defaults to `True`): Whether to convert the image to grayscale. Can be overridden by `do_grayscale` in the `preprocess` method. """ do_grayscale: bool def is_grayscale( image: np.ndarray, input_data_format: ...
LightGlueImageProcessorKwargs
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 527607, "end": 528046 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("id", "name", "name_html") id = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="id") name = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="name") ...
ProjectV2SingleSelectFieldOption
python
Lightning-AI__lightning
src/lightning/pytorch/loops/fetchers.py
{ "start": 5105, "end": 6469 }
class ____(_DataFetcher): """This class is used to return directly the `dataloader_iter` to the ``LightningModule`` training_step for users to implement their own pre-fetching logic. This feature can be activated as follows: Example:: Class MyModel(LightningModule): def training_step(s...
_DataLoaderIterDataFetcher
python
spyder-ide__spyder
spyder/utils/environ.py
{ "start": 9577, "end": 11333 }
class ____(RemoteEnvDialog): """User Environment Variables Viewer/Editor""" def __init__(self, parent=None): title = _("User environment variables") readonly = True if os.name == 'nt': title = _(r"User environment variables in Windows registry") readonly = False ...
UserEnvDialog
python
readthedocs__readthedocs.org
readthedocs/config/models.py
{ "start": 2673, "end": 2828 }
class ____(ConfigBaseModel): include: list[str] | Literal["all"] = [] exclude: list[str] | Literal["all"] = [] recursive: bool = False
Submodules
python
getsentry__sentry
src/sentry/analytics/events/sentry_app_uninstalled.py
{ "start": 79, "end": 239 }
class ____(analytics.Event): user_id: int organization_id: int sentry_app: str analytics.register(SentryAppUninstalledEvent)
SentryAppUninstalledEvent
python
sqlalchemy__sqlalchemy
test/orm/test_relationships.py
{ "start": 171111, "end": 182179 }
class ____(_fixtures.FixtureTest): run_inserts = None @testing.flag_combinations( dict( detached=False, raiseload=False, backref=False, delete=False, active_history=False, legacy_inactive_history_style=True, ), dict...
InactiveHistoryNoRaiseTest
python
wandb__wandb
wandb/sdk/artifacts/_generated/artifact_collection_membership_files.py
{ "start": 992, "end": 1212 }
class ____( GQLResult ): files: Optional[ ArtifactCollectionMembershipFilesProjectArtifactCollectionArtifactMembershipFiles ]
ArtifactCollectionMembershipFilesProjectArtifactCollectionArtifactMembership