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
metrics
src/torchmetrics/functional/text/_deprecated.py
.py
import os from collections.abc import Sequence from typing import Any, Callable, List, Literal, Optional, Union import torch from torch import Tensor from torch.nn import Module from torchmetrics.functional.text.bert import bert_score from torchmetrics.functional.text.bleu import bleu_score from torchmetrics.function...
410
13,963
onnxruntime
onnxruntime/test/python/onnxruntime_test_float8.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # pylint: disable=C0116,W0212,R1720,C0103,C0114 import os import platform import sys import unittest import numpy as np import packaging.version as pv import parameterized from numpy.testing import assert_allclose from onnx ...
708
30,719
jupyterlab
packages/ui-components/examples/simple-windowed-list/main.py
.py
""" An example demonstrating a stand-alone windowed list. Copyright (c) Jupyter Development Team. Distributed under the terms of the Modified BSD License. Example ------- To run the example, see the instructions in the README to build it. Then run ``python main.py``. """ import json import os from jupyter_server....
80
2,598
saleor
saleor/payment/gateways/stripe/tests/test_plugin.py
.py
import warnings from unittest.mock import Mock, patch import pytest from django.core.exceptions import ValidationError from stripe.error import AuthenticationError, StripeError from stripe.stripe_object import StripeObject from .....plugins.models import PluginConfiguration from .... import TransactionKind from ....i...
1,637
54,903
astropy
astropy/io/registry/interface.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import inspect import os import pydoc import re import sys from .base import IORegistryError __all__ = ["UnifiedReadWrite", "UnifiedReadWriteMethod"] # ----------------------------------------------------------------------------- class UnifiedReadWr...
171
5,997
conda
conda/gateways/disk/__init__.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause import os import sys from errno import EACCES, EEXIST, ENOENT, ENOTEMPTY, EPERM, errorcode from logging import getLogger from os.path import basename, dirname, isdir from subprocess import CalledProcessError from time import sleep from ...commo...
116
3,575
returns
returns/_internal/pipeline/flow.py
.py
from functools import reduce from typing import TypeVar _InstanceType = TypeVar('_InstanceType') _PipelineStepType = TypeVar('_PipelineStepType') _ReturnType = TypeVar('_ReturnType') def flow( instance: _InstanceType, *functions: _PipelineStepType, ) -> _ReturnType: # type: ignore[type-var] """ Allo...
55
1,632
probability
spinoffs/inference_gym/inference_gym/targets/item_response_theory.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...
319
13,118
mlflow
tests/store/model_registry/test_sqlalchemy_store.py
.py
import concurrent.futures import shutil import time import uuid from pathlib import Path from unittest import mock import pytest from sqlalchemy import create_engine, text from mlflow.entities.model_registry import ( ModelVersion, ModelVersionTag, RegisteredModelTag, ) from mlflow.entities.model_registry....
2,540
97,722
pyomo
pyomo/contrib/parmest/graphics.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...
668
21,673
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/__init__.py
.py
import numpy as np from cvxpy.atoms.affine.add_expr import AddExpression from cvxpy.atoms.affine.binary_operators import (DivExpression, MulExpression, multiply,) from cvxpy.atoms.affine.sum import Sum from cvxpy.atoms.affine.trace import Trace from cvxpy.atoms.cumprod ...
226
9,740
mlflow
mlflow/store/db_migrations/versions/bd07f7e963c5_create_index_on_run_uuid.py
.py
"""create index on run_uuid Create Date: 2022-03-03 10:14:34.037978 """ from alembic import op # revision identifiers, used by Alembic. revision = "bd07f7e963c5" down_revision = "c48cb773bb87" branch_labels = None depends_on = None def upgrade(): # As a fix for https://github.com/mlflow/mlflow/issues/3785, cr...
25
589
saleor
saleor/graphql/account/mutations/staff/user_avatar_delete.py
.py
from typing import cast import graphene from .....account import models from .....permission.auth_filters import AuthorizationFilters from .....thumbnail import models as thumbnail_models from ....account.types import User from ....core import ResolveInfo from ....core.doc_category import DOC_CATEGORY_USERS from .......
32
1,091
onnxruntime
onnxruntime/test/testdata/test_data_generation/lr_scheduler/lr_scheduler_test_data_generator.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """This file is used to generate test data for LR scheduler optimizer tests in orttraining/orttraining/test/training_api/core/training_api_tests.cc.""" import inspect import logging import torch from torch.optim.lr_schedule...
136
4,870
saleor
saleor/tests/e2e/transactions/utils/transaction_event_report.py
.py
from ...utils import get_graphql_content TRANSACTION_EVENT_REPORT_MUTATION = """ mutation TransactionEventReport( $id: ID $type: TransactionEventTypeEnum! $amount: PositiveDecimal! $pspReference: String! $time: DateTime $externalUrl: String $message: String ...
104
2,594
confluent-kafka-python
examples/oauth_producer.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...
128
4,893
saleor
saleor/tests/e2e/account/utils/account_register.py
.py
from ...utils import get_graphql_content ACCOUNT_REGISTER_MUTATION = """ mutation AccountRegister($input: AccountRegisterInput!) { accountRegister(input: $input) { errors { field message code } requiresConfirmation user { id email isActive } } } """ def raw...
68
1,323
mlflow
mlflow/pyfunc/stdin_server.py
.py
import argparse import inspect import json import logging import sys from mlflow.pyfunc import scoring_server from mlflow.pyfunc.model import _log_warning_if_params_not_in_predict_signature _logger = logging.getLogger(__name__) logging.basicConfig(level=logging.INFO) parser = argparse.ArgumentParser() parser.add_arg...
45
1,362
beam
sdks/python/apache_beam/runners/worker/worker_id_interceptor.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...
73
2,830
mlflow
mlflow/tracing/utils/warning.py
.py
import functools import importlib import logging import warnings _logger = logging.getLogger(__name__) class LogDemotionFilter(logging.Filter): def __init__(self, module: str, message: str): super().__init__() self.module = module self.message = message def filter(self, record: loggi...
76
2,655
biopython
Bio/AlignIO/MafIO.py
.py
# Copyright 2011, 2012 by Andrew Sczesnak. All rights reserved. # Revisions Copyright 2011, 2017 by Peter Cock. All rights reserved. # Revisions Copyright 2014, 2015 by Adam Novak. All rights reserved. # Revisions Copyright 2015, 2017 by Blaise Li. All rights reserved. # # This file is part of the Biopython distrib...
870
35,258
textual
docs/examples/guide/input/key03.py
.py
from textual import events from textual.app import App, ComposeResult from textual.widgets import RichLog class KeyLogger(RichLog): def on_key(self, event: events.Key) -> None: self.write(event) class InputApp(App): """App to display key events.""" CSS_PATH = "key03.tcss" def compose(self)...
26
507
rq
rq/timeouts.py
.py
import ctypes import signal import threading class BaseTimeoutException(Exception): """Base exception for timeouts.""" pass class JobTimeoutException(BaseTimeoutException): """Raised when a job takes longer to complete than the allowed maximum timeout value. """ pass class HorseMonitorTi...
132
4,331
coremltools
coremltools/converters/sklearn/_standard_scaler.py
.py
# Copyright (c) 2017, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from coremltools import proto from ... import SPECIFICATION_VERSION from ..._deps import _HAS_SKLEARN ...
91
2,617
pyomo
examples/doc/samples/scripts/test_scripts.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...
70
2,231
pyomo
pyomo/contrib/cp/tests/test_step_function_expressions.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...
543
19,699
tablib
docs/conf.py
.py
# # Tablib documentation build configuration file, created by # sphinx-quickstart on Tue Oct 5 15:25:21 2010. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values hav...
231
7,557
probability
tensorflow_probability/python/experimental/mcmc/particle_filter_augmentation_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 ...
169
7,034
textual
tests/snapshot_tests/snapshot_apps/text_area_wrapping.py
.py
from textual.app import App, ComposeResult from textual.widgets import TextArea TEXT = """\ # The Wonders of Space Exploration Space exploration has *always* captured the human imagination. ダレンバーンズ \tThisissomelongtextthatshouldfoldcorrectly. \t\tダレン バーンズ """ class TextAreaWrapping(App): def compose(s...
32
534
sqlmap
tamper/uppercase.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.data import kb from lib.core.enums import PRIORITY __priority__ = PRIORITY.NORMAL def dependencies(): pass def tamper(payload, **kwargs): """ ...
49
1,099
pyomo
pyomo/contrib/pynumero/sparse/tests/test_mpi_block_vector.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,654
62,461
hatch
src/hatch/cli/env/__init__.py
.py
import click from hatch.cli.env.create import create from hatch.cli.env.find import find from hatch.cli.env.lock import lock from hatch.cli.env.prune import prune from hatch.cli.env.remove import remove from hatch.cli.env.run import run from hatch.cli.env.show import show @click.group(short_help="Manage project envi...
24
511
loguru
tests/exceptions/source/diagnose/no_error_message.py
.py
import sys from loguru import logger logger.remove() logger.add(sys.stderr, format="", colorize=True, backtrace=False, diagnose=True) def foo(): raise ValueError("") def bar(): foo() try: bar() except ValueError: logger.exception("")
21
258
pyomo
pyomo/contrib/mindtpy/global_outer_approximation.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 E...
111
4,623
mlflow
mlflow/assistant/providers/base.py
.py
from abc import ABC, abstractmethod from functools import lru_cache from pathlib import Path from typing import Any, AsyncGenerator, Callable, Literal from mlflow.assistant.config import AssistantConfig, ProviderConfig from mlflow.assistant.types import Event ClientToolDelivery = Literal["tool", "structured", "unsupp...
132
4,259
saleor
saleor/tests/e2e/product/test_should_create_variants_in_bulk.py
.py
import pytest from ..attributes.utils import attribute_create from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_permissions from .utils import ( create_category, create_product, create_product_channel_listing, create_product_type, create_variants_in_bulk, g...
163
5,396
hydra
tests/test_examples/test_basic_sweep.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from pathlib import Path from textwrap import dedent from typing import List from pytest import mark from hydra.test_utils.test_utils import ( assert_regex_match, chdir_hydra_root, run_python_script, ) chdir_hydra_root() @mark.param...
81
2,477
beam
sdks/python/apache_beam/yaml/yaml_utils_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...
220
5,795
pyomo
pyomo/contrib/alternative_solutions/obbt.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...
354
13,294
wandb
tests/system_tests/test_core/test_leet.py
.py
import subprocess from wandb.util import get_core_path def test_leet_help_smoke(): """Smoke test: verify leet binary works and shows help.""" core_path = get_core_path() # Run wandb-core leet --help result = subprocess.run( [core_path, "leet", "--help"], capture_output=True, ...
20
447
wandb
wandb/proto/v6/wandb_telemetry_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: wandb/proto/wandb_telemetry.proto # Protobuf Python Version: 6.30.0 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descri...
51
12,294
probability
spinoffs/inference_gym/inference_gym/targets/eight_schools.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...
154
5,656
mlflow
examples/sklearn_autolog/grid_search_cv.py
.py
from pprint import pprint import pandas as pd from sklearn import datasets, svm from sklearn.model_selection import GridSearchCV from utils import fetch_logged_data import mlflow def main(): mlflow.sklearn.autolog() iris = datasets.load_iris() parameters = {"kernel": ("linear", "rbf"), "C": [1, 10]} ...
41
1,183
qutip
qutip/solver/krylovsolve.py
.py
# Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations __all__ = ['krylovsolve'] from .. import QobjEvo, Qobj from .mesolve import mesolve from .result import Result from numpy.typing import ArrayLike from qutip.typing import QobjEvoLike from typing import Any, Callable def krylovso...
128
5,356
scikit-bio
skbio/metadata/tests/test_mixin.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. # --------------------------------------------...
119
4,518
wandb
tests/unit_tests/test_artifacts/test_wandb_artifacts.py
.py
from __future__ import annotations import functools import queue import shutil import unittest.mock as mock from collections.abc import Mapping from concurrent.futures import ThreadPoolExecutor from pathlib import Path from string import ascii_letters, digits from typing import TYPE_CHECKING, Any from unittest.mock im...
741
24,943
python-prompt-toolkit
examples/progress-bar/styled-rainbow.py
.py
#!/usr/bin/env python """ A simple progress bar, visualized with rainbow colors (for fun). """ import time from prompt_toolkit.output import ColorDepth from prompt_toolkit.shortcuts import ProgressBar from prompt_toolkit.shortcuts.progress_bar import formatters from prompt_toolkit.shortcuts.prompt import confirm de...
37
933
gunicorn
gunicorn/dirty/errors.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Dirty Arbiters Error Classes Exception hierarchy for dirty worker pool operations. """ class DirtyError(Exception): """Base exception for all dirty arbiter errors.""" def __init__(self, message, det...
181
6,401
beam
playground/frontend/playground_components/tools/extract_symbols_python/extract_symbols_python.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...
125
4,037
probability
tensorflow_probability/python/distributions/doublesided_maxwell_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...
150
5,409
sqlmap
plugins/dbms/firebird/enumeration.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.data import logger from plugins.generic.enumeration import Enumeration as GenericEnumeration class Enumeration(GenericEnumeration): def getDbs(self): wa...
39
1,079
openvino
tests/layer_tests/tensorflow_tests/test_tf_SparseFillEmptyRows.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(475912) class TestSparseFillEmptyRows(CommonTFLayerTest): def _prepare_input(self, input...
95
4,204
hatch
tests/cli/clean/test_clean.py
.py
import os import pytest from hatch.project.core import Project from hatchling.utils.constants import DEFAULT_BUILD_SCRIPT, DEFAULT_CONFIG_FILE pytestmark = [pytest.mark.usefixtures("mock_backend_process")] @pytest.mark.requires_internet def test(hatch, temp_dir, helpers, config_file, mock_plugin_installation): ...
88
2,565
pyfilesystem2
fs/copy.py
.py
"""Functions for copying resources *between* filesystem. """ from __future__ import print_function, unicode_literals import typing import warnings from .errors import IllegalDestination, ResourceNotFound from .opener import manage_fs from .path import abspath, combine, frombase, isbase, normpath from .tools import ...
539
18,574
gunicorn
tests/requests/valid/rfc9112_target_asterisk_options_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.4: asterisk-form, only valid with OPTIONS. request = { "method": "OPTIONS", "uri": uri("*"), "version": (1, 1), "headers": [ ("HOST", "example.com"), ], "body"...
15
329
biopython
Bio/HMM/__init__.py
.py
# 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. """A selection of Hidden Markov Model code."""
6
283
mlflow
dev/clint/src/clint/rules/lazy_module.py
.py
from clint.rules.base import Rule class LazyModule(Rule): def _message(self) -> str: return "Module loaded by `LazyLoader` must be imported in `TYPE_CHECKING` block."
7
181
pyomo
pyomo/solvers/tests/models/MILP_simple.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...
71
2,246
toolz
toolz/tests/test_inspect_args.py
.py
import functools import inspect import itertools import operator import sys import toolz from toolz.functoolz import (curry, is_valid_args, is_partial_args, is_arity, num_required_args, has_varargs, has_keywords) from toolz._signatures import builtins import toolz._signatures as _sigs from ...
505
16,539
luigi
luigi/contrib/sge.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...
338
13,385
conda
tests/core/test_solve.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations import copy import re import sys from importlib.metadata import version from pprint import pprint from typing import TYPE_CHECKING from unittest.mock import Mock, patch import archspec.cpu import pytest from...
4,148
159,098
pyomo
pyomo/contrib/appsi/tests/test_base.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...
101
3,663
saleor
saleor/discount/tests/test_utils/test_get_variants_to_promotions_map.py
.py
from decimal import Decimal import graphene from ....product.models import ProductVariant from ....product.utils.variants import fetch_variants_for_promotion_rules from ... import PromotionRuleInfo, RewardValueType from ...models import Promotion, PromotionRule from ...utils.promotion import get_variants_to_promotion...
158
5,015
voila
voila/voila_kernel_manager.py
.py
############################################################################# # Copyright (c) 2021, Voilà Contributors # # Copyright (c) 2021, QuantStack # # # # Distri...
462
19,132
openvino
tests/model_hub_tests/pytorch/test_lightglue.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import subprocess import sys import tempfile import pytest import torch from openvino import PartialShape from torch_utils import TestTorchConvertModel # To make tests reproducible we seed the random generator torch.manual_s...
73
2,531
saleor
saleor/graphql/core/validators/alias_count_limit_rule.py
.py
import logging from typing import Any from django.conf import settings from graphql import GraphQLError from graphql.language.ast import Field from graphql.validation.rules.base import ValidationRule from graphql.validation.validation import ValidationContext from ...metrics import record_graphql_alias_count logger ...
40
1,370
textual
docs/blog/snippets/2022-12-07-responsive-app-background-task/blocking02.py
.py
import asyncio import time from random import randint from textual.app import App, ComposeResult from textual.color import Color from textual.containers import Grid, VerticalScroll from textual.widget import Widget from textual.widgets import Footer, Label class ColourChanger(Widget): def on_click(self) -> None:...
45
1,015
mlflow
tests/autologging/test_autologging_behaviors_unit.py
.py
import logging import sys import threading import time import warnings from concurrent.futures import ThreadPoolExecutor from io import StringIO import numpy as np import pytest import mlflow from mlflow.utils.autologging_utils import autologging_integration, safe_patch from mlflow.utils.logging_utils import eprint ...
352
13,139
mlflow
mlflow/store/tracking/gateway/config_resolver.py
.py
""" Server-side only configuration resolver for Gateway endpoints. This module provides functions to retrieve decrypted endpoint configurations for resources. These functions are privileged operations that should only be called server-side and never exposed to clients via MlflowClient. """ import json from mlflow.ex...
255
9,707
pyro
pyro/contrib/examples/util.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import os import sys import torchvision.datasets as datasets from torch.utils.data import DataLoader from torchvision import transforms class MNIST(datasets.MNIST): mirrors = ["https://github.com/pyro-ppl/datasets/blob/maste...
85
2,479
beam
sdks/python/apache_beam/transforms/py_dataflow_distribution_counter.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...
158
4,851
jupytext
tests/data/notebooks/outputs/ipynb_to_script_vim_folding_markers/convert_to_py_then_test_with_update83.py
.py
# --- # jupyter: # jupytext: # cell_markers: '{{{,}}}' # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # {{{ # %%time print('asdf') # }}} # Thanks for jupytext!
20
218
beam
sdks/python/apache_beam/ml/transforms/base.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...
850
32,270
probability
tensorflow_probability/python/experimental/mcmc/potential_scale_reduction_reducer.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...
186
7,804
astropy
astropy/time/tests/test_methods.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import copy import warnings import numpy as np import pytest from numpy.testing import assert_array_equal import astropy.units as u from astropy.time import Time from astropy.time.utils import day_frac from astropy.utils import iers from astropy.utils.c...
811
33,993
astropy
astropy/stats/tests/test_spatial.py
.py
import numpy as np import pytest from numpy.testing import assert_allclose from astropy.stats.spatial import RipleysKEstimator from astropy.utils.misc import NumpyRNGContext a = np.array([[1, 4], [2, 5], [3, 6]]) b = np.array([[-1, 1], [-2, 2], [-3, 3]]) @pytest.mark.parametrize("points, x_min, x_max", [(a, 0, 10),...
138
5,473
probability
tensorflow_probability/python/sts/forecast_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...
413
17,069
openvino
tests/e2e_tests/common/postprocessors/YOLO.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import math import numpy as np from .provider import ClassProvider PRECOMPUTED_ANCHORS = { 'yolo_v2': [1.3221, 1.73145, 3.19275, 4.00944, 5.05587, 8.09892, 9.47112, 4.84053, 11.2364, 10.0071], 'tiny_yolo_v2': [1.08, 1.19, 3.42...
311
12,969
hatch
tests/helpers/templates/wheel/standard_editable_exact_force_include.py
.py
from hatch.template import File from hatch.utils.fs import Path from hatchling.__about__ import __version__ from hatchling.metadata.spec import DEFAULT_METADATA_VERSION from ..new.feature_no_src_layout import get_files as get_template_files from .utils import update_record_file_contents def get_files(**kwargs): ...
59
1,852
saleor
saleor/order/tests/webhooks/test_exclude_shipping_cache.py
.py
import json import uuid from decimal import Decimal from unittest import mock import graphene import pytest from measurement.measures import Weight from prices import Money from ....core.prices import quantize_price from ....shipping.interface import ShippingMethodData from ....shipping.webhooks.shared import CACHE_E...
255
7,786
astropy
astropy/io/votable/tests/test_ucd.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest from astropy.io.votable import ucd def test_none(): assert ucd.check_ucd(None) examples = { "phys.temperature": [("ivoa", "phys.temperature")], "pos.eq.ra;meta.main": [("ivoa", "pos.eq.ra"), ("ivoa", "meta.main")], "meta...
117
3,577
saleor
saleor/graphql/app/tests/queries/test_apps_pagination.py
.py
import pytest from .....app.models import App from ....tests.utils import get_graphql_content @pytest.fixture def apps_for_pagination(): apps = App.objects.bulk_create( [ App(name="Account1", is_active=True), App(name="AccountAccount1", is_active=True), App(name="Accou...
107
3,059
mlflow
mlflow/transformers/__init__.py
.py
"""MLflow module for HuggingFace/transformer support.""" from __future__ import annotations import ast import base64 import binascii import contextlib import copy import functools import importlib import json import logging import os import pathlib import re import shutil import string import sys from types import Ma...
3,236
142,668
wandb
tests/assets/notebooks/ipython_exit.py
.py
import wandb wandb.init()
4
27
onnxruntime
onnxruntime/test/testdata/custom_op_local_function/custom_op_test_local_function.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import os import sys import unittest import numpy as np import onnx from onnxruntime import InferenceSession, SessionOptions class TestOnnxToolsGraph(unittest.TestCase): def test_basic_all(self): if sys.platfor...
48
1,501
pymc
tests/distributions/test_shape_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...
635
24,982
textual
docs/examples/guide/widgets/checker03.py
.py
from __future__ import annotations from textual.app import App, ComposeResult from textual.geometry import Size from textual.strip import Strip from textual.scroll_view import ScrollView from rich.segment import Segment class CheckerBoard(ScrollView): COMPONENT_CLASSES = { "checkerboard--white-square", ...
65
1,915
confluent-kafka-python
tests/ducktape/producer_strategy.py
.py
""" Producer strategies for testing sync and async Kafka producers. This module contains strategy classes that encapsulate the different producer implementations (sync vs async) with consistent interfaces for testing. """ import asyncio import json import os import time import uuid from confluent_kafka import Produc...
582
25,472
saleor
saleor/graphql/csv/sorters.py
.py
import graphene from ..core.types import SortInputObjectType class ExportFileSortField(graphene.Enum): STATUS = ["status"] CREATED_AT = ["created_at"] UPDATED_AT = ["updated_at"] LAST_MODIFIED_AT = ["updated_at", "pk"] @property def description(self): # pylint: disable=no-member ...
40
1,587
scikit-bio
skbio/sequence/_grammared_sequence.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. # --------------------------------------------...
975
28,872
loguru
tests/exceptions/source/others/exception_formatting_generator.py
.py
import sys from loguru import logger logger.remove() logger.add(sys.stderr, format="", diagnose=False, backtrace=False, colorize=False) logger.add(sys.stderr, format="", diagnose=True, backtrace=False, colorize=False) logger.add(sys.stderr, format="", diagnose=False, backtrace=True, colorize=False) logger.add(sys.std...
23
495
pyomo
examples/pyomobook/mpec-ch/munson1.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...
27
1,021
readthedocs.org
readthedocs/search/api/v3/tests/test_queryparser.py
.py
from django.test import TestCase from readthedocs.search.api.v3.queryparser import SearchQueryParser class TestQueryParser(TestCase): def test_no_arguments(self): parser = SearchQueryParser("search query") parser.parse() arguments = parser.arguments self.assertEqual(arguments["pro...
87
3,530
pyomo
pyomo/contrib/fbbt/fbbt.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,618
58,041
mlflow
tests/dev/test_remove_experimental_decorators.py
.py
import subprocess import sys from pathlib import Path SCRIPT_PATH = "dev/remove_experimental_decorators.py" def test_script_with_specific_file(tmp_path: Path) -> None: test_file = tmp_path / "test.py" test_file.write_text(""" @experimental(version="1.0.0") def func(): pass """) output = subprocess.c...
207
4,789
conda
conda/plugins/virtual_packages/cuda.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Detect CUDA version.""" from __future__ import annotations import ctypes import functools import itertools import multiprocessing import os import platform import warnings from contextlib import suppress from typing import TYPE_CHECKING fr...
183
5,820
wagtail
wagtail/admin/api/actions/move.py
.py
import swapper from django.core.exceptions import ValidationError as DjangoValidationError from django.shortcuts import get_object_or_404 from rest_framework import fields, status from rest_framework.exceptions import ValidationError from rest_framework.response import Response from rest_framework.serializers import Se...
56
1,642
wandb
tests/system_tests/test_functional/test_util/test_util.py
.py
import pathlib import subprocess def test_util_import_adds_attribute_to_parent_module(): script = pathlib.Path(__file__).parent / "util_import_lazy.py" subprocess.check_call(["python", str(script)])
8
209
flit
flit_core/tests_core/samples/annotated_version/module1.py
.py
"""This module has a __version__ that has a type annotation""" __version__: str = '0.1'
5
90
coveragepy
coverage/context.py
.py
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/coveragepy/coveragepy/blob/main/NOTICE.txt """Determine contexts for coverage.py""" from __future__ import annotations from collections.abc import Sequence from types import FrameType from coverage.type...
75
2,434