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 |
|---|---|---|---|---|---|
returns | returns/pointfree/map.py | .py | from collections.abc import Callable
from typing import TypeVar
from returns.interfaces.mappable import MappableN
from returns.primitives.hkt import Kinded, KindN, kinded
_FirstType = TypeVar('_FirstType')
_SecondType = TypeVar('_SecondType')
_ThirdType = TypeVar('_ThirdType')
_UpdatedType = TypeVar('_UpdatedType')
... | 58 | 1,564 |
sqlmap | plugins/dbms/sybase/filesystem.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.filesystem import Filesystem as GenericFilesystem
class Filesystem(GenericFilesystem):
d... | 19 | 670 |
beam | sdks/python/apache_beam/io/gcp/experimental/spannerio_write_it_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... | 281 | 9,733 |
mlflow | mlflow/transformers/peft.py | .py | """
PEFT (Parameter-Efficient Fine-Tuning) is a library for efficiently adapting large pretrained
models without fine-tuning all of model parameters but only a small number of (extra) parameters.
Users can define a PEFT model that wraps a Transformer model to apply a thin adapter layer on
top of the base model. The PEF... | 52 | 2,190 |
django-cms | cms/forms/fields.py | .py | from django import forms
from django.contrib.admin.widgets import RelatedFieldWidgetWrapper
from django.core.validators import EMPTY_VALUES
from django.forms import ChoiceField
from django.utils.translation import gettext_lazy as _
from cms.forms.utils import get_page_choices, get_site_choices
from cms.forms.validator... | 117 | 5,008 |
pyro | pyro/contrib/forecast/evaluate.py | .py | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import logging
import warnings
from timeit import default_timer
import torch
import pyro
from pyro.ops.stats import crps_empirical
from .forecaster import Forecaster
logger = logging.getLogger(__name__)
@torch.no_grad()
def eval_... | 251 | 8,823 |
django-cms | cms/utils/encoder.py | .py | from django.core.serializers.json import DjangoJSONEncoder
from django.utils.encoding import force_str
from django.utils.functional import Promise
from django.utils.html import conditional_escape
class SafeJSONEncoder(DjangoJSONEncoder):
def _recursive_escape(self, o, esc=conditional_escape):
if isinstanc... | 28 | 939 |
sqlmap | plugins/dbms/mysql/syntax.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
import binascii
from lib.core.convert import getBytes
from lib.core.convert import getOrds
from lib.core.convert import getUnicode
from plugins.generic.syntax import Syntax as Ge... | 32 | 1,043 |
metrics | src/torchmetrics/functional/regression/__init__.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... | 62 | 3,045 |
luigi | luigi/contrib/s3.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... | 737 | 27,307 |
pynacl | src/nacl/signing.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... | 252 | 8,352 |
pyomo | pyomo/contrib/solver/solvers/knitro/package.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... | 109 | 3,602 |
luigi | luigi/configuration/core.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... | 87 | 2,641 |
beam | sdks/python/apache_beam/coders/slow_stream.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... | 199 | 5,268 |
saleor | saleor/graphql/account/schema.py | .py | import graphene
from ...core.search import prefix_search
from ...permission.auth_filters import AuthorizationFilters
from ...permission.enums import (
AccountPermissions,
CustomerTypePermissions,
OrderPermissions,
)
from ...permission.utils import message_one_of_permissions_required
from ..app.dataloaders ... | 421 | 14,556 |
saleor | saleor/webhook/tests/subscription_webhooks/test_create_deliveries_for_subscriptions_payments.py | .py | import json
import graphene
from ...event_types import WebhookEventSyncType
from ...transport.asynchronous import create_deliveries_for_subscriptions
from .payloads import generate_payment_payload
def test_payment_authorize(payment, subscription_payment_authorize_webhook):
# given
webhooks = [subscription_p... | 128 | 4,340 |
pyro | tests/distributions/test_von_mises.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import math
import os
import pytest
import torch
from torch import optim
from pyro.distributions import VonMises, VonMises3D
from pyro.distributions.testing.gof import auto_goodness_of_fit
from tests.common import TEST_FAILURE_RA... | 199 | 5,467 |
cvxpy | cvxpy/tests/test_canon_methods.py | .py | """
Copyright, the CVXPY authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
... | 65 | 2,830 |
coremltools | coremltools/test/ml_program/test_utils.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
import copy
import itertools
import os
import platform
import shutil
import tempfile
from sys import ver... | 1,904 | 74,405 |
confluent-kafka-python | examples/oauth_schema_registry.py | .py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2025 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... | 129 | 5,075 |
coremltools | coremltools/test/optimize/api/__init__.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
| 5 | 218 |
kafka | tests/kafkatest/services/kafka/kafka.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 ... | 2,122 | 111,973 |
pyomo | pyomo/repn/tests/lp_diff.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... | 81 | 2,371 |
saleor | saleor/tests/e2e/checkout/discounts/vouchers/test_checkout_voucher_is_still_active_when_checkout_fails.py | .py | import pytest
from ....product.utils import product_variant_stock_update
from ....product.utils.preparing_product import prepare_product
from ....shop.utils import prepare_default_shop
from ....utils import assign_permissions
from ....vouchers.utils import (
create_voucher,
create_voucher_channel_listing,
... | 170 | 5,037 |
saleor | saleor/graphql/order/mutations/order_grant_refund_create.py | .py | import decimal
from typing import Any
import graphene
from django.core.exceptions import ValidationError
from django.db import transaction
from ....order import models
from ....order.utils import update_order_charge_data
from ....page.models import Page
from ....permission.enums import OrderPermissions
from ...core i... | 326 | 12,243 |
pyomo | pyomo/contrib/mpc/modeling/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... | 326 | 12,956 |
pyomo | pyomo/contrib/gdpopt/tests/test_ldsda.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... | 303 | 12,190 |
astropy | astropy/units/format/latex.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Handles the "LaTeX" unit format.
"""
import re
from typing import ClassVar, Literal
from astropy.units.core import NamedUnit, UnitBase
from astropy.units.enums import DeprecatedUnitAction
from astropy.units.typing import UnitPower
from . import con... | 93 | 3,006 |
sphinx | sphinx/ext/intersphinx/_cli.py | .py | """This module provides contains the code for intersphinx command-line utilities."""
from __future__ import annotations
import sys
from pathlib import Path
from sphinx.ext.intersphinx._load import (
_fetch_inventory_data,
_InvConfig,
_load_inventory,
)
def inspect_main(argv: list[str], /) -> int:
"... | 58 | 1,647 |
textual | tests/snapshot_tests/snapshot_apps/recompose_on_mount.py | .py | from __future__ import annotations
from textual.app import App, ComposeResult
from textual.screen import Screen
from textual.widgets import Header, Footer, Static, RadioSet
from textual.reactive import reactive
class Profile(Static):
choices: reactive[list[str]] = reactive(list, recompose=True)
def compose(... | 46 | 1,166 |
textual | src/textual/__init__.py | .py | """
The root Textual module.
Exposes some commonly used symbols.
"""
from __future__ import annotations
import inspect
import weakref
from typing import TYPE_CHECKING, Callable
import rich.repr
from textual import constants
from textual._context import active_app
from textual._log import LogGroup, LogVerbosity
fr... | 208 | 5,694 |
probability | tensorflow_probability/python/bijectors/softsign_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... | 97 | 3,775 |
beam | sdks/python/apache_beam/examples/complete/game/user_score_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... | 56 | 1,995 |
clearml | clearml/utilities/locks/portalocker.py | .py | import os
from typing import Any
from . import constants
from . import exceptions
if os.name == "nt": # pragma: no cover
import msvcrt
lock_length = int(2**31 - 1)
def lock(file_: Any, flags: int) -> None:
if flags & constants.LOCK_SH:
import win32file
import pywintypes
... | 141 | 5,494 |
hydra | tests/test_apps/run_as_module_3/module/my_app.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from omegaconf import DictConfig, OmegaConf
import hydra
@hydra.main(config_name="config")
def my_app(cfg: DictConfig) -> None:
print(OmegaConf.to_yaml(cfg))
if __name__ == "__main__":
my_app()
| 14 | 278 |
mlflow | mlflow/genai/judges/instructions_judge/__init__.py | .py | import json
import logging
from dataclasses import asdict
from typing import Any, Literal
from urllib.parse import urlparse, urlunparse
import pydantic
from pydantic import PrivateAttr
import mlflow
from mlflow.entities.assessment import Feedback
from mlflow.entities.model_registry.prompt_version import PromptVersion... | 910 | 39,049 |
pyro | examples/contrib/epidemiology/sir.py | .py | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
# This script aims to replicate the behavior of examples/sir_hmc.py but using
# the high-level components of pyro.contrib.epidemiology. Command line
# arguments and results should be similar.
import argparse
import logging
import math... | 404 | 15,144 |
onnx | onnx/reference/ops/aionnx_preview/_op_list.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
__all__ = [
"load_op",
"FlexAttention",
]
import textwrap
from typing import Any
from onnx.reference.op_run import OpFunction, OpRun
from onnx.reference.ops._helpers import build_registered_ope... | 86 | 2,708 |
probability | spinoffs/inference_gym/inference_gym/tools/stan/radon_contextual_effects_halfnormal.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... | 127 | 4,580 |
returns | returns/interfaces/bimappable.py | .py | from typing import Never, TypeVar
from returns.interfaces import altable, mappable
_FirstType = TypeVar('_FirstType')
_SecondType = TypeVar('_SecondType')
_ThirdType = TypeVar('_ThirdType')
class BiMappableN(
mappable.MappableN[_FirstType, _SecondType, _ThirdType],
altable.AltableN[_FirstType, _SecondType, ... | 32 | 817 |
mlflow | mlflow/server/__init__.py | .py | import importlib
import logging
import os
import secrets
import shlex
import signal
import sys
import tempfile
import textwrap
import types
import warnings
from pathlib import Path
_logger = logging.getLogger("mlflow.server")
from flask import Flask, Response, send_from_directory
from packaging.version import Version... | 517 | 17,608 |
probability | tensorflow_probability/python/experimental/vi/util/trainable_linear_operators.py | .py | # Copyright 2021 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 396 | 16,223 |
pyomo | pyomo/contrib/pynumero/plugins.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... | 45 | 1,812 |
coveragepy | lab/platform_info.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
"""Dump information so we can get a quick look at what's available."""
import platform
import sys
def whatever(f):
try:
return f()
except:
... | 27 | 620 |
pyro | tests/distributions/test_reshape.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import pytest
import torch
from pyro.distributions.torch import Bernoulli
from tests.common import assert_equal
def test_sample_shape_order():
shape12 = torch.Size((1, 2))
shape34 = torch.Size((3, 4))
d = Bernoulli(0... | 156 | 5,906 |
mlflow | dev/flavors/src/flavors/_loader.py | .py | from __future__ import annotations
from pathlib import Path
from typing import Any
import yaml
from flavors._schema import FlavorConfig
VERSIONS_YAML_PATH = "mlflow/ml-package-versions.yml"
def load(path: str | Path) -> dict[str, FlavorConfig]:
with open(path) as f:
raw = yaml.safe_load(f)
return ... | 35 | 867 |
pyfilesystem2 | fs/base.py | .py | """PyFilesystem base class.
The filesystem base class is common to all filesystems. If you
familiarize yourself with this (rather straightforward) API, you
can work with any of the supported filesystems.
"""
from __future__ import absolute_import, print_function, unicode_literals
import typing
import abc
import ha... | 1,834 | 63,977 |
qutip | qutip/tests/test_animation.py | .py | import pytest
import qutip
import numpy as np
from qutip.wigner import sph_harm_y
mpl = pytest.importorskip("matplotlib")
plt = pytest.importorskip("matplotlib.pyplot")
def test_result_state():
H = qutip.rand_dm(2)
tlist = np.linspace(0, 3*np.pi, 2)
results = qutip.mesolve(H, H, tlist)
fig, ani = qut... | 148 | 3,863 |
coremltools | coremltools/converters/mil/mil/ops/tests/iOS15/test_image_resizing.py | .py | # Copyright (c) 2023, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
import itertools
import numpy as np
import pytest
import coremltools as ct
from coremltools.convert... | 372 | 13,801 |
wagtail | wagtail/images/components.py | .py | from wagtail.admin.ui.fields import BaseFieldDisplay
from wagtail.images.shortcuts import get_rendition_or_not_found
class ImageDisplay(BaseFieldDisplay):
rendition_spec = "max-400x400"
def render_html(self, parent_context):
if self.value is None:
return None
return get_rendition_... | 12 | 376 |
openvino | src/frontends/paddle/tests/test_models/gen_scripts/generate_sigmoid.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# sigmoid paddle model generator
#
import numpy as np
from save_model import saveModel
import paddle
import sys
def sigmoid(name: str, x, data_type):
paddle.enable_static()
with paddle.static.program_guard(paddle.static.Prog... | 46 | 1,263 |
saleor | saleor/order/tests/test_calculate_prices.py | .py | from decimal import Decimal
import pytest
from prices import Money, TaxedMoney
from ...core.prices import quantize_price
from ...core.taxes import zero_money
from ...discount import DiscountType, DiscountValueType
from ...order.base_calculations import (
apply_subtotal_discount_to_order_lines,
calculate_price... | 757 | 27,393 |
saleor | saleor/graphql/discount/mutations/sale/sale_add_catalogues.py | .py | from .....core.tracing import traced_atomic_transaction
from .....discount.error_codes import DiscountErrorCode
from .....discount.models import Promotion, PromotionRule
from .....permission.enums import DiscountPermissions
from .....webhook.event_types import WebhookEventAsyncType
from ....core import ResolveInfo
from... | 98 | 3,692 |
textual | docs/examples/styles/color_auto.py | .py | from textual.app import App
from textual.widgets import Label
class ColorApp(App):
CSS_PATH = "color_auto.tcss"
def compose(self):
yield Label("The quick brown fox jumps over the lazy dog!", id="lbl1")
yield Label("The quick brown fox jumps over the lazy dog!", id="lbl2")
yield Label(... | 19 | 601 |
pyomo | pyomo/environ/tests/standalone_minimal_pyomo_driver.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... | 172 | 5,094 |
saleor | saleor/core/management/commands/remove_invalid_files.py | .py | """Remove files with invalid/dangerous MIME types from storage.
This command scans specific directories in storage for files with invalid
MIME types. By default, it runs in dry-run mode showing what would be deleted
without actually removing files.
"""
import os
from django.conf import settings
from django.core.file... | 198 | 7,251 |
onnxruntime | onnxruntime/test/testdata/abs_0d_lostdim.py | .py | """
Run this script to recreate the original onnx model.
Example usage:
python abs_0d_lostdim.py out_model_path.onnx
"""
import sys
import onnx
from onnx import TensorProto, helper
def order_repeated_field(repeated_proto, key_name, order):
order = list(order)
repeated_proto.sort(key=lambda x: order.index(ge... | 55 | 1,788 |
probability | tensorflow_probability/python/internal/prefer_static_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... | 621 | 22,304 |
pyomo | pyomo/common/tests/test_plugin.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... | 336 | 10,260 |
saleor | saleor/graphql/account/tests/queries/test_customer_types.py | .py | import graphene
from ....core.enums import OrderDirection
from ....tests.utils import assert_no_permission, get_graphql_content
from ...sorters import CustomerTypeSortField
CUSTOMER_TYPE_QUERY = """
query CustomerType($id: ID!) {
customerType(id: $id) {
id
name
slug
... | 201 | 6,028 |
textual | tests/snapshot_tests/snapshot_apps/option_list_multiline_options.py | .py | from __future__ import annotations
from textual.app import App, ComposeResult
from textual.widgets import OptionList, Header, Footer
from textual.widgets.option_list import Option
class OptionListApp(App[None]):
def compose(self) -> ComposeResult:
yield Header()
yield OptionList(
Op... | 33 | 894 |
jupytext | tests/data/notebooks/outputs/ipynb_to_script_vscode_folding_markers/Notebook with metadata and long cells.py | .py | # ---
# jupyter:
# jupytext:
# cell_markers: region,endregion
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # Part one - various cells
# Here we have a markdown cell
#
#
# with two blank lines
# Now we have a markdown cell
# with a code block inside it
#
# ```p... | 55 | 892 |
astropy | astropy/cosmology/_src/traits/photoncomponent.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Photon component."""
__all__ = ("PhotonComponent",)
from collections.abc import Callable
from typing import Any
import numpy as np
from numpy.typing import ArrayLike, NDArray
from astropy.cosmology._src.typing import FArray
from astropy.cosmology._s... | 47 | 1,338 |
saleor | saleor/graphql/app/tests/mutations/test_app_token_delete.py | .py | import graphene
from .....app.error_codes import AppErrorCode
from .....app.models import App, AppToken
from ....tests.utils import assert_no_permission, get_graphql_content
APP_TOKEN_DELETE_MUTATION = """
mutation appTokenDelete($id: ID!){
appTokenDelete(id: $id){
errors{
field
... | 191 | 5,846 |
qutip | qutip/matplotlib_utilities.py | .py | """
This module contains utility functions that enhance Matplotlib
in one way or another.
"""
__all__ = ['wigner_cmap', 'MidpointNorm', 'complex_phase_cmap']
import numpy as np
try:
import matplotlib as mpl
from matplotlib import cm
from matplotlib.colors import Normalize, ColorConverter
except ImportEr... | 156 | 5,594 |
mlflow | tests/utils/test_search_utils.py | .py | import base64
import json
import re
import pytest
from mlflow.entities import (
Dataset,
DatasetInput,
InputTag,
LifecycleStage,
Metric,
Param,
Run,
RunData,
RunInfo,
RunInputs,
RunStatus,
RunTag,
TraceState,
trace_location,
)
from mlflow.entities.trace_info imp... | 894 | 32,647 |
cvxpy | cvxpy/lin_ops/backends/__init__.py | .py | """
Copyright 2025, the CVXPY authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... | 98 | 2,561 |
lemur | lemur/tests/plugins/destination_plugin.py | .py | from lemur.plugins.bases import DestinationPlugin
class TestDestinationPlugin(DestinationPlugin):
title = "Test"
slug = "test-destination"
description = "Enables testing"
author = "Kevin Glisson"
author_url = "https://github.com/netflix/lemur.git"
def __init__(self, *args, **kwargs):
... | 35 | 987 |
onnxruntime | onnxruntime/python/tools/transformers/fusion_reshape.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
from logging import getLogger
import numpy as np
from fusion_base impo... | 174 | 6,230 |
probability | tensorflow_probability/python/optimizer/convergence_criteria/loss_not_decreasing_test.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... | 154 | 6,116 |
coremltools | coremltools/converters/mil/frontend/milproto/test_load.py | .py | # Copyright (c) 2022, 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 itertools
import numpy as np
import pytest
import coremltools as ct
from coremltools import _SP... | 497 | 19,651 |
hatch | tests/helpers/templates/sdist/standard_default_build_script_artifacts.py | .py | from hatch.template import File
from hatch.utils.fs import Path
from hatchling.metadata.spec import DEFAULT_METADATA_VERSION
from hatchling.utils.constants import DEFAULT_BUILD_SCRIPT
from ..new.feature_no_src_layout import get_files as get_template_files
def get_files(**kwargs):
relative_root = kwargs.get("rela... | 48 | 1,245 |
sphinx | sphinx/search/fr.py | .py | """French search language."""
from __future__ import annotations
import snowballstemmer
from sphinx.search import SearchLanguage
from sphinx.search._stopwords.fr import FRENCH_STOPWORDS
class SearchFrench(SearchLanguage):
lang = 'fr'
language_name = 'French'
js_stemmer_rawcode = 'french-stemmer.js'
... | 23 | 589 |
pyro | pyro/ops/hessian.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import torch
def hessian(y, xs):
"""
Convenience method for computing hessians. Note that this is slow in high
dimensions because computing hessians in a reverse-mode AD library like
PyTorch is inherently slow (no... | 23 | 673 |
saleor | saleor/tests/e2e/checkout/taxes/test_checkout_calculate_simple_taxes_product_type_tax_class.py | .py | import pytest
from ...product.utils import (
create_category,
create_product,
create_product_channel_listing,
create_product_type,
create_product_variant,
create_product_variant_channel_listing,
update_product_type,
)
from ...shop.utils.preparing_shop import prepare_shop
from ...taxes.utils... | 214 | 6,495 |
saleor | saleor/discount/tests/test_utils/test_copy_unit_discount_data_to_order_line.py | .py | from decimal import Decimal
import graphene
from ....order.fetch import fetch_draft_order_lines_info
from ... import DiscountType, DiscountValueType
from ...models import PromotionRule
from ...utils.order import update_unit_discount_data_on_order_lines_info
def test_copy_unit_discount_data_to_order_line_multiple_di... | 97 | 3,285 |
wandb | tests/unit_tests/test_launch/test_agent/test_config.py | .py | import os
from unittest.mock import MagicMock
import pytest
import yaml
from wandb.sdk.launch._launch import create_and_run_agent, resolve_agent_config
from wandb.sdk.launch.agent.config import validate_registry_uri
from wandb.sdk.launch.errors import LaunchError
class MockAgent:
def __init__(self, api, config):... | 147 | 4,143 |
astropy | astropy/modeling/tests/test_quantities_rotations.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# pylint: disable=invalid-name, no-member
import numpy as np
import pytest
from numpy.testing import assert_allclose
from astropy import units as u
from astropy.modeling import models
from astropy.tests.helper import assert_quantity_allclose
from astropy... | 118 | 3,967 |
metrics | src/torchmetrics/retrieval/r_precision.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... | 138 | 5,627 |
textual | tests/css/test_css_reloading.py | .py | import os
from pathlib import Path
from textual.app import App, ComposeResult
from textual.screen import Screen
from textual.widgets import Label
CSS_PATH = (Path(__file__) / "../css_reloading.tcss").resolve()
class BaseScreen(Screen[None]):
def compose(self) -> ComposeResult:
yield Label("I am the base... | 87 | 2,368 |
probability | tensorflow_probability/python/distributions/distribution.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... | 2,189 | 87,179 |
metrics | src/torchmetrics/functional/regression/csi.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... | 113 | 4,855 |
probability | tensorflow_probability/python/distributions/kumaraswamy_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... | 401 | 14,903 |
pyomo | pyomo/opt/base/problem.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... | 44 | 1,357 |
coremltools | coremltools/converters/mil/mil/ops/defs/iOS16/__init__.py | .py | # Copyright (c) 2022, 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._deployment_compatibility import \
AvailableTarget as target
_IO... | 17 | 725 |
mamba | libmambapy/src/libmambapy/__init__.py | .py | # Import all submodules so that one can use them directly with `import libmambapy`
import libmambapy.utils
import libmambapy.version
import libmambapy.specs
import libmambapy.solver
# Legacy which used to combine everything
from libmambapy.bindings.legacy import * # noqa: F403
# Define top-level attributes
__version... | 12 | 356 |
biopython | Tests/test_ColorSpiral.py | .py | # Copyright 2013 by Leighton Pritchard. 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 general functionality of the ColorSpiral utility."""
# Builtins
import colo... | 130 | 4,287 |
django-cms | cms/utils/mptree.py | .py | """
Dependency-free materialized-path tree backend
This replaces the ``django-treebeard`` dependency for the page tree
by treating ``parent_id`` as the single source of truth and maintaining
``path``/``depth``/``numchild`` as a derived, set-based-recomputed cache.
The module ships three things:
* :class:`Materialize... | 879 | 38,979 |
python-prompt-toolkit | src/prompt_toolkit/filters/cli.py | .py | """
For backwards-compatibility. keep this file.
(Many people are going to have key bindings that rely on this file.)
"""
from __future__ import annotations
from .app import *
__all__ = [
# Old names.
"HasArg",
"HasCompletions",
"HasFocus",
"HasSelection",
"HasValidationError",
"IsDone",
... | 66 | 1,867 |
coremltools | coremltools/converters/mil/frontend/tensorflow/naming_utils.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
_varname_charset = set(
[chr(i) for i in range(ord("A"), ord("Z") + 1)]
+ [chr(i) for i in r... | 36 | 993 |
mlflow | tests/store/artifact/test_hdfs_artifact_repo.py | .py | import sys
from unittest import mock
from unittest.mock import call
import pyarrow
import pytest
from mlflow.entities import FileInfo
from mlflow.store.artifact.hdfs_artifact_repo import (
HdfsArtifactRepository,
_parse_extra_conf,
_relative_path_remote,
_resolve_base_path,
)
@pytest.fixture
def hdf... | 224 | 7,724 |
eve | examples/security/token.py | .py | # -*- coding: utf-8 -*-
"""
Auth-Token
~~~~~~~~~~
Securing an Eve-powered API with Token based Authentication.
Token based authentication can be considered a specialized version of Basic
Authentication. The Authorization header tag will contain the auth token.
This script assumes that user a... | 44 | 1,481 |
hypercorn | docs/conf.py | .py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Hypercorn documentation build configuration file, created by
# sphinx-quickstart on Sun May 21 14:18:44 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# ... | 179 | 5,460 |
probability | tensorflow_probability/python/distributions/moyal.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... | 254 | 9,447 |
confluent-kafka-python | tests/integration/schema_registry/data/proto/SInt32Value_pb2.py | .py | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: tests/integration/schema_registry/data/proto/SInt32Value.proto
"""Generated protocol buffer code."""
from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.pro... | 30 | 1,245 |
pyro | tests/infer/test_inference.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import logging
import math
from unittest import TestCase
import pytest
import torch
from torch.distributions import constraints
import pyro
import pyro.contrib.gp.kernels as kernels
import pyro.distributions as dist
import pyro.o... | 1,008 | 36,696 |
mlflow | mlflow/smolagents/__init__.py | .py | """
The ``mlflow.smolagents`` module provides an API for tracing Smolagents AI agents.
"""
import logging
from mlflow.smolagents.autolog import (
patched_class_call,
)
from mlflow.telemetry.events import AutologgingEvent
from mlflow.telemetry.track import _record_event
from mlflow.utils.autologging_utils import a... | 71 | 2,345 |
returns | tests/test_pipeline/test_managed/test_managed_reader_ioresult.py | .py | import pytest
from returns.context import NoDeps, ReaderIOResult
from returns.io import IOFailure, IOSuccess
from returns.pipeline import managed
from returns.result import Failure, Result, Success
_acquire_success = ReaderIOResult.from_value('acquire success')
_acquire_failure = ReaderIOResult.from_failure('acquire ... | 130 | 3,569 |
probability | tensorflow_probability/python/distributions/categorical_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... | 684 | 26,529 |
django-cms | cms/test_utils/project/pluginapp/plugins/revdesc/cms_plugins.py | .py | from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from . import models
class RevDescUnalteredP(CMSPluginBase):
model = models.UnalteredPM
render_template = 'cms/content.html'
plugin_pool.register_plugin(RevDescUnalteredP)
class RevDescNoRelNmeP(CMSPluginBase):
model = ... | 53 | 1,139 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.