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
Netflix__metaflow
metaflow/user_configs/config_parameters.py
{ "start": 13538, "end": 21640 }
class ____(Parameter, collections.abc.Mapping): """ Includes a configuration for this flow. `Config` is a special type of `Parameter` but differs in a few key areas: - it is immutable and determined at deploy time (or prior to running if not deploying to a scheduler) - as such, it can b...
Config
python
python-excel__xlwt
xlwt/BIFFRecords.py
{ "start": 8012, "end": 8131 }
class ____(BiffRecord): _REC_ID = 0x00C1 def __init__(self): self._rec_data = pack('<H', 0x00)
MMSRecord
python
airbytehq__airbyte
airbyte-integrations/connectors/source-shopify/source_shopify/shopify_graphql/bulk/query.py
{ "start": 30666, "end": 33357 }
class ____(ShopifyBulkQuery): """ { collections(query: "updated_at:>='2023-02-07T00:00:00+00:00' AND updated_at:<='2023-12-04T00:00:00+00:00'", sortKey: UPDATED_AT) { edges { node { __typename id handle ...
Collection
python
PyCQA__pylint
doc/data/messages/n/not-context-manager/bad.py
{ "start": 0, "end": 128 }
class ____: def __enter__(self): pass with MyContextManager() as c: # [not-context-manager] pass
MyContextManager
python
simonw__datasette
datasette/views/special.py
{ "start": 38819, "end": 40025 }
class ____(SchemaBaseView): """ Displays schema for a specific database. Supports HTML, JSON, and Markdown formats. """ name = "database_schema" async def get(self, request): database_name = request.url_vars["database"] format_ = request.url_vars.get("format") or "html" ...
DatabaseSchemaView
python
facebook__pyre-check
client/commands/tests/server_setup.py
{ "start": 3831, "end": 4212 }
class ____(connections.AsyncBytesWriter): """ An AsyncBytesWriter that always raises a given except when write is invoked. """ def __init__(self, exception: Exception) -> None: self.exception = exception async def write(self, data: bytes) -> None: raise self.exception async de...
ExceptionRaisingBytesWriter
python
facebook__pyre-check
client/commands/tests/servers_test.py
{ "start": 1135, "end": 7322 }
class ____(testslide.TestCase): def test_parse_running_server_status(self) -> None: def assert_parsed( input: str, expected: servers.RunningServerStatus, flavor: identifiers.PyreFlavor = identifiers.PyreFlavor.CLASSIC, ) -> None: self.assertEqual( ...
ServersTest
python
pola-rs__polars
py-polars/src/polars/io/partition.py
{ "start": 1554, "end": 3091 }
class ____: """ Callback context for a partition creation using keys. .. warning:: This functionality is currently considered **unstable**. It may be changed at any point without it being considered a breaking change. See Also -------- PartitionByKey PartitionParted """...
KeyedPartitionContext
python
ansible__ansible
lib/ansible/plugins/doc_fragments/constructed.py
{ "start": 194, "end": 3320 }
class ____(object): DOCUMENTATION = r""" options: strict: description: - If V(yes) make invalid entries a fatal error, otherwise skip and continue. - Since it is possible to use facts in the expressions they might not always be available and we ignore those errors by default. ty...
ModuleDocFragment
python
huggingface__transformers
src/transformers/models/olmo2/configuration_olmo2.py
{ "start": 1572, "end": 8851 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`Olmo2Model`]. It is used to instantiate an OLMo2 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configur...
Olmo2Config
python
streamlit__streamlit
lib/tests/streamlit/web/cli_test.py
{ "start": 26394, "end": 29970 }
class ____(unittest.TestCase): def tearDown(self) -> None: from streamlit.watcher.event_based_path_watcher import EventBasedPathWatcher EventBasedPathWatcher.close_all() def get_http_session(self) -> requests.Session: http_session = requests.Session() http_session.mount( ...
HTTPServerIntegrationTest
python
plotly__plotly.py
plotly/graph_objs/sunburst/marker/colorbar/_tickfont.py
{ "start": 233, "end": 9959 }
class ____(_BaseTraceHierarchyType): _parent_path_str = "sunburst.marker.colorbar" _path_str = "sunburst.marker.colorbar.tickfont" _valid_props = { "color", "family", "lineposition", "shadow", "size", "style", "textcase", "variant", "we...
Tickfont
python
doocs__leetcode
solution/1900-1999/1947.Maximum Compatibility Score Sum/Solution.py
{ "start": 0, "end": 733 }
class ____: def maxCompatibilitySum( self, students: List[List[int]], mentors: List[List[int]] ) -> int: def dfs(i: int, s: int): if i >= m: nonlocal ans ans = max(ans, s) return for j in range(m): if not vis...
Solution
python
pyca__cryptography
tests/hazmat/primitives/test_ed448.py
{ "start": 1396, "end": 12650 }
class ____: @pytest.mark.parametrize( "vector", load_vectors_from_file( os.path.join("asymmetric", "Ed448", "rfc8032.txt"), load_nist_vectors, ), ) def test_sign_input(self, vector, backend): if vector.get("context") is not None: pytest.ski...
TestEd448Signing
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/class_interval.py
{ "start": 7290, "end": 7762 }
class ____(A17): @classmethod def m1(cls, arg): sink_c(arg) def test_class_methods(): # Expect no issue B17.m0(_test_source()) # Expect no issue as well b = B17() b.m0(_test_source()) # Expect an issue, which is not pruned away by class intervals (unlike the # above call ...
D17
python
python-poetry__poetry
tests/console/test_application_global_options.py
{ "start": 857, "end": 1236 }
class ____(Command): name = "check-project-path" description = "Check Project Path Command" def handle(self) -> int: if not self.poetry.pyproject_path.exists(): raise RuntimeError( f"Wrong project path in handle: {self.poetry.pyproject_path}\nWorking directory: {Path.cw...
CheckProjectPathCommand
python
pandas-dev__pandas
pandas/io/formats/info.py
{ "start": 14266, "end": 15828 }
class ____(_BaseInfo): """ Class storing series-specific info. """ def __init__( self, data: Series, memory_usage: bool | str | None = None, ) -> None: self.data: Series = data self.memory_usage = _initialize_memory_usage(memory_usage) def render( ...
SeriesInfo
python
sanic-org__sanic
sanic/signals.py
{ "start": 4011, "end": 4114 }
class ____(RouteGroup): """A `RouteGroup` that is used to dispatch signals to handlers"""
SignalGroup
python
miyuchina__mistletoe
test/test_cli.py
{ "start": 123, "end": 5579 }
class ____(TestCase): @patch('mistletoe.cli.parse', return_value=Mock(filenames=[], renderer=sentinel.Renderer)) @patch('mistletoe.cli.interactive') def test_main_to_interactive(self, mock_interactive, mock_parse): cli.main(None) mock_interactive.assert_called_with(sentinel.Renderer) @p...
TestCli
python
kamyu104__LeetCode-Solutions
Python/reach-a-number.py
{ "start": 46, "end": 372 }
class ____(object): def reachNumber(self, target): """ :type target: int :rtype: int """ target = abs(target) k = int(math.ceil((-1+math.sqrt(1+8*target))/2)) target -= k*(k+1)/2 return k if target%2 == 0 else k+1+k%2 # Time: O(sqrt(n)) # Space: O(1...
Solution
python
bokeh__bokeh
tests/unit/bokeh/util/test_strings.py
{ "start": 2999, "end": 3444 }
class ____: TEXT = "some text\nto indent\n goes here" def test_default_args(self) -> None: assert bus.indent(self.TEXT) == " some text\n to indent\n goes here" def test_with_n(self) -> None: assert bus.indent(self.TEXT, n=3) == " some text\n to indent\n goes here" def te...
Test_indent
python
spyder-ide__spyder
external-deps/python-lsp-server/test/plugins/test_folding.py
{ "start": 644, "end": 1750 }
class ____(): def method(self, x1): def inner(): return x1 if x2: func(3, 4, 5, 6, 7) elif x3 < 2: pass else: more_complex_func(2, 3, 4, 5, 6, 8) return inner a = 2 operation = (a...
A
python
dagster-io__dagster
python_modules/dagster/dagster/_core/definitions/output.py
{ "start": 12383, "end": 16586 }
class ____( NamedTuple( "_Out", [ ("dagster_type", PublicAttr[Union[DagsterType, type[NoValueSentinel]]]), ("description", PublicAttr[Optional[str]]), ("is_required", PublicAttr[bool]), ("io_manager_key", PublicAttr[str]), ("metadata", Publ...
Out
python
kamyu104__LeetCode-Solutions
Python/maximum-deletions-on-a-string.py
{ "start": 36, "end": 706 }
class ____(object): def deleteString(self, s): """ :type s: str :rtype: int """ if all(x == s[0] for x in s): return len(s) dp2 = [[0]*(len(s)+1) for i in xrange(2)] # dp2[i%2][j]: max prefix length of s[i:] and s[j:] dp = [1]*len(s) # dp[i]: max...
Solution
python
pytorch__pytorch
test/test_legacy_vmap.py
{ "start": 35686, "end": 38398 }
class ____: class TestVmapBaseLegacy(TestCase): def __init__(self, method_name="runTest"): super().__init__(method_name) test_method = getattr(self, method_name, None) if test_method is None: return if not should_allow_vmap_fallback_usage(tes...
Namespace
python
keras-team__keras
keras/src/export/saved_model.py
{ "start": 1322, "end": 28425 }
class ____(BackendExportArchive): """ExportArchive is used to write SavedModel artifacts (e.g. for inference). If you have a Keras model or layer that you want to export as SavedModel for serving (e.g. via TensorFlow-Serving), you can use `ExportArchive` to configure the different serving endpoints you...
ExportArchive
python
takluyver__flit
flit_core/flit_core/sdist.py
{ "start": 751, "end": 1685 }
class ____: """Manage a set of file inclusion/exclusion patterns relative to basedir""" def __init__(self, patterns, basedir): self.basedir = basedir self.dirs = set() self.files = set() for pattern in patterns: for path in sorted(glob(osp.join(basedir, pattern), re...
FilePatterns
python
huggingface__transformers
src/transformers/models/data2vec/modular_data2vec_audio.py
{ "start": 2324, "end": 2386 }
class ____(Wav2Vec2SamePadLayer): pass
Data2VecAudioPadLayer
python
matplotlib__matplotlib
lib/matplotlib/font_manager.py
{ "start": 19748, "end": 32971 }
class ____: """ A class for storing and manipulating font properties. The font properties are the six properties described in the `W3C Cascading Style Sheet, Level 1 <http://www.w3.org/TR/1998/REC-CSS2-19980512/>`_ font specification and *math_fontfamily* for math fonts: - family: A list o...
FontProperties
python
dagster-io__dagster
python_modules/dagster-test/dagster_test/toys/error_monster.py
{ "start": 1468, "end": 6207 }
class ____: pass def resource_init(init_context): if init_context.resource_config["throw_on_resource_init"]: raise Exception("throwing from in resource_fn") return ErrorableResource() def define_errorable_resource(): return ResourceDefinition( resource_fn=resource_init, confi...
ErrorableResource
python
PyCQA__pylint
tests/functional/p/postponed/postponed_evaluation_pep585.py
{ "start": 1186, "end": 1381 }
class ____(typing.TypedDict): my_var: list[int] # Check dataclasses def my_decorator(*args, **kwargs): def wraps(*args, **kwargs): pass return wraps @dataclass
CustomTypedDict4
python
pytorch__pytorch
torch/_subclasses/fake_utils.py
{ "start": 6266, "end": 10311 }
class ____(TorchDispatchMode): def __init__( self, ignore_op_fn: Union[Callable[[OpOverload], bool], None] = None, *, check_strides=True, check_aliasing=True, only_check_ops_with_meta=True, ): super().__init__() self.ignore_op_fn = ( ig...
CrossRefFakeMode
python
pytransitions__transitions
transitions/extensions/states.py
{ "start": 2111, "end": 4750 }
class ____(State): """Adds timeout functionality to a state. Timeouts are handled model-specific. Attributes: timeout (float): Seconds after which a timeout function should be called. on_timeout (list): Functions to call when a timeout is triggered. """ dynamic_methods = ['on_timeout'] ...
Timeout
python
dagster-io__dagster
python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/generated/sources.py
{ "start": 42894, "end": 43772 }
class ____(GeneratedAirbyteSource): @public def __init__( self, name: str, query_path: str, api_key: str, query_params: Optional[str] = None ): """Airbyte Source for Us Census. Documentation can be found at https://docs.airbyte.com/integrations/sources/us-census Args: ...
UsCensusSource
python
dagster-io__dagster
python_modules/libraries/dagster-cloud-cli/dagster_cloud_cli/commands/ci/__init__.py
{ "start": 19618, "end": 22790 }
class ____(Enum): json = "json" markdown = "markdown" @app.command(help="Show status of the current build session") def status( statedir: str = STATEDIR_OPTION, output_format: StatusOutputFormat = typer.Option("json", help="Output format for build status"), ): state_store = state.FileStore(statedi...
StatusOutputFormat
python
getsentry__sentry
src/sentry/issues/ingest.py
{ "start": 5513, "end": 16292 }
class ____(TypedDict): type: str culprit: str | None metadata: Mapping[str, Any] title: str location: str | None last_received: str @sentry_sdk.tracing.trace def materialize_metadata(occurrence: IssueOccurrence, event: Event) -> OccurrenceMetadata: """ Returns the materialized metadata...
OccurrenceMetadata
python
eventlet__eventlet
tests/test__greenness.py
{ "start": 373, "end": 1483 }
class ____(BaseHTTPServer.BaseHTTPRequestHandler): protocol_version = "HTTP/1.0" def log_message(self, *args, **kw): pass def start_http_server(): server_address = ('localhost', 0) httpd = BaseHTTPServer.HTTPServer(server_address, QuietHandler) sa = httpd.socket.getsockname() # print(...
QuietHandler
python
crytic__slither
slither/slithir/operations/lvalue.py
{ "start": 145, "end": 620 }
class ____(Operation): """ Operation with a lvalue """ def __init__(self) -> None: super().__init__() self._lvalue: Optional[Variable] = None @property def lvalue(self) -> Optional[Variable]: return self._lvalue @lvalue.setter def lvalue(self, lvalue: Variable...
OperationWithLValue
python
Pylons__pyramid
tests/test_path.py
{ "start": 12013, "end": 18935 }
class ____(unittest.TestCase): def _makeOne(self, package=None): from pyramid.path import DottedNameResolver return DottedNameResolver(package) def config_exc(self, func, *arg, **kw): try: func(*arg, **kw) except ValueError as e: return e else: ...
TestDottedNameResolver
python
haoel__leetcode
algorithms/python/MiddleOfTheLinkedList/middleOfTheLinkedList.py
{ "start": 135, "end": 602 }
class ____: def middleNode(self, head: ListNode) -> ListNode: aux = head cont = 1 while aux.next: cont += 1 aux = aux.next print(cont) if cont%2 == 0: posicao = (cont/2)+1 else: posicao = (cont//2)+1 aux = head ...
Solution
python
google__jax
jax/_src/pallas/pipelining/schedulers.py
{ "start": 2665, "end": 4634 }
class ____: """Container class containing pipeline state information. Attributes: loop_index: The current grid indices to run for the current stage. linearized_index: The linearized ``loop_index``. pipeline_state: The global pipeline carry state. """ loop_index: tuple[jax.Array, ...] linearized_i...
PipelineContext
python
doocs__leetcode
solution/2800-2899/2834.Find the Minimum Possible Sum of a Beautiful Array/Solution.py
{ "start": 0, "end": 276 }
class ____: def minimumPossibleSum(self, n: int, target: int) -> int: mod = 10**9 + 7 m = target // 2 if n <= m: return ((1 + n) * n // 2) % mod return ((1 + m) * m // 2 + (target + target + n - m - 1) * (n - m) // 2) % mod
Solution
python
django__django
tests/inspectdb/models.py
{ "start": 3833, "end": 4007 }
class ____(models.Model): char_field = models.CharField(max_length=None) class Meta: required_db_features = {"supports_unlimited_charfield"}
CharFieldUnlimited
python
qdrant__qdrant-client
qdrant_client/parallel_processor.py
{ "start": 488, "end": 583 }
class ____(str, Enum): stop = "stop" confirm = "confirm" error = "error"
QueueSignals
python
pallets__jinja
docs/examples/inline_gettext_extension.py
{ "start": 250, "end": 2397 }
class ____(Extension): """This extension implements support for inline gettext blocks:: <h1>_(Welcome)</h1> <p>_(This is a paragraph)</p> Requires the i18n extension to be loaded and configured. """ def filter_stream(self, stream): paren_stack = 0 for token in stream:...
InlineGettext
python
sqlalchemy__sqlalchemy
lib/sqlalchemy/engine/interfaces.py
{ "start": 13825, "end": 15374 }
class ____(TypedDict): """Dictionary representing the reflected elements corresponding to :class:`.Index`. The :class:`.ReflectedIndex` structure is returned by the :meth:`.Inspector.get_indexes` method. """ name: Optional[str] """index name""" column_names: List[Optional[str]] "...
ReflectedIndex
python
django__django
tests/admin_filters/tests.py
{ "start": 4582, "end": 4948 }
class ____(FieldListFilter): list_separator = "|" def __init__(self, field, request, params, model, model_admin, field_path): self.lookup_kwarg = "%s__in" % field_path super().__init__(field, request, params, model, model_admin, field_path) def expected_parameters(self): return [se...
EmployeeNameCustomDividerFilter
python
sqlalchemy__sqlalchemy
test/ext/test_automap.py
{ "start": 20296, "end": 21785 }
class ____(fixtures.TestBase): __only_on__ = "sqlite+pysqlite" def _make_tables(self, e): m = MetaData() for i in range(15): Table( "table_%d" % i, m, Column("id", Integer, primary_key=True), Column("data", String(50)),...
ConcurrentAutomapTest
python
apache__airflow
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_task_instances.py
{ "start": 178921, "end": 194036 }
class ____(TestTaskInstanceEndpoint): ENDPOINT_URL = "/dags/example_python_operator/dagRuns/TEST_DAG_RUN_ID/taskInstances/print_the_context" NEW_STATE = "failed" DAG_ID = "example_python_operator" TASK_ID = "print_the_context" RUN_ID = "TEST_DAG_RUN_ID" DAG_DISPLAY_NAME = "example_python_operato...
TestPatchTaskInstanceDryRun
python
pennersr__django-allauth
allauth/socialaccount/providers/openid/utils.py
{ "start": 1444, "end": 1953 }
class ____: CONTACT_EMAIL = "http://axschema.org/contact/email" PERSON_NAME = "http://axschema.org/namePerson" PERSON_FIRST_NAME = "http://axschema.org/namePerson/first" PERSON_LAST_NAME = "http://axschema.org/namePerson/last" AXAttributes = [ AXAttribute.CONTACT_EMAIL, AXAttribute.PERSON_NAME...
AXAttribute
python
getsentry__sentry
tests/sentry/db/models/test_base.py
{ "start": 1098, "end": 2308 }
class ____(TestCase): def all_subclasses(self, cls): return set(cls.__subclasses__()).union( [s for c in cls.__subclasses__() for s in self.all_subclasses(c)] ) def test(self) -> None: assert self.all_subclasses(DefaultFieldsModelExisting) == { BaseImportChunk, ...
PreventDefaultFieldsModelExistingUseTest
python
encode__django-rest-framework
rest_framework/fields.py
{ "start": 55883, "end": 57661 }
class ____(Field): default_error_messages = { 'required': _('No file was submitted.'), 'invalid': _('The submitted data was not a file. Check the encoding type on the form.'), 'no_name': _('No filename could be determined.'), 'empty': _('The submitted file is empty.'), 'max_l...
FileField
python
astropy__astropy
astropy/io/fits/hdu/compressed/_codecs.py
{ "start": 10423, "end": 13838 }
class ____(Codec): """ The FITS HCompress compression and decompression algorithm. Hcompress is an the image compression package written by Richard L. White for use at the Space Telescope Science Institute. Hcompress was used to compress the STScI Digitized Sky Survey and has also been used to comp...
HCompress1
python
numpy__numpy
numpy/ma/tests/test_extras.py
{ "start": 17360, "end": 18907 }
class ____: # Tests for mr_, the equivalent of r_ for masked arrays. def test_1d(self): # Tests mr_ on 1D arrays. assert_array_equal(mr_[1, 2, 3, 4, 5, 6], array([1, 2, 3, 4, 5, 6])) b = ones(5) m = [1, 0, 0, 0, 0] d = masked_array(b, mask=m) c = mr_[d, 0, 0, d] ...
TestConcatenator
python
scipy__scipy
scipy/stats/_discrete_distns.py
{ "start": 35481, "end": 39504 }
class ____(rv_discrete): r"""A uniform discrete random variable. %(before_notes)s Notes ----- The probability mass function for `randint` is: .. math:: f(k) = \frac{1}{\texttt{high} - \texttt{low}} for :math:`k \in \{\texttt{low}, \dots, \texttt{high} - 1\}`. `randint` take...
randint_gen
python
scipy__scipy
scipy/stats/_page_trend_test.py
{ "start": 16782, "end": 19315 }
class ____: '''Maintains state between `page_trend_test` executions''' def __init__(self): '''Lightweight initialization''' self.all_pmfs = {} def set_k(self, k): '''Calculate lower and upper limits of L for single row''' self.k = k # See [5] top of page 52 ...
_PageL
python
tensorflow__tensorflow
tensorflow/lite/python/lite_v2_test.py
{ "start": 193554, "end": 194510 }
class ____(lite_v2_test_util.ModelTest): @test_util.run_v2_only def testReduceDataset(self): @tf.function def model(): dataset = tf.data.Dataset.from_tensor_slices([1, 2, 3, 4]) output = dataset.reduce(np.int32(0), lambda x, y: x + y) return output concrete_func = model.get_concrete_...
DatasetOpsTest
python
davidhalter__parso
parso/grammar.py
{ "start": 8809, "end": 11081 }
class ____(Grammar): _error_normalizer_config = ErrorFinderConfig() _token_namespace = PythonTokenTypes _start_nonterminal = 'file_input' def __init__(self, version_info: PythonVersionInfo, bnf_text: str): super().__init__( bnf_text, tokenizer=self._tokenize_lines, ...
PythonGrammar
python
great-expectations__great_expectations
great_expectations/metrics/batch/batch_column_types.py
{ "start": 347, "end": 464 }
class ____(BatchMetric[BatchColumnTypesResult]): """Table schema""" name = "table.column_types"
BatchColumnTypes
python
ray-project__ray
rllib/env/tests/test_multi_agent_env_runner.py
{ "start": 429, "end": 1224 }
class ____(ConnectorV2): def __init__(self, env, spaces, device): super().__init__(env.observation_space, env.action_space) self.episode_end_counter = 0 self.episodes_encountered_list = list() self.episodes_encountered_set = set() @override(ConnectorV2) def __call__( ...
EpisodeTracker
python
python-jsonschema__jsonschema
jsonschema/tests/test_validators.py
{ "start": 66932, "end": 67115 }
class ____(ValidatorTestMixin, TestCase): Validator = validators.Draft6Validator valid: tuple[dict, dict] = ({}, {}) invalid = {"type": "integer"}, "foo"
TestDraft6Validator
python
apache__airflow
providers/google/tests/unit/google/cloud/operators/test_dataplex.py
{ "start": 20006, "end": 20940 }
class ____: @mock.patch(HOOK_STR) def test_execute(self, hook_mock): op = DataplexDeleteZoneOperator( task_id=TASK_ID, project_id=PROJECT_ID, region=REGION, lake_id=LAKE_ID, zone_id=ZONE_ID, api_version=API_VERSION, gcp_...
TestDataplexDeleteZoneOperator
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/deprecated4.py
{ "start": 992, "end": 1277 }
class ____: @overload @deprecated("DescB1 __get__") def __get__(self, obj: None, owner: object) -> str: ... @overload def __get__(self, obj: object, owner: object) -> str: ... def __get__(self, obj: object | None, owner: object) -> str: return ""
DescB1
python
pypa__pip
src/pip/_vendor/rich/pretty.py
{ "start": 14333, "end": 17204 }
class ____: """A node in a repr tree. May be atomic or a container.""" key_repr: str = "" value_repr: str = "" open_brace: str = "" close_brace: str = "" empty: str = "" last: bool = False is_tuple: bool = False is_namedtuple: bool = False children: Optional[List["Node"]] = None...
Node
python
tensorflow__tensorflow
tensorflow/python/summary/plugin_asset_test.py
{ "start": 1055, "end": 1173 }
class ____(_UnnamedPluginAsset): """Simple example asset.""" plugin_name = "_ExamplePluginAsset"
_ExamplePluginAsset
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/classVar6.py
{ "start": 317, "end": 451 }
class ____(TypedDict): # This should generate an error. x: ClassVar # This should generate an error. y: ClassVar[int]
TD1
python
joke2k__faker
tests/providers/test_person.py
{ "start": 73003, "end": 76802 }
class ____(unittest.TestCase): def setUp(self): self.fake = Faker("zh_TW") Faker.seed(0) def test_last_name(self): # There's no gender-specific last name in Chinese. assert not hasattr(ZhTWProvider, "last_names_male") assert not hasattr(ZhTWProvider, "last_names_female")...
TestZhTW
python
numba__numba
numba/tests/test_typeinfer.py
{ "start": 2200, "end": 11848 }
class ____(unittest.TestCase): """ Tests for type unification with a typing context. """ int_unify = { ('uint8', 'uint8'): 'uint8', ('int8', 'int8'): 'int8', ('uint16', 'uint16'): 'uint16', ('int16', 'int16'): 'int16', ('uint32', 'uint32'): 'uint32', ('in...
TestUnify
python
ansible__ansible
test/units/modules/test_unarchive.py
{ "start": 626, "end": 729 }
class ____: def __init__(self): self.params = {} self.tmpdir = None
FakeAnsibleModule
python
pypa__setuptools
setuptools/discovery.py
{ "start": 6391, "end": 7732 }
class ____(PEP420PackageFinder): _EXCLUDE = ( "ci", "bin", "debian", "doc", "docs", "documentation", "manpages", "news", "newsfragments", "changelog", "test", "tests", "unit_test", "unit_tests", "...
FlatLayoutPackageFinder
python
pytorch__pytorch
test/inductor/test_cooperative_reductions.py
{ "start": 1664, "end": 8804 }
class ____(TestCase): def setUp(self): super().setUp() torch._inductor.metrics.generated_kernel_count = 0 torch._dynamo.reset() def run_and_check(self, fn, args, dtype=None, *, expect_kernel_count=1): # Define fixed tolerances RTOL = 1e-5 ATOL = 1e-6 # c...
CooperativeReductionTests
python
django__django
django/template/base.py
{ "start": 17121, "end": 25511 }
class ____: def __init__(self, tokens, libraries=None, builtins=None, origin=None): # Reverse the tokens so delete_first_token(), prepend_token(), and # next_token() can operate at the end of the list in constant time. self.tokens = list(reversed(tokens)) self.tags = {} self....
Parser
python
django__django
tests/admin_docs/test_utils.py
{ "start": 289, "end": 5629 }
class ____(AdminDocsSimpleTestCase): """ This __doc__ output is required for testing. I copied this example from `admindocs` documentation. (TITLE) Display an individual :model:`myapp.MyModel`. **Context** ``RequestContext`` ``mymodel`` An instance of :model:`myapp.MyModel`. ...
TestUtils
python
python-openxml__python-docx
src/docx/enum/dml.py
{ "start": 779, "end": 3346 }
class ____(BaseXmlEnum): """Indicates the Office theme color, one of those shown in the color gallery on the formatting ribbon. Alias: ``MSO_THEME_COLOR`` Example:: from docx.enum.dml import MSO_THEME_COLOR font.color.theme_color = MSO_THEME_COLOR.ACCENT_1 MS API name: `MsoTheme...
MSO_THEME_COLOR_INDEX
python
falconry__falcon
tests/test_typing.py
{ "start": 2483, "end": 6513 }
class ____: def process_request(self, req: FancyRequest, resp: FancyResponse) -> None: _process_auth(req, resp) # NOTE(vytas): Unlike req.context, resp.context.comment is type checked, # try misspelling it or using with an incompatible type. resp.context.comment = 'fancy req/resp'...
AuthMiddlewareFancyBoth
python
huggingface__transformers
src/transformers/models/aya_vision/modeling_aya_vision.py
{ "start": 4610, "end": 6200 }
class ____(ModelOutput): r""" loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided): Language modeling loss (for next-token prediction). logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`): Prediction scores of the lan...
AyaVisionCausalLMOutputWithPast
python
google__jax
jax/_src/interpreters/pxla.py
{ "start": 78121, "end": 87183 }
class ____: def __init__(self, shardings: tuple[GSPMDSharding | UnspecifiedValue, ...], avals: tuple[core.AbstractValue]): gspmd_shardings = [ s if (isinstance(s, (UnspecifiedValue, AUTO)) or (isinstance(s, NamedSharding) and isinstance(s.mesh, AbstractMesh))) else to...
SemanticallyEqualShardings
python
scipy__scipy
scipy/stats/_multivariate.py
{ "start": 84221, "end": 86237 }
class ____(multi_rv_frozen): __class_getitem__ = None def __init__(self, alpha, seed=None): self.alpha = _dirichlet_check_parameters(alpha) self._dist = dirichlet_gen(seed) def logpdf(self, x): return self._dist.logpdf(x, self.alpha) def pdf(self, x): return self._dist...
dirichlet_frozen
python
scipy__scipy
scipy/stats/_continuous_distns.py
{ "start": 119498, "end": 128716 }
class ____(rv_continuous): r"""A generalized hyperbolic continuous random variable. %(before_notes)s See Also -------- t, norminvgauss, geninvgauss, laplace, cauchy Notes ----- The probability density function for `genhyperbolic` is: .. math:: f(x, p, a, b) = ...
genhyperbolic_gen
python
pennersr__django-allauth
tests/apps/socialaccount/providers/hubic/tests.py
{ "start": 238, "end": 938 }
class ____(OAuth2TestsMixin, TestCase): provider_id = HubicProvider.id def get_mocked_response(self): return MockedResponse( HTTPStatus.OK, """ { "email": "user@example.com", "firstname": "Test", "activated": true, "creationDate": "2014-04-17T17:04:01+02:00", ...
HubicTests
python
pyca__cryptography
src/cryptography/hazmat/primitives/_modes.py
{ "start": 1513, "end": 3075 }
class ____(Mode, metaclass=abc.ABCMeta): @property @abc.abstractmethod def tag(self) -> bytes | None: """ The value of the tag supplied to the constructor of this mode. """ def _check_aes_key_length(self: Mode, algorithm: CipherAlgorithm) -> None: if algorithm.key_size > 256 an...
ModeWithAuthenticationTag
python
sqlalchemy__sqlalchemy
test/orm/test_versioning.py
{ "start": 33457, "end": 34850 }
class ____(fixtures.MappedTest): __sparse_driver_backend__ = True @classmethod def define_tables(cls, metadata): Table( "base", metadata, Column( "id", Integer, primary_key=True, test_needs_autoincrement=True ), Column("ver...
PlainInheritanceTest
python
ray-project__ray
python/ray/util/client/client_pickler.py
{ "start": 4842, "end": 6012 }
class ____(pickle.Unpickler): def persistent_load(self, pid): assert isinstance(pid, PickleStub) if pid.type == "Object": return ClientObjectRef(pid.ref_id) elif pid.type == "Actor": return ClientActorHandle(ClientActorRef(pid.ref_id)) else: raise ...
ServerUnpickler
python
davidhalter__parso
test/normalizer_issue_files/python.py
{ "start": 193, "end": 1222 }
class ____: cls_var: ClassVar[str] def m(self): xs: List[int] = [] # True and False are keywords in Python 3 and therefore need a space. #: E275:13 E275:14 norman = True+False #: E302+3:0 def a(): pass async def b(): pass # Okay async def add(a: int = 0, b: int = 0) -> int: return a ...
Class
python
sympy__sympy
sympy/combinatorics/galois.py
{ "start": 3136, "end": 17867 }
class ____(Enum): """ Names for the transitive subgroups of S6. """ C6 = "C6" S3 = "S3" D6 = "D6" A4 = "A4" G18 = "G18" A4xC2 = "A4 x C2" S4m = "S4-" S4p = "S4+" G36m = "G36-" G36p = "G36+" S4xC2 = "S4 x C2" PSL2F5 = "PSL2(F5)" G72 = "G72" PGL2F5 = "PG...
S6TransitiveSubgroups
python
airbytehq__airbyte
airbyte-integrations/connectors/destination-motherduck/destination_motherduck/processors/duckdb.py
{ "start": 1070, "end": 3942 }
class ____(SqlConfig): """Configuration for DuckDB.""" db_path: Path | str = Field() """Normally db_path is a Path object. The database name will be inferred from the file name. For example, given a `db_path` of `/path/to/my/duckdb-file`, the database name is `my_db`. """ schema_name: str...
DuckDBConfig
python
getsentry__sentry
tests/sentry/models/test_debugfile.py
{ "start": 898, "end": 7393 }
class ____(TestCase): def test_delete_dif(self) -> None: dif = self.create_dif_file( debug_id="dfb8e43a-f242-3d73-a453-aeb6a777ef75-feedface", features=["debug", "unwind"] ) dif_id = dif.id dif.delete() assert not ProjectDebugFile.objects.filter(id=dif_id).exist...
DebugFileTest
python
PrefectHQ__prefect
src/prefect/client/schemas/objects.py
{ "start": 2360, "end": 2840 }
class ____(AutoEnum): """Enumeration of state types.""" SCHEDULED = AutoEnum.auto() PENDING = AutoEnum.auto() RUNNING = AutoEnum.auto() COMPLETED = AutoEnum.auto() FAILED = AutoEnum.auto() CANCELLED = AutoEnum.auto() CRASHED = AutoEnum.auto() PAUSED = AutoEnum.auto() CANCELLING ...
StateType
python
pola-rs__polars
py-polars/src/polars/expr/expr.py
{ "start": 3794, "end": 379253 }
class ____: """Expressions that can be used in various contexts.""" # NOTE: This `= None` is needed to generate the docs with sphinx_accessor. _pyexpr: PyExpr = None # type: ignore[assignment] _accessors: ClassVar[set[str]] = { "arr", "bin", "cat", "dt", "ext", ...
Expr
python
pytorch__pytorch
test/dynamo/cpython/3_13/test_contextlib.py
{ "start": 46034, "end": 47692 }
class ____(__TestCase): def make_relative_path(self, *parts): return os.path.join( os.path.dirname(os.path.realpath(__file__)), *parts, ) def test_simple(self): old_cwd = os.getcwd() target = self.make_relative_path('data') self.assertNotEqual(old...
TestChdir
python
tornadoweb__tornado
tornado/test/auth_test.py
{ "start": 22326, "end": 23311 }
class ____(AsyncHTTPTestCase): def get_app(self): return Application( [ # test endpoints ("/client/login", GoogleLoginHandler, dict(test=self)), # simulated google authorization server endpoints ("/google/oauth2/authorize", GoogleOA...
GoogleOAuth2Test
python
astropy__astropy
astropy/utils/misc.py
{ "start": 1826, "end": 3608 }
class ____: """A noop writeable object.""" def write(self, s: str) -> None: pass @contextlib.contextmanager def silence() -> Generator[None, None, None]: """A context manager that silences sys.stdout and sys.stderr.""" old_stdout = sys.stdout old_stderr = sys.stderr sys.stdout = _Dumm...
_DummyFile
python
ansible__ansible
lib/ansible/_internal/_ssh/_ssh_agent.py
{ "start": 4883, "end": 4963 }
class ____(bytes): def to_blob(self) -> bytes: return self
constraints
python
airbytehq__airbyte
airbyte-integrations/connectors/source-appsflyer/source_appsflyer/source.py
{ "start": 12268, "end": 12544 }
class ____(Installs): def path( self, stream_state: Mapping[str, Any] = None, stream_slice: Mapping[str, Any] = None, next_page_token: Mapping[str, Any] = None ) -> str: return f"raw-data/export/app/{self.app_id}/installs-retarget/v5"
RetargetingInstalls
python
pytorch__pytorch
test/quantization/core/experimental/test_adaround_eager.py
{ "start": 535, "end": 4968 }
class ____(QuantizationTestCase): def feedforawrd_callback( self, model, data, ) -> None: model(data) def feedforawrd_callback_with_wrapper(self, model, data, wrapper) -> None: wrapper(model, data) def run_adaround(self, model, img_data, wrapper=None): a...
TestAdaround
python
joke2k__faker
faker/providers/person/fr_FR/__init__.py
{ "start": 44, "end": 12902 }
class ____(PersonProvider): formats_female = ( "{{first_name_female}} {{last_name}}", "{{first_name_female}} {{last_name}}", "{{first_name_female}} {{last_name}}", "{{first_name_female}} {{last_name}}", "{{first_name_female}} {{last_name}}", "{{first_name_female}} {{l...
Provider
python
pytorch__pytorch
torch/_dynamo/variables/user_defined.py
{ "start": 79397, "end": 80306 }
class ____(UserDefinedObjectVariable): @staticmethod def is_matching_object(obj): mod = sys.modules.get("torchrec.sparse.jagged_tensor") return mod is not None and type(obj) is mod.KeyedJaggedTensor def __init__(self, value, **kwargs) -> None: from torchrec.sparse.jagged_tensor impo...
KeyedJaggedTensorVariable
python
huggingface__transformers
tests/models/yoso/test_modeling_yoso.py
{ "start": 12295, "end": 14210 }
class ____(unittest.TestCase): @slow def test_inference_no_head(self): model = YosoModel.from_pretrained("uw-madison/yoso-4096") input_ids = torch.tensor([[0, 1, 2, 3, 4, 5]]) with torch.no_grad(): output = model(input_ids)[0] expected_shape = torch.Size((1, 6, 768)...
YosoModelIntegrationTest
python
tensorflow__tensorflow
tensorflow/python/ops/ragged/dynamic_ragged_shape.py
{ "start": 80630, "end": 124129 }
class ____: """A _Broadcaster represents a transformation from one shape to another. It provides a transform for each axis of the source shape to the corresponding axis of the destination shape. """ def __init__(self, source_shape, target_shape, layer_broadcaste...
_Broadcaster
python
pytorch__pytorch
torch/distributed/tensor/_redistribute.py
{ "start": 886, "end": 2251 }
class ____(NamedTuple): mesh_dim: int src_dst_placements: tuple[Placement, Placement] # logical_shape on this mesh dimension logical_shape: list[int] # Global cache for DTensorRedistributePlanner instances _planner_cache: dict[ tuple[weakref.ReferenceType, int], "DTensorRedistributePlanner" ] = {}...
_TransformInfo