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/utils/apps.py
.py
from importlib import import_module from django.apps import apps from django.utils.module_loading import module_has_submodule def get_app_modules(): """ Generator function that yields a module object for each installed app yields tuples of (app_name, module) """ for app in apps.get_app_configs():...
24
677
saleor
saleor/graphql/core/context.py
.py
import datetime from dataclasses import dataclass from typing import TYPE_CHECKING, Any, Generic, TypeVar from django.conf import settings from django.db.models import Model, QuerySet from django.http import HttpRequest from django.utils.functional import empty if TYPE_CHECKING: from ...account.models import User...
106
3,517
ipython
IPython/core/magics/packaging.py
.py
"""Implementation of packaging-related magic functions. """ #----------------------------------------------------------------------------- # Copyright (c) 2018 The IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with ...
182
6,030
openvino
tests/layer_tests/pytorch_tests/test_masked_select.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import torch from packaging.version import parse as parse_version import pytest from pytorch_layer_test_class import PytorchLayerTest class TestMaskedSelect(PytorchLayerTest): def _prepare_input(self, mask_selec...
61
2,510
pyomo
examples/dae/Parameter_Estimation.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...
74
2,061
pdm
src/pdm/cli/commands/install.py
.py
import argparse import sys import sysconfig from pdm import termui from pdm.cli.commands.base import BaseCommand from pdm.cli.filters import GroupSelection from pdm.cli.hooks import HookManager from pdm.cli.options import ( dry_run_option, frozen_lockfile_option, groups_group, install_group, lockfi...
112
3,922
lemur
lemur/plugins/lemur_gcs/plugin.py
.py
import os from typing import Dict, Any, Optional from google.cloud import storage # type: ignore[attr-defined] from google.oauth2 import service_account from google.api_core import exceptions as gcs_exceptions from flask import current_app from lemur.plugins import lemur_gcs from lemur.common.defaults import ( ...
244
8,884
biopython
Bio/Affy/__init__.py
.py
# This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included as part of this # package. """Deal with Affymetrix related data such as cel files."""
7
296
deap
doc/code/benchmarks/shekel.py
.py
from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm from matplotlib.colors import LogNorm import matplotlib.pyplot as plt try: import numpy as np except: exit() from deap import benchmarks #NUMMAX = 5 #A = 10 * np.random.rand(NUMMAX, 2) #C = np.random.rand(NUMMAX) A = [[0.5, 0.5], [0.25, 0.25]...
36
876
ipython
tests/test_demo.py
.py
# -*- coding: utf-8 -*- """Tests for the IPython.lib.demo module.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import builtins import io import pytest from IPython.lib import demo as demo_module from IPython.lib.demo import ( ClearDemo, ClearIPDemo,...
435
12,485
ipython
tests/test_text_utils.py
.py
"""Parametrized tests for IPython.utils.text utility functions.""" import pytest from IPython.utils.text import ( indent, list_strings, marquee, format_screen, dedent, get_text_list, ) # --------------------------------------------------------------------------- # indent # --------------------...
140
4,532
probability
tensorflow_probability/python/experimental/fastgp/fast_log_det_test.py
.py
# Copyright 2024 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...
680
20,763
probability
tensorflow_probability/python/layers/dense_variational.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...
720
28,249
textual
docs/examples/guide/screens/screen01.py
.py
from textual.app import App, ComposeResult from textual.screen import Screen from textual.widgets import Static ERROR_TEXT = """ An error has occurred. To continue: Press Enter to return to Windows, or Press CTRL+ALT+DEL to restart your computer. If you do this, you will lose any unsaved information in all open appl...
35
840
saleor
saleor/graphql/account/tests/mutations/account/test_confirm_email_change.py
.py
from functools import partial from unittest.mock import patch from django.conf import settings from ......account.models import User from ......channel.models import Channel from ......core.jwt import JWT_CONFIRM_CHANGE_EMAIL_TYPE, create_token, jwt_decode from .....tests.fixtures import ApiClient from .....tests.uti...
235
7,300
sqlmap
tamper/space2morehash.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 random import re import string from lib.core.common import singleTimeWarnMessage from lib.core.compat import xrange from lib.core.data import kb from lib.core.en...
80
2,633
clearml
clearml/utilities/process/exit_hooks.py
.py
import atexit import os import signal import sys import types from typing import Callable, Union, Any from ...logger import Logger class ExitHooks: _orig_exit = None _orig_exc_handler = None remote_user_aborted = False def __init__(self, callback: Callable) -> None: self.exit_code = None ...
192
6,565
onnx
onnx/backend/test/case/node/sequence_map.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 class SequenceMap(Base): @staticmethod def export_sequence_map_ident...
305
10,952
kombu
kombu/transport/SQS/__init__.py
.py
"""Amazon SQS transport module for Kombu. This package implements an AMQP-like interface on top of Amazons SQS service, with the goal of being optimized for high performance and reliability. The default settings for this module are focused now on high performance in task queue situations where tasks are small, idempo...
1,482
56,556
biopython
Tests/test_AlignIO_EmbossIO.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.AlignIO.EmbossIO module.""" import unittest from io import StringIO from...
74
2,726
probability
tensorflow_probability/python/experimental/auto_batching/backend_test_lib.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...
247
9,030
onnxruntime
onnxruntime/test/python/transformers/env_var_helper.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import os from contextlib import contextmanager @contextmanager def s...
26
802
saleor
saleor/graphql/discount/tests/mutations/test_voucher_code_bulk_delete.py
.py
from unittest import mock import graphene from ....tests.utils import get_graphql_content VOUCHER_CODE_BULK_DELETE_MUTATION = """ mutation voucherCodeBulkDelete($ids: [ID!]!) { voucherCodeBulkDelete(ids: $ids) { count errors { path message ...
138
3,759
onnxruntime
onnxruntime/test/providers/cpu/reduction/reduction_test_cases_generator.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import numpy as np def TestReduction(op, data, axes, keepdims): # noqa: N802 if op == "ReduceL1": return np.sum(a=np.abs(data), axis=axes, keepdims=keepdims) elif op == "ReduceL2": return np.sqrt(np...
159
4,618
metrics
tests/unittests/text/test_wer.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...
71
2,504
returns
returns/interfaces/mappable.py
.py
from abc import abstractmethod from collections.abc import Callable, Sequence from typing import ClassVar, Generic, Never, TypeVar, final from returns.functions import compose, identity from returns.primitives.asserts import assert_equal from returns.primitives.hkt import KindN from returns.primitives.laws import ( ...
96
2,594
biopython
Bio/Align/bed.py
.py
# Copyright 2022 by Michiel de Hoon. All rights reserved. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included as part of this # package. """Bio.Align support fo...
260
9,932
probability
tensorflow_probability/python/mcmc/internal/util.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...
506
19,010
probability
tensorflow_probability/python/bijectors/power.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...
116
4,204
httpie
tests/test_meta.py
.py
import pytest from httpie.models import ELAPSED_TIME_LABEL from httpie.output.formatters.colors import PIE_STYLE_NAMES from .utils import http, MockEnvironment, COLOR def test_meta_elapsed_time(httpbin): r = http('--meta', httpbin + '/delay/1') assert f'{ELAPSED_TIME_LABEL}: 1.' in r @pytest.mark.parametri...
18
570
jupytext
tests/integration/cli/test_cli_pipe.py
.py
import pytest from jupytext.cli import jupytext @pytest.mark.requires_myst @pytest.mark.requires_black def test_cli_black_myst( tmp_path, no_jupytext_version_number, text="""--- jupytext: formats: md:myst text_representation: extension: .md format_name: myst format_version: 0.13 kernelspe...
38
655
probability
tensorflow_probability/python/internal/backend/numpy/tensor_array_ops.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...
189
6,755
mlflow
mlflow/entities/model_registry/registered_model_deployment_job_state.py
.py
from mlflow.protos.databricks_uc_registry_messages_pb2 import DeploymentJobConnection class RegisteredModelDeploymentJobState: """Enum for registered model deployment state of an :py:class:`mlflow.entities.model_registry.RegisteredModel`. """ NOT_SET_UP = DeploymentJobConnection.State.Value("NOT_SET_...
40
1,757
pyomo
pyomo/gdp/plugins/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,247
52,082
hydra
hydra/core/config_loader.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from abc import ABC, abstractmethod from typing import Any, List, Optional from omegaconf import DictConfig from hydra.core.config_search_path import ConfigSearchPath from hydra.core.object_type import ObjectType from hydra.plugins.config_source i...
58
1,521
coremltools
coremltools/converters/mil/frontend/torch/test/test_passes.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 from collections import OrderedDict import numpy as np import pytest import torch from ..internal_g...
458
14,794
httpie
tests/utils/plugins_cli.py
.py
import secrets import site import sys import textwrap import pytest from collections import defaultdict from dataclasses import dataclass, field, asdict from pathlib import Path from typing import Any, List, Dict, Tuple from unittest.mock import patch from httpie.context import Environment from httpie.compat import ...
236
6,572
mlflow
mlflow/deployments/openai/__init__.py
.py
import os from mlflow.deployments import BaseDeploymentClient from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE from mlflow.utils.openai_utils import ( _OAITokenHolder, _OpenAIApiConfig, _OpenAIEnvVar, ) from mlflow.utils.rest_utils import augmen...
253
7,400
wandb
tests/system_tests/test_sweep/test_sweep_public_api.py
.py
import json import pytest import wandb from wandb import Api from wandb.apis.public.sweeps import Sweep from wandb.errors import UnsupportedError from wandb.proto import wandb_internal_pb2 as pb from wandb.sdk.internal.internal_api import Api as InternalApi from tests.fixtures.wandb_backend_spy import WandbBackendSpy...
262
8,154
biopython
Bio/SeqIO/SeqXmlIO.py
.py
# Copyright 2010 by Thomas Schmitt. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included as part of this # package. """Bio.SeqIO support for the "seqxml" file for...
728
30,529
onnx
onnx/reference/ops/op_pool_common.py
.py
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import itertools import math from typing import TYPE_CHECKING import numpy as np from onnx.reference.op_run import OpRun if TYPE_CHECKING: from collections.abc import Sequence def get_pad_shape...
346
12,618
saleor
saleor/tests/e2e/checkout/discounts/promotions/test_checkout_products_on_percentage_promotion.py
.py
import pytest from ......product.tasks import recalculate_discounted_price_for_products_task from ....product.utils.preparing_product import prepare_product from ....promotions.utils import create_promotion, create_promotion_rule from ....shop.utils import prepare_default_shop from ....utils import assign_permissions ...
126
4,323
mlflow
mlflow/store/db/base_sql_model.py
.py
from sqlalchemy.orm import declarative_base Base = declarative_base()
4
71
openvino
docs/scripts/create_doc_mapping.py
.py
import re import os import json from pathlib import Path import argparse import logging # from github import Github def create_mapping(output_dir: Path, doc_dir_name: str): mapping = {} output_dir = output_dir.resolve() script_dir = os.path.dirname(os.path.realpath(__file__)) directory = os.path.abspat...
75
2,763
mlflow
mlflow/models/notebook_resources/eval_with_synthetic_example.py
.py
# ruff: noqa: F821, I001 {{pipInstall}} from databricks.agents.evals import generate_evals_df import mlflow agent_description = "A chatbot that answers questions about Databricks." question_guidelines = """ # User personas - A developer new to the Databricks platform # Example questions - What API lets me parallelize...
23
730
hydra
tests/test_config_loader.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import re from dataclasses import dataclass, field from textwrap import dedent from typing import Any, List, cast from omegaconf import MISSING, DictConfig, OmegaConf, ValidationError, open_dict from omegaconf.errors import InterpolationResolutionE...
1,115
37,122
loguru
tests/exceptions/source/others/recursion_error.py
.py
from loguru import logger import sys sys.setrecursionlimit(1000) logger.remove() logger.add(sys.stderr, format="", diagnose=False, backtrace=False, colorize=False) logger.add(sys.stderr, format="", diagnose=False, backtrace=True, colorize=False) logger.add(sys.stderr, format="", diagnose=False, backtrace=False, colo...
22
518
saleor
saleor/graphql/account/mutations/authentication/request_password_reset.py
.py
import graphene from django.conf import settings from django.core.exceptions import ValidationError from django.utils import timezone from .....account.error_codes import AccountErrorCode from .....account.tasks import trigger_send_password_reset_notification from .....account.utils import RequestorAwareContext, retri...
112
4,373
sphinx
sphinx/domains/cpp/_parser.py
.py
from __future__ import annotations import re from typing import TYPE_CHECKING from sphinx.domains.cpp._ast import ( ASTAlignofExpr, ASTArray, ASTAssignmentExpr, ASTBaseClass, ASTBinOpExpr, ASTBooleanLiteral, ASTBracedInitList, ASTCastExpr, ASTCharLiteral, ASTClass, ASTComma...
2,270
89,916
cvxpy
cvxpy/atoms/elementwise/logistic.py
.py
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
84
2,413
pyomo
pyomo/contrib/gdp_bounds/info.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...
73
2,932
pyomo
pyomo/core/tests/unit/test_labelers.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...
243
10,362
black
tests/data/cases/remove_newline_after_code_block_open.py
.py
import random def foo1(): print("The newline above me should be kept!") def foo2(): print("All the newlines above me should be kept!") def foo3(): print("No newline above me!") print("There is a newline above me, and that's OK!") def foo4(): # There is a comment here print("The n...
213
3,218
returns
returns/context/requires_context_ioresult.py
.py
from __future__ import annotations from collections.abc import Callable from typing import TYPE_CHECKING, Any, ClassVar, TypeAlias, TypeVar, final from returns.context import NoDeps from returns.interfaces.specific import reader_ioresult from returns.io import IO, IOFailure, IOResult, IOSuccess from returns.primitive...
934
30,932
kombu
kombu/transport/consul.py
.py
"""Consul Transport module for Kombu. Features ======== It uses Consul.io's Key/Value store to transport messages in Queues It uses python-consul for talking to Consul's HTTP API Features ======== * Type: Native * Supports Direct: Yes * Supports Topic: *Unreviewed* * Supports Fanout: *Unreviewed* * Supports Priorit...
324
9,424
tqdm
tqdm/__main__.py
.py
from .cli import main main()
4
30
saleor
saleor/payment/tests/test_utils/test_create_transaction_event_for_transaction_session.py
.py
import datetime import logging from decimal import Decimal from unittest.mock import patch import pytest from freezegun import freeze_time from ....order import OrderAuthorizeStatus from ... import TransactionEventType from ...models import TransactionEvent from ...utils import ( create_transaction_event_for_tran...
1,146
36,813
wagtail
wagtail/rich_text/pages.py
.py
import swapper from django.db.models import Model from django.utils.html import escape from wagtail.rich_text import LinkHandler Page = swapper.load_model("wagtailcore", "Page") class PageLinkHandler(LinkHandler): identifier = "page" @staticmethod def get_model(): return Page @classmethod ...
41
1,375
probability
tensorflow_probability/python/mcmc/langevin_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...
309
12,260
returns
returns/contrib/hypothesis/type_resolver.py
.py
"""Make `hypothesis` resolve types to the right strategies.""" from collections.abc import Callable, Iterator, Mapping from contextlib import contextmanager from typing import TypeAlias, TypeVar from hypothesis import strategies as st from hypothesis.strategies._internal import types # noqa: PLC2701 Example_co = Ty...
76
2,485
probability
tensorflow_probability/python/distributions/negative_binomial.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...
311
12,851
pyro
examples/contrib/autoname/mixture.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import argparse import torch from torch.distributions import constraints import pyro import pyro.distributions as dist from pyro.contrib.autoname import named from pyro.infer import SVI, JitTrace_ELBO, Trace_ELBO from pyro.optim ...
83
2,572
gunicorn
examples/asgi/websocket_app.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ WebSocket ASGI application example. Run with: gunicorn -k asgi examples.asgi.websocket_app:app Test with: # Using websocat (install with: cargo install websocat) websocat ws://127.0.0.1:8000/ws ...
236
6,927
gunicorn
tests/requests/valid/rfc9112_target_absolute_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 request-target. request = { "method": "GET", "uri": uri("http://example.com/foo?q=1"), "version": (1, 1), "headers": [ ("HOST", "example.com"), ],...
15
340
saleor
saleor/graphql/order/tests/mutations/test_fulfillment_approve.py
.py
from unittest.mock import patch import graphene from .....giftcard.models import GiftCard from .....order import FulfillmentStatus, OrderEvents, OrderStatus from .....order.actions import fulfill_order_lines from .....order.error_codes import OrderErrorCode from .....order.fetch import OrderLineInfo from .....order.m...
542
19,690
flit
flit/config.py
.py
import os from flit_core.config import * from flit_core.config import read_flit_config as _read_flit_config_core from .validate import validate_config def read_flit_config(path): """Read and check the `pyproject.toml` or `flit.ini` file with data about the package. """ res = _read_flit_config_core(path) ...
19
592
beam
sdks/python/apache_beam/ml/transforms/embeddings/vertex_ai.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...
519
19,136
clearml
clearml/backend_interface/task/access.py
.py
import itertools import operator from abc import abstractproperty from typing import Dict, Optional, Any from pathlib2 import Path class AccessMixin: """A mixin providing task fields access functionality""" session = abstractproperty() data = abstractproperty() cache_dir = abstractproperty() lo...
128
4,596
wagtail
wagtail/contrib/redirects/api/__init__.py
.py
from .v2 import RedirectsAPIViewSet, RedirectSerializer # For backwards compatibility __all__ = [ "RedirectSerializer", "RedirectsAPIViewSet", ]
8
154
gunicorn
gunicorn/http2/async_connection.py
.py
# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Async HTTP/2 server connection implementation for ASGI workers. Uses the hyper-h2 library for HTTP/2 protocol handling with asyncio for non-blocking I/O. """ import asyncio from .errors...
596
20,959
biopython
Bio/SearchIO/_utils.py
.py
# Copyright 2012 by Wibowo Arindrarto. All rights reserved. # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included as part of this # package. """Common SearchIO util...
170
5,596
cvxpy
cvxpy/atoms/affine/diff.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...
74
2,395
probability
tensorflow_probability/python/experimental/auto_batching/allocation_strategy_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...
95
4,227
confluent-kafka-python
src/confluent_kafka/_oauthbearer/aws/jwt_extractor.py
.py
# 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 required by applicable law or agreed to in writing, s...
91
3,040
mlflow
mlflow/gateway/providers/mlflow.py
.py
import time from pydantic import BaseModel, StrictFloat, StrictStr, ValidationError, field_validator from mlflow.gateway.config import EndpointConfig, MlflowModelServingConfig from mlflow.gateway.constants import MLFLOW_SERVING_RESPONSE_KEY from mlflow.gateway.exceptions import AIGatewayException from mlflow.gateway....
240
8,780
sqlmap
plugins/dbms/virtuoso/connector.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ from lib.core.exception import SqlmapUnsupportedFeatureException from plugins.generic.connector import Connector as GenericConnector class Connector(GenericConnector): def co...
16
505
wagtail
scripts/get-translator-credits.py
.py
import re from collections import defaultdict from pathlib import Path from babel import Locale authors_by_locale = defaultdict(set) for filename in Path("wagtail").rglob("*.po"): # extract locale string from filename locale = re.search(r"locale/(\w+)/LC_MESSAGES", str(filename)).group(1) if locale == "e...
62
1,847
sqlmap
thirdparty/chardet/latin1prober.py
.py
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All R...
146
5,370
saleor
saleor/core/utils/tests/test_events.py
.py
from unittest import mock from django.db import transaction from ..events import call_event @mock.patch.object(transaction, "get_connection", wraps=transaction.get_connection) def test_call_event_triggers_provided_method( mocked_transaction, checkout_info, plugins_manager, django_capture_on_commit_c...
27
706
beam
sdks/python/apache_beam/testing/benchmarks/inference/pytorch_sentiment_benchmarks.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
43
1,568
sphinx
tests/roots/test-extensions/read_serial.py
.py
def setup(app): return { 'parallel_read_safe': False, }
5
72
django-cms
cms/toolbar/items.py
.py
import json from abc import ABCMeta from collections import defaultdict from django.template.loader import render_to_string from django.utils.encoding import force_str from django.utils.functional import Promise from cms.constants import LEFT, REFRESH_PAGE, RIGHT, URL_CHANGE class ItemSearchResult: """ Retu...
738
25,925
probability
tensorflow_probability/python/internal/name_util.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...
117
3,817
mlflow
tests/dev/test_update_model_catalog.py
.py
import json import sys from datetime import date from pathlib import Path import pytest sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "dev")) from update_model_catalog import ( _extract_long_context_pricing, _extract_modality_pricing, _extract_service_tiers, _extract_tool_pricing, ...
796
24,846
slimit
src/slimit/parser.py
.py
############################################################################### # # Copyright (c) 2011 Ruslan Spivak # # 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, inc...
1,224
40,155
beam
sdks/python/setup.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...
701
27,911
openvino
src/bindings/python/tests/test_graph/test_preprocess.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset13 as ops from openvino import Core, Layout, Model, Shape, Tensor, Type from openvino.utils.decorators import custom_preprocess_function from openvino import...
805
29,160
astropy
scripts/update-latest-whatsnew-stats.py
.py
# /// script # requires-python = ">=3.11" # dependencies = [] # /// """Update a ``docs/whatsnew/<version>.rst`` file with the release summary. Usage: python scripts/update-latest-whatsnew-stats.py --pat=$GITHUB_PAT python scripts/update-latest-whatsnew-stats.py docs/whatsnew/8.0.rst --pat=$GITHUB_PAT With no ...
294
9,670
saleor
saleor/checkout/tests/test_actions.py
.py
import datetime from decimal import Decimal from unittest.mock import ANY, patch import pytest from django.test import override_settings from django.utils import timezone from freezegun import freeze_time from ...core.models import EventDelivery from ...plugins.manager import get_plugins_manager from ...webhook.event...
1,741
61,532
openvino
tests/layer_tests/onnx_tests/test_sum.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from common.onnx_layer_test_class import OnnxRuntimeLayerTest, onnx_make_model class TestSum(OnnxRuntimeLayerTest): def create_net(self, dyn_shapes, const_shapes, precision, ir_version, opset=None)...
341
15,264
textual
tests/listview/test_listview_initial_index.py
.py
import pytest from textual.app import App, ComposeResult from textual.widgets import Label, ListItem, ListView @pytest.mark.parametrize( "initial_index,expected_index", [ (0, 1), (1, 1), (2, 4), (3, 4), (4, 4), (5, 5), (6, 7), (7, 7), (8...
43
1,266
onnxruntime
onnxruntime/python/tools/quantization/execution_providers/qnn/fusion_lpnorm.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- from __fut...
133
5,195
scikit-optimize
skopt/__init__.py
.py
""" Scikit-Optimize, or `skopt`, is a simple and efficient library to minimize (very) expensive and noisy black-box functions. It implements several methods for sequential model-based optimization. `skopt` is reusable in many contexts and accessible. """ try: # This variable is injected in the __builtins__ by the b...
83
2,357
saleor
saleor/checkout/search/indexing.py
.py
from typing import TYPE_CHECKING import graphene from django.conf import settings from django.db import transaction from django.db.models import Value from ...account.search import ( generate_address_search_vector_value, generate_email_vector, ) from ...core.context import with_promise_context from ...core.db...
218
7,302
pyomo
doc/OnlineDocs/src/expr/overview.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...
102
1,937
textual
tests/snapshot_tests/snapshot_apps/max_height_100.py
.py
from textual.app import App, ComposeResult from textual.widgets import DataTable, Static class HappyDataTableFunApp(App[None]): """The DataTable should expand to full the screen and show a horizontal scrollbar.""" CSS = """ #s { max-height: 100%; } DataTable { max-height: 100%; ...
31
759
pyomo
pyomo/contrib/mpc/modeling/tests/test_cost_expressions.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...
506
21,746
openvino
tests/e2e_tests/common/ref_collector/score_paddlepaddle.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import logging as log import os import sys from pathlib import Path from e2e_tests.common.common.base_provider.ref_collector.provider import ClassProvider os.environ["GLOG_minloglevel"] = "3" class ScorePaddlePaddle(ClassProvider): ...
60
2,169
onnxruntime
onnxruntime/test/testdata/trt_plugin_custom_op_test.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import onnx from onnx import TensorProto, helper def generate_model(model_name): nodes = [ helper.make_node( "DisentangledAttention_TRT", ["input1", "input2", "inpu...
41
1,141
hydra
tests/standalone_apps/discovery_test_plugin/hydra_plugins/discovery_test/discovery_test.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import os from pathlib import Path from hydra.plugins.plugin import Plugin if "TMP_FILE" in os.environ: with Path(os.environ["TMP_FILE"]).open(mode="a") as f: f.write("imported\n") class DiscoveryTestPlugin(Plugin): ...
13
307