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
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/mul_canon.py
.py
from cvxpy.atoms.affine import add_expr def mul_canon(expr, args): del expr return add_expr.AddExpression(args), []
7
126
cvxpy
cvxpy/reductions/utilities.py
.py
""" Copyright 2018 Akshay Agrawal 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...
162
5,961
hatch
tests/helpers/templates/wheel/standard_no_strict_naming.py
.py
from hatch.template import File from hatch.utils.fs import Path from hatchling.__about__ import __version__ from hatchling.metadata.spec import DEFAULT_METADATA_VERSION from ..new.feature_no_src_layout import get_files as get_template_files from .utils import update_record_file_contents def get_files(**kwargs): ...
50
1,281
astropy
astropy/stats/tests/test_histogram.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np import pytest from numpy.testing import assert_allclose from astropy.stats import ( calculate_bin_edges, freedman_bin_width, histogram, knuth_bin_width, scott_bin_width, ) from astropy.utils.compat.optional_deps imp...
193
5,969
django-cms
cms/test_utils/project/fourth_urls_for_apphook_tests.py
.py
from django.conf import settings from django.conf.urls.i18n import i18n_patterns from django.contrib import admin from django.urls import include, re_path from django.views.i18n import JavaScriptCatalog from django.views.static import serve from cms.utils.conf import get_cms_setting admin.autodiscover() urlpatterns ...
24
806
beam
learning/tour-of-beam/learning-content/core-transforms/map/group-by-key/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...
53
1,787
beam
sdks/python/apache_beam/transforms/util.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...
2,643
97,018
openvino
tests/e2e_tests/common/infer/provider.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import inspect from e2e_tests.test_utils.test_utils import log_timestamp from e2e_tests.common.common.base_provider import BaseProvider, BaseStepProvider class ClassProvider(BaseProvider): registry = {} @classmethod def va...
36
1,257
clearml
clearml/backend_api/services/v2_23/workers.py
.py
""" workers service Provides an API for worker machines, allowing workers to report status and get tasks for execution """ from typing import List, Optional, Any import six from datetime import datetime import enum from dateutil.parser import parse as parse_datetime from clearml.backend_api.session import ( Reques...
2,586
90,963
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_scatter.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # fill_const paddle model generator # import numpy as np from save_model import saveModel import paddle import sys def scatter(name : str, x,index,updates,overwrite=True): paddle.enable_static() with paddle.static.program_gua...
43
1,609
saleor
saleor/graphql/shipping/tests/mutations/test_bulk_delete.py
.py
from unittest import mock import graphene import pytest from .....shipping.models import ShippingMethod, ShippingZone from ....tests.utils import get_graphql_content @pytest.fixture def shipping_method_list(shipping_zone): shipping_method_1 = ShippingMethod.objects.create( shipping_zone=shipping_zone, n...
178
4,912
mlflow
tests/langchain/sample_code/workflow.py
.py
import json import os from typing import Any, Sequence from langchain_core.language_models import LanguageModelLike from langchain_core.messages import AIMessage, ToolCall from langchain_core.outputs import ChatGeneration, ChatResult from langchain_core.runnables import RunnableConfig, RunnableLambda from langchain_co...
120
3,311
beam
sdks/python/apache_beam/ml/rag/enrichment/milvus_search.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...
594
23,361
pdm
src/pdm/project/lockfile/freshness.py
.py
from __future__ import annotations import dataclasses import hashlib import json import re from collections.abc import Mapping, Sequence from datetime import date, datetime, time from typing import TYPE_CHECKING, Any from dep_logic.markers import AnyMarker, BaseMarker, MarkerUnion from pdm.exceptions import PdmExcep...
460
17,503
wagtail
wagtail/admin/widgets/workflows.py
.py
import json from django import forms from django.utils.translation import gettext_lazy as _ from wagtail.admin.staticfiles import versioned_static from wagtail.admin.widgets import BaseChooser from wagtail.models import Task class AdminTaskChooser(BaseChooser): choose_one_text = _("Choose a task") choose_an...
31
901
hatch
tests/helpers/templates/new/projects_urls_space_in_label.py
.py
from hatch.template import File from hatch.utils.fs import Path from ..licenses import MIT def get_files(**kwargs): return [ File( Path("LICENSE.txt"), MIT.replace("<year>", f"{kwargs['year']}-present", 1).replace( "<copyright holders>", f"{kwargs['author']} <{kwar...
133
3,727
sphinx
tests/test_extensions/test_ext_graphviz.py
.py
"""Test sphinx.ext.graphviz extension.""" from __future__ import annotations import re import sys from typing import TYPE_CHECKING import pytest from sphinx.ext.graphviz import ClickableMapDefinition if TYPE_CHECKING: from sphinx.testing.util import SphinxTestApp @pytest.mark.sphinx('html', testroot='ext-gra...
221
8,575
httpie
tests/test_sessions.py
.py
import json import os import shutil from contextlib import contextmanager from datetime import datetime from unittest import mock from pathlib import Path from typing import Iterator import pytest from .fixtures import FILE_PATH_ARG, UNICODE from httpie.context import Environment from httpie.encoding import UTF8 from...
853
27,509
onnxruntime
onnxruntime/test/platform/apple/generate_ipa_export_options_plist.py
.py
import argparse plist_file_content = """ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>method</key> <string>development</string> <key>teamID</key> <string>{team_id}</string>...
55
1,778
onnx
onnx/reference/ops/op_lp_normalization.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops._op import OpRunUnaryNum class LpNormalization(OpRunUnaryNum): def _run(self, x, axis=None, p=None): axis = axis or self.axis p = p or se...
20
582
mlflow
docs/scripts/convert-notebooks.py
.py
""" Converts all .ipynb files from the docs/ folder into .mdx files. This script uses nbconvert to do the processing. """ import multiprocessing import re from pathlib import Path import nbformat import yaml from nbconvert.exporters import MarkdownExporter from nbconvert.preprocessors import Preprocessor SOURCE_DIR...
118
3,591
beam
sdks/python/apache_beam/ml/rag/chunking/__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 us...
22
913
saleor
saleor/graphql/plugins/tests/queries/test_plugins.py
.py
import copy from unittest import mock import graphene import pytest from .....plugins.base_plugin import ConfigurationTypeField from .....plugins.manager import get_plugins_manager from .....plugins.tests.sample_plugins import ChannelPluginSample, PluginSample from ....tests.utils import assert_no_permission, get_gra...
430
13,839
textual
tests/test_log.py
.py
from textual.app import App, ComposeResult from textual.widgets import Log async def test_process_line(): log = Log() assert log._process_line("foo") == "foo" assert log._process_line("foo\t") == "foo " assert log._process_line("\0foo") == "�foo" async def test_disabled_log_no_attribute_error() ...
26
808
mlflow
mlflow/models/auth_policy.py
.py
from mlflow.models.resources import Resource, _ResourceBuilder class UserAuthPolicy: """ A minimal list of scopes that the user should have access to in order to invoke this model Note: This is only compatible with Databricks Environment currently. TODO: Add Databricks Documentation for User Auth...
80
2,305
textual
tests/test_widget_navigation.py
.py
from __future__ import annotations import pytest from textual._widget_navigation import ( find_first_enabled, find_last_enabled, find_next_enabled, find_next_enabled_no_wrap, get_directed_distance, ) class _D: def __init__(self, disabled): self.disabled = disabled # Represent disab...
155
4,414
textual
docs/examples/app/widgets03.py
.py
from textual.app import App from textual.widgets import Button, Welcome class WelcomeApp(App): def on_key(self) -> None: self.mount(Welcome()) self.query_one(Button).label = "YES!" if __name__ == "__main__": app = WelcomeApp() app.run()
14
269
probability
tensorflow_probability/python/distributions/independent.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...
468
19,612
pyro
pyro/distributions/transforms/lower_cholesky_affine.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import torch from torch.distributions.transforms import Transform from .. import constraints from ..util import copy_docs_from @copy_docs_from(Transform) class LowerCholeskyAffine(Transform): """ A bijection of the form,...
78
2,479
openvino
src/bindings/python/tests/test_runtime/test_output_node.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import openvino.opset13 as ops from openvino import Type, Tensor, Symbol import numpy as np def test_output_replace(device): param = ops.parameter([1, 64], Type.i64) param.output(0).get_tensor().set_nam...
54
1,628
hypercorn
src/hypercorn/trio/tcp_server.py
.py
from __future__ import annotations from collections.abc import Generator from math import inf from typing import Any import trio from .task_group import TaskGroup from .worker_context import TrioSingleTask, WorkerContext from ..config import Config from ..events import Closed, Event, RawData, Updated from ..protocol...
141
4,705
textual
src/textual/document/_edit.py
.py
from __future__ import annotations from dataclasses import dataclass, field from typing import TYPE_CHECKING from textual.document._document import EditResult, Location, Selection if TYPE_CHECKING: from textual.widgets import TextArea @dataclass class Edit: """Implements the Undoable protocol to replace te...
152
5,707
sqlmap
thirdparty/fcrypt/fcrypt.py
.py
# fcrypt.py """Unix crypt(3) password hash algorithm. This is a port to Python of the standard Unix password crypt function. It's a single self-contained source file that works with any version of Python from version 1.5 or higher. The code is based on Eric Young's optimised crypt in C. Python fcrypt is intended fo...
618
26,757
openvino
docs/articles_en/assets/snippets/ov_preprocessing.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # import openvino.properties as props from openvino.preprocess import ResizeAlgorithm, ColorFormat from openvino import Layout, Type, serialize import openvino as ov import openvino.opset12 as ops from utils import get_model, get_temp_di...
234
7,884
beam
sdks/python/apache_beam/io/gcp/experimental/spannerio_read_it_test.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
360
12,391
metrics
src/torchmetrics/regression/csi.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...
113
4,792
beam
examples/notebooks/patch.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...
97
3,234
metrics
src/torchmetrics/nominal/__init__.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...
28
987
funcy
funcy/funcolls.py
.py
from .funcs import compose, juxt from .colls import some, none, one __all__ = ['all_fn', 'any_fn', 'none_fn', 'one_fn', 'some_fn'] def all_fn(*fs): """Constructs a predicate, which holds when all fs hold.""" return compose(all, juxt(*fs)) def any_fn(*fs): """Constructs a predicate, which holds when any...
28
775
loguru
tests/exceptions/source/others/broken_but_decorated_repr.py
.py
import sys from loguru import logger logger.remove() logger.add(sys.stderr, format="", diagnose=True, backtrace=True, colorize=False, catch=True) class Foo: @logger.catch(reraise=True) def __repr__(self): raise ValueError("Something went wrong (Foo)") class Bar: def __repr__(self): wit...
34
532
pyomo
pyomo/solvers/tests/piecewise_linear/problems/piecewise_vararray.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
1,890
onnxruntime
onnxruntime/test/providers/cpu/tensor/resize_sample_test_gen.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # This code is used to generate test data for the test case: # TEST(ResizeOpTest, NoAntialias_AlignCorners_Cubic_Floor_NHWC) # located in onnxruntime/test/providers/cpu/tensor/resize_op_test.cc import torch import torch.nn.f...
35
1,003
textual
docs/examples/styles/keyline_horizontal.py
.py
from textual.app import App, ComposeResult from textual.containers import Horizontal from textual.widgets import Placeholder class KeylineApp(App): CSS_PATH = "keyline_horizontal.tcss" def compose(self) -> ComposeResult: with Horizontal(): yield Placeholder() yield Placeholder...
19
421
lemur
lemur/common/schema.py
.py
""" .. module: lemur.common.schema :platform: unix :copyright: (c) 2018 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: Kevin Glisson <kglisson@netflix.com> """ from functools import wraps from flask import request, current_app from inflection impor...
186
5,627
scikit-bio
skbio/sequence/tests/test_substitution.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. # --------------------------------------------...
209
8,362
probability
tensorflow_probability/python/experimental/distributions/marginal_fns_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...
181
7,325
onnx
onnx/reference/ops/op_qlinear_conv.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 from onnx.reference.ops.op_conv import _conv_implementation class QLinearConv(OpRun): def _run( self, x, x_scale,...
79
2,516
scikit-bio
skbio/alignment/tests/test_tabular_msa.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. # --------------------------------------------...
3,941
148,166
mlflow
tests/utils/test_annotations.py
.py
import re from dataclasses import dataclass, fields import pytest from mlflow.utils.annotations import _get_min_indent_of_docstring, deprecated, keyword_only # Suppress expected deprecation warnings from test fixtures pytestmark = pytest.mark.filterwarnings("ignore:.*is deprecated.*:FutureWarning") class MyClass: ...
329
8,393
probability
tensorflow_probability/python/internal/backend/numpy/composite_tensor.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...
22
790
cvxpy
cvxpy/atoms/elementwise/inv_pos.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...
25
769
mlflow
tests/store/dump_schema.py
.py
"""Script that generates a dump of the MLflow tracking database schema""" import os import sys import tempfile import sqlalchemy from sqlalchemy.schema import CreateTable, MetaData from mlflow.store.tracking.sqlalchemy_store import SqlAlchemyStore def dump_db_schema(db_url, dst_file): engine = sqlalchemy.creat...
40
1,251
coremltools
coremltools/models/ml_program/experimental/torch/perf_utils.py
.py
# Copyright (c) 2025, 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 collections import defaultdict from dataclasses import dataclass from typing import Any, Dict, List...
266
10,220
pyomo
pyomo/core/base/range.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...
952
35,116
mlflow
dev/clint/tests/rules/test_typing_extensions.py
.py
from pathlib import Path from clint.config import Config from clint.index import SymbolIndex from clint.linter import Position, Range, lint_file from clint.rules.typing_extensions import TypingExtensions def test_typing_extensions(index: SymbolIndex) -> None: code = """ # Bad from typing_extensions import ParamS...
24
719
saleor
saleor/auth/__init__.py
.py
# This module was created to be able to handle the migration process after we move # the part of Django Auth directly to Saleor.
3
129
mlflow
mlflow/server/graphql/graphql_schema_extensions.py
.py
import math import graphene from graphql import ( DirectiveLocation, GraphQLArgument, GraphQLDirective, GraphQLNonNull, GraphQLString, ) import mlflow from mlflow.server.graphql.autogenerated_graphql_schema import ( MlflowExperiment, MlflowMetric, MlflowModelVersion, MlflowRun, ...
96
3,116
saleor
saleor/payment/gateways/stripe/tests/test_plugin_deprecated.py
.py
from unittest.mock import Mock, patch from .... import TransactionKind from ....utils import create_payment_information, price_to_minor_unit from ..consts import AUTOMATIC_CAPTURE_METHOD, SUCCESS_STATUS @patch("saleor.payment.gateways.stripe.stripe_api.stripe.Customer.create") @patch("saleor.payment.gateways.stripe....
81
2,801
mlflow
tests/genai/scorers/deepeval/test_deepeval_scorer.py
.py
from unittest.mock import Mock, patch import pydantic import pytest import mlflow from mlflow.entities.assessment import Feedback from mlflow.entities.assessment_source import AssessmentSourceType from mlflow.exceptions import MlflowException from mlflow.genai.judges.utils import CategoricalRating from mlflow.genai.s...
556
19,770
clearml
examples/reporting/model_reporting.py
.py
# ClearML - Example of manual model reporting from clearml import Task, OutputModel # Connecting ClearML with the current process, task = Task.init(project_name="examples", task_name="Model reporting example") # Create output model and connect it to the task output_model = OutputModel(task=task) # Optional: add labe...
22
788
hydra
hydra/_internal/core_plugins/structured_config_source.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import importlib import warnings from typing import List, Optional from hydra.core.config_store import ConfigStore from hydra.core.object_type import ObjectType from hydra.plugins.config_source import ConfigResult, ConfigSource class StructuredCo...
64
2,328
wagtail
wagtail/admin/tests/pages/test_bulk_actions/test_bulk_move.py
.py
from unittest import mock import swapper from django.contrib.auth import get_user_model from django.contrib.auth.models import Permission from django.http import HttpRequest, HttpResponse from django.test import TestCase from django.urls import reverse from wagtail.admin.views.pages.bulk_actions.page_bulk_action impo...
357
13,005
beam
sdks/python/apache_beam/ml/gcp/naturallanguageml_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...
62
2,328
textual
tests/test_version.py
.py
import re # https://stackoverflow.com/questions/37972029/regex-to-match-pep440-compliant-version-strings VERSION_PATTERN = r""" v? (?: (?:(?P<epoch>[0-9]+)!)? # epoch (?P<release>[0-9]+(?:\.[0-9]+)*) # release segment (?P<pre> ...
42
1,233
returns
tests/test_future/test_future_container/test_asyncize_decorator.py
.py
import pytest from returns.future import asyncify @asyncify def _function(arg: int) -> float: return arg / 2 @pytest.mark.anyio async def test_asyncify_decorator(): """Ensure that function marked with ``@asyncify`` is awaitable.""" coro = _function(2) assert await coro == 1
17
297
saleor
saleor/graphql/product/mutations/collection/__init__.py
.py
from .collection_add_products import CollectionAddProducts from .collection_create import CollectionCreate from .collection_delete import CollectionDelete from .collection_remove_products import CollectionRemoveProducts from .collection_reorder_products import CollectionReorderProducts from .collection_update import Co...
16
516
pyomo
pyomo/gdp/tests/test_gdp_reclassification_error.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...
53
2,081
saleor
saleor/graphql/checkout/tests/mutations/test_checkout_shipping_address_update.py
.py
import datetime from unittest import mock from unittest.mock import ANY, patch import pytest from django.test import override_settings from django.utils import timezone from freezegun import freeze_time from .....checkout.actions import call_checkout_info_event from .....checkout.error_codes import CheckoutErrorCode ...
1,481
48,337
cvxpy
cvxpy/reductions/complex2real/canonicalizers/__init__.py
.py
""" Copyright 2017 Robin Verschueren, 2022 - 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 ...
273
11,367
pyomo
examples/pyomobook/nonlinear-ch/multimodal/multimodal_init1.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...
28
1,044
pyomo
examples/pyomo/suffixes/ipopt_warmstart.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...
120
4,317
probability
tensorflow_probability/python/internal/backend/numpy/resource_variable_ops.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...
27
872
textual
docs/examples/styles/min_height.py
.py
from textual.app import App from textual.containers import Horizontal from textual.widgets import Placeholder class MinHeightApp(App): CSS_PATH = "min_height.tcss" def compose(self): yield Horizontal( Placeholder("min-height: 25%", id="p1"), Placeholder("min-height: 75%", id="...
21
509
black
tests/data/cases/trailing_comma_optional_parens3.py
.py
if True: if True: if True: return _( "qweasdzxcqweasdzxcqweasdzxcqweasdzxcqweasdzxcqweasdzxcqweasdzxcqweasdzxcqweasdzxcqweas " + "qweasdzxcqweasdzxcqweasdzxcqweasdzxcqweasdzxcqweasdzxcqweasdzxcqweasdzxcqwegqweasdzxcqweasdzxc.", "qweasdzxcqweasdzxcq...
22
967
conda
conda/gateways/disk/link.py
.py
# Copyright (C) 2012 Anaconda, Inc & Jason R. Coombs # SPDX-License-Identifier: BSD-3-Clause, MIT """Disk utility functions for symlinking files and folders. Portions of the code within this module are taken from https://github.com/jaraco/jaraco.windows which is MIT licensed by Jason R. Coombs. https://github.com/jar...
417
13,614
astropy
astropy/modeling/tests/test_physical_models.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """Tests for physical functions.""" # pylint: disable=no-member, invalid-name import numpy as np import pytest from astropy import cosmology from astropy import units as u from astropy.modeling.fitting import ( DogBoxLSQFitter, LevMarLSQFitter, ...
795
23,389
beam
sdks/python/apache_beam/ml/gcp/__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 us...
26
1,073
kombu
examples/simple_receive.py
.py
""" Example receiving a message using the SimpleQueue interface. """ from __future__ import annotations from kombu import Connection #: Create connection #: If hostname, userid, password and virtual_host is not specified #: the values below are the default, but listed here so it can #: be easily changed. with Conne...
30
939
pyro
tests/contrib/tracking/test_ekf.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import torch from pyro.contrib.tracking.dynamic_models import NcpContinuous, NcvContinuous from pyro.contrib.tracking.extended_kalman_filter import EKFState from pyro.contrib.tracking.measurements import PositionMeasurement from t...
74
2,792
onnxruntime
tools/python/util/qdq_helpers/optimize_qdq_model.py
.py
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import argparse import os import pathlib import onnx def optimize_qdq_model(): parser = argparse.ArgumentParser( os.path.basename(__file__), description="Update a QDQ format ONNX ...
38
1,242
black
tests/data/miscellaneous/blackd_diff.py
.py
def abc (): return ["hello", "world", "!"] print( "Incorrect formatting" )
7
98
wandb
wandb/automations/_generated/__init__.py
.py
# Generated by ariadne-codegen __all__ = [ "CREATE_AUTOMATION_GQL", "CREATE_GENERIC_WEBHOOK_INTEGRATION_GQL", "DELETE_AUTOMATION_GQL", "GET_AUTOMATIONS_LEGACY_GQL", "GET_ENTITY_AUTOMATIONS_GQL", "GET_ENTITY_AUTOMATIONS_LEGACY_GQL", "GET_ORG_AUTOMATIONS_GQL", "INTEGRATIONS_BY_ENTITY_GQL"...
103
3,069
wandb
wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py
.py
"""Artifact manifest v1.""" # Keep older-style type annotations in this legacy model. # ruff: noqa: UP006, UP035 from __future__ import annotations from operator import itemgetter from typing import Annotated, Any, ClassVar, Dict, Literal, final from pydantic import Field from wandb.sdk.lib.hashutil import HexMD5,...
73
2,696
mlflow
tests/server/auth/test_client.py
.py
import json from contextlib import contextmanager from urllib.parse import quote import pytest import requests import mlflow from mlflow import MlflowClient, MlflowException from mlflow.environment_variables import ( MLFLOW_AUTH_CONFIG_PATH, MLFLOW_FLASK_SERVER_SECRET_KEY, MLFLOW_TRACKING_PASSWORD, ML...
726
31,217
onnxruntime
onnxruntime/test/testdata/transform/fusion/bitmask_dropout_fusion_gen.py
.py
import onnx from onnx import OperatorSetIdProto, TensorProto, helper onnxdomain = OperatorSetIdProto() onnxdomain.version = 13 onnxdomain.domain = "" msdomain = OperatorSetIdProto() msdomain.version = 1 msdomain.domain = "com.microsoft" opsets = [onnxdomain, msdomain] def save(model_path, nodes, inputs, outputs, ini...
119
4,749
wagtail
wagtail/images/rich_text/contentstate.py
.py
""" Draftail / contentstate conversion """ from draftjs_exporter import DOM from wagtail.admin.rich_text.converters.contentstate_models import Entity from wagtail.admin.rich_text.converters.html_to_contentstate import ( AtomicBlockEntityElementHandler, ) from wagtail.images import get_image_model from wagtail.ima...
67
1,899
black
tests/data/cases/preview_hug_parens_with_braces_and_square_brackets_no_ll1.py
.py
# flags: --unstable --no-preview-line-length-1 # split out from preview_hug_parens_with_brackes_and_square_brackets, as it produces # different code on the second pass with line-length 1 in many cases. # Seems to be about whether the last string in a sequence gets wrapped in parens or not. foo(*["long long long long lo...
107
4,093
beam
sdks/python/apache_beam/examples/ml_transform/mltransform_image_embedding.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...
264
8,366
jupytext
tests/functional/simple_notebooks/test_knitr_spin.py
.py
import jupytext def test_jupytext_same_as_knitr_spin(r_spin_file, tmpdir): nb = jupytext.read(r_spin_file) rmd_jupytext = jupytext.writes(nb, "Rmd") # Rmd file generated with spin(hair='R/spin.R', knit=FALSE) rmd_file = r_spin_file.replace("R_spin", "Rmd").replace(".R", ".Rmd") with open(rmd_fil...
15
396
beam
sdks/python/apache_beam/utils/logger.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...
138
4,492
jupyterlab
jupyterlab/handlers/plugin_manager_handler.py
.py
"""Tornado handlers for plugin management.""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import dataclasses import json from jupyter_server.base.handlers import APIHandler from tornado import web from jupyterlab.extensions.manager import PluginManager clas...
65
1,915
probability
tensorflow_probability/python/distributions/mvn_linear_operator.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...
401
14,966
hatch
src/hatch/cli/project/metadata.py
.py
from __future__ import annotations from typing import TYPE_CHECKING import click if TYPE_CHECKING: from hatch.cli.application import Application @click.command(short_help="Display project metadata") @click.argument("field", required=False) @click.pass_obj def metadata(app: Application, field: str | None): ...
58
1,857
wandb
wandb/proto/wandb_base_pb2.py
.py
import google.protobuf protobuf_version = google.protobuf.__version__[0] if protobuf_version == "5": from wandb.proto.v5.wandb_base_pb2 import * elif protobuf_version == "6": from wandb.proto.v6.wandb_base_pb2 import * elif protobuf_version == "7": from wandb.proto.v7.wandb_base_pb2 import *
11
307
clearml
examples/frameworks/click/click_multi_cmd.py
.py
import click from clearml import Task @click.group() @click.option( '--print-something/--dont-print-something', default=True, ) @click.option( '--what-to-print', default='something', ) def cli(print_something, what_to_print): Task.init( project_name='examples', task_name='Click mul...
63
1,132
kombu
t/unit/transport/test_transport.py
.py
from __future__ import annotations from unittest.mock import Mock, patch from kombu import transport class test_supports_librabbitmq: def test_eventlet(self): with patch('kombu.transport._detect_environment') as de: de.return_value = 'eventlet' assert not transport.supports_libr...
34
1,014
probability
spinoffs/inference_gym/inference_gym/tools/stan/lorenz_system.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...
190
5,950
jupytext
tests/functional/simple_notebooks/test_read_simple_matlab.py
.py
from nbformat.v4.nbbase import new_code_cell, new_notebook import jupytext from jupytext.compare import compare, compare_notebooks def test_hide_code_tag( no_jupytext_version_number, nb=new_notebook( metadata={"jupytext": {"main_language": "matlab"}}, cells=[new_code_cell("1 + 1", metadata={"...
37
961
openvino
tests/layer_tests/pytorch_tests/test_index_select.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class TestIndexSelect(PytorchLayerTest): def _prepare_input(self, index, out=False, dim=0): import numpy as np index = np.array(in...
48
1,760
conda
conda/auxlib/decorators.py
.py
from collections.abc import Hashable from types import GeneratorType from functools import wraps # TODO: spend time filling out functionality and make these more robust def memoizemethod(method): """ Decorator to cause a method to cache it's results in self for each combination of inputs and return the...
217
6,388