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
spyder-ide__spyder
spyder/widgets/browser.py
{ "start": 1460, "end": 1601 }
class ____: Move = 'move_section' Select = 'select_section' Zoom = 'zoom_section' Extras = 'extras_section'
WebViewMenuSections
python
pytorch__pytorch
test/distributed/test_debug.py
{ "start": 537, "end": 1743 }
class ____(TestCase): def test_basics(self) -> None: store = dist.TCPStore("localhost", 0, 1, is_master=True, wait_for_workers=False) os.environ["MASTER_ADDR"] = "localhost" os.environ["MASTER_PORT"] = str(store.port) os.environ["RANK"] = "0" os.environ["WORLD_SIZE"] = "1" ...
TestDebug
python
sqlalchemy__sqlalchemy
test/orm/test_dynamic.py
{ "start": 51129, "end": 60397 }
class ____( _WriteOnlyFixture, _UOWTests, _fixtures.FixtureTest, testing.AssertsExecutionResults, ): run_inserts = None __sparse_driver_backend__ = True @testing.requires.insert_executemany_returning @testing.combinations(True, False, argnames="flush_user_first") def test_bulk_inser...
WriteOnlyBulkTest
python
pytorch__pytorch
test/dynamo/cpython/3_13/test_iter.py
{ "start": 699, "end": 2326 }
class ____(importlib.abc.MetaPathFinder): def find_spec(self, fullname, path, target=None): # Check if the import is the problematic one if fullname in redirect_imports: try: # Attempt to import the standalone module name = fullname.removeprefix("test.") ...
RedirectImportFinder
python
Pylons__pyramid
tests/test_config/test_settings.py
{ "start": 2918, "end": 31997 }
class ____(unittest.TestCase): def _getTargetClass(self): from pyramid.config.settings import Settings return Settings def _makeOne(self, d=None, environ=None): if environ is None: environ = {} klass = self._getTargetClass() return klass(d, _environ_=environ...
TestSettings
python
spack__spack
lib/spack/spack/error.py
{ "start": 5567, "end": 5826 }
class ____(SpackError): """Pickle-able exception to control stopped builds.""" def __reduce__(self): return _make_stop_phase, (self.message, self.long_message) def _make_stop_phase(msg, long_msg): return StopPhase(msg, long_msg)
StopPhase
python
getsentry__sentry
src/sentry/api/endpoints/organization_events_spans_performance.py
{ "start": 4516, "end": 5961 }
class ____(serializers.Serializer[Never]): field = serializers.ListField(child=serializers.CharField(), required=False, allow_null=True) query = serializers.CharField(required=False, allow_null=True) spanOp = serializers.ListField( child=serializers.CharField(), required=False, allow_null=True, max_...
SpansPerformanceSerializer
python
tensorflow__tensorflow
tensorflow/python/framework/function_test.py
{ "start": 48126, "end": 52925 }
class ____(test.TestCase): BATCH_SIZE = 16 LSTM_DIMS = 32 NUM_UNROLL = 20 def _Weights(self): dims = self.LSTM_DIMS return random_ops.random_uniform([2 * dims, 4 * dims], -1, 1, seed=123456) def _Input(self): return random_ops.random_uniform( [self.NUM_UNROLL, self.BATCH_SIZE, self.LSTM_...
UnrollLSTMTest
python
ray-project__ray
python/ray/serve/_private/long_poll.py
{ "start": 1725, "end": 2172 }
class ____: object_snapshot: Any # The identifier for the object's version. There is not sequential relation # among different object's snapshot_ids. snapshot_id: int # Type signature for the update state callbacks. E.g. # async def update_state(updated_object: Any): # do_something(updated_object)...
UpdatedObject
python
pallets__flask
src/flask/wrappers.py
{ "start": 430, "end": 8110 }
class ____(RequestBase): """The request object used by default in Flask. Remembers the matched endpoint and view arguments. It is what ends up as :class:`~flask.request`. If you want to replace the request object used you can subclass this and set :attr:`~flask.Flask.request_class` to your subcla...
Request
python
dagster-io__dagster
python_modules/libraries/dagster-azure/dagster_azure_tests/pipes_tests/mock_blob_storage.py
{ "start": 2909, "end": 2994 }
class ____(BytesIO): def readall(self): return self.read()
BytesIOWithReadAll
python
celery__celery
celery/worker/components.py
{ "start": 6229, "end": 6618 }
class ____(bootsteps.Step): """Bootstep that sets up between-restart state database file.""" def __init__(self, w, **kwargs): self.enabled = w.statedb w._persistence = None super().__init__(w, **kwargs) def create(self, w): w._persistence = w.state.Persistent(w.state, w.sta...
StateDB
python
kubernetes-client__python
kubernetes/e2e_test/test_watch.py
{ "start": 1129, "end": 3220 }
class ____(unittest.TestCase): @classmethod def setUpClass(cls): cls.config = base.get_e2e_configuration() def test_watch_configmaps(self): client = api_client.ApiClient(configuration=self.config) api = core_v1_api.CoreV1Api(client) # create a configmap name_a = 'c...
TestClient
python
zarr-developers__zarr-python
src/zarr/_cli/cli.py
{ "start": 517, "end": 576 }
class ____(str, Enum): v2 = "v2" v3 = "v3"
ZarrFormat
python
numba__numba
numba/parfors/parfor.py
{ "start": 3765, "end": 17419 }
class ____(object): def __new__(cls, *args): return range(*args) def min_parallel_impl(return_type, arg): # XXX: use prange for 1D arrays since pndindex returns a 1-tuple instead of # integer. This causes type and fusion issues. if arg.ndim == 0: def min_1(in_arr): return ...
internal_prange
python
Pylons__pyramid
tests/test_config/test_views.py
{ "start": 105693, "end": 107842 }
class ____(unittest.TestCase): def _makeOne(self, view1, view2): from pyramid.config.views import runtime_exc_view return runtime_exc_view(view1, view2) def test_call(self): def view1(context, request): return 'OK' def view2(context, request): # pragma: no cover ...
Test_runtime_exc_view
python
matplotlib__matplotlib
lib/matplotlib/hatch.py
{ "start": 3507, "end": 5035 }
class ____(HatchPatternBase): filled = False def __init__(self, hatch, density): if self.num_rows == 0: self.num_shapes = 0 self.num_vertices = 0 else: self.num_shapes = ((self.num_rows // 2 + 1) * (self.num_rows + 1) + (self.nu...
Shapes
python
huggingface__transformers
src/transformers/models/evolla/modeling_evolla.py
{ "start": 23235, "end": 25331 }
class ____(nn.Module): def __init__(self, dim, dim_head=64, heads=8): super().__init__() self.scale = dim_head**-0.5 self.heads = heads inner_dim = dim_head * heads self.norm_media = nn.LayerNorm(dim) self.norm_latents = nn.LayerNorm(dim) self.to_q = nn.Line...
EvollaSequenceCompressorAttention
python
django__django
django/core/mail/backends/base.py
{ "start": 34, "end": 1683 }
class ____: """ Base class for email backend implementations. Subclasses must at least overwrite send_messages(). open() and close() can be called indirectly by using a backend object as a context manager: with backend as connection: # do something with connection pas...
BaseEmailBackend
python
bokeh__bokeh
src/bokeh/models/annotations/dimensional.py
{ "start": 5093, "end": 5705 }
class ____(CustomDimensional): """ Imperial units of length measurement. """ # explicit __init__ to support Init signatures def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) basis = Override(default={ "in": ( 1/12, "in", "inch" ), "ft": ( 1, "ft"...
ImperialLength
python
nryoung__algorithms
tests/test_data_structures.py
{ "start": 22727, "end": 24282 }
class ____(unittest.TestCase): def setUp(self): super(TestLCPSuffixArrays, self).setUp() self.case_1 = "aaaaaa" self.s_array_1 = [5, 4, 3, 2, 1, 0] self.rank_1 = [5, 4, 3, 2, 1, 0] self.lcp_1 = [1, 2, 3, 4, 5, 0] self.case_2 = "abcabcdd" self.s_array_2 = [0, ...
TestLCPSuffixArrays
python
dateutil__dateutil
src/dateutil/tz/tz.py
{ "start": 38395, "end": 38807 }
class ____(object): def __init__(self, tzoffsetfrom, tzoffsetto, isdst, tzname=None, rrule=None): self.tzoffsetfrom = datetime.timedelta(seconds=tzoffsetfrom) self.tzoffsetto = datetime.timedelta(seconds=tzoffsetto) self.tzoffsetdiff = self.tzoffsetto - self.tzoffsetfrom ...
_tzicalvtzcomp
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/array_ops/identity_n_op_py_test.py
{ "start": 881, "end": 2514 }
class ____(test.TestCase): def testInt32String_6(self): value0, value1 = self.evaluate( array_ops.identity_n([[1, 2, 3, 4, 5, 6], [b"a", b"b", b"C", b"d", b"E", b"f", b"g"]])) self.assertAllEqual(np.array([1, 2, 3, 4, 5, 6]), value0) self.assertAllEqual( np....
IdentityNOpTest
python
readthedocs__readthedocs.org
readthedocs/builds/forms.py
{ "start": 875, "end": 4885 }
class ____(forms.ModelForm): project = forms.CharField(widget=forms.HiddenInput(), required=False) class Meta: model = Version states_fields = ["active", "hidden"] privacy_fields = ["privacy_level"] fields = ( "project", "slug", *states_fields...
VersionForm
python
scipy__scipy
scipy/stats/_continuous_distns.py
{ "start": 237650, "end": 241702 }
class ____(rv_continuous): r"""A Nakagami continuous random variable. %(before_notes)s Notes ----- The probability density function for `nakagami` is: .. math:: f(x, \nu) = \frac{2 \nu^\nu}{\Gamma(\nu)} x^{2\nu-1} \exp(-\nu x^2) for :math:`x >= 0`, :math:`\nu > 0`. The distribut...
nakagami_gen
python
huggingface__transformers
src/transformers/modeling_outputs.py
{ "start": 77588, "end": 79608 }
class ____(ModelOutput): """ Base class for outputs of semantic segmentation models. Args: loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Classification (or regression if config.num_labels==1) loss. logits (`torch.FloatTensor` of shap...
SemanticSegmenterOutput
python
matplotlib__matplotlib
lib/matplotlib/tests/test_axes.py
{ "start": 277247, "end": 340516 }
class ____(mtransforms.Transform): input_dims = 1 output_dims = 1 def __init__(self, dx): self.dx = dx def transform(self, values): return values + self.dx def inverted(self): return _Translation(-self.dx) @image_comparison(['secondary_xy.png'], style='mpl20', ...
_Translation
python
getsentry__sentry
src/sentry/auth/providers/google/views.py
{ "start": 637, "end": 3130 }
class ____(AuthView): def __init__( self, domains: list[str] | None, version: str | None, *args: Any, **kwargs: Any ) -> None: self.domains = domains self.version = version super().__init__(*args, **kwargs) def dispatch(self, request: HttpRequest, pipeline: AuthHelper) -> Ht...
FetchUser
python
docker__docker-py
docker/transport/sshconn.py
{ "start": 2515, "end": 3181 }
class ____(urllib3.connection.HTTPConnection): def __init__(self, ssh_transport=None, timeout=60, host=None): super().__init__( 'localhost', timeout=timeout ) self.ssh_transport = ssh_transport self.timeout = timeout self.ssh_host = host def connect(self): ...
SSHConnection
python
google__pytype
pytype/rewrite/abstract/classes_test.py
{ "start": 178, "end": 2031 }
class ____(test_utils.ContextfulTestBase): def test_get_attribute(self): x = self.ctx.consts[5] cls = classes.SimpleClass(self.ctx, 'X', {'x': x}) self.assertEqual(cls.get_attribute('x'), x) def test_get_nonexistent_attribute(self): cls = classes.SimpleClass(self.ctx, 'X', {}) self.assertIsNon...
ClassTest
python
huggingface__transformers
tests/repo_utils/test_check_copies.py
{ "start": 2654, "end": 2944 }
class ____(BertCopyPreTrainedModel): def __init__(self, config): super().__init__() self.bertcopy = BertCopyEncoder(config) @add_docstring(BERTCOPY_DOCSTRING) def forward(self, x): return self.bertcopy(x) """ MOCK_DUMMY_BERT_CODE_MATCH = """
BertCopyModel
python
plotly__plotly.py
plotly/graph_objs/histogram/marker/colorbar/_title.py
{ "start": 233, "end": 4035 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "histogram.marker.colorbar" _path_str = "histogram.marker.colorbar.title" _valid_props = {"font", "side", "text"} @property def font(self): """ Sets this color bar's title font. The 'font' property is an instance of Fo...
Title
python
pytorch__pytorch
test/dynamo/test_modules.py
{ "start": 1796, "end": 2197 }
class ____(torch.nn.Module): def __init__(self, activation): super().__init__() self.linear1 = torch.nn.Linear(10, 10) self.activation = activation def forward(self, x): x = self.linear1(x) if self.activation is not None: x = self.activation(x) if sel...
FnMemberCmp
python
pydata__xarray
xarray/backends/scipy_.py
{ "start": 3474, "end": 5736 }
class ____(netcdf_file_base): # scipy.io.netcdf_file.close() incorrectly closes file objects that # were passed in as constructor arguments: # https://github.com/scipy/scipy/issues/13905 # Instead of closing such files, only call flush(), which is # equivalent as long as the netcdf_file object is n...
flush_only_netcdf_file
python
pypa__pipenv
pipenv/utils/dependencies.py
{ "start": 39601, "end": 48536 }
class ____: """Handles processing and environment variable expansion in VCS URLs.""" ENV_VAR_PATTERN = re.compile(r"\${([^}]+)}|\$([a-zA-Z_][a-zA-Z0-9_]*)") @classmethod def expand_env_vars(cls, value: str) -> str: """ Expands environment variables in a string, with detailed error hand...
VCSURLProcessor
python
run-llama__llama_index
llama-index-core/llama_index/core/callbacks/schema.py
{ "start": 337, "end": 1417 }
class ____(str, Enum): """ Callback manager event types. Attributes: CHUNKING: Logs for the before and after of text splitting. NODE_PARSING: Logs for the documents and the nodes that they are parsed into. EMBEDDING: Logs for the number of texts embedded. LLM: Logs for the t...
CBEventType
python
Textualize__textual
src/textual/css/scalar_animation.py
{ "start": 339, "end": 3159 }
class ____(Animation): def __init__( self, widget: Widget, styles: StylesBase, start_time: float, attribute: str, value: ScalarOffset | Scalar, duration: float | None, speed: float | None, easing: EasingFunction, on_complete: CallbackTy...
ScalarAnimation
python
django__django
tests/timezones/tests.py
{ "start": 30239, "end": 39363 }
class ____(SimpleTestCase): # Backend-specific notes: # - JSON supports only milliseconds, microseconds will be truncated. # - PyYAML dumps the UTC offset correctly for timezone-aware datetimes. # When PyYAML < 5.3 loads this representation, it subtracts the offset # and returns a naive datetime...
SerializationTests
python
getsentry__sentry
src/sentry/rules/history/endpoints/project_rule_group_history.py
{ "start": 1252, "end": 2066 }
class ____(Serializer): def get_attrs( self, item_list: Sequence[RuleGroupHistory], user: Any, **kwargs: Any ) -> MutableMapping[Any, Any]: serialized_groups = { g["id"]: g for g in serialize([item.group for item in item_list], user) } return { history: {"...
RuleGroupHistorySerializer
python
anthropics__anthropic-sdk-python
src/anthropic/types/beta/beta_server_tool_use_block.py
{ "start": 518, "end": 941 }
class ____(BaseModel): id: str caller: Caller """Tool invocation directly from the model.""" input: Dict[str, object] name: Literal[ "web_search", "web_fetch", "code_execution", "bash_code_execution", "text_editor_code_execution", "tool_search_tool_...
BetaServerToolUseBlock
python
pypa__pip
tests/unit/test_vcs.py
{ "start": 27699, "end": 34967 }
class ____(TestCase): def setUp(self) -> None: patcher = mock.patch("pip._internal.vcs.versioncontrol.call_subprocess") self.addCleanup(patcher.stop) self.call_subprocess_mock = patcher.start() # Test Data. self.url = "git+http://username:password@git.example.com/" s...
TestGitArgs
python
pytorch__pytorch
torch/testing/_internal/common_quantization.py
{ "start": 87230, "end": 87687 }
class ____(torch.nn.Module): r"""A Module that uses a dynamic QAT by default.""" def __init__(self, qconfig=None): super().__init__() self.qconfig = qconfig or default_dynamic_qat_qconfig self.fc1 = torch.nn.Linear(5, 1).to(dtype=torch.float) self.fc2 = torch.nn.Linear(1, 10).to...
ManualLinearDynamicQATModel
python
scipy__scipy
tools/gh_lists.py
{ "start": 5480, "end": 9018 }
class ____: def __init__(self, auth=False): self.headers = {'User-Agent': 'gh_lists.py', 'Accept': 'application/vnd.github.v3+json'} if auth: self.authenticate() req = self.urlopen('https://api.github.com/rate_limit') try: if req.getc...
GithubGet
python
walkccc__LeetCode
solutions/490. The Maze/490.py
{ "start": 0, "end": 747 }
class ____: def hasPath( self, maze: list[list[int]], start: list[int], destination: list[int], ) -> bool: DIRS = ((0, 1), (1, 0), (0, -1), (-1, 0)) m = len(maze) n = len(maze[0]) q = collections.deque([(start[0], start[1])]) seen = {(start[0], start[1])} def isValid...
Solution
python
apache__airflow
providers/apache/spark/src/airflow/providers/apache/spark/operators/spark_sql.py
{ "start": 1113, "end": 4583 }
class ____(BaseOperator): """ Execute Spark SQL query. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:SparkSqlOperator` :param sql: The SQL query to execute. (templated) :param conf: arbitrary Spark configuration proper...
SparkSqlOperator
python
spyder-ide__spyder
spyder/utils/syntaxhighlighters.py
{ "start": 47391, "end": 48711 }
class ____(BaseSH): """Fortran Syntax Highlighter""" # Syntax highlighting rules: PROG = re.compile(make_fortran_patterns(), re.S|re.I) IDPROG = re.compile(r"\s+(\w+)", re.S) # Syntax highlighting states (from one text block to another): NORMAL = 0 def __init__(self, parent, font=None, color...
FortranSH
python
huggingface__transformers
src/transformers/models/falcon_h1/modeling_falcon_h1.py
{ "start": 57348, "end": 68631 }
class ____(FalconH1PreTrainedModel): def __init__(self, config: FalconH1Config): super().__init__(config) self.padding_idx = config.pad_token_id self.vocab_size = config.vocab_size self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx) deco...
FalconH1Model
python
scikit-learn__scikit-learn
sklearn/exceptions.py
{ "start": 1167, "end": 1895 }
class ____(ValueError, AttributeError): """Exception class to raise if estimator is used before fitting. This class inherits from both ValueError and AttributeError to help with exception handling and backward compatibility. Examples -------- >>> from sklearn.svm import LinearSVC >>> from ...
NotFittedError
python
ansible__ansible
lib/ansible/errors/__init__.py
{ "start": 15110, "end": 16353 }
class ____(AnsibleRuntimeError): """An error due to attempted storage of an unsupported variable type.""" @classmethod def from_value(cls, *, obj: t.Any) -> t.Self: # avoid an incorrect error message when `obj` is a type type_name = type(obj).__name__ if isinstance(obj, type) else native_ty...
AnsibleVariableTypeError
python
apache__airflow
providers/singularity/tests/unit/singularity/operators/test_singularity.py
{ "start": 1037, "end": 6294 }
class ____: @mock.patch("airflow.providers.singularity.operators.singularity.Client") def test_execute(self, client_mock): instance = mock.Mock( autospec=Instance, **{ "start.return_value": 0, "stop.return_value": 0, }, ) ...
TestSingularityOperator
python
kamyu104__LeetCode-Solutions
Python/sum-root-to-leaf-numbers.py
{ "start": 181, "end": 642 }
class ____(object): # @param root, a tree node # @return an integer def sumNumbers(self, root): return self.sumNumbersRecu(root, 0) def sumNumbersRecu(self, root, num): if root is None: return 0 if root.left is None and root.right is None: return num * 1...
Solution
python
ray-project__ray
doc/source/serve/doc_code/grpc_proxy/user_defined_protos_pb2_grpc.py
{ "start": 234, "end": 1478 }
class ____(object): """Missing associated documentation comment in .proto file.""" def __init__(self, channel): """Constructor. Args: channel: A grpc.Channel. """ self.__call__ = channel.unary_unary( "/userdefinedprotos.UserDefinedService/__call__", ...
UserDefinedServiceStub
python
huggingface__transformers
src/transformers/models/canine/tokenization_canine.py
{ "start": 1924, "end": 5868 }
class ____(PreTrainedTokenizer): r""" Construct a CANINE tokenizer (i.e. a character splitter). It turns text into a sequence of characters, and then converts each character into its Unicode code point. [`CanineTokenizer`] inherits from [`PreTrainedTokenizer`]. Refer to superclass [`PreTrainedToke...
CanineTokenizer
python
django__django
django/contrib/postgres/search.py
{ "start": 2150, "end": 2272 }
class ____(CheckPostgresInstalledMixin, Field): def db_type(self, connection): return "tsquery"
SearchQueryField
python
apache__airflow
providers/fab/src/airflow/providers/fab/auth_manager/models/__init__.py
{ "start": 3680, "end": 4106 }
class ____(Model): """Represents permission actions such as `can_read`.""" __tablename__ = "ab_permission" id: Mapped[int] = mapped_column( Integer, Sequence("ab_permission_id_seq", start=1, increment=1, minvalue=1, cycle=False), primary_key=True, ) name: Mapped[str] = mapp...
Action
python
pytorch__pytorch
torch/_inductor/codegen/cpp.py
{ "start": 21763, "end": 23144 }
class ____: def __init__(self, func_name: str = ""): self.func_name = func_name self.current_node: Optional[torch.fx.Node] = None self.opt_ctx: Optional[OptimizationContext] = None def __enter__(self): assert V.interpreter assert V.interpreter.current_node self....
RecordOptimizationContext
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typedDict18.py
{ "start": 213, "end": 421 }
class ____(TypedDict, Generic[_T1, _T2]): a: dict[_T1, _T2] b: _T1 v1_1: TD1[str, int] = {"a": {"x": 3}, "b": "y"} # This should generate an error. v1_2: TD1[str, str] = {"a": {"x": 3}, "b": "y"}
TD1
python
PyCQA__flake8
src/flake8/style_guide.py
{ "start": 675, "end": 850 }
class ____(enum.Enum): """Enum representing an explicitly or implicitly ignored code.""" Explicitly = "explicitly ignored" Implicitly = "implicitly ignored"
Ignored
python
openai__openai-python
src/openai/types/responses/custom_tool.py
{ "start": 283, "end": 736 }
class ____(BaseModel): name: str """The name of the custom tool, used to identify it in tool calls.""" type: Literal["custom"] """The type of the custom tool. Always `custom`.""" description: Optional[str] = None """Optional description of the custom tool, used to provide more context.""" ...
CustomTool
python
pytorch__pytorch
test/onnx/test_models_onnxruntime.py
{ "start": 5536, "end": 14299 }
class ____(onnx_test_common._TestONNXRuntime): @skipIfUnsupportedMinOpsetVersion(11) @skipScriptTest() # Faster RCNN model is not scriptable def test_faster_rcnn(self): model = faster_rcnn.fasterrcnn_resnet50_fpn( pretrained=False, pretrained_backbone=True, min_size=200, max_size=300 ...
TestModelsONNXRuntime
python
crytic__slither
slither/vyper_parsing/ast/types.py
{ "start": 1676, "end": 1913 }
class ____(Definition): name: str args: Optional[Arguments] returns: Optional[List[ASTNode]] body: List[ASTNode] decorators: Optional[List[ASTNode]] pos: Optional[any] # not sure what this is @dataclass
FunctionDef
python
pandas-dev__pandas
pandas/tests/indexes/interval/test_indexing.py
{ "start": 388, "end": 1747 }
class ____: def test_getitem(self, closed): idx = IntervalIndex.from_arrays((0, 1, np.nan), (1, 2, np.nan), closed=closed) assert idx[0] == Interval(0.0, 1.0, closed=closed) assert idx[1] == Interval(1.0, 2.0, closed=closed) assert isna(idx[2]) result = idx[0:1] expe...
TestGetItem
python
mlflow__mlflow
mlflow/utils/async_logging/async_artifacts_logging_queue.py
{ "start": 510, "end": 9984 }
class ____: """ This is a queue based run data processor that queue incoming data and process it using a single worker thread. This class is used to process artifacts saving in async fashion. Args: logging_func: A callable function that takes in three arguments: - filename: The name...
AsyncArtifactsLoggingQueue
python
tensorflow__tensorflow
tensorflow/python/ops/gradients_test.py
{ "start": 20171, "end": 26707 }
class ____(test_util.TensorFlowTestCase): @classmethod def XSquarePlusB(cls, x, b): return x * x + b @classmethod def XSquarePlusBGradient(cls, x, b, g): # Perturb gradients (multiply by 2), so we can test that this was called. g *= 2.0 return g * 2.0 * x, g @classmethod def _PythonGradie...
FunctionGradientsTest
python
bokeh__bokeh
tests/unit/bokeh/test_objects.py
{ "start": 4230, "end": 4853 }
class ____: def test_references_large(self) -> None: root, objects = large_plot(10) assert set(root.references()) == objects def test_references_deep(self) -> None: root = DeepModel() objects = {root} parent = root # in a previous implementation, about 400 would ...
TestCollectModels
python
tensorflow__tensorflow
tensorflow/python/distribute/tpu_strategy_model_parallelism_test.py
{ "start": 3405, "end": 20931 }
class ____( strategy_test_lib.DistributionTestBase, strategy_test_lib.TwoDeviceDistributionTestBase, parameterized.TestCase): @parameterized.named_parameters([("packed", True), ("unpacked", False)]) def test_spmd_variable_structure(self, enable_packing): strategy, num_replicas = get_tpu_strategy(en...
TPUStrategyModelParallelismTest
python
cython__cython
Cython/Debugger/libcython.py
{ "start": 35800, "end": 35932 }
class ____(CyUp): """ Go down a Cython, Python or relevant C frame. """ name = 'cy down' _command = 'down'
CyDown
python
openai__openai-python
src/openai/types/beta/realtime/realtime_response_usage.py
{ "start": 232, "end": 566 }
class ____(BaseModel): audio_tokens: Optional[int] = None """The number of audio tokens used in the Response.""" cached_tokens: Optional[int] = None """The number of cached tokens used in the Response.""" text_tokens: Optional[int] = None """The number of text tokens used in the Response.""" ...
InputTokenDetails
python
bokeh__bokeh
src/bokeh/models/widgets/inputs.py
{ "start": 10252, "end": 10602 }
class ____(ToggleInput): """ A checkbox-like widget. """ # explicit __init__ to support Init signatures def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) on_icon = Nullable(IconLike, default=None, help=""" """) off_icon = Nullable(IconLike, defau...
Switch
python
django__django
tests/migrations/test_migrations_squashed_complex_multi_apps/app1/2_squashed_3.py
{ "start": 35, "end": 282 }
class ____(migrations.Migration): replaces = [ ("app1", "2_auto"), ("app1", "3_auto"), ] dependencies = [("app1", "1_auto"), ("app2", "2_auto")] operations = [migrations.RunPython(migrations.RunPython.noop)]
Migration
python
pytorch__pytorch
torch/_dynamo/variables/functions.py
{ "start": 29954, "end": 31134 }
class ____(BaseUserFunctionVariable): def __init__( self, fn: types.BuiltinMethodType, is_constant: bool = False, **kwargs: Any ) -> None: super().__init__(**kwargs) assert isinstance(fn, types.BuiltinMethodType) self.fn = fn @staticmethod def is_supported_builtin_method...
BuiltinMethodVariable
python
Lightning-AI__lightning
tests/tests_fabric/utilities/test_data.py
{ "start": 4319, "end": 4438 }
class ____(DataLoader): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs)
NoneDataLoader
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/refurb/FURB180.py
{ "start": 783, "end": 854 }
class ____(B0, abc.ABC, B1): @abstractmethod def foo(self): pass
A7
python
PyCQA__pylint
doc/data/messages/i/init-is-generator/bad.py
{ "start": 0, "end": 140 }
class ____: def __init__(self, worms): # [init-is-generator] yield from worms apple = Fruit(["Fahad", "Anisha", "Tabatha"])
Fruit
python
langchain-ai__langchain
libs/langchain/langchain_classic/chains/moderation.py
{ "start": 394, "end": 4372 }
class ____(Chain): """Pass input through a moderation endpoint. To use, you should have the `openai` python package installed, and the environment variable `OPENAI_API_KEY` set with your API key. Any parameters that are valid to be passed to the openai.create call can be passed in, even if not exp...
OpenAIModerationChain
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/hooks/bigquery.py
{ "start": 62828, "end": 63907 }
class ____(LoggingMixin): """ BigQuery cursor. The BigQuery base cursor contains helper methods to execute queries against BigQuery. The methods can be used directly by operators, in cases where a PEP 249 cursor isn't needed. """ def __init__( self, service: Any, pr...
BigQueryBaseCursor
python
ray-project__ray
python/ray/_private/thirdparty/dacite/exceptions.py
{ "start": 1073, "end": 1317 }
class ____(DaciteFieldError): def __init__(self, field_path: Optional[str] = None): super().__init__(field_path=field_path) def __str__(self) -> str: return f'missing value for field "{self.field_path}"'
MissingValueError
python
apache__airflow
providers/asana/tests/unit/asana/hooks/test_asana.py
{ "start": 1016, "end": 10962 }
class ____: """ Tests for AsanaHook Asana client retrieval """ def test_asana_client_retrieved(self): """ Test that we successfully retrieve an Asana client given a Connection with complete information. :return: None """ with patch.object( AsanaHook, ...
TestAsanaHook
python
scrapy__scrapy
tests/test_utils_signal.py
{ "start": 3100, "end": 3363 }
class ____(TestSendCatchLogAsync): def ok_handler(self, arg, handlers_called): handlers_called.add(self.ok_handler) assert arg == "test" d = defer.Deferred() call_later(0, d.callback, "OK") return d
TestSendCatchLogAsync2
python
cython__cython
Cython/Compiler/ExprNodes.py
{ "start": 458332, "end": 459035 }
class ____(DictNode): def __init__(self, pos, env): local_vars = sorted([ entry.name for entry in env.entries.values() if entry.name]) items = [LocalsDictItemNode( pos, key=IdentifierStringNode(pos, value=var), value=NameNode(pos, name=var, allow_null=True)) ...
FuncLocalsExprNode
python
python-pillow__Pillow
src/PIL/McIdasImagePlugin.py
{ "start": 617, "end": 1877 }
class ____(ImageFile.ImageFile): format = "MCIDAS" format_description = "McIdas area file" def _open(self) -> None: # parse area file directory assert self.fp is not None s = self.fp.read(256) if not _accept(s) or len(s) != 256: msg = "not an McIdas area file" ...
McIdasImageFile
python
spack__spack
lib/spack/spack/vendor/ruamel/yaml/tokens.py
{ "start": 8090, "end": 8168 }
class ____(Token): __slots__ = () id = '<document end>'
DocumentEndToken
python
pennersr__django-allauth
allauth/socialaccount/providers/auth0/views.py
{ "start": 228, "end": 1062 }
class ____(OAuth2Adapter): provider_id = "auth0" settings = app_settings.PROVIDERS.get(provider_id, {}) provider_base_url = settings.get("AUTH0_URL") access_token_url = "{0}/oauth/token".format(provider_base_url) authorize_url = "{0}/authorize".format(provider_base_url) profile_url = "{0}/user...
Auth0OAuth2Adapter
python
getsentry__sentry
src/sentry/replays/usecases/ingest/event_parser.py
{ "start": 1321, "end": 1660 }
class ____: canvas_sizes: list[int] click_events: list[ClickEvent] multiclick_events: list[MultiClickEvent] hydration_errors: list[HydrationError] mutation_events: list[MutationEvent] options_events: list[dict[str, Any]] request_response_sizes: list[tuple[Any, Any]] tap_events: list[TapE...
ParsedEventMeta
python
numpy__numpy
numpy/polynomial/tests/test_legendre.py
{ "start": 784, "end": 1082 }
class ____: def test_legdomain(self): assert_equal(leg.legdomain, [-1, 1]) def test_legzero(self): assert_equal(leg.legzero, [0]) def test_legone(self): assert_equal(leg.legone, [1]) def test_legx(self): assert_equal(leg.legx, [0, 1])
TestConstants
python
huggingface__transformers
tests/models/cohere/test_modeling_cohere.py
{ "start": 5841, "end": 6852 }
class ____(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin, unittest.TestCase): all_model_classes = (CohereModel, CohereForCausalLM) if is_torch_available() else () pipeline_model_mapping = ( { "feature-extraction": CohereModel, "text-generation": CohereForCausalLM, ...
CohereModelTest
python
pyca__cryptography
tests/x509/test_x509_ext.py
{ "start": 152394, "end": 160552 }
class ____: def test_invalid_distribution_points(self): with pytest.raises(TypeError): x509.FreshestCRL( ["notadistributionpoint"] # type:ignore[list-item] ) def test_iter_len(self): fcrl = x509.FreshestCRL( [ x509.Distributio...
TestFreshestCRL
python
readthedocs__readthedocs.org
readthedocs/config/models.py
{ "start": 1099, "end": 1726 }
class ____(ConfigBaseModel): """Object used for `build.jobs` key.""" pre_checkout: list[str] = [] post_checkout: list[str] = [] pre_system_dependencies: list[str] = [] post_system_dependencies: list[str] = [] pre_create_environment: list[str] = [] create_environment: list[str] | None = None...
BuildJobs
python
tiangolo__fastapi
tests/test_response_model_as_return_annotation.py
{ "start": 356, "end": 397 }
class ____(BaseUser): surname: str
User
python
modin-project__modin
modin/conftest.py
{ "start": 5323, "end": 6581 }
class ____(BaseQueryCompiler): def __init__(self, modin_frame): self._modin_frame = modin_frame storage_format = property( lambda self: "Base", doc=BaseQueryCompiler.storage_format.__doc__ ) engine = property(lambda self: "Python", doc=BaseQueryCompiler.engine.__doc__) def finalize...
TestQC
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/decorator_location.py
{ "start": 2520, "end": 3960 }
class ____: def return_source(self) -> int: return _test_source() def identity(f: Callable) -> Callable: # The return type is wrongly written as `Callable`. @wraps(f) def inner(*args, **kwargs) -> Callable: return f(*args, **kwargs) return inner @identity def return_foo() -> Foo...
Foo
python
django__django
tests/delete_regress/models.py
{ "start": 1889, "end": 2051 }
class ____(models.Model): food = models.ForeignKey(Food, models.CASCADE, to_field="name") meal = models.CharField(max_length=20) # Models for #15776
Eaten
python
matplotlib__matplotlib
lib/matplotlib/patheffects.py
{ "start": 10050, "end": 12178 }
class ____(AbstractPathEffect): """A simple shadow via a line.""" def __init__(self, offset=(2, -2), shadow_color='k', alpha=0.3, rho=0.3, **kwargs): """ Parameters ---------- offset : (float, float), default: (2, -2) The (x, y) offset to apply to th...
SimpleLineShadow
python
MongoEngine__mongoengine
mongoengine/fields.py
{ "start": 79042, "end": 79589 }
class ____(GeoJsonBaseField): """A GeoJSON field storing a polygon of longitude and latitude coordinates. The data is represented as: .. code-block:: js {'type' : 'Polygon' , 'coordinates' : [[[x1, y1], [x1, y1] ... [xn, yn]], [[x1, y1], [x1, y1] ... [xn, yn]]} ...
PolygonField
python
django-debug-toolbar__django-debug-toolbar
tests/test_csp_rendering.py
{ "start": 1725, "end": 8101 }
class ____(IntegrationTestCase): """Testing if `csp-nonce` renders.""" def setUp(self): super().setUp() self.parser = HTMLParser() def _fail_if_missing(self, root, path, namespaces, nonce): """ Search elements, fail if a `nonce` attribute is missing on them. """ ...
CspRenderingTestCase
python
kubernetes-client__python
kubernetes/client/api/resource_v1beta1_api.py
{ "start": 543, "end": 450723 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ def __init__(self, api_client=None): if api_client is None: api_client = ApiClient() self.api_client = api_client ...
ResourceV1beta1Api
python
getsentry__sentry
tests/sentry/workflow_engine/processors/test_data_condition.py
{ "start": 215, "end": 2142 }
class ____(TestCase): def setUp(self) -> None: self.slow_config = { "interval": "1d", "value": 7, } def test_simple(self) -> None: conditions = [ self.create_data_condition(type=Condition.EQUAL), # fast self.create_data_condition(type=Con...
SplitConditionsBySpeedTest
python
numba__numba
numba/tests/test_analysis.py
{ "start": 19917, "end": 30814 }
class ____(TestBranchPruneBase, SerialMixin): # Really important thing to remember... the branch on predicates end up as # POP_JUMP_IF_<bool> and the targets are backwards compared to normal, i.e. # the true condition is far jump and the false the near i.e. `if x` would # end up in Numba IR as e.g. `bra...
TestBranchPrunePredicates
python
django__django
tests/gis_tests/gdal_tests/test_srs.py
{ "start": 242, "end": 8393 }
class ____: def __init__(self, wkt, **kwargs): self.wkt = wkt for key, value in kwargs.items(): setattr(self, key, value) # Some Spatial Reference examples srlist = ( TestSRS( 'GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,' 'AUTHORITY["EP...
TestSRS
python
langchain-ai__langchain
libs/langchain/langchain_classic/output_parsers/pandas_dataframe.py
{ "start": 348, "end": 7019 }
class ____(BaseOutputParser[dict[str, Any]]): """Parse an output using Pandas DataFrame format.""" """The Pandas DataFrame to parse.""" dataframe: Any @field_validator("dataframe") @classmethod def _validate_dataframe(cls, val: Any) -> Any: import pandas as pd if issubclass(ty...
PandasDataFrameOutputParser