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 |
|---|---|---|---|---|---|
wandb | tools/graphql_codegen/plugin.py | .py | """Plugin module to customize GraphQL-to-Python code generation.
NOTE: As this is a dev-only tool, Python 3.10+ is required.
For more info, see:
- https://github.com/mirumee/ariadne-codegen/blob/main/PLUGINS.md
- https://github.com/mirumee/ariadne-codegen/blob/main/ariadne_codegen/plugins/base.py
"""
from __future__... | 509 | 21,113 |
cvxpy | cvxpy/reductions/solvers/conic_solvers/scs_conif.py | .py | """
Copyright 2013 Steven Diamond, 2017 Robin Verschueren, 2017 Akshay Agrawal
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 ap... | 279 | 10,249 |
wagtail | wagtail/contrib/frontend_cache/tests.py | .py | from unittest import mock
from urllib.error import HTTPError, URLError
import requests
from azure.mgmt.cdn import CdnManagementClient
from azure.mgmt.frontdoor import FrontDoorManagementClient
from django.core.exceptions import ImproperlyConfigured
from django.test import SimpleTestCase, TestCase
from django.test.util... | 911 | 34,882 |
biopython | Tests/test_SeqIO.py | .py | # Copyright 2007-2016,2020 by Peter Cock. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Tests for SeqIO module."""
import copy
import gzip
import unittest
import warnings
f... | 5,912 | 235,592 |
ipython | tests/test_shortcuts.py | .py | import pytest
import sys
import time
from IPython.terminal.interactiveshell import PtkHistoryAdapter
from IPython.terminal.shortcuts.auto_suggest import (
accept,
accept_or_jump_to_end,
accept_token,
accept_character,
accept_word,
accept_and_keep_cursor,
discard,
llm_autosuggestion,
... | 1,188 | 38,590 |
beam | sdks/python/apache_beam/examples/sinks/generate_event.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... | 145 | 6,820 |
kombu | kombu/compat.py | .py | """Carrot compatibility interface.
See https://pypi.org/project/carrot/ for documentation.
"""
from __future__ import annotations
from itertools import count
from typing import TYPE_CHECKING
from . import messaging
from .entity import Exchange, Queue
if TYPE_CHECKING:
from types import TracebackType
__all__ =... | 228 | 6,752 |
probability | spinoffs/inference_gym/inference_gym/backends/numpy_integration_test.py | .py | # Copyright 2020 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 31 | 1,119 |
wagtail | wagtail/admin/tests/test_keyboard_shortcuts.py | .py | import json
import re
from django.test import RequestFactory, TestCase, override_settings
from django.test.client import Client
from django.urls import reverse
from wagtail.admin.utils import get_keyboard_key_labels_from_request
from wagtail.test.utils import WagtailTestUtils
from wagtail.users.models import UserProf... | 271 | 10,381 |
wandb | wandb/proto/wandb_settings_pb2.py | .py | import google.protobuf
protobuf_version = google.protobuf.__version__[0]
if protobuf_version == "5":
from wandb.proto.v5.wandb_settings_pb2 import *
elif protobuf_version == "6":
from wandb.proto.v6.wandb_settings_pb2 import *
elif protobuf_version == "7":
from wandb.proto.v7.wandb_settings_pb2 import *
| 11 | 319 |
eve | eve/flaskapp.py | .py | # -*- coding: utf-8 -*-
"""
eve.flaskapp
~~~~~~~~~~~~
This module implements the central WSGI application object as a Flask
subclass.
:copyright: (c) 2017 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
"""
import copy
import fnmatch
import os
import sys
import warnings
from ty... | 1,118 | 42,796 |
mlflow | mlflow/tracing/analysis.py | .py | import math
from dataclasses import dataclass
from mlflow.entities._mlflow_object import _MlflowObject
from mlflow.protos.service_pb2 import CalculateTraceFilterCorrelation
@dataclass
class TraceFilterCorrelationResult(_MlflowObject):
"""
Result of calculating correlation between two trace filter conditions.... | 89 | 3,376 |
pyomo | pyomo/contrib/pynumero/examples/tests/test_mpi_examples.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... | 52 | 1,837 |
onnx | onnx/backend/test/case/node/hannwindow.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 HannWindow(Base):
@staticmethod
def export() -> None:
... | 46 | 1,222 |
kafka | release/notes.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... | 175 | 6,491 |
conda | tests/plugins/test_env_specs.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import functools
from pathlib import Path
from xml.etree import ElementTree
import pytest
from conda import plugins
from conda.auxlib.ish import dals
from conda.exceptions import (
AmbiguousEnvironmentSpecPlugin,
EnvironmentSpecPluginN... | 727 | 22,723 |
mlflow | mlflow/store/tracking/gateway/sqlalchemy_mixin.py | .py | from __future__ import annotations
import json
import os
import uuid
from typing import Any
from sqlalchemy import case, func
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm import joinedload
from mlflow.entities import (
FallbackConfig,
GatewayEndpoint,
GatewayEndpointBinding,
GatewayE... | 1,611 | 63,685 |
saleor | saleor/graphql/checkout/mutations/checkout_complete.py | .py | from typing import Union
import graphene
from django.core.exceptions import ValidationError
from ....account.models import User
from ....app.models import App
from ....checkout import AddressType, models
from ....checkout.checkout_cleaner import (
clean_checkout_shipping,
validate_checkout_email,
)
from ....c... | 384 | 14,811 |
saleor | saleor/graphql/product/tests/benchmark/test_variant.py | .py | from uuid import uuid4
import graphene
import pytest
from .....product.models import ProductMedia, ProductVariant, VariantMedia
from .....warehouse.models import Stock
from ....tests.utils import get_graphql_content
@pytest.mark.django_db
@pytest.mark.count_queries(autouse=False)
def test_retrieve_variant_list(
... | 407 | 11,435 |
pdm | src/pdm/compat.py | .py | from __future__ import annotations
import sys
from collections.abc import Iterator, Sequence
from typing import TYPE_CHECKING, TypeVar
if TYPE_CHECKING:
from typing import Protocol
class SupportsIdentify(Protocol):
def identify(self) -> str: ...
if sys.version_info >= (3, 11):
import tomllib
el... | 75 | 2,256 |
openvino | tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_text_vectorization.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import platform
import numpy as np
import pytest
import tensorflow as tf
from common.tf2_layer_test_class import CommonTF2LayerTest
from tensorflow.keras.layers import TextVectorization
rng = np.random.default_rng()
class TestTextVec... | 68 | 3,707 |
textual | tests/snapshot_tests/snapshot_apps/markdown_whitespace.py | .py | from textual.app import App, ComposeResult
from textual.containers import Horizontal
from textual.widgets import Markdown
MARKDOWN = (
"""\
X X
X X
X\tX
X\t\tX
""",
"""\
X \tX
X \t \tX
""",
"""\
[X X X\tX\t\tX \t \tX](https://example.com/)
_X X X\tX\t\tX \t \tX_
**X X X\tX\t\tX \t \tX**
~~X X X... | 60 | 960 |
astropy | astropy/io/fits/diff.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Facilities for diffing two FITS files. Includes objects for diffing entire
FITS files, individual HDUs, FITS headers, or just FITS data.
Used to implement the fitsdiff program.
"""
import fnmatch
import glob
import io
import operator
import os
impor... | 1,568 | 59,616 |
openvino | src/bindings/python/src/openvino/frontend/jax/__init__.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""
Package: openvino
Low level wrappers for the FrontEnd C++ API.
"""
# flake8: noqa
try:
from openvino.frontend.jax.py_jax_frontend import _FrontEndJaxDecoder as Decoder
except ImportError as err:
raise ImportError("OpenVINO ... | 15 | 431 |
mlflow | tests/tracing/utils/test_processor.py | .py | from unittest.mock import patch
import pytest
import mlflow
from mlflow.exceptions import MlflowException
from mlflow.tracing.utils.processor import validate_span_processors
from tests.tracing.helper import get_traces
@mlflow.trace
def predict(text: str):
return "Answer: " + text
@pytest.fixture(autouse=True... | 143 | 4,271 |
saleor | saleor/graphql/warehouse/tests/queries/test_warehouses_filtering.py | .py | import graphene
import pytest
from .....warehouse import WarehouseClickAndCollectOption
from .....warehouse.models import Warehouse
from ....tests.utils import get_graphql_content
QUERY_WAREHOUSES_WITH_FILTERS = """
query Warehouses($filters: WarehouseFilterInput) {
warehouses(first:100, filter: $filters) {
... | 337 | 10,288 |
ipython | IPython/lib/display.py | .py | """Various display related classes.
Authors : MinRK, gregcaporaso, dannystaple
"""
from os.path import exists, isfile, splitext, abspath, join, isdir
from os import walk, sep, fsdecode
from IPython.core.display import DisplayObject, TextDisplayObject
from collections.abc import Iterable
__all__ = ['Audio', 'IFrame'... | 702 | 24,982 |
beam | sdks/python/apache_beam/runners/worker/logger.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... | 179 | 6,761 |
saleor | saleor/graphql/discount/tests/mutations/test_sale_update.py | .py | import datetime
from unittest.mock import patch
import graphene
from django.utils import timezone
from freezegun import freeze_time
from .....discount.error_codes import DiscountErrorCode
from .....discount.models import PromotionRule, RewardValueType
from .....product.models import ProductChannelListing
from ....tes... | 946 | 31,675 |
beam | learning/tour-of-beam/learning-content/introduction/introduction-concepts/creating-collections/reading-from-text/python-example/textIo.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... | 64 | 2,278 |
saleor | saleor/graphql/order/mutations/order_discount_update.py | .py | import copy
import graphene
from django.core.exceptions import ValidationError
from ....core.tracing import traced_atomic_transaction
from ....order import events, models
from ....order.calculations import fetch_order_prices_if_expired
from ....order.error_codes import OrderErrorCode
from ....permission.enums import ... | 104 | 4,285 |
astropy | astropy/coordinates/builtin_frames/fk4_fk5_transforms.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from astropy.coordinates.baseframe import frame_transform_graph
from astropy.coordinates.matrix_utilities import matrix_transpose
from astropy.coordinates.transformations import DynamicMatrixTransform
from .fk4 import FK4NoETerms
fro... | 76 | 2,730 |
textual | tests/snapshot_tests/snapshot_apps/tabs_invalidate.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Label, TabbedContent, TabPane
class TabApp(App):
CSS = """
TabPane {
border: solid blue;
}
"""
def compose(self) -> ComposeResult:
with TabbedContent():
with TabPane("Tab 1", id="tab-1"):
... | 25 | 563 |
wandb | wandb/sdk/wandb_watch.py | .py | """watch."""
from __future__ import annotations
import logging
from collections.abc import Sequence
from typing import TYPE_CHECKING
try:
from typing import Literal
except ImportError:
from typing import Literal # type: ignore
import wandb
from .lib import telemetry
if TYPE_CHECKING:
import torch # ... | 148 | 4,762 |
luigi | test/parameter_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... | 1,385 | 53,470 |
astropy | astropy/config/tests/test_configs.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import io
import os
import re
import subprocess
import sys
from contextlib import chdir, suppress
from inspect import cleandoc
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Literal
from uuid import uuid4
import pytes... | 1,007 | 31,079 |
mamba | micromamba/tests/test_install.py | .py | import os
import platform
import shutil
import subprocess
import sys
from pathlib import Path
from packaging.version import Version
import pytest
import re
# Need to import everything to get fixtures
from .helpers import * # noqa: F403
from . import helpers
class TestInstall:
current_root_prefix = os.environ["... | 1,099 | 42,932 |
onnx | onnx/reference/ops/op_isinf.py | .py | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.op_run import OpRun
class IsInf(OpRun):
def _run(self, data, detect_negative=None, detect_positive=None):
if detect_negative:
if detect_p... | 21 | 568 |
beam | sdks/python/apache_beam/runners/direct/bundle_factory.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... | 222 | 7,587 |
mlflow | examples/mlflow-3/evaluate_example.py | .py | from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
import mlflow
from mlflow.models import infer_signature
X, y = load_iris(return_X_y=True, as_frame=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0... | 43 | 1,377 |
hydra | tools/landscape/refresh_landscape_metadata.py | .py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""Refresh live GitHub metadata used for Hydra Landscape maintenance evidence."""
from __future__ import annotations
import argparse
import json
import re
import shutil
import subprocess
from datetime import datetime, time... | 236 | 8,097 |
httpie | httpie/manager/tasks/export_args.py | .py | import argparse
import json
from httpie.cli.definition import options
from httpie.cli.options import to_data
from httpie.output.writer import write_raw_data
from httpie.status import ExitStatus
from httpie.context import Environment
FORMAT_TO_CONTENT_TYPE = {
'json': 'application/json'
}
def cli_export_args(en... | 28 | 701 |
saleor | saleor/graphql/checkout/tests/deprecated/test_checkout.py | .py | from saleor.graphql.core.utils import to_global_id_or_none
from saleor.graphql.tests.utils import get_graphql_content
CHECKOUT_QUERY = """
query getCheckout($token: UUID) {
checkout(token: $token) {
id
}
}
"""
def test_checkout_by_token(checkout, user_api_client, customer_user):
# given
check... | 26 | 641 |
sphinx | tests/roots/test-ext-autosummary-recursive/package/module.py | .py | from os import * # NoQA: F403
class Foo:
def __init__(self):
pass
def bar(self):
pass
@property
def baz(self):
pass
| 14 | 161 |
toolz | toolz/utils.py | .py | def raises(err, lamda):
try:
lamda()
return False
except err:
return True
no_default = '__no__default__'
| 10 | 139 |
pyomo | pyomo/solvers/plugins/solvers/direct_solver.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... | 222 | 9,296 |
structlog | tests/test_dev.py | .py | # SPDX-License-Identifier: MIT OR Apache-2.0
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the MIT License. See the LICENSE file in the root of this
# repository for complete details.
import pickle
import sys
from io import StringIO
from unittest import mock
import pytest
i... | 1,230 | 35,524 |
openvino | tests/model_hub_tests/pytorch/scripts/process_op_report.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
if __name__ == "__main__":
assert len(sys.argv) > 1, "Please provide filename"
filename = sys.argv[1]
if os.path.isfile(filename):
ops_dict = dict()
with open(filename, 'r') as f:
... | 28 | 866 |
conda | conda/testing/gateways/__init__.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
| 3 | 75 |
wandb | wandb/env.py | .py | """All of W&B's environment variables.
Getters and putters for all of them should go here. That way it'll be easier to
avoid typos with names and be consistent about environment variables' semantics.
Environment variables are not the authoritative source for these values in many
cases.
"""
from __future__ import ann... | 536 | 13,994 |
wandb | wandb/apis/public/integrations.py | .py | """W&B Public API for integrations.
This module provides classes for interacting with W&B integrations.
"""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, ClassVar, TypeVar
from typing_extensions import override
from wandb.apis.paginator import RelayPaginator
if TYPE_CHECKING:
from ... | 96 | 3,388 |
textual | tests/text_area/test_issue_4301.py | .py | from itertools import product
import pytest
from textual.app import App, ComposeResult
from textual.widgets import TextArea
from textual.widgets.text_area import Selection
TEST_TEXT = "\n".join(f"01234567890 - {n}" for n in range(10))
TEST_SELECTED_TEXT = "567890 - 0\n01234567890 - 1\n01234"
class TextAreaApp(App[... | 39 | 1,285 |
textual | tests/test_concurrency.py | .py | from threading import Thread
import pytest
from textual.app import App, ComposeResult
from textual.widgets import RichLog
def test_call_from_thread_app_not_running():
app = App()
# Should fail if app is not running
with pytest.raises(RuntimeError):
app.call_from_thread(print)
def test_call_fr... | 55 | 1,634 |
saleor | saleor/tests/e2e/checkout/taxes/test_order_create_from_checkout_return_tax_error.py | .py | import pytest
from ...apps.utils import add_app
from ...orders.utils import raw_order_create_from_checkout
from ...product.utils.preparing_product import prepare_product
from ...shop.utils import prepare_default_shop
from ...taxes.utils import get_tax_configurations, update_tax_configuration
from ...utils import assig... | 135 | 5,526 |
pyomo | pyomo/scripting/__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... | 11 | 595 |
openvino | tests/layer_tests/ovc_python_api_tests/test_extensions.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
import numpy as np
from common.mo_convert_test_class import CommonMOConvertTest
from common.onnx_layer_test_class import save_to_onnx
import openvino as ov
from openvino import PartialShape, Model
class TestExtensions(C... | 122 | 4,098 |
hydra | hydra/test_utils/test_utils.py | .py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
Utilities used by tests
"""
import copy
import logging
import os
import re
import shutil
import string
import subprocess
import sys
import tempfile
from contextlib import contextmanager
from difflib import unified_diff
from pathlib import Path
... | 472 | 15,175 |
sphinx | sphinx/ext/autosummary/generate.py | .py | """Generates reST source files for autosummary.
Usable as a library or script to generate automatic RST source files for
items referred to in autosummary:: directives.
Each generated RST file contains a single auto*:: directive which
extracts the docstring of the referred item.
Example Makefile rule::
generate:
... | 993 | 31,629 |
pyro | pyro/ops/gamma_gaussian.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import math
import torch
from torch.distributions.utils import lazy_property
from torch.nn.functional import pad
from pyro.distributions.multivariate_studentt import MultivariateStudentT
from pyro.distributions.torch import Multi... | 469 | 17,941 |
beam | sdks/python/apache_beam/testing/benchmarks/nexmark/models/nexmark_model.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... | 239 | 8,080 |
pyomo | pyomo/contrib/gjh/getGJH.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... | 62 | 2,090 |
colorama | demos/fixpath.py | .py | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
# Add demo dir's parent to sys path, so that 'import colorama' always finds
# the local source in preference to any installed version of colorama.
import sys
from os.path import normpath, dirname, join
local_colorama_module = normpath(join(dirn... | 9 | 384 |
cvxpy | cvxpy/reductions/dnlp2smooth/canonicalizers/power_canon.py | .py | """
Copyright 2025 CVXPY developers
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softwa... | 48 | 1,620 |
metrics | src/torchmetrics/functional/clustering/homogeneity_completeness_v_measure.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... | 115 | 4,374 |
metrics | src/torchmetrics/segmentation/dice.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... | 201 | 9,079 |
python-prompt-toolkit | docs/conf.py | .py | #
# prompt_toolkit documentation build configuration file, created by
# sphinx-quickstart on Thu Jul 31 14:17:08 2014.
#
# 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
# autogenerated file.
#
# All configuration ... | 393 | 12,672 |
voila | tests/app/prelaunch_hook_test.py | .py | # tests prelaunch hook config
import os
import pytest
from nbformat import NotebookNode
BASE_DIR = os.path.dirname(__file__)
@pytest.fixture
def voila_notebook(notebook_directory):
return os.path.join(notebook_directory, "print.ipynb")
@pytest.fixture
def voila_config():
def foo(req, notebook, cwd):
... | 44 | 1,087 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_control_dependency.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
tf.compat.v1.reset_default_graph()
# Create the graph and model
with tf.compat.v1.Session() as sess:
input1 = tf.compat.v1.placeholder(tf.float32, [2, 3], 'input1')
... | 25 | 713 |
wandb | wandb/sdk/lib/disabled.py | .py | from typing import Any
class SummaryDisabled(dict):
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__
def __getattr__(self, key):
return self[key]
def __getitem__(self, key):
val = dict.__getitem__(self, key)
if isinstance(val, dict) and not isinstance(val, Summar... | 31 | 963 |
onnx | onnx/reference/__init__.py | .py | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
__all__ = ["ReferenceEvaluator"]
from onnx.reference.reference_evaluator import ReferenceEvaluator
| 9 | 218 |
conda | tests/plugins/subcommands/conftest.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Shared fixtures for doctor and fix subcommand tests."""
from __future__ import annotations
import json
import uuid
from typing import TYPE_CHECKING, NamedTuple
import pytest
if TYPE_CHECKING:
from collections.abc import Iterable
f... | 112 | 3,395 |
wagtail | wagtail/contrib/redirects/apps.py | .py | from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class WagtailRedirectsAppConfig(AppConfig):
name = "wagtail.contrib.redirects"
label = "wagtailredirects"
verbose_name = _("Wagtail redirects")
default_auto_field = "django.db.models.AutoField"
def ready(self... | 33 | 956 |
sqlmap | thirdparty/colorama/ansitowin32.py | .py | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
import re
import sys
import os
from .ansi import AnsiFore, AnsiBack, AnsiStyle, Style, BEL
from .winterm import enable_vt_processing, WinTerm, WinColor, WinStyle
from .win32 import windll, winapi_test
winterm = None
if windll is not None:
... | 291 | 11,684 |
astropy | astropy/utils/tests/test_collections.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
from astropy.utils import collections
def test_homogeneous_list():
l = collections.HomogeneousList(int)
with pytest.raises(TypeError):
l.append(5.0)
def test_homogeneous_list2():
l = collections.HomogeneousList(int)
... | 76 | 1,737 |
astropy | astropy/timeseries/periodograms/bls/tests/test_bls.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.tests.helper import assert_quantity_allclose
from astropy.time import Time, TimeDelta
from astropy.timeseries.periodogram... | 513 | 17,516 |
astropy | astropy/table/tests/test_array.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
import pytest
from astropy.table.sorted_array import SortedArray
from astropy.table.table import Table
@pytest.fixture
def array():
# composite index
col0 = np.array([x % 2 for x in range(1, 11)])
col1 = np.array(list(ran... | 46 | 1,331 |
astropy | astropy/timeseries/io/__init__.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from .kepler import *
| 4 | 87 |
saleor | saleor/thumbnail/views.py | .py | import logging
from typing import NamedTuple
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.http import (
HttpResponse,
HttpResponseBadRequest,
HttpResponseNotFound,
HttpResponseRedirect,
)
from graphql.error import GraphQLError
from ..account.models... | 184 | 6,883 |
sqlmap | plugins/dbms/vertica/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 vertica_python
except:
pass
import logging
from lib.core.common import getSafeExString
from lib.core.data import conf
from lib.core.data import logger
from l... | 65 | 2,243 |
onnxruntime | onnxruntime/test/testdata/transform/fusion/gemm_sum_gen.py | .py | import onnx
from onnx import OperatorSetIdProto, TensorProto, helper
onnxdomain = OperatorSetIdProto()
onnxdomain.version = 12
# The empty string ("") or absence of this field implies the operator set that is defined as part of the ONNX specification.
onnxdomain.domain = ""
msdomain = OperatorSetIdProto()
msdomain.ver... | 185 | 7,106 |
pyro | tests/infer/reparam/test_neutra.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import pytest
import torch
import pyro
import pyro.distributions as dist
from pyro import optim
from pyro.distributions.transforms import ComposeTransform
from pyro.infer import MCMC, NUTS, SVI, Trace_ELBO
from pyro.infer.autoguid... | 97 | 3,101 |
onnxruntime | onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/RuntimeOptimizationRecordContainerEntry.py | .py | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: fbs
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class RuntimeOptimizationRecordContainerEntry(object):
__slots__ = ['_tab']
@classmethod
def GetRootAs(cls, buf, offset=0):
n =... | 92 | 3,741 |
pynacl | tests/test_kx.py | .py | # Copyright 2018 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... | 105 | 3,332 |
pyomo | examples/pyomobook/pyomo-components-ch/examples.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... | 32 | 1,037 |
pyro | pyro/contrib/timeseries/base.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
from pyro.nn import PyroModule, pyro_method
class TimeSeriesModel(PyroModule):
"""
Base class for univariate and multivariate time series models.
"""
@pyro_method
def log_prob(self, targets):
"""
... | 50 | 2,211 |
mlflow | mlflow/store/db_migrations/versions/de4033877273_create_entity_associations.py | .py | """create entity_associations table
Create Date: 2025-07-28 13:05:53.982327
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "de4033877273"
down_revision = "a1b2c3d4e5f6"
branch_labels = None
depends_on = None
def upgrade():
# Create entity_associations ta... | 53 | 1,596 |
saleor | saleor/graphql/product/types/__init__.py | .py | from .categories import Category, CategoryCountableConnection
from .collections import Collection, CollectionCountableConnection
from .products import (
Product,
ProductCountableConnection,
ProductMedia,
ProductType,
ProductTypeCountableConnection,
ProductVariant,
ProductVariantCountableConn... | 26 | 640 |
textual | docs/examples/guide/styles/dimensions01.py | .py | from textual.app import App, ComposeResult
from textual.widgets import Static
TEXT = """I must not fear.
Fear is the mind-killer.
Fear is the little-death that brings total obliteration.
I will face my fear.
I will permit it to pass over me and through me.
And when it has gone past, I will turn the inner eye to see i... | 28 | 756 |
wagtail | wagtail/embeds/views/chooser.py | .py | from django.forms.utils import ErrorList
from django.utils.translation import gettext as _
from wagtail.admin.modal_workflow import render_modal_workflow
from wagtail.embeds import embeds
from wagtail.embeds.exceptions import (
EmbedNotFoundException,
EmbedUnsupportedProviderException,
)
from wagtail.embeds.fi... | 90 | 3,072 |
saleor | saleor/graphql/middleware.py | .py | from .views import GraphQLView
def process_view(self, request, view_func, *args):
if hasattr(view_func, "view_class") and issubclass(
view_func.view_class, GraphQLView
):
request._graphql_view = True
| 9 | 226 |
onnx | onnx/backend/test/case/node/swiglu.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
def swiglu(a: np.ndarray, b: np.ndarray, alpha: float) -> np.ndarray:
sw... | 81 | 2,292 |
probability | tensorflow_probability/python/internal/backend/numpy/gen/linear_operator_inversion.py | .py | # Copyright 2020 The TensorFlow Probability Authors. All Rights Reserved.
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
# THIS FILE IS AUTO-GENERATED BY `gen_linear_operators.py`.
# DO NOT MODIFY DIRECTLY.
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@... | 268 | 9,968 |
pyomo | pyomo/contrib/mpc/data/scalar_data.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... | 43 | 1,577 |
wandb | wandb/integration/sklearn/plot/clusterer.py | .py | """Define plots for clustering models built with scikit-learn."""
from warnings import simplefilter
import pandas as pd
import sklearn
import wandb
from wandb.integration.sklearn import calculate, utils
# ignore all future warnings
simplefilter(action="ignore", category=FutureWarning)
def clusterer(model, X_train... | 147 | 4,917 |
cvxpy | cvxpy/reductions/canonicalization.py | .py | """
Copyright 2013 Steven Diamond, 2017 Akshay Agrawal, 2017 Robin Verschueren
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 app... | 188 | 7,392 |
wandb | wandb/plot/line.py | .py | from __future__ import annotations
from typing import TYPE_CHECKING
from wandb.plot.custom_chart import plot_table
if TYPE_CHECKING:
import wandb
from wandb.plot.custom_chart import CustomChart
def line(
table: wandb.Table,
x: str,
y: str,
stroke: str | None = None,
title: str = "",
... | 76 | 2,369 |
structlog | src/structlog/_log_levels.py | .py | # SPDX-License-Identifier: MIT OR Apache-2.0
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the MIT License. See the LICENSE file in the root of this
# repository for complete details.
"""
Extracted log level data used by both stdlib and native log level filters.
"""
from __fu... | 82 | 1,973 |
wagtail | wagtail/admin/views/collections.py | .py | from django.http import HttpResponseForbidden
from django.shortcuts import get_object_or_404, redirect
from django.utils.translation import gettext_lazy
from wagtail import hooks
from wagtail.admin import messages
from wagtail.admin.forms.collections import CollectionForm
from wagtail.admin.ui.tables import TitleColum... | 186 | 7,092 |
wagtail | wagtail/embeds/apps.py | .py | from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
from .finders import get_finders
class WagtailEmbedsAppConfig(AppConfig):
name = "wagtail.embeds"
label = "wagtailembeds"
verbose_name = _("Wagtail embeds")
default_auto_field = "django.db.models.AutoField"
... | 18 | 447 |
beam | sdks/python/apache_beam/examples/cookbook/bigquery_tornadoes.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... | 110 | 3,687 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.