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 |
|---|---|---|---|---|---|
pdm | src/pdm/models/auth.py | .py | from __future__ import annotations
import functools
import urllib.parse
from unearth.auth import MaybeAuth, MultiDomainBasicAuth, get_keyring_provider
from unearth.utils import commonprefix, split_auth_from_url
from pdm._types import RepositoryConfig
from pdm.exceptions import PdmException
from pdm.termui import UI,... | 128 | 4,895 |
onnxruntime | tools/python/util/mobile_helpers/test/test_usability_checker.py | .py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from __future__ import annotations
import logging
import pathlib
import unittest
from testfixtures import LogCapture
from ..usability_checker import analyze_model
# example usage from <ort root>/tools/python
# python -m un... | 148 | 6,435 |
clearml | examples/services/monitoring/slack_alerts.py | .py | """
Create a ClearML Monitoring Service that posts alerts on Slack Channel groups based on some logic
Creating a new Slack Bot (ClearML Bot):
1. Login to your Slack account
2. Go to https://api.slack.com/apps/new
3. Give the new App a name (For example "ClearML Bot") and select your workspace
4. Press Create App
5. In... | 325 | 12,891 |
conda | tests/models/test_version.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from copy import copy
from random import shuffle
import pytest
from conda.exceptions import InvalidVersionSpec
from conda.models.version import VersionOrder, VersionSpec, normalized_version, ver_eval
def test_version_order():
versions = ... | 437 | 14,114 |
textual | docs/examples/guide/workers/weather04.py | .py | import httpx
from rich.text import Text
from textual import work
from textual.app import App, ComposeResult
from textual.containers import VerticalScroll
from textual.widgets import Input, Static
from textual.worker import Worker
class WeatherApp(App):
"""App to display the current weather."""
CSS_PATH = "w... | 48 | 1,493 |
metrics | src/torchmetrics/functional/classification/hamming.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... | 430 | 20,726 |
saleor | saleor/tests/e2e/account/utils/staff_update.py | .py | from ...utils import get_graphql_content
STAFF_UPDATE_MUTATION = """
mutation StaffUpdate($id: ID!, $input: StaffUpdateInput!){
staffUpdate(id: $id,
input: $input) {
user {
id
metadata {
key
value
}
privateMetadata {
key
value
}
}
errors {... | 46 | 787 |
saleor | saleor/graphql/app/mutations/__init__.py | .py | from .app_activate import AppActivate
from .app_create import AppCreate
from .app_deactivate import AppDeactivate
from .app_delete import AppDelete
from .app_delete_failed_installation import AppDeleteFailedInstallation
from .app_fetch_manifest import AppFetchManifest
from .app_install import AppInstall
from .app_probl... | 34 | 1,037 |
httpie | tests/utils/matching/tokens.py | .py | from enum import Enum, auto
class Expect(Enum):
"""
Predefined token types we can expect in the output.
"""
REQUEST_HEADERS = auto()
RESPONSE_HEADERS = auto()
RESPONSE_META = auto()
BODY = auto()
SEPARATOR = auto()
class ExpectSequence:
"""
Standard combined chunks. These pr... | 57 | 1,106 |
saleor | saleor/attribute/error_codes.py | .py | from enum import Enum
class AttributeErrorCode(Enum):
ALREADY_EXISTS = "already_exists"
GRAPHQL_ERROR = "graphql_error"
INVALID = "invalid"
NOT_FOUND = "not_found"
REQUIRED = "required"
UNIQUE = "unique"
class AttributeBulkCreateErrorCode(Enum):
ALREADY_EXISTS = "already_exists"
BLAN... | 35 | 870 |
saleor | saleor/graphql/account/mutations/account/account_address_delete.py | .py | from .....account import models
from .....webhook.event_types import WebhookEventAsyncType
from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.types import AccountError
from ....core.utils import WebhookEventInfo
from ...types import Address
from ..base import BaseAddressDelete
class AccountAddressDele... | 28 | 959 |
tablib | src/tablib/formats/_cli.py | .py | """Tablib - Command-line Interface table export support.
Generates a representation for CLI from the dataset.
Wrapper for tabulate library.
"""
__lazy_modules__ = {"tabulate"}
from tabulate import tabulate as Tabulate
class CLIFormat:
""" Class responsible to export to CLI Format """
title = 'cli'
... | 24 | 645 |
hydra | tests/test_apps/simple_interpolation/my_app.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from omegaconf import DictConfig
import hydra
@hydra.main(config_path=".", config_name="config")
def my_app(cfg: DictConfig) -> None:
print(cfg.c)
if __name__ == "__main__":
my_app()
| 14 | 267 |
coremltools | coremltools/converters/mil/experimental/passes/generic_layernorm_instancenorm_pattern_fusion.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 numpy as np
from coremltools.converters.mil import Builder as mb
from coremltools.... | 458 | 21,031 |
beam | sdks/python/apache_beam/io/utils_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... | 69 | 2,312 |
loguru | tests/test_threading.py | .py | import itertools
import time
from threading import Barrier, Thread
from loguru import logger
class NonSafeSink:
def __init__(self, sleep_time, stop_time=0):
self.sleep_time = sleep_time
self.stop_time = stop_time
self.written = ""
self.stopped = False
def write(self, message)... | 226 | 4,996 |
loguru | tests/test_levels.py | .py | import functools
import pytest
from loguru import logger
from .conftest import parse
def test_log_int_level(writer):
logger.add(writer, format="{level.name} -> {level.no} -> {message}", colorize=False)
logger.log(10, "test")
assert writer.read() == "Level 10 -> 10 -> test\n"
def test_log_str_level(w... | 299 | 9,005 |
black | tests/util.py | .py | import argparse
import functools
import os
import shlex
import sys
import unittest
from collections.abc import Collection, Iterator
from contextlib import contextmanager
from dataclasses import dataclass, field, replace
from functools import partial
from pathlib import Path
from typing import Any
import black
from bla... | 356 | 12,188 |
sphinx | sphinx/parsers.py | .py | """A Base class for additional parsers."""
from __future__ import annotations
from typing import TYPE_CHECKING
import docutils.parsers
import docutils.parsers.rst
from docutils.parsers.rst import states
from docutils.statemachine import StringList
from docutils.transforms.universal import SmartQuotes
from sphinx.de... | 116 | 3,877 |
wagtail | wagtail/admin/api/actions/create_alias.py | .py | import swapper
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 Se... | 54 | 1,846 |
coremltools | coremltools/_deps/__init__.py | .py | # Copyright (c) 2017, 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
"""
List of all external dependencies for this package. Imported as
optional includes
"""
import platfor... | 253 | 7,268 |
readthedocs.org | readthedocs/api/v2/adapters.py | .py | from requests.adapters import HTTPAdapter
from requests_toolbelt.adapters.host_header_ssl import HostHeaderSSLAdapter
class TimeoutAdapter:
"""
Adapter to inject ``timeout`` to all the requests.
Allows us to not wait forever when querying our API internally from the
builders and make the build fail f... | 31 | 852 |
pyomo | pyomo/devel/initialization/pwl_init.py | .py | # ____________________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of... | 363 | 12,957 |
scikit-optimize | skopt/plots.py | .py | # -*- encoding: UTF-8 -*-
"""Plotting functions."""
import sys
import numpy as np
from itertools import count
from functools import partial
from scipy.optimize import OptimizeResult
from .acquisition import _gaussian_acquisition
from skopt import expected_minimum, expected_minimum_random_sampling
from .space import Ca... | 1,398 | 51,950 |
probability | tensorflow_probability/python/experimental/psd_kernels/multitask_kernel_test.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... | 111 | 4,717 |
probability | tensorflow_probability/python/distributions/mvn_diag_plus_low_rank_covariance_test.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... | 72 | 2,579 |
readthedocs.org | readthedocs/organizations/tests/test_privacy_urls.py | .py | from django.contrib.auth.models import User
from django.test import TestCase, override_settings
from django_dynamic_fixture import get
from readthedocs.organizations.models import Organization, Team, TeamInvite
from readthedocs.rtd_tests.tests.test_privacy_urls import URLAccessMixin
class OrganizationMixin(URLAccess... | 87 | 2,983 |
coveragepy | tests/test_html.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
"""Tests that HTML generation is awesome."""
from __future__ import annotations
import collections
import datetime
import glob
import json
import os
import os.p... | 1,636 | 59,789 |
beam | sdks/python/apache_beam/runners/interactive/utils.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 477 | 17,335 |
mlflow | tests/models/test_resources.py | .py | import pytest
from mlflow.models.resources import (
DEFAULT_API_VERSION,
DatabricksApp,
DatabricksFunction,
DatabricksGenieSpace,
DatabricksLakebase,
DatabricksServingEndpoint,
DatabricksSQLWarehouse,
DatabricksTable,
DatabricksUCConnection,
DatabricksVectorSearchIndex,
_Res... | 363 | 13,623 |
sqlmap | plugins/dbms/h2/__init__.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.enums import DBMS
from lib.core.settings import H2_SYSTEM_DBS
from lib.core.unescaper import unescaper
from plugins.dbms.h2.enumeration import Enumeration
from plugi... | 30 | 868 |
cvxpy | cvxpy/reductions/dgp2dcp/canonicalizers/pnorm_canon.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
... | 56 | 1,910 |
openvino | src/frontends/onnx/tests/tests_python/test_frontendmanager.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pickle
import os
from pathlib import Path
from openvino import PartialShape
from openvino.frontend import FrontEndManager, InitializationFailure, TelemetryExtension
from openvino.utils.types import get_ele... | 718 | 21,979 |
ipython | IPython/core/release.py | .py | """Release data for the IPython project."""
#-----------------------------------------------------------------------------
# Copyright (c) 2008, IPython Development Team.
# Copyright (c) 2001, Fernando Perez <fernando.perez@colorado.edu>
# Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
# Copyright (c) 2001, ... | 45 | 1,484 |
omegaconf | tests/test_matrix.py | .py | import copy
import re
from pathlib import Path
from typing import Any, Optional, Union
from pytest import mark, raises, warns
from omegaconf import (
BooleanNode,
BytesNode,
DictConfig,
EnumNode,
FloatNode,
IntegerNode,
ListConfig,
OmegaConf,
PathNode,
StringNode,
UnionNode... | 411 | 12,901 |
wagtail | wagtail/images/tests/test_signal_handlers.py | .py | from django.db import transaction
from django.test import TestCase, TransactionTestCase, override_settings, tag
from wagtail.images import get_image_model, signal_handlers
from wagtail.images.tests.utils import get_test_image_file
from wagtail.models import Collection
from wagtail.test.utils import PageFixturesMixin
... | 102 | 4,340 |
confluent-kafka-python | tests/test_buffer_timeout_manager.py | .py | #!/usr/bin/env python3
"""
Unit tests for the BufferTimeoutManager class (_buffer_timeout_manager.py)
This module tests the BufferTimeoutManager class to ensure proper
buffer timeout monitoring and automatic flush handling.
"""
import asyncio
import time
import unittest
from unittest.mock import AsyncMock, Mock
from... | 287 | 11,674 |
saleor | saleor/discount/error_codes.py | .py | from enum import Enum
class DiscountErrorCode(Enum):
ALREADY_EXISTS = "already_exists"
GRAPHQL_ERROR = "graphql_error"
INVALID = "invalid"
NOT_FOUND = "not_found"
REQUIRED = "required"
UNIQUE = "unique"
CANNOT_MANAGE_PRODUCT_WITHOUT_VARIANT = "cannot_manage_product_without_variant"
DUP... | 76 | 2,273 |
saleor | saleor/tests/e2e/checkout/discounts/promotions/test_promotion_discount_applied_on_checkout_with_specific_total_and_subtotal.py | .py | from decimal import Decimal
import pytest
from ......checkout.models import Checkout
from ......discount import DiscountType, RewardValueType
from ....product.utils.preparing_product import prepare_product
from ....promotions.utils import create_promotion, create_promotion_rule
from ....shop.utils.preparing_shop impo... | 181 | 6,345 |
mlflow | tests/genai/scorers/guardrails/test_guardrails.py | .py | from unittest.mock import patch
import guardrails
import pytest
from guardrails import Validator, register_validator
from guardrails.classes.validation.validation_result import FailResult, PassResult
import mlflow
from mlflow.entities.assessment import Feedback
from mlflow.entities.assessment_source import Assessment... | 277 | 9,224 |
coremltools | coremltools/converters/mil/mil/operation.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 typing import Any, Dict, Optional, Tuple
import numpy as np
from coremltools.converters.mil.mi... | 632 | 23,609 |
kafka | committer-tools/find-unfinished-test.py | .py | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | 67 | 2,438 |
saleor | saleor/tests/e2e/account/staff/test_create_and_update_customer_with_metadata.py | .py | import pytest
from ...utils import assign_permissions
from ..utils import create_customer, customer_update
@pytest.mark.e2e
def test_create_and_update_customer_with_metadata_core_1514(
e2e_staff_api_client,
permission_manage_users,
):
# Before
permissions = [
permission_manage_users,
]
... | 55 | 1,574 |
saleor | saleor/graphql/core/types/common.py | .py | from typing import TYPE_CHECKING
from urllib.parse import unquote, urlparse
import graphene
from django.core.files.storage import default_storage
from ....core.utils import build_absolute_uri
from ...account.enums import AddressTypeEnum
from ...core.doc_category import (
DOC_CATEGORY_APPS,
DOC_CATEGORY_ATTRIB... | 1,048 | 30,350 |
eve | eve/__init__.py | .py | # -*- coding: utf-8 -*-
"""
Eve
~~~
An out-of-the-box REST Web API that's as dangerous as you want it to be.
:copyright: (c) 2017 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
.. versionchanged:: 0.5
'SERVER_NAME' removed.
'QUERY_WHERE' added.
'QUERY_SO... | 90 | 2,044 |
textual | tests/test_style_inheritance.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Button, Static
async def test_text_style_inheritance():
"""Check that changes to text style are inherited in children."""
class FocusableThing(Static, can_focus=True):
DEFAULT_CSS = """
FocusableThing {
text-st... | 38 | 1,099 |
scikit-bio | skbio/stats/composition/tests/test_ancombc.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.
# --------------------------------------------... | 355 | 14,468 |
textual | tests/test_box_model.py | .py | from __future__ import annotations
from fractions import Fraction
from textual.box_model import BoxModel
from textual.geometry import Size, Spacing
from textual.widget import Widget
async def test_content_box():
one = Fraction(1)
class TestWidget(Widget):
def get_content_width(self, container: Size... | 190 | 6,248 |
onnx | onnx/reference/ops/__init__.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
__all__ = ["load_op"]
from onnx.reference.ops._op_list import load_op
| 9 | 189 |
astropy | astropy/io/ascii/misc.py | .py | """A Collection of useful miscellaneous functions.
misc.py:
Collection of useful miscellaneous functions.
:Author: Hannes Breytenbach (hannes@saao.ac.za)
"""
import collections.abc
import itertools
import operator
def first_true_index(iterable, pred=None, default=None):
"""find the first index position for t... | 128 | 4,112 |
mlflow | tests/projects/backend/test_loader.py | .py | from mlflow.projects.backend import loader
def test_plugin_backend():
backend = loader.load_backend("dummy-backend")
assert backend is not None
def test_plugin_does_not_exist():
backend = loader.load_backend("my_plugin")
assert backend is None
| 12 | 264 |
astropy | astropy/cosmology/_src/tests/test_realizations.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pickle
import pytest
import astropy.cosmology.units as cu
import astropy.units as u
from astropy import cosmology
from astropy.cosmology import parameters, realizations
from astropy.cosmology.realizations import default_cosmology
def test_reali... | 106 | 3,589 |
metrics | src/torchmetrics/utilities/imports.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... | 70 | 3,412 |
probability | tensorflow_probability/python/bijectors/ffjord.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... | 417 | 17,627 |
jupytext | tests/data/notebooks/inputs/hydrogen/hydrogen_latex_html_R_magics.py | .py | # %%
1 + 1
# %%
import pandas as pd
pd.Series({'A':5, 'B':2}).plot()
# %%
%matplotlib inline
pd.Series({'A':5, 'B':2}).plot(figsize=(3,2))
# %%
%%html
<p><a href="https://github.com/mwouts/jupytext", style="color: rgb(0,0,255)">Jupytext</a> on GitHub</p>
# %%
%load_ext rpy2.ipython
# %%
%%R -w 400 -h 200
library(g... | 27 | 438 |
openvino | tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_flatten.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 TestKerasFlatten(CommonTF2LayerTest):
def create_keras_flatten_net(self, input_names, input_shapes, input_type, data_format,
... | 41 | 1,709 |
saleor | saleor/app/tests/fixtures/app_problem.py | .py | from datetime import datetime
import pytest
from django.utils import timezone
from ....account.models import User
from ...models import App, AppProblem
@pytest.fixture
def app_problem_generator():
def create_problem(
app: App,
key: str = "test-key",
message: str = "Test problem",
... | 47 | 1,400 |
saleor | saleor/graphql/attribute/tests/mutations/test_attribute_value_create.py | .py | import json
from unittest import mock
import graphene
import pytest
from django.core.exceptions import ValidationError
from django.utils.functional import SimpleLazyObject
from django.utils.text import slugify
from freezegun import freeze_time
from .....attribute.error_codes import AttributeErrorCode
from .....attrib... | 564 | 18,030 |
saleor | saleor/graphql/discount/tests/benchmark/test_promotion_rule_update.py | .py | from decimal import Decimal
import graphene
import pytest
from ....tests.utils import get_graphql_content
from ...enums import RewardValueTypeEnum
from ..mutations.test_promotion_rule_update import PROMOTION_RULE_UPDATE_MUTATION
@pytest.mark.django_db
@pytest.mark.count_queries(autouse=False)
def test_promotion_rul... | 79 | 2,235 |
saleor | saleor/graphql/notifications/tests/test_external_notification_dispatch.py | .py | from unittest.mock import patch
from graphql_relay.node.node import to_global_id
from ....account.models import User
@patch("saleor.plugins.manager.PluginsManager.notify")
def test_notify_via_external_notification_trigger(
notify_single_plugin_mock,
settings,
staff_users,
external_notification_trigg... | 41 | 1,165 |
wandb | wandb/integration/sklearn/plot/shared.py | .py | """Define plots used by multiple sklearn model classes."""
from warnings import simplefilter
import numpy as np
import wandb
from wandb.integration.sklearn import calculate, utils
# ignore all future warnings
simplefilter(action="ignore", category=FutureWarning)
def summary_metrics(model=None, X=None, y=None, X_t... | 92 | 2,763 |
mlflow | tests/gateway/test_gateway_app.py | .py | from unittest import mock
import pytest
from fastapi.testclient import TestClient
from mlflow.exceptions import MlflowException
from mlflow.gateway.app import create_app_from_config, create_app_from_env
from mlflow.gateway.config import GatewayConfig
from mlflow.gateway.constants import (
MLFLOW_GATEWAY_CRUD_ENDP... | 279 | 8,585 |
mlflow | mlflow/models/python_api.py | .py | import logging
import os
import shutil
from io import StringIO
from typing import ForwardRef, get_args, get_origin
from mlflow.exceptions import MlflowException
from mlflow.models.flavor_backend_registry import get_flavor_backend
from mlflow.utils import env_manager as _EnvManager
from mlflow.utils.databricks_utils im... | 379 | 16,191 |
sqlmap | thirdparty/pydes/__init__.py | .py | #!/usr/bin/env python
#
# Copyright 2009 Todd Whiteman
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This... | 20 | 720 |
pyomo | pyomo/core/expr/calculus/derivatives.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... | 121 | 4,911 |
astropy | astropy/timeseries/periodograms/lombscargle/implementations/mle.py | .py | import numpy as np
def design_matrix(t, frequency, dy=None, bias=True, nterms=1):
"""Compute the Lomb-Scargle design matrix at the given frequency.
This is the matrix X such that the periodic model at the given frequency
can be expressed :math:`\\hat{y} = X \\theta`.
Parameters
----------
t ... | 106 | 3,175 |
saleor | saleor/graphql/csv/tests/mutations/test_export_products.py | .py | from unittest.mock import ANY, patch
import graphene
import pytest
from .....attribute.models import Attribute
from .....channel.models import Channel
from .....csv import ExportEvents
from .....csv.error_codes import ExportErrorCode
from .....csv.models import ExportEvent
from .....warehouse.models import Warehouse
... | 904 | 26,071 |
probability | tensorflow_probability/python/distributions/von_mises.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... | 678 | 27,147 |
django-cms | cms/signals/pagecontent.py | .py | """
Signal handlers for PageContent model operations.
"""
import logging
from django.db.models.signals import post_save
from django.dispatch import receiver
from cms.models.contentmodels import PageContent
from cms.signals.apphook import set_restart_trigger
logger = logging.getLogger(__name__)
@receiver(post_save,... | 38 | 1,299 |
beam | playground/infrastructure/test_grpc_client.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 ... | 87 | 3,015 |
astropy | astropy/stats/tests/test_funcs.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_equal
from astropy import units as u
from astropy.stats import funcs
from astropy.utils.compat.optional_deps import HAS_BOTTLENECK, HAS_MPMATH, HAS_SCIPY
from astropy.util... | 925 | 30,693 |
beam | learning/tour-of-beam/learning-content/triggers/event-time-trigger/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 | 2,243 |
saleor | saleor/graphql/giftcard/resolvers.py | .py | from ...giftcard import models
from ..core.context import get_database_connection_name
def resolve_gift_card(info, id):
return (
models.GiftCard.objects.using(get_database_connection_name(info.context))
.filter(pk=id)
.first()
)
def resolve_gift_cards(info):
return models.GiftCar... | 23 | 544 |
pynacl | src/nacl/bindings/crypto_generichash.py | .py | # Copyright 2013-2019 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 applicabl... | 281 | 8,837 |
cvxpy | cvxpy/atoms/affine/real.py | .py | """
Copyright 2013 Steven Diamond
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... | 53 | 1,458 |
openvino | tests/layer_tests/pytorch_tests/test_bincount.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
import torch
from pytorch_layer_test_class import PytorchLayerTest
class TestBincount(PytorchLayerTest):
def _prepare_input(self, input_data, i_dtype, w_dtype, with_weights):
inputs = (np.... | 70 | 2,456 |
probability | tensorflow_probability/python/bijectors/cholesky_outer_product.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... | 224 | 8,442 |
wagtail | wagtail/permission_policies/base.py | .py | from django.contrib.auth import get_permission_codename, get_user_model
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import FieldDoesNotExist, ImproperlyConfigured
from django.db.models import Q
from django.utils.functional impo... | 448 | 19,270 |
biopython | Bio/SCOP/Raf.py | .py | # Copyright 2001 by Gavin E. Crooks. All rights reserved.
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
# Please see the LICENSE file that should have been included as part of this
# package.
"""ASTRAL RAF (Rapid Acce... | 320 | 10,317 |
lemur | lemur/destinations/service.py | .py | """
.. module: lemur.destinations.service
: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 sqlalchemy import func
from flask import current_app
from lemur import databas... | 172 | 5,297 |
coremltools | coremltools/proto/CategoricalMapping_pb2.py | .py | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: CategoricalMapping.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _messag... | 42 | 1,959 |
biopython | Bio/SearchIO/ExonerateIO/__init__.py | .py | # Copyright 2012 by Wibowo Arindrarto. All rights reserved.
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
# Please see the LICENSE file that should have been included as part of this
# package.
"""Bio.SearchIO support... | 255 | 13,047 |
kombu | t/unit/test_entity.py | .py | from __future__ import annotations
import pickle
from unittest.mock import Mock, call
import pytest
from kombu import Connection, Exchange, Producer, Queue, binding
from kombu.abstract import MaybeChannelBound
from kombu.exceptions import NotBoundError
from kombu.serialization import registry
from t.mocks import Tra... | 457 | 14,846 |
beam | sdks/python/apache_beam/utils/profiler_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... | 65 | 2,089 |
saleor | saleor/graphql/account/tests/mutations/authentication/test_tokens_deactivate_all.py | .py | import json
from freezegun import freeze_time
from ......account.error_codes import AccountErrorCode
from ......core.jwt import create_access_token, create_refresh_token, jwt_decode
from .....tests.utils import get_graphql_content
from ....mutations.authentication.utils import _get_new_csrf_token
from .test_token_ref... | 89 | 3,038 |
wagtail | wagtail/utils/registry.py | .py | from django.core.exceptions import ImproperlyConfigured
from django.db import models
from wagtail.coreutils import resolve_model_string
class ObjectTypeRegistry:
"""
Implements a lookup table for mapping objects to values according to the object type.
The most specific type according to the object's inhe... | 92 | 3,429 |
saleor | saleor/graphql/checkout/dataloaders/models.py | .py | from collections import defaultdict
from collections.abc import Iterable
from django.db.models import F
from ....checkout.models import Checkout, CheckoutLine, CheckoutMetadata
from ....payment.models import TransactionItem
from ...core.dataloaders import DataLoader
class CheckoutByTokenLoader(DataLoader[str, Check... | 101 | 3,771 |
wandb | wandb/filesync/upload_job.py | .py | from __future__ import annotations
import logging
import os
from typing import TYPE_CHECKING
import wandb
from wandb.analytics import get_sentry
from wandb.sdk.lib.paths import LogicalPath
if TYPE_CHECKING:
from wandb.filesync import dir_watcher, stats, step_upload
from wandb.sdk.internal import file_stream,... | 146 | 5,534 |
mlflow | tests/autologging/test_autologging_behaviors_integration.py | .py | import importlib
import logging
import sys
import warnings
from concurrent.futures import ThreadPoolExecutor
from io import StringIO
from itertools import permutations
from unittest import mock
import pytest
import mlflow
from mlflow import MlflowClient
from mlflow.utils import gorilla
from mlflow.utils.autologging_u... | 335 | 11,961 |
astropy | astropy/time/tests/test_mask.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import functools
import numpy as np
import pytest
from astropy import units as u
from astropy.coordinates import EarthLocation
from astropy.table import Table
from astropy.time import Time, conf
from astropy.utils import iers
from astropy.utils.compat.o... | 367 | 12,670 |
probability | tensorflow_probability/python/distributions/inverse_gaussian_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... | 474 | 17,077 |
textual | docs/examples/guide/layout/layers.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Static
class LayersExample(App):
CSS_PATH = "layers.tcss"
def compose(self) -> ComposeResult:
yield Static("box1 (layer = above)", id="box1")
yield Static("box2 (layer = below)", id="box2")
if __name__ == "__main__":
... | 16 | 357 |
metrics | src/torchmetrics/video/__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... | 22 | 810 |
onnxruntime | onnxruntime/python/tools/transformers/models/sam2/nvtx_helper.py | .py | # -------------------------------------------------------------------------
# Copyright (R) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
import nvtx
from cuda import cudart
class NvtxHelper:
def __init__... | 34 | 1,279 |
pyomo | pyomo/dae/plugins/__init__.py | .py | # ____________________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of... | 13 | 619 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_empty_tensor_list.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import tensorflow as tf
tf.compat.v1.reset_default_graph()
# Create the graph and model
with tf.compat.v1.Session() as sess:
tensor = tf.compat.v1.placeholder(tf.float32, [2, 3, 5], name='data')
element_sh... | 26 | 1,093 |
saleor | saleor/webhook/observability/tests/test_obfuscation.py | .py | import pytest
from graphql import GraphQLError
from ....graphql.api import schema
from ..obfuscation import (
MASK,
anonymize_event_payload,
anonymize_gql_operation_response,
filter_and_hide_headers,
validate_sensitive_fields_map,
)
@pytest.mark.parametrize(
("headers", "allowed", "sensitive"... | 170 | 4,682 |
beam | sdks/python/apache_beam/examples/snippets/transforms/elementwise/keys_test.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");... | 52 | 1,430 |
sphinx | tests/test_builders/test_build_changes.py | .py | """Test the ChangesBuilder class."""
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
if TYPE_CHECKING:
from sphinx.testing.util import SphinxTestApp
@pytest.mark.sphinx('changes', testroot='changes')
def test_build(app: SphinxTestApp) -> None:
app.build()
# TODO: Use... | 47 | 1,355 |
sphinx | tests/roots/test-extensions/read_parallel.py | .py | def setup(app):
return {
'parallel_read_safe': True,
}
| 5 | 71 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.