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
coremltools
coremltools/converters/mil/mil/types/type_bool.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 .annotate import annotate, class_annotate, delay_type from .type_spec import Type @class_annot...
50
1,230
mlflow
tests/pyfunc/docker/test_docker.py
.py
import difflib import os import shutil from dataclasses import dataclass from pathlib import Path from unittest import mock import pytest import sklearn import sklearn.neighbors from packaging.version import Version import mlflow from mlflow.environment_variables import _MLFLOW_RUN_SLOW_TESTS from mlflow.models impor...
158
5,415
onnx
onnx/backend/test/case/model/gradient.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.model import expect from onnx.defs import AI_ONNX_PREVIEW_TRAINING_DOMAIN, ONNX_DOMAIN class Gra...
111
4,010
mlflow
dev/clint/tests/rules/test_docstring_param_order.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.docstring_param_order import DocstringParamOrder def test_docstring_param_order(index: SymbolIndex) -> None: code = """ # Bad def f(x: int, y: str) -> ...
32
803
onnxruntime
onnxruntime/test/python/quantization/bench_matmul_2bits.py
.py
#!/usr/bin/env python # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- """ Benchmark for MatMulNBits 2-bit dequantization...
321
11,069
wagtail
wagtail/admin/rich_text/converters/html_to_contentstate.py
.py
import re from html.parser import HTMLParser import swapper from wagtail.admin.rich_text.converters.contentstate_models import ( Block, ContentState, Entity, EntityRange, InlineStyleRange, ) from wagtail.admin.rich_text.converters.html_ruleset import HTMLRuleset from wagtail.rich_text import featu...
450
17,923
beam
sdks/python/apache_beam/examples/inference/multi_language_inference/multi_language_custom_transform/multi_language_custom_transform/__init__.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 ...
15
781
openvino
tests/layer_tests/pytorch_tests/test_quantized_cat.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class aten_quantized_cat(torch.nn.Module): def __init__(self, scale, zero_point, dtype): super().__init__(...
150
5,460
kombu
t/unit/transport/test_zookeeper.py
.py
from __future__ import annotations import pytest from kombu import Connection from kombu.transport import zookeeper pytest.importorskip('kazoo') class test_Channel: def setup_method(self): self.connection = self.create_connection() self.channel = self.connection.default_channel def create_...
38
1,071
saleor
saleor/tests/e2e/orders/utils/order_discount_delete.py
.py
from saleor.graphql.tests.utils import get_graphql_content ORDER_DISCOUNT_DELETE_MUTATION = """ mutation OrderDiscountDelete($discountId: ID!){ orderDiscountDelete(discountId: $discountId){ errors { message field } order { errors { message field } id to...
95
1,625
openvino
tests/layer_tests/pytorch_tests/test_matmul.py
.py
import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestMatMulOperation(PytorchLayerTest): def _prepare_input(self, matrix, vector): return matrix, vector def create_model(self): class CustomMatMulOperation(torch.nn.Module): de...
43
1,559
saleor
saleor/account/tests/fixtures/user.py
.py
from typing import Any import pytest from ....account.models import Group, User, UserManager from ....permission.enums import get_permissions from .customer_type import get_or_create_default_customer_type def dangerously_get_or_create_superuser( email: str, password: str | None = None, **extra_fields: Any ) -> ...
159
5,025
textual
tests/select/test_empty_select.py
.py
import pytest from textual.app import App from textual.widgets import Select from textual.widgets.select import EmptySelectError async def test_empty_select_is_ok_with_blanks(): class SelectApp(App[None]): def compose(self): yield Select([]) app = SelectApp() async with app.run_test(...
54
1,546
black
tests/data/cases/type_aliases.py
.py
# flags: --minimum-version=3.12 type A=int type Gen[T]=list[T] type Alias[T]=lambda: T type And[T]=T and T type IfElse[T]=T if T else T type One = int; type Another = str class X: type InClass = int type = aliased print(type(42)) # output type A = int type Gen[T] = list[T] type Alias[T] = lambda: T type And[T] = T ...
31
458
pyomo
pyomo/contrib/parmest/examples/reactor_design/timeseries_data_example.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
80
2,571
pyomo
pyomo/core/staleflag.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...
72
2,894
mlflow
mlflow/store/model_registry/__init__.py
.py
# Path to default location for backend when using local FileStore. DEFAULT_LOCAL_FILE_AND_ARTIFACT_PATH = "./mlruns" SEARCH_REGISTERED_MODEL_MAX_RESULTS_DEFAULT = 100 SEARCH_REGISTERED_MODEL_MAX_RESULTS_THRESHOLD = 1000 # Some backends have a low maximum results threshold; for example, Databricks only allows # `max_re...
11
605
toolz
toolz/tests/test_recipes.py
.py
from toolz import first, identity, countby, partitionby def iseven(x): return x % 2 == 0 def test_countby(): assert countby(iseven, [1, 2, 3]) == {True: 1, False: 2} assert countby(len, ['cat', 'dog', 'mouse']) == {3: 2, 5: 1} assert countby(0, ('ab', 'ac', 'bc')) == {'a': 2, 'b': 1} def test_part...
28
820
beam
playground/infrastructure/datastore_client.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 ...
407
15,540
probability
spinoffs/inference_gym/inference_gym/targets/banana.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...
157
5,334
onnx
onnx/backend/test/case/node/logsoftmax.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect def logsoftmax(x: np.ndarray, axis: int = -1) -> np.ndarray: x_max = np....
93
2,773
coveragepy
lab/parse_all.py
.py
"""Parse every Python file in a tree.""" import os import sys from coverage.parser import PythonParser for root, dirnames, filenames in os.walk(sys.argv[1]): for filename in filenames: if filename.endswith(".py"): filename = os.path.join(root, filename) print(f":: {filename}") ...
19
524
lemur
lemur/__init__.py
.py
""" .. module: lemur :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> .. moduleauthor:: Curtis Castrapel <ccastrapel@netflix.com> .. moduleauthor:: Hossein Shafagh <hshafagh@netf...
189
5,792
pyomo
pyomo/util/tests/test_check_units.py
.py
# -*- coding: utf-8 -*- # ____________________________________________________________________________________ # # 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 En...
320
12,102
coremltools
coremltools/converters/mil/mil/ops/defs/coreml_dialect/ops.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from coremltools.converters.mil.mil import types from coremltools.converters.mil.mil.input_type impor...
68
1,980
metrics
src/torchmetrics/functional/regression/wmape.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...
85
2,615
saleor
saleor/graphql/payment/utils.py
.py
from typing import TYPE_CHECKING, Optional from django.core.exceptions import ValidationError from ...page.models import PageType from ...payment import models as payment_models if TYPE_CHECKING: from ...account.models import User from ...app.models import App def deprecated_metadata_contains_empty_key(met...
95
3,019
textual
src/textual/widgets/_text_area.py
.py
from __future__ import annotations import dataclasses import re from collections import defaultdict from dataclasses import dataclass from functools import lru_cache from pathlib import Path from typing import TYPE_CHECKING, ClassVar, Iterable, Optional, Sequence, Tuple from rich.console import RenderableType from ri...
2,799
102,337
black
tests/data/miscellaneous/string_quotes.py
.py
'''''' '\'' '"' "'" "\"" "Hello" "Don't do that" 'Here is a "' 'What\'s the deal here?' "What's the deal \"here\"?" "And \"here\"?" """Strings with "" in them""" '''Strings with "" in them''' '''Here's a "''' '''Here's a " ''' '''Just a normal triple quote''' f"just a normal {f} string" f'''This is a triple-quoted {f}...
115
2,363
mlflow
mlflow/agent/setup/select.py
.py
from __future__ import annotations import os import select import sys import click if sys.platform != "win32": import termios import tty def _read_key() -> str: """Read a single keystroke (or escape sequence) from stdin in raw mode.""" fd = sys.stdin.fileno() old = termios.tcgetattr(fd) try...
95
3,034
mlflow
tests/genai/utils/test_message_utils.py
.py
from enum import Enum import pydantic import pytest from mlflow.genai.utils.message_utils import ( _enforce_strict_json_schema, pydantic_to_response_format, serialize_messages_to_prompts, ) from mlflow.types.llm import ChatMessage, FunctionToolCallArguments, ToolCall @pytest.mark.parametrize( ("mess...
289
9,820
pyomo
pyomo/core/kernel/tuple_container.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...
161
5,294
pyomo
examples/dae/simulator_ode_example.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
97
2,900
hydra
tests/test_config_search_path.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import os from os.path import realpath from typing import List, Optional, Tuple from pytest import mark from hydra._internal.config_search_path_impl import ConfigSearchPathImpl from hydra._internal.utils import compute_search_path_dir from hydra.c...
183
6,122
saleor
saleor/graphql/account/tests/mutations/customer_type/test_customer_type_update.py
.py
from unittest.mock import patch import graphene from ......account.error_codes import CustomerTypeUpdateErrorCode from ......account.models import CustomerType from .....tests.utils import assert_no_permission, get_graphql_content CUSTOMER_TYPE_UPDATE_MUTATION = """ mutation CustomerTypeUpdate($id: ID!, $input: ...
297
8,790
hydra
tests/defaults_list/test_defaults_tree.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import re from textwrap import dedent from typing import Any, Dict, List, Optional from omegaconf import OmegaConf from pytest import mark, param, raises from hydra.core.default_element import ( ConfigDefault, DefaultsTreeNode, GroupDe...
3,631
122,189
openvino
tools/ovc/openvino/tools/ovc/__main__.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import sys from openvino.tools.ovc.main import main from openvino.tools.ovc.telemetry_utils import init_ovc_telemetry init_ovc_telemetry() sys.exit(main())
11
241
metrics
src/torchmetrics/functional/audio/dnsmos.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...
292
11,843
probability
tensorflow_probability/python/stats/kendalls_tau.py
.py
# Copyright 2020 The TensorFlow Probability 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 require...
103
4,159
mlflow
mlflow/genai/agent_server/server.py
.py
import argparse import functools import inspect import json import logging import os import posixpath from typing import Any, AsyncGenerator, Callable, Literal, ParamSpec, TypeVar import httpx import uvicorn from fastapi import FastAPI, HTTPException, Request from fastapi.responses import Response, StreamingResponse ...
439
17,247
sqlmap
thirdparty/termcolor/termcolor.py
.py
# coding: utf-8 # Copyright (c) 2008-2011 Volvox Development Team # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy...
174
5,246
cvxpy
cvxpy/reductions/dcp2cone/canonicalizers/quantum_rel_entr_canon.py
.py
import numpy as np import cvxpy as cp from cvxpy import Variable from cvxpy.atoms.affine.kron import kron from cvxpy.constraints import OpRelEntrConeQuad from cvxpy.utilities.solver_context import SolverInfo def quantum_rel_entr_canon(expr, args, solver_context: SolverInfo | None = None): X, Y = args n = X.s...
30
1,099
sqlmap
plugins/dbms/vertica/syntax.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.convert import getOrds from plugins.generic.syntax import Syntax as GenericSyntax class Syntax(GenericSyntax): @staticmethod def escape(expression, quote=Tr...
23
688
mlflow
mlflow/protos/unity_catalog_prompt_messages_pb2.py
.py
import google.protobuf from packaging.version import Version if Version(google.protobuf.__version__).major >= 5: # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: unity_catalog_prompt_messages.proto # Protobuf Python Version: 5.26.0 """Generated protocol buffer code...
444
34,735
readthedocs.org
readthedocs/api/v2/views/proxied.py
.py
from readthedocs.core.mixins import ProxiedAPIMixin from readthedocs.core.utils.extend import SettingsOverrideObject from readthedocs.embed.views import EmbedAPI class ProxiedEmbedAPIBase(ProxiedAPIMixin, EmbedAPI): pass class ProxiedEmbedAPI(SettingsOverrideObject): _default_class = ProxiedEmbedAPIBase
12
317
pyomo
pyomo/contrib/parmest/scenariocreator.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...
184
6,267
sqlmap
plugins/dbms/mssqlserver/enumeration.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import re from lib.core.agent import agent from lib.core.common import arrayizeValue from lib.core.common import getLimitRange from lib.core.common import isInferenceAvailable fr...
447
18,168
beam
examples/notebooks/notebook_test_scripts/testlib.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...
66
1,960
saleor
saleor/graphql/order/tests/queries/test_draft_order_with_where.py
.py
import datetime import graphene import pytest from django.utils import timezone from freezegun import freeze_time from .....account.models import Address from .....order import ( OrderAuthorizeStatus, OrderChargeStatus, OrderEvents, OrderStatus, ) from .....order.models import Order, OrderEvent, Order...
1,943
59,245
conda
tests/models/test_package_info.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from conda.base.context import context from conda.models.channel import Channel from conda.models.enums import FileMode, PathEnum from conda.models.package_info import Noarch, PackageInfo, PackageMetadata from conda.models.records import Package...
55
1,926
kafka
tests/kafkatest/services/performance/producer_performance.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 ...
171
7,925
httpie
httpie/output/lexers/metadata.py
.py
import pygments from httpie.models import ELAPSED_TIME_LABEL from httpie.output.lexers.common import precise SPEED_TOKENS = { 0.45: pygments.token.Number.SPEED.FAST, 1.00: pygments.token.Number.SPEED.AVG, 2.50: pygments.token.Number.SPEED.SLOW, } def speed_based_token(lexer, match, ctx): try: ...
60
1,672
onnx
onnx/reference/ops/aionnx_preview_training/op_momentum.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from onnx.reference.ops.aionnx_preview_training._op_run_training import OpRunTraining def _apply_momentum(r, t, x, g, v, norm_coefficient, alpha, beta): # Add gradient of regularization term. g...
83
2,467
pyomo
pyomo/common/tests/test_env.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...
106
5,467
coremltools
coremltools/proto/Identity_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: Identity.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _message from goo...
36
1,206
qutip
qutip/tests/core/data/test_linalg.py
.py
import qutip.settings as settings import numpy as np import scipy import pytest import qutip import warnings from qutip.core import data as _data from qutip.core.data import Data, Dense, CSR, Dia skip_no_mkl = pytest.mark.skipif( not settings.has_mkl, reason="mkl not available" ) class TestSolve(): def op_...
158
5,238
readthedocs.org
readthedocs/projects/utils.py
.py
"""Utility functions used by projects.""" import csv import structlog from django.http import StreamingHttpResponse from django.utils.http import content_disposition_header log = structlog.get_logger(__name__) class Echo: """ A class that implements just the write method of the file-like interface. T...
38
1,045
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_prelu.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 TestKerasPReLU(CommonTF2LayerTest): def create_keras_prelu_net(self, input_names, input_shapes, input_type, shared_axes, ...
65
3,119
hydra
hydra/experimental/callbacks.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import logging import pickle from pathlib import Path from typing import Any from omegaconf import DictConfig from hydra.core.utils import JobReturn, JobStatus from hydra.experimental.callback import Callback class LogJobReturnCallback(Callback...
61
2,336
ipython
docs/autogen_api.py
.py
#!/usr/bin/env python """Script to auto-generate our API docs. """ import os import sys pjoin = os.path.join here = os.path.abspath(os.path.dirname(__file__)) sys.path.append(pjoin(os.path.abspath(here), 'sphinxext')) from apigen import ApiDocWriter source = pjoin(here, 'source') #********************************...
70
2,408
sphinx
tests/test_ext_intersphinx/test_ext_intersphinx.py
.py
"""Test the intersphinx extension.""" from __future__ import annotations import http.server import time from typing import TYPE_CHECKING from unittest import mock import pytest from docutils import nodes from sphinx import addnodes from sphinx._cli.util.errors import strip_escape_sequences from sphinx.builders.html...
946
36,174
ipython
tests/test_timing.py
.py
"""Tests for IPython.utils.timing.""" import pytest from IPython.utils.timing import clock, clock2, timing, timings, timings_out def test_clock_returns_float(): t = clock() assert isinstance(t, float) assert t >= 0.0 def test_clock2_returns_two_floats(): u, s = clock2() assert isinstance(u, fl...
87
1,976
probability
tensorflow_probability/python/distributions/joint_distribution_util.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...
109
5,393
mkdocs
mkdocs/config/base.py
.py
from __future__ import annotations import functools import logging import os import sys import warnings from collections import UserDict from contextlib import contextmanager from typing import ( IO, TYPE_CHECKING, Any, Generic, Iterator, List, Mapping, Sequence, Tuple, TypeVar,...
393
13,159
metrics
src/torchmetrics/detection/helpers.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...
798
36,145
flit
flit/build.py
.py
"""flit build - build both wheel and sdist""" from contextlib import contextmanager import logging import os from pathlib import Path import tarfile from tempfile import TemporaryDirectory from types import SimpleNamespace import sys from .config import read_flit_config, ConfigError from .sdist import SdistBuilder fr...
63
2,249
openvino
src/bindings/python/src/openvino/opset4/__init__.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino.opset1.ops import absolute from openvino.opset1.ops import absolute as abs from openvino.opset1.ops import acos from openvino.opset4.ops import acosh from openvino.opset1.ops import add from openvino...
145
6,086
confluent-kafka-python
src/confluent_kafka/avro/serializer/__init__.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...
38
1,034
biopython
Tests/test_codonalign.py
.py
# Copyright (C) 2013 by Zheng Ruan (zruan1991@gmail.com) # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Unit tests for the Bio.codonalign modules.""" import tempfile import unittest import warnin...
477
17,567
wagtail
wagtail/admin/rich_text/editors/draftail/__init__.py
.py
import json import warnings from django.core.serializers.json import DjangoJSONEncoder from django.forms import Media, widgets from django.utils.functional import cached_property from wagtail.admin.rich_text.converters.contentstate import ContentstateConverter from wagtail.admin.staticfiles import versioned_static fr...
110
3,607
hypercorn
tests/e2e/test_httpx.py
.py
from __future__ import annotations import httpx # type: ignore import pytest import trio import hypercorn.trio from hypercorn.config import Config from hypercorn.typing import ASGIReceiveCallable, ASGISendCallable, Scope async def app(scope, receive, send) -> None: # type: ignore assert scope["type"] == "http...
106
2,876
gunicorn
tests/requests/valid/compat_obs_fold.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. from gunicorn.http.errors import ObsoleteFolding from gunicorn.config import Config cfg = Config() cfg.set('permit_obsolete_folding', True) request = { "method": "GET", "uri": uri("/"), "version": (1,...
21
427
probability
tensorflow_probability/python/distributions/gaussian_process_regression_model.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...
833
38,682
astropy
astropy/utils/masked/tests/test_functions.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test numpy functions and ufuncs on Masked arrays and quantities. The tests here are fairly detailed but do not aim for complete coverage. Complete coverage of all numpy functions is done with less detailed tests in test_function_helpers. """ # We gen...
631
26,436
luigi
luigi/contrib/simulate.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...
113
3,407
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/combineperkey_simple.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");...
61
1,723
gunicorn
gunicorn/asgi/unreader.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Async version of gunicorn/http/unreader.py for ASGI workers. Provides async reading with pushback buffer support. """ import io class AsyncUnreader: """Async socket reader with pushback buffer support. ...
136
4,121
mlflow
mlflow/store/artifact/cli.py
.py
import logging import click from mlflow.artifacts import download_artifacts as _download_artifacts from mlflow.store.artifact.artifact_repository_registry import get_artifact_repository from mlflow.tracking import _get_store from mlflow.utils.proto_json_utils import message_to_json _logger = logging.getLogger(__name...
142
5,375
metrics
tests/unittests/nominal/test_pearson.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...
126
4,694
pyomo
doc/OnlineDocs/src/data/ex.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...
21
717
saleor
saleor/tests/e2e/checkout/test_logged_customer_is_unable_to_buy_more_products_than_the_limit_per_customer.py
.py
import pytest from ..product.utils import ( create_category, create_product, create_product_channel_listing, create_product_type, create_product_variant, create_product_variant_channel_listing, ) from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_permissions...
130
3,506
biopython
Bio/SearchIO/__init__.py
.py
# Copyright 2012 by Wibowo Arindrarto. 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. """Biopython interface...
685
29,177
probability
tensorflow_probability/python/internal/backend/numpy/gen/linear_operator_addition.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. # @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...
474
17,552
textual
src/textual/widgets/_header.py
.py
"""Provides a Textual application header widget.""" from __future__ import annotations from datetime import datetime from rich.text import Text from textual.app import ComposeResult, RenderResult from textual.content import Content from textual.dom import NoScreen from textual.events import Click, Mount from textua...
229
6,299
mlflow
tests/protos/test_message_pb2.py
.py
import google.protobuf from packaging.version import Version if Version(google.protobuf.__version__).major >= 5: # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: test_message.proto # Protobuf Python Version: 5.26.0 """Generated protocol buffer code.""" from googl...
167
12,459
hatch
tests/cli/fmt/test_fmt.py
.py
from __future__ import annotations import pytest from hatch.config.constants import ConfigEnvVars from hatch.project.core import Project FMT_DEPRECATION_WARNING = ( "The `hatch fmt` command is deprecated and will be removed in a future release." " Use `hatch check code --fix` for linting and `hatch check fmt...
975
34,295
saleor
saleor/checkout/tests/fixtures/checkout_with_discount.py
.py
from decimal import Decimal import graphene import pytest from prices import Money from ....discount import DiscountType, DiscountValueType, RewardType, RewardValueType from ....discount.models import CheckoutDiscount, CheckoutLineDiscount, Promotion from ....plugins.manager import get_plugins_manager from ....produc...
245
7,802
textual
tests/snapshot_tests/snapshot_apps/pretty_grid_gutter_interaction.py
.py
"""App used as regression test for https://github.com/Textualize/textual/pull/4219.""" from __future__ import annotations from textual.app import App, ComposeResult from textual.containers import Grid from textual.widgets import Pretty, Label class MyGrid(Grid): """A simple grid with 2 columns and 2 rows.""" ...
42
864
luigi
luigi/__init__.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...
158
4,070
readthedocs.org
readthedocs/vcs_support/base.py
.py
"""Base classes for VCS backends.""" import os import structlog from readthedocs.core.utils.filesystem import safe_rmtree from readthedocs.doc_builder.exceptions import BuildCancelled from readthedocs.doc_builder.exceptions import BuildUserError from readthedocs.projects.exceptions import RepositoryError log = str...
146
4,585
probability
tensorflow_probability/python/distributions/poisson.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...
494
19,336
onnxruntime
tools/ci_build/github/android/build_aar_package.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import argparse import json import os import pathlib import shutil import subprocess import sys SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) REPO_DIR = os.path.normpath(os.path.join(SCRIPT_...
270
11,176
pyomo
pyomo/core/kernel/piecewise_library/transforms.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,312
44,992
coremltools
coremltools/proto/NonMaximumSuppression_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: NonMaximumSuppression.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _mes...
53
3,058
pymc
pymc/logprob/utils.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...
328
11,044
mlflow
tests/store/artifact/test_local_artifact_repo.py
.py
import io import json import os import pathlib import posixpath import stat from unittest import mock import pytest from opentelemetry.sdk.trace import ReadableSpan as OTelReadableSpan from mlflow.entities.span import Span, SpanAttributeKey from mlflow.entities.trace_data import TraceData from mlflow.exceptions impor...
683
26,418
coremltools
coremltools/converters/mil/frontend/tensorflow2/ssa_passes/test_v2_passes.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 copy import numpy as np from coremltools.converters.mil.mil import Builder as mb from coreml...
55
1,850
wagtail
wagtail/actions/copy_page.py
.py
import logging import uuid import swapper from django.core.exceptions import PermissionDenied from modelcluster.models import get_all_child_relations from wagtail.actions.base import BaseAction from wagtail.log_actions import log from wagtail.signals import page_published logger = logging.getLogger("wagtail") clas...
386
14,580
wandb
wandb/sdk/artifacts/_generated/enums.py
.py
# Generated by ariadne-codegen # Source: core/api/graphql/schemas/schema-latest.graphql from __future__ import annotations from enum import Enum class ArtifactCollectionState(str, Enum): DELETED = "DELETED" READY = "READY" class ArtifactCollectionType(str, Enum): PORTFOLIO = "PORTFOLIO" SEQUENCE =...
23
442
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/regex_matches.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");...
64
1,976