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
mlflow
tests/test_version.py
.py
from mlflow import version def test_is_release_version(monkeypatch): monkeypatch.setattr(version, "VERSION", "1.19.0") assert version.is_release_version() monkeypatch.setattr(version, "VERSION", "1.19.0.dev0") assert not version.is_release_version()
10
269
gunicorn
tests/requests/valid/rfc9110_field_name_special_chars_01.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. # RFC 9110 section 5.6.2: token = 1*tchar; tchar includes !#$%&'*+-.^_`|~ # and alphanumerics. Dot, pipe, and other specials are legal in field-names. request = { "method": "GET", "uri": uri("/foo"), "v...
17
446
wagtail
wagtail/contrib/search_promotions/templatetags/wagtailsearchpromotions_tags.py
.py
from django import template from wagtail.contrib.search_promotions.models import Query, SearchPromotion register = template.Library() @register.simple_tag def get_search_promotions(search_query): if search_query: return Query.get(search_query).editors_picks.all() else: return SearchPromotion...
14
336
metrics
tests/unittests/regression/test_kl_divergence.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...
147
5,444
pyomo
pyomo/contrib/appsi/solvers/tests/test_ipopt_persistent.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...
57
2,347
wagtail
wagtail/contrib/forms/views.py
.py
import datetime from collections import OrderedDict import swapper from django.contrib.admin.utils import quote from django.contrib.contenttypes.models import ContentType from django.core.exceptions import PermissionDenied from django.forms import CheckboxSelectMultiple from django.http import Http404 from django.shor...
371
13,305
structlog
tests/test_testing.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 pytest import structlog from structlog import contextvars, get_config, get_logger, t...
228
6,584
textual
src/textual/widget.py
.py
""" This module contains the `Widget` class, the base class for all widgets. """ from __future__ import annotations from asyncio import create_task, gather, wait from collections import Counter from contextlib import asynccontextmanager from fractions import Fraction from time import monotonic from types import Trac...
4,957
175,691
hypercorn
src/hypercorn/middleware/wsgi.py
.py
from __future__ import annotations import asyncio from collections.abc import Callable, Iterable from functools import partial from typing import Any from ..app_wrappers import WSGIWrapper from ..typing import ASGIReceiveCallable, ASGISendCallable, Scope, WSGIFramework MAX_BODY_SIZE = 2**16 WSGICallable = Callable[...
51
1,516
pyro
pyro/contrib/gp/__init__.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 from pyro.contrib.gp import kernels, likelihoods, models, parameterized, util from pyro.contrib.gp.parameterized import Parameterized __all__ = [ "Parameterized", "kernels", "likelihoods", "models", "parameteri...
15
340
openvino
src/bindings/python/src/openvino/preprocess/__init__.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Package: openvino Low level wrappers for the PrePostProcessing C++ API. """ # flake8: noqa from openvino._pyopenvino import get_version __version__ = get_version() # main classes from openvino._pyopenvino.preprocess import InputI...
29
974
sphinx
tests/roots/test-linkcheck/conf.py
.py
root_doc = 'links' exclude_patterns = ['_build'] linkcheck_anchors = True linkcheck_timeout = 0.25
5
99
ipython
IPython/__main__.py
.py
# PYTHON_ARGCOMPLETE_OK """Terminal-based IPython entry point.""" # ----------------------------------------------------------------------------- # Copyright (c) 2012, IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed w...
14
471
openvino
src/tests/test_utils/functional_test_utils/layer_tests_summary/conformance_helper_tools/find_models_for_subgraphs_dumper.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os from argparse import ArgumentParser from pathlib import Path import sys import re sys.path.append(os.path.join(os.path.dirname(__file__), '..')) from utils.file_utils import prepare_filelist, find_latest_dir from utils.confo...
136
6,028
beam
sdks/python/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 us...
176
5,715
clearml
clearml/utilities/plotly_reporter.py
.py
import json from typing import List, Optional, Dict, Union, Tuple, Any import numpy import numpy as np from ..errors import UsageError from ..utilities.dicts import merge_dicts try: import pandas as pd except ImportError: pd = None from attr import attrs, attrib def create_2d_histogram_plot( np_row_wis...
700
22,969
kafka
tests/kafkatest/tests/core/controller_mutation_quota_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 ...
129
5,682
metrics
src/torchmetrics/image/scc.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...
84
3,256
saleor
saleor/graphql/payment/mutations/base.py
.py
from decimal import Decimal from typing import TYPE_CHECKING from django.conf import settings from django.core.exceptions import ValidationError from graphql import GraphQLError from ....checkout import models as checkout_models from ....checkout.calculations import fetch_checkout_data from ....checkout.fetch import ...
123
4,567
beam
sdks/python/apache_beam/examples/inference/table_row_inference_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...
311
9,966
wandb
tests/unit_tests/test_launch/test_agent/test_agent.py
.py
import asyncio import platform import threading from unittest.mock import MagicMock import pytest from wandb.analytics import TelemetryRecorder from wandb.errors import CommError from wandb.sdk.launch.agent.agent import ( _DEFAULT_BASE_IMAGE, InternalAgentLogger, JobAndRunStatusTracker, LaunchAgent, ) ...
1,015
31,523
flit
tests/samples/ns1-pkg2/ns1/pkg2/__init__.py
.py
""" ================== ns1.pkg2 ================== """ __version__ = '0.1'
8
76
sphinx
sphinx/directives/__init__.py
.py
"""Handlers for additional ReST directives.""" from __future__ import annotations import re from typing import TYPE_CHECKING, cast from docutils import nodes from docutils.parsers.rst import directives, roles from sphinx import addnodes from sphinx.util import docutils from sphinx.util.docfields import DocFieldTran...
386
15,629
coremltools
coremltools/converters/mil/mil/ops/helper.py
.py
# Copyright (c) 2022, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from typing import Dict, Type from coremltools.converters.mil._deployment_compatibility import Avail...
37
1,581
sqlmap
lib/core/wordlist.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import zipfile from lib.core.common import getSafeExString from lib.core.common import isZipFile from lib.core.exception import SqlmapDataException from lib.core.exception import...
101
3,562
luigi
test/contrib/spark_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...
435
16,399
mlflow
tests/genai/scorers/conftest.py
.py
"""Conftest for scorer tests - imports telemetry fixtures for telemetry testing.""" from unittest import mock import pytest import mlflow.telemetry.utils # Import telemetry fixtures from the telemetry test module # Autouse fixtures (terminate_telemetry_client, mock_requests_get) # are imported for their side effect...
28
869
textual
docs/examples/styles/scrollbar_visibility.py
.py
from textual.app import App from textual.containers import Horizontal, VerticalScroll from textual.widgets import Label 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...
28
764
coveragepy
tests/coveragetest.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 """Base test case class for coverage.py testing.""" from __future__ import annotations import collections import contextlib import datetime import glob import i...
527
20,022
metrics
src/torchmetrics/functional/retrieval/auroc.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...
65
2,663
probability
tensorflow_probability/python/math/ode/bdf.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...
856
36,717
pyro
pyro/contrib/gp/kernels/__init__.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 from pyro.contrib.gp.kernels.brownian import Brownian from pyro.contrib.gp.kernels.coregionalize import Coregionalize from pyro.contrib.gp.kernels.dot_product import DotProduct, Linear, Polynomial from pyro.contrib.gp.kernels.isotr...
65
1,483
confluent-kafka-python
tests/integration/share_consumer_sasl/test_share_consumer_sasl.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # 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 requi...
131
5,442
coremltools
coremltools/converters/sklearn/_LinearSVC.py
.py
# Copyright (c) 2017, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from ..._deps import _HAS_SKLEARN from ...models import MLModel as _MLModel if _HAS_SKLEARN: from s...
59
1,500
mlflow
tests/data/test_pandas_dataset.py
.py
import json import pandas as pd import pytest import mlflow.data from mlflow.data.code_dataset_source import CodeDatasetSource from mlflow.data.delta_dataset_source import DeltaDatasetSource from mlflow.data.evaluation_dataset import EvaluationDataset from mlflow.data.filesystem_dataset_source import FileSystemDatase...
284
9,563
biopython
Tests/test_EMBL_unittest.py
.py
# Copyright 2015 by Kai Blin. # 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 EMBL module (using unittest framework).""" import unittest import warnings from os import path from Bio im...
81
3,074
python-prompt-toolkit
tools/debug_input_cross_platform.py
.py
#!/usr/bin/env python """ Read input and print keys. For testing terminal input. Works on both Windows and Posix. """ import asyncio from prompt_toolkit.input import create_input from prompt_toolkit.keys import Keys async def main() -> None: done = asyncio.Event() input = create_input() def keys_ready...
33
630
mlflow
tests/entities/test_span_status.py
.py
import pytest from opentelemetry import trace as trace_api from opentelemetry.proto.trace.v1.trace_pb2 import Status as OTelProtoStatus from opentelemetry.trace import Status as OTelStatus from opentelemetry.trace import StatusCode as OTelStatusCode from mlflow.entities import SpanStatus, SpanStatusCode from mlflow.ex...
112
4,246
clearml
clearml/backend_api/services/v2_9/models.py
.py
""" models service This service provides a management interface for models (results of training tasks) stored in the system. """ from typing import List, Optional, Any from datetime import datetime import six from dateutil.parser import parse as parse_datetime from ....backend_api.session import ( NonStrictDataMod...
3,018
103,062
saleor
saleor/discount/tests/test_utils/test_mark_active_promotion_rules_as_dirty.py
.py
import datetime from decimal import Decimal from unittest.mock import patch import graphene from ... import RewardValueType from ...models import Promotion, PromotionRule from ...utils.promotion import mark_active_catalogue_promotion_rules_as_dirty @patch("saleor.discount.utils.promotion.PromotionRule.channels.thro...
136
4,212
onnxruntime
onnxruntime/test/testdata/transform/fusion/fast_gelu2.py
.py
import numpy as np import onnx from onnx import OperatorSetIdProto, TensorProto, helper, numpy_helper # Gelu formula: x * 0.5 * (1.0 + tanh((sqrt(2 / pi) * (x + 0.044715 * pow(x, 3))))) has_bias = False # change it to True to generate fast_gelu_openai_with_bias.onnx gelu_use_graph_input = True # change it to False t...
107
3,844
wandb
tests/system_tests/test_functional/asyncio_compat_run/pass_if_cancelled.py
.py
import asyncio import sys import threading import time from wandb.sdk.lib import asyncio_compat _got_cancelled = threading.Event() async def pass_if_cancelled() -> None: global _got_cancelled try: print(f"Ready at {time.monotonic()}", file=sys.stderr) print("TEST READY", flush=True) ...
58
1,757
pyomo
examples/pyomo/suffixes/sipopt_parametric.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...
92
3,287
astropy
astropy/io/misc/ecsv.py
.py
""" ECSV Engine Module -------------------------- This module provides functionality for reading and writing Enhanced Character Separated Values (ECSV) files using various backends, including: - `PyArrow <https://arrow.apache.org/docs/python/>`_ - `pandas <https://pandas.pydata.org/>`_ - `Astropy's ASCII engine <https:...
1,284
46,673
beam
sdks/python/apache_beam/error.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...
49
1,550
textual
docs/examples/styles/display.py
.py
from textual.app import App from textual.widgets import Static class DisplayApp(App): CSS_PATH = "display.tcss" def compose(self): yield Static("Widget 1") yield Static("Widget 2", classes="remove") yield Static("Widget 3") if __name__ == "__main__": app = DisplayApp() app.r...
17
325
beam
sdks/python/apache_beam/ml/inference/pytorch_inference.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...
616
24,376
toolz
toolz/tests/test_curried.py
.py
import toolz import toolz.curried from toolz.curried import (take, first, second, sorted, merge_with, reduce, merge, operator as cop) from collections import defaultdict from importlib import import_module from operator import add def test_take(): assert list(take(2)([1, 2, 3])) == [1, ...
118
3,724
bazel
third_party/py/mock/tests/__init__.py
.py
# Copyright (C) 2007-2012 Michael Foord & the mock team # E-mail: fuzzyman AT voidspace DOT org DOT uk # http://www.voidspace.org.uk/python/mock/
4
146
confluent-kafka-python
tests/schema_registry/test_schema_id.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2025 Confluent Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
117
3,532
pyomo
pyomo/gdp/plugins/binary_multiplication.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...
174
7,213
mlflow
mlflow/agno/autolog_v2.py
.py
""" Autologging logic for Agno V2 (>= 2.0.0) using OpenTelemetry instrumentation. """ import importlib.metadata as _meta import logging from opentelemetry import trace from opentelemetry.context import Context from opentelemetry.trace import Tracer, TracerProvider from mlflow.exceptions import MlflowException from m...
127
4,527
ipython
IPython/sphinxext/ipython_directive.py
.py
""" Sphinx directive to support embedded IPython code. IPython provides an extension for `Sphinx <http://www.sphinx-doc.org/>`_ to highlight and run code. This directive allows pasting of entire interactive IPython sessions, prompts and all, and their code will actually get re-executed at doc build time, with all pro...
1,301
45,961
pyomo
pyomo/contrib/mindtpy/tests/test_mindtpy_regularization.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...
273
10,598
coremltools
coremltools/converters/mil/mil/ops/tests/iOS17/test_tensor_transformation.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import numpy as np import pytest from coremltools.converters.mil.mil import Builde...
382
13,613
black
tests/data/miscellaneous/invalid_header.py
.py
This is not valid Python syntax y = "This is valid syntax"
3
59
metrics
src/torchmetrics/functional/regression/mse.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...
83
2,893
mkdocs-material
material/plugins/offline/plugin.py
.py
# Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com> # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, c...
70
2,884
wandb
tests/unit_tests/test_launch/test_internal_api.py
.py
import json from unittest.mock import MagicMock import pytest from wandb.apis import internal from wandb.errors import CommError from wandb.sdk.lib.service.service_connection import WandbApiFailedError def test_push_to_run_queue_by_name(): _api = internal.Api() mock_run_spec = {"test-key": "test-value"} ...
94
2,927
pyomo
pyomo/core/tests/unit/kernel/test_conic.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...
864
31,734
toolz
bench/test_curry.py
.py
from toolz.curried import get pairs = [(1, 2) for i in range(100000)] def test_get_curried(): first = get(0) for p in pairs: first(p)
11
154
saleor
saleor/graphql/attribute/mutations/utils.py
.py
from django.db.models import Exists, OuterRef from ....attribute import models from ....page import models as page_models from ....product import models as product_models def get_product_ids_to_search_index_update_for_attribute_values( values: list[models.AttributeValue], ) -> list[int]: """Get product IDs t...
53
1,992
saleor
saleor/tests/e2e/account/account/test_should_not_be_able_to_login_with_invalid_credentials.py
.py
from unittest.mock import patch import pytest from saleor.account.throttling import get_cache_key_blocked_ip from ...shop.utils import prepare_shop from ...utils import assign_permissions from ..utils import account_register, raw_token_create @pytest.mark.e2e @patch("saleor.account.throttling.get_client_ip") @patc...
94
2,886
beam
sdks/python/apache_beam/runners/portability/stager_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...
1,018
40,821
beam
sdks/python/apache_beam/examples/windowed_wordcount.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...
102
3,217
lemur
lemur/tests/plugins/notification_plugin.py
.py
from lemur.plugins.bases import NotificationPlugin class TestNotificationPlugin(NotificationPlugin): title = "Test" slug = "test-notification" description = "Enables testing" author = "Kevin Glisson" author_url = "https://github.com/netflix/lemur.git" def __init__(self, *args, **kwargs): ...
18
463
mlflow
tests/store/model_registry/test_sqlalchemy_workspace_store.py
.py
import shutil import uuid import pytest from mlflow.entities.model_registry import ModelVersionTag, RegisteredModelTag from mlflow.entities.webhook import WebhookAction, WebhookEntity, WebhookEvent from mlflow.environment_variables import MLFLOW_ENABLE_WORKSPACES from mlflow.exceptions import MlflowException from mlf...
382
17,001
pyomo
examples/pyomo/transform/scaling_ex.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...
94
3,371
wandb
wandb/wandb_agent.py
.py
from __future__ import annotations import contextlib import enum import logging import multiprocessing import os import platform import queue import re import signal import socket import subprocess import sys import time import traceback from collections.abc import Callable from typing import Any import wandb from wa...
835
31,764
pyomo
pyomo/mpec/tests/test_complementarity.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...
545
17,224
wandb
wandb/apis/public/utils.py
.py
from __future__ import annotations import re from enum import Enum from urllib.parse import urlparse from wandb._iterutils import one from wandb.sdk.internal.internal_api import Api as InternalApi def parse_s3_url_to_s3_uri(url) -> str: """Convert an S3 HTTP(S) URL to an S3 URI. Arguments: url (str...
107
3,691
mlflow
tests/gateway/test_budget_tracker.py
.py
from datetime import datetime, timedelta, timezone from unittest.mock import patch import pytest from mlflow.entities.gateway_budget_policy import ( BudgetAction, BudgetDuration, BudgetDurationUnit, BudgetTargetScope, BudgetUnit, GatewayBudgetPolicy, ) from mlflow.gateway.budget_tracker import...
654
23,334
saleor
saleor/graphql/core/types/model.py
.py
from typing import Generic, TypeVar from uuid import UUID from django.db.models import Model, Q from graphene.types.objecttype import ObjectTypeOptions from ..doc_category import DOC_CATEGORY_MAP from . import TYPES_WITH_DOUBLE_ID_AVAILABLE from .base import BaseObjectType class ModelObjectOptions(ObjectTypeOptions...
86
2,799
readthedocs.org
readthedocs/core/notifications.py
.py
"""Read the Docs notifications.""" import textwrap from django.utils.translation import gettext_lazy as _ from readthedocs.notifications.constants import TIP from readthedocs.notifications.constants import WARNING from readthedocs.notifications.messages import Message from readthedocs.notifications.messages import r...
57
1,885
omegaconf
build_helpers/get_vendored.py
.py
import re import shutil import subprocess from functools import partial from itertools import chain from pathlib import Path from typing import Callable, FrozenSet, Generator, List, Set, Tuple, Union WHITELIST = {"README.txt", "__init__.py", "vendor.txt"} def delete_all( *paths: Path, whitelist: Union[Set[str], ...
138
4,664
saleor
saleor/warehouse/tests/webhooks/subscriptions/test_channel_stock_events.py
.py
import json import graphene import pytest from .....webhook.event_types import WebhookEventAsyncType from .....webhook.transport.asynchronous.transport import ( create_deliveries_for_subscriptions, ) from ....interface import VariantChannelStockInfo PRODUCT_VARIANT_OUT_OF_STOCK_IN_CHANNEL = """ subscription{...
201
6,000
httpie
httpie/__init__.py
.py
""" HTTPie: modern, user-friendly command-line HTTP client for the API era. """ __version__ = '3.2.4' __date__ = '2024-11-01' __author__ = 'Jakub Roztocil' __licence__ = 'BSD'
10
178
astropy
astropy/modeling/convolution.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Convolution Model.""" # pylint: disable=line-too-long, too-many-lines, too-many-arguments, invalid-name import numpy as np from .core import CompoundModel class Convolution(CompoundModel): """ Wrapper class for a convolution model. Par...
117
4,085
pyro
pyro/optim/multi.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 from typing import Dict, List import torch from pyro.ops.newton import newton_step from pyro.optim.optim import PyroOptim class MultiOptimizer: """ Base class of optimizers that make use of higher-order derivatives. ...
169
6,391
sqlmap
tests/test_keyset_engine.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission The keyset (seek) pagination dump engine (lib/utils/keysetdump.py). Large tables are dumped one row at a time by seeking on an indexed cursor (a row-id or the primary key). For a COM...
110
4,428
returns
tests/test_context/test_requires_context_ioresult/test_requires_context_ioresult_cast.py
.py
from returns.context import ( ReaderIOResult, ReaderIOResultE, RequiresContextIOResult, RequiresContextIOResultE, ) def _function(arg: int) -> RequiresContextIOResultE[float, int]: if arg == 0: return RequiresContextIOResult.from_failure( ZeroDivisionError('Divided by 0'), ...
34
1,185
gunicorn
tests/dirty/test_worker_streaming.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """Tests for dirty worker streaming functionality.""" import asyncio import struct from unittest import mock import pytest from gunicorn.dirty.protocol import ( DirtyProtocol, BinaryProtocol, make_re...
423
14,455
mlflow
mlflow/store/artifact/cloud_artifact_repo.py
.py
import logging import math import os import posixpath import time from abc import abstractmethod from concurrent.futures import as_completed from typing import NamedTuple from mlflow.environment_variables import ( _MLFLOW_MPD_NUM_RETRIES, _MLFLOW_MPD_RETRY_INTERVAL_SECONDS, MLFLOW_ENABLE_MULTIPART_DOWNLOAD...
330
13,307
openvino
tests/layer_tests/tensorflow_lite_tests/test_tfl_ArgValue.py
.py
import pytest import tensorflow as tf from common.tflite_layer_test_class import TFLiteLayerTest from common.utils.tflite_utils import additional_test_params from common.utils.tflite_utils import parametrize_tests test_ops = [ {'op_name': 'ARG_MAX', 'op_func': 'tf.math.argmax'}, {'op_name': 'ARG_MIN', 'op_fun...
42
1,513
coremltools
deps/protobuf/python/google/protobuf/internal/enum_type_wrapper.py
.py
# Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. All rights reserved. # https://developers.google.com/protocol-buffers/ # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redi...
116
4,469
onnxruntime
onnxruntime/test/python/transformers/test_qmoe_cpu.py
.py
# -------------------------------------------------------------------------- # Copyright 2020 The HuggingFace Inc. 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/l...
1,899
78,241
onnx
onnx/backend/test/case/node/greater.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 Greater(Base): @staticmethod def export() -> None: nod...
69
2,452
astropy
astropy/time/tests/test_precision.py
.py
import contextlib import decimal import functools import warnings from datetime import datetime, timedelta from decimal import Decimal import erfa import numpy as np import pytest from erfa import ErfaError, ErfaWarning from hypothesis import assume, example, given, target from hypothesis.extra.numpy import array_shap...
837
29,156
saleor
saleor/app/tests/fixtures/app_extension.py
.py
import pytest from ....app.models import AppExtension @pytest.fixture def app_with_extensions(app_with_token, permission_manage_products): first_app_extension = AppExtension( app=app_with_token, label="Create product with App", url="www.example.com/app-product", mount="product_ove...
50
1,543
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_rnn_lstm.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import os from save_model import saveModel import sys def _get_framework_pb2(): try: from paddle.fluid.proto import framework_pb2 return framework_pb2 except Exception: pass try: ...
152
5,070
mlflow
mlflow/claude_code/tracing.py
.py
"""MLflow tracing integration for Claude Code interactions.""" import dataclasses import json import logging import os import sys from datetime import datetime from pathlib import Path from typing import Any import dateutil.parser import mlflow from mlflow.claude_code.config import ( MLFLOW_TRACING_ENABLED, ...
882
32,646
django-cms
cms/test_utils/project/sampleapp/views.py
.py
# Create your views here. from django.http import Http404 from django.shortcuts import render from django.utils.translation import gettext_lazy as _ from django.views.decorators.csrf import csrf_exempt from django.views.generic.base import TemplateView from cms.test_utils.project.sampleapp.models import Category from ...
79
2,443
readthedocs.org
readthedocs/subscriptions/forms.py
.py
"""Subscriptions forms.""" from django import forms from django.utils.translation import gettext_lazy as _ from djstripe import models as djstripe from readthedocs.subscriptions.products import get_listed_products class PlanForm(forms.Form): """Form to create a subscription after the previous one has ended.""" ...
31
1,075
probability
discussion/robust_inverse_graphics/util/array_util.py
.py
# Copyright 2024 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...
37
1,093
biopython
Bio/Alphabet/__init__.py
.py
# Copyright 2000-2002 by Andrew Dalke. # Revisions copyright 2007-2010 by Peter Cock. # 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 ...
23
1,201
mlflow
mlflow/gateway/providers/palm.py
.py
import time import warnings from typing import Any from mlflow.gateway.config import EndpointConfig, PaLMConfig from mlflow.gateway.exceptions import AIGatewayException from mlflow.gateway.providers.base import BaseProvider from mlflow.gateway.providers.utils import rename_payload_keys, send_request from mlflow.gatewa...
230
8,158
saleor
saleor/graphql/account/mutations/staff/staff_update.py
.py
from typing import cast import graphene from django.core.exceptions import ValidationError from .....account import models from .....account.error_codes import AccountErrorCode from .....core.tracing import traced_atomic_transaction from .....giftcard.search import mark_gift_cards_search_index_as_dirty from .....gift...
203
7,510
bazel
tools/ctexplain/types_test.py
.py
# Copyright 2020 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...
69
2,423
saleor
saleor/graphql/payment/dataloaders.py
.py
from collections import defaultdict from ...payment.models import Payment, Transaction, TransactionEvent, TransactionItem from ..core.dataloaders import DataLoader class TransactionEventByTransactionIdLoader(DataLoader[int, list[TransactionEvent]]): context_key = "transaction_event_by_transaction_id" def ba...
58
2,083
saleor
saleor/webhook/tests/fixtures/webhook_data.py
.py
import pytest from ....webhook.observability import WebhookData @pytest.fixture def observability_webhook_data(observability_webhook): return WebhookData( id=observability_webhook.id, saleor_domain="example.com", target_url=observability_webhook.target_url, secret_key=observabilit...
14
348