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 |
|---|---|---|---|---|---|
sphinx | sphinx/ext/intersphinx/_resolve.py | .py | """This module provides logic for resolving references to intersphinx targets."""
from __future__ import annotations
import re
from pathlib import Path
from typing import TYPE_CHECKING, cast
from docutils import nodes
from sphinx.addnodes import pending_xref
from sphinx.errors import ExtensionError
from sphinx.ext.... | 580 | 21,092 |
loguru | tests/test_opt.py | .py | import sys
from unittest.mock import MagicMock
import pytest
from loguru import logger
from .conftest import parse
def test_record(writer):
logger.add(writer, format="{message}")
logger.opt(record=True).debug("1")
logger.opt(record=True).debug("2 {record[level]}")
logger.opt(record=True).log(11, "... | 639 | 22,076 |
conda | tests/cli/test_main_rename.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
import uuid
from pathlib import Path
from typing import TYPE_CHECKING
import pytest
from conda.base.context import (
context,
locate_prefix_by_name,
reset_context,
)
from conda.common.compat impo... | 358 | 10,644 |
ipython | tests/test_logger.py | .py | # -*- coding: utf-8 -*-
"""Test IPython.core.logger"""
import os.path
import re
import pytest
from tempfile import TemporaryDirectory
from IPython.core.logger import Logger
def test_logstart_inaccessible_file():
with pytest.raises(IOError):
_ip.logger.logstart(logfname="/") # Opening that filename wil... | 280 | 8,802 |
pyfilesystem2 | tests/test_appfs.py | .py | from __future__ import unicode_literals
import shutil
import six
import tempfile
import unittest
try:
from unittest import mock
except ImportError:
import mock
import fs.test
from fs import appfs
class _TestAppFS(fs.test.FSTestCases):
AppFS = None
@classmethod
def setUpClass(cls):
sup... | 87 | 1,924 |
textual | docs/examples/styles/tint.py | .py | from textual.app import App
from textual.color import Color
from textual.widgets import Label
class TintApp(App):
CSS_PATH = "tint.tcss"
def compose(self):
color = Color.parse("green")
for tint_alpha in range(0, 101, 10):
widget = Label(f"tint: green {tint_alpha}%;")
w... | 20 | 471 |
wagtail | wagtail/test/utils/wagtail_factories/blocks.py | .py | from collections import defaultdict
import factory
from factory.declarations import ParameteredAttribute
from wagtail import blocks
from wagtail.documents.blocks import DocumentChooserBlock
from wagtail.images.blocks import ImageChooserBlock
from .builder import (
ListBlockStepBuilder,
StreamBlockStepBuilder... | 243 | 7,372 |
openvino | src/bindings/python/src/openvino/opset13/ops.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Factory functions for ops added to openvino opset13."""
from functools import partial, singledispatch
from typing import Literal, Optional, Union
import logging
import numpy as np
log = logging.getLogger(__na... | 429 | 17,254 |
pymc | pymc/progress_bar/progress.py | .py | # Copyright 2025 - present The PyMC Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 646 | 21,968 |
openvino | tests/layer_tests/tensorflow_tests/test_tf_Eye.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
import tensorflow as tf
from common.tf_layer_test_class import CommonTFLayerTest
class TestTFEye(CommonTFLayerTest):
eye_output_type_param = np.float32
# Overload inputs generation to fill dumm... | 60 | 2,868 |
probability | spinoffs/inference_gym/inference_gym/tools/stan/stan_model.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... | 43 | 1,519 |
onnxruntime | onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/ValueInfo.py | .py | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: fbs
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class ValueInfo(object):
__slots__ = ['_tab']
@classmethod
def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbu... | 85 | 2,571 |
openvino | docs/scripts/tests/test_docs.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
""" Test for Doxygen based documentation generation.
Refer to conftest.py on the test usage.
"""
def test_documentation_page(errors):
""" Test documentation page has no errors generating
"""
if errors:
assert False,... | 15 | 411 |
coremltools | coremltools/converters/_profile_utils.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 time
_FUNCTION_PROFILE_REGISTRY = {} # str -> list (function name to time stack)
_... | 79 | 2,375 |
mlflow | tests/store/workspace/test_rest_store.py | .py | from __future__ import annotations
import json
from types import SimpleNamespace
from unittest import mock
import pytest
from mlflow.entities.workspace import Workspace, WorkspaceDeletionMode
from mlflow.exceptions import MlflowException, RestException
from mlflow.protos.service_pb2 import (
CreateWorkspace,
... | 209 | 7,419 |
saleor | saleor/graphql/order/mutations/order_grant_refund_utils.py | .py | import uuid
from collections import defaultdict
from typing import Any, TypedDict
import graphene
from django.core.exceptions import ValidationError
from graphql import GraphQLError
from ....order import models
from ....page.models import Page
from ...core.utils import from_global_id_or_error
class GrantRefundLineD... | 284 | 9,484 |
jupytext | demo/World population.pct.py | .py | # ---
# jupyter:
# jupytext:
# cell_markers: region,endregion
# formats: ipynb,.pct.py:percent,.lgt.py:light,.spx.py:sphinx,md,Rmd,.pandoc.md:pandoc
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.2'
# jupytext_version: 1.1.0
# kernelspec:
# ... | 112 | 2,891 |
probability | tensorflow_probability/python/math/psd_kernels/parabolic_test.py | .py | # Copyright 2020 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 125 | 4,530 |
probability | tensorflow_probability/python/distributions/kullback_leibler.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... | 279 | 10,051 |
httpie | tests/test_offline.py | .py | from .fixtures import FILE_CONTENT, FILE_PATH_ARG
from .utils import http
def test_offline():
r = http(
'--offline',
'https://this-should.never-resolve/foo',
)
assert 'GET /foo' in r
def test_offline_raw():
r = http(
'--offline',
'--raw',
'foo bar',
'h... | 97 | 1,979 |
onnxruntime | onnxruntime/test/python/transformers/test_gemmfastgelu_fusion.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 ... | 153 | 5,182 |
lemur | lemur/logs/models.py | .py | """
.. module: lemur.logs.models
:platform: unix
:synopsis: This module contains all of the models related private key audit log.
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
"""
from sq... | 34 | 1,031 |
conda | tests/__init__.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
# This is just here so that tests is a package, so that dotted relative
# imports work.
import sys
from conda.gateways.logging import initialize_logging
initialize_logging()
from conda.testing import conda_move_to_front_of_PATH
conda_move_t... | 37 | 1,100 |
owasp-mstg | src/contributors.py | .py | import json
import requests
url = 'https://api.github.com/repos/OWASP/mastg/stats/contributors'
headers = {'Accept' : 'application/vnd.github.v3+json'}
r = requests.get(url, headers=headers)
data = r.json()
coAuthor = "Author/Co-Authors: "
topContributors = "Top Contributors: "
contributors = "Contributors: "
miniC... | 53 | 1,710 |
saleor | saleor/tests/e2e/orders/discounts/test_order_products_on_catalog_promotion_and_voucher_entire.py | .py | from decimal import Decimal
import pytest
from .....product.tasks import recalculate_discounted_price_for_products_task
from ... import DEFAULT_ADDRESS
from ...product.utils import (
create_category,
create_product,
create_product_channel_listing,
create_product_type,
create_product_variant,
c... | 554 | 19,122 |
scikit-optimize | skopt/learning/gaussian_process/gpr.py | .py | import numpy as np
import warnings
from scipy.linalg import cho_solve
from scipy.linalg import solve_triangular
import sklearn
from sklearn.gaussian_process import GaussianProcessRegressor as sk_GaussianProcessRegressor
from sklearn.utils import check_array
from .kernels import ConstantKernel
from .kernels import Su... | 369 | 15,238 |
sphinx | tests/roots/test-remote-logo/conf.py | .py | latex_documents = [
(
'index',
'test.tex',
'The basic Sphinx documentation for testing',
'Sphinx',
'report',
)
]
html_logo = 'https://www.python.org/static/img/python-logo.png'
html_favicon = 'https://www.python.org/static/favicon.ico'
| 12 | 284 |
coremltools | coremltools/converters/mil/mil/ops/defs/iOS17/tensor_operation.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
from coremltools.converters.mil.mil import types
from coremltools.converters.mil.mil.input_type impor... | 192 | 7,907 |
scikit-bio | skbio/io/tests/test_util.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.
# --------------------------------------------... | 641 | 23,864 |
probability | tensorflow_probability/python/experimental/bijectors/__init__.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... | 34 | 1,692 |
lemur | lemur/plugins/lemur_acme/tests/test_powerdns.py | .py | import unittest
from unittest.mock import patch, Mock
from flask import Flask
from lemur.plugins.lemur_acme import plugin, powerdns
class TestPowerdns(unittest.TestCase):
@patch("lemur.plugins.lemur_acme.plugin.dns_provider_service")
def setUp(self, mock_dns_provider_service):
self.ACMEIssuerPlugin =... | 184 | 8,041 |
pdm | src/pdm/installers/base.py | .py | from __future__ import annotations
import dataclasses
import json
from collections.abc import Collection, Iterable
from functools import cached_property
from importlib.metadata import Distribution
from itertools import chain
from pdm import termui
from pdm.environments import BaseEnvironment
from pdm.exceptions impor... | 243 | 10,527 |
confluent-kafka-python | tests/integration/consumer/test_cooperative_rebalance_2.py | .py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2020 Confluent Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 86 | 2,575 |
textual | tests/css/test_stylesheet.py | .py | from contextlib import nullcontext as does_not_raise
import pytest
from textual.color import Color
from textual.css.stylesheet import CssSource, Stylesheet, StylesheetParseError
from textual.css.tokenizer import TokenError
from textual.dom import DOMNode
from textual.geometry import Spacing
from textual.widget import... | 296 | 10,099 |
textual | docs/examples/guide/styles/padding01.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Static
TEXT = """I must not fear.
Fear is the mind-killer.
Fear is the little-death that brings total obliteration.
I will face my fear.
I will permit it to pass over me and through me.
And when it has gone past, I will turn the inner eye to see i... | 28 | 750 |
pyro | examples/vae/ss_vae_M2.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import argparse
import torch
import torch.nn as nn
from utils.custom_mlp import MLP, Exp
from utils.mnist_cached import MNISTCached, mkdir_p, setup_data_loaders
from utils.vae_plots import mnist_test_tsne_ssvae, plot_conditional_s... | 542 | 20,433 |
coremltools | coremltools/converters/mil/mil/ops/defs/__init__.py | .py | # Copyright (c) 2020, 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 . import complex_dialect_ops, coreml_dialect, iOS15, iOS16, iOS17, iOS18
| 7 | 297 |
sqlmap | tests/test_gui_helpers.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
Parser-introspection helpers in lib/utils/gui.py. The GUI itself needs a live
display (Tk), so it is excluded from the smoke test and never imported there;
these module-level helpers,... | 119 | 4,386 |
onnx | onnx/backend/test/case/node/mod.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 Mod(Base):
@staticmethod
def export_mod_mixed_sign_float64() -... | 178 | 6,251 |
mlflow | mlflow/dspy/callback.py | .py | import logging
import threading
from collections import defaultdict
from functools import wraps
from typing import Any
import dspy
from dspy.utils.callback import BaseCallback
import mlflow
from mlflow.dspy.constant import FLAVOR_NAME
from mlflow.dspy.util import (
log_dspy_lm_state,
log_dspy_module_params,
... | 456 | 17,789 |
beam | sdks/python/apache_beam/examples/snippets/transforms/elementwise/map_simple.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");... | 60 | 1,684 |
tqdm | tqdm/_tqdm_notebook.py | .py | from warnings import warn
from .notebook import * # NOQA
from .notebook import __all__ # NOQA
from .std import TqdmDeprecationWarning
warn("This function will be removed in tqdm==5.0.0\n"
"Please use `tqdm.notebook.*` instead of `tqdm._tqdm_notebook.*`",
TqdmDeprecationWarning, stacklevel=2)
| 10 | 307 |
metrics | src/torchmetrics/image/qnr.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... | 228 | 9,626 |
kombu | t/unit/asynchronous/test_hub.py | .py | from __future__ import annotations
import errno
from unittest.mock import ANY, Mock, call, patch
import pytest
from vine import promise
from kombu.asynchronous import ERR, READ, WRITE, Hub
from kombu.asynchronous import hub as _hub
from kombu.asynchronous.debug import _rcb, callback_for, repr_flag
from kombu.asynchr... | 616 | 18,630 |
loguru | loguru/__init__.py | .py | """
The Loguru library provides a pre-instanced logger to facilitate dealing with logging in Python.
Just ``from loguru import logger``.
"""
import atexit as _atexit
import sys as _sys
from . import _defaults
from ._logger import Core as _Core
from ._logger import Logger as _Logger
__version__ = "0.7.3"
__all__ = ... | 35 | 627 |
gunicorn | examples/frameworks/django/testing/testing/urls.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from django.conf.urls import include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = [
# Examples:
# url(r'^$', 'testing.views.... | 24 | 683 |
pyomo | doc/OnlineDocs/src/data/import3.tab.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... | 19 | 730 |
wagtail | wagtail/admin/tests/tests.py | .py | import json
import unittest
from django.conf import settings
from django.contrib.auth.models import Group, Permission
from django.core import mail
from django.core.management import call_command
from django.test import TestCase, override_settings
from django.urls import reverse, reverse_lazy
from django.utils.translat... | 554 | 22,226 |
onnx | onnx/backend/test/case/node/erf.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import math
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Erf(Base):
@staticmethod
def export() -> None:
... | 27 | 620 |
pymc | pymc/stats/log_density.py | .py | # Copyright 2024 - present The PyMC Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 238 | 8,612 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_metagraph_variables.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import tensorflow as tf
# Create the graph and model
tf.compat.v1.reset_default_graph()
with tf.compat.v1.Session() as sess:
x_value = [[1.,2.,3.],[3.,2.,1.]]
z_value = [[2.,2.,1.],[1.,1.,2.]]
tf_x = tf... | 37 | 1,689 |
mlflow | tests/semantic_kernel/test_semantic_kernel_autolog.py | .py | import asyncio
from unittest import mock
import openai
import pytest
import pytest_asyncio
from semantic_kernel import Kernel
from semantic_kernel.agents import AgentResponseItem
from semantic_kernel.connectors.ai.open_ai import OpenAIChatCompletion
from semantic_kernel.contents import ChatMessageContent
from semantic... | 523 | 18,825 |
pdm | tests/cli/test_template.py | .py | import os
import pytest
from pdm.cli.templates import ProjectTemplate
from pdm.exceptions import PdmException
def test_non_pyproject_template_disallowed(project_no_init):
with (
ProjectTemplate("tests/fixtures/projects/demo_extras") as template,
pytest.raises(PdmException, match=r"Template pypro... | 67 | 2,879 |
saleor | saleor/payment/tests/test_gateway.py | .py | from decimal import Decimal
from unittest.mock import Mock, patch
import pytest
from ...order import OrderEvents
from ...plugins.manager import get_plugins_manager
from ...webhook.event_types import WebhookEventSyncType
from ...webhook.models import Webhook
from .. import (
ChargeStatus,
CustomPaymentChoices,... | 1,529 | 48,927 |
probability | tensorflow_probability/python/distributions/gamma_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... | 977 | 39,218 |
readthedocs.org | readthedocs/search/tests/test_signals.py | .py | import pytest
from django.core.management import call_command
from django.test import TestCase, override_settings
from django_dynamic_fixture import get
from elasticsearch.exceptions import NotFoundError
from readthedocs.projects.models import Project
from readthedocs.search.documents import ProjectDocument
@pytest.... | 53 | 1,750 |
scikit-bio | skbio/embedding/__init__.py | .py | r"""Biological Embeddings (:mod:`skbio.embedding`)
=================================================
.. currentmodule:: skbio.embedding
This module provides support for storing embeddings for biological objects, such
as protein embeddings outputted from protein language models (pLMs).
Embedding types
--------------... | 80 | 1,733 |
openvino | tests/layer_tests/pytorch_tests/test_full.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import platform
import numpy as np
import pytest
from pytorch_layer_test_class import PytorchLayerTest, skip_if_export
class TestFull(PytorchLayerTest):
def _prepare_input(self, value):
return (np.array(value, dtype=np.fl... | 645 | 27,716 |
openvino | tests/layer_tests/ovc_python_api_tests/test_tf_output_order.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
import tempfile
import tensorflow as tf
from common import constants
from pathlib import Path
def create_net_list(input_names, input_shapes):
tf.keras.backend.clear_session()
# Create TensorFlo... | 101 | 3,957 |
saleor | saleor/graphql/payment/mutations/stored_payment_methods/payment_method_process_tokenization.py | .py | import graphene
from django.core.exceptions import ValidationError
from .....payment.interface import PaymentMethodProcessTokenizationRequestData
from .....permission.auth_filters import AuthorizationFilters
from .....webhook.event_types import WebhookEventSyncType
from ....channel.utils import validate_channel
from .... | 84 | 3,242 |
httpie | httpie/output/utils.py | .py | import json
import re
from typing import Tuple
from ..utils import load_json_preserve_order_and_dupe_keys
from .lexers.json import PREFIX_REGEX
def load_prefixed_json(data: str) -> Tuple[str, json.JSONDecoder]:
"""Simple JSON loading from `data`.
"""
# First, the full data.
try:
return '', l... | 38 | 1,066 |
astropy | astropy/io/registry/compat.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import functools
from .core import UnifiedIORegistry
__all__ = [ # noqa: F822
"delay_doc_updates",
"get_formats",
"get_reader",
"get_writer",
"identify_format",
"read",
"register_identifier",
"register_reader",
"regi... | 71 | 1,896 |
coveragepy | tests/modules/pkg1/p1b.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
x = 1
y = 2
z = 3
| 7 | 176 |
lemur | lemur/roles/views.py | .py | """
.. module: lemur.roles.views
:platform: Unix
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
"""
from flask import Blueprint, g
from flask import make_response, jsonify
from flask_restful ... | 469 | 12,916 |
onnxruntime | onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/DeprecatedSessionState.py | .py | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: fbs
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
# deprecated: no longer using kernel def hashes
class DeprecatedSessionState(object):
__slots__ = ['_tab']
@classmethod
def GetRootAs(c... | 97 | 3,582 |
textual | docs/examples/widgets/progress_bar_styled_.py | .py | from textual.app import App, ComposeResult
from textual.clock import MockClock
from textual.containers import Center, Middle
from textual.timer import Timer
from textual.widgets import Footer, ProgressBar
class StyledProgressBar(App[None]):
BINDINGS = [("s", "start", "Start")]
CSS_PATH = "progress_bar_styled.... | 53 | 1,693 |
onnxruntime | orttraining/orttraining/python/training/ortmodule/ortmodule.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
# isort: skip_file
# Import ordering is important in this module to avoid... | 339 | 16,188 |
pyomo | pyomo/contrib/gdpopt/tests/test_gdpopt.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,813 | 74,140 |
metrics | tests/unittests/classification/test_sensitivity_specificity.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... | 497 | 22,800 |
onnxruntime | onnxruntime/python/torch_cpp_extensions/aten_op_executor/setup.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
import os
from setuptools import setup
from torch.utils import cpp_exte... | 17 | 588 |
probability | tensorflow_probability/python/distributions/mvn_tril.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... | 259 | 9,625 |
saleor | saleor/graphql/checkout/tests/test_checkout_price_expiration.py | .py | import datetime
from unittest import mock
from unittest.mock import patch
import graphene
from django.utils import timezone
from freezegun import freeze_time
from ....checkout.fetch import fetch_checkout_info, fetch_checkout_lines
from ....checkout.utils import invalidate_checkout
from ....plugins.manager import get_... | 374 | 10,824 |
probability | spinoffs/inference_gym/inference_gym/internal/datasets/sp500_closing_prices.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... | 2,560 | 43,356 |
textual | tests/notifications/test_all_levels_notifications.py | .py | from textual.app import App, ComposeResult
from textual.screen import Screen
from textual.widget import Widget
class NotifyWidget(Widget):
def on_mount(self) -> None:
self.notify("test", timeout=60)
class NotifyScreen(Screen):
def on_mount(self) -> None:
self.notify("test", timeout=60)
... | 29 | 743 |
probability | tensorflow_probability/python/experimental/sequential/iterated_filter_test.py | .py | # Copyright 2020 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the _License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | 182 | 8,589 |
beam | learning/tour-of-beam/learning-content/core-transforms/combine/combine-per-key/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... | 58 | 1,776 |
saleor | saleor/payment/lock_objects.py | .py | from typing import TYPE_CHECKING, Optional
from uuid import UUID
from django.db.models import QuerySet
from ..checkout.lock_objects import checkout_qs_select_for_update
from ..order.lock_objects import order_qs_select_for_update
from .models import TransactionItem
if TYPE_CHECKING:
from ..checkout.models import ... | 37 | 1,239 |
openvino | src/frontends/paddle/tests/test_models/gen_scripts/generate_split.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# split paddle model generator
#
import numpy as np
from save_model import saveModel
import sys
def split(name : str, x, attrs : dict):
import paddle
paddle.enable_static()
with paddle.static.program_guard(paddle.static.... | 127 | 4,563 |
pyomo | pyomo/contrib/gdpopt/tests/test_enumerate.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... | 193 | 7,470 |
saleor | saleor/app/installation_utils.py | .py | import logging
import time
from io import BytesIO
import requests
from celery.exceptions import MaxRetriesExceededError
from celery.utils.log import get_task_logger
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.core.files import File
from django.cor... | 340 | 12,477 |
astropy | astropy/io/fits/card.py | .py | # Licensed under a 3-clause BSD style license - see PYFITS.rst
import re
import warnings
import numpy as np
from astropy.utils.exceptions import AstropyUserWarning
from . import conf
from .util import _is_int, _str_to_num, _words_group, translate
from .verify import VerifyError, VerifyWarning, _ErrList, _Verify
__... | 1,333 | 50,087 |
onnxruntime | onnxruntime/test/providers/cpu/rnn/GRU.py | .py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import numpy as np
DebugOutput = False
np.set_printoptions(suppress=True) # , precision=16, floatmode='maxprec')
def print_with_shape(name, a, force_output=False):
if force_output or DebugOutput:
print(name + ... | 451 | 16,172 |
textual | src/textual/_parser.py | .py | from __future__ import annotations
from collections import deque
from typing import Callable, Deque, Generator, Generic, Iterable, NamedTuple, TypeVar
from textual._time import get_time
class ParseError(Exception):
"""Base class for parse related errors."""
class ParseEOF(ParseError):
"""End of Stream."""... | 127 | 3,307 |
mlflow | mlflow/entities/model_registry/registered_model.py | .py | from mlflow.entities.model_registry._model_registry_entity import _ModelRegistryEntity
from mlflow.entities.model_registry.model_version import ModelVersion
from mlflow.entities.model_registry.prompt_version import IS_PROMPT_TAG_KEY
from mlflow.entities.model_registry.registered_model_alias import RegisteredModelAlias
... | 186 | 6,892 |
saleor | saleor/graphql/product/mutations/product_variant/__init__.py | .py | from .product_variant_create import ProductVariantCreate
from .product_variant_delete import ProductVariantDelete
from .product_variant_preorder_deactivate import ProductVariantPreorderDeactivate
from .product_variant_reorder import ProductVariantReorder
from .product_variant_set_default import ProductVariantSetDefault... | 20 | 742 |
openvino | tests/layer_tests/tensorflow_tests/test_tf_MaxPoolWithArgmax.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import platform
import numpy as np
import pytest
import tensorflow as tf
from common.tf_layer_test_class import CommonTFLayerTest
class TestMaxPoolWithArgmax(CommonTFLayerTest):
def _prepare_input(self, inputs_info):
asser... | 76 | 3,427 |
probability | tensorflow_probability/python/distributions/lambertw_f.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... | 303 | 12,868 |
saleor | saleor/graphql/meta/tests/mutations/test_discount.py | .py | import graphene
from . import PRIVATE_KEY, PRIVATE_VALUE, PUBLIC_KEY, PUBLIC_VALUE
from .test_delete_metadata import (
execute_clear_public_metadata_for_item,
item_without_public_metadata,
)
from .test_delete_private_metadata import (
execute_clear_private_metadata_for_item,
item_without_private_metada... | 246 | 7,879 |
saleor | saleor/tests/e2e/shipping_zone/utils/shipping_zone.py | .py | from ...utils import get_graphql_content
SHIPPING_ZONE_CREATE_MUTATION = """
mutation createShipping($input: ShippingZoneCreateInput!) {
shippingZoneCreate(input: $input) {
errors {
field
code
message
}
shippingZone {
id
name
description
warehouses {
name... | 87 | 1,648 |
pyomo | pyomo/core/kernel/base.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... | 319 | 10,371 |
astropy | astropy/cosmology/_src/traits/neutrino.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
r"""Neutrino component trait.
This is private API. See `~astropy.cosmology.traits` for public API.
"""
__all__ = ["NeutrinoComponent"]
from abc import abstractmethod
from collections.abc import Callable
from functools import cached_property
from typing ... | 259 | 8,494 |
onnx | onnx/backend/test/case/node/adam.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
from onnx.defs import AI_ONNX_PREVIEW_TRAINING_DOMAIN
def apply_adam(
r,... | 136 | 4,417 |
coremltools | coremltools/converters/mil/mil/passes/defs/cleanup/loop_invariant_elimination.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
from coremltools.converters.mil.mil import Builder as mb
from coremltools.converters.mil.mil.passes.... | 167 | 6,794 |
onnx | onnx/backend/test/case/node/globalaveragepool.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 GlobalAveragePool(Base):
@staticmethod
def export() -> None:
... | 45 | 1,274 |
ipython | IPython/core/magics/execution.py | .py | """Implementation of execution-related magic functions."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import ast
import builtins as builtin_mod
import gc
import itertools
import os
import re
import shlex
import sys
import time
import timeit
from typing import... | 1,720 | 64,413 |
mlflow | mlflow/keras/__init__.py | .py | # MLflow Keras 3 flavor.
import keras
from packaging.version import Version
if Version(keras.__version__).major < 3:
from mlflow.tensorflow import (
# Redirect `mlflow.keras._load_pyfunc` to `mlflow.tensorflow._load_pyfunc`,
# For backwards compatibility on loading keras model saved by old mlflow v... | 49 | 1,232 |
django-cms | cms/extensions/toolbar.py | .py | from django.urls import NoReverseMatch
from cms.models import PageContent
from cms.toolbar_base import CMSToolbar
from cms.utils.page_permissions import user_can_change_page
from cms.utils.urlutils import admin_reverse
class ExtensionToolbar(CMSToolbar):
"""Offers simplified API for providing the user access to ... | 102 | 4,251 |
mlflow | fs2db/src/generate_synthetic_data.py | .py | # ruff: noqa: T201
"""
Generate synthetic MLflow FileStore data for testing the fs2db migration tool.
Usage:
uv run --with mlflow==3.6.0 --no-project python -I \
fs2db/src/generate_synthetic_data.py --output /tmp/fs2db/v3.6.0/ --size small
This script uses the MLflow public API to create realistic on-disk... | 435 | 14,337 |
wandb | tests/system_tests/test_notebooks/conftest.py | .py | import io
import os
import pathlib
import re
import shutil
import sys
from contextlib import contextmanager
from unittest.mock import MagicMock
import filelock
import IPython
import IPython.display
import nbformat
import pytest
import wandb
import wandb.util
from nbclient import NotebookClient
from nbclient.client imp... | 231 | 7,364 |
pyomo | pyomo/solvers/tests/piecewise_linear/problems/tester.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... | 55 | 2,097 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.