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
wagtail
wagtail/admin/ui/tables/orderable.py
.py
from collections import OrderedDict from django.contrib.admin.utils import quote from django.utils.functional import cached_property from django.utils.translation import gettext, gettext_lazy from wagtail.admin.ui.tables import BaseColumn, BulkActionsCheckboxColumn class OrderingColumn(BaseColumn): """A column ...
78
2,920
wagtail
wagtail/images/formats.py
.py
from django.utils.html import escape from django.utils.translation import gettext_lazy as _ from wagtail.utils.apps import get_app_submodules from .shortcuts import get_rendition_or_not_found class Format: def __init__(self, name, label, classname, filter_spec): self.name = name self.label = lab...
109
3,033
sqlmap
tamper/charunicodeencode.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import os import string from lib.core.common import singleTimeWarnMessage from lib.core.enums import PRIORITY __priority__ = PRIORITY.LOWEST def dependencies(): singleTimeW...
64
2,144
mlflow
mlflow/models/notebook_resources/eval_with_dataset_example.py
.py
# ruff: noqa: F821, I001 {{pipInstall}} import pandas as pd import mlflow evals = [ { "request": { "messages": [ {"role": "user", "content": "How do I convert a Spark DataFrame to Pandas?"} ], }, # Optional, needed for judging correctness. "e...
23
574
cvxpy
cvxpy/tests/nlp_tests/test_hyperbolic.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
70
2,379
httpie
httpie/manager/cli.py
.py
from textwrap import dedent from httpie.cli.argparser import HTTPieManagerArgumentParser from httpie.cli.options import Qualifiers, ARGPARSE_QUALIFIER_MAP, map_qualifiers, parser_to_parser_spec from httpie import __version__ CLI_SESSION_UPGRADE_FLAGS = [ { 'flags': ['--bind-cookies'], 'action': 'st...
182
5,371
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/groupby_attr_expr.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");...
68
2,162
textual
docs/examples/guide/command_palette/command01.py
.py
from typing import Iterable from textual.app import App, SystemCommand from textual.screen import Screen class BellCommandApp(App): """An app with a 'bell' command.""" def get_system_commands(self, screen: Screen) -> Iterable[SystemCommand]: yield from super().get_system_commands(screen) # (1)! ...
18
459
pyro
tests/infer/reparam/test_haar.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import pytest import torch from torch.autograd import grad import pyro import pyro.distributions as dist from pyro import poutine from pyro.distributions.transforms.haar import HaarTransform from pyro.infer.autoguide.initialization im...
189
6,392
pyomo
doc/OnlineDocs/src/data/param1.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
29
925
python-prompt-toolkit
examples/ssh/asyncssh-server.py
.py
#!/usr/bin/env python """ Example of running a prompt_toolkit application in an asyncssh server. """ import asyncio import logging import asyncssh from pygments.lexers.html import HtmlLexer from prompt_toolkit.completion import WordCompleter from prompt_toolkit.contrib.ssh import PromptToolkitSSHServer, PromptToolki...
122
3,195
wagtail
wagtail/contrib/redirects/permissions.py
.py
import warnings from wagtail.contrib.redirects.models import Redirect from wagtail.permissions import policy_registry from wagtail.utils.deprecation import RemovedInWagtail90Warning warnings.warn( "wagtail.contrib.redirects.permissions.permission_policy is deprecated. " "Use wagtail.permissions.policy_registr...
28
1,087
openvino
tests/layer_tests/pytorch_tests/test_linspace.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestLinspace(PytorchLayerTest): def _prepare_input(self, start, end, steps, dtype=None, ref_dtype=None): ...
95
3,763
astropy
astropy/utils/masked/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Built-in mask mixin class. The design uses `Masked` as a factory class which automatically generates new subclasses for any data class that is itself a subclass of a predefined masked class, with `MaskedNDArray` providing such a predefined class for `...
12
362
metrics
_samples/rouge_score-own_normalizer_and_tokenizer.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...
91
2,653
gunicorn
tests/docker/asgi_compliance/apps/main_app.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Main ASGI application for compliance testing. Routes requests to appropriate test applications based on path prefix. This is the primary entry point for Docker-based integration tests. """ import json import ...
245
7,939
cvxpy
cvxpy/reductions/dqcp2dcp/__init__.py
.py
""" Copyright, the CVXPY authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software ...
16
562
saleor
saleor/graphql/order/sorters.py
.py
from django.db.models import CharField, ExpressionWrapper, OuterRef, QuerySet, Subquery from ...payment.models import Payment from ..core.descriptions import ADDED_IN_322, DEPRECATED_LEGACY_PAYMENTS from ..core.doc_category import DOC_CATEGORY_ORDERS from ..core.types import BaseEnum, SortInputObjectType class Order...
70
3,597
onnxruntime
onnxruntime/python/tools/quantization/operators/split.py
.py
import onnx from ..quant_utils import QuantizedValue, QuantizedValueType, attribute_to_kwarg from .base_operator import QuantOperatorBase from .qdq_base_operator import QDQOperatorBase class QSplit(QuantOperatorBase): def __init__(self, onnx_quantizer, onnx_node): super().__init__(onnx_quantizer, onnx_no...
64
2,195
pyro
tests/distributions/test_grouped_normal_normal.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import math import torch from pyro.distributions import GroupedNormalNormal, Normal from tests.common import assert_close def test_grouped_normal_normal(num_groups=3, num_samples=10**5): prior_scale = torch.rand(num_groups) ...
45
1,565
pyro
pyro/contrib/funsor/infer/tracetmc_elbo.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import contextlib import funsor from pyro.contrib.funsor import to_data from pyro.contrib.funsor.handlers import enum, plate, replay, trace from pyro.contrib.funsor.infer.elbo import ELBO, Jit_ELBO from pyro.contrib.funsor.infer.trac...
55
1,916
mlflow
mlflow/server/jobs/_job_subproc_entry.py
.py
""" This module is used for launching subprocess to execute the job function. If the job has timeout setting, or the job has pip requirements dependencies, or the job has extra environment variables setting, the job is executed as a subprocess. """ import importlib import json import logging import os import threadin...
105
3,510
readthedocs.org
readthedocs/audit/tasks.py
.py
"""Celery tasks related to audit logs.""" import structlog from django.conf import settings from django.utils import timezone from readthedocs.audit.models import AuditLog from readthedocs.worker import app log = structlog.get_logger(__name__) @app.task(queue="web") def delete_old_personal_audit_logs(days=None): ...
32
948
pyomo
pyomo/mpec/plugins/mpec2.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...
118
4,820
textual
tests/css/test_tokenize.py
.py
from __future__ import annotations import pytest from textual.css.tokenize import tokenize from textual.css.tokenizer import Token, TokenError VALID_VARIABLE_NAMES = [ "warning-text", "warning_text", "warningtext1", "1warningtext", "WarningText1", "warningtext_", "warningtext-", "_war...
981
24,422
scikit-bio
skbio/stats/ordination/tests/test_redundancy_analysis.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. # --------------------------------------------...
258
10,446
onnxruntime
onnxruntime/python/tools/transformers/models/gpt2/convert_to_onnx.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- """ This...
567
20,271
mlflow
mlflow/mcp/cli.py
.py
import click from mlflow.mcp.server import run_server from mlflow.telemetry.events import McpRunEvent from mlflow.telemetry.track import record_usage_event @click.group( "mcp", help=( "Model Context Protocol (MCP) server for MLflow. " "MCP enables LLM applications to interact with MLflow trac...
34
872
textual
tests/snapshot_tests/snapshot_apps/input_suggestions.py
.py
from textual.app import App, ComposeResult from textual.suggester import SuggestFromList from textual.widgets import Input fruits = ["apple", "pear", "mango", "peach", "strawberry", "blueberry", "banana"] class FruitsApp(App[None]): CSS = """ Input > .input--suggestion { color: red; text-sty...
28
783
textual
tests/css/test_initial.py
.py
from textual.app import App, ComposeResult from textual.color import Color from textual.widget import Widget class Base(Widget): DEFAULT_CSS = """ Base { color: magenta; } """ class CustomWidget1(Base): DEFAULT_CSS = """ CustomWidget1 { background: red } """ class C...
96
2,380
openvino
tests/layer_tests/pytorch_tests/test_broadcast_tensors.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestBroadcastTensors(PytorchLayerTest): def _prepare_input(self, x_shape, y_shape, z_shape, x_dtype, y_dtype, z_dtype): return ( self.ra...
45
1,816
mlflow
tests/resources/mlflow-test-plugin/mlflow_test_plugin/request_auth_provider.py
.py
from mlflow.tracking.request_auth.abstract_request_auth_provider import RequestAuthProvider class PluginRequestAuthProvider(RequestAuthProvider): """RequestAuthProvider provided through plugin system""" def get_name(self): return "test_auth_provider_name" def get_auth(self): return {"aut...
12
356
astropy
astropy/cosmology/_src/flrw/base.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst __all__ = ("FLRW", "FlatFLRWMixin") import inspect import warnings from dataclasses import field from functools import cached_property from inspect import signature from math import floor, pi, sqrt from typing import Any, Final, NamedTuple, TypeVar, over...
1,339
46,056
pyomo
pyomo/common/tests/test_modeling.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...
47
1,733
mlflow
mlflow/exceptions.py
.py
import json import logging from mlflow.error_classification import ErrorClass, SqlState from mlflow.protos.databricks_pb2 import ( ABORTED, ALREADY_EXISTS, BAD_REQUEST, CANCELLED, CUSTOMER_UNAUTHORIZED, DATA_LOSS, DEADLINE_EXCEEDED, ENDPOINT_NOT_FOUND, INTERNAL_ERROR, INVALID_PA...
307
11,549
python-prompt-toolkit
examples/prompts/colored-prompt.py
.py
#!/usr/bin/env python """ Example of a colored prompt. """ from prompt_toolkit import prompt from prompt_toolkit.formatted_text import ANSI, HTML from prompt_toolkit.styles import Style style = Style.from_dict( { # Default style. "": "#ff0066", # Prompt. "username": "#884444 italic...
78
1,786
mlflow
mlflow/error_classification.py
.py
"""Centralized error classification for MLflow exceptions. Maps error codes to sqlstate codes and error classes for structured error classification and observability. Client-side errors use the KAM0x/XXM0x namespace, while server/CP errors use the KAMCx/XXMCx namespace. Terminology: error_code: The existing MLflo...
198
9,094
onnxruntime
onnxruntime/python/tools/transformers/benchmark_helper.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 ...
643
22,355
saleor
saleor/graphql/order/tests/queries/test_order_line.py
.py
from decimal import Decimal from unittest.mock import MagicMock, patch import graphene from django.core.files import File from prices import Money, TaxedMoney from .....core.prices import quantize_price from .....discount import DiscountType, DiscountValueType from .....order import OrderOrigin, OrderStatus from .......
912
28,382
pyro
tests/distributions/testing/test_special.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import itertools import numpy as np import scipy from pyro.distributions.testing.special import chi2sf from tests.common import assert_close def test_chi2sf(): xlist = np.linspace(0, 100, 500) slist = np.arange(1, 41, 1.5) ...
18
431
django-cms
cms/test_utils/project/app_without_cms_file/apps.py
.py
from django.apps import AppConfig class WithoutCMSFileConfig(AppConfig): name = 'cms.test_utils.project.app_without_cms_file' label = 'app_without_cms_file'
7
167
mlflow
tests/dspy/test_dspy_util.py
.py
import importlib.metadata import json import dspy import pytest from packaging.version import Version import mlflow from mlflow.dspy.util import ( log_dspy_dataset, log_dspy_lm_state, log_dspy_module_params, sanitize_params, save_dspy_module_state, ) from mlflow.tracking import MlflowClient @pyt...
145
4,748
metrics
src/torchmetrics/detection/mean_ap.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...
690
33,109
wandb
tests/unit_tests/test_library_public.py
.py
"""Library public tests. *NOTE*: If you need to add a symbol, make sure this has been discussed and the name of the object or method is agreed upon. Todo: - clean up / hide symbols, which shouldn't be public - deprecate ones that were public but we want to remove """ import inspect import wandb SYMBOLS_RO...
309
5,531
wandb
wandb/sdk/launch/registry/abstract.py
.py
"""Abstract base class for registries.""" from abc import ABC, abstractmethod from typing_extensions import Self class AbstractRegistry(ABC): """Abstract base class for registries.""" uri: str async def get_username_password(self) -> tuple[str, str]: """Get the username and password for the re...
50
1,143
probability
tensorflow_probability/python/bijectors/inline_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...
92
3,533
probability
tensorflow_probability/python/math/psd_kernels/pointwise_exponential_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...
57
2,271
ipython
tests/test_magic_arguments.py
.py
# ----------------------------------------------------------------------------- # Copyright (C) 2010-2011, IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. # -------------------------------------------...
146
4,737
onnx
onnx/reference/ops/op_center_crop_pad.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.op_run import OpRun class CenterCropPad(OpRun): def _run(self, input_data, shape, axes=None): axes = axes or self.axes input_rank = len(input...
51
1,626
beam
learning/tour-of-beam/learning-content/io/kafka-io/kafka-read/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...
60
2,207
wagtail
wagtail/test/dummy_sendfile_backend.py
.py
from django.http import HttpResponse def sendfile(request, filename, **kwargs): """ Dummy sendfile backend implementation. """ return HttpResponse("Dummy backend response")
9
191
conda
tests/test_misc.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations import re from contextlib import nullcontext from typing import TYPE_CHECKING import pytest from conda import misc from conda.common.compat import on_mac, on_win from conda.core.subdir_data import cache_fn_u...
250
8,112
onnxruntime
onnxruntime/test/python/quantization/test_op_reshape.py
.py
#!/usr/bin/env python # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # ---------------------------------------------------------------...
170
6,386
astropy
astropy/coordinates/builtin_frames/baseradec.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.coordinates import representation as r from astropy.coordinates.baseframe import ( BaseCoordinateFrame, RepresentationMapping, base_doc, ) from astropy.utils.decorators import format_doc __all__ = ["BaseRADecFrame"] doc_compone...
53
2,017
mkdocs-material
material/plugins/blog/author.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...
41
1,754
pyomo
pyomo/contrib/mpc/modeling/__init__.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
17
774
httpie
tests/test_ssl.py
.py
import ssl import pytest import pytest_httpbin.certs import requests.exceptions import urllib3 from unittest import mock from httpie.ssl_ import AVAILABLE_SSL_VERSION_ARG_MAPPING, DEFAULT_SSL_CIPHERS_STRING from httpie.status import ExitStatus from .utils import HTTP_OK, TESTS_ROOT, IS_PYOPENSSL, http try: # ...
212
7,354
biopython
Tests/test_Align_sam.py
.py
# 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 Align.sam module.""" import unittest from io import StringIO from Bio import Al...
9,632
392,416
gunicorn
tests/test_asgi_lifespan.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ ASGI lifespan protocol tests. Tests for lifespan message formats and behavior per ASGI 3.0 specification. """ import asyncio from unittest import mock import pytest # ======================================...
425
14,183
saleor
saleor/graphql/attribute/mutations/permissions.py
.py
from collections.abc import Iterable from ....attribute import AttributeType from ....core.exceptions import PermissionDenied from ....permission.enums import ( BasePermissionEnum, CustomerTypePermissions, PageTypePermissions, ProductTypePermissions, ) from ...core.mutations import BaseMutation ATTRIB...
63
2,314
sphinx
sphinx/search/de.py
.py
"""German search language.""" from __future__ import annotations import snowballstemmer from sphinx.search import SearchLanguage from sphinx.search._stopwords.de import GERMAN_STOPWORDS class SearchGerman(SearchLanguage): lang = 'de' language_name = 'German' js_stemmer_rawcode = 'german-stemmer.js' ...
23
589
saleor
saleor/graphql/product/tests/queries/test_variant_query.py
.py
import graphene import pytest from .....attribute.models import AttributeValue from .....attribute.utils import ( _associate_attribute_to_instance, associate_attribute_values_to_instance, ) from .....warehouse.models import Stock, Warehouse from ....tests.utils import ( assert_graphql_error_with_message, ...
1,173
35,746
ipython
tests/test_deepreload.py
.py
# -*- coding: utf-8 -*- """Test suite for the deepreload module.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import sys import types from pathlib import Path import pytest from tempfile import TemporaryDirectory from IPython.lib import deepreload from IPyt...
317
11,803
probability
tensorflow_probability/python/distributions/mvn_full_covariance.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...
221
9,052
scikit-bio
skbio/io/format/ordination.py
.py
r"""Ordination results format (:mod:`skbio.io.format.ordination`) ============================================================= .. currentmodule:: skbio.io.format.ordination The ordination results file format (``ordination``) stores the results of an ordination method in a human-readable, text-based format. The forma...
447
14,876
black
src/black/debug.py
.py
from collections.abc import Iterator from dataclasses import dataclass, field from typing import Any, TypeVar, Union from black.nodes import Visitor from black.output import out from black.parsing import lib2to3_parse from blib2to3.pgen2 import token from blib2to3.pytree import Leaf, Node, type_repr LN = Union[Leaf, ...
56
1,922
probability
tensorflow_probability/python/mcmc/eight_schools_hmc.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...
159
5,694
hydra
examples/tutorials/basic/your_first_hydra_app/4_config_groups/my_app.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from omegaconf import DictConfig, OmegaConf import hydra @hydra.main(config_path="conf") def my_app(cfg: DictConfig) -> None: print(OmegaConf.to_yaml(cfg)) if __name__ == "__main__": my_app()
14
276
saleor
saleor/webhook/deprecated_event_types.py
.py
class WebhookEventType: ANY = "any_events" ORDER_CREATED = "order_created" ORDER_CONFIRMED = "order_confirmed" ORDER_FULLY_PAID = "order_fully_paid" ORDER_UPDATED = "order_updated" ORDER_CANCELLED = "order_cancelled" FULFILLMENT_CANCELED = "fulfillment_canceled" ORDER_FULFILLED = "order_...
166
7,393
scikit-bio
skbio/io/format/binary_dm.py
.py
"""Simple binary dissimilarity matrix format (:mod:`skbio.io.format.binary_dm`) ============================================================================ .. currentmodule:: skbio.io.format.binary_dm The Binary DisSimilarity Matrix format (``binary_dm``) encodes a binary representation for dissimilarity and distanc...
227
7,104
biopython
Tests/test_Align_emboss.py
.py
# Copyright 2008-2014 by Peter Cock. 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.emboss module.""" import unittest from io import StringIO from tempf...
3,428
193,789
textual
src/textual/document/_history.py
.py
from __future__ import annotations import time from collections import deque from dataclasses import dataclass, field from textual.document._edit import Edit class HistoryException(Exception): """Indicates misuse of the EditHistory API. For example, trying to undo() an Edit that has yet to be done. """...
184
7,061
coremltools
deps/protobuf/benchmarks/util/result_parser.py
.py
# This import depends on the automake rule protoc_middleman, please make sure # protoc_middleman has been built before run this file. import argparse import json import re import os.path # BEGIN OPENSOURCE import sys sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)) # END OPENSOURCE ...
353
10,126
pyomo
pyomo/core/base/__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...
219
6,359
mlflow
mlflow/projects/docker.py
.py
import logging import os import posixpath import shutil import subprocess import tempfile import urllib.parse import urllib.request import docker from mlflow import tracking from mlflow.environment_variables import MLFLOW_TRACKING_URI from mlflow.exceptions import ExecutionException from mlflow.projects.utils import ...
168
6,305
saleor
saleor/graphql/product/tests/queries/variants_where/test_over_attributes_boolean.py
.py
import graphene import pytest from ......attribute import AttributeInputType, AttributeType from ......attribute.models import Attribute, AttributeValue from ......attribute.utils import associate_attribute_values_to_instance from .....tests.utils import get_graphql_content from .shared import PRODUCT_VARIANTS_WHERE_Q...
85
2,766
saleor
saleor/graphql/discount/tests/queries/test_vouchers.py
.py
from unittest.mock import ANY from ....tests.utils import get_graphql_content VOUCHERS_QUERY = """ query vouchers { vouchers(first: 1) { edges { node { type name code usageLimit ...
208
6,322
pyro
pyro/poutine/guide.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 from abc import ABC, abstractmethod from typing import TYPE_CHECKING, Callable, Dict, Optional, Tuple, Union import torch import pyro.distributions as dist from pyro.poutine.trace_messenger import TraceMessenger from pyro.poutine.tra...
159
6,163
openvino
tests/layer_tests/tensorflow_tests/test_tf_LRN.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest class TestLRN(CommonTFLayerTest): def create_lrn_net(self, input_shape, depth_radius, bias, alpha, beta): tf.compat.v1...
34
1,264
onnxruntime
onnxruntime/python/tools/quantization/operators/base_operator.py
.py
class QuantOperatorBase: def __init__(self, onnx_quantizer, onnx_node): self.quantizer = onnx_quantizer self.node = onnx_node def should_quantize(self): if not self.quantizer.should_quantize_node(self.node): return False return self.quantizer.is_float_tensor(self.no...
27
1,092
deap
examples/es/cma_minfct.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 ...
60
2,164
wandb
wandb/integration/sklearn/__init__.py
.py
"""Create informative charts for scikit-learn models and log them to W&B.""" from .plot import ( plot_calibration_curve, plot_class_proportions, plot_classifier, plot_clusterer, plot_confusion_matrix, plot_elbow_curve, plot_feature_importances, plot_learning_curve, plot_outlier_cand...
38
861
probability
spinoffs/fun_mc/fun_mc/test_util.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...
106
4,160
astropy
astropy/coordinates/tests/test_iau_fullstack.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import erfa import numpy as np import pytest from numpy import testing as npt from astropy import units as u from astropy.coordinates import EarthLocation, SkyCoord, golden_spiral_grid from astropy.coordinates.builtin_frames import ICRS, AltAz from astro...
147
5,214
probability
tensorflow_probability/python/internal/trainable_state_util.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...
358
14,023
gunicorn
examples/when_ready.conf.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. import signal import commands import threading import time max_mem = 100000 class MemoryWatch(threading.Thread): def __init__(self, server, max_mem): super().__init__() self.daemon = True ...
42
1,126
mlflow
mlflow/deployments/mlflow/__init__.py
.py
from typing import TYPE_CHECKING, Any import requests from mlflow import MlflowException from mlflow.deployments import BaseDeploymentClient from mlflow.deployments.constants import ( MLFLOW_DEPLOYMENT_CLIENT_REQUEST_RETRY_CODES, ) from mlflow.deployments.server.constants import ( MLFLOW_DEPLOYMENTS_CRUD_ENDP...
328
10,822
scikit-bio
skbio/stats/ordination/_canonical_correspondence_analysis.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. # --------------------------------------------...
261
9,175
openvino
src/bindings/python/tests/test_transformations/test_public_transformations.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import pytest import numpy as np from openvino import Model, PartialShape, Shape, Core from openvino import opset13 as ops from openvino.passes import ( Manager, ConstantFolding, MakeStateful...
167
5,083
wagtail
wagtail/contrib/simple_translation/views.py
.py
import swapper from django.contrib.admin.utils import unquote from django.core.exceptions import PermissionDenied from django.db import transaction from django.http import Http404 from django.shortcuts import get_object_or_404, redirect from django.urls import reverse from django.utils.translation import gettext as _ f...
175
6,253
saleor
saleor/graphql/payment/mutations/transaction/__init__.py
.py
from .payment_gateway_initialize import PaymentGatewayInitialize from .transaction_create import TransactionCreate from .transaction_event_report import TransactionEventReport from .transaction_initialize import TransactionInitialize from .transaction_process import TransactionProcess from .transaction_request_action i...
22
772
coremltools
coremltools/test/sklearn_tests/test_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 import random import tempfile import unittest import pandas as pd import pytest from ..utils import lo...
222
7,336
readthedocs.org
readthedocs/projects/tasks/search.py
.py
from fnmatch import fnmatch import structlog from django.conf import settings from readthedocs.builds.constants import BUILD_STATE_FINISHED from readthedocs.builds.constants import INTERNAL from readthedocs.builds.constants import LATEST from readthedocs.builds.models import Build from readthedocs.builds.models impor...
411
14,705
gunicorn
gunicorn/dirty/tlv.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ TLV (Type-Length-Value) Binary Encoder/Decoder Provides efficient binary serialization for dirty worker protocol messages. Inspired by OpenBSD msgctl/msgsnd message format. Type Codes: 0x00: None (no valu...
304
10,428
voila
docs/conf.py
.py
import os # Add dev disclaimer. _release = {} exec( compile(open("../voila/_version.py").read(), "../voila/_version.py", "exec"), _release, ) if _release["version_info"][-1] == "dev": rst_prolog = """ .. note:: This documentation is for a development version of Voilà. There may be sign...
53
1,264
pyomo
pyomo/contrib/parmest/experiment.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...
30
1,123
pyomo
examples/gdp/jobshop-nodisjuncts.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...
77
2,908
onnx
onnx/backend/test/case/node/castlike.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import itertools import numpy as np import onnx from onnx import TensorProto from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect from onnx.helper import make_te...
325
11,394
gunicorn
tests/requests/valid/rfc9112_target_absolute_https_01.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. # RFC 9112 section 3.2.2: absolute-form with https scheme (proxy requests). request = { "method": "GET", "uri": uri("https://example.com/foo"), "version": (1, 1), "headers": [ ("HOST", "exam...
15
357
hatch
backend/src/hatchling/builders/hooks/version.py
.py
from __future__ import annotations from typing import Any from hatchling.builders.hooks.plugin.interface import BuildHookInterface from hatchling.version.core import VersionFile class VersionBuildHook(BuildHookInterface): PLUGIN_NAME = "version" def __init__(self, *args: Any, **kwargs: Any) -> None: ...
72
2,416