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
streamlit__streamlit
lib/streamlit/web/server/server.py
{ "start": 6021, "end": 10396 }
class ____(Exception): pass def server_port_is_manually_set() -> bool: return config.is_manually_set("server.port") def server_address_is_unix_socket() -> bool: address = config.get_option("server.address") return address is not None and address.startswith(UNIX_SOCKET_PREFIX) def start_listening(a...
RetriesExceededError
python
tensorflow__tensorflow
tensorflow/python/distribute/distribute_coordinator.py
{ "start": 1289, "end": 1497 }
class ____(object): PS = "ps" WORKER = "worker" CHIEF = "chief" EVALUATOR = "evaluator" CLIENT = "client" # TODO(yuefengz): support another mode where the client colocates with one # worker.
_TaskType
python
Pylons__pyramid
tests/test_predicates.py
{ "start": 17115, "end": 17327 }
class ____: def __init__(self, result): self.result = result def text(self): return self.result phash = text def __call__(self, context, request): return True
DummyPredicate
python
HypothesisWorks__hypothesis
hypothesis-python/tests/django/toystore/forms.py
{ "start": 7116, "end": 7296 }
class ____(ReprModelForm): company = forms.ModelChoiceField(queryset=Company.objects.order_by("name")) class Meta: model = Store fields = "__all__"
StoreForm
python
spyder-ide__spyder
spyder/plugins/editor/tests/test_editor_config_dialog.py
{ "start": 554, "end": 1186 }
class ____(QMainWindow): register_shortcut = Mock() file_menu_actions = [] file_toolbar_actions = [] statusbar = Mock() new_instance = Mock() plugin_focus_changed = Mock() fallback_completions = Mock() ipyconsole = Mock() mainmenu = Mock() sig_setup_finished = Mock() switcher...
MainWindowMock
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/implementation/fetch_runs.py
{ "start": 14075, "end": 27318 }
class ____: """Three part cursor for paginating the Runs Feed. The run_cursor is the run_id of the oldest run that has been returned. The backfill_cursor is the id of the oldest backfill that has been returned. The timestamp is the timestamp of the oldest entry (run or backfill). If the run/backfill cu...
RunsFeedCursor
python
pypa__twine
tests/test_auth.py
{ "start": 9561, "end": 9977 }
class ____: def __init__(self, status_code: int, json: t.Any) -> None: self.status_code = status_code self._json = json def json(self, *args, **kwargs) -> t.Any: return self._json def raise_for_status(self) -> None: if 400 <= self.status_code: raise requests.exc...
MockResponse
python
huggingface__transformers
src/transformers/models/siglip/modeling_siglip.py
{ "start": 16023, "end": 18872 }
class ____(PreTrainedModel): config: SiglipConfig base_model_prefix = "siglip" input_modalities = ("image", "text") supports_gradient_checkpointing = True _no_split_modules = [ "SiglipTextEmbeddings", "SiglipVisionEmbeddings", "SiglipEncoderLayer", "SiglipMultiheadAt...
SiglipPreTrainedModel
python
getsentry__sentry
src/sentry/release_health/base.py
{ "start": 2471, "end": 3089 }
class ____(TypedDict): start: datetime end: datetime intervals: list[DateString] groups: list[SessionsQueryGroup] query: str FormattedIsoTime = str ProjectRelease = tuple[ProjectId, ReleaseName] ProjectOrRelease = TypeVar("ProjectOrRelease", ProjectId, ProjectRelease) # taken from sentry.snuba.s...
SessionsQueryResult
python
facebookresearch__faiss
tests/test_io.py
{ "start": 6372, "end": 7125 }
class ____: """ wraps an OnDisk object for use from C++ """ def __init__(self, oil): self.oil = oil def list_size(self, list_no): return self.oil.list_size(list_no) def get_codes(self, list_no): oil = self.oil assert 0 <= list_no < oil.lists.size() l = oil.list...
PyOndiskInvertedLists
python
weaviate__weaviate-python-client
weaviate/collections/classes/config.py
{ "start": 61349, "end": 61441 }
class ____(_ConfigBase): cache: Optional[bool] rescore_limit: int @dataclass
_BQConfig
python
ansible__ansible
test/integration/targets/ansible-test-sanity-pylint/ansible_collections/ns/col/plugins/lookup/deprecated.py
{ "start": 3924, "end": 4025 }
class ____: def __init__(self, thing) -> None: self.module: AnsibleModule = thing
MyWrapper
python
coleifer__peewee
tests/postgres.py
{ "start": 31939, "end": 32467 }
class ____(DatabaseTestCase): database = db_loader('postgres', isolation_level=3) # SERIALIZABLE. def test_isolation_level(self): conn = self.database.connection() self.assertEqual(conn.isolation_level, 3) conn.set_isolation_level(2) self.assertEqual(conn.isolation_level, 2) ...
TestPostgresIsolationLevel
python
pandas-dev__pandas
pandas/tests/frame/methods/test_isetitem.py
{ "start": 96, "end": 1428 }
class ____: def test_isetitem_ea_df(self): # GH#49922 df = DataFrame([[1, 2, 3], [4, 5, 6]]) rhs = DataFrame([[11, 12], [13, 14]], dtype="Int64") df.isetitem([0, 1], rhs) expected = DataFrame( { 0: Series([11, 13], dtype="Int64"), ...
TestDataFrameSetItem
python
django__django
tests/contenttypes_tests/models.py
{ "start": 370, "end": 517 }
class ____(models.Model): name = models.CharField(max_length=100) def get_absolute_url(self): return "/authors/%s/" % self.id
Author
python
apache__airflow
airflow-core/tests/unit/always/test_secrets_backends.py
{ "start": 1704, "end": 4172 }
class ____: def setup_method(self) -> None: clear_db_connections() clear_db_variables() def teardown_method(self) -> None: clear_db_connections() clear_db_variables() @pytest.mark.parametrize( ("kwargs", "output"), [ ({"path_prefix": "PREFIX", "s...
TestBaseSecretsBackend
python
ray-project__ray
python/ray/serve/_private/request_router/replica_wrapper.py
{ "start": 1432, "end": 3496 }
class ____(ReplicaWrapper): def __init__(self, actor_handle): self._actor_handle = actor_handle def send_request_java(self, pr: PendingRequest) -> ActorReplicaResult: """Send the request to a Java replica. Does not currently support streaming. """ if pr.metadata.is_strea...
ActorReplicaWrapper
python
sphinx-doc__sphinx
sphinx/domains/cpp/__init__.py
{ "start": 16757, "end": 17596 }
class ____(CPPObject): object_type = 'function' doc_field_types = [ *CPPObject.doc_field_types, GroupedField( 'parameter', label=_('Parameters'), names=('param', 'parameter', 'arg', 'argument'), can_collapse=True, ), GroupedField( ...
CPPFunctionObject
python
allegroai__clearml
clearml/backend_api/services/v2_23/tasks.py
{ "start": 575184, "end": 577334 }
class ____(Response): """ Response of tasks.validate endpoint. """ _service = "tasks" _action = "validate" _version = "2.23" _schema = {"additionalProperties": False, "definitions": {}, "type": "object"} response_mapping = { GetByIdRequest: GetByIdResponse, GetAllRequest: GetAll...
ValidateResponse
python
python-jsonschema__jsonschema
jsonschema/tests/test_validators.py
{ "start": 76473, "end": 77472 }
class ____(TestCase): """ Threading-related functionality tests. jsonschema doesn't promise thread safety, and its validation behavior across multiple threads may change at any time, but that means it isn't safe to share *validators* across threads, not that anytime one has multiple threads tha...
TestThreading
python
allegroai__clearml
clearml/backend_api/services/v2_20/tasks.py
{ "start": 231048, "end": 232253 }
class ____(Response): """ Response of tasks.edit_configuration endpoint. :param updated: Indicates if the task was updated successfully :type updated: int """ _service = "tasks" _action = "edit_configuration" _version = "2.20" _schema = { "definitions": {}, "propert...
EditConfigurationResponse
python
PrefectHQ__prefect
src/prefect/events/actions.py
{ "start": 4494, "end": 4898 }
class ____(Action): """Send a notification when an Automation is triggered""" type: Literal["send-notification"] = "send-notification" block_document_id: UUID = Field( description="The identifier of the notification block to use" ) subject: str = Field("Prefect automated notification") ...
SendNotification
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/requires_virtual/package.py
{ "start": 217, "end": 519 }
class ____(Package): """Package that requires a virtual dependency and is registered as an external. """ homepage = "http://www.example.com" url = "http://www.example.com/a-1.0.tar.gz" version("2.0", md5="abcdef0123456789abcdef0123456789") depends_on("stuff")
RequiresVirtual
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/inputs.py
{ "start": 7069, "end": 7352 }
class ____(graphene.InputObjectType): partitionNames = graphene.InputField(non_null_list(graphene.String)) assetSelection = graphene.InputField(non_null_list(GrapheneAssetKeyInput)) class Meta: name = "AssetBackfillPreviewParams"
GrapheneAssetBackfillPreviewParams
python
numba__llvmlite
llvmlite/tests/test_refprune.py
{ "start": 8161, "end": 10346 }
class ____(BaseTestByIR): refprune_bitmask = llvm.RefPruneSubpasses.DIAMOND per_diamond_1 = r""" define void @main(i8* %ptr) { bb_A: call void @NRT_incref(i8* %ptr) br label %bb_B bb_B: call void @NRT_decref(i8* %ptr) ret void } """ def test_per_diamond_1(self): mod, stats = self.c...
TestDiamond
python
pytorch__pytorch
test/export/test_sparse.py
{ "start": 1415, "end": 1506 }
class ____(torch.nn.Module): def forward(self, x): return x.to_dense()
ToDenseNet
python
wandb__wandb
wandb/sdk/internal/file_stream.py
{ "start": 4034, "end": 10455 }
class ____(DefaultFilePolicy): r"""File stream policy for removing carriage-return erased characters. This is what a terminal does. We use it for console output to reduce the amount of data we need to send over the network (eg. for progress bars), while preserving the output's appearance in the web app...
CRDedupeFilePolicy
python
HypothesisWorks__hypothesis
hypothesis-python/src/hypothesis/internal/conjecture/shrinking/string.py
{ "start": 562, "end": 946 }
class ____(Collection): def __init__(self, initial, predicate, *, intervals, **kwargs): super().__init__( list(initial), lambda val: predicate("".join(val)), to_order=intervals.index_from_char_in_shrink_order, from_order=intervals.char_in_shrink_order, ...
String
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/orm/scoping.py
{ "start": 2762, "end": 4153 }
class ____(Protocol): """Describes the type applied to a class-level :meth:`_orm.scoped_session.query_property` attribute. .. versionadded:: 2.0.5 """ def __get__(self, instance: Any, owner: Type[_T]) -> Query[_T]: ... _O = TypeVar("_O", bound=object) __all__ = ["scoped_session"] @create_pro...
QueryPropertyDescriptor
python
sphinx-doc__sphinx
doc/development/tutorials/examples/todo.py
{ "start": 573, "end": 4070 }
class ____(SphinxDirective): # this enables content in the directive has_content = True def run(self): targetid = 'todo-%d' % self.env.new_serialno('todo') targetnode = nodes.target('', '', ids=[targetid]) todo_node = todo('\n'.join(self.content)) todo_node += nodes.title(_...
TodoDirective
python
scipy__scipy
scipy/optimize/tests/test_optimize.py
{ "start": 5357, "end": 39342 }
class ____(CheckOptimize): def test_cg(self): # conjugate gradient optimization routine if self.use_wrapper: opts = {'maxiter': self.maxiter, 'disp': self.disp, 'return_all': False} res = optimize.minimize(self.func, self.startparams, args=(), ...
CheckOptimizeParameterized
python
pennersr__django-allauth
allauth/socialaccount/providers/odnoklassniki/views.py
{ "start": 629, "end": 2059 }
class ____(OAuth2Adapter): provider_id = "odnoklassniki" access_token_url = "https://api.odnoklassniki.ru/oauth/token.do" # nosec authorize_url = "https://www.odnoklassniki.ru/oauth/authorize" profile_url = "https://api.odnoklassniki.ru/fb.do" access_token_method = "POST" # nosec def complete...
OdnoklassnikiOAuth2Adapter
python
pyqtgraph__pyqtgraph
pyqtgraph/exporters/PrintExporter.py
{ "start": 263, "end": 2586 }
class ____(Exporter): Name = "Printer" def __init__(self, item): Exporter.__init__(self, item) tr = self.getTargetRect() self.params = Parameter.create(name='params', type='group', children=[ {'name': 'width', 'title': translate("Exporter", 'width'), 'type': 'float', 'value':...
PrintExporter
python
openai__openai-python
src/openai/resources/realtime/realtime.py
{ "start": 6793, "end": 7196 }
class ____: def __init__(self, realtime: Realtime) -> None: self._realtime = realtime @cached_property def client_secrets(self) -> ClientSecretsWithRawResponse: return ClientSecretsWithRawResponse(self._realtime.client_secrets) @cached_property def calls(self) -> CallsWithRawRespon...
RealtimeWithRawResponse
python
pytorch__pytorch
torch/_inductor/codegen/multi_kernel.py
{ "start": 18906, "end": 19961 }
class ____(MultiKernel): """ Version of multi-kernel that generates kernels based on specified size hints. Currently only performs 1-d search over hints; doesn't perform combinatorial n-d search if n > 1 dynamic dimensions are specified. e.g. matmul([s0, s1], [s1, s2]) with size-hints [64, 256] onl...
SizeHintMultiKernel
python
davidhalter__jedi
jedi/inference/arguments.py
{ "start": 4449, "end": 4604 }
class ____: def unpack(self, funcdef=None): raise NotImplementedError def get_calling_nodes(self): return []
_AbstractArgumentsMixin
python
kamyu104__LeetCode-Solutions
Python/sentence-similarity-iii.py
{ "start": 29, "end": 731 }
class ____(object): def areSentencesSimilar(self, sentence1, sentence2): """ :type sentence1: str :type sentence2: str :rtype: bool """ if len(sentence1) > len(sentence2): sentence1, sentence2 = sentence2, sentence1 count = 0 for idx in (la...
Solution
python
apache__airflow
airflow-core/src/airflow/metrics/otel_logger.py
{ "start": 10563, "end": 11357 }
class ____: """Stores sync gauge instrument and current value to support delta feature.""" def __init__(self, meter, name: str, tags: Attributes): self.attributes = tags otel_safe_name = _get_otel_safe_name(name) self.gauge = meter.create_gauge(name=otel_safe_name) log.debug("Cr...
InternalGauge
python
altair-viz__altair
altair/vegalite/v6/schema/_config.py
{ "start": 94109, "end": 95335 }
class ____(TypedDict, total=False): """ :class:`altair.ErrorBarConfig` ``TypedDict`` wrapper. Parameters ---------- extent The extent of the rule. Available options include: * ``"ci"``: Extend the rule to the 95% bootstrapped confidence interval of the mean. * ``"stderr"``:...
ErrorBarConfigKwds
python
ray-project__ray
rllib/env/tests/test_env_runner_group.py
{ "start": 203, "end": 4008 }
class ____(unittest.TestCase): @classmethod def setUpClass(cls): ray.init() @classmethod def tearDownClass(cls): ray.shutdown() def test_foreach_env_runner(self): """Test to make sure basic sychronous calls to remote workers work.""" ws = EnvRunnerGroup( ...
TestEnvRunnerGroup
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/mssql/pyodbc.py
{ "start": 20167, "end": 20285 }
class ____(_MSJsonPathType): def get_dbapi_type(self, dbapi): return dbapi.SQL_WVARCHAR
_JSONPathType_pyodbc
python
h5py__h5py
h5py/tests/test_file2.py
{ "start": 8805, "end": 9712 }
class ____(TestCase): def populate(self, f): for i in range(100): # Mix group and dataset creation. if i % 10 == 0: f.create_group(str(i)) else: f[str(i)] = [i] def test_track_order(self): fname = self.mktemp() f = h5py...
TestTrackOrder
python
instagram__MonkeyType
monkeytype/stubs.py
{ "start": 17547, "end": 17915 }
class ____(Stub): def __init__( self, name: str, typ: type, ) -> None: self.name = name self.typ = typ def render(self, prefix: str = "") -> str: return f"{prefix}{self.name}: {render_annotation(self.typ)}" def __repr__(self) -> str: return f"Att...
AttributeStub
python
apache__airflow
airflow-core/tests/unit/models/test_dag.py
{ "start": 76471, "end": 96975 }
class ____: def _clean(self): clear_db_dags() clear_db_assets() clear_db_runs() clear_db_dag_bundles() clear_db_teams() def setup_method(self): self._clean() def teardown_method(self): self._clean() def test_dags_needing_dagruns_not_too_early(se...
TestDagModel
python
skorch-dev__skorch
skorch/_version.py
{ "start": 4568, "end": 7833 }
class ____(_BaseVersion): def __init__(self, version): self._version = str(version) self._key = _legacy_cmpkey(self._version) def __str__(self): return self._version def __repr__(self): return "<LegacyVersion({0})>".format(repr(str(self))) @property def public(sel...
LegacyVersion
python
Netflix__metaflow
test/test_included_modules/my_decorators.py
{ "start": 1474, "end": 1590 }
class ____(StepMutator): def mutate(self, mutable_step): mutable_step.add_decorator(time_step)
AddTimeStep
python
pydata__xarray
xarray/tests/test_dataset.py
{ "start": 300843, "end": 303747 }
class ____: def test_from_numpy(self) -> None: ds = xr.Dataset({"a": ("x", [1, 2, 3])}, coords={"lat": ("x", [4, 5, 6])}) assert_identical(ds.as_numpy(), ds) @requires_dask def test_from_dask(self) -> None: ds = xr.Dataset({"a": ("x", [1, 2, 3])}, coords={"lat": ("x", [4, 5, 6])}) ...
TestNumpyCoercion
python
huggingface__transformers
src/transformers/models/table_transformer/modeling_table_transformer.py
{ "start": 12733, "end": 13606 }
class ____(nn.Module): """ This module adds 2D position embeddings to all intermediate feature maps of the convolutional encoder. """ def __init__(self, conv_encoder, position_embedding): super().__init__() self.conv_encoder = conv_encoder self.position_embedding = position_embe...
TableTransformerConvModel
python
getsentry__sentry
src/sentry/workflow_engine/handlers/condition/issue_occurrences_handler.py
{ "start": 349, "end": 1519 }
class ____(DataConditionHandler[WorkflowEventData]): group = DataConditionHandler.Group.ACTION_FILTER subgroup = DataConditionHandler.Subgroup.ISSUE_ATTRIBUTES comparison_json_schema = { "type": "object", "properties": { "value": {"type": "integer", "minimum": 0}, }, ...
IssueOccurrencesConditionHandler
python
vyperlang__vyper
vyper/venom/passes/memmerging.py
{ "start": 419, "end": 685 }
class ____: start: int length: int @property def end(self): return self.start + self.length def overlaps(self, other): a = max(self.start, other.start) b = min(self.end, other.end) return a < b @dataclass
_Interval
python
apache__airflow
providers/common/sql/tests/unit/common/sql/operators/test_sql.py
{ "start": 33554, "end": 35626 }
class ____: def setup_method(self): self.task_id = "test_task" self.conn_id = "default_conn" def _construct_operator(self, sql, pass_value, tolerance=None): dag = DAG("test_dag", schedule=None, start_date=datetime.datetime(2017, 1, 1)) return SQLValueCheckOperator( ...
TestValueCheckOperator
python
spyder-ide__spyder
spyder/utils/workers.py
{ "start": 867, "end": 2345 }
class ____(QObject): """ Generic python worker for running python code on threads. For running processes (via QProcess) use the ProcessWorker. """ sig_started = Signal(object) sig_finished = Signal(object, object, object) # worker, stdout, stderr def __init__(self, func, args, kwargs): ...
PythonWorker
python
astropy__astropy
astropy/io/ascii/basic.py
{ "start": 5552, "end": 5984 }
class ____(Basic): """Tab-separated table. Unlike the :class:`Basic` reader, whitespace is not stripped from the beginning and end of either lines or individual column values. Example:: col1 <tab> col2 <tab> col3 # Comment line 1 <tab> 2 <tab> 5 """ _format_name = "tab" ...
Tab
python
prompt-toolkit__python-prompt-toolkit
src/prompt_toolkit/widgets/toolbars.py
{ "start": 10846, "end": 11207 }
class ____: def __init__(self) -> None: self.container = ConditionalContainer( content=Window( _CompletionsToolbarControl(), height=1, style="class:completion-toolbar" ), filter=has_completions, ) def __pt_container__(self) -> Container: ...
CompletionsToolbar
python
pypa__pip
src/pip/_internal/metadata/__init__.py
{ "start": 3023, "end": 5824 }
class ____(Protocol): NAME: Literal["importlib", "pkg_resources"] Distribution: type[BaseDistribution] Environment: type[BaseEnvironment] @functools.cache def select_backend() -> Backend: if _should_use_importlib_metadata(): from . import importlib return cast(Backend, importlib) ...
Backend
python
run-llama__llama_index
llama-index-integrations/vector_stores/llama-index-vector-stores-docarray/llama_index/vector_stores/docarray/base.py
{ "start": 543, "end": 6759 }
class ____(VectorStore, ABC): """ DocArray Vector Store Base Class. This is an abstract base class for creating a DocArray vector store. The subclasses should implement _init_index and _find_docs_to_be_removed methods. """ # for mypy. will get initialized by the subclass. _index: Any ...
DocArrayVectorStore
python
bokeh__bokeh
tests/unit/bokeh/models/test_sources.py
{ "start": 19081, "end": 37420 }
class ____: __test__ = is_installed("pandas") def test_init_dataframe_arg(self) -> None: data = dict(a=[1, 2], b=[2, 3]) df = pd.DataFrame(data) ds = bms.ColumnDataSource(df) assert set(df.columns).issubset(set(ds.column_names)) for key in data.keys(): assert...
TestColumnDataSourcePandas
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pep8_naming/N805.py
{ "start": 1869, "end": 1974 }
class ____: def formula(household): hºusehold(1) from typing import Protocol
RenamingWithNFKC
python
huggingface__transformers
src/transformers/models/falcon/modeling_falcon.py
{ "start": 21641, "end": 27131 }
class ____(FalconAttention): """ Falcon flash attention module. This module inherits from `FalconAttention` as the weights of the module stays untouched. The only required change would be on the forward pass where it needs to correctly call the public API of flash attention and deal with padding tokens ...
FalconFlashAttention2
python
python-openxml__python-docx
tests/image/test_png.py
{ "start": 12897, "end": 13639 }
class ____: def it_can_construct_from_a_stream_and_offset(self, from_offset_fixture): stream_rdr, offset, px_width, px_height = from_offset_fixture ihdr_chunk = _IHDRChunk.from_offset(None, stream_rdr, offset) assert isinstance(ihdr_chunk, _IHDRChunk) assert ihdr_chunk.px_width == px...
Describe_IHDRChunk
python
pytorch__pytorch
torch/_inductor/autoheuristic/autoheuristic.py
{ "start": 1163, "end": 1407 }
class ____(Exception): """ Exception that is thrown when AutoHeuristic tries to log data to a file where the metadata stored in the file does not match the metadata it would store if the file didn't exist. """
InconsistentMetadata
python
apache__airflow
airflow-core/tests/unit/models/test_taskinstance.py
{ "start": 4655, "end": 5218 }
class ____: task_id: str | None = None dag_id: str | None = None logical_date: datetime.datetime | None = None task_state_in_callback: str | None = None callback_ran = False def wrap_task_instance(self, ti): self.task_id = ti.task_id self.dag_id = ti.dag_id self.logical_...
CallbackWrapper
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_pie/PIE796.py
{ "start": 120, "end": 185 }
class ____(Enum): A = 1 B = 2 C = 2 # PIE796
FakeEnum2
python
wandb__wandb
wandb/vendor/pygments/lexers/webmisc.py
{ "start": 37898, "end": 39891 }
class ____(ExtendedRegexLexer): """ For Slim markup. .. versionadded:: 2.0 """ name = 'Slim' aliases = ['slim'] filenames = ['*.slim'] mimetypes = ['text/x-slim'] flags = re.IGNORECASE _dot = r'(?: \|\n(?=.* \|)|.)' tokens = { 'root': [ (r'[ \t]*\n', Te...
SlimLexer
python
dagster-io__dagster
python_modules/dagster/dagster/_core/system_config/objects.py
{ "start": 2582, "end": 14003 }
class ____( NamedTuple( "_ResolvedRunConfig", [ ("ops", Mapping[str, OpConfig]), ("execution", "ExecutionConfig"), ("resources", Mapping[str, ResourceConfig]), ("loggers", Mapping[str, Mapping[str, object]]), ("original_config_dict", Any), ...
ResolvedRunConfig
python
rapidsai__cudf
python/cudf/cudf/pandas/_benchmarks/pdsh.py
{ "start": 701, "end": 14788 }
class ____: """PDS-H query definitions.""" name: str = "pdsh" @staticmethod def q0(run_config: RunConfig) -> pd.DataFrame: """Query 0.""" return pd.DataFrame() @staticmethod def q1(run_config: RunConfig) -> pd.DataFrame: """Query 1.""" line_item_ds = get_data( ...
PDSHQueries
python
ray-project__ray
python/ray/tune/logger/tensorboardx.py
{ "start": 6176, "end": 12347 }
class ____(LoggerCallback): """TensorBoardX Logger. Note that hparams will be written only after a trial has terminated. This logger automatically flattens nested dicts to show on TensorBoard: {"a": {"b": 1, "c": 2}} -> {"a/b": 1, "a/c": 2} """ _SAVED_FILE_TEMPLATES = ["events.out.tfevent...
TBXLoggerCallback
python
kamyu104__LeetCode-Solutions
Python/minimum-number-of-flips-to-make-the-binary-string-alternating.py
{ "start": 29, "end": 595 }
class ____(object): def minFlips(self, s): """ :type s: str :rtype: int """ result = float("inf") cnt1 = cnt2 = 0 for i in xrange(2*len(s)-1 if len(s)%2 else len(s)): if i >= len(s): cnt1 -= int(s[i%len(s)])^((i-len(s))%2)^0 ...
Solution
python
pallets__itsdangerous
tests/test_itsdangerous/test_timed.py
{ "start": 512, "end": 758 }
class ____: @pytest.fixture() def ts(self): return datetime(2011, 6, 24, 0, 9, 5, tzinfo=timezone.utc) @pytest.fixture(autouse=True) def freeze(self, ts): with freeze_time(ts) as ft: yield ft
FreezeMixin
python
jackfrued__Python-100-Days
Day31-35/code/example12.py
{ "start": 367, "end": 459 }
class ____(Employee): """部门经理""" def get_salary(self): return 15000.0
Manager
python
HypothesisWorks__hypothesis
hypothesis-python/src/hypothesis/internal/conjecture/data.py
{ "start": 17050, "end": 17184 }
class ____: status: Status = Status.OVERRUN def __repr__(self) -> str: return "Overrun" Overrun = _Overrun()
_Overrun
python
google__jax
tests/pallas/mosaic_gpu_test.py
{ "start": 5608, "end": 5740 }
class ____(PallasTest, jtu.CudaArchSpecificTest): def setUp(self): self.skip_unless_sm90a() super().setUp()
PallasSm90ATest
python
tensorflow__tensorflow
tensorflow/python/distribute/tpu_strategy_test.py
{ "start": 8961, "end": 41146 }
class ____(test.TestCase, parameterized.TestCase): def test_handle_in_cross_replica_context(self, enable_packed_var): strategy = get_tpu_strategy(enable_packed_var) with strategy.scope(): v = variables.Variable(1.0) @def_function.function def func(): self.assertEndsWith(v.handle.device, ...
TPUStrategyTest
python
tornadoweb__tornado
tornado/test/simple_httpclient_test.py
{ "start": 27875, "end": 28870 }
class ____(AsyncHTTPTestCase): def setUp(self): self.cleanup_event = Event() test = self # Dummy Resolver subclass that never finishes. class BadResolver(Resolver): @gen.coroutine def resolve(self, *args, **kwargs): yield test.cleanup_event.wa...
ResolveTimeoutTestCase
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/hooks/vision.py
{ "start": 4376, "end": 25913 }
class ____(GoogleBaseHook): """ Hook for Google Cloud Vision APIs. All the methods in the hook where project_id is used must be called with keyword arguments rather than positional. """ _client: ProductSearchClient | None product_name_determiner = NameDeterminer("Product", "product_id", Pr...
CloudVisionHook
python
numba__numba
numba/tests/test_function_type.py
{ "start": 2392, "end": 17045 }
class ____(TestCase): """Test first-class functions in the context of a Numba jit compiled function. """ def test_in__(self): """Function is passed in as an argument. """ def a(i): return i + 1 def foo(f): return 0 sig = int64(int64) ...
TestFunctionType
python
getsentry__sentry
src/sentry/identity/vsts_extension/provider.py
{ "start": 65, "end": 545 }
class ____(VSTSIdentityProvider): """ Functions exactly the same as ``VSTSIdentityProvider``. This class is necessary because of how Integration Pipelines look up sibling/dependent classes using ``key``. The IntegrationProvider for the VSTS Extension is slightly different from the VSTS version...
VstsExtensionIdentityProvider
python
pandas-dev__pandas
pandas/tests/plotting/test_boxplot_method.py
{ "start": 15372, "end": 29894 }
class ____: def test_boxplot_legacy1(self, hist_df): grouped = hist_df.groupby(by="gender") with tm.assert_produces_warning(UserWarning, check_stacklevel=False): axes = _check_plot_works(grouped.boxplot, return_type="axes") _check_axes_shape(list(axes.values), axes_num=2, layout=...
TestDataFrameGroupByPlots
python
django__django
tests/file_storage/test_base.py
{ "start": 390, "end": 2799 }
class ____(SimpleTestCase): invalid_file_names = [ os.path.join("path", "to", os.pardir, "test.file"), os.path.join(os.path.sep, "path", "to", "test.file"), ] error_msg = "Detected path traversal attempt in '%s'" def test_validate_before_get_available_name(self): s = CustomStor...
StorageValidateFileNameTests
python
pandas-dev__pandas
pandas/core/interchange/buffer.py
{ "start": 2130, "end": 3428 }
class ____(Buffer): """ Data in the buffer is guaranteed to be contiguous in memory. """ def __init__( self, buffer: pa.Buffer, *, length: int, ) -> None: """ Handle pyarrow chunked arrays. """ self._buffer = buffer self._lengt...
PandasBufferPyarrow
python
ansible__ansible
lib/ansible/plugins/action/normal.py
{ "start": 869, "end": 1854 }
class ____(ActionBase): _supports_check_mode = True _supports_async = True def run(self, tmp=None, task_vars=None): # individual modules might disagree but as the generic the action plugin, pass at this point. result = super(ActionModule, self).run(tmp, task_vars) del tmp # tmp n...
ActionModule
python
mlflow__mlflow
mlflow/llama_index/pyfunc_wrapper.py
{ "start": 2059, "end": 3379 }
class ____: def __init__( self, llama_model, # Engine or Workflow model_config: dict[str, Any] | None = None, ): self._llama_model = llama_model self.model_config = model_config or {} @property def index(self): return self._llama_model.index def get...
_LlamaIndexModelWrapperBase
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/taint_in_taint_out.py
{ "start": 2759, "end": 3139 }
class ____(GetQuery): def __init__(self, arg): GetQuery.__init__(self, arg) def test_explicit_call_to_superclass(): user = GetUser(_test_source()) _test_sink(user.arg) def evaluate_lazy(payload: Dict[str, str]): return {key: value for key, value in payload.items()} def test_simplified_eval...
GetUser
python
huggingface__transformers
tests/models/align/test_modeling_align.py
{ "start": 13275, "end": 15523 }
class ____: def __init__(self, parent, text_kwargs=None, vision_kwargs=None, is_training=True): if text_kwargs is None: text_kwargs = {} if vision_kwargs is None: vision_kwargs = {} self.parent = parent self.text_model_tester = AlignTextModelTester(parent, **...
AlignModelTester
python
ansible__ansible
lib/ansible/plugins/filter/core.py
{ "start": 23773, "end": 27283 }
class ____(object): """ Ansible core jinja2 filters """ def filters(self): return { # base 64 'b64decode': b64decode, 'b64encode': b64encode, # uuid 'to_uuid': to_uuid, # json 'to_json': to_json, 'to_nice_...
FilterModule
python
tiangolo__fastapi
docs_src/cookie_param_models/tutorial001_py310.py
{ "start": 86, "end": 303 }
class ____(BaseModel): session_id: str fatebook_tracker: str | None = None googall_tracker: str | None = None @app.get("/items/") async def read_items(cookies: Cookies = Cookie()): return cookies
Cookies
python
ApeWorX__ape
src/ape_compile/config.py
{ "start": 568, "end": 2816 }
class ____(PluginConfig): """ Configure general compiler settings. """ exclude: set[Union[str, Pattern]] = set() """ Source exclusion globs or regex patterns across all file types. To use regex, start your values with ``r"`` and they'll be turned into regex pattern objects. **NOTE*...
Config
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_axis31.py
{ "start": 315, "end": 1398 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_axis31.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(self.got_...
TestCompareXLSXFiles
python
getsentry__sentry
src/sentry/grouping/fingerprinting/rules.py
{ "start": 1067, "end": 1341 }
class ____(TypedDict): text: str # Each matcher is a list of [<name of event attribute to match>, <value to match>] matchers: list[list[str]] fingerprint: list[str] attributes: FingerprintRuleAttributes is_builtin: NotRequired[bool]
FingerprintRuleJSON
python
realpython__materials
wordcount/tests/realpython/models.py
{ "start": 3863, "end": 6514 }
class ____: tests: tuple[Test, ...] @classmethod def from_session(cls, session: Session) -> Self: tests = [] for item in session.items: if STASH_REPORT_KEY in item.stash: report = item.stash[STASH_REPORT_KEY] if "Failed: Timeout >" in report.longr...
TestRun
python
milvus-io__pymilvus
pymilvus/client/interceptor.py
{ "start": 3215, "end": 3985 }
class ____(ClientCallDetailsTuple, grpc.ClientCallDetails): pass def header_adder_interceptor(headers: List, values: List): def intercept_call( client_call_details: Any, request_iterator: Any, ): metadata = [] if client_call_details.metadata is not None: metadat...
_ClientCallDetails
python
jazzband__django-polymorphic
example/pexp/models.py
{ "start": 1517, "end": 1594 }
class ____(TestModelA): field2 = models.CharField(max_length=10)
TestModelB
python
ethereum__web3.py
tests/core/manager/test_middleware_can_be_stateful.py
{ "start": 157, "end": 878 }
class ____(Web3Middleware): state = [] def wrap_make_request(self, make_request): def middleware(method, params): self.state.append((method, params)) return {"jsonrpc": "2.0", "id": 1, "result": self.state} return middleware stateful_middleware = StatefulMiddleware ...
StatefulMiddleware
python
django-compressor__django-compressor
compressor/tests/test_storages.py
{ "start": 1239, "end": 3986 }
class ____(TestCase): def setUp(self): self.default_storage = storage.default_storage storage.default_storage = GzipStorage() storage.brotli_storage = BrotliStorage() def tearDown(self): storage.default_storage = self.default_storage def test_gzip_storage(self): sto...
StorageTestCase
python
run-llama__llama_index
llama-index-integrations/tools/llama-index-tools-box/llama_index/tools/box/search/base.py
{ "start": 502, "end": 3694 }
class ____: """ Represents options for searching Box resources. This class provides a way to specify various criteria for filtering search results when using the `BoxSearchToolSpec` class. You can define parameters like search scope, file extensions, date ranges (created/updated at), size range, ow...
BoxSearchOptions
python
kamyu104__LeetCode-Solutions
Python/alien-dictionary.py
{ "start": 94, "end": 1834 }
class ____(object): def alienOrder(self, words): """ :type words: List[str] :rtype: str """ result, in_degree, out_degree = [], {}, {} zero_in_degree_queue = collections.deque() nodes = set() for word in words: for c in word: ...
Solution
python
walkccc__LeetCode
solutions/634. Find the Derangement of An Array/634.py
{ "start": 0, "end": 282 }
class ____: def findDerangement(self, n: int) -> int: MOD = 1_000_000_007 @functools.lru_cache(None) def dp(i: int) -> int: if i == 0: return 1 if i == 1: return 0 return (i - 1) * (dp(i - 1) + dp(i - 2)) % MOD return dp(n)
Solution
python
encode__django-rest-framework
tests/test_views.py
{ "start": 3889, "end": 4321 }
class ____(TestCase): def setUp(self): self.view = OverriddenSettingsView.as_view() def test_get_exception_handler(self): request = factory.get('/', content_type='application/json') response = self.view(request) assert response.status_code == 400 assert response.data == ...
TestCustomSettings
python
SmileyChris__easy-thumbnails
easy_thumbnails/tests/test_templatetags.py
{ "start": 10687, "end": 11793 }
class ____(ThumbnailerBase): def test_get(self): src = ( '{% with t=filename|thumbnailer %}' '{{ t.small.url }}{% endwith %}' ) output = self.render_template(src) expected = self.verify_thumbnail( (20, 20), settings.THUMBNAIL_ALIASES['']['small'])...
ThumbnailerFilterTest
python
getsentry__sentry
tests/sentry/snuba/test_outcomes.py
{ "start": 733, "end": 5796 }
class ____(TestCase): def test_query_must_have_category(self) -> None: with pytest.raises(InvalidQuery): _make_query("statsPeriod=4d&interval=1d&field=sum(quantity)") def test_invalid_field(self) -> None: with pytest.raises(InvalidField): _make_query("statsPeriod=4d&inte...
OutcomesQueryDefinitionTests