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
sympy__sympy
doc/src/_pygments/styles.py
{ "start": 634, "end": 2255 }
class ____(Style): """ Like Sphinx (which is like friendly, but a bit darker to enhance contrast on the green background) but with higher contrast colors. """ @property def _pre_style(self): # This is used instead of the default 125% so that multiline Unicode # pprint output lo...
SphinxHighContrastStyle
python
pytorch__pytorch
test/package/package_a/test_module.py
{ "start": 108, "end": 309 }
class ____(torch.nn.Module): def __init__(self, script_mod): super().__init__() self.script_mod = script_mod def forward(self, x): return self.script_mod(x)
ModWithSubmod
python
ansible__ansible
lib/ansible/modules/hostname.py
{ "start": 6161, "end": 6803 }
class ____(BaseStrategy): FILE = '/etc/hostname' def get_permanent_hostname(self): if not os.path.isfile(self.FILE): return '' try: return get_file_content(self.FILE, default='', strip=True) except Exception as e: self.module.fail_json( ...
FileStrategy
python
encode__django-rest-framework
rest_framework/viewsets.py
{ "start": 8878, "end": 9292 }
class ____(mixins.CreateModelMixin, mixins.RetrieveModelMixin, mixins.UpdateModelMixin, mixins.DestroyModelMixin, mixins.ListModelMixin, GenericViewSet): """ A viewset that provides default `create()`, `retrieve()`, `...
ModelViewSet
python
jazzband__django-waffle
waffle/templatetags/waffle_tags.py
{ "start": 2294, "end": 2498 }
class ____(template.Node): def render(self, context): return _generate_waffle_js(context['request']) @register.tag def wafflejs(parser, token): return InlineWaffleJSNode()
InlineWaffleJSNode
python
optuna__optuna
optuna/cli.py
{ "start": 19510, "end": 21349 }
class ____(_BaseCommand): """Show a list of trials located at the Pareto front.""" def add_arguments(self, parser: ArgumentParser) -> None: parser.add_argument( "--study-name", type=str, required=True, help="The name of the study to get the best trials (t...
_BestTrials
python
ray-project__ray
python/ray/tune/experimental/output.py
{ "start": 27752, "end": 31013 }
class ____(TuneReporterBase): def experiment_started( self, experiment_name: str, experiment_path: str, searcher_str: str, scheduler_str: str, total_num_samples: int, tensorboard_path: Optional[str] = None, **kwargs, ): if total_num_samples...
TuneTerminalReporter
python
apache__airflow
airflow-core/tests/unit/api_fastapi/auth/managers/test_base_auth_manager.py
{ "start": 4907, "end": 20537 }
class ____: def test_get_cli_commands_return_empty_list(self, auth_manager): assert auth_manager.get_cli_commands() == [] def test_get_fastapi_app_return_none(self, auth_manager): assert auth_manager.get_fastapi_app() is None def test_refresh_user_default_returns_none(self, auth_manager): ...
TestBaseAuthManager
python
ray-project__ray
rllib/policy/tests/test_policy_state_swapping.py
{ "start": 337, "end": 4676 }
class ____(unittest.TestCase): """Tests, whether Policies' states can be swapped out via their state on a GPU.""" @classmethod def setUpClass(cls) -> None: ray.init() @classmethod def tearDownClass(cls) -> None: ray.shutdown() def test_policy_swap_gpu(self): config = (...
TestPolicyStateSwapping
python
apache__airflow
providers/amazon/tests/unit/amazon/aws/utils/eks_test_constants.py
{ "start": 4191, "end": 4417 }
class ____: """All possible inputs for creating an AWS Fargate profile.""" REQUIRED: list[tuple[str, Any]] = [POD_EXECUTION_ROLE_ARN, SELECTORS] OPTIONAL: list[tuple[str, Any]] = [SUBNETS, TAGS]
FargateProfileInputs
python
ray-project__ray
rllib/models/preprocessors.py
{ "start": 5973, "end": 7083 }
class ____(Preprocessor): """One-hot preprocessor for Discrete and MultiDiscrete spaces. .. testcode:: :skipif: True self.transform(Discrete(3).sample()) .. testoutput:: np.array([0.0, 1.0, 0.0]) .. testcode:: :skipif: True self.transform(MultiDiscrete([2, 3...
OneHotPreprocessor
python
django__django
tests/field_deconstruction/tests.py
{ "start": 217, "end": 30248 }
class ____(SimpleTestCase): """ Tests the deconstruct() method on all core fields. """ def test_name(self): """ Tests the outputting of the correct name if assigned one. """ # First try using a "normal" field field = models.CharField(max_length=65) name, ...
FieldDeconstructionTests
python
getsentry__sentry
tests/sentry/ratelimits/utils/test_above_rate_limit_check.py
{ "start": 413, "end": 3674 }
class ____(TestCase): group = RateLimitConfig().group def test_above_rate_limit_check(self) -> None: with freeze_time("2000-01-01"): expected_reset_time = int(time() + 100) return_val = above_rate_limit_check( "foo", RateLimit(limit=10, window=100), "request_uid"...
RatelimitMiddlewareTest
python
spack__spack
lib/spack/spack/test/util/path.py
{ "start": 4625, "end": 10090 }
class ____: @pytest.mark.parametrize("padded,fixed", zip(padded_lines, fixed_lines)) def test_padding_substitution(self, padded, fixed): """Ensure that all padded lines are unpadded correctly.""" assert fixed == sup.padding_filter(padded) def test_no_substitution(self): """Ensure th...
TestPathPadding
python
anthropics__anthropic-sdk-python
src/anthropic/types/beta/beta_raw_content_block_start_event.py
{ "start": 1866, "end": 2067 }
class ____(BaseModel): content_block: ContentBlock """Response model for a file uploaded to the container.""" index: int type: Literal["content_block_start"]
BetaRawContentBlockStartEvent
python
gevent__gevent
src/gevent/exceptions.py
{ "start": 1607, "end": 1811 }
class ____(AssertionError): """ Raised when a gevent synchronous function is called from a low-level event loop callback. This is usually a programming error. """
BlockingSwitchOutError
python
numpy__numpy
numpy/tests/test_warnings.py
{ "start": 485, "end": 2420 }
class ____(ast.NodeVisitor): def __init__(self, filename): super().__init__() self.__filename = filename def visit_Call(self, node): p = ParseCall() p.visit(node.func) ast.NodeVisitor.generic_visit(self, node) if p.ls[-1] == 'simplefilter' or p.ls[-1] == 'filter...
FindFuncs
python
python__mypy
mypy/stubgen.py
{ "start": 13781, "end": 14854 }
class ____(mypy.traverser.TraverserVisitor): """Find names of things defined at the top level of a module.""" def __init__(self) -> None: # Short names of things defined at the top level. self.names: set[str] = set() def visit_class_def(self, o: ClassDef) -> None: # Don't recurse i...
DefinitionFinder
python
ray-project__ray
python/ray/experimental/channel/communicator_handle.py
{ "start": 38, "end": 689 }
class ____: """ A lightweight communicator handle used by the driver to store handles to the actors in the communicator. """ def __init__( self, actor_handles: List["ray.actor.ActorHandle"], ): """ Initializes the CommunicatorHandle with the given actor handles. ...
CommunicatorHandle
python
dask__dask
dask/dataframe/dask_expr/_reductions.py
{ "start": 11822, "end": 17645 }
class ____(Expr): """Perform reduction-like operation on dataframes This pattern is commonly used for reductions, groupby-aggregations, and more. It requires three methods to be implemented: - `chunk`: applied to each input partition - `combine`: applied to lists of intermediate partitions as...
ApplyConcatApply
python
bokeh__bokeh
src/bokeh/document/events.py
{ "start": 25866, "end": 27702 }
class ____(DocumentPatchedEvent): ''' A concrete event representing a change to remove an existing Model from a Document's collection of "root" models. ''' kind = "RootRemoved" def __init__(self, document: Document, model: Model, setter: Setter | None = None, callback_invoker: Invoker | None = No...
RootRemovedEvent
python
walkccc__LeetCode
solutions/2892. Minimizing Array After Replacing Pairs With Their Product/2892.py
{ "start": 0, "end": 291 }
class ____: def minArrayLength(self, nums: list[int], k: int) -> int: count = 0 prod = -1 for num in nums: if num == 0: return 1 if prod != -1 and prod * num <= k: prod *= num else: prod = num count += 1 return count
Solution
python
run-llama__llama_index
llama-index-core/llama_index/core/instrumentation/events/chat_engine.py
{ "start": 334, "end": 591 }
class ____(BaseEvent): """ StreamChatEndEvent. Fired at the end of writing to the stream chat-engine queue. """ @classmethod def class_name(cls) -> str: """Class name.""" return "StreamChatEndEvent"
StreamChatEndEvent
python
getsentry__sentry
src/sentry/issues/ownership/grammar.py
{ "start": 2929, "end": 7560 }
class ____(namedtuple("Matcher", "type pattern")): """ A Matcher represents a type:pattern pairing for use in comparing with an Event. type is either `path`, `tags`, `url`, `module` or `codeowners` at this point. TODO(mattrobenolt): pattern needs to be parsed into a regex Examples: ur...
Matcher
python
pytorch__pytorch
test/distributed/launcher/api_test.py
{ "start": 3031, "end": 3137 }
class ____(Exception): pass def short_hash(): return str(uuid.uuid4()).split("-")[0]
MockException
python
pandas-dev__pandas
pandas/tests/window/test_groupby.py
{ "start": 1159, "end": 36048 }
class ____: def test_groupby_unsupported_argument(self, roll_frame): msg = r"groupby\(\) got an unexpected keyword argument 'foo'" with pytest.raises(TypeError, match=msg): roll_frame.groupby("A", foo=1) def test_getitem(self, roll_frame): g = roll_frame.groupby("A") ...
TestRolling
python
great-expectations__great_expectations
great_expectations/expectations/metrics/table_metrics/table_head.py
{ "start": 878, "end": 4641 }
class ____(TableMetricProvider): metric_name = "table.head" value_keys = ("n_rows", "fetch_all") default_kwarg_values = {"n_rows": 5, "fetch_all": False} @metric_value(engine=PandasExecutionEngine) def _pandas( cls, execution_engine: PandasExecutionEngine, metric_domain_kwar...
TableHead
python
langchain-ai__langchain
libs/langchain_v1/langchain/agents/structured_output.py
{ "start": 3262, "end": 5691 }
class ____(Generic[SchemaT]): """Describes a structured output schema.""" schema: type[SchemaT] """The schema for the response, can be a Pydantic model, `dataclass`, `TypedDict`, or JSON schema dict.""" name: str """Name of the schema, used for tool calling. If not provided, the name will...
_SchemaSpec
python
airbytehq__airbyte
airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/connectors/test/steps/python_connectors.py
{ "start": 11077, "end": 14038 }
class ____(PytestStep): """A step to run the connector integration tests with Pytest.""" title = "Integration tests" test_directory_name = "integration_tests" bind_to_docker_host = True def get_test_steps(context: ConnectorTestContext) -> STEP_TREE: """ Get all the tests steps for a Python c...
IntegrationTests
python
walkccc__LeetCode
solutions/3176. Find the Maximum Length of a Good Subsequence I/3176.py
{ "start": 0, "end": 727 }
class ____: def maximumLength(self, nums: list[int], k: int) -> int: # dp[count][num] := the maximum length of a good subsequence with at most # `count` indices where seq[i] != seq[i + 1] and it ends in `num`. dp = [collections.Counter() for _ in range(k + 1)] # maxLen[count] := the maximum length of ...
Solution
python
kamyu104__LeetCode-Solutions
Python/closest-subsequence-sum.py
{ "start": 61, "end": 1455 }
class ____(object): def minAbsDifference(self, nums, goal): """ :type nums: List[int] :type goal: int :rtype: int """ mx, mn = sum(x for x in nums if x > 0), sum(x for x in nums if x < 0) if goal > mx: return goal-mx if goal < mn: ...
Solution
python
gevent__gevent
src/greentest/3.11/signalinterproctester.py
{ "start": 164, "end": 3151 }
class ____(unittest.TestCase): def setUp(self): self.got_signals = {'SIGHUP': 0, 'SIGUSR1': 0, 'SIGALRM': 0} def sighup_handler(self, signum, frame): self.got_signals['SIGHUP'] += 1 def sigusr1_handler(self, signum, frame): self.got_signals['SIGUSR1'] += 1 raise SIGUSR1Exce...
InterProcessSignalTests
python
walkccc__LeetCode
solutions/472. Concatenated Words/472.py
{ "start": 0, "end": 445 }
class ____: def findAllConcatenatedWordsInADict(self, words: list[str]) -> list[str]: wordSet = set(words) @functools.lru_cache(None) def isConcat(word: str) -> bool: for i in range(1, len(word)): prefix = word[:i] suffix = word[i:] if prefix in wordSet and (suffix in wordSe...
Solution
python
PrefectHQ__prefect
src/prefect/server/database/orm_models.py
{ "start": 45131, "end": 45782 }
class ____(Base): __table_args__: Any = ( sa.Index( "uq_composite_trigger_child_firing__a_id__pt_id__ct__id", "automation_id", "parent_trigger_id", "child_trigger_id", unique=True, ), ) automation_id: Mapped[uuid.UUID] = mapped_col...
CompositeTriggerChildFiring
python
spack__spack
lib/spack/spack/fetch_strategy.py
{ "start": 66450, "end": 66930 }
class ____(spack.error.FetchError): """Raised when a version can't be deduced from a set of arguments.""" def __init__(self, pkg=None, version=None, **args): msg = "Could not guess a fetch strategy" if pkg: msg += " for {pkg}".format(pkg=pkg) if version: ...
InvalidArgsError
python
numba__numba
numba/tests/test_typeinfer.py
{ "start": 28710, "end": 29052 }
class ____(FunctionPass): """Dummy pass to add "cr" to compiler state to avoid errors in TyperCompiler since it doesn't have lowering. """ _name = "dummy_cr" def __init__(self): FunctionPass.__init__(self) def run_pass(self, state): state.cr = 1 # arbitrary non-None value ...
DummyCR
python
fastapi__sqlmodel
docs_src/tutorial/one/tutorial008_py310.py
{ "start": 63, "end": 1503 }
class ____(SQLModel, table=True): id: int | None = Field(default=None, primary_key=True) name: str = Field(index=True) secret_name: str age: int | None = Field(default=None, index=True) sqlite_file_name = "database.db" sqlite_url = f"sqlite:///{sqlite_file_name}" engine = create_engine(sqlite_url, ec...
Hero
python
PrefectHQ__prefect
src/prefect/context.py
{ "start": 16653, "end": 18002 }
class ____(RunContext): """ The context for a task run. Data in this context is only available from within a task run function. Attributes: task: The task instance associated with the task run task_run: The API metadata for this task run """ task: "Task[Any, Any]" task_run:...
TaskRunContext
python
wandb__wandb
wandb/sdk/artifacts/_generated/artifact_used_by.py
{ "start": 254, "end": 336 }
class ____(GQLResult): artifact: Optional[ArtifactUsedByArtifact]
ArtifactUsedBy
python
django__django
django/db/models/functions/window.py
{ "start": 292, "end": 404 }
class ____(Func): function = "CUME_DIST" output_field = FloatField() window_compatible = True
CumeDist
python
sphinx-doc__sphinx
tests/roots/test-root/autodoc_target.py
{ "start": 1375, "end": 1468 }
class ____(Base): def inheritedmeth(self): # no docstring here pass
Derived
python
kamyu104__LeetCode-Solutions
Python/largest-palindrome-product.py
{ "start": 1003, "end": 1751 }
class ____(object): def largestPalindrome(self, n): """ :type n: int :rtype: int """ def divide_ceil(a, b): return (a+b-1)//b if n == 1: return 9 upper, lower = 10**n-1, 10**(n-1) for i in reversed(xrange(lower, upper**2//(10**...
Solution2
python
sqlalchemy__sqlalchemy
test/orm/inheritance/test_relationship.py
{ "start": 62151, "end": 64263 }
class ____( fixtures.DeclarativeMappedTest, testing.AssertsCompiledSQL ): """test for #5107""" __dialect__ = "default" @classmethod def setup_classes(cls): Base = cls.DeclarativeBasic class X(Base): __tablename__ = "x" id = Column(Integer, primary_key=True)...
ContainsEagerMultipleOfType
python
keon__algorithms
algorithms/tree/trie/add_and_search.py
{ "start": 367, "end": 542 }
class ____(object): def __init__(self, letter, is_terminal=False): self.children = dict() self.letter = letter self.is_terminal = is_terminal
TrieNode
python
google__pytype
pytype/tools/xref/kythe.py
{ "start": 377, "end": 499 }
class ____: signature: str path: str language: str root: str corpus: str @dataclasses.dataclass(frozen=True)
VName
python
dagster-io__dagster
python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/generated/sources.py
{ "start": 67091, "end": 67823 }
class ____(GeneratedAirbyteSource): @public def __init__(self, name: str, api_key: str, start_date: str): """Airbyte Source for Klaviyo. Documentation can be found at https://docs.airbyte.com/integrations/sources/klaviyo Args: name (str): The name of the destination. ...
KlaviyoSource
python
ijl__orjson
test/test_enum.py
{ "start": 337, "end": 378 }
class ____(enum.auto): A = "a"
AutoEnum
python
scipy__scipy
scipy/optimize/_shgo_lib/_vertex.py
{ "start": 1878, "end": 4530 }
class ____(VertexBase): """ Add homology properties of a scalar field f: R^n --> R associated with the geometry built from the VertexBase class """ def __init__(self, x, field=None, nn=None, index=None, field_args=(), g_cons=None, g_cons_args=()): """ Parameters ...
VertexScalarField
python
networkx__networkx
networkx/algorithms/tests/test_node_classification.py
{ "start": 2570, "end": 4663 }
class ____: def test_path_graph(self): G = nx.path_graph(4) label_name = "label" G.nodes[0][label_name] = "A" G.nodes[3][label_name] = "B" predicted = node_classification.local_and_global_consistency( G, label_name=label_name ) assert predicted[0] ...
TestLocalAndGlobalConsistency
python
kamyu104__LeetCode-Solutions
Python/find-the-encrypted-string.py
{ "start": 38, "end": 252 }
class ____(object): def getEncryptedString(self, s, k): """ :type s: str :type k: int :rtype: str """ return "".join(s[(i+k)%len(s)] for i in xrange(len(s)))
Solution
python
pytorch__pytorch
test/dynamo/test_streams.py
{ "start": 18245, "end": 22900 }
class ____(torch.nn.Module): def forward(self, tangents_1: "f32[2, 2]", tangents_2: "f32[2, 2]"): # Annotation: {'stream': 0} mul_2: "f32[2, 2]" = torch.ops.aten.mul.Tensor(tangents_2, 2) # add_2: "f32[2, 2]" = torch.ops.aten.add.Tensor(tangents_2, tangents_1); tangents_2 = None ...
GraphModule
python
numba__numba
numba/tests/test_listobject.py
{ "start": 14617, "end": 17699 }
class ____(MemoryLeakMixin, TestCase): """Test list setitem. """ def test_list_setitem_singleton(self): @njit def foo(n): l = listobject.new_list(int32) l.append(0) l[0] = n return l[0] for i in (0, 1, 2, 100): self.assertEqua...
TestSetitem
python
django__django
django/contrib/postgres/fields/hstore.py
{ "start": 436, "end": 2529 }
class ____(CheckPostgresInstalledMixin, CheckFieldDefaultMixin, Field): empty_strings_allowed = False description = _("Map of strings to strings/nulls") default_error_messages = { "not_a_string": _("The value of “%(key)s” is not a string or null."), } _default_hint = ("dict", "{}") def ...
HStoreField
python
dagster-io__dagster
python_modules/dagster/dagster/components/component/component.py
{ "start": 2982, "end": 15387 }
class ____(ABC): """Abstract base class for creating Dagster components. Components are the primary building blocks for programmatically creating Dagster definitions. They enable building multiple interrelated definitions for specific use cases, provide schema-based configuration, and built-in scaffold...
Component
python
apache__airflow
providers/teradata/src/airflow/providers/teradata/operators/bteq.py
{ "start": 1699, "end": 12656 }
class ____(BaseOperator): """ Teradata Operator to execute SQL Statements or BTEQ (Basic Teradata Query) scripts using Teradata BTEQ utility. This supports execution of BTEQ scripts either locally or remotely via SSH. The BTEQ scripts are used to interact with Teradata databases, allowing users to per...
BteqOperator
python
django__django
django/contrib/postgres/indexes.py
{ "start": 6027, "end": 6894 }
class ____(PostgresIndex): suffix = "gist" def __init__(self, *expressions, buffering=None, fillfactor=None, **kwargs): self.buffering = buffering self.fillfactor = fillfactor super().__init__(*expressions, **kwargs) def deconstruct(self): path, args, kwargs = super().decon...
GistIndex
python
keras-team__keras
keras/src/ops/math.py
{ "start": 6379, "end": 7727 }
class ____(Operation): def __init__(self, k, *, name=None): super().__init__(name=name) self.k = k def compute_output_spec(self, targets, predictions): return KerasTensor(shape=targets.shape, dtype="bool") def call(self, targets, predictions): return backend.math.in_top_k(t...
InTopK
python
wandb__wandb
wandb/sdk/artifacts/_generated/input_types.py
{ "start": 5395, "end": 5615 }
class ____(GQLInput): aliases: List[ArtifactCollectionAliasInput] artifact_id: GQLId = Field(alias="artifactID") client_mutation_id: Optional[str] = Field(alias="clientMutationId", default=None)
AddAliasesInput
python
aio-libs__aiohttp
aiohttp/helpers.py
{ "start": 27920, "end": 28006 }
class ____(BaseKey[_T]): """Keys for static typing support in Application."""
AppKey
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 932373, "end": 933571 }
class ____(sgqlc.types.Type): """An error in a `CODEOWNERS` file.""" __schema__ = github_schema __field_names__ = ("column", "kind", "line", "message", "path", "source", "suggestion") column = sgqlc.types.Field(sgqlc.types.non_null(Int), graphql_name="column") """The column number where the error o...
RepositoryCodeownersError
python
PrefectHQ__prefect
src/prefect/server/utilities/messaging/__init__.py
{ "start": 917, "end": 1295 }
class ____(abc.ABC): @abc.abstractmethod async def clear_recently_seen_messages(self) -> None: ... @abc.abstractmethod async def without_duplicates( self, attribute: str, messages: Iterable[M] ) -> list[M]: ... @abc.abstractmethod async def forget_duplicates( self, attribut...
Cache
python
pytorch__pytorch
torch/__init__.py
{ "start": 71201, "end": 71423 }
class ____(_LegacyStorage): @classproperty def dtype(self): _warn_typed_storage_removal(stacklevel=3) return self._dtype @classproperty def _dtype(self): return torch.long
LongStorage
python
mitmproxy__pdoc
test/testdata/type_stubs/__init__.py
{ "start": 187, "end": 653 }
class ____: attr = 42 """An attribute""" def meth(self, y): """A simple method.""" class Subclass: attr = "42" """An attribute""" def meth(self, y): """A simple method.""" def no_type_annotation(self, z): """A method not present in the .pyi fil...
Class
python
ansible__ansible
lib/ansible/errors/__init__.py
{ "start": 8888, "end": 9301 }
class ____(AnsibleTemplateError): """Raised when processing was requested on an untrusted template or expression.""" _default_message = 'Encountered untrusted template or expression.' _default_help_text = ('Templates and expressions must be defined by trusted sources such as playbooks or roles, ' ...
TemplateTrustCheckFailedError
python
mlflow__mlflow
tests/store/artifact/test_artifact_repo.py
{ "start": 642, "end": 1075 }
class ____(ArtifactRepository): def log_artifact(self, local_file, artifact_path=None): raise NotImplementedError() def log_artifacts(self, local_dir, artifact_path=None): raise NotImplementedError() def list_artifacts(self, path): raise NotImplementedError() def _download_fil...
ArtifactRepositoryImpl
python
mlflow__mlflow
mlflow/genai/labeling/labeling.py
{ "start": 492, "end": 1097 }
class ____: """The agent configuration, used for generating responses in the review app. .. note:: This functionality is only available in Databricks. Please run `pip install mlflow[databricks]` to use it. """ def __init__(self, agent: "_Agent"): self._agent = agent @prope...
Agent
python
spyder-ide__spyder
spyder/utils/syntaxhighlighters.py
{ "start": 5868, "end": 13692 }
class ____(QSyntaxHighlighter): """Base Syntax Highlighter Class""" # Syntax highlighting rules: PROG = None BLANKPROG = re.compile(r"\s+") # Syntax highlighting states (from one text block to another): NORMAL = 0 # Syntax highlighting parameters. BLANK_ALPHA_FACTOR = 0.31 sig_outli...
BaseSH
python
readthedocs__readthedocs.org
readthedocs/projects/migrations/0022_add-alias-slug.py
{ "start": 149, "end": 656 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("projects", "0021_add-webhook-deprecation-feature"), ] operations = [ migrations.AlterField( model_name="projectrelationship", name="alias", field=models.SlugField( ...
Migration
python
xlwings__xlwings
xlwings/conversion/standard.py
{ "start": 779, "end": 1054 }
class ____: def __init__(self, options): self.expand = options.get("expand", None) def __call__(self, c): if c.range: # auto-expand the range if self.expand: c.range = c.range.expand(self.expand)
ExpandRangeStage
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pyflakes/F401_33/__init__.py
{ "start": 96, "end": 178 }
class ____: def __init__(self) -> None: from F401_33.other import Ham
Spam
python
docker__docker-py
tests/integration/models_swarm_test.py
{ "start": 107, "end": 1620 }
class ____(unittest.TestCase): def setUp(self): helpers.force_leave_swarm(docker.from_env(version=TEST_API_VERSION)) def tearDown(self): helpers.force_leave_swarm(docker.from_env(version=TEST_API_VERSION)) def test_init_update_leave(self): client = docker.from_env(version=TEST_API_...
SwarmTest
python
spack__spack
lib/spack/spack/vendor/ruamel/yaml/resolver.py
{ "start": 11958, "end": 15564 }
class ____(BaseResolver): """ contrary to the "normal" resolver, the smart resolver delays loading the pattern matching rules. That way it can decide to load 1.1 rules or the (default) 1.2 rules, that no longer support octal without 0o, sexagesimals and Yes/No/On/Off booleans. """ def __ini...
VersionedResolver
python
pallets__werkzeug
tests/test_datastructures.py
{ "start": 19178, "end": 25952 }
class ____: storage_class = ds.Headers def test_basic_interface(self): headers = self.storage_class() headers.add("Content-Type", "text/plain") headers.add("X-Foo", "bar") assert "x-Foo" in headers assert "Content-type" in headers with pytest.raises(ValueError):...
TestHeaders
python
scipy__scipy
benchmarks/benchmarks/go_benchmark_functions/go_funcs_E.py
{ "start": 6324, "end": 7476 }
class ____(Benchmark): r""" El-Attar-Vidyasagar-Dutta [1]_ objective function. This class defines the El-Attar-Vidyasagar-Dutta function global optimization problem. This is a multimodal minimization problem defined as follows: .. math:: f_{\text{ElAttarVidyasagarDutta}}(x) = (x_1^2 +...
ElAttarVidyasagarDutta
python
matplotlib__matplotlib
lib/matplotlib/tests/test_mlab.py
{ "start": 39876, "end": 42695 }
class ____: def test_evaluate_diff_dim(self): """ Test the evaluate method when the dim's of dataset and points have different dimensions. """ x1 = np.arange(3, 10, 2) kde = mlab.GaussianKDE(x1) x2 = np.arange(3, 12, 2) y_expected = [ 0.08...
TestGaussianKDEEvaluate
python
sphinx-doc__sphinx
sphinx/ext/autodoc/_dynamic/_mock.py
{ "start": 3239, "end": 3720 }
class ____(Loader): """A loader for mocking.""" def __init__(self, finder: MockFinder) -> None: super().__init__() self.finder = finder def create_module(self, spec: ModuleSpec) -> ModuleType: logger.debug('[autodoc] adding a mock module as %s!', spec.name) self.finder.mock...
MockLoader
python
walkccc__LeetCode
solutions/2295. Replace Elements in an Array/2295.py
{ "start": 0, "end": 369 }
class ____: def arrayChange( self, nums: list[int], operations: list[list[int]], ) -> list[int]: numToIndex = {num: i for i, num in enumerate(nums)} for original, replaced in operations: index = numToIndex[original] nums[index] = replaced del numToIndex[original] n...
Solution
python
openai__openai-python
src/openai/types/fine_tuning/dpo_method_param.py
{ "start": 259, "end": 414 }
class ____(TypedDict, total=False): hyperparameters: DpoHyperparametersParam """The hyperparameters used for the DPO fine-tuning job."""
DpoMethodParam
python
dask__dask
dask/dataframe/io/parquet/arrow.py
{ "start": 5297, "end": 13604 }
class ____: """Simple class providing a `name` and `keys` attribute for a single partition column. This class was originally designed as a mechanism to build a duck-typed version of pyarrow's deprecated `ParquetPartitions` class. Now that `ArrowLegacyEngine` is deprecated, this class can be mod...
PartitionObj
python
huggingface__transformers
src/transformers/models/qwen2_5_omni/modular_qwen2_5_omni.py
{ "start": 94804, "end": 95175 }
class ____(Qwen2_5_VLTextModel): config: Qwen2_5OmniTextConfig _no_split_modules = ["Qwen2_5OmniDecoderLayer"] def __init__(self, config: Qwen2_5OmniTextConfig): super().__init__(config) @auto_docstring( custom_intro=""" The Qwen2.5OmniThinker model which consists of a audio backbone and ...
Qwen2_5OmniThinkerTextModel
python
huggingface__transformers
src/transformers/models/bridgetower/modeling_bridgetower.py
{ "start": 16852, "end": 17557 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.intermediate_size, config.hidden_size) self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps) self.dropout = nn.Dropout(config.hidden_dropout_prob) def forwa...
BridgeTowerOutput
python
pallets__jinja
tests/test_core_tags.py
{ "start": 15779, "end": 19913 }
class ____: def test_normal(self, env_trim): tmpl = env_trim.from_string("{% set foo = 1 %}{{ foo }}") assert tmpl.render() == "1" assert tmpl.module.foo == 1 def test_block(self, env_trim): tmpl = env_trim.from_string("{% set foo %}42{% endset %}{{ foo }}") assert tmpl....
TestSet
python
sympy__sympy
sympy/polys/polytools.py
{ "start": 211950, "end": 223643 }
class ____(Basic): """Represents a reduced Groebner basis. """ def __new__(cls, F, *gens, **args): """Compute a reduced Groebner basis for a system of polynomials. """ options.allowed_flags(args, ['polys', 'method']) try: polys, opt = parallel_poly_from_expr(F, *gens, **arg...
GroebnerBasis
python
simonw__sqlite-utils
sqlite_utils/utils.py
{ "start": 12403, "end": 13692 }
class ____: def __init__(self): self.couldbe = {key: getattr(self, "test_" + key) for key in self.get_tests()} @classmethod def get_tests(cls): return [ key.split("test_")[-1] for key in cls.__dict__.keys() if key.startswith("test_") ] def te...
ValueTracker
python
tensorflow__tensorflow
tensorflow/python/framework/composite_tensor_gradient.py
{ "start": 3322, "end": 3489 }
class ____(Protocol): """Protocol for adding gradient support to CompositeTensors.""" __composite_gradient__: CompositeTensorGradient
CompositeTensorGradientProtocol
python
bottlepy__bottle
bottle.py
{ "start": 134966, "end": 135656 }
class ____(ServerAdapter): def run(self, handler): # pragma: no cover from cheroot import wsgi from cheroot.ssl import builtin self.options['bind_addr'] = (self.host, self.port) self.options['wsgi_app'] = handler certfile = self.options.pop('certfile', None) keyfile ...
CherootServer
python
scipy__scipy
scipy/linalg/tests/test_decomp.py
{ "start": 39898, "end": 48554 }
class ____: lapack_driver = 'gesdd' def test_degenerate(self): assert_raises(TypeError, svd, [[1.]], lapack_driver=1.) assert_raises(ValueError, svd, [[1.]], lapack_driver='foo') def test_simple(self): a = [[1, 2, 3], [1, 20, 3], [2, 5, 6]] for full_matrices in (True, False...
TestSVD_GESDD
python
python__mypy
mypyc/test-data/fixtures/ir.py
{ "start": 14134, "end": 14178 }
class ____(ArithmeticError): pass
OverflowError
python
PyCQA__pylint
tests/functional/c/classes_meth_could_be_a_function.py
{ "start": 265, "end": 496 }
class ____: # disable "method could be a function" on classes which are not overriding # the factory method because in that case the usage of polymorphism is not # detected def makex(self): return XAsub()
Aimpl
python
getsentry__sentry
src/sentry/analytics/events/sso_enabled.py
{ "start": 68, "end": 206 }
class ____(analytics.Event): user_id: int organization_id: int provider: str analytics.register(SSOEnabledEvent)
SSOEnabledEvent
python
django__django
tests/inspectdb/models.py
{ "start": 270, "end": 468 }
class ____(models.Model): from_field = models.ForeignKey(People, models.CASCADE, db_column="from_id") author = models.ForeignKey(People, models.CASCADE, related_name="message_authors")
Message
python
huggingface__transformers
src/transformers/models/janus/modular_janus.py
{ "start": 22989, "end": 23167 }
class ____(Blip2VisionModel): def __init__(self, config: JanusVisionConfig): super().__init__(config) self.encoder = JanusVisionEncoder(config)
JanusVisionModel
python
PyCQA__pylint
pylint/config/_breaking_changes/__init__.py
{ "start": 1998, "end": 2133 }
class ____(NamedTuple): option: list[str] | str description: str | None = None new_value: str | None = None
OptionInformation
python
PyCQA__pylint
tests/functional/m/method_hidden.py
{ "start": 1011, "end": 1317 }
class ____: def __init__(self): self._bar = 42 self._baz = 84 @my_decorator def method(self): # E0202 return self._baz @method.setter def method(self, value): self._baz = value def do_something_with_baz(self, value): self.method = value
Foo
python
ijl__orjson
test/test_type.py
{ "start": 140, "end": 17790 }
class ____: def test_fragment(self): """ orjson.JSONDecodeError on fragments """ for val in ("n", "{", "[", "t"): pytest.raises(orjson.JSONDecodeError, orjson.loads, val) def test_invalid(self): """ orjson.JSONDecodeError on invalid """ ...
TestType
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/mysql/dml.py
{ "start": 3183, "end": 7560 }
class ____(StandardInsert): """MySQL-specific implementation of INSERT. Adds methods for MySQL-specific syntaxes such as ON DUPLICATE KEY UPDATE. The :class:`~.mysql.Insert` object is created using the :func:`sqlalchemy.dialects.mysql.insert` function. """ stringify_dialect = "mysql" inh...
Insert
python
spack__spack
var/spack/test_repos/spack_repo/builtin_mock/packages/virtual_abi_2/package.py
{ "start": 217, "end": 614 }
class ____(Package): """ This package provides `virtual-with-abi` and is conditionally ABI compatible with `virtual-abi-multi` """ homepage = "https://www.example.com" has_code = False version("1.0") provides("virtual-with-abi") can_splice("virtual-abi-multi@1.0 abi=two", when="@...
VirtualAbi2
python
airbytehq__airbyte
airbyte-integrations/connectors/destination-qdrant/destination_qdrant/config.py
{ "start": 1879, "end": 1959 }
class ____(VectorDBConfigModel): indexing: QdrantIndexingConfigModel
ConfigModel
python
numba__numba
numba/tests/test_linalg.py
{ "start": 88450, "end": 91243 }
class ____(TestLinalgBase): """ Tests for np.trace. """ def setUp(self): super(TestTrace, self).setUp() # compile two versions, one with and one without the offset kwarg self.cfunc_w_offset = jit(nopython=True)(trace_matrix) self.cfunc_no_offset = jit(nopython=True)(trac...
TestTrace
python
weaviate__weaviate-python-client
weaviate/collections/classes/config.py
{ "start": 8856, "end": 8930 }
class ____(_ConfigCreateModel): b: float k1: float
_BM25ConfigCreate