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
beam
sdks/python/apache_beam/examples/cookbook/ordered_window_elements/streaming.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...
639
26,177
pyomo
examples/pyomobook/strip_examples.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...
37
1,169
textual
docs/examples/widgets/masked_input.py
.py
from textual.app import App, ComposeResult from textual.widgets import Label, MaskedInput class MaskedInputApp(App): # (1)! CSS = """ MaskedInput.-valid { border: tall $success 60%; } MaskedInput.-valid:focus { border: tall $success; } MaskedInput { margin: 1 1; ...
33
626
readthedocs.org
readthedocs/search/tasks.py
.py
import datetime import structlog from dateutil.parser import parse from django.apps import apps from django.conf import settings from django.utils import timezone from django_elasticsearch_dsl.registries import registry from readthedocs.builds.models import Version from readthedocs.projects.models import Project from...
228
8,306
pymc
tests/distributions/test_distribution.py
.py
# Copyright 2024 - present The PyMC Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
589
23,140
onnxruntime
onnxruntime/test/testdata/transform/expand_elimination.py
.py
import numpy as np import onnx from onnx import OperatorSetIdProto, TensorProto, helper, numpy_helper X1 = helper.make_tensor_value_info("input1", TensorProto.FLOAT, [2, 1]) X2 = helper.make_tensor_value_info("input2", TensorProto.FLOAT, ["dynamic", 4]) Y = helper.make_tensor_value_info("output", TensorProto.FLOAT, [1...
75
3,127
saleor
saleor/graphql/product/filters/category.py
.py
import django_filters import graphene from django.db.models import Q from ....product.models import Category from ...core.doc_category import DOC_CATEGORY_PRODUCTS from ...core.filters import ( FilterInputObjectType, GlobalIDMultipleChoiceFilter, GlobalIDMultipleChoiceWhereFilter, ListObjectTypeFilter,...
77
2,184
saleor
saleor/tests/e2e/orders/taxes/test_draft_order_complete_return_tax_error.py
.py
import pytest from ... import DEFAULT_ADDRESS from ...apps.utils import add_app from ...product.utils.preparing_product import prepare_product from ...shop.utils.preparing_shop import prepare_default_shop from ...taxes.utils import get_tax_configurations, update_tax_configuration from ...utils import assign_permission...
135
5,560
sqlmap
thirdparty/chardet/langgreekmodel.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from .sbcharsetprober import SingleByteCharSetModel # 3: Positive # 2: Likely # 1: Unlikely # 0: Negative GREEK_LANG_MODEL = { 60: { # 'e' 60: 2, # 'e' 55: 1, # 'o' 58: 2, # 't' 36: 1, # '·' 61: 0, # 'Ά' 46: 0, ...
4,399
99,552
pyro
tests/contrib/easyguide/test_easyguide.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import io import warnings import pytest import torch from torch.distributions import constraints import pyro import pyro.distributions as dist from pyro.contrib.easyguide import EasyGuide, easy_guide from pyro.infer import SVI, T...
256
8,618
luigi
examples/per_task_retry_policy.py
.py
# -*- coding: utf-8 -*- """ You can run this example like this: .. code:: console $ luigi --module examples.per_task_retry_policy examples.PerTaskRetryPolicy --worker-keep-alive \ --local-scheduler --scheduler-retry-delay 5 --logging-conf-file test/testconfig/logging.cfg ......
161
5,236
coremltools
coremltools/models/_feature_management.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 operator as op from collections import defaultdict from copy import copy from functools import re...
355
11,762
onnx
onnx/reference/ops/op_cast_like.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from onnx.helper import np_dtype_to_tensor_dtype from onnx.reference.op_run import OpRun from onnx.reference.ops.op_cast import cast_to def _cast_like(x, y, saturate: bool): return (cast_to(x, np_d...
28
679
probability
tensorflow_probability/python/bijectors/rational_quadratic_spline.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...
441
17,963
saleor
saleor/graphql/account/tests/mutations/authentication/test_external_authentication.py
.py
import json from unittest.mock import Mock from .....tests.utils import get_graphql_content MUTATION_EXTERNAL_AUTHENTICATION = """ mutation externalAuthenticationUrl($pluginId: String!, $input: JSONString!){ externalAuthenticationUrl(pluginId: $pluginId, input: $input){ authenticationData ...
47
1,660
probability
tensorflow_probability/python/sts/internal/seasonality_util_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...
152
6,522
saleor
saleor/graphql/warehouse/enums.py
.py
from typing import Final import graphene from ...graphql.core.enums import to_enum from ...warehouse import WarehouseClickAndCollectOption from ..core.doc_category import DOC_CATEGORY_PRODUCTS WarehouseClickAndCollectOptionEnum: Final[graphene.Enum] = to_enum( WarehouseClickAndCollectOption, type_name="Warehouse...
13
421
pyomo
scripts/performance/simple.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,320
readthedocs.org
readthedocs/config/utils.py
.py
"""Shared functions for the config module.""" def list_to_dict(list_): """Transform a list to a dictionary with its indices as keys.""" dict_ = {str(i): element for i, element in enumerate(list_)} return dict_
8
224
mlflow
mlflow/tracing/processor/otel_metrics_mixin.py
.py
""" Mixin class for OpenTelemetry span processors that provides metrics recording functionality. This mixin allows different span processor implementations to share common metrics logic while maintaining their own inheritance hierarchies (BatchSpanProcessor, SimpleSpanProcessor). """ import logging from typing import...
122
4,737
sphinx
sphinx/ext/autodoc/mock.py
.py
from __future__ import annotations from sphinx.ext.autodoc._dynamic._mock import ( MockFinder, # NoQA: F401 MockLoader, # NoQA: F401 _make_subclass, # NoQA: F401 _MockModule, # NoQA: F401 _MockObject, # NoQA: F401 ismock, # NoQA: F401 ismockmodule, # NoQA: F401 mock, # NoQA: F40...
14
354
pymc
tests/dims/distributions/test_censored.py
.py
# Copyright 2026 - present The PyMC Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
91
3,378
gunicorn
tests/requests/invalid/rfc9110_trailer_forbidden_host_01.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. # RFC 9110 section 6.5.1: certain header fields must not be sent in # trailers because they alter routing or message framing (e.g. Host, # Content-Length, Transfer-Encoding). Accepting them enables smuggling. from ...
10
394
biopython
Tests/test_motifs_online.py
.py
# Copyright 2015 by Peter Cock. All rights reserved. # Copyright 2015 by Antony Lee. 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 p...
58
1,709
probability
tensorflow_probability/python/experimental/vi/util/__init__.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...
34
1,744
beam
sdks/python/apache_beam/utils/sentinel.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...
29
911
sphinx
tests/test_builders/test_build_html.py
.py
"""Test the HTML builder and check output against XPath.""" from __future__ import annotations import os import posixpath import re from typing import TYPE_CHECKING import pytest from docutils import nodes from docutils.parsers import rst from docutils.readers import standalone from docutils.writers import html5_pol...
852
26,532
mlflow
tests/genai/discovery/test_sampling.py
.py
from unittest.mock import patch from mlflow.genai.discovery.sampling import sample_traces from mlflow.genai.discovery.utils import group_traces_by_session # ---- sample_traces ---- def test_sample_traces_no_sessions(make_trace): traces = [make_trace() for _ in range(20)] search_kwargs = {"filter_string": No...
101
3,020
toolz
toolz/tests/test_utils.py
.py
from toolz.utils import raises def test_raises(): assert raises(ZeroDivisionError, lambda: 1 / 0) assert not raises(ZeroDivisionError, lambda: 1)
7
156
wagtail
wagtail/actions/create.py
.py
from django.core.exceptions import PermissionDenied from wagtail.actions.base import BaseAction from wagtail.log_actions import log from wagtail.utils.forms import FormValidationError # Sentinel for "auto-detect the sort order field from the model", distinct from # an explicit None which means "do not set a sort orde...
160
6,167
metrics
src/torchmetrics/functional/pairwise/euclidean.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...
90
3,449
pyro
tests/distributions/test_gaussian_mixtures.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import logging import math import pytest import torch from pyro.distributions import ( GaussianScaleMixture, MixtureOfDiagNormals, MixtureOfDiagNormalsSharedCovariance, ) from tests.common import assert_equal logger ...
306
10,771
beam
sdks/python/apache_beam/examples/complete/tfidf_it_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...
77
2,776
cvxpy
cvxpy/reductions/solvers/conic_solvers/cplex_conif.py
.py
""" Copyright 2013 Steven Diamond, 2017 Robin Verschueren 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...
533
19,288
kafka
release/release.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...
435
20,572
wagtail
wagtail/test/utils/__init__.py
.py
from .decorators import * # NOQA: F403 from .page_tests import * # NOQA: F403 from .wagtail_tests import * # NOQA: F403
4
123
saleor
saleor/graphql/checkout/tests/test_checkout.py
.py
import datetime import json from decimal import Decimal from unittest import mock import freezegun import graphene import pytest from django.core.exceptions import ValidationError from django.db.models import F from django.test import override_settings from django.utils import timezone from django.utils.dateparse impo...
5,407
170,600
mlflow
mlflow/server/auth/permissions.py
.py
from dataclasses import dataclass from mlflow import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE @dataclass class Permission: name: str can_read: bool can_use: bool can_update: bool can_delete: bool can_manage: bool READ = Permission( name="READ", ...
186
6,063
mlflow
examples/groq/tracing.py
.py
""" This is an example for leveraging MLflow's auto tracing capabilities for Groq. For more information about MLflow Tracing, see: https://mlflow.org/docs/latest/llms/tracing/index.html """ import groq import mlflow # Turn on auto tracing for Groq by calling mlflow.groq.autolog() mlflow.groq.autolog() client = gro...
28
631
sphinx
tests/roots/test-util-copyasset_overwrite/conf.py
.py
import sys from pathlib import Path sys.path.insert(0, str(Path.cwd().resolve())) extensions = ['myext'] html_static_path = ['user_static'] html_theme = 'basic'
9
163
wagtail
wagtail/admin/views/pages/unpublish.py
.py
import swapper from django.conf import settings from django.core.exceptions import PermissionDenied from django.shortcuts import get_object_or_404 from django.urls import reverse from django.utils.translation import gettext_lazy as _ from wagtail import hooks from wagtail.actions.unpublish_page import UnpublishPageAct...
99
3,784
astropy
astropy/io/fits/hdu/compressed/header.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import re import warnings from astropy.io.fits.column import KEYWORD_NAMES as TABLE_KEYWORD_NAMES from astropy.io.fits.column import TDEF_RE, ColDefs, Column from astropy.io.fits.hdu.compressed.compbintable import _CompBinTableHDU from astropy.io.fits.he...
705
24,041
pyomo
examples/pyomobook/pyomo-components-ch/set_initialization.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...
54
1,299
coremltools
deps/protobuf/examples/add_person.py
.py
#! /usr/bin/env python # See README.txt for information and build instructions. import addressbook_pb2 import sys try: raw_input # Python 2 except NameError: raw_input = input # Python 3 # This function fills in a Person message based on user input. def PromptForAddress(person): person.id = int(raw...
64
1,750
onnxruntime
onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/NodesToOptimizeIndices.py
.py
# automatically generated by the FlatBuffers compiler, do not modify # namespace: fbs import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() # nodes to consider for a runtime optimization # see corresponding type in onnxruntime/core/graph/runtime_optimization_record.h class NodesToOptimiz...
161
5,984
onnxruntime
tools/ci_build/prepare_macos_package.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import argparse import os import pathlib import shutil import stat as stat_module import subprocess import sys import tarfile from datetime import datetime def run_command(command: list[str | pathlib.Path], check: bool = Tr...
186
7,263
textual
src/textual/_border.py
.py
from __future__ import annotations from functools import lru_cache from typing import TYPE_CHECKING, Iterable, Tuple, cast from rich.segment import Segment from textual.color import Color from textual.css.types import AlignHorizontal, EdgeStyle, EdgeType from textual.style import Style if TYPE_CHECKING: from ty...
480
13,018
saleor
saleor/graphql/app/tests/mutations/test_app_problem_dismiss_by_app.py
.py
import graphene from .....app.error_codes import AppProblemDismissErrorCode from ....tests.utils import get_graphql_content from ...mutations.app_problem_dismiss import MAX_ITEMS_LIMIT APP_PROBLEM_DISMISS_MUTATION = """ mutation AppProblemDismiss($input: AppProblemDismissInput!) { appProblemDismiss(input:...
226
7,503
pyomo
pyomo/core/expr/ndarray.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...
38
1,701
astropy
astropy/coordinates/builtin_frames/altaz.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from astropy import units as u from astropy.coordinates import representation as r from astropy.coordinates.attributes import ( EarthLocationAttribute, QuantityAttribute, TimeAttribute, ) from astropy.coordinates.baseframe ...
145
5,707
textual
tests/snapshot_tests/snapshot_apps/log_write.py
.py
from textual.app import App, ComposeResult from textual.widgets import Log from textual.containers import Horizontal class LogApp(App): def compose(self) -> ComposeResult: yield Log() def on_ready(self) -> None: log = self.query_one(Log) log.write("Hello,") log.write(" World")...
23
489
wandb
tools/wandb_export_history.py
.py
#!/usr/bin/env python """Export W&B run history. This module uses the W&B public api to download unsampled history to a sqlite database. Usage: ./wandb_export_history --run entity/project/run_id --db_file save.db or: ```python import wandb_export_history wandb_export_history(run="entity/project/run_...
109
2,887
astropy
astropy/stats/tests/test_info_theory.py
.py
from numpy.testing import assert_allclose from astropy.stats.info_theory import ( akaike_info_criterion, akaike_info_criterion_lsq, bayesian_info_criterion, bayesian_info_criterion_lsq, ) def test_bayesian_info_criterion(): # This test is from an example presented in Ref [1] lnL = (-176.4, -1...
79
2,339
qutip
qutip/tests/core/test_gates.py
.py
import pytest import numpy as np import qutip from qutip.core import gates from qutip import Qobj def _infidelity(a, b): """Infidelity between two kets.""" return 1 - abs(a.overlap(b)) def _remove_global_phase(qobj): """ Return a new Qobj with the gauge fixed for the global phase. Explicitly, w...
213
9,006
beam
learning/katas/python/Core Transforms/Side Input/Side Input/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"); you may...
66
2,334
wagtail
wagtail/images/jinja2tags.py
.py
from django import template from jinja2.ext import Extension from .models import Filter, Picture, ResponsiveImage from .shortcuts import get_rendition_or_not_found, get_renditions_or_not_found from .templatetags.wagtailimages_tags import image_url def image(image, filterspec, **attrs): if not image: retu...
75
2,239
wandb
wandb/sdk/artifacts/artifact_manifest.py
.py
"""Artifact manifest.""" from __future__ import annotations from abc import ABC, abstractmethod from typing import TYPE_CHECKING, Annotated, Any, Dict # noqa: UP035 from pydantic import Field from wandb.sdk.lib.hashutil import HexMD5 from ._models.base_model import ArtifactsBase from ._validators import validate_...
81
2,806
onnxruntime
onnxruntime/test/python/transformers/test_parity_layernorm.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 ...
313
10,489
astropy
astropy/coordinates/tests/accuracy/test_fk4_no_e_fk5.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from astropy import units as u from astropy.coordinates import angular_separation from astropy.coordinates.builtin_frames import FK5, FK4NoETerms from astropy.table import Table from astropy.time import Time from astropy.utils.data im...
76
2,152
onnx
onnx/reference/ops/op_lrn.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import math import numpy as np from onnx.reference.op_run import OpRun class LRN(OpRun): def _run(self, x, alpha=None, beta=None, bias=None, size=None): if len(x.shape) != 4: ...
29
880
saleor
saleor/graphql/channel/mutations/__init__.py
.py
from .base_channel_listing import BaseChannelListingMutation from .channel_activate import ChannelActivate from .channel_create import ChannelCreate from .channel_deactivate import ChannelDeactivate from .channel_delete import ChannelDelete from .channel_reorder_warehouses import ChannelReorderWarehouses from .channel_...
18
540
sphinx
tests/roots/test-extensions/write_parallel.py
.py
def setup(app): return { 'parallel_write_safe': True, }
5
72
probability
tensorflow_probability/python/bijectors/discrete_cosine_transform_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...
88
3,476
mlflow
mlflow/openai/utils/chat_schema.py
.py
import logging from collections.abc import Iterable from typing import Any from mlflow.entities.span import LiveSpan from mlflow.exceptions import MlflowException from mlflow.tracing import set_span_chat_tools from mlflow.tracing.constant import SpanAttributeKey, TokenUsageKey from mlflow.tracing.utils import set_span...
232
7,153
pyomo
pyomo/contrib/incidence_analysis/tests/test_dulmage_mendelsohn.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
8,053
hatch
tests/backend/builders/test_binary.py
.py
from __future__ import annotations import os import subprocess import sys from typing import Any import pytest from hatch.utils.fs import Path from hatch.utils.structures import EnvVars from hatchling.builders.app import AppBuilder from hatchling.builders.binary import BinaryBuilder from hatchling.builders.plugin.in...
730
25,679
hatch
backend/src/hatchling/metadata/plugin/hooks.py
.py
from __future__ import annotations from typing import TYPE_CHECKING from hatchling.metadata.custom import CustomMetadataHook from hatchling.plugin import hookimpl if TYPE_CHECKING: from hatchling.metadata.plugin.interface import MetadataHookInterface @hookimpl def hatch_register_metadata_hook() -> type[Metadat...
15
397
mlflow
mlflow/__main__.py
.py
from mlflow.cli import cli cli.main()
4
39
beam
sdks/python/apache_beam/io/gcp/healthcare/dicomclient.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...
128
4,100
sqlmap
tests/test_option.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission Option setup / normalization helpers in lib/core/option.py. These exercise the (mostly) pure config-massaging functions that parse, validate and normalize user-supplied option values...
1,651
64,193
conda
conda/gateways/repodata/lock.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """ Backwards compatibility import. Moved to prevent circular imports. """ from ..disk.lock import lock # noqa: F401
10
195
jupytext
tests/data/notebooks/outputs/ipynb_to_percent/raw_cell_with_non_dict_yaml_content.py
.py
# --- # Content. # jupyter: # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # %% print("Hello, World!")
12
151
pyomo
pyomo/dae/flatten.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...
594
25,257
readthedocs.org
readthedocs/projects/version_handling.py
.py
"""Project version handling.""" import operator import unicodedata from bumpver.v2version import parse_version_info from bumpver.version import PatternError from packaging.version import InvalidVersion from packaging.version import Version from readthedocs.builds.constants import LATEST from readthedocs.builds.const...
271
8,737
saleor
saleor/graphql/core/schema.py
.py
import graphene from ..core.doc_category import DOC_CATEGORY_TAXES from ..core.fields import BaseField from ..plugins.dataloaders import get_plugin_manager_promise from . import ResolveInfo from .mutations import FileUpload from .types import NonNullList, TaxType class CoreQueries(graphene.ObjectType): tax_types...
29
899
coremltools
deps/pybind11/tests/test_gil_scoped.py
.py
from __future__ import annotations import multiprocessing import sys import threading import time import pytest import env from pybind11_tests import gil_scoped as m class ExtendedVirtClass(m.VirtClass): def virtual_func(self): pass def pure_virtual_func(self): pass def test_callback_py_...
245
8,543
pyomo
pyomo/util/tests/test_report_scaling.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...
91
2,909
beam
sdks/python/apache_beam/runners/worker/opcounters.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...
357
13,493
openvino
tests/layer_tests/common/mo_convert_test_class.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import sys from pathlib import Path from common.utils.common_utils import generate_ir from common.utils.common_utils import shell from openvino.test_utils import compare_functions from openvino.tools.ovc import ovc def generate_ir_ov...
99
3,707
openvino
src/bindings/python/src/openvino/preprocess/torchvision/preprocess_converter.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from typing import Any, Union from collections.abc import Callable import logging from openvino import Model class PreprocessConverter(): def __init__(self, model: Model): self._model = model @...
49
1,796
mlflow
mlflow/genai/scorers/online/trace_checkpointer.py
.py
"""Checkpoint management for trace-level online scoring.""" import json import logging import time from dataclasses import asdict, dataclass from mlflow.entities.experiment_tag import ExperimentTag from mlflow.environment_variables import ( MLFLOW_ONLINE_SCORING_DEFAULT_TRACE_COMPLETION_BUFFER_SECONDS, ) from mlf...
111
4,550
readthedocs.org
readthedocs/analytics/tests/test_models.py
.py
import pytest from django.contrib.auth.models import User from django.db import IntegrityError from django.test import TestCase from django_dynamic_fixture import get from readthedocs.analytics.models import PageView from readthedocs.projects.models import Project class TestModels(TestCase): def setUp(self): ...
67
1,861
beam
learning/tour-of-beam/learning-content/core-transforms/motivating-challenge-4/python-challenge/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...
71
2,330
sphinx
tests/test_versioning.py
.py
"""Test the versioning implementation.""" from __future__ import annotations import pickle import shutil import pytest from docutils.utils import DependencyList from sphinx.testing.util import SphinxTestApp from sphinx.versioning import add_uids, get_ratio, merge_doctrees TYPE_CHECKING = False if TYPE_CHECKING: ...
134
4,376
confluent-kafka-python
tests/integration/schema_registry/_async/test_json_serializers.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...
471
14,886
onnx
onnx/backend/test/case/node/hardmax.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 def hardmax(x: np.ndarray, axis: int = -1) -> np.ndarray: x_argmax = np....
93
2,659
pymc
tests/variational/test_inference.py
.py
# Copyright 2024 - present The PyMC Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
674
23,129
wagtail
wagtail/api/v2/router.py
.py
import functools from django.urls import include, re_path from wagtail.utils.urlpatterns import decorate_urlpatterns class WagtailAPIRouter: """ A class that provides routing and cross-linking for a collection of API endpoints """ def __init__(self, url_namespace): self.url_namespace = ...
96
2,891
pymc
tests/dims/distributions/test_scalar.py
.py
# Copyright 2025 - present The PyMC Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
378
12,636
confluent-kafka-python
examples/oauth_oidc_ccloud_aws_iam.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2026 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...
206
7,121
flit
flit_core/tests_core/samples/imported_version/package1/_version.py
.py
"""Imposter docstring that shouldn't be used""" __version__ = '0.5.8'
4
71
pyomo
pyomo/solvers/plugins/solvers/cplex_direct.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
1,047
41,491
returns
benchmarks/test_benchmarks.py
.py
"""Performance benchmarks for the core ``returns`` containers. These benchmarks exercise the hot paths of the most commonly used containers (``Result``, ``Maybe``, ``IO``) together with the pipeline and iterable helpers. They are measured by CodSpeed in CI. """ from returns.io import IO from returns.iterables import ...
156
4,272
wagtail
wagtail/admin/templatetags/wagtailadmin_tags.py
.py
import datetime import re import warnings from urllib.parse import urljoin, urlsplit from django import template from django.conf import settings from django.contrib.admin.utils import quote from django.contrib.humanize.templatetags.humanize import intcomma, naturaltime from django.contrib.messages.constants import DE...
1,433
49,013
onnx
onnx/reference/ops/aionnx_preview_training/op_adam.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.aionnx_preview_training._op_run_training import OpRunTraining def _apply_adam( r, t, x, g, v, h, norm_coefficient, norm_coefficient_post, alpha, beta, ep...
106
2,863
beam
sdks/python/apache_beam/runners/interactive/caching/streaming_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...
524
23,221
pyomo
pyomo/contrib/appsi/writers/__init__.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
12
611
conda
conda/common/compat.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Common compatibility code.""" # Try to keep compat small because it's imported by everything # What is compat, and what isn't? # If a piece of code is "general" and used in multiple modules, it goes here. # If it's only used in one module, ke...
112
3,071
biopython
Scripts/xbbtools/xbb_blast.py
.py
#!/usr/bin/env python # Copyright 2000 by Thomas Sicheritz-Ponten. # Copyright 2016 by Markus Piotrowski. # 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. # Created: Thu Jul 13 ...
213
7,704
hypercorn
src/hypercorn/logging.py
.py
from __future__ import annotations import json import logging import os import sys import time from collections.abc import Mapping from http import HTTPStatus from logging.config import dictConfig, fileConfig from typing import Any, IO, TYPE_CHECKING if sys.version_info >= (3, 11): import tomllib else: import...
204
7,335