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
pyomo
pyomo/contrib/incidence_analysis/tests/test_connected.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...
165
6,906
django-cms
cms/test_utils/project/pluginapp/plugins/multicolumn/models.py
.py
from cms.models import CMSPlugin class MultiColumns(CMSPlugin): """ A plugin that has sub Column classes """ def __str__(self): plugins = self.child_plugin_instances or [] return f"{len(plugins)} columns"
12
240
qutip
doc/guide/scripts/correlation_ex3.py
.py
import numpy as np import matplotlib.pyplot as plt import qutip N = 15 taus = np.linspace(0,10.0,200) a = qutip.destroy(N) H = 2 * np.pi * a.dag() * a # collapse operator G1 = 0.75 n_th = 2.00 # bath temperature in terms of excitation number c_ops = [np.sqrt(G1 * (1 + n_th)) * a, np.sqrt(G1 * n_th) * a.dag()] # sta...
34
980
pyro
pyro/poutine/infer_config_messenger.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 from typing import TYPE_CHECKING, Callable from pyro.poutine.messenger import Messenger if TYPE_CHECKING: from pyro.poutine.runtime import InferDict, Message class InferConfigMessenger(Messenger): """ Given a callab...
58
1,997
astropy
astropy/table/tests/test_info.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import warnings from collections import OrderedDict from copy import deepcopy from io import StringIO import numpy as np import pytest from astropy import coordinates, table, time from astropy import units as u from astropy.table.info import serialize_...
401
12,182
mlflow
examples/langchain/chain_stream_output.py
.py
import os from langchain.llms import OpenAI from langchain_core.output_parsers import StrOutputParser import mlflow # Ensure the OpenAI API key is set in the environment assert "OPENAI_API_KEY" in os.environ, "Please set the OPENAI_API_KEY environment variable." # Initialize the OpenAI model and the prompt template...
24
692
metrics
src/torchmetrics/audio/pit.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...
165
6,914
mlflow
tests/deployments/mlflow/test_mlflow.py
.py
from unittest import mock import pytest from mlflow.deployments import get_deploy_client from mlflow.deployments.mlflow import MlflowDeploymentClient from mlflow.environment_variables import MLFLOW_DEPLOYMENT_CLIENT_HTTP_REQUEST_TIMEOUT def test_get_deploy_client(): client = get_deploy_client("http://localhost:...
268
9,734
biopython
Bio/phenotype/pm_fitting.py
.py
# Copyright 2014-2016 by Marco Galardini. 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. """Growth curves f...
152
4,208
coremltools
coremltools/converters/mil/mil/passes/defs/cleanup/__init__.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from .const_deduplication import const_deduplication from .const_elimination import const_elimination...
17
824
astropy
astropy/visualization/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from .basic_rgb import * from .hist import * from .interval import * from .lupton_rgb import LuptonAsinhStretch, LuptonAsinhZscaleStretch, make_lupton_rgb from .mpl_normalize import * from .mpl_style import * from .stretch import * from .time import * fro...
13
363
httpie
httpie/output/writer.py
.py
import errno import requests from typing import Any, Dict, IO, Optional, TextIO, Tuple, Type, Union from ..cli.dicts import HTTPHeadersDict from ..context import Environment from ..models import ( HTTPRequest, HTTPResponse, HTTPMessage, RequestsMessage, RequestsMessageKind, OutputOptions, ) fro...
205
6,515
saleor
saleor/graphql/account/mutations/account/account_register.py
.py
import graphene from django.conf import settings from django.contrib.auth import password_validation from django.core.exceptions import ValidationError from django.db import IntegrityError, transaction from .....account import models from .....account.error_codes import AccountErrorCode from .....account.tasks import ...
296
10,720
kafka
tests/kafkatest/services/trogdor/files_unreadable_fault_spec.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 ...
47
2,083
confluent-kafka-python
tests/integration/schema_registry/data/proto/common_proto_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: tests/integration/schema_registry/data/proto/common_proto.proto """Generated protocol buffer code.""" from google.protobuf.internal import builder as _builder from google.protobuf import descriptor as _descriptor from google.pr...
45
2,749
openvino
tests/layer_tests/tensorflow_tests/test_tf_Tile.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest class TestTile(CommonTFLayerTest): def _prepare_input(self, inputs_info): assert 'input:0' in inputs_info ...
45
1,641
metrics
src/torchmetrics/classification/f_beta.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...
1,222
54,228
cvxpy
cvxpy/constraints/exponential.py
.py
""" Copyright 2013 Steven Diamond, 2022 - 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 agre...
410
14,204
astropy
astropy/units/errors.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Custom errors and exceptions for astropy.units.""" __all__ = [ "UnitConversionError", "UnitParserWarning", "UnitScaleError", "UnitTypeError", "UnitsError", "UnitsWarning", ] from astropy.utils.exceptions import AstropyWarning ...
54
1,199
openvino
tests/layer_tests/tensorflow_tests/test_tf_Reshape.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest class TestReshape(CommonTFLayerTest): def _prepare_input(self, inputs_info): assert 'tensor:0' in inputs_info...
95
3,832
gunicorn
tests/docker/asgi_framework_compat/frameworks/litestar_app/app.py
.py
""" Litestar ASGI Application for Compatibility Testing Implements the contract endpoints for ASGI 3.0 compliance testing. Litestar is a modern ASGI framework with extensive feature support. """ import asyncio import json import time from typing import Any, Dict from litestar import Litestar, Request, get, post from...
255
7,366
pyomo
pyomo/gdp/plugins/bilinear.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
7,478
beam
sdks/python/apache_beam/transforms/timestamped_value_type_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...
137
4,450
probability
tensorflow_probability/python/distributions/gaussian_process.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...
875
36,719
textual
tests/test_count_parameters.py
.py
from functools import partial from textual._callback import count_parameters def test_functions() -> None: """Test count parameters of functions.""" def foo(): ... def bar(a): ... def baz(a, b): ... # repeat to allow for caching for _ in range(3): assert count_parameters(foo) == 0 ...
58
1,377
wagtail
wagtail/locales/tests/test_admin_views.py
.py
from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType from django.contrib.messages import get_messages from django.contrib.messages.constants import ERROR from django.test import TestCase, override_settings from django.urls import reverse from wagtail import hooks...
394
13,765
mlflow
tests/claude_code/test_tracing.py
.py
import importlib import json import logging from pathlib import Path import pytest from claude_agent_sdk.types import ( AssistantMessage, ResultMessage, TextBlock, ToolResultBlock, ToolUseBlock, UserMessage, ) import mlflow import mlflow.claude_code.tracing as tracing_module from mlflow.claude...
906
30,720
openvino
tests/samples_tests/smoke_tests/test_hello_query_device.py
.py
""" Copyright (C) 2018-2026 Intel Corporation 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 w...
44
1,667
probability
tensorflow_probability/python/distributions/beta_binomial.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...
329
13,205
pyomo
examples/pyomo/radertext/Ex2_6b.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...
78
2,107
textual
tests/snapshot_tests/snapshot_apps/viewport_units.py
.py
from textual.app import App, ComposeResult from textual.widgets import Static class ViewportUnits(App): CSS = """Static {width: 100vw; height: 100vh; border: solid cyan;} """ def compose(self) -> ComposeResult: yield Static("Hello, world!") app = ViewportUnits() if __name__ == '__main__': app.r...
15
325
coremltools
coremltools/converters/mil/frontend/tensorflow2/test/test_v2_ops_tf_keras.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 import itertools import platform import random import numpy as np import pytest from packaging.versi...
1,793
61,829
mlflow
dev/clint/src/clint/rules/use_sys_executable.py
.py
import ast from clint.resolver import Resolver from clint.rules.base import Rule class UseSysExecutable(Rule): def _message(self) -> str: return ( "Use `[sys.executable, '-m', 'mlflow', ...]` when running mlflow CLI in a subprocess." ) @staticmethod def check(node: ast.Call, ...
35
1,105
saleor
saleor/csv/__init__.py
.py
class ExportEvents: """The different csv events types.""" EXPORT_PENDING = "export_pending" EXPORT_SUCCESS = "export_success" EXPORT_FAILED = "export_failed" EXPORT_DELETED = "export_deleted" EXPORTED_FILE_SENT = "exported_file_sent" EXPORT_FAILED_INFO_SENT = "Export_failed_info_sent" ...
35
970
onnxruntime
onnxruntime/test/testdata/gather_with_scalar_indices_then_shape.py
.py
from pathlib import Path import onnx from onnx import helper from onnx.onnx_pb import TensorProto nodes = [ helper.make_node("Gather", ["X", "indices"], ["Y"], axis=1), helper.make_node("Shape", ["Y"], ["Y_shape"]), ] graph = helper.make_graph( nodes, "GatherWithScalarIndicesThenShape", [ # inpu...
27
789
wagtail
wagtail/images/views/serve.py
.py
from django.core.exceptions import ImproperlyConfigured, PermissionDenied from django.http import FileResponse, HttpResponse from django.shortcuts import get_object_or_404, redirect from django.urls import reverse from django.utils.decorators import classonlymethod, method_decorator from django.views.decorators.cache i...
100
3,422
probability
tensorflow_probability/python/optimizer/proximal_hessian_sparse_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...
240
8,801
gunicorn
tests/docker/test_asgi_uwsgi/app.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """Simple ASGI test application for uWSGI protocol testing.""" async def app(scope, receive, send): """Simple ASGI application that echoes request info.""" if scope["type"] == "lifespan": while Tr...
50
1,482
saleor
saleor/graphql/core/const.py
.py
# Default value for list with limit argument DEFAULT_NESTED_LIST_LIMIT = 100
3
77
hydra
hydra/_internal/core_plugins/basic_sweeper.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved """ Basic sweeper can generate cartesian products of multiple input commands, each with a comma separated list of values. for example, for: python foo.py a=1,2,3 b=10,20 Basic Sweeper would generate 6 jobs: 1,10 1,20 2,10 2,20 3,10 3,20 The Basic ...
202
6,585
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_maxpool1D.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 TestKerasMaxPool1D(CommonTF2LayerTest): def create_keras_maxpool1D_net(self, input_names, input_shapes, input_type, pool_size, ...
71
3,771
returns
tests/test_result/test_result_failure.py
.py
import pytest from returns.primitives.exceptions import UnwrapFailedError from returns.result import Failure, Success def test_unwrap_success(): """Ensures that unwrap works for Success container.""" with pytest.raises(UnwrapFailedError): assert Success(5).failure() def test_unwrap_failure(): "...
16
411
probability
tensorflow_probability/python/sts/internal/seasonality_util.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...
250
9,405
mlflow
tests/genai/judges/utils/test_invocation_utils.py
.py
import json from unittest import mock import pytest from pydantic import BaseModel, Field from mlflow.entities.assessment import AssessmentSourceType from mlflow.entities.trace import Trace from mlflow.entities.trace_info import TraceInfo from mlflow.entities.trace_location import TraceLocation from mlflow.entities.t...
442
15,584
saleor
saleor/graphql/product/filters/product.py
.py
import django_filters import graphene from django.db.models import Exists, OuterRef from ....channel.models import Channel from ....product.models import ( CollectionProduct, Product, ProductChannelListing, ProductVariant, ProductVariantChannelListing, ) from ...channel.filters import get_channel_s...
446
15,748
pyomo
pyomo/contrib/mindtpy/tests/nonconvex3.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
2,786
deap
deap/tools/support.py
.py
from bisect import bisect_right from collections import defaultdict from copy import deepcopy from functools import partial from itertools import chain from operator import eq def identity(obj): """Returns directly the argument *obj*. """ return obj class History(object): """The :class:`History` cla...
653
26,498
confluent-kafka-python
tests/integration/serialization/test_serializers.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...
155
4,376
onnxruntime
onnxruntime/test/python/onnxruntime_test_python_compile_api.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from __future__ import annotations import os import platform import sys import unittest from collections.abc import Sequence import onnx from autoep_helper import AutoEpTestCase from helper import get_name, get_shared_librar...
515
22,564
saleor
saleor/plugins/webhook/tests/subscription_webhooks/filterable_webhooks/test_product_variant_discounted_price_updated.py
.py
import json from decimal import Decimal from unittest.mock import patch import graphene from django.test import override_settings from ......core.models import EventDelivery from ......graphql.webhook.subscription_query import SubscriptionQuery from ......product.interface import VariantDiscountedPriceChange from ......
213
6,744
django-cms
cms/utils/apphook_reload.py
.py
import logging import sys import uuid # Py2 and Py3 compatible reload from importlib import reload from threading import local from django.conf import settings from django.urls import clear_url_caches logger = logging.getLogger("cms") _urlconf_revision = {} _urlconf_revision_threadlocal = local() use_threadlocal =...
106
2,978
kombu
t/unit/utils/test_utils.py
.py
from __future__ import annotations import pytest from kombu import version_info_t from kombu.utils.text import version_string_as_tuple def test_dir(): import kombu assert dir(kombu) @pytest.mark.parametrize('version,expected', [ ('3', version_info_t(3, 0, 0, '', '')), ('3.3', version_info_t(3, 3, ...
23
609
openvino
tests/layer_tests/pytorch_tests/test_roll.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from pytorch_layer_test_class import PytorchLayerTest class TestRoll(PytorchLayerTest): def _prepare_input(self): return (self.random.uniform(0, 50, (2, 3, 4), dtype=np.float32),) def ...
44
1,292
openvino
tools/ovc/openvino/tools/ovc/telemetry_params.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 telemetry_params = { 'TID': "G-W5E9RNLD4H" }
7
132
astropy
astropy/io/ascii/mesa.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """mesa.py: Classes to read MESA stellar evolution code output files (history and profile). MESA (Modules for Experiments in Stellar Astrophysics) is a widely-used stellar evolution code. This reader handles the standard MESA history and profile file fo...
278
9,757
confluent-kafka-python
examples/share_consumer_avro.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2026 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...
162
6,002
wandb
tests/unit_tests/test_public_api/test_public_api.py
.py
import json import sys from types import SimpleNamespace from unittest import mock from unittest.mock import MagicMock import pytest import wandb from wandb import Api from wandb.apis._generated import ProjectFragment, UserFragment from wandb.errors import UsageError from wandb.proto import wandb_api_pb2 as apb from w...
615
20,609
probability
tensorflow_probability/python/distributions/batch_broadcast.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...
480
19,307
mlflow
tests/metrics/genai/test_genai_metrics.py
.py
import inspect import re from unittest import mock import numpy as np import pandas as pd import pytest from mlflow.exceptions import MlflowException from mlflow.metrics.genai import EvaluationExample, model_utils from mlflow.metrics.genai.genai_metric import ( _extract_score_and_justification, _format_args_s...
1,389
60,220
beam
sdks/python/apache_beam/ml/inference/huggingface_inference_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...
157
5,691
metrics
src/torchmetrics/retrieval/base.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...
192
8,043
mkdocs
mkdocs/structure/__init__.py
.py
from __future__ import annotations import abc from typing import TYPE_CHECKING, Iterable if TYPE_CHECKING: from mkdocs.structure.nav import Section class StructureItem(metaclass=abc.ABCMeta): """An item in MkDocs structure - see concrete subclasses Section, Page or Link.""" @abc.abstractmethod def ...
37
945
qutip
qutip/tests/core/test_ptrace.py
.py
import itertools import numpy as np import pytest import qutip from qutip.core import data as _data def expected(qobj, sel): if qobj.isbra or qobj.isket: qobj = qobj.proj() sel = sorted(sel) dims = [[x for i, x in enumerate(qobj.dims[0]) if i in sel]]*2 new_shape = (np.prod(dims[0], dtype=in...
152
5,216
coremltools
coremltools/converters/mil/frontend/tensorflow2/tf_graph_pass/rewrite_control_flow_functions.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 coremltools import _logger as logger from coremltools.converters.mil.frontend.tensorflow.basic_...
562
20,086
saleor
saleor/order/utils.py
.py
import logging from collections.abc import Iterable from datetime import datetime, timedelta from decimal import Decimal from typing import TYPE_CHECKING, Optional, cast import graphene from django.conf import settings from django.core.exceptions import ValidationError from django.db import transaction from django.db....
1,326
48,965
onnxruntime
cgmanifests/webgpu/validate_webgpu_cgmanifest.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """Validate WebGPU Component Governance manifest drift.""" from __future__ import annotations import json import re import sys from pathlib import Path from typing import Any REPO_ROOT = Path(__file...
166
6,244
pyomo
pyomo/contrib/gjh/GJH.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
9,799
beam
sdks/python/apache_beam/coders/coders.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...
1,915
56,124
mlflow
tests/tracking/request_auth/test_registry.py
.py
from importlib import reload from unittest import mock import pytest import mlflow.tracking.request_auth.registry from mlflow.tracking.request_auth.registry import RequestAuthProviderRegistry, fetch_auth def test_request_auth_provider_registry_register(): provider_class = mock.Mock() registry = RequestAuth...
94
3,388
astropy
astropy/cosmology/_src/flrw/lambdacdm.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst __all__ = ("FlatLambdaCDM", "LambdaCDM") from math import acos, cos, inf, sin, sqrt from numbers import Number import numpy as np from numpy import log from numpy.typing import ArrayLike, NDArray # isort: split from astropy.cosmology._src.core import d...
772
27,780
onnxruntime
onnxruntime/test/python/quantization/test_op_conv_transpose.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. # ---------------------------------------------------------------...
183
7,006
openvino
tests/layer_tests/onnx_tests/test_non_zero.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest pytest.importorskip("openvino.tools.mo", reason="Ticket - 157136") from common.layer_test_class import check_ir_version from common.onnx_layer_test_class import OnnxRuntimeLayerTest, onnx_make_model fro...
203
7,089
sqlmap
lib/utils/jwt.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import hashlib import hmac import json import re from lib.core.convert import decodeBase64 from lib.core.convert import encodeBase64 from lib.core.convert import getBytes from li...
155
6,580
readthedocs.org
readthedocs/audit/tests/test_models.py
.py
from django.contrib.auth.models import User from django.test import TestCase, override_settings from django_dynamic_fixture import get from readthedocs.audit.models import AuditLog from readthedocs.organizations.models import Organization, OrganizationOwner from readthedocs.projects.models import Project @override_s...
98
3,519
readthedocs.org
readthedocs/rtd_tests/tests/test_automation_rule_views.py
.py
import pytest from django.urls import reverse from django_dynamic_fixture import get from readthedocs.builds.constants import ( ALL_VERSIONS, BRANCH, CUSTOM_MATCH, TAG, ) from readthedocs.organizations.models import Organization from readthedocs.projects.models import AutomationRule, Project @pytest....
471
16,211
textual
src/textual/css/_error_tools.py
.py
from __future__ import annotations from typing import Iterable def friendly_list( words: Iterable[str], joiner: str = "or", omit_empty: bool = True ) -> str: """Generate a list of words as readable prose. >>> friendly_list(["foo", "bar", "baz"]) "'foo', 'bar', or 'baz'" Args: words: A l...
31
743
beam
sdks/python/apache_beam/testing/load_tests/pardo_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...
168
6,209
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_clip.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # clip paddle model generator # import numpy as np from save_model import saveModel import sys def clip(name: str, x, min, max): import paddle paddle.enable_static() with paddle.static.program_guard(paddle.static.Program(...
46
1,226
probability
tensorflow_probability/python/distributions/half_cauchy.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...
214
8,166
probability
spinoffs/fun_mc/fun_mc/api.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...
31
1,057
onnxruntime
onnxruntime/python/tools/quantization/operators/qdq_base_operator.py
.py
import itertools from ..quant_utils import QuantizedValue, QuantizedValueType, attribute_to_kwarg, quantize_nparray # noqa: F401 from .base_operator import QuantOperatorBase # noqa: F401 class QDQOperatorBase: def __init__(self, onnx_quantizer, onnx_node): self.quantizer = onnx_quantizer self.n...
23
801
luigi
luigi/contrib/esindex.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...
453
13,676
pyomo
pyomo/repn/tests/cpxlp/__init__.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
12
577
wandb
tools/perf/scripts/process_sar_helper.py
.py
import argparse import json import logging import subprocess from pathlib import Path logger = logging.getLogger(__name__) def pre_process_network_sar_log(log_dir: str) -> str: """This helper function pre-processes the network.dev.log. Parse out the metrics of the device we are interested in. i.e. eth0. ...
265
8,967
openvino
tests/layer_tests/pytorch_tests/test_transformer_encoder_layer.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest EMBED_DIM = 8 NUM_HEADS = 4 FFN_DIM = 16 SEQ_LENGTH = 6 BATCH_SIZE = 2 NO_MASK, ATTN_MASK, KEY_PAD_MASK, MERGED_MASK = -1, 0, 1, 2 def make_encoder_lay...
130
5,991
cvxpy
cvxpy/reductions/dcp2cone/canonicalizers/sigma_max_canon.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...
38
1,219
wandb
wandb/filesync/step_checksum.py
.py
"""Batching file prepare requests to our API.""" from __future__ import annotations import concurrent.futures import functools import os import queue import shutil import threading from typing import TYPE_CHECKING, NamedTuple, cast from wandb.filesync import step_upload from wandb.sdk.lib import filesystem, runid fr...
145
4,670
qutip
doc/guide/scripts/floquet_ex2.py
.py
import numpy as np from matplotlib import pyplot import qutip delta = 0.0 * 2*np.pi eps0 = 1.0 * 2*np.pi A = 0.25 * 2*np.pi omega = 1.0 * 2*np.pi T = 2*np.pi / omega tlist = np.linspace(0.0, 10 * T, 101) psi0 = qutip.basis(2,0) H0 = - delta/2.0 * qutip.sigmax() - eps0/2.0 * qutip.sigmaz() H1 = A/2.0 * q...
40
1,335
pyro
pyro/distributions/lkj.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import warnings import torch from pyro.distributions.torch import LKJCholesky, TransformedDistribution from pyro.distributions.transforms.cholesky import CorrMatrixCholeskyTransform from . import constraints class LKJCorrChole...
63
2,534
pyomo
pyomo/opt/results/solution.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...
222
8,127
beam
sdks/python/apache_beam/examples/complete/distribopt_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...
95
3,317
probability
tensorflow_probability/python/experimental/sequential/extended_kalman_filter_test.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 ...
206
8,527
mlflow
tests/tracing/test_otel_logging.py
.py
import gzip import time import zlib from pathlib import Path from typing import Iterator from unittest import mock import pytest import requests from opentelemetry import trace as otel_trace from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter from opentelemetry.proto.collector.trace.v1.t...
1,085
38,321
black
tests/data/cases/linelength6.py
.py
# flags: --line-length=6 # Regression test for #3427, which reproes only with line length <= 6 def f(): """ x """
7
126
astropy
astropy/units/tests/test_format.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Regression tests for the units.format package """ import re import warnings from collections.abc import Iterable from contextlib import nullcontext from fractions import Fraction from typing import NamedTuple import numpy as np import pytest from num...
1,238
40,665
saleor
saleor/graphql/product/filters/product_attributes.py
.py
import datetime import math from collections import defaultdict from typing import TypedDict from django.db.models import Exists, OuterRef, Q, QuerySet from graphql import GraphQLError from ....attribute import AttributeInputType from ....attribute.models import ( AssignedProductAttributeValue, AssignedVarian...
404
14,337
probability
tensorflow_probability/python/experimental/mcmc/initialization_test.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...
201
8,501
openvino
src/bindings/python/tests/test_graph/test_einsum.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import openvino.opset8 as ov import numpy as np import pytest from openvino.utils.types import get_element_type def einsum_op_check(input_shapes: list, equation: str, data_type: np.dtype, se...
88
3,023
clearml
examples/reporting/3d_plots_reporting.py
.py
# ClearML - Example of manual graphs and statistics reporting # import numpy as np from clearml import Task, Logger def report_plots(logger, iteration=0): # type: (Logger, int) -> None """ reporting plots to plots section :param logger: The task.logger to use for sending the plots :param iteratio...
65
1,665
mlflow
dev/clint/src/clint/rules/os_chdir_in_test.py
.py
import ast from clint.resolver import Resolver from clint.rules.base import Rule class OsChdirInTest(Rule): def _message(self) -> str: return "Do not use `os.chdir` in test directly. Use `monkeypatch.chdir` (https://docs.pytest.org/en/stable/reference/reference.html#pytest.MonkeyPatch.chdir)." @stat...
17
520