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
biopython
Bio/Phylo/_io.py
.py
# Copyright (C) 2009 by Eric Talevich (eric.talevich@gmail.com) # # 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. """I/O function w...
90
2,678
mlflow
tests/tracking/context/test_databricks_command_context.py
.py
from unittest import mock from mlflow.tracking.context.databricks_command_context import DatabricksCommandRunContext from mlflow.utils.mlflow_tags import MLFLOW_DATABRICKS_NOTEBOOK_COMMAND_ID def test_databricks_command_run_context_in_context(): with mock.patch("mlflow.utils.databricks_utils.get_job_group_id", r...
22
891
bazel
third_party/py/abseil/absl/flags/_validators_classes.py
.py
# Copyright 2021 The Abseil 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 ...
173
6,157
mlflow
tests/metrics/test_metric_definitions.py
.py
import inspect import io import sys from unittest import mock import pandas as pd import pytest from mlflow.metrics import ( MetricValue, ari_grade_level, bleu, exact_match, f1_score, flesch_kincaid_grade_level, mae, mape, max_error, mse, ndcg_at_k, precision_at_k, ...
396
14,379
kombu
t/integration/test_sqs.py
.py
from __future__ import annotations import os import uuid from unittest.mock import patch import pytest import kombu import kombu.asynchronous from .common import BaseExchangeTypes, BaseMessage, BasicFunctionality def get_connection(hostname: str = "localhost", port: int = 4100, queue_prefix: str = "") -> kombu.Co...
113
3,318
onnx
onnx/backend/test/case/node/convinteger.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 ConvInteger(Base): @staticmethod def export_without_padding() ...
104
2,747
luigi
luigi/event.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...
37
1,757
wagtail
wagtail/contrib/redirects/signal_handlers.py
.py
import logging from collections.abc import Iterable import swapper from django.apps import apps from django.conf import settings from django.db.models import Q from wagtail.contrib.frontend_cache.utils import PurgeBatch from wagtail.coreutils import BatchCreator, get_dummy_request from wagtail.models import Site fro...
200
6,651
scikit-bio
skbio/sequence/tests/test_dna.py
.py
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE.txt, distributed with this software. # --------------------------------------------...
50
1,817
probability
tensorflow_probability/python/distributions/two_piece_normal_test.py
.py
# Copyright 2022 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...
497
19,313
openvino
tests/layer_tests/tensorflow_tests/test_tf_TensorArrayOps.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest def create_tensor_array(data_shape, data_type): size = data_shape[0] data = tf.compat.v1.placeholder(data_type, d...
209
9,740
lemur
lemur/manage.py
.py
#!/usr/bin/env python import base64 import json import os import sys import click import requests from cryptography.fernet import Fernet from flask import current_app from flask.cli import FlaskGroup, pass_script_info from flask_migrate import stamp from flask_migrate.cli import db from sqlalchemy.sql import text fr...
611
20,252
mkdocs-material
material/plugins/blog/structure/__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...
338
13,811
textual
tests/snapshot_tests/snapshot_apps/auto_tab_active.py
.py
from textual.app import App, ComposeResult from textual.widgets import Button, Footer, TabbedContent, TabPane class ExampleApp(App): BINDINGS = [("space", "focus_button_2_2", "Focus button 2.2")] def compose(self) -> ComposeResult: with TabbedContent(id="tabbed-root"): with TabPane("[ansi...
37
1,361
probability
tensorflow_probability/python/internal/nest_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...
642
24,702
mlflow
tests/data/test_dataset_source_registry.py
.py
from typing import Any from unittest import mock import pytest from mlflow.data.dataset_source_registry import DatasetSourceRegistry from mlflow.exceptions import MlflowException from tests.resources.data.dataset_source import SampleDatasetSource def test_register_entrypoints_and_resolve(tmp_path): from mlflow...
179
7,053
saleor
saleor/order/tests/fixtures/fulfillment.py
.py
from typing import NamedTuple import graphene import pytest from ....warehouse.models import Stock, Warehouse from ...models import FulfillmentLine, FulfillmentStatus, Order, OrderLine @pytest.fixture def fulfillment(fulfilled_order): return fulfilled_order.fulfillments.first() @pytest.fixture def full_fulfil...
98
3,226
python-prompt-toolkit
examples/print-text/named-colors.py
.py
#!/usr/bin/env python """ Demonstration of all the ANSI colors. """ from prompt_toolkit import HTML, print_formatted_text from prompt_toolkit.formatted_text import FormattedText from prompt_toolkit.output import ColorDepth from prompt_toolkit.styles.named_colors import NAMED_COLORS print = print_formatted_text def ...
31
884
mlflow
mlflow/tracking/_tracking_service/client.py
.py
""" Internal package providing a Python CRUD interface to MLflow experiments and runs. This is a lower level API than the :py:mod:`mlflow.tracking.fluent` module, and is exposed in the :py:mod:`mlflow.tracking` module. """ import logging import os import sys from itertools import zip_longest from typing import TYPE_CH...
1,137
44,537
metrics
src/torchmetrics/functional/image/perceptual_path_length.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...
284
13,741
saleor
saleor/tests/e2e/checkout/discounts/promotions/test_promotion_applied_on_checkout_with_specific_subtotal.py
.py
from decimal import Decimal import pytest from ......checkout.models import Checkout from ......discount import DiscountType, RewardValueType from ....product.utils.preparing_product import prepare_product from ....promotions.utils import create_promotion, create_promotion_rule from ....shop.utils.preparing_shop impo...
167
5,995
biopython
Bio/Phylo/CDAOIO.py
.py
# Copyright (C) 2013 by Ben Morris (ben@bendmorris.com) # Based on Bio.Nexus, copyright 2005-2008 by Frank Kauff & Cymon J. Cox # and Bio.Phylo.Newick, copyright 2009 by Eric Talevich. # All rights reserved. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agre...
482
16,066
mlflow
mlflow/store/tracking/dbmodels/models.py
.py
import json import uuid from typing import Any import sqlalchemy as sa from sqlalchemy import ( JSON, BigInteger, Boolean, CheckConstraint, Column, Computed, Float, ForeignKey, ForeignKeyConstraint, Index, Integer, LargeBinary, PrimaryKeyConstraint, String, T...
4,308
148,159
kafka
tests/kafkatest/services/security/__init__.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 ...
16
781
python-prompt-toolkit
examples/telnet/hello-world.py
.py
#!/usr/bin/env python """ A simple Telnet application that asks for input and responds. The interaction function is a prompt_toolkit coroutine. Also see the `hello-world-asyncio.py` example which uses an asyncio coroutine. That is probably the preferred way if you only need Python 3 support. """ import logging from a...
41
980
pyomo
pyomo/core/tests/unit/test_bounds.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...
98
3,159
readthedocs.org
readthedocs/builds/tests/test_views.py
.py
from unittest import mock from django.conf import settings from django.contrib.auth.models import User from django.test import TestCase, override_settings from django.urls import reverse from django_dynamic_fixture import get from readthedocs.builds.constants import ( BUILD_STATE_CANCELLED, BUILD_STATE_INSTAL...
142
5,434
black
src/blib2to3/pygram.py
.py
# Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Export the Python grammar and symbols.""" # Python imports import os from typing import Union # Local imports from .pgen2 import driver from .pgen2.grammar import Grammar # Moved into initialize because mypyc can'...
208
5,003
pyomo
pyomo/contrib/mpc/data/tests/test_convert.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...
187
8,103
coremltools
coremltools/converters/mil/mil/ops/defs/iOS17/normalization.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.converters.mil.mil import types from coremltools.converters.mil.mil.input_type impor...
149
5,542
sphinx
tests/roots/test-ext-autosummary-import_cycle/conf.py
.py
import sys from pathlib import Path sys.path.insert(0, str(Path.cwd().resolve())) extensions = ['sphinx.ext.autosummary'] autosummary_generate = False
8
153
gunicorn
tests/test_valid_requests.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. import glob import os import pytest import treq dirname = os.path.dirname(__file__) reqdir = os.path.join(dirname, "requests", "valid") httpfiles = glob.glob(os.path.join(reqdir, "*.http")) # Flags incompatible...
38
1,070
astropy
astropy/cosmology/_src/tests/io/test_mrt.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # THIRD PARTY import pytest from astropy.cosmology import Planck18 from astropy.cosmology._src.io.builtin.mrt import ( read_mrt, write_mrt, ) from astropy.table import QTable, Table from .base import ReadWriteDirectTestBase, ReadWriteTestMixinB...
202
7,130
wandb
wandb/sdk/lib/identity.py
.py
"""Resolving session credentials to the account they belong to.""" from __future__ import annotations import dataclasses import logging from typing import TYPE_CHECKING, Any from wandb.sdk.lib.json_util import loads if TYPE_CHECKING: from wandb.sdk.wandb_settings import Settings _logger = logging.getLogger(__n...
102
3,119
mlflow
tests/semantic_kernel/resources.py
.py
import openai from semantic_kernel import Kernel from semantic_kernel.agents import ChatCompletionAgent from semantic_kernel.connectors.ai.open_ai import ( OpenAIChatCompletion, OpenAITextCompletion, OpenAITextEmbedding, ) from semantic_kernel.contents import ChatHistory from semantic_kernel.functions impor...
167
5,681
gunicorn
gunicorn/dirty/stash.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Stash - Global Shared State for Dirty Workers Provides simple key-value tables stored in the arbiter process. All workers can read and write to the same tables. Usage:: from gunicorn.dirty import stash ...
504
13,582
sqlmap
tests/test_crawler.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission Crawler result normalization (lib/utils/crawler.py normalizeCrawlingResults). --crawl can surface thousands of near-identical URLs; normalization keeps one representative per distinc...
66
2,691
pymc
tests/model/transform/test_deterministic.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...
103
4,132
clearml
examples/reporting/artifacts.py
.py
import os from time import sleep import pandas as pd import numpy as np from PIL import Image from clearml import Task def main(): # Connecting ClearML with the current process, # from here on everything is logged automatically task = Task.init(project_name='examples', task_name='Artifacts example') ...
57
2,094
voila
voila/notebook_renderer.py
.py
############################################################################# # Copyright (c) 2021, Voilà Contributors # # Copyright (c) 2021, QuantStack # # # # Distri...
424
18,201
pyomo
doc/OnlineDocs/src/data/param8a.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...
24
837
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/withtimestamps_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");...
107
3,510
saleor
saleor/graphql/discount/tests/mutations/test_promotion_rule_delete.py
.py
import graphene import pytest from .....discount import PromotionEvents from .....discount.models import PromotionEvent from .....product.models import ProductChannelListing from ....tests.utils import assert_no_permission, get_graphql_content from ...utils import get_products_for_promotion PROMOTION_RULE_DELETE_MUTA...
179
5,696
tomli
tests/test_misc.py
.py
# SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2021 Taneli Hukkinen # Licensed to PSF under a Contributor Agreement. import copy import datetime from decimal import Decimal as D import importlib from pathlib import Path import subprocess import sys import tempfile import textwrap import unittest from . impo...
178
6,113
luigi
test/decorator_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...
390
10,651
onnxruntime
orttraining/orttraining/python/training/ortmodule/experimental/hierarchical_ortmodule/_hierarchical_ortmodule.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # _hierarchical_ortmodule.py import tempfile import warnings import torch from onnxruntime.training import ortmodule from onnxruntime.training.ortmodule import ORTModule from onnxruntime.training.ortmodule.options import Deb...
280
12,838
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/count_per_element.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");...
54
1,711
luigi
test/contrib/hdfs/webhdfs_client_test.py
.py
# -*- coding: utf-8 -*- # # Copyright 2015 VNG 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...
39
1,333
probability
tensorflow_probability/python/bijectors/kumaraswamy_cdf.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...
150
5,727
pyomo
pyomo/core/base/suffix.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...
544
17,858
pyomo
pyomo/contrib/doe/tests/test_greybox.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
1,379
52,878
hydra
tests/test_apps/deprecation_warning/my_app.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from omegaconf import DictConfig import hydra from hydra._internal.deprecation_warning import deprecation_warning @hydra.main() def my_app(cfg: DictConfig) -> None: deprecation_warning("Feature FooBar is deprecated") if __name__ == "__main_...
15
337
mlflow
tests/paddle/test_paddle_autolog.py
.py
import paddle import pytest import mlflow from mlflow import MlflowClient NUM_EPOCHS = 6 class LinearRegression(paddle.nn.Layer): def __init__(self): super().__init__() self.fc = paddle.nn.Linear(13, 1) def forward(self, feature): return self.fc(feature) def get_datasets(): tr...
131
4,389
textual
tests/test_parser.py
.py
from textual._parser import Parser def test_read1(): class TestParser(Parser[str]): """A simple parser that reads a byte at a time from a stream.""" def parse(self, on_token): while True: data = yield self.read1() if not data: break ...
54
1,784
confluent-kafka-python
src/confluent_kafka/schema_registry/rules/cel/constraints.py
.py
# Copyright 2024 Confluent, Inc. # Copyright 2023 Buf Technologies, 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 require...
222
8,684
conda
tests/gateways/test_logging.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause import logging import os import sys from logging import getLogger from pathlib import Path from subprocess import run import pytest from conda.auxlib.ish import dals from conda.gateways.logging import ( TokenURLFilter, initialize_loggi...
192
6,064
coremltools
docs-guides/conf.py
.py
# Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master...
57
1,593
beam
sdks/python/apache_beam/testing/test_pipeline.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...
223
8,755
openvino
tests/layer_tests/tensorflow_tests/test_tf_TensorListLength.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from sys import platform import numpy as np import pytest import tensorflow as tf from common.tf_layer_test_class import CommonTFLayerTest class TestTensorListLength(CommonTFLayerTest): def _prepare_input(self, inputs_info): ...
84
3,618
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_conv2d_combinations.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from save_model import saveModel import numpy as np import paddle import sys paddle.enable_static() def run_and_save_model(input_x, name, feed, fetch_list, main_prog, start_prog): cpu = paddle.static.cpu_places(1) exe = paddle....
149
6,924
textual
tests/snapshot_tests/snapshot_apps/auto_grid_default_height.py
.py
from __future__ import annotations from typing import Type from textual.app import App, ComposeResult from textual.containers import Container, Horizontal, Vertical, Grid from textual.widgets import Header, Footer, Label from textual.binding import Binding class GridHeightAuto(App[None]): CSS = """ #test-are...
59
1,522
mlflow
examples/llama_index/autolog.py
.py
""" This is an example for leveraging MLflow's autologging capabilities for LlamaIndex. For more information about MLflow LlamaIndex integration, see: https://mlflow.org/docs/latest/llms/llama-index/index.html """ import os from llama_index.agent.openai import OpenAIAgent from llama_index.core import Document, Setti...
80
2,386
probability
tensorflow_probability/python/internal/samplers.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...
369
12,907
beam
playground/infrastructure/verify.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 ...
255
9,830
saleor
saleor/graphql/product/tests/test_product_pagination.py
.py
import uuid from decimal import Decimal import graphene import pytest from ....attribute.utils import associate_attribute_values_to_instance from ....product import ProductTypeKind from ....product.models import ( Category, Collection, CollectionChannelListing, Product, ProductChannelListing, ...
982
30,866
readthedocs.org
readthedocs/core/filters.py
.py
"""Extended classes for django-filter.""" import structlog from django_filters import FilterSet from django_filters import ModelChoiceFilter from django_filters import views from django_filters.fields import ModelChoiceField log = structlog.get_logger(__name__) class ModelFilterSet(FilterSet): """ Filterse...
132
5,004
conda
conda/plugins/subcommands/doctor/health_checks/altered_files.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Health check: Altered files in packages.""" from __future__ import annotations from logging import getLogger from pathlib import Path from typing import TYPE_CHECKING from .....base.constants import OK_MARK, X_MARK from .....cli.install im...
126
3,907
tqdm
tqdm/tk.py
.py
""" Tkinter GUI progress bar decorator for iterators. Usage: >>> from tqdm.tk import trange, tqdm >>> for i in trange(10): ... ... """ import re import sys import tkinter import tkinter.ttk as ttk from warnings import warn from .std import TqdmExperimentalWarning, TqdmWarning from .std import tqdm as std_tqdm __...
197
6,702
wagtail
wagtail/admin/views/reports/audit_logging.py
.py
import datetime from collections import defaultdict import django_filters from django.contrib.auth import get_user_model from django.contrib.contenttypes.models import ContentType from django.db.models import IntegerField, Value from django.utils.encoding import force_str from django.utils.translation import gettext_l...
191
7,680
flit
tests/test_upload.py
.py
from contextlib import contextmanager from tempfile import NamedTemporaryFile import os import io import pathlib import pytest import responses from testpath import modified_env from unittest.mock import patch from flit import upload from flit.build import ALL_FORMATS from flit.upload import get_repository, RepoDetai...
157
4,498
wandb
wandb/sdk/artifacts/_models/storage.py
.py
from __future__ import annotations from pydantic import ConfigDict, StrictStr from pydantic.alias_generators import to_camel from typing_extensions import Self from wandb.sdk.artifacts.storage_layout import StorageLayout from .base_model import ArtifactsBase class StoragePolicyConfig(ArtifactsBase): model_conf...
31
883
luigi
test/mock_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...
116
3,309
mlflow
mlflow/store/tracking/abstract_store.py
.py
import bisect import json from abc import ABCMeta, abstractmethod from typing import TYPE_CHECKING, Any, Literal from mlflow.entities import ( Assessment, DatasetInput, DatasetRecord, Issue, IssueSeverity, IssueStatus, LoggedModel, LoggedModelInput, LoggedModelOutput, LoggedMode...
2,125
81,464
cvxpy
cvxpy/reductions/cone2cone/exact.py
.py
""" Copyright 2021 the CVXPY developers Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, so...
616
21,656
saleor
saleor/tests/e2e/checkout/discounts/promotions/test_checkout_with_fixed_promotion_should_not_result_in_negative_price.py
.py
import pytest from ......product.tasks import recalculate_discounted_price_for_products_task from ....product.utils import get_product from ....product.utils.preparing_product import prepare_product from ....promotions.utils import create_promotion, create_promotion_rule from ....shop.utils import prepare_default_shop...
110
3,763
beam
learning/tour-of-beam/learning-content/common-transforms/aggregation/min/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...
52
1,730
saleor
saleor/graphql/webhook/tests/queries/test_sample_payload.py
.py
from unittest.mock import patch import pytest from ....tests.utils import assert_no_permission, get_graphql_content from ...enums import WebhookSampleEventTypeEnum SAMPLE_PAYLOAD_QUERY = """ query webhookSamplePayload($event_type: WebhookSampleEventTypeEnum!) { webhookSamplePayload(eventType: $event_type) } ...
102
4,137
mamba
libmamba/data/compile_pyc.py
.py
import os import sys from compileall import compile_file from concurrent.futures import ProcessPoolExecutor def main(): max_workers = int(os.environ.get("MAMBA_EXTRACT_THREADS", "0")) if max_workers <= 0: max_workers = None results = [] with sys.stdin: with ProcessPoolExecutor(max_wor...
27
714
biopython
Tests/test_GraphicsGeneral.py
.py
# Copyright 2001 by Brad Chapman. All rights reserved. # 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. """Test for graphics things that don't really deserve there own test module.""" import os impor...
72
2,593
saleor
saleor/tests/e2e/vouchers/test_staff_can_delete_vouchers_in_bulk.py
.py
import pytest from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_permissions from .utils import ( create_voucher, create_voucher_channel_listing, get_vouchers, voucher_bulk_delete, ) def create_multiple_vouchers(e2e_staff_api_client, channel_id): voucher_ids =...
81
2,207
hydra
plugins/hydra_submitit_launcher/tests/test_submitit_launcher.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from pathlib import Path from typing import Optional, Type from unittest.mock import MagicMock, patch import submitit from hydra.core.plugins import Plugins from hydra.plugins.launcher import Launcher from hydra.test_utils.launcher_common_tests imp...
141
4,291
saleor
saleor/graphql/order/tests/mutations/test_order_grant_refund_update.py
.py
from decimal import Decimal import graphene import pytest from .....core.prices import quantize_price from .....order import OrderGrantedRefundStatus from .....order.utils import update_order_charge_data from ....core.utils import to_global_id_or_none from ....tests.utils import ( assert_no_permission, get_gr...
2,260
74,850
marshmallow
examples/inflection_example.py
.py
# /// script # requires-python = ">=3.9" # dependencies = [ # "marshmallow", # ] # /// from marshmallow import Schema, fields def camelcase(s): parts = iter(s.split("_")) return next(parts) + "".join(i.title() for i in parts) class CamelCaseSchema(Schema): """Schema that uses camel-case for its exte...
39
921
mlflow
mlflow/tracing/context.py
.py
from __future__ import annotations import contextlib from contextvars import ContextVar from dataclasses import dataclass, field from typing import Generator from mlflow.tracing.constant import TraceMetadataKey @dataclass(frozen=True) class _UserTraceContext: """ Metadata and tags declared via ``mlflow.trac...
124
4,633
saleor
saleor/graphql/order/mutations/order_note_add.py
.py
from typing import Final import graphene from django.db import transaction from ....order import error_codes, events from ....order.search import update_order_search_vector from ....permission.enums import OrderPermissions from ...app.dataloaders import get_app_promise from ...core import ResolveInfo from ...core.con...
71
2,506
beam
sdks/python/apache_beam/yaml/yaml_ml.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...
644
24,888
metrics
src/torchmetrics/functional/text/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...
95
3,496
clearml
clearml/debugging/trace.py
.py
import inspect import os import sys import threading import time import types import zipfile from typing import Callable, Union, Optional, List, TextIO, Any __stream_write = None __stream_flush = None __patched_trace = False __trace_level = 1 __trace_start = 0 __thread_id = None __thread_so = None def _thread_linux_...
425
14,176
mlflow
dev/clint/src/clint/rules/docstring_param_order.py
.py
from clint.rules.base import Rule class DocstringParamOrder(Rule): def __init__(self, params: list[str]) -> None: self.params = params def _message(self) -> str: return f"Unordered parameters in docstring: {self.params}"
10
248
probability
tensorflow_probability/python/experimental/sts_gibbs/dynamic_spike_and_slab.py
.py
# Copyright 2022 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...
611
29,123
python-prompt-toolkit
examples/full-screen/buttons.py
.py
#!/usr/bin/env python """ A simple example of a few buttons and click handlers. """ from prompt_toolkit.application import Application from prompt_toolkit.application.current import get_app from prompt_toolkit.key_binding import KeyBindings from prompt_toolkit.key_binding.bindings.focus import focus_next, focus_previo...
93
2,390
mlflow
mlflow/bedrock/chat.py
.py
from typing import Any from mlflow.types.chat import ChatTool, FunctionToolDefinition def convert_tool_to_mlflow_chat_tool(tool: dict[str, Any]) -> ChatTool: """ Convert Bedrock tool definition into MLflow's standard format (OpenAI compatible). Ref: https://docs.aws.amazon.com/bedrock/latest/APIReferenc...
27
810
mlflow
tests/tracking/test_client_workspace.py
.py
from __future__ import annotations from mlflow import MlflowClient from mlflow.entities import TraceArchivalConfig from mlflow.environment_variables import MLFLOW_TRACKING_URI, MLFLOW_WORKSPACE_STORE_URI from mlflow.tracking._workspace import fluent as workspace_fluent from mlflow.tracking._workspace.client import Wor...
252
8,552
biopython
Bio/SeqRecord.py
.py
# Copyright 2000-2002 Andrew Dalke. All rights reserved. # Copyright 2002-2004 Brad Chapman. All rights reserved. # Copyright 2006-2023 by Peter Cock. All rights reserved. # Copyright 2020 by Michael R. Crusoe # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License...
1,545
61,659
mlflow
mlflow/utils/model_utils.py
.py
import contextlib import json import logging import os import shutil import sys from pathlib import Path from typing import Any import yaml from mlflow.exceptions import MlflowException from mlflow.models import Model from mlflow.models.model import MLMODEL_FILE_NAME from mlflow.protos.databricks_pb2 import ( INV...
536
20,851
pyomo
pyomo/contrib/fbbt/expression_bounds_walker.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...
343
10,435
confluent-kafka-python
examples/asyncio_avro_producer.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...
68
2,844
coveragepy
tests/test_numbits.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 """Tests for coverage.numbits""" from __future__ import annotations import json import sqlite3 from collections.abc import Iterable from coverage import env f...
199
6,382
loguru
tests/exceptions/source/others/nested_with_reraise.py
.py
import sys from loguru import logger logger.remove() logger.add(sys.stderr, format="", diagnose=False, backtrace=False, colorize=False) logger.add(sys.stderr, format="", diagnose=True, backtrace=False, colorize=False) logger.add(sys.stderr, format="", diagnose=False, backtrace=True, colorize=False) logger.add(sys.std...
31
625
onnxruntime
onnxruntime/test/python/transformers/test_gpt2_benchmark.py
.py
#!/usr/bin/env python # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------...
55
1,899