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
wandb
wandb/sdk/artifacts/_generated/delete_artifact.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/artifacts/ from __future__ import annotations from wandb._pydantic import GQLId, GQLResult class DeleteArtifact(GQLResult): result: DeleteArtifactResult | None class DeleteArtifactResult(GQLResult): artifact: DeleteArtifactResultArtifact cla...
23
448
readthedocs.org
readthedocs/rtd_tests/tests/test_gold.py
.py
from django.test import TestCase from django.urls import reverse from django_dynamic_fixture import fixture, get from readthedocs.gold.models import LEVEL_CHOICES, GoldUser from readthedocs.projects.models import Project from readthedocs.rtd_tests.utils import create_user class GoldViewTests(TestCase): def setUp...
59
2,148
mkdocs
setup.py
.py
"""Installation using setup.py is no longer supported. Use `python -m pip install .` instead.""" import sys from setuptools import setup sys.exit(__doc__) # Fake reference so GitHub still considers it a real package for statistics purposes. setup( name="mkdocs", )
14
273
probability
tensorflow_probability/python/experimental/distributions/__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...
39
2,041
probability
tensorflow_probability/python/bijectors/rayleigh_cdf_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...
87
3,493
mlflow
mlflow/store/fs2db/_tracking.py
.py
""" Migrate tracking store entities from FileStore to DB. FileStore layout: <mlruns>/ ├── <experiment_id>/ │ ├── meta.yaml -> experiments │ ├── tags/<key> -> experiment_tags │ ├── <run_uuid>/ │ │ ├── meta.yaml -> runs │ │ ├─...
712
24,290
saleor
saleor/tests/e2e/checkout/utils/__init__.py
.py
from ...orders.utils.draft_order_create import draft_order_create from ...orders.utils.order_lines_create import order_lines_create from ...product.utils.product_channel_listing import raw_create_product_channel_listing from .checkout_add_promo_code import ( checkout_add_promo_code, raw_checkout_add_promo_code,...
52
1,977
openvino
tests/e2e_tests/common/postprocessors/image_modifications.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Postprocessor for image modification tasks such as super-resolution, style transfer. It takes normalized image and converts it back to colored picture""" from .provider import ClassProvider import numpy as np import logging as log ...
31
1,219
wagtail
wagtail/test/snippets/apps.py
.py
from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ class WagtailSnippetsTestsAppConfig(AppConfig): default_auto_field = "django.db.models.AutoField" name = "wagtail.test.snippets" label = "snippetstests" verbose_name = _("Wagtail snippets tests") def ready(se...
20
916
hypercorn
src/hypercorn/asyncio/udp_server.py
.py
from __future__ import annotations import asyncio from typing import TYPE_CHECKING from .task_group import TaskGroup from .worker_context import WorkerContext from ..config import Config from ..events import Event, RawData from ..typing import AppWrapper, ConnectionState, LifespanState from ..utils import parse_socke...
69
2,379
readthedocs.org
readthedocs/core/tests/test_history.py
.py
from unittest import mock from django.contrib.auth.models import User from django.test import TestCase from django.urls import reverse from django_dynamic_fixture import get from readthedocs.projects.models import Project class TestHistoricalModels(TestCase): def setUp(self): self.user = get(User) ...
54
2,297
metrics
src/torchmetrics/multimodal/clip_score.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...
264
10,941
sqlmap
thirdparty/chardet/langbulgarianmodel.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from .sbcharsetprober import SingleByteCharSetModel # 3: Positive # 2: Likely # 1: Unlikely # 0: Negative BULGARIAN_LANG_MODEL = { 63: { # 'e' 63: 1, # 'e' 45: 0, # '\xad' 31: 0, # 'А' 32: 0, # 'Б' 35: 0, # 'В' 4...
4,651
105,678
scikit-optimize
doc/conf.py
.py
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ------------------------------------------------------------...
384
12,427
beam
sdks/python/apache_beam/dataframe/pandas_doctests_test.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
1,049
50,025
python-prompt-toolkit
src/prompt_toolkit/layout/scrollable_pane.py
.py
from __future__ import annotations from prompt_toolkit.data_structures import Point from prompt_toolkit.filters import FilterOrBool, to_filter from prompt_toolkit.key_binding import KeyBindingsBase from prompt_toolkit.mouse_events import MouseEvent from .containers import Container, ScrollOffsets from .dimension impo...
495
19,264
onnxruntime
orttraining/orttraining/test/python/orttraining_test_ort_apis.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # This file contains calls to the tests for ONNXBlock (front end tooling for ort training apis) and training apis. # The tests are run in a separate process to avoid testing the entire ort suite of test...
60
1,692
saleor
saleor/tests/e2e/orders/discounts/test_order_promotion_still_applied_to_the_order_when_promotion_is_removed.py
.py
import pytest from .....product.tasks import recalculate_discounted_price_for_products_task from ... import DEFAULT_ADDRESS from ...product.utils.preparing_product import prepare_product from ...product.utils.product_query import get_product from ...promotions.utils import ( create_promotion, create_promotion_...
164
6,536
onnxruntime
onnxruntime/test/testdata/transform/pre_shape_node_elimination.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import onnx from onnx import OperatorSetIdProto, TensorProto, helper in...
41
1,586
bazel
src/test/py/bazel/bazel_windows_symlinks_test.py
.py
# Copyright 2019 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...
65
1,985
black
tests/data/cases/comments4.py
.py
from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import ( MyLovelyCompanyTeamProjectComponent, # NOT DRY ) from com.my_lovely_company.my_lovely_team.my_lovely_project.my_lovely_component import ( MyLovelyCompanyTeamProjectComponent as component, # DRY ) class C: @pytest.ma...
95
3,532
saleor
saleor/product/tests/test_generate_and_set_variant_name.py
.py
from unittest.mock import MagicMock, Mock from ...attribute import AttributeInputType from ...attribute.models import AttributeValue from ...attribute.utils import associate_attribute_values_to_instance from ..models import ProductType from ..tasks import _update_variants_names from ..utils.variants import generate_an...
212
7,780
saleor
saleor/graphql/order/mutations/draft_order_update.py
.py
from typing import cast import graphene from django.core.exceptions import ValidationError from ....account.models import User from ....checkout import AddressType from ....core.tracing import traced_atomic_transaction from ....core.utils.update_mutation_manager import InstanceTracker from ....discount.models import ...
447
16,734
coremltools
coremltools/optimize/torch/quantization/_utils.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 math import operator as _operator from collections import defaultdict from enum import Enum as...
262
8,119
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/groupbykey_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");...
54
1,724
mlflow
mlflow/entities/file_info.py
.py
from mlflow.entities._mlflow_object import _MlflowObject from mlflow.protos.service_pb2 import FileInfo as ProtoFileInfo class FileInfo(_MlflowObject): """ Metadata about a file or directory. """ def __init__(self, path, is_dir, file_size): self._path = path self._is_dir = is_dir ...
46
1,215
beam
sdks/python/apache_beam/examples/cookbook/mergecontacts.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...
148
6,014
astropy
astropy/utils/iers/tests/test_leap_second.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import locale import os import pkgutil import platform import urllib.request import erfa import numpy as np import pytest from numpy.testing import assert_array_equal import astropy from astropy.tests.helper import CI from astropy.time import Time, TimeD...
510
21,325
saleor
saleor/graphql/product/tests/queries/products_filtrations/test_over_attributes_datetime.py
.py
import datetime import pytest from ......attribute import AttributeInputType, AttributeType from ......attribute.models import Attribute from ......attribute.utils import associate_attribute_values_to_instance from .....tests.utils import get_graphql_content from .shared import PRODUCTS_FILTER_QUERY, PRODUCTS_WHERE_Q...
132
4,129
gunicorn
examples/sendfile.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. # # Example code from Eventlet sources import os from wsgiref.validate import validator # @validator # breaks sendfile def app(environ, start_response): """Simplest possible application object""" status ...
24
583
saleor
saleor/tests/e2e/orders/test_cancel_fully_paid_order.py
.py
import pytest from .. import DEFAULT_ADDRESS from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_default_shop from ..transactions.utils import create_transaction from ..utils import assign_permissions from .utils import ( draft_order_complete, draft_ord...
116
3,931
scikit-optimize
skopt/tests/test_benchmarks.py
.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from numpy.testing import assert_almost_equal from skopt.benchmarks import branin from skopt.benchmarks import hart6 @pytest.mark.fast_test def test_branin(): xstars = np.asarray([(-np.pi, 12.275), (+np.pi, 2.275), (9.42478, 2....
24
716
sphinx
tests/roots/test-ext-autodoc/target/name_mangling.py
.py
class Foo: #: name of Foo __name = None __age = None class Bar(Foo): __address = None #: a member having mangled-like name _Baz__email = None
12
169
scikit-bio
skbio/metadata/__init__.py
.py
r"""Metadata (:mod:`skbio.metadata`) ================================ .. currentmodule:: skbio.metadata This module provides functionality for storing and working with metadata -- the data that describes other data. While a typical data table (see :mod:`skbio.table`) stores the measurements of features in samples, me...
88
1,947
biopython
Tests/test_SCOP_Dom.py
.py
# Copyright 2001 by Gavin E. Crooks. 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. """Unit test for Dom. This test requires the mini DOM file 'testDom.txt' """ import unitte...
55
1,763
onnxruntime
orttraining/orttraining/python/training/ortmodule/torch_cpp_extensions/cpu/torch_interop_utils/fake_ctx.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- class FakeContext: """A mock up class used to represent ctx in unsf...
14
471
coremltools
coremltools/converters/sklearn/_NuSVR.py
.py
# Copyright (c) 2017, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from ..._deps import _HAS_SKLEARN from . import _SVR as _SVR if _HAS_SKLEARN: from sklearn.svm impo...
55
1,458
sphinx
tests/roots/test-ext-extlinks-hardcoded-urls/conf.py
.py
extensions = ['sphinx.ext.extlinks'] extlinks = {'issue': ('https://github.com/sphinx-doc/sphinx/issues/%s', 'issue %s')} extlinks_detect_hardcoded_links = True
4
161
openvino
tests/layer_tests/tensorflow_tests/test_tf_SelectV2.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest class TestSelectV2(CommonTFLayerTest): def _prepare_input(self, inputs_info): assert 'cond:0' in inputs_info,...
96
4,585
textual
src/textual/widgets/_footer.py
.py
from __future__ import annotations from collections import defaultdict from itertools import groupby from typing import TYPE_CHECKING import rich.repr from rich.text import Text from textual import events from textual.app import ComposeResult from textual.binding import Binding from textual.containers import Horizon...
334
10,585
metrics
src/torchmetrics/video/vmaf.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...
188
10,016
deap
examples/ga/tsp.py
.py
# This file is part of DEAP. # # DEAP is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation, either version 3 of # the License, or (at your option) any later version. # # DEAP is distributed ...
77
2,494
conda
tests/shards/test_coverage.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """ Fast, mostly AI-generated tests to help reach 100% coverage of conda shards modules. Tests focus on uncovered code paths in: - misc.py: URL handling, threading, exception handling - cache.py: Database operations, WAL mode, error recovery - ...
995
36,850
mlflow
tests/models/test_model_input_examples.py
.py
import json import math from io import StringIO from unittest import mock import numpy as np import pandas as pd import pytest import sklearn.linear_model as logreg_module from scipy.sparse import csc_matrix, csr_matrix from sklearn import datasets from sklearn.base import BaseEstimator, ClassifierMixin import mlflow...
454
16,754
onnxruntime
onnxruntime/test/testdata/capi_symbolic_dims.py
.py
import onnx from onnx import TensorProto, helper, shape_inference # create output with rank but unnamed symbolic dim output = helper.make_tensor_value_info("C", TensorProto.FLOAT, [1]) output.type.tensor_type.shape.Clear() dim = output.type.tensor_type.shape.dim.add() print(dim) graph_def = helper.make_graph( nod...
37
1,151
pyomo
doc/OnlineDocs/src/scripting/spy4Expressions.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...
132
3,079
onnxruntime
onnxruntime/test/testdata/transform/model_parallel/bart_mlp_megatron_basic_test.py
.py
import numpy as np import onnx from onnx import OperatorSetIdProto, TensorProto, helper, numpy_helper hidden_size = 4 weight_dim_to_split = 16 X = helper.make_tensor_value_info("input", TensorProto.FLOAT, ["batch", "seqlen", hidden_size]) Y = helper.make_tensor_value_info("output", TensorProto.FLOAT, ["batch", "seqle...
145
4,063
coremltools
coremltools/converters/mil/backend/nn/passes/handle_return_inputs_as_outputs.py
.py
# Copyright (c) 2020, 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 Builder as mb from coremltools.converters.mil.mil.passes.g...
63
2,153
python-prompt-toolkit
src/prompt_toolkit/completion/base.py
.py
""" """ from __future__ import annotations from abc import ABCMeta, abstractmethod from collections.abc import AsyncGenerator, Callable, Iterable, Sequence from prompt_toolkit.document import Document from prompt_toolkit.eventloop import aclosing, generator_to_async_generator from prompt_toolkit.filters import Filte...
439
16,112
readthedocs.org
readthedocs/oauth/services/gitlab.py
.py
"""OAuth utility functions.""" import json import re from urllib.parse import quote_plus from urllib.parse import urlparse import structlog from allauth.socialaccount.providers.gitlab.provider import GitLabProvider from django.conf import settings from oauthlib.oauth2.rfc6749.errors import InvalidGrantError from oaut...
575
20,052
pyro
pyro/ops/einsum/torch_marginal.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import pyro.ops.einsum.torch_log from pyro.ops.einsum.adjoint import Backward, transpose from pyro.ops.einsum.util import Tensordot class _EinsumBackward(Backward): def __init__(self, equation, operands): self.equatio...
63
2,234
onnxruntime
onnxruntime/python/tools/quantization/execution_providers/qnn/fusion_spacetodepth.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- """Define ...
163
6,123
hatch
tests/cli/status/test_status.py
.py
import pytest from hatch.config.constants import ConfigEnvVars from hatch.utils.fs import temp_chdir from hatch.utils.structures import EnvVars class TestModeLocalDefault: def test_no_project(self, hatch, isolation, config_file, helpers): result = hatch("status") assert result.exit_code == 0, re...
272
8,727
metrics
tests/unittests/image/test_ms_ssim.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...
137
4,995
mlflow
mlflow/diffusers/__init__.py
.py
""" The ``mlflow.diffusers`` module provides an API for logging and loading diffusion model LoRA adapters as MLflow Models. This module exports adapter models with the following flavors: :py:mod:`mlflow.diffusers` Adapter weights in safetensors format, with a reference to the base model. :py:mod:`mlflow.pyfunc` ...
541
20,534
probability
tensorflow_probability/python/experimental/marginalize/__init__.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...
26
1,064
django-cms
cms/tests/test_forms.py
.py
from html import unescape from django.contrib.auth import get_user_model from django.contrib.sites.models import Site from django.core.cache import cache from django.core.exceptions import ValidationError from django.utils.translation import override as force_language from cms.admin import forms from cms.admin.forms ...
660
26,943
saleor
saleor/graphql/giftcard/tests/mutations/test_gift_card_create.py
.py
import datetime import json from unittest import mock import graphene import pytest from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....core.utils.json_serializer import CustomJsonEncoder from .....giftcard import GiftCardEvents from .....giftcard.error_codes import GiftCa...
1,082
30,754
kombu
t/integration/__init__.py
.py
from __future__ import annotations import os import sys sys.path.insert(0, os.pardir) sys.path.insert(0, os.getcwd())
8
120
gunicorn
gunicorn/dirty/worker.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Dirty Worker Process Asyncio-based worker that loads dirty apps and handles requests from the DirtyArbiter. Threading Model --------------- Each dirty worker runs an asyncio event loop in the main thread for:...
531
17,476
qutip
qutip/tests/core/test_options.py
.py
import pytest import numpy import qutip from qutip.core.numpy_backend import np from qutip import CoreOptions, settings # Mocking JAX to demonstrate backend switching class Mock_JAX: def sum(*a, **kw): return "jax_sum" def __getattr__(self, _): return "other" mock_jax = Mock_JAX() mock_np ...
90
3,193
hydra
hydra/version.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # Source of truth for Hydra's version import re from textwrap import dedent from typing import Any, Tuple from . import __version__ from ._internal.deprecation_warning import deprecation_warning from .core.singleton import Singleton from .errors ...
86
2,638
metrics
tests/unittests/image/test_rase.py
.py
# Copyright The PyTorch 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 i...
101
3,592
saleor
saleor/site/context_processors.py
.py
from typing import TYPE_CHECKING from django.contrib.sites.models import Site from django.contrib.sites.shortcuts import get_current_site from django.db.models import prefetch_related_objects if TYPE_CHECKING: from django.http.request import HttpRequest def site(request: "HttpRequest") -> dict: """Add site ...
17
530
metrics
tests/unittests/wrappers/test_multitask.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...
330
13,949
pyomo
pyomo/contrib/mpc/examples/cstr/model.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
177
5,280
metrics
src/torchmetrics/functional/classification/confusion_matrix.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...
656
27,785
toolz
toolz/tests/test_dicttoolz.py
.py
from collections import defaultdict as _defaultdict from collections.abc import Mapping import os from toolz.dicttoolz import (merge, merge_with, valmap, keymap, update_in, assoc, dissoc, keyfilter, valfilter, itemmap, itemfilter, assoc_in) from toolz.functoolz ...
271
9,037
beam
sdks/python/apache_beam/examples/complete/estimate_pi_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...
55
1,845
mlflow
mlflow/genai/scorers/deepeval/scorers/agentic_metrics.py
.py
"""Agentic metrics for evaluating AI agent performance.""" from __future__ import annotations from typing import ClassVar from mlflow.genai.judges.builtin import _MODEL_API_DOC from mlflow.genai.scorers.deepeval import DeepEvalScorer from mlflow.utils.docstring_utils import format_docstring @format_docstring(_MODE...
174
5,560
sphinx
tests/test_util/test_util_nodes.py
.py
"""Tests uti.nodes functions.""" from __future__ import annotations from textwrap import dedent from typing import TYPE_CHECKING, Any import pytest from docutils import frontend, nodes from docutils.parsers import rst from docutils.utils import new_document from sphinx.transforms import ApplySourceWorkaround from s...
276
7,942
textual
tests/test_dom.py
.py
import pytest from textual.css.errors import StyleValueError from textual.dom import BadIdentifier, DOMNode def test_display_default(): node = DOMNode() assert node.display is True @pytest.mark.parametrize( "setter_value,style_value", [[True, "block"], [False, "none"], ["block", "block"], ["none", ...
283
6,918
openvino
src/bindings/python/tests/test_graph/test_gqa_extension.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from openvino import Core, Extension from openvino.op import _GroupQueryAttentionExtension def test_gqa_extension_is_extension(): ext = _GroupQueryAttentionExtension() assert isinstance(ex...
20
480
biopython
Bio/ExPASy/__init__.py
.py
# Copyright 2000 by Jeffrey Chang. 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. """Code to access resources at ExPASy over the WWW. See https://www.expasy.org/ Functions: ...
139
4,357
coveragepy
tests/test_templite.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.templite.""" from __future__ import annotations import re from types import SimpleNamespace from typing import Any, ContextManager impor...
388
13,642
coremltools
coremltools/converters/mil/mil/ops/tests/iOS17/test_quantization.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 itertools from typing import Tuple import numpy as np import pytest from coremltools._deps i...
495
17,939
confluent-kafka-python
examples/avro_consumer.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2020 Confluent Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
121
3,819
scikit-bio
skbio/io/format/clustal.py
.py
r"""Clustal format (:mod:`skbio.io.format.clustal`) =============================================== .. currentmodule:: skbio.io.format.clustal Clustal format (``clustal``) stores multiple sequence alignments. This format was originally introduced in the Clustal package [1]_. Format Support -------------- **Has Sniff...
354
12,348
mamba
update_changelog.py
.py
# Script to update `CHANGELOG.md` in order to release any of the mamba packages # Steps: # 1. Run this script to update the root `CHANGELOG.md` file by providing the date of # the last release as input (cf. last date shown at the top of the file for reference) # or any other starting date that may be relevant for the...
196
7,747
beam
sdks/python/apache_beam/testing/benchmarks/inference/pytorch_image_captioning_benchmarks.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...
43
1,594
probability
tensorflow_probability/python/sts/components/semilocal_linear_trend_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...
205
8,194
mlflow
tests/litellm/test_litellm_autolog.py
.py
import asyncio import litellm import pytest import mlflow from mlflow.entities.span import SpanType from tests.tracing.helper import get_traces def _assert_usage( attributes, expected_prompt_tokens=None, expected_completion_tokens=None, expected_total_tokens=None, ): if "mlflow.chat.tokenUsage"...
228
7,477
hydra
examples/tutorials/basic/your_first_hydra_app/3_using_config/my_app.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from omegaconf import DictConfig, MissingMandatoryValue, open_dict from pytest import raises import hydra @hydra.main(config_path=".", config_name="config") def my_app(cfg: DictConfig) -> None: assert cfg.node.loompa == 10 # attribute style ...
36
1,238
beam
sdks/python/apache_beam/dataframe/frame_base_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...
195
7,423
cvxpy
cvxpy/error.py
.py
""" Copyright 2013 Steven Diamond 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...
68
1,378
coremltools
coremltools/optimize/torch/palettization/_supported_modules.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 typing import Dict as _Dict from typing import List as _List from typing import Optional as _Opt...
369
12,659
saleor
saleor/graphql/app/dataloaders/app_tokens.py
.py
from collections import defaultdict from ....app.models import AppToken from ...core.dataloaders import DataLoader class AppTokensByAppIdLoader(DataLoader[str, AppToken]): context_key = "app_tokens_by_app_id" def batch_load(self, keys): tokens = AppToken.objects.using(self.database_connection_name)....
18
599
metrics
src/torchmetrics/classification/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...
337
13,717
mlflow
tests/types/test_genai_types.py
.py
import pytest from pydantic import ValidationError from mlflow.types.chat import ChatCompletionResponse def test_instantiation_chat_completion(): response_structure = { "id": "1", "object": "1", "created": 1, "model": "model", "choices": [ { "in...
91
3,043
astropy
astropy/visualization/units.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from contextlib import ContextDecorator import numpy as np from astropy import units as u from astropy.utils.compat.optional_deps import HAS_MATPLOTLIB __all__ = ["MplQuantityConverter", "quantity_support"] __doctest_skip__ = ["quantity_support"] _de...
161
5,706
mkdocs-material
material/utilities/filter/__init__.py
.py
# Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com> # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, c...
125
3,963
coremltools
coremltools/test/optimize/torch/palettization/test_palettizer.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 from coremltools.optimize.torch.palettization import ( DKMPalettizer,...
121
4,600
luigi
luigi/contrib/redshift.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...
741
24,400
probability
tensorflow_probability/python/distributions/stochastic_process_properties_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...
604
22,628
onnxruntime
onnxruntime/test/testdata/loop_sub_one.py
.py
from onnx import TensorProto, checker, helper, save, shape_inference """ x = A for (int i = 0; i < MAX_ITERS; i++) { y = x - 1.0 user_val = x - 1.0 x = y } C = x D = user_val (will be the concatenated result of all iterations) """ loop_body = helper.make_graph( nodes=[ helper.make_node( ...
70
2,025
black
tests/data/cases/context_managers_autodetect_310.py
.py
# flags: --minimum-version=3.10 # This file uses pattern matching introduced in Python 3.10. match http_code: case 404: print("Not found") with \ make_context_manager1() as cm1, \ make_context_manager2() as cm2, \ make_context_manager3() as cm3, \ make_context_manager4() as cm4 \ : ...
37
627
sphinx
sphinx/builders/latex/constants.py
.py
"""constants for LaTeX builder.""" from __future__ import annotations from typing import TYPE_CHECKING if TYPE_CHECKING: from typing import Any PDFLATEX_DEFAULT_FONTPKG = r""" \usepackage{tgtermes} \usepackage{tgheros} \renewcommand{\ttdefault}{txtt} """ PDFLATEX_DEFAULT_FONTSUBSTITUTION = r""" \expandafter\if...
219
7,432
kombu
examples/complete_send.py
.py
""" Example producer that sends a single message and exits. You can use `complete_receive.py` to receive the message sent. """ from __future__ import annotations from kombu import Connection, Exchange, Producer, Queue #: By default messages sent to exchanges are persistent (delivery_mode=2), #: and queues and exc...
37
1,174
django-cms
cms/wizards/views.py
.py
import os from django.conf import settings from django.core.exceptions import PermissionDenied from django.core.files.storage import FileSystemStorage from django.forms import Form from django.http import HttpResponse from django.urls import NoReverseMatch from django.utils.html import escape from formtools.wizard.vie...
206
7,564
beam
learning/katas/python/Core Transforms/GroupByKey/GroupByKey/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...
44
1,416