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
rapidsai__cudf
python/cudf/cudf/core/udf/strings_typing.py
{ "start": 1032, "end": 1292 }
class ____(types.Type): np_dtype: np.dtype[np.object_] = np.dtype("object") def __init__(self): super().__init__(name="string_view") @property def return_as(self): return ManagedUDFString() @register_model(StringView)
StringView
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/waiters/test_glue.py
{ "start": 1470, "end": 1701 }
class ____: @pytest.fixture(autouse=True) def mock_conn(self, monkeypatch): self.client = boto3.client("glue") monkeypatch.setattr(GlueDataQualityHook, "conn", self.client)
TestGlueDataQualityCustomWaitersBase
python
eriklindernoren__ML-From-Scratch
mlfromscratch/deep_learning/activation_functions.py
{ "start": 287, "end": 533 }
class ____(): def __call__(self, x): e_x = np.exp(x - np.max(x, axis=-1, keepdims=True)) return e_x / np.sum(e_x, axis=-1, keepdims=True) def gradient(self, x): p = self.__call__(x) return p * (1 - p)
Softmax
python
langchain-ai__langchain
libs/core/langchain_core/runnables/base.py
{ "start": 148011, "end": 158478 }
class ____(Runnable[Input, Output]): """`Runnable` that runs a generator function. `RunnableGenerator`s can be instantiated directly or by using a generator within a sequence. `RunnableGenerator`s can be used to implement custom behavior, such as custom output parsers, while preserving streaming c...
RunnableGenerator
python
langchain-ai__langchain
libs/langchain/langchain_classic/smith/evaluation/string_run_evaluator.py
{ "start": 10586, "end": 18429 }
class ____(Chain, RunEvaluator): """Evaluate Run and optional examples.""" run_mapper: StringRunMapper """Maps the Run to a dictionary with 'input' and 'prediction' strings.""" example_mapper: StringExampleMapper | None = None """Maps the Example (dataset row) to a dictionary with a 'reference'...
StringRunEvaluatorChain
python
google__jax
jax/_src/literals.py
{ "start": 1259, "end": 1595 }
class ____(float): dtype: np.dtype def __new__(cls, value: float, dtype: np.dtype): v = super(TypedFloat, cls).__new__(cls, value) v.dtype = dtype return v def __repr__(self): return f'TypedFloat({float(self)}, dtype={self.dtype.name})' def __getnewargs__(self): return (float(self), self...
TypedFloat
python
pytorch__pytorch
torch/testing/_internal/common_quantization.py
{ "start": 85579, "end": 86068 }
class ____(torch.nn.Module): r"""A Module with manually inserted `QuantStub` and `DeQuantStub`""" def __init__(self) -> None: super().__init__() self.qconfig = torch.ao.quantization.get_default_qconfig("qnnpack") self.quant = QuantStub() self.dequant = DeQuantStub() self...
QuantStubModel
python
spack__spack
lib/spack/spack/spec.py
{ "start": 35443, "end": 41256 }
class ____(collections.abc.Mapping): """Represent a collection of edges (DependencySpec objects) in the DAG. Objects of this class are used in Specs to track edges that are outgoing towards direct dependencies, or edges that are incoming from direct dependents. Edges are stored in a dictionary and...
_EdgeMap
python
run-llama__llama_index
llama-index-core/llama_index/core/llama_dataset/simple.py
{ "start": 2204, "end": 4368 }
class ____(BaseLlamaDataset[LLM]): _example_type = LabelledSimpleDataExample def _construct_prediction_dataset( # type: ignore self, predictions: Sequence[SimpleExamplePrediction] ) -> SimplePredictionDataset: """ Construct the specific prediction dataset. Args: ...
LabelledSimpleDataset
python
django__django
django/urls/resolvers.py
{ "start": 5199, "end": 6366 }
class ____: def describe(self): """ Format the URL pattern for display in warning messages. """ description = "'{}'".format(self) if self.name: description += " [name='{}']".format(self.name) return description def _check_pattern_startswith_slash(self...
CheckURLMixin
python
doocs__leetcode
solution/0800-0899/0813.Largest Sum of Averages/Solution.py
{ "start": 0, "end": 508 }
class ____: def largestSumOfAverages(self, nums: List[int], k: int) -> float: @cache def dfs(i: int, k: int) -> float: if i == n: return 0 if k == 1: return (s[n] - s[i]) / (n - i) ans = 0 for j in range(i + 1, n): ...
Solution
python
google__pytype
pytype/tools/analyze_project/pytype_runner.py
{ "start": 5495, "end": 14901 }
class ____: """Runs pytype over an import graph.""" def __init__(self, conf, sorted_sources): self.filenames = set(conf.inputs) # files to type-check # all source modules as a sequence of (module, direct_deps) self.sorted_sources = sorted_sources self.python_version = conf.python_version self....
PytypeRunner
python
walkccc__LeetCode
solutions/1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree/1379.py
{ "start": 0, "end": 487 }
class ____: def getTargetCopy( self, original: TreeNode, cloned: TreeNode, target: TreeNode, ) -> TreeNode: ans = None def dfs(original: TreeNode, cloned: TreeNode) -> None: nonlocal ans if ans: return if not original: return if original == ta...
Solution
python
pytorch__pytorch
torchgen/model.py
{ "start": 10257, "end": 12538 }
class ____(Enum): Byte = auto() Char = auto() Short = auto() Int = auto() Long = auto() Half = auto() Float = auto() Double = auto() ComplexHalf = auto() ComplexFloat = auto() ComplexDouble = auto() Bool = auto() BFloat16 = auto() Float8_e5m2 = auto() Float8_e...
ScalarType
python
sympy__sympy
sympy/matrices/expressions/fourier.py
{ "start": 273, "end": 1478 }
class ____(MatrixExpr): r""" Returns a discrete Fourier transform matrix. The matrix is scaled with :math:`\frac{1}{\sqrt{n}}` so that it is unitary. Parameters ========== n : integer or Symbol Size of the transform. Examples ======== >>> from sympy.abc import n >>> f...
DFT
python
huggingface__transformers
src/transformers/models/bit/modeling_bit.py
{ "start": 11084, "end": 13432 }
class ____(nn.Module): """Pre-activation (v2) bottleneck block. Follows the implementation of "Identity Mappings in Deep Residual Networks": https://github.com/KaimingHe/resnet-1k-layers/blob/master/resnet-pre-act.lua Except it puts the stride on 3x3 conv when available. """ def __init__( ...
BitPreActivationBottleneckLayer
python
kamyu104__LeetCode-Solutions
Python/count-integers-with-even-digit-sum.py
{ "start": 39, "end": 396 }
class ____(object): def countEven(self, num): """ :type num: int :rtype: int """ def parity(x): result = 0 while x: result += x%10 x //= 10 return result%2 return (num-parity(num))//2 # Time: O(nl...
Solution
python
langchain-ai__langchain
libs/langchain/langchain_classic/chains/sequential.py
{ "start": 4506, "end": 7535 }
class ____(Chain): """Simple chain where the outputs of one step feed directly into next.""" chains: list[Chain] strip_outputs: bool = False input_key: str = "input" output_key: str = "output" model_config = ConfigDict( arbitrary_types_allowed=True, extra="forbid", ) @...
SimpleSequentialChain
python
langchain-ai__langchain
libs/core/langchain_core/prompts/chat.py
{ "start": 11338, "end": 22090 }
class ____(BaseMessagePromptTemplate): """Human message prompt template. This is a message sent from the user.""" prompt: ( StringPromptTemplate | list[StringPromptTemplate | ImagePromptTemplate | DictPromptTemplate] ) """Prompt template.""" additional_kwargs: dict = Field(default_f...
_StringImageMessagePromptTemplate
python
pytorch__pytorch
torch/_export/db/examples/type_reflection_method.py
{ "start": 111, "end": 461 }
class ____(torch.nn.Module): """ type() calls on custom objects followed by attribute accesses are not allowed due to its overly dynamic nature. """ def forward(self, x): a = A() return type(a).func(x) example_args = (torch.randn(3, 4),) tags = {"python.builtin"} model = TypeRefle...
TypeReflectionMethod
python
charliermarsh__ruff
crates/ruff_python_formatter/resources/test/fixtures/ruff/statement/class_definition.py
{ "start": 3627, "end": 3765 }
class ____[A, B, C](meta=Aaaaaaaaaaaaaaaaaaaaaa): pass # Regression test for: https://github.com/astral-sh/ruff/pull/7001
TestTypeParams
python
eventlet__eventlet
eventlet/green/http/client.py
{ "start": 57530, "end": 57662 }
class ____(HTTPException): def __init__(self, version): self.args = version, self.version = version
UnknownProtocol
python
ansible__ansible
test/integration/targets/ansible-test-container/runme.py
{ "start": 23646, "end": 24873 }
class ____: user_scenario: UserScenario engine: str container_name: str image: str disable_selinux: bool expose_cgroup_version: int | None enable_sha1: bool debug_systemd: bool probe_cgroups: bool disable_apparmor_profile_unix_chkpwd: bool @property def tags(self) -> tup...
TestScenario
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 616749, "end": 617084 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("cursor", "node") cursor = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="cursor") node = sgqlc.types.Field(SecurityVulnerability, graphql_name="node")
SecurityVulnerabilityEdge
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 944988, "end": 945740 }
class ____(sgqlc.types.relay.Connection): """The connection type for RepositoryTopic.""" __schema__ = github_schema __field_names__ = ("edges", "nodes", "page_info", "total_count") edges = sgqlc.types.Field(sgqlc.types.list_of("RepositoryTopicEdge"), graphql_name="edges") """A list of edges.""" ...
RepositoryTopicConnection
python
kennethreitz__tablib
src/tablib/packages/dbfpy/fields.py
{ "start": 11916, "end": 14538 }
class ____(DbfFieldDef): """Definition of the timestamp field.""" # a difference between JDN (Julian Day Number) # and GDN (Gregorian Day Number). note, that GDN < JDN JDN_GDN_DIFF = 1721425 typeCode = "T" defaultValue = utils.classproperty(lambda cls: datetime.datetime.now()) # two 32-bits...
DbfDateTimeFieldDef
python
pandas-dev__pandas
pandas/tests/extension/decimal/test_decimal.py
{ "start": 1285, "end": 8316 }
class ____(base.ExtensionTests): def _get_expected_exception( self, op_name: str, obj, other ) -> type[Exception] | tuple[type[Exception], ...] | None: return None def _supports_reduction(self, ser: pd.Series, op_name: str) -> bool: if op_name in ["kurt", "sem"]: return ...
TestDecimalArray
python
pytorch__pytorch
torch/utils/mkldnn.py
{ "start": 2990, "end": 3696 }
class ____(_MkldnnConvNd): def __init__(self, dense_module, dtype) -> None: super().__init__(dense_module) self.register_buffer('weight', torch._C._nn.mkldnn_reorder_conv2d_weight( dense_module.weight.to_mkldnn(dtype), self.padding, self.stride, self....
MkldnnConv2d
python
django__django
tests/admin_changelist/admin.py
{ "start": 3031, "end": 3150 }
class ____(admin.ModelAdmin): list_display = ("band", "player") list_select_related = ("player",)
InvitationAdmin
python
skorch-dev__skorch
examples/benchmarks/history.py
{ "start": 514, "end": 706 }
class ____(Callback): def on_batch_end(self, net, **kwargs): try: net.history[-1, 'batches', -1, 'foobar'] except Exception as e: pass
TriggerKeyError
python
joke2k__faker
faker/providers/bank/ru_RU/__init__.py
{ "start": 42, "end": 16674 }
class ____(BankProvider): """Implement bank provider for ``ru_RU`` locale. Sources for region codes, currency codes, and bank names: - https://ru.wikipedia.org/wiki/Коды_субъектов_Российской_Федерации - https://ru.wikipedia.org/wiki/Общероссийский_классификатор_валют - http://cbr.ru/credit/corepor...
Provider
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/declarative_automation/operators/boolean_operators.py
{ "start": 5054, "end": 8554 }
class ____(BuiltinAutomationCondition[T_EntityKey]): """This class represents the condition that any of its children evaluate to true.""" operands: Sequence[AutomationCondition[T_EntityKey]] @property def description(self) -> str: return "Any of" @property def name(self) -> str: ...
OrAutomationCondition
python
kamyu104__LeetCode-Solutions
Python/shortest-path-in-a-hidden-grid.py
{ "start": 2100, "end": 3778 }
class ____(object): def findShortestPath(self, master): """ :type master: GridMaster :rtype: int """ directions = {'L': (0, -1), 'R': (0, 1), 'U': (-1, 0), 'D': (1, 0)} rollback = {'L': 'R', 'R': 'L', 'U': 'D', 'D': 'U'} def dfs(pos, target, master, lookup, a...
Solution2
python
langchain-ai__langchain
libs/core/tests/unit_tests/test_tools.py
{ "start": 33998, "end": 42306 }
class ____(FooBase): @override def _run(self, bar: Any, bar_config: RunnableConfig, **kwargs: Any) -> Any: return True def test_tool_pass_config_non_pickleable() -> None: tool = FooBaseNonPickleable() args = {"bar": threading.Lock()} tool_call = { "name": tool.name, "args"...
FooBaseNonPickleable
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/freshness_evaluator.py
{ "start": 704, "end": 1261 }
class ____(ABC): """Abstract base class for freshness policy evaluators. Do not implement this class, implement subclasses for each policy type. """ @abstractmethod async def evaluate_freshness( self, context: LoadingContext, node: BaseAssetNode ) -> FreshnessState: """Evaluate ...
FreshnessPolicyEvaluator
python
huggingface__transformers
tests/models/table_transformer/test_modeling_table_transformer.py
{ "start": 7594, "end": 22517 }
class ____(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = ( ( TableTransformerModel, TableTransformerForObjectDetection, ) if is_torch_available() else () ) pipeline_model_mapping = ( {"image-feature-extraction":...
TableTransformerModelTest
python
pandas-dev__pandas
pandas/tests/generic/test_to_xarray.py
{ "start": 3127, "end": 4524 }
class ____: def test_to_xarray_index_types(self, index_flat, request): # MultiIndex is tested in test_to_xarray_with_multiindex index = index_flat ser = Series(range(len(index)), index=index, dtype="int64") ser.index.name = "foo" result = ser.to_xarray() repr(result)...
TestSeriesToXArray
python
ray-project__ray
python/ray/data/_internal/block_builder.py
{ "start": 92, "end": 1197 }
class ____(Generic[T]): """A builder class for blocks.""" @staticmethod def for_block(block: Block) -> "BlockBuilder": return BlockAccessor.for_block(block).builder() def add(self, item: T) -> None: """Append a single row to the block being built.""" raise NotImplementedError ...
BlockBuilder
python
pypa__pipenv
pipenv/vendor/pipdeptree/_freeze.py
{ "start": 942, "end": 2979 }
class ____: """ An adapter class for pip's `pipenv.patched.pip._internal.metadata.BaseDistribution` abstract class. It essentially wraps over an importlib.metadata.Distribution object and provides just enough fields/methods found in pip's `BaseDistribution` so that we can use `pipenv.patched.pip._inter...
PipBaseDistributionAdapter
python
django__django
tests/admin_inlines/tests.py
{ "start": 59163, "end": 70421 }
class ____(TestDataMixin, TestCase): factory = RequestFactory() def test_verbose_name_inline(self): class NonVerboseProfileInline(TabularInline): model = Profile verbose_name = "Non-verbose childs" class VerboseNameProfileInline(TabularInline): model = Verbo...
TestVerboseNameInlineForms
python
huggingface__transformers
src/transformers/models/lightglue/modular_lightglue.py
{ "start": 11586, "end": 12349 }
class ____(nn.Module): def __init__(self, config: LightGlueConfig): super().__init__() self.projector = nn.Linear(2, config.descriptor_dim // config.num_attention_heads // 2, bias=False) def forward( self, keypoints: torch.Tensor, output_hidden_states: Optional[bool] = False ) -> Un...
LightGluePositionalEncoder
python
apache__airflow
task-sdk/tests/task_sdk/execution_time/test_comms.py
{ "start": 1111, "end": 2318 }
class ____: """Test Pydantic models used in task communication for proper validation.""" @pytest.mark.parametrize( "object_to_mask", [ { "key_path": "/files/airflow-breeze-config/keys2/keys.json", "scope": "https://www.googleapis.com/auth/cloud-platfo...
TestCommsModels
python
apache__airflow
providers/google/tests/unit/google/cloud/transfers/test_gcs_to_gcs.py
{ "start": 2287, "end": 43103 }
class ____: """ Tests the three use-cases for the wildcard operator. These are no_prefix: *test_object no_suffix: test_object* prefix_and_suffix: test*object Also tests the destination_object as prefix when the wildcard is used. """ @mock.patch("airflow.providers.google.cloud.transfers....
TestGoogleCloudStorageToCloudStorageOperator
python
ansible__ansible
test/lib/ansible_test/_internal/host_configs.py
{ "start": 2223, "end": 2941 }
class ____(metaclass=abc.ABCMeta): """Base class for host configuration.""" @abc.abstractmethod def get_defaults(self, context: HostContext) -> CompletionConfig: """Return the default settings.""" @abc.abstractmethod def apply_defaults(self, context: HostContext, defaults: CompletionConfig...
HostConfig
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1094899, "end": 1095815 }
class ____(sgqlc.types.Type, Node, UniformResourceLocatable): """Represents a 'closed' event on any `Closable`.""" __schema__ = github_schema __field_names__ = ("actor", "closable", "closer", "created_at", "state_reason") actor = sgqlc.types.Field(Actor, graphql_name="actor") """Identifies the acto...
ClosedEvent
python
allegroai__clearml
clearml/backend_api/services/v2_9/queues.py
{ "start": 55179, "end": 56481 }
class ____(Response): """ Response of queues.move_task_forward endpoint. :param position: The new position of the task entry in the queue (index, -1 represents bottom of queue) :type position: int """ _service = "queues" _action = "move_task_forward" _version = "2.9" _schem...
MoveTaskForwardResponse
python
python-excel__xlwt
xlwt/antlr.py
{ "start": 60786, "end": 62956 }
class ____(Parser): def __init__(self, *args, **kwargs): try: arg1 = args[0] except: arg1 = 1 if isinstance(arg1,int): super(LLkParser,self).__init__() self.k = arg1 return if isinstance(arg1,ParserSharedInputState): ...
LLkParser
python
tensorflow__tensorflow
tensorflow/python/compiler/xla/tests/jit_test.py
{ "start": 7443, "end": 12926 }
class ____(test.TestCase, parameterized.TestCase): @test_util.build_as_function_and_v1_graph def testCompilationInGradient(self): with self.cached_session(): x = constant_op.constant([[3.]]) y_nc = math_ops.matmul(x, x, name="not_compiled") with jit.experimental_jit_scope(): y_c = mat...
CompilationEnabledInGradientTest
python
google__python-fire
fire/console/text.py
{ "start": 2555, "end": 2776 }
class ____(_TextTypes): """Defines text types that can be used for styling text.""" RESOURCE_NAME = 1 URL = 2 USER_INPUT = 3 COMMAND = 4 INFO = 5 URI = 6 OUTPUT = 7 PT_SUCCESS = 8 PT_FAILURE = 9
TextTypes
python
getsentry__sentry
src/sentry/integrations/vsts/webhooks.py
{ "start": 1587, "end": 8798 }
class ____(Endpoint): owner = ApiOwner.INTEGRATIONS publish_status = { "POST": ApiPublishStatus.PRIVATE, } rate_limits = RateLimitConfig( limit_overrides={ "POST": { RateLimitCategory.IP: RateLimit(limit=100, window=1), RateLimitCategory.USER:...
WorkItemWebhook
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_set_start_page02.py
{ "start": 315, "end": 1015 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("set_start_page02.xlsx") self.ignore_elements = {"xl/worksheets/sheet1.xml": ["<pageMargins"]} def test_create_file(self): """Test ...
TestCompareXLSXFiles
python
wandb__wandb
tests/unit_tests/test_launch/test_runner/test_kubernetes.py
{ "start": 6289, "end": 7158 }
class ____: """Mocks a kubernetes batch API client.""" def __init__(self): self.jobs = dict() async def read_namespaced_job(self, name, namespace): return self.jobs[name] async def read_namespaced_job_status(self, name, namespace): return self.jobs[name] async def patch_n...
MockBatchApi
python
pydata__xarray
xarray/tests/test_combine.py
{ "start": 29240, "end": 43700 }
class ____: def test_combine_by_coords(self): objs = [Dataset({"x": [0]}), Dataset({"x": [1]})] actual = combine_by_coords(objs) expected = Dataset({"x": [0, 1]}) assert_identical(expected, actual) actual = combine_by_coords([actual]) assert_identical(expected, actua...
TestCombineDatasetsbyCoords
python
apache__airflow
dev/breeze/src/airflow_breeze/utils/custom_param_types.py
{ "start": 2514, "end": 3843 }
class ____(BetterChoice): """ This parameter allows to pass parameters that do not pass verification by choice. This is useful to keep autocomplete working but also to allow some extra parameters that are dynamic, for example allowing glob in package names for docs building. """ name = "NotVeri...
NotVerifiedBetterChoice
python
pytorch__pytorch
torch/_dynamo/variables/base.py
{ "start": 8066, "end": 8832 }
class ____(type): all_subclasses: list[type] = [] def __instancecheck__(cls: type, instance: object) -> bool: """Make isinstance work with LazyVariableTracker""" # This is super expensive - just having it costs over 4% of tracing # time! if (type(instance) is variables.LazyVaria...
VariableTrackerMeta
python
openai__openai-python
src/openai/types/beta/realtime/conversation_item_delete_event_param.py
{ "start": 232, "end": 569 }
class ____(TypedDict, total=False): item_id: Required[str] """The ID of the item to delete.""" type: Required[Literal["conversation.item.delete"]] """The event type, must be `conversation.item.delete`.""" event_id: str """Optional client-generated ID used to identify this event."""
ConversationItemDeleteEventParam
python
google__pytype
pytype/pytd/pep484_test.py
{ "start": 160, "end": 1348 }
class ____(parser_test_base.ParserTest): """Test the visitors in optimize.py.""" def convert(self, t): """Run ConvertTypingToNative and return the result as a string.""" return pytd_utils.Print(t.Visit(pep484.ConvertTypingToNative(None))) def test_convert_optional(self): t = pytd.GenericType( ...
TestPEP484
python
pymupdf__PyMuPDF
src/__init__.py
{ "start": 94948, "end": 95877 }
class ____: def __init__(self, *args): if args_match( args, mupdf.FzDevice): device, = args self.this = device elif args_match( args, Pixmap, None): pm, clip = args bbox = JM_irect_from_py( clip) if mupdf.fz_is_infinite_irect( bbox): ...
DeviceWrapper
python
fluentpython__example-code-2e
22-dyn-attr-prop/oscon/schedule_v4.py
{ "start": 541, "end": 912 }
class ____: __index = None def __init__(self, **kwargs): self.__dict__.update(kwargs) def __repr__(self): return f'<{self.__class__.__name__} serial={self.serial!r}>' @staticmethod def fetch(key): if Record.__index is None: Record.__index = load() retu...
Record
python
pytransitions__transitions
tests/test_nesting.py
{ "start": 42780, "end": 42849 }
class ____(TestSeparatorsBase): separator = '/'
TestSeparatorsSlash
python
pypa__virtualenv
src/virtualenv/config/convert.py
{ "start": 931, "end": 1061 }
class ____(TypeData): def convert(self, value): if not value: return None return str(value)
NoneType
python
Textualize__textual
src/textual/app.py
{ "start": 7475, "end": 7689 }
class ____: """A file-like where writes go nowhere.""" def write(self, text: str) -> None: pass def flush(self) -> None: pass def isatty(self) -> bool: return True
_NullFile
python
pypa__pipenv
pipenv/patched/pip/_vendor/distlib/version.py
{ "start": 21929, "end": 22103 }
class ____(Version): def parse(self, s): return _semantic_key(s) @property def is_prerelease(self): return self._parts[1][0] != '|'
SemanticVersion
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 25664, "end": 25763 }
class ____(sgqlc.types.Scalar): """Git SSH string""" __schema__ = github_schema
GitSSHRemote
python
django__django
tests/utils_tests/test_autoreload.py
{ "start": 16600, "end": 17116 }
class ____(SimpleTestCase): def test_mutates_error_files(self): fake_method = mock.MagicMock(side_effect=RuntimeError()) wrapped = autoreload.check_errors(fake_method) with mock.patch.object(autoreload, "_error_files") as mocked_error_files: try: with self.assertR...
TestCheckErrors
python
getsentry__sentry
src/sentry/api/serializers/rest_framework/rule.py
{ "start": 3136, "end": 5321 }
class ____(serializers.Serializer): conditions = serializers.ListField(child=RuleNodeField(type="condition/event"), required=False) filters = serializers.ListField(child=RuleNodeField(type="filter/event"), required=False) actionMatch = serializers.ChoiceField( choices=(("all", "all"), ("any", "any")...
RuleSetSerializer
python
more-itertools__more-itertools
tests/test_recipes.py
{ "start": 8568, "end": 11110 }
class ____(TestCase): def test_basic(self): seq = 'ABCDEF' for n, expected in [ (3, [('A', 'B', 'C'), ('D', 'E', 'F')]), (4, [('A', 'B', 'C', 'D'), ('E', 'F', None, None)]), (5, [('A', 'B', 'C', 'D', 'E'), ('F', None, None, None, None)]), (6, [('A', 'B...
GrouperTests
python
getsentry__sentry
src/sentry/integrations/bitbucket/webhook.py
{ "start": 3922, "end": 6154 }
class ____(BitbucketWebhook): # https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html#EventPayloads-Push @property def event_type(self) -> IntegrationWebhookEventType: return IntegrationWebhookEventType.PUSH def __call__(self, event: Mapping[str, Any], **kwargs) -> None: ...
PushEventWebhook
python
django__django
tests/admin_views/tests.py
{ "start": 172265, "end": 176059 }
class ____(TestCase): @classmethod def setUpTestData(cls): cls.superuser = User.objects.create_superuser( username="super", password="secret", email="super@example.com" ) cls.b1 = Book.objects.create(name="Lærdommer") cls.p1 = Promo.objects.create(name="<Promo for Lær...
AdminViewUnicodeTest
python
PrefectHQ__prefect
src/integrations/prefect-gcp/prefect_gcp/credentials.py
{ "start": 2518, "end": 20032 }
class ____(CredentialsBlock): """ Block used to manage authentication with GCP. Google authentication is handled via the `google.oauth2` module or through the CLI. Specify either one of service `account_file` or `service_account_info`; if both are not specified, the client will try to detect the cre...
GcpCredentials
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/abstractClass9.py
{ "start": 340, "end": 413 }
class ____(MixinB, ClassA): pass ClassB(myproperty="myproperty")
ClassB
python
Pylons__pyramid
tests/test_config/test_adapters.py
{ "start": 13143, "end": 13583 }
class ____: def __init__(self, resource, request): self.resource = resource self.request = request def predicate_maker(name): class Predicate: def __init__(self, val, config): self.val = val def phash(self): return 'phash' text = phash ...
DummyResourceURL
python
facebook__pyre-check
tools/incremental_test/tests/specification_tests.py
{ "start": 575, "end": 8044 }
class ____(unittest.TestCase): def test_create_repository_state(self) -> None: self.assertEqual( RepositoryState.from_json( {"kind": "hg", "repository": ".", "commit_hash": "facefacefaceb000"} ), HgRepositoryState(repository=Path("."), commit_hash="facefac...
SpecificationTest
python
huggingface__transformers
src/transformers/tokenization_utils_sentencepiece.py
{ "start": 1276, "end": 12591 }
class ____(PreTrainedTokenizer): """ Base class for SentencePiece-based tokenizers that load from sentencepiece.model files. Inherits from [`~tokenization_utils.PreTrainedTokenizer`]. Handle all the shared methods for tokenization and special tokens as well as methods downloading/caching/loading p...
SentencePieceBackend
python
mitmproxy__pdoc
pdoc/doc.py
{ "start": 39786, "end": 45221 }
class ____(Doc[None]): """ Representation of a variable's documentation. This includes module, class and instance variables. """ kind = "variable" default_value: ( Any | empty ) # technically Any includes empty, but this conveys intent. """ The variable's default value. ...
Variable
python
pypa__pipenv
pipenv/patched/pip/_internal/metadata/base.py
{ "start": 2778, "end": 21545 }
class ____(Protocol): @classmethod def from_directory(cls, directory: str) -> "BaseDistribution": """Load the distribution from a metadata directory. :param directory: Path to a metadata directory, e.g. ``.dist-info``. """ raise NotImplementedError() @classmethod def fr...
BaseDistribution
python
pypa__pip
src/pip/_internal/exceptions.py
{ "start": 21709, "end": 24604 }
class ____(DiagnosticPipError): """The current environment is externally managed. This is raised when the current environment is externally managed, as defined by `PEP 668`_. The ``EXTERNALLY-MANAGED`` configuration is checked and displayed when the error is bubbled up to the user. :param error: T...
ExternallyManagedEnvironment
python
openai__openai-python
src/openai/lib/streaming/chat/_events.py
{ "start": 1026, "end": 1354 }
class ____(BaseModel): type: Literal["tool_calls.function.arguments.delta"] name: str index: int arguments: str """Accumulated raw JSON string""" parsed_arguments: object """The parsed arguments so far""" arguments_delta: str """The JSON string delta"""
FunctionToolCallArgumentsDeltaEvent
python
walkccc__LeetCode
solutions/3203. Find Minimum Diameter After Merging Two Trees/3203.py
{ "start": 0, "end": 1314 }
class ____: def minimumDiameterAfterMerge( self, edges1: list[list[int]], edges2: list[list[int]], ) -> int: diameter1 = self._getDiameter(edges1) diameter2 = self._getDiameter(edges2) combinedDiameter = (diameter1 + 1) // 2 + (diameter2 + 1) // 2 + 1 return max(diameter1, diameter...
Solution
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/protocol3.py
{ "start": 4805, "end": 4846 }
class ____: prop1: int = 0
Concrete15_2
python
pallets__quart
src/quart/typing.py
{ "start": 4102, "end": 4315 }
class ____(Protocol): def __init__(self, app: Quart, scope: HTTPScope) -> None: ... async def __call__( self, receive: ASGIReceiveCallable, send: ASGISendCallable ) -> None: ...
ASGIHTTPProtocol
python
walkccc__LeetCode
solutions/452. Minimum Number of Arrows to Burst Balloons/452.py
{ "start": 0, "end": 255 }
class ____: def findMinArrowShots(self, points: list[list[int]]) -> int: ans = 0 arrowX = -math.inf for point in sorted(points, key=lambda x: x[1]): if point[0] > arrowX: ans += 1 arrowX = point[1] return ans
Solution
python
dask__distributed
distributed/dashboard/components/worker.py
{ "start": 1856, "end": 2906 }
class ____(DashboardComponent): """Currently running tasks""" def __init__(self, worker): self.worker = worker names = ["Stored", "Executing", "Ready", "Waiting", "Connections", "Serving"] self.source = ColumnDataSource({name: [] for name in names}) columns = {name: TableColum...
StateTable
python
great-expectations__great_expectations
great_expectations/compatibility/postgresql.py
{ "start": 2291, "end": 2590 }
class ____: """Namespace for PostgreSQL dialect types.""" TEXT = TEXT CHAR = CHAR INTEGER = INTEGER SMALLINT = SMALLINT BIGINT = BIGINT TIMESTAMP = TIMESTAMP DATE = DATE DOUBLE_PRECISION = DOUBLE_PRECISION BOOLEAN = BOOLEAN NUMERIC = NUMERIC
POSTGRESQL_TYPES
python
getsentry__sentry
tests/sentry/integrations/github/test_client.py
{ "start": 38098, "end": 51926 }
class ____(GitHubClientFileBlameBase): """ Tests that get_blame_for_files builds the correct GraphQL query """ def setUp(self) -> None: super().setUp() @mock.patch("sentry.integrations.github.client.get_jwt", return_value="jwt_token_1") @responses.activate def test_get_blame_for_fi...
GitHubClientFileBlameQueryBuilderTest
python
tensorflow__tensorflow
tensorflow/python/eager/device_placement_test.py
{ "start": 8217, "end": 10210 }
class ____(test.TestCase): def setUp(self): super(ClusterPlacementTest, self).setUp() context._reset_context() config.set_soft_device_placement(enabled=True) context.context().log_device_placement = True workers, _ = test_util.create_local_cluster(2, 0) remote.connect_to_remote_host([workers[...
ClusterPlacementTest
python
fastai__fastai
fastai/collab.py
{ "start": 1758, "end": 4258 }
class ____(Module): "Base dot model for collaborative filtering." def __init__(self, n_factors, n_users, n_items, y_range=None): self.y_range = y_range (self.u_weight, self.i_weight, self.u_bias, self.i_bias) = [Embedding(*o) for o in [ (n_users, n_factors), (n_items, n_factors), (n_...
EmbeddingDotBias
python
ethereum__web3.py
ens/exceptions.py
{ "start": 2344, "end": 2442 }
class ____(ENSException): """ Raised if there is a validation error """
ENSValidationError
python
pyqtgraph__pyqtgraph
pyqtgraph/flowchart/library/Filters.py
{ "start": 6659, "end": 6999 }
class ____(CtrlNode): """Removes linear trend from the data""" nodeName = 'DetrendFilter' def processData(self, data): try: from scipy.signal import detrend except ImportError: raise Exception("DetrendFilter node requires the package scipy.signal.") retur...
Detrend
python
pydata__xarray
doc/examples/_code/accessor_example.py
{ "start": 59, "end": 703 }
class ____: def __init__(self, xarray_obj): self._obj = xarray_obj self._center = None @property def center(self): """Return the geographic center point of this dataset.""" if self._center is None: # we can use a cache on our accessor objects, because accessors ...
GeoAccessor
python
squidfunk__mkdocs-material
material/plugins/blog/structure/__init__.py
{ "start": 6580, "end": 10158 }
class ____(Page): # Initialize an excerpt for the given post - we create the Markdown parser # when intitializing the excerpt in order to improve rendering performance # for excerpts, as they are reused across several different views, because # posts might be referenced from multiple different location...
Excerpt
python
joke2k__faker
tests/providers/test_bank.py
{ "start": 16391, "end": 16595 }
class ____: """Test zh_CN bank provider""" def test_bank(self, faker, num_samples): for _ in range(num_samples): assert re.match(r"[\u4e00-\u9fa5]{2,20}", faker.bank())
TestZhCn
python
walkccc__LeetCode
solutions/2130. Maximum Twin Sum of a Linked List/2130.py
{ "start": 0, "end": 651 }
class ____: def pairSum(self, head: ListNode | None) -> int: def reverseList(head: ListNode) -> ListNode: prev = None while head: next = head.next head.next = prev prev = head head = next return prev ans = 0 slow = head fast = head # `slow` point...
Solution
python
pydata__xarray
xarray/core/extension_array.py
{ "start": 2635, "end": 7269 }
class ____(NDArrayMixin, Generic[T_ExtensionArray]): """NEP-18 compliant wrapper for pandas extension arrays. Parameters ---------- array : T_ExtensionArray The array to be wrapped upon e.g,. :py:class:`xarray.Variable` creation. ``` """ array: T_ExtensionArray def __post_init...
PandasExtensionArray
python
pytest-dev__pytest
testing/test_terminal.py
{ "start": 22175, "end": 25086 }
class ____: def test_setup_fixture_error(self, pytester: Pytester) -> None: pytester.makepyfile( """ def setup_function(function): print("setup func") assert 0 def test_nada(): pass """ ) result = pyt...
TestFixtureReporting
python
anthropics__anthropic-sdk-python
src/anthropic/lib/streaming/_beta_messages.py
{ "start": 10321, "end": 20395 }
class ____(Generic[ResponseFormatT]): """Wrapper over BetaAsyncMessageStream that is returned by `.stream()` so that an async context manager can be used without `await`ing the original client call. ```py async with client.beta.messages.stream(...) as stream: async for chunk in stream: ...
BetaAsyncMessageStreamManager
python
astropy__astropy
astropy/modeling/core.py
{ "start": 19271, "end": 114466 }
class ____(metaclass=_ModelMeta): """ Base class for all models. This is an abstract class and should not be instantiated directly. The following initialization arguments apply to the majority of Model subclasses by default (exceptions include specialized utility models like `~astropy.modeling...
Model
python
pydata__xarray
xarray/core/types.py
{ "start": 10810, "end": 11647 }
class ____(BaseBuffer, Protocol[AnyStr_co]): def read(self, n: int = ..., /) -> AnyStr_co: # for BytesIOWrapper, gzip.GzipFile, bz2.BZ2File ... QuantileMethods = Literal[ "inverted_cdf", "averaged_inverted_cdf", "closest_observation", "interpolated_inverted_cdf", "hazen", "...
ReadBuffer
python
getsentry__sentry
src/sentry/services/eventstore/models.py
{ "start": 21528, "end": 25369 }
class ____(BaseEvent): def __init__( self, project_id: int, event_id: str, group_id: int | None = None, data: Mapping[str, Any] | None = None, snuba_data: Mapping[str, Any] | None = None, groups: Sequence[Group] | None = None, ): super().__init__(p...
Event
python
sqlalchemy__sqlalchemy
test/dialect/postgresql/test_types.py
{ "start": 203232, "end": 203332 }
class ____( _DateMultiRangeTests, _MultiRangeTypeRoundTrip ): pass
DateMultiRangeRoundTripTest