repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
saleor
saleor/plugins/admin_email/plugin.py
.py
import logging from collections.abc import Callable from copy import deepcopy from dataclasses import asdict from django.conf import settings from promise.promise import Promise from ...core.notify import AdminNotifyEvent, NotifyEventType from ...graphql.plugins.dataloaders import EmailTemplatesByPluginConfigurationL...
320
12,218
omegaconf
tests/examples/test_dataclass_example.py
.py
from dataclasses import dataclass, field from enum import Enum from typing import Any, Dict, List, Optional from pytest import raises from omegaconf import ( MISSING, DictConfig, MissingMandatoryValue, OmegaConf, ReadonlyConfigError, ValidationError, ) class Height(Enum): SHORT = 0 T...
405
11,719
biopython
Bio/Emboss/__init__.py
.py
# Copyright 2001 Brad Chapman. All rights reserved. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included as part of this # package. """Code to interact with the ...
9
355
flit
flit_core/tests_core/samples/inclusion/module1.py
.py
"""For tests""" __version__ = '0.1'
4
37
mkdocs-material
material/plugins/social/templates/__init__.py
.py
# Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com> # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, c...
30
1,456
openvino
docs/scripts/install_appropriate_openvino_version.py
.py
import re import argparse import subprocess import requests from packaging import version from pathlib import Path def determine_openvino_version(file_path): pattern = r"version_name\s*=\s*['\"]([^'\"]+)['\"]" with open(file_path, 'r') as file: content = file.read() match = re.search(pattern, cont...
78
2,946
mlflow
tests/claude_code/test_cli.py
.py
import json from pathlib import Path from unittest import mock import pytest from click.testing import CliRunner from mlflow.claude_code.cli import commands @pytest.fixture def runner(): return CliRunner() @pytest.fixture(autouse=True) def _clear_mlflow_env(monkeypatch): for name in ( "MLFLOW_TRAC...
225
8,108
probability
tensorflow_probability/python/distributions/gamma_gamma_test.py
.py
# Copyright 2018 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
262
9,203
pdm
src/pdm/formats/base.py
.py
from __future__ import annotations from collections.abc import Callable, Mapping from typing import Any, TypeVar, cast import tomlkit from pdm import termui _T = TypeVar("_T", bound=Callable) def convert_from(field: str | None = None, name: str | None = None) -> Callable[[_T], _T]: def wrapper(func: _T) -> _T...
106
3,429
cvxpy
cvxpy/interface/numpy_interface/matrix_interface.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
60
2,033
pyomo
pyomo/repn/tests/ampl/small11_testCase.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
46
1,528
astropy
astropy/coordinates/tests/test_funcs.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests for miscellaneous functionality in the `funcs` module """ import numpy as np import pytest from numpy import testing as npt from astropy import units as u from astropy.coordinates import FK5, ICRS, SkyCoord from astropy.coordinates import repr...
235
8,332
saleor
saleor/graphql/account/mutations/account/request_email_change.py
.py
from typing import cast from urllib.parse import urlencode import graphene from django.conf import settings from django.core.exceptions import ValidationError from .....account import models, notifications from .....account.error_codes import AccountErrorCode from .....core.jwt import JWT_CONFIRM_CHANGE_EMAIL_TYPE, c...
134
4,650
onnxruntime
onnxruntime/test/testdata/custom_op_library/custom_op_test_float8.py
.py
""" This file was used to generate model `custom_op_test_float8.py`. """ from onnx import TensorProto from onnx.checker import check_model from onnx.helper import make_graph, make_model, make_node, make_opsetid, make_tensor_value_info X = make_tensor_value_info("X", TensorProto.FLOAT8E4M3FN, [None]) Y = make_tensor_v...
26
828
pyro
examples/air/main.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 """ AIR applied to the multi-mnist data set [1]. [1] Eslami, SM Ali, et al. "Attend, infer, repeat: Fast scene understanding with generative models." Advances in Neural Information Processing Systems. 2016. """ import argparse im...
454
14,656
astropy
astropy/coordinates/representation/cartesian.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Cartesian representations and differentials.""" import numpy as np from erfa import ufunc as erfa_ufunc import astropy.units as u from .base import BaseDifferential, BaseRepresentation class CartesianRepresentation(BaseRepresentation): """ ...
434
16,354
openvino
tests/layer_tests/onnx_tests/test_add_sub_mul_div.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from common.onnx_layer_test_class import OnnxRuntimeLayerTest, onnx_make_model class TestOperations(OnnxRuntimeLayerTest): def create_net(self, shape1, shape2, op, precision, ir_version, opset=None...
362
15,166
mlflow
mlflow/entities/mcp_server_version.py
.py
from __future__ import annotations from dataclasses import dataclass, field from typing import Any from mlflow.entities.mcp_server import MCPStatus, MCPTool from mlflow.exceptions import MlflowException from mlflow.utils.annotations import experimental from mlflow.utils.workspace_utils import resolve_entity_workspace...
78
2,917
returns
returns/interfaces/equable.py
.py
from abc import abstractmethod from collections.abc import Sequence from typing import ClassVar, TypeVar, final from returns.primitives.laws import ( Law, Law1, Law2, Law3, Lawful, LawSpecDef, law_definition, ) _EqualType = TypeVar('_EqualType', bound='Equable') @final class _LawSpec(Law...
77
1,874
cvxpy
cvxpy/atoms/min.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
127
3,959
voila
tests/app/kernel_death_test.py
.py
import os import pytest @pytest.fixture def voila_notebook(notebook_directory): return os.path.join(notebook_directory, "autokill.ipynb") @pytest.fixture def voila_args_extra(): return ["--debug"] @pytest.fixture def preheat_mode(): return False async def test_kernel_death(http_server_client, base_...
25
476
gunicorn
benchmarks/http_parser_benchmark.py
.py
#!/usr/bin/env python """ Benchmark comparing HTTP parser implementations. Compares: - WSGI Python parser vs Fast parser (gunicorn_h1c) - ASGI Python parser vs Fast parser (gunicorn_h1c) Usage: python benchmarks/http_parser_benchmark.py """ import io import time import statistics from typing import NamedTuple f...
270
8,490
astropy
astropy/visualization/wcsaxes/axislabels.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import matplotlib.transforms as mtransforms import numpy as np from matplotlib import rcParams from matplotlib.text import Text from .frame import RectangularFrame class AxisLabels(Text): def __init__(self, frame, minpad=1, *args, **kwargs): ...
152
5,061
biopython
Tests/test_PDB_KDTree.py
.py
# Copyright 2009-2010 by Eric Talevich. All rights reserved. # Revisions copyright 2010 by Peter Cock. All rights reserved. # # Converted by Eric Talevich from an older unit test copyright 2002 # by Thomas Hamelryck. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython L...
193
7,781
wagtail
wagtail/actions/publish_revision.py
.py
from __future__ import annotations import logging from typing import TYPE_CHECKING from django.conf import settings from django.core.exceptions import PermissionDenied from django.utils import timezone from wagtail.actions.base import BaseAction from wagtail.log_actions import log from wagtail.signals import publish...
244
8,428
readthedocs.org
readthedocs/worker.py
.py
"""Celery worker application instantiation.""" import os from celery import Celery from django.conf import settings from django_structlog.celery.steps import DjangoStructLogInitStep def create_application(): """Create a Celery application using Django settings.""" os.environ.setdefault( "DJANGO_SETT...
75
2,466
coremltools
coremltools/converters/mil/frontend/tensorflow/parse.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as _np from tensorflow.core.framework.types_pb2 import DataType from tensorflow.python.f...
139
4,082
saleor
saleor/graphql/payment/tests/mutations/test_payment_method_process_tokenization.py
.py
from unittest.mock import patch import pytest from .....payment.interface import ( PaymentMethodProcessTokenizationRequestData, PaymentMethodTokenizationResponseData, PaymentMethodTokenizationResult, ) from .....plugins.manager import PluginsManager from ....core.enums import PaymentMethodProcessTokenizat...
269
8,663
beam
sdks/python/apache_beam/io/components/adaptive_throttler_test.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
110
3,985
openvino
tools/ovc/openvino/tools/ovc/error.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import re class BasicError(Exception): """ Base class for all exceptions in Model Conversion API It operates like Exception but when it is converted to str, it formats string as args[0].format(*args[1:]), where ...
50
1,463
cvxpy
cvxpy/atoms/elementwise/log.py
.py
""" Copyright 2013 Steven Diamond, Eric Chu Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing...
123
3,372
pyomo
pyomo/solvers/tests/piecewise_linear/problems/piecewise_var.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
76
2,350
wagtail
wagtail/api/utils.py
.py
from urllib.parse import urlsplit from django.conf import settings from django.utils.encoding import force_str from wagtail.models import Site def get_base_url(request=None): base_url = getattr(settings, "WAGTAILAPI_BASE_URL", None) if base_url is None and request: site = Site.find_for_request(requ...
31
761
astropy
astropy/visualization/wcsaxes/tests/test_formatter_locator.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from matplotlib import rc_context from numpy.testing import assert_almost_equal from astropy import units as u from astropy.tests.helper import assert_quantity_allclose from astropy.units import UnitsError from astropy.vi...
646
22,132
black
tests/data/cases/pep_646.py
.py
# flags: --minimum-version=3.11 A[*b] A[*b] = 1 A del A[*b] A A[*b, *b] A[*b, *b] = 1 A del A[*b, *b] A A[b, *b] A[b, *b] = 1 A del A[b, *b] A A[*b, b] A[*b, b] = 1 A del A[*b, b] A A[b, b, *b] A[b, b, *b] = 1 A del A[b, b, *b] A A[*b, b, b] A[*b, b, b] = 1 A del A[*b, b, b] A A[b, *b, b] A[b, *b, b] = 1 A del A[b, *b,...
196
2,146
saleor
saleor/graphql/product/mutations/product/product_cleaner.py
.py
from django.core.exceptions import ValidationError from .....core.editorjs import editorjs_to_text from .....product.error_codes import ProductErrorCode from ....core.validators import validate_slug_and_generate_if_needed def clean_weight(cleaned_input: dict): weight = cleaned_input.get("weight") if weight a...
35
1,117
saleor
saleor/core/__init__.py
.py
from django.conf import settings from django.core.files.storage import Storage from django.utils.functional import LazyObject from django.utils.module_loading import import_string class JobStatus: PENDING = "pending" SUCCESS = "success" FAILED = "failed" DELETED = "deleted" CHOICES = [ (P...
52
1,130
mlflow
examples/keras/train.py
.py
"""Trains and evaluate a simple MLP on the Reuters newswire topic classification task. """ import numpy as np from tensorflow import keras from tensorflow.keras.datasets import reuters from tensorflow.keras.layers import Activation, Dense, Dropout from tensorflow.keras.models import Sequential from tensorflow.keras.pr...
60
1,974
django-cms
cms/utils/decorators.py
.py
from urllib.parse import quote from django.conf import settings from django.contrib.auth.views import redirect_to_login from django.http import Http404 from django.urls import resolve from cms.page_rendering import _handle_no_page from cms.utils import get_current_site from cms.utils.page_permissions import user_can_...
75
2,772
httpie
extras/profiling/benchmarks.py
.py
""" This file is the declaration of benchmarks for HTTPie. It is also used to run them with the current environment. Each instance of BaseRunner class will be an individual benchmark. And if run without any arguments, this file will execute every benchmark instance and report the timings. The benchmarks are run throu...
203
5,925
conda
tests/plugins/test_hookspec.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause import pytest import conda.plugins.hookspec @pytest.mark.parametrize( "constant", ["spec_name"], ) def test_deprecations(constant: str) -> None: with pytest.deprecated_call(): getattr(conda.plugins.hookspec, constant)
15
316
beam
sdks/python/apache_beam/ml/inference/anthropic_inference_it_test.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
216
7,070
onnx
onnx/backend/test/case/node/meanvariancenormalization.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class MeanVarianceNormalization(Base): @staticmethod def export() ->...
50
1,722
probability
tensorflow_probability/python/mcmc/transformed_kernel_test.py
.py
# Copyright 2018 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
505
20,747
clearml
examples/router/simple_webserver.py
.py
""" A simple webserver, used as a tool to showcase the capabilities of ClearML HTTP router. See `http_router.py` for more details. """ from fastapi import FastAPI, HTTPException from pydantic import BaseModel import uvicorn app = FastAPI() actions = { "1": {"name": "Action 1", "description": "This is model acti...
45
994
textual
docs/examples/guide/actions/actions01.py
.py
from textual.app import App from textual import events class ActionsApp(App): def action_set_background(self, color: str) -> None: self.screen.styles.background = color def on_key(self, event: events.Key) -> None: if event.key == "r": self.action_set_background("red") if __name_...
17
374
beam
sdks/python/apache_beam/runners/interactive/messaging/interactive_environment_inspector_test.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
209
8,532
black
tests/data/miscellaneous/missing_final_newline.py
.py
# A comment-only file, with no final EOL character # This triggers https://bugs.python.org/issue2142 # This is the line without the EOL character
3
145
pyomo
pyomo/contrib/doe/examples/reactor_example.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
166
5,795
pymc
tests/model/test_transform_values.py
.py
# Copyright 2026 - present The PyMC Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
150
5,710
probability
tensorflow_probability/python/math/generic.py
.py
# Copyright 2018 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
868
33,764
saleor
saleor/graphql/checkout/tests/mutations/test_order_create_from_checkout.py
.py
import datetime from decimal import Decimal from unittest.mock import ANY, patch import graphene import pytest from django.db import transaction from django.db.models.aggregates import Sum from django.test import override_settings from django.utils import timezone from freezegun import freeze_time from prices import M...
3,382
110,877
readthedocs.org
readthedocs/proxito/cache.py
.py
import structlog from django.conf import settings log = structlog.get_logger(__name__) CACHE_TAG_HEADER = "Cache-Tag" CDN_CACHE_CONTROL_HEADER = "CDN-Cache-Control" def add_cache_tags(response, cache_tags): """ Add cache tags to the response. New cache tags will be appended to the existing ones. ...
74
2,623
saleor
saleor/account/apps.py
.py
from django.apps import AppConfig from django.db.models.signals import post_delete class AccountAppConfig(AppConfig): name = "saleor.account" def ready(self): from .models import User from .signals import delete_avatar post_delete.connect( delete_avatar, sende...
17
385
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_mul.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np from save_model import saveModel import sys def paddle_matmul(name, x1, x2, x_transpose=False, y_transpose=False): import paddle paddle.enable_static() with paddle.static.program_guard(paddle.static.Progr...
56
2,196
wandb
tests/conftest.py
.py
from __future__ import annotations import logging import os import pathlib import shutil import subprocess import sys import time import unittest.mock from collections.abc import Callable, Generator from pathlib import Path from queue import Queue from typing import Any from wandb.sdk import wandb_setup # Don't writ...
362
11,120
qutip
qutip/solver/sode/sode.py
.py
import numpy as np import warnings from . import _sode from ..integrator.integrator import Integrator from ..stochastic import StochasticSolver, SMESolver from ._noise import Wiener, PreSetWiener __all__ = ["SIntegrator", "PlatenSODE", "PredCorr_SODE"] class SIntegrator(Integrator): """ A wrapper around stoc...
312
9,356
astropy
astropy/io/fits/hdu/compressed/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from .compressed import * from .header import * from .section import * from .settings import * from .utils import *
8
181
wandb
tests/system_tests/test_functional/catboost/regression.py
.py
import wandb from catboost import CatBoostClassifier, Pool, datasets from wandb.integration.catboost import WandbCallback, log_summary train_df, _ = datasets.msrank_10k() X, Y = train_df[train_df.columns[1:]], train_df[train_df.columns[0]] pool = Pool( data=X[:1000], label=Y[:1000], feature_names=list(X.co...
19
575
textual
docs/examples/guide/widgets/loading01.py
.py
from asyncio import sleep from random import randint from textual import work from textual.app import App, ComposeResult from textual.widgets import DataTable ROWS = [ ("lane", "swimmer", "country", "time"), (4, "Joseph Schooling", "Singapore", 50.39), (2, "Michael Phelps", "United States", 51.14), (5...
55
1,396
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_conv_2d_transpose.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import tensorflow as tf from common.tf2_layer_test_class import CommonTF2LayerTest rng = np.random.default_rng(233534) class TestKerasConv2DTranspose(CommonTF2LayerTest): def _prepare_input(self, ...
76
3,603
openvino
src/bindings/python/src/openvino/utils/data_helpers/__init__.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino.utils.data_helpers.data_dispatcher import _data_dispatch from openvino.utils.data_helpers.wrappers import tensor_from_file from openvino.utils.data_helpers.wrappers import _InferRequestWrapper from o...
9
370
wagtail
wagtail/images/api/fields.py
.py
from collections import OrderedDict from rest_framework.fields import Field from ..models import SourceImageIOError from ..utils import to_svg_safe_spec class ImageRenditionField(Field): """ A field that generates a rendition with the specified filter spec, and serialises details of that rendition. ...
60
1,757
astropy
astropy/table/tests/test_serialize.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Tests for functions in astropy.table.serialize""" import numpy as np import pytest from astropy.table import QTable, Table from astropy.table.serialize import represent_nd_columns_as_1d_columns from astropy.time import Time class TestRepresentNdColu...
138
5,605
openvino
tests/layer_tests/onnx_tests/test_hard_sigmoid.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest pytest.importorskip("openvino.tools.mo", reason="Ticket - 157136") from common.layer_test_class import check_ir_version from common.onnx_layer_test_class import OnnxRuntimeLayerTest, onnx_make_model fro...
242
9,033
pyomo
pyomo/solvers/plugins/converter/glpsol.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
120
4,626
saleor
saleor/webhook/transport/tests/test_list_stored_payment_methods.py
.py
import copy from unittest.mock import patch import pytest from ....payment.interface import ( PaymentGateway, PaymentGatewayInitializeTokenizationResult, PaymentMethodCreditCardInfo, PaymentMethodData, PaymentMethodTokenizationResult, StoredPaymentMethodRequestDeleteResult, ) from ...response_...
441
14,237
gunicorn
tests/requests/valid/019.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. request = { "method": "GET", "uri": uri("/first"), "version": (1, 0), "headers": [], "body": b"" }
12
225
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/values_test.py
.py
# coding=utf-8 # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License");...
52
1,462
httpie
httpie/manager/tasks/plugins.py
.py
import argparse import os import textwrap import re import shutil from collections import defaultdict from contextlib import suppress from pathlib import Path from typing import List, Optional, Tuple from httpie.manager.compat import PipError, run_pip from httpie.manager.cli import parser, missing_subcommand from http...
249
8,526
probability
tensorflow_probability/python/bijectors/pad_test.py
.py
# Copyright 2019 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
152
5,809
metrics
src/torchmetrics/retrieval/auroc.py
.py
# Copyright The Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
165
7,001
coveragepy
doc/cog_helpers.py
.py
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/coveragepy/coveragepy/blob/main/NOTICE.txt """ Functions for use with cog in the documentation. """ # For help text in doc/cmd.rst: # optparse wraps help to the COLUMNS value. Set it here to be sure it's...
107
3,150
black
src/blackd/client.py
.py
import aiohttp from aiohttp.typedefs import StrOrURL import black _DEFAULT_HEADERS = {"Content-Type": "text/plain; charset=utf-8"} class BlackDClient: def __init__( self, url: StrOrURL = "http://localhost:9090", line_length: int | None = None, skip_source_first_line: bool = False...
93
3,986
beam
sdks/python/apache_beam/examples/inference/anomaly_detection/write_data_to_pubsub_pipeline/config.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
25
990
mlflow
mlflow/entities/model_registry/__init__.py
.py
from mlflow.entities.model_registry.model_version import ModelVersion from mlflow.entities.model_registry.model_version_deployment_job_state import ( ModelVersionDeploymentJobState, ) from mlflow.entities.model_registry.model_version_search import ModelVersionSearch from mlflow.entities.model_registry.model_version...
31
1,284
pynacl
src/nacl/pwhash/__init__.py
.py
# Copyright 2017 Donald Stufft and individual contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
74
2,586
coremltools
coremltools/models/neural_network/optimization_utils.py
.py
# Copyright (c) 2017, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause """ Neural Network optimization utilities. """ import numpy as _np from coremltools import _logger de...
280
9,167
sphinx
sphinx/builders/latex/util.py
.py
"""Utilities for LaTeX builder.""" from __future__ import annotations from docutils.writers.latex2e import Babel class ExtBabel(Babel): cyrillic_languages = ('bulgarian', 'kazakh', 'mongolian', 'russian', 'ukrainian') def __init__(self, language_code: str, use_polyglossia: bool = False) -> None: se...
49
1,703
sphinx
tests/test_roles.py
.py
"""Test sphinx.roles""" from __future__ import annotations from unittest.mock import Mock import pytest from docutils import nodes from sphinx.roles import EmphasizedLiteral, _format_rfc_target from sphinx.testing.util import assert_node def test_samp() -> None: emph_literal_role = EmphasizedLiteral() # ...
140
3,751
pyro
pyro/contrib/forecast/__init__.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 from .evaluate import backtest, eval_crps, eval_mae, eval_rmse from .forecaster import Forecaster, ForecastingModel, HMCForecaster __all__ = [ "Forecaster", "ForecastingModel", "HMCForecaster", "backtest", "eval_cr...
16
360
probability
tensorflow_probability/python/distributions/blockwise_test.py
.py
# Copyright 2018 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
508
18,947
openvino
tests/e2e_tests/common/postprocessors/ctc.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """CTC output postprocessor""" import string import numpy as np from tensorflow.keras import backend as k from .provider import ClassProvider class ParseCTCOutput(ClassProvider): """Transforms CTC output to dictionary {"predictio...
60
2,251
pyomo
pyomo/core/expr/cnf_walker.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
142
5,736
confluent-kafka-python
tests/test_oauth_cb.py
.py
#!/usr/bin/env python # # Copyright 2026 Confluent Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
261
7,619
pyomo
pyomo/contrib/doe/tests/test_doe_initialization.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
164
6,951
onnxruntime
orttraining/orttraining/test/python/orttraining_test_ortmodule_poc.py
.py
import argparse import logging import time import torch from torchvision import datasets, transforms import onnxruntime from onnxruntime.training.ortmodule import DebugOptions, ORTModule class NeuralNet(torch.nn.Module): def __init__(self, input_size, hidden_size, num_classes): super().__init__() ...
237
8,888
textual
docs/examples/how-to/center02.py
.py
from textual.app import App, ComposeResult from textual.widgets import Static class CenterApp(App): """How to center things.""" CSS = """ Screen { align: center middle; } #hello { background: blue 50%; border: wide white; } """ def compose(self) -> ComposeRes...
26
440
hatch
src/hatch/utils/env.py
.py
from __future__ import annotations from ast import literal_eval from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from hatch.utils.platform import Platform class PythonInfo: def __init__(self, platform: Platform, executable: str = "python") -> None: self.platform = platform self.execut...
80
2,445
openvino
docs/articles_en/assets/snippets/gpu/dynamic_batch.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import openvino as ov from snippets import get_model def main(): model = get_model() core = ov.Core() if "GPU" not in core.available_devices: return 0 #! [dynamic_batch] core = ov.Core() C = 3 ...
40
921
mlflow
mlflow/pyfunc/utils/serving_data_parser.py
.py
from typing import Any # Support unwrapped JSON with these keys for LLM use cases of Chat, Completions, Embeddings tasks LLM_CHAT_KEY = "messages" LLM_COMPLETIONS_KEY = "prompt" LLM_EMBEDDINGS_KEY = "input" SUPPORTED_LLM_FORMATS = {LLM_CHAT_KEY, LLM_COMPLETIONS_KEY, LLM_EMBEDDINGS_KEY} def is_unified_llm_input(json_...
12
407
mlflow
mlflow/entities/run_outputs.py
.py
from typing import Any from mlflow.entities._mlflow_object import _MlflowObject from mlflow.entities.logged_model_output import LoggedModelOutput from mlflow.protos.service_pb2 import RunOutputs as ProtoRunOutputs class RunOutputs(_MlflowObject): """RunOutputs object.""" def __init__(self, model_outputs: li...
44
1,316
wagtail
wagtail/contrib/routable_page/templatetags/wagtailroutablepage_tags.py
.py
from django import template from wagtail.models import Site register = template.Library() @register.simple_tag(takes_context=True) def routablepageurl(context, page, url_name, *args, **kwargs): """ ``routablepageurl`` is similar to ``pageurl``, but works with pages using ``RoutablePageMixin``. It behave...
43
1,467
mlflow
mlflow/tracking/request_auth/registry.py
.py
import warnings from mlflow.tracking.request_auth.kubernetes_request_auth_provider import ( KubernetesNamespacedRequestAuthProvider, KubernetesRequestAuthProvider, ) from mlflow.utils.plugins import get_entry_points REQUEST_AUTH_PROVIDER_ENTRYPOINT = "mlflow.request_auth_provider" class RequestAuthProviderR...
67
2,281
textual
docs/examples/app/event01.py
.py
from textual.app import App from textual import events class EventApp(App): COLORS = [ "white", "maroon", "red", "purple", "fuchsia", "olive", "yellow", "navy", "teal", "aqua", ] def on_mount(self) -> None: self.scre...
31
574
readthedocs.org
readthedocs/payments/tests/utils.py
.py
from djstripe.models import APIKey from djstripe.enums import APIKeyType from djstripe.models import Account class PaymentMixin: def setUp(self): super().setUp() Account.objects.create( id="acct_1032D82eZvKYlo2C", charges_enabled=True, country="US", ...
21
648
hypercorn
src/hypercorn/trio/run.py
.py
from __future__ import annotations import sys from collections.abc import Awaitable, Callable from functools import partial from multiprocessing.synchronize import Event as EventType from random import randint import trio from .lifespan import Lifespan from .statsd import StatsdLogger from .tcp_server import TCPServ...
139
5,415
mlflow
mlflow/legacy_databricks_cli/configure/provider.py
.py
# This module is copied from legacy databricks CLI python library # module `databricks_cli.configure.provider`, # but with some modification to make `EnvironmentVariableConfigProvider` supporting # 'DATABRICKS_CLIENT_ID' and 'DATABRICKS_CLIENT_SECRET' environmental variables, # and make ProfileConfigProvider supporting...
480
16,881
textual
tests/snapshot_tests/snapshot_apps/vertical_min_height.py
.py
from textual.app import App, ComposeResult from textual.containers import Vertical from textual.widgets import Placeholder class VerticalApp(App): CSS = """ #top { min-height: 10; height: 1fr; border: white; } #bottom { height:3fr; border: white; } ...
27
529
mlflow
tests/langgraph/sample_code/langgraph_diy.py
.py
# Sample code that contains custom python nodes from typing import Annotated, Sequence, TypedDict from langchain_core.messages import BaseMessage from langchain_openai import ChatOpenAI from langgraph.graph import END, START, StateGraph from langgraph.graph.message import add_messages import mlflow def generate(sta...
47
1,104