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
Lightning-AI__lightning
src/lightning/pytorch/loops/progress.py
{ "start": 6159, "end": 7134 }
class ____(_Progress): """Tracks batch progress. These counters are local to a trainer rank. By default, they are not globally synced across all ranks. Args: total: Tracks the total batch progress. current: Tracks the current batch progress. is_last_batch: Whether the batch is the ...
_BatchProgress
python
getsentry__sentry
tests/sentry/api/test_base.py
{ "start": 26415, "end": 27479 }
class ____(APITestCase): """Tests for ensuring request.access is properly set before being accessed.""" def setUp(self) -> None: super().setUp() self.org = self.create_organization() self.user = self.create_user() self.create_member(user=self.user, organization=self.org) ...
RequestAccessTest
python
vyperlang__vyper
tests/unit/ast/test_annotate_and_optimize_ast.py
{ "start": 87, "end": 1729 }
class ____(python_ast.NodeVisitor): def assert_about_node(self, node): raise AssertionError() def generic_visit(self, node): self.assert_about_node(node) super().generic_visit(node) TEST_CONTRACT_SOURCE_CODE = """ struct S: a: bool b: int128 interface ERC20Contract: def ...
AssertionVisitor
python
automl__auto-sklearn
test/test_pipeline/components/classification/test_base.py
{ "start": 369, "end": 12655 }
class ____(unittest.TestCase): # Magic command to not run tests on base class __test__ = False res = None module = None sk_module = None # Hyperparameter which is increased by iterative_fit step_hyperparameter = None def test_default_iris(self): if self.__class__ == BaseClass...
BaseClassificationComponentTest
python
mwaskom__seaborn
tests/_marks/test_text.py
{ "start": 231, "end": 4344 }
class ____: def get_texts(self, ax): if ax.texts: return list(ax.texts) else: # Compatibility with matplotlib < 3.5 (I think) return [a for a in ax.artists if isinstance(a, MPLText)] def test_simple(self): x = y = [1, 2, 3] s = list("abc") ...
TestText
python
getsentry__sentry
tests/sentry/core/endpoints/test_organization_member_index.py
{ "start": 34581, "end": 40977 }
class ____(OrganizationMemberListTestBase, HybridCloudTestMixin): method = "post" def test_forbid_qq(self) -> None: data = {"email": "1234@qq.com", "role": "member", "teams": [self.team.slug]} response = self.get_error_response(self.organization.slug, **data, status_code=400) assert res...
OrganizationMemberListPostTest
python
dagster-io__dagster
python_modules/dagster/dagster/_core/storage/local_compute_log_manager.py
{ "start": 13061, "end": 13792 }
class ____(PatternMatchingEventHandler): def __init__(self, manager, log_key, update_paths, complete_paths): self.manager = manager self.log_key = log_key self.update_paths = update_paths self.complete_paths = complete_paths patterns = update_paths + complete_paths su...
LocalComputeLogFilesystemEventHandler
python
getsentry__sentry
src/sentry/snuba/metrics/extraction.py
{ "start": 11675, "end": 12668 }
class ____(TypedDict): """ Specification for a metric to extract from some data. The metric type is given as part of the MRI (metric reference identifier) which must follow the form: `<type>:<namespace>/<name>@<unit>`. How the metric's value is obtained depends on the metric type: - Counter m...
MetricSpec
python
django__django
django/contrib/admin/exceptions.py
{ "start": 57, "end": 194 }
class ____(SuspiciousOperation): """Invalid filter was passed to admin view via URL querystring""" pass
DisallowedModelAdminLookup
python
sympy__sympy
sympy/integrals/manualintegrate.py
{ "start": 11177, "end": 11398 }
class ____(Rule): """Leave the integral as is.""" def eval(self) -> Expr: return Integral(self.integrand, self.variable) def contains_dont_know(self) -> bool: return True @dataclass
DontKnowRule
python
getsentry__sentry
tests/sentry/incidents/endpoints/validators/test_validators.py
{ "start": 11145, "end": 24618 }
class ____(TestMetricAlertsDetectorValidator): @mock.patch("sentry.incidents.metric_issue_detector.schedule_update_project_config") @mock.patch("sentry.workflow_engine.endpoints.validators.base.detector.create_audit_entry") def test_create_with_valid_data( self, mock_audit: mock.MagicMock, mock_sch...
TestMetricAlertsCreateDetectorValidator
python
kamyu104__LeetCode-Solutions
Python/power-of-three.py
{ "start": 356, "end": 483 }
class ____(object): def isPowerOfThree(self, n): return n > 0 and (math.log10(n)/math.log10(3)).is_integer()
Solution2
python
sqlalchemy__sqlalchemy
test/orm/test_eager_relations.py
{ "start": 204195, "end": 207168 }
class ____(fixtures.DeclarativeMappedTest): """test for [ticket:3431]""" @classmethod def setup_classes(cls): Base = cls.DeclarativeBasic class A(Base): __tablename__ = "a" id = Column( Integer, primary_key=True, test_needs_autoincrement=True ...
EntityViaMultiplePathTestOne
python
jina-ai__jina
tests/unit/orchestrate/flow/flow-construct/test_flow.py
{ "start": 8060, "end": 12481 }
class ____(BaseExecutor): """Class used in Flow YAML""" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # pod/pod-specific assert 'key1' not in os.environ assert 'key2' not in os.environ # inherit from parent process assert os.environ['key_...
EnvChecker2
python
crytic__slither
slither/tools/upgradeability/checks/constant.py
{ "start": 195, "end": 3058 }
class ____(AbstractCheck): ARGUMENT = "were-constant" IMPACT = CheckClassification.HIGH HELP = "Variables that should be constant" WIKI = "https://github.com/crytic/slither/wiki/Upgradeability-Checks#variables-that-should-be-constant" WIKI_TITLE = "Variables that should be constant" # region w...
WereConstant
python
sqlalchemy__sqlalchemy
test/orm/test_eager_relations.py
{ "start": 210619, "end": 217238 }
class ____(fixtures.DeclarativeMappedTest): """test for [ticket:3963]""" @classmethod def setup_classes(cls): Base = cls.DeclarativeBasic class A(Base): __tablename__ = "a" id = Column( Integer, primary_key=True, test_needs_autoincrement=True ...
LazyLoadOptSpecificityTest
python
ansible__ansible
lib/ansible/module_utils/_internal/_json/_profiles/_module_modern_m2c.py
{ "start": 212, "end": 1025 }
class ____(_profiles._JSONSerializationProfile["Encoder", "Decoder"]): encode_strings_as_utf8 = True @classmethod def post_init(cls) -> None: cls.allowed_ansible_serializable_types = _profiles._common_module_types | _profiles._common_module_response_types cls.serialize_map = { ...
_Profile
python
neetcode-gh__leetcode
python/0016-3sum-closest.py
{ "start": 0, "end": 857 }
class ____: def threeSumClosest(self, nums: List[int], target: int) -> int: nums.sort() best = float('inf') for i in range(len(nums) - 2): val = nums[i] left = i + 1 right = len(nums) - 1 while left < right: ...
Solution
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/operators/bedrock.py
{ "start": 25471, "end": 28148 }
class ____(AwsBaseOperator[BedrockAgentHook]): """ Set up an Amazon Bedrock Data Source to be added to an Amazon Bedrock Knowledge Base. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:BedrockCreateDataSourceOperator` :param...
BedrockCreateDataSourceOperator
python
Textualize__textual
examples/mother.py
{ "start": 743, "end": 809 }
class ____(Markdown): """Markdown for the user prompt."""
Prompt
python
wandb__wandb
wandb/apis/public/registries/_utils.py
{ "start": 272, "end": 4244 }
class ____(str, Enum): # names are what users see/pass into Python methods # values are what's expected by backend API organization = "PRIVATE" restricted = "RESTRICTED" @classmethod def _missing_(cls, value: object) -> Any: # Allow instantiation from enum names too (e.g. "organization"...
Visibility
python
has2k1__plotnine
plotnine/themes/themeable.py
{ "start": 42103, "end": 42655 }
class ____(themeable): """ Frame around colorbar Parameters ---------- theme_element : element_rect """ _omit = ["facecolor"] def apply_figure(self, figure: Figure, targets: ThemeTargets): super().apply_figure(figure, targets) if rect := targets.legend_frame: ...
legend_frame
python
django-mptt__django-mptt
tests/myapp/tests.py
{ "start": 33263, "end": 34727 }
class ____(TestCase): def test_insert_unordered_stuff(self): root = OrderedInsertion.objects.create(name="") # "b" gets inserted first, b = OrderedInsertion.objects.create(name="b", parent=root) # "a" gets inserted later, a = OrderedInsertion.objects.create(name="a", parent...
OrderedInsertionSortingTestCase
python
astropy__astropy
astropy/time/core.py
{ "start": 106882, "end": 107005 }
class ____(AstropyDeprecationWarning): """Warning for missing unit or format in TimeDelta."""
TimeDeltaMissingUnitWarning
python
huggingface__transformers
src/transformers/models/afmoe/modeling_afmoe.py
{ "start": 23803, "end": 27524 }
class ____(AfmoePreTrainedModel): """ Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`AfmoeDecoderLayer`] Args: config: AfmoeConfig """ def __init__(self, config: AfmoeConfig): super().__init__(config) self.padding_idx = config.pad_tok...
AfmoeModel
python
pytorch__pytorch
torch/_dynamo/precompile_context.py
{ "start": 1578, "end": 1705 }
class ____(BackendCacheArtifact[Any]): def after_deserialization(self) -> Any: return self.content
EagerCacheArtifact
python
gevent__gevent
src/greentest/3.12/test_interpreters.py
{ "start": 17445, "end": 18133 }
class ____(TestBase): # In these tests we generally want a lot of interpreters, # but not so many that any test takes too long. @support.requires_resource('cpu') def test_create_many_sequential(self): alive = [] for _ in range(100): interp = interpreters.create() ...
StressTests
python
huggingface__transformers
src/transformers/models/deepseek_v2/modeling_deepseek_v2.py
{ "start": 4020, "end": 6732 }
class ____(nn.Module): def __init__(self, config: DeepseekV2Config): super().__init__() self.config = config self.experts = DeepseekV2Experts(config) self.gate = nn.Linear(config.hidden_size, config.n_routed_experts, bias=False) if config.n_shared_experts is not None: ...
DeepseekV2Moe
python
cherrypy__cherrypy
cherrypy/_cplogging.py
{ "start": 5238, "end": 15525 }
class ____(object): """An object to assist both simple and advanced logging. ``cherrypy.log`` is an instance of this class. """ appid = None """The id() of the Application object which owns this log manager. If this is a global log manager, appid is None. """ error_log = None """...
LogManager
python
spack__spack
lib/spack/spack/vendor/ruamel/yaml/tokens.py
{ "start": 8453, "end": 8527 }
class ____(Token): __slots__ = () id = '<stream end>'
StreamEndToken
python
facelessuser__pymdown-extensions
pymdownx/highlight.py
{ "start": 20090, "end": 21969 }
class ____(Extension): """Configure highlight settings globally.""" def __init__(self, *args, **kwargs): """Initialize.""" self.config = copy.deepcopy(DEFAULT_CONFIG) super().__init__(*args, **kwargs) def get_pymdownx_highlight_settings(self): """Get the specified extensio...
HighlightExtension
python
pytorch__pytorch
test/torch_np/numpy_tests/core/test_scalar_methods.py
{ "start": 5363, "end": 7215 }
class ____(TestCase): @parametrize( "cls", [ np.number, np.integer, np.inexact, np.unsignedinteger, np.signedinteger, np.floating, ], ) def test_abc(self, cls: type[np.number]) -> None: alias = cls[Any] ...
TestClassGetItem
python
automl__auto-sklearn
autosklearn/pipeline/components/regression/sgd.py
{ "start": 600, "end": 8916 }
class ____( IterativeComponent, AutoSklearnRegressionAlgorithm, ): def __init__( self, loss, penalty, alpha, fit_intercept, tol, learning_rate, l1_ratio=0.15, epsilon=0.1, eta0=0.01, power_t=0.5, average=False, ...
SGD
python
kamyu104__LeetCode-Solutions
Python/design-a-file-sharing-system.py
{ "start": 1905, "end": 3320 }
class ____(object): def __init__(self, m): """ :type m: int """ self.__users = [] self.__lookup = set() self.__chunks = collections.defaultdict(set) self.__min_heap = [] def join(self, ownedChunks): """ :type ownedChunks: List[int] ...
FileSharing2
python
python-excel__xlrd
tests/test_ignore_workbook_corruption_error.py
{ "start": 79, "end": 451 }
class ____(TestCase): def test_not_corrupted(self): with self.assertRaises(Exception) as context: xlrd.open_workbook(from_sample('corrupted_error.xls')) self.assertTrue('Workbook corruption' in str(context.exception)) xlrd.open_workbook(from_sample('corrupted_error.xls'), ignor...
TestIgnoreWorkbookCorruption
python
pytorch__pytorch
benchmarks/operator_benchmark/pt/qlinear_test.py
{ "start": 1075, "end": 1299 }
class ____(_QLinearBenchmarkBase): def init(self, N, IN, OUT, device): super().init(N, IN, OUT, nnq.Linear(IN, OUT)) self.inputs = {"input": self.qX} self.set_module_name("QLinear")
QLinearBenchmark
python
dateutil__dateutil
src/dateutil/parser/isoparser.py
{ "start": 1051, "end": 13230 }
class ____(object): def __init__(self, sep=None): """ :param sep: A single character that separates date and time portions. If ``None``, the parser will accept any single character. For strict ISO-8601 adherence, pass ``'T'``. """ if sep is not Non...
isoparser
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pylint/invalid_return_type_str.py
{ "start": 588, "end": 629 }
class ____: def __str__(self): ...
Str3
python
dagster-io__dagster
python_modules/dagster/dagster/_core/execution/stats.py
{ "start": 6906, "end": 14253 }
class ____: run_id: str step_key_stats: Sequence[RunStepKeyStatsSnapshot] partial_markers: Optional[Mapping[str, Sequence[RunStepMarker]]] def build_run_step_stats_from_events( run_id: str, entries: Iterable[EventLogEntry], ) -> Sequence[RunStepKeyStatsSnapshot]: snapshot = build_run_step_stat...
RunStepStatsSnapshot
python
numba__numba
numba/core/ccallback.py
{ "start": 415, "end": 1002 }
class ____(_FunctionCompiler): def _customize_flags(self, flags): flags.no_cpython_wrapper = True flags.no_cfunc_wrapper = False # Disable compilation of the IR module, because we first want to # add the cfunc wrapper. flags.no_compile = True # Object mode is not cur...
_CFuncCompiler
python
PyCQA__pylint
tests/functional/n/none_dunder_protocols.py
{ "start": 123, "end": 171 }
class ____(type): __iter__ = None
MetaIterable
python
PyCQA__pylint
tests/functional/g/generic_class_syntax.py
{ "start": 702, "end": 783 }
class ____(Parent[_T]): def func(self): self.update_interval = None
Child
python
openai__openai-python
src/openai/resources/moderations.py
{ "start": 7067, "end": 7324 }
class ____: def __init__(self, moderations: AsyncModerations) -> None: self._moderations = moderations self.create = _legacy_response.async_to_raw_response_wrapper( moderations.create, )
AsyncModerationsWithRawResponse
python
PyCQA__flake8
src/flake8/statistics.py
{ "start": 3387, "end": 4357 }
class ____: """Simple wrapper around the logic of each statistic. Instead of maintaining a simple but potentially hard to reason about tuple, we create a class which has attributes and a couple convenience methods on it. """ def __init__( self, error_code: str, filename: str, message: ...
Statistic
python
optuna__optuna
optuna/testing/tempfile_pool.py
{ "start": 298, "end": 1274 }
class ____: tempfile_pool: list[IO[Any]] = [] def __new__(cls, **kwargs: Any) -> "NamedTemporaryFilePool": if not hasattr(cls, "_instance"): cls._instance = super(NamedTemporaryFilePool, cls).__new__(cls) atexit.register(cls._instance.cleanup) return cls._instance d...
NamedTemporaryFilePool
python
kamyu104__LeetCode-Solutions
Python/path-with-minimum-effort.py
{ "start": 3199, "end": 4747 }
class ____(object): def minimumEffortPath(self, heights): """ :type heights: List[List[int]] :rtype: int """ directions = [(0, 1), (1, 0), (0, -1), (-1, 0)] def check(heights, x): # bi-bfs lookup = [[False]*len(heights[0]) for _ in xrange(len(heights))] ...
Solution3
python
dagster-io__dagster
examples/docs_snippets/docs_snippets/docs_beta/guides/automation/asset-sensor-with-config.py
{ "start": 23, "end": 1488 }
class ____(dg.Config): param1: str @dg.asset def daily_sales_data(context: dg.AssetExecutionContext): context.log.info("Asset to watch") # highlight-next-line yield dg.MaterializeResult(metadata={"specific_property": "value"}) @dg.asset def weekly_report(context: dg.AssetExecutionContext, config: My...
MyConfig
python
huggingface__transformers
src/transformers/models/dia/modeling_dia.py
{ "start": 24472, "end": 29199 }
class ____(DiaPreTrainedModel): """Transformer Decoder Stack using DenseGeneral.""" def __init__(self, config: DiaDecoderConfig): super().__init__(config) self.num_channels = config.num_channels self.vocab_size = config.vocab_size self.embeddings = DiaMultiChannelEmbedding(confi...
DiaDecoder
python
keras-team__keras
keras/src/layers/rnn/conv_lstm3d.py
{ "start": 141, "end": 8289 }
class ____(ConvLSTM): """3D Convolutional LSTM. Similar to an LSTM layer, but the input transformations and recurrent transformations are both convolutional. Args: filters: int, the dimension of the output space (the number of filters in the convolution). kernel_size: int o...
ConvLSTM3D
python
pennersr__django-allauth
allauth/account/views.py
{ "start": 36013, "end": 38174 }
class ____(NextRedirectMixin, FormView): def dispatch(self, request, *args, **kwargs): resp = self._check_reauthentication_method_available(request) if resp: return resp resp = self._check_ratelimit(request) if resp: return resp return super().dispatch...
BaseReauthenticateView
python
getsentry__sentry
src/sentry/integrations/slack/utils/threads.py
{ "start": 753, "end": 3357 }
class ____: """ Stateless utility class for handling notification action threads. This class will will be used for the issue and metric alert handlers. Eventually with Notification Platform, we should delete this class """ @classmethod def _save_notification_action_message( cls, ...
NotificationActionThreadUtils
python
getsentry__sentry
src/sentry/relocation/services/relocation_export/service.py
{ "start": 630, "end": 903 }
class ____(ByRegionName): parameter_name: str = "replying_region_name" # See the comment on /src/sentry/relocation/tasks/process.py::uploading_start for a detailed description of # how this service fits into the entire SAAS->SAAS relocation workflow.
ByReplyingRegionName
python
tensorflow__tensorflow
tensorflow/python/platform/gfile.py
{ "start": 4445, "end": 5065 }
class ____(_FileIO): """File I/O wrappers without thread locking. Note, that this is somewhat like builtin Python file I/O, but there are semantic differences to make it more efficient for some backing filesystems. For example, a write mode file will not be opened until the first write call (to m...
FastGFile
python
ZoranPandovski__al-go-rithms
data_structures/doubly_linked_list/python/main.py
{ "start": 66, "end": 234 }
class ____: def __init__(self, data): self.data = data self.next = None self.prev = None # creation of the main double linked list class
Node
python
google__jax
jax/_src/hijax.py
{ "start": 2239, "end": 3172 }
class ____(core.AbstractValue): is_high = True has_qdd = False # immutable # type equality def __hash__(self): assert False, "must override" def __eq__(self, other): assert False, "must override" # lowering from hijax type to lojax types def lo_ty(self) -> list[core.AbstractValue]: assert False, "m...
HiType
python
fluentpython__example-code-2e
24-class-metaprog/persistent/dblib.py
{ "start": 727, "end": 963 }
class ____(Exception): """Query returned more than 1 row.""" SQLType = str TypeMap = dict[type, SQLType] SQL_TYPES: TypeMap = { int: 'INTEGER', str: 'TEXT', float: 'REAL', bytes: 'BLOB', }
UnexpectedMultipleResults
python
python-pillow__Pillow
Tests/test_file_avif.py
{ "start": 1708, "end": 2355 }
class ____: def test_unsupported(self, monkeypatch: pytest.MonkeyPatch) -> None: monkeypatch.setattr(AvifImagePlugin, "SUPPORTED", False) with pytest.raises(UnidentifiedImageError): with pytest.warns(UserWarning, match="AVIF support not installed"): with Image.open(TEST_...
TestUnsupportedAvif
python
anthropics__anthropic-sdk-python
src/anthropic/_client.py
{ "start": 20844, "end": 21875 }
class ____: _client: Anthropic def __init__(self, client: Anthropic) -> None: self._client = client @cached_property def completions(self) -> completions.CompletionsWithStreamingResponse: from .resources.completions import CompletionsWithStreamingResponse return CompletionsWit...
AnthropicWithStreamedResponse
python
wandb__wandb
wandb/vendor/graphql-core-1.1/wandb_graphql/execution/base.py
{ "start": 552, "end": 4091 }
class ____(object): """Data that must be available at all points during query execution. Namely, schema of the type system that is currently executing, and the fragments defined in the query document""" __slots__ = 'schema', 'fragments', 'root_value', 'operation', 'variable_values', 'errors', 'context...
ExecutionContext
python
sphinx-doc__sphinx
sphinx/domains/cpp/_ast.py
{ "start": 37870, "end": 38815 }
class ____(ASTExpression): def __init__(self, expr: ASTExpression) -> None: self.expr = expr def __eq__(self, other: object) -> bool: if not isinstance(other, ASTNoexceptExpr): return NotImplemented return self.expr == other.expr def __hash__(self) -> int: retur...
ASTNoexceptExpr
python
plotly__plotly.py
plotly/graph_objs/histogram2dcontour/colorbar/_tickformatstop.py
{ "start": 233, "end": 8569 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "histogram2dcontour.colorbar" _path_str = "histogram2dcontour.colorbar.tickformatstop" _valid_props = {"dtickrange", "enabled", "name", "templateitemname", "value"} @property def dtickrange(self): """ range [*min*, *max*], ...
Tickformatstop
python
getsentry__sentry
src/sentry/hybridcloud/models/orgauthtokenreplica.py
{ "start": 521, "end": 2092 }
class ____(Model): __relocation_scope__ = RelocationScope.Excluded organization = FlexibleForeignKey("sentry.Organization", null=False, on_delete=models.CASCADE) orgauthtoken_id = HybridCloudForeignKey("sentry.OrgAuthToken", null=False, on_delete="cascade") # The JWT token in hashed form token_hash...
OrgAuthTokenReplica
python
pydata__xarray
xarray/tests/test_ufuncs.py
{ "start": 6411, "end": 6524 }
class ____(DuckArray): def __array_namespace__(self, *, api_version=None): return DuckArray2
DuckArray2
python
jina-ai__jina
tests/unit/orchestrate/flow/flow-orchestrate/test_ndarray_type.py
{ "start": 708, "end": 2356 }
class ____(Executor): @requests def check_nparray(self, docs, **kwargs): embedding_is_nparray = True tensor_is_nparray = True for doc in docs: embedding_is_nparray = embedding_is_nparray and isinstance( doc.embedding, np.ndarray ) tenso...
NparrayInEec
python
great-expectations__great_expectations
tests/data_context/fixtures/plugins/extended_checkpoint.py
{ "start": 579, "end": 1009 }
class ____(LegacyCheckpoint): def __init__( self, name: str, data_context, expectation_suite_name: Optional[str] = None, action_list: Optional[List[dict]] = None, ): super().__init__( name=name, data_context=data_context, expect...
ExtendedLegacyCheckpoint
python
qdrant__qdrant-client
tools/async_client_generator/transformers/client/function_def_transformer.py
{ "start": 119, "end": 1052 }
class ____(FunctionDefTransformer): def __init__( self, keep_sync: Optional[list[str]] = None, class_replace_map: Optional[dict[str, str]] = None, exclude_methods: Optional[list[str]] = None, async_methods: Optional[list[str]] = None, ): super().__init__(keep_sync...
ClientFunctionDefTransformer
python
wandb__wandb
wandb/sdk/data_types/video.py
{ "start": 2141, "end": 10482 }
class ____(BatchableMedia): """A class for logging videos to W&B.""" _log_type = "video-file" EXTS = ("gif", "mp4", "webm", "ogg") _width: Optional[int] _height: Optional[int] def __init__( self, data_or_path: Union[str, pathlib.Path, "np.ndarray", "TextIO", "BytesIO"], ...
Video
python
huggingface__transformers
tests/models/pix2struct/test_modeling_pix2struct.py
{ "start": 12824, "end": 14809 }
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 = Pix2StructTextModelTester(paren...
Pix2StructModelTester
python
huggingface__transformers
src/transformers/models/glm4v/modeling_glm4v.py
{ "start": 31327, "end": 36091 }
class ____(Glm4vPreTrainedModel): config: Glm4vVisionConfig input_modalities = ("image", "video") _no_split_modules = ["Glm4vVisionBlock"] def __init__(self, config) -> None: super().__init__(config) self.spatial_merge_size = config.spatial_merge_size self.patch_size = config.pa...
Glm4vVisionModel
python
astropy__astropy
astropy/visualization/wcsaxes/tests/test_images.py
{ "start": 1735, "end": 48119 }
class ____(BaseImageTests): @figure_test def test_tight_layout(self): # Check that tight_layout works on a WCSAxes. fig = Figure(figsize=(8, 6)) canvas = FigureCanvasAgg(fig) for i in (1, 2): fig.add_subplot(2, 1, i, projection=WCS(self.msx_header)) fig.tight_...
TestBasic
python
getsentry__sentry
src/sentry/utils/snuba_rpc.py
{ "start": 2452, "end": 2496 }
class ____(SnubaError): pass
SnubaRPCError
python
getsentry__sentry
src/sentry/mail/forms/notify_email.py
{ "start": 157, "end": 392 }
class ____(MemberTeamForm[ActionTargetType]): targetType = forms.ChoiceField(choices=ACTION_CHOICES) teamValue = ActionTargetType.TEAM memberValue = ActionTargetType.MEMBER targetTypeEnum = ActionTargetType
NotifyEmailForm
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/links/spanner.py
{ "start": 1422, "end": 1627 }
class ____(BaseGoogleLink): """Helper class for constructing Spanner Database Link.""" name = "Spanner Database" key = "spanner_database" format_str = SPANNER_DATABASE_LINK
SpannerDatabaseLink
python
numba__numba
numba/cuda/cudadrv/driver.py
{ "start": 69375, "end": 70847 }
class ____(mviewbuf.MemAlloc): """A pointer to a pinned buffer on the host. :param context: The context in which the pointer was mapped. :type context: Context :param owner: The object owning the memory. For EMM plugin implementation, this ca :param pointer: The address of the buf...
PinnedMemory
python
apache__airflow
airflow-ctl/src/airflowctl/api/datamodels/generated.py
{ "start": 53393, "end": 54442 }
class ____(BaseModel): """ Schema for Human-in-the-loop detail history. """ options: Annotated[list[str], Field(min_length=1, title="Options")] subject: Annotated[str, Field(title="Subject")] body: Annotated[str | None, Field(title="Body")] = None defaults: Annotated[list[str] | None, Field...
HITLDetailHistory
python
dagster-io__dagster
python_modules/dagster-graphql/dagster_graphql/schema/logs/events.py
{ "start": 18932, "end": 19222 }
class ____(graphene.ObjectType): class Meta: interfaces = ( GrapheneMessageEvent, GrapheneDisplayableEvent, GrapheneStepEvent, GrapheneMarkerEvent, ) name = "ResourceInitStartedEvent"
GrapheneResourceInitStartedEvent
python
doocs__leetcode
solution/2800-2899/2809.Minimum Time to Make Array Sum At Most x/Solution2.py
{ "start": 0, "end": 465 }
class ____: def minimumTime(self, nums1: List[int], nums2: List[int], x: int) -> int: n = len(nums1) f = [0] * (n + 1) for a, b in sorted(zip(nums1, nums2), key=lambda z: z[1]): for j in range(n, 0, -1): f[j] = max(f[j], f[j - 1] + a + b * j) s1 = sum(nums...
Solution
python
doocs__leetcode
solution/0800-0899/0813.Largest Sum of Averages/Solution2.py
{ "start": 0, "end": 459 }
class ____: def largestSumOfAverages(self, nums: List[int], k: int) -> float: n = len(nums) f = [[0] * (k + 1) for _ in range(n + 1)] s = list(accumulate(nums, initial=0)) for i in range(1, n + 1): f[i][1] = s[i] / i for j in range(2, min(i + 1, k + 1)): ...
Solution
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 557651, "end": 558130 }
class ____(sgqlc.types.Type): """Autogenerated return type of DeleteProject""" __schema__ = github_schema __field_names__ = ("client_mutation_id", "owner") client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId") """A unique identifier for the client performing the mutation."...
DeleteProjectPayload
python
Netflix__metaflow
metaflow/_vendor/packaging/specifiers.py
{ "start": 25567, "end": 39080 }
class ____(BaseSpecifier): """This class abstracts handling of a set of version specifiers. It can be passed a single specifier (``>=3.0``), a comma-separated list of specifiers (``>=3.0,!=3.1``), or no specifier at all. """ def __init__( self, specifiers: str = "", prereleases: Optional[b...
SpecifierSet
python
PyCQA__pydocstyle
src/pydocstyle/config.py
{ "start": 33218, "end": 33488 }
class ____(Exception): """An exception for illegal configurations.""" pass # General configurations for pydocstyle run. RunConfiguration = namedtuple( 'RunConfiguration', ('explain', 'source', 'debug', 'verbose', 'count', 'config'), )
IllegalConfiguration
python
huggingface__transformers
src/transformers/models/vivit/modeling_vivit.py
{ "start": 12502, "end": 13755 }
class ____(GradientCheckpointingLayer): """This corresponds to the EncoderBlock class in the scenic/vivit implementation.""" def __init__(self, config: VivitConfig): super().__init__() self.chunk_size_feed_forward = config.chunk_size_feed_forward self.seq_len_dim = 1 self.attent...
VivitLayer
python
tensorflow__tensorflow
tensorflow/python/ops/weak_tensor_math_ops_test.py
{ "start": 28979, "end": 32912 }
class ____(test_util.TensorFlowTestCase): def numpySafeFloorDivInt(self, x, y): z = x // y # Numpy produces 0 for INT_MIN/-1, but we expect an overflow to INT_MIN # so that (INT_MIN/-1) + (INT_MIN % -1) = INT_MIN + 0 = INT_MIN. z[(x == np.iinfo(x.dtype).min) & (y == -1)] = np.iinfo(x.dtype).min r...
DivAndModTest
python
pypa__pip
src/pip/_internal/req/req_uninstall.py
{ "start": 21661, "end": 24099 }
class ____: def __init__(self, pth_file: str) -> None: self.file = pth_file self.entries: set[str] = set() self._saved_lines: list[bytes] | None = None def add(self, entry: str) -> None: entry = os.path.normcase(entry) # On Windows, os.path.normcase converts the entry to...
UninstallPthEntries
python
kennethreitz__tablib
src/tablib/exceptions.py
{ "start": 143, "end": 213 }
class ____(Exception): "Outside of Dataset size"
InvalidDatasetIndex
python
pytorch__pytorch
test/inductor/test_cpu_cpp_wrapper.py
{ "start": 1619, "end": 14394 }
class ____(InductorTestCase): device = "cpu" test_failures_cpp_wrapper = { # conv2d will fallback for dynamic shapes; the fallback path is not yet supported "test_conv2d_unary_cpu_dynamic_shapes": test_torchinductor.TestFailure( ("cpp_wrapper",), is_skip=True ), "test_conv2d_binary_inplace...
DynamicShapesCppWrapperCpuTests
python
gevent__gevent
src/greentest/3.14/test_socket.py
{ "start": 100284, "end": 110207 }
class ____(unittest.TestCase): def testCreateRfcommSocket(self): with socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM) as s: pass @unittest.skipIf(sys.platform == "win32", "windows does not support L2CAP sockets") def testCreateL2capSocket(self): wi...
BluetoothTest
python
huggingface__transformers
src/transformers/models/sew/modeling_sew.py
{ "start": 15746, "end": 20522 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.config = config self.pos_conv_embed = SEWPositionalConvEmbedding(config) self.pool = nn.AvgPool1d(config.squeeze_factor, config.squeeze_factor) self.layer_norm = nn.LayerNorm(config.hidden_size, eps=co...
SEWEncoder
python
allegroai__clearml
clearml/backend_api/services/v2_9/tasks.py
{ "start": 93080, "end": 96265 }
class ____(Request): """ Signal a task has completed :param force: If not true, call fails if the task status is not in_progress/stopped :type force: bool :param task: Task ID :type task: str :param status_reason: Reason for status change :type status_reason: str :param stat...
CompletedRequest
python
encode__django-rest-framework
tests/test_throttling.py
{ "start": 12972, "end": 13569 }
class ____(XffTestingBase): def test_xff_spoofing_doesnt_change_machine_id_with_one_app_proxy(self): self.config_proxy(1) self.view(self.request) self.request.META['HTTP_X_FORWARDED_FOR'] = '4.4.4.4, 5.5.5.5, 2.2.2.2' assert self.view(self.request).status_code == 429 def test_xf...
XffSpoofingTests
python
getsentry__sentry
src/sentry/rules/filters/issue_category.py
{ "start": 473, "end": 582 }
class ____(forms.Form): value = forms.ChoiceField(choices=list(CATEGORY_CHOICES.items()))
IssueCategoryForm
python
OmkarPathak__pygorithm
pygorithm/data_structures/linked_list.py
{ "start": 5717, "end": 7527 }
class ____(object): ''' Class for circular linked list ''' def __init__(self): self.head = None self.tail = None self.size = 0 def clear(self): ''' clears the head and tails of the linked list ''' self.tail = None self.head = None def get_data(se...
CircularLinkedList
python
walkccc__LeetCode
solutions/2707. Extra Characters in a String/2707.py
{ "start": 0, "end": 463 }
class ____: # Similar to 139. Word Break def minExtraChar(self, s: str, dictionary: list[str]) -> int: n = len(s) dictionarySet = set(dictionary) # dp[i] := the minimum extra letters if breaking up s[0..i) optimally dp = [0] + [n] * n for i in range(1, n + 1): for j in range(i): i...
Solution
python
wandb__wandb
wandb/vendor/pygments/lexers/robotframework.py
{ "start": 5295, "end": 6152 }
class ____(object): _space_splitter = re.compile('( {2,})') _pipe_splitter = re.compile('((?:^| +)\|(?: +|$))') def split(self, row): splitter = (row.startswith('| ') and self._split_from_pipes or self._split_from_spaces) for value in splitter(row): yield val...
RowSplitter
python
wandb__wandb
wandb/errors/links.py
{ "start": 391, "end": 440 }
class ____: url: str description: str
WBURL
python
ijl__orjson
test/test_datetime.py
{ "start": 22186, "end": 23345 }
class ____: def test_time(self): """ datetime.time """ assert orjson.dumps([datetime.time(12, 15, 59, 111)]) == b'["12:15:59.000111"]' assert orjson.dumps([datetime.time(12, 15, 59)]) == b'["12:15:59"]' @pytest.mark.skipif(zoneinfo is None, reason="zoneinfo not available...
TestTime
python
apache__airflow
providers/amazon/src/airflow/providers/amazon/aws/sensors/sagemaker.py
{ "start": 4648, "end": 5808 }
class ____(SageMakerBaseSensor): """ Poll the transform job until it reaches a terminal state; raise AirflowException with the failure reason. .. seealso:: For more information on how to use this sensor, take a look at the guide: :ref:`howto/sensor:SageMakerTransformSensor` :param job_...
SageMakerTransformSensor
python
huggingface__transformers
src/transformers/models/aimv2/modeling_aimv2.py
{ "start": 17086, "end": 19551 }
class ____(Aimv2PreTrainedModel): config: Aimv2VisionConfig main_input_name = "pixel_values" _can_record_outputs = { "hidden_states": Aimv2EncoderLayer, "attentions": Aimv2Attention, } def __init__(self, config: Aimv2VisionConfig): super().__init__(config) self.confi...
Aimv2VisionModel
python
allegroai__clearml
clearml/backend_api/services/v2_20/auth.py
{ "start": 10613, "end": 11806 }
class ____(Response): """ Response of auth.edit_credentials endpoint. :param updated: Number of credentials updated :type updated: int """ _service = "auth" _action = "edit_credentials" _version = "2.20" _schema = { "definitions": {}, "properties": { "up...
EditCredentialsResponse
python
pyca__cryptography
tests/x509/test_x509_ext.py
{ "start": 78959, "end": 80422 }
class ____: def test_not_ipaddress(self): with pytest.raises(TypeError): x509.IPAddress(b"notanipaddress") # type:ignore[arg-type] with pytest.raises(TypeError): x509.IPAddress(1.3) # type:ignore[arg-type] def test_repr(self): gn = x509.IPAddress(ipaddress.IPv...
TestIPAddress