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
ipython
IPython/core/magics/code.py
.py
"""Implementation of code management magic functions. """ #----------------------------------------------------------------------------- # Copyright (c) 2012 The IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with th...
771
28,359
mlflow
mlflow/gateway/providers/mosaicml.py
.py
import time import warnings from contextlib import contextmanager from typing import Any from mlflow.exceptions import MlflowException from mlflow.gateway.config import EndpointConfig, MosaicMLConfig from mlflow.gateway.exceptions import AIGatewayException from mlflow.gateway.providers.base import BaseProvider from ml...
308
10,648
hatch
backend/src/hatchling/plugin/exceptions.py
.py
class UnknownPluginError(ValueError): pass
3
47
gunicorn
gunicorn/workers/base.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. import io import os import signal import sys import time import traceback from datetime import datetime from random import randint from ssl import SSLError from gunicorn import util from gunicorn.http.errors impor...
288
9,899
wandb
tests/assets/scripts/eval.py
.py
import argparse import math import random import wandb def main(attach_id: str, eval_step: int, project: str): run = wandb.init( id=attach_id, project=project, settings=wandb.Settings( mode="shared", console="off", _disable_machine_info=True, ...
43
949
probability
tensorflow_probability/python/distributions/logistic.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...
236
8,411
probability
tensorflow_probability/python/bijectors/normal_cdf_test.py
.py
# Copyright 2018 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
77
3,087
onnx
onnx/backend/test/case/node/less.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 Less(Base): @staticmethod def export() -> None: node =...
69
2,386
openvino
tests/model_hub_tests/tensorflow/test_tf_read_model.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import gc import os import platform import shutil import pytest import tensorflow as tf import tensorflow_hub as hub # noinspection PyUnresolvedReferences #import tensorflow_text # do not delete, needed for text models. Commented due t...
158
7,049
metrics
tests/unittests/image/test_d_s.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...
430
14,085
saleor
saleor/graphql/product/tests/queries/products_filtrations/test_over_references_pages.py
.py
import graphene import pytest from ......attribute import AttributeEntityType, AttributeType from ......attribute.models import Attribute, AttributeValue from ......attribute.utils import associate_attribute_values_to_instance from ......page.models import Page from .....core.utils import to_global_id_or_none from ......
427
13,217
wandb
wandb/plot/roc_curve.py
.py
from __future__ import annotations import numbers from collections.abc import Sequence from typing import TYPE_CHECKING import wandb from wandb import util from wandb.plot.custom_chart import plot_table from wandb.plot.utils import test_missing, test_types if TYPE_CHECKING: from wandb.plot.custom_chart import Cu...
165
5,653
mlflow
mlflow/store/db_migrations/versions/1a0cddfcaa16_add_webhooks_and_webhook_events_tables.py
.py
"""Add webhooks and webhook_events tables Create Date: 2025-07-07 23:00:00.000000 """ import sqlalchemy as sa from alembic import op from mlflow.store.model_registry.dbmodels.models import SqlWebhook, SqlWebhookEvent # revision identifiers, used by Alembic. revision = "1a0cddfcaa16" down_revision = "de4033877273" ...
72
2,926
astropy
astropy/nddata/nddata_base.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # This module implements the base NDDataBase class. from abc import ABCMeta, abstractmethod __all__ = ["NDDataBase"] class NDDataBase(metaclass=ABCMeta): """Base metaclass that defines the interface for N-dimensional datasets with associated m...
81
1,994
httpie
tests/test_exit_status.py
.py
from unittest import mock from httpie.status import ExitStatus from .utils import MockEnvironment, http, HTTP_OK def test_keyboard_interrupt_during_arg_parsing_exit_status(httpbin): with mock.patch('httpie.cli.definition.parser.parse_args', side_effect=KeyboardInterrupt()): r = http('...
75
2,642
saleor
saleor/graphql/invoice/tests/test_send_invoice_notification.py
.py
from unittest.mock import patch import graphene from ....core import JobStatus from ....core.notify import NotifyEventType from ....core.tests.utils import get_site_context_payload from ....graphql.tests.utils import assert_no_permission, get_graphql_content from ....invoice.models import Invoice from ....invoice.not...
205
7,181
biopython
Bio/Blast/NCBIWWW.py
.py
# Copyright 1999 by Jeffrey Chang. All rights reserved. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included as part of this # package. # # Patched by Brad Chapm...
374
14,116
pyomo
pyomo/core/expr/numeric_expr.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...
4,010
108,664
wandb
tests/system_tests/test_functional/test_tensorboard/test_wandb_tb_log.py
.py
"""Tests for wandb.tensorboard.log and wandb.tensorboard.WandbHook.""" import pytest import tensorflow as tf import wandb from tensorboard.compat.proto import summary_pb2 def test_wandb_tf_log(wandb_backend_spy, assets_path): with wandb.init(sync_tensorboard=True) as run: summary_pb = open(assets_path("w...
108
4,459
metrics
src/torchmetrics/functional/classification/group_fairness.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...
383
16,872
wandb
wandb/apis/_generated/search_users.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/api/ from __future__ import annotations from wandb._pydantic import GQLResult from .fragments import UserFragment class SearchUsers(GQLResult): users: SearchUsersUsers | None class SearchUsersUsers(GQLResult): edges: list[SearchUsersUsersEdge...
26
496
openvino
tests/layer_tests/pytorch_tests/test_getitem_oob_index.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Regression tests for out-of-bounds index validation in aten::__getitem__ replacer transforms (CVE fix). These tests verify that ov.convert_model raises a proper exception (instead of crashing with SIGSEGV) when a TorchScript model c...
433
16,211
beam
sdks/python/apache_beam/ml/inference/vertex_ai_inference.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...
298
12,020
sqlmap
lib/core/datatype.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import copy import threading from collections import OrderedDict from thirdparty.six.moves import collections_abc as _collections class AttribDict(dict): """ This class ...
243
6,529
cvxpy
cvxpy/reductions/solvers/nlp_solvers/__init__.py
.py
""" Copyright 2025 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...
16
569
readthedocs.org
readthedocs/invitations/tests/test_signals.py
.py
from django.contrib.auth.models import User from django.test import TestCase from django_dynamic_fixture import get from readthedocs.invitations.models import Invitation from readthedocs.organizations.models import Organization, Team from readthedocs.projects.models import Project class TestSignals(TestCase): de...
38
1,243
sphinx
sphinx/ext/autodoc/importer.py
.py
"""Importer utilities for autodoc""" from __future__ import annotations import traceback from importlib.machinery import EXTENSION_SUFFIXES from typing import TYPE_CHECKING, NamedTuple from sphinx.errors import PycodeError from sphinx.ext.autodoc._dynamic._importer import ( _find_type_stub_spec, # NoQA: F401 ...
324
11,656
gunicorn
tests/docker/dirty_arbiter/gunicorn_conf.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ Gunicorn configuration for integration tests. """ bind = "0.0.0.0:8000" workers = 1 worker_class = "sync" dirty_workers = 1 dirty_apps = ["app:TestDirtyApp"] dirty_timeout = 30 dirty_graceful_timeout = 5 timeo...
21
399
pyomo
pyomo/contrib/incidence_analysis/tests/test_matching.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...
246
6,976
pyomo
pyomo/core/tests/unit/test_var.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
1,831
64,669
pyro
tests/distributions/test_unit.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import pytest import torch import pyro.distributions as dist from tests.common import assert_equal @pytest.mark.parametrize("batch_shape", [(), (4,), (3, 2)]) def test_shapes(batch_shape): log_factor = torch.randn(batch_shap...
33
966
omegaconf
tests/interpolation/built_in_resolvers/test_oc_dict.py
.py
import re from typing import Any, List from pytest import mark, param, raises from omegaconf import DictConfig, ListConfig, OmegaConf from omegaconf.errors import ( InterpolationResolutionError, InterpolationToMissingValueError, ) from omegaconf.resolvers.oc.dict import _get_and_validate_dict_input from tests...
338
9,570
coremltools
coremltools/converters/mil/mil/ops/tests/iOS18/test_transformers.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools import numpy as np import pytest import torch import coremltools as ct from coreml...
420
14,358
mlflow
mlflow/genai/scorers/deepeval/models.py
.py
from __future__ import annotations import json from typing import Any from deepeval.models.base_model import DeepEvalBaseLLM from pydantic import ValidationError from mlflow.genai.scorers.llm_backend import ScorerLLMClient def _build_json_prompt_with_schema(prompt: str, schema) -> str: return ( f"{prom...
91
3,181
coremltools
deps/pybind11/tests/test_opaque_types.py
.py
from __future__ import annotations import pytest from pybind11_tests import ConstructorStats, UserType from pybind11_tests import opaque_types as m def test_string_list(): lst = m.StringList() lst.push_back("Element 1") lst.push_back("Element 2") assert m.print_opaque_list(lst) == "Opaque list: [Ele...
61
1,883
django-cms
cms/urls.py
.py
from django.conf import settings from django.urls import URLResolver, include, path, re_path from django.urls.resolvers import RegexPattern from django.utils.functional import cached_property from cms import views from cms.constants import SLUG_REGEXP if settings.APPEND_SLASH: regexp = r'^(?P<slug>%s)/$' % SLUG_...
53
1,592
cvxpy
cvxpy/reductions/solvers/conic_solvers/glop_conif.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 ...
240
9,641
returns
returns/contrib/mypy/_typeops/fallback.py
.py
from collections.abc import Callable from functools import wraps from typing import TypeVar from mypy.types import AnyType, TypeOfAny _CallableType = TypeVar('_CallableType', bound=Callable) def asserts_fallback_to_any(function: _CallableType) -> _CallableType: """ Falls back to ``Any`` when some ``assert ....
31
908
mlflow
tests/catboost/test_catboost_model_export.py
.py
import json import os from pathlib import Path from typing import Any, NamedTuple from unittest import mock import catboost as cb import numpy as np import pandas as pd import pytest import yaml from packaging.version import Version from sklearn import datasets from sklearn.pipeline import Pipeline import mlflow.catb...
539
20,242
onnx
onnx/backend/test/case/node/lppool.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 from onnx.reference.ops.op_pool_common import ( get_output_shape_auto_pad,...
299
9,007
saleor
saleor/graphql/checkout/tests/deprecated/test_checkout_customer_attach.py
.py
import graphene from .....checkout.error_codes import CheckoutErrorCode from ....tests.utils import assert_no_permission, get_graphql_content CHECKOUT_CUSTOMER_ATTACH_MUTATION = """ mutation checkoutCustomerAttach($checkoutId: ID, $token: UUID) { checkoutCustomerAttach(checkoutId: $checkoutId, token: $tok...
120
4,158
wandb
wandb/sdk/lib/exit_hooks.py
.py
from __future__ import annotations import sys import traceback from types import TracebackType from typing import TYPE_CHECKING import wandb from wandb.errors import Error if TYPE_CHECKING: from typing import NoReturn class ExitHooks: exception: BaseException | None = None def __init__(self) -> None: ...
57
1,555
django-cms
cms/templatetags/cms_js_tags.py
.py
import json from classytags.core import Options, Tag from django import template from django.utils.safestring import mark_safe from sekizai.helpers import get_varname from cms.utils.encoder import SafeJSONEncoder from cms.utils.placeholder import rescan_placeholders_for_obj register = template.Library() @register....
72
2,053
textual
docs/examples/widgets/footer.py
.py
from textual.app import App, ComposeResult from textual.binding import Binding from textual.widgets import Footer class FooterApp(App): BINDINGS = [ Binding(key="q", action="quit", description="Quit the app"), Binding( key="question_mark", action="help", descrip...
26
680
wagtail
wagtail/actions/move_page.py
.py
import logging import swapper from django.core.exceptions import PermissionDenied from django.db import transaction from treebeard.mp_tree import MP_MoveHandler from wagtail.actions.base import BaseAction from wagtail.log_actions import log from wagtail.signals import post_page_move, pre_page_move logger = logging.g...
114
4,020
pyro
examples/rsa/generics.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 """ Interpreting generic statements with RSA models of pragmatics. Taken from: [0] http://forestdb.org/models/generics.html [1] https://gscontras.github.io/probLang/chapters/07-generics.html """ import argparse import collections...
185
5,389
ipython
examples/Embedding/start_ipython_config.py
.py
"""Quick snippet explaining how to set config options when using start_ipython.""" # First create a config object from the traitlets library from traitlets.config import Config c = Config() # Now we can set options as we would in a config file: # c.Class.config_value = value # For example, we can set the exec_lines...
23
738
python-prompt-toolkit
src/prompt_toolkit/key_binding/bindings/vi.py
.py
# pylint: disable=function-redefined from __future__ import annotations import codecs import string from collections.abc import Callable, Iterable from enum import Enum from itertools import accumulate from typing import TypeVar from prompt_toolkit.application.current import get_app from prompt_toolkit.buffer import ...
2,235
75,622
mlflow
mlflow/cli/traces.py
.py
""" Comprehensive MLflow Traces CLI for managing trace data, assessments, and metadata. This module provides a complete command-line interface for working with MLflow traces, including search, retrieval, deletion, tagging, and assessment management. It supports both table and JSON output formats with flexible field se...
882
30,350
saleor
saleor/graphql/product/bulk_mutations/product_variant_bulk_delete.py
.py
from collections.abc import Iterable import graphene from django.conf import settings from django.core.exceptions import ValidationError from django.db import transaction from django.db.models import Exists, OuterRef, Subquery from django.db.models.fields import IntegerField from django.db.models.functions import Coal...
220
8,639
mlflow
tests/test_skinny_client_omits_data_science_libs.py
.py
import os import pytest @pytest.fixture(autouse=True) def is_skinny(): if "MLFLOW_SKINNY" not in os.environ: pytest.skip("This test is only valid for the skinny client") def test_fails_import_flask(): import mlflow # noqa: F401 with pytest.raises(ImportError, match="flask"): import fl...
31
647
beam
sdks/python/apache_beam/runners/sdf_utils_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...
139
5,878
saleor
saleor/graphql/order/mutations/order_lines_create.py
.py
from collections import defaultdict import graphene from django.core.exceptions import ValidationError from ....account.models import User from ....app.models import App from ....core.taxes import TaxError from ....core.tracing import traced_atomic_transaction from ....order import events from ....order import models...
257
9,199
pyomo
doc/OnlineDocs/src/data/param3c.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,141
readthedocs.org
readthedocs/core/permissions.py
.py
"""Objects for User permission checks.""" from django.conf import settings from django.contrib.auth.models import User from django.db.models import Q from readthedocs.core.utils.extend import SettingsOverrideObject from readthedocs.organizations.constants import ADMIN_ACCESS from readthedocs.organizations.constants i...
198
7,449
mlflow
tests/server/test_prometheus_exporter.py
.py
import pytest from mlflow.server.prometheus_exporter import activate_prometheus_exporter @pytest.fixture(autouse=True) def mock_settings_env_vars(tmp_path, monkeypatch): monkeypatch.setenv("PROMETHEUS_MULTIPROC_DIR", str(tmp_path)) @pytest.fixture def app(): from mlflow.server import app with app.app_...
72
2,152
ipython
IPython/utils/syspathcontext.py
.py
from __future__ import annotations import sys from types import TracebackType from typing import Literal, Self class prepended_to_syspath: """A context for prepending a directory to sys.path for a second.""" dir: str added: bool def __init__(self, dir: str) -> None: self.dir = dir ...
40
947
onnxruntime
onnxruntime/test/testdata/abs_0d_input.py
.py
""" Run this script to recreate the original onnx model. Example usage: python abs_0d_input.py out_model_path.onnx """ import sys from onnx import TensorProto, helper, save def clear_field(proto, field): proto.ClearField(field) return proto def order_repeated_field(repeated_proto, key_name, order): or...
59
1,845
bazel
third_party/py/abseil/absl/flags/_flag.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 ...
489
17,271
lemur
lemur/tests/test_oauth.py
.py
from datetime import datetime, timedelta from freezegun import freeze_time from flask import current_app from lemur.auth.views import * # noqa from lemur.tests.conf import OAUTH_STATE_TOKEN_STALE_TOLERANCE_SECONDS, OAUTH_STATE_TOKEN_SECRET def test_build_hmac(client): from lemur.auth.views import build_hmac ...
49
1,575
wagtail
wagtail/contrib/forms/models.py
.py
import datetime import os import swapper from django.core.serializers.json import DjangoJSONEncoder from django.core.validators import validate_email from django.db import models from django.template.response import TemplateResponse from django.utils.formats import date_format from django.utils.translation import gett...
400
12,666
confluent-kafka-python
tests/integration/share_consumer_oauth/test_oauth_integration.py
.py
"""End-to-end integration tests for ShareConsumer with OAUTHBEARER. These cover the full SASL handshake, which the unit tests in tests/test_ShareConsumer_callbacks.py cannot reach: the unit test_oauthbearer_token_refresh_cb only checks that oauth_cb fires during init, and the literal string 'token' it produces never r...
205
7,867
tqdm
tests/tests_rlock.py
.py
from .tests_tqdm import StringIO, closing, importorskip, mark, skip @mark.slow def test_rlock_creation(): """Test that importing tqdm does not create multiprocessing objects.""" mp = importorskip('multiprocessing') if not hasattr(mp, 'get_context'): skip("missing multiprocessing.get_context") ...
39
1,520
hydra
hydra/compose.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from typing import List, Optional from omegaconf import DictConfig, open_dict from hydra.core.global_hydra import GlobalHydra from hydra.types import RunMode def compose( config_name: Optional[str] = None, overrides: Optional[List[str]] ...
47
1,341
openvino
src/frontends/tensorflow_lite/tests/test_models/gen_scripts/generate_quantize.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import sys import tensorflow as tf # Model: # (float32)tensor_0[12] -> QUANTIZE -> (int8)tensor_1[12] # QUANTIZE: # scale: 0.25 # zero point: 16 sm_path = os.path.join(sys.argv[1], "quantize_int8") tflite_model = b'\x08\x...
28
3,675
black
tests/data/cases/target_version_flag.py
.py
# flags: --minimum-version=3.12 --target-version=py312 # this is invalid in versions below py312 class ClassA[T: str]: def method1(self) -> T: ... # output # this is invalid in versions below py312 class ClassA[T: str]: def method1(self) -> T: ...
11
265
openvino
docs/articles_en/assets/snippets/utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # import tempfile import numpy as np from sys import platform import openvino as ov import openvino.opset13 as ops def get_dynamic_model(): param = ops.parameter(ov.PartialShape([-1, -1]), name="input") return ov.Model(ops.rel...
66
1,932
beam
sdks/python/apache_beam/examples/inference/tfx_bsl/build_tensorflow_model.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...
147
6,004
probability
tensorflow_probability/python/distributions/mixture_same_family.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...
746
31,019
pyomo
pyomo/dae/utilities.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
2,828
71,371
onnxruntime
onnxruntime/python/tools/transformers/fusion_qordered_matmul.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- from logging import getLogger from fusion_base import Fusion from fusi...
217
8,325
coremltools
coremltools/optimize/torch/quantization/_coreml_quantizer_utils.py
.py
# Copyright (c) 2024, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import itertools as _itertools from typing import Callable as _Callable from typing import List as _L...
785
27,954
pyro
pyro/distributions/relaxed_straight_through.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import torch from torch.distributions.utils import clamp_probs from pyro.distributions.torch import RelaxedBernoulli, RelaxedOneHotCategorical from pyro.distributions.util import copy_docs_from @copy_docs_from(RelaxedOneHotCateg...
104
3,637
sqlmap
thirdparty/fcrypt/__init__.py
.py
#!/usr/bin/env python #Copyright (c) 2004, Carey Evans <careye@spamcop.net> #All rights reserved. #Redistribution and use in source and binary forms, with or without modification, #are permitted provided that the following conditions are met: #* Redistributions of source code must retain the above copyright notice, ...
27
1,356
wandb
tests/unit_tests/test_artifacts/test_references_azure.py
.py
from __future__ import annotations import unittest.mock from pytest import fixture, mark from wandb import Artifact @fixture def mock_azure_handler(): # noqa: C901 class BlobServiceClient: def __init__(self, account_url, credential): pass def get_container_client(self, container): ...
260
8,317
saleor
saleor/tests/e2e/orders/utils/order_update.py
.py
from ...account.utils.fragments import ADDRESS_FRAGMENT from ...utils import get_graphql_content ORDER_UPDATE_MUTATION = ( """ mutation orderUpdate( $id: ID $externalReference: String $input: OrderUpdateInput! ) { orderUpdate( id: $id externalReferenc...
62
1,299
wagtail
wagtail/contrib/table_block/templatetags/table_block_tags.py
.py
from django import template from django.utils.html import format_html register = template.Library() @register.simple_tag(takes_context=True) def cell_classname(context, row_index, col_index, table_header=None): classnames = context.get("classnames") if classnames: if table_header is not None: ...
46
1,334
mamba
micromamba/tests/test_config.py
.py
import os import platform import shutil import subprocess import textwrap from pathlib import Path import pytest import yaml from . import helpers @pytest.fixture def user_config_dir(tmp_home: Path): """Location of config files that are generated from mamba""" maybe_xdg_config = os.getenv("XDG_CONFIG_DIR", ...
807
30,052
kombu
kombu/transport/etcd.py
.py
"""Etcd Transport module for Kombu. It uses Etcd as a store to transport messages in Queues It uses python-etcd for talking to Etcd's HTTP API Features ======== * Type: Virtual * Supports Direct: *Unreviewed* * Supports Topic: *Unreviewed* * Supports Fanout: *Unreviewed* * Supports Priority: *Unreviewed* * Supports ...
301
8,644
jupytext
src/jupytext_config/labconfig.py
.py
""" helper to inspect / initialize jupyterlab labconfig settings that are required to open jupytext notebooks in jupyterlab by default when these settings are not present, a double click on a jupytext notebook will cause jupyterlab to open it in an editor, i.e. as a text file """ import json import logging from pathli...
83
2,473
ipython
IPython/core/interactiveshell.py
.py
"""Main IPython class.""" #----------------------------------------------------------------------------- # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> # Copyright (C) 2001-2007 Fernando Perez. <fperez@colorado.edu> # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of t...
4,243
164,967
mlflow
mlflow/utils/spark_utils.py
.py
def is_spark_connect_mode(): try: from pyspark.sql.utils import is_remote except ImportError: return False return is_remote() def get_spark_dataframe_type(): if is_spark_connect_mode(): from pyspark.sql.connect.dataframe import DataFrame as SparkDataFrame else: from...
16
395
wandb
wandb/data_types.py
.py
"""This module defines data types for logging rich, interactive visualizations to W&B. Data types include common media types, like images, audio, and videos, flexible containers for information, like tables and HTML, and more. For more on logging media, see [our guide](https://docs.wandb.ai/models/track/log/media) F...
69
2,338
probability
tensorflow_probability/python/math/ode/util_test.py
.py
# Copyright 2018 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
101
3,668
saleor
saleor/graphql/giftcard/bulk_mutations/gift_card_bulk_deactivate.py
.py
import graphene from ....core.tracing import traced_atomic_transaction from ....giftcard import events, models from ....permission.enums import GiftcardPermissions from ....webhook.event_types import WebhookEventAsyncType from ....webhook.utils import get_webhooks_for_event from ...app.dataloaders import get_app_promi...
54
2,025
probability
tensorflow_probability/python/distributions/gaussian_process_regression_model_test.py
.py
# Copyright 2018 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
724
30,742
astropy
astropy/io/fits/hdu/table.py
.py
# Licensed under a 3-clause BSD style license - see PYFITS.rst import csv import math import operator import os import re import textwrap import warnings from contextlib import suppress import numpy as np # This module may have many dependencies on astropy.io.fits.column, but # astropy.io.fits.column has fewer depe...
1,568
60,945
readthedocs.org
readthedocs/search/views.py
.py
"""Search views.""" import collections from urllib.parse import urlencode import structlog from django.conf import settings from django.http.response import HttpResponseRedirect from django.urls import reverse from django.views import View from django.views.generic import TemplateView from readthedocs.projects.model...
175
5,734
luigi
test/scheduler_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...
396
16,722
textual
tests/test_links.py
.py
from textual.app import App, ComposeResult from textual.screen import Screen from textual.widgets import Label async def test_links() -> None: """Regression test for https://github.com/Textualize/textual/issues/4536""" messages: list[str] = [] class LinkLabel(Label): def action_bell_message(self,...
38
1,391
sqlmap
plugins/dbms/informix/connector.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ try: import ibm_db_dbi except: pass import logging from lib.core.common import getSafeExString from lib.core.data import conf from lib.core.data import logger from lib.c...
61
1,994
sqlmap
extra/beep/beep.py
.py
#!/usr/bin/env python """ beep.py - Make a beep sound Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import os import sys import wave BEEP_WAV_FILENAME = os.path.join(os.path.dirname(__file__), "beep.wav") def beep(): try: if sys.platfor...
104
2,964
pyfilesystem2
fs/opener/tempfs.py
.py
# coding: utf-8 """`TempFS` opener definition. """ from __future__ import absolute_import, print_function, unicode_literals import typing from .base import Opener from .registry import registry if typing.TYPE_CHECKING: from typing import Text from ..tempfs import TempFS # noqa: F401 from .parse import...
38
785
kombu
kombu/transport/filesystem.py
.py
"""File-system Transport module for kombu. Transport using the file-system as the message store. Messages written to the queue are stored in `data_folder_in` directory and messages read from the queue are read from `data_folder_out` directory. Both directories must be created manually. Simple example: * Producer: .....
384
11,652
onnxruntime
orttraining/orttraining/python/training/ort_triton/_utils.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import re import uuid from collections import defaultdict from typing im...
169
5,595
astropy
astropy/wcs/tests/test_wcsprm.py
.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst import gc import locale import re import numpy as np import pytest from numpy.testing import assert_array_almost_equal, assert_array_equal from packaging.version import Version from astropy import units as u from astropy.io import fits from astropy.unit...
1,250
28,851
readthedocs.org
readthedocs/domains/notifications.py
.py
"""Notifications related to custom domains.""" import textwrap from django.utils.translation import gettext_noop as _ from readthedocs.notifications.constants import INFO from readthedocs.notifications.email import EmailNotification from readthedocs.notifications.messages import Message from readthedocs.notification...
54
1,877
confluent-kafka-python
src/confluent_kafka/schema_registry/rules/cel/string_format.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...
199
7,784
saleor
saleor/product/tests/fixtures/variant.py
.py
import datetime from decimal import Decimal import pytest from django.utils import timezone from ....warehouse.models import Stock from ... import ProductTypeKind from ...models import ( Product, ProductChannelListing, ProductMedia, ProductType, ProductVariant, ProductVariantChannelListing, ...
348
11,275
sqlmap
thirdparty/chardet/langhebrewmodel.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from .sbcharsetprober import SingleByteCharSetModel # 3: Positive # 2: Likely # 1: Unlikely # 0: Negative HEBREW_LANG_MODEL = { 50: { # 'a' 50: 0, # 'a' 60: 1, # 'c' 61: 1, # 'd' 42: 1, # 'e' 53: 1, # 'i' 56: 2, ...
4,384
98,757