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
huggingface__transformers
src/transformers/models/granitemoeshared/modular_granitemoeshared.py
{ "start": 4898, "end": 5058 }
class ____(GraniteMoePreTrainedModel): config: GraniteMoeSharedConfig _no_split_modules = ["GraniteMoeSharedDecoderLayer"]
GraniteMoeSharedPreTrainedModel
python
getsentry__sentry
tests/sentry/relocation/api/endpoints/artifacts/test_index.py
{ "start": 575, "end": 1510 }
class ____(APITestCase): endpoint = "sentry-api-0-relocations-artifacts-index" method = "GET" def setUp(self) -> None: super().setUp() self.owner = self.create_user(email="owner@example.com", is_superuser=False, is_staff=False) self.superuser = self.create_user(is_superuser=True) ...
GetRelocationArtifactsTest
python
PyCQA__pylint
tests/functional/i/invalid/invalid_metaclass_py3.py
{ "start": 245, "end": 306 }
class ____(metaclass=valid_metaclass_1): pass
GoodMetaclass
python
django__django
tests/modeladmin/test_checks.py
{ "start": 48275, "end": 51459 }
class ____(CheckTestCase): def test_list_display_links_is_none(self): """ list_display and list_editable can contain the same values when list_display_links is None """ class ProductAdmin(ModelAdmin): list_display = ["name", "slug", "pub_date"] list_e...
ListDisplayEditableTests
python
pyqtgraph__pyqtgraph
pyqtgraph/GraphicsScene/exportDialogTemplate_generic.py
{ "start": 347, "end": 2922 }
class ____(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(241, 367) self.gridLayout = QtWidgets.QGridLayout(Form) self.gridLayout.setSpacing(0) self.gridLayout.setObjectName("gridLayout") self.label = QtWidgets.QLabel(Form) self.label...
Ui_Form
python
numpy__numpy
numpy/f2py/tests/test_callback.py
{ "start": 6729, "end": 7099 }
class ____(util.F2PyTest): sources = [util.getpath("tests", "src", "callback", "gh26681.f90")] options = ['--lower'] def test_callstatement_fortran(self): with pytest.raises(ValueError, match='helpme') as exc: self.module.mypy_abort = self.module.utils.my_abort self.module.u...
TestCBFortranCallstatement
python
sqlalchemy__sqlalchemy
test/ext/asyncio/test_engine.py
{ "start": 33941, "end": 37475 }
class ____(EngineFixture): """The engine events all run in their normal synchronous context. we do not provide an asyncio event interface at this time. """ __backend__ = True @async_test async def test_no_async_listeners(self, async_engine): with testing.expect_raises_message( ...
AsyncEventTest
python
qdrant__qdrant-client
qdrant_client/http/models/models.py
{ "start": 27170, "end": 27279 }
class ____(BaseModel, extra="forbid"): datetime_key: str = Field(..., description="")
DatetimeKeyExpression
python
etianen__django-reversion
reversion/middleware.py
{ "start": 73, "end": 679 }
class ____: """Wraps the entire request in a revision.""" manage_manually = False using = None atomic = True def __init__(self, get_response): self.get_response = create_revision( manage_manually=self.manage_manually, using=self.using, atomic=self.ato...
RevisionMiddleware
python
anthropics__anthropic-sdk-python
src/anthropic/types/beta/beta_bash_code_execution_result_block.py
{ "start": 317, "end": 525 }
class ____(BaseModel): content: List[BetaBashCodeExecutionOutputBlock] return_code: int stderr: str stdout: str type: Literal["bash_code_execution_result"]
BetaBashCodeExecutionResultBlock
python
getsentry__sentry
src/sentry/snuba/metrics/query.py
{ "start": 3958, "end": 4072 }
class ____(MetricActionByField): direction: Direction = Direction.ASC @dataclass(frozen=True)
MetricOrderByField
python
run-llama__llama_index
llama-index-integrations/readers/llama-index-readers-pdb/llama_index/readers/pdb/base.py
{ "start": 265, "end": 1275 }
class ____(BaseReader): """Protein Data Bank entries' primary citation abstract reader.""" def __init__(self) -> None: super().__init__() def load_data(self, pdb_ids: List[str]) -> List[Document]: """ Load data from RCSB or EBI REST API. Args: pdb_ids (List[str...
PdbAbstractReader
python
openai__openai-python
src/openai/types/eval_create_params.py
{ "start": 3088, "end": 3488 }
class ____(TypedDict, total=False): type: Required[Literal["stored_completions"]] """The type of data source. Always `stored_completions`.""" metadata: Dict[str, object] """Metadata filters for the stored completions data source.""" DataSourceConfig: TypeAlias = Union[DataSourceConfigCustom, DataSour...
DataSourceConfigStoredCompletions
python
ray-project__ray
python/ray/_private/thirdparty/pynvml/pynvml.py
{ "start": 105850, "end": 106257 }
class ____(Structure): _fields_ = [('version', c_uint), ('environment', c_uint), ('ccFeature', c_uint), ('devToolsMode', c_uint), ('multiGpuMode', c_uint), ] def __init__(self): super(c_nvmlSystemConfComputeSettings_v1_t, sel...
c_nvmlSystemConfComputeSettings_v1_t
python
huggingface__transformers
src/transformers/models/sam3/configuration_sam3.py
{ "start": 11866, "end": 13952 }
class ____(PreTrainedConfig): r""" Configuration class for SAM3 DETR Decoder (object query decoder). Args: hidden_size (`int`, *optional*, defaults to 256): Dimensionality of the decoder layers. num_layers (`int`, *optional*, defaults to 6): Number of decoder layers....
Sam3DETRDecoderConfig
python
zarr-developers__zarr-python
src/zarr/core/config.py
{ "start": 1462, "end": 1526 }
class ____(ValueError): _msg = "bad Config: %r"
BadConfigError
python
numpy__numpy
numpy/f2py/tests/test_return_complex.py
{ "start": 79, "end": 1818 }
class ____(util.F2PyTest): def check_function(self, t, tname): if tname in ["t0", "t8", "s0", "s8"]: err = 1e-5 else: err = 0.0 assert abs(t(234j) - 234.0j) <= err assert abs(t(234.6) - 234.6) <= err assert abs(t(234) - 234.0) <= err assert abs...
TestReturnComplex
python
doocs__leetcode
solution/0300-0399/0315.Count of Smaller Numbers After Self/Solution2.py
{ "start": 95, "end": 1180 }
class ____: def __init__(self, n): self.tr = [Node() for _ in range(n << 2)] self.build(1, 1, n) def build(self, u, l, r): self.tr[u].l = l self.tr[u].r = r if l == r: return mid = (l + r) >> 1 self.build(u << 1, l, mid) self.build(u <...
SegmentTree
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/executors/ecs/test_ecs_executor.py
{ "start": 52951, "end": 81940 }
class ____: @pytest.fixture def assign_subnets(self): with conf_vars({(CONFIG_GROUP_NAME, AllEcsConfigKeys.SUBNETS): "sub1,sub2"}): yield @pytest.fixture def assign_container_name(self): with conf_vars({(CONFIG_GROUP_NAME, AllEcsConfigKeys.CONTAINER_NAME): "foobar"}): ...
TestEcsExecutorConfig
python
getsentry__sentry
src/sentry/integrations/github/webhook.py
{ "start": 31323, "end": 35417 }
class ____(Endpoint): """ GitHub Webhook API reference: https://docs.github.com/en/webhooks-and-events/webhooks/about-webhooks """ authentication_classes = () permission_classes = () owner = ApiOwner.ECOSYSTEM publish_status = { "POST": ApiPublishStatus.PRIVATE, } _han...
GitHubIntegrationsWebhookEndpoint
python
huggingface__transformers
src/transformers/models/apertus/modular_apertus.py
{ "start": 8907, "end": 9175 }
class ____(NemotronMLP): def __init__(self, config): super().__init__() self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False) self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=False)
ApertusMLP
python
walkccc__LeetCode
solutions/1487. Making File Names Unique/1487.py
{ "start": 0, "end": 638 }
class ____: def getFolderNames(self, names: list[str]) -> list[str]: ans = [] nameToSuffix = {} for name in names: if name in nameToSuffix: suffix = nameToSuffix[name] + 1 newName = self._getName(name, suffix) while newName in nameToSuffix: suffix += 1 ne...
Solution
python
aimacode__aima-python
agents.py
{ "start": 21278, "end": 21394 }
class ____(Obstacle): pass # ______________________________________________________________________________
Wall
python
Textualize__textual
src/textual/events.py
{ "start": 16996, "end": 17158 }
class ____(MouseEvent, bubble=True, verbose=True): """Sent when the mouse wheel is scrolled *left*. - [X] Bubbles - [X] Verbose """
MouseScrollLeft
python
walkccc__LeetCode
solutions/3286. Find a Safe Walk Through a Grid/3286.py
{ "start": 0, "end": 796 }
class ____: def findSafeWalk(self, grid: list[list[int]], health: int) -> bool: DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0)) m = len(grid) n = len(grid[0]) initialHealth = health - grid[0][0] q = collections.deque([(0, 0, initialHealth)]) seen = {(0, 0, initialHealth)} while q: for _ i...
Solution
python
tensorflow__tensorflow
tensorflow/python/compiler/tensorrt/test/cast_test.py
{ "start": 1108, "end": 2376 }
class ____(trt_test.TfTrtIntegrationTestBase): """Tests cast to FP32 are split in FP16 mode.""" def _ConstOp(self, shape, dtype): return constant_op.constant(np.random.randn(*shape), dtype=dtype) def GraphFn(self, x): b_f = self._ConstOp((1, 10), dtypes.float16) x_f = math_ops.cast(x, dtypes.float16...
CastInt32ToFp32Test
python
pypa__setuptools
setuptools/_distutils/tests/test_dist.py
{ "start": 711, "end": 1165 }
class ____(Distribution): """Distribution subclasses that avoids the default search for configuration files. The ._config_files attribute must be set before .parse_config_files() is called. """ def find_config_files(self): return self._config_files @pytest.fixture def clear_argv(): ...
TestDistribution
python
airbytehq__airbyte
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/migrate_to_manifest_only/declarative_component_schema.py
{ "start": 33871, "end": 34675 }
class ____(BaseModel): type: Literal["RemoveFields"] condition: Optional[str] = Field( "", description="The predicate to filter a property by a property value. Property will be removed if it is empty OR expression is evaluated to True.,", examples=[ "{{ property|string == '' ...
RemoveFields
python
langchain-ai__langchain
libs/partners/anthropic/tests/integration_tests/test_chat_models.py
{ "start": 31498, "end": 31608 }
class ____(BaseModel): """Person data.""" name: str age: int nicknames: list[str] | None
Person
python
facebook__pyre-check
client/commands/check.py
{ "start": 1217, "end": 5770 }
class ____: """ Data structure for configuration options the backend check command can recognize. Need to keep in sync with `source/command/checkCommand.ml` """ base_arguments: backend_arguments.BaseArguments additional_logging_sections: Sequence[str] = dataclasses.field(default_factory=list) ...
Arguments
python
h5py__h5py
h5py/tests/test_dataset.py
{ "start": 45375, "end": 48187 }
class ____(BaseDataset): """ Feature: Datasets created with "maxshape" may be resized """ def test_create(self): """ Create dataset with "maxshape" """ dset = self.f.create_dataset(make_name(), (20, 30), maxshape=(20, 60)) self.assertIsNot(dset.chunks, None) self.as...
TestResize
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/roles.py
{ "start": 7325, "end": 7464 }
class ____(SQLRole): __slots__ = () _role_name = "String column name or column expression for DDL constraint"
DDLConstraintColumnRole
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 554651, "end": 555174 }
class ____(sgqlc.types.Type): """Autogenerated return type of DeleteIpAllowListEntry""" __schema__ = github_schema __field_names__ = ("client_mutation_id", "ip_allow_list_entry") client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId") """A unique identifier for the client pe...
DeleteIpAllowListEntryPayload
python
getsentry__sentry
src/sentry/testutils/cases.py
{ "start": 16828, "end": 18811 }
class ____(BaseTestCase, DjangoTestCase): # We need Django to flush all databases. databases: set[str] | str = "__all__" @contextmanager def auto_select_silo_mode_on_redirects(self): """ Tests that utilize follow=True may follow redirects between silo modes. This isn't ideal but conven...
TestCase
python
pyodide__pyodide
src/py/pyodide/console.py
{ "start": 9047, "end": 20665 }
class ____: """Interactive Pyodide console An interactive console based on the Python standard library :py:class:`~code.InteractiveConsole` that manages stream redirections and asynchronous execution of the code. The stream callbacks can be modified directly by assigning to :py:attr:`~Console....
Console
python
sqlalchemy__sqlalchemy
test/orm/test_sync.py
{ "start": 968, "end": 9186 }
class ____( fixtures.MappedTest, testing.AssertsExecutionResults, AssertsUOW ): @classmethod def define_tables(cls, metadata): Table( "t1", metadata, Column("id", Integer, primary_key=True), Column("foo", Integer), ) Table( ...
SyncTest
python
pytorch__pytorch
torch/_subclasses/fake_tensor.py
{ "start": 20931, "end": 21669 }
class ____: debug = os.environ.get("TORCH_FAKE_TENSOR_DEBUG", "0") == "1" # This memorizes unbacked SymInt or SymFloats representing quantities like the # number of nonzero elements in this tensor or learning rate. There is one # instance of the descriptor per particular quantity to memoize. # # Memoization is he...
FakeTensorConfig
python
airbytehq__airbyte
airbyte-integrations/connectors/source-bigcommerce/components.py
{ "start": 345, "end": 1000 }
class ____(AddFields): def transform( self, record: Record, config: Optional[Config] = None, stream_state: Optional[StreamState] = None, stream_slice: Optional[StreamSlice] = None, ) -> Record: kwargs = {"record": record, "stream_state": stream_state, "stream_slic...
DateTimeTransformer
python
sympy__sympy
sympy/plotting/series.py
{ "start": 47137, "end": 49706 }
class ____(Line2DBaseSeries): """Representation for a line consisting of list of points.""" def __init__(self, list_x, list_y, label="", **kwargs): super().__init__(**kwargs) np = import_module('numpy') if len(list_x) != len(list_y): raise ValueError( "The tw...
List2DSeries
python
airbytehq__airbyte
airbyte-integrations/connectors/source-instagram/unit_tests/integration/test_user_lifetime_insights.py
{ "start": 1524, "end": 2511 }
class ____(TestCase): @staticmethod def _read(config_: ConfigBuilder, expecting_exception: bool = False) -> EntrypointOutput: return read_output( config_builder=config_, stream_name=_STREAM_NAME, sync_mode=SyncMode.full_refresh, expecting_exception=expecti...
TestFullRefresh
python
matplotlib__matplotlib
lib/matplotlib/patheffects.py
{ "start": 2161, "end": 5754 }
class ____(RendererBase): """ Implements a Renderer which contains another renderer. This proxy then intercepts draw calls, calling the appropriate :class:`AbstractPathEffect` draw method. .. note:: Not all methods have been overridden on this RendererBase subclass. It may be neces...
PathEffectRenderer
python
huggingface__transformers
src/transformers/models/xlstm/modeling_xlstm.py
{ "start": 61754, "end": 66234 }
class ____(xLSTMPreTrainedModel, GenerationMixin): def __init__(self, config): super().__init__(config) self.backbone = xLSTMModel(config) self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False) # Initialize weights and apply final processing self.post_ini...
xLSTMForCausalLM
python
apache__airflow
task-sdk/src/airflow/sdk/exceptions.py
{ "start": 5027, "end": 5134 }
class ____(AirflowException): """Raise when there is a timeout on sensor polling."""
AirflowSensorTimeout
python
keon__algorithms
tests/test_strings.py
{ "start": 19377, "end": 19893 }
class ____(unittest.TestCase): """[summary] Test for the file knuth_morris_pratt.py Arguments: unittest {[type]} -- [description] """ def test_knuth_morris_pratt(self): self.assertEqual([0, 1, 2, 3, 4], knuth_morris_pratt("aaaaaaa", "aaa")) self.assertEqual([0, 4], knuth_m...
TestKnuthMorrisPratt
python
ipython__ipython
IPython/core/oinspect.py
{ "start": 3212, "end": 4299 }
class ____(TypedDict): type_name: Optional[str] base_class: Optional[str] string_form: Optional[str] namespace: Optional[str] length: Optional[str] file: Optional[str] definition: Optional[str] docstring: Optional[str] source: Optional[str] init_definition: Optional[str] clas...
InfoDict
python
charliermarsh__ruff
crates/ruff_python_formatter/resources/test/fixtures/black/cases/fmtonoff5.py
{ "start": 1548, "end": 1806 }
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
milvus-io__pymilvus
pymilvus/client/types.py
{ "start": 22134, "end": 22703 }
class ____: def __init__(self, username: str, entities: List[milvus_types.RoleEntity]) -> None: self._username = username roles = [] for entity in entities: if isinstance(entity, milvus_types.RoleEntity): roles.append(entity.name) self._roles = tuple(roles...
UserItem
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/hooks/managed_kafka.py
{ "start": 3507, "end": 30705 }
class ____(GoogleBaseHook): """Hook for Managed Service for Apache Kafka APIs.""" def __init__( self, gcp_conn_id: str = "google_cloud_default", impersonation_chain: str | Sequence[str] | None = None, **kwargs, ) -> None: super().__init__(gcp_conn_id, impersonation_c...
ManagedKafkaHook
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/roles.py
{ "start": 1496, "end": 1608 }
class ____(SQLRole): __slots__ = () _role_name = "ExecutionOption Core or ORM object"
ExecutableOptionRole
python
getsentry__sentry
src/sentry/web/frontend/base.py
{ "start": 2186, "end": 5651 }
class ____(SiloLimit): def __init__(self, modes: SiloMode | Iterable[SiloMode], internal: bool = False) -> None: if isinstance(modes, SiloMode): modes = [modes] self.modes = frozenset(modes) self.internal = internal def modify_endpoint_class(self, decorated_class: type[View]...
ViewSiloLimit
python
getsentry__sentry
src/sentry/tsdb/redis.py
{ "start": 1070, "end": 1823 }
class ____(Generic[T]): """\ Wraps a context manager and prevents any exceptions raised either during the managed block or the exiting of the wrapped manager from propagating. You probably shouldn't use this. """ def __init__(self, wrapped: ContextManager[T]): self.wrapped = wrapped ...
SuppressionWrapper
python
jazzband__django-simple-history
simple_history/registry_tests/migration_test_app/migrations/0001_initial.py
{ "start": 158, "end": 3723 }
class ____(migrations.Migration): initial = True dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL)] operations = [ migrations.CreateModel( name="DoYouKnow", fields=[ ( "id", models.AutoField( ...
Migration
python
airbytehq__airbyte
airbyte-integrations/connectors/source-greenhouse/components.py
{ "start": 505, "end": 1803 }
class ____(LegacyToPerPartitionStateMigration): declarative_stream: DeclarativeStreamModel config: Config def __init__(self, declarative_stream: DeclarativeStreamModel, config: Config): self._partition_router = declarative_stream.retriever.partition_router self._cursor = declarative_stream....
GreenhouseStateMigration
python
getsentry__sentry
tests/sentry/integrations/slack/webhooks/events/test_discover_link_shared.py
{ "start": 1080, "end": 8251 }
class ____(BaseEventTest): @pytest.fixture(autouse=True) def mock_chat_postEphemeral(self): with patch( "slack_sdk.web.client.WebClient.chat_postEphemeral", return_value=SlackResponse( client=None, http_verb="POST", api_url="https:/...
DiscoverLinkSharedEvent
python
oauthlib__oauthlib
oauthlib/openid/connect/core/exceptions.py
{ "start": 300, "end": 359 }
class ____(FatalClientError): pass
FatalOpenIDClientError
python
pydata__xarray
xarray/tests/test_indexes.py
{ "start": 26777, "end": 28581 }
class ____(Index): @classmethod def from_variables(cls, variables, *, options=None): return cls() def create_variables(self, variables=None): if variables is None: # For Coordinates.from_xindex(), return all variables the index can create return { "ti...
IndexWithExtraVariables
python
doocs__leetcode
solution/0400-0499/0408.Valid Word Abbreviation/Solution.py
{ "start": 0, "end": 551 }
class ____: def validWordAbbreviation(self, word: str, abbr: str) -> bool: m, n = len(word), len(abbr) i = j = x = 0 while i < m and j < n: if abbr[j].isdigit(): if abbr[j] == "0" and x == 0: return False x = x * 10 + int(abbr[j...
Solution
python
huggingface__transformers
src/transformers/models/glm4v/convert_glm4v_mgt_weights_to_hf.py
{ "start": 776, "end": 32469 }
class ____(pickle.Unpickler): def find_class(self, mod_name, name): class DummyClass: def __init__(self, *args, **kwargs): pass if mod_name.startswith("megatron") or mod_name.startswith("glm") or mod_name.startswith("__main__"): return DummyClass retu...
UnpicklerWrapper
python
django-guardian__django-guardian
guardian/testapp/tests/test_other.py
{ "start": 10345, "end": 11416 }
class ____(TestCase): @mock.patch("django.contrib.auth.get_user_model") def test_monkey_patch(self, mocked_get_user_model): class CustomUserTestClass(AbstractUser): pass mocked_get_user_model.return_value = CustomUserTestClass self.assertFalse(getattr(CustomUserTestClass, "...
TestMonkeyPatch
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/ecp_viz_sdk/package.py
{ "start": 216, "end": 490 }
class ____(Package): """Package that has a dependency with a variant which adds a transitive dependency forced to use non default values. """ homepage = "https://dev.null" version("1.0") depends_on("conditional-constrained-dependencies")
EcpVizSdk
python
ansible__ansible
test/lib/ansible_test/_internal/http.py
{ "start": 3649, "end": 3865 }
class ____(ApplicationError): """HTTP response as an error.""" def __init__(self, status: int, message: str) -> None: super().__init__('%s: %s' % (status, message)) self.status = status
HttpError
python
wandb__wandb
wandb/vendor/pygments/lexers/dylan.py
{ "start": 512, "end": 8300 }
class ____(RegexLexer): """ For the `Dylan <http://www.opendylan.org/>`_ language. .. versionadded:: 0.7 """ name = 'Dylan' aliases = ['dylan'] filenames = ['*.dylan', '*.dyl', '*.intr'] mimetypes = ['text/x-dylan'] flags = re.IGNORECASE builtins = set(( 'subclass', '...
DylanLexer
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/streams.py
{ "start": 19101, "end": 19401 }
class ____(GithubStream): """ API docs: https://docs.github.com/en/rest/issues/labels?apiVersion=2022-11-28#list-labels-for-a-repository """ def path(self, stream_slice: Mapping[str, Any] = None, **kwargs) -> str: return f"repos/{stream_slice['repository']}/labels"
IssueLabels
python
dask__distributed
distributed/shuffle/_worker_plugin.py
{ "start": 8496, "end": 14969 }
class ____(WorkerPlugin): """Interface between a Worker and a Shuffle. This extension is responsible for - Lifecycle of Shuffle instances - ensuring connectivity between remote shuffle instances - ensuring connectivity and integration with the scheduler - routing concurrent calls to the approp...
ShuffleWorkerPlugin
python
numpy__numpy
numpy/f2py/tests/test_quoted_character.py
{ "start": 103, "end": 477 }
class ____(util.F2PyTest): sources = [util.getpath("tests", "src", "quoted_character", "foo.f")] @pytest.mark.skipif(sys.platform == "win32", reason="Fails with MinGW64 Gfortran (Issue #9673)") @pytest.mark.slow def test_quoted_character(self): assert self.module.foo() =...
TestQuotedCharacter
python
encode__django-rest-framework
tests/test_renderers.py
{ "start": 3801, "end": 4153 }
class ____(APIView): renderer_classes = (BrowsableAPIRenderer,) permission_classes = (POSTDeniedPermission,) def get(self, request): return Response() def post(self, request): return Response() def put(self, request): return Response() def patch(self, request): ...
POSTDeniedView
python
apache__airflow
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/secret.py
{ "start": 1064, "end": 5317 }
class ____(K8SModel): """Defines Kubernetes Secret Volume.""" def __init__(self, deploy_type, deploy_target, secret, key=None, items=None): """ Initialize a Kubernetes Secret Object. Used to track requested secrets from the user. :param deploy_type: The type of secret deploy i...
Secret
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/execution.py
{ "start": 2179, "end": 2817 }
class ____(graphene.Enum): COMPUTE = "COMPUTE" UNRESOLVED_MAPPED = "UNRESOLVED_MAPPED" UNRESOLVED_COLLECT = "UNRESOLVED_COLLECT" class Meta: name = "StepKind" @property def description(self): if self == GrapheneStepKind.COMPUTE: return "This is a user-defined comput...
GrapheneStepKind
python
pydata__xarray
xarray/tests/test_rolling.py
{ "start": 20019, "end": 34403 }
class ____: @pytest.mark.parametrize( "funcname, argument", [ ("reduce", (np.mean,)), ("mean", ()), ("construct", ("window_dim",)), ("count", ()), ], ) def test_rolling_keep_attrs(self, funcname, argument) -> None: global_attrs ...
TestDatasetRolling
python
huggingface__transformers
src/transformers/models/dbrx/modeling_dbrx.py
{ "start": 27750, "end": 32799 }
class ____(DbrxPreTrainedModel, GenerationMixin): _tied_weights_keys = {"lm_head.weight": "transformer.wte.weight"} _tp_plan = {"lm_head": "colwise_rep"} _pp_plan = {"lm_head": (["hidden_states"], ["logits"])} def __init__(self, config: DbrxConfig): super().__init__(config) self.transfo...
DbrxForCausalLM
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/ext/mutable.py
{ "start": 27841, "end": 31004 }
class ____(Mutable, Dict[_KT, _VT]): """A dictionary type that implements :class:`.Mutable`. The :class:`.MutableDict` object implements a dictionary that will emit change events to the underlying mapping when the contents of the dictionary are altered, including when values are added or removed. ...
MutableDict
python
django-haystack__django-haystack
haystack/management/commands/clear_index.py
{ "start": 88, "end": 2265 }
class ____(BaseCommand): help = "Clears out the search index completely." # noqa A003 def add_arguments(self, parser): parser.add_argument( "--noinput", action="store_false", dest="interactive", default=True, help="If provided, no prompts wil...
Command
python
spyder-ide__spyder
spyder/widgets/helperwidgets.py
{ "start": 21692, "end": 23543 }
class ____(QLabel): """Icon widget to show information as a tooltip when clicked.""" def __init__( self, tip_text: str, icon: QIcon, hover_icon: QIcon, size: int | None = None, wrap_text: bool = False ): super().__init__() if wrap_text: ...
TipWidget
python
getsentry__sentry
src/sentry/monitors/processing_errors/errors.py
{ "start": 5161, "end": 5702 }
class ____(Exception): """ This exception should be raised with a list of ProcessingError representing the problems which occurred while processing a monitor check-in. """ def __init__( self, processing_errors: Sequence[ProcessingError], monitor: Monitor | None = None, )...
ProcessingErrorsException
python
fluentpython__example-code-2e
10-dp-1class-func/pytypes/classic_strategy.py
{ "start": 2556, "end": 2884 }
class ____(Promotion): # second Concrete Strategy """10% discount for each LineItem with 20 or more units""" def discount(self, order): discount = 0 for item in order.cart: if item.quantity >= 20: discount += item.total() * .1 return discount @typelogged
BulkItemPromo
python
getlogbook__logbook
src/logbook/compat.py
{ "start": 979, "end": 1745 }
class ____: """Temporarily redirects logging for all threads and reverts it later to the old handlers. Mainly used by the internal unittests:: from logbook.compat import redirected_logging with redirected_logging(): ... """ def __init__(self, set_root_logger_level=Tru...
redirected_logging
python
patrick-kidger__equinox
equinox/nn/_pool.py
{ "start": 7407, "end": 8967 }
class ____(Pool): """One-dimensional downsample using the maximum over a sliding window.""" def __init__( self, kernel_size: int | Sequence[int], stride: int | Sequence[int] = 1, padding: int | Sequence[int] | Sequence[tuple[int, int]] = 0, use_ceil: bool = False, ):...
MaxPool1d
python
lepture__authlib
authlib/oauth2/auth.py
{ "start": 2392, "end": 3587 }
class ____: """Attach token information to HTTP requests. :param token: A dict or OAuth2Token instance of an OAuth 2.0 token :param token_placement: The placement of the token, default is ``header``, available choices: * header (default) * body * uri """ DEFAULT_TO...
TokenAuth
python
numpy__numpy
numpy/fft/tests/test_pocketfft.py
{ "start": 462, "end": 22253 }
class ____: def test_identity(self): maxlen = 512 x = random(maxlen) + 1j * random(maxlen) xr = random(maxlen) for i in range(1, maxlen): assert_allclose(np.fft.ifft(np.fft.fft(x[0:i])), x[0:i], atol=1e-12) assert_allclose(np.fft.i...
TestFFT1D
python
astropy__astropy
astropy/io/votable/converters.py
{ "start": 33792, "end": 34926 }
class ____(Converter): """ Handles the bit datatype. """ format = "b1" array_type = BitArray vararray_type = ScalarVarArray default = False binary_one = b"\x08" binary_zero = b"\0" def parse(self, value, config=None, pos=None): if config is None: config = {}...
Bit
python
pypa__pip
tests/unit/test_appdirs.py
{ "start": 175, "end": 3178 }
class ____: @pytest.mark.skipif(sys.platform != "win32", reason="Windows-only test") def test_user_cache_dir_win(self, monkeypatch: pytest.MonkeyPatch) -> None: _get_win_folder = mock.Mock(return_value="C:\\Users\\test\\AppData\\Local") monkeypatch.setattr( platformdirs.windows, # ...
TestUserCacheDir
python
kamyu104__LeetCode-Solutions
Python/count-numbers-with-non-decreasing-digits.py
{ "start": 1582, "end": 3590 }
class ____(object): def countNumbers(self, l, r, b): """ :type l: str :type r: str :type b: int :rtype: int """ MOD = 10**9+7 fact, inv, inv_fact = [[1]*2 for _ in xrange(3)] def nCr(n, k): while len(inv) <= n: # lazy initializatio...
Solution2
python
pypa__pip
src/pip/_vendor/pyproject_hooks/_in_process/_in_process.py
{ "start": 10093, "end": 10180 }
class ____(Exception): """Nothing should ever raise this exception"""
_DummyException
python
jazzband__prettytable
tests/test_colortable.py
{ "start": 642, "end": 1474 }
class ____: def test_themeless( self, row_prettytable: PrettyTable, row_colortable: ColorTable ) -> None: # Not worth the logic customizing the reset code # For now we'll just get rid of it assert ( row_colortable.get_string().replace(RESET_CODE, "") == ro...
TestColorTable
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/array_ops/spacetobatch_op_test.py
{ "start": 7377, "end": 7547 }
class ____(SpaceToBatchTest, CppOpImpl): """Tests input-output pairs for the SpaceToBatch and BatchToSpace ops. This uses the C++ ops. """ pass
SpaceToBatchCppTest
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/multi_sink_ports.py
{ "start": 530, "end": 582 }
class ____: def send(self): pass
QueryBase
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 982010, "end": 982588 }
class ____(sgqlc.types.Type, Node): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("body", "body_html", "database_id", "title", "user") body = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="body") body_html = sgqlc.types.Field(sgqlc.type...
SavedReply
python
readthedocs__readthedocs.org
readthedocs/projects/migrations/0130_addons_remove_old_fields.py
{ "start": 121, "end": 880 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("projects", "0129_addons_notification_data_migration"), ] operations = [ migrations.RemoveField( model_name="addonsconfig", name="external_version_warning_enabled", ), ...
Migration
python
facebookresearch__faiss
benchs/bench_fw/utils.py
{ "start": 3874, "end": 6877 }
class ____(Enum): TIME = 0 # time vs accuracy SPACE = 1 # space vs accuracy TIME_SPACE = 2 # (time, space) vs accuracy def range_search_recall_at_precision(experiment, precision): return round( max( r for r, p in zip( experiment["range_search_pr"]["re...
ParetoMetric
python
tensorflow__tensorflow
tensorflow/lite/python/lite_test.py
{ "start": 3109, "end": 9315 }
class ____(TestModels): # Tests invalid constructors using a dummy value for the GraphDef. def testInvalidConstructor(self): message = ( 'If input_tensors and output_tensors are None, both ' 'input_arrays_with_shape and output_arrays|control_output_arrays must ' 'be defined.') # `o...
FromConstructor
python
tensorflow__tensorflow
tensorflow/python/ops/weak_tensor_special_math_ops_test.py
{ "start": 5366, "end": 7501 }
class ____(test.TestCase, parameterized.TestCase): @test_util.run_in_graph_and_eager_modes def test_fresnel_cos_boundary(self): self.assertAllClose(0., special_math_ops.fresnel_cos(0.)) self.assertTrue( np.isnan(self.evaluate(special_math_ops.fresnel_cos(np.nan)))) @parameterized.parameters(np.f...
FresnelCosTest
python
sqlalchemy__sqlalchemy
test/orm/test_selectin_relations.py
{ "start": 100425, "end": 107129 }
class ____( fixtures.DeclarativeMappedTest, testing.AssertsExecutionResults ): @classmethod def setup_classes(cls): Base = cls.DeclarativeBasic class A(ComparableEntity, Base): __tablename__ = "a" id = Column(Integer, primary_key=True) b_id = Column(Forei...
M2OWDegradeTest
python
getsentry__sentry
src/sentry/integrations/example/integration.py
{ "start": 7214, "end": 8489 }
class ____(IntegrationProvider): """ An example integration, generally used for testing. """ key = "example" name = "Example" metadata = metadata integration_cls = ExampleIntegration features = frozenset( [ IntegrationFeatures.COMMITS, IntegrationFeatur...
ExampleIntegrationProvider
python
ray-project__ray
python/ray/tests/aws/test_aws_batch_tag_update.py
{ "start": 1528, "end": 2153 }
class ____(unittest.TestCase): def test_concurrent(self): num_threads = 100 batches_sent, tags_updated = batch_test(num_threads, delay=0) self.assertLess(batches_sent, num_threads / 10) self.assertEqual(tags_updated, num_threads) def test_serial(self): num_threads = 5 ...
TagBatchTest
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 634676, "end": 635337 }
class ____(sgqlc.types.relay.Connection): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("edges", "nodes", "page_info", "total_count") edges = sgqlc.types.Field( sgqlc.types.list_of("SponsorshipNewsletterEdge"), graphql_name="edges" ) nodes...
SponsorshipNewsletterConnection
python
SmileyChris__easy-thumbnails
easy_thumbnails/models.py
{ "start": 1512, "end": 1711 }
class ____(FileManager): def _get_thumbnail_manager(self): if settings.THUMBNAIL_CACHE_DIMENSIONS: return self.select_related("dimensions") return self
ThumbnailManager
python
wandb__wandb
wandb/vendor/pygments/lexers/configs.py
{ "start": 17589, "end": 19054 }
class ____(RegexLexer): """ Lexer for `Nginx <http://nginx.net/>`_ configuration files. .. versionadded:: 0.11 """ name = 'Nginx configuration file' aliases = ['nginx'] filenames = ['nginx.conf'] mimetypes = ['text/x-nginx-conf'] tokens = { 'root': [ (r'(include...
NginxConfLexer
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_object_position19.py
{ "start": 315, "end": 933 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("object_position19.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file with image(s).""" workbook =...
TestCompareXLSXFiles
python
kamyu104__LeetCode-Solutions
Python/minimum-knight-moves.py
{ "start": 29, "end": 1806 }
class ____(object): def minKnightMoves(self, x, y): """ :type x: int :type y: int :rtype: int """ # we can observe from: # [0] # [3, 2] # [2,(1),4] # [3, 2, 3, 2] # [2, 3,(2) 3, 4] # [3, 4, 3, 4, 3, 4] # [4, 3, 4...
Solution
python
openai__gym
tests/vector/utils.py
{ "start": 2623, "end": 3834 }
class ____(gym.Env): def __init__(self): super().__init__() self.observation_space = CustomSpace() self.action_space = CustomSpace() def reset(self, *, seed: Optional[int] = None, options: Optional[dict] = None): super().reset(seed=seed) return "reset", {} def step(...
CustomSpaceEnv