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 | wandb/integration/huggingface/__init__.py | .py | __all__ = ("autolog",)
from .huggingface import autolog
| 4 | 57 |
hatch | src/hatch/cli/config/__init__.py | .py | import os
import click
@click.group(short_help="Manage the config file")
def config():
pass
@config.command(short_help="Open the config location in your file manager")
@click.pass_obj
def explore(app):
"""Open the config location in your file manager."""
click.launch(str(app.config_file.path), locate=T... | 150 | 4,807 |
wagtail | wagtail/admin/tests/test_upgrade_notification.py | .py | from django.test import RequestFactory, TestCase, override_settings
from wagtail import __version__
from wagtail.admin.views.home import UpgradeNotificationPanel
from wagtail.test.utils import WagtailTestUtils
from wagtail.users.models import UserProfile
class TestUpgradeNotificationPanel(WagtailTestUtils, TestCase)... | 150 | 5,990 |
probability | tensorflow_probability/python/distributions/internal/statistical_testing_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... | 525 | 23,044 |
pymc | pymc/step_methods/hmc/nuts.py | .py | # Copyright 2024 - present The PyMC Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 490 | 20,053 |
ipython | IPython/terminal/pt_inputhooks/qt.py | .py | import sys
import os
from IPython.external.qt_for_kernel import QtCore, QtGui, enum_helper
from IPython.core.getipython import get_ipython
# If we create a QApplication, QEventLoop, or a QTimer, keep a reference to them
# so that they don't get garbage collected or leak memory when created multiple times.
_appref = No... | 91 | 3,495 |
tqdm | tqdm/keras.py | .py | from copy import copy
from functools import partial
from .auto import tqdm as tqdm_auto
try:
import keras
except (ImportError, AttributeError) as e:
try:
from tensorflow import keras
except ImportError:
raise e
__author__ = {"github.com/": ["casperdcl"]}
__all__ = ['TqdmCallback']
class ... | 124 | 4,396 |
astropy | astropy/coordinates/spectral_quantity.py | .py | import numpy as np
from astropy.units import Unit, si
from astropy.units import equivalencies as eq
from astropy.units.decorators import quantity_input
from astropy.units.quantity import Quantity, SpecificTypeQuantity
__all__ = ["SpectralQuantity"]
# We don't want to run doctests in the docstrings we inherit from Qu... | 324 | 12,384 |
deap | tests/test_creator.py | .py | # This file is part of DEAP.
#
# DEAP 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.
#
# DEAP is distributed ... | 78 | 2,611 |
sqlmap | plugins/dbms/virtuoso/fingerprint.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.common import Backend
from lib.core.common import Format
from lib.core.data import conf
from lib.core.data import kb
from lib.core.data import logger
from lib.core.e... | 90 | 2,516 |
metrics | src/torchmetrics/functional/retrieval/hit_rate.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 | 2,409 |
cvxpy | cvxpy/problems/__init__.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... | 16 | 563 |
mlflow | tests/models/test_python_api.py | .py | import datetime
import json
import os
import sys
from unittest import mock
import numpy as np
import pandas as pd
import pytest
import scipy.sparse
import mlflow
from mlflow.exceptions import MlflowException
from mlflow.models.python_api import (
_CONTENT_TYPE_CSV,
_CONTENT_TYPE_JSON,
_serialize_input_dat... | 401 | 12,834 |
beam | sdks/python/apache_beam/io/gcp/pubsub.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... | 830 | 30,824 |
sphinx | tests/test_directives/test_directive_object_description.py | .py | """Test object description directives."""
from __future__ import annotations
from typing import TYPE_CHECKING
import docutils.utils
import pytest
from docutils import nodes
from sphinx import addnodes
from sphinx.testing import restructuredtext
from sphinx.util.docutils import _parse_str_to_doctree
from tests.util... | 81 | 2,708 |
pyomo | pyomo/contrib/latex_printer/tests/test_latex_printer_vartypes.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... | 3,012 | 116,348 |
sqlmap | plugins/dbms/monetdb/enumeration.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.data import logger
from plugins.generic.enumeration import Enumeration as GenericEnumeration
class Enumeration(GenericEnumeration):
def getPasswordHashes(self):... | 39 | 1,102 |
beam | sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/apache_beam_jupyterlab_sidepanel/yaml_parse_utils.py | .py | # 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
# distributed unde... | 175 | 4,803 |
pymc | pymc/distributions/mixture.py | .py | # Copyright 2024 - present The PyMC Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 1,091 | 37,981 |
metrics | src/torchmetrics/classification/recall_fixed_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... | 515 | 25,272 |
openvino | tests/layer_tests/tensorflow2_keras_tests/test_tf2_keras_maximum.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 TestKerasMaximum(CommonTF2LayerTest):
def create_keras_maximum_net(self, input_names, input_shapes, input_type, ir_version):
... | 92 | 4,413 |
tqdm | tests/tests_concurrent.py | .py | """
Tests for `tqdm.contrib.concurrent`.
"""
import sys
from pytest import warns
from tqdm.contrib.concurrent import interpreter_map, process_map, thread_map
from .tests_tqdm import StringIO, TqdmWarning, closing, importorskip, mark, skip
def incr(x):
"""Dummy function"""
return x + 1
def test_thread_map... | 112 | 3,528 |
beam | learning/katas/python/Common Transforms/Filter/ParDo/tests/test_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"); you may not... | 36 | 1,240 |
mlflow | examples/pyfunc/model_as_code_driver.py | .py | # This is an example for logging a Python model from code using the
# mlflow.pyfunc.log_model API. When a path to a valid Python script is submitted to the
# python_model argument, the model code itself is serialized instead of the model object.
# Within the targeted script, the model implementation must be defined and... | 29 | 1,013 |
pyfilesystem2 | tests/test_permissions.py | .py | from __future__ import print_function, unicode_literals
import unittest
from six import text_type
from fs.permissions import Permissions, make_mode
class TestPermissions(unittest.TestCase):
def test_make_mode(self):
self.assertEqual(make_mode(None), 0o777)
self.assertEqual(make_mode(0o755), 0o75... | 134 | 4,692 |
onnx | onnx/backend/test/case/node/bitshift.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 BitShift(Base):
@staticmethod
def export_right_unit8() -> None... | 101 | 3,581 |
onnxruntime | onnxruntime/test/testdata/transform/fusion/create_conv_hardsigmoid.py | .py | import onnx
from onnx import TensorProto, helper
graph = helper.make_graph(
[ # nodes
# fusable, const_min_negative should be replaced
helper.make_node("Conv", ["X", "W"], ["conv0_out"], "Conv0"),
helper.make_node("HardSigmoid", ["conv0_out"], ["hardsigmoid0_out"], "HardSigmoid0"),
],
... | 22 | 716 |
ipython | IPython/core/logger.py | .py | """Logger class for IPython's logging facilities.
"""
#*****************************************************************************
# Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
# Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
#
# Distributed under the terms of the BSD License. ... | 231 | 8,523 |
pyomo | pyomo/opt/parallel/local.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... | 78 | 2,838 |
textual | docs/examples/widgets/progress_bar_styled.py | .py | from textual.app import App, ComposeResult
from textual.containers import Center, Middle
from textual.timer import Timer
from textual.widgets import Footer, ProgressBar
class StyledProgressBar(App[None]):
BINDINGS = [("s", "start", "Start")]
CSS_PATH = "progress_bar_styled.tcss"
progress_timer: Timer
... | 36 | 1,076 |
openvino | src/frontends/onnx/tests/tests_python/utils/onnx_backend.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""ONNX Backend implementation.
See ONNX documentation for details:
https://github.com/onnx/onnx/blob/master/docs/Implementing%20an%20ONNX%20backend.md
"""
from typing import Any, Optional, Text
from collections... | 137 | 4,723 |
pdm | src/pdm/builders/__init__.py | .py | from pdm.builders.editable import EditableBuilder
from pdm.builders.sdist import SdistBuilder
from pdm.builders.wheel import WheelBuilder
__all__ = ["EditableBuilder", "SdistBuilder", "WheelBuilder"]
| 6 | 201 |
clearml | clearml/backend_interface/datasets/hyper_dataset_data_view.py | .py | from typing import (
Any,
Iterable,
List,
Mapping,
Optional,
Sequence,
Tuple,
Union,
)
from ..base import IdObjectBase
from ..util import exact_match_regex, get_or_create_project, get_single_result, make_message
from ...backend_api.services import dataviews, frames
class DataViewManag... | 561 | 20,594 |
readthedocs.org | readthedocs/invitations/urls.py | .py | from django.urls import path
from readthedocs.invitations.views import RedeemInvitation
from readthedocs.invitations.views import RevokeInvitation
urlpatterns = [
path("<invitation_token>/", RedeemInvitation.as_view(), name="invitations_redeem"),
path(
"<int:invitation_pk>/revoke/",
RevokeInv... | 15 | 383 |
saleor | saleor/graphql/account/mutations/staff/customer_update.py | .py | from typing import cast
import graphene
from django.db.models import QuerySet
from .....account import events as account_events
from .....account import models
from .....account.search import update_user_search_vector
from .....core.tracing import traced_atomic_transaction
from .....core.utils.update_mutation_manager... | 253 | 9,892 |
saleor | saleor/tests/e2e/orders/discounts/test_order_product_with_percentage_promotion.py | .py | import pytest
from .....product.tasks import recalculate_discounted_price_for_products_task
from ... import DEFAULT_ADDRESS
from ...product.utils.preparing_product import prepare_product
from ...promotions.utils import create_promotion, create_promotion_rule
from ...shop.utils.preparing_shop import prepare_default_sho... | 141 | 5,675 |
probability | tensorflow_probability/python/glm/fisher_scoring.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... | 691 | 29,159 |
openvino | tests/layer_tests/jax_tests/test_argmax.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
from jax import lax
from jax import numpy as jnp
from jax_layer_test_class import JaxLayerTest
rng = np.random.default_rng(706670)
class TestArgmax(JaxLayerTest):
def _prepare_input(self):
... | 63 | 2,698 |
sphinx | sphinx/directives/admonitions.py | .py | from __future__ import annotations
from typing import TYPE_CHECKING
from docutils import nodes
from docutils.parsers.rst.directives.admonitions import BaseAdmonition
from sphinx import addnodes
from sphinx.util.docutils import SphinxDirective
if TYPE_CHECKING:
from typing import ClassVar
from docutils.node... | 108 | 2,794 |
mlflow | tests/agno/conftest.py | .py | import pytest
import mlflow
@pytest.fixture(autouse=True)
def _reset_mlflow():
from mlflow.utils.autologging_utils import AUTOLOGGING_INTEGRATIONS
for integ in AUTOLOGGING_INTEGRATIONS.values():
integ.clear()
mlflow.utils.import_hooks._post_import_hooks = {}
@pytest.fixture(autouse=True)
def m... | 18 | 396 |
astropy | astropy/visualization/wcsaxes/patches.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import sys
import warnings
import numpy as np
from matplotlib.patches import Polygon
from astropy import units as u
from astropy.coordinates import SkyCoord, rotation_matrix
from astropy.coordinates.representation import (
SphericalRepresentation,
... | 198 | 7,724 |
astropy | astropy/coordinates/builtin_frames/icrs_observed_transforms.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Contains the transformation functions for getting to "observed" systems from ICRS.
"""
import erfa
from astropy import units as u
from astropy.coordinates.baseframe import frame_transform_graph
from astropy.coordinates.builtin_frames.utils import atc... | 134 | 4,874 |
pyomo | pyomo/network/tests/test_port.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... | 558 | 17,242 |
kafka | tests/kafkatest/tests/core/quorum_reconfiguration_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 ... | 206 | 11,439 |
probability | tensorflow_probability/python/internal/slicing_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... | 289 | 11,729 |
textual | src/textual/widgets/_tab.py | .py | from textual.widgets._tabs import Tab
__all__ = ["Tab"]
| 4 | 57 |
pdm | src/pdm/resolver/uv.py | .py | from __future__ import annotations
import logging
import os
import re
import subprocess
from dataclasses import dataclass, replace
from pathlib import Path
from typing import TYPE_CHECKING, Any
from pdm._types import HiddenText
from pdm.models.candidates import Candidate
from pdm.models.markers import get_marker
from... | 217 | 9,774 |
readthedocs.org | readthedocs/builds/filters.py | .py | """Filters used in project dashboard."""
import structlog
from django.utils.translation import gettext_lazy as _
from django_filters import ChoiceFilter
from readthedocs.builds.constants import BUILD_FINAL_STATES
from readthedocs.builds.constants import BUILD_STATE_FINISHED
from readthedocs.builds.constants import EX... | 92 | 2,939 |
openvino | tests/layer_tests/tensorflow_tests/test_tf_NormalizeL2.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import platform
import pytest
from common.tf_layer_test_class import CommonTFLayerTest
class TestNormalizeL2(CommonTFLayerTest):
@staticmethod
def create_normalize_l2_net(shape, axes):
import tensorflow as tf
t... | 53 | 2,052 |
conda | tests/plugins/test_post_solves.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from conda import plugins
from conda.exceptions import DryRunExit
from conda.plugins import solvers
if TYPE_CHECKING:
from pytest_mock import MockerFixture... | 86 | 2,184 |
black | tests/data/cases/keep_newline_after_match.py | .py | # flags: --minimum-version=3.10
def http_status(status):
match status:
case 400:
return "Bad request"
case 401:
return "Unauthorized"
case 403:
return "Forbidden"
case 404:
return "Not found"
# output
def http_status(status):
... | 41 | 547 |
hatch | src/hatch/env/plugin/hooks.py | .py | from hatch.env.system import SystemEnvironment
from hatch.env.virtual import VirtualEnvironment
from hatchling.plugin import hookimpl
@hookimpl
def hatch_register_environment():
return [SystemEnvironment, VirtualEnvironment]
| 9 | 231 |
astropy | astropy/cosmology/_src/traits/matter.py | .py | """Matter component."""
import numpy as np
from numpy.typing import ArrayLike
from astropy.cosmology._src.typing import FArray
from astropy.cosmology._src.utils import aszarr
from astropy.units import Quantity
__all__ = ("MatterComponent",)
class MatterComponent:
"""The cosmology has attributes and methods for... | 46 | 1,285 |
metrics | tests/unittests/clustering/test_cluster_accuracy.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... | 86 | 3,779 |
kombu | kombu/transport/mongodb.py | .py | # copyright: (c) 2010 - 2013 by Flavio Percoco Premoli.
# license: BSD, see LICENSE for more details.
"""MongoDB transport module for kombu.
Features
========
* Type: Virtual
* Supports Direct: Yes
* Supports Topic: Yes
* Supports Fanout: Yes
* Supports Priority: Yes
* Supports TTL: Yes
Connection String
===========... | 555 | 16,786 |
pyomo | pyomo/contrib/observer/tests/test_change_detector.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... | 543 | 17,846 |
wagtail | wagtail/management/commands/set_url_paths.py | .py | import swapper
from django.core.management.base import BaseCommand
Page = swapper.load_model("wagtailcore", "Page")
class Command(BaseCommand):
help = "Resets url_path fields on each page recursively"
def set_subtree(self, root, parent=None):
root.set_url_path(parent)
root.save(update_fields... | 19 | 538 |
jupytext | tests/external/pre_commit/test_pre_commit_4_sync_execute.py | .py | import pytest
from git.exc import HookExecutionError
from nbformat.v4.nbbase import new_code_cell
from pre_commit.main import main as pre_commit
from jupytext import read, write
@pytest.mark.requires_user_kernel_python3
def test_pre_commit_hook_sync_execute(
tmpdir,
cwd_tmpdir,
tmp_repo,
jupytext_rep... | 65 | 1,862 |
mlflow | mlflow/projects/submitted_run.py | .py | import logging
import os
import signal
from abc import abstractmethod
from mlflow.entities import RunStatus
from mlflow.utils.annotations import developer_stable
_logger = logging.getLogger(__name__)
@developer_stable
class SubmittedRun:
"""
Wrapper around an MLflow project run (e.g. a subprocess running an... | 107 | 3,529 |
jupyterlab | examples/federated/main.py | .py | # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import json
import os
from jupyterlab_server import LabServerApp
HERE = os.path.abspath(os.path.dirname(__file__))
# Turn off the Jupyter configuration system so configuration files on disk do
# not affect this app.... | 48 | 1,664 |
coremltools | coremltools/converters/mil/mil/passes/tests/test_passes.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
import copy
import itertools
import unittest
from typing import Dict, Optional
import numpy as np
im... | 7,823 | 288,619 |
pyro | pyro/ops/gaussian.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import math
from typing import Optional, Tuple, Union
import torch
from torch.distributions.utils import lazy_property
from torch.nn.functional import pad
from pyro.distributions.util import broadcast_shape
from pyro.ops.tensor_u... | 716 | 28,119 |
luigi | test/contrib/bigquery_avro_test.py | .py | # -*- coding: utf-8 -*-
#
# Copyright 2019 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 or a... | 51 | 1,617 |
sqlmap | plugins/dbms/vertica/takeover.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.takeover import Takeover as GenericTakeover
class Takeover(GenericTakeover):
def osCmd(s... | 29 | 974 |
hypercorn | tests/asyncio/test_keep_alive.py | .py | from __future__ import annotations
import asyncio
from collections.abc import AsyncGenerator
import h11
import pytest
import pytest_asyncio
from hypercorn.app_wrappers import ASGIWrapper
from hypercorn.asyncio.tcp_server import TCPServer
from hypercorn.asyncio.worker_context import WorkerContext
from hypercorn.confi... | 110 | 3,982 |
beam | playground/infrastructure/conftest.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 ... | 129 | 4,498 |
sphinx | tests/test_builders/xpath_data.py | .py | from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Final
FIGURE_CAPTION: Final[str] = './/figure/figcaption/p'
| 9 | 172 |
beam | infra/keys/secret_manager.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 t... | 787 | 37,483 |
sphinx | sphinx/ext/graphviz.py | .py | """Allow graphviz-formatted graphs to be included inline in generated documents."""
from __future__ import annotations
import os.path
import re
import subprocess
import xml.etree.ElementTree as ET
from hashlib import sha1
from itertools import chain
from subprocess import CalledProcessError
from typing import TYPE_CH... | 537 | 18,061 |
hatch | src/hatch/cli/python/find.py | .py | from __future__ import annotations
from typing import TYPE_CHECKING
import click
if TYPE_CHECKING:
from hatch.cli.application import Application
@click.command(short_help="Locate Python binaries")
@click.argument("name")
@click.option("-p", "--parent", is_flag=True, help="Show the parent directory of the Pytho... | 25 | 835 |
coremltools | coremltools/converters/mil/frontend/tensorflow/tf_graph_pass/delete_disconnected_nodes.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
def delete_disconnected_nodes(gd):
# delete all nodes with no inputs and outputs
empty_nodes... | 22 | 669 |
jupyterlab | jupyterlab/_version.py | .py | # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from collections import namedtuple
VersionInfo = namedtuple("VersionInfo", ["major", "minor", "micro", "releaselevel", "serial"])
# DO NOT EDIT THIS DIRECTLY! It is managed by bumpversion
version_info = VersionInfo(... | 23 | 677 |
python-prompt-toolkit | src/prompt_toolkit/input/__init__.py | .py | from __future__ import annotations
from .base import DummyInput, Input, PipeInput
from .defaults import create_input, create_pipe_input
__all__ = [
# Base.
"Input",
"PipeInput",
"DummyInput",
# Defaults.
"create_input",
"create_pipe_input",
]
| 15 | 273 |
omegaconf | subprojects/omegaconf-pydevd/tests/test_pydevd_plugin_namespace.py | .py | import json
import os
import subprocess
import sys
from pathlib import Path
OLD_NAMESPACE_INIT = """import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
"""
FAKE_PKG_RESOURCES = """_namespaces = set()
def _package_paths(name):
import os
import sys
relpath = os.path.join(*name.split("."))... | 241 | 7,004 |
pyro | pyro/ops/einsum/util.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0 AND MIT
EINSUM_SYMBOLS_BASE = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
class Tensordot:
"""
Creates a tensordot implementation from an einsum implementation.
"""
def __init__(self, einsum):
... | 60 | 1,901 |
onnxruntime | onnxruntime/test/testdata/30_nested_loops.py | .py | import os
import tempfile
import onnx
from onnx import TensorProto, helper
import onnxruntime as ort
def make_nested_loop(depth):
if depth == 0:
body = helper.make_graph(
[
helper.make_node("Identity", ["cond_in"], ["cond_out"]),
helper.make_node("Identity", [... | 70 | 2,210 |
mlflow | mlflow/tracing/config.py | .py | from dataclasses import dataclass, field, replace
from typing import TYPE_CHECKING, Any, Callable
from mlflow.tracing.utils.processor import validate_span_processors
if TYPE_CHECKING:
from mlflow.entities.span import LiveSpan
@dataclass
class TracingConfig:
"""Configuration for MLflow tracing behavior."""
... | 124 | 4,413 |
hatch | src/hatch/index/publish.py | .py | from hatch.index.errors import ArtifactMetadataError
MULTIPLE_USE_METADATA_FIELDS = {
"classifier",
"dynamic",
"license_file",
"obsoletes_dist",
"platform",
"project_url",
"provides_dist",
"provides_extra",
"requires_dist",
"requires_external",
"supported_platform",
}
RENAME... | 104 | 3,378 |
saleor | saleor/graphql/core/utils/error_codes.py | .py | from enum import Enum
DJANGO_VALIDATORS_ERROR_CODES = [
"invalid",
"invalid_extension",
"limit_value",
"max_decimal_places",
"max_digits",
"max_length",
"max_value",
"max_whole_digits",
"min_length",
"min_value",
"null_characters_not_allowed",
]
DJANGO_FORM_FIELDS_ERROR_COD... | 51 | 1,122 |
mlflow | examples/langchain/retriever_chain.py | .py | import os
import tempfile
from langchain.document_loaders import TextLoader
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import CharacterTextSplitter
from langchain.vectorstores import FAISS
import mlflow
assert "OPENAI_API_KEY" in os.environ, "Please set the OPENAI_API_KEY e... | 43 | 1,620 |
beam | sdks/python/apache_beam/examples/snippets/transforms/aggregation/combineglobally_side_inputs_singleton.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");... | 50 | 1,863 |
saleor | saleor/tests/e2e/orders/taxes/test_order_calculate_simple_taxes_product_tax_class.py | .py | import pytest
from ... import DEFAULT_ADDRESS
from ...product.utils import update_product
from ...product.utils.preparing_product import prepare_product
from ...shop.utils.preparing_shop import prepare_shop
from ...taxes.utils import update_country_tax_rates
from ...utils import assign_permissions
from ..utils import ... | 153 | 4,932 |
pyomo | pyomo/common/tests/test_flags.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... | 49 | 1,921 |
black | tests/data/cases/cantfit.py | .py | # long variable name
this_is_a_ridiculously_long_name_and_nobody_in_their_right_mind_would_use_one_like_it = 0
this_is_a_ridiculously_long_name_and_nobody_in_their_right_mind_would_use_one_like_it = 1 # with a comment
this_is_a_ridiculously_long_name_and_nobody_in_their_right_mind_would_use_one_like_it = [
1, 2, 3... | 101 | 3,523 |
coveragepy | tests/modules/plugins/another.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
"""A plugin for tests to reference."""
from __future__ import annotations
from typing import Any
from coverage import CoveragePlugin
from coverage.plugin_suppo... | 23 | 516 |
hatch | tests/backend/utils/test_macos.py | .py | from __future__ import annotations
import platform
import pytest
from hatchling.builders.macos import normalize_macos_version, process_macos_plat_tag
@pytest.mark.parametrize(
("plat", "arch", "compat", "archflags", "deptarget", "expected"),
[
("macosx_10_9_x86_64", "x86_64", False, "", "", "macosx... | 57 | 2,185 |
pyomo | examples/pyomobook/abstract-ch/param6.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... | 35 | 1,149 |
colorama | colorama/tests/ansitowin32_test.py | .py | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
from io import StringIO, TextIOWrapper
from unittest import TestCase, main
from unittest.mock import MagicMock, Mock, patch
from contextlib import ExitStack
from ..ansitowin32 import AnsiToWin32, StreamWrapper
from ..win32 import ENABLE_VIRTUAL... | 287 | 10,521 |
confluent-kafka-python | src/confluent_kafka/aio/producer/_producer_batch_processor.py | .py | # 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 required by applicable law or agreed to in writing, s... | 333 | 13,238 |
beam | sdks/python/apache_beam/examples/snippets/transforms/aggregation/combineglobally_side_inputs_dict.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");... | 57 | 1,993 |
coveragepy | lab/show_platform.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
import platform
import types
for n in dir(platform):
if n.startswith("_"):
continue
v = getattr(platform, n)
if isinstance(v, types.ModuleTyp... | 20 | 482 |
probability | tensorflow_probability/python/distributions/masked.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... | 471 | 19,675 |
wandb | wandb/sdk/launch/registry/elastic_container_registry.py | .py | """Implementation of Elastic Container Registry class for wandb launch."""
from __future__ import annotations
import base64
import logging
from wandb.sdk.launch.errors import LaunchError
from wandb.sdk.launch.registry.abstract import AbstractRegistry
from wandb.sdk.launch.utils import (
ELASTIC_CONTAINER_REGISTR... | 194 | 7,229 |
loguru | tests/test_configure.py | .py | import sys
import pytest
from loguru import logger
def test_handlers(capsys, tmp_path):
file = tmp_path / "test.log"
handlers = [
{"sink": file, "format": "FileSink: {message}"},
{"sink": sys.stdout, "format": "StdoutSink: {message}"},
]
logger.configure(handlers=handlers)
logg... | 219 | 5,358 |
probability | tensorflow_probability/python/distributions/normal.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... | 277 | 9,432 |
pymc | tests/distributions/test_transform.py | .py | # Copyright 2024 - present The PyMC Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | 878 | 29,915 |
onnxruntime | tools/python/util/get_azcopy.py | .py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from __future__ import annotations
import contextlib
import logging
import os
import platform
import re
import shutil
import stat
import subprocess
import tempfile
import urllib.parse
import urllib.request
AZCOPY_VERSION = "... | 82 | 2,862 |
saleor | saleor/graphql/page/mutations/page_attribute_assign.py | .py | from collections import defaultdict
import graphene
from django.core.exceptions import ValidationError
from ....attribute import AttributeType, models
from ....page import models as page_models
from ....page.error_codes import PageErrorCode
from ....page.utils import mark_pages_search_vector_as_dirty_in_batches
from ... | 135 | 4,991 |
probability | tensorflow_probability/python/bijectors/bijector_composition_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... | 93 | 3,726 |
astropy | astropy/cosmology/parameters.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""This module contains dictionaries with sets of parameters for a given cosmology.
The list of cosmologies available are given by the tuple `available`.
"""
import sys
from types import MappingProxyType
from .realizations import available
__all__ = ( ... | 43 | 1,033 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.