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
mlflow
mlflow/store/workspace_rest_store_mixin.py
.py
from __future__ import annotations from mlflow.exceptions import MlflowException from mlflow.protos import databricks_pb2 from mlflow.utils.server_info import ( SERVER_INFO_ENDPOINT, SERVER_INFO_WORKSPACES_ENABLED, ServerInfoRequestError, fetch_server_info, ) from mlflow.utils.uri import is_databricks_...
82
2,880
beam
sdks/python/apache_beam/io/gcp/big_query_query_to_table_pipeline.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
105
3,693
conda
conda/gateways/disk/delete.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause """Disk utility functions for deleting files and folders.""" from __future__ import annotations import fnmatch import os import shutil import sys from logging import getLogger from os.path import ( abspath, basename, dirname, e...
287
10,410
openvino
tests/layer_tests/onnx_tests/test_prelu.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest pytest.importorskip("openvino.tools.mo", reason="Ticket - 157136") from common.layer_test_class import check_ir_version from common.onnx_layer_test_class import OnnxRuntimeLayerTest, onnx_make_model fro...
152
6,105
wandb
wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py
.py
"""WandB storage policy.""" from __future__ import annotations import concurrent.futures import hashlib import logging import os import shutil from collections import deque from operator import itemgetter from typing import TYPE_CHECKING, Any from urllib.parse import quote import requests from typing_extensions impo...
385
14,013
confluent-kafka-python
tests/common/schema_registry/__init__.py
.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2024 Confluent Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
36
1,321
loguru
tests/exceptions/source/diagnose/global_variable.py
.py
import sys from loguru import logger logger.remove() logger.add(sys.stderr, format="", colorize=True, backtrace=False, diagnose=True) foo = True bar = False def func(): foo = None return 1 / 0 + foo + bar + False try: func() except ZeroDivisionError: logger.exception("")
22
296
pyro
tests/infer/test_valid_models.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import logging import warnings from collections import defaultdict import pytest import torch from torch.distributions import constraints import pyro import pyro.distributions as dist import pyro.poutine as poutine from pyro.dist...
2,783
93,251
tqdm
tests/tests_pandas.py
.py
from tqdm import tqdm from .tests_tqdm import StringIO, closing, importorskip, mark, skip pytestmark = mark.slow np = importorskip('numpy') random = importorskip('numpy.random') rand = random.rand randint = random.randint pd = importorskip('pandas') def test_pandas_setup(): """Test tqdm.pandas()""" with cl...
224
8,263
readthedocs.org
readthedocs/filetreediff/tests/test_filetreediff.py
.py
import json from contextlib import contextmanager from unittest import mock from django.test import TestCase from django_dynamic_fixture import get from readthedocs.builds.constants import BUILD_STATE_FINISHED, EXTERNAL, LATEST from readthedocs.builds.models import Build, Version from readthedocs.filetreediff import ...
243
8,942
astropy
astropy/time/time_helper/function_helpers.py
.py
""" Helpers for overriding numpy functions in `~astropy.time.Time.__array_function__`. """ import numpy as np from astropy.units.quantity_helper.function_helpers import FunctionAssigner # TODO: Fill this in with functions that don't make sense for times UNSUPPORTED_FUNCTIONS = {} # Functions that return the final re...
37
1,069
saleor
saleor/graphql/discount/tests/deprecated/test_voucher.py
.py
import graphene from ....tests.utils import ( assert_no_permission, get_graphql_content, get_graphql_content_from_response, ) QUERY_VOUCHER_BY_ID = """ query Voucher($id: ID!) { voucher(id: $id) { id code name discountValue } } """ ...
80
2,539
hydra
hydra/_internal/instantiate/_instantiate2.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import copy import functools import inspect import os import re from contextvars import ContextVar from enum import Enum from textwrap import dedent from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union, cast from omegacon...
1,170
41,246
sphinx
sphinx/search/ro.py
.py
"""Romanian search language.""" from __future__ import annotations import snowballstemmer from sphinx.search import SearchLanguage class SearchRomanian(SearchLanguage): lang = 'ro' language_name = 'Romanian' js_stemmer_rawcode = 'romanian-stemmer.js' stopwords = frozenset() def __init__(self, ...
22
537
probability
tensorflow_probability/python/math/diag_jacobian.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...
245
10,089
saleor
saleor/warehouse/channel_stock_availability.py
.py
from collections import defaultdict from dataclasses import dataclass from typing import TYPE_CHECKING from uuid import UUID from django.db.models import Exists, OuterRef from . import WarehouseClickAndCollectOption from .interface import VariantChannelStockInfo from .models import ChannelWarehouse, Stock, Warehouse ...
380
14,346
pyomo
pyomo/core/tests/unit/test_suffix.py
.py
# ____________________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contract DE-NA0003525 with National Technology and Engineering # Solutions of...
1,873
78,324
probability
tensorflow_probability/python/distributions/log_prob_ratio.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...
72
2,475
mlflow
tests/langchain/sample_code/model_with_config.py
.py
from langchain_core.prompts import PromptTemplate from langchain_core.runnables import ConfigurableField from langchain_openai import ChatOpenAI from mlflow.models import set_model model = ChatOpenAI(temperature=0).configurable_fields( temperature=ConfigurableField( id="temperature", name="LLM tem...
19
503
mlflow
mlflow/webhooks/__init__.py
.py
"""MLflow webhooks module. This module provides webhook functionality for MLflow model registry and prompt registry events. """ from mlflow.webhooks.constants import WEBHOOK_SIGNATURE_HEADER from mlflow.webhooks.types import ( ModelVersionAliasCreatedPayload, ModelVersionAliasDeletedPayload, ModelVersionC...
43
1,248
beam
sdks/python/apache_beam/yaml/yaml_utils.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...
244
8,696
pdm
src/pdm/core.py
.py
r""" ____ ____ __ ___ / __ \/ __ \/ |/ / / /_/ / / / / /|_/ / / ____/ /_/ / / / / /_/ /_____/_/ /_/ """ from __future__ import annotations import argparse import contextlib import dataclasses as dc import importlib import importlib.metadata import itertools import os import pkgutil import sys from ...
410
15,329
onnx
tests/python/opaque_type_test.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 """Illustrative example of using an Opaque type. Opaque types allow a model to carry values whose internal representation is not defined by the ONNX spec, but is instead understood only by the producer/consumer of a custom domain's ops (mu...
184
7,407
pdm
src/pdm/formats/requirements.py
.py
from __future__ import annotations import argparse import hashlib import shlex import urllib.parse from collections.abc import Iterable, Mapping from pathlib import Path from typing import TYPE_CHECKING, Any, cast from pdm.environments import BareEnvironment from pdm.exceptions import PdmException, PdmUsageError from...
245
9,599
saleor
saleor/graphql/payment/tests/mutations/test_payment_gateway_initialize.py
.py
import datetime import json from decimal import Decimal from unittest import mock from django.conf import settings from django.test import override_settings from .....checkout.calculations import fetch_checkout_data from .....checkout.fetch import fetch_checkout_info, fetch_checkout_lines from .....core import EventD...
1,236
39,098
beam
learning/katas/python/Core Transforms/Branching/Branching/tests/test_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"); you may not...
45
1,528
onnxruntime
orttraining/orttraining/test/python/orttraining_test_lort.py
.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import unittest import torch import torch.nn as nn import torch.nn.functional as F # Ask lazy backend to use Pytorch's JIT as # lazy backend's executor. from torch._lazy.ts_backend import init as init_ts_backend init_ts_ba...
120
4,135
biopython
Bio/SCOP/__init__.py
.py
# Copyright 2001 by Gavin E. Crooks. All rights reserved. # Modifications Copyright 2004/2005 James Casbon. All rights Reserved. # Modifications Copyright 2010 Jeffrey Finkelstein. All rights reserved. # # This file is part of the Biopython distribution and governed by your # choice of the "Biopython License Agreement...
912
31,276
jupyterlab
jupyterlab/labhubapp.py
.py
"""A JupyterHub EntryPoint that defaults to use JupyterLab""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import os import sys from collections.abc import Sequence from jupyter_server.serverapp import ServerApp from traitlets import default from .labapp impor...
68
2,165
confluent-kafka-python
tests/schema_registry/data/proto/cycle_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: cycle.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_dat...
29
1,083
probability
tensorflow_probability/python/sts/structural_time_series_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...
663
27,162
onnxruntime
onnxruntime/test/testdata/matmul_integer_to_float.py
.py
import numpy as np import onnx from onnx import TensorProto, helper, numpy_helper def generate_model( model_name, sign_i, sign_w, output_type_fp16, has_zp=True, bias=False, bias_initializer=False, bias_flip=False ): nodes = [ # subgraph helper.make_node( "MatMulInteger", ["A",...
137
4,631
pyomo
doc/OnlineDocs/ext/pyomo_autosummary_autoenum.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...
341
13,099
beam
sdks/python/apache_beam/ml/rag/embeddings/__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...
21
908
onnxruntime
onnxruntime/python/tools/transformers/fusion_quickgelu.py
.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- import logging from fusion_base import Fusion from onnx import helper ...
75
2,795
mlflow
tests/entities/test_trace_metrics.py
.py
import pytest from mlflow.entities.trace_metrics import ( AggregationType, MetricAggregation, MetricDataPoint, MetricViewType, ) from mlflow.protos import service_pb2 as pb @pytest.mark.parametrize( ("view_type", "expected_proto"), list(zip(MetricViewType, pb.MetricViewType.values(), strict=T...
134
4,943
beam
sdks/python/gen_managed_doc.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...
361
11,522
onnxruntime
onnxruntime/test/python/transformers/parse_nsys.py
.py
#!/usr/bin/env python3 # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -------------------------------------------------------------------------- """ Parse nsys SQLite output to extract CUDA ker...
571
20,756
cvxpy
cvxpy/reductions/dgp2dcp/canonicalizers/finite_set_canon.py
.py
from cvxpy.constraints.finite_set import FiniteSet def finite_set_canon(expr, args): ineq_form, id = expr.get_data() # Log applied already to set of values (i.e., args[1]). return FiniteSet(args[0], args[1], ineq_form, id), []
8
241
wandb
wandb/sdk/launch/runner/kubernetes_monitor.py
.py
"""Monitors kubernetes resources managed by the launch agent.""" from __future__ import annotations import asyncio import logging import traceback from typing import Any import kubernetes_asyncio # type: ignore import urllib3 from kubernetes_asyncio import watch from kubernetes_asyncio.client import ( # type: igno...
477
17,803
textual
src/textual/css/query.py
.py
""" This module contains the `DOMQuery` class and related objects. A DOMQuery is a set of DOM nodes returned by [query][textual.dom.DOMNode.query]. The set of nodes may be further refined with [filter][textual.css.query.DOMQuery.filter] and [exclude][textual.css.query.DOMQuery.exclude]. Additional methods apply actio...
509
15,732
textual
docs/examples/guide/widgets/checker01.py
.py
from rich.segment import Segment from rich.style import Style from textual.app import App, ComposeResult from textual.strip import Strip from textual.widget import Widget class CheckerBoard(Widget): """Render an 8x8 checkerboard.""" def render_line(self, y: int) -> Strip: """Render a line of the wid...
44
1,305
readthedocs.org
readthedocs/rtd_tests/tests/test_integrations.py
.py
import django_dynamic_fixture as fixture from django.test import TestCase from rest_framework.test import APIClient from readthedocs.api.v2.views.integrations import GITHUB_SIGNATURE_HEADER from readthedocs.integrations.models import GitHubWebhook, HttpExchange, Integration from readthedocs.projects.models import Proj...
223
7,626
sqlmap
extra/esperanto/__init__.py
.py
""" Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission esperanto - a DBMS-agnostic SQL poking prototype. Given only a boolean oracle - a callable oracle(condition) -> bool that reports whether an arbitrary SQL boolean expression holds at the target - this disc...
31
1,450
beam
sdks/python/apache_beam/runners/interactive/interactive_runner.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...
357
14,662
pyomo
pyomo/solvers/tests/checks/test_xpress_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...
410
15,027
ipython
setup.py
.py
# -*- coding: utf-8 -*- """Setup script for IPython. Under Posix environments it works like a typical setup.py script. Under Windows, the command sdist is not supported, since IPython requires utilities which are not available under Windows.""" #------------------------------------------------------------------------...
102
3,233
wandb
wandb/sdk/launch/environment/abstract.py
.py
"""Abstract base class for environments.""" from abc import ABC, abstractmethod class AbstractEnvironment(ABC): """Abstract base class for environments.""" region: str @abstractmethod async def verify(self) -> None: """Verify that the environment is configured correctly.""" raise No...
30
951
hydra
plugins/hydra_rq_launcher/example/my_app.py
.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import logging import os import time import hydra from omegaconf import DictConfig log = logging.getLogger(__name__) @hydra.main(config_name="config") def my_app(cfg: DictConfig) -> None: log.info(f"Process ID {os.getpid()} executing task {c...
21
396
hatch
src/hatch/publish/index.py
.py
from __future__ import annotations import re from typing import TYPE_CHECKING from hatch.publish.plugin.interface import PublisherInterface from hatch.utils.fs import Path from hatchling.metadata.utils import normalize_project_name if TYPE_CHECKING: from collections.abc import Iterable class IndexPublisher(Pub...
165
6,018
kafka
tests/kafkatest/services/verifiable_consumer.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 ...
563
25,946
kombu
kombu/simple.py
.py
"""Simple messaging interface.""" from __future__ import annotations import socket from collections import deque from queue import Empty from time import monotonic from typing import TYPE_CHECKING from . import entity, messaging from .connection import maybe_channel if TYPE_CHECKING: from types import Traceback...
165
5,339
probability
tensorflow_probability/python/math/scan_associative_test.py
.py
# Copyright 2020 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
253
9,205
mlflow
mlflow/utils/docstring_utils.py
.py
import textwrap import warnings from typing import Any from mlflow.ml_package_versions import _ML_PACKAGE_VERSIONS from mlflow.utils.autologging_utils.versioning import ( get_min_max_version_and_pip_release, ) def _create_placeholder(key: str): return "{{ " + key + " }}" def _replace_keys_with_placeholders...
520
21,288
qutip
doc/guide/scripts/floquet_ex3.py
.py
import numpy as np from matplotlib import pyplot import qutip delta = 0.0 * 2*np.pi eps0 = 1.0 * 2*np.pi A = 0.25 * 2*np.pi omega = 1.0 * 2*np.pi T = 2*np.pi / omega tlist = np.linspace(0.0, 20 * T, 301) psi0 = qutip.basis(2,0) H0 = - delta/2.0 * qutip.sigmax() - eps0/2.0 * qutip.sigmaz() H1 = A/2.0 * q...
53
1,600
openvino
tests/e2e_tests/common/infer/network_modifiers/network_modifiers.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """IE network modifiers applied to IE network.""" import logging as log import sys from e2e_tests.utils.test_utils import align_input_names from e2e_tests.common.test_utils import get_shapes_from_data, convert_shapes_to_partial_shape f...
141
4,582
eve
tests/methods/post.py
.py
from base64 import b64decode from io import BytesIO import simplejson as json from bson import ObjectId from werkzeug.datastructures import MultiDict from eve import DATE_CREATED, ETAG, ISSUES, LAST_UPDATED, STATUS, STATUS_OK from eve.methods.post import post, post_internal from eve.utils import str_type from tests i...
1,210
48,922
gunicorn
examples/dirty_example/test_integration.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. #!/usr/bin/env python """ Integration test for the dirty example server. This tests that the full gunicorn server with dirty workers responds correctly to HTTP requests. Run with: python examples/dirty_exampl...
82
2,180
pyomo
pyomo/solvers/tests/checks/test_ipopt.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...
42
1,519
mlflow
tests/sagemaker/mock/mock_sagemaker_urls.py
.py
from tests.sagemaker.mock import SageMakerResponse url_bases = [ "https?://api.sagemaker.(.+).amazonaws.com", ] url_paths = { "{0}/$": SageMakerResponse.dispatch, }
10
175
saleor
saleor/graphql/app/mutations/app_retry_install.py
.py
import graphene from django.core.exceptions import ValidationError from ....app import models from ....app.error_codes import AppErrorCode from ....app.tasks import install_app_task from ....core import JobStatus from ....permission.enums import AppPermission from ....webhook.event_types import WebhookEventAsyncType f...
63
2,331
confluent-kafka-python
tests/integration/schema_registry/data/proto/metadata_proto_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: tests/integration/schema_registry/data/proto/metadata_proto.proto """Generated protocol buffer code.""" from google.protobuf.internal import builder as _builder from google.protobuf import descriptor as _descriptor from google....
164
22,797
onnx
onnx/reference/ops/op_bitwise_not.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 OpRunUnary class BitwiseNot(OpRunUnary): def _run(self, X): return (np.bitwise_not(X),)
14
274
saleor
saleor/graphql/channel/tests/queries/test_channels.py
.py
from ....tests.utils import assert_no_permission, get_graphql_content QUERY_CHANNELS = """ query { channels { name slug currencyCode defaultCountry { code country } } } """ def test_query_channels_as_s...
150
3,715
mlflow
tests/onnx/test_onnx_model_export.py
.py
import logging import os from pathlib import Path from unittest import mock import numpy as np import onnx import onnxruntime as ort import pandas as pd import pytest import torch import torch.onnx import yaml from packaging.version import Version from sklearn import datasets from torch import nn from torch.utils.data...
946
36,592
probability
tensorflow_probability/python/mcmc/__init__.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...
72
3,797
returns
tests/test_contrib/test_hypothesis/test_laws/test_user_specified_strategy.py
.py
from hypothesis import strategies as st from test_hypothesis.test_laws import test_custom_type_applicative from returns.contrib.hypothesis.laws import check_all_laws container_type = test_custom_type_applicative._Wrapper # noqa: SLF001 check_all_laws( container_type, container_strategy=st.builds(container_t...
12
343
textual
docs/examples/getting_started/console.py
.py
""" Simulates a screenshot of the Textual devtools """ from textual_dev.renderables import DevConsoleHeader from textual.app import App from textual.widgets import Static class ConsoleApp(App): def compose(self): yield Static(DevConsoleHeader()) app = ConsoleApp()
17
283
pymc
tests/distributions/test_truncated.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...
641
22,068
scikit-bio
skbio/tree/_upgma.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. # --------------------------------------------...
100
3,081
saleor
saleor/graphql/account/tests/mutations/authentication/test_request_password_reset.py
.py
import datetime import warnings from unittest.mock import patch from urllib.parse import urlencode from django.utils import timezone from freezegun import freeze_time from ......account.error_codes import AccountErrorCode from ......account.notifications import get_default_user_payload from ......core.notify import N...
623
20,313
wagtail
wagtail/api/v2/filters.py
.py
import swapper from django.conf import settings from django.core.exceptions import FieldError from django.db import models from django.shortcuts import get_object_or_404 from rest_framework.filters import BaseFilterBackend from taggit.managers import TaggableManager from wagtail.models import Locale from wagtail.searc...
304
11,243
wagtail
wagtail/test/utils/template_tests.py
.py
from django.test import SimpleTestCase from .wagtail_tests import WagtailTestUtils class AdminTemplateTestUtils: base_breadcrumb_items = [{"label": "Home", "url": "/admin/"}] def assertBreadcrumbsItemsRendered( self: WagtailTestUtils | SimpleTestCase, items: list[dict[str, str]], htm...
89
3,372
bazel
src/test/py/bazel/py_test.py
.py
# Copyright 2018 The Bazel Authors. All rights reserved. # # 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 la...
379
11,392
readthedocs.org
readthedocs/organizations/views/base.py
.py
"""Base classes for organization views.""" from functools import lru_cache from django.conf import settings from django.contrib.messages.views import SuccessMessageMixin from django.http import Http404 from django.shortcuts import get_object_or_404 from django.shortcuts import render from django.urls import reverse_l...
283
9,211
coveragepy
tests/test_mixins.py
.py
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/coveragepy/coveragepy/blob/main/NOTICE.txt """Tests of code in tests/mixins.py""" from __future__ import annotations import pytest from coverage.misc import import_local_file from tests.mixins import T...
87
3,023
openvino
tests/layer_tests/tensorflow_lite_tests/test_tfl_MirrorPad.py
.py
import numpy as np import pytest import tensorflow as tf from common.tflite_layer_test_class import TFLiteLayerTest test_params = [ {'shape': [2, 3], 'padding_matrix': [[1, 1], [2, 1]], 'mode': 'REFLECT'}, {'shape': [2, 3], 'padding_matrix': [[1, 1], [1, 1]], 'mode': 'REFLECT'}, {'shape': [2, 3], 'padding...
40
1,664
jupytext
tests/functional/simple_notebooks/test_read_simple_sphinx.py
.py
import jupytext from jupytext.compare import compare def test_read_simple_file( script='''# -*- coding: utf-8 -*- """ This is a markdown cell """ 1 + 2 + 3 + 4 5 6 "" 7 ################################# # Another markdown cell def f(x): """Sample docstring""" return 4 ''', ): nb = jupytext.reads(scr...
141
2,895
beam
sdks/python/apache_beam/runners/interactive/pipeline_fragment_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...
171
6,418
sphinx
sphinx/ext/autosummary/__init__.py
.py
"""Extension that adds an autosummary:: directive. The directive can be used to generate function/method/attribute/etc. summary lists, similar to those output eg. by Epydoc and other API doc generation tools. An :autolink: role is also provided. autosummary directive --------------------- The autosummary directive ...
930
32,089
textual
src/textual/demo/_project_stars.py
.py
STARS = { "Posting": "11.4k", "Memray": "14.9k", "Toolong": "3.9k", "Dolphie": "1.1k", "Harlequin": "5.8k", "Elia": "2.4k", "Trogon": "2.8k", "TFTUI - The Terraform textual UI": "1.3k", "RecoverPy": "1.7k", "Frogmouth": "3.1k", "oterm": "2.3k", "logmerger": "250", "do...
16
335
hypercorn
src/hypercorn/trio/__init__.py
.py
from __future__ import annotations import warnings from collections.abc import Awaitable, Callable from typing import Literal import trio from .run import worker_serve from ..config import Config from ..typing import Framework from ..utils import wrap_app async def serve( app: Framework, config: Config, ...
54
1,569
clearml
clearml/backend_interface/datasets/save_frames_request_no_validate_wrapped.py
.py
_SaveFramesRequestNoValidate = None def _get_save_frames_request_no_validate(): """ Make sure the _SaveFramesRequestNoValidate class is not created at import time. Creating it at import time will result in an API call being made to the server which won't work on machines with no network connectivity/m...
20
734
lemur
lemur/tests/factories.py
.py
import json from datetime import date from typing import List from factory import Sequence, post_generation, SubFactory from factory.alchemy import SQLAlchemyModelFactory from factory.fuzzy import FuzzyChoice, FuzzyText, FuzzyDate, FuzzyInteger from lemur.api_keys.models import ApiKey from lemur.authorities.models im...
477
11,949
django-cms
cms/cache/choices.py
.py
from django.conf import settings from cms.utils.conf import get_cms_setting def _site_cache_key(lang): return "{}-{}".format(get_cms_setting('SITE_CHOICES_CACHE_KEY'), lang) def _page_cache_key(lang): return "{}-{}".format(get_cms_setting('PAGE_CHOICES_CACHE_KEY'), lang) def _clean_many(prefix): from...
31
816
tqdm
tests/tests_asyncio.py
.py
"""Tests `tqdm.asyncio`.""" import asyncio from functools import partial from sys import platform from time import time from tqdm.asyncio import tarange, tqdm_asyncio from .tests_tqdm import StringIO, closing, mark tqdm = partial(tqdm_asyncio, miniters=0, mininterval=0) trange = partial(tarange, miniters=0, mininter...
185
4,713
probability
tensorflow_probability/python/bijectors/householder.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...
92
3,179
hypercorn
tests/trio/test_keep_alive.py
.py
from __future__ import annotations from collections.abc import Awaitable, Callable, Generator from typing import cast import h11 import pytest import trio from hypercorn.app_wrappers import ASGIWrapper from hypercorn.config import Config from hypercorn.trio.tcp_server import TCPServer from hypercorn.trio.worker_cont...
123
4,129
sqlmap
tamper/luanginx.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ import random import string from lib.core.compat import xrange from lib.core.enums import HINT from lib.core.enums import PRIORITY from lib.core.settings import DEFAULT_GET_POST_...
38
3,045
saleor
saleor/graphql/discount/tests/mutations/test_promotion_rule_update.py
.py
from decimal import Decimal from unittest.mock import ANY, patch import graphene from django.test import override_settings from .....discount import PromotionEvents, RewardValueType from .....discount.error_codes import PromotionRuleUpdateErrorCode from .....discount.models import PromotionEvent from .....product.mod...
1,279
38,116
mlflow
tests/store/artifact/test_dbfs_fuse_artifact_repo.py
.py
import os from unittest import mock from unittest.mock import PropertyMock import pytest from mlflow.store.artifact.artifact_repository_registry import get_artifact_repository TEST_FILE_1_CONTENT = "Hello πŸ†πŸ”".encode() TEST_FILE_2_CONTENT = "World πŸ†πŸ”πŸ†".encode() TEST_FILE_3_CONTENT = "Β‘πŸ†πŸ†πŸ”πŸ†πŸ†!".encode() @py...
135
4,493
wandb
tests/unit_tests/test_launch/test_registry/test_ecr.py
.py
from unittest.mock import MagicMock import botocore.exceptions import pytest from wandb.sdk.launch.errors import LaunchError from wandb.sdk.launch.registry.elastic_container_registry import ( ElasticContainerRegistry, ) @pytest.mark.parametrize( "uri, account_id, region, repo_name, expected_uri", [ ...
189
5,900
pyomo
examples/pyomobook/mpec-ch/ex1e.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...
25
920
wagtail
wagtail/admin/panels/comment_panel.py
.py
from wagtail.admin.forms.comments import CommentForm, CommentFormSet from wagtail.models import COMMENTS_RELATION_NAME from .base import Panel class CommentPanel(Panel): def get_form_options(self): # add the comments formset return { # Adds the comment notifications field to the form....
39
1,317
onnx
onnx/reference/ops/op_max_unpool.py
.py
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.op_run import OpRun class MaxUnpool(OpRun): def _run( self, X, indices, output_shape=None, kernel_shape=None, pads=None, strides=None ): ...
59
1,794
pynacl
src/nacl/exceptions.py
.py
# Copyright 2013 Donald Stufft and individual contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
88
2,484
returns
tests/test_methods/test_partition.py
.py
import pytest from returns.io import IO, IOResult from returns.maybe import Nothing, Some from returns.methods import partition from returns.result import Failure, Success @pytest.mark.parametrize( ('containers', 'expected'), [ ( (Success(1), Success(2), Failure(None), Success(3)), ...
35
881
astropy
astropy/io/ascii/tests/test_cds_header_from_readme.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 import units as u from astropy.io import ascii from astropy.table import Table from .common import ( setup_function, # noqa: F401 teardown_function, # noqa...
282
9,008
sqlmap
plugins/dbms/altibase/takeover.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ from lib.core.exception import SqlmapUnsupportedFeatureException from plugins.generic.takeover import Takeover as GenericTakeover class Takeover(GenericTakeover): def osCmd(s...
29
978
pyomo
examples/pyomo/radertext/Ex2_3.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...
113
3,327