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
mlflow
examples/demos/mlflow-3/deep_learning.py
.py
# # MLflow 3 Deep Learning Example # In this example, we will first run a model training job, which is tracked as an MLflow Run. # Every 10 epochs, we will store model checkpoints, which are tracked as MLflow Logged Models. # We will then select the best checkpoint for production deployment. import pandas as pd import ...
126
4,575
attrs
src/attrs/converters.py
.py
# SPDX-License-Identifier: MIT from attr.converters import * # noqa: F403
4
76
saleor
saleor/graphql/csv/tests/mutations/test_export_gift_cards.py
.py
from unittest.mock import ANY, patch import graphene import pytest from .....csv import ExportEvents from .....csv.error_codes import ExportErrorCode from .....csv.models import ExportEvent from ....tests.utils import get_graphql_content from ...enums import ExportScope, FileTypeEnum EXPORT_GIFT_CARDS_MUTATION = """...
381
9,912
returns
returns/pointfree/alt.py
.py
from collections.abc import Callable from typing import TypeVar from returns.interfaces.altable import AltableN from returns.primitives.hkt import Kinded, KindN, kinded _FirstType = TypeVar('_FirstType') _SecondType = TypeVar('_SecondType') _ThirdType = TypeVar('_ThirdType') _UpdatedType = TypeVar('_UpdatedType') _A...
57
1,589
onnx
onnx/backend/test/case/node/mean.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 class Mean(Base): @staticmethod def export() -> None: data_0...
48
1,367
conda
tests/cli/test_actions.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations from argparse import ArgumentParser from contextlib import nullcontext from typing import TYPE_CHECKING import pytest from conda.cli import actions from conda.cli.actions import NullCountAction from conda.co...
46
1,325
astropy
astropy/table/tests/test_masked.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test behavior related to masked tables""" import numpy as np import numpy.ma as ma import pytest from numpy.testing import assert_array_equal import astropy.units as u from astropy.table import Column, MaskedColumn, QTable, Table from astropy.table.co...
697
26,842
pyomo
pyomo/contrib/solver/solvers/knitro/utils.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...
271
9,811
qutip
qutip/tests/core/test_environment.py
.py
import pytest from importlib.util import find_spec from numbers import Number import numpy as np from scipy.integrate import quad_vec from qutip.utilities import n_thermal from qutip.core.environment import ( BosonicEnvironment, DrudeLorentzEnvironment, UnderDampedEnvironment, OhmicEnvironment, C...
1,528
56,398
probability
tensorflow_probability/python/layers/dense_variational_v2_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...
121
4,241
saleor
saleor/discount/tests/fixtures/__init__.py
.py
from .benchmark import * # noqa: F403 from .promotion import * # noqa: F403 from .promotion_rule import * # noqa: F403 from .voucher import * # noqa: F403
5
159
onnxruntime
onnxruntime/python/tools/quantization/onnx_model.py
.py
# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- from pathlib import Path import onnx import onnx.helper as onnx_helper...
601
23,928
wandb
wandb/integration/xgboost/xgboost.py
.py
"""xgboost init!""" from __future__ import annotations import json import warnings from collections.abc import Callable from pathlib import Path from typing import TYPE_CHECKING, NamedTuple, TypeAlias, cast import xgboost as xgb import xgboost.callback from typing_extensions import override import wandb from wandb....
207
6,891
pynacl
tests/test_pwhash.py
.py
# Copyright 2013 Donald Stufft and individual contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
679
19,376
django-cms
cms/test_utils/project/placeholderapp/models.py
.py
from functools import cached_property from django.db import models from django.urls import reverse from cms.models import ContentAdminManager from cms.models.fields import PlaceholderRelationField from cms.utils import get_language_from_request from cms.utils.placeholder import get_placeholder_from_slot from cms.util...
107
3,370
conda
tests/env/support/advanced-pip/module_to_install_in_editable_mode/setup.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from setuptools import setup setup( name="module_to_install_in_editable_mode", packages=[], )
9
178
wagtail
wagtail/test/context_processors.py
.py
def do_not_use_static_url(request): def exception(): raise Exception( "Do not use STATIC_URL in templates. Use the {% static %} templatetag (or {% versioned_static %} within admin templates) instead." ) return { "STATIC_URL": lambda: exception(), } CALL_COUNT = 0 def...
29
534
openvino
tests/layer_tests/tensorflow_tests/test_tf_TensorScatterAdd.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest rng = np.random.default_rng(872173) class TestTensorScatterAdd(CommonTFLayerTest): def _prepare_input(self, inputs_i...
88
3,813
biopython
Tests/test_GraphicsDistribution.py
.py
# Copyright 2001 by Brad Chapman. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Test the creation of graphics of distribution information. Provides tests for the Graphics.D...
88
2,677
saleor
saleor/graphql/shipping/utils.py
.py
from collections.abc import Iterable from typing import overload from django.core.exceptions import ValidationError from ...shipping import models from ..core.utils import from_global_id_or_error from .types import ShippingMethod, ShippingMethodType @overload def get_shipping_model_by_object_id( object_id: str,...
56
1,789
wandb
wandb/sdk/lib/wb_logging.py
.py
"""Logging configuration for the "wandb" logger. Most log statements in wandb are made in the context of a run and should be redirected to that run's log file (usually named 'debug.log'). This module provides a context manager to temporarily set the current run ID and registers a global handler for the 'wandb' logger ...
163
4,908
ipython
IPython/core/kitty.py
.py
# Implements https://sw.kovidgoyal.net/kitty/graphics-protocol/ from base64 import b64encode, b64decode import os import sys import warnings #: Set ``IPYTHON_KITTY_GRAPHICS`` to ``1``/``true`` or ``0``/``false`` to state #: outright whether the terminal speaks the kitty graphics protocol. Unset (or #: empty) autodete...
114
3,516
pyomo
examples/performance/dae/stochpdegas1_automatic.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...
457
13,697
onnxruntime
orttraining/tools/scripts/sqldb_to_tensors.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import sqlite3 import onnx from onnx import numpy_helper connection = sqlite3.connect("<path-to-sqldb-from-tracing>", detect_types=sqlite3.PARSE_DECLTYPES) def convert_tensor_proto_to_numpy_array(blob): tensor_proto =...
24
722
openvino
tests/e2e_tests/common/comparator/ssim.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import logging as log import sys import numpy as np from skimage.metrics import structural_similarity as ssim from .provider import ClassProvider from e2e_tests.common.comparator.threshold_utils import get_default_ssim_threshold class...
85
4,336
gunicorn
tests/dirty/test_client_streaming_async.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """Tests for dirty client async streaming functionality.""" import asyncio import struct import pytest from gunicorn.dirty.protocol import ( DirtyProtocol, BinaryProtocol, make_chunk_message, make...
264
8,454
pyomo
examples/pyomobook/dae-ch/dae_tester_model.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...
89
2,743
probability
tensorflow_probability/python/distributions/johnson_su_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...
591
23,098
pyomo
pyomo/contrib/gdp_bounds/plugins.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...
13
611
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/filter_multiple_arguments.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");...
73
2,270
jupytext
src/jupytext/stringparser.py
.py
"""A simple file parser that can tell whether the first character of a line is quoted or not""" from .languages import _COMMENT class StringParser: """A simple file parser that can tell whether the first character of a line is quoted or not""" single = None triple = None triple_start = None ...
86
2,427
beam
sdks/python/apache_beam/ml/transforms/embeddings/tensorflow_hub.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...
175
7,131
pyro
examples/contrib/timeseries/gp_models.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import argparse from os.path import exists from urllib.request import urlopen import numpy as np import torch import pyro from pyro.contrib.timeseries import IndependentMaternGP, LinearlyCoupledMaternGP # download dataset from ...
204
7,165
saleor
saleor/graphql/meta/tests/mutations/__init__.py
.py
PRIVATE_KEY = "private_key" PRIVATE_VALUE = "private_vale" PUBLIC_KEY = "key" PUBLIC_KEY2 = "key2" PUBLIC_VALUE = "value" PUBLIC_VALUE2 = "value2"
8
148
black
src/black/numerics.py
.py
""" Formatting numeric literals. """ from blib2to3.pytree import Leaf def format_hex(text: str) -> str: """ Formats a hexadecimal string like "0x12B3" """ before, after = text[:2], text[2:] return f"{before}{after.upper()}" def format_scientific_notation(text: str) -> str: """Formats a nume...
64
1,753
lemur
lemur/plugins/lemur_azure_dest/plugin.py
.py
""" .. module: lemur.plugins.lemur_azure_dest.plugin :platform: Unix :copyright: (c) 2019 :license: Apache, see LICENCE for more details. Plugin for uploading certificates and private key as secret to azure key-vault that can be pulled down by end point nodes. .. moduleauthor:: sirferl """ from f...
191
6,402
returns
tests/test_context/test_requires_context/test_context_equality.py
.py
from collections.abc import Callable from returns.context import RequiresContext def _same_function(some_arg: int) -> Callable[[float], float]: return lambda other: other / some_arg def test_equality() -> None: """Ensures that containers can be compared.""" assert RequiresContext(_same_function) == Req...
19
575
biopython
Bio/Align/sam.py
.py
# Copyright 2022 by Michiel de Hoon. 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. """Bio.Align support fo...
766
30,547
beam
sdks/python/apache_beam/dataframe/frames.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...
5,527
219,685
beam
sdks/python/apache_beam/examples/inference/pytorch_language_modeling.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...
223
8,537
saleor
saleor/graphql/attribute/mutations/validators.py
.py
from django.core.exceptions import ValidationError from ....attribute import models from ....attribute.error_codes import AttributeErrorCode def validate_value_is_unique(attribute: models.Attribute, value: models.AttributeValue): """Check if the attribute value is unique within the attribute it belongs to.""" ...
19
702
saleor
saleor/plugins/webhook/tests/test_transaction_process_session_webhook.py
.py
import json from decimal import Decimal from unittest import mock import graphene from freezegun import freeze_time from ....channel import TransactionFlowStrategy from ....core import EventDeliveryStatus from ....core.models import EventDelivery, EventPayload from ....payment.interface import ( PaymentGatewayDat...
734
20,792
coremltools
coremltools/converters/mil/mil/passes/tests/test_state_passes.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._deployment_compatibility import AvailableTarget...
317
10,542
saleor
saleor/webhook/__init__.py
.py
from ..core.telemetry import saleor_attributes, tracer def traced_payload_generator(func): def wrapper(*args, **kwargs): operation = f"{func.__name__}" with tracer.start_as_current_span(operation) as span: span.set_attribute(saleor_attributes.COMPONENT, "payloads") return f...
12
361
hydra
examples/instantiate/object/my_app.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from omegaconf import DictConfig import hydra from hydra.utils import instantiate, target_whitelist class DBConnection: def connect(self) -> None: ... class MySQLConnection(DBConnection): def __init__(self, host: str, user: str, passwor...
42
1,073
wandb
wandb/integration/sklearn/calculate/outlier_candidates.py
.py
from warnings import simplefilter import numpy as np import wandb from wandb.integration.sklearn import utils # ignore all future warnings simplefilter(action="ignore", category=FutureWarning) def outlier_candidates(regressor, X, y): # noqa: N803 # Fit a linear model to X and y to compute MSE regressor.fi...
70
1,946
tablib
src/tablib/_vendor/dbfpy/fields.py
.py
import datetime import struct from functools import total_ordering from . import utils __version__ = "$Revision: 1.14 $"[11:-2] __date__ = "$Date: 2009/05/26 05:16:51 $"[7:-2] __all__ = ["lookupFor"] # field classes added at the end of the module """DBF fields definitions. TODO: - make memos work """ """Histor...
475
14,560
sphinx
tests/roots/test-ext-napoleon/conf.py
.py
import sys from pathlib import Path sys.path.insert(0, str(Path.cwd().resolve())) extensions = ['sphinx.ext.napoleon']
7
121
gunicorn
tests/requests/valid/rfc9112_target_absolute_userinfo_01.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. # RFC 9112 section 3.2.2: absolute-form with userinfo and explicit port. request = { "method": "GET", "uri": uri("http://user:pass@example.com:8080/foo?q=1"), "version": (1, 1), "headers": [ ...
15
377
mlflow
dev/clint/tests/rules/test_empty_notebook_cell.py
.py
import json from pathlib import Path from clint.config import Config from clint.index import SymbolIndex from clint.linter import lint_file from clint.rules.empty_notebook_cell import EmptyNotebookCell def test_empty_notebook_cell(index: SymbolIndex) -> None: notebook_content = { "cells": [ {...
48
1,494
beam
sdks/python/apache_beam/coders/coders_property_based_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...
156
5,866
pyomo
pyomo/contrib/trustregion/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...
436
17,551
hatch
src/hatch/env/internal/build.py
.py
from __future__ import annotations from typing import Any def get_default_config() -> dict[str, Any]: return { "skip-install": True, "builder": True, "installer": "uv", }
12
206
cvxpy
cvxpy/tests/test_dgp.py
.py
import numpy as np import scipy.sparse as sp import cvxpy from cvxpy.tests.base_test import BaseTest class TestDgp(BaseTest): def test_product(self) -> None: x = cvxpy.Variable((), pos=True) y = cvxpy.Variable((), pos=True) prod = x * y self.assertTrue(prod.is_dgp()) self....
414
16,138
loguru
tests/exceptions/source/others/handler_formatting_with_context_manager.py
.py
import sys from loguru import logger logger.remove() logger.add( sys.stderr, format="{name} {file.name} {function} {line}", diagnose=False, backtrace=False, colorize=False, ) def a(): with logger.catch(): 1 / 0 a()
21
253
mkdocs-material
material/plugins/projects/structure/__init__.py
.py
# Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com> # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, c...
242
10,645
pyomo
examples/pyomobook/scripts-ch/warehouse_load_solutions.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...
44
1,432
conda
tests/test_link_order.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations from typing import TYPE_CHECKING import pytest if TYPE_CHECKING: from pathlib import Path from conda.testing.fixtures import TmpEnvFixture @pytest.mark.integration def test_link_order_post_link_ac...
29
600
pymc
pymc/variational/__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...
88
1,853
eve
tests/test_settings_env.py
.py
# -*- coding: utf-8 -*- # this is just a helper file which we are going # to try to load with environmental variable in # test_existing_env_config() test case DOMAIN = {"env_domain": {}}
8
189
kombu
kombu/asynchronous/__init__.py
.py
"""Event loop.""" from __future__ import annotations from kombu.utils.eventio import ERR, READ, WRITE from .hub import Hub, get_event_loop, set_event_loop __all__ = ('READ', 'WRITE', 'ERR', 'Hub', 'get_event_loop', 'set_event_loop')
10
237
jupytext
src/jupytext/myst.py
.py
""" This module contains round-trip conversion between myst formatted text documents and notebooks. """ import json import re import warnings from textwrap import dedent import nbformat as nbf import yaml from yaml.representer import SafeRepresenter from .cell_to_text import three_backticks_or_more from .metadata_fi...
423
14,922
beam
sdks/python/apache_beam/testing/benchmarks/chicago_taxi/tfdv_analyze_and_validate.py
.py
# Copyright 2019 Google LLC. 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
225
7,124
beam
sdks/python/apache_beam/typehints/schema_registry.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...
69
2,220
tqdm
tqdm/version.py
.py
"""`tqdm` version detector. Precedence: installed dist, git, 'UNKNOWN'.""" from importlib.metadata import PackageNotFoundError, version try: __version__ = version('tqdm') except PackageNotFoundError: __version__ = "UNKNOWN"
8
233
probability
tensorflow_probability/python/experimental/nn/variational_base.py
.py
# Copyright 2019 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...
237
7,602
mlflow
mlflow/data/evaluation_dataset.py
.py
import hashlib import json import logging import math import struct import sys from packaging.version import Version import mlflow from mlflow.entities import RunTag from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE from mlflow.utils.string_utils import gen...
565
20,783
readthedocs.org
readthedocs/core/apps.py
.py
"""App configurations for core app.""" import structlog from django.apps import AppConfig log = structlog.get_logger(__name__) class CoreAppConfig(AppConfig): name = "readthedocs.core" verbose_name = "Core" def ready(self): # Import `readthedocs.core.logs` to set up structlog import re...
23
587
coremltools
deps/protobuf/objectivec/DevTools/pddm_tests.py
.py
#! /usr/bin/python # # Protocol Buffers - Google's data interchange format # Copyright 2015 Google Inc. All rights reserved. # https://developers.google.com/protocol-buffers/ # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are ...
523
16,991
jupytext
tests/data/notebooks/outputs/ipynb_to_marimo/frozen_cell.py
.py
import marimo __generated_with = "0.17.8" app = marimo.App() @app.cell def _(): # This is an unfrozen cell. Works as usual. print("I'm a regular cell so I run and print!") return @app.cell def _(): # This is an frozen cell print("I'm frozen so Im not executed :(") return if __name__ == "_...
23
344
mlflow
tests/langchain/sample_code/langchain_chat_agent.py
.py
from operator import itemgetter from typing import Any, Generator from langchain_core.messages import AIMessage, AIMessageChunk from langchain_core.outputs import ChatGeneration, ChatGenerationChunk, ChatResult from langchain_core.prompts import ChatPromptTemplate from langchain_core.runnables import RunnableLambda fr...
104
3,032
scikit-bio
skbio/stats/tests/test_subsample.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. # --------------------------------------------...
219
8,940
probability
tensorflow_probability/python/experimental/auto_batching/gast_util.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...
75
2,125
scikit-bio
skbio/io/format/tests/test_base.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. # --------------------------------------------...
326
13,438
pyomo
pyomo/core/base/symbol_map.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...
61
2,408
metrics
src/torchmetrics/functional/regression/spearman.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...
127
4,723
openvino
tests/layer_tests/ovc_python_api_tests/test_ovc_tool_help.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import sys import unittest from openvino.tools.ovc import ovc from openvino.tools.ovc.cli_parser import get_mo_convert_params from pathlib import Path from common.utils.common_utils import shell class TestSubprocessMoConver...
31
1,000
confluent-kafka-python
tests/integration/schema_registry/_async/test_avro_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...
362
12,050
sphinx
sphinx/ext/doctest.py
.py
"""Mimic doctest in Sphinx. The extension automatically execute code snippets and checks their results. """ from __future__ import annotations import doctest import os.path import re import sys import time from io import StringIO from typing import TYPE_CHECKING from docutils import nodes from docutils.parsers.rst ...
665
24,608
mlflow
mlflow/tracing/__init__.py
.py
from mlflow.tracing.config import configure from mlflow.tracing.context import context from mlflow.tracing.databricks import set_databricks_monitoring_sql_warehouse_id from mlflow.tracing.display import disable_notebook_display, enable_notebook_display from mlflow.tracing.distributed import ( get_tracing_context_he...
36
1,149
onnxruntime
csharp/tools/ValidateNativeDelegateAttributes.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import argparse import pathlib def check_all_delegates_have_unmanaged_function_pointer_attribute(file: pathlib.Path): """ Check that all 'public delegate' declarations have a matching Unmanage...
63
2,336
textual
src/textual/_binary_encode.py
.py
""" An encoding / decoding format suitable for serializing data structures to binary. This is based on https://en.wikipedia.org/wiki/Bencode with some extensions. The following data types may be encoded: - None - int - bool - bytes - str - list - tuple - dict """ from __future__ import annotations from typing imp...
326
7,653
textual
tests/snapshot_tests/snapshot_apps/capture_print.py
.py
from textual.app import App, ComposeResult from textual import events from textual.widgets import RichLog class PrintLogger(RichLog): """A RichLog which captures printed text.""" def on_print(self, event: events.Print) -> None: self.write(event.text) class CaptureApp(App): def compose(self) -> ...
28
702
onnxruntime
onnxruntime/test/python/quantization/test_op_matmul_4bits.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. # ---------------------------------------------------------------...
603
26,513
saleor
saleor/app/manifest_schema.py
.py
import mimetypes from django.core.exceptions import ValidationError as DjangoValidationError from pydantic import BaseModel, ConfigDict, field_validator from pydantic.alias_generators import to_camel from pydantic_core import PydanticCustomError from ..thumbnail import ICON_MIME_TYPES from ..webhook.response_schemas....
143
4,335
sphinx
tests/roots/test-ext-autosummary/autosummary_class_module.py
.py
class Class: pass
3
22
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_multiply.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 TestKerasMultiply(CommonTF2LayerTest): def create_keras_multiply_net(self, input_names, input_shapes, input_type, ir_version): ...
93
4,903
probability
tensorflow_probability/python/math/psd_kernels/exp_sin_squared.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...
158
6,459
probability
tensorflow_probability/python/experimental/nn/initializers/initializers.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...
205
8,266
jupyterlab
jupyterlab/debuglog.py
.py
"""A mixin for adding a debug log file.""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import contextlib import logging import os import sys import tempfile import traceback import warnings from collections.abc import Iterator from typing import Protocol, cast ...
81
2,602
jupyterlab
scripts/milestone_check.py
.py
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. # Generate a GitHub token at https://github.com/settings/tokens # Invoke this script using something like: # python scripts/milestone_check.py import os import subprocess import sys import requests ranges = { "0...
249
6,786
kombu
t/unit/asynchronous/test_semaphore.py
.py
from __future__ import annotations from kombu.asynchronous.semaphore import LaxBoundedSemaphore class test_LaxBoundedSemaphore: def test_over_release(self) -> None: x = LaxBoundedSemaphore(2) calls: list[int] = [] for i in range(1, 21): x.acquire(calls.append, i) x.re...
44
1,141
mlflow
mlflow/protos/unity_catalog_prompt_service_pb2_grpc.py
.py
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! """Client and server classes corresponding to protobuf-defined services.""" import grpc import warnings import unity_catalog_prompt_messages_pb2 as unity__catalog__prompt__messages__pb2 GRPC_GENERATED_VERSION = '1.71.0' GRPC_VERSION = grpc.__versio...
786
35,387
beam
sdks/python/apache_beam/internal/set_pickler.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...
165
5,756
metrics
tests/unittests/text/test_squad.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...
121
4,461
saleor
saleor/graphql/discount/types/sales.py
.py
import graphene from graphene import relay from ....discount import DiscountValueType, models from ....permission.enums import DiscountPermissions from ....product.models import Category, Collection, Product, ProductVariant from ...channel.dataloaders.by_self import ChannelBySlugLoader from ...channel.types import Cha...
280
9,809
eve
examples/notifications.py
.py
# -*- coding: utf-8 -*- from __future__ import print_function """ Custom event notifications ~~~~~~~~~~~~~~~~~~~~~~~~~~ Flask supports callback functions via decorators such as `before_request` and `after_request`. Being a subclass of Flask, Eve supports this mechanism too, and it's pretty darn po...
45
1,244
mlflow
tests/store/_unity_catalog/model_registry/test_uc_native_credential_dispatch.py
.py
# Offline coverage for the UC-native artifact credential-dispatch and enrichment-converter arms # that a single (AWS, external-storage) live workspace does not exercise. # # These are the pieces that vary workspace-to-workspace: # * cloud-provider credential arms (AWS / Azure / GCP / R2) selected via TemporaryCredenti...
264
9,755
beam
sdks/python/apache_beam/transforms/userstate_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...
1,299
46,348
voila
tests/app/static_files_test.py
.py
import pytest import tornado from voila.static_file_handler import TemplateStaticFileHandler async def test_static_file_absolute_path(voila_app, app, base_url, http_server_client): response_lab = await http_server_client.fetch( f"{base_url}voila/templates/lab/static/voila.js" ) assert response_la...
59
2,186