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 |
|---|---|---|---|---|---|
beam | sdks/python/apache_beam/examples/cookbook/bigquery_side_input_it_test.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 71 | 2,402 |
gunicorn | tests/config/test_cfg_with_wsgi_app.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
wsgi_app = "app1:app1"
| 6 | 129 |
beam | sdks/python/apache_beam/runners/direct/transform_evaluator.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... | 1,260 | 46,585 |
pyomo | pyomo/contrib/parmest/examples/rooney_biegler/parameter_estimation_example.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... | 60 | 2,085 |
beam | sdks/python/apache_beam/utils/sharded_key.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 56 | 1,630 |
luigi | luigi/tools/__init__.py | .py | # -*- coding: utf-8 -*-
# Copyright (c) 2014 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... | 21 | 751 |
wandb | tests/system_tests/test_functional/test_tensorboard/test_tensorboardX.py | .py | """Tests for tensorboardX integration."""
import torch
import wandb
from tensorboardX import SummaryWriter
def test_add_scalar(wandb_backend_spy):
with wandb.init(sync_tensorboard=True) as run:
with SummaryWriter() as writer:
for i in range(10):
writer.add_scalar("loss", torch... | 64 | 2,263 |
mlflow | mlflow/genai/evaluation/session_utils.py | .py | """Utilities for session-level (multi-turn) evaluation."""
from __future__ import annotations
import traceback
from collections import defaultdict
from concurrent.futures import ThreadPoolExecutor
from typing import TYPE_CHECKING, Any
from mlflow.entities.assessment import Feedback
from mlflow.entities.assessment_er... | 211 | 7,657 |
pyro | tests/distributions/test_sine_skewed.py | .py | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
from math import pi
import pytest
import torch
import pyro
from pyro.distributions import Normal, SineSkewed, Uniform, VonMises, constraints
from pyro.infer import SVI, Trace_ELBO
from pyro.optim import Adam
from tests.common import ... | 108 | 2,967 |
beam | sdks/python/apache_beam/yaml/yaml_join_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... | 217 | 6,586 |
pynacl | docs/vectors/python/argondriver.py | .py | import argparse
import json
import random
import string
import subprocess
import sys
class argonRunner:
GOODCHARS = string.ascii_letters + string.digits
def __init__(self, args):
self.exe = args.exe
self.mnsaltlen = args.mnsaltlen
self.mnpwlen = args.mnpwlen
self.mndgstlen = a... | 158 | 4,614 |
wandb | wandb/integration/metaflow/errors.py | .py | import wandb
class MissingDependencyError(Exception):
"""An optional dependency is missing."""
def __init__(self, *args: object, warning: str) -> None:
super().__init__(*args)
self._wb_warning = warning
def warn(self) -> None:
"""Print a warning for the problem."""
wandb.... | 14 | 347 |
bazel | tools/build_defs/pkg/path_test.py | .py | # Copyright 2016 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | 91 | 2,749 |
probability | tensorflow_probability/python/experimental/distributions/joint_distribution_pinned_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... | 534 | 22,422 |
gunicorn | tests/requests/invalid/rfc9112_smuggle_cl_te_chunked_01.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
# RFC 9112 section 6.1: a message with both Content-Length and
# Transfer-Encoding: chunked is the classic CL.TE desync vector and MUST
# be rejected by the origin server. PortSwigger HTTP Desync corpus, CL.TE.
fro... | 10 | 388 |
gunicorn | gunicorn/asgi/__init__.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
"""
ASGI support for gunicorn.
This module provides native ASGI worker support, using gunicorn's own
HTTP parsing infrastructure adapted for async I/O.
Components:
- AsyncUnreader: Async socket reading with pushb... | 25 | 698 |
astropy | astropy/cosmology/_src/tests/io/test_html.py | .py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import astropy.units as u
from astropy.cosmology._src.io.builtin.html import (
_FORMAT_TABLE,
read_html_table,
write_html_table,
)
from astropy.table import QTable, Table, vstack
from astropy.utils.compat.optional_deps import HA... | 262 | 10,019 |
coremltools | deps/pybind11/tests/test_multiple_inheritance.py | .py | from __future__ import annotations
import pytest
import env # noqa: F401
from pybind11_tests import ConstructorStats
from pybind11_tests import multiple_inheritance as m
def test_multiple_inheritance_cpp():
mt = m.MIType(3, 4)
assert mt.foo() == 3
assert mt.bar() == 4
@pytest.mark.xfail("env.PYPY")
... | 496 | 11,910 |
voila | voila/__init__.py | .py | #############################################################################
# Copyright (c) 2018, Voilà Contributors #
# Copyright (c) 2018, QuantStack #
# #
# Distri... | 44 | 1,618 |
probability | tensorflow_probability/python/internal/backend/meta/gen_linear_operators.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... | 268 | 11,094 |
sphinx | tests/roots/test-intl_substitution_definitions/conf.py | .py | exclude_patterns = ['_build']
rst_prolog = """\
.. |subst_prolog_1| replace:: prologue substitute text
.. |subst_prolog_2| image:: /img.png
"""
rst_epilog = """\
.. |subst_epilog_1| replace:: epilogue substitute text
.. |subst_epilog_2| image:: /i18n.png
"""
| 14 | 263 |
astropy | astropy/extern/ply/yacc.py | .py | # -----------------------------------------------------------------------------
# ply: yacc.py
#
# Copyright (C) 2001-2018
# David M. Beazley (Dabeaz LLC)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions ar... | 3,434 | 135,305 |
pyomo | pyomo/solvers/tests/checks/__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... | 12 | 576 |
pyomo | pyomo/common/tests/dep_mod_except.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 | 588 |
confluent-kafka-python | tests/oauthbearer/aws/test_contract.py | .py | # Copyright 2026 Confluent Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 136 | 4,999 |
saleor | saleor/product/tests/test_product_tags.py | .py | from unittest.mock import MagicMock
import graphene
from django.core.files import File
from django.templatetags.static import static
from ...thumbnail.models import Thumbnail
from ..product_images import (
get_product_image_placeholder,
get_product_image_thumbnail_url,
)
def test_get_product_image_thumbnail... | 84 | 2,271 |
scikit-bio | skbio/io/format/_base.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.
# --------------------------------------------... | 240 | 7,599 |
gunicorn | tests/requests/valid/031.py | .py | #
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
request = {
"method": "-BLARGH",
"uri": uri("/foo"),
"version": (1, 1),
"headers": [],
"body": b""
}
| 12 | 227 |
beam | sdks/python/apache_beam/examples/inference/anomaly_detection/write_data_to_pubsub_pipeline/pipeline/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... | 68 | 2,513 |
pyomo | pyomo/repn/tests/baron/test_baron.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... | 342 | 11,416 |
cvxpy | cvxpy/problems/param_prob.py | .py | """
Copyright 2013 Steven Diamond, 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 applicable law or agreed to... | 44 | 1,602 |
hatch | tests/helpers/templates/wheel/standard_default_extra_metadata.py | .py | from hatch.template import File
from hatch.utils.fs import Path
from hatchling.__about__ import __version__
from hatchling.metadata.spec import DEFAULT_METADATA_VERSION
from ..new.feature_no_src_layout import get_files as get_template_files
from .utils import update_record_file_contents
def get_files(**kwargs):
... | 52 | 1,439 |
tqdm | tests/tests_synchronisation.py | .py | import atexit
from functools import wraps
from threading import Event, RLock, Thread, current_thread
from time import sleep, time
from tqdm import TMonitor, tqdm, trange
from .tests_tqdm import StringIO, closing, importorskip, patch_lock, skip
class Time:
"""Fake time class providing an offset"""
offset = 0... | 291 | 10,066 |
conda | tests/env/specs/test_requirements.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import pytest
from conda.env.specs.requirements import RequirementsSpec
from conda.exceptions import CondaValueError, PluginError
from conda.models.environment import Environment
from .. import support_file
def test_no_environment_file():
... | 38 | 1,075 |
probability | tensorflow_probability/python/internal/backend/numpy/gen/linear_operator_util.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.
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@... | 677 | 24,879 |
sqlmap | plugins/dbms/informix/takeover.py | .py | #!/usr/bin/env python
"""
Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
See the file 'LICENSE' for copying permission
"""
from plugins.generic.takeover import Takeover as GenericTakeover
class Takeover(GenericTakeover):
def __init__(self):
self.__basedir = None
self.__datadir = N... | 16 | 364 |
textual | docs/examples/guide/screens/screen02.py | .py | from textual.app import App, ComposeResult
from textual.screen import Screen
from textual.widgets import Static
ERROR_TEXT = """
An error has occurred. To continue:
Press Enter to return to Windows, or
Press CTRL+ALT+DEL to restart your computer. If you do this,
you will lose any unsaved information in all open appl... | 37 | 893 |
wandb | wandb/integration/keras/callbacks/metrics_logger.py | .py | from __future__ import annotations
from typing import Any, Literal
import tensorflow as tf # type: ignore
from tensorflow.keras import callbacks
import wandb
from wandb.integration.keras.keras import patch_tf_keras
from wandb.sdk.lib import telemetry
LogStrategy = Literal["epoch", "batch"]
patch_tf_keras()
cla... | 132 | 4,911 |
openvino | src/bindings/python/src/openvino/opset7/__init__.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.opset1.ops import absolute
from openvino.opset1.ops import absolute as abs
from openvino.opset1.ops import acos
from openvino.opset4.ops import acosh
from openvino.opset1.ops import add
from openvino... | 159 | 6,680 |
openvino | tests/layer_tests/onnx_tests/test_logsoftmax.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
pytest.importorskip("openvino.tools.mo", reason="Ticket - 157136")
from common.layer_test_class import check_ir_version
from common.onnx_layer_test_class import OnnxRuntimeLayerTest, onnx_make_model
fro... | 259 | 13,429 |
coveragepy | tests/covmodzip1.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
# Module-level docstrings are counted differently in different versions of Python,
# so don't add one here.
# pylint: disable=missing-module-docstring
# covmodzi... | 11 | 368 |
saleor | saleor/graphql/checkout/dataloaders/calculations.py | .py | from collections.abc import Iterable
from uuid import UUID
from promise import Promise
from ....app.models import App
from ....checkout.calculations import fetch_checkout_data
from ....checkout.fetch import CheckoutInfo, CheckoutLineInfo
from ...app.dataloaders.utils import get_app_promise
from ...core.dataloaders im... | 65 | 2,587 |
saleor | saleor/order/tests/webhooks/test_order_calculate_taxes.py | .py | import json
from unittest.mock import ANY, patch
import pytest
from freezegun import freeze_time
from ....core import EventDeliveryStatus
from ....core.models import EventDelivery
from ....core.taxes import TaxDataError
from ....graphql.webhook.subscription_payload import (
generate_payload_promise_from_subscript... | 249 | 7,977 |
deap | examples/coev/coop_evol.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 ... | 178 | 6,150 |
pyomo | pyomo/version/tests/check.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... | 21 | 733 |
openvino | tests/layer_tests/tensorflow_tests/test_tf_UnravelIndex.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
import tensorflow as tf
from common.tf_layer_test_class import CommonTFLayerTest
class TestUnravelIndex(CommonTFLayerTest):
def _prepare_input(self, inputs_info):
assert 'indices:0' in input... | 43 | 1,671 |
beam | sdks/python/apache_beam/examples/snippets/transforms/aggregation/combineperkey_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");... | 62 | 1,879 |
qutip | qutip/tests/core/data/test_dia.py | .py | import numpy as np
import scipy.sparse
import pytest
from qutip.core import data, qeye, CoreOptions
from qutip.core.data import dia, Dense, Dia
from . import conftest
# We only choose a small subset of dtypes to test so it isn't crazy.
_dtype_complex = ['complex128']
_dtype_float = ['float64']
_dtype_int = ['int32',... | 367 | 14,663 |
saleor | saleor/graphql/shop/mutations/gift_card_settings_update.py | .py | import graphene
from django.core.exceptions import ValidationError
from ....permission.enums import GiftcardPermissions
from ....site import GiftCardSettingsExpiryType
from ....site.error_codes import GiftCardSettingsErrorCode
from ...core import ResolveInfo
from ...core.doc_category import DOC_CATEGORY_GIFT_CARDS
fro... | 87 | 3,132 |
wandb | tests/system_tests/test_core/test_file_upload.py | .py | import platform
import pytest
import wandb
@pytest.mark.parametrize(
"x_primary, files",
[
(
True,
{
"wandb-metadata.json",
"wandb-summary.json",
"output.log",
"config.yaml",
"requirements.txt",
... | 66 | 1,866 |
openvino | tests/layer_tests/pytorch_tests/test_strided_const.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
from pytorch_layer_test_class import PytorchLayerTest
class TestStrides(PytorchLayerTest):
def _prepare_input(self):
import numpy as np
x = self.random.randint(0, 10, [1, 3, 2, 2], dtype=np.float32)
... | 34 | 1,058 |
probability | tensorflow_probability/examples/vq_vae.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... | 571 | 22,555 |
returns | tests/test_context/test_requires_context_result/test_context_result.py | .py | from copy import copy, deepcopy
import pytest
from returns.context import RequiresContextResult
from returns.primitives.exceptions import ImmutableStateError
def test_immutable_copy():
"""Ensures that helper returns it self when passed to copy function."""
context_result = RequiresContextResult.from_value(1... | 25 | 788 |
textual | tests/test_dynamic_bindings.py | .py | from __future__ import annotations
from textual.app import App
async def test_dynamic_disabled():
"""Check we can dynamically disable bindings."""
actions = []
class DynamicApp(App):
BINDINGS = [
("a", "register('a')", "A"),
("b", "register('b')", "B"),
("c", ... | 34 | 899 |
confluent-kafka-python | src/confluent_kafka/schema_registry/error.py | .py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2020 Confluent Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 67 | 2,171 |
mkdocs | mkdocs/utils/cache.py | .py | import datetime
import urllib.request
from typing import Callable
import mkdocs_get_deps.cache
import mkdocs
def download_url(url: str) -> bytes:
req = urllib.request.Request(url, headers={"User-Agent": f"mkdocs/{mkdocs.__version__}"})
with urllib.request.urlopen(req) as resp:
return resp.read()
d... | 37 | 1,127 |
openvino | tools/ovc/openvino/tools/ovc/help.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
def get_convert_model_help_specifics():
from openvino.tools.ovc.cli_parser import CanonicalizePathCheckExistenceAction, readable_dirs_or_files_or_empty
from openvino.tools.ovc.version import VersionChecker
return {
'i... | 49 | 2,791 |
pyro | examples/rsa/hyperbole.py | .py | # Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
"""
Interpreting hyperbole with RSA models of pragmatics.
Taken from: https://gscontras.github.io/probLang/chapters/03-nonliteral.html
"""
import argparse
import collections
import torch
from search_inference import HashingMargi... | 225 | 6,737 |
textual | src/textual/widgets/rule.py | .py | from textual.widgets._rule import (
InvalidLineStyle,
InvalidRuleOrientation,
LineStyle,
RuleOrientation,
)
__all__ = [
"InvalidLineStyle",
"InvalidRuleOrientation",
"LineStyle",
"RuleOrientation",
]
| 14 | 233 |
tablib | src/tablib/core.py | .py | """
tablib.core
~~~~~~~~~~~
This module implements the central Tablib objects.
:copyright: (c) 2016 by Kenneth Reitz. 2019 Jazzband.
:license: MIT, see LICENSE for more details.
"""
__lazy_modules__ = {
"copy",
"operator",
"tablib.exceptions",
"tablib.utils",
}
from copy import c... | 967 | 28,978 |
conda | tests/plugins/test_subcommands.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
import re
from dataclasses import dataclass
from typing import TYPE_CHECKING
import pytest
from conda import plugins
from conda.auxlib.ish import dals
from conda.base.context import context
from conda.cli.co... | 375 | 11,295 |
django-cms | cms/test_utils/project/placeholderapp/cms_apps.py | .py | from django.utils.translation import gettext_lazy as _
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
class Example1App(CMSApp):
name = _("Example1 App")
def get_urls(self, page=None, language=None, **kwargs):
return ["cms.test_utils.project.placeholderapp.urls"]
class M... | 23 | 606 |
black | tests/data/line_ranges_formatted/pattern_matching.py | .py | # flags: --minimum-version=3.10
def pattern_matching():
match status:
case 1:
return "1"
case [single]:
return "single"
case [
action,
obj,
]:
return "act on obj"
case Point(x=0):
return "class pattern"... | 26 | 537 |
sphinx | sphinx/search/pt.py | .py | """Portuguese search language."""
from __future__ import annotations
import snowballstemmer
from sphinx.search import SearchLanguage
from sphinx.search._stopwords.pt import PORTUGUESE_STOPWORDS
class SearchPortuguese(SearchLanguage):
lang = 'pt'
language_name = 'Portuguese'
js_stemmer_rawcode = 'portug... | 23 | 617 |
openvino | tools/commit_slider/utils/map_builder.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from os import walk, path
from utils.helpers import CfgError
def buildMap(commonPath, subPath=None) -> dict:
precomPath = commonPath
items = next(walk(precomPath), (None, None, []))[1]
map = {}
for item in items:
... | 29 | 838 |
openvino | src/frontends/paddle/tests/test_models/gen_scripts/generate_conv2d.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import os
import sys
from save_model import saveModel
def conv2d(name: str, x, dtype):
import paddle
paddle.enable_static()
with paddle.static.program_guard(paddle.static.Program(), paddle.static.Program(... | 38 | 1,262 |
cvxpy | cvxpy/atoms/elementwise/scalene.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... | 26 | 845 |
onnxruntime | onnxruntime/python/tools/transformers/profile_result_processor.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
"""This profiler result processor print out the kernel time spent on eac... | 359 | 12,582 |
kombu | kombu/asynchronous/aws/sqs/connection.py | .py | """Amazon SQS Connection."""
from __future__ import annotations
import json
from botocore.serialize import Serializer
from vine import transform
from kombu.asynchronous.aws.connection import AsyncAWSQueryConnection
from kombu.asynchronous.aws.ext import AWSRequest
from .ext import boto3
from .message import AsyncM... | 358 | 12,768 |
lemur | lemur/users/schemas.py | .py | """
.. module: lemur.users.schemas
: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>
"""
import re
from flask import current_app
from marshmallow import fields, validates, Validat... | 74 | 2,583 |
tqdm | tqdm/rich.py | .py | """
`rich.progress` decorator for iterators.
Usage:
>>> from tqdm.rich import trange, tqdm
>>> for i in trange(10):
... ...
"""
from warnings import warn
from rich.progress import (
BarColumn, Progress, ProgressColumn, Text, TimeElapsedColumn, TimeRemainingColumn, filesize)
from .std import TqdmExperimentalW... | 155 | 5,255 |
beam | sdks/python/apache_beam/transforms/enrichment_handlers/feast_feature_store_it_test.py | .py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | 122 | 4,209 |
confluent-kafka-python | tools/download-s3.py | .py | #!/usr/bin/env python3
#
#
# Collects CI artifacts from S3 storage, downloading them
# to a local directory.
#
# The artifacts' folder in the S3 bucket must have the following token
# format:
# <token>-[<value>]__ (repeat)
#
# Recognized tokens (unrecognized tokens are ignored):
# p - project (e.g., "confluen... | 176 | 6,002 |
coremltools | coremltools/models/ml_program/experimental/__init__.py | .py | # Copyright (c) 2025, 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 . import (
async_wrapper,
compute_plan_utils,
debugging_utils,
model_structure_path... | 15 | 370 |
beam | sdks/python/apache_beam/dataframe/io_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... | 544 | 19,480 |
textual | docs/examples/widgets/content_switcher.py | .py | from textual.app import App, ComposeResult
from textual.containers import Horizontal, VerticalScroll
from textual.widgets import Button, ContentSwitcher, DataTable, Markdown
MARKDOWN_EXAMPLE = """# Three Flavours Cornetto
The Three Flavours Cornetto trilogy is an anthology series of British
comedic genre films direct... | 66 | 1,939 |
conda | tests/testing/test_http_test_server.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Tests for HTTP test server fixtures."""
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING
import pytest
import requests
if TYPE_CHECKING:
from conda.testing.fixtures import HttpTestServerFixt... | 144 | 5,504 |
openvino | src/frontends/paddle/tests/test_models/gen_wrapper.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import glob
import os
import subprocess
import sys
print(sys.argv)
if len(sys.argv) < 3:
print("Gen folder and output folder must be specified as arguments")
sys.exit(1)
gen_folder = sys.argv[1]
out_folder = sys.argv[2]
mark_fi... | 30 | 853 |
metrics | tests/unittests/image/test_sam.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... | 133 | 5,403 |
saleor | saleor/graphql/checkout/tests/mutations/test_checkout_create.py | .py | import datetime
import warnings
from unittest import mock
from unittest.mock import ANY, patch
import graphene
import pytest
from django.test import override_settings
from django.utils import timezone
from .....channel.utils import DEPRECATION_WARNING_MESSAGE
from .....checkout import AddressType
from .....checkout.a... | 3,222 | 108,992 |
textual | docs/examples/guide/reactivity/set_reactive01.py | .py | from textual.app import App, ComposeResult
from textual.containers import Horizontal
from textual.reactive import reactive, var
from textual.widgets import Label
GREETINGS = [
"Bonjour",
"Hola",
"こんにちは",
"你好",
"안녕하세요",
"Hello",
]
class Greeter(Horizontal):
"""Display a greeting and a name... | 68 | 1,579 |
textual | tests/test_header.py | .py | from textual.app import App
from textual.screen import Screen
from textual.widgets import Header, Static
async def test_screen_title_none_is_ignored():
class MyScreen(Screen):
def compose(self):
yield Header()
class MyApp(App):
TITLE = "app title"
def on_mount(self):
... | 141 | 3,492 |
metrics | tests/unittests/image/test_csi.py | .py | # Copyright The Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 94 | 3,699 |
pyomo | pyomo/repn/tests/test_linear_template.py | .py | # ____________________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of... | 1,257 | 39,009 |
coveragepy | tests/moremodules/othermods/sub/osa.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
s = 5
t = 6
| 6 | 170 |
mlflow | mlflow/models/evaluation/calibration_curve.py | .py | import matplotlib.pyplot as plt
import numpy as np
from matplotlib.figure import Figure
from sklearn.calibration import CalibrationDisplay, calibration_curve
def make_multi_class_calibration_plot(
n_classes, y_true, y_probs, calibration_config, label_list
) -> Figure:
"""Generate one calibration plot for all ... | 113 | 4,277 |
saleor | saleor/graphql/product/tests/queries/test_product_variants_query_with_where.py | .py | import datetime
import graphene
import pytest
from django.utils import timezone
from freezegun import freeze_time
from .....product.models import ProductVariant
from ....tests.utils import get_graphql_content
PRODUCT_VARIANTS_WHERE_QUERY = """
query($where: ProductVariantWhereInput!, $channel: String) {
pr... | 175 | 5,032 |
biopython | Bio/Phylo/NewickIO.py | .py | # Copyright (C) 2009 by Eric Talevich (eric.talevich@gmail.com)
# Based on Bio.Nexus, copyright 2005-2008 by Frank Kauff & Cymon J. Cox.
# 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 s... | 381 | 12,911 |
mlflow | mlflow/store/db_migrations/versions/c3d6457b6d8a_add_status_details_column_to_jobs_table.py | .py | """add status_details column to jobs table
Create Date: 2026-03-20 09:48:33.248771
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import mssql
# revision identifiers, used by Alembic.
revision = "c3d6457b6d8a"
down_revision = "76601a5f987d"
branch_labels = None
depends_on = None
def _... | 35 | 784 |
beam | sdks/python/apache_beam/transforms/transforms_keyword_only_args_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... | 135 | 5,612 |
onnxruntime | onnxruntime/python/tools/transformers/torch_onnx_export_helper.py | .py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
import warnings
import torch
from torch._C._onnx import OperatorExport... | 83 | 3,001 |
biopython | Bio/Graphics/ColorSpiral.py | .py | # Copyright 2012 by Leighton Pritchard. 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.
"""Generate RGB colo... | 206 | 7,349 |
openvino | tests/layer_tests/pytorch_tests/test_one_hot.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
from pytorch_layer_test_class import PytorchLayerTest
class TestOneHot(PytorchLayerTest):
def _prepare_input(self):
return (self.random.randint(0, 100, (1,1000), dtype=np.int32),)
def ... | 34 | 1,060 |
mlflow | mlflow/genai/discovery/clustering.py | .py | from __future__ import annotations
import json
import logging
from pydantic import BaseModel as _BaseModel
from mlflow.entities.issue import IssueSeverity
from mlflow.genai.discovery.constants import (
CLUSTER_LABELS_PROMPT_TEMPLATE,
_format_cluster_categories,
build_cluster_summary_prompt,
)
from mlflow... | 219 | 7,874 |
hatch | backend/src/hatchling/builders/sdist.py | .py | from __future__ import annotations
import gzip
import os
import tarfile
import tempfile
from contextlib import closing
from copy import copy
from io import BytesIO
from time import time as get_current_timestamp
from typing import TYPE_CHECKING, Any
from hatchling.builders.config import BuilderConfig
from hatchling.bu... | 358 | 13,558 |
readthedocs.org | readthedocs/projects/models.py | .py | """Project models."""
import fnmatch
import hashlib
import hmac
import os
import re
from shlex import quote
from urllib.parse import urlparse
import regex
import structlog
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.contenttypes.fields import GenericRelation
from d... | 2,731 | 94,172 |
mlflow | mlflow/deployments/server/config.py | .py | from pydantic import ConfigDict
from mlflow.gateway.base_models import ResponseModel
from mlflow.gateway.config import EndpointModelInfo, Limit
class Endpoint(ResponseModel):
name: str
endpoint_type: str
model: EndpointModelInfo
endpoint_url: str
limit: Limit | None
model_config = ConfigDict... | 28 | 787 |
cvxpy | cvxpy/reductions/solvers/qp_solvers/knitro_qpif.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... | 370 | 12,142 |
saleor | saleor/graphql/plugins/mutations.py | .py | import graphene
from django.core.exceptions import ValidationError
from ...permission.enums import PluginsPermissions
from ...plugins.error_codes import PluginErrorCode
from ...plugins.manager import get_plugins_manager
from ..channel.types import Channel
from ..core import ResolveInfo
from ..core.mutations import Bas... | 108 | 3,883 |
openvino | tests/layer_tests/pytorch_tests/test_pow.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
@pytest.mark.parametrize('test_input,inplace', [
((np.array([[1, 2], [3, 4]], dtype=np.float32), np.array([[1, 1], [2, 2]], dtype=... | 141 | 6,036 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.