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
gunicorn
examples/streaming_chat/main.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. import json from fastapi import FastAPI from fastapi.responses import StreamingResponse, HTMLResponse from pydantic import BaseModel from gunicorn.dirty.client import get_dirty_client_async app = FastAPI( tit...
276
8,301
clearml
clearml/backend_api/session/__init__.py
.py
from .session import Session, browser_login from .datamodel import DataModel, NonStrictDataModel, schema_property, StringEnum from .request import Request, BatchRequest, CompoundRequest from .response import Response from .token_manager import TokenManager from .errors import TimeoutExpiredError, ResultNotReadyError fr...
25
654
rq
rq/types.py
.py
from __future__ import annotations from collections.abc import Callable from types import TracebackType from typing import TYPE_CHECKING, Any, TypeVar if TYPE_CHECKING: from typing import TypeAlias from redis import Redis from .job import Dependency, Job FunctionReferenceType = TypeVar('FunctionRefere...
32
973
mlflow
tests/genai/scorers/guardrails/test_utils.py
.py
import sys from unittest.mock import patch import pytest import mlflow from mlflow.exceptions import MlflowException from mlflow.genai.scorers.guardrails.utils import ( check_guardrails_installed, map_scorer_inputs_to_text, ) def _create_test_trace(inputs=None, outputs=None): """Create a test trace usin...
67
1,953
saleor
saleor/graphql/core/connection.py
.py
from base64 import b64encode from collections.abc import Callable, Iterable from decimal import Decimal, InvalidOperation from typing import TYPE_CHECKING, Any import graphene import orjson from django.conf import settings from django.db.models import Model as DjangoModel from django.db.models import Q, QuerySet from ...
755
25,212
loguru
tests/exceptions/source/backtrace/suppressed_expression_indirect.py
.py
import sys from loguru import logger logger.remove() logger.add(sys.stderr, format="", colorize=False, backtrace=True, diagnose=False) def a(x, y): x / y def b(): try: a(1, 0) except ZeroDivisionError as e: raise ValueError("NOK") from e @logger.catch def c_decorated(): b() def...
38
480
cvxpy
cvxpy/tests/test_scopes.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 ...
64
2,025
wandb
wandb/sdk/launch/registry/anon.py
.py
from typing_extensions import Self from wandb.docker import is_docker_installed from wandb.sdk.launch.utils import docker_image_exists from .abstract import AbstractRegistry class AnonynmousRegistry(AbstractRegistry): def __init__(self, uri: str) -> None: """Initialize the registry.""" self.uri ...
30
939
saleor
saleor/graphql/channel/tests/dataloaders/test_by_transaction.py
.py
from .....channel.models import Channel from ....context import SaleorContext from ...dataloaders.by_transaction import ChannelByTransactionIdLoader def test_batch_load_with_order_transactions( order_with_lines, transaction_item_generator ): # given order = order_with_lines transaction1 = transaction_...
180
5,663
astropy
astropy/io/votable/util.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Various utilities and cookbook-like things. """ # STDLIB import codecs import contextlib import gzip import io import os import re from packaging.version import Version __all__ = [ "coerce_range_list_param", "convert_to_writable_filelike", ...
254
6,344
conda
conda/plugins/environment_exporters/environment_yml.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Built-in conda standard environment exporter plugins (YAML and JSON).""" from __future__ import annotations from typing import TYPE_CHECKING, Literal from ...common.serialize import json, yaml from ...exceptions import CondaValueError from...
119
3,878
clearml
clearml/backend_api/services/v2_13/events.py
.py
""" events service Provides an API for running tasks to report events collected by the system. """ from typing import List, Optional, Any import enum import six from clearml.backend_api.session import ( Request, BatchRequest, Response, NonStrictDataModel, CompoundRequest, schema_property, S...
3,521
114,714
bazel
third_party/py/abseil/absl/flags/argparse_flags.py
.py
# Copyright 2018 The Abseil 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 ...
389
14,437
sphinx
tests/roots/test-ext-viewcode/spam/__init__.py
.py
from .mod1 import Class1, func1 from .mod2 import Class2, func2
3
64
beam
sdks/python/apache_beam/runners/worker/log_handler.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...
219
8,642
coremltools
deps/protobuf/conformance/update_failure_list.py
.py
#!/usr/bin/env python # Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. All rights reserved. # https://developers.google.com/protocol-buffers/ # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are...
74
2,898
biopython
Doc/examples/nmr/simplepredict.py
.py
#!/usr/bin/env python # Copyright 2004 Robert Bussell, Jr. 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. """Generate NOE crosspeak peaklists from diagonal peaklist. ** What...
150
5,356
beam
sdks/python/apache_beam/io/gcp/experimental/spannerio_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...
715
27,349
saleor
saleor/tests/e2e/attributes/utils/create_attribute.py
.py
from ...utils import get_graphql_content ATTRIBUTE_CREATE_MUTATION = """ mutation AttributeCreate($input: AttributeCreateInput!) { attributeCreate(input: $input) { attribute { id name slug unit entityType referenceTypes { ... on ProductType { __typename...
84
1,757
pdm
src/pdm/cli/commands/self_cmd.py
.py
from __future__ import annotations import argparse import shlex import subprocess import sys from importlib.metadata import Distribution from typing import TYPE_CHECKING, Any from pdm import termui from pdm.cli.commands.base import BaseCommand from pdm.cli.options import verbose_option from pdm.utils import is_in_zip...
275
10,197
pdm
tests/models/test_working_set.py
.py
from __future__ import annotations from types import SimpleNamespace from pdm.models.working_set import EgglinkFinder, WorkingSet def make_dist(name): return SimpleNamespace(metadata={"Name": name}) def test_egglink_finder_reads_link_target(tmp_path, mocker): site_packages = tmp_path / "site-packages" ...
72
2,414
wagtail
wagtail/permissions.py
.py
import swapper from django.core.exceptions import ImproperlyConfigured from django.db.models import Model from wagtail.models import AbstractPage, Collection, Locale, Site, Task, Workflow from wagtail.permission_policies import BasePermissionPolicy, ModelPermissionPolicy from wagtail.permission_policies.collections im...
113
4,745
sphinx
tests/roots/test-build-html-theme-having-multiple-stylesheets/conf.py
.py
html_theme_path = ['_themes'] html_theme = 'mytheme'
3
53
qutip
qutip/solver/multitraj.py
.py
# Required for Sphinx to follow autodoc_type_aliases from __future__ import annotations from .result import Result from .multitrajresult import MultiTrajResult from .parallel import _get_map from time import time from .solver_base import Solver from ..core import QobjEvo, Qobj from ..core.numpy_backend import np from ...
524
20,126
wagtail
wagtail/api/v3/tests/test_errors.py
.py
from django.test import TestCase from django.urls import reverse from wagtail.api.v3.tests.base import TestV3Base from wagtail.test.utils import WagtailTestUtils class TestV3ErrorResponses(TestV3Base, WagtailTestUtils, TestCase): def test_not_found_is_problem_json(self): response = self.client.get( ...
41
1,424
mlflow
dev/clint/src/clint/rules/markdown_link.py
.py
from clint.rules.base import Rule class MarkdownLink(Rule): def _message(self) -> str: return ( "Markdown link is not supported in docstring. " "Use reST link instead (e.g., `Link text <link URL>`_)." )
10
249
coremltools
mlmodel/docs/preprocess.py
.py
import os import re from itertools import izip import inflection def preprocess(): "splits _sources/reference.rst into separate files" text = open("./_sources/reference.rst", "r").read() os.remove("./_sources/reference.rst") if not os.path.exists("./_sources/reference"): os.makedirs("./_sour...
35
959
coremltools
coremltools/test/modelpackage/test_mlmodel.py
.py
# Copyright (c) 2021, 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 os import shutil import numpy as np import torch import coremltools as ct from coremltools._dep...
75
2,137
coremltools
coremltools/optimize/torch/pruning/pruning_scheduler.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from abc import ABC as _ABC from abc import abstractmethod as _abstractmethod from typing import Unio...
145
5,587
onnxruntime
onnxruntime/python/convert_npz_to_onnx_adapter.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # This script helps converting .npz files to .onnx_adapter files import argparse import os import sys import numpy as np import onnxruntime as ort def get_args() -> argparse: parser = argparse.ArgumentParser() pa...
49
1,533
pyomo
pyomo/common/tests/test_timing.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...
722
26,767
pyomo
pyomo/gdp/tests/test_cuttingplane.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,189
49,441
returns
returns/interfaces/specific/ioresult.py
.py
""" An interface for types that do ``IO`` and can fail. It is a base interface for both sync and async ``IO`` stacks. """ from __future__ import annotations from abc import abstractmethod from collections.abc import Callable from typing import TYPE_CHECKING, Never, TypeVar from returns.interfaces.specific import io...
110
3,247
onnxruntime
onnxruntime/python/tools/transformers/fusion_qordered_layernorm.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- from logging import getLogger from fusion_base import Fusion from fusio...
123
4,810
mlflow
dev/clint/tests/rules/test_missing_notebook_h1_header.py
.py
import json from pathlib import Path from clint.config import Config from clint.index import SymbolIndex from clint.linter import lint_file from clint.rules import MissingNotebookH1Header def test_missing_notebook_h1_header(index: SymbolIndex) -> None: notebook = { "cells": [ { ...
47
1,344
saleor
saleor/graphql/order/tests/queries/test_order_get_variants.py
.py
from ....tests.utils import get_graphql_content QUERY_GET_VARIANTS_FROM_ORDER = """ { me{ orders(first:10){ edges{ node{ lines{ variant{ id } } } } } } } """ def test_get_variant_from_order_line_variant_published_as_cus...
216
5,877
openvino
src/bindings/python/tests/test_graph/test_if.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import numpy as np import openvino.opset8 as ov from openvino import Model from openvino.op.util import InvariantInputDescription, BodyOutputDescription from tests.utils.helpers import compare_mode...
240
8,403
mlflow
examples/virtualenv/project/entrypoint.py
.py
import argparse import os import sys import numpy as np import sklearn from sklearn.pipeline import make_pipeline from sklearn.preprocessing import StandardScaler from sklearn.svm import SVC import mlflow parser = argparse.ArgumentParser() parser.add_argument( "--test", action="store_true", help="If spec...
34
892
probability
tensorflow_probability/python/internal/prefer_static_shape64_test.py
.py
# Copyright 2023 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,032
beam
sdks/python/apache_beam/io/filebasedsource_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 ...
758
28,088
sphinx
tests/roots/test-linkcheck-documents_exclude/conf.py
.py
exclude_patterns = ['_build'] linkcheck_exclude_documents = [ '^broken_link$', 'br[0-9]ken_link', ] linkcheck_timeout = 0.25
7
133
probability
spinoffs/inference_gym/inference_gym/targets/stochastic_volatility.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...
264
10,061
biopython
Bio/PDB/PDBMLParser.py
.py
# 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. """This module contains a parser for PDBML (PDB XML) files. PDBML is a representation of PDB data in XML format. See https://pdbml.wwpdb.org/. """ f...
170
6,858
mlflow
dev/clint/src/clint/rules/implicit_optional.py
.py
import ast from clint.rules.base import Rule class ImplicitOptional(Rule): def _message(self) -> str: return "Use `Optional` if default value is `None`" @staticmethod def check(node: ast.AnnAssign) -> bool: """ Returns True if the value to assign is `None` but the type annotation...
61
1,988
biopython
Tests/test_SeqIO_online.py
.py
# Copyright 2007-2010 by Peter Cock. All rights reserved. # Revisions copyright 2007-2008 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. """Testing online c...
104
3,529
django-cms
cms/templates.py
.py
from django.template.loader import get_template from django.utils.functional import cached_property class TemplatesCache: def __init__(self): self._cached_templates = {} def get_cached_template(self, template): # we check if template quacks like a Template, as generic Template and engine-spe...
32
1,039
astropy
astropy/table/mixins/registry.py
.py
# This module handles the definition of mixin 'handlers' which are functions # that given an arbitrary object (e.g. a dask array) will return an object that # can be used as a mixin column. This is useful because it means that users can # then add objects to tables that are not formally mixin columns and where # adding...
81
2,711
textual
tests/snapshot_tests/snapshot_apps/hatch.py
.py
from textual.app import App, ComposeResult from textual.widgets import Label from textual.containers import Container class HatchApp(App): CSS = """ Screen { hatch: right slateblue; } #one { hatch: left $success; margin: 2 4; } #two { hatch: cross $warning; ...
57
1,186
clearml
examples/datasets/multi_parent_child_dataset.py
.py
from pathlib2 import Path from clearml import Dataset, StorageManager def main(): manager = StorageManager() print("STEP1 : Downloading mnist dataset") mnist_dataset = Path( manager.get_local_copy(remote_url="https://allegro-datasets.s3.amazonaws.com/datasets/MNIST.zip", name="MNIST") ) ...
42
1,430
python-prompt-toolkit
src/prompt_toolkit/input/base.py
.py
""" Abstraction of CLI Input. """ from __future__ import annotations from abc import ABCMeta, abstractmethod from collections.abc import Callable, Generator from contextlib import AbstractContextManager, contextmanager from prompt_toolkit.key_binding import KeyPress __all__ = [ "Input", "PipeInput", "Du...
159
4,139
textual
tests/input/test_input_clear.py
.py
from textual.app import App, ComposeResult from textual.widgets import Input class InputApp(App): def compose(self) -> ComposeResult: yield Input("Hello, World!") async def test_input_clear(): async with InputApp().run_test() as pilot: input_widget = pilot.app.query_one(Input) assert...
17
456
readthedocs.org
readthedocs/telemetry/admin.py
.py
"""Telemetry admin.""" from django.contrib import admin from readthedocs.core.utils.admin import pretty_json_field from readthedocs.telemetry.models import BuildData @admin.register(BuildData) class BuildDataAdmin(admin.ModelAdmin): """Admin class for BuildData model.""" fields = ("created", "modified", "p...
39
1,112
ipython
tests/test_magics_code.py
.py
# coding: utf-8 """Tests for the code management magics (%save, %load, %pastebin, %edit).""" import importlib.util import os from pathlib import Path from urllib.parse import parse_qs import pytest from IPython.testing.decorators import skip_win32 from IPython.core.error import StdinNotImplementedError, TryNext, Us...
568
19,581
onnx
onnx/reference/ops/aionnxml/_op_run_aionnxml.py
.py
# SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from onnx.reference.op_run import OpRun class OpRunAiOnnxMl(OpRun): op_domain = "ai.onnx.ml"
9
173
astropy
astropy/utils/compat/optional_deps.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Checks for optional dependencies using lazy import from `PEP 562 <https://www.python.org/dev/peps/pep-0562/>`_. """ from importlib.util import find_spec # First, the top-level packages: # TODO: This list is a duplicate of the dependencies in pyproject...
63
1,487
returns
returns/contrib/mypy/_features/flow.py
.py
from mypy.plugin import FunctionContext from mypy.types import Type as MypyType from mypy.types import get_proper_type from returns.contrib.mypy._typeops.inference import PipelineInference def analyze(ctx: FunctionContext) -> MypyType: """ Helps to analyze ``flow`` function calls. By default, ``mypy`` c...
56
1,702
saleor
saleor/tests/e2e/attributes/utils/prepare_attributes.py
.py
from .attribute_bulk_create import bulk_create_attributes from .create_attribute import attribute_create def prepare_all_attributes(e2e_staff_api_client, attribute_type, entity_type): # Dropdown values = [ {"name": "Freddy Torres"}, {"name": "Isabella Smith"}, {"name": "Hayden Blake"},...
294
7,435
probability
tensorflow_probability/python/internal/backend/numpy/numpy_logging.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...
171
3,497
onnx
onnx/backend/test/case/node/gru.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from typing import Any import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class GRUHelper: def __init__(self, **params: An...
384
11,438
ipython
tests/test_debugger.py
.py
"""Tests for debugging machinery.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import builtins import io import os import re as re_module import sys import platform from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from tex...
1,994
57,989
saleor
saleor/account/notifications.py
.py
from urllib.parse import urlencode from ..core.notification.utils import get_site_context from ..core.notify import NotifyEventType, NotifyHandler from ..core.tokens import ( account_confirm_token_generator, account_delete_token_generator, password_reset_token_generator, ) from ..core.utils.url import prep...
205
6,762
beam
sdks/python/apache_beam/ml/rag/ingestion/milvus_search.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...
352
13,008
onnx
onnx/reference/ops/op_dynamic_quantize_linear.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 DynamicQuantizeLinear(OpRun): def _run(self, x): # args: x, y_scale, zero_point dtype, qmin, qmax = np.uint8, 0, 25...
33
965
mlflow
mlflow/protos/prompt_optimization_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: prompt_optimization.proto # Protobuf Python Version: 5.26.0 """Generated protocol buffer code.""" fro...
142
10,285
metrics
src/torchmetrics/functional/regression/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...
44
1,805
beam
sdks/python/apache_beam/coders/standard_coders_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...
330
13,011
mlflow
tests/store/artifact/test_cloud_artifact_repo.py
.py
from concurrent.futures import Future from unittest import mock import pytest from mlflow.exceptions import MlflowException from mlflow.protos.databricks_artifacts_pb2 import ArtifactCredentialInfo, ArtifactCredentialType from mlflow.store.artifact.cloud_artifact_repo import ( CloudArtifactRepository, _readab...
135
5,124
wagtail
wagtail/admin/urls/__init__.py
.py
import functools from django.conf import settings from django.http import Http404 from django.urls import include, path, re_path from django.views.decorators.cache import never_cache from django.views.defaults import page_not_found from django.views.generic import TemplateView from wagtail import hooks from wagtail.a...
193
6,464
pyomo
pyomo/mpec/plugins/__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...
21
715
gunicorn
examples/streaming_chat/__init__.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. # Streaming Chat Example # Demonstrates dirty worker streaming with simulated LLM token generation
7
205
biopython
Bio/Phylo/CDAO.py
.py
# Copyright (C) 2013 by Ben Morris (ben@bendmorris.com) # based on code by Eric Talevich (eric.talevich@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 inc...
51
1,660
gunicorn
examples/celery_alternative/gunicorn_conf.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Gunicorn Configuration - Celery Replacement Example This configuration sets up: 1. ASGI workers to handle web requests with async I/O (using uvloop) 2. Dirty workers to handle background tasks (replacing Celer...
155
5,333
openvino
tests/layer_tests/pytorch_tests/test_slice_scatter.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestSliceScatter(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(2, 5, 3, 4),) def create_model(self, src, dim, start, ...
41
1,374
saleor
saleor/warehouse/tests/test_tasks.py
.py
import datetime import pytest from django.utils import timezone from ..models import Allocation, PreorderReservation, Reservation from ..tasks import ( delete_empty_allocations_task, delete_expired_reservations_task, update_stocks_quantity_allocated_task, ) def test_delete_empty_allocations_task(allocat...
107
3,227
coremltools
coremltools/converters/mil/debugging_utils.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 copy from collections import OrderedDict from typing import List, Optional import coremltools...
203
7,908
mlflow
examples/agno/tracing.py
.py
import mlflow mlflow.set_tracking_uri("http://localhost:5000") mlflow.set_experiment("AGNO Reasoning Finance Team") mlflow.agno.autolog() mlflow.anthropic.autolog() mlflow.openai.autolog() from agno.agent import Agent from agno.models.anthropic import Claude from agno.models.openai import OpenAIChat from agno.team.t...
77
2,781
pyomo
pyomo/dae/tests/test_simulator.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,410
50,558
voila
voila/tornado/treehandler.py
.py
############################################################################# # Copyright (c) 2018, Voilà Contributors # # Copyright (c) 2018, QuantStack # # # # Distri...
118
4,928
wagtail
wagtail/admin/forms/formsets.py
.py
from django import forms class BaseFormSetMixin: """ A mixin for formsets that adds the necessary attributes for the w-formset controller. So that JavaScript behavior can be added to the formset for dynamic addition and deletion of child forms. See client/src/controllers/FormsetController.ts """ ...
33
1,220
astropy
astropy/io/votable/validator/main.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Validates a large collection of web-accessible VOTable files, and generates a report as a directory tree of HTML files. """ # STDLIB import os # LOCAL from astropy.utils.data import get_pkg_data_filename from . import html, result __all__ = ["make_...
158
4,745
luigi
test/scheduler_parameter_visibilities_test.py
.py
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
120
4,933
returns
returns/interfaces/specific/maybe.py
.py
from abc import abstractmethod from collections.abc import Callable, Sequence from typing import ClassVar, Never, TypeVar, final from returns.interfaces import equable, failable, unwrappable from returns.primitives.asserts import assert_equal from returns.primitives.hkt import KindN from returns.primitives.laws import...
176
5,150
python-prompt-toolkit
examples/print-text/ansi-colors.py
.py
#!/usr/bin/env python """ Demonstration of all the ANSI colors. """ from prompt_toolkit import print_formatted_text from prompt_toolkit.formatted_text import HTML, FormattedText print = print_formatted_text def main(): wide_space = ("", " ") space = ("", " ") print(HTML("\n<u>Foreground colors</u...
102
3,084
clearml
examples/pipeline/step1_dataset_artifact.py
.py
from clearml import Task, StorageManager # create an dataset experiment task = Task.init(project_name="examples", task_name="Pipeline step 1 dataset artifact") # only create the task, we will actually execute it later task.execute_remotely() # simulate local dataset, download one, so we have something local local_ir...
20
659
colorama
demos/demo08.py
.py
import fixpath from colorama import colorama_text, Fore def main(): """automatically reset stdout""" with colorama_text(): print(Fore.GREEN + 'text is green') print(Fore.RESET + 'text is back to normal') print('text is back to stdout') if __name__ == '__main__': main()
15
306
lemur
lemur/common/defaults.py
.py
import re import unicodedata from cryptography import x509 from cryptography.hazmat.primitives.serialization import Encoding from flask import current_app from sentry_sdk import capture_exception from lemur.common.utils import is_selfsigned from lemur.constants import SAN_NAMING_TEMPLATE, DEFAULT_NAMING_TEMPLATE de...
310
8,258
black
tests/data/cases/context_managers_autodetect_311.py
.py
# flags: --minimum-version=3.11 # This file uses except* clause in Python 3.11. try: some_call() except* Error as e: pass with \ make_context_manager1() as cm1, \ make_context_manager2() as cm2, \ make_context_manager3() as cm3, \ make_context_manager4() as cm4 \ : pass # output ...
39
585
beam
sdks/python/apache_beam/ml/rag/ingestion/test_utils.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...
96
3,186
pyomo
examples/pyomobook/abstract-ch/param6a.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...
35
1,150
kombu
kombu/transport/sqlalchemy/models.py
.py
"""Kombu transport using SQLAlchemy as the message store.""" from __future__ import annotations import datetime from sqlalchemy import (Boolean, Column, DateTime, ForeignKey, Index, Integer, Sequence, SmallInteger, String, Text) from sqlalchemy.orm import relationship from sqlalchemy.schema i...
77
2,302
onnxruntime
onnxruntime/python/tools/transformers/fusion_gpt_attention_no_past.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- from logging import getLogger from fusion_base import Fusion from onnx ...
258
10,573
sqlmap
lib/utils/prove.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 time from lib.core.common import Backend from lib.core.common import average from lib.core.common import getCurrentThreadData from lib.core.common import getSafe...
484
21,298
saleor
saleor/graphql/account/mutations/staff/user_avatar_update.py
.py
from typing import cast import graphene from .....account import models from .....account.error_codes import AccountErrorCode from .....permission.auth_filters import AuthorizationFilters from .....thumbnail import models as thumbnail_models from ....account.types import User from ....core import ResolveInfo from ......
50
1,821
coveragepy
lab/select_contexts.py
.py
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/coveragepy/coveragepy/blob/main/NOTICE.txt """\ Select certain contexts from a coverage.py data file. """ import argparse import re import sys import coverage def main(argv): parser = argparse.Argu...
67
2,174
cvxpy
cvxpy/interface/numpy_interface/ndarray_interface.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...
80
2,523
textual
tests/directory_tree/test_early_show_root.py
.py
from textual.app import App, ComposeResult from textual.widgets import DirectoryTree class DirectoryTreeApp(App[None]): def compose(self) -> ComposeResult: tree = DirectoryTree(".") tree.show_root = True yield tree async def test_managed_to_set_show_root_before_mounted() -> None: """...
17
573
funcy
funcy/calc.py
.py
from datetime import timedelta import time import inspect from collections import deque from bisect import bisect from .decorators import wraps __all__ = ['memoize', 'make_lookuper', 'silent_lookuper', 'cache'] class SkipMemory(Exception): pass # TODO: use pos-only arg once in Python 3.8+ only def memoize(_...
153
4,673
biopython
Tests/test_SeqIO_features.py
.py
# Copyright 2009-2016 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. """SeqFeature related tests for SeqRecord objects from Bio.SeqIO. Initially this takes match...
1,376
60,237
beam
playground/backend/internal/utils/test_data/wordcount.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...
112
3,559
saleor
saleor/graphql/product/types/categories.py
.py
import graphene from graphene import relay from promise import Promise from ....core.search import prefix_search from ....permission.utils import has_one_of_permissions from ....product import models from ....product.models import ALL_PRODUCTS_PERMISSIONS from ....thumbnail.utils import ( get_image_or_proxy_url, ...
235
9,165