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
PrefectHQ__prefect
src/prefect/client/schemas/actions.py
{ "start": 16486, "end": 16638 }
class ____(ActionBaseModel): """Data used by the Prefect REST API to update a task run""" name: Optional[str] = Field(default=None)
TaskRunUpdate
python
coleifer__peewee
tests/sqlite.py
{ "start": 52532, "end": 61579 }
class ____(BaseFTSTestCase, ModelTestCase): database = database requires = [FTS5Test] test_corpus = ( ('foo aa bb', 'aa bb cc ' * 10, 1), ('bar bb cc', 'bb cc dd ' * 9, 2), ('baze cc dd', 'cc dd ee ' * 8, 3), ('nug aa dd', 'bb cc ' * 7, 4)) def setUp(self): super...
TestFTS5
python
apache__airflow
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/utils/pod_manager.py
{ "start": 8017, "end": 8116 }
class ____(AirflowException): """Expected pod does not exist in kube-api."""
PodNotFoundException
python
spyder-ide__spyder
spyder/widgets/comboboxes.py
{ "start": 4816, "end": 5879 }
class ____(BaseComboBox): """Search pattern combo box""" def __init__( self, parent, items=None, tip=None, adjust_to_minimum=True, id_=None, items_elide_mode=None, ): if not PYSIDE2: super().__init__(parent, items_elide_mode) ...
PatternComboBox
python
huggingface__transformers
src/transformers/modeling_outputs.py
{ "start": 2255, "end": 3215 }
class ____(ModelOutput): """ Base class for model's outputs, with potential hidden states. Args: last_hidden_state (`torch.FloatTensor` of shape `(batch_size, num_channels, height, width)`): Sequence of hidden-states at the output of the last layer of the model. hidden_states (`...
BaseModelOutputWithNoAttention
python
jazzband__django-redis
tests/settings_wrapper.py
{ "start": 100, "end": 1033 }
class ____: def __init__(self) -> None: self._to_restore: list[override_settings] object.__setattr__(self, "_to_restore", []) def __delattr__(self, attr: str) -> None: from django.test import override_settings override = override_settings() override.enable() fro...
SettingsWrapper
python
getsentry__sentry
src/sentry/integrations/models/repository_project_path_config.py
{ "start": 391, "end": 3397 }
class ____(DefaultFieldsModelExisting): __relocation_scope__ = RelocationScope.Excluded repository = FlexibleForeignKey("sentry.Repository") project = FlexibleForeignKey("sentry.Project", db_constraint=False) organization_integration_id = HybridCloudForeignKey( "sentry.OrganizationIntegration"...
RepositoryProjectPathConfig
python
getsentry__sentry
src/sentry/issues/endpoints/organization_group_suspect_flags.py
{ "start": 780, "end": 868 }
class ____(TypedDict): data: list[ResponseDataItem] @region_silo_endpoint
ResponseData
python
kamyu104__LeetCode-Solutions
Python/number-of-ways-to-wear-different-hats-to-each-other.py
{ "start": 37, "end": 744 }
class ____(object): def numberWays(self, hats): """ :type hats: List[List[int]] :rtype: int """ MOD = 10**9 + 7 HAT_SIZE = 40 hat_to_people = [[] for _ in xrange(HAT_SIZE)] for i in xrange(len(hats)): for h in hats[i]: hat_t...
Solution
python
pdm-project__pdm
src/pdm/resolver/resolvelib.py
{ "start": 750, "end": 5863 }
class ____(Resolver): def __post_init__(self) -> None: super().__post_init__() if self.locked_repository is None: self.locked_repository = self.project.get_locked_repository() supports_env_spec = "env_spec" in inspect.signature(self.project.get_provider).parameters if sup...
RLResolver
python
numba__numba
numba/core/types/abstract.py
{ "start": 10607, "end": 10773 }
class ____(Sequence): """ Base class for 1d mutable sequence types. Instances should have the *dtype* attribute. """ mutable = True
MutableSequence
python
kamyu104__LeetCode-Solutions
Python/longest-happy-prefix.py
{ "start": 639, "end": 1411 }
class ____(object): def longestPrefix(self, s): """ :type s: str :rtype: str """ M = 10**9+7 D = 26 def check(l, s): for i in xrange(l): if s[i] != s[len(s)-l+i]: return False return True ...
Solution2
python
sympy__sympy
sympy/utilities/matchpy_connector.py
{ "start": 5825, "end": 5942 }
class ____(_WildAbstract): min_length = 1 fixed_size = False @doctest_depends_on(modules=('matchpy',))
WildPlus
python
Pylons__pyramid
tests/test_i18n.py
{ "start": 7918, "end": 8926 }
class ____(unittest.TestCase): def setUp(self): testing.setUp() def tearDown(self): testing.tearDown() def _callFUT(self, request): from pyramid.i18n import default_locale_negotiator return default_locale_negotiator(request) def test_from_none(self): request =...
Test_default_locale_negotiator
python
pypa__virtualenv
src/virtualenv/run/plugin/activators.py
{ "start": 149, "end": 2235 }
class ____(ComponentBuilder): def __init__(self, interpreter, parser) -> None: self.default = None possible = OrderedDict( (k, v) for k, v in self.options("virtualenv.activate").items() if v.supports(interpreter) ) super().__init__(interpreter, parser, "activators", possi...
ActivationSelector
python
cherrypy__cherrypy
cherrypy/_cptools.py
{ "start": 15104, "end": 18959 }
class ____(object): """A collection of Tools. This object also functions as a config namespace handler for itself. Custom toolboxes should be added to each Application's toolboxes dict. """ def __init__(self, namespace): """Initialize a toolbox instance.""" self.namespace = nam...
Toolbox
python
sphinx-doc__sphinx
sphinx/directives/other.py
{ "start": 7847, "end": 8299 }
class ____(SphinxDirective): """Directive to give an explicit tabulary column definition to LaTeX.""" has_content = False required_arguments = 1 optional_arguments = 0 final_argument_whitespace = True option_spec: ClassVar[OptionSpec] = {} def run(self) -> list[Node]: node = addnod...
TabularColumns
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_pie/PIE796.py
{ "start": 810, "end": 922 }
class ____(enum.Enum): A = ... B = ... # PIE796 C = ... # PIE796 from typing import cast
FakeEnum10
python
readthedocs__readthedocs.org
readthedocs/api/v2/adapters.py
{ "start": 704, "end": 788 }
class ____(TimeoutAdapter, HostHeaderSSLAdapter): pass
TimeoutHostHeaderSSLAdapter
python
h5py__h5py
h5py/tests/test_file.py
{ "start": 25059, "end": 25289 }
class ____(TestCase): """ Feature: Files can be flushed """ def test_flush(self): """ Flush via .flush method """ fid = File(self.mktemp(), 'w') fid.flush() fid.close()
TestFlush
python
pytorch__pytorch
torch/backends/mkl/__init__.py
{ "start": 186, "end": 1783 }
class ____: """ On-demand oneMKL verbosing functionality. To make it easier to debug performance issues, oneMKL can dump verbose messages containing execution information like duration while executing the kernel. The verbosing functionality can be invoked via an environment variable named `MKL_...
verbose
python
gevent__gevent
src/greentest/3.14/test_urllib2.py
{ "start": 80901, "end": 84920 }
class ____(unittest.TestCase): class PutRequest(Request): method = 'PUT' def setUp(self): self.get = Request("http://www.python.org/~jeremy/") self.post = Request("http://www.python.org/~jeremy/", "data", headers={"X-Test": "test"}...
RequestTests
python
pytorch__pytorch
test/dynamo/test_guard_serialization.py
{ "start": 14199, "end": 60265 }
class ____(TestGuardSerializationBase): def test_function_locals(self): def foo(x): return x + 1 def fn(x, g): return g(x) + 1 self._test_serialization("TENSOR_MATCH", fn, torch.randn(3), foo) def test_tensor_match(self): def f(x: torch.Tensor): ...
TestGuardSerialization
python
getlogbook__logbook
src/logbook/queues.py
{ "start": 16109, "end": 16767 }
class ____(Handler): """Implements a handler that dispatches over a queue to a different process. It is connected to a subscriber with a :class:`multiprocessing.Queue`:: from multiprocessing import Queue from logbook.queues import MultiProcessingHandler queue = Queue(-1) h...
MultiProcessingHandler
python
doocs__leetcode
solution/0400-0499/0448.Find All Numbers Disappeared in an Array/Solution2.py
{ "start": 0, "end": 256 }
class ____: def findDisappearedNumbers(self, nums: List[int]) -> List[int]: for x in nums: i = abs(x) - 1 if nums[i] > 0: nums[i] *= -1 return [i + 1 for i in range(len(nums)) if nums[i] > 0]
Solution
python
gevent__gevent
src/gevent/tests/test__threading_2.py
{ "start": 22680, "end": 22779 }
class ____(lock_tests.LockTests): locktype = staticmethod(threading.Lock) @skipDueToHang
LockTests
python
aio-libs__aiohttp
aiohttp/client_exceptions.py
{ "start": 2804, "end": 2893 }
class ____(ClientResponseError): """ContentType found is not valid."""
ContentTypeError
python
numba__numba
numba/cuda/tests/cudadrv/test_pinned.py
{ "start": 127, "end": 944 }
class ____(ContextResettingTestCase): def _run_copies(self, A): A0 = np.copy(A) stream = cuda.stream() ptr = cuda.to_device(A, copy=False, stream=stream) ptr.copy_to_device(A, stream=stream) ptr.copy_to_host(A, stream=stream) stream.synchronize() self.asser...
TestPinned
python
django__django
tests/mutually_referential/tests.py
{ "start": 63, "end": 541 }
class ____(TestCase): def test_mutually_referential(self): # Create a Parent q = Parent(name="Elizabeth") q.save() # Create some children c = q.child_set.create(name="Charles") q.child_set.create(name="Edward") # Set the best child # No assertion req...
MutuallyReferentialTests
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typeParams1.py
{ "start": 607, "end": 1360 }
class ____: def object[T](self, target: object, new: T) -> T: ... # This should generate an error because T3 is duplicated. def func3[T3, S1, T3](): ... def func4[T4](T4: int): ... def func5[T5](a: int): # This should generate an error because T5 is already in use. class ClassA[T5]: ... # This sh...
ClassH
python
huggingface__transformers
src/transformers/models/sew/modular_sew.py
{ "start": 1510, "end": 1582 }
class ____(Wav2Vec2NoLayerNormConvLayer): pass
SEWNoLayerNormConvLayer
python
facelessuser__pymdown-extensions
tests/test_extensions/test_blocks/test_legacy_tab.py
{ "start": 100, "end": 1225 }
class ____(util.MdCase): """Test legacy tab slug cases.""" extension = ['pymdownx.blocks.tab', 'toc'] extension_configs = { 'pymdownx.blocks.tab': {'slugify': slugify(case='lower')} } MD = r""" ### Here is some text /// tab | Here is some text content /// /// tab | He...
TestLegacyTabSlugs
python
apache__airflow
providers/google/src/airflow/providers/google/marketing_platform/operators/campaign_manager.py
{ "start": 19097, "end": 22872 }
class ____(BaseOperator): """ Updates existing conversions. .. seealso:: Check official API docs: `https://developers.google.com/doubleclick-advertisers/rest/v4/conversions/batchupdate` .. seealso:: For more information on how to use this operator, take a look at the guide: ...
GoogleCampaignManagerBatchUpdateConversionsOperator
python
sqlalchemy__sqlalchemy
test/orm/test_relationships.py
{ "start": 159727, "end": 168579 }
class ____( _RelationshipErrors, fixtures.MappedTest ): @classmethod def define_tables(cls, metadata): Table("foos", metadata, Column("id", Integer, primary_key=True)) Table( "foobars", metadata, Column("fid", Integer), Column("bid", Integer) ) Table("bars", metad...
InvalidRelationshipEscalationTestM2M
python
streamlit__streamlit
lib/streamlit/elements/graphviz_chart.py
{ "start": 1456, "end": 7941 }
class ____: @gather_metrics("graphviz_chart") def graphviz_chart( self, figure_or_dot: FigureOrDot, use_container_width: bool | None = None, *, # keyword-only arguments: width: Width = "content", height: Height = "content", ) -> DeltaGenerator: """Dis...
GraphvizMixin
python
openai__openai-python
src/openai/types/realtime/realtime_conversation_item_system_message.py
{ "start": 465, "end": 1224 }
class ____(BaseModel): content: List[Content] """The content of the message.""" role: Literal["system"] """The role of the message sender. Always `system`.""" type: Literal["message"] """The type of the item. Always `message`.""" id: Optional[str] = None """The unique ID of the item. ...
RealtimeConversationItemSystemMessage
python
spack__spack
lib/spack/spack/traverse.py
{ "start": 1883, "end": 2484 }
class ____: """A visitor that reverses the arrows in the DAG, following dependents.""" def __init__(self, visitor, depflag: dt.DepFlag = dt.ALL): self.visitor = visitor self.depflag = depflag def accept(self, item): return self.visitor.accept(item) def neighbors(self, item): ...
ReverseVisitor
python
eventlet__eventlet
tests/pools_test.py
{ "start": 6104, "end": 6532 }
class ____(TestCase): mode = 'static' def setUp(self): self.pool = IntPool(max_size=3, order_as_stack=True) def test_ordering(self): # items come out in the reverse order they are put one, two = self.pool.get(), self.pool.get() self.pool.put(one) self.pool.put(two) ...
TestOrderAsStack
python
Textualize__textual
docs/examples/styles/width_comparison.py
{ "start": 240, "end": 790 }
class ____(App): CSS_PATH = "width_comparison.tcss" def compose(self): yield Horizontal( Placeholder(id="cells"), # (1)! Placeholder(id="percent"), Placeholder(id="w"), Placeholder(id="h"), Placeholder(id="vw"), Placeholder(id="vh...
WidthComparisonApp
python
plotly__plotly.py
plotly/graph_objs/image/legendgrouptitle/_font.py
{ "start": 233, "end": 9916 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "image.legendgrouptitle" _path_str = "image.legendgrouptitle.font" _valid_props = { "color", "family", "lineposition", "shadow", "size", "style", "textcase", "variant", "weight", ...
Font
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/client/utils.py
{ "start": 2018, "end": 2535 }
class ____(NamedTuple): repository_location_name: str repository_name: str job_name: str @staticmethod def from_node(node: dict[str, Any]) -> list["JobInfo"]: repo_name = node["name"] repo_location_name = node["location"]["name"] return [ JobInfo( ...
JobInfo
python
scipy__scipy
scipy/optimize/tests/test__shgo.py
{ "start": 7933, "end": 8304 }
class ____(StructTestFunction): def f(self, x): if x[0] == 3.0 and x[1] == 3.0: return 50 else: return 100 g = None cons = wrap_constraints(g) test_table = StructTestTable(bounds=[(-10, 10), (-10, 10)], expected_fun=[50], ...
StructTestTable
python
getsentry__sentry
src/sentry/notifications/notifications/organization_request/base.py
{ "start": 698, "end": 2576 }
class ____(BaseNotification, abc.ABC): notification_setting_type_enum = NotificationSettingEnum.APPROVAL RoleBasedRecipientStrategyClass: type[RoleBasedRecipientStrategy] def __init__(self, organization: Organization, requester: User) -> None: super().__init__(organization) self.requester =...
OrganizationRequestNotification
python
milvus-io__pymilvus
pymilvus/client/asynch.py
{ "start": 1451, "end": 4978 }
class ____(AbstractFuture): def __init__( self, future: Any, done_callback: Optional[Callable] = None, pre_exception: Optional[Callable] = None, **kwargs, ) -> None: self._future = future # keep compatible (such as Future(future, done_callback)), deprecate...
Future
python
vyperlang__vyper
vyper/venom/analysis/dfg.py
{ "start": 325, "end": 3898 }
class ____(IRAnalysis): _dfg_inputs: dict[IRVariable, OrderedSet[IRInstruction]] _dfg_outputs: dict[IRVariable, IRInstruction] def __init__(self, analyses_cache: IRAnalysesCache, function: IRFunction): super().__init__(analyses_cache, function) self._dfg_inputs = dict() self._dfg_ou...
DFGAnalysis
python
huggingface__transformers
src/transformers/models/qwen3_omni_moe/modular_qwen3_omni_moe.py
{ "start": 62644, "end": 62795 }
class ____(Qwen3MoePreTrainedModel): config_class = Qwen3OmniMoeTextConfig config = Qwen3OmniMoeTextConfig
Qwen3OmniMoeThinkerTextPreTrainedModel
python
pdm-project__pdm
src/pdm/cli/commands/run.py
{ "start": 4247, "end": 18735 }
class ____: """The task runner for pdm project""" TYPES = ("cmd", "shell", "call", "composite") OPTIONS = ("env", "env_file", "help", "keep_going", "working_dir", "site_packages") def __init__(self, project: Project, hooks: HookManager) -> None: self.project = project global_options = ...
TaskRunner
python
pyinstaller__pyinstaller
tests/functional/modules/pyi_testmod_relimp/F/__init__.py
{ "start": 540, "end": 585 }
class ____: name = 'pyi_testmod_relimp.F.H'
H
python
matplotlib__matplotlib
lib/matplotlib/testing/jpl_units/Epoch.py
{ "start": 157, "end": 6100 }
class ____: # Frame conversion offsets in seconds # t(TO) = t(FROM) + allowed[ FROM ][ TO ] allowed = { "ET": { "UTC": +64.1839, }, "UTC": { "ET": -64.1839, }, } def __init__(self, frame, sec=None, jd=None, daynum=None, dt=None): ...
Epoch
python
numba__numba
numba/tests/test_listimpl.py
{ "start": 5294, "end": 5811 }
class ____(object): """An iterator for the `List`. """ def __init__(self, parent): self.parent = parent itsize = self.parent.tc.numba_list_iter_sizeof() self.it_state_buf = (ctypes.c_char_p * itsize)(0) self.it = ctypes.cast(self.it_state_buf, ctypes.c_void_p) self.pa...
ListIter
python
pytorch__pytorch
benchmarks/tensorexpr/normalization.py
{ "start": 1508, "end": 1796 }
class ____(NormalizationBench): def forward(self): y = self.instance_norm(self.data) return y @staticmethod def module(): return "instance_norm" def is_supported(self): return tensor_engine.is_supported(self.instance_norm)
InstanceNormBench
python
pola-rs__polars
py-polars/tests/unit/constructors/test_constructors.py
{ "start": 1695, "end": 1775 }
class ____(pydantic.BaseModel): d: datetime e: float f: str
_TestBazPD
python
doocs__leetcode
solution/2100-2199/2174.Remove All Ones With Row and Column Flips II/Solution.py
{ "start": 0, "end": 967 }
class ____: def removeOnes(self, grid: List[List[int]]) -> int: m, n = len(grid), len(grid[0]) state = sum(1 << (i * n + j) for i in range(m) for j in range(n) if grid[i][j]) q = deque([state]) vis = {state} ans = 0 while q: for _ in range(len(q)): ...
Solution
python
ray-project__ray
python/ray/experimental/channel/conftest.py
{ "start": 392, "end": 2148 }
class ____: """ Barrier that blocks the given number of actors until all actors have reached the barrier. This is used to mock out blocking NCCL ops. """ def __init__(self, num_actors=2): self.num_actors = num_actors self.condition = asyncio.Condition() # Buffer for the data...
Barrier
python
pandas-dev__pandas
pandas/core/interchange/dataframe_protocol.py
{ "start": 404, "end": 621 }
class ____(enum.IntEnum): """Integer enum for device type codes matching DLPack.""" CPU = 1 CUDA = 2 CPU_PINNED = 3 OPENCL = 4 VULKAN = 7 METAL = 8 VPI = 9 ROCM = 10
DlpackDeviceType
python
kamyu104__LeetCode-Solutions
Python/design-sql.py
{ "start": 293, "end": 1212 }
class ____(object): def __init__(self, names, columns): """ :type names: List[str] :type columns: List[int] """ self.__table = {name:[column] for name, column in itertools.izip(names, columns)} def insertRow(self, name, row): """ :type name: str ...
SQL
python
doocs__leetcode
solution/1900-1999/1986.Minimum Number of Work Sessions to Finish the Tasks/Solution.py
{ "start": 0, "end": 525 }
class ____: def minSessions(self, tasks: List[int], sessionTime: int) -> int: n = len(tasks) ok = [False] * (1 << n) for i in range(1, 1 << n): t = sum(tasks[j] for j in range(n) if i >> j & 1) ok[i] = t <= sessionTime f = [inf] * (1 << n) f[0] = 0 ...
Solution
python
pandas-dev__pandas
pandas/tests/dtypes/test_dtypes.py
{ "start": 7875, "end": 14454 }
class ____(Base): @pytest.fixture def dtype(self): """ Class level fixture of dtype for TestDatetimeTZDtype """ return DatetimeTZDtype("ns", "US/Eastern") def test_alias_to_unit_raises(self): # 23990 with pytest.raises(ValueError, match="Passing a dtype alias...
TestDatetimeTZDtype
python
astropy__astropy
astropy/modeling/utils.py
{ "start": 7335, "end": 10255 }
class ____(UserDict): """ Wrapper around UserDict to allow for better tracking of the Special Operators for CompoundModels. This dictionary is structured so that one cannot inadvertently overwrite an existing special operator. Parameters ---------- unique_id: int the last used uniqu...
_SpecialOperatorsDict
python
celery__celery
celery/app/routes.py
{ "start": 1528, "end": 4551 }
class ____: """Route tasks based on the :setting:`task_routes` setting.""" def __init__(self, routes=None, queues=None, create_missing=False, app=None): self.app = app self.queues = {} if queues is None else queues self.routes = [] if routes is None else routes ...
Router
python
pallets__flask
src/flask/json/tag.py
{ "start": 5599, "end": 5911 }
class ____(JSONTag): __slots__ = () key = " d" def check(self, value: t.Any) -> bool: return isinstance(value, datetime) def to_json(self, value: t.Any) -> t.Any: return http_date(value) def to_python(self, value: t.Any) -> t.Any: return parse_date(value)
TagDateTime
python
pytorch__pytorch
test/torch_np/numpy_tests/core/test_indexing.py
{ "start": 944, "end": 18868 }
class ____(TestCase): def test_index_no_floats(self): a = np.array([[[5]]]) assert_raises(IndexError, lambda: a[0.0]) assert_raises(IndexError, lambda: a[0, 0.0]) assert_raises(IndexError, lambda: a[0.0, 0]) assert_raises(IndexError, lambda: a[0.0, :]) assert_raises(...
TestIndexing
python
scipy__scipy
benchmarks/benchmarks/go_benchmark_functions/go_funcs_S.py
{ "start": 36850, "end": 38092 }
class ____(Benchmark): r""" Stochastic objective function. This class defines the Stochastic [1]_ global optimization problem. This is a multimodal minimization problem defined as follows: .. math:: f_{\text{Stochastic}}(x) = \sum_{i=1}^{n} \epsilon_i ...
Stochastic
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_pyi/PYI034.py
{ "start": 2153, "end": 2666 }
class ____: def __new__(cls: type[Self], *args: Any, **kwargs: Any) -> Self: ... @abstractmethod def __str__(self) -> str: ... @abc.abstractmethod def __repr__(self) -> str: ... def __eq__(self, other: object) -> bool: ... def __ne__(self, obj: object) -> ...
Good
python
altair-viz__altair
altair/vegalite/v6/schema/core.py
{ "start": 1480566, "end": 1494370 }
class ____(TopLevelSpec): """ TopLevelUnitSpec schema wrapper. Parameters ---------- data : dict, :class:`Data`, :class:`UrlData`, :class:`Generator`, :class:`NamedData`, :class:`DataSource`, :class:`InlineData`, :class:`SphereGenerator`, :class:`SequenceGenerator`, :class:`GraticuleGenerator`, Non...
TopLevelUnitSpec
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/dataclass4.py
{ "start": 1803, "end": 1864 }
class ____(DC10): a: str = field() b: bool = field()
DC11
python
numpy__numpy
numpy/_core/code_generators/genapi.py
{ "start": 13048, "end": 13748 }
class ____: def __init__(self, name, index, api_name): self.name = name self.index = index self.type = 'PyBoolScalarObject' self.api_name = api_name def define_from_array_api_string(self): return "#define %s ((%s *)%s[%d])" % (self.name, ...
BoolValuesApi
python
jackfrued__Python-100-Days
Day31-35/code/example02.py
{ "start": 812, "end": 4597 }
class ____(object): """人""" def __init__(self, name, age): self.name = name self.age = age # def __gt__(self, other): # return self.name > other.name def __str__(self): return f'{self.name}: {self.age}' def __repr__(self): return self.__str__() def selec...
Person
python
huggingface__transformers
src/transformers/models/xlm_roberta_xl/modeling_xlm_roberta_xl.py
{ "start": 20985, "end": 22650 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.config = config self.layer = nn.ModuleList([XLMRobertaXLLayer(config, layer_idx=i) for i in range(config.num_hidden_layers)]) self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps) d...
XLMRobertaXLEncoder
python
miyuchina__mistletoe
mistletoe/span_token.py
{ "start": 5591, "end": 6504 }
class ____(SpanToken): """ Autolink token. ("<http://www.google.com>") This is an inline token with a single child of type RawText. Attributes: children (list): a single RawText node for the link target. target (str): link target. mailto (bool): true iff the target looks like an...
AutoLink
python
openai__openai-python
src/openai/types/beta/threads/file_path_annotation.py
{ "start": 303, "end": 552 }
class ____(BaseModel): end_index: int file_path: FilePath start_index: int text: str """The text in the message content that needs to be replaced.""" type: Literal["file_path"] """Always `file_path`."""
FilePathAnnotation
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 865820, "end": 867601 }
class ____(sgqlc.types.Type, Node): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ( "content", "created_at", "creator", "database_id", "field_values", "is_archived", "project", "title", "t...
ProjectNextItem
python
python-pillow__Pillow
Tests/test_imagewin.py
{ "start": 620, "end": 2728 }
class ____: def test_dib_image(self) -> None: # Arrange im = hopper() # Act dib = ImageWin.Dib(im) # Assert assert dib.size == im.size def test_dib_mode_string(self) -> None: # Arrange mode = "RGBA" size = (128, 128) # Act ...
TestImageWinDib
python
pytorch__pytorch
test/test_serialization.py
{ "start": 40010, "end": 40301 }
class ____: def __init__(self, num): self.num = num def __reduce_ex__(self, proto): # Third item, state here will cause pickle to push a BUILD instruction return ClassThatUsesBuildInstruction, (self.num,), {'foo': 'bar'} @dataclass
ClassThatUsesBuildInstruction
python
aio-libs__aiohttp
aiohttp/http_parser.py
{ "start": 2566, "end": 2705 }
class ____(IntEnum): PARSE_CHUNKED_SIZE = 0 PARSE_CHUNKED_CHUNK = 1 PARSE_CHUNKED_CHUNK_EOF = 2 PARSE_TRAILERS = 4
ChunkState
python
bokeh__bokeh
tests/unit/bokeh/command/test_subcommand.py
{ "start": 1074, "end": 2552 }
class ____(sc.Subcommand): def invoke(self, args): pass #----------------------------------------------------------------------------- # General API #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Dev A...
_Good
python
huggingface__transformers
tests/pipelines/test_pipelines_audio_classification.py
{ "start": 1175, "end": 8569 }
class ____(unittest.TestCase): model_mapping = MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING _dataset = None @classmethod def _load_dataset(cls): # Lazy loading of the dataset. Because it is a class method, it will only be loaded once per pytest process. if cls._dataset is None: cl...
AudioClassificationPipelineTests
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/links/translate.py
{ "start": 5206, "end": 5532 }
class ____(BaseGoogleLink): """ Helper class for constructing Translation Datasets List link. Both legacy and native datasets are available under this link. """ name = "Translation Dataset List" key = "translation_dataset_list" format_str = TRANSLATION_DATASET_LIST_LINK
TranslationDatasetsListLink
python
pyca__cryptography
tests/hazmat/primitives/test_hashes.py
{ "start": 3671, "end": 4394 }
class ____: test_blake2s = generate_base_hash_test( hashes.BLAKE2s(digest_size=32), digest_size=32, ) def test_invalid_digest_size(self, backend): with pytest.raises(ValueError): hashes.BLAKE2s(digest_size=33) with pytest.raises(ValueError): hashes.B...
TestBLAKE2s
python
milvus-io__pymilvus
pymilvus/client/types.py
{ "start": 25990, "end": 28134 }
class ____: """ Represents information about a node in the system. Attributes: node_id (int): The ID of the node. address (str): The ip address of the node. hostname (str): The hostname of the node. Example: NodeInfo( node_id=1, address="127.0.0.1"...
NodeInfo
python
pytorch__pytorch
test/inductor/test_flex_attention.py
{ "start": 154110, "end": 181635 }
class ____(torch.nn.Module): def forward(self, primals_1: "f64[2, 2, 128, 4]", primals_2: "f64[2, 2, 128, 4]", primals_3: "f64[2, 2, 128, 4]", full: "i32[1, 1, 1]", full_default: "i32[1, 1, 1, 1]", convert_element_type: "i32[1, 1, 1]", convert_element_type_1: "i32[1, 1, 1, 1]", getitem_2: "f64[2, 2, 128, 4]", getit...
GraphModule
python
django__django
tests/queries/tests.py
{ "start": 77767, "end": 79181 }
class ____(TestCase): def test_ticket10028(self): # Ordering by model related to nullable relations(!) should use outer # joins, so that all results are included. p1 = Plaything.objects.create(name="p1") self.assertSequenceEqual(Plaything.objects.all(), [p1]) def test_join_alrea...
NullableRelOrderingTests
python
getsentry__sentry
tests/acceptance/test_accept_organization_invite.py
{ "start": 510, "end": 7983 }
class ____(AcceptanceTestCase): def setUp(self) -> None: super().setUp() self.user = self.create_user("foo@example.com") self.org = self.create_organization(name="Rowdy Tiger", owner=None) self.team = self.create_team(organization=self.org, name="Mariachi Band") self.member =...
AcceptOrganizationInviteTest
python
python-attrs__attrs
src/attr/validators.py
{ "start": 13203, "end": 15117 }
class ____: bound = attrib() compare_op = attrib() compare_func = attrib() def __call__(self, inst, attr, value): """ We use a callable class to be able to change the ``__repr__``. """ if not self.compare_func(value, self.bound): msg = f"'{attr.name}' must be...
_NumberValidator
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_print_options05.py
{ "start": 315, "end": 1310 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("print_options05.xlsx") self.ignore_files = [ "xl/printerSettings/printerSettings1.bin", "xl/worksheets/_rels/sheet1.xml...
TestCompareXLSXFiles
python
getsentry__sentry
tests/sentry/web/frontend/test_organization_auth_settings.py
{ "start": 31981, "end": 33936 }
class ____(AuthProviderTestCase): provider = DummyGenericSAML2Provider provider_name = "saml2_generic_dummy" def setUp(self) -> None: super().setUp() self.user = self.create_user("foobar@sentry.io") self.organization = self.create_organization(owner=self.user, name="saml2-org") ...
OrganizationAuthSettingsGenericSAML2Test
python
plotly__plotly.py
plotly/graph_objs/layout/map/_bounds.py
{ "start": 235, "end": 4620 }
class ____(_BaseLayoutHierarchyType): _parent_path_str = "layout.map" _path_str = "layout.map.bounds" _valid_props = {"east", "north", "south", "west"} @property def east(self): """ Sets the maximum longitude of the map (in degrees East) if `west`, `south` and `north` are de...
Bounds
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_decorators_1.py
{ "start": 303, "end": 353 }
class ____: x: datetime.datetime @attrs.define
A
python
eventlet__eventlet
tests/greendns_test.py
{ "start": 15361, "end": 17084 }
class ____(tests.LimitedTestCase): def setUp(self): base_resolver = _make_mock_base_resolver() base_resolver.rr.address = '1.2.3.4' self._old_resolver = greendns.resolver greendns.resolver = base_resolver() def tearDown(self): greendns.resolver = self._old_resolver ...
TestResolve
python
huggingface__transformers
tests/models/chinese_clip/test_image_processing_chinese_clip.py
{ "start": 3196, "end": 5378 }
class ____(ImageProcessingTestMixin, unittest.TestCase): image_processing_class = ChineseCLIPImageProcessor if is_vision_available() else None fast_image_processing_class = ChineseCLIPImageProcessorFast if is_torchvision_available() else None def setUp(self): super().setUp() self.image_proc...
ChineseCLIPImageProcessingTest
python
has2k1__plotnine
plotnine/geoms/geom_dotplot.py
{ "start": 625, "end": 8718 }
class ____(geom): """ Dot plot {usage} Parameters ---------- {common_parameters} stackdir : Literal["up", "down", "center", "centerwhole"], default="up" Direction in which to stack the dots. Options are stackratio : float, default=1 How close to stack the dots. If value...
geom_dotplot
python
spyder-ide__spyder
spyder/api/widgets/menus.py
{ "start": 1826, "end": 17530 }
class ____(QMenu, SpyderFontsMixin): """ A QMenu subclass to implement additional functionality for Spyder. """ MENUS = [] APP_MENU = False HORIZONTAL_MARGIN_FOR_ITEMS = 2 * AppStyle.MarginSize HORIZONTAL_PADDING_FOR_ITEMS = 3 * AppStyle.MarginSize def __init__( self, pa...
SpyderMenu
python
doocs__leetcode
solution/1800-1899/1812.Determine Color of a Chessboard Square/Solution.py
{ "start": 0, "end": 139 }
class ____: def squareIsWhite(self, coordinates: str) -> bool: return (ord(coordinates[0]) + ord(coordinates[1])) % 2 == 1
Solution
python
weaviate__weaviate-python-client
weaviate/exceptions.py
{ "start": 428, "end": 898 }
class ____(Exception): """Weaviate base exception that all Weaviate exceptions should inherit from. This error can be used to catch any Weaviate exceptions. """ def __init__(self, message: str = ""): """Weaviate base exception initializer. Args: message (str): An error mes...
WeaviateBaseError
python
sympy__sympy
sympy/assumptions/cnf.py
{ "start": 2030, "end": 2751 }
class ____: """ A low-level implementation for Or """ def __init__(self, *args): self._args = args @property def args(self): return sorted(self._args, key=str) def rcall(self, expr): return type(self)(*[arg.rcall(expr) for arg in self._ar...
OR
python
pdm-project__pdm
src/pdm/cli/commands/venv/purge.py
{ "start": 261, "end": 2387 }
class ____(BaseCommand): """Purge selected/all created Virtualenvs""" arguments = (verbose_option,) def add_arguments(self, parser: argparse.ArgumentParser) -> None: parser.add_argument( "-f", "--force", action="store_true", help="Force purging witho...
PurgeCommand
python
streamlit__streamlit
lib/streamlit/testing/v1/element_tree.py
{ "start": 17970, "end": 18142 }
class ____(HeadingBase): def __init__(self, proto: HeadingProto, root: ElementTree) -> None: super().__init__(proto, root, "header") @dataclass(repr=False)
Header
python
scrapy__scrapy
tests/test_feedexport.py
{ "start": 2593, "end": 4940 }
class ____: def test_store_file_uri(self, tmp_path): path = tmp_path / "file.txt" uri = path_to_file_uri(str(path)) self._assert_stores(FileFeedStorage(uri), path) def test_store_file_uri_makedirs(self, tmp_path): path = tmp_path / "more" / "paths" / "file.txt" uri = pat...
TestFileFeedStorage
python
EpistasisLab__tpot
tpot/tpot_estimator/estimator.py
{ "start": 2501, "end": 56515 }
class ____(BaseEstimator): def __init__(self, search_space, scorers, scorers_weights, classification, cv = 10, other_objective_functions=[], other...
TPOTEstimator
python
has2k1__plotnine
plotnine/iapi.py
{ "start": 8204, "end": 8411 }
class ____: """ What is required to layout an inside legend """ box: FlexibleAnchoredOffsetbox justification: tuple[float, float] position: tuple[float, float] @dataclass
inside_legend