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/bijectors/bijector.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...
2,400
101,580
pyomo
examples/pyomobook/pyomo-components-ch/set_declaration.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...
68
1,831
openvino
tests/e2e_tests/common/ir_provider/pregenerated.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from e2e_tests.test_utils.path_utils import resolve_file_path from .provider import ClassProvider import logging as log import sys class Pregenerated(ClassProvider): """Pregenerated IR provider.""" __action_name__ = "pregenerat...
25
891
pyomo
pyomo/contrib/sensitivity_toolbox/tests/test_pynumero.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...
130
5,716
cvxpy
cvxpy/atoms/suppfunc.py
.py
import numpy as np import scipy.sparse as sp import cvxpy.lin_ops.lin_utils as lu from cvxpy.atoms.atom import Atom from cvxpy.expressions.expression import ExpressionValue from cvxpy.expressions.variable import Variable class SuppFuncAtom(Atom): def __init__(self, y, parent) -> None: """ Param...
143
4,107
rq
tests/test_serializers.py
.py
import json import pickle import pickletools import queue import unittest from rq.serializers import DefaultSerializer, JSONSerializer, PickleSerializer, resolve_serializer class TestSerializers(unittest.TestCase): def test_resolve_serializer(self): """Ensure function resolve_serializer works correctly""...
48
1,833
onnxruntime
tools/python/run_adb.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from __future__ import annotations import logging import os import sys from util import run from util.android import get_sdk_tool_paths def run_adb(android_sdk_root: str, args: list[str]): sdk_to...
36
891
pyomo
pyomo/common/tests/test_bunch.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...
227
6,481
saleor
saleor/graphql/checkout/tests/deprecated/test_checkout_shipping_address_update.py
.py
from unittest import mock import graphene from .....checkout.error_codes import CheckoutErrorCode from .....checkout.fetch import fetch_checkout_info, fetch_checkout_lines from .....plugins.manager import get_plugins_manager from ....tests.utils import get_graphql_content from ...mutations.utils import mark_checkout_...
166
5,995
confluent-kafka-python
src/confluent_kafka/avro/cached_schema_registry_client.py
.py
#!/usr/bin/env python # # Copyright 2016 Confluent Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
534
20,879
pdm
src/pdm/models/in_process/__init__.py
.py
""" A collection of functions that need to be called via a subprocess call. """ from __future__ import annotations import contextlib import functools import importlib.resources import json import os import subprocess import tempfile from collections.abc import Generator from typing import TYPE_CHECKING, Any if TYPE_...
66
2,139
hatch
backend/src/hatchling/cli/dep/__init__.py
.py
from __future__ import annotations import sys from typing import TYPE_CHECKING, Any if TYPE_CHECKING: import argparse def synced_impl(*, dependencies: list[str], python: str) -> None: import subprocess from ast import literal_eval from packaging.requirements import Requirement from hatchling.c...
38
1,169
flit
tests/test_build.py
.py
from pathlib import Path import pytest import shutil import sys from tempfile import TemporaryDirectory from testpath import assert_isdir, MockCommand from flit_core import common from flit import build samples_dir = Path(__file__).parent / 'samples' LIST_FILES_TEMPLATE = """\ #!{python} import sys from os.path impo...
85
2,932
hatch
backend/src/hatchling/cli/version/__init__.py
.py
from __future__ import annotations import argparse from typing import Any def version_impl( *, called_by_app: bool, # noqa: ARG001 force: bool, desired_version: str, ) -> None: import os from hatchling.bridge.app import Application from hatchling.metadata.core import ProjectMetadata ...
73
2,426
ipython
examples/utils/cwd_prompt.py
.py
"""This is an example that shows how to create new prompts for IPython""" from IPython.terminal.prompts import Prompts, Token import os class MyPrompt(Prompts): def in_prompt_tokens(self): return [(Token, os.getcwd()), (Token.Prompt, ">>>")] def load_ipython_extension(shell): new_prompts = MyPrompt...
23
584
coremltools
coremltools/models/array_feature_extractor.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 from coremltools import proto from .. import SPECIFICATION_VERSION from . import datatypes from ._inter...
62
2,006
openvino
tests/layer_tests/pytorch_tests/test_rot90.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # import torch import numpy as np import pytest from pytorch_layer_test_class import PytorchLayerTest class TestRot90(PytorchLayerTest): def _prepare_input(self): return (self.random.uniform(0, 50, (2, 3, 4)).astype(np.flo...
43
1,505
saleor
saleor/graphql/shop/schema.py
.py
import graphene from ...permission.enums import GiftcardPermissions from ..core.doc_category import ( DOC_CATEGORY_GIFT_CARDS, DOC_CATEGORY_SHOP, ) from ..core.fields import PermissionsField from ..site.dataloaders import load_site_callback from ..translations.mutations import ShopSettingsTranslate from .mutat...
84
2,884
jupytext
src/jupytext/compare.py
.py
"""Compare two Jupyter notebooks""" import difflib import json import os import re from jupytext.marimo import marimo_version from jupytext.paired_paths import full_path from .cell_metadata import _IGNORE_CELL_METADATA from .combine import combine_inputs_with_outputs from .formats import check_auto_ext, long_form_on...
412
15,096
astropy
astropy/coordinates/tests/test_masked.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from numpy.testing import assert_array_equal import astropy.coordinates.representation as r import astropy.units as u from astropy.coordinates import FK5, SkyCoord from astropy.coordinates.matrix_utilities import rotation...
396
17,051
pymc
tests/test_pytensorf.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...
854
31,895
textual
src/textual/cache.py
.py
""" Cache classes are dict-like containers used to avoid recalculating expensive operations such as rendering. You can also use them in your own apps for similar reasons. """ from __future__ import annotations from typing import TYPE_CHECKING, Dict, Generic, KeysView, TypeVar, overload CacheKey = TypeVar("CacheKe...
315
9,357
wagtail
wagtail/contrib/settings/tests/site_specific/test_forms.py
.py
from django.test import TestCase from wagtail.contrib.settings.forms import SiteSwitchForm from wagtail.models import Site from wagtail.test.testapp.models import TestSiteSetting from wagtail.test.utils import Page class TestSiteSwitchFormOrdering(TestCase): def setUp(self): self.root_page = Page.objects...
44
1,751
ipython
IPython/utils/process.py
.py
""" Utilities for working with external processes. """ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import os import sys if sys.platform == 'win32': from ._process_win32 import system, getoutput, arg_split, check_pid elif sys.platform == "emscripten": ...
74
1,922
cvxpy
cvxpy/reductions/cone2cone/approx.py
.py
""" Copyright 2022 the CVXPY 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 law or agreed to in writing, so...
290
10,493
pyomo
pyomo/contrib/pynumero/linalg/mumps_interface.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...
262
9,713
beam
sdks/python/apache_beam/utils/profiler.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...
181
5,853
metrics
src/torchmetrics/functional/image/vif.py
.py
# Copyright The PyTorch 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 i...
155
6,419
textual
docs/examples/styles/keyline.py
.py
from textual.app import App, ComposeResult from textual.containers import Grid from textual.widgets import Placeholder class KeylineApp(App): CSS_PATH = "keyline.tcss" def compose(self) -> ComposeResult: with Grid(): yield Placeholder(id="foo") yield Placeholder(id="bar") ...
20
488
sphinx
tests/roots/test-ext-autodoc/target/coroutine.py
.py
import asyncio from functools import wraps class AsyncClass: async def do_coroutine(self): """A documented coroutine function""" attr_coro_result = await _other_coro_func() @classmethod async def do_coroutine2(cls): """A documented coroutine classmethod""" pass @stati...
39
781
biopython
Bio/SCOP/Hie.py
.py
# Copyright 2001 by Gavin E. Crooks. All rights reserved. # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included as part of this # package. """Handle the SCOP HIErar...
107
2,963
gunicorn
tests/requests/valid/015.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. request = { "method": "GET", "uri": uri("/test"), "version": (1, 0), "headers": [ ("HOST", "0.0.0.0:5000"), ("USER-AGENT", "ApacheBench/2.3"), ("ACCEPT", "*/*") ], "b...
16
332
confluent-kafka-python
src/confluent_kafka/aio/producer/_buffer_timeout_manager.py
.py
# Copyright 2025 Confluent Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
144
5,820
pymc
pymc/logprob/__init__.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...
69
2,377
beam
sdks/python/apache_beam/examples/inference/online_clustering/write_data_to_pubsub_pipeline/setup.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...
43
1,567
onnxruntime
tools/python/cherry_pick.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """ Cherry-Pick Helper Script ------------------------- Description: This script automates the process of cherry-picking commits for a release branch. It fetches merged PRs with a specific label, sorts them by merge d...
319
11,535
black
tests/data/cases/fmtonoff5.py
.py
# Regression test for https://github.com/psf/black/issues/3129. setup( entry_points={ # fmt: off "console_scripts": [ "foo-bar" "=foo.bar.:main", # fmt: on ] # Includes an formatted indentation. }, ) # Regression test for https://github.com/psf/blac...
176
3,619
structlog
tests/processors/test_processors.py
.py
# SPDX-License-Identifier: MIT OR Apache-2.0 # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the MIT License. See the LICENSE file in the root of this # repository for complete details. from __future__ import annotations import functools import inspect import itertools import j...
767
23,777
bazel
examples/py_native/lib.py
.py
"""A tiny example binary for the native Python rules of Bazel.""" def GetNumber(): return 42
6
97
wandb
wandb/sdk/artifacts/_generated/artifact_created_by.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/artifacts/ from __future__ import annotations from typing import Annotated, Literal from pydantic import Field from wandb._pydantic import GQLResult, Typename from .fragments import RunInfoFragment class ArtifactCreatedBy(GQLResult): artifact: Ar...
35
788
coremltools
coremltools/converters/mil/mil/passes/defs/cleanup/expand_dynamic_linear.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 import numpy as np from coremltools.converters.mil.mil import Block from coremltools.converters.mil....
116
5,147
beam
sdks/python/apache_beam/transforms/enrichment_handlers/cloudsql_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...
620
21,925
beam
sdks/python/apache_beam/utils/timestamp_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...
446
19,844
probability
tensorflow_probability/python/distributions/chi2.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...
250
9,555
jupytext
tests/data/notebooks/outputs/ipynb_to_sphinx/plotly_graphs.py
.py
# --- # jupyter: # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- """ This notebook contains complex outputs, including plotly javascript graphs. """ ############################################################################### # # Interactive plots ####################...
30
782
pyomo
examples/mpec/munson1d.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...
34
1,106
wandb
wandb/sdk/lib/run_moment.py
.py
from __future__ import annotations from dataclasses import dataclass from urllib import parse @dataclass class RunMoment: """A moment in a run. Defines a branching point in a finished run to fork or resume from. A run moment is identified by a run ID and a metric value. Currently, only the metric '_...
82
2,388
biopython
Bio/codonalign/codonalignment.py
.py
# Copyright 2013 by Zheng Ruan (zruan1991@gmail.com). All rights reserved. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included as part of this # package. """Code...
518
18,231
mlflow
tests/store/artifact/test_cli.py
.py
import json import pathlib from unittest import mock import pytest from click.testing import CliRunner import mlflow from mlflow.entities import FileInfo from mlflow.store.artifact.cli import _file_infos_to_json, download_artifacts from mlflow.tracking.artifact_utils import _download_artifact_from_uri @pytest.fixtu...
140
5,083
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_repeatvector.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 TestKerasRepeatVector(CommonTF2LayerTest): def create_keras_repeatvector_net(self, input_names, input_shapes, input_type, n, ir...
36
1,488
pdm
src/pdm/installers/uninstallers.py
.py
from __future__ import annotations import abc import glob import os import shutil from collections.abc import Iterable from pathlib import Path from tempfile import TemporaryDirectory from typing import TYPE_CHECKING, NewType, cast from typing_extensions import Self from pdm import termui from pdm.exceptions import ...
313
12,164
pyro
pyro/contrib/conjugate/infer.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 from collections import defaultdict import torch import pyro.distributions as dist from pyro import poutine from pyro.distributions.util import sum_leftmost from pyro.poutine.messenger import Messenger from pyro.poutine.util impo...
245
9,073
astropy
astropy/io/fits/tests/test_uint.py
.py
# Licensed under a 3-clause BSD style license - see PYFITS.rst import platform import numpy as np import pytest from numpy.testing import assert_array_equal from astropy.io import fits from .conftest import FitsTestCase class TestUintFunctions(FitsTestCase): @classmethod def setup_class(cls): cls....
149
6,058
returns
returns/iterables.py
.py
from abc import abstractmethod from collections.abc import Callable, Iterable from typing import TypeVar, final from returns.interfaces.applicative import ApplicativeN from returns.interfaces.failable import FailableN from returns.primitives.hkt import KindN, kinded _FirstType = TypeVar('_FirstType') _SecondType = Ty...
429
12,735
saleor
saleor/plugins/sendgrid/__init__.py
.py
from dataclasses import dataclass @dataclass class SendgridConfiguration: api_key: str | None sender_name: str | None sender_address: str | None account_confirmation_template_id: str | None account_set_customer_password_template_id: str | None account_delete_template_id: str | None account...
24
914
astropy
astropy/timeseries/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This subpackage contains classes and functions for work with time series. """ from astropy.timeseries import io from astropy.timeseries.binned import * from astropy.timeseries.core import * from astropy.timeseries.downsample import * from astropy.tim...
13
391
pyomo
pyomo/mpec/plugins/solver2.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...
107
3,792
mlflow
examples/databricks/dbconnect.py
.py
""" python examples/databricks/dbconnect.py --cluster-id <cluster-id> """ import argparse from databricks.connect import DatabricksSession from databricks.sdk import WorkspaceClient from pyspark.sql.types import DoubleType from sklearn import datasets from sklearn.neighbors import KNeighborsClassifier import mlflow ...
57
1,532
hatch
src/hatch/cli/new/migrate.py
.py
import os import sys FILE = os.path.abspath(__file__) HERE = os.path.dirname(FILE) ENV_VAR_PREFIX = "_HATCHLING_PORT_ADD_" def _apply_env_vars(kwargs): from ast import literal_eval for key, value in os.environ.items(): if key.startswith(ENV_VAR_PREFIX): kwargs[key.replace(ENV_VAR_PREFIX,...
368
13,804
mlflow
mlflow/genai/scorers/phoenix/models.py
.py
from __future__ import annotations from mlflow.genai.scorers.llm_backend import ScorerLLMClient from mlflow.genai.scorers.phoenix.utils import _NoOpRateLimiter, check_phoenix_installed class MlflowPhoenixModel: """Phoenix model adapter backed by the shared scorer LLM client. Routes through native providers ...
48
1,459
onnxruntime
onnxruntime/test/python/quantization/test_op_matmulnbits_prepacked_cuda.py
.py
#!/usr/bin/env python # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # ---------------------------------------------------------------...
323
14,932
readthedocs.org
readthedocs/config/__init__.py
.py
"""Logic to parse and validate ``readthedocs.yaml`` file.""" import readthedocs.config.notifications # noqa from .config import * # noqa from .parser import * # noqa
7
171
astropy
astropy/units/tests/test_quantity_ufuncs.py
.py
# The purpose of these tests are to ensure that calling ufuncs with quantities # returns quantities with the right units, or raises exceptions. import concurrent.futures import dataclasses import warnings from collections.abc import Callable from typing import NamedTuple import numpy as np import pytest from erfa imp...
1,716
61,929
sphinx
tests/test_domains/test_domain_py_pyfunction.py
.py
"""Tests the Python Domain""" from __future__ import annotations import pytest from docutils import nodes from sphinx import addnodes from sphinx.addnodes import ( desc, desc_addname, desc_annotation, desc_content, desc_name, desc_optional, desc_parameter, desc_parameterlist, desc...
896
24,943
omegaconf
tests/test_select.py
.py
from contextlib import AbstractContextManager from typing import Any, Optional, Union from pytest import mark, param, raises, warns from omegaconf import DictConfig, ListConfig, MissingMandatoryValue, OmegaConf from omegaconf._impl import select_value from omegaconf._utils import _ensure_container from omegaconf.erro...
444
17,052
clearml
clearml/backend_api/session/jsonmodels/fields.py
.py
import datetime import re from typing import Union, List, Optional, Type, Iterable, Tuple, Any from weakref import WeakKeyDictionary from dateutil.parser import parse from .errors import ValidationError from .collections import ModelCollection # unique marker for "no default value specified". None is not good enough ...
469
14,259
mlflow
examples/evaluation/evaluate_with_qa_metrics.py
.py
import openai import pandas as pd import mlflow eval_df = pd.DataFrame({ "inputs": [ "What is MLflow?", "What is Spark?", "What is Python?", ], "ground_truth": [ "MLflow is an open-source platform for managing the end-to-end machine learning (ML) lifecycle. It was developed...
42
2,117
pyomo
pyomo/contrib/pynumero/sparse/block_matrix.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,340
46,322
coremltools
coremltools/test/optimize/coreml/test_passes.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 os import re import tempfile import cattrs import numpy as np import pytest imp...
3,860
139,904
wagtail
wagtail/documents/apps.py
.py
from django.apps import AppConfig from django.db.models import ForeignKey from django.utils.translation import gettext_lazy as _ from . import get_document_model, get_permission_policy class WagtailDocsAppConfig(AppConfig): name = "wagtail.documents" label = "wagtaildocs" verbose_name = _("Wagtail docume...
41
1,244
onnx
tests/python/shape_inference_test.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import contextlib from pathlib import Path from typing import TYPE_CHECKING, Any import numpy as np import pytest from google.protobuf import text_format import onnx.shape_inference from onnx import (...
13,531
496,001
lemur
lemur/notifications/models.py
.py
""" .. module: lemur.notifications.models :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 sqlalchemy.orm import relationship from sqlalchemy import Integer, String, Colu...
49
1,466
saleor
saleor/webhook/observability/obfuscation.py
.py
from typing import TYPE_CHECKING, Any, cast from graphql import ( GraphQLError, GraphQLInterfaceType, GraphQLObjectType, GraphQLSchema, get_default_backend, get_named_type, ) from graphql.language.ast import ( Field, FragmentDefinition, FragmentSpread, InlineFragment, Operat...
207
7,258
qutip
doc/conf.py
.py
# # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # import os import pathlib import warnings # -- General configuration ---------...
398
12,486
pyomo
examples/pyomobook/intro-ch/abstract5.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...
35
1,074
pyomo
pyomo/core/tests/unit/kernel/test_constraint.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...
2,073
67,776
saleor
saleor/graphql/product/tests/mutations/test_unassign_variant_media.py
.py
from graphql_relay import to_global_id from .....graphql.tests.utils import get_graphql_content from .....product.models import ProductMedia UNASSIGN_VARIANT_IMAGE_QUERY = """ mutation unassignVariantMediaMutation($variantId: ID!, $mediaId: ID!) { variantMediaUnassign(variantId: $variantId, mediaId: $medi...
57
1,838
saleor
saleor/tests/e2e/transactions/utils/__init__.py
.py
from .transaction_create import create_transaction from .transaction_event_report import transaction_event_report from .transaction_initialize import transaction_initialize __all__ = [ "create_transaction", "transaction_initialize", "transaction_event_report", ]
10
276
qutip
qutip/tests/core/test_qobj.py
.py
import numbers import operator import pytest import numpy as np import scipy.sparse import scipy.linalg import qutip from qutip.core import data as _data from qutip.core.dimensions import flatten @pytest.fixture(params=[_data.CSR, _data.Dense], ids=["CSR", "Dense"]) def datatype(request): return request.param ...
1,533
48,183
saleor
saleor/graphql/menu/tests/queries/test_menus_sorting.py
.py
import pytest from .....menu.models import Menu, MenuItem from ....tests.utils import get_graphql_content QUERY_MENU_WITH_SORT = """ query ($sort_by: MenuSortingInput!) { menus(first:5, sortBy: $sort_by) { edges{ node{ name } } ...
91
2,874
textual
docs/examples/how-to/center10.py
.py
from textual.app import App, ComposeResult from textual.containers import Center from textual.widgets import Static class CenterApp(App): """How to center things.""" CSS = """ Screen { align: center middle; } .words { background: blue 50%; border: wide white; widt...
31
617
gunicorn
tests/test_asgi_header_security.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ ASGI header security tests. Tests for header validation, normalization, and injection prevention to ensure secure HTTP header handling per ASGI 3.0 and RFC 9110/9112. """ import pytest from gunicorn.asgi.par...
374
11,545
saleor
saleor/graphql/shipping/mutations/delivery_options_calculate.py
.py
import graphene from ....checkout.delivery_context import fetch_shipping_methods_for_checkout from ....checkout.fetch import fetch_checkout_info, fetch_checkout_lines from ....webhook.event_types import WebhookEventSyncType from ...checkout import types as checkout_types from ...core.descriptions import ADDED_IN_323 f...
70
2,657
scikit-bio
skbio/io/_warning.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
20
604
gunicorn
tests/test_signal_integration.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Integration tests for arbiter signal handling. These tests start a real gunicorn process and verify signal handling works correctly with actual requests and signals. """ import os import signal import socket i...
228
6,995
metrics
tests/unittests/regression/test_log_cosh_error.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...
91
3,131
onnxruntime
orttraining/tools/scripts/performance_investigation.py
.py
import argparse import onnx parser = argparse.ArgumentParser(description="ONNX file analyzer for performance investigation.") parser.add_argument("onnx_file", type=str, help="ONNX file to analyze") args = parser.parse_args() def process_file(onnx_file): model = onnx.load(onnx_file) # Map from output arg to...
91
2,822
pyomo
pyomo/contrib/pynumero/asl.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...
467
17,181
onnxruntime
onnxruntime/python/tools/transformers/models/stable_diffusion/ort_optimizer.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- """ ONNX Model Optimizer for Stable Diffusion """ import gc import log...
137
5,717
luigi
test/other_module.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
836
wagtail
wagtail/tests/test_whitelist.py
.py
from django.test import TestCase from wagtail.test.utils import WagtailTestUtils from wagtail.whitelist import ( Whitelister, allow_without_attributes, attribute_rule, check_url, ) class TestCheckUrl(TestCase): def test_allowed_url_schemes(self): for url_scheme in ["", "http", "https", "f...
162
5,495
wandb
tests/unit_tests/test_automations/test_run_events.py
.py
from __future__ import annotations import json import operator from collections.abc import Iterable from typing import Any import pytest from hypothesis import given from hypothesis.strategies import DrawFn, SearchStrategy, composite, lists, sampled_from from pydantic import ValidationError from pytest import raises ...
775
27,058
probability
discussion/robust_inverse_graphics/saving_test.py
.py
# Copyright 2024 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...
51
1,682
mamba
libmambapy/tests/test_specs.py
.py
import copy import pytest import libmambapy def test_import_submodule(): import libmambapy.specs as specs # Dummy execution _p = specs.KnownPlatform.noarch def test_import_recursive(): import libmambapy as mamba # Dummy execution _p = mamba.specs.KnownPlatform.noarch def test_ParseErro...
1,006
31,348
voila
tests/app/template_custom_test.py
.py
# tests programmatic config of template system import os import pytest BASE_DIR = os.path.dirname(__file__) @pytest.fixture def voila_args_extra(): return ["--template=test_template", "--VoilaExecutor.timeout=240"] @pytest.fixture def voila_config(): def config(app): path_test_template = os.path.a...
35
947
kombu
t/unit/transport/test_pyamqp.py
.py
from __future__ import annotations import sys from itertools import count from unittest.mock import MagicMock, Mock, patch import pytest from kombu import Connection from kombu.transport import pyamqp def test_amqps_connection(): conn = Connection('amqps://') assert conn.transport # evaluate transport, do...
324
10,643
probability
tensorflow_probability/python/internal/backend/numpy/gen/linear_operator_block_diag.py
.py
# Copyright 2020 The TensorFlow Probability Authors. All Rights Reserved. # @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ # THIS FILE IS AUTO-GENERATED BY `gen_linear_operators.py`. # DO NOT MODIFY DIRECTLY. # @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...
855
35,254
onnx
onnx/reference/ops/op_matmul.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops._op import OpRunBinaryNum def numpy_matmul(a, b): """Implements a matmul product. See :func:`np.matmul`. Handles sparse matrices. """ try: ...
26
644
bazel
tools/ctexplain/analyses/summary.py
.py
# Copyright 2020 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
70
2,516
pyro
pyro/poutine/enum_messenger.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 from typing import Any, Dict, List, Optional import torch from typing_extensions import Self from pyro.distributions.torch import Categorical from pyro.distributions.torch_distribution import TorchDistributionMixin from pyro.ops....
255
10,711