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
onnx
onnx/backend/test/case/node/cast.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import itertools import numpy as np import onnx from onnx import TensorProto from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect from onnx.helper import ( m...
399
13,573
probability
spinoffs/inference_gym/inference_gym/targets/ground_truth/eight_schools.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...
84
2,210
beam
sdks/python/apache_beam/examples/streaming_wordcount_debugging.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...
213
7,180
onnxruntime
tools/python/util/test/test_onnx_model_utils.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import pathlib import unittest import onnx from onnx import TensorProto, helper, shape_inference from ..mobile_helpers.usability_checker import check_shapes from ..onnx_model_utils import ( fix_output_shapes, get_pr...
266
11,759
mlflow
tests/agno/test_agno_tracing.py
.py
import sys from unittest.mock import MagicMock, patch import agno import pytest from agno.agent import Agent from agno.exceptions import ModelProviderError from agno.models.anthropic import Claude from agno.tools.function import Function, FunctionCall from anthropic.types import Message, TextBlock, Usage from opentele...
422
15,467
coremltools
coremltools/models/ml_program/compression_utils.py
.py
# Copyright (c) 2022, 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 coremltools.converters.mil.mil import Operation as _Operation from coremltools...
113
4,516
metrics
src/torchmetrics/audio/stoi.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...
160
6,428
saleor
saleor/graphql/account/tests/mutations/account/test_request_email_change.py
.py
import time from unittest.mock import ANY, patch from urllib.parse import urlencode import graphene from django.conf import settings from freezegun import freeze_time from ......account.error_codes import AccountErrorCode from ......account.notifications import get_default_user_payload from ......core.jwt import JWT_...
265
9,139
mkdocs-material
material/plugins/optimize/config.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...
53
2,326
biopython
Bio/Phylo/PhyloXMLIO.py
.py
# Copyright (C) 2009 by Eric Talevich (eric.talevich@gmail.com) # # 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. """PhyloXML reade...
936
32,340
probability
tensorflow_probability/python/bijectors/cumsum_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...
106
4,246
beam
learning/tour-of-beam/learning-content/triggers/composite-trigger/python-example/task.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"); y...
65
2,505
wandb
wandb/integration/tensorflow/__init__.py
.py
"""api.""" from wandb.integration.tensorboard import log from .estimator_hook import WandbHook
6
97
jupyterlab
galata/test/jupyterlab/notebooks/completer_panel.py
.py
def option_1(): """Documentation of 1st option. This docstring is intentionally long to fill the documentation panel box. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur vel auctor felis. Phasellus non risus maximus tortor molestie consectetur. Suspendisse in mauris eget nunc im...
16
580
pymc
pymc/sampling/forward.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...
1,426
59,801
wandb
tests/unit_tests/test_ssl.py
.py
import contextlib import dataclasses import http.server import ssl import threading from collections.abc import Callable, Generator, Mapping from pathlib import Path from unittest.mock import patch import pytest import requests import wandb.apis import wandb.env @dataclasses.dataclass class SSLCredPaths: ca_path...
135
3,587
luigi
examples/execution_summary_example.py
.py
# -*- coding: utf-8 -*- # # Copyright 2015-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...
118
3,319
deap
examples/ga/knapsack.py
.py
# This file is part of DEAP. # # DEAP is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation, either version 3 of # the License, or (at your option) any later version. # # DEAP is distributed ...
111
3,564
astropy
astropy/io/fits/hdu/compressed/tests/test_compression_failures.py
.py
# Licensed under a 3-clause BSD style license - see PYFITS.rst import numpy as np import pytest from astropy.io import fits from astropy.io.fits.hdu.compressed._tiled_compression import compress_image_data from astropy.io.fits.tests.conftest import FitsTestCase MAX_INT = np.iinfo(np.intc).max MAX_LONG = np.iinfo(int...
262
11,086
wagtail
wagtail/test/settings.py
.py
import os from django.contrib.messages import constants as message_constants from django.core.exceptions import ImproperlyConfigured from django.utils.translation import gettext_lazy as _ from wagtail.test.numberformat import patch_number_formats WAGTAIL_CHECK_TEMPLATE_NUMBER_FORMAT = ( os.environ.get("WAGTAIL_C...
315
11,149
astropy
astropy/visualization/wcsaxes/tests/test_utils.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from numpy.testing import assert_almost_equal from astropy import units as u from astropy.coordinates import Angle, Galactic, HADec from astropy.tests.helper import ( assert_quantity_allclose as assert_almost_equal_quantity, ) from astropy.visualiza...
89
4,224
textual
docs/examples/guide/reactivity/recompose02.py
.py
from datetime import datetime from textual.app import App, ComposeResult from textual.reactive import reactive from textual.widgets import Digits class Clock(App): CSS = """ Screen {align: center middle} Digits {width: auto} """ time: reactive[datetime] = reactive(datetime.now, recompose=True) ...
30
613
mlflow
tests/anthropic/test_anthropic_genai_semconv_converter.py
.py
import json from unittest.mock import patch import anthropic import pytest from packaging.version import Version import mlflow from mlflow.anthropic.genai_semconv_converter import _convert_block from mlflow.tracing.constant import GenAiSemconvKey from tests.anthropic.test_anthropic_autolog import ( DUMMY_CREATE_...
177
6,463
wagtail
wagtail/admin/forms/__init__.py
.py
# definitions which are not being deprecated from wagtail.admin.forms from .models import ( # NOQA: F401 DIRECT_FORM_FIELD_OVERRIDES, FORM_FIELD_OVERRIDES, WagtailAdminModelForm, WagtailAdminModelFormMetaclass, formfield_for_dbfield, ) from .pages import WagtailAdminPageForm # NOQA: F401
10
311
openvino
tests/layer_tests/tensorflow_tests/test_tf_Erfc.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 rng = np.random.default_rng(3453466) class TestAddTypes(CommonTFLayerTest): def _prepare_input(self, inputs_info): ...
41
1,480
beam
sdks/python/apache_beam/options/pipeline_options_validator_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...
784
28,939
black
action/main.py
.py
import os import re import shlex import shutil import sys from pathlib import Path from subprocess import PIPE, STDOUT, run ACTION_PATH = Path(os.environ["GITHUB_ACTION_PATH"]) ENV_PATH = ACTION_PATH / ".black-env" ENV_BIN = ENV_PATH / ("Scripts" if sys.platform == "win32" else "bin") OPTIONS = os.getenv("INPUT_OPTION...
202
6,269
pyomo
pyomo/contrib/parmest/examples/reactor_design/datarec_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...
170
4,947
django-cms
cms/test_utils/project/sampleapp/cms_menus.py
.py
from django.urls import NoReverseMatch, reverse from django.utils.translation import gettext_lazy as _ from cms.menu_bases import CMSAttachMenu from cms.test_utils.project.sampleapp.models import Category from menus.base import Menu, NavigationNode from menus.menu_pool import menu_pool class SampleAppMenu(Menu): ...
83
2,469
astropy
astropy/utils/metadata/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """This module contains helper functions and classes for handling metadata.""" from . import core as _core from . import exceptions as _exceptions from . import merge as _merge from . import utils as _utils from .core import * from .exceptions import * fr...
18
482
pyro
tests/infer/test_gradient.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import logging import numpy as np import pytest import torch import torch.optim from torch.distributions import constraints import pyro import pyro.distributions as dist import pyro.poutine as poutine from pyro.distributions.test...
432
15,384
conda
conda/common/_os/windows.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from enum import IntEnum from logging import getLogger from ..compat import ensure_binary, on_win log = getLogger(__name__) if on_win: from ctypes import ( POINTER, Structure, WinError, byref, c_cha...
192
5,496
saleor
saleor/product/utils/search_helpers.py
.py
from ..tasks import mark_products_search_vector_as_dirty # Results in update time ~0.2s, consumes ~30 MB MARK_SEARCH_VECTOR_DIRTY_BATCH_SIZE = 1000 def mark_products_search_vector_as_dirty_in_batches(product_ids: list[int]): """Mark products as needing search index updates.""" for i in range(0, len(product_i...
12
502
eve
docs/_themes/flask_theme_support.py
.py
# flasky extensions. flasky pygments style based on tango style from pygments.style import Style from pygments.token import (Comment, Error, Generic, Keyword, Literal, Name, Number, Operator, Other, Punctuation, String, Whitespace) class FlaskyStyle(Style): ...
79
3,910
mlflow
tests/store/model_registry/test_abstract_store.py
.py
import json import threading import time from unittest import mock import pytest from mlflow.entities.logged_model import LoggedModel from mlflow.entities.logged_model_tag import LoggedModelTag from mlflow.entities.model_registry.model_version import ModelVersion from mlflow.entities.model_registry.model_version_tag ...
741
25,029
coremltools
coremltools/converters/mil/mil/passes/defs/optimize_elementwise_binary.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 import numpy as np from coremltools.converters.mil.mil import Block from coremltools.converters.mil....
504
17,517
marshmallow
tests/test_validate.py
.py
"""Tests for marshmallow.validate""" import re import pytest from marshmallow import ValidationError, validate @pytest.mark.parametrize( "valid_url", [ "http://example.org", "https://example.org", "ftp://example.org", "ftps://example.org", "http://example.co.jp", ...
1,102
36,011
onnxruntime
onnxruntime/test/python/transformers/test_shape_infer_helper.py
.py
import unittest import onnx import pytest import torch from parity_utilities import find_transformers_source if find_transformers_source(): from benchmark_helper import ConfigModifier, OptimizerInfo, Precision from huggingface_models import MODELS from onnx_exporter import export_onnx_model_from_pt fr...
79
3,117
metrics
src/torchmetrics/text/rouge.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...
238
9,412
confluent-kafka-python
tests/integration/serialization/__init__.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2020 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 requi...
18
624
astropy
astropy/cosmology/_src/tests/io/base.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import astropy.units as u from astropy.cosmology import Cosmology, Parameter, realizations from astropy.cosmology import units as cu from astropy.cosmology._src.core import _COSMOLOGY_CLASSES, dataclass_decorator from astropy.cosmology.real...
216
7,617
openvino
tests/layer_tests/pytorch_tests/test_roi_align.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest from torchvision.ops import roi_align class TestROIAlign(PytorchLayerTest): def _prepare_input(self): return (self.input_...
65
2,658
probability
tensorflow_probability/python/internal/empirical_statistical_testing.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...
599
22,670
sqlmap
plugins/dbms/cratedb/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...
95
2,537
textual
tests/snapshot_tests/snapshot_apps/command_palette_dismiss.py
.py
from textual.app import App, ComposeResult from textual.widgets import Label class CPApp(App): def compose(self) -> ComposeResult: yield Label("Command palette test app") if __name__ == "__main__": app = CPApp() app.run()
13
246
jupyterlab
jupyterlab/handlers/announcements.py
.py
"""Announcements handler for JupyterLab.""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import abc import hashlib import json import xml.etree.ElementTree as ET from collections.abc import Awaitable from dataclasses import asdict, dataclass, field from datetime...
295
10,010
saleor
saleor/graphql/page/tests/mutations/test_page_type_reorder_attributes.py
.py
import graphene from .....page.error_codes import PageErrorCode from .....page.models import PageType from ....tests.utils import assert_no_permission, get_graphql_content PAGE_TYPE_REORDER_ATTRIBUTES_MUTATION = """ mutation PageTypeReorderAttributes( $pageTypeId: ID! $moves: [ReorderInput!]! ...
311
8,857
wandb
wandb/sdk/launch/loader.py
.py
"""Utilities for the agent.""" from __future__ import annotations from typing import Any import wandb from wandb.apis.internal import Api from wandb.docker import is_docker_installed from wandb.sdk.launch.errors import LaunchError from .builder.abstract import AbstractBuilder from .environment.abstract import Abstr...
252
8,940
pyro
examples/neutra.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 """ This example illustrates the use of `NeuTraReparam` to run neural transport HMC [1] on a toy model that draws from a banana-shaped bivariate distribution [2]. We first train an autoguide by using `AutoNormalizingFlow` that learns a...
283
9,381
beam
learning/tour-of-beam/learning-content/final-challenge/final-challenge-1/python-challenge/task.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"); y...
60
2,145
probability
tensorflow_probability/python/math/__init__.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...
175
8,062
mlflow
mlflow/tracing/trace_archival_config.py
.py
from __future__ import annotations import logging import threading import time from dataclasses import dataclass from pathlib import Path from typing import Any import yaml from mlflow.environment_variables import MLFLOW_TRACE_ARCHIVAL_CONFIG from mlflow.exceptions import MlflowException from mlflow.store.tracking.u...
258
8,675
openvino
tests/conditional_compilation/conftest.py
.py
#!/usr/bin/env python3 # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # pylint: disable=line-too-long """Pytest configuration for compilation tests.""" import json import logging import sys from inspect import getsourcefile from pathlib import Path # add utils folder to imports sy...
287
9,486
mlflow
tests/tracking/test_workspace_utils.py
.py
import pytest from mlflow.environment_variables import MLFLOW_TRACKING_URI, MLFLOW_WORKSPACE_STORE_URI from mlflow.utils.workspace_utils import resolve_workspace_store_uri, set_workspace_store_uri @pytest.fixture(autouse=True) def _reset_workspace_uri(monkeypatch): set_workspace_store_uri(None) monkeypatch.d...
39
1,598
pyfilesystem2
fs/opener/__init__.py
.py
# coding: utf-8 """Open filesystems from a URL. """ # Declare fs.opener as a namespace package __import__("pkg_resources").declare_namespace(__name__) # type: ignore # Import opener modules so that `registry.install` if called on each opener from . import appfs, ftpfs, memoryfs, osfs, tarfs, tempfs, zipfs # Import ...
23
686
jupyterlab
galata/jupyter_server_test_config.py
.py
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from jupyterlab.galata import configure_jupyter_server configure_jupyter_server(c) c.LabApp.dev_mode = True # Uncomment to set server log level to debug level # c.ServerApp.log_level = "DEBUG"
11
297
pyomo
pyomo/solvers/tests/piecewise_linear/problems/convex_multi_vararray2.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,730
sphinx
sphinx/ext/coverage.py
.py
"""Check Python modules and C API for coverage. Mostly written by Josip Dzolonga for the Google Highly Open Participation contest. """ from __future__ import annotations import glob import inspect import os.path import pickle import pkgutil import re import sys from importlib import import_module from typing import ...
558
22,563
hatch
tests/cli/project/test_metadata.py
.py
import os import pytest from hatch.config.constants import ConfigEnvVars from hatch.project.core import Project from hatchling.utils.constants import DEFAULT_CONFIG_FILE pytestmark = [pytest.mark.usefixtures("mock_backend_process_output")] def read_readme(project_dir): return repr((project_dir / "README.txt")....
427
13,318
mlflow
dev/clint/src/clint/comments.py
.py
import io import re import tokenize from dataclasses import dataclass from typing import TYPE_CHECKING, Iterator from typing_extensions import Self if TYPE_CHECKING: from clint.linter import Position NOQA_REGEX = re.compile(r"#\s*noqa\s*:\s*([A-Z]\d+(?:\s*,\s*[A-Z]\d+)*)", re.IGNORECASE) @dataclass class Noqa:...
42
1,174
lemur
lemur/sources/schemas.py
.py
""" .. module: lemur.sources.schemas :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> """ from marshmallow import fields, post_dump from lemur.schemas import PluginInputSchema, P...
40
1,162
onnxruntime
docs/python/examples/plot_train_convert_predict.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # pylint: disable=C0411,C0412,C0413 """ .. _l-logreg-example-speed: Train, convert and predict with ONNX Runtime ============================================ This example demonstrates an end to end scenario starting with t...
235
6,947
mlflow
tests/tracing/utils/test_exception.py
.py
import pytest from mlflow.exceptions import MlflowTracingException from mlflow.tracing.utils.exception import raise_as_trace_exception def test_raise_as_trace_exception(): @raise_as_trace_exception def test_fn(): raise ValueError("error") with pytest.raises(MlflowTracingException, match="error")...
20
452
astropy
astropy/coordinates/tests/test_representation_arithmetic.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import operator import numpy as np import pytest from astropy import units as u from astropy.coordinates import ( CartesianDifferential, CartesianRepresentation, CylindricalDifferential, CylindricalRepresentation, Latitude, Longi...
1,482
60,430
readthedocs.org
readthedocs/proxito/views/serve.py
.py
"""Views for doc serving.""" from urllib.parse import urlparse import structlog from django.conf import settings from django.http import Http404 from django.http import HttpResponse from django.http import HttpResponseRedirect from django.shortcuts import get_object_or_404 from django.shortcuts import render from dja...
985
38,251
lemur
lemur/tests/test_issuer_manager.py
.py
# from lemur.tests import LemurTestCase # class ManagerTestCase(LemurTestCase): # def test_validate_authority(self): # pass # # def test_get_all_authorities(self): # from lemur.common.services.issuers.manager import get_all_authorities # authorities = get_all_authorities() # self.asse...
17
546
coremltools
coremltools/converters/mil/mil/types/type_complex.py
.py
# Copyright (c) 2022, 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 coremltools import _logger as logger from .annotate import annotate, class_...
172
5,705
django-cms
cms/test_utils/project/sampleapp/cms_apps.py
.py
from django.core.exceptions import ObjectDoesNotExist from django.http import HttpResponse from django.urls import re_path, reverse from django.utils.translation import gettext_lazy as _ from cms.app_base import CMSApp from cms.apphook_pool import apphook_pool from cms.test_utils.project.sampleapp.cms_menus import ( ...
152
4,437
clearml
examples/frameworks/xgboost/xgboost_metrics.py
.py
import xgboost as xgb from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split from clearml import Task task = Task.init(project_name="examples", task_name="XGBoost metric auto reporting") X, y = load_iris(return_X_y=True) X_train, X_test, y_train, y_test = train_test_split( X,...
28
680
probability
spinoffs/inference_gym/inference_gym/tools/stan/brownian_motion.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...
147
4,562
wagtail
wagtail/snippets/apps.py
.py
from django.apps import AppConfig from django.db.models.signals import post_migrate from django.utils.translation import gettext_lazy as _ class WagtailSnippetsAppConfig(AppConfig): name = "wagtail.snippets" label = "wagtailsnippets" verbose_name = _("Wagtail snippets") def ready(self): from ...
39
1,628
pyomo
pyomo/dae/simulator.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...
1,091
40,734
openvino
tests/layer_tests/pytorch_tests/test_unflatten.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestUnflatten(PytorchLayerTest): def _prepare_input(self, dtype): return (self.random.uniform(0, 50, (6, 3, 4), dtype=dtype),) def create_model...
69
2,360
pyomo
doc/OnlineDocs/src/data/ABCD9.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...
29
1,011
mlflow
mlflow/paddle/__init__.py
.py
""" The ``mlflow.paddle`` module provides an API for logging and loading paddle models. This module exports paddle models with the following flavors: Paddle (native) format This is the main flavor that can be loaded back into paddle. :py:mod:`mlflow.pyfunc` Produced for use by generic pyfunc-based deployment ...
618
21,898
gunicorn
examples/websocket/gevent_websocket.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. import collections import errno import re import hashlib import base64 from base64 import b64encode, b64decode import socket import struct import logging from socket import error as SocketError import gevent from ...
454
15,763
probability
tensorflow_probability/python/math/psd_kernels/kumaraswamy_transformed_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...
153
5,374
biopython
Tests/test_SearchIO_blat_psl.py
.py
# Copyright 2012 by Wibowo Arindrarto. 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. """Tests for SearchIO BlatIO parsers.""" import os import unittest from Bio.SearchIO imp...
1,331
60,568
pyomo
pyomo/contrib/solver/tests/solvers/test_gurobi_minlp.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...
237
8,192
openvino
src/frontends/tensorflow/tests/test_models/gen_scripts/generate_ragged_tensor_to_sparse.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import sys import tensorflow.compat.v1 as tf def main(): tf.compat.v1.reset_default_graph() @tf.function def second_func(strings, row_splits): sparse_indices, sparse_values, sparse_dense_shape = tf.raw_o...
36
1,307
wandb
wandb/sdk/internal/job_builder.py
.py
"""job builder.""" from __future__ import annotations import json import logging import os import re import sys from collections.abc import Callable from typing import TYPE_CHECKING, Any, Literal, TypedDict import wandb from wandb.sdk.artifacts._internal_artifact import InternalArtifact from wandb.sdk.artifacts.arti...
642
23,218
mlflow
tests/entities/test_trace_state.py
.py
import pytest from mlflow.entities.trace_state import TraceState from mlflow.protos.service_pb2 import TraceInfoV3 as ProtoTraceInfo @pytest.mark.parametrize( ("state", "proto_state"), [ (TraceState.STATE_UNSPECIFIED, ProtoTraceInfo.State.STATE_UNSPECIFIED), (TraceState.OK, ProtoTraceInfo.Sta...
19
613
wandb
wandb/sdk/artifacts/_factories.py
.py
from __future__ import annotations from typing import TYPE_CHECKING from ._models.storage import StoragePolicyConfig from .storage_policies import WandbStoragePolicy if TYPE_CHECKING: from .storage_policy import StoragePolicy def make_storage_policy(region: str | None = None) -> StoragePolicy: """Returns t...
15
461
coremltools
coremltools/test/neural_network/__init__.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
5
215
kafka
release/svn.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...
61
2,474
hypercorn
tests/protocol/test_h2.py
.py
from __future__ import annotations import asyncio from unittest.mock import AsyncMock, call, Mock import pytest from h2.connection import H2Connection from h2.events import ConnectionTerminated from hypercorn.asyncio.worker_context import EventWrapper, WorkerContext from hypercorn.config import Config from hypercorn...
119
3,601
gunicorn
tests/requests/invalid/012.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', 98)
11
280
pyomo
pyomo/contrib/pynumero/examples/tests/test_cyipopt_examples.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...
287
11,672
onnx
onnx/backend/test/case/node/topk.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 def topk_sorted_implementation(X, k, axis, largest): ind_axis = np.indic...
263
6,761
beam
playground/infrastructure/test_checker.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 ...
57
2,229
wagtail
wagtail/admin/tests/pages/test_revisions.py
.py
from http import HTTPStatus from django.conf import settings 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 freezegun import freeze_time from wagtail.admin.staticfiles import versioned_static...
739
28,492
mlflow
mlflow/projects/kubernetes.py
.py
import logging import os import time from datetime import datetime from shlex import quote, split from threading import RLock import docker import kubernetes from kubernetes.config.config_exception import ConfigException from mlflow.entities import RunStatus from mlflow.exceptions import ExecutionException from mlflo...
166
6,363
ipython
tests/test_pretty.py
.py
# coding: utf-8 """Tests for IPython.lib.pretty.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from collections import Counter, defaultdict, deque, OrderedDict, UserList import os import pytest import types import string import sys from IPython.lib import pr...
612
16,196
python-prompt-toolkit
examples/progress-bar/custom-key-bindings.py
.py
#!/usr/bin/env python """ A very simple progress bar which keep track of the progress as we consume an iterator. """ import os import signal import time from prompt_toolkit import HTML from prompt_toolkit.key_binding import KeyBindings from prompt_toolkit.patch_stdout import patch_stdout from prompt_toolkit.shortcuts...
53
1,208
openvino
tests/layer_tests/jax_tests/test_copy.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from jax import lax from jax import numpy as jnp from jax_layer_test_class import JaxLayerTest class TestCopy(JaxLayerTest): def _prepare_input(self): lhs = jnp.array(np.random.rand(*self.i...
43
1,174
pyomo
pyomo/contrib/mindtpy/tests/unit_test.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...
100
3,381
wagtail
wagtail/contrib/redirects/api/v2/__init__.py
.py
from django.http import Http404 from rest_framework import serializers from wagtail.api.v2.filters import FieldsFilter, OrderingFilter, SearchFilter from wagtail.api.v2.serializers import BaseSerializer from wagtail.api.v2.views import BaseAPIViewSet from wagtail.contrib.redirects.middleware import get_redirect from w...
40
1,230
pyro
pyro/contrib/oed/util.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import math import torch from pyro.contrib.oed.glmm import analytic_posterior_cov from pyro.contrib.util import get_indices from pyro.infer.autoguide.utils import mean_field_entropy def linear_model_ground_truth( model, des...
38
1,230
black
tests/test_no_ipynb.py
.py
import pathlib import pytest from click.testing import CliRunner from black import jupyter_dependencies_are_installed, main from tests.util import get_case_path pytestmark = pytest.mark.no_jupyter runner = CliRunner() def test_ipynb_diff_with_no_change_single() -> None: jupyter_dependencies_are_installed.cach...
37
1,247
mlflow
tests/genai/scorers/test_builtin_scorers.py
.py
import json from unittest import mock from unittest.mock import Mock, call, patch import pydantic import pytest import mlflow from mlflow.entities.assessment import Feedback from mlflow.entities.assessment_error import AssessmentError from mlflow.entities.assessment_source import AssessmentSource, AssessmentSourceTyp...
2,852
102,057