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
readthedocs.org
readthedocs/rtd_tests/tests/test_managers.py
.py
from django.contrib.auth import get_user_model from django.test import TestCase from django_dynamic_fixture import get from readthedocs.builds.constants import EXTERNAL from readthedocs.builds.models import Build, Version from readthedocs.projects.constants import PRIVATE, PUBLIC from readthedocs.projects.models impor...
332
10,761
mlflow
mlflow/transformers/signature.py
.py
import json import logging import numpy as np from mlflow.environment_variables import MLFLOW_INPUT_EXAMPLE_INFERENCE_TIMEOUT from mlflow.models.signature import ModelSignature, infer_signature from mlflow.models.utils import _contains_params from mlflow.types.schema import ColSpec, DataType, Schema, TensorSpec from ...
183
7,438
astropy
astropy/units/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This subpackage contains classes and functions for defining and converting between different physical units, as well as the units themselves. This code is adapted from the `pynbody <https://github.com/pynbody/pynbody>`_ units module written by Andrew...
70
1,756
mlflow
mlflow/system_metrics/metrics/disk_monitor.py
.py
"""Class for monitoring disk stats.""" import os import psutil from mlflow.system_metrics.metrics.base_metrics_monitor import BaseMetricsMonitor class DiskMonitor(BaseMetricsMonitor): """Class for monitoring disk stats.""" def collect_metrics(self): # Get disk usage metrics. disk_usage = p...
22
689
wagtail
wagtail/snippets/tests/test_index_view.py
.py
from django.contrib.auth.models import Permission from django.test import SimpleTestCase, TestCase from django.test.utils import override_settings from django.urls import reverse from wagtail.admin.menu import admin_menu from wagtail.coreutils import get_dummy_request from wagtail.snippets.models import SNIPPET_MODELS...
106
4,045
pymc
tests/logprob/test_transforms.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...
849
28,702
hydra
examples/plugins/example_generic_plugin/hydra_plugins/example_generic_plugin/example_plugin.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from hydra.plugins.plugin import Plugin class ExamplePlugin(Plugin): def __init__(self, v: int) -> None: self.v = v def add(self, x: int) -> int: return self.v + x
11
262
pyomo
pyomo/devel/initialization/tests/test_initialization.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
236
8,974
wagtail
wagtail/project_template/project_name/urls.py
.py
from django.conf import settings from django.urls import include, path from django.contrib import admin from wagtail.admin import urls as wagtailadmin_urls from wagtail import urls as wagtail_urls from wagtail.documents import urls as wagtaildocs_urls from search import views as search_views urlpatterns = [ path...
36
1,245
metrics
tests/unittests/clustering/test_davies_bouldin_score.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...
57
2,131
confluent-kafka-python
src/confluent_kafka/schema_registry/_async/avro.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...
853
44,276
onnxruntime
onnxruntime/test/testdata/transform/fusion/create_conv_clip11.py
.py
import onnx from onnx import TensorProto, helper graph = helper.make_graph( [ # nodes # fusable, min/max from constant inputs. helper.make_node("Conv", ["X0", "W"], ["conv0_out"], "Conv0"), helper.make_node("Clip", ["conv0_out", "const_min", "const_max"], ["clip0_out"], "Clip0"), #...
38
1,801
django-cms
cms/tests/test_management.py
.py
import sys from io import StringIO from django.conf import settings from django.contrib.auth import get_user_model from django.contrib.contenttypes.models import ContentType from django.contrib.sites.models import Site from django.core import management from django.core.management import CommandError from django.db im...
890
37,198
sqlmap
plugins/dbms/frontbase/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...
90
2,612
astropy
astropy/cosmology/_src/io/builtin/utils.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from astropy.modeling import Parameter as ModelParameter from astropy.table import Column def convert_parameter_to_column(parameter, value, meta=None): """Convert a |Cosmology| Parameter to a Table |Column|. Parameters -...
71
1,791
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/max_globally.py
.py
# coding=utf-8 # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License");...
54
1,574
astropy
astropy/cosmology/_src/tests/parameter/test_utils.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.cosmology._src.parameter import Parameter, all_parameters def test_all_parameters(): """Test :func:`astropy.cosmology._src.utils.all_parameters`.""" class ClassA: a = 1 b = 2 got = all_parameters(ClassA) a...
27
643
deap
deap/tools/constraint.py
.py
from functools import wraps from itertools import repeat try: from collections.abc import Sequence except ImportError: from collections import Sequence class DeltaPenalty(object): r"""This decorator returns penalized fitness for invalid individuals and the original fitness value for valid individual...
180
7,941
wagtail
wagtail/apps.py
.py
from django.apps import AppConfig, apps from django.utils.translation import gettext_lazy as _ from . import checks # NOQA: F401 class WagtailAppConfig(AppConfig): name = "wagtail" label = "wagtailcore" verbose_name = _("Wagtail core") default_auto_field = "django.db.models.AutoField" def ready...
28
788
readthedocs.org
readthedocs/search/api/v2/views.py
.py
from functools import lru_cache import structlog from django.shortcuts import get_object_or_404 from django.utils import timezone from django.utils.translation import gettext as _ from rest_framework.exceptions import ValidationError from rest_framework.generics import GenericAPIView from readthedocs.api.mixins impor...
213
7,112
pynacl
tests/test_secretstream.py
.py
# Copyright 2013-2018 Donald Stufft and individual contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
287
10,343
sphinx
tests/roots/test-ext-autodoc/target/final.py
.py
from __future__ import annotations import typing from typing import final import typing_extensions from typing_extensions import final as final_ext # noqa: UP035 @typing.final class Class: """docstring""" @final def meth1(self): """docstring""" def meth2(self): """docstring""" ...
28
453
biopython
Bio/UniProt/__init__.py
.py
# Copyright 2013 by Iddo Friedberg idoerg@gmail.com # Revision copyright 2013 by Peter Cock. All rights reserved. # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been inclu...
157
5,376
wandb
tests/unit_tests/test_automations/test_automations.py
.py
from __future__ import annotations import json from typing import Any from pydantic import ValidationError from pytest import FixtureRequest, fixture, mark, raises from wandb.automations import ( ActionType, ArtifactEvent, EventType, NewAutomation, OnAddArtifactAlias, OnAddArtifactTag, OnA...
388
14,893
wandb
wandb/sdk/artifacts/_generated/project_artifact_collection.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/artifacts/ from __future__ import annotations from pydantic import Field from wandb._pydantic import GQLResult from .fragments import ArtifactCollectionFragment class ProjectArtifactCollection(GQLResult): project: ProjectArtifactCollectionProject ...
32
823
coremltools
coremltools/converters/mil/mil/ops/tests/iOS17/test_image_resizing.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 itertools import numpy as np import pytest from coremltools.converters.mil.mil import Builde...
420
15,870
openvino
docs/articles_en/assets/snippets/ov_matcher_pass.py
.py
# ! [matcher_pass:ov_matcher_pass_py] ''' ``MatcherPass`` is used for pattern-based transformations. To create transformation, you need to: 1. Create a pattern. 2. Implement a callback. 3. Register the pattern and ``Matcher``. The next example defines transformation that searches for the ``Relu`` layer and inserts af...
95
2,500
saleor
saleor/tests/e2e/promotions/utils/__init__.py
.py
from .promotion_create import create_promotion, raw_create_promotion from .promotion_delete import delete_promotion from .promotion_query import promotion_query from .promotion_rule_create import create_promotion_rule from .promotion_rule_translate import translate_promotion_rule from .promotion_rule_update import raw_...
22
753
conda
tests/plugins/test_reporter_backends.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations import pytest from conda import plugins from conda.base.constants import ( DEFAULT_CONSOLE_REPORTER_BACKEND, DEFAULT_JSON_REPORTER_BACKEND, ) from conda.plugins.reporter_backends import plugins as def...
108
3,106
mlflow
mlflow/store/db_migrations/versions/acf3f17fdcc7_add_storage_location_field_to_model_.py
.py
"""add storage location field to model versions Create Date: 2023-10-23 15:26:53.062080 """ import sqlalchemy as sa from alembic import op from mlflow.store.model_registry.dbmodels.models import SqlModelVersion # revision identifiers, used by Alembic. revision = "acf3f17fdcc7" down_revision = "2d6e25af4d3e" branch...
28
546
openvino
src/bindings/python/tests/test_runtime/test_remote_api.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import pytest import numpy as np import openvino as ov from tests.utils.helpers import get_relu_model @pytest.mark.skipif( "CPU" not in os.environ.get("TEST_DEVICE", ""), reason="Test can be...
270
9,400
lemur
lemur/dns_providers/views.py
.py
""" .. module: lemur.dns)providers.views :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Curtis Castrapel <ccastrapel@netflix.com> """ from flask import Blueprint, g from flask_restful import reqparse, Api from lem...
196
5,997
cvxpy
cvxpy/utilities/performance_utils.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...
88
2,811
qutip
qutip/utilities.py
.py
""" This module contains utility functions that are commonly needed in other qutip modules. """ # Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations __all__ = ['n_thermal', 'clebsch', 'convert_unit', 'iterated_fit'] import math from fractions import Fraction from typing import Call...
1,019
31,492
clearml
clearml/backend_api/session/apimodel.py
.py
from .datamodel import DataModel class ApiModel(DataModel): """API-related data model""" _service = None _action = None _version = None
10
155
beam
learning/tour-of-beam/learning-content/windowing/adding-timestamp/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...
78
2,615
luigi
luigi/contrib/hdfs/error.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...
30
1,029
saleor
saleor/graphql/core/tests/test_context.py
.py
from django.urls import reverse from ...context import set_app_on_context from ..context import SaleorContext def test_app_middleware_accepts_app_requests(app, rf): # given # Retrieve sample request object request = rf.get(reverse("api")) _, token = app.tokens.create() request.META = {"HTTP_AUTHO...
57
1,217
jupytext
tests/data/notebooks/outputs/ipynb_to_script_vscode_folding_markers/plotly_graphs.py
.py
# --- # jupyter: # jupytext: # cell_markers: region,endregion # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # This notebook contains complex outputs, including plotly javascript graphs. # # Interactive plots # We use Plotly's connected mode to make the notebook l...
27
664
pyomo
examples/pyomobook/pyomo-components-ch/param_validation.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...
40
1,033
wagtail
wagtail/contrib/settings/tests/generic/test_model.py
.py
from django.test import TestCase, override_settings from wagtail.models import Site from wagtail.permission_policies import ModelPermissionPolicy from wagtail.permissions import policy_registry from wagtail.test.testapp.models import ImportantPagesGenericSetting from .base import GenericSettingsTestMixin @override_...
137
5,931
coremltools
coremltools/converters/mil/mil/ops/tests/iOS16/test_conv.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 import pytest from coremltools.converters.mil.mil import Builder as mb from core...
73
2,854
saleor
saleor/tests/e2e/pages/utils/__init__.py
.py
from .page_create import create_page from .page_type_create import create_page_type __all__ = [ "create_page", "create_page_type", ]
8
142
mlflow
tests/store/artifact/constants.py
.py
MODELS_ARTIFACT_REPOSITORY_PACKAGE = "mlflow.store.artifact.models_artifact_repo" MODELS_ARTIFACT_REPOSITORY = MODELS_ARTIFACT_REPOSITORY_PACKAGE + ".ModelsArtifactRepository" WORKSPACE_MODELS_ARTIFACT_REPOSITORY = ( f"{MODELS_ARTIFACT_REPOSITORY_PACKAGE}.DatabricksModelsArtifactRepository" ) UC_MODELS_ARTIFACT_REP...
13
540
mlflow
dev/clint/src/clint/rules/base.py
.py
import inspect import itertools import re from abc import ABC, abstractmethod from typing import Any _id_counter = itertools.count(start=1) _CLASS_NAME_TO_RULE_NAME_REGEX = re.compile(r"(?<!^)(?=[A-Z])") class Rule(ABC): id: str name: str def __init_subclass__(cls, **kwargs: Any) -> None: super(...
32
798
openvino
tests/layer_tests/common/tf_layer_test_class.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np from common.layer_utils import InferAPI from common.utils.common_utils import generate_ir_python_api from common.utils.tf_utils import save_to_pb from common.utils.tf_utils import summarize_graph from common.utils.tfli...
177
7,770
luigi
test/contrib/salesforce_test.py
.py
# -*- coding: utf-8 -*- # # Copyright (c) 2016 Simply Measured # # 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...
117
3,730
coveragepy
tests/modules/pkg2/p2a.py
.py
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/coveragepy/coveragepy/blob/main/NOTICE.txt q = 1 r = 1 s = 1
7
176
saleor
saleor/app/tests/tasks/test_saleor3_23.py
.py
from saleor.app.migrations.tasks.saleor3_23 import ( fill_app_extension_settings_task, ) from saleor.app.models import App, AppExtension def test_skip_settings_if_filled(): # given app = App.objects.create(name="Test App", is_active=True) extension = AppExtension.objects.create( app=app, ...
80
2,051
textual
src/textual/css/errors.py
.py
from __future__ import annotations from rich.console import Console, ConsoleOptions, RenderResult from textual.css._help_renderables import HelpText from textual.css.tokenizer import Token, TokenError class DeclarationError(Exception): def __init__(self, name: str, token: Token, message: str | HelpText) -> None...
51
1,304
beam
sdks/python/apache_beam/examples/cookbook/datastore_wordcount_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...
78
2,603
django-cms
cms/toolbar_pool.py
.py
from collections import OrderedDict from django.core.exceptions import ImproperlyConfigured from django.utils.module_loading import autodiscover_modules, import_string from cms.exceptions import ToolbarAlreadyRegistered, ToolbarNotRegistered from cms.utils.conf import get_cms_setting class ToolbarPool: def __in...
66
2,208
pyomo
pyomo/core/tests/unit/test_logical_expr_expanded.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...
466
17,362
kombu
t/unit/asynchronous/test_timer.py
.py
from __future__ import annotations from datetime import datetime, timezone from unittest.mock import Mock, patch import pytest from kombu.asynchronous.timer import Entry, Timer, to_timestamp class test_to_timestamp: def test_timestamp(self): assert to_timestamp(3.13) == 3.13 def test_datetime(sel...
157
4,266
mlflow
tests/server/test_artifact_router.py
.py
from unittest import mock import pytest from starlette.testclient import TestClient from mlflow.server import ARTIFACTS_DESTINATION_ENV_VAR, SERVE_ARTIFACTS_ENV_VAR from mlflow.server import app as flask_app from mlflow.server.fastapi_app import create_fastapi_app from mlflow.store.artifact.artifact_repo import ARTIF...
282
10,002
textual
tests/snapshot_tests/snapshot_apps/sparkline.py
.py
import random from statistics import mean from textual.app import App, ComposeResult from textual.widgets import Sparkline random.seed(73) data = [random.expovariate(1 / 3) for _ in range(1000)] class SparklineApp(App[None]): DEFAULT_CSS = """ SparklineApp { Sparkline { height: 1fr; ...
29
606
sphinx
tests/test_directives/test_directive_other.py
.py
"""Test the other directives.""" from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING import pytest from docutils import nodes from sphinx import addnodes from sphinx.testing import restructuredtext from sphinx.testing.util import assert_node from tests.utils import extract_...
215
7,303
pyro
pyro/contrib/oed/glmm/guides.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 from contextlib import ExitStack import torch from torch import nn import pyro import pyro.distributions as dist from pyro import poutine from pyro.contrib.util import ( iter_plates_to_shape, lexpand, rmv, rtril, ...
314
11,368
black
tests/data/cases/preview_simplify_power_operator_hugging_long.py
.py
# flags: --preview # This is a copy of `power_op_spacing_long.py` with output adjusted for `simplify_power_operator_hugging`. a = 1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1 b = 1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1**1 c = 1 ** 1 ** 1 *...
100
2,667
beam
sdks/python/apache_beam/runners/portability/spark_runner.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...
130
5,094
probability
tensorflow_probability/python/bijectors/lambertw_transform.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...
270
11,355
pyfilesystem2
fs/test.py
.py
# coding: utf-8 """Base class for tests. All Filesystems should be able to pass these. """ from __future__ import absolute_import, unicode_literals import io import itertools import json import os import six import time import unittest import warnings from datetime import datetime from six import text_type import ...
2,004
77,367
astropy
astropy/timeseries/periodograms/lombscargle/implementations/main.py
.py
""" Main Lomb-Scargle Implementation. The ``lombscargle`` function here is essentially a sophisticated switch statement for the various implementations available in this submodule """ __all__ = ["available_methods", "lombscargle"] import numpy as np from astropy.utils.compat.optional_deps import HAS_SCIPY from .ch...
241
8,170
astropy
astropy/coordinates/builtin_frames/icrs_cirs_transforms.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Contains the transformation functions for getting from ICRS/HCRS to CIRS and anything in between (currently that means GCRS). """ import numpy as np from astropy import units as u from astropy.coordinates.baseframe import frame_transform_graph from a...
285
11,194
mlflow
dev/clint/src/clint/rules/no_shebang.py
.py
from clint.rules.base import Rule class NoShebang(Rule): def _message(self) -> str: return "Python scripts should not contain shebang lines" @staticmethod def check(file_content: str) -> bool: """ Returns True if the file contains a shebang line at the beginning. A sheban...
16
451
pyomo
pyomo/opt/results/results_.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...
218
8,103
sqlmap
thirdparty/ansistrm/ansistrm.py
.py
# # Copyright (C) 2010-2012 Vinay Sajip. All rights reserved. Licensed under the new BSD license. # (Note: 2018 modifications by @stamparm) # import logging import re import sys from lib.core.settings import IS_WIN if IS_WIN: import ctypes import ctypes.wintypes # Reference: https://gist.github.com/vsaj...
172
5,329
probability
tensorflow_probability/python/experimental/tangent_spaces/spherical_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...
299
9,181
openvino
tests/layer_tests/jax_tests/test_div.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import jax.numpy as jnp import numpy as np import pytest from jax_layer_test_class import JaxLayerTest def get_rand_jnp_array(shape, dtype): if dtype in [np.float32, np.float16, np.float64]: res = np.random.uniform(-1000, ...
140
4,526
gunicorn
tests/requests/valid/022.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. req1 = { "method": "GET", "uri": uri("/first"), "version": (1, 0), "headers": [("CONNECTION", "Keep-Alive")], "body": b"" } req2 = { "method": "GET", "uri": uri("/second"), "version...
22
392
coremltools
coremltools/converters/mil/frontend/torch/test/test_torch_conversion_api.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 from datetime import date import itertools import os import platform import re import shutil import t...
3,299
137,818
pyro
tests/distributions/test_conjugate.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import math import pytest import torch import pyro.distributions as dist from pyro.distributions import BetaBinomial, DirichletMultinomial, GammaPoisson from tests.common import assert_close @pytest.mark.parametrize( "dist"...
127
4,358
django-cms
cms/test_utils/project/pluginapp/plugins/revdesc/models.py
.py
from django.db import models from cms.models import CMSPlugin # sorry for the cryptic names. But we were hitting max lengths on Django 1.6 # and 1.7 with the too long names otherwise. class UnalteredPM(CMSPlugin): title = models.CharField(max_length=50) search_fields = ['title'] class NoRelNmePM(CMSPlugin...
58
1,645
textual
src/textual/errors.py
.py
""" General exception classes. """ from __future__ import annotations class TextualError(Exception): """Base class for Textual errors.""" class NoWidget(TextualError): """Specified widget was not found.""" class RenderError(TextualError): """An object could not be rendered.""" class DuplicateKeyHa...
27
534
wagtail
wagtail/admin/mail.py
.py
import logging from django.conf import settings from django.contrib.auth import get_user_model from django.core.mail import get_connection from django.core.mail.message import EmailMultiAlternatives from django.template.loader import render_to_string from django.utils.translation import override from wagtail.coreutil...
417
15,356
openvino
tests/layer_tests/py_frontend_tests/test_paddle_frontend.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from pathlib import Path import os import glob import re import sys # ticket 95904 #import paddle #from paddle.jit import to_static #from paddle.static import InputSpec import pytest from openvino.frontend import FrontEndManager from ...
179
5,500
pyro
tests/infer/reparam/test_loc_scale.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import pytest import torch from torch.autograd import grad import pyro import pyro.distributions as dist from pyro import poutine from pyro.distributions.util import is_identically_one from pyro.infer.autoguide.initialization impo...
110
4,077
pyomo
pyomo/contrib/simplification/simplify.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...
74
2,727
clearml
examples/frameworks/jsonargparse/jsonargparse_nested_namespaces.py
.py
from dataclasses import dataclass from jsonargparse import ArgumentParser from clearml import Task @dataclass class Arg2: opt1: str = "from default 1" opt2: str = "from default 2" if __name__ == "__main__": Task.init(project_name="examples", task_name="jsonargparse nested namespaces") parser = Argum...
20
594
cvxpy
cvxpy/reductions/cone2cone/soc_dim3.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, soft...
527
18,147
openvino
tests/layer_tests/pytorch_tests/test_im2col.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestIm2Col(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(10, 3, 24, 24),) def create_model(self, kernel_size, dilation...
45
1,631
conda
conda/gateways/shards/typing.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Minimal set of interfaces required to describe shards code to clients (solvers)""" import typing from collections.abc import Iterable, Iterator, KeysView from typing import Literal class Shards(typing.Protocol): base_url: str @pro...
75
2,751
confluent-kafka-python
src/confluent_kafka/schema_registry/_sync/avro.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...
844
43,830
qutip
qutip/continuous_variables.py
.py
""" This module contains a collection functions for calculating continuous variable quantities from fock-basis representation of the state of multi-mode fields. """ __all__ = ['correlation_matrix', 'covariance_matrix', 'correlation_matrix_field', 'correlation_matrix_quadrature', 'wigner_covarianc...
260
8,524
mlflow
dev/clint/tests/rules/test_forbidden_set_active_model_usage.py
.py
from pathlib import Path from clint.config import Config from clint.index import SymbolIndex from clint.linter import Position, Range, lint_file from clint.rules.forbidden_set_active_model_usage import ForbiddenSetActiveModelUsage def test_forbidden_set_active_model_usage(index: SymbolIndex) -> None: code = """ ...
34
1,132
mlflow
mlflow/utils/autologging_utils/versioning.py
.py
import importlib import importlib.metadata import re from typing import Literal from packaging.version import InvalidVersion, Version from mlflow.ml_package_versions import _ML_PACKAGE_VERSIONS, FLAVOR_TO_MODULE_NAME from mlflow.utils.databricks_utils import is_in_databricks_runtime def _check_version_in_range(ver,...
111
4,540
deap
examples/gp/symbreg.py
.py
# This file is part of EAP. # # EAP 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. # # EAP is distributed in ...
95
3,374
wagtail
wagtail/users/wagtail_hooks.py
.py
from django.apps import apps from django.core.exceptions import ImproperlyConfigured from django.utils.module_loading import import_string from wagtail import hooks from wagtail.users.views.bulk_actions import ( AssignRoleBulkAction, DeleteBulkAction, SetActiveStateBulkAction, ) def get_viewset_cls(app_c...
44
1,499
probability
tensorflow_probability/python/distributions/quantized_distribution_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...
532
22,008
wagtail
wagtail/test/utils/page_tests.py
.py
from typing import Any from unittest import mock import swapper from django.conf import settings from django.contrib.auth.base_user import AbstractBaseUser from django.http import Http404 from django.test import TestCase from django.urls import reverse from django.utils.http import urlencode from django.utils.text imp...
481
18,549
saleor
saleor/page/tests/fixtures/page.py
.py
import pytest from ....attribute.utils import associate_attribute_values_to_instance from ....tests.utils import dummy_editorjs from ...models import Page from ...search import update_pages_search_vector @pytest.fixture def page(db, page_type, size_page_attribute): data = { "slug": "test-url", "t...
105
2,894
wagtail
wagtail/models/api.py
.py
import math import secrets import zlib from django.conf import settings from django.db import models from django.utils import timezone from django.utils.crypto import salted_hmac from django.utils.translation import gettext_lazy as _ BASE62_ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" B...
126
4,493
astropy
astropy/cosmology/_src/flrw/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Astropy FLRW classes.""" from .base import * from .lambdacdm import * from .w0cdm import * from .w0wacdm import * from .w0wzcdm import * from .wpwazpcdm import *
10
230
scikit-optimize
doc/sphinxext/sphinx_issues.py
.py
# -*- coding: utf-8 -*- """A Sphinx extension for linking to your project's issue tracker. Copyright 2014 Steven Loria 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, includi...
219
8,118
pyomo
examples/gdp/batchProcessing.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...
308
11,754
coremltools
coremltools/converters/mil/frontend/tensorflow/convert_utils.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from collections import defaultdict from tqdm import tqdm as _tqdm from coremltools import _logger ...
212
7,497
biopython
Bio/Graphics/GenomeDiagram/_AbstractDrawer.py
.py
# Copyright 2003-2008 by Leighton Pritchard. All rights reserved. # Revisions copyright 2008-2017 by Peter Cock. # # 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 incl...
566
18,539
onnxruntime
onnxruntime/test/testdata/transform/propagate_cast/gen_propagate_cast.py
.py
import itertools import numpy as np import onnx from onnx import OperatorSetIdProto, TensorProto, helper onnxdomain = OperatorSetIdProto() onnxdomain.version = 12 # The empty string ("") or absence of this field implies the operator set that is defined as part of the ONNX specification. onnxdomain.domain = "" msdomai...
400
15,042
lemur
lemur/plugins/lemur_email/plugin.py
.py
""" .. module: lemur.plugins.lemur_email.plugin :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 boto3 from html.parser import HTMLParser from flask import current_app...
168
5,353
returns
returns/interfaces/bindable.py
.py
from abc import abstractmethod from collections.abc import Callable from typing import Generic, Never, TypeVar from returns.primitives.hkt import KindN _FirstType = TypeVar('_FirstType') _SecondType = TypeVar('_SecondType') _ThirdType = TypeVar('_ThirdType') _UpdatedType = TypeVar('_UpdatedType') _BindableType = Typ...
52
1,488