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
scrapy__scrapy
tests/CrawlerRunner/custom_loop_different.py
{ "start": 206, "end": 684 }
class ____(Spider): name = "no_request" custom_settings = { "TWISTED_REACTOR": "twisted.internet.asyncioreactor.AsyncioSelectorReactor", "ASYNCIO_EVENT_LOOP": "uvloop.Loop", } async def start(self): return yield def main(reactor): configure_logging() runner = ...
NoRequestsSpider
python
run-llama__llama_index
llama-index-integrations/vector_stores/llama-index-vector-stores-azurepostgresql/llama_index/vector_stores/azure_postgres/common/_shared.py
{ "start": 1212, "end": 1547 }
class ____(BaseModel): """Basic username/password authentication for Azure Database for PostgreSQL connections. :param username: Username for the connection. :type username: str :param password: Password for the connection. :type password: str """ username: str = "postgres" password: s...
BasicAuth
python
joke2k__faker
faker/providers/person/ar_DZ/__init__.py
{ "start": 70, "end": 6808 }
class ____(PersonProvider): formats_female: Tuple[str, ...] = ("{{first_name_female}} {{last_name}}",) formats_male: Tuple[str, ...] = ("{{first_name_male}} {{last_name}}",) formats = formats_male + formats_female # Translated from: https://studentsoftheworld.info/penpals/stats_fr.php?Pays=ALG # ...
Provider
python
qdrant__qdrant-client
qdrant_client/http/models/models.py
{ "start": 127672, "end": 128237 }
class ____(BaseModel): """ Configuration for sparse inverted index. """ full_scan_threshold: Optional[int] = Field( default=None, description="We prefer a full scan search upto (excluding) this number of vectors. Note: this is number of vectors, not KiloBytes.", ) index_type: "...
SparseIndexConfig
python
tiangolo__fastapi
docs_src/dependencies/tutorial004_an_py310.py
{ "start": 171, "end": 647 }
class ____: def __init__(self, q: str | None = None, skip: int = 0, limit: int = 100): self.q = q self.skip = skip self.limit = limit @app.get("/items/") async def read_items(commons: Annotated[CommonQueryParams, Depends()]): response = {} if commons.q: response.update({"q"...
CommonQueryParams
python
gevent__gevent
src/gevent/_config.py
{ "start": 18652, "end": 18789 }
class ____(AresSettingMixin, Setting): name = 'ares_tcp_port' default = None environment_key = 'GEVENTARES_TCP_PORT'
AresTCPPort
python
PrefectHQ__prefect
src/prefect/server/utilities/server.py
{ "start": 851, "end": 2091 }
class ____(APIRoute): """ A FastAPIRoute class which attaches an async stack to requests that exits before a response is returned. Requests already have `request.scope['fastapi_astack']` which is an async stack for the full scope of the request. This stack is used for managing contexts of FastAPI ...
PrefectAPIRoute
python
sqlalchemy__sqlalchemy
test/sql/test_operators.py
{ "start": 3645, "end": 12510 }
class ____( testing.AssertsCompiledSQL, fixtures.TestBase ): dialect = __dialect__ = "default_enhanced" @testing.combinations((operators.desc_op, desc), (operators.asc_op, asc)) def test_scalar(self, operator, compare_to): left = column("left") assert left.comparator.operate(operator).c...
DefaultColumnComparatorTest
python
allegroai__clearml
clearml/backend_api/services/v2_20/queues.py
{ "start": 16329, "end": 19799 }
class ____(Request): """ Add or update queue metadata :param queue: ID of the queue :type queue: str :param metadata: Metadata items to add or update :type metadata: Sequence[MetadataItem] :param replace_metadata: If set then the all the metadata items will be replaced with the provided one...
AddOrUpdateMetadataRequest
python
ApeWorX__ape
src/ape_test/config.py
{ "start": 3735, "end": 4462 }
class ____(PluginConfig): enable_session: bool = True """ Set to ``False`` to disable session isolation. """ enable_package: bool = True """ Set to ``False`` to disable package isolation. """ enable_module: bool = True """ Set to ``False`` to disable module isolation. "...
IsolationConfig
python
pytorch__pytorch
torch/_functorch/_aot_autograd/aot_autograd_result.py
{ "start": 21243, "end": 21469 }
class ____(GenericAOTAutogradResult[CompiledForward, CompiledBackward]): """ Regular AOTAutogradResult: saves the forward/backward FxGraphCache keys and looks them up in FxGraphCache on load """
AOTAutogradResult
python
tensorflow__tensorflow
tensorflow/python/kernel_tests/check_ops_test.py
{ "start": 37217, "end": 41124 }
class ____(test.TestCase): # Static shape inference @test_util.run_deprecated_v1 def testStaticShape(self): placeholder = array_ops.placeholder(dtypes.int32) ensure_shape_op = check_ops.ensure_shape(placeholder, (3, 3, 3)) self.assertEqual(ensure_shape_op.get_shape(), (3, 3, 3)) @test_util.run_dep...
EnsureShapeTest
python
kamyu104__LeetCode-Solutions
Python/minimum-number-of-visited-cells-in-a-grid.py
{ "start": 970, "end": 2163 }
class ____(object): def minimumVisitedCells(self, grid): """ :type grid: List[List[int]] :rtype: int """ m, n = len(grid), len(grid[0]) uf1 = [UnionFind(n+1) for _ in xrange(m)] uf2 = [UnionFind(m+1) for _ in xrange(n)] d, i, j = 1, 0, 0 q = [(...
Solution
python
walkccc__LeetCode
solutions/642. Design Search Autocomplete System/642.py
{ "start": 0, "end": 455 }
class ____: def __init__(self): self.children: dict[str, TrieNode] = {} self.s: str | None = None self.time = 0 self.top3: list[TrieNode] = [] def __lt__(self, other): if self.time == other.time: return self.s < other.s return self.time > other.time def update(self, node) -> None: ...
TrieNode
python
dagster-io__dagster
examples/docs_snippets/docs_snippets/guides/components/shell-script-component/generated/2-shell-command-empty.py
{ "start": 22, "end": 418 }
class ____(dg.Component, dg.Model, dg.Resolvable): """COMPONENT SUMMARY HERE. COMPONENT DESCRIPTION HERE. """ # added fields here will define params when instantiated in Python, and yaml schema via Resolvable def build_defs(self, context: dg.ComponentLoadContext) -> dg.Definitions: # Add ...
ShellCommand
python
pydantic__pydantic
tests/mypy/modules/plugin_success.py
{ "start": 1883, "end": 1952 }
class ____(Model): x: int OverrideModel(x=1, y='b')
OverrideModel
python
django__django
tests/gis_tests/geo3d/tests.py
{ "start": 9795, "end": 14005 }
class ____(FuncTestMixin, Geo3DLoadingHelper, TestCase): def test_kml(self): """ Test KML() function with Z values. """ self._load_city_data() h = City3D.objects.annotate(kml=AsKML("point", precision=6)).get(name="Houston") # KML should be 3D. # `SELECT ST_AsK...
Geo3DFunctionsTests
python
pypa__warehouse
warehouse/manage/views/organizations.py
{ "start": 26152, "end": 28956 }
class ____: def __init__(self, organization, request): self.organization = organization self.request = request self.organization_service = request.find_service( IOrganizationService, context=None ) @property def default_response(self): return { ...
ManageOrganizationTeamsViews
python
dagster-io__dagster
python_modules/dagster/dagster/_core/events/__init__.py
{ "start": 67005, "end": 67119 }
class ____: asset_key: AssetKey partition_keys: Optional[Sequence[str]] @whitelist_for_serdes
AssetWipedData
python
neetcode-gh__leetcode
python/0304-range-sum-query-2d-immutable.py
{ "start": 0, "end": 606 }
class ____: def __init__(self, matrix): self.sum_ = [[0] * (len(matrix[0]) + 1) for _ in range(len(matrix) + 1)] for i, line in enumerate(matrix): previous = 0 for j, num in enumerate(line): previous += num above = self.sum_[i][j + 1] ...
NumMatrix
python
google__jax
jax/_src/core.py
{ "start": 113957, "end": 117742 }
class ____(effects.Effect): """A side-effect introducing a new named axis into the current scope.""" name: AxisName effects.control_flow_allowed_effects.add_type(NamedAxisEffect) effects.custom_derivatives_allowed_effects.add_type(NamedAxisEffect) effects.lowerable_effects.add_type(NamedAxisEffect) effects.remat_a...
NamedAxisEffect
python
pytest-dev__pytest
testing/test_runner.py
{ "start": 617, "end": 5981 }
class ____: def test_setup(self, pytester: Pytester) -> None: item = pytester.getitem("def test_func(): pass") ss = item.session._setupstate values = [1] ss.setup(item) ss.addfinalizer(values.pop, item) assert values ss.teardown_exact(None) assert not ...
TestSetupState
python
ray-project__ray
doc/source/ray-core/doc_code/actor_checkpointing.py
{ "start": 1713, "end": 2692 }
class ____: def __init__(self, checkpoint_file): self.checkpoint_file = checkpoint_file if os.path.exists(self.checkpoint_file): # Restore from a checkpoint with open(self.checkpoint_file, "r") as f: self.state = json.load(f) else: self.st...
ImmortalActor
python
pandas-dev__pandas
asv_bench/benchmarks/strings.py
{ "start": 4596, "end": 5832 }
class ____: params = ([0, 3], [None, ","], [None, "-"], [0.0, 0.001, 0.15]) param_names = ["other_cols", "sep", "na_rep", "na_frac"] def setup(self, other_cols, sep, na_rep, na_frac): N = 10**5 mask_gen = lambda: np.random.choice([True, False], N, p=[1 - na_frac, na_frac]) self.s = ...
Cat
python
marshmallow-code__marshmallow
tests/test_serialization.py
{ "start": 35621, "end": 37606 }
class ____: def test_serialize_with_missing_param_value(self): class AliasingUserSerializer(Schema): name = fields.String() birthdate = fields.DateTime(dump_default=dt.datetime(2017, 9, 29)) data = {"name": "Mick"} result = AliasingUserSerializer().dump(data) ...
TestSchemaSerialization
python
Pylons__pyramid
src/pyramid/config/tweens.py
{ "start": 329, "end": 6979 }
class ____: def add_tween(self, tween_factory, under=None, over=None): """ .. versionadded:: 1.2 Add a 'tween factory'. A :term:`tween` (a contraction of 'between') is a bit of code that sits between the Pyramid router's main request handling function and the upstream WSGI ...
TweensConfiguratorMixin
python
altair-viz__altair
altair/vegalite/v6/schema/core.py
{ "start": 858313, "end": 858511 }
class ____(VegaLiteSchema): """ParameterName schema wrapper.""" _schema = {"$ref": "#/definitions/ParameterName"} def __init__(self, *args): super().__init__(*args)
ParameterName
python
dagster-io__dagster
helm/dagster/schema/schema/charts/dagster/subschema/postgresql.py
{ "start": 162, "end": 433 }
class ____(BaseModel): image: ExternalImage enabled: bool postgresqlHost: str postgresqlUsername: str postgresqlPassword: str postgresqlDatabase: str postgresqlParams: dict postgresqlScheme: Optional[str] = None service: Service
PostgreSQL
python
ray-project__ray
rllib/connectors/module_to_env/unbatch_to_individual_items.py
{ "start": 472, "end": 4829 }
class ____(ConnectorV2): """Unbatches the given `data` back into the individual-batch-items format. Note: This is one of the default module-to-env ConnectorV2 pieces that are added automatically by RLlib into every module-to-env connector pipeline, unless `config.add_default_connectors_to_module_to_env...
UnBatchToIndividualItems
python
pola-rs__polars
py-polars/src/polars/dataframe/_html.py
{ "start": 534, "end": 1372 }
class ____: """Class for representing an HTML tag.""" def __init__( self, elements: list[str], tag: str, attributes: dict[str, str] | None = None, ) -> None: self.tag = tag self.elements = elements self.attributes = attributes def __enter__(self)...
Tag
python
huggingface__transformers
src/transformers/models/openai/modeling_openai.py
{ "start": 20794, "end": 26565 }
class ____(OpenAIGPTPreTrainedModel): _tied_weights_keys = {"transformer.tokens_embed.weight": "lm_head.weight"} def __init__(self, config): super().__init__(config) config.num_labels = 1 self.transformer = OpenAIGPTModel(config) self.lm_head = nn.Linear(config.n_embd, config.v...
OpenAIGPTDoubleHeadsModel
python
dagster-io__dagster
python_modules/automation/automation_tests/dagster_dev_tests/ai_review_tests/test_ai_review_analyze.py
{ "start": 95, "end": 1782 }
class ____: """Basic smoke tests for the ai-review-analyze command.""" def test_import_and_basic_structure(self): """Test that command can be imported and has expected structure.""" from automation.dagster_dev.commands.ai_review_analyze import ai_review_analyze assert ai_review_analyze...
TestAiReviewAnalyze
python
pytorch__pytorch
test/dynamo/cpython/3_13/test_iter.py
{ "start": 3430, "end": 3511 }
class ____: def __iter__(self): raise ZeroDivisionError
BadIterableClass
python
encode__django-rest-framework
rest_framework/schemas/coreapi.py
{ "start": 1478, "end": 2619 }
class ____(dict): def __init__(self): self.links = [] self.methods_counter = Counter() super().__init__() def get_available_key(self, preferred_key): if preferred_key not in self: return preferred_key while True: current_val = self.methods_counte...
LinkNode
python
dagster-io__dagster
python_modules/libraries/dagster-airbyte/dagster_airbyte/managed/generated/sources.py
{ "start": 80565, "end": 81768 }
class ____(GeneratedAirbyteSource): @public def __init__( self, name: str, start_date: str, access_key: str, base: Optional[str] = None, ignore_weekends: Optional[bool] = None, ): """Airbyte Source for Exchange Rates. Documentation can be foun...
ExchangeRatesSource
python
realpython__materials
queue/src/queues.py
{ "start": 1100, "end": 1863 }
class ____(IterableMixin): def __init__(self): super().__init__() self._elements_by_value = {} self._elements = [] self._counter = count() def __setitem__(self, unique_value, priority): if unique_value in self._elements_by_value: self._elements_by_value[uniqu...
MutableMinHeap
python
gevent__gevent
src/gevent/tests/test__core_timer.py
{ "start": 283, "end": 1927 }
class ____(TestCase): __timeout__ = LARGE_TIMEOUT repeat = 0 timer_duration = 0.001 def setUp(self): super(Test, self).setUp() self.called = [] self.loop = config.loop(default=False) self.timer = self.loop.timer(self.timer_duration, repeat=self.repeat) assert no...
Test
python
streamlit__streamlit
lib/streamlit/vendor/pympler/asizeof.py
{ "start": 52762, "end": 87966 }
class ____(object): """Sizer state and options to accumulate sizes.""" _above_ = 1024 # rank only objs of size 1K+ _align_ = 8 # alignment, power-of-2 _clip_ = 80 _code_ = False _cutoff_ = 0 # in percent _derive_ = False _detail_ = 0 # for Asized only _frames_ = False _infer...
Asizer
python
PrefectHQ__prefect
src/integrations/prefect-aws/prefect_aws/workers/ecs_worker.py
{ "start": 8146, "end": 15455 }
class ____(BaseJobConfiguration): """ Job configuration for an ECS worker. """ aws_credentials: Optional[AwsCredentials] = Field(default_factory=AwsCredentials) task_definition: Dict[str, Any] = Field( default_factory=dict, json_schema_extra=dict(template=_default_task_definition_te...
ECSJobConfiguration
python
huggingface__transformers
src/transformers/models/swin2sr/modeling_swin2sr.py
{ "start": 18953, "end": 24791 }
class ____(nn.Module): def __init__( self, config, dim, input_resolution, num_heads, drop_path_rate=0.0, shift_size=0, pretrained_window_size=0 ): super().__init__() self.input_resolution = input_resolution window_size, shift_size = self._compute_window_shift( (config...
Swin2SRLayer
python
sqlalchemy__sqlalchemy
test/dialect/oracle/test_types.py
{ "start": 49995, "end": 54144 }
class ____(fixtures.TestBase): __only_on__ = ("oracle+cx_oracle", "oracle+oracledb") __backend__ = True @testing.combinations( (SmallInteger, 25, int, False), (Integer, 25, int, False), (Numeric(10, 8), decimal.Decimal("25.34534"), None, False), (oracle.FLOAT(15), 25.34534, ...
SetInputSizesTest
python
apache__airflow
docker-tests/tests/docker_tests/test_prod_image.py
{ "start": 2110, "end": 3521 }
class ____: def test_without_command(self, default_docker_image): """Checking the image without a command. It should return non-zero exit code.""" with pytest.raises(DockerException) as ctx: run_cmd_in_docker(image=default_docker_image) assert ctx.value.return_code == 2 def ...
TestCommands
python
getsentry__sentry
tests/sentry/uptime/endpoints/test_validators.py
{ "start": 1638, "end": 3941 }
class ____(TestCase): def get_valid_data(self, **kwargs): return { "url": kwargs.get("url", "https://www.google.com"), "interval_seconds": kwargs.get( "interval_seconds", UptimeSubscription.IntervalSeconds.ONE_MINUTE ), "timeout_ms": kwargs.get...
UptimeMonitorDataSourceValidatorTest
python
PrefectHQ__prefect
src/prefect/client/schemas/filters.py
{ "start": 18292, "end": 18702 }
class ____(PrefectBaseModel): """Filter by `Log.level`.""" ge_: Optional[int] = Field( default=None, description="Include logs with a level greater than or equal to this level", examples=[20], ) le_: Optional[int] = Field( default=None, description="Include logs...
LogFilterLevel
python
run-llama__llama_index
llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/firecrawl_web/base.py
{ "start": 250, "end": 37193 }
class ____(BasePydanticReader): """ turn a url to llm accessible markdown with `Firecrawl.dev`. Args: api_key (str): The Firecrawl API key. api_url (Optional[str]): Optional base URL for Firecrawl deployment mode (Optional[str]): The mode to run the loader in. Default is...
FireCrawlWebReader
python
getsentry__sentry
tests/sentry/data_secrecy/test_service.py
{ "start": 458, "end": 5030 }
class ____(TestCase): def setUp(self) -> None: self.organization = self.create_organization() self.organization_2 = self.create_organization() def test_get_effective_waiver_status_with_active_grant(self) -> None: now = datetime.now(tz=timezone.utc) grant_start = now - timedelta(...
TestDataAccessGrantService
python
agronholm__apscheduler
src/apscheduler/eventbrokers/local.py
{ "start": 183, "end": 613 }
class ____(BaseEventBroker): """ Asynchronous, local event broker. This event broker only broadcasts within the process it runs in, and is therefore not suitable for multi-node or multiprocess use cases. Does not serialize events. """ def __repr__(self) -> str: return create_repr(...
LocalEventBroker
python
PyCQA__pylint
tests/functional/ext/typing/typing_deprecated_alias.py
{ "start": 2227, "end": 2325 }
class ____(TypedDict): my_var: List[int] # [deprecated-typing-alias] @dataclass
CustomTypedDict2
python
huggingface__transformers
src/transformers/models/oneformer/convert_to_hf_oneformer.py
{ "start": 7733, "end": 9145 }
class ____: def __call__(self, original_config: object, model_repo: str) -> OneFormerProcessor: model = original_config.MODEL model_input = original_config.INPUT dataset_catalog = MetadataCatalog.get(original_config.DATASETS.TEST_PANOPTIC[0]) if "ade20k" in model_repo: c...
OriginalOneFormerConfigToProcessorConverter
python
getsentry__sentry
tests/snuba/api/endpoints/test_organization_metrics_meta.py
{ "start": 217, "end": 4840 }
class ____(MetricsEnhancedPerformanceTestCase): def setUp(self) -> None: super().setUp() self.min_ago = before_now(minutes=1) self.two_min_ago = before_now(minutes=2) self.features = { "organizations:performance-use-metrics": True, } self.login_as(user=sel...
OrganizationMetricsCompatiblity
python
cython__cython
Cython/Debugger/libpython.py
{ "start": 5749, "end": 14710 }
class ____: """ Class wrapping a gdb.Value that's either a (PyObject*) within the inferior process, or some subclass pointer e.g. (PyBytesObject*) There will be a subclass for every refined PyObject type that we care about. Note that at every stage the underlying pointer could be NULL, point ...
PyObjectPtr
python
sympy__sympy
sympy/physics/mechanics/pathway.py
{ "start": 9692, "end": 17832 }
class ____(PathwayBase): """Obstacle-set pathway between a set of attachment points. Explanation =========== An obstacle-set pathway forms a series of straight-line segment between pairs of consecutive points in a set of points. It is similar to multiple linear pathways joined end-to-end. It w...
ObstacleSetPathway
python
pypa__pipenv
pipenv/vendor/click/core.py
{ "start": 44709, "end": 56511 }
class ____(BaseCommand): """Commands are the basic building block of command line interfaces in Click. A basic command handles command line parsing and might dispatch more parsing to commands nested below it. :param name: the name of the command to use unless a group overrides it. :param context_s...
Command
python
pallets__werkzeug
src/werkzeug/datastructures/structures.py
{ "start": 27446, "end": 32510 }
class ____(ImmutableMultiDictMixin[K, V], MultiDict[K, V]): # type: ignore[misc] """A read only :class:`MultiDict` that you can pass multiple :class:`MultiDict` instances as sequence and it will combine the return values of all wrapped dicts: >>> from werkzeug.datastructures import CombinedMultiDict, ...
CombinedMultiDict
python
django__django
tests/aggregation/models.py
{ "start": 1031, "end": 1286 }
class ____(models.Model): name = models.CharField(max_length=255) books = models.ManyToManyField(Book) original_opening = models.DateTimeField() friday_night_closing = models.TimeField() def __str__(self): return self.name
Store
python
ray-project__ray
python/ray/_private/ray_logging/__init__.py
{ "start": 7791, "end": 13219 }
class ____: def __init__( self, agg_window_s: int, allow_re: Optional[str], skip_re: Optional[str], *, _timesource=None, ): self.agg_window_s = agg_window_s if allow_re: self.allow_re = re.compile(allow_re) else: sel...
LogDeduplicator
python
scipy__scipy
scipy/stats/_multivariate.py
{ "start": 37100, "end": 49867 }
class ____(multi_rv_generic): r"""A matrix normal random variable. The `mean` keyword specifies the mean. The `rowcov` keyword specifies the among-row covariance matrix. The 'colcov' keyword specifies the among-column covariance matrix. Methods ------- pdf(X, mean=None, rowcov=1, colcov=1)...
matrix_normal_gen
python
ZoranPandovski__al-go-rithms
others/synchronization/ProducerConsumer/Python/producer_consumer.py
{ "start": 998, "end": 1533 }
class ____(Thread): def run(self): global queue while True: condition.acquire() #lock.acquire() if not Q: print("Q empty : consumer is waiting!") condition.wait() print("producer added some item and notified the cons...
Consumer
python
PrefectHQ__prefect
src/integrations/prefect-dbt/prefect_dbt/core/settings.py
{ "start": 650, "end": 3857 }
class ____(BaseSettings): """ dbt settings that directly affect the PrefectDbtRunner. These settings will be collected automatically from their corresponding 'DBT_'-prefixed environment variables. If a setting is not set in the environment or in the fields of this class, the default value will be used. ...
PrefectDbtSettings
python
qdrant__qdrant-client
qdrant_client/http/models/models.py
{ "start": 145792, "end": 146762 }
class ____(BaseModel): """ Config of single vector data storage """ size: int = Field(..., description="Size/dimensionality of the vectors used") distance: "Distance" = Field(..., description="Config of single vector data storage") storage_type: "VectorStorageType" = Field(..., description="Con...
VectorDataConfig
python
google__pytype
pytype/rewrite/abstract/functions.py
{ "start": 1226, "end": 2145 }
class ____(Protocol): """Protocol for a VM frame.""" name: str final_locals: Mapping[str, base.BaseValue] stack: Sequence['FrameType'] functions: Sequence['InterpreterFunction'] classes: Sequence[Any] def make_child_frame( self, func: 'InterpreterFunction', initial_locals: Mapping[str,...
FrameType
python
ray-project__ray
python/ray/llm/tests/batch/cpu/processor/test_processor_base.py
{ "start": 9116, "end": 12342 }
class ____: def test_valid_concurrency(self): config = vLLMEngineProcessorConfig( model_source="unsloth/Llama-3.2-1B-Instruct", concurrency=(1, 2), ) assert config.concurrency == (1, 2) config = vLLMEngineProcessorConfig( model_source="unsloth/Lla...
TestProcessorConfig
python
allegroai__clearml
clearml/debugging/log.py
{ "start": 2949, "end": 9576 }
class ____(object): __base_logger = None @classmethod def get_base_logger( cls, level: Optional[Union[str, int]] = None, stream: Union[None, TextIO] = sys.stdout, colored: bool = False, ) -> PickledLogger: if LoggerRoot.__base_logger: return LoggerRoo...
LoggerRoot
python
protocolbuffers__protobuf
python/google/protobuf/internal/well_known_types.py
{ "start": 11450, "end": 19302 }
class ____(object): """Class for Duration message type.""" __slots__ = () def ToJsonString(self): """Converts Duration to string format. Returns: A string converted from self. The string format will contains 3, 6, or 9 fractional digits depending on the precision required to represent...
Duration
python
mlflow__mlflow
mlflow/genai/judges/adapters/databricks_adapter.py
{ "start": 13671, "end": 21457 }
class ____: response: str request_id: str | None num_prompt_tokens: int | None num_completion_tokens: int | None def _parse_databricks_model_response( res_json: dict[str, Any], headers: dict[str, Any] ) -> InvokeDatabricksModelOutput: """ Parse and validate the response from a Databricks m...
InvokeDatabricksModelOutput
python
fastapi__sqlmodel
docs_src/tutorial/code_structure/tutorial001_py310/models.py
{ "start": 268, "end": 602 }
class ____(SQLModel, table=True): id: int | None = Field(default=None, primary_key=True) name: str = Field(index=True) secret_name: str age: int | None = Field(default=None, index=True) team_id: int | None = Field(default=None, foreign_key="team.id") team: Team | None = Relationship(back_popula...
Hero
python
explosion__spaCy
spacy/lang/bg/__init__.py
{ "start": 399, "end": 805 }
class ____(BaseDefaults): lex_attr_getters = dict(Language.Defaults.lex_attr_getters) lex_attr_getters[LANG] = lambda text: "bg" lex_attr_getters.update(LEX_ATTRS) stop_words = STOP_WORDS tokenizer_exceptions = update_exc(BASE_EXCEPTIONS, TOKENIZER_EXCEPTIONS) suffixes = COMBINING_DIACRITICS_T...
BulgarianDefaults
python
keras-team__keras
keras/src/metrics/accuracy_metrics.py
{ "start": 15166, "end": 18274 }
class ____(reduction_metrics.MeanMetricWrapper): """Computes how often integer targets are in the top `K` predictions. By default, the arguments expected by `update_state()` are: - `y_true`: a tensor of shape `(batch_size)` representing indices of true categories. - `y_pred`: a tensor of shape ...
SparseTopKCategoricalAccuracy
python
tensorflow__tensorflow
tensorflow/python/util/serialization_test.py
{ "start": 892, "end": 1223 }
class ____(test.TestCase): def test_serialize_shape(self): round_trip = json.loads(json.dumps( tensor_shape.TensorShape([None, 2, 3]), default=serialization.get_json_type)) self.assertIs(round_trip[0], None) self.assertEqual(round_trip[1], 2) if __name__ == "__main__": test.main()
SerializationTests
python
ansible__ansible
lib/ansible/plugins/action/dnf.py
{ "start": 392, "end": 3664 }
class ____(ActionBase): TRANSFERS_FILES = False def run(self, tmp=None, task_vars=None): self._supports_check_mode = True self._supports_async = True result = super(ActionModule, self).run(tmp, task_vars) del tmp # tmp no longer has any effect # Carry-over concept fr...
ActionModule
python
scikit-learn__scikit-learn
sklearn/mixture/tests/test_gaussian_mixture.py
{ "start": 2793, "end": 55651 }
class ____: def __init__( self, rng, n_samples=200, n_components=2, n_features=2, scale=50, dtype=np.float64, ): self.n_samples = n_samples self.n_components = n_components self.n_features = n_features self.weights = rng.ra...
RandomData
python
docker__docker-py
tests/unit/utils_test.py
{ "start": 15925, "end": 16629 }
class ____(unittest.TestCase): longMessage = True def test_convert_filters(self): tests = [ ({'dangling': True}, '{"dangling": ["true"]}'), ({'dangling': "true"}, '{"dangling": ["true"]}'), ({'exited': 0}, '{"exited": ["0"]}'), ({'exited': [0, 1]}, '{"exi...
UtilsTest
python
django-mptt__django-mptt
mptt/admin.py
{ "start": 1232, "end": 4581 }
class ____(ModelAdmin): """ A basic admin class that displays tree items according to their position in the tree. No extra editing functionality beyond what Django admin normally offers. """ if IS_GRAPPELLI_INSTALLED: change_list_template = "admin/grappelli_mptt_change_list.html" e...
MPTTModelAdmin
python
getsentry__sentry
src/sentry/conf/types/taskworker.py
{ "start": 665, "end": 947 }
class ____(TypedDict): """The schedule definition for an individual task.""" task: str schedule: timedelta | crontab ScheduleConfigMap = Mapping[str, ScheduleConfig] """A collection of schedule configuration, usually defined in application configuration"""
ScheduleConfig
python
PrefectHQ__prefect
tests/test_tasks.py
{ "start": 95672, "end": 99950 }
class ____: async def test_downstream_does_not_run_if_upstream_fails(self): @task def fails(): raise ValueError("Fail task!") @flow def bar(y): return y @flow def test_flow(): f = fails.submit() b = bar(2, wait_for=[f]...
TestSubflowWaitForTasks
python
wandb__wandb
wandb/vendor/pygments/lexers/dotnet.py
{ "start": 14984, "end": 19759 }
class ____(RegexLexer): """ For `Visual Basic.NET <http://msdn2.microsoft.com/en-us/vbasic/default.aspx>`_ source code. """ name = 'VB.net' aliases = ['vb.net', 'vbnet'] filenames = ['*.vb', '*.bas'] mimetypes = ['text/x-vbnet', 'text/x-vba'] # (?) uni_name = '[_' + uni.combin...
VbNetLexer
python
MongoEngine__mongoengine
mongoengine/fields.py
{ "start": 90071, "end": 91789 }
class ____(BaseField): """ 128-bit decimal-based floating-point field capable of emulating decimal rounding with exact precision. This field will expose decimal.Decimal but stores the value as a `bson.Decimal128` behind the scene, this field is intended for monetary data, scientific computations, etc. ...
Decimal128Field
python
astropy__astropy
astropy/io/fits/header.py
{ "start": 74210, "end": 76018 }
class ____(_CardAccessor): """ A class used internally by the Header class for the Header.comments attribute access. This object can be used to display all the keyword comments in the Header, or look up the comments on specific keywords. It allows all the same forms of keyword lookup as the He...
_HeaderComments
python
huggingface__transformers
src/transformers/models/internvl/modular_internvl.py
{ "start": 14839, "end": 16414 }
class ____(InternVLVisionPreTrainedModel): def __init__(self, config: InternVLVisionConfig) -> None: super().__init__(config) self.config = config self.embeddings = InternVLVisionEmbeddings(config) self.encoder = InternVLVisionEncoder(config) self.layernorm = ( ...
InternVLVisionModel
python
pytorch__pytorch
torch/_inductor/ir.py
{ "start": 238205, "end": 239025 }
class ____(ExternKernelOut): def __init__(self, count: int, device: torch.device) -> None: limits = torch.iinfo(torch.int64) super().__init__( layout=FixedLayout( device=device, dtype=torch.int64, size=[count], ), in...
RandomSeeds
python
pypa__warehouse
tests/unit/admin/views/test_users.py
{ "start": 3953, "end": 4084 }
class ____: def test_validate(self): form = views.UserForm() assert form.validate(), str(form.erros)
TestUserForm
python
ApeWorX__ape
tests/functional/test_test.py
{ "start": 14385, "end": 15026 }
class ____: """ Note: Most isolation-based tests occur in `functional/test_fixtures.py`. """ @pytest.fixture def registry(self): return SnapshotRegistry() def test_get_snapshot_id(self, registry): actual = registry.get_snapshot_id(Scope.SESSION) assert actual is None ...
TestSnapshotRegistry
python
tensorflow__tensorflow
tensorflow/python/saved_model/model_utils/export_test.py
{ "start": 1422, "end": 14261 }
class ____(test_util.TensorFlowTestCase): def test_build_all_signature_defs_without_receiver_alternatives(self): # Force the test to run in graph mode. # This tests a deprecated v1 API that depends on graph-only functions such # as build_tensor_info. with ops.Graph().as_default(): receiver_tens...
ExportTest
python
readthedocs__readthedocs.org
readthedocs/api/v3/views.py
{ "start": 4875, "end": 10366 }
class ____( APIv3Settings, NestedViewSetMixin, ProjectQuerySetMixin, FlexFieldsMixin, ProjectImportMixin, UpdateChangeReasonMixin, CreateModelMixin, UpdateMixin, UpdateModelMixin, ReadOnlyModelViewSet, ): model = Project lookup_field = "slug" lookup_url_kwarg = "proje...
ProjectsViewSetBase
python
spyder-ide__spyder
spyder/plugins/preferences/plugin.py
{ "start": 1569, "end": 14338 }
class ____(SpyderPluginV2): """ Spyder preferences plugin. This class manages all the preference pages and tabs for all internal and external plugins, as well enabling other plugins to add configurations to other sections. """ NAME = 'preferences' CONF_SECTION = 'preferences' OPTIO...
Preferences
python
django-extensions__django-extensions
django_extensions/mongodb/models.py
{ "start": 360, "end": 654 }
class ____(Document): """ TimeStampedModel An abstract base class model that provides self-managed "created" and "modified" fields. """ created = CreationDateTimeField() modified = ModificationDateTimeField() class Meta: abstract = True
TimeStampedModel
python
airbytehq__airbyte
airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/streams.py
{ "start": 4082, "end": 4529 }
class ____(FBMarketingIncrementalStream): """doc: https://developers.facebook.com/docs/marketing-api/reference/adgroup""" entity_prefix = "ad" status_field = "effective_status" valid_statuses = [status.value for status in ValidAdStatuses] def list_objects(self, params: Mapping[str, Any], account_i...
Ads
python
davidhalter__jedi
test/completion/classes.py
{ "start": 5308, "end": 5546 }
class ____(): def b(self): class B(): def b(self): return [] return B().b() #? list() A().b() # ----------------- # ducktyping # ----------------- def meth(self): return self.a, self.b
A
python
dagster-io__dagster
examples/with_openai/with_openai/assets.py
{ "start": 1809, "end": 3617 }
class ____(Config): model: str question: str @asset( compute_kind="OpenAI", ins={ "search_index": AssetIn(partition_mapping=AllPartitionMapping()), }, ) def completion( context: AssetExecutionContext, openai: OpenAIResource, config: OpenAIConfig, search_index: dict[str, Any...
OpenAIConfig
python
numba__numba
numba/core/types/containers.py
{ "start": 7536, "end": 7849 }
class ____(Type): def __init__(self, types): self.types = tuple(sorted(set(types), key=lambda x: x.name)) name = "Union[{}]".format(",".join(map(str, self.types))) super(UnionType, self).__init__(name=name) def get_type_tag(self, typ): return self.types.index(typ)
UnionType
python
xlwings__xlwings
xlwings/expansion.py
{ "start": 101, "end": 494 }
class ____: def register(self, *aliases): for alias in aliases: expanders[alias] = self def expand(self, rng): """ Expands a range Arguments --------- rng: Range The reference range Returns ------- Range object: T...
Expander
python
numpy__numpy
numpy/lib/tests/test_type_check.py
{ "start": 7847, "end": 8808 }
class ____: # Fixme, wrong place, isfinite now ufunc def test_goodvalues(self): z = np.array((-1., 0., 1.)) res = np.isfinite(z) == 1 assert_all(np.all(res, axis=0)) def test_posinf(self): with np.errstate(divide='ignore', invalid='ignore'): assert_all(np.isfini...
TestIsfinite
python
boto__boto3
tests/unit/resources/test_model.py
{ "start": 8620, "end": 14421 }
class ____(BaseTestCase): def test_multiple(self): # This tests a bunch of different renames working together model = ResourceModel( 'test', { 'identifiers': [{'name': 'Foo'}], 'actions': {'Foo': {}}, 'has': { ...
TestRenaming
python
doocs__leetcode
solution/1200-1299/1248.Count Number of Nice Subarrays/Solution.py
{ "start": 0, "end": 250 }
class ____: def numberOfSubarrays(self, nums: List[int], k: int) -> int: cnt = Counter({0: 1}) ans = t = 0 for v in nums: t += v & 1 ans += cnt[t - k] cnt[t] += 1 return ans
Solution
python
pypa__pip
src/pip/_vendor/urllib3/exceptions.py
{ "start": 232, "end": 316 }
class ____(Warning): """Base warning used by this module.""" pass
HTTPWarning
python
joke2k__faker
faker/providers/internet/es_CL/__init__.py
{ "start": 134, "end": 899 }
class ____(InternetProvider): safe_email_tlds = ("com", "net", "cl", "cl") tlds = ("com", "com", "com", "net", "org", "cl", "cl", "cl") replacements = ( ("à", "a"), ("â", "a"), ("ã", "a"), ("á", "a"), ("ç", "c"), ("é", "e"), ("ê", "e"), ("í", "...
Provider
python
huggingface__transformers
src/transformers/models/siglip/modeling_siglip.py
{ "start": 11752, "end": 14260 }
class ____(nn.Module): """Multi-headed attention from 'Attention Is All You Need' paper""" def __init__(self, config): super().__init__() self.config = config self.embed_dim = config.hidden_size self.num_heads = config.num_attention_heads self.head_dim = self.embed_dim /...
SiglipAttention
python
sqlalchemy__sqlalchemy
test/orm/test_query.py
{ "start": 246559, "end": 254495 }
class ____(QueryTest): run_setup_mappers = "each" @contextlib.contextmanager def _assert_bind_args(self, session, expect_mapped_bind=True): get_bind = mock.Mock(side_effect=session.get_bind) with mock.patch.object(session, "get_bind", get_bind): yield for call_ in get_bi...
SessionBindTest
python
python-excel__xlrd
xlrd/biffh.py
{ "start": 417, "end": 16650 }
class ____(object): """ Parent of almost all other classes in the package. Defines a common :meth:`dump` method for debugging. """ _repr_these = [] def dump(self, f=None, header=None, footer=None, indent=0): """ :param f: open file object, to which the dump is written ...
BaseObject
python
openai__openai-python
tests/test_transform.py
{ "start": 2907, "end": 3003 }
class ____(TypedDict): foo: Annotated[Union[Bar4, List[Baz4]], PropertyInfo(alias="FOO")]
Foo5