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
saleor
saleor/graphql/tests/fixtures.py
.py
import json import logging from unittest import mock from unittest.mock import Mock import graphene import pytest from django.core.serializers.json import DjangoJSONEncoder from django.test import TestCase from django.test.client import MULTIPART_CONTENT, Client from django.urls import reverse from django.utils.functi...
241
6,831
beam
sdks/python/apache_beam/io/gcp/datastore/v1new/datastoreio.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...
611
23,606
astropy
astropy/coordinates/tests/test_angular_separation.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Tests for the projected separation stuff """ import numpy as np import pytest from astropy import units as u from astropy.coordinates import Angle from astropy.coordinates.builtin_frames import ICRS # lon1, lat1, lon2, lat2 in degrees coords = [ ...
60
1,628
mlflow
tests/genai/scorers/online/test_trace_checkpointer.py
.py
import time from unittest.mock import MagicMock import pytest from mlflow.environment_variables import ( MLFLOW_ONLINE_SCORING_DEFAULT_TRACE_COMPLETION_BUFFER_SECONDS, ) from mlflow.genai.scorers.online.constants import MAX_LOOKBACK_MS from mlflow.genai.scorers.online.trace_checkpointer import ( OnlineTraceCh...
236
8,953
sphinx
sphinx/io.py
.py
"""Input/Output files""" from __future__ import annotations import warnings from typing import TYPE_CHECKING from docutils.io import FileInput from docutils.readers import standalone from docutils.transforms.references import DanglingReferences from docutils.writers import UnfilteredWriter from sphinx.deprecation i...
157
4,662
cvxpy
doc/source/conf.py
.py
# -*- coding: utf-8 -*- # # CVXPY documentation build configuration file, created by # sphinx-quickstart on Mon Jan 27 20:47:07 2014. # # 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 c...
429
14,134
scikit-optimize
skopt/tests/test_deprecation.py
.py
from functools import partial from itertools import product import pytest from skopt import gp_minimize from skopt import forest_minimize from skopt import gbrt_minimize from skopt import Optimizer from skopt.learning import ExtraTreesRegressor # dummy_minimize does not support same parameters so # treated separate...
31
854
wandb
wandb/errors/__init__.py
.py
__all__ = ( "Error", "CommError", "AuthenticationError", "UsageError", "UnsupportedError", "WandbCoreNotAvailableError", ) from .errors import ( AuthenticationError, CommError, Error, UnsupportedError, UsageError, WandbCoreNotAvailableError, )
18
293
wagtail
wagtail/embeds/templatetags/wagtailembeds_tags.py
.py
from django import template from django.utils.safestring import mark_safe from wagtail.embeds import embeds from wagtail.embeds.exceptions import EmbedException register = template.Library() @register.simple_tag(name="embed") def embed_tag(url, max_width=None): try: embed = embeds.get_embed(url, max_wid...
17
495
wandb
tests/unit_tests/test_automations/test_actions.py
.py
import json from hypothesis import given from hypothesis.strategies import dictionaries, sampled_from, text from wandb.automations import ActionType, SendNotification, SendWebhook from wandb.automations._generated import AlertSeverity, TriggeredActionType from wandb.sdk.wandb_alerts import AlertLevel from tests.unit_...
90
3,149
mlflow
tests/pyfunc/test_virtualenv.py
.py
import os import sys from io import BytesIO from stat import S_IRGRP, S_IROTH, S_IRUSR, S_IXGRP, S_IXOTH, S_IXUSR from typing import NamedTuple import numpy as np import pandas as pd import pytest import sklearn from sklearn.datasets import load_iris from sklearn.linear_model import LogisticRegression import mlflow f...
232
8,129
mlflow
mlflow/assistant/cli.py
.py
"""MLflow CLI commands for Assistant integration.""" import sys import threading import time from pathlib import Path import click from mlflow.assistant.config import AssistantConfig, ProjectConfig, SkillsConfig from mlflow.assistant.providers import AssistantProvider, list_providers from mlflow.assistant.providers....
518
17,346
confluent-kafka-python
tests/test_AIOProducer.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Unit tests for AIOProducer class. """ import asyncio import concurrent.futures from unittest.mock import Mock, patch import pytest from confluent_kafka import KafkaError, KafkaException from confluent_kafka.aio.producer._AIOProducer import AIOProducer class TestAI...
647
27,053
pyro
pyro/distributions/__init__.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import pyro.distributions.torch_patch # noqa F403 # Import * to get the latest upstream distributions. from pyro.distributions.torch import * # noqa F403 # Additionally try to import explicitly to help mypy static analysis. try...
264
7,555
pyomo
pyomo/contrib/incidence_analysis/incidence.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...
190
7,334
black
tests/test_format.py
.py
import re from collections.abc import Iterator from dataclasses import replace from typing import Any from unittest.mock import patch import pytest import black from black.mode import TargetVersion from tests.util import ( all_data_cases, assert_format, dump_to_stderr, read_data, read_data_with_mo...
100
2,905
mlflow
tests/genai/scorers/phoenix/test_utils.py
.py
import json import sys import time from unittest.mock import patch import pytest from opentelemetry.sdk.trace import ReadableSpan as OTelReadableSpan from mlflow.entities.span import Span from mlflow.entities.trace import Trace, TraceData, TraceInfo from mlflow.entities.trace_location import TraceLocation from mlflow...
142
4,608
wandb
wandb/sdk/launch/agent/job_status_tracker.py
.py
from __future__ import annotations import logging from dataclasses import dataclass from wandb.apis.internal import Api from wandb.errors import CommError from wandb.sdk.launch._project_spec import LaunchProject from ..runner.abstract import AbstractRun from ..utils import event_loop_thread_exec from .run_queue_item...
57
1,823
bazel
tools/ctexplain/bazel_api_test.py
.py
# Copyright 2020 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
149
5,610
wagtail
wagtail/documents/wagtail_hooks.py
.py
from django.conf import settings from django.template.response import TemplateResponse from django.urls import include, path, reverse, reverse_lazy from django.utils.cache import add_never_cache_headers from django.utils.translation import gettext_lazy as _ from django.utils.translation import ngettext import wagtail....
220
7,436
gunicorn
tests/docker/dirty_arbiter/app.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Simple WSGI and Dirty applications for integration testing. """ from gunicorn.dirty.app import DirtyApp def application(environ, start_response): """Simple WSGI application.""" start_response('200 OK...
30
688
probability
tensorflow_probability/python/bijectors/scale_matvec_diag.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...
121
3,879
conda
conda/_preview/env_setup/cli/__init__.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """CLI modules for the env-setup preview feature."""
4
128
textual
tests/snapshot_tests/snapshot_apps/enter_or_leave.py
.py
from textual import on from textual.app import App, ComposeResult from textual.widgets import Label from textual.widget import Widget from textual import events class MyWidget(Widget): def compose(self) -> ComposeResult: yield Label("Foo", id="foo") yield Label("Bar") @on(events.Enter) @o...
45
849
coremltools
coremltools/test/optimize/torch/conversion/palettization/test_palettization_conversion.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 pytest import torch import torch.nn as nn import coremltools.test.optimize.torch.conversion.c...
481
14,860
saleor
saleor/core/search_tasks.py
.py
from typing import Any from celery.utils.log import get_task_logger from django.conf import settings from django.db import transaction from ..account.models import User from ..account.search import generate_user_search_vector_value from ..celeryconf import app from ..core.db.connection import allow_writer from ..orde...
164
4,842
onnxruntime
onnxruntime/test/python/transformers/test_constant_fold.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 os import unittest import onnx from bert_model_generator import float_tenso...
124
5,325
metrics
src/torchmetrics/functional/segmentation/hausdorff_distance.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...
108
4,940
sphinx
sphinx/ext/extlinks.py
.py
"""Extension to save typing and prevent hard-coding of base URLs in reST files. This adds a new config value called ``extlinks`` that is created like this:: extlinks = {'exmpl': ('https://example.invalid/%s.html', caption), ...} Now you can use e.g. :exmpl:`foo` in your documents. This will create a link to ``ht...
140
4,879
coremltools
coremltools/converters/mil/frontend/torch/test/test_examples.py
.py
# Copyright (c) 2022, 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 pytest import coremltools from coremltools._deps import _HAS_TORCH, MSG_TORCH_NOT_FOUND from cor...
68
2,043
wagtail
wagtail/contrib/settings/tests/site_specific/test_templates.py
.py
from django.template import Context, RequestContext, Template, engines from django.test import TestCase from django.test.utils import override_settings from wagtail.coreutils import get_dummy_request from wagtail.models import Site from wagtail.test.utils import WagtailTestUtils from .base import SiteSettingsTestMixi...
318
11,470
saleor
saleor/graphql/attribute/tests/queries/test_attribute_pagination.py
.py
from decimal import Decimal import graphene import pytest from .....attribute import AttributeType from .....attribute.models import Attribute, AttributeProduct, AttributeVariant from .....product import ProductTypeKind from .....product.models import ( Product, ProductChannelListing, ProductType, Pro...
262
8,469
mlflow
mlflow/metrics/genai/genai_metric.py
.py
import json import logging import re import warnings from concurrent.futures import ThreadPoolExecutor, as_completed from inspect import Parameter, Signature from tempfile import TemporaryDirectory from typing import Any import pandas as pd import mlflow from mlflow.exceptions import MlflowException from mlflow.metri...
807
33,307
coremltools
coremltools/proto/DataStructures_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: DataStructures.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import message as _message fr...
200
10,402
pyomo
pyomo/solvers/plugins/solvers/SCIPAMPL.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...
492
19,967
openvino
tests/layer_tests/tensorflow_tests/test_tf_ReverseV2.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from common.tf_layer_test_class import CommonTFLayerTest class TestReverseV2(CommonTFLayerTest): def create_reverse_v2_net(self, shape, axis): import tensorflow as tf tf.compat.v1.reset_default_graph()...
34
1,180
mlflow
examples/rapids/mlflow_project/src/rf_test/train.py
.py
"""Hyperparameter optimization with cuML, hyperopt, and MLflow""" import argparse from functools import partial from cuml.ensemble import RandomForestClassifier from cuml.metrics.accuracy import accuracy_score from cuml.preprocessing.model_selection import train_test_split from hyperopt import STATUS_OK, Trials, fmin...
132
3,980
beam
sdks/python/apache_beam/runners/portability/artifact_service_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 use ...
189
7,263
coveragepy
tests/test_sqlitedb.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.sqlitedb""" from __future__ import annotations from unittest import mock import pytest from coverage.exceptions import DataError from co...
98
4,530
sphinx
tests/conftest.py
.py
from __future__ import annotations import gettext import os import sys from pathlib import Path from types import SimpleNamespace from typing import TYPE_CHECKING import docutils import pytest import sphinx import sphinx.locale from sphinx.testing.util import _clean_up_global_state from tests.utils import TEST_ROOT...
104
2,774
django-cms
cms/extensions/admin.py
.py
from django.contrib import admin from django.contrib.admin.options import csrf_protect_m from django.core.exceptions import PermissionDenied from django.http import HttpResponseRedirect from django.urls import reverse from cms.models import Page, PageContent from cms.utils.page_permissions import user_can_change_page ...
110
4,248
pyfilesystem2
fs/_fscompat.py
.py
import six try: from os import fsdecode, fsencode except ImportError: from backports.os import fsdecode, fsencode # type: ignore try: from os import fspath except ImportError: def fspath(path): # type: ignore """Return the path representation of a path-like object. If str or bytes ...
43
1,464
coremltools
coremltools/optimize/torch/_utils/registry.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 abc import ABC as _ABC class BaseRegistry(_ABC): """ Base class for registries that re...
110
4,067
saleor
saleor/plugins/openid_connect/utils.py
.py
import datetime import json import logging from typing import TYPE_CHECKING import requests from authlib.jose import JWTClaims, jwt from authlib.jose.errors import DecodeError, JoseError from authlib.oidc.core import CodeIDToken from django.conf import settings from django.contrib.auth.hashers import make_password fro...
761
25,800
onnx
onnx/backend/test/case/node/asinh.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 Asinh(Base): @staticmethod def export() -> None: node ...
29
780
probability
tensorflow_probability/python/internal/backend/numpy/v1.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...
190
6,151
cvxpy
cvxpy/reductions/solvers/conic_solvers/cosmo_conif.py
.py
""" Copyright 2022, 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, sof...
190
5,651
biopython
Tests/test_SearchIO_hhsuite2_text.py
.py
# Copyright 2019 by Jens Thomas. 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 SearchIO HhsuiteIO parsers.""" import os import unittest from Bio.SearchIO import...
548
21,779
coremltools
deps/protobuf/python/google/protobuf/internal/descriptor_pool_test.py
.py
# Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. All rights reserved. # https://developers.google.com/protocol-buffers/ # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redi...
1,144
50,316
pyomo
pyomo/contrib/interior_point/inverse_reduced_hessian.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...
152
6,213
mlflow
mlflow/types/responses.py
.py
import json from collections.abc import Sequence from itertools import tee from typing import Any, Generator, Iterator from uuid import uuid4 from pydantic import BaseModel, ConfigDict, model_validator from mlflow.types.agent import ChatContext from mlflow.types.responses_helpers import ( BaseRequestPayload, ...
567
21,457
onnx
onnx/reference/ops/op_flatten.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops._op import OpRunUnary class Flatten(OpRunUnary): def _run(self, x, axis=None): i = axis or self.axis shape = x.shape new_shape = ...
17
419
pyomo
pyomo/solvers/tests/mip/test_scip.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...
117
4,593
sphinx
sphinx/ext/apidoc/_cli.py
.py
from __future__ import annotations import argparse import fnmatch import locale import re import sys from pathlib import Path from typing import TYPE_CHECKING import sphinx.locale from sphinx import __display_version__ from sphinx.cmd.quickstart import EXTENSIONS from sphinx.ext.apidoc._generate import create_modules...
357
10,182
astropy
astropy/timeseries/tests/test_sampled.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from datetime import datetime import pytest from numpy.testing import assert_allclose, assert_equal from astropy import units as u from astropy.table import Column, Table from astropy.tests.helper import assert_quantity_allclose from astropy.time import...
520
17,843
onnx
onnx/reference/ops/op_swish.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops._op import OpRunUnaryNum class Swish(OpRunUnaryNum): def _run(self, x, alpha=None): alpha = self.alpha if alpha is None else alpha return...
15
375
confluent-kafka-python
src/confluent_kafka/admin/_topic.py
.py
# Copyright 2023 Confluent Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
59
1,927
onnx
onnx/backend/test/case/model/single_relu.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.model import expect class SingleRelu(Base): @staticmethod def export() -> None: ...
37
1,086
conda
conda/common/_os/osx.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause import platform from subprocess import check_output def mac_ver() -> str: """ Returns macOS version, without compatibility modes for 11.x. https://github.com/conda/conda/issues/13832 If Python was compiled against macOS <=10.15...
22
742
biopython
Tests/test_PDB_MMCIFParser.py
.py
# Copyright 2012 Lenna X. Peterson (arklenna@gmail.com). # 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. # ...
413
17,263
wagtail
wagtail/admin/ui/tables/pages.py
.py
from django.utils.safestring import mark_safe from django.utils.translation import gettext from wagtail.admin.ui.tables import BaseColumn, BulkActionsCheckboxColumn, Column, Table from wagtail.admin.ui.tables.orderable import OrderableTableMixin class PageTitleColumn(BaseColumn): """ A column that displays t...
222
8,992
loguru
tests/test_filesink_permissions.py
.py
import os from stat import S_IMODE import pytest from loguru import logger @pytest.fixture(scope="module", autouse=True) def set_umask(): default = os.umask(0) yield os.umask(default) @pytest.mark.parametrize("permissions", [0o777, 0o766, 0o744, 0o700, 0o611]) def test_log_file_permissions(tmp_path, p...
46
1,304
kafka
tests/kafkatest/tests/streams/streams_named_repartition_topic_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 use ...
97
4,105
textual
docs/examples/guide/widgets/tooltip02.py
.py
from textual.app import App, ComposeResult from textual.widgets import Button TEXT = """I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration. I will face my fear.""" class TooltipApp(App): CSS = """ Screen { align: center middle; } Tooltip { ...
32
643
probability
discussion/pathfinder/pathfinder_test.py
.py
# Copyright 2021 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...
124
3,930
probability
spinoffs/inference_gym/inference_gym/targets/ground_truth/synthetic_log_gaussian_cox_process.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...
362
8,978
loguru
loguru/_file_sink.py
.py
import datetime import decimal import glob import numbers import os import shutil import string from functools import partial from stat import ST_DEV, ST_INO from . import _string_parsers as string_parsers from ._ctime_functions import get_ctime, set_ctime from ._datetime import aware_now def generate_rename_path(ro...
443
14,951
ipython
IPython/lib/lexers.py
.py
""" The IPython lexers are now a separate package, ipython-pygments-lexers. Importing from here is deprecated and may break in the future. """ # ----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. # # Distributed under the terms of the Modif...
32
841
probability
tensorflow_probability/python/optimizer/nelder_mead.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...
872
40,361
mlflow
mlflow/genai/evaluation/__init__.py
.py
from mlflow.genai.evaluation.base import evaluate, to_predict_fn __all__ = ["evaluate", "to_predict_fn"]
4
106
onnxruntime
onnxruntime/test/python/transformers/test_onnx_attention/test_gqa.py
.py
# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- # Copyr...
3,105
112,243
wandb
wandb/sandbox/_auth.py
.py
from __future__ import annotations from collections.abc import Generator from contextlib import contextmanager from contextvars import ContextVar import cwsandbox from cwsandbox import AuthHeaders, CWSandboxAuthenticationError, set_auth_mode import wandb from wandb.errors import UsageError from wandb.sdk import wand...
94
3,046
onnx
onnx/backend/test/case/node/or_.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 Or(Base): @staticmethod def export() -> None: node = o...
77
2,482
clearml
clearml/utilities/hashing.py
.py
import hashlib import sys StrHashFunction = str # Literal["md5", "sha256", "sha384", "sha512"] # ``usedforsecurity`` was added to hashlib constructors in Python 3.9. # All hashing in this SDK is non-cryptographic # (caching, deduplication, identity, path shortening), # so we pass ``usedforsecurity=False`` where supp...
115
2,706
beam
sdks/python/apache_beam/utils/retry.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...
333
13,227
mlflow
tests/genai/judges/optimizers/test_gepa.py
.py
from importlib import reload from unittest.mock import MagicMock, patch import dspy import pytest from mlflow.exceptions import MlflowException from mlflow.genai.judges.optimizers import GEPAAlignmentOptimizer from tests.genai.judges.optimizers.conftest import create_mock_judge_invocator def test_dspy_optimize_no_...
178
7,140
saleor
saleor/graphql/order/tests/benchmark/test_order.py
.py
import graphene import pytest from ....checkout.tests.benchmark.test_checkout_mutations import ( FRAGMENT_ADDRESS, FRAGMENT_PRODUCT_VARIANT, ) from ....tests.utils import get_graphql_content FRAGMENT_DISCOUNTS = """ fragment OrderDiscounts on OrderDiscount { id type valueType value name ...
274
5,522
beam
sdks/python/apache_beam/transforms/error_handling.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...
127
4,537
sqlmap
tamper/space2dash.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import random import string from lib.core.compat import xrange from lib.core.enums import PRIORITY __priority__ = PRIORITY.LOW def tamper(payload, **kwargs): """ Replac...
58
1,669
probability
tensorflow_probability/python/math/psd_kernels/internal/util_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...
208
8,340
hatch
src/hatch/publish/auth.py
.py
from __future__ import annotations from hatch.utils.fs import Path class AuthenticationCredentials: def __init__( self, app, cache_dir: Path, options: dict, repo: str, repo_config: dict[str, str], ): self._app = app self._pwu_path = cache_dir / ...
117
3,864
readthedocs.org
readthedocs/allauth/providers/githubapp/provider.py
.py
from allauth.socialaccount.providers.github.provider import GitHubProvider from readthedocs.allauth.providers.githubapp.views import GitHubAppOAuth2Adapter class GitHubAppProvider(GitHubProvider): """ Provider for GitHub App. We subclass the GitHubProvider to have two separate providers for the GitHub O...
18
470
astropy
astropy/io/fits/tests/test_fitsdiff.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import os import numpy as np import pytest from astropy import __version__ as version from astropy.io import fits from astropy.io.fits import FITSDiff, HDUList, Header, ImageHDU from astropy.io.fits.convenience import writeto from astropy.io.fits.hdu im...
392
13,027
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/quad_over_lin_canon.py
.py
from cvxpy.reductions.dgp2dcp.canonicalizers.add_canon import add_canon from cvxpy.reductions.dgp2dcp.util import explicit_sum def quad_over_lin_canon(expr, args): summed = explicit_sum(2 * args[0]) numerator, _ = add_canon(summed, summed.args) return numerator - args[1], []
9
290
metrics
src/torchmetrics/functional/classification/hinge.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...
289
12,404
coremltools
coremltools/test/sklearn_tests/test_feature_names.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 import unittest import coremltools.models._feature_management as fm import coremltools.models.datatypes...
31
1,031
textual
docs/examples/widgets/collapsible_nested.py
.py
from textual.app import App, ComposeResult from textual.widgets import Collapsible, Label class CollapsibleApp(App[None]): def compose(self) -> ComposeResult: with Collapsible(collapsed=False): with Collapsible(): yield Label("Hello, world.") if __name__ == "__main__": ap...
15
355
saleor
saleor/graphql/plugins/dataloaders.py
.py
from collections import defaultdict from functools import partial, wraps from promise import Promise from ...core.middleware import Requestor from ...plugins.manager import PluginsManager, get_plugins_manager from ...plugins.models import EmailTemplate from ..app.dataloaders import get_app_promise from ..core import ...
71
2,441
ipython
IPython/core/alias.py
.py
""" System command aliases. Authors: * Fernando Perez * Brian Granger """ from __future__ import annotations #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. # # The full licen...
267
10,209
openvino
tests/layer_tests/tensorflow_lite_tests/test_tfl_Select.py
.py
import pytest import tensorflow as tf from common.tflite_layer_test_class import TFLiteLayerTest test_params = [ {'shape': [2, 3, 1, 2, 2], 'condition': [True, False]}, {'shape': [4, 3, 1, 2], 'condition': [False, False, False, True]}, {'shape': [2, 3], 'condition': [[True, True, True], [False, False, Fal...
36
1,361
wandb
wandb/sdk/lib/gitlib.py
.py
from __future__ import annotations import logging import os import re import shutil import subprocess from dataclasses import dataclass from urllib.parse import urlparse, urlunparse import wandb logger = logging.getLogger(__name__) # The environment variable GitPython used for locating the git executable, # honored...
420
13,424
gunicorn
tests/requests/invalid/chunked_01.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. from gunicorn.http.errors import InvalidChunkSize request = InvalidChunkSize
7
183
beam
sdks/python/apache_beam/transforms/maven_repository_url_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...
225
9,371
onnxruntime
onnxruntime/test/testdata/transform/fusion/matmul_integer_to_float_large_tensor.py
.py
import onnx from onnx import TensorProto, helper def GenerateModel(model_name): # noqa: N802 inputs = [] outputs = [] initializers = [] nodes = [] inputs.append(helper.make_tensor_value_info("inputA", TensorProto.FLOAT, [16, 32, 1280, 1280])) inputs.append(helper.make_tensor_value_info("inpu...
48
1,540
onnxruntime
onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/OperatorSetId.py
.py
# automatically generated by the FlatBuffers compiler, do not modify # namespace: fbs import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class OperatorSetId(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0): n = flatbuffers.encode.Get(fl...
68
2,032
probability
tensorflow_probability/python/internal/backend/numpy/gen/slicing.py
.py
# Copyright 2020 The TensorFlow Probability Authors. All Rights Reserved. # @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ # THIS FILE IS AUTO-GENERATED BY `gen_linear_operators.py`. # DO NOT MODIFY DIRECTLY. # @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...
221
9,238
coveragepy
tests/modules/runmod1.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("runmod1: passed %s" % sys.argv[1])
8
245
luigi
luigi/server.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...
380
14,507
mlflow
mlflow/bedrock/utils.py
.py
import logging from typing import Any, Callable, Sequence from mlflow.bedrock import FLAVOR_NAME from mlflow.environment_variables import _MLFLOW_TESTING from mlflow.tracing.constant import TokenUsageKey from mlflow.utils.autologging_utils.config import AutoLoggingConfig _logger = logging.getLogger(__name__) # Token...
213
8,539
metrics
tests/unittests/classification/test_cohen_kappa.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...
254
10,369