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
celery__celery
t/unit/worker/test_heartbeat.py
{ "start": 76, "end": 488 }
class ____: heart = None next_iter = 0 def __init__(self): self.sent = [] self.on_enabled = set() self.on_disabled = set() self.enabled = True def send(self, msg, **_fields): self.sent.append((msg, _fields)) if self.heart: if self.next_iter >...
MockDispatcher
python
walkccc__LeetCode
solutions/3403. Find the Lexicographically Largest String From the Box I/3403.py
{ "start": 0, "end": 1153 }
class ____: def answerString(self, word: str, numFriends: int) -> str: if numFriends == 1: return word s = self._lastSubstring(word) sz = len(word) - numFriends + 1 return s[:min(len(s), sz)] # Same as 1163. Last Substring in Lexicographical Order def _lastSubstring(self, s: str) -> str: ...
Solution
python
plotly__plotly.py
plotly/graph_objs/waterfall/_outsidetextfont.py
{ "start": 233, "end": 17203 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "waterfall" _path_str = "waterfall.outsidetextfont" _valid_props = { "color", "colorsrc", "family", "familysrc", "lineposition", "linepositionsrc", "shadow", "shadowsrc", "size", ...
Outsidetextfont
python
bokeh__bokeh
src/bokeh/models/widgets/inputs.py
{ "start": 3827, "end": 7788 }
class ____(InputWidget): ''' Present a file-chooser dialog to users and return the contents of the selected files. ''' # explicit __init__ to support Init signatures def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) value = Readonly(Either(String,...
FileInput
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/metadata/metadata_set.py
{ "start": 1051, "end": 3980 }
class ____(ABC, DagsterModel): """Base class for defining a set of key-value pairs in the same namespace. Includes shared behavior between NamespacedMetadataSet and NamespacedTagSet. """ @classmethod @abstractmethod def namespace(cls) -> str: raise NotImplementedError() @classmet...
NamespacedKVSet
python
django__django
tests/custom_lookups/tests.py
{ "start": 6903, "end": 7210 }
class ____(models.Transform): lookup_name = "as_datetime" @property def output_field(self): return models.DateTimeField() def as_sql(self, compiler, connection): lhs, params = compiler.compile(self.lhs) return "from_unixtime({})".format(lhs), params
DateTimeTransform
python
huggingface__transformers
src/transformers/models/olmoe/modeling_olmoe.py
{ "start": 9793, "end": 13766 }
class ____(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__(self, config: OlmoeConfig, layer_idx: Optional[int] = None): super().__init__() self.config = config self.layer_idx = layer_idx self.head_dim = getattr(config, "head_dim", con...
OlmoeAttention
python
pytorch__pytorch
torch/autograd/profiler.py
{ "start": 37679, "end": 44056 }
class ____: """Context manager that makes every autograd operation emit an NVTX range. It is useful when running the program under nvprof:: nvprof --profile-from-start off -o trace_name.prof -- <regular command here> Unfortunately, there's no way to force nvprof to flush the data it collected ...
emit_nvtx
python
great-expectations__great_expectations
contrib/great_expectations_semantic_types_expectations/great_expectations_semantic_types_expectations/expectations/expect_column_values_to_be_valid_isin.py
{ "start": 897, "end": 1884 }
class ____(ColumnMapMetricProvider): # This is the id string that will be used to reference your metric. condition_metric_name = "column_values.to_be_valid_isin" # This method implements the core logic for the PandasExecutionEngine @column_condition_partial(engine=PandasExecutionEngine) def _pandas...
ColumnValuesToBeValidIsin
python
openai__openai-python
src/openai/resources/videos.py
{ "start": 30937, "end": 31700 }
class ____: def __init__(self, videos: AsyncVideos) -> None: self._videos = videos self.create = async_to_streamed_response_wrapper( videos.create, ) self.retrieve = async_to_streamed_response_wrapper( videos.retrieve, ) self.list = async_to_s...
AsyncVideosWithStreamingResponse
python
wandb__wandb
wandb/integration/diffusers/pipeline_resolver.py
{ "start": 209, "end": 1834 }
class ____: """Resolver for `DiffusionPipeline` request and responses from [HuggingFace Diffusers](https://huggingface.co/docs/diffusers/index), providing necessary data transformations, formatting, and logging. This is based off `wandb.sdk.integration_utils.auto_logging.RequestResponseResolver`. """ ...
DiffusersPipelineResolver
python
apache__airflow
devel-common/src/tests_common/test_utils/perf/perf_kit/sqlalchemy.py
{ "start": 5159, "end": 7474 }
class ____: """ Counts the number of queries sent to Airflow Database in a given context. Does not support multiple processes. When a new process is started in context, its queries will not be included. :param print_fn: The function used to display the text. By default, ``builtins.print`` """ ...
CountQueries
python
spyder-ide__spyder
spyder/plugins/ipythonconsole/utils/websocket_client.py
{ "start": 35251, "end": 35644 }
class ____(_WebSocketHBChannel, SuperQObject): """A heartbeat channel emitting a Qt signal when a message is received.""" # Emitted when the kernel has died. kernel_died = Signal(float) def call_handlers(self, since_last_heartbeat): """Reimplemented to emit signal.""" # Emit the generi...
QtWSHBChannel
python
langchain-ai__langchain
libs/core/langchain_core/messages/ai.py
{ "start": 2088, "end": 2757 }
class ____(TypedDict, total=False): """Breakdown of output token counts. Does *not* need to sum to full output token count. Does *not* need to have all keys. Example: ```python { "audio": 10, "reasoning": 200, } ``` May also hold extra provider-...
OutputTokenDetails
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/strings_ops/unicode_encode_op_test.py
{ "start": 1352, "end": 17579 }
class ____(test.TestCase, parameterized.TestCase): def assertAllEqual(self, rt, expected): with self.cached_session() as sess: value = sess.run(rt) if isinstance(value, np.ndarray): value = value.tolist() elif isinstance(value, ragged_tensor_value.RaggedTensorValue): value = val...
UnicodeEncodeOpTest
python
numba__numba
numba/core/imputils.py
{ "start": 9646, "end": 14889 }
class ____(Enum): """ Enumerate the reference type """ """ A new reference """ NEW = 1 """ A borrowed reference """ BORROWED = 2 """ An untracked reference """ UNTRACKED = 3 def iternext_impl(ref_type=None): """ Wrap the given iternext() implementatio...
RefType
python
geekcomputers__Python
venv/Lib/site-packages/pip/_vendor/resolvelib/resolvers.py
{ "start": 1310, "end": 2783 }
class ____(object): """Representation of possible resolution results of a package. This holds three attributes: * `information` is a collection of `RequirementInformation` pairs. Each pair is a requirement contributing to this criterion, and the candidate that provides the requirement. * `...
Criterion
python
dagster-io__dagster
python_modules/dagster/dagster/_core/storage/sql.py
{ "start": 7505, "end": 7962 }
class ____(db.Text): """Allows customization of certain fields to map to LONGTEXT in MySQL. For Postgres, all text fields are mapped to TEXT, which is unbounded in length, so the distinction is not neccessary. In MySQL, however, TEXT is limited to 64KB, so LONGTEXT (4GB) is required for certain fields. ...
LongText
python
great-expectations__great_expectations
tests/integration/data_sources_and_expectations/test_misconfigured_expectations.py
{ "start": 3609, "end": 5889 }
class ____: _DATA = pd.DataFrame({"a": [1, 2]}) _EXPECTATION = gxe.ExpectColumnMedianToBeBetween(column="b", min_value=5, max_value=10) @parameterize_batch_for_data_sources( data_source_configs=[*PANDAS_DATA_SOURCES, *SQL_DATA_SOURCES], data=_DATA, ) def test_pandas_and_sql(self, ba...
TestNonExistentColumnMisconfiguration
python
getsentry__sentry
src/sentry/search/events/fields.py
{ "start": 37291, "end": 37674 }
class ____(ColumnArg): """Validate that the argument is either a column or a valid tag""" def normalize( self, value: str, params: ParamsType, combinator: Combinator | None ) -> str | list[Any]: if TAG_KEY_RE.match(value) or VALID_FIELD_PATTERN.match(value): return value ...
ColumnTagArg
python
google__pytype
pytype/pytd/codegen/function.py
{ "start": 153, "end": 394 }
class ____(Exception): """Inconsistent decorators on an overloaded function.""" def __init__(self, name, typ): msg = f"Overloaded signatures for '{name}' disagree on {typ} decorators" super().__init__(msg)
OverloadedDecoratorError
python
apache__airflow
airflow-core/tests/unit/callbacks/test_callback_requests.py
{ "start": 4337, "end": 6912 }
class ____: def test_dagrun_context_creation(self): """Test DagRunContext can be created with dag_run and first_ti""" current_time = timezone.utcnow() dag_run_data = DRDataModel( dag_id="test_dag", run_id="test_run", logical_date=current_time, ...
TestDagRunContext
python
pypa__pip
src/pip/_vendor/distlib/util.py
{ "start": 54523, "end": 55297 }
class ____(CSVBase): def __init__(self, **kwargs): if 'stream' in kwargs: stream = kwargs['stream'] if sys.version_info[0] >= 3: # needs to be a text stream stream = codecs.getreader('utf-8')(stream) self.stream = stream else: ...
CSVReader
python
doocs__leetcode
solution/3100-3199/3147.Taking Maximum Energy From the Mystic Dungeon/Solution.py
{ "start": 0, "end": 313 }
class ____: def maximumEnergy(self, energy: List[int], k: int) -> int: ans = -inf n = len(energy) for i in range(n - k, n): j, s = i, 0 while j >= 0: s += energy[j] ans = max(ans, s) j -= k return ans
Solution
python
tensorflow__tensorflow
tensorflow/python/ops/tensor_array_ops.py
{ "start": 37030, "end": 51638 }
class ____: """Class wrapping dynamic-sized, per-time-step, Tensor arrays. This class is meant to be used with dynamic iteration primitives such as `while_loop` and `map_fn`. It supports gradient back-propagation via special "flow" control flow dependencies. Note that although the array can be read multipl...
TensorArray
python
ansible__ansible
lib/ansible/plugins/__init__.py
{ "start": 2433, "end": 7162 }
class ____(_AnsiblePluginInfoMixin, _ConfigurablePlugin, metaclass=abc.ABCMeta): # Set by plugin loader _load_name: str # allow extra passthrough parameters allow_extras: bool = False _extras_prefix: str | None = None def __init__(self): self._options = {} self._origins = {} ...
AnsiblePlugin
python
numba__numba
numba/tests/test_types.py
{ "start": 9193, "end": 11472 }
class ____(TestCase): """ Tests for number types. """ def test_bitwidth(self): """ All numeric types have bitwidth attribute """ for ty in types.number_domain: self.assertTrue(hasattr(ty, "bitwidth")) def test_minval_maxval(self): self.assertEqua...
TestNumbers
python
wandb__wandb
wandb/sdk/artifacts/_generated/artifact_collection_aliases.py
{ "start": 942, "end": 1301 }
class ____(GQLResult): node: Optional[ArtifactAliasFragment] ArtifactCollectionAliases.model_rebuild() ArtifactCollectionAliasesArtifactCollection.model_rebuild() ArtifactCollectionAliasesArtifactCollectionAliases.model_rebuild() ArtifactCollectionAliasesArtifactCollectionAliasesEdges.model_rebuild()
ArtifactCollectionAliasesArtifactCollectionAliasesEdges
python
walkccc__LeetCode
solutions/2000. Reverse Prefix of Word/2000.py
{ "start": 0, "end": 133 }
class ____: def reversePrefix(self, word: str, ch: str) -> str: i = word.find(ch) + 1 return word[:i][::-1] + word[i:]
Solution
python
spack__spack
lib/spack/spack/test/sbang.py
{ "start": 1669, "end": 15182 }
class ____: """Directory full of test scripts to run sbang instrumentation on.""" def __init__(self, sbang_line): self.tempdir = tempfile.mkdtemp() self.directory = os.path.join(self.tempdir, "dir") fs.mkdirp(self.directory) # Script with short shebang self.short_sheba...
ScriptDirectory
python
plotly__plotly.py
plotly/graph_objs/scatterpolar/_marker.py
{ "start": 233, "end": 42102 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "scatterpolar" _path_str = "scatterpolar.marker" _valid_props = { "angle", "angleref", "anglesrc", "autocolorscale", "cauto", "cmax", "cmid", "cmin", "color", "coloraxis", ...
Marker
python
apache__airflow
task-sdk/tests/task_sdk/bases/test_xcom.py
{ "start": 978, "end": 2807 }
class ____: @pytest.mark.parametrize( "map_index", [ pytest.param(None, id="map_index_none"), pytest.param(-1, id="map_index_negative_one"), pytest.param(0, id="map_index_zero"), pytest.param(5, id="map_index_positive"), ], ) def test_d...
TestBaseXCom
python
pypa__virtualenv
src/virtualenv/activation/activator.py
{ "start": 84, "end": 1419 }
class ____(ABC): """Generates activate script for the virtual environment.""" def __init__(self, options) -> None: """ Create a new activator generator. :param options: the parsed options as defined within :meth:`add_parser_arguments` """ self.flag_prompt = os.path.base...
Activator
python
conda__conda
conda/plugins/config.py
{ "start": 748, "end": 4294 }
class ____(Configuration): """ Class used to hold settings for conda plugins. The object created by this class should only be accessed via :class:`conda.base.context.Context.plugins`. When this class is updated via the :func:`add_plugin_setting` function it adds new setting properties which ca...
PluginConfig
python
Textualize__textual
src/textual/widgets/_masked_input.py
{ "start": 1622, "end": 15966 }
class ____(Validator): """Template mask enforcer.""" @dataclass class CharDefinition: """Holds data for a single char of the template mask.""" pattern: Pattern[str] """Compiled regular expression to check for matches.""" flags: _CharFlags = _CharFlags.NONE """Flags...
_Template
python
dask__dask
dask/dataframe/dask_expr/_reductions.py
{ "start": 1076, "end": 2182 }
class ____(Blockwise): """Partition-wise component of `ApplyConcatApply` This class is used within `ApplyConcatApply._lower`. See Also -------- ApplyConcatApply """ _parameters = ["frame", "kind", "chunk", "chunk_kwargs"] @property def operation(self): return self.chunk ...
Chunk
python
google__flatbuffers
tests/monster_test_generated.py
{ "start": 13376, "end": 14302 }
class ____(object): # AbilityT def __init__( self, id = 0, distance = 0, ): self.id = id # type: int self.distance = distance # type: int @classmethod def InitFromBuf(cls, buf, pos): ability = Ability() ability.Init(buf, pos) return...
AbilityT
python
plotly__plotly.py
plotly/graph_objs/scattergeo/unselected/_textfont.py
{ "start": 233, "end": 2598 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "scattergeo.unselected" _path_str = "scattergeo.unselected.textfont" _valid_props = {"color"} @property def color(self): """ Sets the text font color of unselected points, applied only when a selection exists. ...
Textfont
python
langchain-ai__langchain
libs/langchain/langchain_classic/chains/qa_with_sources/retrieval.py
{ "start": 478, "end": 2542 }
class ____(BaseQAWithSourcesChain): """Question-answering with sources over an index.""" retriever: BaseRetriever = Field(exclude=True) """Index to connect to.""" reduce_k_below_max_tokens: bool = False """Reduce the number of results to return from store based on tokens limit""" max_tokens_lim...
RetrievalQAWithSourcesChain
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/ruff/RUF009_attrs_auto_attribs.py
{ "start": 365, "end": 480 }
class ____: a: str = 0 b = field() c: int = foo() d = list() @frozen # auto_attribs = None => True
C
python
huggingface__transformers
src/transformers/models/bigbird_pegasus/modeling_bigbird_pegasus.py
{ "start": 2514, "end": 3402 }
class ____(nn.Embedding): """ This module learns positional embeddings up to a fixed maximum size. """ def __init__(self, num_embeddings: int, embedding_dim: int): super().__init__(num_embeddings, embedding_dim) def forward( self, input_ids_shape: torch.Size, past_key_values_length...
BigBirdPegasusLearnedPositionalEmbedding
python
PyCQA__mccabe
mccabe.py
{ "start": 6756, "end": 10717 }
class ____(object): """McCabe cyclomatic complexity checker.""" name = 'mccabe' version = __version__ _code = 'C901' _error_tmpl = "C901 %r is too complex (%d)" max_complexity = -1 def __init__(self, tree, filename): self.tree = tree @classmethod def add_options(cls, parser...
McCabeChecker
python
getsentry__sentry
tests/sentry/core/endpoints/test_organization_member_index.py
{ "start": 1367, "end": 7702 }
class ____(TestCase): def test_valid(self) -> None: context = {"organization": self.organization, "allowed_roles": [roles.get("member")]} data = { "email": "eric@localhost", "orgRole": "member", "teamRoles": [{"teamSlug": self.team.slug, "role": None}], } ...
OrganizationMemberRequestSerializerTest
python
giampaolo__psutil
tests/test_linux.py
{ "start": 53485, "end": 60689 }
class ____(PsutilTestCase): def test_boot_time(self): vmstat_value = vmstat('boot time') psutil_value = psutil.boot_time() assert int(vmstat_value) == int(psutil_value) def test_no_procfs_on_import(self): my_procfs = self.get_testfn() os.mkdir(my_procfs) with op...
TestMisc
python
PrefectHQ__prefect
src/integrations/prefect-github/prefect_github/schemas/graphql_schema.py
{ "start": 684311, "end": 684957 }
class ____(sgqlc.types.relay.Connection): """ See source code for more info. """ __schema__ = graphql_schema __field_names__ = ("edges", "nodes", "page_info", "total_count") edges = sgqlc.types.Field( sgqlc.types.list_of("VerifiableDomainEdge"), graphql_name="edges" ) nodes = sg...
VerifiableDomainConnection
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_hyperlink32.py
{ "start": 315, "end": 902 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("hyperlink32.xlsx") def test_create_file(self): """Test the creation of a file with hyperlinked image(s).""" workbook = Workbook(se...
TestCompareXLSXFiles
python
ray-project__ray
python/ray/serve/schema.py
{ "start": 24210, "end": 25219 }
class ____(BaseModel): """Options to start the gRPC Proxy with.""" port: int = Field( default=DEFAULT_GRPC_PORT, description=( "Port for gRPC server. Defaults to 9000. Cannot be updated once " "Serve has started running. Serve must be shut down and restarted " ...
gRPCOptionsSchema
python
numba__numba
numba/tests/test_funcdesc.py
{ "start": 790, "end": 1698 }
class ____(unittest.TestCase): def test_mangling_abi_tags(self): """ This is a minimal test for the abi-tags support in the mangler. """ def udt(): pass # run minimal frontend to create a function descriptor func_ir = run_frontend(udt) typemap = {...
TestFuncDescMangledName
python
apache__airflow
airflow-core/tests/unit/cli/commands/test_info_command.py
{ "start": 6050, "end": 6928 }
class ____: @conf_vars( { ("database", "sql_alchemy_conn"): "postgresql+psycopg2://postgres:airflow@postgres/airflow", } ) def test_show_info_anonymize_fileio(self, setup_parser, cleanup_providers_manager, stdout_capture): with mock.patch("airflow.cli.commands.info_comman...
TestInfoCommandMockHttpx
python
huggingface__transformers
src/transformers/models/deepseek_vl_hybrid/modular_deepseek_vl_hybrid.py
{ "start": 2718, "end": 5749 }
class ____(DeepseekVLConfig): r""" This is the configuration class to store the configuration of a [`DeepseekVLHybridModel`]. It is used to instantiate a DeepseekVLHybrid model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yie...
DeepseekVLHybridConfig
python
kamyu104__LeetCode-Solutions
Python/distribute-candies-among-children-i.py
{ "start": 96, "end": 772 }
class ____(object): def distributeCandies(self, n, limit): """ :type n: int :type limit: int :rtype: int """ def nCr(n, r): # Time: O(n), Space: O(1) if not 0 <= r <= n: return 0 if n-r < r: r = n-r ...
Solution
python
doocs__leetcode
solution/2300-2399/2371.Minimize Maximum Value in a Grid/Solution.py
{ "start": 0, "end": 471 }
class ____: def minScore(self, grid: List[List[int]]) -> List[List[int]]: m, n = len(grid), len(grid[0]) nums = [(v, i, j) for i, row in enumerate(grid) for j, v in enumerate(row)] nums.sort() row_max = [0] * m col_max = [0] * n ans = [[0] * n for _ in range(m)] ...
Solution
python
tox-dev__tox
src/tox/config/cli/parse.py
{ "start": 518, "end": 3221 }
class ____(NamedTuple): parsed: Parsed pos_args: Sequence[str] | None source: Source cmd_handlers: dict[str, Callable[[State], int]] log_handler: ToxHandler def get_options(*args: str) -> Options: pos_args: tuple[str, ...] | None = None try: # remove positional arguments passed to parser ...
Options
python
redis__redis-py
redis/_parsers/commands.py
{ "start": 573, "end": 925 }
class ____(Enum): ONE_SUCCEEDED = "one_succeeded" ALL_SUCCEEDED = "all_succeeded" AGG_LOGICAL_AND = "agg_logical_and" AGG_LOGICAL_OR = "agg_logical_or" AGG_MIN = "agg_min" AGG_MAX = "agg_max" AGG_SUM = "agg_sum" SPECIAL = "special" DEFAULT_KEYLESS = "default_keyless" DEFAULT_KEYE...
ResponsePolicy
python
HypothesisWorks__hypothesis
hypothesis-python/tests/cover/test_pretty.py
{ "start": 3752, "end": 3926 }
class ____: def _repr_pretty_(self, p, cycle): with p.group(4, "TG: ", ":"): p.text("Breaking(") p.break_() p.text(")")
Breaking
python
miyuchina__mistletoe
mistletoe/contrib/github_wiki.py
{ "start": 197, "end": 355 }
class ____(SpanToken): pattern = re.compile(r"\[\[ *(.+?) *\| *(.+?) *\]\]") def __init__(self, match): self.target = match.group(2)
GithubWiki
python
lazyprogrammer__machine_learning_examples
hmm_class/hmmd_scaled.py
{ "start": 580, "end": 6254 }
class ____: def __init__(self, M): self.M = M # number of hidden states def fit(self, X, max_iter=30): np.random.seed(123) # train the HMM model using the Baum-Welch algorithm # a specific instance of the expectation-maximization algorithm # determine V, the vocabul...
HMM
python
wandb__wandb
wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/polling.py
{ "start": 3941, "end": 4230 }
class ____(BaseObserver): """ Platform-independent observer that polls a directory to detect file system changes. """ def __init__(self, timeout=DEFAULT_OBSERVER_TIMEOUT): BaseObserver.__init__(self, emitter_class=PollingEmitter, timeout=timeout)
PollingObserver
python
airbytehq__airbyte
airbyte-integrations/connectors/source-notion/components.py
{ "start": 2311, "end": 3834 }
class ____(SimpleRetriever): """ Docs: https://developers.notion.com/reference/get-block-children According to that fact that block's entity may have children entities that stream also need to retrieve BlocksRetriever calls read_records when received record.has_children is True. """ def __pos...
BlocksRetriever
python
getsentry__sentry
src/sentry/migrations/0928_move_notifications_models.py
{ "start": 147, "end": 3829 }
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
getsentry__sentry
tests/sentry/models/test_release.py
{ "start": 4423, "end": 10778 }
class ____(TestCase): @receivers_raise_on_send() def test_simple(self) -> None: org = self.create_organization() commit = Commit.objects.create(organization_id=org.id, repository_id=5) commit2 = Commit.objects.create(organization_id=org.id, repository_id=6) # merge to pr...
MergeReleasesTest
python
bokeh__bokeh
src/bokeh/models/text.py
{ "start": 2456, "end": 2814 }
class ____(MathText): """ Render mathematical content using `MathML <https://www.w3.org/Math/>`_ notation. See :ref:`ug_styling_mathtext` in the |user guide| for more information. """ # explicit __init__ to support Init signatures def __init__(self, *args: Any, **kwargs: Any) -> None: ...
MathML
python
huggingface__transformers
src/transformers/models/flava/modeling_flava.py
{ "start": 67690, "end": 89239 }
class ____(FlavaPreTrainedModel): # Those are linked to xxx.bias _tied_weights_keys = { "mmm_text_head.bias": "mmm_text_head.decoder.bias", "mim_head.bias": "mim_head.decoder.bias", "mlm_head.bias": "mlm_head.decoder.bias", "mmm_image_head.bias": "mmm_image_head.decoder.bias", ...
FlavaForPreTraining
python
ray-project__ray
doc/source/_ext/callouts.py
{ "start": 2498, "end": 4254 }
class ____(SphinxDirective): """Code callout directive with annotations for Sphinx. Use this `callout` directive by wrapping either `code-block` or `literalinclude` directives. Each line that's supposed to be equipped with an annotation should have an inline comment of the form "# <x>" where x is an in...
CalloutDirective
python
pytest-dev__pytest
testing/acceptance_test.py
{ "start": 33532, "end": 37356 }
class ____: source = """ from _pytest import timing def test_something(): pass def test_2(): timing.sleep(0.010) def test_1(): timing.sleep(0.002) def test_3(): timing.sleep(0.020) """ def test_calls(self, pytester: Pyt...
TestDurations
python
ray-project__ray
rllib/utils/runners/runner_group.py
{ "start": 962, "end": 30324 }
class ____(metaclass=abc.ABCMeta): def __init__( self, config: "AlgorithmConfig", # TODO (simon): Check, if this is needed. Derived classes could define # this if needed. # default_policy_class: Optional[Type[Policy]] local_runner: Optional[bool] = False, logd...
RunnerGroup
python
pytorch__pytorch
test/inductor/test_codecache.py
{ "start": 2580, "end": 3261 }
class ____(logging.Handler): def __init__(self, level): super().__init__(level) self.records = [] def emit(self, record): self.records.append(record) @contextmanager def capture_logs(log_name, log_level): try: logger = logging.getLogger(log_name) old_level = logger...
LogCaptureHandler
python
numba__numba
numba/core/codegen.py
{ "start": 43871, "end": 45080 }
class ____(metaclass=ABCMeta): """ Base Codegen class. It is expected that subclasses set the class attribute ``_library_class``, indicating the CodeLibrary class for the target. Subclasses should also initialize: ``self._data_layout``: the data layout for the target. ``self._target_data``: th...
Codegen
python
tensorflow__tensorflow
tensorflow/python/training/basic_session_run_hooks.py
{ "start": 14183, "end": 16697 }
class ____(session_run_hook.SessionRunHook): """Hook that requests stop at a specified step. @compatibility(TF2) Please check this [notebook][notebook] on how to migrate the API to TF2. [notebook]:https://github.com/tensorflow/docs/blob/master/site/en/guide/migrate/logging_stop_hook.ipynb @end_compatibilit...
StopAtStepHook
python
PrefectHQ__prefect
tests/test_tasks.py
{ "start": 168071, "end": 169538 }
class ____: def test_commit_hook_is_called_on_commit(self): data = {} @task def my_task(): pass @my_task.on_commit def commit(txn): data["txn"] = txn state = my_task(return_state=True) assert state.is_completed() assert stat...
TestTransactions
python
sanic-org__sanic
sanic/exceptions.py
{ "start": 3514, "end": 4095 }
class ____(SanicException): """A base class for other exceptions and should not be called directly.""" def __init__( self, message: Optional[Union[str, bytes]] = None, *, quiet: Optional[bool] = None, context: Optional[dict[str, Any]] = None, extra: Optional[dict...
HTTPException
python
astropy__astropy
astropy/nddata/tests/test_utils.py
{ "start": 15181, "end": 25627 }
class ____: def setup_class(self): self.data = np.arange(20.0).reshape(5, 4) self.position = SkyCoord("13h11m29.96s -01d19m18.7s", frame="icrs") wcs = WCS(naxis=2) rho = np.pi / 3.0 scale = 0.05 / 3600.0 wcs.wcs.cd = [ [scale * np.cos(rho), -scale * np.sin...
TestCutout2D
python
pytorch__pytorch
test/inductor/test_cuda_repro.py
{ "start": 2351, "end": 100035 }
class ____(TestCase): device = "cuda" common = check_model_cuda def test_mm_out_dtype_compile(self): a = torch.randn(1, 3, device="cuda", dtype=torch.float16) b = torch.randn(3, 2, device="cuda", dtype=torch.float16) def fn(x, y): return torch.mm(x, y, out_dtype=torch.f...
CudaReproTests
python
pytorch__pytorch
torch/_subclasses/fake_tensor.py
{ "start": 44697, "end": 45280 }
class ____: """ Information about the state of the FakeTensor dispatch cache. """ hits: int misses: int bypasses: dict[str, int] size: int # We keep one instantiation of `fake_tensor_converter` active # for the duration of `with FakeTensorMode()`. # This allows accurate storage aliasing a...
DispatchCacheInfo
python
facebook__pyre-check
stubs/integration_test/fixture_source/integration_test/list_comprehension.py
{ "start": 271, "end": 710 }
class ____: def run(self, command: str) -> str: sink(command) return "" def take_input() -> None: sinks: List[Sink] = [Sink()] result = [s.run(source()) for s in sinks] def inductive_comprehension_sink(arguments: List[str]) -> None: command = " ".join(argument.lower() for argument i...
Sink
python
plotly__plotly.py
plotly/graph_objs/scattergeo/marker/colorbar/title/_font.py
{ "start": 233, "end": 9964 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "scattergeo.marker.colorbar.title" _path_str = "scattergeo.marker.colorbar.title.font" _valid_props = { "color", "family", "lineposition", "shadow", "size", "style", "textcase", "variant",...
Font
python
geekcomputers__Python
venv/Lib/site-packages/pip/_vendor/rich/padding.py
{ "start": 420, "end": 4970 }
class ____(JupyterMixin): """Draw space around content. Example: >>> print(Padding("Hello", (2, 4), style="on blue")) Args: renderable (RenderableType): String or other renderable. pad (Union[int, Tuple[int]]): Padding for top, right, bottom, and left borders. May be sp...
Padding
python
plotly__plotly.py
plotly/graph_objs/scatterpolargl/unselected/_marker.py
{ "start": 233, "end": 4086 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "scatterpolargl.unselected" _path_str = "scatterpolargl.unselected.marker" _valid_props = {"color", "opacity", "size"} @property def color(self): """ Sets the marker color of unselected points, applied only when a selec...
Marker
python
davidhalter__jedi
test/completion/parser.py
{ "start": 678, "end": 744 }
class ____(object): @property #? ['str'] def bar(x=str
Foo
python
getsentry__sentry
src/sentry/integrations/jira/views/sentry_installation.py
{ "start": 610, "end": 1826 }
class ____(JiraSentryUIBaseView): """ Handles requests (from the Sentry integration in Jira) for HTML to display when setting up the integration in the Jira UI. """ html_file = "sentry/integrations/jira-config.html" def get(self, request: Request, *args, **kwargs) -> Response: try: ...
JiraSentryInstallationView
python
django__django
tests/gis_tests/geo3d/tests.py
{ "start": 4519, "end": 9795 }
class ____(Geo3DLoadingHelper, TestCase): """ Only a subset of the PostGIS routines are 3D-enabled, and this TestCase tries to test the features that can handle 3D and that are also available within GeoDjango. For more information, see the PostGIS docs on the routines that support 3D: https://p...
Geo3DTest
python
pytorch__pytorch
test/dynamo/cpython/3_13/test_set.py
{ "start": 39285, "end": 39931 }
class ____(_TestBasicOps, __TestCase): def setUp(self): self.enterContext(warnings_helper.check_warnings()) warnings.simplefilter('ignore', BytesWarning) self.case = "string and bytes set" self.values = ["a", "b", b"a", b"b"] self.set = set(self.values) self.dup ...
TestBasicOpsMixedStringBytes
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pyupgrade/UP050.py
{ "start": 378, "end": 495 }
class ____( A, # comment metaclass=type, ): ... def foo(): class A(metaclass=type): ...
B
python
sqlalchemy__sqlalchemy
test/orm/test_lazy_relations.py
{ "start": 1477, "end": 29823 }
class ____(_fixtures.FixtureTest): run_inserts = "once" run_deletes = None def test_basic(self): users, Address, addresses, User = ( self.tables.users, self.classes.Address, self.tables.addresses, self.classes.User, ) self.mapper_regi...
LazyTest
python
allegroai__clearml
clearml/backend_interface/metrics/events.py
{ "start": 7323, "end": 7863 }
class ____(MetricsEventAdapter): def __init__(self, metric: str, variant: str, src: str, iter: int = 0, **kwargs: Any) -> None: self._url = src parts = urlparse(src) self._key = urlunparse(("", "", parts.path, parts.params, parts.query, parts.fragment)) super(ImageEventNoUpload, self...
ImageEventNoUpload
python
apache__airflow
providers/opensearch/src/airflow/providers/opensearch/operators/opensearch.py
{ "start": 5724, "end": 8006 }
class ____(BaseOperator): """ Add a new document to a given Index or overwrite an existing one. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:OpenSearchAddDocumentOperator` :param index_name: The name of the index to put t...
OpenSearchAddDocumentOperator
python
walkccc__LeetCode
solutions/278. First Bad Version/278.py
{ "start": 0, "end": 205 }
class ____: def firstBadVersion(self, n: int) -> int: l = 1 r = n while l < r: m = (l + r) >> 1 if isBadVersion(m): r = m else: l = m + 1 return l
Solution
python
pytorch__pytorch
torch/testing/_internal/common_quantization.py
{ "start": 68051, "end": 68423 }
class ____(nn.Module): def __init__(self) -> None: super().__init__() self.subm = TwoLayerLinearModel() self.fc = nn.Linear(5, 5) def forward(self, x): x = self.subm(x) x = self.fc(x) return x def get_example_inputs(self) -> tuple[Any, ...]: return s...
LinearModelWithSubmodule
python
allegroai__clearml
clearml/utilities/requests_toolbelt/multipart/decoder.py
{ "start": 481, "end": 850 }
class ____(Exception): pass def _header_parser(string, encoding): major = sys.version_info[0] if major == 3: string = string.decode(encoding) headers = email.parser.HeaderParser().parsestr(string).items() return ( (encode_with(k, encoding), encode_with(v, encoding)) for k, ...
NonMultipartContentTypeException
python
pyqtgraph__pyqtgraph
pyqtgraph/flowchart/library/Data.py
{ "start": 13164, "end": 13543 }
class ____(CtrlNode): """Calculate the standard deviation of an array across an axis. """ nodeName = 'Stdev' uiTemplate = [ ('axis', 'intSpin', {'value': -0, 'min': -1, 'max': 1000000}), ] def processData(self, data): s = self.stateGroup.state() ax = None if s['axis'...
Stdev
python
squidfunk__mkdocs-material
material/plugins/blog/structure/options.py
{ "start": 1654, "end": 2110 }
class ____(Dict[str, datetime]): # Initialize date dictionary def __init__(self, data: dict): super().__init__(data) # Ensure presence of `date.created` self.created: datetime = data["created"] # Allow attribute access def __getattr__(self, name: str): if name in self:...
DateDict
python
encode__httpx
httpx/_client.py
{ "start": 4555, "end": 5330 }
class ____(AsyncByteStream): """ An async byte stream that is bound to a given response instance, and that ensures the `response.elapsed` is set once the response is closed. """ def __init__( self, stream: AsyncByteStream, response: Response, start: float ) -> None: self._stream...
BoundAsyncStream
python
realpython__materials
python-class/animals.py
{ "start": 383, "end": 460 }
class ____(Mammal): def walk(self): print("The cat is walking")
Cat
python
readthedocs__readthedocs.org
readthedocs/core/migrations/0013_add_optout_email_config_file_deprecation.py
{ "start": 149, "end": 991 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("core", "0012_add_newsletter_setting"), ] operations = [ migrations.AddField( model_name="historicaluserprofile", name="optout_email_config_file_deprecation", field=models....
Migration
python
networkx__networkx
networkx/algorithms/centrality/tests/test_katz_centrality.py
{ "start": 9958, "end": 10727 }
class ____(TestKatzCentralityDirected): @classmethod def setup_class(cls): global np np = pytest.importorskip("numpy") pytest.importorskip("scipy") super().setup_class() def test_katz_centrality_weighted(self): G = self.G alpha = self.G.alpha p = nx.k...
TestKatzCentralityDirectedNumpy
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/mysql/dml.py
{ "start": 1754, "end": 3183 }
class ____(SyntaxExtension, ClauseElement): stringify_dialect = "mysql" __visit_name__ = "mysql_dml_limit_clause" _traverse_internals: _TraverseInternalsType = [ ("_limit_clause", InternalTraversal.dp_clauseelement), ] def __init__(self, limit: _LimitOffsetType): self._limit_clause...
DMLLimitClause
python
run-llama__llama_index
llama-index-core/llama_index/core/agent/workflow/multi_agent_workflow.py
{ "start": 2797, "end": 2918 }
class ____(WorkflowMeta, ABCMeta): """Metaclass for AgentWorkflow that inherits from WorkflowMeta."""
AgentWorkflowMeta
python
crytic__slither
plugin_example/slither_my_plugin/detectors/example.py
{ "start": 91, "end": 823 }
class ____(AbstractDetector): # pylint: disable=too-few-public-methods """ Documentation """ ARGUMENT = "mydetector" # slither will launch the detector with slither.py --mydetector HELP = "Help printed by slither" IMPACT = DetectorClassification.HIGH CONFIDENCE = DetectorClassification.HI...
Example
python
getsentry__sentry
tests/sentry/uptime/endpoints/test_organization_uptime_summary.py
{ "start": 12561, "end": 14950 }
class ____(OrganizationUptimeSummaryBaseTest, UptimeResultEAPTestCase): __test__ = True def store_uptime_data( self, subscription_id, check_status, incident_status=IncidentStatus.NO_INCIDENT, scheduled_check_time=None, check_duration_us=None, ): kwarg...
OrganizationUptimeSummaryEAPTest
python
ansible__ansible
lib/ansible/module_utils/_internal/_datatag/__init__.py
{ "start": 13816, "end": 16062 }
class ____(AnsibleSerializable, metaclass=abc.ABCMeta): _validation_allow_subclasses = True _validation_auto_enabled = True def _as_dict(self) -> t.Dict[str, t.Any]: # omit None values when None is the field default # DTFIX-FUTURE: this implementation means we can never change the default o...
AnsibleSerializableDataclass