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
airbytehq__airbyte
airbyte-integrations/connectors/source-iterable/source_iterable/streams.py
{ "start": 17409, "end": 17502 }
class ____(IterableExportEventsStreamAdjustableRange): data_field = "inAppClick"
InAppClick
python
networkx__networkx
networkx/algorithms/tests/test_cycles.py
{ "start": 6812, "end": 25929 }
class ____: @staticmethod def K(n): return nx.complete_graph(n) @staticmethod def D(n): return nx.complete_graph(n).to_directed() @staticmethod def edgeset_function(g): if g.is_directed(): return directed_cycle_edgeset elif g.is_multigraph(): ...
TestCycleEnumeration
python
ansible__ansible
test/units/module_utils/basic/test_no_log.py
{ "start": 401, "end": 1694 }
class ____: dataset: tuple[tuple[t.Any, frozenset[str]], ...] = ( ('string', frozenset(['string'])), ('', frozenset()), (1, frozenset(['1'])), (1.0, frozenset(['1.0'])), (False, frozenset()), (['1', '2', '3'], frozenset(['1', '2', '3'])), (('1', '2', '3'), fro...
TestReturnValues
python
scipy__scipy
scipy/stats/_warnings_errors.py
{ "start": 927, "end": 1196 }
class ____(RuntimeError): """Represents an error condition when fitting a distribution to data.""" def __init__(self, msg=None): if msg is None: msg = ("An error occurred when fitting a distribution to data.") self.args = (msg,)
FitError
python
kamyu104__LeetCode-Solutions
Python/convert-the-temperature.py
{ "start": 36, "end": 236 }
class ____(object): def convertTemperature(self, celsius): """ :type celsius: float :rtype: List[float] """ return [celsius+273.15, celsius*1.80+32.00]
Solution
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/dialects/oracle/cx_oracle.py
{ "start": 36924, "end": 54831 }
class ____(OracleDialect): supports_statement_cache = True execution_ctx_cls = OracleExecutionContext_cx_oracle statement_compiler = OracleCompiler_cx_oracle supports_sane_rowcount = True supports_sane_multi_rowcount = True insert_executemany_returning = True insert_executemany_returning_s...
OracleDialect_cx_oracle
python
ApeWorX__ape
src/ape/managers/project.py
{ "start": 40232, "end": 41819 }
class ____(dict[str, "ProjectManager"]): """ A mapping of versions to dependencies. This class exists to allow both v-prefixed versions as well none v-prefixed versions. """ def __init__(self, name: str): self._name = name super().__init__() @log_instead_of_fail(default="<D...
DependencyVersionMap
python
django__django
tests/admin_docs/views.py
{ "start": 391, "end": 489 }
class ____(View): def __call__(self, request): return HttpResponse()
XViewCallableObject
python
dask__dask
dask/dataframe/dask_expr/_reductions.py
{ "start": 23193, "end": 23333 }
class ____(PivotTableAbstract): chunk = staticmethod(methods.pivot_sum) aggregate_func = staticmethod(methods.pivot_agg)
PivotTableSum
python
openai__openai-python
src/openai/resources/realtime/realtime.py
{ "start": 22438, "end": 23512 }
class ____(BaseRealtimeConnectionResource): def update(self, *, session: session_update_event_param.Session, event_id: str | Omit = omit) -> None: """ Send this event to update the session’s configuration. The client may send this event at any time to update any field except for `voi...
RealtimeSessionResource
python
pandas-dev__pandas
pandas/_config/config.py
{ "start": 2566, "end": 3069 }
class ____(NamedTuple): key: str defval: Any doc: str validator: Callable[[object], Any] | None cb: Callable[[str], Any] | None # holds deprecated option metadata _deprecated_options: dict[str, DeprecatedOption] = {} # holds registered option metadata _registered_options: dict[str, RegisteredOpti...
RegisteredOption
python
apache__airflow
providers/microsoft/azure/tests/unit/microsoft/azure/hooks/test_wasb.py
{ "start": 2238, "end": 33493 }
class ____: @pytest.fixture(autouse=True) def setup_method(self, create_mock_connections): self.login = "login" self.wasb_test_key = "wasb_test_key" self.connection_type = "wasb" self.azure_test_connection_string = "azure_test_connection_string" self.azure_shared_key_test...
TestWasbHook
python
readthedocs__readthedocs.org
readthedocs/organizations/tests/test_views.py
{ "start": 16745, "end": 17405 }
class ____(RequestFactoryTestMixin, TestCase): """Tests for invite handling in views.""" def setUp(self): self.owner = get(User) self.organization = get( Organization, owners=[self.owner], ) self.team = get(Team, organization=self.organization) def ...
OrganizationInviteViewTests
python
wandb__wandb
wandb/vendor/pygments/lexers/c_like.py
{ "start": 10577, "end": 12813 }
class ____(CLexer): """ For NVIDIA `CUDA™ <http://developer.nvidia.com/category/zone/cuda-zone>`_ source. .. versionadded:: 1.6 """ name = 'CUDA' filenames = ['*.cu', '*.cuh'] aliases = ['cuda', 'cu'] mimetypes = ['text/x-cuda'] function_qualifiers = set(('__device__', '__globa...
CudaLexer
python
doocs__leetcode
solution/0300-0399/0345.Reverse Vowels of a String/Solution.py
{ "start": 0, "end": 434 }
class ____: def reverseVowels(self, s: str) -> str: vowels = "aeiouAEIOU" i, j = 0, len(s) - 1 cs = list(s) while i < j: while i < j and cs[i] not in vowels: i += 1 while i < j and cs[j] not in vowels: j -= 1 if i < ...
Solution
python
getsentry__sentry
tests/sentry/tasks/test_post_process.py
{ "start": 82458, "end": 87948 }
class ____(BasePostProgressGroupMixin): def test_user_report_gets_environment(self) -> None: project = self.create_project() environment = Environment.objects.create( organization_id=project.organization_id, name="production" ) environment.add_project(project) ev...
UserReportEventLinkTestMixin
python
pytorch__pytorch
torch/testing/_internal/common_fsdp.py
{ "start": 21821, "end": 24594 }
class ____(FSDPTestModel): """This class wraps a :class:`FSDPTestModel` to optionally add a delay after computing the loss and/or before the gradient reduction.""" def __init__( self, module: nn.Module, delay_after_loss_ms: int, delay_before_reduction_ms: int, ): ...
ModuleWithDelay
python
agronholm__apscheduler
src/apscheduler/datastores/sqlalchemy.py
{ "start": 2454, "end": 3295 }
class ____(TypeDecorator[timedelta]): impl = BigInteger() cache_ok = True def process_bind_param( self, value: timedelta | None, dialect: Dialect ) -> float | None: return value.total_seconds() * 1000000 if value is not None else None def process_result_value( self, value: ...
EmulatedInterval
python
django__django
tests/test_utils/test_testcase.py
{ "start": 459, "end": 913 }
class ____(SimpleTestCase): def test_is_picklable_with_non_picklable_properties(self): """ParallelTestSuite requires that all TestCases are picklable.""" self.non_picklable = lambda: 0 self.assertEqual(self, pickle.loads(pickle.dumps(self))) def test_is_picklable_with_non_picklable_obje...
TestSimpleTestCase
python
streamlit__streamlit
lib/streamlit/testing/v1/element_tree.py
{ "start": 38299, "end": 39896 }
class ____(Widget): """A representation of ``st.text_input``.""" _value: str | None | InitialValue proto: TextInputProto = field(repr=False) label: str max_chars: int autocomplete: str placeholder: str help: str form_id: str def __init__(self, proto: TextInputProto, root: Eleme...
TextInput
python
streamlit__streamlit
lib/tests/streamlit/runtime/caching/cache_data_api_test.py
{ "start": 2806, "end": 9020 }
class ____(unittest.TestCase): def setUp(self) -> None: # Caching functions rely on an active script run ctx add_script_run_ctx(threading.current_thread(), create_mock_script_run_ctx()) mock_runtime = MagicMock(spec=Runtime) mock_runtime.cache_storage_manager = MemoryCacheStorageMana...
CacheDataTest
python
fluentpython__example-code-2e
10-dp-1class-func/untyped/strategy_best3.py
{ "start": 1625, "end": 2515 }
class ____: # the Context def __init__(self, customer, cart, promotion=None): self.customer = customer self.cart = list(cart) self.promotion = promotion def total(self): if not hasattr(self, '__total'): self.__total = sum(item.total() for item in self.cart) ...
Order
python
nryoung__algorithms
tests/test_factorization.py
{ "start": 444, "end": 879 }
class ____(unittest.TestCase): def test_pollard_rho(self): x = random.randint(1, 100000000000) factors = pollard_rho(x) res = 1 for j in factors: res *= j self.assertEqual(x, res) def test_pollard_rho_x_is_zero(self): x = 0 factors = pollard_...
TestPollardRho
python
pyinstaller__pyinstaller
PyInstaller/utils/conftest.py
{ "start": 5259, "end": 26380 }
class ____: def __init__(self, tmp_path, request, bundle_mode): self._tmp_path = tmp_path self._request = request self._mode = bundle_mode self._spec_dir = tmp_path self._dist_dir = tmp_path / 'dist' self._build_dir = tmp_path / 'build' self._is_spec = False ...
AppBuilder
python
PyCQA__pylint
tests/functional/i/inherit_non_class.py
{ "start": 357, "end": 462 }
class ____: """ Empty class. """ def return_class(): """ Return a class. """ return Good3
Empty
python
rapidsai__cudf
python/cudf_polars/cudf_polars/typing/__init__.py
{ "start": 5601, "end": 5923 }
class ____(TypedDict): """ Deserialized Column constructor options. Notes ----- Used to deserialize Column and DataFrame containers. """ is_sorted: plc.types.Sorted order: plc.types.Order null_order: plc.types.NullOrder name: str | None dtype: DataType
DeserializedColumnOptions
python
altair-viz__altair
altair/vegalite/v6/schema/channels.py
{ "start": 50698, "end": 80146 }
class ____( FieldChannelMixin, core.FieldOrDatumDefWithConditionMarkPropFieldDefGradientstringnull, ): r""" Color schema wrapper. Parameters ---------- shorthand : str, dict, Sequence[str], :class:`RepeatRef` shorthand for field, aggregate, and type aggregate : dict, :class:`Agg...
Color
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/test_dataform.py
{ "start": 13022, "end": 13761 }
class ____: @mock.patch(HOOK_STR) def test_execute(self, hook_mock): op = DataformRemoveFileOperator( task_id="remove-file", project_id=PROJECT_ID, region=REGION, repository_id=REPOSITORY_ID, workspace_id=WORKSPACE_ID, filepath=FILE...
TestDataformRemoveFileOperator
python
getsentry__sentry
src/sentry/sentry_metrics/consumers/indexer/parsed_message.py
{ "start": 174, "end": 354 }
class ____(IngestMetric): """Internal representation of a parsed ingest metric message for indexer to support generic metrics""" use_case_id: Required[UseCaseID]
ParsedMessage
python
mlflow__mlflow
mlflow/models/evaluation/artifacts.py
{ "start": 1513, "end": 1863 }
class ____(EvaluationArtifact): def _save(self, output_artifact_path): np.save(output_artifact_path, self._content, allow_pickle=False) def _load_content_from_file(self, local_artifact_path): self._content = np.load(local_artifact_path, allow_pickle=False) return self._content @develo...
NumpyEvaluationArtifact
python
huggingface__transformers
src/transformers/models/pop2piano/modeling_pop2piano.py
{ "start": 5844, "end": 6642 }
class ____(nn.Module): def __init__(self, config: Pop2PianoConfig): super().__init__() if config.is_gated_act: self.DenseReluDense = Pop2PianoDenseGatedActDense(config) else: self.DenseReluDense = Pop2PianoDenseActDense(config) self.layer_norm = Pop2PianoLaye...
Pop2PianoLayerFF
python
django-import-export__django-import-export
tests/core/tests/admin_integration/test_import_functionality.py
{ "start": 11597, "end": 15745 }
class ____(AdminTestMixin, TestCase): def test_import_log_entry(self): response = self._do_import_post(self.book_import_url, "books.csv") self.assertEqual(response.status_code, 200) confirm_form = response.context["confirm_form"] data = confirm_form.initial self._prepend_for...
ImportLogEntryTest
python
kamyu104__LeetCode-Solutions
Python/convert-an-array-into-a-2d-array-with-conditions.py
{ "start": 88, "end": 553 }
class ____(object): def findMatrix(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ result = [] cnt = collections.Counter() for x in nums: if cnt[x] == len(result): result.append([]) result[cnt[x]].appe...
Solution
python
keras-team__keras
keras/src/layers/preprocessing/image_preprocessing/random_flip_test.py
{ "start": 779, "end": 9037 }
class ____(testing.TestCase): @parameterized.named_parameters( ("random_flip_horizontal", "horizontal"), ("random_flip_vertical", "vertical"), ("random_flip_both", "horizontal_and_vertical"), ) def test_random_flip(self, mode): run_training_check = False if backend.backend() ...
RandomFlipTest
python
kamyu104__LeetCode-Solutions
Python/check-if-the-sentence-is-pangram.py
{ "start": 37, "end": 214 }
class ____(object): def checkIfPangram(self, sentence): """ :type sentence: str :rtype: bool """ return len(set(sentence)) == 26
Solution
python
pallets__werkzeug
src/werkzeug/exceptions.py
{ "start": 11051, "end": 11360 }
class ____(HTTPException): """*404* `Not Found` Raise if a resource does not exist and never existed. """ code = 404 description = ( "The requested URL was not found on the server. If you entered" " the URL manually please check your spelling and try again." )
NotFound
python
HypothesisWorks__hypothesis
hypothesis-python/tests/cover/test_pretty.py
{ "start": 16617, "end": 17184 }
class ____(Flag): A = 1 B = 2 def __repr__(self): return "LyingReprOptions.A|B|C" @pytest.mark.parametrize( "rep", [ "AnEnum.SOME_MEMBER", "Options.A", "Options.A | Options.B", "Options.A | Options.B | Options.C", "Options(0)", "EvilReprOpti...
LyingReprOptions
python
getsentry__sentry
src/sentry/sentry_metrics/indexer/base.py
{ "start": 526, "end": 653 }
class ____(Enum): CACHE_HIT = "c" HARDCODED = "h" DB_READ = "d" FIRST_SEEN = "f" RATE_LIMITED = "r"
FetchType
python
dask__distributed
distributed/shuffle/_limiter.py
{ "start": 167, "end": 2798 }
class ____(Generic[_T]): """Limit an abstract resource This allows us to track usage of an abstract resource. If the usage of this resources goes beyond a defined limit, we can block further execution Example:: limiter = ResourceLimiter(2) limiter.increase(1) limiter.increase(...
ResourceLimiter
python
Textualize__textual
tests/snapshot_tests/snapshot_apps/notification_with_inline_link.py
{ "start": 30, "end": 247 }
class ____(App): def on_mount(self) -> None: self.notify("Click [@click=bell]here[/] for the bell sound.") if __name__ == "__main__": app = NotifyWithInlineLinkApp() app.run()
NotifyWithInlineLinkApp
python
django__django
tests/backends/sqlite/test_introspection.py
{ "start": 1952, "end": 7848 }
class ____(TestCase): def parse_definition(self, sql, columns): """Parse a column or constraint definition.""" statement = sqlparse.parse(sql)[0] tokens = (token for token in statement.flatten() if not token.is_whitespace) with connection.cursor(): return connection.intro...
ParsingTests
python
apache__airflow
helm-tests/tests/helm_tests/airflow_core/test_worker.py
{ "start": 47750, "end": 48338 }
class ____: """Tests worker service.""" def test_should_add_component_specific_labels(self): docs = render_chart( values={ "executor": "CeleryExecutor", "workers": { "labels": {"test_label": "test_label_value"}, }, ...
TestWorkerService
python
sympy__sympy
sympy/core/expr.py
{ "start": 142807, "end": 144603 }
class ____: def __init__(self, op, args=None, validator=None, check=True): if not hasattr(op, "__call__"): raise TypeError("op {} needs to be callable".format(op)) self.op = op if args is None: self.args = [] else: self.args = args self.val...
ExprBuilder
python
django__django
django/contrib/gis/db/models/functions.py
{ "start": 6069, "end": 6169 }
class ____(GeoFunc): output_field = FloatField() arity = 2 geom_param_pos = (0, 1)
Azimuth
python
openai__openai-python
examples/parsing_tools.py
{ "start": 242, "end": 485 }
class ____(str, Enum): id = "id" status = "status" expected_delivery_date = "expected_delivery_date" delivered_at = "delivered_at" shipped_at = "shipped_at" ordered_at = "ordered_at" canceled_at = "canceled_at"
Column
python
django__django
tests/sitemaps_tests/urls/http.py
{ "start": 3152, "end": 3449 }
class ____(Sitemap): changefreq = "never" priority = 0.5 location = "/location/" def items(self): return [object()] def lastmod(self, obj): return datetime(2013, 3, 13, 10, 0, 0) def get_latest_lastmod(self): return None
GetLatestLastmodNoneSiteMap
python
pallets__werkzeug
src/werkzeug/exceptions.py
{ "start": 15778, "end": 16841 }
class ____(HTTPException): """*416* `Requested Range Not Satisfiable` The client asked for an invalid part of the file. .. versionadded:: 0.7 """ code = 416 description = "The server cannot provide the requested range." def __init__( self, length: int | None = None, ...
RequestedRangeNotSatisfiable
python
weaviate__weaviate-python-client
weaviate/collections/classes/config_vectorizers.py
{ "start": 18071, "end": 18283 }
class ____(_Multi2VecBase): vectorizer: Union[Vectorizers, _EnumLikeStr] = Field( default=Vectorizers.MULTI2VEC_CLIP, frozen=True, exclude=True ) inferenceUrl: Optional[str]
_Multi2VecClipConfig
python
kamyu104__LeetCode-Solutions
Python/minimum-distance-to-the-target-element.py
{ "start": 29, "end": 433 }
class ____(object): def getMinDistance(self, nums, target, start): """ :type nums: List[int] :type target: int :type start: int :rtype: int """ for i in xrange(len(nums)): if (start-i >= 0 and nums[start-i] == target) or \ (start+i <...
Solution
python
pytransitions__transitions
tests/test_graphviz.py
{ "start": 1142, "end": 13161 }
class ____(TestTransitions): machine_cls = GraphMachine # type: Type[GraphMachine] graph_engine = "graphviz" # type: Union[Literal["pygraphviz"], Literal["graphviz"], Literal["mermaid"]] edge_re = re.compile(r"^\s+(?P<src>\w+)\s*->\s*(?P<dst>\w+)\s*(?P<attr>\[.*\]?)\s*$") node_re = re.compile(r"^\s+(...
TestDiagrams
python
python-openxml__python-docx
tests/image/test_image.py
{ "start": 9732, "end": 10926 }
class ____: def it_constructs_the_right_class_for_a_given_image_stream(self, call_fixture): stream, expected_class = call_fixture image_header = _ImageHeaderFactory(stream) assert isinstance(image_header, expected_class) def it_raises_on_unrecognized_image_stream(self): stream =...
Describe_ImageHeaderFactory
python
mlflow__mlflow
dev/clint/src/clint/linter.py
{ "start": 10851, "end": 12442 }
class ____(ast.NodeVisitor): def __init__(self, linter: "Linter") -> None: self.linter = linter self.stack: list[ast.AST] = [] def visit(self, node: ast.AST) -> None: self.stack.append(node) super().visit(node) self.stack.pop() def visit_Name(self, node: ast.Name) -...
TypeAnnotationVisitor
python
huggingface__transformers
examples/pytorch/summarization/run_summarization.py
{ "start": 4832, "end": 32163 }
class ____: """ Arguments pertaining to what data we are going to input our model for training and eval. """ lang: Optional[str] = field(default=None, metadata={"help": "Language id for summarization."}) dataset_name: Optional[str] = field( default=None, metadata={"help": "The name of the ...
DataTrainingArguments
python
plotly__plotly.py
plotly/graph_objs/icicle/_tiling.py
{ "start": 233, "end": 5081 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "icicle" _path_str = "icicle.tiling" _valid_props = {"flip", "orientation", "pad"} @property def flip(self): """ Determines if the positions obtained from solver are flipped on each axis. The 'flip' property is...
Tiling
python
streamlit__streamlit
lib/streamlit/errors.py
{ "start": 18715, "end": 19074 }
class ____(LocalizableStreamlitException): """Exception raised when trying to set values where writes are not allowed.""" def __init__(self, key: str) -> None: super().__init__( "Values for the widget with `key` '{key}' cannot be set using `st.session_state`.", key=key, ...
StreamlitValueAssignmentNotAllowedError
python
pytorch__pytorch
torch/distributed/fsdp/_fully_shard/_fsdp_collectives.py
{ "start": 2467, "end": 2887 }
class ____(DefaultAllocMixin, AllGather): def __call__( self, output_tensor: torch.Tensor, input_tensor: torch.Tensor, group: dist.ProcessGroup, async_op: bool = False, ) -> Optional[dist.Work]: return dist.all_gather_into_tensor( output_tensor, ...
DefaultAllGather
python
getsentry__sentry
src/sentry/auth/email.py
{ "start": 953, "end": 4534 }
class ____: email: str organization: Organization | None def resolve(self, candidates: Collection[UserEmail]) -> User: """Pick the user best matching the email address.""" if not candidates: raise ValueError if len(candidates) == 1: (unique_email,) = candida...
_EmailResolver
python
tensorflow__tensorflow
tensorflow/python/keras/engine/training_generator_v1.py
{ "start": 27024, "end": 30841 }
class ____(training_utils_v1.TrainingLoop): """TrainingLoop that handle inputs like python generator. This is the default handler for most of the input data types, includes symbolic tensors or Numpy array-like, Datasets and iterators in graph mode (since they generate symbolic tensors). This Function is used t...
GeneratorLikeTrainingLoop
python
huggingface__transformers
src/transformers/models/hgnet_v2/modeling_hgnet_v2.py
{ "start": 12136, "end": 14477 }
class ____(HGNetV2PreTrainedModel, BackboneMixin): has_attentions = False def __init__(self, config: HGNetV2Config): super().__init__(config) super()._init_backbone(config) self.depths = config.depths self.num_features = [config.embedding_size] + config.hidden_sizes self...
HGNetV2Backbone
python
crytic__slither
slither/detectors/operations/cache_array_length.py
{ "start": 480, "end": 8915 }
class ____(AbstractDetector): """ Detects `for` loops that use `length` member of some storage array in their loop condition and don't modify it. """ ARGUMENT = "cache-array-length" HELP = ( "Detects `for` loops that use `length` member of some storage array in their loop condition and don'...
CacheArrayLength
python
airbytehq__airbyte
airbyte-integrations/connectors/source-google-ads/source_google_ads/streams.py
{ "start": 4266, "end": 10483 }
class ____(GoogleAdsStream, CheckpointMixin, ABC): primary_key = None days_of_data_storage = None cursor_field = "segments.date" cursor_time_format = "YYYY-MM-DD" # Slice duration is set to 14 days, because for conversion_window_days default value is 14. # Range less than 14 days will break the ...
IncrementalGoogleAdsStream
python
getsentry__sentry
src/sentry/explore/endpoints/explore_saved_query_starred.py
{ "start": 534, "end": 900 }
class ____(serializers.Serializer): starred = serializers.BooleanField(required=True) position = serializers.IntegerField(required=False) def validate(self, data): if not data["starred"] and "position" in data: raise serializers.ValidationError("Position is only allowed when starring a ...
StarQuerySerializer
python
python-markdown__markdown
markdown/postprocessors.py
{ "start": 2219, "end": 3803 }
class ____(Postprocessor): """ Restore raw html to the document. """ BLOCK_LEVEL_REGEX = re.compile(r'^\<\/?([^ >]+)') def run(self, text: str) -> str: """ Iterate over html stash and restore html. """ def substitute_match(m: re.Match[str]) -> str: if key := m.group(1): ...
RawHtmlPostprocessor
python
dagster-io__dagster
python_modules/dagster/dagster/_core/scheduler/scheduler.py
{ "start": 816, "end": 916 }
class ____(DagsterError): """Base class for all Dagster Scheduler errors."""
DagsterSchedulerError
python
apache__airflow
providers/slack/tests/unit/slack/notifications/test_slack_webhook.py
{ "start": 1082, "end": 6227 }
class ____: def test_class_and_notifier_are_same(self): assert send_slack_webhook_notification is SlackWebhookNotifier @mock.patch("airflow.providers.slack.notifications.slack_webhook.SlackWebhookHook") @pytest.mark.parametrize( ("slack_op_kwargs", "hook_extra_kwargs"), [ ...
TestSlackNotifier
python
pypa__warehouse
warehouse/predicates.py
{ "start": 1339, "end": 2638 }
class ____: def __init__(self, val, config): self.val = bool(val) def text(self): return f"require_active_organization = {self.val}" phash = text def __call__(self, context: Organization | Team, request): """Check organizations are enabled globally and this organization is ...
ActiveOrganizationPredicate
python
walkccc__LeetCode
solutions/2255. Count Prefixes of a Given String/2255.py
{ "start": 0, "end": 117 }
class ____: def countPrefixes(self, words: list[str], s: str) -> int: return sum(map(s.startswith, words))
Solution
python
pytorch__pytorch
torch/_functorch/pyfunctorch.py
{ "start": 7830, "end": 10824 }
class ____(FuncTorchInterpreter): def __init__(self, cdata: CInterpreter): assert cdata.key() == TransformType.Functionalize self._cdata = cdata @cached_property # pyrefly: ignore [bad-override] def _cptr(self): return CFunctionalizeInterpreterPtr(self._cdata) def process(s...
FunctionalizeInterpreter
python
numba__numba
numba/tests/test_linalg.py
{ "start": 13576, "end": 21365 }
class ____(EnableNRTStatsMixin, TestCase): """ Provides setUp and common data/error modes for testing np.linalg functions. """ # supported dtypes dtypes = (np.float64, np.float32, np.complex128, np.complex64) def setUp(self): # Collect leftovers from previous test cases before checking...
TestLinalgBase
python
kubernetes-client__python
kubernetes/base/dynamic/exceptions.py
{ "start": 3197, "end": 3283 }
class ____(DynamicApiError): """ 405: StatusMethodNotAllowed """
MethodNotAllowedError
python
tensorflow__tensorflow
tensorflow/python/distribute/ps_values.py
{ "start": 22511, "end": 28187 }
class ____(lookup_ops.StaticHashTable): """A distributed StaticHashTable for ParameterServerStrategy. An instance of DistributedTable has copies of a StaticHashTable and its resource handle on the coordinator of each worker, created at the DistributedTable instance initialization time with initializers on each...
DistributedTable
python
wandb__wandb
wandb/vendor/pygments/lexers/configs.py
{ "start": 3033, "end": 4729 }
class ____(RegexLexer): """ Lexer for configuration files in Java's properties format. Note: trailing whitespace counts as part of the value as per spec .. versionadded:: 1.4 """ name = 'Properties' aliases = ['properties', 'jproperties'] filenames = ['*.properties'] mimetypes = [...
PropertiesLexer
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/call7.py
{ "start": 1401, "end": 1606 }
class ____(TypedDict, total=False): opt1: bool opt2: str def func6(code: str | None = None, **options: Unpack[Options]): pass func6(**{}) func6(**{"opt1": True}) func6(**{"opt2": "hi"})
Options
python
pyca__cryptography
tests/hazmat/primitives/test_rsa.py
{ "start": 5087, "end": 13398 }
class ____: @pytest.mark.parametrize( ("public_exponent", "key_size"), itertools.product( (3, 65537), (1024, 1536, 2048), ), ) def test_generate_rsa_keys(self, backend, public_exponent, key_size): if backend._fips_enabled: if key_size < bac...
TestRSA
python
sphinx-doc__sphinx
tests/roots/test-ext-autodoc/target/classes.py
{ "start": 508, "end": 626 }
class ____(List[Union[int, float]]): # NoQA: UP006,UP007 """A subclass of List[Union[int, float]]""" pass
Quux
python
google__jax
tests/tree_util_test.py
{ "start": 56459, "end": 59320 }
class ____(jtu.JaxTestCase): def test_register_dataclass_with_field_specifier(self): @tree_util.register_dataclass @dataclasses.dataclass class Foo: x: int y: int = dataclasses.field(metadata=dict(static=True)) f = Foo(2, 3) self.assertLen(jax.tree.leaves(f), 1) def test_register_...
RegistrationTest
python
walkccc__LeetCode
solutions/2014. Longest Subsequence Repeated k Times/2014.py
{ "start": 0, "end": 970 }
class ____: def longestSubsequenceRepeatedK(self, s: str, k: int) -> str: ans = '' count = [0] * 26 possibleChars = [] # Stores subsequences, where the length grows by 1 each time. q = collections.deque(['']) for c in s: count[ord(c) - ord('a')] += 1 for c in string.ascii_lowercase...
Solution
python
pennersr__django-allauth
allauth/socialaccount/providers/eventbrite/provider.py
{ "start": 332, "end": 709 }
class ____(ProviderAccount): """ProviderAccount subclass for Eventbrite.""" def get_avatar_url(self): """Return avatar url.""" return self.account.extra_data["image_id"] def to_str(self): emails = self.account.extra_data.get("emails") if emails: return emails[0]...
EventbriteAccount
python
PyCQA__pylint
pylint/utils/file_state.py
{ "start": 694, "end": 9628 }
class ____: """Hold internal state specific to the currently analyzed file.""" def __init__( self, modname: str, msg_store: MessageDefinitionStore, node: nodes.Module | None = None, *, is_base_filestate: bool = False, ) -> None: self.base_name = modna...
FileState
python
GoogleCloudPlatform__python-docs-samples
appengine/standard/ndb/property_subclasses/my_models.py
{ "start": 2445, "end": 2869 }
class ____(ndb.StructuredProperty): def __init__(self, **kwds): super(FuzzyDateProperty, self).__init__(FuzzyDateModel, **kwds) def _validate(self, value): assert isinstance(value, FuzzyDate) def _to_base_type(self, value): return FuzzyDateModel(first=value.first, last=value.last) ...
FuzzyDateProperty
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/quantization_ops/quantization_ops_test.py
{ "start": 6032, "end": 7900 }
class ____(test_util.TensorFlowTestCase): @test_util.run_in_graph_and_eager_modes def test_invalid_inputs(self): inputs = constant_op.constant( np.int8(0), shape=[3, 3, 3, 3], dtype=dtypes.qint8) bias = constant_op.constant(np.int8(0), shape=[3], dtype=dtypes.qint8) with self.assertRaisesRegex...
QuantizedBiasedAddTest
python
run-llama__llama_index
llama-index-integrations/voice_agents/llama-index-voice-agents-elevenlabs/llama_index/voice_agents/elevenlabs/events.py
{ "start": 769, "end": 862 }
class ____(BaseVoiceAgentEvent): model_config = ConfigDict(extra="allow")
InterruptionEvent
python
apache__airflow
task-sdk/tests/task_sdk/execution_time/test_supervisor.py
{ "start": 39511, "end": 50305 }
class ____: @pytest.fixture def mock_process(self, mocker): process = mocker.Mock(spec=psutil.Process) process.pid = 12345 return process @pytest.fixture def watched_subprocess(self, mocker, mock_process): proc = ActivitySubprocess( process_log=mocker.MagicMo...
TestWatchedSubprocessKill
python
mlflow__mlflow
tests/langchain/sample_code/langchain_chat_agent.py
{ "start": 630, "end": 1950 }
class ____(ChatOpenAI, extra="allow"): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._responses = iter([AIMessage(content="1")]) self._stream_responses = iter( [ AIMessageChunk(content="1"), AIMessageChunk(content="2"...
FakeOpenAI
python
google__pytype
pytype/tools/analyze_project/pytype_runner.py
{ "start": 547, "end": 639 }
class ____: CHECK = 'check' INFER = 'infer' GENERATE_DEFAULT = 'generate default'
Action
python
pypa__virtualenv
src/virtualenv/create/via_global_ref/api.py
{ "start": 254, "end": 685 }
class ____(CreatorMeta): def __init__(self) -> None: super().__init__() self.copy_error = None self.symlink_error = None if not fs_supports_symlink(): self.symlink_error = "the filesystem does not supports symlink" @property def can_copy(self): return not...
ViaGlobalRefMeta
python
python__mypy
mypy/test/testinfer.py
{ "start": 5591, "end": 7526 }
class ____(Suite): """Test cases for checker.DisjointDict, which is used for type inference with operands.""" def new(self) -> DisjointDict[int, str]: return DisjointDict() def test_independent_maps(self) -> None: d = self.new() d.add_mapping({0, 1}, {"group1"}) d.add_mappi...
OperandDisjointDictSuite
python
python__mypy
mypy/report.py
{ "start": 6695, "end": 11201 }
class ____(AbstractReporter): """Report frequencies of different kinds of Any types.""" def __init__(self, reports: Reports, output_dir: str) -> None: super().__init__(reports, output_dir) self.counts: dict[str, tuple[int, int]] = {} self.any_types_counter: dict[str, collections.Counter...
AnyExpressionsReporter
python
doocs__leetcode
solution/1000-1099/1000.Minimum Cost to Merge Stones/Solution.py
{ "start": 0, "end": 698 }
class ____: def mergeStones(self, stones: List[int], K: int) -> int: n = len(stones) if (n - 1) % (K - 1): return -1 s = list(accumulate(stones, initial=0)) f = [[[inf] * (K + 1) for _ in range(n + 1)] for _ in range(n + 1)] for i in range(1, n + 1): f...
Solution
python
eventlet__eventlet
eventlet/support/greendns.py
{ "start": 6070, "end": 11371 }
class ____: """Class to parse the hosts file Attributes ---------- :fname: The filename of the hosts file in use. :interval: The time between checking for hosts file modification """ LINES_RE = re.compile(r""" \s* # Leading space ([^\r\n#]*?) # The actual match, non-gree...
HostsResolver
python
getsentry__sentry
src/sentry/statistical_detectors/algorithm.py
{ "start": 2771, "end": 3009 }
class ____(ABC): @abstractmethod def update( self, raw: Mapping[str | bytes, bytes | float | int | str], payload: DetectorPayload, ) -> tuple[TrendType, float, DetectorState | None]: ...
DetectorAlgorithm
python
numba__llvmlite
llvmlite/binding/value.py
{ "start": 13537, "end": 13770 }
class ____(_ValueIterator): kind = 'instruction' def _dispose(self): self._capi.LLVMPY_DisposeInstructionsIter(self) def _next(self): return ffi.lib.LLVMPY_InstructionsIterNext(self)
_InstructionsIterator
python
pytorch__pytorch
torch/utils/_pytree.py
{ "start": 64933, "end": 65350 }
class ____: """ _TreeSpecSchema is the schema used to serialize the TreeSpec It contains the following fields: - type: A string name of the type. null for the case of a LeafSpec. - context: Any format which is json dumpable - children_spec: A list of children serialized specs. """ type:...
_TreeSpecSchema
python
scipy__scipy
scipy/stats/tests/test_mstats_basic.py
{ "start": 35019, "end": 35725 }
class ____: def setup_method(self): self.a1 = [3, 4, 5, 10, -3, -5, 6] self.a2 = [3, -6, -2, 8, 7, 4, 2, 1] self.a3 = [3., 4, 5, 10, -3, -5, -6, 7.0] def test_percentile(self): x = np.arange(8) * 0.5 assert_equal(mstats.scoreatpercentile(x, 0), 0.) assert_equal(m...
TestPercentile
python
plotly__plotly.py
plotly/graph_objs/cone/_lighting.py
{ "start": 233, "end": 7731 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "cone" _path_str = "cone.lighting" _valid_props = { "ambient", "diffuse", "facenormalsepsilon", "fresnel", "roughness", "specular", "vertexnormalsepsilon", } @property def ambient(sel...
Lighting
python
getsentry__sentry
src/sentry/auth/providers/fly/provider.py
{ "start": 3462, "end": 3817 }
class ____(FlyOAuth2Provider): """ When a customer is no longer on a Fly.io sponsored plan, we change their provider to the "non-partner" version of Fly SSO so that it can be disabled. """ name = SPONSOR_OAUTH_NAME[ChannelName.FLY_NON_PARTNER] key = ChannelName.FLY_NON_PARTNER.value is_part...
NonPartnerFlyOAuth2Provider
python
google__pytype
pytype/overlays/fiddle_overlay.py
{ "start": 1987, "end": 7175 }
class ____(abstract.PyTDClass, mixin.HasSlots): """Factory for creating fiddle.Config classes.""" def __init__(self, name, ctx, module): pytd_cls = ctx.loader.lookup_pytd(module, name) # fiddle.Config/Partial loads as a LateType, convert to pytd.Class if isinstance(pytd_cls, pytd.Constant): pytd_...
BuildableBuilder
python
Textualize__textual
src/textual/widgets/_text_area.py
{ "start": 2847, "end": 3247 }
class ____: """A container for a language which has been registered with the TextArea.""" name: str """The name of the language""" language: "Language" | None """The tree-sitter language object if that has been overridden, or None if it is a built-in language.""" highlight_query: str """T...
TextAreaLanguage
python
joke2k__faker
faker/exceptions.py
{ "start": 286, "end": 506 }
class ____(BaseFakerException): """The requested feature is not available on this system.""" def __init__(self, msg: str, name: str) -> None: self.name = name super().__init__(msg)
UnsupportedFeature
python
getsentry__sentry
src/sentry/api/endpoints/organization_events_spans_histogram.py
{ "start": 1467, "end": 2828 }
class ____(OrganizationEventsV2EndpointBase): publish_status = { "GET": ApiPublishStatus.PRIVATE, } def get(self, request: Request, organization: Organization) -> Response: try: snuba_params = self.get_snuba_params(request, organization) except NoProjects: re...
OrganizationEventsSpansHistogramEndpoint