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/graphql/discount/tests/mutations/test_voucher_create.py
.py
import datetime import json from unittest.mock import call, patch import graphene from django.utils import timezone from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....core.utils.json_serializer import CustomJsonEncoder from .....discount import DiscountValueType, VoucherT...
526
17,409
saleor
saleor/webhook/transport/__init__.py
.py
import hashlib import hmac from ...core.jwt_manager import get_jwt_manager def signature_for_payload(body: bytes, secret_key: str | None): if not secret_key: return get_jwt_manager().jws_encode(body) hash = hmac.new(bytes(secret_key, "utf-8"), body, hashlib.sha256) return hash.hexdigest()
12
313
mlflow
mlflow/models/__init__.py
.py
""" The ``mlflow.models`` module provides an API for saving machine learning models in "flavors" that can be understood by different downstream tools. The built-in flavors are: - :py:mod:`mlflow.catboost` - :py:mod:`mlflow.dspy` - :py:mod:`mlflow.h2o` - :py:mod:`mlflow.langchain` - :py:mod:`mlflow.lightgbm` - :py:mod...
97
2,702
black
scripts/release_tests.py
.py
#!/usr/bin/env python3 import unittest from pathlib import Path from shutil import rmtree from tempfile import TemporaryDirectory from typing import Any from unittest.mock import Mock, patch from release import SourceFiles, tuple_calver # type: ignore class FakeDateTime: """Used to mock the date to test genera...
70
2,333
wagtail
wagtail/test/snippets/forms.py
.py
from wagtail.admin.forms import WagtailAdminModelForm class FancySnippetForm(WagtailAdminModelForm): """ A custom form class for FancySnippets in the admin """
8
174
beam
sdks/python/apache_beam/internal/test_data/module_1_global_variable_added.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...
30
1,069
beam
sdks/python/apache_beam/io/external/xlang_debeziumio_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...
145
4,910
attrs
tests/test_converters.py
.py
# SPDX-License-Identifier: MIT """ Tests for `attr.converters`. """ import pickle import pytest import attr from attr import Converter, Factory, attrib from attr._compat import _AnnotationExtractor from attr.converters import default_if_none, optional, pipe, to_bool class TestConverter: @pytest.mark.parametr...
367
9,093
wandb
wandb/sdk/wandb_login.py
.py
"""Log in to Weights & Biases. This authenticates your machine to log data to your account. """ from __future__ import annotations import click import wandb from wandb import env from wandb.apis.public.service_api import ServiceApi from wandb.errors import AuthenticationError, term from wandb.sdk import wandb_setup...
372
11,423
saleor
saleor/graphql/account/tests/queries/test_customer_type_attributes.py
.py
import graphene from ....tests.utils import assert_no_permission, get_graphql_content CUSTOMER_TYPE_ATTRIBUTES_QUERY = """ query CustomerType($id: ID!) { customerType(id: $id) { id attributes { slug } } } """ CUSTOMER_TYPE_AVAILABLE_ATTRIBUT...
239
7,246
cvxpy
cvxpy/atoms/sigma_max.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...
90
2,565
pyomo
pyomo/repn/tests/ampl/small6_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...
42
1,980
jupytext
src/jupytext/async_contentsmanager.py
.py
""" This module exposes the AsyncTextFileContentsManager that allows to open text files as notebooks """ import inspect import itertools import os try: import tomllib except ImportError: import tomli as tomllib from collections import namedtuple from datetime import timedelta import nbformat from tornado.we...
688
29,510
coremltools
deps/protobuf/python/google/protobuf/internal/message_factory_test.py
.py
# Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. All rights reserved. # https://developers.google.com/protocol-buffers/ # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redi...
236
10,237
mlflow
mlflow/data/spark_delta_utils.py
.py
import logging import os from mlflow.utils.string_utils import _backtick_quote _logger = logging.getLogger(__name__) def _is_delta_table(table_name: str) -> bool: """Checks if a Delta table exists with the specified table name. Returns: True if a Delta table exists with the specified table name. Fa...
118
3,987
gunicorn
tests/requests/valid/rfc9112_smuggle_gzip_chunked_01.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. # RFC 9112 section 6.1: Transfer-Encoding codings stack left-to-right; # chunked must be the final coding. gzip before chunked is valid. request = { "method": "POST", "uri": uri("/upload"), "version": (...
17
456
voila
tests/app/template_config_file_test.py
.py
# tests config of template system from JSON file import os import pytest BASE_DIR = os.path.dirname(__file__) @pytest.fixture def voila_args_extra(): path_test_template = os.path.abspath( os.path.join( BASE_DIR, "../test_template/share/jupyter/voila/templates/test_template/nbconv...
37
1,075
mlflow
examples/pytorch/mnist_tensorboard_artifact.py
.py
# # Trains an MNIST digit recognizer using PyTorch, and uses tensorboardX to log training metrics # and weights in TensorBoard event format to the MLflow run's artifact directory. This stores the # TensorBoard events in MLflow for later access using the TensorBoard command line tool. # # NOTE: This example requires you...
253
8,353
saleor
saleor/graphql/giftcard/tests/bulk_mutations/test_gift_card_bulk_deactivate.py
.py
from unittest import mock import graphene from .....giftcard import GiftCardEvents from .....giftcard.models import GiftCard, GiftCardEvent from ....tests.utils import assert_no_permission, get_graphql_content MUTATION_GIFT_CARD_BULK_DEACTIVATE = """ mutation GiftCardBulkDeactivate($ids: [ID!]!) { giftCa...
186
5,009
mlflow
tests/store/artifact/test_presigned_url_artifact_repo.py
.py
import json import os import random import string from unittest import mock from unittest.mock import ANY import pytest import requests from mlflow.environment_variables import MLFLOW_MULTIPART_DOWNLOAD_CHUNK_SIZE from mlflow.exceptions import RestException from mlflow.protos.databricks_artifacts_pb2 import ArtifactC...
364
13,972
saleor
saleor/graphql/tax/tests/mutations/test_tax_exemption_manage.py
.py
import graphene from django.utils import timezone from freezegun import freeze_time from .....order import OrderStatus from .....tax.error_codes import TaxExemptionManageErrorCode from ....tests.utils import get_graphql_content TAX_EXEMPTION_MUTATION = """ mutation manageTaxExemption($id: ID!, $taxExemption: Bool...
141
4,406
onnxruntime
onnxruntime/python/tools/transformers/fusion_attention_clip.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- from logging import getLogger from fusion_attention import AttentionMas...
341
13,756
openvino
tests/layer_tests/pytorch_tests/test_lerp.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from packaging import version from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class TestLerp(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(2, 5, 3, ...
62
2,365
cvxpy
cvxpy/reductions/eval_params.py
.py
from cvxpy import problems from cvxpy.error import ParameterError from cvxpy.expressions.constants.constant import Constant from cvxpy.expressions.constants.parameter import Parameter from cvxpy.reductions.reduction import Reduction def replace_params_with_consts(expr): if isinstance(expr, list): return [...
79
2,689
qutip
qutip/solver/integrator/__init__.py
.py
from .integrator import * from .scipy_integrator import * from .qutip_integrator import * from .krylov import *
5
112
mkdocs
mkdocs/structure/pages.py
.py
from __future__ import annotations import enum import logging import posixpath import warnings from typing import TYPE_CHECKING, Any, Callable, Iterator, MutableMapping, Sequence from urllib.parse import unquote as urlunquote from urllib.parse import urljoin, urlsplit, urlunsplit import markdown import markdown.exten...
570
22,168
wandb
wandb/sdk/lib/service/service_process.py
.py
"""Module for starting up the service process (wandb-core).""" from __future__ import annotations import os import pathlib import platform import subprocess import tempfile from typing import TYPE_CHECKING from wandb.analytics import get_sentry from wandb.env import core_debug, dcgm_profiling_enabled, error_reportin...
171
4,677
pyomo
pyomo/common/__init__.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...
38
1,339
bazel
src/test/py/bazel/bzlmod/test_utils.py
.py
# pylint: disable=invalid-name # pylint: disable=g-long-ternary # Copyright 2021 The Bazel Authors. All rights reserved. # # 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.apac...
496
15,520
lemur
lemur/notifications/messaging.py
.py
""" .. module: lemur.notifications.messaging :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ import sys from collections import defaultdict from datetime import timedelta ...
541
21,780
astropy
astropy/timeseries/io/kepler.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import warnings import numpy as np from astropy.io import fits, registry from astropy.table import MaskedColumn, Table from astropy.time import Time, TimeDelta from astropy.timeseries.sampled import TimeSeries __all__ = ["kepler_fits_reader"] def kepl...
116
3,829
eve
eve/io/mongo/media.py
.py
""" eve.io.mongo.media ~~~~~~~~~~~~~~~~~~ GridFS media storage for Eve-powered APIs. :copyright: (c) 2017 by Nicola Iarocci. :license: BSD, see LICENSE for more details. """ from bson import ObjectId from flask import Flask from gridfs import GridFS from eve.io.media import MediaStorage from eve....
106
3,304
pyomo
pyomo/contrib/benders/tests/test_benders.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...
441
16,862
pyomo
doc/OnlineDocs/src/dataportal/PP_sqlite.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...
37
1,022
wagtail
wagtail/admin/urls/pages.py
.py
from django.urls import path, re_path from wagtail.admin.views.pages import revisions from wagtail.admin.viewsets.pages import page_viewset_registry app_name = "wagtailadmin_pages" urlpatterns = [ path( "add/<slug:content_type_app_name>/<slug:content_type_model_name>/<int:parent_page_id>/", page_v...
281
7,924
biopython
Bio/PDB/DSSP.py
.py
# Copyright (C) 2002, Thomas Hamelryck (thamelry@binf.ku.dk) # # 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. r"""Use the DSSP pro...
573
20,210
textual
docs/examples/widgets/tabbed_content.py
.py
from textual.app import App, ComposeResult from textual.widgets import Footer, Label, Markdown, TabbedContent, TabPane LETO = """ # Duke Leto I Atreides Head of House Atreides. """ JESSICA = """ # Lady Jessica Bene Gesserit and concubine of Leto, and mother of Paul and Alia. """ PAUL = """ # Paul Atreides Son of ...
58
1,467
saleor
saleor/tests/e2e/checkout/zero_total/test_pay_for_total_checkout_with_gift_card.py
.py
import pytest from ...channel.utils import update_channel from ...gift_cards.utils import create_gift_card from ...orders.utils.order_query import order_query from ...product.utils.preparing_product import prepare_products from ...shop.utils.preparing_shop import prepare_default_shop from ...utils import assign_permis...
155
5,190
sqlmap
thirdparty/socks/socks.py
.py
from base64 import b64encode try: from collections.abc import Callable except ImportError: from collections import Callable from errno import EOPNOTSUPP, EINVAL, EAGAIN import functools from io import BytesIO import logging import os from os import SEEK_CUR import socket import struct import sys __version__ = ...
898
33,159
readthedocs.org
readthedocs/proxito/tests/test_middleware.py
.py
# Copied from test_middleware.py import pytest from django.core.exceptions import SuspiciousOperation from django.http import HttpRequest, HttpResponse from django.test import TestCase from django.test.utils import override_settings from django_dynamic_fixture import get from readthedocs.projects.constants import PUB...
270
9,992
pymc
tests/test_util.py
.py
# Copyright 2024 - 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...
293
9,896
saleor
saleor/graphql/translations/tests/mutations/test_promotion_rule_translate.py
.py
import json from unittest.mock import ANY, patch import graphene from freezegun import freeze_time from .....webhook.event_types import WebhookEventAsyncType from .....webhook.transport.asynchronous.transport import WebhookPayloadData from ....tests.utils import assert_no_permission, get_graphql_content PROMOTION_RU...
228
6,437
probability
tensorflow_probability/python/optimizer/sgld_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...
402
17,257
probability
tensorflow_probability/python/bijectors/power_transform_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...
73
2,991
cvxpy
cvxpy/reductions/solvers/qp_solvers/copt_qpif.py
.py
""" This file is the CVXPY QP extension of the Cardinal Optimizer """ import numpy as np import scipy.sparse as sp import cvxpy.settings as s from cvxpy.reductions.solution import Solution, failure_solution from cvxpy.reductions.solvers import utilities from cvxpy.reductions.solvers.qp_solvers.qp_solver import QpSolve...
240
8,172
conda
tests/test_install.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations import os import random import subprocess import sys import tempfile from os import makedirs from os.path import exists, join, relpath from pathlib import Path from typing import TYPE_CHECKING import pytest ...
267
9,113
beam
sdks/python/apache_beam/runners/portability/fn_api_runner/worker_handlers_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...
53
2,055
sqlmap
plugins/dbms/raima/fingerprint.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ from lib.core.common import Backend from lib.core.common import Format from lib.core.data import conf from lib.core.data import kb from lib.core.data import logger from lib.core.e...
94
2,651
pyomo
pyomo/solvers/plugins/solvers/persistent_solver.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...
603
23,703
wagtail
wagtail/test/utils/wagtail_factories/options.py
.py
from factory import declarations from factory.base import FactoryOptions, OptionDefault class BlockFactoryOptions(FactoryOptions): def _build_default_options(self): options = super()._build_default_options() options.append(OptionDefault("block_def", None)) return options def get_meta_...
61
1,911
black
scripts/fuzz.py
.py
"""Property-based tests for Black. By Zac Hatfield-Dodds, based on my Hypothesmith tool for source code generation. You can run this file with `python`, `pytest`, or (soon) a coverage-guided fuzzer I'm working on. """ import hypothesmith from hypothesis import HealthCheck, given, settings from hypothesis import stra...
74
2,714
pyro
examples/baseball.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import argparse import logging import math import pandas as pd import torch import pyro from pyro.distributions import Beta, Binomial, HalfCauchy, Normal, Pareto, Uniform from pyro.distributions.util import scalar_like from pyro....
422
16,321
confluent-kafka-python
tests/integration/schema_registry/data/proto/TestProto_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: tests/integration/schema_registry/data/proto/TestProto.proto """Generated protocol buffer code.""" from google.protobuf.internal import builder as _builder from google.protobuf import descriptor as _descriptor from google.proto...
33
2,002
wandb
tests/system_tests/test_sweep/test_wandb_agent.py
.py
"""Agent tests.""" import os import platform import signal import subprocess import sys import textwrap from pathlib import Path from unittest import mock import pytest from wandb.apis.public.sweeps import Agent as PublicAgent from wandb.sdk.launch.sweeps.utils import ( create_sweep_command, create_sweep_comm...
281
8,026
mlflow
tests/entities/test_trace_status.py
.py
from mlflow.entities.trace_status import TraceStatus from mlflow.protos.service_pb2 import TraceStatus as ProtoTraceStatus def test_trace_status_from_proto(): assert TraceStatus.from_proto(ProtoTraceStatus.OK) == TraceStatus.OK assert isinstance(TraceStatus.from_proto(ProtoTraceStatus.OK), TraceStatus) as...
21
989
textual
tests/snapshot_tests/snapshot_apps/option_list.py
.py
from __future__ import annotations from rich.text import Text from textual.app import App, ComposeResult from textual.containers import Horizontal from textual.widgets import OptionList from textual.widgets.option_list import Option class OptionListApp(App[None]): BINDINGS = [("a", "add", "add")] def comp...
59
1,680
mlflow
mlflow/store/db_migrations/versions/da6fb0208061_add_workspaces_trace_archival_location.py
.py
"""add trace archival workspace columns Revision ID: da6fb0208061 Revises: 7d34483879f0 Create Date: 2026-04-03 10:50:46.501372 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "da6fb0208061" down_revision = "7d34483879f0" branch_labels = None depends_on = None...
47
1,474
mlflow
mlflow/tracking/_workspace/__init__.py
.py
from mlflow.tracking._workspace.client import WorkspaceProviderClient from mlflow.tracking._workspace.registry import ( WorkspaceStoreRegistry, get_workspace_store, ) __all__ = [ "WorkspaceProviderClient", "WorkspaceStoreRegistry", "get_workspace_store", ]
12
278
onnx
onnx/reference/ops_optimized/__init__.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from onnx.reference.ops_optimized.op_conv_optimized import Conv optimized_operators = [Conv] __all__ = ["Conv", "optimized_operators"]
11
255
coremltools
coremltools/test/sklearn_tests/test_one_hot_encoder.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 import unittest from copy import copy import numpy as np from packaging.version import Version from .....
291
10,311
textual
src/textual/widgets/_data_table.py
.py
from __future__ import annotations import functools from dataclasses import dataclass from itertools import chain, zip_longest from operator import itemgetter from typing import ( Any, Callable, ClassVar, Generic, Iterable, NamedTuple, TypeVar, Union, ) import rich.repr from rich.conso...
2,865
108,987
mlflow
mlflow/store/db_migrations/versions/728d730b5ebd_add_registered_model_tags_table.py
.py
"""add registered model tags table Create Date: 2020-06-26 13:30:00.290154 """ import sqlalchemy as sa from alembic import op from mlflow.store.model_registry.dbmodels.models import SqlRegisteredModelTag # revision identifiers, used by Alembic. revision = "728d730b5ebd" down_revision = "0a8213491aaa" branch_labels...
37
894
astropy
astropy/stats/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This subpackage contains statistical tools provided for or used by Astropy. While the `scipy.stats` package contains a wide range of statistical tools, it is a general-purpose package, and is missing some that are particularly useful to astronomy or a...
45
1,199
beam
playground/infrastructure/grpc_client.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 use ...
205
7,275
gunicorn
tests/requests/invalid/chunked_14.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. from gunicorn.http.errors import InvalidChunkExtension request = InvalidChunkExtension
7
193
pyro
tests/distributions/test_lowrank_mvn.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import torch from pyro.distributions import LowRankMultivariateNormal, MultivariateNormal from tests.common import assert_equal def test_scale_tril(): loc = torch.tensor([1.0, 2.0, 1.0, 2.0, 0.0]) D = torch.tensor([1.0, ...
45
1,451
probability
tensorflow_probability/python/experimental/bayesopt/acquisition/max_value_entropy_search_test.py
.py
# Copyright 2023 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...
137
5,639
textual
docs/examples/guide/reactivity/set_reactive02.py
.py
from textual.app import App, ComposeResult from textual.containers import Horizontal from textual.reactive import reactive, var from textual.widgets import Label GREETINGS = [ "Bonjour", "Hola", "こんにちは", "你好", "안녕하세요", "Hello", ] class Greeter(Horizontal): """Display a greeting and a name...
68
1,613
scikit-bio
skbio/util/_random.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
119
4,041
mamba
micromamba/tests/test_virtual_pkgs.py
.py
import os import platform from .helpers import info class TestVirtualPkgs: def test_virtual_packages(self): infos = info() assert "virtual packages :" in infos assert "__archspec=1=" in infos if platform.system() == "Windows": assert "__win" in infos elif plat...
32
976
openvino
src/bindings/python/src/openvino/opset9/__init__.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino.opset1.ops import absolute from openvino.opset1.ops import absolute as abs from openvino.opset1.ops import acos from openvino.opset4.ops import acosh from openvino.opset8.ops import adaptive_avg_pool...
176
7,416
onnxruntime
onnxruntime/test/python/quantization/test_static_quantize_runner.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- import co...
569
26,244
pyomo
pyomo/repn/plugins/lp_writer.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...
633
23,821
coremltools
coremltools/converters/mil/mil/passes/defs/cleanup/dead_code_elimination.py
.py
# Copyright (c) 2023, 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 from coremltools import _logger as logger from coremltools.converters.mil.mil import Program from co...
87
3,198
mlflow
tests/models/test_pyfunc.py
.py
MLFLOW_VERSION = "1.0.0" # we expect this model to be bound to this mlflow version. class PyFuncTestModel: def __init__(self, check_version=True): self._check_version = check_version def predict(self, df): from mlflow.version import VERSION if self._check_version: assert...
19
473
wagtail
wagtail/test/utils/timestamps.py
.py
import datetime from django.utils import timezone def submittable_timestamp(timestamp): """ Helper function to translate a possibly-timezone-aware datetime into the format used in the go_live_at / expire_at form fields - "YYYY-MM-DD hh:mm", with no timezone indicator. This will be interpreted as bein...
23
789
bazel
tools/ctexplain/lib.py
.py
# Copyright 2020 The Bazel Authors. All rights reserved. # # 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 la...
57
2,101
saleor
saleor/graphql/checkout/mutations/checkout_customer_note_update.py
.py
import graphene from ....checkout.actions import call_checkout_event from ....webhook.event_types import WebhookEventAsyncType from ...core import ResolveInfo from ...core.context import SyncWebhookControlContext from ...core.doc_category import DOC_CATEGORY_CHECKOUT from ...core.mutations import BaseMutation from ......
62
2,032
pyomo
pyomo/core/expr/calculus/diff_with_sympy.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...
109
3,838
saleor
saleor/tests/e2e/checkout/test_checkout_complete_not_save_cc_address_in_customer_address_book.py
.py
import pytest from .. import ADDRESS_DE from ..account.utils import get_own_data from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assert_address_data, assign_permissions from ..warehouse.utils import update_warehouse from .ut...
146
4,696
pymc
pymc/step_methods/slicer.py
.py
# Copyright 2024 - 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...
217
7,178
openvino
src/frontends/onnx/tests/tests_python/test_ops_logical.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import onnx import pytest from tests.tests_python.utils import run_node @pytest.mark.parametrize( ("onnx_op", "numpy_func", "data_type"), [ pytest.param("And", np.logical_and,...
46
1,727
jupytext
tests/functional/others/test_jupytext_read.py
.py
import pytest import jupytext from jupytext.compare import compare_notebooks def test_as_version_has_appropriate_type(): with pytest.raises(TypeError): jupytext.read("script.py", "py:percent") def test_read_file_with_explicit_fmt(tmpdir): tmp_py = str(tmpdir.join("notebook.py")) with open(tmp_...
26
510
httpie
httpie/plugins/builtin.py
.py
from base64 import b64encode import requests.auth from .base import AuthPlugin # noinspection PyAbstractClass class BuiltinAuthPlugin(AuthPlugin): package_name = '(builtin)' class HTTPBasicAuth(requests.auth.HTTPBasicAuth): def __call__( self, request: requests.PreparedRequest ) -> re...
80
2,120
kombu
kombu/utils/encoding.py
.py
"""Text encoding utilities. Utilities to encode text, and to safely emit text from running applications without crashing from the infamous :exc:`UnicodeDecodeError` exception. """ from __future__ import annotations import sys import traceback #: safe_str takes encoding from this file by default. #: :func:`set_defau...
98
2,297
saleor
saleor/webhook/tests/conftest.py
.py
from unittest.mock import Mock, patch import pytest @pytest.fixture def mocked_fetch_checkout(): def mocked_fetch_side_effect( checkout_info, manager, lines, address, force_update=False ): return checkout_info, lines with patch( "saleor.checkout.calculations.fetch_checkout_data",...
48
1,197
django-cms
cms/tests/test_apphooks.py
.py
import sys import types import uuid from django.apps import apps from django.contrib.auth import get_user_model from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType from django.contrib.sites.models import Site from django.core import checks from django.core.cache...
1,499
63,922
astropy
astropy/constants/astropyconst20.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Astronomical and physics constants for Astropy v2.0. See :mod:`astropy.constants` for a complete listing of constants defined in Astropy. """ import warnings from astropy.utils import find_current_module from . import codata2014, iau2015 from . impo...
71
2,028
metrics
src/torchmetrics/functional/nominal/cramers.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...
184
7,340
django-cms
cms/tests/test_permissions.py
.py
from unittest.mock import patch from django.contrib.auth.models import Group from django.contrib.sites.models import Site from django.db import OperationalError, ProgrammingError from django.test.utils import override_settings from cms.admin.permissionadmin import GlobalPagePermissionAdmin, PagePermissionInlineAdmin ...
311
13,140
black
tests/data/cases/pattern_matching_long.py
.py
# flags: --minimum-version=3.10 match x: case "abcd" | "abcd" | "abcd" : pass case "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd" | "abcd": pass case xxxxxxxxxxxxxxxxxxxxxxx: pass # output match x: cas...
35
692
pyomo
pyomo/solvers/tests/piecewise_linear/kernel_problems/convex_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...
53
1,677
saleor
saleor/graphql/tax/mutations/tax_class_create.py
.py
from typing import Final import graphene from ....permission.enums import CheckoutPermissions from ....tax import error_codes, models from ...account.enums import CountryCodeEnum from ...core.doc_category import DOC_CATEGORY_TAXES from ...core.mutations import DeprecatedModelMutation from ...core.types import BaseInp...
86
2,719
mlflow
examples/llms/question_answering/question_answering.py
.py
import os import openai import pandas as pd import mlflow assert "OPENAI_API_KEY" in os.environ, ( "Please set the OPENAI_API_KEY environment variable to run this example." ) def build_and_evaluate_model_with_prompt(system_prompt): mlflow.start_run() mlflow.log_param("system_prompt", system_prompt) ...
71
2,486
metrics
src/torchmetrics/functional/nominal/pearson.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...
175
6,875
saleor
saleor/graphql/account/tests/queries/test_customers.py
.py
import pytest from .....account.models import User from .....account.search import update_user_search_vector from .....order.models import Order from ....tests.utils import get_graphql_content QUERY_CUSTOMERS_WITH_PAGINATION = """ query ( $first: Int, $last: Int, $after: String, $before: String, $...
148
4,412
saleor
saleor/graphql/product/mutations/product/product_media_reorder.py
.py
import graphene from django.core.exceptions import ValidationError from .....permission.enums import ProductPermissions from .....product import models from .....product.error_codes import ProductErrorCode from ....core import ResolveInfo from ....core.context import ChannelContext from ....core.doc_category import DO...
83
2,969
sphinx
tests/test_builders/test_build_html_download.py
.py
from __future__ import annotations import hashlib import re from typing import TYPE_CHECKING import pytest if TYPE_CHECKING: from sphinx.testing.util import SphinxTestApp @pytest.mark.sphinx('html', testroot='root') def test_html_download(app: SphinxTestApp) -> None: app.build() # subdir/includes.html...
83
2,982
pyomo
pyomo/contrib/pynumero/examples/external_grey_box/param_est/perform_estimation.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...
125
4,173
saleor
saleor/order/tests/fixtures/benchmark.py
.py
import random from decimal import Decimal import pytest from prices import Money, TaxedMoney from ....account.models import User from ....payment import ChargeStatus from ....payment.models import Payment, Transaction from ... import OrderEvents, OrderStatus from ...models import Fulfillment, FulfillmentLine, Order, ...
173
4,941