id
int64
0
300k
label
stringlengths
1
74
text
stringlengths
4k
8k
11,100
get arithmetic input fn
# Copyright 2016 The TensorFlow 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 applica...
11,101
solve
# This code is part of a Qiskit project. # # (C) Copyright IBM 2020, 2023. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications ...
11,102
compute constraint params
from .linear_constraint import LinearConstraint, canlinear_colloc_to_interpolate from ..constraint import DiscretizationType import numpy as np class JointTorqueConstraint(LinearConstraint): """Joint Torque Constraint. A joint torque constraint is given by .. math:: A(q) \ddot q + \dot q^\\top B...
11,103
repr array
"""Redo the builtin repr() (representation) but with limits on most sizes.""" __all__ = ["Repr", "repr", "recursive_repr"] import builtins from itertools import islice from _thread import get_ident def recursive_repr(fillvalue='...'): 'Decorator to make a repr function return fillvalue for a recursive call' ...
11,104
device authorize
import time from flask import json from authlib.oauth2.rfc8628 import ( DeviceAuthorizationEndpoint as _DeviceAuthorizationEndpoint, DeviceCodeGrant as _DeviceCodeGrant, DeviceCredentialDict, ) from .models import db, User, Client from .oauth2_server import TestCase from .oauth2_server import create_authori...
11,105
find systems
"""Helpers for working with extensions to DIRAC""" import argparse import fnmatch import functools import importlib import os import pkgutil import sys from collections import defaultdict from importlib.machinery import PathFinder import importlib_metadata as metadata import importlib_resources def iterateThenSort(f...
11,106
test default improver with nvd
# # Copyright (c) nexB Inc. and others. All rights reserved. # VulnerableCode is a trademark of nexB Inc. # SPDX-License-Identifier: Apache-2.0 # See http://www.apache.org/licenses/LICENSE-2.0 for the license text. # See https://github.com/nexB/vulnerablecode for support or download. # See https://aboutcode.org for mor...
11,107
rename key
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. 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 r...
11,108
write table
# Stubs for ply.yacc (Python 3.7) # # NOTE: This dynamically typed stub was automatically generated by stubgen. from typing import Any, Optional, TypeVar, Generic, List from ply.lex import Lexer from inmanta.ast.statements import Statement __tabversion__: str yaccdebug: bool debug_file: str tab_module: str default_...
11,109
get vagrant options
""" The ``@vagrant`` connector reads the current Vagrant status and generates an inventory for any running VMs. .. code:: shell # Run on all hosts pyinfra @vagrant ... # Run on a specific VM pyinfra @vagrant/my-vm-name ... # Run on multiple named VMs pyinfra @vagrant/my-vm-name,@vagrant/anot...
11,110
test sensitive headers
import pytest import httpx def test_headers(): h = httpx.Headers([("a", "123"), ("a", "456"), ("b", "789")]) assert "a" in h assert "A" in h assert "b" in h assert "B" in h assert "c" not in h assert h["a"] == "123, 456" assert h.get("a") == "123, 456" assert h.get("nope", default...
11,111
buchheim
# Authors: William Mill (bill@billmill.org) # License: BSD 3 clause import numpy as np class DrawTree: def __init__(self, tree, parent=None, depth=0, number=1): self.x = -1.0 self.y = depth self.tree = tree self.children = [ DrawTree(c, self, depth + 1, i + 1) for i, c...
11,112
set up class
import os import shutil import subprocess import unittest import numpy as np import onnx import onnxruntime as ort from transformers import AutoTokenizer from neural_compressor import PostTrainingQuantConfig, quantization def Inference(model, data): sess = ort.InferenceSession(model.SerializeToString(), provide...
11,113
get alloc node info
"""The Raw (local system) scheduler.""" import os import signal import socket import subprocess import time import uuid from pathlib import Path from typing import Union, List, Tuple from pavilion.jobs import JobInfo, Job from pavilion.status_file import STATES, TestStatusInfo from pavilion.types import NodeInfo, Nod...
11,114
gate
# Copyright 2019 The Cirq 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
11,115
load file
# Copyright 2020 The TensorFlow 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 applica...
11,116
test async
import importlib import pathlib import pytest from pint import UnitRegistry # Conditionally import NumPy, Dask, and Distributed np = pytest.importorskip("numpy", reason="NumPy is not available") dask = pytest.importorskip("dask", reason="Dask is not available") distributed = pytest.importorskip("distributed", reaso...
11,117
dbid
# This file implements a class which forms an interface to the .cddb # directory that is maintained by SGI's cdman program. # # Usage is as follows: # # import readcd # r = readcd.Readcd() # c = Cddb(r.gettrackinfo()) # # Now you can use c.artist, c.title and c.track[trackno] (where trackno # starts at 1). When the CD...
11,118
display rise
"""Google View.""" __docformat__ = "numpy" import logging import os from typing import List, Optional, Union import pandas as pd from openbb_terminal import OpenBBFigure, theme from openbb_terminal.common.behavioural_analysis import google_model from openbb_terminal.decorators import log_start_end from openbb_termin...
11,119
parse statement
from ScoutSuite.providers.aws.resources.base import AWSCompositeResources from ScoutSuite.providers.aws.resources.iam.credentialreports import CredentialReports from ScoutSuite.providers.aws.resources.iam.groups import Groups from ScoutSuite.providers.aws.resources.iam.policies import Policies from ScoutSuite.providers...
11,120
f2
r"""Incompressible Hyperelasticity This example solves the governing equations describing the mechanical response of a nearly incompressible elastomer using a mixed formulation. The elastomer, assumed to be made up of a Neo-Hookean solid, occupies the domain :math:`\Omega` in the undeformed configuration, with the ...
11,121
test get
""" Test cases for salt.modules.etcd_mod Note: No functional tests are required as of now, as this is essentially a wrapper around salt.utils.etcd_util. If the contents of this module were to add more logic besides acting as a wrapper, then functional tests would be required. :codeauthor: Jaye...
11,122
supports range index
""" Croston method -------------- """ from typing import Optional from statsforecast.models import TSB as CrostonTSB from statsforecast.models import CrostonClassic, CrostonOptimized, CrostonSBA from darts.logging import raise_if, raise_if_not from darts.models.forecasting.forecasting_model import ( FutureCovari...
11,123
test vm nics
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
11,124
test runs tests without help flag
#!/usr/bin/env python # # Copyright 2009, Google Inc. # 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, this list...
11,125
build pytorch model
# Copyright (c) OpenMMLab. All rights reserved. import copy from typing import Dict, Optional, Tuple, Union import numpy as np import torch from mmengine import Config from mmengine.model import BaseDataPreprocessor from mmengine.registry import Registry from mmdeploy.apis.utils import build_task_processor from mmdep...
11,126
get final url
# -*- coding: utf-8 -*- # Copyright 2014 Google Inc. 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 require...
11,127
test versionvariants parses correct version string
# Licensed to Elasticsearch B.V. under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright # ownership. Elasticsearch B.V. licenses this file to you under # the Apache License, Version 2.0 (the "License"); you may # not use this f...
11,128
show snapshot
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
11,129
get metdata
# Copyright (C) 2023 Intel Corporation # SPDX-License-Identifier: GPL-3.0-or-later import asyncio import json import shutil import tempfile from pathlib import Path import aiohttp import gnupg from rich.progress import track from cve_bin_tool.async_utils import FileIO from cve_bin_tool.error_handler import ERROR_COD...
11,130
create instance
# Copyright (c) 2021 Charles University, Faculty of Arts, # Institute of the Czech National Corpus # Copyright (c) 2021 Martin Zimandl <martin.zimandl@gmail.com> # Copyright (c) 2021 Tomas Machalek <tomas.machalek@gmail.com> # # This program is free software; you can redistribute it and/or # modify i...
11,131
set up class
# python-holidays # --------------- # A fast, efficient Python library for generating country, province and state # specific sets of holidays on the fly. It aims to make determining whether a # specific date is a holiday as fast and flexible as possible. # # Authors: dr-prodigy <dr.prodigy.github@gmail.com> (c) 2...
11,132
test from internal map when exists
# ------------------------------------------------------------------------------------------------- # Copyright (C) 2015-2023 Nautech Systems Pty Ltd. All rights reserved. # https://nautechsystems.io # # Licensed under the GNU Lesser General Public License Version 3.0 (the "License"); # You may not use this file ex...
11,133
test can be deselected and selected
#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2023, Anaconda, Inc. All rights reserved. # # Powered by the Bokeh Development Team. # # The full license is in the file LICENSE.txt, distributed with this software. #---------------------------------------------------...
11,134
test rabit ops
import re import sys import numpy as np import pytest import xgboost as xgb from xgboost import RabitTracker, collective from xgboost import testing as tm if sys.platform.startswith("win"): pytest.skip("Skipping dask tests on Windows", allow_module_level=True) def test_rabit_tracker(): tracker = RabitTrack...
11,135
test collection add and remove
from feeluown.models.uri import ResolveFailed, ResolverNotFound, reverse from feeluown.collection import Collection, CollectionManager, LIBRARY_FILENAME, \ POOL_FILENAME def test_collection_load(tmp_path, song, mocker): mock_resolve = mocker.patch('feeluown.collection.resolve', ...
11,136
find objects
# Data Parallel Control (dpctl) # # Copyright 2020-2022 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2....
11,137
list
# coding=utf-8 ##################################################### # THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT # ##################################################### # noqa: E128,E201 from ...aio.asyncclient import AsyncBaseClient from ...aio.asyncclient import createApiClient from ...aio.asyncclient import ...
11,138
query parameters
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # # Code generated by aaz-dev-tools # --------------------------------...
11,139
most recent
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import copy import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload fr...
11,140
forward
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from typing import Dict, List, Optional from pathlib import Path import torch.nn as nn from torch import Tensor from fairseq im...
11,141
test hosthost
from django.test import SimpleTestCase from eulxml.xpath import parse as parse_xpath from testil import eq, assert_raises from corehq.apps.case_search.xpath_functions.ancestor_functions import is_ancestor_comparison, \ _is_ancestor_path_expression from corehq.apps.case_search.filter_dsl import CaseFilterError from...
11,142
allow bulk destroy
# # Copyright (C) 2015-2017 by frePPLe bv # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish...
11,143
test partial object validate
# -*- mode:python; coding:utf-8 -*- # Copyright (c) 2021 IBM Corp. 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 # # https://www.apache.org/licenses/LICENSE-2.0 # ...
11,144
connect
from __future__ import annotations import json import os import re import time from concurrent.futures import ThreadPoolExecutor, as_completed from itertools import chain, repeat from typing import TYPE_CHECKING, Any import pytest from requests import Session import ibis from ibis.backends.tests.base import RoundHal...
11,145
lemke howson solve
# Copyright 2019 DeepMind Technologies Limited # # 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 agr...
11,146
try repr or str
import pprint import reprlib from typing import Any from typing import Dict from typing import IO from typing import Optional def METHOD_NAME(obj: object) -> str: try: return repr(obj) except (KeyboardInterrupt, SystemExit): raise except BaseException: return f'{type(obj).__name__}...
11,147
get context data
import json from django.views.generic import TemplateView from django.db.models import Q from django.db.models.functions import Lower from django.http import HttpResponseRedirect, Http404 from django.contrib.auth.mixins import UserPassesTestMixin from sass.enums.chem_unit import ChemUnit from bims.serializers.survey_se...
11,148
get submission
import http.client import json import requests class DevCenterAccessTokenClient(object): """A client for acquiring access tokens from AAD to use with the Dev Center Client.""" def __init__(self, tenant_id, client_id, client_secret): self.tenant_id = tenant_id self.client_id = client_id ...
11,149
single point
# 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 u...
11,150
isdir
from collections.abc import Callable, Sequence from contextlib import AbstractContextManager from stat import S_IMODE as S_IMODE from types import TracebackType from typing import IO from typing_extensions import Literal, Self, TypeAlias import paramiko from paramiko import AuthenticationException as AuthenticationExc...
11,151
test ga4 send event
import decimal import json import os import unittest from pathlib import Path import toml from httprunner import __version__, loader, utils from httprunner.utils import ExtendJSONEncoder, merge_variables, ga4_client class TestUtils(unittest.TestCase): def test_set_os_environ(self): self.assertNotIn("abc...
11,152
close
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
11,153
get pids
#!/usr/bin/env python # Copyright (C) 2015 Dmitry Rodionov # This software may be modified and distributed under the terms # of the MIT license. See the LICENSE file for details. import inspect import logging import subprocess import timeit from os import environ, path, sys, waitpid from lib.api.process import Proces...
11,154
initialize gl
""" RawImageWidget.py Copyright 2010-2016 Luke Campagnola Distributed under MIT/X11 license. See license.txt for more information. """ from .. import functions as fn from .. import getConfigOption, getCupy from ..Qt import QtCore, QtGui, QtWidgets try: QOpenGLWidget = QtWidgets.QOpenGLWidget from OpenGL.GL im...
11,155
list
# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRe...
11,156
switch out
from __future__ import print_function from code import InteractiveConsole import errno import socket import sys import errno import traceback import eventlet from eventlet import hubs from eventlet.support import greenlets, get_errno try: sys.ps1 except AttributeError: sys.ps1 = '>>> ' try: sys.ps2 excep...
11,157
calc results progress
import datetime import pandas as pd from mapswipe_workers.definitions import logger def METHOD_NAME( number_of_users: int, number_of_users_required: int, cum_number_of_users: int, number_of_tasks: int, number_of_results: int, ) -> int: """ for each project the progress is calculated ...
11,158
configure loader modules
""" Unit tests for the Vault runner """ import logging import pytest import salt.runners.vault as vault from tests.support.mock import ANY, MagicMock, Mock, patch log = logging.getLogger(__name__) def _mock_json_response(data, status_code=200, reason=""): """ Mock helper for http response """ res...
11,159
handle stdin
from collections.abc import Iterable, Mapping from types import TracebackType from typing import Any, TextIO, overload from typing_extensions import Literal, TypeAlias from .watchers import StreamWatcher _Hide: TypeAlias = Literal[None, True, False, "out", "stdout", "err", "stderr", "both"] class Runner: read_ch...
11,160
run hmc
# Copyright Contributors to the Pyro project. # SPDX-License-Identifier: Apache-2.0 """ Example: Hamiltonian Monte Carlo with Energy Conserving Subsampling =================================================================== This example illustrates the use of data subsampling in HMC using Energy Conserving Subsamplin...
11,161
test settings
import pytest from ddt import ddt from mock import patch, Mock, MagicMock from requests import Response from monitorrent.plugins.clients.utorrent import UTorrentClientPlugin from tests import DbTestCase, use_vcr @ddt class UTorrentPluginTest(DbTestCase): real_host = "http://localhost" real_port = 8080 re...
11,162
show image
import json import cv2 import base64 import threading import time from datetime import datetime from websocket_server import WebsocketServer import os # Graphical User Interface Class class GUI: # Initialization function # The actual initialization def __init__(self, host): t = threading.Thread(ta...
11,163
unordered
"""pytest configuration Extends output capture as needed by pybind11: ignore constructors, optional unordered lines. Adds docstring and exceptions message sanitizers. """ import contextlib import difflib import gc import multiprocessing import os import re import textwrap import pytest # Early diagnostic for failed...
11,164
as ip addr
#!/usr/bin/env python """Network-related client rdfvalues.""" import binascii import ipaddress import logging from typing import Optional from typing import Text from typing import Union from grr_response_core.lib import rdfvalue from grr_response_core.lib.rdfvalues import protodict as rdf_protodict from grr_response...
11,165
set up
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
11,166
from config
# Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file ex...
11,167
test logging
# Copyright (c) 2009-2023 The Regents of the University of Michigan. # Part of HOOMD-blue, released under the BSD 3-Clause License. import hoomd from hoomd import md from hoomd.conftest import expected_loggable_params from hoomd.conftest import (logging_check, pickling_check, autotuned_kern...
11,168
installing fs obj
__all__ = ( "null_output", "formatter_output", "file_handle_output", "phase_observer", "repo_observer", "decorate_build_method", ) import threading from snakeoil import klass from snakeoil.currying import pre_curry def _convert(msg, args=(), kwds={}): # Note for interpolation, ValueError...
11,169
principal
# parameters=sessao,imagem,data,lst_materias,dic_cabecalho,lst_rodape,dic_filtro """relatorio_materia.py External method para gerar o arquivo rml do resultado de uma pesquisa de matérias Autor: Leandro Gasparotto Valladares Empresa: Interlegis versão: 1.0 """ import time import os from trml2pdf import par...
11,170
importer prefill
#!/usr/bin/env python # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you ma...
11,171
test app delete for app out of
import json from unittest import mock import graphene from django.utils.functional import SimpleLazyObject from freezegun import freeze_time from .....app.error_codes import AppErrorCode from .....app.models import App from .....core.utils.json_serializer import CustomJsonEncoder from .....webhook.event_types import ...
11,172
disruptive uniform crossover
""" A simple genetic algorithm for parameter search """ import random from collections import OrderedDict import numpy as np from kernel_tuner import util from kernel_tuner.searchspace import Searchspace from kernel_tuner.strategies import common from kernel_tuner.strategies.common import CostFunc _options = OrderedD...
11,173
test zabbix getinfo
import logging import pytest from unittest import mock from elastalert.alerters.zabbix import ZabbixAlerter from elastalert.loaders import FileRulesLoader from elastalert.util import EAException def test_zabbix_basic(caplog): caplog.set_level(logging.WARNING) rule = { 'name': 'Basic Zabbix test', ...
11,174
get atcoder rating
# -*- coding: utf-8 -*- """ Copyright (c) 2015-2020 Raj Patel(raj454raj@gmail.com), StopStalk Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without...
11,175
facilityadmins
import requests from django.urls import reverse from rest_framework import decorators from rest_framework.exceptions import NotFound from rest_framework.exceptions import PermissionDenied from rest_framework.exceptions import ValidationError from rest_framework.permissions import BasePermission from rest_framework.resp...
11,176
make report
"""Profiling code for Jax and PyTorch. Modified from: https://github.com/Lightning-AI/lightning/tree/master/src/pytorch_lightning/profilers. """ from collections import defaultdict from contextlib import contextmanager import os import time from typing import Dict, Generator, List, Optional, Tuple import numpy as np...
11,177
do iterm
import cmd from fv3net.diagnostics.prognostic_run import load_run_data import intake import vcm.catalog import vcm import xarray as xr import fv3viz import pathlib import matplotlib.pyplot as plt import cartopy.crs import sys import io import warnings from . import iterm warnings.filterwarnings("ignore") def meridi...
11,178
fetch all
# SPDX-FileCopyrightText: 2023 Blender Authors # # SPDX-License-Identifier: GPL-2.0-or-later # Script to get all the inactive gitea developers # Usage: GITEA_API_TOKEN=<yourtoken> python3 gitea_inactive_developers.py # # The API Token have the "read:org" or "admin:org" scope. # # Potential errors: # * 403 Client Error...
11,179
ot3 session server
import asyncio import contextlib import json import time from pathlib import Path from typing import Any, Dict, Generator import pytest import requests from robot_server.versioning import API_VERSION_HEADER, LATEST_API_VERSION_HEADER_VALUE from .dev_server import DevServer from .robot_client import RobotClient _SE...
11,180
output
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # # Code generated by aaz-dev-tools # --------------------------------...
11,181
test 2 steps regressor
import inspect import logging import pytest from sklearn import datasets from lale.lib import autogen from lale.lib.lale import Hyperopt from lale.lib.lale.hyperopt import logger from lale.lib.sklearn import LogisticRegression from lale.operators import Operator, make_choice logger.setLevel(logging.ERROR) def load...
11,182
test updates foo
from webtest import TestApp as Client import morepath import app from app import App def setup_module(module): morepath.scan(app) morepath.commit(App) def test_json(): """/json""" app = App() c = Client(app) response = c.get('/json', status=200) assert response.headerlist == [ ...
11,183
parse trailers
# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. import io import sys from gunicorn.http.errors import (NoMoreData, ChunkMissingTerminator, InvalidChunkSize) class ChunkedReader(object): def __init__(...
11,184
handle request
""" This type stub file was generated by pyright. """ import ssl import typing from socksio import socks5 from .._exceptions import ConnectionNotAvailable, ProxyError from .._models import Origin, Request, Response, URL, enforce_bytes, enforce_url from .._ssl import default_ssl_context from .._synchronization import L...
11,185
pytest generate tests
# 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 u...
11,186
test hex tiles gridsize tuple
import numpy as np from holoviews.core import Dimension from holoviews.element import HexTiles from holoviews.plotting.bokeh.hex_tiles import hex_binning from holoviews.plotting.bokeh.util import property_to_dict from .test_plot import TestBokehPlot, bokeh_renderer class TestHexTilesOperation(TestBokehPlot): d...
11,187
search page data
from __future__ import annotations from pathlib import Path import pytest from poetry.repositories.parsers.pypi_search_parser import Result from poetry.repositories.parsers.pypi_search_parser import SearchResultParser FIXTURES_DIRECTORY = Path(__file__).parent.parent / "fixtures" / "pypi.org" / "search" @pytest....
11,188
get sft and sidecar
import gc from dipy.io.streamline import load_tractogram import numpy as np from dipy.io.stateful_tractogram import StatefulTractogram, Space import os.path as op from AFQ.utils.path import drop_extension, read_json class SegmentedSFT(): def __init__(self, bundles, space): reference = None self.b...
11,189
vector test
#!/usr/bin/env python # Copyright (C) 2006-2021 Music Technology Group - Universitat Pompeu Fabra # # This file is part of Essentia # # Essentia is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation (FSF), e...
11,190
assert true
# -*- coding: utf-8 -*- """ werkzeug.testsuite ~~~~~~~~~~~~~~~~~~ Contains all test Werkzeug tests. :copyright: (c) 2014 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statement import re import sys import unittest import shutil import tempfile im...
11,191
test test bytes2
import pytest from vyper.exceptions import InvalidType, TypeMismatch def test_test_bytes(get_contract_with_gas_estimation, assert_tx_failed): test_bytes = """ @external def foo(x: Bytes[100]) -> Bytes[100]: return x """ c = get_contract_with_gas_estimation(test_bytes) moo_result = c.foo(b"cow") ...
11,192
set existing languages
# coding=utf-8 from __future__ import absolute_import import logging import os from babelfish.exceptions import LanguageError from subzero.language import Language, language_from_stream from subliminal_patch import scan_video, refine, search_external_subtitles import six logger = logging.getLogger(__name__) def ha...
11,193
get queryset
from django.conf import settings from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.db import models from django.db.models import Case, Value, When from django.db.models.functions import Concat from django.utils import timezone from dj...
11,194
save
#!/usr/bin/env python3 # # Cross Platform and Multi Architecture Advanced Binary Emulation Framework # import ctypes from qiling.core import Qiling from qiling.hw.peripheral import QlPeripheral from qiling.utils import ql_get_module_function from qiling.exception import QlErrorModuleFunctionNotFound class QlHwMana...
11,195
tear down
############################################################################## # # Copyright (c) 2002 Zope Foundation and Contributors. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS I...
11,196
test route
# type: ignore import pathlib from typing import Any import pytest from yarl import URL from aiohttp import web from aiohttp.web_urldispatcher import UrlDispatcher @pytest.fixture def router(): return UrlDispatcher() def test_get(router: Any) -> None: async def handler(request): pass router.a...
11,197
test file uri to path
from __future__ import annotations import logging from contextlib import ExitStack from pathlib import PurePath, PurePosixPath, PureWindowsPath from test.utils.iri import file_uri_to_path, rebase_url from typing import Optional, Type, Union import pytest @pytest.mark.parametrize( ["file_uri", "path_class", "exp...
11,198
vad collector
""" Vad for files/folders with webrtcvad. Credit: https://github.com/wiseman/py-webrtcvad/blob/master/example.py Author ------ Yingzhi Wang 2023 """ import collections import webrtcvad import contextlib import wave import os def read_wave(path): """Reads a .wav file. Takes the path, and returns (PCM audio ...
11,199
isatty
from __future__ import print_function from code import InteractiveConsole import errno import socket import sys import errno import traceback import eventlet from eventlet import hubs from eventlet.support import greenlets, get_errno try: sys.ps1 except AttributeError: sys.ps1 = '>>> ' try: sys.ps2 excep...