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
ray-project__ray
python/ray/tests/test_ray_event_export_task_events.py
{ "start": 39032, "end": 52844 }
class ____: def __init__(self): pass def task(self, arg): pass actor = Actor.remote() obj = ray.put("test") ray.get(actor.task.remote(obj)) """ def validate_events(events: json): ( driver_script_job_id, driver_task_id, ) ...
Actor
python
ipython__ipython
tests/test_interactiveshell.py
{ "start": 1787, "end": 21077 }
class ____(unittest.TestCase): def test_naked_string_cells(self): """Test that cells with only naked strings are fully executed""" # First, single-line inputs ip.run_cell('"a"\n') self.assertEqual(ip.user_ns["_"], "a") # And also multi-line cells ip.run_cell('"""a\nb"...
InteractiveShellTestCase
python
getsentry__sentry
src/sentry/models/debugfile.py
{ "start": 22615, "end": 23788 }
class ____: @property def cache_path(self) -> str: return options.get("dsym.cache-path") def get_project_path(self, project: Project) -> str: return os.path.join(self.cache_path, str(project.id)) def fetch_difs( self, project: Project, debug_ids: Iterable[str], features: Iterab...
DIFCache
python
dagster-io__dagster
helm/dagster/schema/schema/charts/dagster/subschema/redis.py
{ "start": 33, "end": 265 }
class ____(BaseModel, extra="allow"): enabled: bool internal: bool usePassword: bool password: str host: str port: int brokerDbNumber: int backendDbNumber: int brokerUrl: str backendUrl: str
Redis
python
walkccc__LeetCode
solutions/2176. Count Equal and Divisible Pairs in an Array/2176.py
{ "start": 0, "end": 481 }
class ____: def countPairs(self, nums: list[int], k: int) -> int: ans = 0 numToIndices = collections.defaultdict(list) for i, num in enumerate(nums): numToIndices[num].append(i) for indices in numToIndices.values(): gcds = collections.Counter() for i in indices: gcd_i = mat...
Solution
python
openai__openai-python
src/openai/lib/streaming/responses/_events.py
{ "start": 2847, "end": 2958 }
class ____(RawResponseFunctionCallArgumentsDeltaEvent): snapshot: str
ResponseFunctionCallArgumentsDeltaEvent
python
streamlit__streamlit
lib/tests/streamlit/elements/alert_test.py
{ "start": 8290, "end": 10305 }
class ____(DeltaGeneratorTestCase): """Test ability to marshall Alert proto.""" def test_st_warning(self): """Test st.warning.""" st.warning("some warning") el = self.get_delta_from_queue().new_element assert el.alert.body == "some warning" assert el.alert.format == Ale...
StWarningAPITest
python
keras-team__keras
keras/src/ops/numpy.py
{ "start": 16382, "end": 18949 }
class ____(Operation): def __init__(self, axis=None, *, name=None): super().__init__(name=name) self.axis = axis def call(self, x1, x2): return backend.numpy.append(x1, x2, axis=self.axis) def compute_output_spec(self, x1, x2): x1_shape = x1.shape x2_shape = x2.shap...
Append
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 18612, "end": 19019 }
class ____(sgqlc.types.Enum): """The possible values for an enabled/no policy enterprise setting. Enumeration Choices: * `ENABLED`: The setting is enabled for organizations in the enterprise. * `NO_POLICY`: There is no policy set for organizations in the enterprise. """ __schema__...
EnterpriseEnabledSettingValue
python
pallets__jinja
tests/test_regression.py
{ "start": 293, "end": 2089 }
class ____: def test_assigned_scoping(self, env): t = env.from_string( """ {%- for item in (1, 2, 3, 4) -%} [{{ item }}] {%- endfor %} {{- item -}} """ ) assert t.render(item=42) == "[1][2][3][4]42" t = env.from_string( ...
TestCorner
python
pytorch__pytorch
test/distributed/test_c10d_logger.py
{ "start": 1300, "end": 4555 }
class ____(DistributedTestBase): @property def world_size(self): return WORLD_SIZE @property def process_group(self): return dist.group.WORLD def destroy_comms(self): # Wait for all ranks to reach here before starting shutdown. dist.barrier() dist.destroy_pr...
C10dErrorLoggerTest
python
dateutil__dateutil
src/dateutil/tz/win.py
{ "start": 1257, "end": 3793 }
class ____(object): """ Class for accessing ``tzres.dll``, which contains timezone name related resources. .. versionadded:: 2.5.0 """ p_wchar = ctypes.POINTER(wintypes.WCHAR) # Pointer to a wide char def __init__(self, tzres_loc='tzres.dll'): # Load the user32 DLL so we can...
tzres
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/abstractClass10.py
{ "start": 150, "end": 616 }
class ____(ABC): @staticmethod @abstractmethod def method1() -> None: ... @staticmethod @abstractmethod def method2() -> None: pass @classmethod @abstractmethod def method3(cls) -> None: raise NotImplementedError @classmethod @abstractmethod def method4...
A
python
getsentry__sentry
src/sentry/models/release_threshold/release_threshold.py
{ "start": 452, "end": 1765 }
class ____(Model): """ NOTE: To transition to utilizing AlertRules, there are some duplicated attrs we'll want to dedup. AlertRule model should house metadata on the AlertRule itself (eg. type of alert rule) AlertRuleTrigger model should house the trigger requirements (eg. value, over/under trigger ...
ReleaseThreshold
python
huggingface__transformers
src/transformers/models/informer/modular_informer.py
{ "start": 2433, "end": 2894 }
class ____(PreTrainedModel): config: InformerConfig base_model_prefix = "model" main_input_name = "past_values" input_modalities = ("time",) supports_gradient_checkpointing = True @torch.no_grad() def _init_weights(self, module: nn.Module): super()._init_weights(module) if i...
InformerPreTrainedModel
python
ray-project__ray
rllib/utils/replay_buffers/reservoir_replay_buffer.py
{ "start": 452, "end": 4533 }
class ____(ReplayBuffer): """This buffer implements reservoir sampling. The algorithm has been described by Jeffrey S. Vitter in "Random sampling with a reservoir". """ def __init__( self, capacity: int = 10000, storage_unit: str = "timesteps", **kwargs ): """Initializes a Rese...
ReservoirReplayBuffer
python
pytorch__pytorch
torch/utils/benchmark/utils/valgrind_wrapper/timer_interface.py
{ "start": 11509, "end": 11852 }
class ____(enum.Enum): PICKLE = 0 TORCH = 1 TORCH_JIT = 2 _GLOBALS_ALLOWED_TYPES: dict[Serialization, tuple[Any, ...]] = { Serialization.PICKLE: (str, bytes, bool, int, float, complex), Serialization.TORCH_JIT: (torch.jit.ScriptFunction, torch.jit.ScriptModule), Serialization.TORCH: (torch.nn....
Serialization
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/protocol37.py
{ "start": 248, "end": 331 }
class ____(metaclass=StyleMeta): pass x: type[Style] = Style print(list(x))
Style
python
sqlalchemy__sqlalchemy
test/dialect/oracle/test_dialect.py
{ "start": 9983, "end": 13972 }
class ____(fixtures.TestBase): """mock test for encoding_errors. While we tried to write a round trip test, I could only reproduce the problem on Python 3 and only for STRING/CHAR. I couldn't get a CLOB to come back with broken encoding and also under py2k cx_Oracle would always return a bytestrin...
EncodingErrorsTest
python
simplejson__simplejson
setup.py
{ "start": 2734, "end": 4759 }
class ____(Command): user_options = [] def initialize_options(self): pass def finalize_options(self): pass def run(self): import sys import subprocess raise SystemExit( subprocess.call([sys.executable, # Turn on deprecat...
TestCommand
python
cherrypy__cherrypy
cherrypy/lib/reprconf.py
{ "start": 7430, "end": 11983 }
class ____: def build(self, o): m = getattr(self, 'build_' + o.__class__.__name__, None) if m is None: raise TypeError( 'unrepr does not recognize %s' % repr(o.__class__.__name__), ) return m(o) def astnode(self, s): """Return a Python3 as...
_Builder
python
dagster-io__dagster
python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/generated/sources.py
{ "start": 19364, "end": 21301 }
class ____(GeneratedAirbyteSource): class APIPassword: @public def __init__(self, api_password: str): self.auth_method = "api_password" self.api_password = check.str_param(api_password, "api_password") class OAuth20: @public def __init__( self...
ShopifySource
python
spack__spack
lib/spack/spack/test/installer_tui.py
{ "start": 10467, "end": 12524 }
class ____: """Test time-based behaviors like spinner and cleanup""" def test_spinner_updates(self): """Test that spinner advances over time""" status, fake_time, _ = create_build_status() add_mock_builds(status, 1) # Initial spinner index initial_index = status.spinner...
TestTimeBasedBehavior
python
pennersr__django-allauth
allauth/headless/socialaccount/inputs.py
{ "start": 590, "end": 646 }
class ____(SignupForm, inputs.Input): pass
SignupInput
python
PyCQA__pylint
tests/functional/b/bad_reversed_sequence.py
{ "start": 591, "end": 2105 }
class ____: """ implements only __getitem__ """ def __getitem__(self, index): return index def uninferable(seq): """ This can't be inferred at this moment, make sure we don't have a false positive. """ return reversed(seq) def test(path): """ test function """ seq = reversed() ...
SecondBadReversed
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1587740, "end": 1588339 }
class ____(sgqlc.types.Union): """An item in an issue timeline""" __schema__ = github_schema __types__ = ( AssignedEvent, ClosedEvent, Commit, CrossReferencedEvent, DemilestonedEvent, IssueComment, LabeledEvent, LockedEvent, Milestoned...
IssueTimelineItem
python
doocs__leetcode
solution/2200-2299/2203.Minimum Weighted Subgraph With the Required Paths/Solution.py
{ "start": 0, "end": 896 }
class ____: def minimumWeight( self, n: int, edges: List[List[int]], src1: int, src2: int, dest: int ) -> int: def dijkstra(g, u): dist = [inf] * n dist[u] = 0 q = [(0, u)] while q: d, u = heappop(q) if d > dist[u]: ...
Solution
python
python-attrs__attrs
tests/test_dunders.py
{ "start": 12818, "end": 12891 }
class ____: foo_value = attr.ib()
HashCacheSerializationTestCachedSlots
python
huggingface__transformers
src/transformers/models/roberta/modeling_roberta.py
{ "start": 47423, "end": 50259 }
class ____(RobertaPreTrainedModel): def __init__(self, config): super().__init__(config) self.num_labels = config.num_labels self.roberta = RobertaModel(config, add_pooling_layer=False) classifier_dropout = ( config.classifier_dropout if config.classifier_dropout is not ...
RobertaForTokenClassification
python
falconry__falcon
falcon/_typing.py
{ "start": 3522, "end": 3705 }
class ____(Protocol): def __call__( self, resource: Resource, req: Request, resp: Response, **kwargs: Any, ) -> None: ...
ResponderMethod
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/clipboard/in_memory.py
{ "start": 152, "end": 1060 }
class ____(Clipboard): """ Default clipboard implementation. Just keep the data in memory. This implements a kill-ring, for Emacs mode. """ def __init__(self, data: ClipboardData | None = None, max_size: int = 60) -> None: assert max_size >= 1 self.max_size = max_size ...
InMemoryClipboard
python
tensorflow__tensorflow
tensorflow/python/ops/image_ops_test.py
{ "start": 5613, "end": 6846 }
class ____(test_util.TensorFlowTestCase): @test_util.run_without_tensor_float_32( "Calls rgb_to_yuv and yuv_to_rgb, which use matmul") def testBatch(self): # Build an arbitrary RGB image np.random.seed(7) batch_size = 5 shape = (batch_size, 2, 7, 3) for nptype in [np.float32, np.float64]...
RGBToYUVTest
python
getsentry__sentry
src/sentry/integrations/discord/message_builder/base/embed/field.py
{ "start": 67, "end": 162 }
class ____(TypedDict): name: str value: str inline: bool
DiscordMessageEmbedFieldDict
python
huggingface__transformers
src/transformers/models/fnet/modeling_fnet.py
{ "start": 13658, "end": 14055 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.seq_relationship = nn.Linear(config.hidden_size, 2) def forward(self, pooled_output): seq_relationship_score = self.seq_relationship(pooled_output) return seq_relationship_score # Copied from transforme...
FNetOnlyNSPHead
python
django__django
tests/forms_tests/tests/test_input_formats.py
{ "start": 216, "end": 4644 }
class ____(SimpleTestCase): @classmethod def setUpClass(cls): # nl/formats.py has customized TIME_INPUT_FORMATS: # ['%H:%M:%S', '%H.%M:%S', '%H.%M', '%H:%M'] cls.enterClassContext(translation.override("nl")) super().setUpClass() def test_timeField(self): "TimeFields ...
LocalizedTimeTests
python
doocs__leetcode
solution/2500-2599/2557.Maximum Number of Integers to Choose From a Range II/Solution.py
{ "start": 0, "end": 617 }
class ____: def maxCount(self, banned: List[int], n: int, maxSum: int) -> int: banned.extend([0, n + 1]) ban = sorted(set(banned)) ans = 0 for i, j in pairwise(ban): left, right = 0, j - i - 1 while left < right: mid = (left + right + 1) >> 1 ...
Solution
python
doocs__leetcode
solution/0800-0899/0895.Maximum Frequency Stack/Solution.py
{ "start": 0, "end": 493 }
class ____: def __init__(self): self.cnt = defaultdict(int) self.q = [] self.ts = 0 def push(self, val: int) -> None: self.ts += 1 self.cnt[val] += 1 heappush(self.q, (-self.cnt[val], -self.ts, val)) def pop(self) -> int: val = heappop(self.q)[2] ...
FreqStack
python
plotly__plotly.py
plotly/graph_objs/layout/polar/_angularaxis.py
{ "start": 235, "end": 66881 }
class ____(_BaseLayoutHierarchyType): _parent_path_str = "layout.polar" _path_str = "layout.polar.angularaxis" _valid_props = { "autotypenumbers", "categoryarray", "categoryarraysrc", "categoryorder", "color", "direction", "dtick", "exponentfor...
AngularAxis
python
huggingface__transformers
tests/models/chinese_clip/test_modeling_chinese_clip.py
{ "start": 17120, "end": 19518 }
class ____: def __init__(self, parent, text_kwargs=None, vision_kwargs=None, is_training=True): if text_kwargs is None: text_kwargs = {} if vision_kwargs is None: vision_kwargs = {} self.parent = parent self.text_model_tester = ChineseCLIPTextModelTester(pare...
ChineseCLIPModelTester
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_pie/PIE790.py
{ "start": 1760, "end": 2005 }
class ____: @abc.abstractmethod def func(self) -> str: """Docstring""" ... def impl(self) -> str: """Docstring""" return self.func() def stub(self) -> str: """Docstring""" ...
Repro
python
graphql-python__graphene
graphene/types/tests/test_definition.py
{ "start": 1252, "end": 9009 }
class ____(InputObjectType): pass def test_defines_a_query_only_schema(): blog_schema = Schema(Query) assert blog_schema.query == Query assert blog_schema.graphql_schema.query_type.graphene_type == Query article_field = Query._meta.fields["article"] assert article_field.type == Article a...
MyInputObjectType
python
django__django
django/core/files/storage/filesystem.py
{ "start": 585, "end": 8646 }
class ____(Storage, StorageSettingsMixin): """ Standard filesystem storage """ def __init__( self, location=None, base_url=None, file_permissions_mode=None, directory_permissions_mode=None, allow_overwrite=False, ): self._location = location ...
FileSystemStorage
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/protocol3.py
{ "start": 5435, "end": 5508 }
class ____(NamedTuple): other: int @dataclass(frozen=True)
Concrete16_1
python
FactoryBoy__factory_boy
factory/declarations.py
{ "start": 8569, "end": 9186 }
class ____(BaseDeclaration): """Specific BaseDeclaration to use for 'sequenced' fields. These fields are typically used to generate increasing unique values. Attributes: function (function): A function, expecting the current sequence counter and returning the computed value. """ ...
Sequence
python
kamyu104__LeetCode-Solutions
Python/merge-in-between-linked-lists.py
{ "start": 70, "end": 151 }
class ____(object): def __init__(self, val=0, next=None): pass
ListNode
python
streamlit__streamlit
lib/streamlit/runtime/caching/storage/cache_storage_protocol.py
{ "start": 2959, "end": 4220 }
class ____: """Context passed to the cache storage during initialization This is the normalized parameters that are passed to CacheStorageManager.create() method. Parameters ---------- function_key: str A hash computed based on function name and source code decorated by `@st.cac...
CacheStorageContext
python
pyinstaller__pyinstaller
tests/unit/test_modulegraph/test_implies.py
{ "start": 94, "end": 2892 }
class ____(unittest.TestCase): if not hasattr(unittest.TestCase, 'assertIsInstance'): def assertIsInstance(self, object, types, message=None): self.assertTrue(isinstance(object, types), message or '%r is not an instance of %r'%(object, types)) def testBasicImplies(self):...
ImpliesTestCase
python
pandas-dev__pandas
pandas/tests/tseries/offsets/test_month.py
{ "start": 20382, "end": 23270 }
class ____: def test_day_of_month(self): dt = datetime(2007, 1, 1) offset = MonthEnd() result = dt + offset assert result == Timestamp(2007, 1, 31) result = result + offset assert result == Timestamp(2007, 2, 28) def test_normalize(self): dt = datetime(...
TestMonthEnd
python
wandb__wandb
wandb/vendor/pygments/lexers/javascript.py
{ "start": 49395, "end": 57559 }
class ____(RegexLexer): """ For `Earl-Grey`_ source code. .. _Earl-Grey: https://breuleux.github.io/earl-grey/ .. versionadded: 2.1 """ name = 'Earl Grey' aliases = ['earl-grey', 'earlgrey', 'eg'] filenames = ['*.eg'] mimetypes = ['text/x-earl-grey'] tokens = { 'root'...
EarlGreyLexer
python
langchain-ai__langchain
libs/langchain_v1/langchain/agents/middleware/shell_tool.py
{ "start": 3353, "end": 10488 }
class ____: """Persistent shell session that supports sequential command execution.""" def __init__( self, workspace: Path, policy: BaseExecutionPolicy, command: tuple[str, ...], environment: Mapping[str, str], ) -> None: self._workspace = workspace s...
ShellSession
python
apache__airflow
providers/cloudant/tests/unit/cloudant/hooks/test_cloudant.py
{ "start": 1062, "end": 2862 }
class ____: def setup_method(self): self.cloudant_hook = CloudantHook() @patch( "airflow.providers.cloudant.hooks.cloudant.CloudantHook.get_connection", return_value=Connection(login="the_user", password="the_password", host="the_account"), ) @patch("airflow.providers.cloudant.h...
TestCloudantHook
python
great-expectations__great_expectations
great_expectations/expectations/metrics/column_aggregate_metrics/column_parameterized_distribution_ks_test_p_value.py
{ "start": 489, "end": 1537 }
class ____(ColumnAggregateMetricProvider): """MetricProvider Class for Aggregate Standard Deviation metric""" metric_name = "column.parameterized_distribution_ks_test_p_value" value_keys = ("distribution", "p_value", "params") @column_aggregate_value(engine=PandasExecutionEngine) def _pandas(cls, ...
ColumnParameterizedDistributionKSTestPValue
python
hynek__structlog
src/structlog/twisted.py
{ "start": 1639, "end": 3564 }
class ____: """ Build a Twisted logger when an *instance* is called. >>> from structlog import configure >>> from structlog.twisted import LoggerFactory >>> configure(logger_factory=LoggerFactory()) """ def __call__(self, *args: Any) -> WrappedLogger: """ Positional argumen...
LoggerFactory
python
getsentry__sentry
src/sentry/analytics/events/auth_v2.py
{ "start": 204, "end": 344 }
class ____(analytics.Event): event: str analytics.register(AuthV2CsrfTokenRotated) analytics.register(AuthV2DeleteLogin)
AuthV2DeleteLogin
python
plotly__plotly.py
plotly/graph_objs/box/_stream.py
{ "start": 233, "end": 3479 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "box" _path_str = "box.stream" _valid_props = {"maxpoints", "token"} @property def maxpoints(self): """ Sets the maximum number of points to keep on the plots from an incoming stream. If `maxpoints` is set to 50, only t...
Stream
python
getsentry__sentry
tests/sentry/issue_detection/test_consecutive_db_detector.py
{ "start": 722, "end": 11869 }
class ____(TestCase): def setUp(self) -> None: super().setUp() self._settings = get_detection_settings() def find_problems(self, event: dict[str, Any]) -> list[PerformanceProblem]: detector = ConsecutiveDBSpanDetector(self._settings, event) run_detector_on_data(detector, event) ...
ConsecutiveDbDetectorTest
python
jazzband__django-simple-history
simple_history/tests/models.py
{ "start": 22392, "end": 22513 }
class ____(AbstractExternal3): name = models.CharField(max_length=15, unique=True)
OverrideModelNameUsingExternalModel2
python
tensorflow__tensorflow
tensorflow/python/trackable/resource_test.py
{ "start": 2161, "end": 4233 }
class ____(test.TestCase): def testBasic(self): resource_tracker = resource.ResourceTracker() with resource.resource_tracker_scope(resource_tracker): dummy_resource1 = _DummyResource("test1") dummy_resource2 = _DummyResource("test2") self.assertEqual(2, len(resource_tracker.resources)) s...
ResourceTrackerTest
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/mysql/pyodbc.py
{ "start": 2676, "end": 5086 }
class ____(PyODBCConnector, MySQLDialect): supports_statement_cache = True colspecs = util.update_copy(MySQLDialect.colspecs, {Time: _pyodbcTIME}) supports_unicode_statements = True execution_ctx_cls = MySQLExecutionContext_pyodbc pyodbc_driver_name = "MySQL" def _detect_charset(self, connecti...
MySQLDialect_pyodbc
python
cython__cython
Cython/Compiler/Code.py
{ "start": 94850, "end": 95372 }
class ____: # emit_linenums boolean write #line pragmas? # emit_code_comments boolean copy the original code into C comments? # c_line_in_traceback boolean append the c file and line number to the traceback for exceptions? def __init__(self, emit_linenums=True, emit_code_...
CCodeConfig
python
rapidsai__cudf
python/cudf_polars/cudf_polars/dsl/ir.py
{ "start": 46146, "end": 49600 }
class ____(IR): """ Input from an existing polars DataFrame. This typically arises from ``q.collect().lazy()`` """ __slots__ = ("_id_for_hash", "df", "projection") _non_child = ("schema", "df", "projection") df: Any """Polars internal PyDataFrame object.""" projection: tuple[str, ....
DataFrameScan
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 209904, "end": 210491 }
class ____(sgqlc.types.Type): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ( "branch_protection_rule", "conflicting_branch_protection_rule", "ref", ) branch_protection_rule = sgqlc.types.Field( "BranchProtectionRule", g...
BranchProtectionRuleConflict
python
great-expectations__great_expectations
contrib/capitalone_dataprofiler_expectations/capitalone_dataprofiler_expectations/expectations/expect_column_values_to_be_equal_to_or_less_than_profile_max.py
{ "start": 864, "end": 2774 }
class ____(ColumnMapMetricProvider): # This is the id string that will be used to reference your metric. condition_metric_name = "column_values.less_than_or_equal_to_profile_max" condition_value_keys = ("profile",) # This method implements the core logic for the PandasExecutionEngine @column_condi...
ColumnValuesLessThanOrEqualToProfileMax
python
dagster-io__dagster
python_modules/libraries/dagster-deltalake/dagster_deltalake/io_manager.py
{ "start": 1377, "end": 1766 }
class ____(TypedDict): root_uri: str mode: WriteMode overwrite_schema: bool writer_engine: WriterEngine storage_options: _StorageOptionsConfig client_options: NotRequired[dict[str, str]] table_config: NotRequired[dict[str, str]] custom_metadata: NotRequired[dict[str, str]] writer_pro...
_DeltaTableIOManagerResourceConfig
python
google__pytype
pytype/matcher_test.py
{ "start": 19290, "end": 22705 }
class ____(MatcherTestBase): """Test matching TypeVar against various types.""" def test_match_from_mro(self): # A TypeParameter never matches anything in match_from_mro, since its mro is # empty. This test is mostly to make sure we don't crash. self.assertIsNone( self.matcher.match_from_mro( ...
TypeVarTest
python
cherrypy__cherrypy
cherrypy/process/plugins.py
{ "start": 21638, "end": 25887 }
class ____(Monitor): """Monitor which re-executes the process when files change. This :ref:`plugin<plugins>` restarts the process (via :func:`os.execv`) if any of the files it monitors change (or is deleted). By default, the autoreloader monitors all imported modules; you can add to the set by addi...
Autoreloader
python
psf__black
tests/data/cases/fmtonoff5.py
{ "start": 3362, "end": 3619 }
class ____(t.Protocol): def this_will_be_formatted(self, **kwargs) -> Named: ... # fmt: on # Regression test for https://github.com/psf/black/issues/3436. if x: return x # fmt: off elif unformatted: # fmt: on will_be_formatted()
Factory
python
apache__airflow
helm-tests/tests/helm_tests/airflow_aux/test_airflow_common.py
{ "start": 914, "end": 24212 }
class ____: """ Tests that apply to more than 1 Airflow component so we don't have to repeat tests everywhere. The one general exception will be the KubernetesExecutor PodTemplateFile, as it requires extra test setup. """ @pytest.mark.parametrize( ("logs_values", "expected_mount"), ...
TestAirflowCommon
python
huggingface__transformers
src/transformers/modeling_outputs.py
{ "start": 42348, "end": 44526 }
class ____(ModelOutput): """ Base class for causal language model (or autoregressive) outputs. Args: loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Language modeling loss (for next-token prediction). logits (`torch.FloatTensor` of sha...
CausalLMOutputWithPast
python
scipy__scipy
scipy/linalg/tests/test_fblas.py
{ "start": 14953, "end": 16371 }
class ____: def get_data(self,x_stride=1,y_stride=1): rng = np.random.default_rng(1234) alpha = array(1., dtype = self.dtype) a = rng.normal(0.,1.,(3,3)).astype(self.dtype) x = arange(shape(a)[0]*x_stride,dtype=self.dtype) y = arange(shape(a)[1]*y_stride,dtype=self.dtype) ...
BaseGer
python
numpy__numpy
numpy/distutils/misc_util.py
{ "start": 1572, "end": 24010 }
class ____: """ Container to hold information on an installable library. Parameters ---------- name : str Name of the installed library. build_info : dict Dictionary holding build information. target_dir : str Absolute path specifying where to install the library. ...
InstallableLib
python
getsentry__sentry
src/sentry/workflow_engine/migrations/0096_delete_non_single_written_fire_history.py
{ "start": 669, "end": 2034 }
class ____(CheckedMigration): # This flag is used to mark that a migration shouldn't be automatically run in production. # This should only be used for operations where it's safe to run the migration after your # code has deployed. So this should not be used for most operations that alter the schema # o...
Migration
python
facebook__pyre-check
tools/generate_taint_models/get_dynamic_graphql_sources.py
{ "start": 1211, "end": 4107 }
class ____(ModelGenerator[CallableModel]): def __init__( self, # pyre-fixme[11]: Annotation `GraphQLSchema` is not defined as a type. graphql_schema: GraphQLSchema, graphql_object_type: GraphQLObjectType, annotations: AnnotationSpecification, formattable_return: Optio...
DynamicGraphQLSourceGenerator
python
PyCQA__pylint
tests/extensions/test_private_import.py
{ "start": 530, "end": 2700 }
class ____(CheckerTestCase): """The mocked dirname is the directory of the file being linted, the node is code inside that file.""" CHECKER_CLASS = private_import.PrivateImportChecker @patch("pathlib.Path.parent") def test_internal_module(self, parent: MagicMock) -> None: parent.parts = ("", "...
TestPrivateImport
python
kamyu104__LeetCode-Solutions
Python/path-with-maximum-minimum-value.py
{ "start": 1415, "end": 2168 }
class ____(object): def maximumMinimumPath(self, A): """ :type A: List[List[int]] :rtype: int """ directions = [(0, 1), (1, 0), (0, -1), (-1, 0)] max_heap = [(-A[0][0], 0, 0)] lookup = set([(0, 0)]) while max_heap: i, r, c = heapq.heappop(m...
Solution2
python
simonw__datasette
datasette/views/base.py
{ "start": 604, "end": 991 }
class ____(Exception): def __init__( self, message, title=None, error_dict=None, status=500, template=None, message_is_html=False, ): self.message = message self.title = title self.error_dict = error_dict or {} self.status =...
DatasetteError
python
pytorch__pytorch
torch/_higher_order_ops/flex_attention.py
{ "start": 3504, "end": 21572 }
class ____(HigherOrderOperator): def __init__(self) -> None: super().__init__("flex_attention_backward", cacheable=True) def __call__( self, query: torch.Tensor, key: torch.Tensor, value: torch.Tensor, out: torch.Tensor, logsumexp: torch.Tensor, g...
FlexAttentionBackwardHOP
python
HypothesisWorks__hypothesis
hypothesis-python/tests/django/toystore/models.py
{ "start": 2770, "end": 3252 }
class ____(models.Model): name = models.CharField(max_length=100, unique=True) company = models.ForeignKey(Company, null=False, on_delete=models.CASCADE) def __init__(self, **kw): if "company" in kw: raise RuntimeError cname = kw["name"] + "_company" kw["company"] = Comp...
MandatoryComputed
python
allegroai__clearml
clearml/backend_api/schema/service.py
{ "start": 159, "end": 6856 }
class ____(object): """Service schema handler""" __jsonschema_ref_ex = re.compile("^#/definitions/(.*)$") @property def default(self) -> ConfigTree: return self._default @property def actions(self) -> Dict[str, Dict[float, Action]]: return self._actions @property def ...
Service
python
Pylons__pyramid
src/pyramid/config/views.py
{ "start": 85032, "end": 85483 }
class ____: def __init__( self, view, registry, package, predicates, exception_only, options ): self.original_view = view self.registry = registry self.package = package self.predicates = predicates or [] self.options = options or {} self.exception_only = ...
ViewDeriverInfo
python
pallets__quart
src/quart/asgi.py
{ "start": 6686, "end": 13769 }
class ____: def __init__(self, app: Quart, scope: WebsocketScope) -> None: self.app = app self.scope = scope self.queue: asyncio.Queue = asyncio.Queue() self._accepted = False self._closed = False async def __call__( self, receive: ASGIReceiveCallable, send: ASGI...
ASGIWebsocketConnection
python
davidhalter__jedi
test/refactor/extract_function.py
{ "start": 8629, "end": 8901 }
class ____: def f(self, b, c): local1, local2 = 3, 4 #foo #? 11 text {'new_name': 'ab', 'until_line': 7, 'until_column': 29} return local1 & glob1 & b # bar local2 # ++++++++++++++++++++++++++++++++++++++++++++++++++ glob1 = 1
X
python
cython__cython
Cython/Debugger/Tests/test_libcython_in_gdb.py
{ "start": 9069, "end": 9433 }
class ____(DebugStepperTestCase): def test_cython_next(self): self.break_and_run('c = 2') lines = ( 'int(10)', 'puts("spam")', 'os.path.join("foo", "bar")', 'some_c_function()', ) for line in lines: gdb.execute('cy next')...
TestNext
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/engine/result.py
{ "start": 29128, "end": 54271 }
class ____(_WithKeys, ResultInternal[Row[Unpack[_Ts]]]): """Represent a set of database results. .. versionadded:: 1.4 The :class:`_engine.Result` object provides a completely updated usage model and calling facade for SQLAlchemy Core and SQLAlchemy ORM. In Core, it forms the basis of the ...
Result
python
readthedocs__readthedocs.org
readthedocs/embed/v3/views.py
{ "start": 1353, "end": 16362 }
class ____(EmbedAPIMixin, CDNCacheTagsMixin, APIView): # pylint: disable=line-too-long """ Embed a section of content from any Read the Docs page. ### Arguments * url (with fragment) (required) * doctool * doctoolversion * maincontent ### Example GET https://readthedocs.org/...
EmbedAPIBase
python
celery__celery
celery/utils/log.py
{ "start": 5131, "end": 8756 }
class ____: """Forward file object to :class:`logging.Logger` instance. Arguments: logger (~logging.Logger): Logger instance to forward to. loglevel (int, str): Log level to use when logging messages. """ mode = 'w' name = None closed = False loglevel = logging.ERROR _t...
LoggingProxy
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typeVarDefaultClass3.py
{ "start": 3143, "end": 3213 }
class ____[T1 = str, *Ts1 = Unpack[tuple[T1, T2]], T2 = T1]: ...
ClassTB
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/operators/bigquery.py
{ "start": 93206, "end": 106158 }
class ____(GoogleCloudBaseOperator, _BigQueryInsertJobOperatorOpenLineageMixin): """ Execute a BigQuery job. Waits for the job to complete and returns job id. This operator work in the following way: - it calculates a unique hash of the job using job's configuration or uuid if ``force_rerun`` is T...
BigQueryInsertJobOperator
python
google__jax
tests/pallas/gpu_ops_test.py
{ "start": 14125, "end": 14988 }
class ____(PallasBaseTest): def setUp(self): super().setUp() if jtu.test_device_matches(["cpu", "tpu"]): self.skipTest("Works only on GPU") @parameterized.product( shape=[(1024, 125), (4, 1024, 125)], dtype=[jnp.bfloat16, jnp.float16, jnp.float32] ) def test_softmax(self, shape, dtyp...
SoftmaxTest
python
getsentry__sentry
tests/sentry/api/test_base.py
{ "start": 17050, "end": 19976 }
class ____(APITestCase): def test_serializes_params(self) -> None: request = self.make_request(method="GET", path="/api/0/organizations/") request.GET = QueryDict("member=1&cursor=foo") endpoint = Endpoint() result = endpoint.build_cursor_link( request, "next", Cursor.fro...
CursorGenerationTest
python
getsentry__sentry
src/sentry/flags/providers.py
{ "start": 13047, "end": 13210 }
class ____(serializers.Serializer): data = serializers.ListField(child=StatsigEventSerializer(), required=True) # type: ignore[assignment]
StatsigItemSerializer
python
mwaskom__seaborn
tests/_core/test_moves.py
{ "start": 9723, "end": 10268 }
class ____(MoveFixtures): def test_default(self, toy_df): gb = GroupBy(["color", "group"]) res = Shift()(toy_df, gb, "x", {}) for col in toy_df: assert_series_equal(toy_df[col], res[col]) @pytest.mark.parametrize("x,y", [(.3, 0), (0, .2), (.1, .3)]) def test_moves(self...
TestShift
python
matplotlib__matplotlib
lib/matplotlib/colors.py
{ "start": 19963, "end": 23624 }
class ____: """ A class only kept for backwards compatibility. Its functionality is entirely provided by module-level functions. """ colors = _colors_full_map cache = _colors_full_map.cache to_rgb = staticmethod(to_rgb) to_rgba = staticmethod(to_rgba) to_rgba_array = staticmethod(to...
ColorConverter
python
aimacode__aima-python
mdp.py
{ "start": 3953, "end": 4422 }
class ____(MDP): """ Inherits from MDP. Handles terminal states, and transitions to and from terminal states better. """ def __init__(self, init, actlist, terminals, transitions, reward=None, gamma=0.9): MDP.__init__(self, init, actlist, terminals, transitions, reward, gamma=gamma) def T(s...
MDP2
python
huggingface__transformers
src/transformers/models/marian/modeling_marian.py
{ "start": 13988, "end": 19069 }
class ____(GradientCheckpointingLayer): def __init__(self, config: MarianConfig, layer_idx: Optional[int] = None): super().__init__() self.embed_dim = config.d_model self.self_attn = MarianAttention( embed_dim=self.embed_dim, num_heads=config.decoder_attention_heads,...
MarianDecoderLayer
python
django__django
django/db/models/fields/__init__.py
{ "start": 72278, "end": 73434 }
class ____(Field): empty_strings_allowed = False default_error_messages = { "invalid": _("“%(value)s” value must be a float."), } description = _("Floating point number") def get_prep_value(self, value): value = super().get_prep_value(value) if value is None: ret...
FloatField
python
pyqtgraph__pyqtgraph
pyqtgraph/graphicsItems/ScaleBar.py
{ "start": 277, "end": 2334 }
class ____(GraphicsWidgetAnchor, GraphicsObject): """ Displays a rectangular bar to indicate the relative scale of objects on the view. """ def __init__(self, size, width=5, brush=None, pen=None, suffix='m', offset=None): GraphicsObject.__init__(self) GraphicsWidgetAnchor.__init__(self) ...
ScaleBar
python
pandas-dev__pandas
pandas/tests/scalar/period/test_arithmetic.py
{ "start": 217, "end": 13965 }
class ____: def test_add_overflow_raises(self): # GH#55503 per = Timestamp.max.to_period("ns") msg = "|".join( [ "Python int too large to convert to C long", # windows, 32bit linux builds "int too big to convert", ] ...
TestPeriodArithmetic
python
jazzband__django-formtools
tests/wizard/test_forms.py
{ "start": 964, "end": 1020 }
class ____(forms.Form): data = forms.CharField()
Step3
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typeNarrowingIsinstance2.py
{ "start": 646, "end": 880 }
class ____: @classmethod def test(cls: type[TD], id: int | TD): if isinstance(id, cls): reveal_type(id, expected_text="ClassD*") else: reveal_type(id, expected_text="int | ClassD*")
ClassD