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/sklearn_logistic_regression/train.py
.py
import numpy as np from sklearn.linear_model import LogisticRegression import mlflow import mlflow.sklearn from mlflow.models import infer_signature if __name__ == "__main__": X = np.array([-2, -1, 0, 1, 2, 1]).reshape(-1, 1) y = np.array([0, 0, 1, 1, 1, 0]) lr = LogisticRegression() lr.fit(X, y) ...
20
642
cvxpy
cvxpy/reductions/dnlp2smooth/canonicalizers/kl_div_canon.py
.py
""" Copyright 2025 CVXPY developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softwa...
26
906
mlflow
mlflow/pyfunc/loaders/__init__.py
.py
import mlflow.pyfunc.loaders.chat_agent # noqa: F401 import mlflow.pyfunc.loaders.chat_model # noqa: F401 import mlflow.pyfunc.loaders.code_model # noqa: F401 import mlflow.pyfunc.loaders.responses_agent # noqa: F401
5
221
metrics
tests/unittests/bases/test_saving_loading.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...
51
2,002
pyfilesystem2
fs/osfs.py
.py
"""Manage the filesystem provided by your OS. In essence, an `OSFS` is a thin layer over the `io` and `os` modules of the Python standard library. """ from __future__ import absolute_import, print_function, unicode_literals import sys import typing import errno import io import itertools import logging import os im...
690
26,101
trivy
pkg/fanal/analyzer/language/c/conan/testdata/cacheDir_v2/p/zlib41bd3946e7341/e/conanfile.py
.py
from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, load, replace_in_file, save from conan.tools.scm import Version import os required_conan_version = ">=1.53.0" class ZlibConan(ConanFile):...
111
4,185
pyomo
examples/pyomo/suffixes/gurobi_ampl_iis.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...
66
2,369
mlflow
dev/check_skills.py
.py
import re import sys from pathlib import Path from typing import Any import yaml # https://agentskills.io/specification#frontmatter NAME_RE = re.compile(r"^[a-z0-9]+(-[a-z0-9]+)*$") NAME_MAX = 64 DESCRIPTION_MAX = 1024 def parse_frontmatter(text: str) -> dict[str, Any] | None: if not text.startswith("---\n"): ...
69
2,015
openvino
src/bindings/python/src/openvino/utils/decorators.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from functools import wraps from inspect import signature from typing import Any, Optional, Union, get_origin, get_args from collections.abc import Callable from openvino import Node, Output from openvino.utils.t...
162
6,341
hatch
release/unix/make_scripts_portable.py
.py
from __future__ import annotations import sys import sysconfig from io import BytesIO from pathlib import Path def main(): interpreter = Path(sys.executable).resolve() # https://github.com/indygreg/python-build-standalone/blob/20240415/cpython-unix/build-cpython.sh#L812-L813 portable_shebang = b'#!/bin/...
50
1,393
saleor
saleor/graphql/discount/mutations/bulk_mutations.py
.py
import graphene from django.conf import settings from django.core.exceptions import ValidationError from django.db import transaction from django.db.models import OuterRef, Subquery from ....discount import models from ....discount.error_codes import DiscountErrorCode from ....discount.models import VoucherCode from ....
193
7,258
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_sum.py
.py
from __future__ import print_function import sys import numpy as np import paddle from save_model import saveModel def sum_(name: str, input): paddle.enable_static() with paddle.static.program_guard(paddle.static.Program(), paddle.static.Program()): data = paddle.static.data('data', shape=input.shape...
71
2,823
kafka
tests/setup.py
.py
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
56
2,077
qutip
qutip/tests/solver/heom/test_heom.py
.py
""" Tests for qutip.solver.heom. """ from qutip.solver.heom import ( BathExponent, Bath, BosonicBath, DrudeLorentzBath, DrudeLorentzPadeBath, UnderDampedBath, FermionicBath, LorentzianBath, LorentzianPadeBath, heomsolve, HEOMSolver, HEOMResult, HSolverDL, Hierarc...
46
1,006
conda
conda/plugins/subcommands/doctor/health_checks/environment_txt.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Health check: Environment listed in environments.txt.""" from __future__ import annotations from logging import getLogger from pathlib import Path from typing import TYPE_CHECKING from .....base.constants import OK_MARK, X_MARK from .....c...
87
2,769
onnxruntime
docs/python/_common/onnx_sphinx.py
.py
# pylint: disable=C0103,C0415,R0912,R0913,R0914,R0915 """ Automates the generation of ONNX operators. """ import importlib import inspect import keyword import os import re import sys import textwrap from difflib import Differ import numpy as np import onnx from onnx.backend.test.case.base import _Exporter from onnx....
900
29,135
pyomo
pyomo/contrib/pynumero/examples/mumps_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...
79
2,817
saleor
saleor/graphql/meta/tests/mutations/test_shop.py
.py
from unittest import mock import graphene from django.contrib.sites.models import Site from ....shop.types import SHOP_ID from ....tests.utils import get_graphql_content from . import PRIVATE_KEY, PRIVATE_VALUE, PUBLIC_KEY, PUBLIC_VALUE from .test_delete_metadata import ( execute_clear_public_metadata_for_item, ...
177
5,133
onnxruntime
onnxruntime/python/tools/transformers/models/whisper/whisper_chain.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- import ...
335
14,904
beam
sdks/python/apache_beam/examples/wordcount_dataframe.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...
30
1,069
pyomo
doc/OnlineDocs/src/data/table7.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...
20
776
mlflow
mlflow/genai/scorers/builtin_scorers.py
.py
import copy import inspect import json import logging import math import re from abc import abstractmethod from dataclasses import asdict, dataclass from typing import TYPE_CHECKING, Any, Literal import pydantic if TYPE_CHECKING: from mlflow.genai.utils.type import FunctionCall from mlflow.types.llm import Ch...
3,673
130,749
saleor
saleor/tests/e2e/taxes/utils/tax_country_configuration_update.py
.py
from ...utils import get_graphql_content TAX_COUNTRY_CONFIGURATION_UPDATE_MUTATION = """ mutation TaxCountryConfigurationUpdate($countryCode: CountryCode!, $updateTaxClassRates: [TaxClassRateInput!]!) { taxCountryConfigurationUpdate( countryCode: $countryCode updateTaxClassRates: $updateTaxClassRates ) { ...
58
1,248
openvino
tests/layer_tests/pytorch_tests/test_topk.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestTopK(PytorchLayerTest): def _prepare_input(self): return (self.input_tensor,) def create_model(self, k, dim, largest, sort): import ...
65
1,902
sphinx
tests/roots/test-ext-viewcode/spam/mod2.py
.py
"""mod2""" def decorator(f): return f @decorator def func2(a, b): """this is func2""" return a, b @decorator class Class2: """this is Class2"""
17
166
pyomo
examples/pyomobook/gdp-ch/verify_scont.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...
62
1,975
saleor
saleor/graphql/product/mutations/product/product_media_create.py
.py
import graphene from django.core.exceptions import ValidationError from .....permission.enums import ProductPermissions from .....product import ProductMediaTypes, models from .....product.error_codes import ProductErrorCode from .....product.tasks import fetch_product_media_image_task from ....core import ResolveInfo...
129
4,857
beam
sdks/python/apache_beam/runners/portability/flink_runner_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...
433
16,006
loguru
tests/exceptions/source/diagnose/unprintable_object.py
.py
import sys from loguru import logger logger.remove() logger.add(sys.stderr, format="", colorize=True, backtrace=False, diagnose=True) class Object: def __repr__(self): raise RuntimeError("No way!") try: obj = Object() obj + 1 / 0 except ZeroDivisionError: logger.exception("")
19
307
pyomo
examples/performance/misc/bilinear2_100000.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...
31
1,050
onnxruntime
orttraining/orttraining/python/training/utils/hooks/merge_activation_summary.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- """ This merges convergence debugging per activation summary files into...
156
5,536
wandb
wandb/proto/v7/wandb_api_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: wandb/proto/wandb_api.proto # Protobuf Python Version: 7.34.0 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_p...
167
21,566
readthedocs.org
readthedocs/core/utils/users.py
.py
from django.contrib.auth.models import User def get_user_by_username_or_email(username_or_email): """Get a user by their username or email address.""" # SECURITY: Check for email address if the username contains an "@" symbol, # to prevent fetching a user with an username that matches # the email addr...
14
596
wagtail
wagtail/models/specific.py
.py
from django.contrib.contenttypes.models import ContentType from django.db.models import DEFERRED from django.utils.functional import cached_property class SpecificMixin: """ Mixin for models that support multi-table inheritance and provide a ``content_type`` field pointing to the specific model class, to ...
129
5,652
onnxruntime
orttraining/tools/scripts/pipeline_model_split.py
.py
import os import sys # noqa: F401 import onnx from onnx import OperatorSetIdProto, TensorProto, helper # noqa: F401 # Edge that needs to be cut for the split. # If the edge is feeding into more than one nodes, and not all the nodes belong to the same cut, # specify those consuming nodes that need to be cut class ...
410
15,126
coremltools
coremltools/converters/mil/mil/ops/defs/iOS18/states.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...
44
1,357
saleor
saleor/graphql/menu/tests/mutations/test_menu_create.py
.py
import json from unittest import mock import graphene import pytest from django.core.exceptions import ValidationError from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....core.utils.json_serializer import CustomJsonEncoder from .....menu.models import Menu from .....produc...
204
6,100
pdm
src/pdm/cli/commands/init.py
.py
from __future__ import annotations import argparse import sys from typing import TYPE_CHECKING, Any, cast from pdm import termui from pdm.cli.commands.base import BaseCommand from pdm.cli.hooks import HookManager from pdm.cli.options import skip_option from pdm.cli.templates import ProjectTemplate from pdm.exceptions...
334
14,887
scikit-optimize
skopt/callbacks.py
.py
"""Monitor and influence the optimization procedure via callbacks. Callbacks are callables which are invoked after each iteration of the optimizer and are passed the results "so far". Callbacks can monitor progress, or stop the optimization early by returning `True`. """ try: from collections.abc import Callable ...
320
9,377
black
tests/data/cases/fmtonoff4.py
.py
# fmt: off @test([ 1, 2, 3, 4, ]) # fmt: on def f(): pass @test([ 1, 2, 3, 4, ]) def f(): pass # output # fmt: off @test([ 1, 2, 3, 4, ]) # fmt: on def f(): pass @test( [ 1, 2, 3, 4, ] ) def f(): pass
37
278
probability
tensorflow_probability/python/math/numeric_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...
104
3,281
astropy
astropy/modeling/tests/test_pickle.py
.py
"""Tests that models are picklable.""" from pickle import dumps, loads import numpy as np import pytest from numpy.testing import assert_allclose from astropy import units as u from astropy.modeling import ( functional_models, mappings, math_functions, physical_models, polynomial, powerlaws, ...
211
5,740
pyomo
pyomo/contrib/parmest/examples/reactor_design/leaveNout_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
3,434
sqlmap
plugins/dbms/postgresql/fingerprint.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.common import Backend from lib.core.common import Format from lib.core.common import hashDBRetrieve from lib.core.common import hashDBWrite from lib.core.data import...
237
10,576
hatch
src/hatch/env/internal/type_check.py
.py
from __future__ import annotations from typing import Any def get_default_config() -> dict[str, Any]: from hatch.env.internal.test import get_default_config as get_test_config test_config = get_test_config() test_deps = test_config.get("dependencies", []) return { "installer": "uv", ...
25
776
python-prompt-toolkit
src/prompt_toolkit/key_binding/bindings/scroll.py
.py
""" Key bindings, for scrolling up and down through pages. This are separate bindings, because GNU readline doesn't have them, but they are very useful for navigating through long multiline buffers, like in Vi, Emacs, etc... """ from __future__ import annotations from prompt_toolkit.key_binding.key_processor import ...
191
5,613
onnx
onnx/backend/test/case/node/log.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 Log(Base): @staticmethod def export() -> None: node = ...
29
754
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/latest_test.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");...
67
2,032
black
tests/data/line_ranges_formatted/basic.py
.py
"""Module doc.""" from typing import ( Callable, Literal, ) # fmt: off class Unformatted: def should_also_work(self): pass # fmt: on a = [1, 2] # fmt: skip # This should cover as many syntaxes as possible. class Foo: """Class doc.""" def __init__(self) -> None: pass @add_...
50
852
coremltools
coremltools/test/optimize/torch/palettization/test_palettization_api.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 copy import pytest import torch import torch.nn as nn import torch.nn.functional as F from c...
781
30,514
luigi
test/task_history_test.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...
56
1,624
clearml
examples/datasets/csv_dataset_creation.py
.py
from clearml import StorageManager, Dataset def main(): manager = StorageManager() print("STEP1 : Downloading CSV dataset") csv_file_path = manager.get_local_copy( remote_url="https://allegro-datasets.s3.amazonaws.com/datasets/Iris_Species.csv" ) print("STEP2 : Creating a dataset") #...
29
901
mlflow
mlflow/models/signature.py
.py
""" The :py:mod:`mlflow.models.signature` module provides an API for specification of model signature. Model signature defines schema of model input and output. See :py:class:`mlflow.types.schema.Schema` for more details on Schema and data types. """ import inspect import logging import re import warnings from copy i...
650
25,444
gunicorn
tests/test_asgi_parser_validation.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """Tests for ASGI callback parser header validation. These tests verify that PythonProtocol correctly validates HTTP headers and body framing according to RFC 9110 and RFC 9112. """ import pytest from gunicorn.a...
419
13,328
textual
src/textual/renderables/blank.py
.py
from __future__ import annotations from rich.style import Style as RichStyle from textual.color import Color from textual.content import Style from textual.css.styles import RulesMap from textual.strip import Strip from textual.visual import RenderOptions, Visual class Blank(Visual): """Draw solid background co...
43
1,359
beam
sdks/python/apache_beam/examples/cookbook/multiple_output_pardo_test.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
81
3,026
saleor
saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_with_fixed_voucher.py
.py
import pytest from ....product.utils.preparing_product import prepare_product from ....shop.utils import prepare_default_shop from ....utils import assign_permissions from ....vouchers.utils import create_voucher, create_voucher_channel_listing from ...utils import ( checkout_add_promo_code, checkout_complete,...
163
5,044
saleor
saleor/giftcard/events.py
.py
from collections.abc import Iterable from decimal import Decimal from typing import TYPE_CHECKING from ..account.models import User from ..app.models import App from . import GiftCardEvents from .models import GiftCard, GiftCardEvent if TYPE_CHECKING: from ..order.models import Order def gift_card_issued_event(...
346
9,013
probability
spinoffs/inference_gym/inference_gym/targets/ground_truth/stochastic_volatility_sp500_small.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...
372
9,219
saleor
saleor/graphql/payment/mutations/transaction/utils.py
.py
import uuid from django.core.exceptions import ValidationError from django.core.validators import validate_ipv46_address from .....core.exceptions import PermissionDenied from .....core.utils import get_client_ip from .....page.models import Page from .....payment import TransactionAction, TransactionEventType from ....
130
4,210
black
src/black/_width_table.py
.py
# Generated by make_width_table.py # wcwidth 0.2.14 # Unicode 17.0.0 from typing import Final WIDTH_TABLE: Final[list[tuple[int, int, int]]] = [ (4352, 4447, 2), (8986, 8987, 2), (9001, 9002, 2), (9193, 9196, 2), (9200, 9200, 2), (9203, 9203, 2), (9725, 9726, 2), (9748, 9749, 2), (9...
133
3,096
probability
tensorflow_probability/python/distributions/generalized_normal_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...
505
20,719
coveragepy
tests/test_coverage.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 """Tests for coverage.py.""" from __future__ import annotations import pytest import coverage from coverage import env from coverage.exceptions import NoDataEr...
1,890
47,247
openvino
tests/layer_tests/pytorch_tests/test_div.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 TestDiv(PytorchLayerTest): def _prepare_input(self): return (self.input_array.astype(self.input_typ...
139
6,353
conda
tests/test_create.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations import os import platform import re import sys from datetime import datetime from importlib.metadata import version from itertools import zip_longest from json import loads as json_loads from logging import ge...
3,265
112,259
voila
tests/server/execute_test.py
.py
# test basics of Voilà running a notebook async def test_hello_world(http_server_client, print_notebook_url): response = await http_server_client.fetch(print_notebook_url) assert response.code == 200 html_text = response.body.decode("utf-8") assert "Hi Voilà" in html_text assert "print(" not in ht...
13
486
pyomo
pyomo/contrib/solver/tests/solvers/test_scip_direct.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,259
coveragepy
tests/modules/pkg1/runmod2.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 # Used in the tests for PyRunner import sys print("runmod2: passed %s" % sys.argv[1])
8
245
probability
tensorflow_probability/python/distributions/gev.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...
273
10,836
saleor
saleor/graphql/translations/tests/mutations/test_attribute_bulk_translate.py
.py
from unittest.mock import patch import graphene import pytest from ....core.enums import LanguageCodeEnum, TranslationErrorCode from ....tests.utils import get_graphql_content from ...mutations import AttributeBulkTranslate ATTRIBUTE_BULK_TRANSLATE_MUTATION = """ mutation AttributeBulkTranslate( $transla...
401
12,441
hatch
tests/helpers/templates/wheel/standard_default_python_constraint.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): ...
50
1,283
voila
tests/app/timeout_test.py
.py
import os import pytest @pytest.fixture def voila_notebook(notebook_directory): return os.path.join(notebook_directory, "sleep.ipynb") @pytest.fixture def voila_args_extra(): return ["--VoilaExecutor.timeout=1", "--KernelManager.shutdown_wait_time=0.1"] async def test_timeout(http_server_client, base_url...
20
476
beam
sdks/python/apache_beam/examples/complete/juliaset/juliaset/juliaset_test_it.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...
62
2,097
textual
src/textual/command.py
.py
""" This module contains classes for working with Textual's command palette. See the guide on the [Command Palette](../guide/command_palette.md) for full details. """ from __future__ import annotations from abc import ABC, abstractmethod from asyncio import ( CancelledError, Queue, Task, TimeoutErro...
1,287
43,086
saleor
saleor/graphql/channel/resolvers.py
.py
from ...channel import models from ...permission.auth_filters import is_app, is_staff_user from ..core.context import get_database_connection_name from ..core.utils import from_global_id_or_error from ..core.validators import validate_one_of_args_is_in_query from .types import Channel def resolve_channel(info, id: st...
37
1,116
pynacl
src/nacl/bindings/crypto_shorthash.py
.py
# Copyright 2016 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...
77
2,542
saleor
saleor/plugins/tests/test_plugin_config_checks.py
.py
import pytest from ..apps import PluginConfig def test_empty_plugin_path(): plugin_path = "" with pytest.raises(ImportError): PluginConfig.load_and_check_plugin(None, plugin_path) def test_invalid_plugin_path(): plugin_path = "saleor.core.plugins.wrong_path.Plugin" with pytest.raises(Import...
16
390
coremltools
deps/pybind11/tests/test_enum.py
.py
# ruff: noqa: SIM201 SIM300 SIM202 from __future__ import annotations import pytest from pybind11_tests import enums as m def test_unscoped_enum(): assert str(m.UnscopedEnum.EOne) == "UnscopedEnum.EOne" assert str(m.UnscopedEnum.ETwo) == "UnscopedEnum.ETwo" assert str(m.EOne) == "UnscopedEnum.EOne" ...
271
9,104
astropy
astropy/visualization/hist.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.stats.histogram import calculate_bin_edges __all__ = ["hist"] def hist(x, bins=10, ax=None, max_bins=1e5, **kwargs): """Enhanced histogram function. This is a histogram function that enables the use of more sophisticated algor...
76
2,409
saleor
saleor/graphql/giftcard/mutations/gift_card_activate.py
.py
import graphene from ....giftcard import events from ....giftcard.utils import activate_gift_card from ....permission.enums import GiftcardPermissions from ....webhook.event_types import WebhookEventAsyncType from ...app.dataloaders import get_app_promise from ...core import ResolveInfo from ...core.doc_category impor...
58
2,149
loguru
tests/test_add_option_serialize.py
.py
import json import re import sys from loguru import logger class JsonSink: def __init__(self): self.message = None self.dict = None self.json = None def write(self, message): self.message = message self.dict = message.record self.json = json.loads(message) d...
144
4,199
biopython
Bio/KEGG/__init__.py
.py
# Copyright 2001 by Tarjei Mikkelsen. All rights reserved. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included as part of this # package. """Code to work with ...
97
3,038
beam
sdks/python/apache_beam/examples/inference/pytorch_model_per_key_image_segmentation.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...
311
9,241
biopython
Tests/test_TreeConstruction.py
.py
# Copyright (C) 2013 by Yanbo Ye (yeyanbo289@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.Phylo.TreeConstruction module.""" import os import tempfile import un...
509
20,128
mlflow
mlflow/gateway/guardrails.py
.py
from __future__ import annotations import abc import asyncio import json from contextlib import nullcontext from typing import TYPE_CHECKING, Any from fastapi import HTTPException import mlflow from mlflow.entities import SpanType from mlflow.entities.assessment import Feedback from mlflow.entities.gateway_guardrail...
451
17,038
wandb
tests/system_tests/test_functional/interrupt/test_interrupt.py
.py
import pathlib import subprocess import threading import pytest import wandb from tests.fixtures.wandb_backend_spy import WandbBackendSpy @pytest.fixture(autouse=True) def fast_stop_polling_interval(monkeypatch: pytest.MonkeyPatch) -> None: monkeypatch.setattr("wandb.sdk.lib.run_stopping._POLL_INTERVAL", 0.1) ...
51
1,279
beam
learning/tour-of-beam/learning-content/core-transforms/map/flat-map-elements/python-example/task.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"); y...
51
1,753
pdm
src/pdm/cli/commands/cache.py
.py
import argparse import os from collections.abc import Iterable from pathlib import Path from pdm import termui from pdm.cli.commands.base import BaseCommand from pdm.cli.options import verbose_option from pdm.exceptions import PdmUsageError from pdm.project import Project class Command(BaseCommand): """Control t...
178
6,127
onnxruntime
orttraining/orttraining/python/training/optim/lr_scheduler.py
.py
import math class _LRScheduler: r"""Base class for implementing custom learning rate schedulers Schedulers can be either stateful or stateless. Stateless implementation can only rely on information available at :py:class:`.TrainStepInfo`. Stateful implementation, on the other hand, can store addi...
293
12,685
wandb
wandb/sandbox/_secret.py
.py
from __future__ import annotations from dataclasses import dataclass from cwsandbox import Secret as _BaseSecret WANDB_SECRET_STORE = "wandb-team-secrets" @dataclass(frozen=True, kw_only=True) class Secret(_BaseSecret): """W&B sandbox secret with a default team secret store.""" store: str = WANDB_SECRET_S...
15
325
probability
tensorflow_probability/python/experimental/util/deferred_module_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...
172
6,732
cvxpy
cvxpy/reductions/dnlp2smooth/canonicalizers/div_canon.py
.py
""" Copyright 2025 CVXPY developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softwa...
42
1,460
conda
conda/cli/__init__.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from .main import main # NOQA
4
106
mlflow
tests/genai/judges/test_judge_tool_list_spans.py
.py
from unittest import mock import pytest from mlflow.entities.span import Span from mlflow.entities.span_status import SpanStatus, SpanStatusCode from mlflow.entities.trace import Trace from mlflow.entities.trace_data import TraceData from mlflow.entities.trace_info import TraceInfo from mlflow.entities.trace_location...
156
5,345
sqlmap
tamper/scientific.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.enums import PRIORITY __priority__ = PRIORITY.HIGHEST def dependencies(): pass def tamper(payload, **kwargs): """ Abuses MySQL scientific n...
36
984
wandb
tests/unit_tests/test_wandb_init.py
.py
import glob import os import stat import tempfile import time import pytest import wandb def test_no_root_dir_access__uses_temp_dir(tmp_path, monkeypatch): temp_dir = tempfile.gettempdir() root_dir = tmp_path / "create_dir_test" os.makedirs(root_dir, exist_ok=True) monkeypatch.setattr( os, ...
120
3,400
textual
docs/examples/guide/reactivity/refresh02.py
.py
from textual.app import App, ComposeResult from textual.reactive import reactive from textual.widget import Widget from textual.widgets import Input class Name(Widget): """Generates a greeting.""" who = reactive("name", layout=True) # (1)! def render(self) -> str: return f"Hello, {self.who}!" ...
30
661
openvino
src/bindings/python/tests/test_graph/test_create_op.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from openvino import PartialShape, Dimension, Model, Type from openvino.exceptions import UserInputError from openvino.utils.types import make_constant_node import openvino.opset...
2,363
86,352
probability
spinoffs/inference_gym/inference_gym/targets/__init__.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,838
beam
sdks/python/apache_beam/utils/timestamp.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...
631
23,746