repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
coremltools
coremltools/converters/mil/mil/passes/defs/randomize.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.mil import Builder as mb from coremltools.convert...
60
1,944
saleor
saleor/plugins/error_codes.py
.py
from enum import Enum class PluginErrorCode(Enum): GRAPHQL_ERROR = "graphql_error" INVALID = "invalid" PLUGIN_MISCONFIGURED = "plugin-misconfigured" NOT_FOUND = "not_found" REQUIRED = "required" UNIQUE = "unique"
11
239
beam
sdks/python/apache_beam/examples/cookbook/group_with_coder_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...
120
4,458
openvino
src/frontends/tensorflow/tests/test_models/models_pbtxt/partitioned_call.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import tensorflow.compat.v1 as tf @tf.function def second_func(x): return x ** 2 @tf.function def first_func(x, y): return second_func(x - y) graph_def = first_func.get_concrete_function(tf.constant([6, 3]), tf.constant([7]...
19
418
mlflow
mlflow/genai/scorers/guardrails/registry.py
.py
from __future__ import annotations from mlflow.exceptions import MlflowException _SUPPORTED_VALIDATORS = [ "ToxicLanguage", "NSFWText", "DetectJailbreak", "DetectPII", "SecretsPresent", "GibberishText", ] def get_validator_class(validator_name: str): """ Get Guardrails AI validator c...
44
1,343
pyomo
examples/pyomo/callbacks/tsp.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...
112
3,004
saleor
saleor/graphql/attribute/tests/mutations/test_bulk_delete.py
.py
from unittest import mock import graphene import pytest from .....attribute.models import Attribute, AttributeValue from .....attribute.utils import associate_attribute_values_to_instance from ....tests.utils import assert_no_permission, get_graphql_content ATTRIBUTE_BULK_DELETE_MUTATION = """ mutation attribute...
650
21,126
wandb
wandb/integration/sagemaker/config.py
.py
from __future__ import annotations import json import os import re import warnings from typing import Any from . import files as sm_files def is_using_sagemaker() -> bool: """Returns whether we're in a SageMaker environment.""" return ( os.path.exists(sm_files.SM_PARAM_CONFIG) # or "SM_TRAI...
59
1,748
conda
conda/plugins/subcommands/doctor/health_checks/pinned.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Health check: Pinned file format.""" from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING from .....base.constants import OK_MARK, PREFIX_PINNED_FILE, X_MARK from .....common.io import dashlist from ...
132
4,080
biopython
Tests/test_Align_exonerate.py
.py
# Copyright 2012 by Wibowo Arindrarto. 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. """Tests for Bio.Align Exonerate parsers.""" import io import os import unittest from tem...
8,689
384,690
black
tests/data/cases/preview_long_strings__regression.py
.py
# flags: --unstable class A: def foo(): result = type(message)("") # Don't merge multiline (e.g. triple-quoted) strings. def foo(): query = ( """SELECT xxxxxxxxxxxxxxxxxxxx(xxx)""" """ FROM xxxxxxxxxxxxxxxx WHERE xxxxxxxxxx AND xxx <> xxxxxxxxxxxxxx()""") # There was a bug where tuple...
1,270
46,702
astropy
astropy/coordinates/tests/accuracy/__init__.py
.py
""" The modules in the accuracy testing subpackage are primarily intended for comparison with "known-good" (or at least "known-familiar") datasets. More basic functionality and sanity checks are in the main ``coordinates/tests`` testing modules. """ N_ACCURACY_TESTS = 10 # the number of samples to use per accuracy te...
9
323
sphinx
sphinx/builders/dirhtml.py
.py
"""Directory HTML builders.""" from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING from sphinx.builders.html import StandaloneHTMLBuilder from sphinx.util import logging from sphinx.util.osutil import SEP if TYPE_CHECKING: from sphinx.application import Sphinx from s...
51
1,409
conda
tests/env/test_env.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations import os import random from io import StringIO from typing import TYPE_CHECKING from unittest.mock import patch import pytest from conda.common.serialize import yaml from conda.env.env import ( VALID_KE...
523
13,676
pyfilesystem2
fs/tools.py
.py
"""Miscellaneous tools for operating on filesystems. """ from __future__ import print_function, unicode_literals import typing from . import errors from .errors import DirectoryNotEmpty, ResourceNotFound from .path import abspath, dirname, normpath, recursepath if typing.TYPE_CHECKING: from typing import IO, Li...
99
2,714
saleor
saleor/tests/e2e/pages/test_create_page_with_all_attributes_types.py
.py
import datetime import json import pytest from django.conf import settings from ....tests.utils import dummy_editorjs from ..attributes.utils import prepare_all_attributes from ..pages.utils import create_page, create_page_type from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_...
120
3,693
pyomo
pyomo/dae/diffvar.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...
238
9,130
readthedocs.org
readthedocs/api/v2/urls.py
.py
"""Define routes between URL paths and views/endpoints.""" from django.urls import include from django.urls import path from django.urls import re_path from rest_framework import routers from readthedocs.api.v2.views import core_views from readthedocs.api.v2.views import integrations from readthedocs.api.v2.views imp...
110
3,257
httpie
tests/test_stream.py
.py
import json import pytest import responses from unittest.mock import Mock from httpie.compat import is_windows from httpie.cli.constants import PRETTY_MAP from httpie.output.streams import BINARY_SUPPRESSED_NOTICE from httpie.plugins import ConverterPlugin from httpie.plugins.registry import plugin_manager from .uti...
151
4,507
onnxruntime
onnxruntime/python/tools/transformers/models/torch_export_patches/patches/patch_torch.py
.py
import inspect import os from collections.abc import Callable, Sequence from typing import Any import torch from torch._subclasses.fake_tensor import FakeTensorMode def _catch_produce_guards_and_solve_constraints( previous_function: Callable, fake_mode: "FakeTensorMode", gm: "torch.fx.GraphModule", d...
324
14,034
probability
tensorflow_probability/python/bijectors/sinh_arcsinh.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...
180
7,350
onnx
onnx/reference/ops/op_instance_normalization.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.op_run import OpRun class InstanceNormalization(OpRun): def _run(self, x, s, bias, epsilon=None): dims_x = len(x.shape) axis = tuple(range(2,...
22
646
gunicorn
gunicorn/http/body.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. import io import sys from gunicorn.http.errors import (NoMoreData, ChunkMissingTerminator, InvalidChunkSize, InvalidChunkExtension) class ChunkedReader: def __init__(self, r...
272
7,787
mlflow
tests/spark/autologging/datasource/conftest.py
.py
import os import tempfile import pytest from pyspark.sql import Row from pyspark.sql.types import IntegerType, StringType, StructField, StructType from mlflow.spark.autologging import clear_table_infos from tests.spark.autologging.utils import _get_or_create_spark_session # Module-scoped version of pytest monkeypa...
78
2,661
pyomo
pyomo/contrib/appsi/solvers/__init__.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
17
748
textual
src/textual/_spatial_map.py
.py
from __future__ import annotations from collections import defaultdict from itertools import product from typing import Generic, Iterable, TypeVar from typing_extensions import TypeAlias from textual.geometry import Offset, Region ValueType = TypeVar("ValueType") GridCoordinate: TypeAlias = "tuple[int, int]" clas...
104
3,764
astropy
astropy/units/tests/test_quantity_erfa_ufuncs.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Test Structured units and quantities specifically with the ERFA ufuncs. """ import numpy as np import pytest from erfa import ufunc as erfa_ufunc from numpy.testing import assert_array_equal from astropy import units as u from astropy.tests.helper im...
703
27,525
hatch
backend/src/hatchling/builders/config.py
.py
from __future__ import annotations import os from contextlib import contextmanager from functools import cached_property from typing import TYPE_CHECKING, Any, TypeVar import pathspec from hatchling.builders.constants import DEFAULT_BUILD_DIRECTORY, EXCLUDED_DIRECTORIES, BuildEnvVars from hatchling.builders.utils im...
865
35,662
saleor
saleor/page/error_codes.py
.py
from enum import Enum class PageErrorCode(Enum): GRAPHQL_ERROR = "graphql_error" INVALID = "invalid" NOT_FOUND = "not_found" REQUIRED = "required" UNIQUE = "unique" DUPLICATED_INPUT_ITEM = "duplicated_input_item" ATTRIBUTE_ALREADY_ASSIGNED = "attribute_already_assigned"
12
301
funcy
funcy/flow.py
.py
from collections.abc import Hashable from datetime import datetime, timedelta import time import threading from contextlib import suppress # reexport from .decorators import decorator, wraps, get_argnames, arggetter, contextmanager __all__ = ['raiser', 'ignore', 'silent', 'suppress', 'nullcontext', 'reraise', 'retr...
247
7,282
astropy
astropy/modeling/powerlaws.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Power law model variants. """ # pylint: disable=invalid-name import numpy as np from astropy.units import Magnitude, Quantity, UnitsError, dimensionless_unscaled, mag from .core import Fittable1DModel from .parameters import InputParameterError, Par...
662
21,235
beam
sdks/python/apache_beam/metrics/execution.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...
396
13,481
pyomo
pyomo/mpec/tests/test_path.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...
134
4,404
sqlmap
lib/utils/hashdb.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import hashlib import os import sqlite3 import struct import threading import time from lib.core.common import getSafeExString from lib.core.common import serializeObject from li...
253
10,003
tablib
src/tablib/_vendor/dbfpy/dbf.py
.py
#! /usr/bin/env python from . import header, record from .utils import INVALID_VALUE __version__ = "$Revision: 1.7 $"[11:-2] __date__ = "$Date: 2007/02/11 09:23:13 $"[7:-2] __author__ = "Jeff Kunce <kuncej@mail.conservation.state.mo.us>" __all__ = ["Dbf"] """DBF accessing helpers. FIXME: more documentation needed ...
296
9,220
textual
src/textual/_animator.py
.py
from __future__ import annotations import asyncio from abc import ABC, abstractmethod from dataclasses import dataclass from functools import partial from typing import TYPE_CHECKING, Any, Callable, TypeVar from typing_extensions import Protocol, runtime_checkable from textual import _time from textual._callback imp...
591
20,673
gunicorn
tests/ctl/test_protocol.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """Tests for control socket protocol.""" import json import struct import pytest from gunicorn.ctl.protocol import ( ControlProtocol, ProtocolError, make_request, make_response, make_error_res...
250
7,587
confluent-kafka-python
src/confluent_kafka/schema_registry/_sync/serde.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2024 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...
728
29,384
black
src/black/strings.py
.py
""" Simple formatting on strings. Further string formatting code is in trans.py. """ import re import sys from functools import lru_cache from re import Match, Pattern from typing import Final from black._width_table import WIDTH_TABLE from blib2to3.pytree import Leaf STRING_PREFIX_CHARS: Final = "fturbFTURB" # All...
409
13,967
saleor
saleor/graphql/product/types/channels.py
.py
from dataclasses import asdict from decimal import Decimal import graphene from promise import Promise from ....core.utils.country import get_active_country from ....graphql.core.types import Money, MoneyRange from ....permission.enums import ProductPermissions from ....product import models from ....product.utils.av...
390
15,387
sqlmap
plugins/dbms/derby/connector.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ try: import drda except: pass import logging from lib.core.common import getSafeExString from lib.core.data import conf from lib.core.data import logger from lib.core.ex...
63
1,885
sqlmap
plugins/dbms/postgresql/filesystem.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import os from lib.core.common import randomInt from lib.core.compat import xrange from lib.core.data import kb from lib.core.data import logger from lib.core.enums import CHARSE...
94
3,566
python-dotenv
tests/test_lib.py
.py
import subprocess from pathlib import Path from typing import Sequence def run_dotenv( args: Sequence[str], cwd: str | Path | None = None, env: dict | None = None, ) -> subprocess.CompletedProcess: """ Run the `dotenv` CLI in a subprocess with the given arguments. """ process = subprocess...
47
1,122
wagtail
wagtail/admin/tests/pages/test_edit_page.py
.py
import datetime import json import os from unittest import mock from django.conf import settings from django.contrib.auth.models import Group, Permission from django.core import mail from django.core.files.base import ContentFile from django.http import HttpRequest, HttpResponse, JsonResponse from django.test import T...
5,394
210,181
pyomo
pyomo/contrib/alternative_solutions/balas.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...
259
9,457
mlflow
tests/pyfunc/docker/conftest.py
.py
import logging import os import subprocess from functools import lru_cache import docker import pytest import requests from packaging.version import Version import mlflow TEST_IMAGE_NAME = "test_image" MLFLOW_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..")) RESOURCE_DIR = os.path.joi...
79
2,734
readthedocs.org
readthedocs/invitations/apps.py
.py
""" Invitations app. This manages user invitations to join a project, organization, team, etc. """ from django.apps import AppConfig class InvitationsConfig(AppConfig): default_auto_field = "django.db.models.BigAutoField" name = "readthedocs.invitations" def ready(self): import readthedocs.invi...
16
344
beam
sdks/python/apache_beam/examples/inference/large_language_modeling/main.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 u...
141
4,488
mlflow
dev/proto_to_graphql/string_utils.py
.py
import re def camel_to_snake(string): return re.sub(r"(?<!^)(?=[A-Z])", "_", string).lower() def snake_to_camel(string): return "".join(x[0].upper() + x[1:] for x in string.split("_")) def snake_to_pascal(string): temp = snake_to_camel(string) return temp[0].upper() + temp[1:]
15
300
probability
tensorflow_probability/python/distributions/sigmoid_beta.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...
254
9,504
saleor
saleor/graphql/checkout/mutations/utils.py
.py
import datetime import uuid from collections import defaultdict from collections.abc import Iterable from dataclasses import asdict, dataclass, field from decimal import Decimal from typing import TYPE_CHECKING, Any, cast import graphene from django.conf import settings from django.core.exceptions import ObjectDoesNot...
637
23,407
sqlmap
plugins/dbms/sqlite/__init__.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.enums import DBMS from lib.core.settings import SQLITE_SYSTEM_DBS from lib.core.unescaper import unescaper from plugins.dbms.sqlite.enumeration import Enumeration fr...
30
908
pyomo
examples/pyomobook/performance-ch/lin_expr.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...
32
1,147
probability
spinoffs/inference_gym/inference_gym/internal/test_util.py
.py
# Copyright 2020 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
659
24,913
structlog
tests/test_packaging.py
.py
# SPDX-License-Identifier: MIT OR Apache-2.0 # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the MIT License. See the LICENSE file in the root of this # repository for complete details. from importlib import metadata import pytest import structlog class TestLegacyMetadataHac...
50
1,499
toolz
toolz/sandbox/__init__.py
.py
from .core import EqualityHashKey, unzip from .parallel import fold
3
68
scikit-bio
skbio/stats/distance/tests/test_mantel.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. # --------------------------------------------...
1,204
48,490
conda
tests/base/test_constants.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from contextlib import nullcontext from logging import getLogger import pytest from conda.base import constants from conda.base.constants import ChannelPriority from conda.common.constants import NULL log = getLogger(__name__) def test_null...
38
1,076
luigi
test/contrib/batch_test.py
.py
# -*- coding: utf-8 -*- # # Copyright 2018 Outlier Bio, LLC # # 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 la...
106
4,124
openvino
docs/scripts/copy_images.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import argparse import shutil from pathlib import Path def copy_images(input_dir: Path, output_dir: Path): """ Copy images from doxygen xml folder to sphinx folder """ output_dir.mkdir(parents=True, exist_ok=True) e...
32
951
pyomo
doc/OnlineDocs/src/data/param5.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...
24
836
httpie
tests/test_defaults.py
.py
""" Tests for the provided defaults regarding HTTP method, and --json vs. --form. """ from io import BytesIO from httpie.client import JSON_ACCEPT from .utils import MockEnvironment, http, HTTP_OK from .fixtures import FILE_PATH def test_default_headers_case_insensitive(httpbin): """ <https://github.com/htt...
133
4,831
cvxpy
cvxpy/tests/nlp_tests/test_quasi_newton.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
200
7,900
beam
sdks/python/apache_beam/transforms/sideinputs_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...
529
20,740
saleor
saleor/core/cleaners/urls.py
.py
import ipaddress import urllib.parse from typing import Protocol import idna MAILTO_SAFE_CHARS = ".-_+," class UrlCleaner(Protocol): def __call__(self, dirty_url: str) -> str: ... class URLCleanerError(ValueError): """Base exception class for all URL cleaner-related exceptions.""" class InvalidHostname(...
146
4,785
hypercorn
tests/assets/config.py
.py
from __future__ import annotations import ssl # noqa: F401 access_log_format = "bob" bind = "127.0.0.1:5555" h11_max_incomplete_size = 4
8
140
beam
sdks/python/apache_beam/io/gcp/datastore/v1new/helper.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...
88
2,964
pynacl
src/nacl/bindings/sodium_core.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...
34
1,039
metrics
src/torchmetrics/functional/image/__init__.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...
59
2,890
openvino
tests/layer_tests/pytorch_tests/test_distance.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import pytest from pytorch_layer_test_class import PytorchLayerTest class TestCdist(PytorchLayerTest): def _prepare_input(self, x_dtype="float32", y_dtype="float32"): return (self.random.randint(-10, 10, (...
70
2,546
wandb
wandb/sdk/lib/noop_run.py
.py
"""Implementation for WANDB_MODE=disabled.""" import time from typing import cast from typing_extensions import Self, override import wandb from wandb.sdk import wandb_config, wandb_metric, wandb_run, wandb_settings from wandb.sdk.artifacts import artifact from wandb.sdk.lib import module from wandb.sdk.lib.disabled...
143
3,653
pyro
pyro/infer/autoguide/__init__.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 from pyro.infer.autoguide.effect import ( AutoHierarchicalNormalMessenger, AutoMessenger, AutoNormalMessenger, AutoRegressiveMessenger, ) from pyro.infer.autoguide.gaussian import AutoGaussian from pyro.infer.autogu...
67
1,618
scikit-bio
skbio/sequence/tests/test_protein.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. # --------------------------------------------...
140
5,067
pyro
tests/infer/test_jit.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import logging import warnings import pytest import torch from torch.autograd import grad from torch.distributions import constraints, kl_divergence import pyro import pyro.distributions as dist import pyro.ops.jit import pyro.po...
614
19,363
conda
conda/cli/formats.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Helpers for rendering CLI help text.""" from __future__ import annotations from typing import TYPE_CHECKING from ..common.io import dashlist from ..plugins.types import EnvironmentFormat if TYPE_CHECKING: from collections.abc import M...
62
1,877
pyomo
pyomo/dataportal/plugins/xml_table.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...
124
4,154
textual
src/textual/drivers/linux_inline_driver.py
.py
from __future__ import annotations import asyncio import os import selectors import signal import sys import termios import tty from codecs import getincrementaldecoder from threading import Event, Thread from typing import TYPE_CHECKING, Any import rich.repr from textual import events from textual._loop import loop...
326
10,600
sphinx
sphinx/domains/_domains_container.py
.py
from __future__ import annotations from typing import TYPE_CHECKING, overload if TYPE_CHECKING: from collections.abc import Iterable, Iterator, Mapping, Set from typing import Any, Final, Literal, NoReturn, Self from docutils import nodes from sphinx.domains import Domain from sphinx.domains.c i...
287
9,590
mlflow
mlflow/genai/discovery/job.py
.py
from mlflow.client import MlflowClient from mlflow.entities.run_status import RunStatus from mlflow.environment_variables import MLFLOW_SERVER_JUDGE_INVOKE_MAX_WORKERS from mlflow.exceptions import MlflowException from mlflow.genai.discovery.pipeline import discover_issues from mlflow.server.jobs import job from mlflow...
83
3,225
beam
sdks/python/apache_beam/typehints/decorators_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...
557
20,105
cvxpy
cvxpy/reductions/solvers/constant_solver.py
.py
import cvxpy.settings as s from cvxpy.reductions.solution import Solution from cvxpy.reductions.solvers.solver import Solver class ConstantSolver(Solver): """TODO(akshayka): Documentation.""" # Solver capabilities MIP_CAPABLE = True def accepts(self, problem) -> bool: return len(problem.vari...
41
1,130
onnxruntime
orttraining/orttraining/test/external_custom_ops/test.py
.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import os # noqa: F401 import sys # noqa: F401 import numpy as np # Restore dlopen flags. import orttraining_external_custom_ops # noqa: F401 # Expose available (onnx::* and protobuf::*) symbols from onnxruntime to resolve references in # t...
22
696
saleor
saleor/payment/tests/test_transaction_item_calculations.py
.py
import datetime from decimal import Decimal from django.utils import timezone from freezegun import freeze_time from .. import TransactionEventType from ..models import TransactionItem from ..transaction_item_calculations import recalculate_transaction_amounts def _assert_amounts( transaction: TransactionItem, ...
1,667
46,614
astropy
astropy/io/votable/volint.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Script support for validating a VO file. """ import argparse def main(args=None): from . import table parser = argparse.ArgumentParser( description="Check a VOTable file for compliance to the VOTable specification" ) # TODO:...
22
573
mlflow
tests/langchain/conftest.py
.py
import importlib from unittest import mock import openai import pytest from langchain.embeddings.base import Embeddings from pydantic import BaseModel from tests.helper_functions import start_mock_openai_server from tests.tracing.helper import reset_autolog_state # noqa: F401 @pytest.fixture(autouse=True) def set_...
59
1,681
beam
sdks/python/apache_beam/io/external/generate_sequence_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...
93
3,329
saleor
saleor/tests/e2e/checkout/utils/checkout_payment_create.py
.py
from ...utils import get_graphql_content CHECKOUT_PAYMENT_CREATE_MUTATION = """ mutation createPayment($checkoutId: ID, $input: PaymentInput!) { checkoutPaymentCreate(id: $checkoutId, input: $input) { errors { field code message } checkout { id } payment { id } ...
61
1,451
saleor
saleor/graphql/account/tests/queries/test_permission_group.py
.py
import graphene from .....account.models import Group from ....tests.utils import get_graphql_content GROUP_FEDERATION_QUERY = """ query GetGroupInFederation($representations: [_Any!]!) { _entities(representations: $representations) { __typename ... on Group { id name } } ...
126
3,382
marshmallow
src/marshmallow/utils.py
.py
"""Utility methods for marshmallow.""" from __future__ import annotations import datetime as dt import inspect import typing from collections.abc import Mapping, Sequence from marshmallow.constants import missing def is_generator(obj) -> typing.TypeGuard[typing.Generator]: """Return True if ``obj`` is a genera...
167
5,430
hydra
plugins/hydra_colorlog/hydra_plugins/hydra_colorlog/colorlog.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from hydra.core.config_search_path import ConfigSearchPath from hydra.plugins.search_path_plugin import SearchPathPlugin class HydraColorlogSearchPathPlugin(SearchPathPlugin): def manipulate_search_path(self, search_path: ConfigSearchPath) -> ...
10
494
probability
tensorflow_probability/python/experimental/nn/convolutional_layers_test.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...
167
6,221
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_silu.py
.py
# # silu paddle model generator # import numpy as np from save_model import saveModel import paddle as pdpd import sys def silu(name: str, x, data_type, use_static=True): pdpd.enable_static() with pdpd.static.program_guard(pdpd.static.Program(), pdpd.static.Program()): if use_static: node...
65
1,969
probability
tensorflow_probability/python/optimizer/lbfgs.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...
493
22,350
saleor
saleor/graphql/meta/tests/queries/test_discount.py
.py
import graphene from ....tests.utils import assert_no_permission, get_graphql_content from .utils import PRIVATE_KEY, PRIVATE_VALUE, PUBLIC_KEY, PUBLIC_VALUE QUERY_SALE_PUBLIC_META = """ query saleMeta($id: ID!){ sale(id: $id){ metadata{ key value }...
556
15,322
mlflow
mlflow/models/evaluation/default_evaluator.py
.py
import copy import inspect import json import logging import pathlib import pickle import shutil import tempfile import traceback from abc import abstractmethod from typing import Any, Callable, NamedTuple, Optional import numpy as np import pandas as pd import mlflow from mlflow import MlflowClient, MlflowException ...
984
41,785
pyomo
pyomo/contrib/pynumero/dependencies.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...
29
1,147
saleor
saleor/core/templatetags/taxed_prices.py
.py
from django import template from prices import Money, MoneyRange, TaxedMoney, TaxedMoneyRange register = template.Library() def _get_display_price( base: TaxedMoney | TaxedMoneyRange, display_gross: bool ) -> Money: """Return the price amount that should be displayed based on settings.""" if isinstance(b...
29
943
hatch
backend/src/hatchling/build.py
.py
from __future__ import annotations import os from typing import Any __all__ = [ "build_editable", "build_sdist", "build_wheel", "get_requires_for_build_editable", "get_requires_for_build_sdist", "get_requires_for_build_wheel", ] __all__ += ["__all__"] def get_requires_for_build_sdist(config_...
145
5,577
openvino
src/bindings/python/src/openvino/frontend/tensorflow/graph_iterator.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # flake8: noqa # mypy: ignore-errors import tensorflow as tf from openvino.frontend.tensorflow.node_decoder import TFGraphNodeDecoder from openvino.frontend.tensorflow.py_tensorflow_frontend import _FrontEndPyGraphIterator as GraphItera...
117
4,961
saleor
saleor/graphql/order/tests/mutations/test_order_bulk_create.py
.py
import copy import datetime from decimal import Decimal from unittest.mock import patch import graphene import pytest from django.utils import timezone from .....account.models import Address from .....core import JobStatus from .....core.prices import quantize_price from .....discount.models import OrderDiscount fro...
4,086
139,042