repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
metrics
tests/unittests/clustering/test_utils.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...
118
4,732
loguru
tests/exceptions/source/modern/walrus_operator.py
.py
# fmt: off import sys from loguru import logger def foo(): if a := "a" + (x:=1/0): pass def bar(): return [y for x in [1, 2] if (y := foo()) != 0] @logger.catch def main(): walrus = False (walrus := foo()) logger.remove() logger.add(sys.stderr, format="", diagnose=True, backtrace=True, ...
26
343
mlflow
mlflow/genai/scorers/deepeval/scorers/rag_metrics.py
.py
"""RAG (Retrieval-Augmented Generation) metrics for DeepEval integration.""" 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 @form...
147
5,124
saleor
saleor/graphql/app/mutations/app_update.py
.py
import graphene from django.core.exceptions import ValidationError from ....app import models from ....app.error_codes import AppErrorCode from ....permission.enums import AppPermission, get_permissions from ....webhook.event_types import WebhookEventAsyncType from ...account.utils import can_manage_app from ...core i...
72
2,838
biopython
Bio/Compass/__init__.py
.py
# Copyright 2004 by James Casbon. All rights reserved. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included as part of this # package. """Code to deal with COMP...
224
6,954
wagtail
wagtail/tests/actions/test_edit.py
.py
from unittest import mock from django.contrib.auth.models import Permission from django.forms.models import modelform_factory from django.test import TestCase from wagtail.actions.edit import EditAction, EditPermissionError from wagtail.log_actions import registry as log_registry from wagtail.models import Revision f...
255
10,174
hydra
plugins/hydra_rq_launcher/setup.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # type: ignore from pathlib import Path from read_version import read_version from setuptools import find_namespace_packages, setup setup( name="hydra-rq-launcher", version=read_version("hydra_plugins/hydra_rq_launcher", "__init__.py"), ...
37
1,309
onnxruntime
orttraining/orttraining/python/training/utils/ptable.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- class Row: """A row in a PTable""" def __init__(self, columns:...
72
2,709
coremltools
coremltools/converters/mil/mil/ops/tests/iOS16/test_scatter_gather.py
.py
# Copyright (c) 2023, 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 import numpy as np import pytest import coremltools as ct from coremltools.convert...
247
9,075
beam
sdks/python/apache_beam/yaml/options.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...
37
1,490
django-cms
manage.py
.py
#!/usr/bin/env python import os import sys import warnings from cms.exceptions import DontUsePageAttributeWarning warnings.filterwarnings("ignore", category=DontUsePageAttributeWarning) def consume_option(argv, name): """Pop ``--name value`` from ``argv`` and return the value (or ``None``).""" if name in ar...
66
1,779
wandb
wandb/apis/internal.py
.py
from __future__ import annotations from typing import Any from wandb.sdk.internal.internal_api import Api as InternalApi class Api: """Internal proxy to the official internal API.""" # TODO: Move these methods to PublicApi. def __init__(self, *args: Any, **kwargs: Any) -> None: self._api_args ...
218
6,827
jupytext
tests/data/notebooks/outputs/ipynb_to_script/raw_cell_with_complex_yaml_like_content.py
.py
# --- # # This is a complex paragraph # that is split over multiple lines. # # It also includes blank lines. # # # jupyter: # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- print("Hello, World!")
17
242
saleor
saleor/graphql/plugins/filters.py
.py
import graphene from ..channel.types import Channel from ..core.types import NonNullList from ..utils import get_nodes from .enums import PluginConfigurationType from .types import Plugin def filter_plugin_status_in_channels( plugins: list[Plugin], status_in_channels: dict, database_connection_name: str ) -> lis...
66
2,214
mlflow
dev/clint/src/clint/rules/forbidden_make_judge_in_builtin_scorers.py
.py
import ast from pathlib import Path from clint.resolver import Resolver from clint.rules.base import Rule class ForbiddenMakeJudgeInBuiltinScorers(Rule): """Ensure make_judge is not used in builtin_scorers.py. After switching to InstructionsJudge in builtin_scorers.py, this rule prevents future regressi...
47
1,503
openvino
tests/layer_tests/pytorch_tests/test_cat.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch import numpy as np from pytorch_layer_test_class import PytorchLayerTest class aten_cat(torch.nn.Module): def forward(self, x): return torch.cat(self.prepare_input(x), 1) def prepare_input(s...
330
12,288
mlflow
mlflow/genai/evaluation/job.py
.py
"""Huey job function for the UI-triggered `mlflow.genai.evaluate` flow. This module backs the `POST /ajax-api/3.0/mlflow/genai/evaluate/invoke` endpoint used by the "Run evaluation" modal's "Run judges" button. """ import logging import os import mlflow from mlflow.client import MlflowClient from mlflow.entities.run...
61
2,118
saleor
saleor/graphql/product/tests/queries/test_product_variants_where_unassigned_attribute.py
.py
import graphene import pytest from ....tests.utils import get_graphql_content PRODUCT_ATTRIBUTE_UNASSIGN_MUTATION = """ mutation ProductAttributeUnassign($productTypeId: ID!, $attributeIds: [ID!]!) { productAttributeUnassign( productTypeId: $productTypeId, attributeIds: $attributeIds )...
96
2,981
saleor
saleor/graphql/giftcard/tests/queries/test_gift_card_tags.py
.py
from ....tests.utils import assert_no_permission, get_graphql_content QUERY_GIFT_CARD_TAGS = """ query giftCardTags{ giftCardTags(first: 10) { edges { node { id name } } totalCount } } ""...
67
1,631
probability
tensorflow_probability/python/experimental/bijectors/sharded_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...
110
4,236
openvino
tests/layer_tests/tensorflow_tests/test_tf_Fill.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from common.tf_layer_test_class import CommonTFLayerTest # Testing Fill operation (Initial Implementation) # Documentation: https://www.tensorflow.org/api_docs/python/tf/raw_ops/Fill class TestFillOps(...
55
1,877
kombu
kombu/matcher.py
.py
"""Pattern matching registry.""" from __future__ import annotations from fnmatch import fnmatch from re import match as rematch from typing import Callable, cast from .utils.compat import entrypoints from .utils.encoding import bytes_to_str MatcherFunction = Callable[[str, str], bool] class MatcherNotInstalled(Ex...
145
4,270
pyomo
examples/pyomobook/nonlinear-ch/react_design/ReactorDesignTable.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
31
1,238
saleor
saleor/graphql/attribute/shared_filters.py
.py
from collections.abc import Callable from typing import Literal, TypedDict, cast import graphene from django.db.models import Exists, OuterRef, Q, QuerySet from graphql import GraphQLError from ...attribute import AttributeInputType from ...attribute.models import ( AssignedPageAttributeValue, AssignedProduct...
906
31,420
rq
tests/test_worker_pool.py
.py
import os import signal from multiprocessing import Process from time import sleep from rq.connections import get_connection_kwargs, parse_connection from rq.job import JobStatus from rq.queue import Queue from rq.serializers import JSONSerializer from rq.worker import SimpleWorker from rq.worker_pool import WorkerPoo...
172
7,099
structlog
src/structlog/dev.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. """ Helpers that make development with *structlog* more pleasant. See also the narrative doc...
1,242
37,210
pdm
tests/models/test_auth.py
.py
from __future__ import annotations import pytest from pdm._types import RepositoryConfig from pdm.exceptions import PdmException from pdm.models.auth import Keyring, PdmBasicAuth from pdm.termui import Verbosity def test_auth_selects_closest_source(mocker): sources = [ RepositoryConfig("pypi", "root", u...
134
4,508
python-prompt-toolkit
src/prompt_toolkit/widgets/base.py
.py
""" Collection of reusable components for building full screen applications. All of these widgets implement the ``__pt_container__`` method, which makes them usable in any situation where we are expecting a `prompt_toolkit` container object. .. warning:: At this point, the API for these widgets is considered uns...
1,082
35,572
pyomo
pyomo/contrib/solver/tests/solvers/test_gurobi_persistent.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...
790
28,458
pyomo
examples/pyomo/p-median/pmedian.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...
67
1,977
astropy
astropy/coordinates/tests/test_spectral_coordinate.py
.py
from contextlib import nullcontext import numpy as np import pytest from numpy.testing import assert_allclose import astropy.units as u from astropy import time from astropy.constants import c from astropy.coordinates import ( FK5, GCRS, ICRS, CartesianDifferential, CartesianRepresentation, Ea...
1,133
41,417
scikit-bio
skbio/alignment/_tabular_msa.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. # --------------------------------------------...
2,586
84,640
scikit-bio
skbio/stats/distance/_permdisp.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. # --------------------------------------------...
330
13,551
pyomo
examples/gdp/strip_packing/stripPacking.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...
119
3,757
conda
tests/plugins/subcommands/doctor/health_checks/__init__.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Tests for doctor health checks."""
4
113
pyro
tests/distributions/test_nanmasked.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import math import pytest import torch import pyro import pyro.distributions as dist from pyro.infer import SVI, Trace_ELBO from pyro.infer.autoguide import AutoNormal from pyro.optim import Adam from tests.common import assert_close...
98
3,318
astropy
astropy/wcs/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """World Coordinate System (WCS) transformations in FITS files. .. _wcslib: https://www.atnf.csiro.au/people/mcalabre/WCS/wcslib/index.html .. _distortion paper: https://www.atnf.csiro.au/people/mcalabre/WCS/dcs_20040422.pdf .. _SIP: https://irsa.ipac.cal...
76
3,038
mlflow
tests/transformers/test_transformers_model_export.py
.py
import base64 import gc import importlib.util import json import logging import math import os import pathlib import re import shutil import textwrap from contextlib import contextmanager from pathlib import Path from unittest import mock import huggingface_hub import librosa import numpy as np import pandas as pd imp...
3,980
150,812
beam
learning/tour-of-beam/learning-content/core-transforms/map/pardo-one-to-one/python-example/task.py
.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); y...
57
1,797
biopython
Bio/PDB/MMCIF2Dict.py
.py
# Copyright (C) 2002, Thomas Hamelryck (thamelry@binf.ku.dk) # # 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. """Turn an mmCIF fil...
132
5,063
openvino
tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_minimum.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import tensorflow as tf from common.tf2_layer_test_class import CommonTF2LayerTest class TestKerasMinimum(CommonTF2LayerTest): def create_keras_minimum_net(self, input_names, input_shapes, input_type, ir_version): ...
92
4,417
bazel
third_party/py/mock/tests/testpatch.py
.py
# Copyright (C) 2007-2012 Michael Foord & the mock team # E-mail: fuzzyman AT voidspace DOT org DOT uk # http://www.voidspace.org.uk/python/mock/ import os import sys from tests import support from tests.support import unittest2, inPy3k, SomeClass, is_instance, callable from mock import ( NonCallableMock, Callab...
1,810
53,865
gunicorn
tests/requests/valid/004.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. request = { "method": "GET", "uri": uri("/silly"), "version": (1, 1), "headers": [ ("AAAAAAAAAAAAA", "++++++++++") ], "body": b"" }
14
270
saleor
saleor/graphql/product/tests/queries/products_filtrations/test_over_references_variants.py
.py
import graphene import pytest from ......attribute import AttributeEntityType, AttributeType from ......attribute.models import Attribute, AttributeValue from ......attribute.utils import associate_attribute_values_to_instance from .....core.utils import to_global_id_or_none from .....tests.utils import get_graphql_co...
425
14,113
cvxpy
cvxpy/atoms/elementwise/elementwise.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...
84
2,472
probability
tensorflow_probability/python/experimental/math/__init__.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...
34
1,589
biopython
Tests/test_Align_a2m.py
.py
# Copyright 2006-2014 by Peter Cock. All rights reserved. # Copyright 2022 by Michiel de Hoon. 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.a2m module....
907
54,855
wagtail
wagtail/api/v2/pagination.py
.py
from collections import OrderedDict from django.conf import settings from rest_framework.pagination import BasePagination from rest_framework.response import Response from .utils import BadRequestError class WagtailPagination(BasePagination): def paginate_queryset(self, queryset, request, view=None): li...
54
1,633
pdm
tests/test_formats.py
.py
import shutil from argparse import Namespace import pytest from pdm.compat import tomllib from pdm.formats import MetaConvertError, flit, pipfile, poetry, requirements, setup_py from pdm.formats.uv import uv_file_builder from pdm.models.repositories import LockedRepository from pdm.models.requirements import parse_re...
391
15,956
mlflow
tests/data/test_numpy_dataset.py
.py
import json import numpy as np import pandas as pd import pytest import mlflow.data from mlflow.data.code_dataset_source import CodeDatasetSource from mlflow.data.evaluation_dataset import EvaluationDataset from mlflow.data.filesystem_dataset_source import FileSystemDatasetSource from mlflow.data.numpy_dataset import...
258
9,429
saleor
saleor/account/management/commands/createsuperuser.py
.py
# mypy: ignore-errors """Management utility to create superusers. This module was moved for Django Auth directly to Saleor. """ import getpass import os import sys from django.contrib.auth.password_validation import validate_password from django.core import exceptions from django.core.management.base import BaseComm...
285
12,137
mlflow
tests/store/_unity_catalog/model_registry/test_uc_native_legacy_parity.py
.py
# Parity tests for the UC-native model-registry client migration. # # These assert that when the client reads a model / model version off the native governance # surface (``/api/2.1/unity-catalog/*``, ``RegisteredModelInfo`` / ``ModelVersionInfo`` with the # MLflow-enrichment fields as flattened siblings), it produces ...
352
14,244
python-prompt-toolkit
examples/prompts/regular-language.py
.py
#!/usr/bin/env python """ This is an example of "prompt_toolkit.contrib.regular_languages" which implements a little calculator. Type for instance:: > add 4 4 > sub 4 4 > sin 3.14 This example shows how you can define the grammar of a regular language and how to use variables in this grammar with complet...
110
3,155
pdm
src/pdm/models/versions.py
.py
from __future__ import annotations import re from typing import TYPE_CHECKING, overload from pdm.exceptions import InvalidPyVersion if TYPE_CHECKING: from typing import Any, Literal VersionBit = int | Literal["*"] PRE_RELEASE_SEGMENT_RE = re.compile( r"(?P<digit>\d+)(?P<type>a|b|rc)(?P<n>\d*)", fla...
170
5,898
mlflow
mlflow/protos/facet_feature_statistics_pb2.py
.py
import google.protobuf from packaging.version import Version if Version(google.protobuf.__version__).major >= 5: # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: facet_feature_statistics.proto # Protobuf Python Version: 5.26.0 """Generated protocol buffer code.""" ...
297
26,249
beam
sdks/python/apache_beam/ml/anomaly/univariate/base.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
91
2,757
metrics
src/torchmetrics/regression/explained_variance.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...
179
6,948
coremltools
coremltools/test/xgboost_tests/test_decision_tree_regression_numeric.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 itertools import unittest import pandas as pd import pytest from packaging.version import Versio...
106
3,737
cvxpy
cvxpy/atoms/max.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...
127
3,959
saleor
saleor/product/managers.py
.py
import datetime from typing import Union from django.contrib.postgres.aggregates import StringAgg from django.db import models from django.db.models import ( BooleanField, Case, Count, DateTimeField, Exists, ExpressionWrapper, F, OuterRef, Q, Subquery, Sum, Value, Wh...
402
15,294
pyomo
pyomo/repn/plugins/standard_form.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...
711
26,974
wandb
wandb/proto/v6/wandb_otel_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: wandb/proto/wandb_otel.proto # Protobuf Python Version: 6.30.0 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_...
48
3,271
coremltools
coremltools/converters/xgboost/__init__.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 ._tree import convert
7
243
mlflow
tests/haystack/conftest.py
.py
import pytest from opentelemetry import trace as otel_trace import mlflow from mlflow.tracing.provider import provider from mlflow.utils.autologging_utils import AUTOLOGGING_INTEGRATIONS @pytest.fixture(autouse=True) def clear_autolog_state(reset_tracing): for key in list(AUTOLOGGING_INTEGRATIONS.keys()): ...
24
789
wandb
tests/system_tests/test_core/test_tb_watcher.py
.py
from wandb.sdk.internal import tb_watcher class TestIsTfEventsFileCreatedBy: def test_simple(self): assert tb_watcher.is_tfevents_file_created_by( "out.writer.tfevents.193.me.94.5", "me", 193 ) def test_no_tfevents(self): assert ( tb_watcher.is_tfevents_file_cr...
62
1,682
onnxruntime
onnxruntime/python/tools/transformers/models/llama/benchmark_all.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 a...
489
15,305
wagtail
wagtail/tests/test_management_commands.py
.py
from datetime import timedelta from io import StringIO from unittest import mock import swapper from django.contrib.auth import get_user_model from django.contrib.auth.models import Group from django.core import management from django.core.cache import cache from django.db import models from django.test import TestCas...
898
31,466
mamba
micromamba/tests/test_remove.py
.py
import os import platform import subprocess import time from pathlib import Path import pytest # Need to import everything to get fixtures from .helpers import * # noqa: F403 from . import helpers __this_dir__ = Path(__file__).parent.resolve() @pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) @p...
317
12,220
sphinx
sphinx/search/es.py
.py
"""Spanish search language.""" from __future__ import annotations import snowballstemmer from sphinx.search import SearchLanguage from sphinx.search._stopwords.es import SPANISH_STOPWORDS class SearchSpanish(SearchLanguage): lang = 'es' language_name = 'Spanish' js_stemmer_rawcode = 'spanish-stemmer.js...
23
596
coremltools
deps/pybind11/pybind11/_version.py
.py
from __future__ import annotations def _to_int(s: str) -> int | str: try: return int(s) except ValueError: return s __version__ = "2.13.1" version_info = tuple(_to_int(s) for s in __version__.split("."))
13
232
conda
conda/core/__init__.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """ Code in ``conda.core`` is the core logic. It is strictly forbidden from having side effects. No printing to stdout or stderr, no disk manipulation, no http requests. All side effects should be implemented through ``conda.gateways``. Object...
24
698
wagtail
wagtail/contrib/search_promotions/models.py
.py
import datetime import swapper from django.conf import settings from django.db import models from django.utils import timezone from django.utils.translation import gettext_lazy as _ from wagtail.search.utils import MAX_QUERY_STRING_LENGTH, normalise_query_string class Query(models.Model): query_string = models....
160
4,579
deap
examples/gp/symbreg_numpy.py
.py
# This file is part of EAP. # # EAP 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. # # EAP is distributed in ...
95
3,289
pyro
tests/contrib/gp/test_models.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import logging from collections import namedtuple import pytest import torch import pyro.distributions as dist from pyro.contrib.gp.kernels import RBF, Cosine, Matern32, WhiteNoise from pyro.contrib.gp.likelihoods import Gaussian...
456
15,052
probability
tensorflow_probability/python/distributions/pixel_cnn_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...
300
10,521
beam
sdks/python/apache_beam/io/watermark_estimators_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...
109
5,030
dirty-equals
tests/test_strings.py
.py
import re import pytest from dirty_equals import IsAnyStr, IsBytes, IsStr @pytest.mark.parametrize( 'value,dirty,match', [ # IsStr tests ('foo', IsStr, True), ('foo', IsStr(), True), (b'foo', IsStr, False), ('foo', IsStr(regex='fo{2}'), True), ('foo', IsStr(re...
113
4,252
beam
sdks/python/apache_beam/runners/worker/statesampler_slow.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...
104
3,154
probability
tensorflow_probability/python/distributions/bates_test.py
.py
# Copyright 2020 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
380
14,417
openvino
tests/layer_tests/pytorch_tests/test_prod.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch import random from pytorch_layer_test_class import PytorchLayerTest class aten_prod(torch.nn.Module): def __init__(self, in_dtype): super().__init__() self.in_dtype = in_dtype def fo...
88
2,970
wandb
wandb/apis/paginator.py
.py
from __future__ import annotations import json from abc import ABC, abstractmethod from collections.abc import Callable, Iterable, Iterator, Mapping, Sized from typing import TYPE_CHECKING, Any, ClassVar, Generic, TypeVar, overload import wandb from wandb._strutils import nameof if TYPE_CHECKING: from wandb._pyd...
236
7,980
saleor
saleor/graphql/core/tests/test_scalars.py
.py
from unittest import mock import pytest from ....order.models import Order from ....payment.interface import PaymentGatewayData from ...tests.utils import get_graphql_content, get_graphql_content_from_response from ..utils import to_global_id_or_none QUERY_CHECKOUT = """ query getCheckout($token: UUID!) { checko...
422
10,353
astropy
astropy/wcs/tests/test_auxprm.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # Tests for the auxiliary parameters contained in wcsaux from numpy.testing import assert_allclose from astropy.io import fits from astropy.wcs import WCS STR_PLANETARY_EXPECTED_EMPTY = """ a_radius: b_radius: c_radius: bdis_obs: blon_obs: blat_obs:"""...
199
6,097
coremltools
coremltools/optimize/torch/_utils/math_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 torch as _torch def rmse_error(a, b): return _torch.sqrt(_torch.mean(_torch.square(a - b...
11
324
kafka
tests/kafkatest/tests/tools/replica_verification_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 ...
95
4,315
sphinx
tests/test_directives/test_directive_patch.py
.py
"""Test the patched directives.""" from __future__ import annotations from typing import TYPE_CHECKING import pytest from docutils import nodes from sphinx.testing import restructuredtext from sphinx.testing.util import assert_node if TYPE_CHECKING: from sphinx.testing.util import SphinxTestApp @pytest.mark....
147
4,724
mlflow
tests/genai/scorers/deepeval/test_utils.py
.py
from unittest.mock import Mock import pytest from mlflow.entities.span import Span, SpanAttributeKey, SpanType from mlflow.exceptions import MlflowException from mlflow.genai.scorers.deepeval.models import create_deepeval_model from mlflow.genai.scorers.deepeval.utils import ( _convert_to_deepeval_tool_calls, ...
143
4,673
onnxruntime
onnxruntime/test/testdata/transpose_optimizer_shared_initializers.py
.py
import numpy as np import onnx from onnx import TensorProto, helper # Create a model with shared initializers that can be updated in-place by the transpose optimizer, # including ones behind a DQ node. The transpose optimizer updates the first usage and inserts # Transpose/Unsqueeze ops on the others (see UnsqueezeIn...
117
5,961
beam
sdks/python/apache_beam/runners/interactive/caching/read_cache_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...
89
3,497
pyomo
examples/pyomo/callbacks/sc.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...
229
6,100
wandb
wandb/sdk/artifacts/_generated/artifact_by_id.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/artifacts/ from __future__ import annotations from wandb._pydantic import GQLResult from .fragments import ArtifactFragment class ArtifactByID(GQLResult): artifact: ArtifactFragment | None ArtifactByID.model_rebuild()
16
292
mlflow
tests/pyfunc/sample_code/python_model.py
.py
from mlflow.models import set_model from mlflow.pyfunc import PythonModel class MyModel(PythonModel): def predict(self, context, model_input): return f"This was the input: {model_input}" set_model(MyModel())
11
224
onnxruntime
onnxruntime/python/tools/transformers/models/torch_export_patches/__init__.py
.py
from dataclasses import fields, is_dataclass from typing import Any import numpy as np import packaging.version as pv import torch from transformers import __version__ as transformers_version from transformers.cache_utils import DynamicCache, EncoderDecoderCache from .onnx_export_errors import ( bypass_export_som...
464
15,780
wagtail
wagtail/checks.py
.py
import swapper from django.core.checks import Warning, register @register("search") def page_search_fields_check(app_configs, **kwargs): """Checks each page model with search_fields to core fields are included""" from wagtail.models import get_page_models Page = swapper.load_model("wagtailcore", "Page") ...
36
1,258
gunicorn
gunicorn/app/wsgiapp.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. import os from gunicorn.errors import ConfigError from gunicorn.app.base import Application from gunicorn import util class WSGIApplication(Application): def init(self, parser, opts, args): self.app_...
71
1,924
pyomo
pyomo/contrib/alternative_solutions/aos_utils.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...
303
10,130
conda
tests/test_activate.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations import json import os from logging import getLogger from os.path import join from pathlib import Path from typing import TYPE_CHECKING from uuid import uuid4 import pytest from conda import CondaError, plugi...
2,289
75,127
biopython
Bio/Phylo/PAML/codeml.py
.py
# Copyright (C) 2011, 2018 by Brandon Invergo (b.invergo@gmail.com) # # 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. """Classes fo...
226
9,371
biopython
Tests/test_mmtf.py
.py
# Copyright 2016 by Anthony Bradley. All rights reserved. # Revisions copyright 2017 by Peter Cock. All rights reserved. # Revisions copyright 2019 by Joe Greener. 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-C...
247
10,676
probability
tensorflow_probability/python/bijectors/softmax_centered_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...
153
6,257