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
astropy__astropy
astropy/coordinates/attributes.py
{ "start": 15409, "end": 17631 }
class ____(Attribute): """ A frame attribute which is a coordinate object. It can be given as a `~astropy.coordinates.SkyCoord` or a low-level frame instance. If a low-level frame instance is provided, it will always be upgraded to be a `~astropy.coordinates.SkyCoord` to ensure consistent transfor...
CoordinateAttribute
python
apache__airflow
providers/apache/kafka/tests/integration/apache/kafka/operators/test_consume.py
{ "start": 2752, "end": 4954 }
class ____: """ test ConsumeFromTopicOperator """ def test_consumer_operator_test_1(self): """test consumer works with string import""" TOPIC = "operator.consumer.test.integration.test_1" p = Producer(**{"bootstrap.servers": "broker:29092"}) p.produce(TOPIC, TOPIC) ...
TestConsumeFromTopic
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 506217, "end": 507516 }
class ____(sgqlc.types.Type): """A calendar of contributions made on GitHub by a user.""" __schema__ = github_schema __field_names__ = ("colors", "is_halloween", "months", "total_contributions", "weeks") colors = sgqlc.types.Field(sgqlc.types.non_null(sgqlc.types.list_of(sgqlc.types.non_null(String))),...
ContributionCalendar
python
lepture__authlib
authlib/integrations/base_client/sync_app.py
{ "start": 3938, "end": 5916 }
class ____(_RequestMixin, OAuth1Base): def request(self, method, url, token=None, **kwargs): with self._get_oauth_client() as session: return self._send_token_request(session, method, url, token, kwargs) def create_authorization_url(self, redirect_uri=None, **kwargs): """Generate th...
OAuth1Mixin
python
realpython__materials
web-scraping-with-scrapy-and-mongodb/books/books/spiders/book.py
{ "start": 50, "end": 1362 }
class ____(scrapy.Spider): name = "book" allowed_domains = ["books.toscrape.com"] start_urls = ["https://books.toscrape.com/"] def start_requests(self): for url in self.start_urls: yield scrapy.Request( url, callback=self.parse, errback=self.log_error ) ...
BookSpider
python
walkccc__LeetCode
solutions/2477. Minimum Fuel Cost to Report to the Capital/2477.py
{ "start": 0, "end": 491 }
class ____: def minimumFuelCost(self, roads: list[list[int]], seats: int) -> int: ans = 0 tree = [[] for _ in range(len(roads) + 1)] for u, v in roads: tree[u].append(v) tree[v].append(u) def dfs(u: int, prev: int) -> int: nonlocal ans people = 1 + sum(dfs(v, u) for v in tree...
Solution
python
charliermarsh__ruff
crates/ruff_linter/resources/test/fixtures/flake8_pytest_style/is_pytest_test.py
{ "start": 79, "end": 237 }
class ____: def test_this_too_is_a_test(self, a=1): ... def testAndOfCourseThis(self, a=1): ... # No errors def this_is_not_a_test(a=1): ...
TestClass
python
PyCQA__pylint
tests/functional/t/typing_generic.py
{ "start": 271, "end": 330 }
class ____(Generic[T], metaclass=ABCMeta): """Base"""
Base
python
openai__openai-python
src/openai/types/beta/realtime/response_function_call_arguments_done_event.py
{ "start": 216, "end": 793 }
class ____(BaseModel): arguments: str """The final arguments as a JSON string.""" call_id: str """The ID of the function call.""" event_id: str """The unique ID of the server event.""" item_id: str """The ID of the function call item.""" output_index: int """The index of the ...
ResponseFunctionCallArgumentsDoneEvent
python
pennersr__django-allauth
allauth/usersessions/app_settings.py
{ "start": 0, "end": 820 }
class ____: def __init__(self, prefix): self.prefix = prefix def _setting(self, name, dflt): from allauth.utils import get_setting return get_setting(self.prefix + name, dflt) @property def ADAPTER(self): return self._setting( "ADAPTER", "allauth.usersessio...
AppSettings
python
ethereum__web3.py
web3/exceptions.py
{ "start": 8342, "end": 9022 }
class ____(Web3Exception): """ Raised when a JSON-RPC response contains an error field. """ def __init__( self, message: str, rpc_response: RPCResponse | None = None, user_message: str | None = None, ) -> None: if user_message is None: user_messag...
Web3RPCError
python
doocs__leetcode
solution/1200-1299/1243.Array Transformation/Solution.py
{ "start": 0, "end": 450 }
class ____: def transformArray(self, arr: List[int]) -> List[int]: f = True while f: f = False t = arr[:] for i in range(1, len(t) - 1): if t[i] > t[i - 1] and t[i] > t[i + 1]: arr[i] -= 1 f = True ...
Solution
python
fastai__fastai
fastai/data/transforms.py
{ "start": 15309, "end": 16169 }
class ____(DisplayedTransform): "Transform image to float tensor, optionally dividing by 255 (e.g. for images)." order = 10 #Need to run after PIL transforms on the GPU def __init__(self, div=255., div_mask=1): store_attr() def encodes(self, o:TensorImage): return o.float().div_(self.div) def encode...
IntToFloatTensor
python
getsentry__sentry
src/sentry/preprod/api/endpoints/project_preprod_check_for_updates.py
{ "start": 1242, "end": 8897 }
class ____(ProjectEndpoint): owner = ApiOwner.EMERGE_TOOLS publish_status = { "GET": ApiPublishStatus.EXPERIMENTAL, } permission_classes = (ProjectDistributionPermission,) rate_limits = RateLimitConfig( limit_overrides={ "GET": { RateLimitCategory.ORGANIZ...
ProjectPreprodArtifactCheckForUpdatesEndpoint
python
pytorch__pytorch
test/distributed/_composable/test_replicate_training.py
{ "start": 30102, "end": 31967 }
class ____(FSDPTest): @property def world_size(self) -> int: return min(4, torch.get_device_module(device_type).device_count()) @skip_if_lt_x_gpu(2) def test_train_parity_with_shared_params(self): self.run_subtests( { "use_activation_checkpointing": [False, T...
TestReplicateSharedParams
python
dagster-io__dagster
python_modules/dagster-test/dagster_test/toys/user_computed_data_versions/__init__.py
{ "start": 5546, "end": 6326 }
class ____(TypedDict): assets: Sequence[AssetInfo] source_assets: Sequence[SourceAssetInfo] SCHEMA: Schema = { "assets": [ {"key": "alpha", "code_version": "lib/v1", "dependencies": set()}, {"key": "beta", "code_version": "lib/v1", "dependencies": {"alpha"}}, {"key": "epsilon", "co...
Schema
python
jmcnamara__XlsxWriter
xlsxwriter/sharedstrings.py
{ "start": 369, "end": 2824 }
class ____(xmlwriter.XMLwriter): """ A class for writing the Excel XLSX sharedStrings file. """ ########################################################################### # # Public API. # ########################################################################### def __init__(se...
SharedStrings
python
tiangolo__fastapi
docs_src/handling_errors/tutorial005.py
{ "start": 500, "end": 626 }
class ____(BaseModel): title: str size: int @app.post("/items/") async def create_item(item: Item): return item
Item
python
getsentry__sentry
src/sentry/tasks/summaries/utils.py
{ "start": 2432, "end": 4452 }
class ____: accepted_error_count = 0 dropped_error_count = 0 accepted_transaction_count = 0 dropped_transaction_count = 0 accepted_replay_count = 0 dropped_replay_count = 0 new_substatus_count = 0 ongoing_substatus_count = 0 escalating_substatus_count = 0 regression_substatus_co...
ProjectContext
python
cython__cython
Cython/Compiler/Code.py
{ "start": 143761, "end": 144582 }
class ____: def __init__(self, klass): self.klass = klass self.temps_allocated = {} self.temps_free = {} self.temps_count = 0 def reset(self): for type, cnames in self.temps_allocated.items(): self.temps_free[type] = list(cnames) def allocate_temp(self, ...
ClosureTempAllocator
python
davidhalter__parso
parso/python/tree.py
{ "start": 20764, "end": 22146 }
class ____(Flow): type = 'if_stmt' __slots__ = () def get_test_nodes(self): """ E.g. returns all the `test` nodes that are named as x, below: if x: pass elif x: pass """ for i, c in enumerate(self.children): ...
IfStmt
python
pydata__xarray
asv_bench/benchmarks/groupby.py
{ "start": 4709, "end": 4943 }
class ____(Resample): def setup(self, *args, **kwargs): requires_dask() super().setup(**kwargs) self.ds1d = self.ds1d.chunk({"time": 50}) self.ds2d = self.ds2d.chunk({"time": 50, "z": 4})
ResampleDask
python
huggingface__transformers
src/transformers/models/lxmert/modeling_lxmert.py
{ "start": 28693, "end": 29926 }
class ____(nn.Module): def __init__(self, config): super().__init__() self.transform = LxmertPredictionHeadTransform(config) # Decide the use of visual losses visual_losses = {} if config.visual_obj_loss: visual_losses["obj"] = {"shape": (-1,), "num": config.num_o...
LxmertVisualObjHead
python
facebook__pyre-check
tools/pysa_integration_tests/runner_lib.py
{ "start": 921, "end": 12303 }
class ____(enum.IntEnum): # 1-29 reserved for pyre and pysa client, see client/commands/commands.py TEST_COMPARISON_DIFFERS = 30 TEST_MODEL_VERIFICATION_ERROR = 31 def is_test_function(define: str, code: int) -> bool: return f"test_{code}_" in define def is_test_class_method(define: str, code: int) ...
ExitCode
python
gevent__gevent
src/greentest/3.9/test_socket.py
{ "start": 230402, "end": 239676 }
class ____(ThreadedTCPSocketTest): """ Test the send() implementation of socket.sendfile(). """ FILESIZE = (10 * 1024 * 1024) # 10 MiB BUFSIZE = 8192 FILEDATA = b"" TIMEOUT = support.LOOPBACK_TIMEOUT @classmethod def setUpClass(cls): def chunks(total, step): as...
SendfileUsingSendTest
python
OmkarPathak__pygorithm
tests/test_pathing.py
{ "start": 2224, "end": 2624 }
class ____(SimplePathfindingTestCaseTimed): def find_path(self, my_graph, v1, v2): my_pathfinder = astar.BiDirectionalAStar() def my_heuristic(graph, v1, v2): dx = v2[0] - v1[0] dy = v2[1] - v1[1] return math.sqrt(dx * dx + dy * dy) retur...
TestAStarBiDirectionalTimed
python
great-expectations__great_expectations
contrib/great_expectations_geospatial_expectations/great_expectations_geospatial_expectations/expectations/expect_column_values_to_be_nonempty_geometries.py
{ "start": 1696, "end": 6278 }
class ____(ColumnMapExpectation): """Expect values in a column to be shapely geometries that aren't empty (however, they can be null). Args: column (str): \ The column name. """ # These examples will be shown in the public gallery. # They will also be executed as unit tests fo...
ExpectColumnValuesToBeNonemptyGeometries
python
openai__openai-python
src/openai/resources/audio/transcriptions.py
{ "start": 49666, "end": 49925 }
class ____: def __init__(self, transcriptions: Transcriptions) -> None: self._transcriptions = transcriptions self.create = _legacy_response.to_raw_response_wrapper( transcriptions.create, )
TranscriptionsWithRawResponse
python
pypa__pipenv
pipenv/patched/pip/_internal/commands/search.py
{ "start": 979, "end": 1108 }
class ____(TypedDict): name: str summary: str versions: List[str] logger = logging.getLogger(__name__)
TransformedHit
python
numpy__numpy
benchmarks/benchmarks/bench_ufunc.py
{ "start": 6843, "end": 7330 }
class ____(Benchmark): """ Benchmark for the methods which take an argument """ params = [['__and__', '__or__', '__xor__'], ['int16', 'int32', 'int64']] param_names = ['methods', 'npdtypes'] timeout = 10 def setup(self, methname, npdtypes): values = get_squares_().get(npdt...
MethodsV1IntOnly
python
facebook__pyre-check
source/interprocedural_analyses/taint/test/integration/sanitize.py
{ "start": 1345, "end": 19550 }
class ____: attribute = ... def __init__(self, value): self.instance = value self.attribute = value def return_taint_sanitize(arg: T) -> T: """Identity function that returns the argument unmodified, but is marked as 'Sanitize' in the accompanying .pysa file """ return arg de...
C_sanitized_all_sinks
python
doocs__leetcode
solution/1600-1699/1631.Path With Minimum Effort/Solution2.py
{ "start": 0, "end": 969 }
class ____: def minimumEffortPath(self, heights: List[List[int]]) -> int: def check(h: int) -> bool: q = deque([(0, 0)]) vis = {(0, 0)} dirs = (-1, 0, 1, 0, -1) while q: for _ in range(len(q)): i, j = q.popleft() ...
Solution
python
numba__numba
numba/tests/npyufunc/test_ufunc.py
{ "start": 813, "end": 4426 }
class ____(TestCase): def _test_ufunc_attributes(self, cls, a, b, *args): "Test ufunc attributes" vectorizer = cls(add, *args) vectorizer.add(float32(float32, float32)) ufunc = vectorizer.build_ufunc() info = (cls, a.ndim) self.assertPreciseEqual(ufunc(a, b), a + b,...
TestUFuncs
python
Delgan__loguru
loguru/_recattrs.py
{ "start": 1385, "end": 2481 }
class ____: """A class representing a file record with name and path. Attributes ---------- name : str The name of the file path : str The path to the file """ __slots__ = ("name", "path") def __init__(self, name, path): """Initialize a RecordFile instance. ...
RecordFile
python
django__django
tests/queries/tests.py
{ "start": 165108, "end": 165524 }
class ____(SimpleTestCase): def test_ticket_18785(self): # Test join trimming from ticket18785 qs = ( Item.objects.exclude(note__isnull=False) .filter(name="something", creator__extra__isnull=True) .order_by() ) self.assertEqual(1, str(qs.query).co...
Ticket18785Tests
python
dagster-io__dagster
python_modules/dagster/dagster/_utils/tags.py
{ "start": 589, "end": 9771 }
class ____: """Helper object that keeps track of when the tag concurrency limits are met.""" _key_limits: dict[str, int] _key_value_limits: dict[tuple[str, str], int] _unique_value_limits: dict[str, int] _key_counts: dict[str, int] _key_value_counts: dict[tuple[str, str], int] _unique_value...
TagConcurrencyLimitsCounter
python
apache__airflow
providers/google/tests/unit/google/cloud/hooks/test_bigquery.py
{ "start": 61771, "end": 63895 }
class ____(_BigQueryBaseTestClass): @mock.patch("airflow.providers.google.cloud.hooks.bigquery.Table") @mock.patch("airflow.providers.google.cloud.hooks.bigquery.Client") def test_update_table(self, mock_client, mock_table): description_patched = "Test description." expiration_time_patched =...
TestBigQueryWithKMS
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 982923, "end": 983329 }
class ____(sgqlc.types.Type): """An edge in a connection.""" __schema__ = github_schema __field_names__ = ("cursor", "node") cursor = sgqlc.types.Field(sgqlc.types.non_null(String), graphql_name="cursor") """A cursor for use in pagination.""" node = sgqlc.types.Field("SponsorshipNewsletter", g...
SponsorshipNewsletterEdge
python
spyder-ide__spyder
spyder/plugins/layout/container.py
{ "start": 770, "end": 1996 }
class ____: DefaultLayout = 'default_layout_action' MatlabLayout = 'matlab_layout_action' RStudio = 'rstudio_layout_action' HorizontalSplit = 'horizontal_split_layout_action' VerticalSplit = 'vertical_split_layout_action' SaveLayoutAction = 'save_layout_action' ShowLayoutPreferencesAction = ...
LayoutContainerActions
python
pydantic__pydantic
pydantic/v1/dataclasses.py
{ "start": 8295, "end": 18172 }
class ____: __slots__ = '__dataclass__' def __init__(self, dc_cls: Type['Dataclass']) -> None: object.__setattr__(self, '__dataclass__', dc_cls) def __call__(self, *args: Any, **kwargs: Any) -> Any: with set_validation(self.__dataclass__, True): return self.__dataclass__(*args,...
DataclassProxy
python
airbytehq__airbyte
airbyte-integrations/connectors/source-github/source_github/github_schema.py
{ "start": 1599468, "end": 1599664 }
class ____(sgqlc.types.Union): """A record that can be featured on a GitHub Sponsors profile.""" __schema__ = github_schema __types__ = (Repository, User)
SponsorsListingFeatureableItem
python
fastapi__sqlmodel
docs_src/tutorial/offset_and_limit/tutorial004_py310.py
{ "start": 71, "end": 1614 }
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) sqlite_file_name = "database.db" sqlite_url = f"sqlite:///{sqlite_file_name}" engine = create_engine(sqlite_url, ec...
Hero
python
ray-project__ray
python/ray/serve/_private/test_utils.py
{ "start": 5104, "end": 5473 }
class ____: def __init__(self): self._init_args = () self._options = dict() def options(self, **kwargs): res = copy(self) for k, v in kwargs.items(): res._options[k] = v return res def remote(self, *args) -> MockActorHandle: return MockActorHan...
MockActorClass
python
PrefectHQ__prefect
src/prefect/settings/models/server/database.py
{ "start": 2945, "end": 4600 }
class ____(PrefectBaseSettings): """ Settings for controlling SQLAlchemy behavior; note that these settings only take effect when using a PostgreSQL database. """ model_config: ClassVar[SettingsConfigDict] = build_settings_config( ("server", "database", "sqlalchemy") ) connect_args...
SQLAlchemySettings
python
getsentry__sentry
src/sentry/monitors/validators.py
{ "start": 3355, "end": 3720 }
class ____(serializers.Serializer): environment = serializers.CharField( max_length=64, required=False, allow_null=True, help_text="Name of the environment" ) targets = MonitorAlertRuleTargetValidator( many=True, help_text="Array of dictionaries with information of the user or team t...
MonitorAlertRuleValidator
python
tensorflow__tensorflow
tensorflow/python/framework/ops_test.py
{ "start": 128648, "end": 129356 }
class ____(test_util.TensorFlowTestCase): def testNoDeadlineSet(self): with ops.Graph().as_default() as g: get_deadline = test_ops.get_deadline() with self.session(graph=g) as sess: run_options = config_pb2.RunOptions() with self.assertRaises(errors.InvalidArgumentError): se...
DeadlineTest
python
PyCQA__pyflakes
pyflakes/messages.py
{ "start": 870, "end": 1131 }
class ____(Message): message = 'import %r from line %r shadowed by loop variable' def __init__(self, filename, loc, name, orig_loc): Message.__init__(self, filename, loc) self.message_args = (name, orig_loc.lineno)
ImportShadowedByLoopVar
python
pytorch__pytorch
torch/testing/_internal/common_quantization.py
{ "start": 68937, "end": 69508 }
class ____(torch.nn.Module): def __init__(self) -> None: super().__init__() self.qconfig = torch.ao.quantization.get_default_qconfig("fbgemm") self.quant = torch.ao.quantization.QuantStub() self.hardswish = torch.nn.Hardswish().to(dtype=torch.float) self.elu = torch.nn.ELU()....
ActivationsTestModel
python
kamyu104__LeetCode-Solutions
Python/the-score-of-students-solving-math-expression.py
{ "start": 39, "end": 982 }
class ____(object): def scoreOfStudents(self, s, answers): """ :type s: str :type answers: List[int] :rtype: int """ MAX_ANS = 1000 n = (len(s)+1)//2 dp = [[set() for _ in xrange(n)] for _ in xrange(n)] for i in xrange(n): dp[i][i]....
Solution
python
openai__openai-python
tests/api_resources/test_files.py
{ "start": 575, "end": 10073 }
class ____: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_create(self, client: OpenAI) -> None: file = client.files.create( file=b"raw file contents", purpose="assistants", ) ...
TestFiles
python
huggingface__transformers
src/transformers/models/clipseg/configuration_clipseg.py
{ "start": 5381, "end": 9395 }
class ____(PreTrainedConfig): r""" This is the configuration class to store the configuration of a [`CLIPSegModel`]. It is used to instantiate an CLIPSeg model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar conf...
CLIPSegVisionConfig
python
weaviate__weaviate-python-client
weaviate/rbac/sync.py
{ "start": 160, "end": 215 }
class ____(_RolesExecutor[ConnectionSync]): pass
_Roles
python
doocs__leetcode
solution/2300-2399/2368.Reachable Nodes With Restrictions/Solution.py
{ "start": 0, "end": 407 }
class ____: def reachableNodes( self, n: int, edges: List[List[int]], restricted: List[int] ) -> int: def dfs(i: int) -> int: vis.add(i) return 1 + sum(j not in vis and dfs(j) for j in g[i]) g = defaultdict(list) for a, b in edges: g[a].append...
Solution
python
ansible__ansible
lib/ansible/_internal/_templating/_jinja_common.py
{ "start": 7401, "end": 7547 }
class ____(Marker): """A `Marker` value that represents an undefined value encountered during templating.""" __slots__ = ()
UndefinedMarker
python
google__jax
tests/shard_map_test.py
{ "start": 178134, "end": 178876 }
class ____(jtu.JaxTestCase): # Verify we can lower to a `ManualComputationOp`. def test_shardy_collective_permute(self): mesh = jtu.create_mesh((2,), ('x',)) a = jax.device_put( jnp.arange(8 * 8).reshape((8, 8)), jax.sharding.NamedSharding(mesh, P('x', None)), ) @jax.jit @parti...
SdyIntegrationTest
python
django__django
tests/update/models.py
{ "start": 557, "end": 667 }
class ____(models.Model): a = models.ForeignKey(A, models.CASCADE) y = models.IntegerField(default=10)
B
python
ray-project__ray
rllib/core/models/torch/primitives.py
{ "start": 404, "end": 8853 }
class ____(nn.Module): """A multi-layer perceptron with N dense layers. All layers (except for an optional additional extra output layer) share the same activation function, bias setup (use bias or not), and LayerNorm setup (use layer normalization or not). If `output_dim` (int) is not None, an ad...
TorchMLP
python
neetcode-gh__leetcode
python/0075-sort-colors.py
{ "start": 0, "end": 480 }
class ____: def sortColors(self, nums: List[int]) -> None: low = 0 high = len(nums) - 1 mid = 0 while mid <= high: if nums[mid] == 0: nums[low], nums[mid] = nums[mid], nums[low] low += 1 mid += 1 elif nums[mid] ...
Solution
python
huggingface__transformers
src/transformers/models/t5gemma/modeling_t5gemma.py
{ "start": 42699, "end": 47717 }
class ____(T5GemmaPreTrainedModel, GenerationMixin): _tied_weights_keys = {"lm_head.out_proj.weight": "model.decoder.embed_tokens.weight"} _tp_plan = {"lm_head.out_proj": "colwise_rep"} _pp_plan = {"lm_head.out_proj": (["hidden_states"], ["logits"])} def __init__(self, config: T5GemmaConfig): c...
T5GemmaForConditionalGeneration
python
spyder-ide__spyder
spyder/plugins/appearance/plugin.py
{ "start": 725, "end": 2164 }
class ____(SpyderPluginV2): """ Appearance Plugin. """ NAME = "appearance" # TODO: Fix requires to reflect the desired order in the preferences REQUIRES = [Plugins.Preferences] CONTAINER_CLASS = None CONF_SECTION = NAME CONF_WIDGET_CLASS = AppearanceConfigPage CONF_FILE = False ...
Appearance
python
google__jax
jax/_src/lax/fft.py
{ "start": 1135, "end": 7259 }
class ____(enum.IntEnum): "Describes which FFT operation to perform." FFT = 0 "Forward complex-to-complex FFT." IFFT = 1 "Inverse complex-to-complex FFT." RFFT = 2 "Forward real-to-complex FFT." IRFFT = 3 "Inverse real-to-complex FFT." def _str_to_fft_type(s: str) -> FftType: if s in ("fft", "...
FftType
python
numba__numba
numba/tests/enum_usecases.py
{ "start": 714, "end": 803 }
class ____(IntEnum): dummy = 2 not_found = 404 internal_error = 500
RequestError
python
tornadoweb__tornado
tornado/log.py
{ "start": 2462, "end": 12547 }
class ____(logging.Formatter): """Log formatter used in Tornado. Key features of this formatter are: * Color support when logging to a terminal that supports it. * Timestamps on every log line. * Robust against str/bytes encoding problems. This formatter is enabled automatically by `torna...
LogFormatter
python
apache__airflow
airflow-core/src/airflow/api_fastapi/core_api/datamodels/task_instances.py
{ "start": 1474, "end": 2817 }
class ____(BaseModel): """TaskInstance serializer for responses.""" id: str task_id: str dag_id: str run_id: str = Field(alias="dag_run_id") map_index: int logical_date: datetime | None run_after: datetime start_date: datetime | None end_date: datetime | None duration: float...
TaskInstanceResponse
python
PrefectHQ__prefect
tests/blocks/test_core.py
{ "start": 98898, "end": 99262 }
class ____(Block): winner: str = "kendrick" secret_str: SecretStr secret_str_manual: PydanticSecret[str] secret_bytes: SecretBytes secret_bytes_manual: PydanticSecret[bytes] secret_int: PydanticSecret[int] nested_model: NestedFunModel normal_dictionary: Dict[str, Union[str, Dict[str, Any...
FunSecretModel
python
sphinx-doc__sphinx
sphinx/builders/latex/transforms.py
{ "start": 6693, "end": 11361 }
class ____(SphinxPostTransform): """Convert footnote definitions and references to appropriate form to LaTeX. * Replace footnotes on restricted zone (e.g. headings) by footnotemark node. In addition, append a footnotetext node after the zone. Before:: <section> <title> ...
LaTeXFootnoteTransform
python
google__jax
jax/_src/core.py
{ "start": 71600, "end": 78075 }
class ____(Exception): pass # TODO(dougalm): Cast scalar, numpy arrays, etc to jax arrays so that values # passed to primitives are always have avals, etc i.e. they are canonical. def canonicalize_value(val): try: aval = get_aval(val) except TypeError: return val if not isinstance(aval, ShapedArray): ...
ShardingTypeError
python
mkdocs__mkdocs
mkdocs/livereload/__init__.py
{ "start": 1706, "end": 2257 }
class ____(logging.LoggerAdapter): def process(self, msg: str, kwargs: dict) -> tuple[str, dict]: # type: ignore[override] return time.strftime("[%H:%M:%S] ") + msg, kwargs log = _LoggerAdapter(logging.getLogger(__name__), {}) def _normalize_mount_path(mount_path: str) -> str: """Ensure the mount p...
_LoggerAdapter
python
getsentry__sentry
tests/sentry/api/endpoints/issues/test_organization_derive_code_mappings.py
{ "start": 641, "end": 11731 }
class ____(APITestCase): def setUp(self) -> None: super().setUp() self.login_as(user=self.user) self.organization = self.create_organization("federal-bureau-of-control") self.organization.flags.allow_joinleave = False self.organization.save() self.team = self.create_t...
OrganizationDeriveCodeMappingsTest
python
ipython__ipython
IPython/extensions/autoreload.py
{ "start": 20981, "end": 31724 }
class ____(Magics): def __init__(self, *a, **kw): super().__init__(*a, **kw) self._reloader = ModuleReloader(self.shell) self._reloader.check_all = False self._reloader.autoload_obj = False self.loaded_modules = set(sys.modules) @line_magic @magic_arguments.magic_arg...
AutoreloadMagics
python
microsoft__pyright
packages/pyright-internal/src/tests/samples/typeVarDefault2.py
{ "start": 1693, "end": 1725 }
class ____[*Ts = P1]: ...
ClassTs7
python
falconry__falcon
falcon/routing/compiled.py
{ "start": 44725, "end": 45130 }
class ____(_CxChild): def __init__(self, param_name: str, field_value_name: str) -> None: self._param_name = param_name self._field_value_name = field_value_name def src(self, indentation: int) -> str: return "{0}params['{1}'] = {2}".format( _TAB_STR * indentation, ...
_CxSetParamFromValue
python
cherrypy__cherrypy
cherrypy/lib/sessions.py
{ "start": 14449, "end": 16221 }
class ____(Session): """A memory-baked session store implementation.""" # Class-level objects. Don't rebind these! cache = {} locks = {} def clean_up(self): """Clean up expired sessions.""" now = self.now() for _id, (data, expiration_time) in self.cache.copy().items(): ...
RamSession
python
oauthlib__oauthlib
tests/oauth2/rfc6749/test_utils.py
{ "start": 225, "end": 471 }
class ____: """ Fixture for testing list_to_scope()/scope_to_list() with objects other than regular strings. """ def __init__(self, scope): self.scope = scope def __str__(self): return self.scope
ScopeObject
python
ansible__ansible
lib/ansible/galaxy/dependency_resolution/reporters.py
{ "start": 1347, "end": 3389 }
class ____(BaseReporter): """A dependency reporter for Ansible Collections. This is a proxy class allowing us to abstract away importing resolvelib outside of the `ansible.galaxy.dependency_resolution` Python package. """ def __init__(self) -> None: """Initialize the collection rejection c...
CollectionDependencyReporter
python
PrefectHQ__prefect
tests/test_context.py
{ "start": 5603, "end": 12292 }
class ____: @pytest.fixture(autouse=True) def temporary_profiles_path(self, tmp_path): path = tmp_path / "profiles.toml" with temporary_settings( updates={PREFECT_HOME: tmp_path, PREFECT_PROFILES_PATH: path} ): yield path def test_settings_context_variable(se...
TestSettingsContext
python
mlflow__mlflow
dev/clint/src/clint/rules/empty_notebook_cell.py
{ "start": 36, "end": 167 }
class ____(Rule): def _message(self) -> str: return "Empty notebook cell. Remove it or add some content."
EmptyNotebookCell
python
pytorch__pytorch
torch/utils/_sympy/functions.py
{ "start": 20921, "end": 21140 }
class ____(sympy.Function): is_integer = True @classmethod def eval(cls, base, shift): if shift < 0: raise ValueError("negative shift count") return FloorDiv(base, 2**shift)
RShift
python
fluentpython__example-code
attic/attributes/hasattr.py
{ "start": 295, "end": 869 }
class ____: def __init__(self): self.gadget = True gizmo = Gizmo() test_keys = 'hasattr', 'getattr', 'tryget' def test(): for test_key in test_keys: test_name = 'test_' + test_key test = globals()[test_name] setup = 'from __main__ import gizmo' t_present = min(timeit....
Gizmo
python
run-llama__llama_index
llama-index-integrations/embeddings/llama-index-embeddings-llm-rails/llama_index/embeddings/llm_rails/base.py
{ "start": 214, "end": 3755 }
class ____(BaseEmbedding): """ LLMRails embedding models. This class provides an interface to generate embeddings using a model deployed in an LLMRails cluster. It requires a model_id of the model deployed in the cluster and api key you can obtain from https://console.llmrails.com/api-keys. ""...
LLMRailsEmbedding
python
ray-project__ray
python/ray/_private/thirdparty/pynvml/pynvml.py
{ "start": 75057, "end": 80852 }
class ____(Structure): pass # opaque handle c_nvmlEventSet_t = POINTER(struct_c_nvmlEventSet_t) nvmlEventTypeSingleBitEccError = 0x0000000000000001 nvmlEventTypeDoubleBitEccError = 0x0000000000000002 nvmlEventTypePState = 0x0000000000000004 nvmlEventTypeXidCriticalError = 0x00000000...
struct_c_nvmlEventSet_t
python
readthedocs__readthedocs.org
readthedocs/search/api/v3/queryparser.py
{ "start": 74, "end": 220 }
class ____: def __init__(self, *, name, value, type): self.name = name self.value = value self.type = type
ArgumentToken
python
numpy__numpy
numpy/ma/tests/test_subclassing.py
{ "start": 4548, "end": 5453 }
class ____(NDArrayOperatorsMixin): """ Wrapping a MaskedArray rather than subclassing to test that ufunc deferrals are commutative. See: https://github.com/numpy/numpy/issues/15200) """ __slots__ = ('_array', 'attrs') __array_priority__ = 20 def __init__(self, array, **attrs): s...
WrappedArray
python
modin-project__modin
modin/core/execution/ray/implementations/pandas_on_ray/partitioning/virtual_partition.py
{ "start": 1263, "end": 9267 }
class ____(PandasDataframeAxisPartition): """ The class implements the interface in ``PandasDataframeAxisPartition``. Parameters ---------- list_of_partitions : Union[list, PandasOnRayDataframePartition] List of ``PandasOnRayDataframePartition`` and ``PandasOnRayDataframeVirtualPart...
PandasOnRayDataframeVirtualPartition
python
Pylons__pyramid
tests/test_integration.py
{ "start": 7782, "end": 8189 }
class ____(IntegrationBase, unittest.TestCase): package = 'tests.pkgs.static_assetspec_nulbyte' def test_nulbyte_chroot(self): super_w_null = '..\x00/' self.testapp.get(f'/{super_w_null}', status=404) def test_nulbyte_chroot_assetspec_override(self): super_w_null = '..\x00/' ...
TestStaticAppUsingAssetSpecNulByte
python
getsentry__sentry
tests/sentry/issues/test_status_change_consumer.py
{ "start": 9262, "end": 15897 }
class ____(IssueOccurrenceTestBase): @django_db_all def setUp(self) -> None: super().setUp() message = get_test_message(self.project.id) with self.feature("organizations:profile-file-io-main-thread-ingest"): result = _process_message(message) assert result is not None...
StatusChangeBulkGetGroupsFromFingerprintsTest
python
wandb__wandb
wandb/vendor/pygments/lexers/html.py
{ "start": 12179, "end": 15766 }
class ____(ExtendedRegexLexer): """ For `Scaml markup <http://scalate.fusesource.org/>`_. Scaml is Haml for Scala. .. versionadded:: 1.4 """ name = 'Scaml' aliases = ['scaml'] filenames = ['*.scaml'] mimetypes = ['text/x-scaml'] flags = re.IGNORECASE # Scaml does not yet supp...
ScamlLexer
python
allegroai__clearml
clearml/backend_api/services/v2_23/frames.py
{ "start": 152211, "end": 153280 }
class ____(Response): """ Response of frames.get_count endpoint. :param total: Total count of frames for the entire query. :type total: int """ _service = "frames" _action = "get_count" _version = "2.23" _schema = { "definitions": {}, "properties": { "t...
GetCountResponse
python
python-pillow__Pillow
Tests/test_image_access.py
{ "start": 8452, "end": 10426 }
class ____: @pytest.mark.xfail(not (sys.version_info >= (3, 13)), reason="failing test") @pytest.mark.skipif(not is_win32(), reason="requires Windows") def test_embeddable(self) -> None: import ctypes from setuptools.command import build_ext compiler = getattr(build_ext, "new_compi...
TestEmbeddable
python
django__django
tests/many_to_one/tests.py
{ "start": 644, "end": 39008 }
class ____(TestCase): @classmethod def setUpTestData(cls): # Create a few Reporters. cls.r = Reporter(first_name="John", last_name="Smith", email="john@example.com") cls.r.save() cls.r2 = Reporter( first_name="Paul", last_name="Jones", email="paul@example.com" ...
ManyToOneTests
python
wandb__wandb
wandb/sdk/artifacts/artifact_file_cache.py
{ "start": 527, "end": 1169 }
class ____(Protocol): def __call__(self, mode: str = ...) -> ContextManager[IO]: ... def artifacts_cache_dir() -> Path: """Get the artifacts cache directory.""" return env.get_cache_dir() / "artifacts" def _get_sys_umask_threadsafe() -> int: # Workaround to get the current system umask, since # ...
Opener
python
getsentry__sentry
src/sentry/search/events/builder/errors.py
{ "start": 5386, "end": 6254 }
class ____(ErrorsQueryBuilderMixin, TimeseriesQueryBuilder): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @property def time_column(self) -> SelectType: return Column("time", entity=Entity(self.dataset.value, alias=self.dataset.value)) def get_snql_query(self)...
ErrorsTimeseriesQueryBuilder
python
scrapy__scrapy
tests/CrawlerProcess/caching_hostname_resolver_ipv6.py
{ "start": 58, "end": 548 }
class ____(scrapy.Spider): """ Finishes without a twisted.internet.error.DNSLookupError exception """ name = "caching_hostname_resolver_spider" start_urls = ["http://[::1]"] if __name__ == "__main__": process = CrawlerProcess( settings={ "RETRY_ENABLED": False, ...
CachingHostnameResolverSpider
python
openai__openai-python
src/openai/types/evals/run_cancel_response.py
{ "start": 12623, "end": 12962 }
class ____(BaseModel): errored: int """Number of output items that resulted in an error.""" failed: int """Number of output items that failed to pass the evaluation.""" passed: int """Number of output items that passed the evaluation.""" total: int """Total number of executed output i...
ResultCounts
python
chroma-core__chroma
chromadb/segment/impl/vector/hnsw_params.py
{ "start": 1533, "end": 2485 }
class ____(Params): space: str construction_ef: int search_ef: int M: int num_threads: int resize_factor: float def __init__(self, metadata: Metadata): metadata = metadata or {} self.space = str(metadata.get("hnsw:space", "l2")) self.construction_ef = int(metadata.ge...
HnswParams
python
catalyst-team__catalyst
catalyst/callbacks/sklearn_model.py
{ "start": 282, "end": 5294 }
class ____(Callback): """Callback to train a classifier on the train loader and to give predictions on the valid loader. Args: feature_key: keys of tensors that should be used as features for the classifier fit target_key: keys of tensors that should be used as targets ...
SklearnModelCallback
python
numpy__numpy
numpy/distutils/tests/test_misc_util.py
{ "start": 1459, "end": 2060 }
class ____: def test_1(self): n = lambda path: path.replace('/', sep) assert_equal(minrelpath(n('aa/bb')), n('aa/bb')) assert_equal(minrelpath('..'), '..') assert_equal(minrelpath(n('aa/..')), '') assert_equal(minrelpath(n('aa/../bb')), 'bb') assert_equal(minrelpath(...
TestMinrelpath
python
spyder-ide__spyder
spyder/plugins/completion/providers/languageserver/transport/tcp/producer.py
{ "start": 938, "end": 3330 }
class ____(LanguageServerClient): """Implementation of a v3.0 compilant language server TCP client.""" MAX_TIMEOUT_TIME = 20000 def __init__(self, host='127.0.0.1', port=2087, zmq_in_port=7000, zmq_out_port=7001): LanguageServerClient.__init__(self, zmq_in_port, zmq_out_port) ...
TCPLanguageServerClient
python
pytorch__pytorch
test/jit/test_save_load_for_op_version.py
{ "start": 579, "end": 23550 }
class ____(JitTestCase): # Helper that returns the module after saving and loading def _save_load_module(self, m): scripted_module = torch.jit.script(m()) buffer = io.BytesIO() torch.jit.save(scripted_module, buffer) buffer.seek(0) return torch.jit.load(buffer) def _...
TestSaveLoadForOpVersion
python
xlwings__xlwings
xlwings/constants.py
{ "start": 125765, "end": 125955 }
class ____: xlUpdateLinksAlways = 3 # from enum XlUpdateLinks xlUpdateLinksNever = 2 # from enum XlUpdateLinks xlUpdateLinksUserSetting = 1 # from enum XlUpdateLinks
UpdateLinks