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
facelessuser__pymdown-extensions
tests/test_extensions/test_escapeall.py
{ "start": 53, "end": 886 }
class ____(util.MdCase): """Test escaping cases.""" extension = [ 'pymdownx.escapeall' ] extension_configs = {} def test_html_special_char_lt(self): """Test `<`.""" self.check_markdown( r'\<pre>foo', '<p>&lt;pre&gt;foo</p>' ) def test_h...
TestEscapeAll
python
mlflow__mlflow
mlflow/models/resources.py
{ "start": 1623, "end": 2608 }
class ____(Resource, ABC): """ Base class to define all the Databricks resources to serve a model. Example usage: https://docs.databricks.com/en/generative-ai/log-agent.html#specify-resources-for-pyfunc-or-langchain-agent """ @property def target_uri(self) -> str: return "databricks" ...
DatabricksResource
python
celery__celery
t/unit/events/test_cursesmon.py
{ "start": 122, "end": 2304 }
class ____: def setup_method(self): from celery.events import cursesmon self.monitor = cursesmon.CursesMonitor(object(), app=self.app) self.win = MockWindow() self.monitor.win = self.win def test_format_row_with_default_widths(self): self.win.x, self.win.y = 91, 24 ...
test_CursesDisplay
python
tornadoweb__tornado
tornado/test/httpclient_test.py
{ "start": 36111, "end": 36804 }
class ____(unittest.TestCase): def test_copy(self): e = HTTPError(403) e2 = copy.copy(e) self.assertIsNot(e, e2) self.assertEqual(e.code, e2.code) def test_plain_error(self): e = HTTPError(403) self.assertEqual(str(e), "HTTP 403: Forbidden") self.assertEq...
HTTPErrorTestCase
python
ansible__ansible
lib/ansible/modules/unarchive.py
{ "start": 38274, "end": 38511 }
class ____(TgzArchive): def __init__(self, src, b_dest, file_args, module): super(TarXzArchive, self).__init__(src, b_dest, file_args, module) self.zipflag = '-J' # Class to handle zstd compressed tar files
TarXzArchive
python
nedbat__coveragepy
coverage/html.py
{ "start": 24794, "end": 31524 }
class ____: """Logic and data to support incremental reporting. When generating an HTML report, often only a few of the source files have changed since the last time we made the HTML report. This means previously created HTML pages can be reused without generating them again, speeding the command....
IncrementalChecker
python
openai__openai-python
src/openai/types/realtime/realtime_session_create_response.py
{ "start": 8384, "end": 8925 }
class ____(BaseModel): read_only: Optional[bool] = None """Indicates whether or not a tool modifies data or is read-only. If an MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint), it will match this filter. ...
ToolMcpToolAllowedToolsMcpToolFilter
python
run-llama__llama_index
llama-index-core/llama_index/core/output_parsers/base.py
{ "start": 113, "end": 235 }
class ____: """Structured output class.""" raw_output: str parsed_output: Optional[Any] = None
StructuredOutput
python
ansible__ansible
test/lib/ansible_test/_util/controller/sanity/validate-modules/validate_modules/main.py
{ "start": 4729, "end": 4911 }
class ____(json.JSONEncoder): def default(self, o): if isinstance(o, Exception): return str(o) return json.JSONEncoder.default(self, o)
ReporterEncoder
python
pandas-dev__pandas
asv_bench/benchmarks/rolling.py
{ "start": 5215, "end": 5794 }
class ____(Methods): params = ( ["DataFrame", "Series"], ["50s", "1h", "1d"], ["int", "float"], ["median", "mean", "max", "min", "std", "count", "skew", "kurt", "sum", "sem"], ) param_names = ["constructor", "window", "dtype", "method"] def setup(self, constructor, windo...
VariableWindowMethods
python
airbytehq__airbyte
airbyte-integrations/connectors/source-kyriba/source_kyriba/source.py
{ "start": 4878, "end": 5020 }
class ____(KyribaStream): primary_key = "uuid" use_cache = True def path(self, **kwargs) -> str: return "accounts"
Accounts
python
networkx__networkx
networkx/algorithms/approximation/tests/test_vertex_cover.py
{ "start": 185, "end": 1942 }
class ____: """Unit tests for the approximate minimum weighted vertex cover function, :func:`~networkx.algorithms.approximation.vertex_cover.min_weighted_vertex_cover`. """ def test_unweighted_directed(self): # Create a star graph in which half the nodes are directed in # and half ...
TestMWVC
python
charliermarsh__ruff
scripts/ty_benchmark/src/benchmark/tool.py
{ "start": 555, "end": 1450 }
class ____(abc.ABC): def write_config(self, project: Project, venv: Venv) -> None: """Write the tool's configuration file.""" if config := self.config(project, venv): config_name, config_text = config config_path = venv.project_path / config_name config_path.writ...
Tool
python
PyCQA__pylint
tests/functional/u/unused/unused_import_class_def_keyword.py
{ "start": 344, "end": 413 }
class ____: def __init_subclass__(cls, **kwargs): pass
Child
python
pytorch__pytorch
torch/utils/data/datapipes/map/callable.py
{ "start": 592, "end": 1933 }
class ____(MapDataPipe[_T_co]): r""" Apply the input function over each item from the source DataPipe (functional name: ``map``). The function can be any regular Python function or partial object. Lambda function is not recommended as it is not supported by pickle. Args: datapipe: Source M...
MapperMapDataPipe
python
doocs__leetcode
lcof/面试题25. 合并两个排序的链表/Solution.py
{ "start": 136, "end": 530 }
class ____: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: dummy = cur = ListNode(0) while l1 and l2: if l1.val <= l2.val: cur.next = l1 l1 = l1.next else: cur.next = l2 l2 = l2.next ...
Solution
python
scipy__scipy
scipy/signal/_ltisys.py
{ "start": 25312, "end": 27419 }
class ____(TransferFunction, dlti): r""" Discrete-time Linear Time Invariant system in transfer function form. Represents the system as the transfer function :math:`H(z)=\sum_{i=0}^N b[N-i] z^i / \sum_{j=0}^M a[M-j] z^j`, where :math:`b` are elements of the numerator `num`, :math:`a` are elements o...
TransferFunctionDiscrete
python
allegroai__clearml
clearml/utilities/version.py
{ "start": 401, "end": 550 }
class ____(object): epoch = attrib() release = attrib() dev = attrib() pre = attrib() post = attrib() local = attrib()
_Version
python
google__pytype
pytype/vm_utils.py
{ "start": 3691, "end": 3848 }
class ____(abc.ABC): """Base class for detailed name error messages.""" @abc.abstractmethod def to_error_message(self) -> str: ...
_NameErrorDetails
python
PyCQA__pylint
tests/functional/ext/docparams/return/missing_return_doc_Google.py
{ "start": 2169, "end": 2492 }
class ____: """test_ignores_return_in_abstract_method_google Example of an abstract method documenting the return type that an implementation should return. """ @abc.abstractmethod def foo_method(self): """docstring ... Returns: int: Ten """ return 1...
Foo
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/test_vision.py
{ "start": 13316, "end": 14203 }
class ____: @mock.patch("airflow.providers.google.cloud.operators.vision.CloudVisionHook") def test_minimal_green_path(self, mock_hook): op = CloudVisionAddProductToProductSetOperator( location=LOCATION_TEST, product_set_id=PRODUCTSET_ID_TEST, product_id=PRODUCT_ID_TE...
TestCloudVisionAddProductToProductSetOperator
python
RaRe-Technologies__gensim
gensim/models/ldaseqmodel.py
{ "start": 48810, "end": 62167 }
class ____(utils.SaveLoad): """Posterior values associated with each set of documents. TODO: use **Hoffman, Blei, Bach: Online Learning for Latent Dirichlet Allocation, NIPS 2010.** to update phi, gamma. End game would be to somehow replace LdaPost entirely with LdaModel. """ def __init__(self, d...
LdaPost
python
chroma-core__chroma
chromadb/server/fastapi/__init__.py
{ "start": 4766, "end": 5879 }
class ____(fastapi.APIRouter): # type: ignore # A simple subclass of fastapi's APIRouter which treats URLs with a # trailing "/" the same as URLs without. Docs will only contain URLs # without trailing "/"s. def add_api_route(self, path: str, *args: Any, **kwargs: Any) -> None: # If kwargs["inc...
ChromaAPIRouter
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/array_ops/array_ops_test.py
{ "start": 67349, "end": 67794 }
class ____(test_util.TensorFlowTestCase): def testInvertPermutation(self): for dtype in [dtypes.int32, dtypes.int64, dtypes.float32, dtypes.float64]: with self.subTest(dtype=dtype, use_gpu=True): x = constant_op.constant([0, 1, 2, 3], dtype=dtype) y = gen_array_ops.snapshot(x) self....
SnapshotOpTest
python
pypa__warehouse
tests/unit/search/test_services.py
{ "start": 113, "end": 413 }
class ____: def test_null_service(self): service = NullSearchService.create_service(pretend.stub(), pretend.stub()) config = pretend.stub() assert service.reindex(config, ["foo", "bar"]) is None assert service.unindex(config, ["foo", "bar"]) is None
TestSearchService
python
geekcomputers__Python
venv/Lib/site-packages/pip/_vendor/pygments/formatters/rtf.py
{ "start": 485, "end": 11957 }
class ____(Formatter): """ Format tokens as RTF markup. This formatter automatically outputs full RTF documents with color information and other useful stuff. Perfect for Copy and Paste into Microsoft(R) Word(R) documents. Please note that ``encoding`` and ``outencoding`` options are ignored. T...
RtfFormatter
python
pypa__pip
src/pip/_vendor/urllib3/packages/backports/weakref_finalize.py
{ "start": 257, "end": 5343 }
class ____(object): """Class for finalization of weakrefable objects finalize(obj, func, *args, **kwargs) returns a callable finalizer object which will be called when obj is garbage collected. The first time the finalizer is called it evaluates func(*arg, **kwargs) and returns the result. After thi...
weakref_finalize
python
astropy__astropy
astropy/io/ascii/core.py
{ "start": 7475, "end": 7572 }
class ____(NoType): """ Indicates that a column consists of numerical data. """
NumType
python
great-expectations__great_expectations
contrib/great_expectations_geospatial_expectations/great_expectations_geospatial_expectations/expectations/expect_column_values_geometry_to_be_near_shape.py
{ "start": 465, "end": 3462 }
class ____(ColumnMapMetricProvider): # This is the id string that will be used to reference your metric. condition_metric_name = "column_values.geometry.near_shape" condition_value_keys = ( "shape", "shape_format", "column_shape_format", "distance_tol", ) # This meth...
ColumnValuesGeometryNearShape
python
airbytehq__airbyte
airbyte-integrations/connectors/destination-weaviate/destination_weaviate/config.py
{ "start": 509, "end": 1081 }
class ____(BaseModel): mode: Literal["username_password"] = Field("username_password", const=True) username: str = Field(..., title="Username", description="Username for the Weaviate cluster", order=1) password: str = Field(..., title="Password", description="Password for the Weaviate cluster", airbyte_secr...
UsernamePasswordAuth
python
run-llama__llama_index
llama-index-packs/llama-index-packs-self-rag/llama_index/packs/self_rag/base.py
{ "start": 9493, "end": 10222 }
class ____(BaseLlamaPack): """Simple short form Self-RAG pack.""" def __init__( self, model_path: str, retriever: BaseRetriever, verbose: bool = False, **kwargs: Any, ) -> None: """Init params.""" self.query_engine = SelfRAGQueryEngine(model_path, ret...
SelfRAGPack
python
marshmallow-code__marshmallow
src/marshmallow/exceptions.py
{ "start": 2101, "end": 2273 }
class ____(MarshmallowError, TypeError): """Raised when an argument is passed to a field class that cannot be resolved to a Field instance."""
_FieldInstanceResolutionError
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/class_interval.py
{ "start": 5806, "end": 5872 }
class ____(A14): def m2(self): return _test_source()
C14
python
html5lib__html5lib-python
html5lib/tests/test_stream.py
{ "start": 2009, "end": 2101 }
class ____(HTMLUnicodeInputStream): _defaultChunkSize = 2
HTMLUnicodeInputStreamShortChunk
python
getsentry__sentry
src/sentry/testutils/cases.py
{ "start": 112850, "end": 115282 }
class ____(APITestCase): def _create_monitor(self, **kwargs): if "owner_user_id" not in kwargs: kwargs["owner_user_id"] = self.user.id return Monitor.objects.create( organization_id=self.organization.id, project_id=self.project.id, config={ ...
MonitorTestCase
python
getsentry__sentry
src/sentry/statistical_detectors/redis.py
{ "start": 430, "end": 2371 }
class ____(DetectorStore): def __init__( self, regression_type: RegressionType, client: RedisCluster | StrictRedis | None = None, ttl=STATE_TTL, ): self.regression_type = regression_type self.ttl = ttl self._client: RedisCluster | StrictRedis | None = None...
RedisDetectorStore
python
tensorflow__tensorflow
tensorflow/python/keras/initializers/initializers_v1.py
{ "start": 2146, "end": 2392 }
class ____(init_ops.VarianceScaling): def __init__(self, seed=None): super(LecunUniform, self).__init__( scale=1., mode='fan_in', distribution='uniform', seed=seed) def get_config(self): return {'seed': self.seed}
LecunUniform
python
plotly__plotly.py
plotly/graph_objs/scatter3d/line/colorbar/_tickformatstop.py
{ "start": 233, "end": 8549 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "scatter3d.line.colorbar" _path_str = "scatter3d.line.colorbar.tickformatstop" _valid_props = {"dtickrange", "enabled", "name", "templateitemname", "value"} @property def dtickrange(self): """ range [*min*, *max*], where "m...
Tickformatstop
python
bokeh__bokeh
src/bokeh/models/widgets/inputs.py
{ "start": 3258, "end": 3827 }
class ____(ModelEvent): """ Notifies the input widget that its input/value needs to be cleared. This is specially useful for widgets whose value can't be simply cleared by assigning to ``value`` (or equivalent) property. """ event_name = "clear_input" def __init__(self, model: InputWidget...
ClearInput
python
catalyst-team__catalyst
examples/self_supervised/src/common.py
{ "start": 2104, "end": 7101 }
class ____(torch.nn.Module): """Contrastive model with projective head. Args: model: projective head for the train time encoder: model for the future uses """ def __init__(self, model, encoder): super(ContrastiveModel, self).__init__() self.model = model self.en...
ContrastiveModel
python
crytic__slither
slither/vyper_parsing/declarations/event.py
{ "start": 335, "end": 1154 }
class ____: # pylint: disable=too-few-public-methods """ Event class """ def __init__(self, event: Event, event_def: EventDef) -> None: self._event = event self._event.name = event_def.name self._elemsNotParsed = event_def.body def analyze(self, contract) -> None: ...
EventVyper
python
geekcomputers__Python
nitkarshchourasia/to_sort/django_projects/ToDo_webapp/todo/apps.py
{ "start": 36, "end": 140 }
class ____(AppConfig): default_auto_field = "django.db.models.BigAutoField" name = "todo"
TodoConfig
python
PrefectHQ__prefect
src/prefect/client/schemas/filters.py
{ "start": 33693, "end": 34035 }
class ____(PrefectBaseModel): """Filter by `ArtifactCollection.type`.""" any_: Optional[List[str]] = Field( default=None, description="A list of artifact types to include" ) not_any_: Optional[List[str]] = Field( default=None, description="A list of artifact types to exclude" )
ArtifactCollectionFilterType
python
walkccc__LeetCode
solutions/1408. String Matching in an Array/1408.py
{ "start": 0, "end": 233 }
class ____: def stringMatching(self, words: list[str]) -> list[str]: ans = [] for a in words: for b in words: if len(a) < len(b) and b.find(a) != -1: ans.append(a) break return ans
Solution
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/string_conversion.py
{ "start": 1472, "end": 2537 }
class ____: g: str = "" def __str__(self): return self.g def join_source_and_attribute_source(i: int): if i > 0: a: str = request.GET["tainted"] else: a: C = C() eval(f"{a}") # noqa: P204 def multiple_targets_for_single_expression_2(a: Union[int, B, C]): eval(f"{a}"...
C
python
pypa__warehouse
warehouse/admin/views/banners.py
{ "start": 4068, "end": 5297 }
class ____(wtforms.Form): name = wtforms.fields.StringField( validators=[ wtforms.validators.Length(max=100), wtforms.validators.InputRequired(), ], ) text = wtforms.fields.StringField( validators=[ wtforms.validators.Length(max=280), w...
BannerForm
python
kamyu104__LeetCode-Solutions
Python/path-in-zigzag-labelled-binary-tree.py
{ "start": 35, "end": 419 }
class ____(object): def pathInZigZagTree(self, label): """ :type label: int :rtype: List[int] """ count = 2**label.bit_length() result = [] while label >= 1: result.append(label) label = ((count//2) + ((count-1)-label)) // 2 ...
Solution
python
apache__airflow
providers/common/compat/src/airflow/providers/common/compat/lineage/entities.py
{ "start": 2173, "end": 2668 }
class ____: """Table entity.""" database: str = attr.ib() cluster: str = attr.ib() name: str = attr.ib() tags: list[Tag] = [] description: str | None = None columns: list[Column] = [] owners: list[User] = [] extra: dict[str, Any] = {} type_hint: str | None = None template_f...
Table
python
python-excel__xlwt
tests/test_simple.py
{ "start": 265, "end": 2070 }
class ____(unittest.TestCase): def create_simple_xls(self, **kw): font0 = xlwt.Font() font0.name = 'Times New Roman' font0.colour_index = 2 font0.bold = True style0 = xlwt.XFStyle() style0.font = font0 style1 = xlwt.XFStyle() style1.num_format_str =...
TestSimple
python
pytorch__pytorch
test/torch_np/numpy_tests/lib/test_index_tricks.py
{ "start": 20782, "end": 21557 }
class ____(TestCase): @xfail # (reason="ndindex not implemented") def test_ndindex(self): x = list(ndindex(1, 2, 3)) expected = [ix for ix, e in ndenumerate(np.zeros((1, 2, 3)))] assert_array_equal(x, expected) x = list(ndindex((1, 2, 3))) assert_array_equal(x, expected...
TestNdIndex
python
doocs__leetcode
solution/1600-1699/1672.Richest Customer Wealth/Solution.py
{ "start": 0, "end": 124 }
class ____: def maximumWealth(self, accounts: List[List[int]]) -> int: return max(sum(v) for v in accounts)
Solution
python
doocs__leetcode
solution/1900-1999/1993.Operations on Tree/Solution.py
{ "start": 0, "end": 1366 }
class ____: def __init__(self, parent: List[int]): n = len(parent) self.locked = [-1] * n self.parent = parent self.children = [[] for _ in range(n)] for son, fa in enumerate(parent[1:], 1): self.children[fa].append(son) def lock(self, num: int, user: int) ->...
LockingTree
python
pytorch__pytorch
test/test_stateless.py
{ "start": 36086, "end": 37195 }
class ____(TestCase): def test_private_stateless_warns(self): script = """ import torch import warnings with warnings.catch_warnings(record=True) as w: from torch.nn.utils import _stateless exit(len(w)) """ try: subprocess.check_output( [sys.executable, '-W', 'alway...
TestStatelessDeprecation
python
great-expectations__great_expectations
great_expectations/types/__init__.py
{ "start": 466, "end": 8315 }
class ____: """A convenience class for migrating away from untyped dictionaries to stronger typed objects. Can be instantiated with arguments: my_A = MyClassA( foo="a string", bar=1, ) Can be instantiated from a dictionary: my_A = MyClassA( ...
DictDot
python
ansible__ansible
test/integration/targets/collections_plugin_namespace/collection_root/ansible_collections/my_ns/my_col/plugins/test/test_test.py
{ "start": 145, "end": 253 }
class ____: def tests(self): return { 'test_name_ok': test_name_ok, }
TestModule
python
openai__openai-python
src/openai/resources/beta/assistants.py
{ "start": 46357, "end": 46958 }
class ____: def __init__(self, assistants: Assistants) -> None: self._assistants = assistants self.create = to_streamed_response_wrapper( assistants.create, ) self.retrieve = to_streamed_response_wrapper( assistants.retrieve, ) self.update = t...
AssistantsWithStreamingResponse
python
ipython__ipython
IPython/terminal/pt_inputhooks/wx.py
{ "start": 1576, "end": 7126 }
class ____: def Run(self, time, input_is_ready): self.input_is_ready = input_is_ready self.evtloop = wx.EventLoop() self.timer = EventLoopTimer(self.check_stdin) self.timer.Start(time) self.evtloop.Run() def check_stdin(self): if self.input_is_ready(): ...
EventLoopRunner
python
django__django
tests/contenttypes_tests/models.py
{ "start": 1807, "end": 2088 }
class ____(models.Model): text = models.CharField(max_length=200) content_type = models.ForeignKey(ContentType, models.CASCADE) object_id = models.PositiveIntegerField() question = GenericForeignKey() class Meta: order_with_respect_to = "question"
Answer
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/protocol45.py
{ "start": 235, "end": 306 }
class ____(Protocol): def __call__(self, item: S, /) -> S: ...
Proto1
python
jazzband__prettytable
src/prettytable/prettytable.py
{ "start": 2097, "end": 2180 }
class ____(IntEnum): FRAME = 0 ALL = 1 NONE = 2 HEADER = 3
HRuleStyle
python
allegroai__clearml
clearml/backend_api/services/v2_23/frames.py
{ "start": 446662, "end": 463444 }
class ____(Request): """ Get unique sorce id that exist in the frames in the given dataview :param dataview: Dataview specification :type dataview: Dataview :param max_count: Number of source IDs to return. default=100, Optional :type max_count: int """ _service = "frames" _action ...
GetSourceIdsForDataviewRequest
python
pytorch__pytorch
torch/fx/experimental/symbolic_shapes.py
{ "start": 77084, "end": 77483 }
class ____: """ Data structure specifying how we should create symbols in ``create_symbolic_sizes_strides_storage_offset``; e.g., should they be static or dynamic. This is an abstract base class because we are probably going to add another version of this that says "use exactly these SymInts, d...
SymbolicContext
python
psf__black
tests/data/cases/remove_newline_after_code_block_open.py
{ "start": 1981, "end": 3218 }
class ____: def bar(self): print("The newline above me should be kept!") for i in range(5): print(f"{i}) The line above me should be kept!") for i in range(5): print(f"{i}) The lines above me should be kept!") for i in range(5): for j in range(7): print(f"{i}) The lines above ...
Foo
python
dagster-io__dagster
python_modules/dagster/dagster/_core/errors.py
{ "start": 17310, "end": 17849 }
class ____(DagsterError): """An exception has occurred in one or more of the child processes dagster manages. This error forwards the message and stack trace for all of the collected errors. """ def __init__(self, *args, **kwargs): from dagster._utils.error import SerializableErrorInfo ...
DagsterSubprocessError
python
wandb__wandb
wandb/sdk/mailbox/mailbox_handle.py
{ "start": 335, "end": 437 }
class ____(Exception): """The handle has no response and has been abandoned."""
HandleAbandonedError
python
crytic__slither
slither/visitors/expression/find_calls.py
{ "start": 1526, "end": 4644 }
class ____(ExpressionVisitor): def __init__(self, expression: Expression) -> None: self._result: Optional[List[Expression]] = None super().__init__(expression) def result(self) -> List[Expression]: if self._result is None: self._result = list(set(get(self.expression))) ...
FindCalls
python
google__pytype
pytype/tests/test_utils.py
{ "start": 2075, "end": 2632 }
class ____: """Util class for generating fake Opcode for testing.""" def __init__(self, filename, line, endline, col, endcol, methodname): self.code = FakeCode(filename, methodname) self.line = line self.endline = endline self.col = col self.endcol = endcol self.name = "FAKE_OPCODE" def ...
FakeOpcode
python
tornadoweb__tornado
tornado/netutil.py
{ "start": 18566, "end": 19956 }
class ____(ExecutorResolver): """Multithreaded non-blocking `Resolver` implementation. The thread pool size can be configured with:: Resolver.configure('tornado.netutil.ThreadedResolver', num_threads=10) .. versionchanged:: 3.1 All ``ThreadedResolvers`` share a s...
ThreadedResolver
python
HypothesisWorks__hypothesis
hypothesis-python/src/hypothesis/internal/conjecture/shrinking/bytes.py
{ "start": 562, "end": 880 }
class ____(Collection): def __init__(self, initial, predicate, **kwargs): super().__init__( # implicit conversion from bytes to list of integers here list(initial), lambda val: predicate(bytes(val)), ElementShrinker=Integer, **kwargs, )
Bytes
python
readthedocs__readthedocs.org
readthedocs/projects/admin.py
{ "start": 1174, "end": 1503 }
class ____: """Make admin inlines read-only.""" show_change_link = True def has_add_permission(self, request, obj=None): return False def has_change_permission(self, request, obj=None): return False def has_delete_permission(self, request, obj=None): return False
ReadOnlyInlineMixin
python
pytorch__pytorch
torch/ao/quantization/experimental/fake_quantize.py
{ "start": 337, "end": 1821 }
class ____(FakeQuantizeBase): alpha: Tensor gamma: Tensor quantization_levels: Tensor level_indices: Tensor def __init__(self, observer: Callable = APoTObserver, **observer_kwargs: Any): super().__init__() self.activation_post_process = observer(**observer_kwargs) self.dtype...
APoTFakeQuantize
python
huggingface__transformers
tests/utils/test_hf_argparser.py
{ "start": 1631, "end": 1734 }
class ____: foo: bool = False baz: bool = True opt: bool | None = None
WithDefaultBoolExample
python
paramiko__paramiko
paramiko/pkey.py
{ "start": 33863, "end": 36719 }
class ____: """ OpenSSH plain public key or OpenSSH signed public key (certificate). Tries to be as dumb as possible and barely cares about specific per-key-type data. .. note:: Most of the time you'll want to call `from_file`, `from_string` or `from_message` for useful instantiat...
PublicBlob
python
neetcode-gh__leetcode
python/0039-combination-sum.py
{ "start": 0, "end": 508 }
class ____: def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]: res = [] def dfs(i, cur, total): if total == target: res.append(cur.copy()) return if i >= len(candidates) or total > target: return ...
Solution
python
explosion__spaCy
spacy/lang/lij/__init__.py
{ "start": 182, "end": 330 }
class ____(BaseDefaults): tokenizer_exceptions = TOKENIZER_EXCEPTIONS infixes = TOKENIZER_INFIXES stop_words = STOP_WORDS
LigurianDefaults
python
falconry__falcon
falcon/routing/compiled.py
{ "start": 43741, "end": 43916 }
class ____(_CxChild): def src(self, indentation: int) -> str: return '{0}groups = match.groupdict()'.format(_TAB_STR * indentation)
_CxPrefetchGroupsFromPatternMatch
python
django__django
tests/auth_tests/test_management.py
{ "start": 49789, "end": 53213 }
class ____(TestCase): def setUp(self): self._original_permissions = Permission._meta.permissions[:] self._original_default_permissions = Permission._meta.default_permissions self.app_config = apps.get_app_config("auth") def tearDown(self): Permission._meta.permissions = self._or...
CreatePermissionsTests
python
qdrant__qdrant-client
tools/async_client_generator/transformers/remote/import_from_transformer.py
{ "start": 41, "end": 1011 }
class ____(ast.NodeTransformer): def __init__(self, import_replace_map: Optional[dict[str, str]] = None): self.import_replace_map = import_replace_map if import_replace_map is not None else {} def visit_ImportFrom(self, node: ast.ImportFrom) -> ast.AST: # update module name for old_valu...
RemoteImportFromTransformer
python
Textualize__textual
docs/examples/how-to/containers03.py
{ "start": 272, "end": 657 }
class ____(App): """Simple app to play with containers.""" CSS = """ .with-border { border: heavy green; } """ def compose(self) -> ComposeResult: with Horizontal(classes="with-border"): # (1)! yield Box() yield Box() yield Box() if __name...
ContainerApp
python
numpy__numpy
numpy/distutils/tests/test_fcompiler_gnu.py
{ "start": 1643, "end": 2136 }
class ____: def test_gfortran_version(self): fc = numpy.distutils.fcompiler.new_fcompiler(compiler='gnu95') for vs, version in gfortran_version_strings: v = fc.version_match(vs) assert_(v == version, (vs, v)) def test_not_gfortran(self): fc = numpy.distutils.fcom...
TestGFortranVersions
python
pyparsing__pyparsing
pyparsing/core.py
{ "start": 196536, "end": 197447 }
class ____(ParseElementEnhance): r"""Matches if an expression matches at the beginning of a line within the parse string Example: .. testcode:: test = '''\ BBB this line BBB and this line BBB but not this one A BBB and definitely not this one ''' ...
AtLineStart
python
scipy__scipy
scipy/stats/tests/test_distributions.py
{ "start": 308815, "end": 313693 }
class ____: def test_pdf_bounds(self): # test bounds y = stats.truncweibull_min.pdf([0.1, 2.0], 2.0, 0.11, 1.99) assert_equal(y, [0.0, 0.0]) def test_logpdf(self): y = stats.truncweibull_min.logpdf(2.0, 1.0, 2.0, np.inf) assert_equal(y, 0.0) # hand calculation ...
TestTruncWeibull
python
tensorflow__tensorflow
tensorflow/python/framework/function.py
{ "start": 1770, "end": 8986 }
class ____(object): """Obsolete. Slated for deletion. Please use tf.function instead. Known feature gaps while migrating to tf.function (could be outdated): - tf.function doesn’t support Send/Recv capability since it doesn’t share rendezvous with the main graph but always creates a new one. - tf.function d...
Defun
python
pyqtgraph__pyqtgraph
pyqtgraph/SignalProxy.py
{ "start": 178, "end": 3832 }
class ____(QtCore.QObject): """Object which collects rapid-fire signals and condenses them into a single signal or a rate-limited stream of signals. Used, for example, to prevent a SpinBox from generating multiple signals when the mouse wheel is rolled over it. Emits sigDelayed after input signals ...
SignalProxy
python
getsentry__sentry
src/sentry/migrations/0917_convert_org_saved_searches_to_views.py
{ "start": 535, "end": 1888 }
class ____(CheckedMigration): # This flag is used to mark that a migration shouldn't be automatically run in production. # This should only be used for operations where it's safe to run the migration after your # code has deployed. So this should not be used for most operations that alter the schema # o...
Migration
python
realpython__materials
python-microservices-with-grpc/recommendations/recommendations.py
{ "start": 1129, "end": 2439 }
class ____(recommendations_pb2_grpc.RecommendationsServicer): def Recommend(self, request, context): if request.category not in books_by_category: raise NotFound("Category not found") books_for_category = books_by_category[request.category] num_results = min(request.max_results,...
RecommendationService
python
django__django
django/test/client.py
{ "start": 34403, "end": 45283 }
class ____(ClientMixin, RequestFactory): """ A class that can act as a client for testing purposes. It allows the user to compose GET and POST requests, and obtain the response that the server gave to those requests. The server Response objects are annotated with the details of the contexts and...
Client
python
scrapy__scrapy
tests/test_downloader_handler_twisted_http11.py
{ "start": 1593, "end": 1672 }
class ____(HTTP11DownloadHandlerMixin, TestHttpProxyBase): pass
TestHttp11Proxy
python
palantir__python-language-server
pyls/plugins/pyflakes_lint.py
{ "start": 807, "end": 2620 }
class ____(object): def __init__(self, lines): self.lines = lines self.diagnostics = [] def unexpectedError(self, _filename, msg): # pragma: no cover err_range = { 'start': {'line': 0, 'character': 0}, 'end': {'line': 0, 'character': 0}, } self....
PyflakesDiagnosticReport
python
coleifer__peewee
tests/schema.py
{ "start": 1793, "end": 27964 }
class ____(ModelDatabaseTestCase): database = get_in_memory_db() requires = [Article, CacheData, Category, Note, Person, Relationship, TMUnique, TMSequence, TMIndexes, TMConstraints, TMNamedConstraints, User] def test_database_required(self): class MissingDB(Model): ...
TestModelDDL
python
joblib__joblib
joblib/externals/loky/process_executor.py
{ "start": 9455, "end": 9633 }
class ____: def __init__(self, work_id, exception=None, result=None): self.work_id = work_id self.exception = exception self.result = result
_ResultItem
python
numpy__numpy
numpy/linalg/tests/test_linalg.py
{ "start": 13670, "end": 14308 }
class ____(LinalgTestCase): @pytest.mark.slow def test_generalized_herm_cases(self): self.check_cases(require={'generalized', 'hermitian'}, exclude={'size-0'}) @pytest.mark.slow def test_generalized_empty_herm_cases(self): self.check_cases(require={'generalized...
HermitianGeneralizedTestCase
python
sphinx-doc__sphinx
sphinx/errors.py
{ "start": 2256, "end": 2351 }
class ____(SphinxError): """Document error.""" category = 'Document error'
DocumentError
python
scipy__scipy
scipy/stats/tests/test_morestats.py
{ "start": 123132, "end": 130785 }
class ____: # In gh-5747, the R package `circular` was used to calculate reference # values for the circular variance, e.g.: # library(circular) # options(digits=16) # x = c(0, 2*pi/3, 5*pi/3) # var.circular(x) @pytest.mark.parametrize("test_func,expected", [(sta...
TestCircFuncs
python
getsentry__sentry
src/sentry/incidents/models/alert_rule.py
{ "start": 9181, "end": 10474 }
class ____(BaseManager["AlertRuleTrigger"]): CACHE_KEY = "alert_rule_triggers:alert_rule:%s" @classmethod def _build_trigger_cache_key(cls, alert_rule_id: int) -> str: return cls.CACHE_KEY % alert_rule_id def get_for_alert_rule(self, alert_rule: AlertRule) -> list[AlertRuleTrigger]: ""...
AlertRuleTriggerManager
python
google__jax
jax/_src/dtypes.py
{ "start": 1584, "end": 1948 }
class ____(np.generic): """Scalar class for extended dtypes. This is an abstract class that should never be instantiated, but rather exists for the sake of `jnp.issubdtype`. Examples: >>> from jax import random >>> from jax import dtypes >>> key = random.key(0) >>> jnp.issubdtype(key.dtype, dt...
extended
python
huggingface__transformers
src/transformers/models/wavlm/modeling_wavlm.py
{ "start": 15473, "end": 18405 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.config = config self.pos_conv_embed = WavLMPositionalConvEmbedding(config) self.layer_norm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps) self.dropout = nn.Dropout(config.hidden_dropout)...
WavLMEncoder
python
huggingface__transformers
src/transformers/models/patchtst/modeling_patchtst.py
{ "start": 38188, "end": 40185 }
class ____(ModelOutput): r""" sequences (`torch.FloatTensor` of shape `(batch_size, num_samples, prediction_length, num_targets)`): Sampled values from the chosen distribution. """ sequences: Optional[torch.FloatTensor] = None # Copied from transformers.models.time_series_transformer.modeling...
SamplePatchTSTOutput
python
django-extensions__django-extensions
django_extensions/management/commands/admin_generator.py
{ "start": 9569, "end": 12164 }
class ____(LabelCommand): help = """Generate a `admin.py` file for the given app (models)""" # args = "[app_name]" can_import_settings = True def add_arguments(self, parser): parser.add_argument("app_name") parser.add_argument("model_name", nargs="*") parser.add_argument( ...
Command
python
ansible__ansible
test/integration/targets/collections_plugin_namespace/collection_root/ansible_collections/my_ns/my_col/plugins/filter/test_filter.py
{ "start": 79, "end": 224 }
class ____(object): def filters(self): filters = { 'filter_name': filter_name, } return filters
FilterModule