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
getsentry__sentry
src/sentry/workflow_engine/endpoints/organization_available_action_index.py
{ "start": 1478, "end": 1609 }
class ____(TypedDict): integration: RpcIntegration services: list[tuple[int, str]] @region_silo_endpoint
AvailableIntegration
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/triggers/vertex_ai.py
{ "start": 4403, "end": 5256 }
class ____(BaseVertexAIJobTrigger): """CreateHyperparameterTuningJobTrigger run on the trigger worker to perform create operation.""" job_type_verbose_name = "Hyperparameter Tuning Job" job_serializer_class = HyperparameterTuningJob @cached_property def async_hook(self) -> HyperparameterTuningJobA...
CreateHyperparameterTuningJobTrigger
python
scipy__scipy
scipy/integrate/_ivp/radau.py
{ "start": 5447, "end": 18981 }
class ____(OdeSolver): """Implicit Runge-Kutta method of Radau IIA family of order 5. The implementation follows [1]_. The error is controlled with a third-order accurate embedded formula. A cubic polynomial which satisfies the collocation conditions is used for the dense output. Parameters --...
Radau
python
numpy__numpy
numpy/_core/tests/test_multiarray.py
{ "start": 273944, "end": 284978 }
class ____: N = 7 def _create_data(self): rng = np.random.RandomState(128) A = rng.random((4, 2)) b1 = rng.random((2, 1)) b2 = rng.random(2) b3 = rng.random((1, 2)) b4 = rng.random(4) return A, b1, b2, b3, b4 def test_dotmatmat(self): A, _, _...
TestDot
python
django__django
django/db/models/utils.py
{ "start": 1610, "end": 2182 }
class ____: """ Make subclasses preserve the alters_data attribute on overridden methods. """ def __init_subclass__(cls, **kwargs): for fn_name, fn in vars(cls).items(): if callable(fn) and not hasattr(fn, "alters_data"): for base in cls.__bases__: ...
AltersData
python
keras-team__keras
keras/src/layers/rnn/gru.py
{ "start": 504, "end": 13820 }
class ____(Layer, DropoutRNNCell): """Cell class for the GRU layer. This class processes one step within the whole time sequence input, whereas `keras.layer.GRU` processes the whole sequence. Args: units: Positive integer, dimensionality of the output space. activation: Activation func...
GRUCell
python
ansible__ansible
test/units/cli/test_galaxy.py
{ "start": 18196, "end": 59382 }
class ____(unittest.TestCase, ValidRoleTests): @classmethod def setUpClass(cls): role_skeleton_path = os.path.join(os.path.split(__file__)[0], 'test_data', 'role_skeleton') cls.setUpRole('delete_me_skeleton', skeleton_path=role_skeleton_path, use_explicit_type=True) @classmethod def te...
TestGalaxyInitSkeleton
python
doocs__leetcode
solution/1700-1799/1796.Second Largest Digit in a String/Solution2.py
{ "start": 0, "end": 307 }
class ____: def secondHighest(self, s: str) -> int: mask = reduce(or_, (1 << int(c) for c in s if c.isdigit()), 0) cnt = 0 for i in range(9, -1, -1): if (mask >> i) & 1: cnt += 1 if cnt == 2: return i return -1
Solution
python
langchain-ai__langchain
libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_pii.py
{ "start": 19477, "end": 22539 }
class ____: """Test using multiple PII middleware instances.""" def test_sequential_application(self): """Test that multiple PII types are detected when applied sequentially.""" # First apply email middleware email_middleware = PIIMiddleware("email", strategy="redact") state = {...
TestMultipleMiddleware
python
ansible__ansible
test/support/windows-integration/plugins/action/win_template.py
{ "start": 1022, "end": 1114 }
class ____(TemplateActionModule, ActionBase): DEFAULT_NEWLINE_SEQUENCE = '\r\n'
ActionModule
python
tensorflow__tensorflow
tensorflow/python/data/experimental/kernel_tests/index_shuffle_test.py
{ "start": 1298, "end": 6687 }
class ____(test_base.DatasetTestBase, parameterized.TestCase): def _build_dataset(self, seed=None, reshuffle_each_iteration=None, num_elements=10): file_infos = [] for _ in range(5): file_infos.append({"path": "unused", "num_elements": num_...
IndexShuffleTest
python
google__pytype
pytype/pytd/base_visitor.py
{ "start": 3254, "end": 7639 }
class ____: """Base class for visitors. Each class inheriting from visitor SHOULD have a fixed set of methods, otherwise it might break the caching in this class. Attributes: visits_all_node_types: Whether the visitor can visit every node type. unchecked_node_names: Contains the names of node classes ...
Visitor
python
wandb__wandb
wandb/vendor/pygments/lexers/nix.py
{ "start": 431, "end": 4031 }
class ____(RegexLexer): """ For the `Nix language <http://nixos.org/nix/>`_. .. versionadded:: 2.0 """ name = 'Nix' aliases = ['nixos', 'nix'] filenames = ['*.nix'] mimetypes = ['text/x-nix'] flags = re.MULTILINE | re.UNICODE keywords = ['rec', 'with', 'let', 'in', 'inherit',...
NixLexer
python
automl__auto-sklearn
autosklearn/pipeline/components/data_preprocessing/feature_type.py
{ "start": 1127, "end": 13174 }
class ____(AutoSklearnPreprocessingAlgorithm): """ This component is used to apply distinct transformations to categorical, numerical and text features of a dataset. It is built on top of sklearn's ColumnTransformer. """ def __init__( self, config: Optional[Configuration] = None...
FeatTypeSplit
python
Textualize__textual
tests/snapshot_tests/snapshot_apps/fr_margins.py
{ "start": 231, "end": 780 }
class ____(App): CSS = """ Container { background: green 20%; border: heavy green; width: auto; height: auto; overflow: hidden; } Label { background: green 20%; width: 1fr; height: 1fr; margin: 2 2; } """ ...
TestApp
python
scrapy__scrapy
scrapy/responsetypes.py
{ "start": 474, "end": 5621 }
class ____: CLASSES = { "text/html": "scrapy.http.HtmlResponse", "application/atom+xml": "scrapy.http.XmlResponse", "application/rdf+xml": "scrapy.http.XmlResponse", "application/rss+xml": "scrapy.http.XmlResponse", "application/xhtml+xml": "scrapy.http.HtmlResponse", ...
ResponseTypes
python
kamyu104__LeetCode-Solutions
Python/number-of-valid-clock-times.py
{ "start": 45, "end": 531 }
class ____(object): def countTime(self, time): """ :type time: str :rtype: int """ result = 1 if time[4] == '?': result *= 10 if time[3] == '?': result *= 6 if time[1] == time[0] == '?': result *= 24 elif tim...
Solution
python
apache__airflow
providers/google/tests/unit/google/cloud/hooks/test_bigquery.py
{ "start": 50954, "end": 58922 }
class ____(_BigQueryBaseTestClass): def test_create_empty_dataset_no_dataset_id_err(self): with pytest.raises(ValueError, match=r"Please specify `datasetId`"): self.hook.create_empty_dataset(dataset_id=None, project_id=None) @mock.patch("airflow.providers.google.cloud.hooks.bigquery.Dataset...
TestDatasetsOperations
python
airbytehq__airbyte
airbyte-integrations/connectors/destination-kvdb/destination_kvdb/writer.py
{ "start": 144, "end": 1715 }
class ____: """ Data is written to KvDB in the following format: key: stream_name__ab__<record_extraction_timestamp> value: a JSON object representing the record's data This is because unless a data source explicitly designates a primary key, we don't know what to key the record on. Sin...
KvDbWriter
python
apache__airflow
providers/apache/beam/src/airflow/providers/apache/beam/operators/beam.py
{ "start": 36994, "end": 37384 }
class ____(ABC): @abstractmethod def is_located_on_gcs(self) -> bool: ... @abstractmethod def download_from_gcs(self, gcs_hook: GCSHook, tmp_dir: str) -> None: ... @abstractmethod def start_pipeline( self, beam_hook: BeamHook, variables: dict, process_line_callb...
_GoArtifact
python
sanic-org__sanic
sanic/touchup/schemes/altsvc.py
{ "start": 254, "end": 424 }
class ____(BaseScheme): ident = "ALTSVC" def visitors(self) -> list[NodeTransformer]: return [RemoveAltSvc(self.app, self.app.state.verbosity)]
AltSvcCheck
python
pytorch__pytorch
test/functorch/test_aot_joint_with_descriptors.py
{ "start": 2966, "end": 7260 }
class ____(torch.nn.Module): def forward( self, primals, tangents, ): primals_1: "f32[2, 3]" # ParamAOTInput(target='linear.weight') primals_2: "f32[2]" # ParamAOTInput(target='linear.bias') primals_3: "f32[4, 3]" # PlainAOTInput(idx=0) tangents_1: "f32...
inner_f
python
getlogbook__logbook
src/logbook/handlers.py
{ "start": 18368, "end": 20676 }
class ____(Handler, StringFormatterHandlerMixin): """a handler class which writes logging records, appropriately formatted, to a stream. note that this class does not close the stream, as sys.stdout or sys.stderr may be used. If a stream handler is used in a `with` statement directly it will :meth:...
StreamHandler
python
run-llama__llama_index
llama-index-core/llama_index/core/memory/memory.py
{ "start": 1844, "end": 2182 }
class ____(Enum): SYSTEM = "system" USER = "user" def generate_chat_store_key() -> str: """Generate a unique chat store key.""" return str(uuid.uuid4()) def get_default_chat_store() -> SQLAlchemyChatStore: """Get the default chat store.""" return SQLAlchemyChatStore(table_name="llama_index_m...
InsertMethod
python
python-poetry__poetry
tests/types.py
{ "start": 4240, "end": 4563 }
class ____(Protocol): def __call__( self, version: str, executable_name: str | Path | None = None, implementation: str | None = None, free_threaded: bool = False, parent: str | Path | None = None, make_system: bool = False, ) -> Python: ...
MockedPythonRegister
python
tiangolo__fastapi
fastapi/openapi/models.py
{ "start": 13203, "end": 13259 }
class ____(OAuthFlow): tokenUrl: str
OAuthFlowPassword
python
run-llama__llama_index
llama-index-integrations/readers/llama-index-readers-google/llama_index/readers/google/calendar/base.py
{ "start": 843, "end": 4781 }
class ____(BaseReader): """ Google Calendar reader. Reads events from Google Calendar """ def load_data( self, number_of_results: Optional[int] = 100, start_date: Optional[Union[str, datetime.date]] = None, ) -> List[Document]: """ Load data from user's...
GoogleCalendarReader
python
apache__airflow
providers/google/src/airflow/providers/google/cloud/links/data_loss_prevention.py
{ "start": 3015, "end": 3270 }
class ____(BaseGoogleLink): """Helper class for constructing Cloud Data Loss Prevention link.""" name = "Cloud DLP Job Triggers List" key = "cloud_dlp_job_triggers_list_key" format_str = DLP_JOB_TRIGGER_LIST_LINK
CloudDLPJobTriggersListLink
python
walkccc__LeetCode
solutions/1472. Design Browser History/1472-2.py
{ "start": 0, "end": 537 }
class ____: def __init__(self, homepage: str): self.history = [] self.visit(homepage) def visit(self, url: str) -> None: self.history.append(url) self.future = [] def back(self, steps: int) -> str: while len(self.history) > 1 and steps > 0: self.future.append(self.history.pop()) ...
BrowserHistory
python
allegroai__clearml
clearml/backend_api/services/v2_23/datasets.py
{ "start": 191461, "end": 193764 }
class ____(Request): """ Get user and system tags used for the specified datasets :param include_system: If set to 'true' then the list of the system tags is also returned. The default value is 'false' :type include_system: bool :param datasets: The list of datasets for which the tags are c...
GetTagsRequest
python
getsentry__sentry
src/sentry/uptime/endpoints/serializers.py
{ "start": 5382, "end": 5769 }
class ____(TypedDict): uptimeCheckId: str timestamp: str scheduledCheckTime: str checkStatus: SerializedCheckStatus checkStatusReason: CheckStatusReasonType | None httpStatusCode: int | None durationMs: int traceId: str incidentStatus: int environment: str region: str reg...
EapCheckEntrySerializerResponse
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/protocolExplicit1.py
{ "start": 1358, "end": 1434 }
class ____(Protocol): @abstractmethod def method1(self): ...
Protocol7
python
apache__airflow
airflow-core/tests/unit/core/test_stats.py
{ "start": 16930, "end": 18657 }
class ____: def setup_method(self): with conf_vars( { ("metrics", "statsd_on"): "True", ("metrics", "statsd_influxdb_enabled"): "True", } ): self.statsd_client = Mock(spec=statsd.StatsClient) self.stats = SafeStatsdLogge...
TestStatsWithInfluxDBEnabled
python
run-llama__llama_index
llama-index-integrations/protocols/llama-index-protocols-ag-ui/llama_index/protocols/ag_ui/events.py
{ "start": 1975, "end": 2076 }
class ____(RunStartedEvent, Event): type: EventType = EventType.RUN_STARTED
RunStartedWorkflowEvent
python
huggingface__transformers
tests/models/bart/test_modeling_bart.py
{ "start": 95530, "end": 96712 }
class ____(ModelTesterMixin, GenerationTesterMixin, unittest.TestCase): all_model_classes = (BartDecoder, BartForCausalLM) if is_torch_available() else () is_encoder_decoder = False test_missing_keys = False def setUp( self, ): self.model_tester = BartStandaloneDecoderModelTester(se...
BartStandaloneDecoderModelTest
python
xlwings__xlwings
xlwings/constants.py
{ "start": 116613, "end": 116781 }
class ____: xlSparkColumn = 2 # from enum XlSparkType xlSparkColumnStacked100 = 3 # from enum XlSparkType xlSparkLine = 1 # from enum XlSparkType
SparkType
python
django__django
django/test/selenium.py
{ "start": 364, "end": 4535 }
class ____(type(LiveServerTestCase)): # List of browsers to dynamically create test classes for. browsers = [] # A selenium hub URL to test against. selenium_hub = None # The external host Selenium Hub can reach. external_host = None # Sentinel value to differentiate browser-specific instanc...
SeleniumTestCaseBase
python
paramiko__paramiko
paramiko/hostkeys.py
{ "start": 1158, "end": 10295 }
class ____(MutableMapping): """ Representation of an OpenSSH-style "known hosts" file. Host keys can be read from one or more files, and then individual hosts can be looked up to verify server keys during SSH negotiation. A `.HostKeys` object can be treated like a dict; any dict lookup is equi...
HostKeys
python
huggingface__transformers
src/transformers/models/bitnet/modular_bitnet.py
{ "start": 3956, "end": 4012 }
class ____(LlamaDecoderLayer): pass
BitNetDecoderLayer
python
astropy__astropy
astropy/units/tests/test_quantity.py
{ "start": 29424, "end": 32268 }
class ____: def test_quantity_equality(self): assert u.Quantity(1000, unit="m") == u.Quantity(1, unit="km") assert not (u.Quantity(1, unit="m") == u.Quantity(1, unit="km")) # for ==, !=, return False, True if units do not match assert (u.Quantity(1100, unit=u.m) != u.Quantity(1, unit...
TestQuantityComparison
python
PyCQA__pylint
tests/functional/i/invalid/invalid_metaclass.py
{ "start": 1099, "end": 1179 }
class ____(metaclass=invalid_metaclass_1): # [invalid-metaclass] pass
Invalid
python
numba__llvmlite
llvmlite/binding/value.py
{ "start": 11701, "end": 12409 }
class ____(ffi.ObjectRef): kind = None # derived classes must specify the Value kind value # as class attribute def __init__(self, ptr, parents): ffi.ObjectRef.__init__(self, ptr) # Keep parent objects (module, function, etc) alive self._parents = parents if self.kind is N...
_ValueIterator
python
getsentry__sentry
tests/sentry/workflow_engine/handlers/condition/test_age_comparison_handler.py
{ "start": 575, "end": 3904 }
class ____(ConditionTestCase): condition = Condition.AGE_COMPARISON def setup_group_event_and_job(self) -> None: self.group_event = self.event.for_group(self.group) self.event_data = WorkflowEventData(event=self.group_event, group=self.group) def setUp(self) -> None: super().setUp(...
TestAgeComparisonCondition
python
jazzband__django-pipeline
pipeline/compilers/coffee.py
{ "start": 87, "end": 666 }
class ____(SubProcessCompiler): output_extension = "js" def match_file(self, path): return path.endswith(".coffee") or path.endswith(".litcoffee") def compile_file(self, infile, outfile, outdated=False, force=False): if not outdated and not force: return # File doesn't need to...
CoffeeScriptCompiler
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/constructors.py
{ "start": 1471, "end": 1737 }
class ____: def __new__(cls): obj = super(BothNewAndInit, cls).__new__() obj.foo = _test_source() return obj def __init__(self): _test_sink(self.foo) def test_both_new_and_init_callgraph(): BothNewAndInit()
BothNewAndInit
python
ray-project__ray
python/ray/_private/thirdparty/pathspec/pattern.py
{ "start": 1225, "end": 4405 }
class ____(Pattern): """ The :class:`RegexPattern` class is an implementation of a pattern using regular expressions. """ # Make the class dict-less. __slots__ = ('regex',) def __init__(self, pattern, include=None): """ Initializes the :class:`RegexPattern` instance. *pattern* (:class:`unicode`, :class:...
RegexPattern
python
lazyprogrammer__machine_learning_examples
unsupervised_class3/dcgan_theano.py
{ "start": 5744, "end": 6908 }
class ____(object): def __init__(self, M1, M2, apply_batch_norm, f=T.nnet.relu): W = 0.02*np.random.randn(M1, M2) self.W = theano.shared(W) self.b = theano.shared(np.zeros(M2)) self.params = [self.W, self.b] self.updates = [] # in case we do batch norm if apply_batch_norm: self.gamma = ...
DenseLayer
python
encode__django-rest-framework
rest_framework/fields.py
{ "start": 28607, "end": 28901 }
class ____(CharField): default_error_messages = { 'invalid': _('Enter a valid URL.') } def __init__(self, **kwargs): super().__init__(**kwargs) validator = URLValidator(message=self.error_messages['invalid']) self.validators.append(validator)
URLField
python
plotly__plotly.py
plotly/graph_objs/scatterternary/marker/_colorbar.py
{ "start": 233, "end": 61796 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "scatterternary.marker" _path_str = "scatterternary.marker.colorbar" _valid_props = { "bgcolor", "bordercolor", "borderwidth", "dtick", "exponentformat", "labelalias", "len", "lenmode", ...
ColorBar
python
astropy__astropy
astropy/utils/exceptions.py
{ "start": 1642, "end": 2502 }
class ____: """Special keyword value. This class may be used as the default value assigned to a deprecated keyword in order to check if it has been given a user defined value. """ def __repr__(self): return "astropy.utils.exceptions.NoValue" NoValue = _NoValue() def __getattr__(nam...
_NoValue
python
lxml__lxml
src/lxml/tests/test_objectify.py
{ "start": 2150, "end": 105539 }
class ____(HelperTestCase): """Test cases for lxml.objectify """ etree = etree def XML(self, xml): return self.etree.XML(xml, self.parser) def setUp(self): super().setUp() self.parser = self.etree.XMLParser(remove_blank_text=True) self.lookup = etree.ElementNamespac...
ObjectifyTestCase
python
readthedocs__readthedocs.org
readthedocs/projects/migrations/0049_add_external_build_enabled.py
{ "start": 149, "end": 785 }
class ____(migrations.Migration): safe = Safe.after_deploy() dependencies = [ ("projects", "0048_remove_version_privacy_field"), ] operations = [ migrations.AddField( model_name="project", name="external_builds_enabled", field=models.BooleanField( ...
Migration
python
scipy__scipy
scipy/sparse/linalg/_special_sparse_arrays.py
{ "start": 278, "end": 19386 }
class ____(LinearOperator): """ The grid Laplacian in ``N`` dimensions and its eigenvalues/eigenvectors. Construct Laplacian on a uniform rectangular grid in `N` dimensions and output its eigenvalues and eigenvectors. The Laplacian ``L`` is square, negative definite, real symmetric array with s...
LaplacianNd
python
django__django
tests/auth_tests/test_models.py
{ "start": 20950, "end": 21621 }
class ____(TestCase): """ Simple test case for ticket #20541 """ def post_save_listener(self, *args, **kwargs): self.signals_count += 1 def setUp(self): self.signals_count = 0 post_save.connect(self.post_save_listener, sender=User) self.addCleanup(post_save.disconne...
TestCreateSuperUserSignals
python
langchain-ai__langchain
libs/langchain_v1/tests/unit_tests/agents/test_system_message.py
{ "start": 20845, "end": 24857 }
class ____: """Test cache control metadata preservation in system messages.""" def test_middleware_can_add_cache_control(self) -> None: """Test middleware adding cache control to system message.""" def cache_control_middleware(request: ModelRequest, handler) -> ModelResponse: """Ad...
TestCacheControlPreservation
python
apache__thrift
test/py/RunClientServer.py
{ "start": 6216, "end": 13181 }
class ____(object): def __init__(self, genbase, libdir, port, gendirs, servers, verbose): self.genbase = genbase self.libdir = libdir self.port = port self.verbose = verbose self.gendirs = gendirs self.servers = servers def default_conf(self): return { ...
TestCases
python
django__django
tests/admin_utils/admin.py
{ "start": 846, "end": 1304 }
class ____(admin.AdminSite): def get_log_entries(self, request): from django.contrib.contenttypes.models import ContentType log_entries = super().get_log_entries(request) return log_entries.filter( content_type__in=ContentType.objects.get_for_models( *self._regis...
CustomAdminSite
python
Lightning-AI__lightning
tests/tests_pytorch/trainer/properties/test_get_model.py
{ "start": 746, "end": 2373 }
class ____(BoringModel): def on_fit_start(self): assert self == self.trainer.lightning_module def on_fit_end(self): assert self == self.trainer.lightning_module def test_get_model(tmp_path): """Tests that `trainer.lightning_module` extracts the model correctly.""" model = TrainerGetMo...
TrainerGetModel
python
walkccc__LeetCode
solutions/1347. Minimum Number of Steps to Make Two Strings Anagram/1347.py
{ "start": 0, "end": 199 }
class ____: def minSteps(self, s: str, t: str) -> int: count = collections.Counter(s) count.subtract(collections.Counter(t)) return sum(abs(value) for value in count.values()) // 2
Solution
python
has2k1__plotnine
plotnine/themes/theme.py
{ "start": 1138, "end": 16407 }
class ____: """ Base class for themes In general, only complete themes should subclass this class. Parameters ---------- complete : bool Themes that are complete will override any existing themes. themes that are not complete (ie. partial) will add to or override specif...
theme
python
scipy__scipy
benchmarks/benchmarks/optimize_milp.py
{ "start": 615, "end": 1764 }
class ____(Benchmark): params = [milp_problems] param_names = ['problem'] def setup(self, prob): if not hasattr(self, 'data'): dir_path = os.path.dirname(os.path.realpath(__file__)) datafile = os.path.join(dir_path, "linprog_benchmark_files", ...
MilpMiplibBenchmarks
python
walkccc__LeetCode
solutions/1612. Check If Two Expression Trees are Equivalent/1612.py
{ "start": 0, "end": 408 }
class ____: def checkEquivalence(self, root1: 'Node', root2: 'Node') -> bool: count = collections.Counter() def dfs(root: 'Node', add: int) -> None: if not root: return if 'a' <= root.val <= 'z': count[root.val] += add dfs(root.left, add) dfs(root.right, add) dfs(...
Solution
python
sphinx-doc__sphinx
sphinx/domains/std/__init__.py
{ "start": 25289, "end": 25792 }
class ____(XRefRole): def process_link( self, env: BuildEnvironment, refnode: Element, has_explicit_title: bool, title: str, target: str, ) -> tuple[str, str]: target = target.lstrip('~') # a title-specific thing if not self.has_explicit_title and...
TokenXRefRole
python
coleifer__peewee
peewee.py
{ "start": 171589, "end": 173187 }
class ____(BlobField): field_type = 'UUIDB' def db_value(self, value): if isinstance(value, bytes) and len(value) == 16: # Raw binary value. No transformation is necessary. return self._constructor(value) elif isinstance(value, basestring) and len(value) == 32: ...
BinaryUUIDField
python
apache__airflow
helm-tests/tests/helm_tests/airflow_core/test_dag_processor.py
{ "start": 32212, "end": 32366 }
class ____(LogGroomerTestBase): """DAG processor log groomer.""" obj_name = "dag-processor" folder = "dag-processor"
TestDagProcessorLogGroomer
python
getsentry__sentry
src/sentry/models/groupsearchview.py
{ "start": 1258, "end": 2588 }
class ____(DefaultFieldsModelExisting): """ A model for a user's view of the issue stream """ __relocation_scope__ = RelocationScope.Organization name = models.TextField(max_length=128) user_id = HybridCloudForeignKey("sentry.User", on_delete="CASCADE") organization = FlexibleForeignKey("se...
GroupSearchView
python
django-extensions__django-extensions
tests/test_management_command.py
{ "start": 9879, "end": 10454 }
class ____(TestCase): """ Tests for the `show_urls` management command. """ def test_color(self): with force_color_support: out = StringIO() call_command("show_urls", stdout=out) self.output = out.getvalue() self.assertIn("\x1b", self.output) ...
ShowUrlsTests
python
walkccc__LeetCode
solutions/2171. Removing Minimum Number of Magic Beans/2171.py
{ "start": 0, "end": 203 }
class ____: def minimumRemoval(self, beans: list[int]) -> int: n = len(beans) summ = sum(beans) return min(summ - (n - i) * bean for i, bean in enumerate(sorted(beans)))
Solution
python
pennersr__django-allauth
allauth/account/views.py
{ "start": 17268, "end": 18829 }
class ____(AjaxCapableProcessFormViewMixin, NextRedirectMixin, FormView): template_name = "account/password_change." + app_settings.TEMPLATE_EXTENSION form_class = ChangePasswordForm def get_form_class(self): return get_form_class(app_settings.FORMS, "change_password", self.form_class) @sensit...
PasswordChangeView
python
Lightning-AI__lightning
tests/tests_pytorch/test_cli.py
{ "start": 23841, "end": 24092 }
class ____(BoringModel): def __init__(self, num_classes: int, batch_size: int = 8): super().__init__() self.save_hyperparameters() self.num_classes = num_classes self.batch_size = batch_size
BoringModelRequiredClasses
python
PrefectHQ__prefect
tests/server/orchestration/api/test_concurrency_limits.py
{ "start": 12510, "end": 21366 }
class ____: """Test the V1 API adapter that routes to V2 system.""" async def test_create_creates_v2_limit_only(self, session, client): """Creating via V1 API should only create V2 limit, no V1 record.""" data = ConcurrencyLimitCreate( tag="v2-only-tag", concurrency_limi...
TestV1ToV2Adapter
python
celery__celery
t/integration/test_inspect.py
{ "start": 483, "end": 7815 }
class ____: """Integration tests to app.control.inspect() API""" @flaky def test_ping(self, inspect): """Tests pinging the worker""" ret = inspect.ping() assert len(ret) == 1 assert ret[NODENAME] == {'ok': 'pong'} # TODO: Check ping() is returning None after stopping...
test_Inspect
python
huggingface__transformers
src/transformers/models/hubert/modeling_hubert.py
{ "start": 6291, "end": 7206 }
class ____(GradientCheckpointingLayer): def __init__(self, config, layer_id=0): super().__init__() self.in_conv_dim = config.conv_dim[layer_id - 1] if layer_id > 0 else 1 self.out_conv_dim = config.conv_dim[layer_id] self.conv = nn.Conv1d( self.in_conv_dim, s...
HubertGroupNormConvLayer
python
django__django
tests/generic_views/views.py
{ "start": 763, "end": 841 }
class ____(generic.DetailView): queryset = Artist.objects.all()
ArtistDetail
python
instagram__MonkeyType
monkeytype/db/base.py
{ "start": 345, "end": 576 }
class ____(metaclass=ABCMeta): """A deferred computation that produces a CallTrace or raises an error.""" @abstractmethod def to_trace(self) -> CallTrace: """Produces the CallTrace.""" pass
CallTraceThunk
python
crytic__slither
slither/printers/summary/loc.py
{ "start": 497, "end": 1200 }
class ____(AbstractPrinter): ARGUMENT = "loc" HELP = """Count the total number lines of code (LOC), source lines of code (SLOC), and comment lines of code (CLOC) found in source files (SRC), dependencies (DEP), and test files (TEST).""" WIKI = "https://github.com/trailofbits/slither...
LocPrinter
python
Textualize__textual
src/textual/screen.py
{ "start": 4547, "end": 72301 }
class ____(Generic[ScreenResultType], Widget): """The base class for screens.""" AUTO_FOCUS: ClassVar[str | None] = None """A selector to determine what to focus automatically when the screen is activated. The widget focused is the first that matches the given [CSS selector](/guide/queries/#query-sele...
Screen
python
doocs__leetcode
solution/1000-1099/1079.Letter Tile Possibilities/Solution.py
{ "start": 0, "end": 398 }
class ____: def numTilePossibilities(self, tiles: str) -> int: def dfs(cnt: Counter) -> int: ans = 0 for i, x in cnt.items(): if x > 0: ans += 1 cnt[i] -= 1 ans += dfs(cnt) cnt[i] += 1 ...
Solution
python
vyperlang__vyper
vyper/compiler/output_bundle.py
{ "start": 1321, "end": 4812 }
class ____: def __init__(self, compiler_data: CompilerData): self.compiler_data = compiler_data @cached_property def compilation_target(self): return self.compiler_data.compilation_target._metadata["type"] @cached_property def source_codes(self) -> dict[str, CompilerInput]: ...
OutputBundle
python
pyinstaller__pyinstaller
PyInstaller/lib/modulegraph/modulegraph.py
{ "start": 24163, "end": 24326 }
class ____(Extension, Package): """ Graph node representing a package where the __init__ module is an extension module. """ pass
ExtensionPackage
python
getsentry__sentry
tests/sentry/api/test_paginator.py
{ "start": 3226, "end": 6555 }
class ____(TestCase): # offset paginator does not support dynamic limits on is_prev def test_simple(self) -> None: res1 = self.create_user("foo@example.com") res2 = self.create_user("bar@example.com") res3 = self.create_user("baz@example.com") queryset = User.objects.all() ...
OffsetPaginatorTest
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1025641, "end": 1026380 }
class ____(sgqlc.types.Type): """Autogenerated return type of UpdateEnterpriseOrganizationProjectsSetting """ __schema__ = github_schema __field_names__ = ("client_mutation_id", "enterprise", "message") client_mutation_id = sgqlc.types.Field(String, graphql_name="clientMutationId") """A uni...
UpdateEnterpriseOrganizationProjectsSettingPayload
python
GoogleCloudPlatform__python-docs-samples
service_extensions/callouts/add_header/service_pb2_grpc.py
{ "start": 196, "end": 2045 }
class ____(object): """[#protodoc-title: External processing service] A service that can access and modify HTTP requests and responses as part of a filter chain. The overall external processing protocol works like this: 1. Envoy sends to the service information about the HTTP request. 2. The s...
ExternalProcessorStub
python
qdrant__qdrant-client
qdrant_client/http/models/models.py
{ "start": 140975, "end": 141059 }
class ____(BaseModel): error: str = Field(..., description="")
TrackerStatusOneOf2
python
numpy__numpy
numpy/_core/tests/test_multiarray.py
{ "start": 383973, "end": 387792 }
class ____: def test_infinite(self): assert_raises_regex( ValueError, "size exceeded", np.arange, 0, np.inf ) def test_nan_step(self): assert_raises_regex( ValueError, "cannot compute length", np.arange, 0, 1, np.nan ) def tes...
TestArange
python
pytorch__pytorch
torch/_dynamo/symbolic_convert.py
{ "start": 11082, "end": 11206 }
class ____: compile_pg: Any local_state: LocalState all_states: Optional[list[LocalState]] = None
DistributedState
python
airbytehq__airbyte
airbyte-integrations/connectors/source-shopify/source_shopify/streams/streams.py
{ "start": 4395, "end": 4505 }
class ____(IncrementalShopifyGraphQlBulkStream): bulk_query: ProductVariant = ProductVariant
ProductVariants
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1242161, "end": 1242997 }
class ____(sgqlc.types.Type, Node): """Represents a 'milestoned' event on a given issue or pull request.""" __schema__ = github_schema __field_names__ = ("actor", "created_at", "milestone_title", "subject") actor = sgqlc.types.Field(Actor, graphql_name="actor") """Identifies the actor who performed...
MilestonedEvent
python
pytest-dev__pytest
testing/test_assertrewrite.py
{ "start": 53648, "end": 56012 }
class ____: def test_assertion_walrus_operator_in_operand(self, pytester: Pytester) -> None: pytester.makepyfile( """ def test_in_string(): assert (obj := "foo") in obj """ ) result = pytester.runpytest() assert result.ret == 0 def t...
TestIssue11028
python
astropy__astropy
astropy/io/fits/hdu/image.py
{ "start": 44856, "end": 48076 }
class ____(_ImageBaseHDU, ExtensionHDU): """ FITS image extension HDU class. """ _extension = "IMAGE" def __init__( self, data=None, header=None, name=None, do_not_scale_image_data=False, uint=True, scale_back=None, ver=None, ): ...
ImageHDU
python
kamyu104__LeetCode-Solutions
Python/4-keys-keyboard.py
{ "start": 560, "end": 857 }
class ____(object): def maxA(self, N): """ :type N: int :rtype: int """ if N < 7: return N dp = range(N+1) for i in xrange(7, N+1): dp[i % 6] = max(dp[(i-4) % 6]*3, dp[(i-5) % 6]*4) return dp[N % 6]
Solution2
python
pytorch__pytorch
torch/_inductor/scheduler.py
{ "start": 47978, "end": 48841 }
class ____: name1: str name2: str reason: str args: tuple[Any, ...] def __init__(self, node1: BaseSchedulerNode, node2: BaseSchedulerNode) -> None: self.name1 = node1.get_name() self.name2 = node2.get_name() def __call__(self, reason: str, *args: Any) -> None: self.reas...
WhyNoFuse
python
gevent__gevent
src/gevent/libev/watcher.py
{ "start": 4726, "end": 5832 }
class ____(_base.IoMixin, watcher): EVENT_MASK = libev.EV__IOFDSET | libev.EV_READ | libev.EV_WRITE @classmethod def _validate_fd(cls, fd): super()._validate_fd(fd) if libev.gevent_check_fd_valid(fd) == -1: raise OSError(errno.EBADF, "Invalid file descriptor %r" % (fd,)) d...
io
python
ipython__ipython
tests/test_ultratb.py
{ "start": 11497, "end": 12243 }
class ____(unittest.TestCase): ERROR_WITH_NOTE = """ try: raise AssertionError("Message") except Exception as e: try: e.add_note("This is a PEP-678 note.") except AttributeError: # Python <= 3.10 e.__notes__ = ("This is a PEP-678 note.",) raise """ def test_verbose_reports_...
PEP678NotesReportingTest
python
ray-project__ray
python/ray/serve/_private/test_utils.py
{ "start": 6970, "end": 10814 }
class ____: def __call__(self): return os.getpid() get_pid_entrypoint = GetPID.bind() def check_ray_stopped(): try: requests.get("http://localhost:8265/api/ray/version") return False except Exception: return True def check_ray_started(): return requests.get("http://...
GetPID
python
huggingface__transformers
src/transformers/models/emu3/modeling_emu3.py
{ "start": 17161, "end": 17618 }
class ____(nn.Module): def __init__( self, in_channel: int, out_channel: int, ): super().__init__() self.conv = Emu3VQVAEConv3d( in_channel, out_channel, kernel_size=(4, 3, 3), stride=(2, 1, 1), ) def forward(se...
Emu3VQVAETemporalDownsample
python
django__django
tests/staticfiles_tests/test_forms.py
{ "start": 268, "end": 697 }
class ____(storage.StaticFilesStorage): def url(self, name): return urljoin("https://example.com/assets/", name) @override_settings( INSTALLED_APPS=("django.contrib.staticfiles",), STORAGES={ STATICFILES_STORAGE_ALIAS: { "BACKEND": "staticfiles_tests.test_forms.StaticTestStorag...
StaticTestStorage
python
qdrant__qdrant-client
qdrant_client/http/models/models.py
{ "start": 1096, "end": 1197 }
class ____(BaseModel, extra="forbid"): abs: "Expression" = Field(..., description="")
AbsExpression
python
getsentry__sentry
src/sentry/event_manager.py
{ "start": 6961, "end": 12553 }
class ____: group: Group is_new: bool is_regression: bool group_release: GroupRelease | None = None is_new_group_environment: bool = False def pop_tag(data: dict[str, Any], key: str) -> None: if "tags" not in data: return data["tags"] = [kv for kv in data["tags"] if kv is None or ...
GroupInfo
python
neetcode-gh__leetcode
python/0332-reconstruct-itinerary.py
{ "start": 0, "end": 723 }
class ____: def findItinerary(self, tickets: List[List[str]]) -> List[str]: adj = {src: [] for src, dst in tickets} res = [] for src, dst in tickets: adj[src].append(dst) for key in adj: adj[key].sort() def dfs(adj, src): if src in adj: ...
Solution