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
bokeh__bokeh
src/bokeh/models/glyphs.py
{ "start": 57680, "end": 59069 }
class ____(XYGlyph, LineGlyph, FillGlyph, HatchGlyph): ''' Render wedges. ''' # explicit __init__ to support Init signatures def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) __example__ = "examples/reference/models/Wedge.py" _args = ('x', 'y', ...
Wedge
python
ansible__ansible
test/units/parsing/yaml/test_loader.py
{ "start": 1590, "end": 6422 }
class ____(unittest.TestCase): def test_parse_number(self): stream = StringIO(u""" 1 """) stream.name = file_name data = yaml.load(stream, Loader=AnsibleLoader) self.assertEqual(data, 1) # No line/column info saved yet def test_parse_stri...
TestAnsibleLoaderBasic
python
getsentry__sentry
tests/sentry/core/endpoints/test_organization_auditlogs.py
{ "start": 424, "end": 9192 }
class ____(APITestCase): endpoint = "sentry-api-0-organization-audit-logs" def setUp(self) -> None: super().setUp() self.login_as(self.user) def test_simple(self) -> None: now = timezone.now() org2 = self.create_organization(owner=self.user) entry1 = AuditLogEntry...
OrganizationAuditLogsTest
python
ray-project__ray
rllib/offline/dataset_writer.py
{ "start": 415, "end": 2801 }
class ____(OutputWriter): """Writer object that saves experiences using Datasets.""" @PublicAPI def __init__( self, ioctx: IOContext = None, compress_columns: List[str] = frozenset(["obs", "new_obs"]), ): """Initializes a DatasetWriter instance. Examples: ...
DatasetWriter
python
apache__airflow
providers/microsoft/azure/src/airflow/providers/microsoft/azure/hooks/synapse.py
{ "start": 8663, "end": 10438 }
class ____(BaseHook): """ A base hook class to create session and connection to Azure Synapse using connection id. :param azure_synapse_conn_id: The :ref:`Azure Synapse connection id<howto/connection:synapse>`. """ conn_type: str = "azure_synapse" conn_name_attr: str = "azure_synapse_conn_id" ...
BaseAzureSynapseHook
python
cython__cython
Cython/Compiler/Dataclass.py
{ "start": 1537, "end": 3069 }
class ____(VisitorTransform, SkipDeclarations): """ Cython (and Python) normally treats class A: x = 1 as generating a class attribute. However for dataclasses the `= 1` should be interpreted as a default value to initialize an instance attribute with. This transform therefore removes...
RemoveAssignmentsToNames
python
run-llama__llama_index
llama-index-core/llama_index/core/schema.py
{ "start": 25818, "end": 28582 }
class ____(TextNode): """Node with image.""" # TODO: store reference instead of actual image # base64 encoded image str image: Optional[str] = None image_path: Optional[str] = None image_url: Optional[str] = None image_mimetype: Optional[str] = None text_embedding: Optional[List[float]]...
ImageNode
python
doocs__leetcode
solution/0500-0599/0505.The Maze II/Solution.py
{ "start": 0, "end": 790 }
class ____: def shortestDistance( self, maze: List[List[int]], start: List[int], destination: List[int] ) -> int: m, n = len(maze), len(maze[0]) dirs = (-1, 0, 1, 0, -1) si, sj = start di, dj = destination q = deque([(si, sj)]) dist = [[inf] * n for _ in r...
Solution
python
ray-project__ray
python/ray/dashboard/modules/job/common.py
{ "start": 3419, "end": 8910 }
class ____: """A class for recording information associated with a job and its execution. Please keep this in sync with the JobsAPIInfo proto in src/ray/protobuf/gcs.proto. """ #: The status of the job. status: JobStatus #: The entrypoint command for this job. entrypoint: str #: A mess...
JobInfo
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_protect02.py
{ "start": 315, "end": 1057 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("protect02.xlsx") def test_create_file(self): """Test the a simple XlsxWriter file with worksheet protection.""" workbook = Workboo...
TestCompareXLSXFiles
python
PrefectHQ__prefect
tests/server/utilities/test_database.py
{ "start": 7214, "end": 15863 }
class ____: @pytest.fixture(autouse=True) async def data(self, session: AsyncSession): session.add_all( [ SQLJSONModel(id=1, data=["a"]), SQLJSONModel(id=2, data=["b"]), SQLJSONModel(id=3, data=["a", "b", "c"]), SQLJSONModel(id=...
TestJSON
python
getsentry__sentry
src/sentry/overwatch_webhooks/webhook_forwarder.py
{ "start": 1610, "end": 8421 }
class ____: integration: Integration def __init__(self, integration: Integration): self.integration = integration def should_forward_to_overwatch(self, headers: Mapping[str, str]) -> bool: event_type = headers.get(GITHUB_WEBHOOK_TYPE_HEADER_KEY) verbose_log( "overwatch....
OverwatchGithubWebhookForwarder
python
falconry__falcon
tests/test_request_body.py
{ "start": 361, "end": 5822 }
class ____: def _get_wrapped_stream(self, req): # Getting wrapped wsgi.input: stream = req.stream if isinstance(stream, BoundedStream): stream = stream.stream if isinstance(stream, InputWrapper): stream = stream.input return stream def test_empty...
TestRequestBody
python
readthedocs__readthedocs.org
readthedocs/projects/exceptions.py
{ "start": 1069, "end": 1247 }
class ____(BuildAppError): """Error risen when there is another sync_repository_task already running.""" REPOSITORY_LOCKED = "project:repository:locked"
SyncRepositoryLocked
python
dagster-io__dagster
python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/generated/sources.py
{ "start": 147259, "end": 149908 }
class ____(GeneratedAirbyteSource): class DefaultOAuth20Authorization: @public def __init__( self, client_id: str, client_secret: str, access_token: str, refresh_token: Optional[str] = None, ): self.client_id = check.str...
SlackSource
python
kamyu104__LeetCode-Solutions
Python/find-maximum-number-of-string-pairs.py
{ "start": 63, "end": 371 }
class ____(object): def maximumNumberOfStringPairs(self, words): """ :type words: List[str] :rtype: int """ result = 0 cnt = collections.Counter() for w in words: result += cnt[w[::-1]] cnt[w] += 1 return result
Solution
python
openai__openai-python
src/openai/types/beta/realtime/response_audio_delta_event.py
{ "start": 201, "end": 742 }
class ____(BaseModel): content_index: int """The index of the content part in the item's content array.""" delta: str """Base64-encoded audio data delta.""" event_id: str """The unique ID of the server event.""" item_id: str """The ID of the item.""" output_index: int """The ...
ResponseAudioDeltaEvent
python
sqlalchemy__sqlalchemy
test/orm/test_relationships.py
{ "start": 66717, "end": 69318 }
class ____(fixtures.MappedTest): """test ambiguous joins due to FKs on both sides treated as self-referential. this mapping is very similar to that of test/orm/inheritance/query.py SelfReferentialTestJoinedToBase , except that inheritance is not used here. """ @classmethod def def...
AmbiguousJoinInterpretedAsSelfRef
python
huggingface__transformers
tests/models/instructblipvideo/test_modeling_instructblipvideo.py
{ "start": 4943, "end": 8276 }
class ____(ModelTesterMixin, unittest.TestCase): """ Here we also overwrite some of the tests of test_modeling_common.py, as InstructBlipVideo's vision encoder does not use input_ids, inputs_embeds, attention_mask and seq_length. """ all_model_classes = (InstructBlipVideoVisionModel,) if is_torch_a...
InstructBlipVideoVisionModelTest
python
python-excel__xlwt
xlwt/BIFFRecords.py
{ "start": 66959, "end": 67533 }
class ____(BiffRecord): """ This record is part of the Calculation Settings Block. It specifies whether to calculate formulas manually, automatically or automatically except for multiple table operations. Record CALCMODE, BIFF2-BIFF8: Offset Size Contents 0 2 FFFFH = automa...
CalcModeRecord
python
docker__docker-py
docker/auth.py
{ "start": 2299, "end": 12977 }
class ____(dict): def __init__(self, dct, credstore_env=None): if 'auths' not in dct: dct['auths'] = {} self.update(dct) self._credstore_env = credstore_env self._stores = {} @classmethod def parse_auth(cls, entries, raise_on_error=False): """ Par...
AuthConfig
python
django__django
django/db/models/fields/tuple_lookups.py
{ "start": 4987, "end": 5574 }
class ____(TupleLookupMixin, Exact): def get_fallback_sql(self, compiler, connection): if isinstance(self.rhs, Query): return super(TupleLookupMixin, self).as_sql(compiler, connection) # Process right-hand-side to trigger sanitization. self.process_rhs(compiler, connection) ...
TupleExact
python
keras-team__keras
keras/src/layers/rnn/dropout_rnn_cell_test.py
{ "start": 1465, "end": 3273 }
class ____(testing.TestCase): def test_seed_tracking(self): cell = RNNCellWithDropout(3, seed=1337) self.assertEqual(len(cell.non_trainable_variables), 1) layer = layers.RNN(cell) self.assertEqual(len(layer.non_trainable_variables), 1) @pytest.mark.requires_trainable_backend ...
DropoutRNNCellTest
python
tornadoweb__tornado
tornado/test/ioloop_test.py
{ "start": 25255, "end": 26620 }
class ____(AsyncTestCase): def test_periodic_plain(self): count = 0 def callback() -> None: nonlocal count count += 1 if count == 3: self.stop() pc = PeriodicCallback(callback, 10) pc.start() self.wait() pc.stop() ...
TestPeriodicCallbackAsync
python
django__django
tests/admin_inlines/admin.py
{ "start": 8994, "end": 9114 }
class ____(admin.TabularInline): model = Class extra = 1 filter_horizontal = ["person"]
ClassTabularHorizontal
python
getsentry__sentry
src/sentry/ingest/transaction_clusterer/meta.py
{ "start": 224, "end": 1198 }
class ____(TypedDict): runs: int first_run: int last_run: int def get_clusterer_meta(namespace: ClustererNamespace, project: Project) -> ClustererMeta: meta: ClustererMeta | None = project.get_option(namespace.value.meta_store) return meta or { "runs": 0, "first_run": 0, "l...
ClustererMeta
python
google__pytype
pytype/errors/error_types.py
{ "start": 4856, "end": 5107 }
class ____(Exception): """Error for matching `str` against `Iterable[str]`/`Sequence[str]`/etc.""" def __init__(self, left_type, other_type): super().__init__() self.left_type = left_type self.other_type = other_type
NonIterableStrError
python
scipy__scipy
scipy/integrate/_ivp/rk.py
{ "start": 5846, "end": 10386 }
class ____(RungeKutta): """Explicit Runge-Kutta method of order 3(2). This uses the Bogacki-Shampine pair of formulas [1]_. The error is controlled assuming accuracy of the second-order method, but steps are taken using the third-order accurate formula (local extrapolation is done). A cubic Hermite ...
RK23
python
great-expectations__great_expectations
contrib/experimental/great_expectations_experimental/expectations/expect_queried_custom_query_to_return_num_rows.py
{ "start": 428, "end": 3917 }
class ____(QueryExpectation): """Expect the number of rows returned from custom query to be equal to specified value. Args: template_dict: dict containing the following key: \ user_query (user query. It must contain active_batch e.g. "select * from {batch}") """ metric_dependencies = ("qu...
ExpectQueriedCustomQueryToReturnNumRows
python
sphinx-doc__sphinx
tests/roots/test-root/autodoc_target.py
{ "start": 3791, "end": 3882 }
class ____(str): # NoQA: FURB189,SLOT000 def __repr__(self): return self
StrRepr
python
mlflow__mlflow
mlflow/tracking/context/databricks_cluster_context.py
{ "start": 182, "end": 520 }
class ____(RunContextProvider): def in_context(self): return databricks_utils.is_in_cluster() def tags(self): cluster_id = databricks_utils.get_cluster_id() tags = {} if cluster_id is not None: tags[MLFLOW_DATABRICKS_CLUSTER_ID] = cluster_id return tags
DatabricksClusterRunContext
python
pennersr__django-allauth
allauth/socialaccount/providers/vk/provider.py
{ "start": 258, "end": 746 }
class ____(ProviderAccount): def get_profile_url(self): return "https://vk.ru/id%s" % self.account.extra_data.get("id") def get_avatar_url(self): ret = None photo_big_url = self.account.extra_data.get("photo_big") photo_medium_url = self.account.extra_data.get("photo_medium") ...
VKAccount
python
astropy__astropy
astropy/uncertainty/tests/test_containers.py
{ "start": 8072, "end": 8959 }
class ____: @classmethod def setup_class(cls): cls.ra = Distribution(np.linspace(0.0, 360 * u.deg, 10, endpoint=False)) cls.dec = Angle([-45.0, 0.0, 45.0], u.deg) cls.dsc = SkyCoord(cls.ra, cls.dec) cls.sc = SkyCoord(cls.ra.distribution, cls.dec[:, np.newaxis]) def test_init...
TestSkyCoord
python
django__django
tests/model_formsets_regress/tests.py
{ "start": 12507, "end": 12563 }
class ____(forms.widgets.TextInput): pass
CustomWidget
python
encode__django-rest-framework
tests/test_serializer.py
{ "start": 27643, "end": 28314 }
class ____: def test_ReturnDict_merging(self): # Serializer.data returns ReturnDict, this is essentially a test for that. class TestSerializer(serializers.Serializer): char = serializers.CharField() s = TestSerializer(data={'char': 'x'}) assert s.is_valid() asse...
Test8301Regression
python
django__django
tests/admin_views/admin.py
{ "start": 21941, "end": 22056 }
class ____(BooleanFieldListFilter): template = "custom_filter_template.html"
CustomTemplateBooleanFieldListFilter
python
run-llama__llama_index
llama-index-integrations/llms/llama-index-llms-bedrock-converse/tests/test_bedrock_converse_utils.py
{ "start": 732, "end": 811 }
class ____: class ThrottlingException(Exception): pass
MockExceptions
python
ray-project__ray
python/ray/llm/_internal/serve/observability/metrics/utils.py
{ "start": 1327, "end": 3948 }
class ____: """This class instruments an asynchronous generator. It gathers 3 metrics: 1. Time to first time 2. Time between tokens 3. Total completion time Usage: @InstrumentTokenAsyncGenerator("my_special_fn") async def to_instrument(): yield ... """ all_instrument_...
InstrumentTokenAsyncGenerator
python
walkccc__LeetCode
solutions/3387. Maximize Amount After Two Days of Conversions/3387.py
{ "start": 0, "end": 792 }
class ____: def maxAmount( self, initialCurrency: str, pairs1: list[list[str]], rates1: list[float], pairs2: list[list[str]], rates2: list[float] ) -> float: # dp[currency] := the maximum amount of money to convert to `currency` dp: dict[str, float] = collections.defaultd...
Solution
python
django__django
django/forms/fields.py
{ "start": 46614, "end": 47233 }
class ____(CharField): default_error_messages = { "invalid": _("Enter a valid UUID."), } def prepare_value(self, value): if isinstance(value, uuid.UUID): return str(value) return value def to_python(self, value): value = super().to_python(value) if v...
UUIDField
python
ray-project__ray
rllib/algorithms/dreamerv3/torch/models/components/sequence_model.py
{ "start": 560, "end": 4307 }
class ____(nn.Module): """The "sequence model" of the RSSM, computing ht+1 given (ht, zt, at). Note: The "internal state" always consists of: The actions `a` (initially, this is a zeroed-out action), `h`-states (deterministic, continuous), and `z`-states (stochastic, discrete). There are two versio...
SequenceModel
python
getsentry__sentry
src/sentry/spans/grouping/strategy/config.py
{ "start": 505, "end": 2450 }
class ____: id: str strategy: SpanGroupingStrategy def execute_strategy(self, event_data: Any) -> SpanGroupingResults: # If there are hashes using the same grouping config stored # in the data, they should be reused. Otherwise, fall back to # generating new hashes using the data. ...
SpanGroupingConfig
python
pytorch__pytorch
torch/_inductor/invert_expr_analysis.py
{ "start": 350, "end": 6903 }
class ____: coefficient: _IntLike range: Optional[_IntLike] # None for unbounded original_expr: sympy.Expr reconstruction_multiplier: _IntLike # The multiplier needed for reconstruction def generate_inverse_formula( expr: sympy.Expr, var: sympy.Symbol ) -> Optional[sympy.Expr]: """ Anal...
Term
python
kamyu104__LeetCode-Solutions
Python/words-within-two-edits-of-dictionary.py
{ "start": 76, "end": 1559 }
class ____(object): def twoEditWords(self, queries, dictionary): """ :type queries: List[str] :type dictionary: List[str] :rtype: List[str] """ MOD = (1<<64)-59 # largest 64-bit prime BASE = 113 POW = [1] def add(a, b): return (a+b...
Solution
python
dagster-io__dagster
python_modules/dagster/dagster/_utils/test/__init__.py
{ "start": 11067, "end": 11184 }
class ____(SqliteStorageConfig): # interval to sleep between claim checks sleep_interval: int
TestStorageConfig
python
getsentry__sentry
src/sentry/utils/email/list_resolver.py
{ "start": 181, "end": 1900 }
class ____: """ Manages the generation of RFC 2919 compliant list-id strings from varying objects types. """ class UnregisteredTypeError(Exception): """ Error raised when attempting to build a list-id from an unregistered object type. """ def __init__( self, nam...
ListResolver
python
ray-project__ray
python/ray/autoscaler/_private/event_summarizer.py
{ "start": 87, "end": 2881 }
class ____: """Utility that aggregates related log messages to reduce log spam.""" def __init__(self): self.events_by_key: Dict[str, int] = {} # Messages to send in next summary batch. self.messages_to_send: List[str] = [] # Tracks TTL of messages. A message will not be re-sent ...
EventSummarizer
python
spack__spack
lib/spack/spack/util/timer.py
{ "start": 1381, "end": 6650 }
class ____(BaseTimer): """Simple interval timer""" def __init__(self, now: Callable[[], float] = time.time): """ Arguments: now: function that gives the seconds since e.g. epoch """ self._now = now self._timers: Dict[str, TimeTracker] = {} self._timer...
Timer
python
python__mypy
mypyc/irbuild/classdef.py
{ "start": 15481, "end": 37344 }
class ____(DataClassBuilder): """Create IR for an attrs class where auto_attribs=False (the default). When auto_attribs is enabled, attrs classes behave similarly to dataclasses (i.e. types are stored as annotations on the class) and are thus handled by DataClassBuilder, but when auto_attribs is disabl...
AttrsClassBuilder
python
astropy__astropy
astropy/cosmology/_src/tests/flrw/test_w0wacdm.py
{ "start": 786, "end": 2220 }
class ____(ParameterTestMixin): """Tests for `astropy.cosmology.Parameter` wa on a Cosmology. wa is a descriptor, which are tested by mixin, here with ``TestFLRW``. These tests expect dicts ``_cls_args`` and ``cls_kwargs`` which give the args and kwargs for the cosmology class, respectively. See ``Test...
ParameterwaTestMixin
python
getsentry__sentry
src/sentry/issues/endpoints/project_user_issue.py
{ "start": 6071, "end": 6213 }
class ____(serializers.Serializer): event_id = serializers.CharField(required=True) @region_silo_endpoint
ProjectUserIssueResponseSerializer
python
cython__cython
Cython/Compiler/MemoryView.py
{ "start": 5450, "end": 14456 }
class ____(Buffer.BufferEntry): """ May be used during code generation time to be queried for shape/strides/suboffsets attributes, or to perform indexing or slicing. """ def __init__(self, entry): self.entry = entry self.type = entry.type self.cname = entry.cname sel...
MemoryViewSliceBufferEntry
python
apache__airflow
providers/standard/src/airflow/providers/standard/exceptions.py
{ "start": 1917, "end": 2077 }
class ____(AirflowExternalTaskSensorException): """Raised when duplicate states are provided across allowed, skipped and failed states."""
DuplicateStateError
python
ray-project__ray
doc/source/ray-core/doc_code/cgraph_visualize.py
{ "start": 101, "end": 613 }
class ____: def inc(self, x): return x + 1 def double(self, x): return x * 2 def echo(self, x): return x sender1 = Worker.remote() sender2 = Worker.remote() receiver = Worker.remote() with InputNode() as inp: w1 = sender1.inc.bind(inp) w1 = receiver.echo.bind(w1) w2 ...
Worker
python
pytorch__pytorch
test/distributed/test_c10d_nccl.py
{ "start": 203243, "end": 241105 }
class ____(NCCLTraceTestBase): def _verify_trace(self, t, include_collectives, timing_enabled, is_json): ver = t["version"] self.assertEqual(ver, "2.10") comm_lib_version = t["comm_lib_version"] torch_comm_lib_version = torch.cuda.nccl.version() self.assertEqual( ...
NCCLTraceTest
python
kamyu104__LeetCode-Solutions
Python/maximize-the-distance-between-points-on-a-square.py
{ "start": 1680, "end": 3582 }
class ____(object): def maxDistance(self, side, points, k): """ :type side: int :type points: List[List[int]] :type k: int :rtype: int """ def binary_search_right(left, right, check): while left <= right: mid = left + (right-left)//...
Solution2
python
PyCQA__pylint
tests/functional/i/inherit_non_class.py
{ "start": 1056, "end": 1091 }
class ____(Good4, int): pass
Good5
python
crytic__slither
slither/slithir/operations/transfer.py
{ "start": 398, "end": 1218 }
class ____(Call): def __init__(self, destination: Union[LocalVariable, LocalIRVariable], value: Constant) -> None: assert isinstance(destination, (Variable, SolidityVariable)) self._destination = destination super().__init__() self._call_value = value def can_send_eth(self) -> ...
Transfer
python
ipython__ipython
tests/test_ultratb.py
{ "start": 10256, "end": 11497 }
class ____(unittest.TestCase): DEFINITIONS = """ def non_recurs(): 1/0 def r1(): r1() def r3a(): r3b() def r3b(): r3c() def r3c(): r3a() def r3o1(): r3a() def r3o2(): r3o1() """ def setUp(self): ip.run_cell(self.DEFINITIONS) def test_no_recursion(self): wi...
RecursionTest
python
pydata__xarray
xarray/tests/test_backends.py
{ "start": 181835, "end": 182679 }
class ____(CFEncodedBase, NetCDF3Only, InMemoryNetCDF): engine: T_NetcdfEngine = "scipy" @contextlib.contextmanager def create_store(self): fobj = BytesIO() yield backends.ScipyDataStore(fobj, "w") @contextlib.contextmanager def roundtrip( self, data, save_kwargs=None, open...
TestScipyInMemoryData
python
apache__airflow
airflow-core/tests/unit/always/test_secrets_backends.py
{ "start": 1328, "end": 1704 }
class ____: def __init__(self, conn_id, variation: str): self.conn_id = conn_id self.var_name = "AIRFLOW_CONN_" + self.conn_id.upper() self.host = f"host_{variation}.com" self.conn_uri = "mysql://user:pw@" + self.host + "/schema?extra1=val%2B1&extra2=val%2B2" self.conn = Conn...
SampleConn
python
sqlalchemy__sqlalchemy
test/perf/compiled_extensions/collections_.py
{ "start": 11232, "end": 12778 }
class ____(Case): @staticmethod def python(): from sqlalchemy.util import _collections_cy py_coll = load_uncompiled_module(_collections_cy) assert not py_coll._is_compiled() return py_coll.unique_list @staticmethod def cython(): from sqlalchemy.util import _coll...
UniqueList
python
PyCQA__pylint
tests/functional/r/regression_02/regression_8067.py
{ "start": 165, "end": 292 }
class ____: def __init__(self, foo=slice(42)): self.foo = foo def bar(): i = Foo() i.foo() return 100
Foo
python
astropy__astropy
astropy/io/votable/exceptions.py
{ "start": 31786, "end": 32155 }
class ____(VOTableSpecWarning): """Referenced elements should be defined before referees. From the VOTable 1.2 spec: In VOTable1.2, it is further recommended to place the ID attribute prior to referencing it whenever possible. """ message_template = "{} ref='{}' which has not already be...
W43
python
pypa__pipenv
pipenv/cmdparse.py
{ "start": 124, "end": 1270 }
class ____(ValueError): pass def _quote_if_contains(value, pattern): if next(iter(re.finditer(pattern, value)), None): return '"{}"'.format(re.sub(r'(\\*)"', r'\1\1\\"', value)) return value def _parse_toml_inline_table(value: tomlkit.items.InlineTable) -> str: """parses the [scripts] in pip...
ScriptParseError
python
jazzband__django-pipeline
tests/tests/test_compiler.py
{ "start": 484, "end": 868 }
class ____(SubProcessCompiler): output_extension = "junk" def match_file(self, path): return path.endswith(".coffee") def compile_file(self, infile, outfile, outdated=False, force=False): command = ( ( "/usr/bin/env", "false", ), ...
FailingCompiler
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/coercions.py
{ "start": 27285, "end": 27366 }
class ____(_ReturnsStringKey, RoleImpl): __slots__ = ()
ColumnArgumentOrKeyImpl
python
modin-project__modin
modin/core/dataframe/pandas/dataframe/dataframe.py
{ "start": 2857, "end": 195192 }
class ____( ABC, ClassLogger, modin_layer="CORE-DATAFRAME", log_level=LogLevel.DEBUG ): """ An abstract class that represents the parent class for any pandas storage format dataframe class. This class provides interfaces to run operations on dataframe partitions. Parameters ---------- part...
PandasDataframe
python
pytorch__pytorch
test/inductor/test_ordered_set.py
{ "start": 32741, "end": 33221 }
class ____(TestBasicOps, TestCase): def setUp(self): super().setUp() self.case = "bytes OrderedSet" self.values = [b"a", b"b", b"c"] self.OrderedSet = OrderedSet(self.values) self.dup = OrderedSet(self.values) self.length = 3 @unittest.skip("Different repr") ...
TestBasicOpsBytes
python
django__django
tests/requests_tests/test_accept_header.py
{ "start": 6051, "end": 15241 }
class ____(TestCase): def test_no_headers(self): """Absence of Accept header defaults to '*/*'.""" request = HttpRequest() self.assertEqual( [str(accepted_type) for accepted_type in request.accepted_types], ["*/*"], ) def test_accept_headers(self): ...
AcceptHeaderTests
python
jmcnamara__XlsxWriter
xlsxwriter/test/drawing/test_xml_declaration.py
{ "start": 297, "end": 831 }
class ____(unittest.TestCase): """ Test initialisation of the Drawing class and call a method. """ def setUp(self): self.fh = StringIO() self.drawing = Drawing() self.drawing._set_filehandle(self.fh) def test_xml_declaration(self): """Test Drawing xml_declaration()...
TestDrawingXmlDeclaration
python
ray-project__ray
python/ray/dashboard/utils.py
{ "start": 10879, "end": 13029 }
class ____(json.JSONEncoder): def default(self, obj): if isinstance(obj, bytes): return binary_to_hex(obj) if isinstance(obj, Immutable): return obj.mutable() # Let the base class default method raise the TypeError return json.JSONEncoder.default(self, obj) ...
CustomEncoder
python
python-openxml__python-docx
src/docx/shared.py
{ "start": 2015, "end": 2240 }
class ____(Length): """Convenience constructor for length in centimeters, e.g. ``height = Cm(12)``.""" def __new__(cls, cm: float): emu = int(cm * Length._EMUS_PER_CM) return Length.__new__(cls, emu)
Cm
python
pydata__xarray
asv_bench/benchmarks/groupby.py
{ "start": 213, "end": 1866 }
class ____: def setup(self, *args, **kwargs): self.n = 100 self.ds1d = xr.Dataset( { "a": xr.DataArray(np.r_[np.repeat(1, self.n), np.repeat(2, self.n)]), "b": xr.DataArray(np.arange(2 * self.n)), "c": xr.DataArray(np.arange(2 * self.n)), ...
GroupBy
python
tensorflow__tensorflow
tensorflow/python/framework/weak_tensor.py
{ "start": 1778, "end": 6360 }
class ____(extension_type.BatchableExtensionType, core.Tensor): """A weakly typed Tensor. A simple wrapper class that contains a normal Tensor. A "weak" type means that its dtype is temporarily inferred by the system, and could defer to other dtypes. i.g. weak f64 + f16 => f16 This information is used f...
WeakTensor
python
airbytehq__airbyte
airbyte-integrations/connectors/source-bing-ads/unit_tests/integrations/test_hourly_reports.py
{ "start": 70502, "end": 76579 }
class ____(HourlyReportsTestWithStateChangesAfterMigration): stream_name = "ad_group_performance_report_hourly" report_file = "ad_group_performance_report_hourly" records_number = 24 state_file = "hourly_reports_state" incremental_report_file = "ad_group_performance_report_hourly_incremental" re...
TestAdGroupPerformanceReportHourlyStream
python
getsentry__sentry
fixtures/safe_migrations_apps/good_flow_delete_field_simple_app/models.py
{ "start": 31, "end": 116 }
class ____(models.Model): field = models.IntegerField(default=0, null=True)
TestTable
python
Netflix__metaflow
metaflow/mflog/save_logs_periodically.py
{ "start": 173, "end": 1256 }
class ____(object): def __init__(self): self._thread = Thread(target=self._update_loop) self.is_alive = True self._thread.start() def process_message(self, msg): if msg.msg_type == MessageTypes.SHUTDOWN: self.is_alive = False @classmethod def get_worker(cls)...
SaveLogsPeriodicallySidecar
python
getsentry__sentry
tests/sentry/core/endpoints/test_organization_details.py
{ "start": 64782, "end": 70029 }
class ____(OrganizationDetailsTestBase): method = "delete" def test_can_remove_as_owner(self) -> None: owners = self.organization.get_owners() assert len(owners) > 0 with self.tasks(): self.get_success_response(self.organization.slug, status_code=status.HTTP_202_ACCEPTED) ...
OrganizationDeleteTest
python
altair-viz__altair
altair/vegalite/v6/schema/core.py
{ "start": 265248, "end": 266435 }
class ____(ConditionalValueDefnumber): """ ConditionalPredicateValueDefnumber schema wrapper. Parameters ---------- test : str, dict, :class:`Predicate`, :class:`FieldGTPredicate`, :class:`FieldLTPredicate`, :class:`FieldGTEPredicate`, :class:`FieldLTEPredicate`, :class:`LogicalOrPredicate`, :class...
ConditionalPredicateValueDefnumber
python
kamyu104__LeetCode-Solutions
Python/maximum-subarray-sum-with-one-deletion.py
{ "start": 0, "end": 358 }
class ____(object): def maximumSum(self, arr): """ :type arr: List[int] :rtype: int """ result, prev, curr = float("-inf"), float("-inf"), float("-inf") for x in arr: curr = max(prev, curr+x, x) result = max(result, curr) prev = max...
Solution
python
GoogleCloudPlatform__python-docs-samples
compute/client_library/snippets/instances/custom_machine_types/create_with_helper.py
{ "start": 1193, "end": 20144 }
class ____: """ Allows to create custom machine types to be used with the VM instances. """ @unique class CPUSeries(Enum): N1 = "custom" N2 = "n2-custom" N2D = "n2d-custom" E2 = "e2-custom" E2_MICRO = "e2-custom-micro" E2_SMALL = "e2-custom-small" ...
CustomMachineType
python
hyperopt__hyperopt
hyperopt/mongoexp.py
{ "start": 4537, "end": 4698 }
class ____(Exception): """Proxy that could be factored out if we also want to use CouchDB and JobmanDB classes with this interface """
OperationFailure
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_blank04.py
{ "start": 315, "end": 1391 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_blank04.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(self.got...
TestCompareXLSXFiles
python
doocs__leetcode
lcp/LCP 24. 数字游戏/Solution.py
{ "start": 0, "end": 796 }
class ____: def __init__(self): self.q1 = [] self.q2 = [] self.s1 = 0 self.s2 = 0 def addNum(self, num: int) -> None: heappush(self.q1, num) self.s1 += num num = heappop(self.q1) heappush(self.q2, -num) self.s1 -= num self.s2 += nu...
MedianFinder
python
astropy__astropy
astropy/time/tests/test_quantity_interaction.py
{ "start": 332, "end": 4044 }
class ____: """Test Interaction of Time with Quantities""" def test_valid_quantity_input(self): """Test Time formats that are allowed to take quantity input.""" q = 2450000.125 * u.day t1 = Time(q, format="jd", scale="utc") assert t1.value == q.value q2 = q.to(u.second) ...
TestTimeQuantity
python
tensorflow__tensorflow
tensorflow/python/util/function_utils_test.py
{ "start": 958, "end": 4330 }
class ____(test.TestCase): def test_simple_function(self): def fn(a, b): return a + b self.assertEqual(('a', 'b'), function_utils.fn_args(fn)) def test_callable(self): class Foo(object): def __call__(self, a, b): return a + b self.assertEqual(('a', 'b'), function_utils.fn_ar...
FnArgsTest
python
tensorflow__tensorflow
tensorflow/python/keras/utils/metrics_utils.py
{ "start": 9502, "end": 9812 }
class ____(Enum): """Type of AUC Curve (ROC or PR).""" ROC = 'ROC' PR = 'PR' @staticmethod def from_str(key): if key in ('pr', 'PR'): return AUCCurve.PR elif key in ('roc', 'ROC'): return AUCCurve.ROC else: raise ValueError('Invalid AUC curve value "%s".' % key)
AUCCurve
python
kubernetes-client__python
kubernetes/client/models/v1alpha3_device_taint_rule_list.py
{ "start": 383, "end": 7164 }
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...
V1alpha3DeviceTaintRuleList
python
tornadoweb__tornado
tornado/test/asyncio_test.py
{ "start": 7775, "end": 10752 }
class ____(unittest.TestCase): def setUp(self): setup_with_context_manager(self, ignore_deprecation()) # Referencing the event loop policy attributes raises deprecation warnings, # so instead of importing this at the top of the file we capture it here. self.AnyThreadEventLoopPolicy =...
AnyThreadEventLoopPolicyTest
python
pytorch__pytorch
torch/cuda/_sanitizer.py
{ "start": 12096, "end": 17523 }
class ____: """Analyzes CSAN trace for synchronization errors. Stores information on each stream's synchronizations with other streams as well as tensor accesses to determine whether a given kernel launch might cause a data race. """ def __init__(self) -> None: self.tensors_accessed = ...
EventHandler
python
falconry__falcon
falcon/errors.py
{ "start": 3749, "end": 3840 }
class ____(ValueError): """The requested operation is not allowed."""
OperationNotAllowed
python
getsentry__sentry
tests/snuba/rules/conditions/test_event_frequency.py
{ "start": 51599, "end": 51849 }
class ____( PerfIssuePlatformEventMixin, EventFrequencyConditionTestCase, ): pass @freeze_time( (timezone.now() - timedelta(days=2)).replace(hour=12, minute=40, second=0, microsecond=0) )
PerfIssuePlatformIssueFrequencyConditionTestCase
python
apache__airflow
providers/apache/kylin/tests/unit/apache/kylin/hooks/test_kylin.py
{ "start": 1077, "end": 2891 }
class ____: def setup_method(self) -> None: self.hook = KylinHook(kylin_conn_id="kylin_default", project="learn_kylin") @patch("kylinpy.Kylin.get_job") def test_get_job_status(self, mock_job): job = MagicMock() job.status = "ERROR" mock_job.return_value = job assert ...
TestKylinHook
python
sympy__sympy
sympy/polys/polyoptions.py
{ "start": 14956, "end": 15453 }
class ____(BooleanOption, metaclass=OptionType): """``gaussian`` option to polynomial manipulation functions. """ option = 'gaussian' requires: list[str] = [] excludes = ['field', 'greedy', 'domain', 'split', 'extension', 'modulus', 'symmetric'] @classmethod def postprocess(cls, optio...
Gaussian
python
huggingface__transformers
src/transformers/models/ministral/modular_ministral.py
{ "start": 859, "end": 8112 }
class ____(MistralConfig, PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`MinistralModel`]. It is used to instantiate an Ministral model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will y...
MinistralConfig
python
run-llama__llama_index
llama-index-core/llama_index/core/base/llms/types.py
{ "start": 1133, "end": 4595 }
class ____(BaseModel): """A representation of image data to directly pass to/from the LLM.""" block_type: Literal["image"] = "image" image: bytes | IOBase | None = None path: FilePath | None = None url: AnyUrl | str | None = None image_mimetype: str | None = None detail: str | None = None ...
ImageBlock
python
tornadoweb__tornado
tornado/platform/asyncio.py
{ "start": 25943, "end": 28136 }
class ____(asyncio.AbstractEventLoop): """Wrap an event loop to add implementations of the ``add_reader`` method family. Instances of this class start a second thread to run a selector. This thread is completely hidden from the user; all callbacks are run on the wrapped event loop's thread. This c...
AddThreadSelectorEventLoop
python
pandas-dev__pandas
asv_bench/benchmarks/groupby.py
{ "start": 32249, "end": 32608 }
class ____: def setup(self): N = 10**3 self.df = DataFrame({"a": np.zeros(N)}) self.groups = np.arange(0, N) self.weights = np.ones(N) def time_sample(self): self.df.groupby(self.groups).sample(n=1) def time_sample_weights(self): self.df.groupby(self.groups)...
Sample
python
google__jax
jax/experimental/pallas/ops/tpu/splash_attention/splash_attention_mask.py
{ "start": 14251, "end": 15286 }
class ____(Mask): """A mask backed by a dense numpy array.""" array: np.ndarray def __post_init__(self): if self.array.ndim != 2: raise ValueError('Expected a 2-dim array') if self.array.dtype != np.bool_: raise ValueError('Mask must be a boolean array') @property def shape(self) -> tu...
NumpyMask