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
onnxruntime
onnxruntime/test/testdata/transform/cse/generate.py
.py
import os import onnx from onnx import TensorProto, helper, shape_inference _this_dir = os.path.abspath(os.path.dirname(__file__)) def _onnx_export(graph_def, relative_path, verbose=False): model = helper.make_model( graph_def, producer_name="makalini", opset_imports=[helper.make_operato...
363
12,317
returns
returns/pointfree/bimap.py
.py
from collections.abc import Callable from typing import TypeVar from returns.interfaces.bimappable import BiMappableN from returns.primitives.hkt import Kinded, KindN, kinded _FirstType = TypeVar('_FirstType') _SecondType = TypeVar('_SecondType') _ThirdType = TypeVar('_ThirdType') _UpdatedType1 = TypeVar('_UpdatedTy...
61
1,798
qutip
qutip/core/data/make.py
.py
from .dispatch import Dispatcher as _Dispatcher from . import csr, dense, dia, CSR, Dense, Dia import numpy as np __all__ = [ 'diag', 'one_element_csr', 'one_element_dense', 'one_element_dia', 'one_element' ] def _diag_signature(diagonals, offsets=0, shape=None): """ Construct a matrix from diagonals...
132
4,361
beam
sdks/python/apache_beam/runners/interactive/caching/streaming_cache.py
.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
543
20,037
wagtail
wagtail/documents/fields.py
.py
from django.conf import settings from django.core.exceptions import ValidationError from django.forms.fields import FileField from django.template.defaultfilters import filesizeformat from django.utils.translation import gettext_lazy as _ class WagtailDocumentField(FileField): def __init__(self, *args, **kwargs):...
58
2,128
pymc
pymc/sampling/mcmc.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...
2,022
75,960
textual
src/textual/_compositor.py
.py
""" The compositor handles combining widgets into a single screen (i.e. compositing). It also stores the results of that process, so that Textual knows the widgets on the screen and their locations. The compositor uses this information to answer queries regarding the widget under an offset, or the style under an offs...
1,273
44,251
openvino
docs/articles_en/assets/snippets/ov_python_inference.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import openvino as ov import openvino.opset12 as ops INPUT_SIZE = 1_000_000 # Use bigger values if necessary, i.e.: 300_000_000 input_0 = ops.parameter([INPUT_SIZE], name="input_0") input_1 = ops.parameter([INPUT_SI...
75
2,538
onnx
onnx/reference/ops/op_rms_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.op_run import OpRun def _rms_normalization( X: np.ndarray, W: np.ndarray, axis: int = -1, epsilon: float = 1e-5, ) -> np.ndarray: shape = X.s...
50
1,334
cvxpy
cvxpy/tests/test_convolution.py
.py
""" Copyright 2013 Steven Diamond, Eric Chu 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...
163
5,725
django-cms
cms/test_utils/project/placeholder_relation_field_app/views.py
.py
from django.http import Http404 from django.shortcuts import render from cms.toolbar.utils import get_toolbar_from_request from .models import FancyPoll def detail(request, poll_id): try: poll = FancyPoll.objects.get(pk=poll_id) except FancyPoll.DoesNotExist: raise Http404('Fancy Poll doesn\...
18
467
pyomo
pyomo/solvers/plugins/solvers/GLPK.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...
579
21,998
coremltools
coremltools/models/utils.py
.py
# Copyright (c) 2017, 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 """ Utilities for the entire package. """ import copy as _copy import gc as _gc import math as _math imp...
2,480
88,773
pyomo
examples/pyomobook/abstract-ch/concrete2.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...
17
861
pyomo
examples/kernel/conic.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...
84
2,494
python-prompt-toolkit
tests/test_inputstream.py
.py
from __future__ import annotations import pytest from prompt_toolkit.input.vt100_parser import Vt100Parser from prompt_toolkit.keys import Keys class _ProcessorMock: def __init__(self): self.keys = [] def feed_key(self, key_press): self.keys.append(key_press) @pytest.fixture def processor...
142
4,060
mlflow
mlflow/transformers/flavor_config.py
.py
from __future__ import annotations import json import os from typing import TYPE_CHECKING, Any from packaging.version import Version from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import ALREADY_EXISTS, INVALID_PARAMETER_VALUE from mlflow.transformers.peft import _PEFT_ADAPTOR_DIR_NA...
281
10,000
mlflow
examples/lightgbm/lightgbm_native/train.py
.py
import argparse import lightgbm as lgb import matplotlib as mpl from sklearn import datasets from sklearn.metrics import accuracy_score, log_loss from sklearn.model_selection import train_test_split import mlflow import mlflow.lightgbm mpl.use("Agg") def parse_args(): parser = argparse.ArgumentParser(descripti...
80
2,107
jupytext
src/jupytext/pep8.py
.py
"""Determine how many blank lines should be inserted between two cells""" from .stringparser import StringParser def next_instruction_is_function_or_class(lines): """Is the first non-empty, non-commented line of the cell either a function or a class?""" parser = StringParser("python") for i, line in enum...
95
2,899
cvxpy
cvxpy/tests/nlp_tests/test_best_of.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 ...
135
5,458
pyomo
pyomo/contrib/mindtpy/tests/test_mindtpy_grey_box.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...
83
3,195
onnxruntime
onnxruntime/test/python/quantization/test_op_attention.py
.py
#!/usr/bin/env python # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # ---------------------------------------------------------------...
115
4,619
ipython
tests/test_syspathcontext.py
.py
"""Tests for IPython.utils.syspathcontext.""" import sys import pytest from IPython.utils.syspathcontext import prepended_to_syspath _FAKE_DIR = "/tmp/fake_test_dir_ipython_xyz_99999" def test_prepended_adds_dir_to_sys_path(): assert _FAKE_DIR not in sys.path with prepended_to_syspath(_FAKE_DIR): ...
75
1,996
pyro
tests/optim/test_optim.py
.py
# Copyright (c) 2017-2019 Uber Technologies, Inc. # SPDX-License-Identifier: Apache-2.0 import os from tempfile import TemporaryDirectory from unittest import TestCase import pytest import torch from torch.distributions import constraints import pyro import pyro.distributions as dist import pyro.optim as optim from ...
561
19,397
astropy
astropy/cosmology/_src/typing.py
.py
"""Static typing for :mod:`astropy.cosmology`. PRIVATE API.""" # Licensed under a 3-clause BSD style license - see LICENSE.rst __all__ = ("CosmoMeta", "FArray", "_CosmoT") from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeAlias, TypeVar import numpy as np from numpy.typing import NDArray...
23
691
probability
tensorflow_probability/python/math/ode/runge_kutta_util.py
.py
# Copyright 2019 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...
305
11,629
confluent-kafka-python
tests/integration/schema_registry/data/proto/DependencyTestProto_pb2.py
.py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: tests/integration/schema_registry/data/proto/DependencyTestProto.proto """Generated protocol buffer code.""" from google.protobuf.internal import builder as _builder from google.protobuf import descriptor as _descriptor from go...
47
2,554
python-prompt-toolkit
examples/progress-bar/styled-2.py
.py
#!/usr/bin/env python """ A very simple progress bar which keep track of the progress as we consume an iterator. """ import time from prompt_toolkit.formatted_text import HTML from prompt_toolkit.shortcuts import ProgressBar from prompt_toolkit.shortcuts.progress_bar import formatters from prompt_toolkit.styles impor...
51
1,347
pyfilesystem2
tests/test_wrap.py
.py
from __future__ import unicode_literals import operator import unittest try: from unittest import mock except ImportError: import mock import six import fs.copy import fs.errors import fs.mirror import fs.move import fs.wrap from fs import open_fs from fs.info import Info class TestWrapReadOnly(unittest.T...
220
7,991
gunicorn
tests/requests/invalid/rfc9112_chunked_size_plus_sign_01.py
.py
# # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. # RFC 9112 section 7.1: chunk-size = 1*HEXDIG; a leading sign ("+" or "-") # is not valid and has been used in request-smuggling vectors. from gunicorn.http.errors import InvalidChunkSize request = InvalidChunkSize...
9
321
coremltools
coremltools/converters/mil/mil/passes/defs/cleanup/noop_elimination.py
.py
# Copyright (c) 2023, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as np from coremltools.converters.mil.mil import types from coremltools.converters.mil...
250
8,331
textual
examples/breakpoints.py
.py
from textual.app import App, ComposeResult from textual.containers import Grid from textual.widgets import Footer, Markdown, Placeholder HELP = """\ ## Breakpoints A demonstration of how to make an app respond to the dimensions of the terminal. Try resizing the terminal, then have a look at the source to see how it ...
54
1,277
pyomo
pyomo/contrib/trustregion/filter.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...
75
2,682
sqlmap
lib/core/option.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ from __future__ import division import codecs import collections import functools import glob import importlib import inspect import json import logging import os import random i...
3,181
119,247
readthedocs.org
readthedocs/analytics/admin.py
.py
"""Analytics Admin classes.""" from django.contrib import admin from .models import PageView @admin.register(PageView) class PageViewAdmin(admin.ModelAdmin): raw_id_fields = ("project", "version") list_display = ("project", "version", "path", "view_count", "date") search_fields = ("project__slug", "vers...
15
441
metrics
src/torchmetrics/text/squad.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...
169
6,066
saleor
saleor/core/context.py
.py
from promise import Promise def with_promise_context(func): """Execute function within Promise context. Allow to use dataloaders inside the function. """ def wrapper(*args, **kwargs): def promise_executor(_): return func(*args, **kwargs) # Create promise chain pr...
19
422
sqlmap
lib/core/enums.py
.py
#!/usr/bin/env python """ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org) See the file 'LICENSE' for copying permission """ class PRIORITY(object): LOWEST = -100 LOWER = -50 LOW = -10 NORMAL = 0 HIGH = 10 HIGHER = 50 HIGHEST = 100 class SORT_ORDER(object): FIRST = 0 ...
535
15,610
jupytext
tests/data/notebooks/outputs/ipynb_to_percent/jupyter_with_raw_cell_on_top.py
.py
# --- # title: Quick test # output: # ioslides_presentation: # widescreen: true # smaller: true # editor_options: # chunk_output_type: console # jupyter: # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # %% 1+2+3 # %%
20
278
ipython
tests/test_history.py
.py
# coding: utf-8 """Tests for the IPython tab-completion machinery.""" # ----------------------------------------------------------------------------- # Module imports # ----------------------------------------------------------------------------- # stdlib import io import gc import os import sqlite3 import subprocess ...
858
30,272
mlflow
mlflow/utils/workspace_context.py
.py
from __future__ import annotations from contextvars import ContextVar, Token from mlflow.environment_variables import MLFLOW_WORKSPACE from mlflow.utils.workspace_utils import DEFAULT_WORKSPACE_NAME _WORKSPACE: ContextVar[str | None] = ContextVar("mlflow_active_workspace", default=None) _IS_WORKSPACE_RESOLVED: Conte...
126
4,110
jupytext
tests/external/pre_commit/test_pre_commit_mode.py
.py
import os import time import pytest from nbformat.v4.nbbase import new_code_cell, new_markdown_cell, new_notebook from jupytext import read, write from jupytext.cli import get_timestamp, git_timestamp, is_untracked, jupytext def test_is_untracked(tmpdir, cwd_tmpdir, tmp_repo): # make a test file file = "tes...
265
8,166
lemur
lemur/logs/views.py
.py
""" .. module: lemur.logs.views :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 flask import Blueprint from flask_restful import reqparse, Api from lemur.common.schema ...
76
2,001
mlflow
mlflow/entities/model_registry/model_version_stages.py
.py
from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE STAGE_NONE = "None" STAGE_STAGING = "Staging" STAGE_PRODUCTION = "Production" STAGE_ARCHIVED = "Archived" STAGE_DELETED_INTERNAL = "Deleted_Internal" ALL_STAGES = [STAGE_NONE, STAGE_STAGING, STAGE_PRODUCTIO...
26
831
probability
tensorflow_probability/python/internal/custom_gradient_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...
153
4,038
openvino
tests/memory_tests/tools/run_tests.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # import platform import argparse import glob import os import re import itertools import subprocess import json import time import sys from typing import Any from pathlib import Path from dataclasses import dataclass, asdict try: ...
452
16,351
conda
docs/source/conf.py
.py
#!/usr/bin/env python3 # Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause import os.path import sys from pathlib import Path # expose custom extensions sys.path.insert(0, os.path.abspath("_extensions")) # expose source code for import sys.path.insert(0, os.path.abspath("../..")) import conda ...
252
8,732
coremltools
coremltools/models/neural_network/builder.py
.py
# Copyright (c) 2017, 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 """ Neural network builder class to construct Core ML models. """ from math import floor as _math_floor ...
8,889
339,341
saleor
saleor/graphql/management/commands/get_graphql_schema.py
.py
from django.core.management.base import BaseCommand from ...api import schema from ...schema_printer import print_schema class Command(BaseCommand): help = "Writes SDL for GraphQL API schema to stdout" def handle(self, *args, **options): self.stdout.write(print_schema(schema))
12
298
mlflow
mlflow/tracking/request_auth/kubernetes_request_auth_provider.py
.py
"""Request auth provider for Kubernetes environments. This module provides two auth plugins activated via ``MLFLOW_TRACKING_AUTH``: - ``kubernetes`` — adds only the ``Authorization`` header (bearer token). - ``kubernetes-namespaced`` — adds both ``Authorization`` and ``X-MLFLOW-WORKSPACE`` (derived from the Kuberne...
343
12,103
textual
tests/snapshot_tests/snapshot_apps/richlog_max_lines.py
.py
from textual.app import App from textual.widgets import RichLog class RichLogLines(App): count = 0 def compose(self): yield RichLog(max_lines=3) async def on_key(self): self.count += 1 log_widget = self.query_one(RichLog) log_widget.write(f"Key press #{self.count}") app...
21
380
biopython
Tests/test_mmtf_online.py
.py
# Copyright 2017 by Peter Cock. 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. """Tests for mmtf online modu...
36
1,078
saleor
saleor/graphql/core/filters/where_filters.py
.py
import django_filters from django.db import models from django.forms import CharField, NullBooleanField from django_filters import Filter, MultipleChoiceFilter from django_filters.filters import FilterMethod from graphql_relay import from_global_id from .filters import ( DefaultMultipleChoiceField, DefaultOper...
184
5,823
wagtail
wagtail/contrib/frontend_cache/signal_handlers.py
.py
import swapper from django.apps import apps from wagtail.contrib.frontend_cache.utils import purge_page_from_cache from wagtail.signals import page_published, page_unpublished def page_published_signal_handler(instance, **kwargs): purge_page_from_cache(instance) def page_unpublished_signal_handler(instance, **...
25
860
openvino
src/frontends/paddle/tests/test_models/gen_scripts/generate_gather.py
.py
# # gather paddle model generator # import numpy as np from save_model import saveModel import paddle import sys def gather(name: str, x, y, z): paddle.enable_static() with paddle.static.program_guard(paddle.static.Program(), paddle.static.Program()): data = paddle.static.data(name='x', shape=x.shape...
101
2,894
beam
sdks/python/apache_beam/io/kinesis.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...
348
13,348
wagtail
wagtail/contrib/table_block/tests.py
.py
import json import unittest from django.test import SimpleTestCase, TestCase from django.urls import reverse from django.utils import translation from wagtail.blocks.field_block import FieldBlockAdapter from wagtail.contrib.table_block.blocks import DEFAULT_TABLE_OPTIONS, TableBlock from wagtail.test.testapp.models i...
726
26,014
python-prompt-toolkit
src/prompt_toolkit/styles/style.py
.py
""" Tool for creating styles from a dictionary. """ from __future__ import annotations import itertools import re from collections.abc import Hashable from enum import Enum from typing import TypeVar from prompt_toolkit.cache import SimpleCache from .base import ( ANSI_COLOR_NAMES, ANSI_COLOR_NAMES_ALIASES,...
409
13,290
probability
tensorflow_probability/python/layers/internal/tensor_tuple.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...
104
3,045
django-cms
cms/test_utils/project/app_with_cms_feature_and_config/apps.py
.py
from django.apps import AppConfig class CMSFeatureAndConfigConfig(AppConfig): name = 'cms.test_utils.project.app_with_cms_feature_and_config' label = 'app_with_cms_feature_and_config'
7
194
metrics
src/torchmetrics/functional/classification/ranking.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...
268
11,377
saleor
saleor/tests/e2e/checkout/discounts/promotions/test_checkout_custom_price_and_percentage_promotion.py
.py
import pytest from ......product.tasks import recalculate_discounted_price_for_products_task from ....checkout.utils import checkout_lines_update from ....product.utils.preparing_product import prepare_product from ....promotions.utils import create_promotion, create_promotion_rule from ....shop.utils import prepare_d...
146
5,409
mlflow
tests/tracking/test_workspace_registry.py
.py
from __future__ import annotations import pytest from mlflow.store.workspace.rest_store import RestWorkspaceStore from mlflow.store.workspace.sqlalchemy_store import SqlAlchemyStore from mlflow.tracking._workspace.registry import ( UnsupportedWorkspaceStoreURIException, _get_workspace_store_registry, get_...
41
1,295
black
tests/data/miscellaneous/force_pyi.py
.py
# flags: --pyi from typing import Union @bird def zoo(): ... class A: ... @bar class B: def BMethod(self) -> None: ... @overload def BMethod(self, arg : List[str]) -> None: ... class C: ... @hmm class D: ... class E: ... @baz def foo() -> None: ... class F (A , C): ... def spam() -> None: ... @ove...
67
808
gunicorn
gunicorn/http2/request.py
.py
# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. """ HTTP/2 request wrapper. Provides a Request-compatible interface for HTTP/2 streams. """ from io import BytesIO from gunicorn.util import split_request_uri class HTTP2Body: """Body...
235
6,488
pyomo
pyomo/core/expr/compare.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...
330
11,363
beam
sdks/python/apache_beam/io/gcp/internal/clients/bigquery/bigquery_v2_messages.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...
11,168
498,777
beam
sdks/python/apache_beam/examples/snippets/snippets_examples_wordcount_debugging.py
.py
# coding=utf-8 # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License");...
134
4,694
sqlmap
thirdparty/chardet/escprober.py
.py
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Con...
102
3,950
deap
examples/de/basic.py
.py
# This file is part of EAP. # # EAP is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation, either version 3 of # the License, or (at your option) any later version. # # EAP is distributed in ...
86
2,816
kombu
examples/simple_task_queue/queues.py
.py
from __future__ import annotations from kombu import Exchange, Queue task_exchange = Exchange('tasks', type='direct') task_queues = [Queue('hipri', task_exchange, routing_key='hipri'), Queue('midpri', task_exchange, routing_key='midpri'), Queue('lopri', task_exchange, routing_key='lopri'...
9
323
probability
tensorflow_probability/python/internal/all_util.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...
44
1,695
pyomo
pyomo/core/tests/unit/test_numeric_expr_api.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,116
41,407
cvxpy
cvxpy/utilities/shape.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...
155
4,451
textual
docs/examples/guide/layout/dock_layout3_sidebar_header.py
.py
from textual.app import App, ComposeResult from textual.widgets import Header, Static TEXT = """\ Docking a widget removes it from the layout and fixes its position, aligned to either the top, right, bottom, or left edges of a container. Docked widgets will not scroll out of view, making them ideal for sticky headers...
24
670
probability
tensorflow_probability/python/distributions/relaxed_onehot_categorical_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...
349
14,801
saleor
saleor/graphql/core/types/taxes.py
.py
from functools import partial import graphene from prices import Money from promise import Promise from ....checkout import base_calculations from ....checkout.models import Checkout, CheckoutLine from ....core.db.connection import allow_writer_in_context from ....core.prices import quantize_price from ....discount i...
454
16,933
qutip
qutip/control.py
.py
"""Module replicating the qutip_qtrl package from within qutip.""" import sys try: import qutip_qtrl del qutip_qtrl sys.modules["qutip.control"] = sys.modules["qutip_qtrl"] except ImportError: raise ImportError( "Importing 'qutip.control' requires the 'qutip_qtrl' package. " "Install it...
14
431
beam
sdks/python/apache_beam/testing/benchmarks/nexmark/queries/query1.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...
43
1,566
saleor
saleor/checkout/tests/fixtures/checkout.py
.py
import datetime from decimal import Decimal import pytest from django.utils import timezone from ....plugins.manager import get_plugins_manager from ....product.models import ProductVariantChannelListing from ...fetch import fetch_checkout_info, fetch_checkout_lines from ...models import Checkout, CheckoutDelivery, C...
717
22,163
django-cms
cms/tests/test_nonroot.py
.py
from django.template import Template from django.test.utils import override_settings from cms.api import create_page from cms.models import Page from cms.test_utils.testcases import CMSTestCase from menus.base import NavigationNode @override_settings(ROOT_URLCONF='cms.test_utils.project.nonroot_urls') class NonRootC...
68
2,608
probability
spinoffs/inference_gym/inference_gym/targets/ill_conditioned_gaussian_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...
85
2,821
voila
tests/conftest.py
.py
# fixtures common for app and server import os import time import pytest BASE_DIR = os.path.dirname(__file__) @pytest.fixture def base_url(): return "/" @pytest.fixture def notebook_directory(): return os.path.join(BASE_DIR, "notebooks") @pytest.fixture def print_notebook_url(base_url): return base_...
39
672
wandb
wandb/automations/_generated/get_org_automations.py
.py
# Generated by ariadne-codegen # Source: tools/graphql_codegen/automations/ from __future__ import annotations from pydantic import Field from wandb._pydantic import GQLResult from .fragments import PageInfoFields, TriggerFields class GetOrgAutomations(GQLResult): scope: GetOrgAutomationsScope | None class ...
34
814
kafka
tests/kafkatest/tests/core/authorizer_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 use ...
113
6,143
conda
tests/models/test_channel.py
.py
# Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from logging import getLogger from tempfile import gettempdir import pytest from pytest import MonkeyPatch from conda.auxlib.ish import dals from conda.base.constants import DEFAULT_CHANNELS from conda.base.context import Context, context, res...
1,418
54,298
probability
discussion/pathfinder/pathfinder.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...
295
11,295
probability
tensorflow_probability/python/bijectors/scale_matvec_lu.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...
300
10,890
kombu
kombu/transport/virtual/exchange.py
.py
"""Virtual AMQ Exchange. Implementations of the standard exchanges defined by the AMQ protocol (excluding the `headers` exchange). """ from __future__ import annotations import re from kombu.utils.text import escape_regex class ExchangeType: """Base class for exchanges. Implements the specifics for an e...
165
4,894
kombu
kombu/utils/collections.py
.py
"""Custom maps, sequences, etc.""" from __future__ import annotations class HashedSeq(list): """Hashed Sequence. Type used for hash() to make sure the hash is not generated multiple times. """ __slots__ = 'hashvalue' def __init__(self, *seq): self[:] = seq self.hashvalue =...
46
942
biopython
Bio/codonalign/codonseq.py
.py
# Copyright 2013 by Zheng Ruan (zruan1991@gmail.com). 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. """Code...
1,320
47,934
onnxruntime
onnxruntime/test/python/transformers/test_generation.py
.py
#!/usr/bin/env python # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------...
551
20,884
saleor
saleor/order/tasks.py
.py
import datetime import logging from collections import Counter from django.conf import settings from django.contrib.sites.models import Site from django.db.models import Exists, F, Func, OuterRef, Subquery, Value from django.db.models.functions import Greatest from django.utils import timezone from ..account.lock_obj...
244
8,318
sphinx
tests/test_transforms/test_transforms_move_module_targets.py
.py
from __future__ import annotations from typing import TYPE_CHECKING import pytest from docutils import nodes from sphinx import addnodes from sphinx.testing.util import SphinxTestApp from sphinx.transforms import MoveModuleTargets if TYPE_CHECKING: from pathlib import Path CONTENT_PY = """\ move-module-targets...
90
2,828
pyro
tests/test_settings.py
.py
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 import pytest from pyro import settings _TEST_SETTING: float = 0.1 pytestmark = pytest.mark.stage("unit") def test_settings(): v0 = settings.get() assert isinstance(v0, dict) assert all(isinstance(alias, str) for alias...
51
1,420
flit
flit_core/flit_core/buildapi.py
.py
"""PEP-517 compliant buildsystem API""" import logging import os import os.path as osp from pathlib import Path from .common import ( Module, make_metadata, write_entry_points, dist_info_name, get_docstring_and_version_via_ast, ) from .config import read_flit_config from .wheel import make_wheel_in, _write_whe...
86
3,344
scikit-bio
skbio/metadata/tests/test_interval.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. # --------------------------------------------...
796
32,405
returns
tests/test_maybe/test_maybe_functions/test_maybe_decorator.py
.py
from returns.maybe import Nothing, Some, maybe @maybe def _function(hashmap: dict[str, str], key: str) -> str | None: return hashmap.get(key) def test_maybe_some(): """Ensures that maybe decorator works correctly for some case.""" assert _function({'a': 'b'}, 'a') == Some('b') def test_maybe_nothing()...
17
444
black
tests/data/cases/py310_pep572.py
.py
# flags: --minimum-version=3.10 x[a:=0] x[a := 0] x[a := 0, b := 1] x[5, b := 0] x[a:=0,b:=1] # output x[a := 0] x[a := 0] x[a := 0, b := 1] x[5, b := 0] x[a := 0, b := 1]
14
173
textual
tests/snapshot_tests/snapshot_apps/hot_reloading_app.py
.py
from pathlib import Path from textual.app import App, ComposeResult from textual.containers import Container from textual.widgets import Label CSS_PATH = (Path(__file__) / "../hot_reloading_app.tcss").resolve() # Write some CSS to the file before the app loads. # Then, the test will clear all the CSS to see if the ...
32
646