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
examples/supply_chain_security/train.py
.py
import sklearn import mlflow # Use explicit model logging to control the conda environment and pip requirements mlflow.sklearn.autolog(log_models=False) # Load data X, y = sklearn.datasets.load_diabetes(return_X_y=True) X_train, X_test, y_train, y_test = sklearn.model_selection.train_test_split( X, y, test_size=...
27
707
openvino
tests/stress_tests/scripts/compare_memcheck_2_runs.py
.py
#!/usr/bin/env python3 # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Create comparison table based on MemCheckTests results from 2 runs Usage: ./scrips/compare_memcheck_2_runs.py cur_source ref_source \ --db_collection collection_name --out_file file_name """ # pylint:di...
208
8,785
mlflow
mlflow/semantic_kernel/tracing_utils.py
.py
import logging from typing import Any from opentelemetry import context as otel_context_api from opentelemetry import trace as otel_trace from opentelemetry.trace import get_current_span from semantic_kernel.contents.chat_history import ChatHistory from semantic_kernel.contents.kernel_content import KernelContent from...
167
7,098
beam
learning/tour-of-beam/learning-content/introduction/introduction-concepts/pipeline-concepts/creating-pipeline/python-example/task.py
.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); y...
44
1,360
hydra
tests/test_env_defaults.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from pathlib import Path from hydra.test_utils.test_utils import chdir_hydra_root, run_python_script chdir_hydra_root() def test_env_defaults(tmpdir: Path) -> None: cmd = [ "tests/test_apps/custom_env_defaults/my_app.py", f'h...
16
416
mlflow
mlflow/entities/run_info.py
.py
from mlflow.entities._mlflow_object import _MlflowObject from mlflow.entities.lifecycle_stage import LifecycleStage from mlflow.entities.run_status import RunStatus from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE from mlflow.protos.service_pb2 import RunInf...
187
5,898
saleor
saleor/graphql/product/tests/queries/variants_where/test_over_references_categories.py
.py
import pytest from ......attribute import AttributeEntityType, AttributeInputType, AttributeType from ......attribute.models import Attribute, AttributeValue from ......attribute.utils import associate_attribute_values_to_instance from .....core.utils import to_global_id_or_none from .....tests.utils import get_graphq...
293
9,729
mlflow
tests/integration/async_logging/test_async_logging_integration.py
.py
import io import pickle import time import uuid import pytest import mlflow from mlflow import MlflowClient from mlflow.entities.metric import Metric from mlflow.entities.param import Param from mlflow.entities.run_tag import RunTag @pytest.fixture(autouse=True) def flush_async_logging(): """Flush async logging...
241
8,250
biopython
Bio/SearchIO/InfernalIO/_base.py
.py
# Copyright 2024 by Samuel Prince. All rights reserved. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included as part of this # package. """Bio.SearchIO base cla...
40
1,415
conda
tests/gateways/test_repodata_lock.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import annotations import multiprocessing import sys import traceback from typing import TYPE_CHECKING import pytest from conda.base.context import context, reset_context from conda.common.compat import on_win from conda.gatew...
100
3,136
tqdm
tqdm/cli.py
.py
""" Module version for monitoring CLI pipes (`... | python -m tqdm | ...`). """ import logging import re import sys from ast import literal_eval from textwrap import indent from .std import TqdmKeyError, TqdmTypeError, tqdm from .version import __version__ __all__ = ["main"] log = logging.getLogger(__name__) def ca...
325
11,011
openvino
tools/benchmark_tool/openvino/tools/benchmark/utils/statistics_report.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import abc import json import csv import numpy as np from enum import Enum from datetime import timedelta from typing import Any from .logging import logger ## statistics reports types noCntReport = 'no_counters' averageCntRep...
297
13,001
openvino
src/bindings/python/docs/examples/custom_module/__init__.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino.helpers.custom_module.custom_helpers import top1_index
6
176
cvxpy
cvxpy/atoms/affine/imag.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...
52
1,414
onnx
onnx/reference/ops/op_equal.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops._op import OpRunBinaryComparison class Equal(OpRunBinaryComparison): def _run(self, a, b): return (np.equal(a, b),)
14
291
tqdm
examples/simple_examples.py
.py
""" # Simple tqdm examples and profiling # Benchmark for i in range(int(1e8)): pass # Basic demo import tqdm for i in tqdm.trange(int(1e8)): pass # Some decorations import tqdm for i in tqdm.trange(int(1e8), miniters=int(1e6), ascii=True, desc="cool", dynamic_ncols=True): pass # Nes...
65
1,352
kafka
tests/kafkatest/utils/transactions_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 under the Li...
56
2,355
beam
sdks/python/apache_beam/testing/benchmarks/nexmark/nexmark_launcher.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...
530
18,327
mlflow
tests/genai/prompts/test_prompts.py
.py
import json import threading import time from concurrent.futures import ThreadPoolExecutor from unittest import mock import jinja2 import pytest from pydantic import BaseModel, ValidationError import mlflow from mlflow import MlflowClient from mlflow.entities.model_registry import PromptModelConfig, PromptVersion fro...
2,098
75,531
saleor
saleor/webhook/tests/subscription_webhooks/test_create_deliveries_for_translation_subscription.py
.py
import json import graphene from ...event_types import WebhookEventAsyncType from ...transport.asynchronous.transport import create_deliveries_for_subscriptions def test_translation_created_product( product_translation_fr, subscription_product_translation_created_webhook ): webhooks = [subscription_product_...
818
28,538
beam
sdks/python/apache_beam/transforms/enrichment_handlers/bigquery_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...
502
17,768
sphinx
tests/test_theming/test_templating.py
.py
"""Test templating.""" from __future__ import annotations from typing import TYPE_CHECKING import pytest if TYPE_CHECKING: from collections.abc import Callable from sphinx.testing.fixtures import _app_params from sphinx.testing.util import SphinxTestApp @pytest.mark.sphinx('html', testroot='templatin...
61
1,740
black
tests/data/cases/pyi_docstring_blank_lines_no_preview.py
.py
# flags: --pyi import sys class C: def before_comment(self) -> None: """docs""" # leading comment for the next method def after_comment(self) -> None: ... def before_if(self) -> None: """docs""" if sys.version_info >= (3, 12): if_attr: int
13
285
hydra
plugins/hydra_ax_sweeper/hydra_plugins/hydra_ax_sweeper/config.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from dataclasses import dataclass, field from typing import Any, Dict, List, Optional from hydra.core.config_store import ConfigStore @dataclass class EarlyStopConfig: minimize: bool = True max_epochs_without_improvement: int = 10 #...
67
2,046
pyomo
doc/OnlineDocs/src/scripting/iterative2.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...
50
1,357
mlflow
dev/proto_to_graphql/autogeneration_utils.py
.py
import re import sys import git from string_utils import camel_to_snake, snake_to_pascal def get_git_root(): repo = git.Repo(".", search_parent_directories=True) return repo.working_tree_dir + "/" INDENT = " " * 4 INDENT2 = INDENT * 2 SCHEMA_EXTENSION_MODULE = "mlflow.server.graphql.graphql_schema_extensio...
44
1,412
probability
tensorflow_probability/python/bijectors/glow.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...
896
39,800
openvino
tests/samples_tests/smoke_tests/test_model_creation_sample.py
.py
""" Copyright (C) 2018-2026 Intel Corporation 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 w...
38
1,764
probability
tensorflow_probability/python/math/psd_kernels/pointwise_exponential.py
.py
# Copyright 2021 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
72
2,590
metrics
src/torchmetrics/functional/clustering/normalized_mutual_info_score.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...
60
2,104
coremltools
coremltools/converters/mil/mil/ops/defs/iOS17/quantization_ops.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 Optional, Tuple import numpy as np from coremltools.converters.mil.mil import Var...
244
9,696
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_pool3d.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # pool3d paddle model generator # import numpy as np import sys from save_model import saveModel data_type = "float32" def pool3d(name: str, x, attrs: dict): import paddle paddle.enable_static() with paddle.static.prog...
325
10,935
hatch
tests/helpers/templates/wheel/standard_default_python_constraint_three_components.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): ...
50
1,289
mlflow
tests/store/artifact/test_databricks_sdk_artifact_repo.py
.py
import importlib.metadata from unittest import mock import pytest from mlflow.store.artifact.databricks_sdk_artifact_repo import _sdk_supports_large_file_uploads def test_sdk_supports_large_file_uploads_true(): with mock.patch("importlib.metadata.version", return_value="0.45.0") as mock_version: assert ...
33
1,265
astropy
astropy/coordinates/tests/test_intermediate_transformations.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Accuracy tests for GCRS coordinate transformations, primarily to/from AltAz.""" import warnings import erfa import numpy as np import pytest from astropy import units as u from astropy.coordinates import ( CIRS, GCRS, HCRS, ICRS, ...
1,158
43,853
pyomo
pyomo/contrib/alternative_solutions/lp_enum.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...
329
13,298
textual
tests/snapshot_tests/snapshot_apps/progress_gradient.py
.py
from textual.app import App, ComposeResult from textual.color import Gradient from textual.widgets import ProgressBar class ProgressApp(App[None]): def compose(self) -> ComposeResult: gradient = Gradient.from_colors( "#881177", "#aa3355", "#cc6666", "#ee9944...
30
715
wandb
tests/system_tests/test_functional/xgboost/classification.py
.py
import pathlib import pandas as pd import wandb from sklearn.model_selection import train_test_split from wandb.integration.xgboost import WandbCallback from xgboost import XGBClassifier # Generated using: # # from sklearn.datasets import load_wine # # load_wine(as_frame=True).frame.sample(n=100).to_csv(..., inde...
38
951
mlflow
mlflow/store/db/workspace_utils.py
.py
"""Shared helpers for workspace-related database operations. Used by both ``workspace_migration`` (migrate-to-default-workspace) and ``workspace_move`` (move-resources). """ from __future__ import annotations import sqlalchemy as sa # Child tables of registered_models that carry their own workspace column. # These ...
65
2,142
wandb
tests/unit_tests/test_dir_watcher.py
.py
"""dir_watcher tests.""" from __future__ import annotations import os import tempfile import time from collections.abc import Callable from pathlib import Path from typing import TYPE_CHECKING from unittest.mock import Mock, patch import pytest import wandb.filesync.dir_watcher from wandb.filesync.dir_watcher import...
264
8,077
lemur
lemur/endpoints/schemas.py
.py
""" .. module: lemur.endpoints.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> """ from marshmallow import fields from lemur.common.schema import LemurOutputSchema from ...
49
1,445
saleor
saleor/warehouse/tests/fixtures/__init__.py
.py
from .allocation import * # noqa: F403 from .preorder_allocation import * # noqa: F403 from .stock import * # noqa: F403 from .warehouse import * # noqa: F403
5
163
lemur
lemur/domains/service.py
.py
""" .. module: lemur.domains.service :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from sqlalchemy import and_ from flask import current_app, g from lemur import databas...
136
3,513
wagtail
wagtail/contrib/forms/panels.py
.py
from django.utils.functional import cached_property from django.utils.translation import gettext as _ from wagtail.admin.panels import Panel class FormSubmissionsPanel(Panel): def on_model_bound(self): if not self.heading: self.heading = _("%(model_name)s submissions") % { "mo...
47
1,556
openvino
tests/layer_tests/onnx_tests/test_image_scaler.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from common.onnx_layer_test_class import OnnxRuntimeLayerTest, onnx_make_model class TestImageScaler(OnnxRuntimeLayerTest): def create_net(self, shape, scale, ir_version): """ O...
166
5,238
tqdm
tqdm/_monitor.py
.py
import atexit from threading import Event, Thread, current_thread from time import time from warnings import warn __all__ = ["TMonitor", "TqdmSynchronisationWarning"] class TqdmSynchronisationWarning(RuntimeWarning): """ tqdm multi-thread/-process errors which may cause incorrect nesting but otherwise no...
105
4,013
coremltools
coremltools/converters/mil/mil/passes/defs/cleanup/remove_symbolic_reshape.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 from coremltools import _logger as logger from coremltools.converters.mil.mil import Builder as mb f...
96
3,848
lemur
lemur/plugins/bases/destination.py
.py
""" .. module: lemur.plugins.bases.destination :platform: Unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from lemur.plugins.base import Plugin, plugins class DestinationPlugin(Plugi...
62
1,826
python-prompt-toolkit
src/prompt_toolkit/clipboard/base.py
.py
""" Clipboard for command line interface. """ from __future__ import annotations from abc import ABCMeta, abstractmethod from collections.abc import Callable from prompt_toolkit.selection import SelectionType __all__ = [ "Clipboard", "ClipboardData", "DummyClipboard", "DynamicClipboard", ] class C...
110
2,524
saleor
saleor/graphql/product/dataloaders/__init__.py
.py
from .attributes import ( ProductAttributesAllByProductTypeIdLoader, ProductAttributesVisibleInStorefrontByProductTypeIdLoader, VariantAttributesAllByProductTypeIdLoader, VariantAttributesVisibleInStorefrontByProductTypeIdLoader, ) from .products import ( AvailableProductVariantsByProductIdAndChanne...
84
3,341
mlflow
tests/pyfunc/test_backward_compatibility.py
.py
import pytest import mlflow @pytest.mark.parametrize("version", ["2.7.1", "2.8.1"]) def test_backward_compatibility(version): model = mlflow.pyfunc.load_model(f"tests/resources/pyfunc_models/{version}") assert model.predict("MLflow is great!") == "MLflow is great!"
10
277
jupytext
tests/data/notebooks/outputs/ipynb_to_script/The flavors of raw cells.py
.py
# --- # jupyter: # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # + raw_mimetype="text/latex" active="" # $1+1$ # + raw_mimetype="text/restructuredtext" active="" # :math:`1+1` # + raw_mimetype="text/html" active="" # <b>Bold text<b> # + raw_mimetype="text/markdown" ac...
26
427
wagtail
wagtail/documents/tests/test_views.py
.py
import os.path import unittest import urllib from unittest import mock from django.conf import settings from django.core.files.base import ContentFile from django.test import TestCase, override_settings from django.urls import reverse from wagtail.documents import models @override_settings(WAGTAILDOCS_SERVE_METHOD=...
449
15,912
mlflow
mlflow/utils/string_utils.py
.py
import re import shlex from datetime import datetime from typing import Any from mlflow.utils.os import is_windows def strip_prefix(original: str, prefix: str) -> str: if original.startswith(prefix): return original[len(prefix) :] return original def strip_suffix(original: str, suffix: str) -> str:...
191
6,079
saleor
saleor/graphql/giftcard/tests/test_user_delete_deactivates_assigned_cards.py
.py
import graphene from ....account.models import User from ....core.tokens import account_delete_token_generator from ....giftcard import GiftCardEvents from ....giftcard.models import GiftCardEvent from ...tests.utils import get_graphql_content CUSTOMER_DELETE = """ mutation CustomerDelete($id: ID!) { cust...
161
5,054
wagtail
wagtail/wagtail_hooks.py
.py
from typing import TYPE_CHECKING import swapper from django.conf import settings from django.contrib.auth.models import Permission from django.contrib.auth.views import redirect_to_login from django.db import models from django.urls import reverse from django.utils.cache import add_never_cache_headers from django.util...
611
24,365
astropy
astropy/cosmology/_src/io/builtin/model.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """|Cosmology| <-> Model I/O, using |Cosmology.to_format| and |Cosmology.from_format|. This module provides functions to transform a |Cosmology| object to and from a :class:`~astropy.modeling.Model`. The functions are registered with ``convert_registry`` ...
300
10,627
saleor
saleor/tests/e2e/shipping_zone/utils/shipping_price_update.py
.py
from ...utils import get_graphql_content SHIPPING_PRICE_UPDATE_MUTATION = """ mutation ShippingPriceUpdate($id: ID!, $input: ShippingPriceInput!) { shippingPriceUpdate(id: $id, input: $input) { errors { field message code } shippingMethod { id name type taxClass ...
72
1,320
wagtail
wagtail/api/v3/tests/test_openapi_snapshot.py
.py
import json from pathlib import Path import swapper from ninja.responses import NinjaJSONEncoder from wagtail.api.v3.api import api from wagtail.api.v3.tests.base import TestV3Base if swapper.is_swapped("wagtailcore", "Page"): SNAPSHOT_PATH = Path(__file__).parent / "snapshots" / "openapi_basepage.json" else: ...
34
1,078
gunicorn
tests/requests/valid/pp_01.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. from gunicorn.config import Config cfg = Config() cfg.set('proxy_protocol', True) request = { "method": "GET", "uri": uri("/stuff/here?foo=bar"), "version": (1, 0), "headers": [ ("SERVER",...
21
465
hatch
src/hatch/env/collectors/plugin/interface.py
.py
from __future__ import annotations class EnvironmentCollectorInterface: """ Example usage: ```python tab="plugin.py" from hatch.env.collectors.plugin.interface import EnvironmentCollectorInterface class SpecialEnvironmentCollector(EnvironmentCollectorInterface): PLUGIN_NAME ...
73
2,013
mlflow
mlflow/store/tracking/gateway/__init__.py
.py
from mlflow.store.tracking.gateway.abstract_mixin import GatewayStoreMixin __all__ = ["GatewayStoreMixin"]
4
108
pyomo
pyomo/contrib/gdpopt/create_oa_subproblems.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...
283
10,498
astropy
astropy/coordinates/tests/test_angles.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test initialization and other aspects of Angle and subclasses""" import pickle import threading import numpy as np import pytest from numpy.testing import assert_allclose, assert_array_equal import astropy.units as u from astropy.coordinates import (...
1,263
39,805
lemur
lemur/tests/test_authorities.py
.py
import json import pytest from lemur.authorities.views import * # noqa from lemur.exceptions import InvalidConfiguration from lemur.tests.factories import AuthorityFactory, RoleFactory from lemur.tests.vectors import ( VALID_ADMIN_API_TOKEN, VALID_ADMIN_HEADER_TOKEN, VALID_USER_HEADER_TOKEN, ) def test...
604
17,473
biopython
Bio/Align/exonerate.py
.py
# Copyright 2022 by Michiel de Hoon. All rights reserved. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included as part of this # package. """Bio.Align support fo...
656
26,538
probability
tensorflow_probability/python/mcmc/nuts_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...
669
26,041
marshmallow
src/marshmallow/exceptions.py
.py
"""Exception classes for marshmallow-related errors.""" from __future__ import annotations import typing # Key used for schema-level validation errors SCHEMA = "_schema" class MarshmallowError(Exception): """Base class for all marshmallow-related errors.""" class ValidationError(MarshmallowError): """Rai...
71
2,273
probability
tensorflow_probability/python/math/ode/bdf_util.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...
254
10,371
tqdm
tqdm/contrib/__init__.py
.py
""" Thin wrappers around common functions. Subpackages contain potentially unstable extensions. """ from warnings import warn from ..auto import tqdm as tqdm_auto from ..std import TqdmDeprecationWarning, tqdm from ..utils import ObjectWrapper __author__ = {"github.com/": ["casperdcl"]} __all__ = ['tenumerate', 'tzi...
92
2,479
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/groupby_test.py
.py
# coding=utf-8 # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License");...
279
8,591
textual
docs/examples/guide/widgets/hello01.py
.py
from textual.app import App, ComposeResult, RenderResult from textual.widget import Widget class Hello(Widget): """Display a greeting.""" def render(self) -> RenderResult: return "Hello, [b]World[/b]!" class CustomApp(App): def compose(self) -> ComposeResult: yield Hello() if __name__...
20
372
ipython
tests/test_kitty.py
.py
import subprocess import sys import pytest from pathlib import Path class DummyStdout: def write(self, *args, **kwargs): pass def flush(self): pass class StdoutWithNonCallableIsatty(DummyStdout): isatty = False class StdoutTTY(DummyStdout): def isatty(self): return True ...
157
4,377
readthedocs.org
readthedocs/search/utils.py
.py
"""Utilities related to reading and generating indexable search content.""" import structlog from django.utils import timezone from django_elasticsearch_dsl.apps import DEDConfig from django_elasticsearch_dsl.registries import registry from readthedocs.notifications.models import Notification from readthedocs.project...
141
4,568
probability
tensorflow_probability/python/bijectors/hypothesis_testlib.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...
585
21,527
conda
tests/env/installers/test_conda_installer_explicit.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Test conda explicit installer functionality.""" import pytest from conda.env.installers.conda import install from conda.env.specs.explicit import ExplicitSpec from conda.models.environment import Environment from conda.models.match_spec imp...
156
5,134
openvino
tests/layer_tests/tensorflow_lite_tests/test_tfl_Split.py
.py
import pytest import tensorflow as tf from common.tflite_layer_test_class import TFLiteLayerTest test_params = [ {'shape': [6], 'num_or_size_splits': 2, 'axis': 0}, {'shape': [2, 1, 6], 'num_or_size_splits': 3, 'axis': 2}, {'shape': [4, 3, 2, 7], 'num_or_size_splits': 4, 'axis': -4}, ] class TestTFLiteS...
33
1,229
hydra
tests/test_hydra.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import os import re import subprocess import sys import warnings from logging import getLogger from pathlib import Path from textwrap import dedent from typing import Any, List, Optional, Set from omegaconf import DictConfig, OmegaConf from pytest ...
1,985
61,823
metrics
src/torchmetrics/functional/audio/pesq.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...
121
5,029
python-prompt-toolkit
src/prompt_toolkit/layout/screen.py
.py
from __future__ import annotations from collections import defaultdict from collections.abc import Callable from typing import TYPE_CHECKING from prompt_toolkit.cache import FastDictCache from prompt_toolkit.data_structures import Point from prompt_toolkit.utils import get_cwidth if TYPE_CHECKING: from .containe...
325
10,140
openvino
src/bindings/python/src/openvino/_offline_transformations/__init__.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # flake8: noqa from openvino._pyopenvino import get_version __version__ = get_version() from openvino._pyopenvino._offline_transformations import apply_fused_names_cleanup from openvino._pyopenvino._offline_tra...
22
1,208
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/combinevalues_function.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,815
openvino
tests/e2e_tests/common/ref_collector/score_tf.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from e2e_tests.common.ref_collector.provider import ClassProvider from e2e_tests.utils.path_utils import resolve_file_path, resolve_dir_path import os import re import sys import itertools from collections import defaultdict import loggi...
259
10,355
coremltools
coremltools/converters/mil/frontend/tensorflow/basic_graph_ops.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 connect_edge(g, source, dest): if isinstance(source, str): source = g[source] if...
364
11,344
mlflow
examples/xgboost/xgboost_sklearn/train.py
.py
from pprint import pprint import xgboost as xgb from sklearn.datasets import load_diabetes from sklearn.metrics import mean_squared_error from sklearn.model_selection import train_test_split from utils import fetch_logged_data import mlflow import mlflow.xgboost def main(): # prepare example dataset X, y = ...
37
1,059
python-prompt-toolkit
examples/prompts/with-frames/gray-frame-on-accept.py
.py
#!/usr/bin/env python """ Example of a frame around a prompt input that has autocompletion and a bottom toolbar. """ from prompt_toolkit import prompt from prompt_toolkit.completion import WordCompleter from prompt_toolkit.styles import Style animal_completer = WordCompleter( [ "alligator", "ant",...
70
1,344
onnxruntime
onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/TensorTypeAndShape.py
.py
# automatically generated by the FlatBuffers compiler, do not modify # namespace: fbs import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class TensorTypeAndShape(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0): n = flatbuffers.encode.G...
72
2,255
probability
tensorflow_probability/python/distributions/moyal_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...
302
10,157
onnxruntime
onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/TypeInfoValue.py
.py
# automatically generated by the FlatBuffers compiler, do not modify # namespace: fbs class TypeInfoValue(object): NONE = 0 tensor_type = 1 sequence_type = 2 map_type = 3
10
189
mlflow
examples/evaluation/evaluate_with_model_validation.py
.py
import shap import xgboost from sklearn.dummy import DummyClassifier from sklearn.model_selection import train_test_split import mlflow from mlflow.models import MetricThreshold, infer_signature, make_metric # load UCI Adult Data Set; segment it into training and test sets X, y = shap.datasets.adult() X_train, X_test...
111
3,974
probability
tensorflow_probability/python/bijectors/exp.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...
83
2,538
saleor
saleor/order/tests/test_order_actions.py
.py
from decimal import Decimal from unittest.mock import ANY, call, patch import pytest from django.test import override_settings from ...channel import MarkAsPaidStrategy from ...core.models import EventDelivery from ...core.utils.events import call_event from ...giftcard import GiftCardEvents from ...giftcard.const im...
3,198
108,765
coremltools
deps/protobuf/python/google/protobuf/internal/well_known_types.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...
860
29,375
pyomo
pyomo/contrib/solver/tests/solvers/test_ipopt.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...
2,167
91,829
coremltools
coremltools/converters/mil/mil/passes/tests/test_quantization_passes.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 from typing import Tuple import numpy as np import parameterized import pytest from...
3,107
124,890
probability
tensorflow_probability/python/sts/internal/util.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...
416
18,367
omegaconf
omegaconf/omegaconf.py
.py
"""OmegaConf module""" import copy import functools import inspect import io import os import pathlib import re import sys import warnings from collections import defaultdict from contextlib import contextmanager, nullcontext from enum import Enum from textwrap import dedent from typing import ( IO, Annotated,...
2,118
77,930
onnxruntime
onnxruntime/python/tools/transformers/onnx_model_bert_keras.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import logging import onnx from onnx import numpy_helper from onnx_mod...
475
18,536
beam
sdks/python/apache_beam/runners/interactive/display/interactive_pipeline_graph.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...
160
5,474
biopython
Bio/PDB/Residue.py
.py
# Copyright (C) 2002, Thomas Hamelryck (thamelry@binf.ku.dk) # # 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. """Residue class, us...
196
6,395