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
probability
tensorflow_probability/python/distributions/normal_inverse_gaussian.py
.py
# Copyright 2020 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...
317
12,119
beam
sdks/python/apache_beam/ml/anomaly/aggregations_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...
160
5,271
probability
tensorflow_probability/python/distributions/student_t_process_regression_model_test.py
.py
# Copyright 2021 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...
549
22,939
mlflow
mlflow/openai/autolog.py
.py
import json import logging from typing import Any, AsyncIterator, Iterator import mlflow from mlflow.entities import SpanType from mlflow.entities.span import LiveSpan from mlflow.entities.span_event import SpanEvent from mlflow.entities.span_status import SpanStatusCode from mlflow.exceptions import MlflowException f...
550
21,030
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/norm_inf_canon.py
.py
from cvxpy.atoms.max import max from cvxpy.reductions.eliminate_pwl.canonicalizers.max_canon import max_canon def norm_inf_canon(expr, args): assert len(args) == 1 tmp = max(args[0], expr.axis, expr.keepdims) return max_canon(tmp, tmp.args)
9
255
scikit-bio
skbio/stats/distance/__init__.py
.py
r"""Distance matrix-based statistics (:mod:`skbio.stats.distance`) ============================================================== .. currentmodule:: skbio.stats.distance This module provides functionality for storing, manipulating, and analyzing pairwise relationships, especially distances, between biological objects...
214
5,319
gunicorn
examples/frameworks/webpyapp.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. # Run with # # $ gunicorn webpyapp:app # import web urls = ( '/', 'index' ) class index: def GET(self): return "Hello, world!" app = web.application(urls, globals()).wsgifunc()
21
303
pdm
tests/cli/test_outdated.py
.py
import json from unittest import mock import pytest from rich.box import ASCII @mock.patch("pdm.termui.ROUNDED", ASCII) @pytest.mark.usefixtures("working_set") def test_outdated(project, pdm, index): pdm(["add", "requests"], obj=project, strict=True, cleanup=False) project.project_config["pypi.url"] = "https...
48
1,400
wagtail
wagtail/api/querysets.py
.py
import swapper from django.conf import settings from wagtail.api.validators import SiteFilterValidator from wagtail.models import PageViewRestriction Page = swapper.load_model("wagtailcore", "Page") def get_public_pages_queryset(request, model=Page): """ Returns a queryset containing all live, public pages ...
47
1,620
conda
tests/env/support/advanced-pip/argh/argh/__init__.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """ A simple argparse wrapper. """ __version__ = "0.26.2"
8
134
ipython
IPython/utils/terminal.py
.py
""" Utilities for working with terminals. Authors: * Brian E. Granger * Fernando Perez * Alexander Belchenko (e-mail: bialix AT ukr.net) """ from __future__ import annotations # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import os import re import sys import w...
131
3,580
pyfilesystem2
tests/test_doctest.py
.py
# coding: utf-8 """Test doctest contained tests in every file of the module. """ import doctest import importlib import os import pkgutil import tempfile import time import types import unittest import warnings from pprint import pprint try: from unittest import mock except ImportError: import mock import six...
195
6,233
coremltools
coremltools/models/neural_network/utils.py
.py
# Copyright (c) 2021, 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 copy as _copy from coremltools.models.utils import _get_model from .builder import NeuralNetwor...
212
6,852
wandb
wandb/integration/sklearn/plot/__init__.py
.py
"""Create and logs charts introspecting models built with scikit-learn to W&B.""" from .classifier import calibration_curve as plot_calibration_curve from .classifier import class_proportions as plot_class_proportions from .classifier import classifier as plot_classifier from .classifier import confusion_matrix as plo...
36
1,368
qutip
qutip/settings.py
.py
""" This module contains settings for the QuTiP graphics, multiprocessing, and tidyup functionality, etc. """ import os import sys from ctypes import cdll, CDLL import platform from glob import glob from pathlib import Path import numpy as np import scipy __all__ = ['settings'] def _blas_info_pre_1_26(): config ...
362
10,593
saleor
saleor/graphql/page/schema.py
.py
import graphene from ...core.search import prefix_search from ..channel.dataloaders.by_self import ChannelBySlugLoader from ..core import ResolveInfo from ..core.connection import create_connection_slice, filter_connection_queryset from ..core.context import ChannelContext, ChannelQsContext from ..core.descriptions im...
172
6,431
mlflow
mlflow/gateway/utils.py
.py
import base64 import functools import json import logging import posixpath import re from typing import Any, AsyncGenerator, Iterator from urllib.parse import urlparse from fastapi import HTTPException from mlflow.environment_variables import MLFLOW_GATEWAY_URI from mlflow.exceptions import MlflowException from mlflo...
449
14,745
astropy
astropy/table/jsviewer.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from pathlib import Path from warnings import warn import astropy.config as _config import astropy.io.registry as io_registry from astropy import extern from .table import Table class Conf(_config.ConfigNamespace): """ Configuration parameters...
250
7,508
black
tests/data/cases/ignore_pyi.py
.py
# flags: --pyi def f(): # type: ignore ... class x: # some comment ... class y: ... # comment # whitespace doesn't matter (note the next line has a trailing space and tab) class z: ... def g(): # hi ... def h(): ... # bye # output def f(): # type: ignore ... class...
43
520
readthedocs.org
readthedocs/profiles/urls/private.py
.py
"""URL patterns for views to modify user profiles.""" from django.urls import path from readthedocs.profiles import views # Split URLs into different lists to be able to selectively import them from a # another application (like Read the Docs Corporate), where we may don't need to # define Token URLs, for example. ...
77
1,745
mlflow
mlflow/store/tracking/__init__.py
.py
""" An MLflow tracking server has two properties related to how data is stored: *backend store* to record ML experiments, runs, parameters, metrics, etc., and *artifact store* to store run artifacts like models, plots, images, etc. Several constants are used by multiple backend store implementations. """ # Path to de...
31
1,521
pyomo
pyomo/devel/initialization/initialize.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...
318
11,234
openvino
src/bindings/python/scripts/generate_pyapi_stubs.py
.py
import re import subprocess #nosec B404 from pathlib import Path import sys # Constants INVALID_EXPRESSIONS = [ "ov::Node", # In openvino._pyopenvino.Input.get_node : Invalid expression 'ov::Node' "ov::Input<ov::Node>", # In openvino._pyopenvino.Output.get_tar...
119
6,431
sphinx
sphinx/util/images.py
.py
"""Image utility functions for Sphinx.""" from __future__ import annotations import base64 from pathlib import Path from typing import TYPE_CHECKING, NamedTuple, overload from urllib.parse import unquote_to_bytes import imagesize if TYPE_CHECKING: from os import PathLike try: from PIL import Image PIL...
160
4,106
saleor
saleor/graphql/warehouse/tests/queries/test_warehouse.py
.py
import graphene from ....core.utils import from_global_id_or_error from ....tests.utils import ( assert_no_permission, get_graphql_content, get_graphql_content_from_response, ) QUERY_WAREHOUSE = """ query warehouse($id: ID!){ warehouse(id: $id) { id name companyName ema...
296
8,669
probability
tensorflow_probability/python/experimental/util/composite_tensor.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...
26
880
wandb
tools/inspect_tool.py
.py
# /// script # requires-python = ">=3.8" # dependencies = [ # "fire", # "wandb", # ] # /// import fire import wandb from wandb.proto import wandb_internal_pb2 from wandb.sdk.internal import datastore def inspect_wandb_transaction_log(wandb_file: str, pause: bool = False) -> None: """Inspect a wandb transacti...
65
1,873
mlflow
tests/utils/test_jsonpath_utils.py
.py
import pytest from mlflow.utils.jsonpath_utils import ( filter_json_by_fields, jsonpath_extract_values, split_path_respecting_backticks, validate_field_paths, ) def test_jsonpath_extract_values_simple(): data = {"info": {"trace_id": "tr-123", "state": "OK"}} values = jsonpath_extract_values(d...
251
9,111
pyomo
pyomo/neos/tests/model_min_lp.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...
26
897
ipython
tests/test_doctb.py
.py
"""Tests for IPython.core.doctb (doc-oriented traceback formatter).""" import io import sys import pytest import stack_data from IPython.core.doctb import DocTB, _format_traceback_lines from IPython.utils.PyColorize import theme_table def _divide(): x = 1 y = 0 return x / y def _call_divide(): re...
320
10,015
sphinx
tests/roots/test-ext-autosummary-module_all/conf.py
.py
import sys from pathlib import Path sys.path.insert(0, str(Path.cwd().resolve())) extensions = ['sphinx.ext.autosummary'] autosummary_generate = True autosummary_ignore_module_all = False
9
190
saleor
saleor/graphql/order/tests/queries/test_order_shipping_method.py
.py
import pytest from measurement.measures import Weight from ....tests.utils import get_graphql_content ORDERS_QUERY_SHIPPING_METHODS = """ query OrdersQuery { orders(first: 1) { edges { node { shippingMethods { name ...
161
5,447
metrics
examples/text/perplexity.py
.py
""" Perplexity =============================== Perplexity is a measure of how well a probabilistic model predicts a sample. In the context of language modeling, perplexity equals the exponential of the cross-entropy loss. A lower perplexity score indicates that the model is more certain about its predictions. Since P...
71
2,932
probability
tensorflow_probability/python/mcmc/internal/slice_sampler_utils.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...
434
21,687
textual
src/textual/system_commands.py
.py
""" This module contains `SystemCommands`, a command palette command provider for Textual system commands. This is a simple command provider that makes the most obvious application actions available via the [command palette][textual.command.CommandPalette]. !!! note The App base class installs this automaticall...
65
2,041
biopython
Tests/test_ExPASy_offline.py
.py
# Copyright 2025 by Timothy Dennis. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Testing Bio.ExPASy offline code.""" import io import unittest from Bio.ExPASy import ScanP...
23
704
saleor
saleor/graphql/invoice/mutations/__init__.py
.py
from .invoice_create import InvoiceCreate from .invoice_delete import InvoiceDelete from .invoice_request import InvoiceRequest from .invoice_request_delete import InvoiceRequestDelete from .invoice_send_notification import InvoiceSendNotification from .invoice_update import InvoiceUpdate __all__ = [ "InvoiceCreat...
16
449
mlflow
mlflow/assistant/providers/prompts.py
.py
"""Shared system prompt for MLflow assistant providers.""" ASSISTANT_SYSTEM_PROMPT = """\ You are an MLflow assistant helping users with their MLflow projects. Users interact with you through the MLflow UI. You can answer questions about MLflow, read and analyze data from MLflow, integrate MLflow with a codebase, run ...
344
14,632
python-prompt-toolkit
tests/test_yank_nth_arg.py
.py
from __future__ import annotations import pytest from prompt_toolkit.buffer import Buffer from prompt_toolkit.history import InMemoryHistory @pytest.fixture def _history(): "Prefilled history." history = InMemoryHistory() history.append_string("alpha beta gamma delta") history.append_string("one two...
87
2,079
mlflow
tests/server/test_init.py
.py
import signal import socket import subprocess import sys import time from unittest import mock import pytest from mlflow import server from mlflow.environment_variables import _MLFLOW_SGI_NAME from mlflow.exceptions import MlflowException from mlflow.utils import find_free_port from mlflow.utils.os import is_windows ...
322
9,115
pyro
profiler/profiling_utils.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import cProfile import functools import os import pstats import timeit from contextlib import contextmanager from io import StringIO from prettytable import ALL, PrettyTable FILE = os.path.abspath(__file__) PROF_DIR = os.path.joi...
125
4,006
probability
spinoffs/inference_gym/inference_gym/internal/datasets/convection_lorenz_bridge.py
.py
# Copyright 2020 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...
74
2,611
biopython
Tests/requires_internet.py
.py
# Copyright 2002 by Jeffrey Chang. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. # This module attempts to detect whether the internet is available. # To use it, import requir...
35
1,212
onnxruntime
orttraining/orttraining/python/training/api/lr_scheduler.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from onnxruntime.capi import _pybind_state as C from onnxruntime.training.api.optimizer import Optimizer class LinearLRScheduler: """Linearly updates the learning rate in the optimizer The linear learning rate sche...
32
1,367
jupytext
tests/data/notebooks/outputs/ipynb_to_marimo/sample_rise_notebook_66.py
.py
import marimo __generated_with = "0.17.8" app = marimo.App() @app.cell(hide_code=True) def _(mo): mo.md(r""" A markdown cell """) return @app.cell def _(): 1+1 return @app.cell(hide_code=True) def _(mo): mo.md(r""" Markdown cell two """) return @app.cell def _(): imp...
37
397
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_cos.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # tanh paddle model generator # import numpy as np from save_model import saveModel import paddle import sys data_type = 'float32' def cos(name:str, x): paddle.enable_static() with paddle.static.program_guard(paddle.static.P...
41
1,050
saleor
saleor/tests/e2e/gift_cards/utils/gift_card_query.py
.py
from ...utils import get_graphql_content GIFT_CARD_QUERY = """ query GiftCard($id: ID!) { giftCard(id: $id) { id code initialBalance { amount currency } currentBalance { amount currency } } } """ def get_gift_card( staff_api_client, gift_card_id, ): var...
35
545
wagtail
wagtail/admin/tests/pages/test_view_draft.py
.py
from django.contrib.auth import get_user_model from django.contrib.auth.models import Group, Permission from django.test import TestCase from django.urls import reverse from wagtail.test.testapp.models import MultiPreviewModesPage, SimplePage, StreamPage from wagtail.test.utils import Page, WagtailTestUtils class Te...
145
5,370
metrics
src/torchmetrics/classification/matthews_corrcoef.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...
417
17,086
pyomo
pyomo/contrib/alternative_solutions/tests/test_aos_utils.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...
299
11,491
mlflow
tests/genai/scorers/trulens/scorers/test_agent_trace.py
.py
from unittest.mock import Mock, patch import pytest import trulens # noqa: F401 import mlflow from mlflow.entities.assessment import Feedback from mlflow.entities.assessment_source import AssessmentSourceType from mlflow.entities.span import SpanType from mlflow.exceptions import MlflowException @pytest.fixture de...
156
5,488
python-prompt-toolkit
tests/test_vt100_output.py
.py
from __future__ import annotations from prompt_toolkit.output.vt100 import _256_colors, _get_closest_ansi_color def test_get_closest_ansi_color(): # White assert _get_closest_ansi_color(255, 255, 255) == "ansiwhite" assert _get_closest_ansi_color(250, 250, 250) == "ansiwhite" # Black assert _get...
32
1,120
luigi
luigi/local_target.py
.py
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
191
6,185
kombu
kombu/utils/__init__.py
.py
"""DEPRECATED - Import from modules below.""" from __future__ import annotations from .collections import EqualityDict from .compat import fileno, maybe_fileno, nested, register_after_fork from .div import emergency_dump_state from .functional import (fxrange, fxrangemax, maybe_list, reprcall, reprkwargs, ...
21
710
onnx
onnx/backend/test/case/node/mul.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 Mul(Base): @staticmethod def export() -> None: node = ...
74
2,575
astropy
astropy/io/ascii/docs.py
.py
READ_DOCSTRING = """ Read the input ``table`` and return the table. Most of the default behavior for various parameters is determined by the ``format`` argument. Help on the ``read()`` function arguments is available as shown in this example:: from astropy.io import ascii ascii.read.help() #...
202
8,127
probability
tensorflow_probability/python/sts/components/local_level.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...
349
14,719
django-cms
cms/test_utils/project/pluginapp/plugins/multiwrap/cms_plugins.py
.py
from cms.api import add_plugin from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool from .forms import MultiWrapForm class MultiWrapPlugin(CMSPluginBase): module = "Multi Wraps" name = "Multi Wrap" render_template = 'pluginapp/multiwrap/multiwrap.html' allow_children = Tr...
40
1,095
qutip
qutip/tests/solver/test_results.py
.py
import numpy as np import pytest import qutip from qutip.solver.result import Result from qutip.solver.multitrajresult import MultiTrajResult, McResult, NmmcResult def fill_options(**kwargs): return { "store_states": None, "store_final_state": False, "keep_runs_results": False, **...
765
28,301
pyomo
examples/pyomobook/abstract-ch/abstract7.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...
110
2,541
probability
tensorflow_probability/python/distributions/logistic_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...
218
8,334
openvino
tests/layer_tests/tensorflow_tests/test_tf_Where.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.tf_layer_test_class import CommonTFLayerTest class TestWhere(CommonTFLayerTest): def _prepare_input(self, inputs_info): assert 'condition:0' in inputs_inf...
42
1,569
wagtail
wagtail/test/manage.py
.py
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "wagtail.test.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
11
255
pyro
tests/distributions/test_mixture.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import pytest import torch import pyro.distributions as dist from pyro.distributions.util import broadcast_shape from pyro.util import torch_isnan from tests.common import assert_equal @pytest.mark.parametrize("sample_shape", [(...
133
5,242
rq
tests/test_cli.py
.py
import json import logging import os from datetime import datetime, timedelta, timezone from time import sleep from unittest.mock import MagicMock, patch from uuid import uuid4 import pytest from click.testing import CliRunner from redis import Redis from rq import Queue from rq.cli import main from rq.cli.helpers im...
1,053
43,107
cvxpy
cvxpy/atoms/affine/upper_tri.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...
208
6,207
rq
rq/__init__.py
.py
# ruff: noqa: F401 from .job import Callback, Retry, cancel_job, get_current_job, requeue_job from .queue import Queue from .rate_limit import RateLimit from .repeat import Repeat from .version import VERSION from .webhook import Webhook from .worker import SimpleWorker, SpawnWorker, Worker __all__ = [ 'Callback',...
26
531
openvino
tools/ovc/unit_tests/moc_tf_fe/test_models/model_with_if.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import tensorflow.compat.v1 as tf from tensorflow.python.framework import function tf.reset_default_graph() @function.Defun(tf.int32, tf.int32) def then_branch_func(x, y): return x + y @function.Defun(tf.int32, tf.int32) def els...
33
960
wagtail
wagtail/images/admin_urls.py
.py
from django.urls import path from wagtail.images.views import images, multiple app_name = "wagtailimages" urlpatterns = [ path("", images.IndexView.as_view(), name="index"), path("results/", images.IndexView.as_view(results_only=True), name="index_results"), path("<int:image_id>/", images.EditView.as_view...
42
1,590
coremltools
coremltools/test/optimize/torch/test_utils/test_metadata_utils.py
.py
# Copyright (c) 2024, 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 contextlib import nullcontext as does_not_raise import pytest import torch from coremltools.op...
159
5,373
biopython
Tests/test_BioSQL_sqlite3_online.py
.py
# This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Run BioSQL tests using SQLite.""" import unittest import requires_internet # Really do want "import *" to get all the test classes: from common_B...
39
1,076
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_dropout.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import tensorflow as tf from common.tf2_layer_test_class import CommonTF2LayerTest class TestKerasDropout(CommonTF2LayerTest): def create_keras_dropout_net(self, input_names, input_shapes, input_type, rate, noise_sha...
61
2,705
sqlmap
tamper/commentbeforeparentheses.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import re from lib.core.enums import PRIORITY __priority__ = PRIORITY.NORMAL def dependencies(): pass def tamper(payload, **kwargs): """ Prepends (inline) comment ...
43
828
textual
tests/renderables/test_underline_bar.py
.py
from unittest.mock import create_autospec from rich.console import Console, ConsoleOptions from rich.text import Text from tests.utilities.render import render from textual.renderables.bar import Bar MAGENTA = "\x1b[35m" GREY = "\x1b[38;5;59m" STOP = "\x1b[0m" GREEN = "\x1b[32m" RED = "\x1b[31m" def test_no_highli...
128
3,660
beam
sdks/python/apache_beam/io/gcp/tests/utils_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...
265
9,842
openvino
src/bindings/python/src/openvino/passes/__init__.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # type: ignore # flake8: noqa from openvino._pyopenvino.passes import ModelPass, Matcher, MatcherPass, PassBase, WrapType, Or, AnyInput, Optional, Predicate from openvino._pyopenvino.passes import ( consumers_count, has_static_di...
22
740
luigi
test/clone_test.py
.py
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
87
2,277
textual
docs/examples/guide/widgets/hello04.py
.py
from itertools import cycle from textual.app import App, ComposeResult from textual.widgets import Static hellos = cycle( [ "Hola", "Bonjour", "Guten tag", "Salve", "Nǐn hǎo", "Olá", "Asalaam alaikum", "Konnichiwa", "Anyoung haseyo", ...
59
1,092
astropy
astropy/units/imperial.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Colloquially used Imperial units. These units are available in the `astropy.units.imperial` namespace, but not in the top-level `astropy.units` namespace, e.g.:: >>> import astropy.units as u >>> mph = u.imperial.mile / u.hour >>> mph ...
178
5,365
coremltools
coremltools/proto/FeatureVectorizer_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: FeatureVectorizer.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _message...
47
2,108
saleor
saleor/graphql/account/tests/mutations/customer_type/test_customer_type_create.py
.py
from unittest.mock import patch from ......account.error_codes import CustomerTypeCreateErrorCode from ......account.models import CustomerType from .....tests.utils import assert_no_permission, get_graphql_content CUSTOMER_TYPE_CREATE_MUTATION = """ mutation CustomerTypeCreate($input: CustomerTypeCreateInput!) {...
222
7,256
sqlmap
plugins/dbms/cubrid/connector.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ try: import CUBRIDdb except: pass import logging from lib.core.common import getSafeExString from lib.core.data import conf from lib.core.data import logger from lib.cor...
62
2,009
clearml
examples/reporting/scatter_hist_confusion_mat_reporting.py
.py
# ClearML - Example of manual graphs and statistics reporting # import numpy as np from clearml import Task, Logger def report_plots(logger, iteration=0): # type: (Logger, int) -> () """ reporting plots to plots section :param logger: The task.logger to use for sending the plots :param iteration...
135
3,542
gunicorn
tests/requests/invalid/013.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. from gunicorn.config import Config from gunicorn.http.errors import LimitRequestHeaders request = LimitRequestHeaders cfg = Config() cfg.set('limit_request_field_size', 14) # once this option is removed, this tes...
15
442
saleor
saleor/plugins/tests/sample_plugins.py
.py
from collections import defaultdict from decimal import Decimal from typing import TYPE_CHECKING, Any, Optional, Union from django.http import HttpResponse, HttpResponseNotFound, JsonResponse from prices import Money, TaxedMoney from ...account.models import User from ...core.taxes import TaxType from ...graphql.core...
474
14,839
jupyterlab
jupyterlab/galata/__init__.py
.py
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import getpass import os from pathlib import Path from tempfile import NamedTemporaryFile, mkdtemp from traitlets.config import Config def configure_jupyter_server(c: Config): """Helper to configure the Jupyter ...
50
1,764
beam
sdks/python/apache_beam/examples/wordcount_minimal.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...
149
5,466
pyomo
pyomo/contrib/iis/mis.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...
418
17,684
saleor
saleor/tests/e2e/orders/utils/order_line_delete.py
.py
from saleor.graphql.tests.utils import get_graphql_content ORDER_LINE_DELETE_MUTATION = """ mutation orderLineDelete($lineId: ID!) { orderLineDelete(id: $lineId) { order { id shippingMethods { id price { amount } } total { ...BaseTaxedMoney ...
85
1,413
openvino
src/bindings/python/tests/test_runtime/test_ovdict.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset13 as ops from openvino import Core, CompiledModel, InferRequest, Model from openvino import ConstOutput from openvino.utils.data_helpers import OVDict def ...
259
7,911
mlflow
tests/openai/test_openai_evaluate.py
.py
from unittest import mock import openai import pandas as pd import pytest import mlflow from mlflow.models.evaluation import evaluate from mlflow.tracing.constant import TraceMetadataKey from tests.tracing.helper import get_traces, purge_traces, reset_autolog_state # noqa: F401 _EVAL_DATA = pd.DataFrame({ "inp...
138
3,999
hatch
tests/python/test_core.py
.py
import json import pytest from hatch.config.constants import PythonEnvVars from hatch.python.core import InstalledDistribution, PythonManager from hatch.python.distributions import ORDERED_DISTRIBUTIONS from hatch.python.resolve import custom_env_var, get_distribution from hatch.utils.structures import EnvVars @pyt...
121
4,383
wagtail
wagtail/images/tests/test_api_fields.py
.py
from django.test import TestCase from wagtail.images.api.fields import ImageRenditionField from .utils import Image, get_test_image_file class TestImageRenditionField(TestCase): def setUp(self): self.image = Image.objects.create( title="Test image", file=get_test_image_file(), ...
26
971
mlflow
mlflow/webhooks/delivery.py
.py
"""Webhook delivery implementation following Standard Webhooks conventions. This module implements webhook delivery patterns similar to the Standard Webhooks specification (https://www.standardwebhooks.com), providing consistent and secure webhook delivery with HMAC signature verification and timestamp-based replay pr...
357
11,847
astropy
astropy/io/ascii/fixedwidth.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """An extensible ASCII table reader and writer. fixedwidth.py: Read or write a table with fixed width columns. :Copyright: Smithsonian Astrophysical Observatory (2011) :Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu) """ from . import basic, core...
486
17,292
cvxpy
cvxpy/lin_ops/backends/coo_backend.py
.py
""" Copyright 2025, the CVXPY 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 or agreed to in writing, sof...
2,594
102,128
textual
docs/examples/events/on_decorator01.py
.py
from textual.app import App, ComposeResult from textual.widgets import Button class OnDecoratorApp(App): CSS_PATH = "on_decorator.tcss" def compose(self) -> ComposeResult: """Three buttons.""" yield Button("Bell", id="bell") yield Button("Toggle dark", classes="toggle dark") y...
29
849
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_embedding.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # paddle model generator # for lookup_table_v2 # https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nn/Embedding_cn.html#embedding # equal to "gather" # import numpy as np import sys import paddle from save_model import ...
189
7,025
mlflow
tests/genai/utils/test_llm_utils.py
.py
from unittest import mock import pydantic import pytest from mlflow.genai.utils.gateway_utils import GatewayLiteLLMConfig from mlflow.genai.utils.llm_utils import ( _call_llm, _call_llm_via_gateway, _fetch_model_cost, _lookup_model_cost, _ModelCost, _resolve_model_for_gateway, _TokenCounte...
473
16,764
pymc
pymc/sampling/jax.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...
749
26,144