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
clearml
examples/frameworks/autokeras/autokeras_imdb_example.py
.py
try: import autokeras as ak except ImportError: import sys raise ImportError( "autokeras package is missing, you can install it using pip: pip install autokeras" if (sys.version_info.major, sys.version_info.minor) > (3, 6) else "AutoKeras does not support python version < 3.7" )...
67
2,122
pyomo
pyomo/core/base/boolean_var.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...
620
21,522
openvino
tests/layer_tests/pytorch_tests/test_adaptive_max_pool.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import pytest import torch import torch.nn.functional as F from pytorch_layer_test_class import PytorchLayerTest class TestAdaptiveMaxPool3D(PytorchLayerTest): def _prepare_input(self): return (self.input...
147
5,707
onnx
onnx/reference/ops/op_scan.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.op_run import OpRun class Scan(OpRun): def __init__(self, onnx_node, run_params): OpRun.__init__(self, onnx_node, run_params) if not hasattr(...
182
6,573
mlflow
mlflow/assistant/config.py
.py
from pathlib import Path from typing import Literal from pydantic import BaseModel, Field MLFLOW_ASSISTANT_HOME = Path.home() / ".mlflow" / "assistant" CONFIG_PATH = MLFLOW_ASSISTANT_HOME / "config.json" class PermissionsConfig(BaseModel): """Permission settings for the assistant provider.""" allow_edit_fi...
165
5,344
sphinx
tests/roots/test-ext-autodoc/target/generic_class.py
.py
from __future__ import annotations from typing import Generic, TypeVar T = TypeVar('T') # Test that typing.Generic's __new__ method does not mask our class' # __init__ signature. class A(Generic[T]): # NoQA: UP046 """docstring for A""" def __init__(self, a, b=None): pass
15
294
pyomo
pyomo/neos/kestrel.py
.py
#!/usr/bin/env python # ____________________________________________________________________________________ # # 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 Engi...
449
16,194
astropy
astropy/coordinates/builtin_frames/icrs_fk5_transforms.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy.coordinates.baseframe import frame_transform_graph from astropy.coordinates.matrix_utilities import matrix_transpose, rotation_matrix from astropy.coordinates.transformations import DynamicMatrixTransform from .fk5 import FK5 from .icrs impo...
45
1,429
astropy
astropy/table/pprint.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import fnmatch import os import re import sys from shutil import get_terminal_size import numpy as np from astropy import log, table from astropy.utils.console import Getch, color_print, conf from astropy.utils.data_info import dtype_info_name __all__ ...
894
31,750
textual
tests/snapshot_tests/test_snapshots.py
.py
from __future__ import annotations import asyncio from pathlib import Path import pytest from rich.panel import Panel from rich.text import Text from tests.snapshot_tests.language_snippets import SNIPPETS from textual import events from textual._on import on from textual import work from textual.app import App, Comp...
4,997
148,164
hatch
backend/src/hatchling/builders/macos.py
.py
from __future__ import annotations import os import platform import re __all__ = ["process_macos_plat_tag"] def process_macos_plat_tag(plat: str, /, *, compat: bool) -> str: """ Process the macOS platform tag. This will normalize the macOS version to 10.16 if compat=True. If the MACOSX_DEPLOYMENT_TARGET...
59
2,085
onnxruntime
onnxruntime/core/flatbuffers/ort_flatbuffers_py/fbs/StringStringEntry.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 StringStringEntry(object): __slots__ = ['_tab'] @classmethod def GetRootAs(cls, buf, offset=0): n = flatbuffers.encode.Ge...
68
2,080
pyro
pyro/distributions/transforms/polynomial.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import math import torch import torch.nn as nn from pyro.nn import AutoRegressiveNN from .. import constraints from ..torch_transform import TransformModule from ..util import copy_docs_from @copy_docs_from(TransformModule) cl...
193
7,075
pymc
pymc/logprob/basic.py
.py
# Copyright 2024 - present The PyMC Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
668
22,248
saleor
saleor/tests/e2e/checkout/shipping/test_checkout_invalidate_price_based_shipping_on_voucher_add.py
.py
import pytest from ...product.utils.preparing_product import prepare_product from ...shop.utils.preparing_shop import prepare_shop from ...utils import assign_permissions from ...vouchers.utils import create_voucher, create_voucher_channel_listing from ..utils import ( checkout_complete, checkout_create, c...
196
6,234
onnx
onnx/backend/test/case/node/dropout.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 import helper from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect def dropout(X, drop_probability=0.5, seed=0, trainin...
210
6,341
metrics
src/torchmetrics/functional/audio/stoi.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...
96
4,213
mkdocs-material
material/plugins/blog/__init__.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...
34
1,485
onnxruntime
onnxruntime/python/tools/microbench/attention.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import argparse from dataclasses import dataclass import numpy as np fr...
70
2,236
sphinx
tests/roots/test-ext-apidoc-trailing-underscore/package_/module_.py
.py
"""A module with a trailing underscore""" class SomeClass_: """A class with a trailing underscore""" def some_function_(some_arg_): """A function with a trailing underscore in name and argument"""
10
209
wagtail
wagtail/users/templatetags/wagtailusers_tags.py
.py
from collections import defaultdict from django import template from django.contrib.auth import get_permission_codename from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType from django.utils.text import camel_case_to_spaces from django.utils.translation import ge...
188
7,803
beam
examples/multi-language/python/wordcount_external.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...
117
4,972
wagtail
wagtail/documents/views/bulk_actions/document_bulk_action.py
.py
from django.utils.functional import cached_property from wagtail.admin.views.bulk_action import BulkAction from wagtail.documents import get_document_model from wagtail.permissions import policy_registry class DocumentBulkAction(BulkAction): models = [get_document_model()] @cached_property def permissio...
42
1,429
openvino
tests/layer_tests/onnx_tests/test_clip.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 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 from unit_tests.utils....
176
6,936
probability
tensorflow_probability/python/experimental/fastgp/fast_gp.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...
447
16,386
mlflow
mlflow/genai/optimize/types.py
.py
import multiprocessing from dataclasses import dataclass, field from typing import TYPE_CHECKING, Any, Callable from mlflow.entities import Feedback, Trace from mlflow.entities.model_registry import PromptVersion from mlflow.utils.annotations import deprecated if TYPE_CHECKING: from mlflow.genai.optimize.optimize...
152
6,084
coremltools
coremltools/converters/mil/frontend/tensorflow2/load.py
.py
# Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import os.path as _os_path import tensorflow as _tf from packaging.version import Version from tenso...
345
14,795
saleor
saleor/graphql/payment/mutations/transaction/transaction_create.py
.py
import uuid from decimal import Decimal from typing import TYPE_CHECKING import graphene from django.core.exceptions import ValidationError from django.core.validators import URLValidator from django.db.models import Model from .....checkout import models as checkout_models from .....core.prices import quantize_price...
392
14,543
beam
sdks/python/apache_beam/examples/per_entity_training.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...
153
5,265
openvino
tests/model_hub_tests/transformation_tests/test_transformations.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from huggingface_hub import snapshot_download import models_hub_common.utils as utils import pytest import os import platform import openvino as ov import tempfile from collections import deque import csv import torch def parse_transfo...
188
7,300
mlflow
tests/entities/test_view_type.py
.py
from mlflow.entities import ViewType from mlflow.protos import service_pb2 def test_to_proto(): assert ViewType.to_proto(ViewType.ACTIVE_ONLY) == service_pb2.ACTIVE_ONLY assert ViewType.to_proto(ViewType.DELETED_ONLY) == service_pb2.DELETED_ONLY assert ViewType.to_proto(ViewType.ALL) == service_pb2.ALL ...
15
569
django-cms
cms/admin/utils.py
.py
import re import typing from copy import copy from functools import partial from urllib.parse import parse_qsl from django import forms from django.contrib.admin import ModelAdmin from django.contrib.admin.checks import ModelAdminChecks from django.contrib.admin.utils import label_for_field from django.contrib.admin.v...
1,161
55,401
onnx
onnx/reference/ops/op_depth_to_space.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.op_run import OpRun class DepthToSpace(OpRun): def _run(self, data, blocksize=None, mode=None): if len(data.shape) != 4: raise RuntimeErr...
47
1,298
readthedocs.org
readthedocs/projects/tasks/utils.py
.py
import datetime import os import re import socket import boto3 import structlog from botocore.exceptions import ClientError from celery.worker.request import Request from django.conf import settings from django.core.exceptions import ValidationError from django.db.models import Q from django.utils import timezone fro...
329
11,272
coremltools
coremltools/test/optimize/torch/test_base_optimizer.py
.py
# Copyright (c) 2024, 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 pytest import torch from coremltools.optimize.torch.base_model_optimizer import ( BaseDat...
69
2,355
beam
sdks/python/apache_beam/examples/sinks/test_write_unbounded.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...
167
6,272
mlflow
tests/utils/test_unity_catalog_oss_utils.py
.py
from mlflow.entities.model_registry import RegisteredModel from mlflow.protos.unity_catalog_messages_pb2 import ( RegisteredModelInfo, ) from mlflow.utils._unity_catalog_oss_utils import get_registered_model_from_uc_oss_proto def test_registered_model_from_uc_oss_proto(): expected_registered_model = Registere...
27
822
wandb
tests/system_tests/test_core/test_run_messages_full.py
.py
"""Integration tests for the run_messages mechanism.""" import pytest import wandb from tests.fixtures.mock_wandb_log import MockWandbLog @pytest.mark.usefixtures("user") # test requires an online run def test_prints_run_messages(mock_wandb_log: MockWandbLog): # This test may need to be rewritten if the messag...
23
707
httpie
httpie/utils.py
.py
import os import base64 import json import mimetypes import re import sys import time import tempfile import sysconfig from collections import OrderedDict from contextlib import contextmanager from http.cookiejar import parse_ns_headers from pathlib import Path from pprint import pformat from urllib.parse import urlsp...
310
9,147
httpie
tests/test_auth.py
.py
"""HTTP authentication-related tests.""" from unittest import mock import pytest from httpie.plugins.builtin import HTTPBasicAuth from httpie.status import ExitStatus from httpie.utils import ExplicitNullAuth from .utils import http, add_auth, HTTP_OK, MockEnvironment import httpie.cli.constants import httpie.cli.defi...
156
5,169
pyomo
pyomo/contrib/trustregion/examples/example2.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...
75
2,616
kafka
tests/kafkatest/tests/streams/streams_application_upgrade_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 ...
316
17,111
mlflow
tests/genai/test_git_versioning.py
.py
import subprocess from pathlib import Path from unittest import mock import pytest import mlflow from mlflow.genai import disable_git_model_versioning, enable_git_model_versioning from mlflow.genai.git_versioning import _get_active_git_context from mlflow.utils.mlflow_tags import MLFLOW_GIT_DIFF @pytest.fixture(aut...
270
10,188
probability
tensorflow_probability/python/experimental/vi/util/trainable_linear_operators_test.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...
228
9,176
textual
docs/examples/styles/text_align.py
.py
from textual.app import App from textual.containers import Grid 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." ) class TextAlign(App...
27
718
wagtail
wagtail/images/rich_text/editor_html.py
.py
""" editor-html conversion for contenteditable editors """ from wagtail.admin.rich_text.converters import editor_html from wagtail.images import get_image_model from wagtail.images.formats import get_image_format class ImageEmbedHandler: """ ImageEmbedHandler will be invoked whenever we encounter an element ...
49
1,568
mlflow
tests/dev/test_update_mlflow_versions.py
.py
import difflib import re from pathlib import Path import pytest from packaging.version import Version from dev.update_mlflow_versions import ( get_current_py_version, replace_java, replace_java_pom_xml, replace_pyproject_toml, replace_python, replace_r, replace_ts, ) # { filename: expecte...
171
5,424
textual
src/textual/css/tokenize.py
.py
from __future__ import annotations import re from typing import TYPE_CHECKING, ClassVar, Iterable from textual.css.tokenizer import Expect, Token, Tokenizer if TYPE_CHECKING: from textual.css.types import CSSLocation PERCENT = r"-?\d+\.?\d*%" DECIMAL = r"-?\d+\.?\d*" COMMA = r"\s*,\s*" OPEN_BRACE = r"\(\s*" CLO...
350
11,258
django-cms
cms/utils/__init__.py
.py
# TODO: this is just stuff from utils.py - should be split / moved from typing import TYPE_CHECKING from django.http import HttpRequest from cms.utils.compat.warnings import RemovedInDjangoCMS60Warning from cms.utils.i18n import ( get_current_language, get_default_language, get_language_code, get_lang...
82
2,652
onnxruntime
orttraining/orttraining/python/training/ortmodule/graph_optimizers/__init__.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import os import torch from packaging.version import Version _all_opti...
23
720
coremltools
coremltools/optimize/torch/quantization/modules/conv_transpose_fused.py
.py
# Copyright (c) 2024, 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 # Original implementation from https://github.com/pytorch/pytorch/blob/main/torch/ao/nn/intrinsic/qat...
531
16,077
textual
docs/examples/styles/grid.py
.py
from textual.app import App from textual.widgets import Static class GridApp(App): CSS_PATH = "grid.tcss" def compose(self): yield Static("Grid cell 1\n\nrow-span: 3;\ncolumn-span: 2;", id="static1") yield Static("Grid cell 2", id="static2") yield Static("Grid cell 3", id="static3") ...
21
582
hatch
tests/helpers/templates/wheel/standard_default_build_script_artifacts.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): ...
51
1,353
django-cms
cms/test_utils/project/extensionapp/cms_toolbars.py
.py
from django.urls import NoReverseMatch from django.utils.translation import gettext_lazy as _ from cms.test_utils.project.extensionapp.models import ( MyPageContentExtension, MyPageExtension, ) from cms.toolbar_base import CMSToolbar from cms.toolbar_pool import toolbar_pool from cms.utils.page_permissions imp...
76
3,003
jupyterlab
docs/source/_ext/shellcheck_builder.py
.py
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. """Sphinx builder to lint shell snippets with shellcheck.""" from __future__ import annotations import json import os import subprocess import textwrap from pathlib import Path from shutil import which from typing im...
187
6,026
wagtail
wagtail/admin/viewsets/model.py
.py
import warnings from django.contrib.auth import get_permission_codename from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ImproperlyConfigured from django.db import models from django.forms.models import modelform_factory fro...
691
25,820
mlflow
mlflow/genai/utils/trace_utils.py
.py
import asyncio import functools import inspect import json import logging import math import threading from collections import OrderedDict from typing import TYPE_CHECKING, Any, Callable from cachetools.func import cached from opentelemetry.trace import NoOpTracer from pydantic import BaseModel, Field import mlflow f...
1,283
47,111
sqlmap
plugins/dbms/sqlite/takeover.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ from lib.core.exception import SqlmapUnsupportedFeatureException from plugins.generic.takeover import Takeover as GenericTakeover class Takeover(GenericTakeover): def osCmd(s...
29
970
jupytext
tests/data/notebooks/outputs/ipynb_to_percent/plotly_graphs.py
.py
# --- # jupyter: # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # %% [markdown] # This notebook contains complex outputs, including plotly javascript graphs. # %% [markdown] # # Interactive plots # %% [markdown] # We use Plotly's connected mode to make the notebook ligh...
30
671
biopython
Bio/motifs/__init__.py
.py
# Copyright 2003-2009 by Bartek Wilczynski. All rights reserved. # Copyright 2012-2013 by Michiel JL de Hoon. All rights reserved. # Revisions copyright 2019 by Victor Lin. All rights reserved. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or t...
646
22,158
cvxpy
cvxpy/atoms/affine/cumsum.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...
137
5,203
gunicorn
tests/docker/asgi_compliance/apps/lifespan_app.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Lifespan test application for ASGI compliance testing. Tests the ASGI lifespan protocol including startup, shutdown, and state sharing between lifespan and request handlers. """ import json import os import t...
304
8,704
sqlmap
thirdparty/chardet/langhungarianmodel.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from .sbcharsetprober import SingleByteCharSetModel # 3: Positive # 2: Likely # 1: Unlikely # 0: Negative HUNGARIAN_LANG_MODEL = { 28: { # 'A' 28: 0, # 'A' 40: 1, # 'B' 54: 1, # 'C' 45: 2, # 'D' 32: 1, # 'E' 50: ...
4,651
102,479
pynacl
tests/test_encoding.py
.py
# Copyright 2013 Donald Stufft and individual contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
84
2,796
saleor
saleor/graphql/core/tests/garbage_collection/test_django.py
.py
import gc import pytest from django.db import connection from .utils import ( clean_up_after_garbage_collection_test, disable_gc_for_garbage_collection_test, ) # Group all tests that require garbage collection so that they do not run concurrently. # This is necessary to ensure that tests don't interfere wit...
38
1,414
cvxpy
cvxpy/tests/test_gurobi_write.py
.py
""" Copyright, the CVXPY 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 or agreed to in writing, software ...
48
1,260
astropy
astropy/time/__init__.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy import config as _config class Conf(_config.ConfigNamespace): """ Configuration parameters for `astropy.time`. """ use_fast_parser = _config.ConfigItem( ["True", "False", "force"], "Use fast C parser for supp...
51
1,710
hydra
plugins/hydra_ray_launcher/integration_test_tools/create_integration_test_ami.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved """ This script is meant to be used for ray launcher integration tests only! Run this script with AWS admin credentials to create new integration test AMIs if any hydra-core & hydra-ray-launcher dependencies changes or there's a newer version of p...
108
4,071
mlflow
examples/sktime/flavor.py
.py
"""The ``flavor`` module provides an example for a custom model flavor for ``sktime`` library. This module exports ``sktime`` models in the following formats: sktime (native) format This is the main flavor that can be loaded back into ``sktime``, which relies on pickle internally to serialize a model. No...
546
23,456
mlflow
mlflow/claude_code/config.py
.py
"""Configuration management for Claude Code integration with MLflow.""" import json import os from dataclasses import dataclass from pathlib import Path from typing import Any from mlflow.environment_variables import ( MLFLOW_EXPERIMENT_ID, MLFLOW_EXPERIMENT_NAME, MLFLOW_TRACKING_URI, ) # Configuration f...
193
6,366
pyomo
pyomo/contrib/incidence_analysis/common/tests/test_dulmage_mendelsohn.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...
182
5,344
ipython
IPython/sphinxext/ipython_console_highlighting.py
.py
""" reST directive for syntax-highlighting ipython interactive sessions. """ from sphinx import highlighting from ipython_pygments_lexers import IPyLexer def setup(app): """Setup as a sphinx extension.""" # This is only a lexer, so adding it below to pygments appears sufficient. # But if somebody knows...
29
895
readthedocs.org
readthedocs/notifications/exceptions.py
.py
from django.utils.translation import gettext_lazy as _ class NotificationBaseException(Exception): """ The base exception class for notification and messages. This provides the additional ``message_id`` and ``format_values`` attributes that are used for message display and registry lookup. """ ...
18
611
mlflow
mlflow/tensorflow/__init__.py
.py
""" The ``mlflow.tensorflow`` module provides an API for logging and loading TensorFlow models. This module exports TensorFlow models with the following flavors: TensorFlow (native) format This is the main flavor that can be loaded back into TensorFlow. :py:mod:`mlflow.pyfunc` Produced for use by generic pyfun...
1,523
63,772
onnxruntime
onnxruntime/test/testdata/transform/fusion/layer_norm_fusion_scale_bias.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import onnx from onnx import OperatorSetIdProto, TensorProto, helper def GenerateModel(model_name, has_casts=False, has_identity=False): # noqa: N802 nodes = [ # LayerNorm subgraph helper.make_node("ReduceMean"...
82
3,230
textual
src/textual/binding.py
.py
""" This module contains the `Binding` class and related objects. See [bindings](/guide/input#bindings) in the guide for details. """ from __future__ import annotations import dataclasses from dataclasses import dataclass from typing import TYPE_CHECKING, Iterable, Iterator, Mapping, NamedTuple import rich.repr f...
401
13,746
django-cms
cms/app_registration.py
.py
import inspect from functools import cache from importlib import import_module from django.apps import apps from django.core.exceptions import ImproperlyConfigured from django.utils.module_loading import module_has_submodule from cms.app_base import CMSAppConfig, CMSAppExtension from cms.constants import CMS_CONFIG_N...
204
8,214
onnx
onnx/backend/test/case/node/shape.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 # Reference implementation of shape op def shape_reference_impl( x: np.n...
65
1,688
wandb
tests/system_tests/test_core/test_git.py
.py
import subprocess import pytest import wandb def run_git(cwd, *args: str) -> str: return subprocess.check_output(["git", *args], cwd=cwd, text=True).strip() def init_git_repo(path) -> None: subprocess.run(["git", "init", path], check=True, stdout=subprocess.DEVNULL) run_git(path, "config", "user.name",...
288
9,625
conda
tests/plugins/subcommands/doctor/health_checks/test_requests_ca_bundle.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Tests for the REQUESTS_CA_BUNDLE health check. Note: env_ok fixture is defined in tests/plugins/subcommands/conftest.py and shared with health fix tests. """ from __future__ import annotations from typing import TYPE_CHECKING from request...
75
2,347
hydra
examples/tutorials/structured_configs/5.2_structured_config_schema_different_config_group/database_lib.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from dataclasses import dataclass from omegaconf import MISSING from hydra.core.config_store import ConfigStore @dataclass class DBConfig: driver: str = MISSING host: str = "localhost" port: int = MISSING @dataclass class MySQLConf...
45
884
metrics
tests/unittests/text/test_wil.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...
71
2,527
saleor
saleor/app/error_codes.py
.py
from enum import Enum class AppErrorCode(Enum): FORBIDDEN = "forbidden" GRAPHQL_ERROR = "graphql_error" INVALID = "invalid" INVALID_STATUS = "invalid_status" INVALID_PERMISSION = "invalid_permission" INVALID_URL_FORMAT = "invalid_url_format" INVALID_MANIFEST_FORMAT = "invalid_manifest_form...
37
1,167
pyomo
examples/kernel/blocks.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...
66
1,944
metrics
tests/unittests/classification/test_average_precision.py
.py
# Copyright The Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
437
19,064
scikit-bio
skbio/io/format/phylip_dm.py
.py
"""PHYLIP distance matrix format (:mod:`skbio.io.format.phylip_dm`) ================================================================ .. currentmodule:: skbio.io.format.phylip_dm .. versionadded:: 0.7.2 The PHYLIP file format stores pairwise distance matrices. This format is commonly used in phylogenetic analysis and...
543
18,110
probability
tensorflow_probability/python/experimental/mcmc/gradient_based_trajectory_length_adaptation_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...
748
28,166
mlflow
mlflow/protos/databricks_uc_registry_service_pb2.py
.py
import google.protobuf from packaging.version import Version if Version(google.protobuf.__version__).major >= 5: # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: databricks_uc_registry_service.proto # Protobuf Python Version: 5.26.0 """Generated protocol buffer cod...
171
34,198
mlflow
mlflow/sklearn/utils.py
.py
import inspect import logging import pkgutil import platform import warnings from copy import deepcopy from importlib import import_module from numbers import Number from operator import itemgetter from typing import Any, Callable, NamedTuple import numpy as np from packaging.version import Version from mlflow import...
1,037
38,418
notebook
tests/conftest.py
.py
import glob import json import os import os.path as osp import pathlib import shutil from importlib.resources import files import pytest from notebook.app import JupyterNotebookApp pytest_plugins = ["jupyter_server.pytest_plugin"] def mkdir(tmp_path, *parts): path = tmp_path.joinpath(*parts) if not path.ex...
135
4,365
kafka
tests/kafkatest/tests/streams/streams_shutdown_deadlock_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 ...
51
1,913
pyomo
pyomo/core/tests/unit/test_compare.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...
210
6,848
onnxruntime
onnxruntime/test/testdata/test_shape_data_propagation_gather_mul_topk.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # Regression fixture for the Shape -> Gather(1-D index) -> Mul -> TopK chain. # # This exercises the elementwise data-propagation consumers (Mul) with rank-1 # single-element operands. Both Gather indices are 1-D constants, s...
63
3,053
wandb
tests/assets/test_mod.py
.py
import multiprocessing import wandb def mp_func(): """Define at the module level to be pickle and send to the spawned process. Required for multiprocessing. """ print("hello from the other side") def main(): wandb.init() context = multiprocessing.get_context("spawn") p = context.Proces...
21
384
mlflow
tests/genai/scorers/online/test_session_checkpointer.py
.py
import time from unittest.mock import MagicMock import pytest from mlflow.environment_variables import ( MLFLOW_ONLINE_SCORING_DEFAULT_SESSION_COMPLETION_BUFFER_SECONDS, ) from mlflow.genai.scorers.online.constants import MAX_LOOKBACK_MS from mlflow.genai.scorers.online.session_checkpointer import ( OnlineSes...
171
6,402
onnx
onnx/backend/test/loader/__init__.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import json import os import onnx.backend.test.case.node from onnx.backend.test.case.test_case import TestCase from onnx.backend.test.case.utils import import_recursive DATA_DIR = os.path.join( os....
79
2,436
onnxruntime
go/testdata/gen_models.py
.py
"""Generate minimal ONNX test models for Go bindings testing.""" import os from onnx import TensorProto, checker, helper, save_model OUT_DIR = os.path.dirname(os.path.abspath(__file__)) def make_add_f32(): """Add op: A[2,3] + B[2,3] = C[2,3], all float32.""" input_a = helper.make_tensor_value_info("A", Ten...
75
2,730
readthedocs.org
readthedocs/invitations/views.py
.py
"""Invitation views.""" import structlog from django.contrib.auth.mixins import UserPassesTestMixin from django.http import Http404 from django.http import HttpResponseBadRequest from django.http import HttpResponseRedirect from django.shortcuts import get_object_or_404 from django.urls import reverse from django.view...
153
5,483
pyomo
pyomo/contrib/pynumero/algorithms/solvers/cyipopt_solver.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineerinkg # Solutions o...
477
17,702
sqlmap
lib/core/settings.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import codecs import os import platform import random import re import string import sys import time from lib.core.enums import DBMS from lib.core.enums import DBMS_DIRECTORY_NAM...
1,826
105,392