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
metrics
src/torchmetrics/functional/detection/__init__.py
.py
# Copyright The PyTorch 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 i...
36
1,510
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/combineperkey_side_inputs_iter.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");...
59
1,837
pyomo
pyomo/contrib/mindtpy/config_options.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...
871
26,878
scikit-bio
skbio/stats/distance/tests/test_bioenv.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. # --------------------------------------------...
267
11,667
ipython
IPython/core/debugger_backport.py
.py
""" The code in this module is a backport of cPython changes in Pdb that were introduced in Python 3.13 by gh-83151: Make closure work on pdb https://github.com/python/cpython/pull/111094. This file should be removed once IPython drops supports for Python 3.12. The only changes are: - reformatting by darker (black) fo...
207
8,226
cvxpy
cvxpy/reductions/dcp2cone/canonicalizers/logic_canon.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 ...
54
1,686
astropy
astropy/table/tests/test_subclass.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst from astropy import table from astropy.table import pprint class MyRow(table.Row): def __str__(self): return str(self.as_void()) class MyColumn(table.Column): pass class MyMaskedColumn(table.MaskedColumn): pass class MyTableCo...
98
2,425
clearml
clearml/utilities/locks/constants.py
.py
""" Locking constants Lock types: - `LOCK_EX` exclusive lock - `LOCK_SH` shared lock Lock flags: - `LOCK_NB` non-blocking Manually unlock, only needed internally - `LOCK_UN` unlock """ import os # The actual tests will execute the code anyhow so the following code can # safely be ignored from the coverage tests ...
42
937
wagtail
wagtail/admin/views/reports/workflows.py
.py
import datetime import django_filters import swapper from django import forms from django.contrib.auth import get_user_model from django.contrib.contenttypes.models import ContentType from django.db.models import CharField, Q from django.db.models.functions import Cast from django.urls import reverse from django.utils...
314
10,501
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/groupbykey.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");...
67
1,991
coremltools
coremltools/test/neural_network/test_simple_nn_inference.py
.py
# Copyright (c) 2021, 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 import numpy as np import coremltools import coremltools.models.datatypes as datatypes from ...
54
1,780
mlflow
tests/types/test_schema.py
.py
import datetime import json import math import re from dataclasses import dataclass, field from typing import Optional import numpy as np import pandas as pd import pyspark import pyspark.sql.types as T import pytest from scipy.sparse import csc_matrix, csr_matrix from mlflow.exceptions import MlflowException from ml...
2,007
71,028
textual
tests/test_tabs.py
.py
from __future__ import annotations import pytest from textual import on from textual.app import App, ComposeResult from textual.widgets import Tab, Tabs from textual.widgets._tabs import Underline async def test_tab_label(): """It should be possible to access a tab's label.""" assert Tab("Pilot").label_text...
513
16,823
saleor
saleor/graphql/account/tests/bulk_mutations/test_user_bulk_set_active.py
.py
import graphene from .....account.models import User from ....tests.utils import get_graphql_content USER_CHANGE_ACTIVE_STATUS_MUTATION = """ mutation userChangeActiveStatus($ids: [ID!]!, $is_active: Boolean!) { userBulkSetActive(ids: $ids, isActive: $is_active) { count errors { ...
105
3,402
rq
tests/test_queue.py
.py
import json from datetime import datetime, timedelta, timezone from unittest.mock import patch from rq import Queue, Retry from rq.exceptions import DuplicateJobError from rq.job import Job, JobStatus from rq.registry import ( CanceledJobRegistry, DeferredJobRegistry, FailedJobRegistry, FinishedJobRegi...
949
41,337
coremltools
deps/protobuf/python/google/protobuf/internal/proto_builder_test.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...
110
4,478
scikit-bio
skbio/util/tests/test_optionals.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. # --------------------------------------------...
61
2,002
probability
tensorflow_probability/python/bijectors/power_transform.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...
130
4,632
saleor
saleor/graphql/attribute/mutations/attribute_value_update.py
.py
import graphene from django.db.models import Exists, OuterRef, Q from ....attribute import models as models from ....page import models as page_models from ....page.utils import mark_pages_search_vector_as_dirty_in_batches from ....product import models as product_models from ....product.utils.search_helpers import ( ...
136
5,553
astropy
astropy/uncertainty/tests/test_functions.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Test numpy functions and ufuncs on Distribution. The tests here are fairly detailed but do not aim for complete coverage. Complete coverage of all numpy functions will be done in test_function_helpers. TODO: start test_function_helpers once more func...
98
3,472
loguru
tests/test_datetime.py
.py
import datetime import os import sys from time import strftime from unittest.mock import Mock import freezegun import pytest import loguru from loguru import logger if sys.version_info < (3, 6): UTC_NAME = "UTC+00:00" else: UTC_NAME = "UTC" def _expected_fallback_time_zone(): # For some reason, Python ...
263
9,480
probability
tensorflow_probability/python/experimental/mcmc/reducer.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...
103
4,178
beam
sdks/python/apache_beam/examples/snippets/transforms/aggregation/combineperkey_multiple_arguments.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,905
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/runinference_sklearn_unkeyed_model_handler.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");...
66
2,321
saleor
saleor/graphql/product/mutations/collection/collection_update.py
.py
import graphene from django.db.models import Exists, OuterRef from .....discount.utils.promotion import mark_active_catalogue_promotion_rules_as_dirty from .....permission.enums import ProductPermissions from .....product import models from .....thumbnail import models as thumbnail_models from ....core import ResolveI...
60
2,463
sphinx
tests/roots/test-latex-numfig/conf.py
.py
extensions = ['sphinx.ext.imgmath'] # for math_numfig latex_documents = [ ('indexmanual', 'SphinxManual.tex', 'Test numfig manual', 'Sphinx', 'manual'), ('indexhowto', 'SphinxHowTo.tex', 'Test numfig howto', 'Sphinx', 'howto'), ]
7
240
pyro
examples/sir_hmc.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 # Introduction # ============ # # This advanced Pyro tutorial demonstrates a number of inference and prediction # tricks in the context of epidemiological models, specifically stochastic # discrete time compartmental models with large ...
676
24,193
astropy
astropy/table/info.py
.py
""" Table property for providing information about table. """ import os # Licensed under a 3-clause BSD style license - see LICENSE.rst import sys from contextlib import contextmanager import numpy as np from astropy.utils.data_info import DataInfo __all__ = ["TableInfo", "serialize_method_as", "table_info"] def...
220
7,454
metrics
src/torchmetrics/image/sam.py
.py
# Copyright The Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
168
6,626
mlflow
tests/llama_index/test_llama_index_tracer.py
.py
import asyncio import base64 import inspect import random from dataclasses import asdict from importlib import metadata from pathlib import Path from typing import Any from unittest.mock import ANY import llama_index.core import openai import pytest from llama_index.core import Settings from llama_index.core.base.resp...
911
32,719
marshmallow
tests/test_registry.py
.py
import pytest from marshmallow import Schema, class_registry, fields from marshmallow.exceptions import RegistryError def test_serializer_has_class_registry(): class MySchema(Schema): pass class MySubSchema(Schema): pass assert "MySchema" in class_registry._registry assert "MySubSch...
232
7,328
httpie
httpie/manager/tasks/sessions.py
.py
import argparse from httpie.sessions import SESSIONS_DIR_NAME, get_httpie_session from httpie.status import ExitStatus from httpie.context import Environment from httpie.legacy import v3_1_0_session_cookie_format, v3_2_0_session_header_format from httpie.manager.cli import missing_subcommand, parser from httpie.utils ...
87
2,686
pyomo
pyomo/contrib/mpc/interfaces/var_linker.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
57
2,422
black
tests/data/cases/fmtskip7.py
.py
a = "this is some code" b = 5 # fmt:skip c = 9 #fmt: skip d = "thisisasuperlongstringthisisasuperlongstringthisisasuperlongstringthisisasuperlongstring" # fmt:skip # output a = "this is some code" b = 5 # fmt:skip c = 9 #fmt: skip d = "thisisasuperlongstringthisisasuperlong...
12
395
voila
voila/exporter.py
.py
############################################################################# # Copyright (c) 2018, Voilà Contributors # # Copyright (c) 2018, QuantStack # # # # Distri...
199
7,470
saleor
saleor/plugins/webhook/tests/conftest.py
.py
import pytest from ....plugins.manager import get_plugins_manager from ....plugins.webhook.plugin import WebhookPlugin @pytest.fixture def webhook_plugin(settings): def factory() -> WebhookPlugin: settings.PLUGINS = ["saleor.plugins.webhook.plugin.WebhookPlugin"] manager = get_plugins_manager(all...
16
433
saleor
saleor/tests/e2e/checkout/test_guest_checkout_should_be_assigned_to_user_after_creating_the_account.py
.py
import pytest from ....account.models import User from ....graphql.core.utils import to_global_id_or_none from ..account.utils import account_register, customer_update, get_user from ..product.utils.preparing_product import prepare_product from ..shop.utils.preparing_shop import prepare_shop from ..utils import assign...
151
4,311
pyomo
pyomo/opt/base/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...
99
3,601
gunicorn
tests/requests/valid/rfc9112_chunked_size_uppercase_hex_01.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. # RFC 9112 section 7.1: chunk-size = 1*HEXDIG, which allows both cases. request = { "method": "POST", "uri": uri("/upload"), "version": (1, 1), "headers": [ ("HOST", "example.com"), ...
16
390
mlflow
tests/genai/judges/test_judge_base.py
.py
from typing import Any import pytest from mlflow.entities.assessment import Feedback from mlflow.entities.trace import Trace from mlflow.genai.judges import Judge from mlflow.genai.judges.base import JudgeField from mlflow.genai.scorers.base import Scorer class MockJudgeImplementation(Judge): def __init__(self,...
113
3,686
beam
sdks/python/apache_beam/typehints/typed_pipeline_test.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
1,023
37,412
mlflow
tests/webhooks/app.py
.py
import base64 import hashlib import hmac import itertools import json import sys from pathlib import Path import fastapi import uvicorn from fastapi import HTTPException, Request from mlflow.webhooks.constants import ( WEBHOOK_DELIVERY_ID_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_SIGNATURE_VERSION, WE...
242
7,351
voila
voila/__main__.py
.py
############################################################################# # Copyright (c) 2018, Voilà Contributors # # Copyright (c) 2018, QuantStack # # # # Distri...
14
696
saleor
saleor/graphql/webhook/subscription_query.py
.py
from enum import Flag from typing import cast from django.core.exceptions import ValidationError from graphene.utils.str_converters import to_snake_case from graphql import get_default_backend, validate from graphql.error import GraphQLSyntaxError from graphql.language.ast import ( Document, Field, Fragmen...
212
7,697
conda
conda/plugins/__init__.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """ In this module, you will find everything relevant to conda's plugin system. It contains all of the code that plugin authors will use to write plugins, as well as conda's internal implementations of plugins. **Modules relevant for plugin aut...
73
2,240
conda
conda/core/envs_manager.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Tools for managing conda environments.""" from __future__ import annotations import os from errno import EACCES, ENOENT, EROFS from logging import getLogger from os.path import dirname, isdir, isfile, join, normpath from typing import TYPE_...
225
7,371
astropy
astropy/time/tests/test_quantity_interaction.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import functools import numpy as np import pytest from astropy import units as u from astropy.table import Column from astropy.time import Time, TimeDelta allclose_sec = functools.partial( np.allclose, rtol=2.0**-52, atol=2.0**-52 * 24 * 3600 ) # 2...
345
13,326
textual
tests/test_message_handling.py
.py
from textual.app import App, ComposeResult from textual.message import Message from textual.widget import Widget async def test_message_inheritance_namespace(): """Inherited messages get their correct namespaces. Regression test for https://github.com/Textualize/textual/issues/1814. """ class BaseWi...
51
1,315
pyomo
doc/OnlineDocs/src/scripting/spy4Constraints.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...
61
1,574
mlflow
examples/gateway/anthropic/example.py
.py
from mlflow.deployments import get_deploy_client def main(): client = get_deploy_client("http://localhost:7000") print(f"Anthropic endpoints: {client.list_endpoints()}\n") print(f"Anthropic completions endpoint info: {client.get_endpoint(endpoint='completions')}\n") # Completions request respons...
24
696
sphinx
sphinx/transforms/references.py
.py
"""Docutils transforms used by Sphinx.""" from __future__ import annotations from typing import TYPE_CHECKING from docutils.transforms.references import DanglingReferences from sphinx.transforms import SphinxTransform if TYPE_CHECKING: from typing import Any from sphinx.application import Sphinx from ...
53
1,438
scikit-bio
skbio/io/format/phylip.py
.py
"""PHYLIP multiple sequence alignment format (:mod:`skbio.io.format.phylip`) ========================================================================= .. currentmodule:: skbio.io.format.phylip The PHYLIP file format stores a multiple sequence alignment. The format was originally defined and used in Joe Felsenstein's ...
406
15,495
marshmallow
tests/test_utils.py
.py
from __future__ import annotations import datetime as dt from copy import copy, deepcopy from typing import NamedTuple import pytest from marshmallow import Schema, fields, utils def test_missing_singleton_copy(): assert copy(utils.missing) is utils.missing assert deepcopy(utils.missing) is utils.missing ...
161
4,316
pyomo
examples/performance/misc/sparse1.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...
35
1,032
clearml
clearml/cli/config/__main__.py
.py
""" ClearML configuration wizard""" from __future__ import print_function import argparse import os import urllib from typing import Tuple, List, Dict, Optional, Any from urllib.parse import ParseResult import six from pathlib2 import Path from six.moves import input from six.moves.urllib.parse import urlparse from ...
388
15,010
gunicorn
tests/test_asgi_protocol_http.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ ASGI HTTP protocol tests. Tests for HTTP connection management, Expect: 100-continue, body size handling, and chunked encoding per ASGI 3.0 and HTTP/1.1 specs. """ from unittest import mock import pytest fr...
512
14,683
mlflow
mlflow/genai/judges/make_judge.py
.py
import types from typing import Any, Literal, Union, get_args, get_origin from mlflow.genai.judges.base import Judge from mlflow.genai.judges.instructions_judge import InstructionsJudge from mlflow.telemetry.events import MakeJudgeEvent from mlflow.telemetry.track import record_usage_event def _is_optional_pb_value_...
295
13,720
clearml
clearml/utilities/plotlympl/renderer.py
.py
""" Renderer Module This module defines the PlotlyRenderer class and a single function, fig_to_plotly, which is intended to be the main way that user's will interact with the matplotlylib package. """ from __future__ import absolute_import import warnings from typing import Optional, TextIO, List, Union, Dict, Any ...
747
32,427
astropy
astropy/io/fits/tests/conftest.py
.py
# Licensed under a 3-clause BSD style license - see PYFITS.rst import os import pathlib import shutil import stat import tempfile import time import pytest from astropy.io import fits @pytest.fixture( params=[False, "str", "pathlib"], ids=["", "home_is_data", "home_is_data, pathlib"] ) def home_is_data(request...
167
6,139
textual
tests/snapshot_tests/snapshot_apps/ansi_mapping.py
.py
from textual.app import App, ComposeResult from textual.widgets import Label class AnsiMappingApp(App[None]): def compose(self) -> ComposeResult: ansi_colors = [ "ansi_red", "ansi_green", "ansi_yellow", "ansi_blue", "ansi_magenta", "a...
27
704
onnxruntime
orttraining/orttraining/python/training/ort_triton/kernel/_slice_scel.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import itertools import sys import torch import triton import triton.la...
368
14,360
textual
src/textual/_files.py
.py
from __future__ import annotations from datetime import datetime def generate_datetime_filename( prefix: str, suffix: str, datetime_format: str | None = None ) -> str: """Generate a filename which includes the current date and time. Useful for ensuring a degree of uniqueness when saving files. Args...
29
1,002
wandb
wandb/sdk/lib/wbauth/prompt.py
.py
from __future__ import annotations import logging from urllib.parse import urlsplit, urlunsplit from wandb import util from wandb.errors import links, term from . import saas, validation, wbnetrc from .host_url import HostUrl _logger = logging.getLogger(__name__) _LOGIN_CHOICE_NEW = "Create a W&B account" _LOGIN_C...
202
6,011
hydra
tests/data.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved def foo() -> None: ... def foo_main_module() -> None: ... foo_main_module.__module__ = "__main__" class Bar: ... bar_instance = Bar() bar_instance_main_module = Bar() bar_instance_main_module.__module__ = "__main__"
18
296
gunicorn
tests/requests/valid/rfc9112_target_authority_ipv6_01.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. # RFC 9112 section 3.2.3: authority-form with IPv6 literal, used by CONNECT. request = { "method": "CONNECT", "uri": uri("[::1]:443"), "version": (1, 1), "headers": [ ("HOST", "[::1]:443"), ...
15
346
astropy
astropy/timeseries/periodograms/lombscargle/_testing.py
.py
import numpy as np def assert_not_strictly_equal( a, b, err="Output arrays are the same - dispatch test has failed" ): """ Asserts that passed arguments are not bitwise equal. Failure means that arrays can be considered to be a copy of each other. Parameters ---------- a : array-like ...
23
565
beam
sdks/python/apache_beam/examples/snippets/transforms/elementwise/partition_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,830
bazel
third_party/py/abseil/absl/logging/converter.py
.py
# Copyright 2017 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 ...
215
6,353
pyomo
pyomo/contrib/solver/solvers/gurobi/gurobi_persistent.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
1,407
51,460
luigi
luigi/rpc.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...
197
6,736
openvino
tests/layer_tests/common/constants.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os if os.environ.get('OUTPUT_DIR') is not None: out_path = os.environ['OUTPUT_DIR'] else: script_path = os.path.dirname(os.path.realpath(__file__)) out_path = os.path.join(script_path, 'out') ...
19
559
mlflow
mlflow/tracking/context/abstract_context.py
.py
from abc import ABCMeta, abstractmethod from mlflow.utils.annotations import developer_stable @developer_stable class RunContextProvider: """ Abstract base class for context provider objects specifying custom tags at run-creation time (e.g. tags specifying the git repo with which the run is associated). ...
36
1,060
mlflow
mlflow/tracing/display/__init__.py
.py
from mlflow.tracing.display.display_handler import ( IPythonTraceDisplayHandler, get_notebook_iframe_html, is_using_tracking_server, ) __all__ = [ "IPythonTraceDisplayHandler", "get_display_handler", "is_using_tracking_server", "get_notebook_iframe_html", ] def get_display_handler() -> IP...
41
1,265
beam
sdks/python/apache_beam/runners/interactive/caching/write_cache.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...
168
7,657
openvino
tests/samples_tests/smoke_tests/common/samples_common_test_class.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ 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.a...
315
13,139
rq
examples/run_example.py
.py
import os import time from fib import slow_fib from redis import Redis from rq import Queue from rq.job import JobStatus def enqueue(connection): # Range of Fibonacci numbers to compute fib_range = range(20, 34) # Kick off the tasks asynchronously q = Queue(connection=connection) jobs = [q.enqu...
50
1,236
saleor
saleor/graphql/account/tests/bulk_mutations/test_customer_bulk_update.py
.py
from unittest.mock import ANY, patch import graphene import pytest from .....account import models from .....account.error_codes import CustomerBulkUpdateErrorCode from .....account.events import CustomerEvents from .....attribute.models import AssignedUserAttributeValue from .....giftcard.models import GiftCard from...
1,588
51,687
python-prompt-toolkit
src/prompt_toolkit/styles/named_colors.py
.py
""" All modern web browsers support these 140 color names. Taken from: https://www.w3schools.com/colors/colors_names.asp """ from __future__ import annotations __all__ = [ "NAMED_COLORS", ] NAMED_COLORS: dict[str, str] = { "AliceBlue": "#f0f8ff", "AntiqueWhite": "#faebd7", "Aqua": "#00ffff", "Aq...
163
4,367
onnxruntime
onnxruntime/test/python/quantization/op_test_utils.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- from __fut...
674
27,067
textual
tests/test_command.py
.py
from __future__ import annotations from typing import Iterable from textual.app import App, ComposeResult, SystemCommand from textual.containers import Grid from textual.screen import ModalScreen, Screen from textual.widgets import Button, Label class QuitScreen(ModalScreen[bool]): """Screen with a dialog to qu...
63
1,886
mlflow
mlflow/gateway/providers/huggingface.py
.py
import time from typing import Any from mlflow.gateway.config import EndpointConfig, HuggingFaceTextGenerationInferenceConfig from mlflow.gateway.exceptions import AIGatewayException from mlflow.gateway.providers.base import BaseProvider from mlflow.gateway.providers.utils import ( rename_payload_keys, send_re...
121
4,810
saleor
saleor/giftcard/tests/fixtures/__init__.py
.py
from .giftcard import * # noqa: F403 from .giftcard_event import * # noqa: F403 from .giftcard_tag import * # noqa: F403
4
124
conda
conda/gateways/disk/permissions.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Disk utility functions for modifying file and directory permissions.""" from errno import EACCES, ENOENT, EPERM, EROFS from itertools import chain from logging import getLogger from os import X_OK, access, chmod, lstat, walk from os.path imp...
89
3,057
metrics
src/torchmetrics/multimodal/clip_iqa.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...
274
11,924
confluent-kafka-python
src/confluent_kafka/schema_registry/common/json_schema.py
.py
import decimal import logging from io import BytesIO from typing import Any, List, Optional, Set, Union import httpx import referencing from jsonschema import ValidationError, validate from referencing import Registry, Resource from referencing._core import Resolver from confluent_kafka.schema_registry import RuleKin...
345
12,067
onnxruntime
onnxruntime/test/python/contrib_ops/onnx_test_trilu.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # # Test reference implementation and model for ONNX Runtime conrtib op trilu import unittest import numpy as np import onnx from onnx_contrib_ops_helper import expect def triu_reference_implementation(x, k=0): return ...
291
8,902
pyomo
examples/pyomobook/nonlinear-ch/multimodal/multimodal_init2.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...
29
1,038
more-itertools
more_itertools/more.py
.py
__lazy_modules__ = frozenset({'queue', 'threading'}) import math import types from collections import Counter, defaultdict, deque from collections.abc import Sequence from contextlib import suppress from functools import cached_property, partial, wraps from heapq import heapify, heapreplace from itertools import ( ...
5,565
172,000
pymc
pymc/logprob/transform_value.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...
268
9,569
lemur
lemur/pending_certificates/models.py
.py
""" .. module: lemur.pending_certificates.models Copyright (c) 2018 and onwards Netflix, Inc. All rights reserved. .. moduleauthor:: James Chuong <jchuong@instartlogic.com> """ from datetime import datetime as dt from sqlalchemy import ( Integer, ForeignKey, String, DefaultClause, func, Co...
184
5,976
saleor
saleor/graphql/discount/tests/benchmark/test_promotion_delete.py
.py
import graphene import pytest from ....tests.utils import get_graphql_content from ..mutations.test_promotion_delete import PROMOTION_DELETE_MUTATION @pytest.mark.django_db @pytest.mark.count_queries(autouse=False) def test_promotion_delete( staff_api_client, permission_group_manage_discounts, catalogue_...
62
1,539
wandb
tests/unit_tests/test_tables.py
.py
import datetime import json import numpy as np import pytest import wandb from wandb.sdk.data_types.table import _ForeignKeyType, _PrimaryKeyType def test_basic_ndx(): # Base Case table_a = wandb.Table(columns=["b"], data=[["a"], ["b"]]) table = wandb.Table(columns=["fi", "c"]) for _ndx, _ in table_a...
447
14,289
pyomo
doc/OnlineDocs/src/data/ABCD5.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...
29
1,050
mlflow
tests/demo/test_registry.py
.py
import pytest from mlflow.demo.base import BaseDemoGenerator, DemoFeature def test_register_and_get(fresh_registry, stub_generator): fresh_registry.register(stub_generator) assert fresh_registry.get(DemoFeature.TRACES) is stub_generator def test_register_duplicate_raises(fresh_registry, stub_generator): ...
49
1,523
saleor
saleor/core/utils/text.py
.py
import unicodedata def strip_accents(text: str) -> str: """Remove diacritical marks from text, e.g. 'Magnésium' → 'Magnesium'.""" nfkd = unicodedata.normalize("NFKD", text) return "".join(c for c in nfkd if not unicodedata.combining(c)) def safe_truncate(text: str, max_length: int) -> str: """Trunca...
26
994
wandb
wandb/sdk/artifacts/_generated/artifact_membership_files.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/artifacts/ from __future__ import annotations from typing import Literal from pydantic import Field from wandb._pydantic import GQLResult, Typename from .fragments import FileFragment, PageInfoFragment class ArtifactMembershipFiles(GQLResult): pr...
62
1,958
coveragepy
coverage/patch.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 """Invasive patches for coverage.py.""" from __future__ import annotations import contextlib import os from typing import TYPE_CHECKING, Any, NoReturn from cov...
119
4,149
openvino
docs/articles_en/assets/snippets/ov_custom_op.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # ! [op:common_include] from openvino import Op # ! [op:common_include] # ! [op:header] class Identity(Op): # ! [op:header] # ! [op:ctor] def __init__(self, inputs=None, **attrs): super().__init__(self, inputs) ...
46
1,027
saleor
saleor/tests/e2e/checkout/test_unlogged_customer_is_unable_to_buy_unpublished_product.py
.py
import pytest from ..product.utils import ( create_category, create_product, create_product_type, create_product_variant, create_product_variant_channel_listing, raw_create_product_channel_listing, ) from ..shop.utils.preparing_shop import prepare_default_shop from ..utils import assign_permiss...
111
2,794
tomli
tests/__init__.py
.py
# SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2021 Taneli Hukkinen # Licensed to PSF under a Contributor Agreement. __all__ = ("tomllib",) # By changing this one line, we can run the tests against # a different module name. import tomli as tomllib
10
261