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 |
|---|---|---|---|---|---|
probability | tensorflow_probability/python/bijectors/shifted_gompertz_cdf.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... | 177 | 7,014 |
tqdm | tests/tests_main.py | .py | """Test CLI usage."""
import logging
import subprocess # nosec
import sys
from functools import wraps
from os import linesep
from tqdm.cli import TqdmKeyError, TqdmTypeError, main
from tqdm.utils import IS_WIN
from .tests_tqdm import BytesIO, closing, mark, raises
def restore_sys(func):
"""Decorates `func(caps... | 245 | 8,023 |
wandb | wandb/integration/kfp/__init__.py | .py | from __future__ import annotations
__all__ = ["wandb_log", "unpatch_kfp"]
from collections.abc import Callable
from typing import TYPE_CHECKING, Any
from .kfp_patch import patch_kfp, unpatch_kfp
if TYPE_CHECKING:
from typing import ParamSpec, TypeVar, overload
_P = ParamSpec("_P")
_T = TypeVar("_T")
... | 67 | 1,591 |
openvino | src/frontends/tensorflow_lite/tests/test_models/gen_scripts/generate_oob_builtin_opcode.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# SDL505 fuzzing finding: generate minimal .tflite models with out-of-bounds
# builtin operator codes to test that the frontend rejects them cleanly (CWE-125).
#
# oob_deprecated_builtin_code.tflite — deprecated_builtin_code=-1 (0xFF as ... | 146 | 6,153 |
probability | tensorflow_probability/python/distributions/beta_quotient.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... | 277 | 10,832 |
textual | docs/examples/widgets/clock.py | .py | from datetime import datetime
from textual.app import App, ComposeResult
from textual.widgets import Digits
class ClockApp(App):
CSS = """
Screen {
align: center middle;
}
#clock {
width: auto;
}
"""
def compose(self) -> ComposeResult:
yield Digits("", id="clock")... | 32 | 633 |
metrics | src/torchmetrics/nominal/cramers.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... | 156 | 6,272 |
pyomo | pyomo/contrib/multistart/reinit.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... | 83 | 2,897 |
wagtail | wagtail/test/utils/wagtail_tests.py | .py | import warnings
from contextlib import contextmanager
from bs4 import BeautifulSoup
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission
from django.test.testcases import assert_and_parse_html
class WagtailTestUtils:
@staticmethod
def get_soup(markup: str | bytes) ... | 265 | 9,554 |
openvino | src/bindings/python/src/openvino/frontend/jax/utils.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# flake8: noqa
# mypy: ignore-errors
import jax
from packaging import version
if version.parse(jax.__version__) < version.parse("0.6.0"):
import jax as jex
import jax.core
else:
import jax.extend as jex
import jax.numpy as... | 196 | 6,400 |
pynacl | src/nacl/bindings/randombytes.py | .py | # Copyright 2013 Donald Stufft and individual contributors
#
# 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... | 52 | 1,563 |
clearml | clearml/backend_interface/task/repo/scriptinfo.py | .py | import os
import sys
from copy import copy
from datetime import datetime, timezone
from functools import partial
from tempfile import gettempdir, mkdtemp
from types import TracebackType
from typing import Optional, Tuple, Union, Dict, List, Any
from urllib.parse import urlparse
import attr
import logging
import json
i... | 1,638 | 67,627 |
ipython | tests/test_pt_inputhooks.py | .py | import os
import importlib
import pytest
from IPython.terminal.pt_inputhooks import set_qt_api, get_inputhook_name_and_func
guis_avail = []
def _get_qt_vers():
"""If any version of Qt is available, this will populate `guis_avail` with 'qt' and 'qtx'. Due
to the import mechanism, we can't import multiple v... | 51 | 1,599 |
saleor | saleor/graphql/discount/mutations/voucher/voucher_delete.py | .py | import graphene
from saleor.discount import models
from .....permission.enums import DiscountPermissions
from .....webhook.event_types import WebhookEventAsyncType
from ....core import ResolveInfo
from ....core.context import ChannelContext
from ....core.mutations import ModelDeleteMutation
from ....core.types import... | 63 | 2,236 |
clearml | clearml/utilities/py3_interop.py | .py | """ Convenience classes supporting python3-like concepts """
from abc import ABC, abstractmethod
from types import TracebackType
from typing import Optional, Type
class AbstractContextManager(ABC):
"""An abstract base class for context managers. Supported in contextlib from python 3.6 and up"""
def __enter__... | 43 | 1,360 |
pyro | pyro/contrib/gp/models/gplvm.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import pyro.distributions as dist
from pyro.contrib.gp.parameterized import Parameterized
from pyro.nn.module import PyroSample, pyro_method
class GPLVM(Parameterized):
"""
Gaussian Process Latent Variable Model (GPLVM) m... | 96 | 3,897 |
saleor | saleor/graphql/order/tests/mutations/test_fulfillment_return_products_reason.py | .py | from unittest.mock import patch
import graphene
from .....order.error_codes import OrderErrorCode
from .....order.models import FulfillmentStatus
from .....page.models import Page, PageType
from .....payment import ChargeStatus
from ....core.utils import to_global_id_or_none
from ....tests.utils import get_graphql_co... | 728 | 25,138 |
probability | tensorflow_probability/substrates/numpy/__init__.py | .py | # Copyright 2019 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 43 | 2,043 |
openvino | tools/ovc/openvino/tools/ovc/version.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import re
from openvino import get_version as get_ie_version # pylint: disable=no-name-in-module,import-error
def extract_release_version(version: str):
patterns = [
# captures release version set by CI for example: '2021... | 81 | 2,554 |
openvino | tests/layer_tests/tensorflow_tests/test_tf_TopK.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
from common.tf_layer_test_class import CommonTFLayerTest
class Test_TopK(CommonTFLayerTest):
@staticmethod
def create_topK_net(shape, k, ir_version):
pytest.xfail(reason="95063")
import tensorflow... | 83 | 2,849 |
mlflow | tests/transformers/version.py | .py | import transformers
from packaging.version import Version
transformers_version = Version(transformers.__version__)
IS_NEW_FEATURE_EXTRACTION_API = transformers_version >= Version("4.27.0")
IS_TRANSFORMERS_V5_OR_LATER = transformers_version.major >= 5
| 7 | 252 |
luigi | examples/kubernetes.py | .py | # -*- coding: utf-8 -*-
#
# Copyright 2015 Outlier Bio, LLC
#
# 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 la... | 59 | 1,924 |
mlflow | examples/sklearn_autolog/pipeline.py | .py | from pprint import pprint
import numpy as np
from sklearn.linear_model import LinearRegression
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from utils import fetch_logged_data
import mlflow
def main():
# enable autologging
mlflow.sklearn.autolog()
# prepare tra... | 34 | 841 |
mamba | micromamba/tests/test_pkg_cache.py | .py | import os
import platform
import shutil
import subprocess
import glob
from pathlib import Path
from typing import Optional
import pytest
from . import helpers
package_to_check = "xtensor"
package_version_to_check = "0.27.0"
file_to_find_in_package = "xtensor.hpp"
def package_to_check_requirements():
return f"{... | 650 | 26,047 |
onnx | onnx/backend/test/case/node/asin.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 Asin(Base):
@staticmethod
def export() -> None:
node =... | 29 | 726 |
confluent-kafka-python | src/confluent_kafka/schema_registry/_sync/mock_schema_registry_client.py | .py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2024 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... | 462 | 18,044 |
ipython | IPython/terminal/pt_inputhooks/gtk.py | .py | # Code borrowed from python-prompt-toolkit examples
# https://github.com/jonathanslenders/python-prompt-toolkit/blob/77cdcfbc7f4b4c34a9d2f9a34d422d7152f16209/examples/inputhook.py
# Copyright (c) 2014, Jonathan Slenders
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modif... | 61 | 2,427 |
probability | tensorflow_probability/python/sts/components/dynamic_regression.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... | 335 | 14,098 |
coremltools | coremltools/converters/mil/frontend/torch/torchir_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, defaultdict
from typing import Dict, Optional
from coremltools ... | 422 | 16,562 |
mlflow | tests/genai/datasets/test_fluent.py | .py | import json
import os
import sys
import warnings
from types import SimpleNamespace
from unittest import mock
import pandas as pd
import pytest
import mlflow
from mlflow.data import Dataset
from mlflow.data.pyfunc_dataset_mixin import PyFuncConvertibleDatasetMixin
from mlflow.entities.dataset_record_source import Data... | 2,369 | 79,667 |
gunicorn | tests/requests/invalid/015.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.http.errors import InvalidHeader
request = InvalidHeader
| 8 | 178 |
tomli | src/tomli/_re.py | .py | # SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2021 Taneli Hukkinen
# Licensed to PSF under a Contributor Agreement.
from __future__ import annotations
from datetime import date, datetime, time, timedelta, timezone, tzinfo
from functools import lru_cache
import re
TYPE_CHECKING = False
if TYPE_CHECKING:
... | 120 | 3,396 |
mlflow | tests/gateway/providers/test_vertex_ai.py | .py | import json
from unittest import mock
import pytest
from aiohttp import ClientTimeout
from fastapi.encoders import jsonable_encoder
from pydantic import ValidationError
from mlflow.environment_variables import MLFLOW_GATEWAY_ROUTE_TIMEOUT_SECONDS
from mlflow.gateway.config import EndpointConfig, VertexAIConfig
from m... | 673 | 23,990 |
pyro | pyro/infer/discrete.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import functools
import warnings
from collections import OrderedDict
from opt_einsum import shared_intermediates
import pyro.ops.packed as packed
from pyro import poutine
from pyro.infer.traceenum_elbo import TraceEnum_ELBO
from ... | 284 | 11,547 |
onnxruntime | onnxruntime/python/tools/qnn/preprocess.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""Provide... | 166 | 7,275 |
probability | tensorflow_probability/python/optimizer/differential_evolution.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... | 779 | 34,953 |
onnxruntime | onnxruntime/test/testdata/nnapi_sigmoid_input_rank_test.py | .py | import onnx
from onnx import TensorProto, helper
# Since NNAPI ANEURALNETWORKS_LOGISTIC only supports input tensor rank up to 4, we added limits in
# Sigmoid op support checker in NNAPI EP, so we don't fail hard. Added test case here.
def GenerateModel(model_name): # noqa: N802
node = [
helper.make_node... | 26 | 796 |
coremltools | coremltools/test/optimize/torch/test_api_surface.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 typing import List
import coremltools.optimize.torch
def _get_visible_items(d):
return [x... | 163 | 5,833 |
wagtail | wagtail/admin/api/actions/copy_for_translation.py | .py | from django.core.exceptions import ValidationError as DjangoValidationError
from django.shortcuts import get_object_or_404
from rest_framework import fields, status
from rest_framework.exceptions import ValidationError
from rest_framework.response import Response
from rest_framework.serializers import Serializer
from ... | 52 | 1,845 |
mlflow | examples/statsmodels/train.py | .py | import argparse
import numpy as np
import statsmodels.api as sm
from sklearn.metrics import mean_squared_error
import mlflow
import mlflow.statsmodels
def parse_args():
parser = argparse.ArgumentParser(description="Statsmodels example")
parser.add_argument(
"--inverse-method",
type=str,
... | 56 | 1,332 |
pyomo | pyomo/core/base/constraint.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,033 | 36,269 |
mlflow | tests/tracking/fluent/test_fluent_autolog.py | .py | import contextlib
import inspect
import sys
from io import StringIO
from typing import Any, NamedTuple
from unittest import mock
import anthropic
import autogen
import boto3
import dspy
import google.genai
import groq
import keras
import langchain
import lightgbm
import lightning
import litellm
import llama_index.core... | 517 | 18,825 |
mlflow | dev/clint/tests/rules/test_unknown_mlflow_arguments.py | .py | from pathlib import Path
import pytest
from clint.config import Config
from clint.index import SymbolIndex
from clint.linter import Position, Range, lint_file
from clint.rules.unknown_mlflow_arguments import UnknownMlflowArguments
def test_unknown_mlflow_arguments(index: SymbolIndex) -> None:
code = '''
def bad(... | 68 | 1,586 |
mlflow | tests/webhooks/test_delivery.py | .py | import json
from pathlib import Path
from unittest.mock import Mock, patch
import pytest
from mlflow.entities.webhook import Webhook, WebhookAction, WebhookEntity, WebhookEvent
from mlflow.environment_variables import MLFLOW_ENABLE_WORKSPACES
from mlflow.store.model_registry.file_store import FileStore
from mlflow.st... | 178 | 6,013 |
django-cms | cms/cms_toolbars.py | .py | from django.conf import settings
from django.contrib import admin
from django.contrib.auth import get_permission_codename, get_user_model
from django.contrib.auth.models import AnonymousUser
from django.contrib.sites.models import Site
from django.urls import NoReverseMatch, Resolver404, resolve, reverse
from django.ut... | 735 | 30,101 |
django-cms | cms/test_utils/project/pluginapp/plugins/meta/cms_plugins.py | .py | from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from .models import (
TestPluginModel,
TestPluginModel2,
TestPluginModel3,
TestPluginModel4,
TestPluginModel5,
)
class TestPlugin(CMSPluginBase):
model = TestPluginModel
render_template = 'cms/content.html'
... | 51 | 958 |
saleor | saleor/graphql/order/tests/mutations/test_order_grant_refund_create_reason.py | .py | from decimal import Decimal
import graphene
from .....page.models import Page, PageType
from ....core.utils import to_global_id_or_none
from ....tests.utils import (
get_graphql_content,
)
from ...enums import (
OrderGrantRefundCreateErrorCode,
)
ORDER_GRANT_REFUND_CREATE = """
mutation OrderGrantRefundCreat... | 582 | 16,203 |
sqlmap | plugins/dbms/sqlite/connector.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
try:
import sqlite3
except:
pass
import logging
from lib.core.common import getSafeExString
from lib.core.convert import getText
from lib.core.data import conf
from lib.... | 89 | 3,082 |
astropy | astropy/modeling/tests/test_fitters.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Module to test fitting routines
"""
# pylint: disable=invalid-name
import os.path
import unittest.mock as mk
from contextlib import nullcontext
from importlib.metadata import EntryPoint
from itertools import combinations
from unittest import mock
imp... | 1,565 | 56,183 |
mlflow | mlflow/genai/discovery/constants.py | .py | from __future__ import annotations
from mlflow.entities.issue import IssueSeverity
# Number of sessions (or individual traces) to sample for triage by default
DEFAULT_TRIAGE_SAMPLE_SIZE = 100
# Fetch N * sample_size traces so random sampling has enough diversity
SAMPLE_POOL_MULTIPLIER = 5
SAMPLE_RANDOM_SEED = 42
# LL... | 407 | 19,881 |
onnxruntime | tools/python/util/ort_format_model/types.py | .py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import ort_flatbuffers_py.fbs as fbs
class FbsTypeInfo:
"Class to provide conversion between ORT flatbuffers schema values and C++ types"
tensordatatype_to_string = { # noqa: RUF012
fbs.TensorDataType.Tens... | 86 | 4,383 |
astropy | astropy/units/tests/test_quantity_annotations.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
from astropy import units as u
from astropy.units import Quantity
def test_ignore_generic_type_annotations():
"""Test annotations that are not unit related are ignored.
This test passes if the function works.
"""
# one u... | 354 | 9,880 |
astropy | astropy/io/votable/table.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This file contains a contains the high-level functions to read a
VOTable file.
"""
# STDLIB
import io
import os
import sys
import textwrap
import warnings
from astropy.utils import data
from astropy.utils.xml import iterparser
# LOCAL
from . import... | 430 | 13,564 |
wandb | tests/unit_tests/test_automations/test_events.py | .py | """Tests on behavior of Automation events."""
from __future__ import annotations
from hypothesis import given
from pytest import mark
from wandb.apis.public import Project
from wandb.automations import (
ArtifactEvent,
EventType,
MetricChangeFilter,
MetricThresholdFilter,
MetricZScoreFilter,
O... | 292 | 12,176 |
wandb | tests/unit_tests/test_media/test_media_logging.py | .py | import os
import platform
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pytest
import wandb
from bokeh.plotting import figure
from rdkit import Chem
from wandb import data_types
data = np.random.randint(255, size=(1000))
@pytest.fixture
def audio_media() -> wandb.Audio:
audi... | 157 | 4,002 |
sphinx | tests/test_util/test_util_logging.py | .py | """Test logging util."""
from __future__ import annotations
import os
from contextlib import contextmanager
from pathlib import Path
from typing import TYPE_CHECKING
import pytest
from docutils import nodes
from sphinx._cli.util.errors import strip_escape_sequences
from sphinx.cmd.build import build_main
from sphin... | 426 | 15,170 |
bazel | combine_distfiles.py | .py | # pylint: disable=g-bad-file-header
# pylint: disable=g-direct-third-party-import
#
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# 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
#
... | 51 | 1,683 |
clearml | clearml/automation/monitor.py | .py | from datetime import datetime
from time import time, sleep
from typing import Optional, Sequence
from ..backend_api.session.client import APIClient
from ..backend_interface.util import exact_match_regex
from ..task import Task
class Monitor:
"""
Base class for monitoring Tasks on the system.
Inherit to i... | 188 | 6,319 |
sphinx | sphinx/builders/xml.py | .py | """Docutils-native XML and pseudo-XML builders."""
from __future__ import annotations
from typing import TYPE_CHECKING
from docutils import nodes
from docutils.writers.docutils_xml import XMLTranslator
from sphinx.builders import Builder
from sphinx.locale import __
from sphinx.util import logging
from sphinx.util.... | 122 | 4,034 |
wandb | wandb/sdk/artifacts/_generated/artifact_used_by.py | .py | # Generated by ariadne-codegen
# Source: tools/graphql_codegen/artifacts/
from __future__ import annotations
from pydantic import Field
from wandb._pydantic import GQLResult
from .fragments import RunInfoFragment
class ArtifactUsedBy(GQLResult):
artifact: ArtifactUsedByArtifact | None
class ArtifactUsedByAr... | 33 | 752 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_resource_gather_model.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import numpy as np
import tensorflow as tf
def main():
# this test model imitates a sub-graph of one model with ResourceGather from our model scope
tf.compat.v1.reset_default_graph()
with tf.compat.v1... | 54 | 2,349 |
saleor | saleor/graphql/order/tests/queries/test_draft_order_with_filter.py | .py | import datetime
from decimal import Decimal
import graphene
import pytest
from django.core.exceptions import ValidationError
from freezegun import freeze_time
from .....core.postgres import FlatConcatSearchVector
from .....discount.models import OrderDiscount
from .....order import OrderStatus
from .....order.models ... | 516 | 13,404 |
conda | conda/notices/__init__.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from .core import notices # noqa: F401
| 4 | 115 |
lemur | lemur/tests/conftest.py | .py | import datetime
import os
import pytest
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from flask import current_app
from flask_principal import identity_changed, Identity
from sqlalchemy.sql import text
from lemur import create... | 366 | 8,548 |
mlflow | examples/gateway/mosaicml/example.py | .py | from mlflow.deployments import get_deploy_client
def main():
client = get_deploy_client("http://localhost:7000")
print(f"MosaicML endpoints: {client.list_endpoints()}\n")
print(f"MosaicML completions endpoint info: {client.get_endpoint(endpoint='completions')}\n")
# Completions request
response_... | 49 | 1,538 |
pdm | src/pdm/installers/installers.py | .py | from __future__ import annotations
import json
import os
import stat
from collections.abc import Iterator
from functools import cached_property
from pathlib import Path
from typing import TYPE_CHECKING
from installer import install as _install
from installer._core import _process_WHEEL_file
from installer.destination... | 243 | 9,057 |
sphinx | utils/generate_snowball.py | .py | #!/usr/bin/env python3
"""Refresh and update language stemming data from the Snowball project."""
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "requests>=2.30",
# ]
# ///
from __future__ import annotations
import hashlib
import shutil
import subprocess
import sys
import tarfile
import tempfile... | 139 | 5,021 |
python-prompt-toolkit | examples/print-text/print-formatted-text.py | .py | #!/usr/bin/env python
"""
Example of printing colored text to the output.
"""
from prompt_toolkit import print_formatted_text
from prompt_toolkit.formatted_text import ANSI, HTML, FormattedText
from prompt_toolkit.styles import Style
print = print_formatted_text
def main():
style = Style.from_dict(
{
... | 48 | 1,098 |
biopython | Tests/test_SeqIO_TwoBitIO.py | .py | """Tests for SeqIO TwoBitIO module."""
import unittest
from Bio import SeqIO
from Bio.Seq import MutableSeq
from Bio.Seq import Seq
from Bio.Seq import UndefinedSequenceError
from Bio.SeqRecord import SeqRecord
class Parsing(unittest.TestCase):
"""Test parsing 2bit files."""
def setUp(self):
path =... | 527 | 22,096 |
wagtail | wagtail/images/tests/test_jinja2.py | .py | import unittest.mock
from django.apps import apps
from django.template import TemplateSyntaxError, engines
from django.test import TestCase
from wagtail.models import Site
from .utils import (
Image,
get_test_bad_image,
get_test_image_file,
get_test_image_filename,
)
class JinjaImagesTestCase(TestC... | 463 | 16,779 |
astropy | astropy/nddata/ccddata.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""This module implements the base CCDData class."""
import itertools
import numpy as np
from astropy import log
from astropy import units as u
from astropy.io import fits, registry
from astropy.utils.decorators import sharedmethod
from astropy.wcs impo... | 867 | 32,936 |
openvino | tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_masking.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
import tensorflow as tf
from common.tf2_layer_test_class import CommonTF2LayerTest
class TestKerasMasking(CommonTF2LayerTest):
def create_keras_masking_net(self, input_names, input_shapes, input_type, mask_value,
... | 43 | 1,853 |
openvino | tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_permute.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
import tensorflow as tf
from common.tf2_layer_test_class import CommonTF2LayerTest
class TestKerasPermute(CommonTF2LayerTest):
def create_keras_permute_net(self, input_names, input_shapes, input_type, dims, ir_versio... | 37 | 1,557 |
black | tests/data/cases/no_blank_line_before_docstring.py | .py | def line_before_docstring():
"""Please move me up"""
class LineBeforeDocstring:
"""Please move me up"""
class EvenIfThereIsAMethodAfter:
"""I'm the docstring"""
def method(self):
pass
class TwoLinesBeforeDocstring:
"""I want to be treated the same as if I were closer"""
class Mu... | 66 | 987 |
onnxruntime | tools/ci_build/op_registration_utils.py | .py | # !/usr/bin/env python3
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""
Utilities to help process files containing kernel registrations.
"""
from __future__ import annotations
import os
import pathlib
import sys
from logger import get_logger
log = get_logger("op_reg... | 268 | 11,017 |
pyro | examples/vae/vae.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import argparse
import numpy as np
import torch
import torch.nn as nn
from utils.mnist_cached import MNISTCached as MNIST
from utils.mnist_cached import setup_data_loaders
from utils.vae_plots import mnist_test_tsne, plot_llk, plo... | 258 | 9,210 |
saleor | saleor/tests/e2e/orders/utils/order_by_checkout_id_query.py | .py | from saleor.graphql.tests.utils import get_graphql_content
ORDER_BY_CHECKOUT_ID_QUERY = """
query OrderByCheckoutIdDetails($checkout_id: ID!) {
orders(first:1, filter: {checkoutIds: [$checkout_id]}) {
totalCount
edges {
node {
chargeStatus
authorizeStatus
paymentStatus
i... | 79 | 1,493 |
textual | tests/snapshot_tests/snapshot_apps/footer_toggle_compact.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Footer, Label
class ToggleCompactFooterApp(App):
CSS = """
Screen {
align: center middle;
}
"""
BINDINGS = [
("ctrl+t", "toggle_compact_footer", "Toggle Compact Footer"),
]
def compose(self) -> Compose... | 34 | 835 |
openvino | src/bindings/python/tests/test_runtime/test_nogil.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import time
import pytest
import os
import io
import threading
import numpy as np
import openvino.properties as props
from openvino import Core, Model, AsyncInferQueue, PartialShape, Layout, serialize
from openvi... | 255 | 6,881 |
mlflow | mlflow/store/tracking/dbmodels/initial_models.py | .py | # Snapshot of MLflow DB models as of the 0.9.1 release, prior to the first database migration.
# Used to standardize initial database state.
# Copied with modifications from
# https://github.com/mlflow/mlflow/blob/v0.9.1/mlflow/store/dbmodels/models.py, which
# is the first database schema that users could be running. ... | 244 | 8,248 |
beam | sdks/python/apache_beam/testing/load_tests/sideinput_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... | 215 | 7,732 |
wagtail | wagtail/admin/tests/test_messages.py | .py | from django.test import TestCase
from django.urls import reverse
class TestPageExplorer(TestCase):
def test_message_tag_classes(self):
url = reverse("testapp_message_test")
response = self.client.post(
url, {"level": "success", "message": "A message"}, follow=True
)
# ... | 28 | 1,074 |
wagtail | wagtail/admin/tests/test_forms.py | .py | from django.forms.fields import CharField
from django.test import SimpleTestCase, TestCase
from wagtail.admin.forms.auth import LoginForm, PasswordResetForm
from wagtail.admin.forms.models import WagtailAdminModelForm
from wagtail.test.snippets.models import MultiSectionRichTextSnippet
from wagtail.test.testapp.models... | 377 | 12,895 |
clearml | examples/reporting/matplotlib_manual_reporting.py | .py | # ClearML - Example of Matplotlib and Seaborn integration and reporting
#
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from clearml import Task
# Connecting ClearML with the current process,
# from here on everything is logged automatically
# Create a new task, disable automatic matplotlib ... | 75 | 1,903 |
textual | docs/examples/guide/layout/vertical_layout.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Static
class VerticalLayoutExample(App):
CSS_PATH = "vertical_layout.tcss"
def compose(self) -> ComposeResult:
yield Static("One", classes="box")
yield Static("Two", classes="box")
yield Static("Three", classes="bo... | 17 | 401 |
confluent-kafka-python | tests/integration/share_consumer_sasl/__init__.py | .py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2026 Confluent Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 17 | 622 |
pyomo | pyomo/gdp/plugins/gdp_var_mover.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... | 164 | 7,643 |
beam | sdks/python/apache_beam/runners/portability/artifact_service.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 ... | 352 | 11,955 |
astropy | astropy/nddata/covariance.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Implements a class used to store and manipulate covariance matrices.
"""
import warnings
import numpy as np
from astropy import table
from astropy.units import Quantity
from astropy.utils.compat.optional_deps import HAS_SCIPY
from astropy.utils.exce... | 1,064 | 38,197 |
luigi | test/worker_multiprocess_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... | 114 | 3,589 |
probability | tensorflow_probability/python/experimental/bayesopt/acquisition/acquisition_function.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... | 191 | 6,719 |
sphinx | tests/roots/test-ext-imgmockconverter/mocksvgconverter.py | .py | """Does foo.svg --> foo.pdf with no change to the file."""
from __future__ import annotations
import shutil
from typing import TYPE_CHECKING
from sphinx.transforms.post_transforms.images import ImageConverter
if TYPE_CHECKING:
import os
from sphinx.application import Sphinx
from sphinx.util.typing impo... | 41 | 939 |
sqlmap | tests/test_payload_marking.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
Request-body injection-point handling:
- recognition regexes (REAL, imported from settings) classify JSON/JSON_LIKE/XML/PLAIN
- JSON/XML injection-point marking preserves every valu... | 277 | 11,215 |
onnxruntime | onnxruntime/test/testdata/ep_dynamic_graph_input_test.py | .py | import onnx
from onnx import TensorProto, helper
# Since NNAPI EP does not support dynamic shape input and we now switch from the approach of immediately rejecting
# the whole graph in NNAPI EP if it has a dynamic input to checking the dynamic shape at individual operator support check level,
# We have a separated te... | 47 | 1,648 |
mlflow | tests/sagemaker/test_batch_deployment.py | .py | import os
import time
from functools import wraps
from typing import NamedTuple
from unittest import mock
import boto3
import botocore
import numpy as np
import pytest
from click.testing import CliRunner
from moto.core import DEFAULT_ACCOUNT_ID
from sklearn.linear_model import LogisticRegression
import mlflow
import ... | 527 | 19,533 |
probability | tensorflow_probability/python/distributions/gumbel.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... | 237 | 8,912 |
metrics | src/torchmetrics/shape/procrustes.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... | 139 | 5,734 |
astropy | astropy/io/fits/tests/test_fitsinfo.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
from astropy import __version__ as version
from astropy.io import fits
from astropy.io.fits.scripts import fitsinfo
from .conftest import FitsTestCase
class TestFitsinfo(FitsTestCase):
def test_help(self):
with pytest.raises(... | 64 | 2,247 |
pyro | tests/distributions/test_transforms.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import operator
from functools import partial, reduce
from unittest import TestCase
import pytest
import torch
import pyro.distributions as dist
import pyro.distributions.transforms as T
from pyro.distributions import constraints... | 582 | 22,417 |
clearml | clearml/utilities/enum.py | .py | from typing import Dict, List, Any
class EnumOptions:
"""Base class for enum-like classes using class-attributes with string values to represent enum key/value pairs"""
__cache = None
@classmethod
def values(cls) -> List[str]:
"""Extract list of enum-like options based on the derived classes... | 31 | 1,077 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.