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
vyperlang__vyper
tests/evm_backends/abi_contract.py
{ "start": 7756, "end": 10236 }
class ____: """ Represents a set of functions that have the same name but different argument types. This is used to implement function overloading. """ @staticmethod def create( functions: list[ABIFunction], contract: "ABIContract" ) -> Union["ABIOverload", ABIFunction]: """...
ABIOverload
python
numba__numba
numba/tests/test_numpy_support.py
{ "start": 9647, "end": 17397 }
class ____(TestCase): """ Test ufunc helpers. """ def test_ufunc_find_matching_loop(self): f = numpy_support.ufunc_find_matching_loop np_add = FakeUFunc(_add_types) np_mul = FakeUFunc(_mul_types) np_isnan = FakeUFunc(_isnan_types) np_sqrt = FakeUFunc(_sqrt_types)...
TestUFuncs
python
getsentry__sentry
src/sentry/monitors/validators.py
{ "start": 22210, "end": 22384 }
class ____(serializers.Serializer): trace = TraceContextValidator(required=False) @extend_schema_serializer(exclude_fields=["monitor_config", "contexts"])
ContextsValidator
python
getsentry__sentry
src/sentry/incidents/models/alert_rule.py
{ "start": 14221, "end": 20890 }
class ____(AbstractNotificationAction): """ This model represents an action that occurs when a trigger (over/under) is fired. This is typically some sort of notification. NOTE: AlertRuleTrigger is the 'threshold' for the AlertRule """ __relocation_scope__ = RelocationScope.Global Type = A...
AlertRuleTriggerAction
python
facelessuser__pymdown-extensions
pymdownx/smartsymbols.py
{ "start": 3491, "end": 3960 }
class ____(HtmlInlineProcessor): """Smart symbols patterns handler.""" def __init__(self, pattern, replace, md): """Setup replace pattern.""" super().__init__(pattern, md) self.replace = replace def handleMatch(self, m, data): """Replace symbol.""" return self.md....
SmartSymbolsPattern
python
PrefectHQ__prefect
src/prefect/server/events/filters.py
{ "start": 13976, "end": 18378 }
class ____(EventDataFilter): id: Optional[list[str]] = Field( None, description="Only include events for related resources with these IDs" ) role: Optional[list[str]] = Field( None, description="Only include events for related resources in these roles" ) resources_in_roles: Optional[...
EventRelatedFilter
python
airbytehq__airbyte
airbyte-integrations/connectors/source-azure-blob-storage/source_azure_blob_storage/spec.py
{ "start": 1942, "end": 2519 }
class ____(BaseModel): class Config(OneOfOptionConfig): title = "Authenticate via Storage Account Key" discriminator = "auth_type" auth_type: Literal["storage_account_key"] = Field("storage_account_key", const=True) azure_blob_storage_account_key: str = Field( title="Azure Blob Stor...
StorageAccountKey
python
getsentry__sentry
src/sentry/data_secrecy/models/data_access_grant.py
{ "start": 332, "end": 1990 }
class ____(DefaultFieldsModel): __relocation_scope__ = RelocationScope.Excluded class GrantType(StrEnum): ZENDESK = "zendesk" MANUAL = "manual" class RevocationReason(StrEnum): TICKET_RESOLVED = "ticket_resolved" MANUAL_REVOCATION = "manual_revocation" organization_id ...
DataAccessGrant
python
ApeWorX__ape
src/ape/exceptions.py
{ "start": 23046, "end": 24918 }
class ____(PluginInstallError): """ An error related to specified plugin version. """ def __init__( self, operation: str, reason: Optional[str] = None, resolution: Optional[str] = None ): message = f"Unable to {operation} plugin." if reason: message = f"{message}...
PluginVersionError
python
apache__airflow
airflow-core/src/airflow/utils/log/task_handler_with_custom_formatter.py
{ "start": 1188, "end": 2561 }
class ____(logging.StreamHandler): """Custom implementation of StreamHandler, a class which writes logging records for Airflow.""" prefix_jinja_template: Template | None = None def set_context(self, ti) -> None: """ Accept the run-time context (i.e. the current task) and configure the form...
TaskHandlerWithCustomFormatter
python
run-llama__llama_index
llama-index-integrations/storage/chat_store/llama-index-storage-chat-store-sqlite/llama_index/storage/chat_store/sqlite/base.py
{ "start": 3729, "end": 13741 }
class ____(BaseChatStore): table_name: Optional[str] = Field( default="chatstore", description="SQLite table name." ) _table_class: TableProtocol = PrivateAttr() # type: ignore _session: sessionmaker = PrivateAttr() # type: ignore _async_session: async_sessionmaker = PrivateAttr() # type...
SQLiteChatStore
python
jmcnamara__XlsxWriter
xlsxwriter/test/comparison/test_chart_pie04.py
{ "start": 315, "end": 1252 }
class ____(ExcelComparisonTest): """ Test file created by XlsxWriter against a file created by Excel. """ def setUp(self): self.set_filename("chart_pie04.xlsx") def test_create_file(self): """Test the creation of a simple XlsxWriter file.""" workbook = Workbook(self.got_f...
TestCompareXLSXFiles
python
gevent__gevent
src/greentest/3.14/test_httpservers.py
{ "start": 63466, "end": 65419 }
class ____(unittest.TestCase): def mock_server_class(self): return mock.MagicMock( return_value=mock.MagicMock( __enter__=mock.MagicMock( return_value=mock.MagicMock( socket=mock.MagicMock( getsockname=lambd...
ScriptTestCase
python
spack__spack
lib/spack/spack/util/windows_registry.py
{ "start": 15529, "end": 16065 }
class ____(RegistryError): """A Runtime Error ecountered when a registry operation is invalid for an indeterminate reason""" def __init__(self, name, e, *args, **kwargs): message = ( f"Windows registry operations: {name} encountered error: {str(e)}" "\nMethod invoked with pa...
InvalidRegistryOperation
python
doocs__leetcode
solution/0900-0999/0956.Tallest Billboard/Solution2.py
{ "start": 0, "end": 634 }
class ____: def tallestBillboard(self, rods: List[int]) -> int: n = len(rods) s = sum(rods) f = [[-inf] * (s + 1) for _ in range(n + 1)] f[0][0] = 0 t = 0 for i, x in enumerate(rods, 1): t += x for j in range(t + 1): f[i][j] = f...
Solution
python
spyder-ide__spyder
spyder/api/widgets/comboboxes.py
{ "start": 2410, "end": 5078 }
class ____(QLineEdit): """Lineedit used for comboboxes.""" sig_mouse_clicked = Signal() def __init__(self, parent, editable, elide_mode=None): super().__init__(parent) self._editable = editable self._elide_mode = elide_mode self._focus_in = False # Fix style issues...
_SpyderComboBoxLineEdit
python
apache__airflow
task-sdk/tests/task_sdk/api/test_client.py
{ "start": 36898, "end": 38878 }
class ____: """ Test that the TestConnectionOperations class works as expected. While the operations are simple, it still catches the basic functionality of the client for connections including endpoint and response parsing. """ def test_connection_get_success(self): # Simulate a succes...
TestConnectionOperations
python
ansible__ansible
test/integration/targets/ansible-test-container/runme.py
{ "start": 39572, "end": 41334 }
class ____(Bootstrapper): """Bootstrapper for apk based systems.""" @classmethod def install_podman(cls) -> bool: """Return True if podman will be installed.""" return True @classmethod def install_docker(cls) -> bool: """Return True if docker will be installed.""" ...
ApkBootstrapper
python
Farama-Foundation__Gymnasium
tests/testing_env.py
{ "start": 5318, "end": 8436 }
class ____(VectorEnv): """A generic testing vector environment similar to GenericTestEnv. Some tests cannot use SyncVectorEnv, e.g. when returning non-numpy arrays in the observations. In these cases, GenericTestVectorEnv can be used to simulate a vector environment. """ def __init__( self...
GenericTestVectorEnv
python
huggingface__transformers
src/transformers/models/kosmos2/modeling_kosmos2.py
{ "start": 53552, "end": 56395 }
class ____(Kosmos2PreTrainedModel): config: Kosmos2TextConfig input_modalities = ("text",) def __init__(self, config: Kosmos2TextConfig): super().__init__(config) self.model = Kosmos2TextTransformer(config) # Initialize weights and apply final processing self.post_init() ...
Kosmos2TextModel
python
facelessuser__pymdown-extensions
tests/test_extensions/test_superfences.py
{ "start": 22366, "end": 24728 }
class ____(util.MdCase): """Test classes and ids without attribute lists.""" extension = ['pymdownx.superfences'] extension_configs = {} def test_classes(self): """Test extra classes.""" self.check_markdown( r''' ```{.python .more} import test ...
TestSuperFencesClassesIds
python
getsentry__sentry
tests/snuba/api/endpoints/test_organization_events_mep.py
{ "start": 146434, "end": 150674 }
class ____( OrganizationEventsMetricsEnhancedPerformanceEndpointTest ): def setUp(self) -> None: super().setUp() self.features["organizations:use-metrics-layer"] = True @pytest.mark.xfail(reason="Not supported") def test_time_spent(self) -> None: super().test_time_spent() @...
OrganizationEventsMetricsEnhancedPerformanceEndpointTestWithMetricLayer
python
coleifer__peewee
tests/regressions.py
{ "start": 8823, "end": 9348 }
class ____(BaseTestCase): def test_subquery_function_call(self): Sample = Table('sample') SA = Sample.alias('s2') query = (Sample .select(Sample.c.data) .where(~fn.EXISTS( SA.select(SQL('1')).where(SA.c.key == 'foo')))) self.asse...
TestSubqueryFunctionCall
python
huggingface__transformers
src/transformers/models/colqwen2/modular_colqwen2.py
{ "start": 13944, "end": 18473 }
class ____(ColPaliForRetrieval): _checkpoint_conversion_mapping = {} def __init__(self, config: ColQwen2Config): super().__init__(config) del self._tied_weights_keys @can_return_tuple @auto_docstring def forward( self, input_ids: Optional[torch.LongTensor] = None, ...
ColQwen2ForRetrieval
python
spack__spack
lib/spack/spack/environment/depfile.py
{ "start": 3958, "end": 10804 }
class ____: """This class produces all data to render a makefile for specs of an environment.""" def __init__( self, env: ev.Environment, roots: List[spack.spec.Spec], adjacency_list: List[DepfileNode], make_prefix: Optional[str], jobserver: bool, ): ...
MakefileModel
python
pytorch__pytorch
test/torch_np/test_basic.py
{ "start": 7016, "end": 7407 }
class ____(TestCase): """Smoke test (shape_like) -> array.""" shape = (3, 4) @parametrize("func", shape_funcs) def test_shape(self, func): a = func(self.shape) assert isinstance(a, w.ndarray) assert a.shape == self.shape seq_funcs = [w.atleast_1d, w.atleast_2d, w.atleast_3d,...
TestShapeLikeToArray
python
bokeh__bokeh
src/bokeh/models/glyphs.py
{ "start": 39838, "end": 41827 }
class ____(XYGlyph, LineGlyph, FillGlyph, HatchGlyph): ''' Render rectangles, characterised by center position (x and y), width, height, and angle of rotation. .. warning:: ``Rect`` glyphs are not well defined on logarithmic scales. Use :class:`~bokeh.models.Block` or :class:`~bokeh.models....
Rect
python
PrefectHQ__prefect
src/prefect/server/schemas/actions.py
{ "start": 33908, "end": 34848 }
class ____(ActionBaseModel): """Data used by the Prefect REST API to create a work queue.""" name: Name = Field(default=..., description="The name of the work queue.") description: Optional[str] = Field( default="", description="An optional description for the work queue." ) is_paused: bool...
WorkQueueCreate
python
spyder-ide__spyder
spyder/utils/stylesheet.py
{ "start": 29703, "end": 30992 }
class ____(SpyderFontsMixin): """Style constants for tour and about dialogs.""" IconScaleFactor = 0.5 BackgroundColor = SpyderPalette.COLOR_BACKGROUND_2 BorderColor = SpyderPalette.COLOR_BACKGROUND_5 @classproperty def _fs(cls): return cls.get_font(SpyderFontType.Interface).pointSize()...
DialogStyle
python
kamyu104__LeetCode-Solutions
Python/cells-in-a-range-on-an-excel-sheet.py
{ "start": 46, "end": 283 }
class ____(object): def cellsInRange(self, s): """ :type s: str :rtype: List[str] """ return [chr(x)+chr(y) for x in xrange(ord(s[0]), ord(s[3])+1) for y in xrange(ord(s[1]), ord(s[4])+1)]
Solution
python
aimacode__aima-python
text.py
{ "start": 3291, "end": 4745 }
class ____(NgramCharModel): def __init__(self, observation_sequence=None, default=0): CountingProbDist.__init__(self, default=default) self.n = 1 self.cond_prob = defaultdict() self.add_sequence(observation_sequence or []) def add_sequence(self, words): for word in words...
UnigramCharModel
python
ray-project__ray
rllib/utils/exploration/per_worker_ornstein_uhlenbeck_noise.py
{ "start": 275, "end": 1947 }
class ____(OrnsteinUhlenbeckNoise): """A per-worker Ornstein Uhlenbeck noise class for distributed algorithms. Sets the Gaussian `scale` schedules of individual workers to a constant: 0.4 ^ (1 + [worker-index] / float([num-workers] - 1) * 7) See Ape-X paper. """ def __init__( self, ...
PerWorkerOrnsteinUhlenbeckNoise
python
joerick__pyinstrument
test/fake_time_util.py
{ "start": 776, "end": 1912 }
class ____: # this implementation mostly lifted from # https://aiotools.readthedocs.io/en/latest/_modules/aiotools/timer.html#VirtualClock # License: https://github.com/achimnol/aiotools/blob/800f7f1bce086b0c83658bad8377e6cb1908e22f/LICENSE # Copyright (c) 2017 Joongi Kim def __init__(self) -> None:...
FakeClockAsyncio
python
keras-team__keras
keras/src/ops/numpy.py
{ "start": 5467, "end": 7000 }
class ____(Operation): def call(self, x1, x2): return backend.numpy.add(x1, x2) def compute_output_spec(self, x1, x2): x1_shape = getattr(x1, "shape", []) x2_shape = getattr(x2, "shape", []) output_shape = broadcast_shapes(x1_shape, x2_shape) output_dtype = dtypes.result...
Add
python
ansible__ansible
lib/ansible/module_utils/six/__init__.py
{ "start": 14646, "end": 15342 }
class ____(_LazyModule): """Lazy loading of moved objects in six.moves.urllib_error""" _urllib_error_moved_attributes = [ MovedAttribute("URLError", "urllib2", "urllib.error"), MovedAttribute("HTTPError", "urllib2", "urllib.error"), MovedAttribute("ContentTooShortError", "urllib", "urllib.error"), ] ...
Module_six_moves_urllib_error
python
getsentry__sentry
src/sentry/api/serializers/models/rule.py
{ "start": 1806, "end": 1853 }
class ____(TypedDict): detail: str
_ErrorDict
python
scipy__scipy
scipy/io/arff/tests/test_arffread.py
{ "start": 3057, "end": 3828 }
class ____: def test_nodata(self): # The file nodata.arff has no data in the @DATA section. # Reading it should result in an array with length 0. nodata_filename = os.path.join(data_path, 'nodata.arff') data, meta = loadarff(nodata_filename) if sys.byteorder == 'big': ...
TestNoData
python
jazzband__django-pipeline
pipeline/compilers/es6.py
{ "start": 87, "end": 602 }
class ____(SubProcessCompiler): output_extension = "js" def match_file(self, path): return path.endswith(".es6") def compile_file(self, infile, outfile, outdated=False, force=False): if not outdated and not force: return # File doesn't need to be recompiled command = (...
ES6Compiler
python
getsentry__sentry
src/sentry/relocation/api/endpoints/public_key.py
{ "start": 682, "end": 1974 }
class ____(Endpoint): owner = ApiOwner.HYBRID_CLOUD publish_status = { # TODO(getsentry/team-ospo#214): Stabilize before GA. "GET": ApiPublishStatus.EXPERIMENTAL, } permission_classes = (SentryIsAuthenticated,) def get(self, request: Request) -> Response: """ Get you...
RelocationPublicKeyEndpoint
python
apache__airflow
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/pod.py
{ "start": 3841, "end": 3968 }
class ____(Enum): """Type of Events emitted by kubernetes pod.""" WARNING = "Warning" NORMAL = "Normal"
PodEventType
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/sql/traversals.py
{ "start": 33091, "end": 34278 }
class ____(TraversalComparatorStrategy): def compare_column_element( self, left, right, use_proxies=True, equivalents=(), **kw ): """Compare ColumnElements using proxies and equivalent collections. This is a comparison strategy specific to the ORM. """ to_compare = (rig...
ColIdentityComparatorStrategy
python
allegroai__clearml
clearml/backend_api/services/v2_13/projects.py
{ "start": 114448, "end": 119425 }
class ____(Request): """ Update project information :param project: Project id :type project: str :param name: Project name. Unique within the company. :type name: str :param description: Project description :type description: str :param tags: User-defined tags list :type tags: ...
UpdateRequest
python
getsentry__sentry
src/sentry/api/serializers/models/debug_file.py
{ "start": 139, "end": 735 }
class ____(Serializer): def serialize(self, obj, attrs, user, **kwargs): d = { "id": str(obj.id), "uuid": obj.debug_id[:36], "debugId": obj.debug_id, "codeId": obj.code_id, "cpuName": obj.cpu_name, "objectName": obj.object_name, ...
DebugFileSerializer
python
getsentry__sentry
src/sentry/notifications/platform/discord/provider.py
{ "start": 1117, "end": 4518 }
class ____(NotificationRenderer[DiscordRenderable]): provider_key = NotificationProviderKey.DISCORD @classmethod def render[DataT: NotificationData]( cls, *, data: DataT, rendered_template: NotificationRenderedTemplate ) -> DiscordRenderable: from sentry.integrations.discord.message_bui...
DiscordRenderer
python
psf__black
src/blib2to3/pygram.py
{ "start": 3235, "end": 5020 }
class ____(Symbols): Alternative: int Alternatives: int Details: int Matcher: int NegatedUnit: int Repeater: int Unit: int python_grammar: Grammar python_grammar_async_keywords: Grammar python_grammar_soft_keywords: Grammar pattern_grammar: Grammar python_symbols: _python_symbols pattern_s...
_pattern_symbols
python
pytorch__pytorch
test/distributed/checkpoint/e2e/test_e2e_save_and_load.py
{ "start": 17660, "end": 19448 }
class ____(DTensorTestBase): @with_temp_dir def test_init_state_dict(self): temp_dir = self.temp_dir model = TestDummyModel() optim = torch.optim.Adam(model.parameters(), lr=0.1) state_dict_to_save = { "model": get_model_state_dict(model), "optimizer": ge...
TestInitStateDict
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 311502, "end": 311965 }
class ____(sgqlc.types.Input): """Ordering options for team repository connections""" __schema__ = github_schema __field_names__ = ("field", "direction") field = sgqlc.types.Field(sgqlc.types.non_null(TeamRepositoryOrderField), graphql_name="field") """The field to order repositories by.""" di...
TeamRepositoryOrder
python
doocs__leetcode
solution/2200-2299/2269.Find the K-Beauty of a Number/Solution2.py
{ "start": 0, "end": 440 }
class ____: def divisorSubstrings(self, num: int, k: int) -> int: x, p = 0, 1 t = num for _ in range(k): t, v = divmod(t, 10) x = p * v + x p *= 10 ans = int(x != 0 and num % x == 0) p //= 10 while t: x //= 10 ...
Solution
python
airbytehq__airbyte
airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/streams.py
{ "start": 3088, "end": 3473 }
class ____(FBMarketingStream): """doc: https://developers.facebook.com/docs/marketing-api/reference/custom-conversion""" entity_prefix = "customconversion" def list_objects(self, params: Mapping[str, Any], account_id: str) -> Iterable: return self._api.get_account(account_id=account_id).get_custom...
CustomConversions
python
django__django
tests/fixtures_regress/models.py
{ "start": 7609, "end": 7758 }
class ____(BaseNKModel): a_set = models.ManyToManyField( "M2MComplexCircular1A", through="M2MCircular1ThroughCA" )
M2MComplexCircular1C
python
google__pytype
pytype/abstract/_classes.py
{ "start": 36180, "end": 39774 }
class ____(ParameterizedClass, mixin.HasSlots): # pytype: disable=signature-mismatch """A Callable with a list of argument types. The formal_type_parameters attribute stores the types of the individual arguments under their indices, the overall argument type under "ARGS", and the return type under "RET". So f...
CallableClass
python
ansible__ansible
lib/ansible/utils/plugin_docs.py
{ "start": 5587, "end": 16119 }
class ____(AnsibleError): pass def add_fragments(doc, filename, fragment_loader, is_module=False, section='DOCUMENTATION'): if section not in _FRAGMENTABLE: raise AnsibleError(f"Invalid fragment section ({section}) passed to render {filename}, it can only be one of {_FRAGMENTABLE!r}") fragments ...
AnsibleFragmentError
python
sqlalchemy__sqlalchemy
test/orm/test_deprecations.py
{ "start": 50921, "end": 52424 }
class ____(PathTest, OptionsQueryTest): run_create_tables = False run_inserts = None run_deletes = None def _assert_opts(self, q, sub_opt, non_sub_opts): attr_a = {} for val in sub_opt._to_bind: val._bind_loader( [ ent.entity_zero ...
SubOptionsTest
python
getsentry__sentry
src/sentry/migrations/1005_add_groupemailthread_project_date_index.py
{ "start": 155, "end": 1479 }
class ____(CheckedMigration): # This flag is used to mark that a migration shouldn't be automatically run in production. # This should only be used for operations where it's safe to run the migration after your # code has deployed. So this should not be used for most operations that alter the schema # o...
Migration
python
ray-project__ray
python/ray/serve/_private/common.py
{ "start": 29491, "end": 29660 }
class ____(str, Enum): """Determines what direction the target capacity is scaling.""" UP = "UP" DOWN = "DOWN" @dataclass(frozen=True)
TargetCapacityDirection
python
ray-project__ray
python/ray/llm/_internal/batch/stages/configs.py
{ "start": 212, "end": 1072 }
class ____(BaseModelExtended): enabled: bool = Field(default=True, description="Whether this stage is enabled.") # Optional overrides; processor-level defaults still apply batch_size: Optional[int] = Field(default=None, description="Rows per batch.") concurrency: Optional[Union[int, Tuple[int, int]]] = ...
_StageConfigBase
python
django__django
tests/check_framework/test_security.py
{ "start": 19344, "end": 19689 }
class ____(SimpleTestCase): @override_settings(DEBUG=True) def test_debug_true(self): """ Warn if DEBUG is True. """ self.assertEqual(base.check_debug(None), [base.W018]) @override_settings(DEBUG=False) def test_debug_false(self): self.assertEqual(base.check_debu...
CheckDebugTest
python
django__django
tests/model_formsets/models.py
{ "start": 6967, "end": 7156 }
class ____(models.Model): name = models.CharField(max_length=255) parent = models.ForeignKey( ParentWithUUIDAlternateKey, models.CASCADE, to_field="uuid" )
ChildRelatedViaAK
python
pytorch__pytorch
torch/testing/_internal/jit_utils.py
{ "start": 25645, "end": 29554 }
class ____: def __enter__(self): self.prev = torch._C._jit_get_tracer_state_warn() torch._C._jit_set_tracer_state_warn(False) def __exit__(self, *args): torch._C._jit_set_tracer_state_warn(self.prev) @contextmanager def inline_everything_mode(should_inline): old = torch._C._jit_get...
NoTracerWarnContextManager
python
google__jax
tests/tree_util_test.py
{ "start": 4548, "end": 4606 }
class ____(int): pass @tree_util.register_static
StaticInt
python
PyCQA__pylint
tests/functional/t/try_except_raise_crash.py
{ "start": 333, "end": 539 }
class ____(TestBaseException): pass def test(): try: 1 / 0 except TestException: # [catching-non-exception,try-except-raise] raise except Exception: pass
TestException
python
FactoryBoy__factory_boy
tests/test_base.py
{ "start": 786, "end": 831 }
class ____(FakeDjangoModel): pass
TestModel
python
kubernetes-client__python
kubernetes/client/models/v1_volume_attributes_class.py
{ "start": 383, "end": 9573 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attri...
V1VolumeAttributesClass
python
wandb__wandb
tests/system_tests/test_core/test_torch_full.py
{ "start": 2297, "end": 3354 }
class ____(nn.Module): def __init__(self): super().__init__() self.lstm1 = nn.LSTMCell(1, 51) self.lstm2 = nn.LSTMCell(51, 51) self.linear = nn.Linear(51, 1) def forward(self, input, future=0): outputs = [] h_t = dummy_torch_tensor((input.size(0), 51)) c_...
Sequence
python
viewflow__viewflow
viewflow/fsm/views.py
{ "start": 333, "end": 1622 }
class ____(APIView): flow_state_field = None lookup_field = "pk" lookup_url_kwarg = None queryset = None def get_queryset(self): if self.queryset: queryset = self.queryset if isinstance(queryset, QuerySet): # Ensure queryset is re-evaluated on each re...
FlowGraphView
python
tensorflow__tensorflow
tensorflow/lite/python/tflite_convert_test.py
{ "start": 19382, "end": 22245 }
class ____(test_util.TensorFlowTestCase, parameterized.TestCase): @parameterized.named_parameters(('v1', False), ('v2', True)) def test_without_experimental_new_converter(self, use_v2_converter): args = [ '--saved_model_dir=/tmp/saved_model/', '--output_file=/tmp/output.tflite', ] # No...
ArgParserTest
python
openai__openai-python
src/openai/types/beta/assistant_stream_event.py
{ "start": 2878, "end": 3092 }
class ____(BaseModel): data: Run """ Represents an execution run on a [thread](https://platform.openai.com/docs/api-reference/threads). """ event: Literal["thread.run.failed"]
ThreadRunFailed
python
pypa__pipenv
pipenv/patched/pip/_internal/utils/hashes.py
{ "start": 674, "end": 4366 }
class ____: """A wrapper that builds multiple hashes at once and checks them against known-good values """ def __init__(self, hashes: Optional[Dict[str, List[str]]] = None) -> None: """ :param hashes: A dict of algorithm names pointing to lists of allowed hex digests ...
Hashes
python
django__django
tests/admin_checks/models.py
{ "start": 1503, "end": 1745 }
class ____(models.Model): name = models.TextField() content_type = models.ForeignKey(ContentType, models.CASCADE) object_id = models.PositiveIntegerField() content_object = GenericForeignKey("content_type", "object_id")
Influence
python
realpython__materials
duck-typing-python/readers.py
{ "start": 506, "end": 731 }
class ____: def __init__(self, filename): self.filename = filename def read(self): with open(self.filename, encoding="utf-8", newline="") as file: return list(csv.DictReader(file))
CSVReader
python
pytorch__pytorch
torch/distributed/checkpoint/examples/async_checkpointing_example.py
{ "start": 759, "end": 3970 }
class ____(torch.nn.Module): def __init__(self) -> None: super().__init__() self.net1 = nn.Linear(8, 32) self.net2 = nn.Linear(32, 128) self.net3 = nn.Linear(128, 64) self.net4 = nn.Linear(64, 8) self.net5 = nn.Linear(8, 1) def forward(self, x): x = F.rel...
Model
python
huggingface__transformers
tests/models/ernie4_5/test_modeling_ernie4_5.py
{ "start": 1108, "end": 1243 }
class ____(CausalLMModelTester): if is_torch_available(): base_model_class = Ernie4_5Model @require_torch
Ernie4_5ModelTester
python
wandb__wandb
wandb/sdk/wandb_metric.py
{ "start": 174, "end": 3346 }
class ____: """Metric object.""" _callback: Optional[Callable[[pb.MetricRecord], None]] _name: str _step_metric: Optional[str] _step_sync: Optional[bool] _hidden: Optional[bool] _summary: Optional[Sequence[str]] _goal: Optional[str] _overwrite: Optional[bool] def __init__( ...
Metric
python
ansible__ansible
lib/ansible/plugins/cache/__init__.py
{ "start": 10347, "end": 12720 }
class ____(c.MutableMapping): """Batch update wrapper around a cache plugin.""" def __init__(self, plugin_name='memory', **kwargs): self._cache = {} self._retrieved = {} self._plugin = cache_loader.get(plugin_name, **kwargs) def update_cache_if_changed(self): if self._retri...
CachePluginAdjudicator
python
kamyu104__LeetCode-Solutions
Python/kth-smallest-instructions.py
{ "start": 37, "end": 1070 }
class ____(object): def kthSmallestPath(self, destination, k): """ :type destination: List[int] :type k: int :rtype: str """ def nCr(n, r): # Time: O(n), Space: O(1) if n < r: return 0 if n-r < r: return nCr(n, ...
Solution
python
pytorch__pytorch
test/quantization/fx/test_numeric_suite_fx.py
{ "start": 7002, "end": 9862 }
class ____(torch.nn.Module): def __init__(self, weight1d, weight2d, weight3d, bias1d, bias2d, bias3d): super().__init__() self.weight1d = torch.nn.Parameter(weight1d) self.weight2d = torch.nn.Parameter(weight2d) self.weight3d = torch.nn.Parameter(weight3d) self.bias1d = torch...
AllConvFunctional
python
streamlit__streamlit
lib/tests/streamlit/runtime/runtime_test.py
{ "start": 19959, "end": 22602 }
class ____(RuntimeTestCase): """Tests for Runtime.does_script_run_without_error""" def setUp(self) -> None: self._home = tempfile.mkdtemp() self._old_home = os.environ["HOME"] os.environ["HOME"] = self._home self._fd, self._path = tempfile.mkstemp() super().setUp() ...
ScriptCheckTest
python
pdm-project__pdm
src/pdm/models/backends.py
{ "start": 319, "end": 805 }
class ____(metaclass=abc.ABCMeta): """A build backend that does not support dynamic values in dependencies""" def __init__(self, root: Path) -> None: self.root = root def expand_line(self, line: str, expand_env: bool = True) -> str: return line def relative_path_to_url(self, path: str...
BuildBackend
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/ruff/RUF009_attrs_auto_attribs.py
{ "start": 1706, "end": 1838 }
class ____: a: str = 0 b = field() c: int = foo() d = list() @attr.s(auto_attribs=[1, 2, 3]) # auto_attribs = False
C
python
wandb__wandb
wandb/automations/_filters/operators.py
{ "start": 2939, "end": 3443 }
class ____(BaseOp, ABC): exprs: TupleOf[Union[FilterExpr, Op]] @classmethod def wrap(cls, expr: Any) -> Self: return expr if isinstance(expr, cls) else cls(exprs=(expr,)) # Logical operator(s) # https://www.mongodb.com/docs/manual/reference/operator/query/and/ # https://www.mongodb.com/docs/manua...
BaseVariadicLogicalOp
python
dagster-io__dagster
python_modules/automation/automation/parse_dataproc_configs.py
{ "start": 272, "end": 359 }
class ____: def __init__(self, inner_type): self.inner_type = inner_type
List
python
tensorflow__tensorflow
tensorflow/python/distribute/parameter_server_strategy_test.py
{ "start": 22723, "end": 32727 }
class ____( ParameterServerStrategyTestBase, strategy_test_lib.DistributionTestBase, strategy_test_lib.TwoDeviceDistributionTestBase, parameterized.TestCase): @classmethod def setUpClass(cls): cls._cluster_spec = multi_worker_test_base.create_in_process_cluster( num_workers=3, num_ps=2)...
ParameterServerStrategyTest
python
ray-project__ray
python/ray/train/v2/_internal/execution/worker_group/state.py
{ "start": 1250, "end": 4361 }
class ____: """Builder for WorkerGroupState. Example usage: ```python builder = WorkerGroupStateBuilder() builder.with_placement_group(placement_group) builder.with_workers(workers) builder.with_sync_actor(sync_actor) state = builder.build() builder.shut...
WorkerGroupStateBuilder
python
langchain-ai__langchain
libs/langchain/langchain_classic/chains/combine_documents/reduce.py
{ "start": 643, "end": 5102 }
class ____(Protocol): """Interface for the combine_docs method.""" async def __call__(self, docs: list[Document], **kwargs: Any) -> str: """Async interface for the combine_docs method.""" def split_list_of_docs( docs: list[Document], length_func: Callable, token_max: int, **kwargs: An...
AsyncCombineDocsProtocol
python
pypa__pip
src/pip/_vendor/distlib/util.py
{ "start": 43970, "end": 51863 }
class ____(object): unknown = 'UNKNOWN' def __init__(self, minval=0, maxval=100): assert maxval is None or maxval >= minval self.min = self.cur = minval self.max = maxval self.started = None self.elapsed = 0 self.done = False def update(self, curval): ...
Progress
python
neetcode-gh__leetcode
python/0071-simplify-path.py
{ "start": 0, "end": 487 }
class ____: def simplifyPath(self, path: str) -> str: stack = [] for i in path.split("/"): # if i == "/" or i == '//', it becomes '' (empty string) if i == "..": if stack: stack.pop() elif i == "." or i == '': ...
Solution
python
wandb__wandb
wandb/vendor/pygments/lexers/configs.py
{ "start": 10996, "end": 17589 }
class ____(RegexLexer): """ Lexer for `squid <http://www.squid-cache.org/>`_ configuration files. .. versionadded:: 0.9 """ name = 'SquidConf' aliases = ['squidconf', 'squid.conf', 'squid'] filenames = ['squid.conf'] mimetypes = ['text/x-squidconf'] flags = re.IGNORECASE keywo...
SquidConfLexer
python
sympy__sympy
sympy/physics/quantum/cartesian.py
{ "start": 1855, "end": 2237 }
class ____(HermitianOperator): """ Y cartesian coordinate operator (for 2D or 3D systems) """ @classmethod def default_args(self): return ("Y",) @classmethod def _eval_hilbert_space(self, args): return L2(Interval(S.NegativeInfinity, S.Infinity)) def _apply_operator_PositionKe...
YOp
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/assets/job/asset_out.py
{ "start": 1852, "end": 12380 }
class ____: """Defines one of the assets produced by a :py:func:`@multi_asset <multi_asset>`. Args: key_prefix (Optional[Union[str, Sequence[str]]]): If provided, the asset's key is the concatenation of the key_prefix and the asset's name. When using ``@multi_asset``, the asset ...
AssetOut
python
wandb__wandb
wandb/vendor/pygments/lexers/r.py
{ "start": 22534, "end": 23755 }
class ____(RegexLexer): """ Pygments Lexer for R documentation (Rd) files This is a very minimal implementation, highlighting little more than the macros. A description of Rd syntax is found in `Writing R Extensions <http://cran.r-project.org/doc/manuals/R-exts.html>`_ and `Parsing Rd files <de...
RdLexer
python
apache__airflow
airflow-core/tests/unit/plugins/test_plugin.py
{ "start": 5732, "end": 5790 }
class ____(AirflowPlugin): name = "plugin-c"
MockPluginC
python
kubernetes-client__python
kubernetes/client/models/v1_custom_resource_definition_list.py
{ "start": 383, "end": 7265 }
class ____(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attri...
V1CustomResourceDefinitionList
python
scikit-learn__scikit-learn
sklearn/metrics/_plot/confusion_matrix.py
{ "start": 401, "end": 17363 }
class ____: """Confusion Matrix visualization. It is recommended to use :func:`~sklearn.metrics.ConfusionMatrixDisplay.from_estimator` or :func:`~sklearn.metrics.ConfusionMatrixDisplay.from_predictions` to create a :class:`ConfusionMatrixDisplay`. All parameters are stored as attributes. F...
ConfusionMatrixDisplay
python
gevent__gevent
src/gevent/tests/test__server_pywsgi.py
{ "start": 2826, "end": 2916 }
class ____(test__server.TestSSLGetCertificate): Settings = Settings
TestSSLGetCertificate
python
python-markdown__markdown
markdown/extensions/admonition.py
{ "start": 1403, "end": 6566 }
class ____(BlockProcessor): CLASSNAME = 'admonition' CLASSNAME_TITLE = 'admonition-title' RE = re.compile(r'(?:^|\n)!!! ?([\w\-]+(?: +[\w\-]+)*)(?: +"(.*?)")? *(?:\n|$)') RE_SPACES = re.compile(' +') def __init__(self, parser: blockparser.BlockParser): """Initialization.""" super...
AdmonitionProcessor
python
huggingface__transformers
src/transformers/models/visual_bert/modeling_visual_bert.py
{ "start": 1400, "end": 7633 }
class ____(nn.Module): """Construct the embeddings from word, position and token_type embeddings and visual embeddings.""" def __init__(self, config): super().__init__() self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, padding_idx=config.pad_token_id) self.posi...
VisualBertEmbeddings
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/pyupgrade/UP050.py
{ "start": 19, "end": 54 }
class ____(metaclass=type): ...
A
python
celery__celery
t/unit/tasks/test_chord.py
{ "start": 9710, "end": 11371 }
class ____: def setup_method(self): @self.app.task(shared=False) def add(x, y): return x + y self.add = add @self.app.task(shared=False, bind=True) def adds(self, sig, lazy=False): return self.add_to_chord(sig, lazy) self.adds = adds @p...
test_add_to_chord
python
networkx__networkx
networkx/generators/tests/test_lattice.py
{ "start": 3820, "end": 5325 }
class ____: """Unit tests for :func:`networkx.generators.lattice.grid_graph`""" def test_grid_graph(self): """grid_graph([n,m]) is a connected simple graph with the following properties: number_of_nodes = n*m degree_histogram = [0,0,4,2*(n+m)-8,(n-2)*(m-2)] """ f...
TestGridGraph
python
pytorch__pytorch
test/distributed/test_c10d_pypg.py
{ "start": 661, "end": 1084 }
class ____(dist._Work): def __init__(self, result, pg): super().__init__() self.result_ = result self.future_ = torch.futures.Future() self.future_.set_result(result) self.pg_ = weakref.ref(pg) def wait(self, timeout): self.pg_().wait_count += 1 return Tr...
MyWork