filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_0_13625
# 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. # --------------------------------------------------------------------...
the-stack_0_13626
import os from indico import IndicoClient, IndicoConfig # Will connect to https://app.indico.io client = IndicoClient() # Environment variables override defaults os.environ["INDICO_HOST"] = "foo.bar.com" # Will connect to https://foo.bar.com client = IndicoClient() # IndicoConfig will override environment variables...
the-stack_0_13627
#!/usr/bin/env python3 import common_test_lib import os import subprocess import argparse ####################################################################################### # edit test parameters into these lists to run different workloads ibof_root = os.path.dirname(os.path.abspath(__file__)) + "/../../../" #...
the-stack_0_13628
import gevent import io import logging import re from datetime import datetime from gevent import Greenlet, sleep from gtts import gTTS from .blob import blobs from .hashtag import HashtagModel from .twitter import get from .tweet import TweetModel logger = logging.getLogger('umahuesla') class Crawler(Greenlet): ...
the-stack_0_13629
import logging from ..redislist import RedisDropboxIndexList from .solrupdater import DropboxSolrUpdater log = logging.getLogger('dropbox') class DropboxIndexer: """ Read all Dropbox entries stored in Redis for a `bearertoken_id` and send them to Solr. Parameters: bearertoken_id -- a `models.Beare...
the-stack_0_13631
from math import sqrt import pytest import torch from torch_geometric.testing import withPackage from torch_geometric.utils import geodesic_distance @withPackage('gdist') @pytest.mark.skip(reason="No way of currently testing this") def test_geodesic_distance(): pos = torch.Tensor([[0, 0, 0], [2, 0, 0], [0, 2, 0...
the-stack_0_13635
# # voter business logic: put commits here # import config from model import Voter db = config.db import voter_dao import user def insert_voters_array(votation_id, ar): """returns number of inserted rows""" count = 0 for user_name in ar: u = user.load_user_by_username(user_name) if u: ...
the-stack_0_13636
import os, pathlib, PIL from tqdm import tqdm import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers from tensorflow.keras.models import Sequential from tensorflow.keras import Model from ResNet18 import ResNet18 from ResNet18V2 import ResNet18V2 from tensorflow.keras.applications....
the-stack_0_13637
########### # testing # ########### from exhibitionist.isubscriber import ISubscriber from exhibitionist.pubsubdispatch import PubSubDispatch import unittest import time import threading class IOLoopMock(object): def add_callback(self, callback): # import random # time.sleep(random.random()*0.05)...
the-stack_0_13638
with open('python.txt') as file_object: contents = file_object.read() print(contents.replace('python','java')) #use the replace() method to replace any word in astring with a different word. #print(contents) #Reading line by line. filename = 'python.txt' with open(filename) as object: for line in object: ...
the-stack_0_13639
import cv2 import numpy as np cap = cv2.VideoCapture('video.mp4') while(1): # Take each frame frame = cap.read() print(frame) # Convert BGR to HSV hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) print(hsv) # define range of blue color in HSV lower_blue = np.array([110, 50, 50]) upper...
the-stack_0_13640
from __future__ import with_statement, absolute_import import time from contextlib import closing import psycopg2 from . import print_row_progress, status_logger from .postgres_writer import PostgresWriter class PostgresDbWriter(PostgresWriter): """Class used to stream DDL and/or data from a MySQL server t...
the-stack_0_13642
# Copyright 2019 The Meson development 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 ...
the-stack_0_13643
#!/usr/bin/python # # Copyright 2019 Polyaxon, 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 required by applicable law o...
the-stack_0_13644
from rqt_gui_py.plugin import Plugin import python_qt_binding.QtGui as QtGui from python_qt_binding.QtGui import (QAction, QIcon, QMenu, QWidget, QPainter, QColor, QFont, QBrush, QPen, QMessageBox, QSizePolicy, ...
the-stack_0_13646
""" """ # Created on 2014.10.05 # # Author: Giovanni Cannata # # Copyright 2014 - 2019 Giovanni Cannata # # This file is part of ldap3. # # ldap3 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 ...
the-stack_0_13647
""" Copyright 2020 The OneFlow 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 law or agr...
the-stack_0_13648
import tensorflow as tf class MultiHeadSelfAttLayer(tf.keras.layers.Layer): def __init__(self, n_heads, input_size, hidd_size, level): super(MultiHeadSelfAttLayer, self).__init__() self.hidd_size = hidd_size self.n_heads = n_heads self.w_output = tf.get_variable(name='w_output', sh...
the-stack_0_13650
#!/usr/bin/env python3 # Copyright (c) 2014-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the fundrawtransaction RPC.""" from test_framework.test_framework import BitcoinTestFramework fro...
the-stack_0_13651
# Copyright (c) 2014 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.0 # # Unless required by applicable law or agreed to in...
the-stack_0_13653
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/gaogaotiantian/viztracer/blob/master/NOTICE.txt import viztracer import subprocess import os import time import sys import multiprocessing from viztracer import VizTracer, ignore_function from .cmdline_tmp...
the-stack_0_13654
import setuptools VERSION = '0.1' setuptools.setup( name='TTWeb', version=VERSION, description='Web framework for The Tale', long_description='Web framework for The Tale', url='https://github.com/Tiendil/the-tale', author='Aleksey Yeletsky <Tiendil>', author_email='a.eletsky@gmail.com', ...
the-stack_0_13655
# Self Driving Car # Importing the libraries import numpy as np from random import random, randint import matplotlib.pyplot as plt import time # Importing the Kivy packages from kivy.app import App from kivy.uix.widget import Widget from kivy.uix.button import Button from kivy.graphics import Color, Ellipse, Line fro...
the-stack_0_13656
#!/usr/bin/env python3 import json import os from os import path import sys import zipfile import hashlib import urllib.parse BLOCKSIZE = 65536 def sha256(file): hasher = hashlib.sha256() with open(file, 'rb') as afile: buf = afile.read(BLOCKSIZE) while len(buf) > 0: hasher.update...
the-stack_0_13657
import click import click_completion from .main import completion @completion.command() @click.option( "-i", "--case-insensitive/--no-case-insensitive", help="Case insensitive completion" ) @click.argument( "shell", required=False, type=click_completion.DocumentedChoice(click_completion.core.shells),...
the-stack_0_13658
from __future__ import print_function import tempfile import os import shutil from b3get.utils import tmp_location def test_has_tempdir(): assert tempfile.gettempdir() def test_create_tempdir(): assert tempfile.gettempdir() tdir = tempfile.mkdtemp() assert os.path.exists(tdir) print("\n", tdir)...
the-stack_0_13659
import matplotlib.pyplot as plt import numpy as np import os from PIL import Image os.makedirs("visual", exist_ok=True) def show_mnist(n=20): from tensorflow import keras (x, y), _ = keras.datasets.mnist.load_data() idx = np.random.randint(0, len(x), n) x, y = x[idx], y[idx] n_col = 5 n_row =...
the-stack_0_13661
# Copyright 2017 Rice University # # 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...
the-stack_0_13662
# -*- coding:utf-8 -*- import os import warnings import git import torch import torchvision.transforms as transforms import yolov2 import visdom from yolov2 import detection_loss_4_yolo from torchsummary.torchsummary import summary from utilities.dataloader import detection_collate from utilities.dataloader import V...
the-stack_0_13665
from __future__ import unicode_literals import tablib from django.test import TestCase from import_export import instance_loaders from import_export import resources from core.models import Book class CachedInstanceLoaderTest(TestCase): def setUp(self): self.resource = resources.modelresource_factory...
the-stack_0_13667
# Copyright 2018 Gregory Szorc <gregory.szorc@gmail.com> # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. from __future__ import absolute_import from .node import ( bin, hex, ) from .i18n import _ from .thirdparty import (...
the-stack_0_13668
# # findPath.py finds the optimal path, p # # create by: Samuel King # from . import getRandomData, field, timeCosts class Path ( field.Field ) : def __init__ ( self ) : super( Path, self ).__init__() self.__finalPathString = [] self.__finalPathCoords = [] self.__overallTimeCost = 0.0 self.__zLen = se...
the-stack_0_13669
# -*- 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 #...
the-stack_0_13671
#!/usr/bin/env python import unittest import socket from framework import VppTestCase, VppTestRunner from vpp_ip import DpoProto from vpp_ip_route import VppIpRoute, VppRoutePath from scapy.layers.l2 import Ether, Raw from scapy.layers.inet import IP, UDP, ICMP from scapy.layers.inet6 import IPv6 class TestMAP(Vpp...
the-stack_0_13672
#!/usr/bin/env python3 # -*- coding: utf-8 -* ''' 项目名称: JD-Script / 测试_test Author: Curtin 功能:邀请5人得60豆(每天最多10次600豆),被邀请完成开卡30豆,一次性任务。ck1助力Author,其他助力ck1 Date: 2021/11/14 下午6:21 TG交流 https://t.me/topstyle996 TG频道 https://t.me/TopStyle2021 cron: 30 6,12,15,20 11-17 11 * new Env('品牌联合开卡 11.11-11.17'); 活动入口:16:/#A5eHpAAyC1...
the-stack_0_13673
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('course', '0016_flowpagevisitgrade_graded_at_git_commit_sha'), ] operations = [ migrations.AddField( model_name='...
the-stack_0_13675
from django.shortcuts import render,HttpResponse from urllib import parse from apps.test_case.services.HTTP_test_caseService import HTTP_test_caseService from apps.test_case.services.HTTP_test_case_stepService import HTTP_test_case_stepService from apps.interface.services.HTTP_interfaceService import HTTP_interfaceServ...
the-stack_0_13676
import unittest from formation import AppBuilder from formation.tests.support import get_resource class CanvasTestCase(unittest.TestCase): builder = None @classmethod def setUpClass(cls) -> None: cls.builder = AppBuilder(path=get_resource("canvas.xml")) cls.canvas1 = cls.builder.canvas1 ...
the-stack_0_13677
import numpy as np from cmath import sqrt import qutip as qt from operators import * tol = 1e-16 def solvePoly(vec): roots = np.empty(2, dtype=np.complex128) vec[1]=2*vec[1] if abs(vec[0]) <= tol: roots[0] = np.inf if abs(vec[1]) <= tol: roots[1] = np.inf ...
the-stack_0_13680
# -*- coding: utf-8 -*- import glob import os import codecs import math from collections import Counter, defaultdict from itertools import chain, cycle import torch import torchtext.data from torchtext.data import Field from torchtext.vocab import Vocab from onmt.inputters.text_dataset import text_fields, TextMultiF...
the-stack_0_13681
# This is the MIT license: http://www.opensource.org/licenses/mit-license.php # # Copyright (c) 2005-2012 the SQLAlchemy authors and contributors <see AUTHORS file>. # SQLAlchemy is a trademark of Michael Bayer. # # Permission is hereby granted, free of charge, to any person obtaining a copy of this # software and asso...
the-stack_0_13682
from NIENV import * # API METHODS -------------- # self.main_widget # self.update_shape() # Ports # self.input(index) # self.set_output_val(index, val) # self.exec_output(index) # self.create_new_input(type_, label, widget_name=None, widget_pos='under', pos=-1) # self.delete_input(index) # self.create_new_output(t...
the-stack_0_13683
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np class GRUCell(nn.Module): def __init__(self, input_size, hidden_size): super(GRUCell, self).__init__() self.hidden_size = hidden_size # Layers ...
the-stack_0_13685
from __future__ import absolute_import, division, print_function, unicode_literals import numpy as np import pandas as pd from sklearn.model_selection import KFold from tqdm.notebook import tqdm from helpers import count_unique_words, count_unique_ngrams, \ build_unique_ngrams, create_sentence_vectors, c...
the-stack_0_13687
from typing import Callable from urllib.parse import urlunsplit from .typing import ASGIFramework from .utils import invoke_asgi class HTTPToHTTPSRedirectMiddleware: def __init__(self, app: ASGIFramework, host: str) -> None: self.app = app self.host = host async def __call__(self, scope: dic...
the-stack_0_13691
import sys import logging import json from collections import OrderedDict from redash import settings logger = logging.getLogger(__name__) __all__ = [ 'BaseQueryRunner', 'InterruptException', 'BaseSQLQueryRunner', 'TYPE_DATETIME', 'TYPE_BOOLEAN', 'TYPE_INTEGER', 'TYPE_STRING', 'TYPE_D...
the-stack_0_13692
import summarizer as nlp import csv from sklearn.preprocessing import OneHotEncoder import numpy as np from collections import defaultdict, Counter import math from myfile import * from googletrans import Translator # turns .tsv file into list of lists def tsv2mat(fname) : with open(fname) as f: wss = csv.rea...
the-stack_0_13693
############################################################################### # # Tests for XlsxWriter. # # SPDX-License-Identifier: BSD-2-Clause # Copyright (c), 2013-2021, John McNamara, jmcnamara@cpan.org # from ..excel_comparison_test import ExcelComparisonTest from ...workbook import Workbook class TestCompar...
the-stack_0_13694
from typing import Any, List import warnings import numpy as np from pandas._config import get_option from pandas._libs import index as libindex from pandas._libs.hashtable import duplicated_int64 from pandas._typing import AnyArrayLike from pandas.util._decorators import Appender, cache_readonly from pandas.core.d...
the-stack_0_13696
#!/usr/bin/python """ PN-CLI vrouter-bgp-add/vrouter-bgp-remove/vrouter-bgp-modify """ # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Lice...
the-stack_0_13697
import tensorflow as tf from select_threshold_op import SelectThreshold import numpy as np import time # SelectThreshold(x, pl, rowsplits, threshold=0.5) nvert=10000 nfeat=128 xs = tf.constant(np.random.rand(nvert) ,dtype='float32') xs = tf.reshape(xs, [-1,1]) rs = tf.constant([0,int(nvert/4),int(nvert/2),nvert],d...
the-stack_0_13698
#!/usr/bin/env python3 # Copyright (c) 2015-2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test node responses to invalid blocks. In this test we connect to one node over p2p, and test block re...
the-stack_0_13701
from django.conf.urls import url from . import views app_name = 'prospecting' urlpatterns = [ # ex: /prospecting/ url(r'^$', views.IndexView.as_view(), name='index'), # ex: /prospecting/5/ url(r'^(?P<pk>[0-9]+)/$', views.DetailView.as_view(), name='detail'), # ex: /prospecting/5/results/ url(r...
the-stack_0_13702
from NekoGram import Neko, Bot import pytest neko = Neko(bot=Bot(token='0:0', validate_token=False), validate_text_names=False) @pytest.mark.asyncio async def test_build_response(): raw_json = '{"x": {"text": "hello"} }' neko.add_texts(texts=raw_json, lang='en') data = await neko.build_text(text='x', use...
the-stack_0_13705
import torch import torch.nn as nn from torch.nn import init from torchvision import models from torch.autograd import Variable import pretrainedmodels from ghost_net import ghost_net from torchreid.models import resnet ###################################################################### def weights_init_kaiming(m):...
the-stack_0_13706
# Copyright 2013 Nebula 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 required by applicable law or agreed to...
the-stack_0_13708
import re import sys RE = re.compile(r'-?\d+') ingredients = [] for line in open(sys.argv[1]).readlines(): ingredients.append([int(v) for v in RE.findall(line)]) def score(amounts): negative = False product = 1 for i in range(len(ingredients[0])-1): iscore = sum([amounts[j]*ingredients[j][i] ...
the-stack_0_13710
from django.http import HttpResponse from django.test import RequestFactory, TestCase from test.utils import encode_jwt class TestDecorators(TestCase): def setUp(self): self.factory = RequestFactory() self.private_key = b"""-----BEGIN RSA PRIVATE KEY----- MIICWwIBAAKBgQDdlatRjRjogo3WojgGHFHYLugd...
the-stack_0_13712
import pickle import sys, os.path parent_dir = os.path.dirname(os.path.dirname(__file__)) sys.path.insert(0, parent_dir) from blinker._utilities import symbol def test_symbols(): foo = symbol('foo') assert foo.name == 'foo' assert foo is symbol('foo') bar = symbol('bar') assert foo is not bar ...
the-stack_0_13714
from collections import defaultdict from typing import List import config def number_game(numbers: List[str], max_turns: int = 2020) -> int: """Simulate the number game. Args: numbers (List[str]): starting numbers for the game Returns: int: the 2020th number spoken """ last_tur...
the-stack_0_13716
""" Utils function. """ import sys import os import logging from glob import glob def add_pyspark_path_if_needed(): """Add PySpark to the library path based on the value of SPARK_HOME if pyspark is not already in our path""" try: from pyspark import context except ImportError: # We ne...
the-stack_0_13717
from django.urls import path from . import views urlpatterns = [ path('home',views.index,name="index"), path('',views.landing,name="landing"), path('register',views.register,name="register"), path('logout',views.logout,name="logout"), path('profile/edit', views.profile, name="profile"), path('pr...
the-stack_0_13719
# coding=utf-8 import datetime import os import gym import numpy import matplotlib.pyplot as plt import pandas from dateutil import relativedelta from gym import spaces class FxEnv(gym.Env): metadata = {'render.modes': ['human', 'ohlc_array']} def __init__(self): # 定数 self.STAY = 0 s...
the-stack_0_13720
#!/usr/bin/env python # -*- coding: utf-8 -*- """The setup script.""" from setuptools import setup, find_packages import tushare_easy with open('README.rst') as readme_file: readme = readme_file.read() with open('HISTORY.rst') as history_file: history = history_file.read() requirements = [ 'arrow', ...
the-stack_0_13722
# Copyright (c) OpenMMLab. All rights reserved. from .class_names import (cityscapes_classes, coco_classes, dataset_aliases, get_classes, imagenet_det_classes, imagenet_vid_classes, voc_classes, person_classes, triage_classes) from .eval_hook...
the-stack_0_13723
# ****************************************************************************** # Copyright 2017-2019 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.apa...
the-stack_0_13725
from core.redis import rds from core.triage import Triage from core.parser import ScanParser class Rule: def __init__(self): self.rule = 'CFG_ZEGE' self.rule_severity = 2 self.rule_description = 'This rule checks for accessible Open API (Swagger) Documentation' self.rule_confirm = 'Remote Server is ...
the-stack_0_13727
""" Copyright (c) 2018-2020 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.0 Unless required by applicable law or agreed to in wri...
the-stack_0_13728
# MIT License # # Copyright (c) 2020 Yu Zhang # # 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, pub...
the-stack_0_13730
"""Builds the Unlimited Hand - sensor values network. (made from MNIST) Implements the inference/loss/training pattern for model building. 1. inference() - Builds the model as far as is required for running the network forward to make predictions. 2. loss() - Adds to the inference model the layers required to generat...
the-stack_0_13731
""" Given a string, calculate its length """ # Iterative approach def iterative_length(string): length = 0 for i in string: length += 1 return length print(iterative_length('hello worLd')) # Recursive approach def recursive_length(string): if string == "": return 0 return 1 + recursive_length(string[1:...
the-stack_0_13732
import os from utils.face_proc import FaceProc import argparse import pickle from forensic_test import exam_img, exam_video def main(args): all_paths = os.listdir(args.input_dir) proba_list = [] # initiate face process class, used to detect face and extract landmarks face_inst = FaceProc() # ini...
the-stack_0_13734
# Cave factory produces a cave-like structure with no disconnected # rooms. Caves typically have a smooth, twisty appearance with lots of # alcoves. This is based largely on the cellular automata examples at: # # http://roguebasin.roguelikedevelopment.org # # It also borrows code for joining disconnected cells from Da...
the-stack_0_13735
#!/usr/bin/env python # coding=utf-8 # Copyright 2020 The HuggingFace 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-...
the-stack_0_13738
import torch import torch.nn as nn class Generator(nn.Module): def __init__(self, channels_noise, features_g=64): super(Generator, self).__init__() self.gen = nn.Sequential( # Input: N x channels_noise x 1 x 1 self._block(channels_noise, features_g * 16, 4, 1, 0), # img: 4...
the-stack_0_13740
from typing import Any from eth_utils import ( encode_hex, is_bytes, is_integer, ) from eth_utils.toolz import curry from eth_keys.constants import ( SECPK1_N, ) from eth_keys.exceptions import ( ValidationError, ) def validate_integer(value: Any) -> None: if not is_integer(value) or isinsta...
the-stack_0_13741
""" Plugin to extract tables from an invoice. """ import re import logging logger = logging.getLogger(__name__) DEFAULT_OPTIONS = {'field_separator': r'\s+', 'line_separator': r'\n'} def extract(self, content, output): """Try to extract tables from an invoice""" for table in self['tables']: # Fir...
the-stack_0_13742
#!/usr/bin/env python # Copyright 2014-2020 The PySCF Developers. 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 # # U...
the-stack_0_13746
# -*- coding: utf-8 -*- from couchbase_helper.documentgenerator import doc_generator from failover.AutoFailoverBaseTest import AutoFailoverBaseTest from custom_exceptions.exception import RebalanceFailedException, \ ServerUnavailableException from membase.api.rest_client import RestConnection class MultiNodeAutoF...
the-stack_0_13748
#!/usr/bin/env python from setuptools import ( setup, find_packages, ) extras_require = { 'test': [ 'cryptography', 'pytest-cov', 'pytest-django', 'pytest-xdist', 'pytest', 'tox', ], 'lint': [ 'flake8', 'pep8', 'isort', ], ...
the-stack_0_13750
import unittest import provider.s3lib as s3lib import tests.settings_mock as settings_mock from mock import mock, patch, MagicMock from ddt import ddt, data, unpack from boto.s3.key import Key from boto.s3.prefix import Prefix class FakeKey(Key): def __init__(self, name): self.name = name class FakePrefi...
the-stack_0_13752
# Copyright 2013 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 required by applicable law or ...
the-stack_0_13754
import math import numpy as np def vec3(x, y, z): return np.array([x, y, z], dtype=np.float32) def radians(v): return np.radians(v) def identity(): return np.identity(4, dtype=np.float32) def empty(): return np.zeros([4, 4], dtype=np.float32) def magnitude(v): return np.linalg.norm(v) def norm...
the-stack_0_13755
import re import subprocess import threading import time # from time import time from config import * from utils import * def pat(test_data_in, class_path, jar, prt=False): inputfile = open(test_data_in).readlines() # print("@@@", test_data_in) basetime, maxtime = datacheck(test_data_in) # input = pa...
the-stack_0_13756
import numpy as np import Augmentor from PIL import Image class DatasetAugmentor(): def __init__(self, dataset_config=None, additional_augmentor_obj=None ): self.p = Augmentor.Pipeline() if dataset_config is not None and 'pipeline' in dataset_config: f...
the-stack_0_13757
from functools import partial import numpy as np import torch import torch.nn as nn from torchvision import transforms from src.modules.distributions import dmol_loss, sample_from_dmol, log_normal_diag # ----- NN Model Seleciton ----- from .image_networks.densenet16x32 import q_u, p_z, q_z, p_y, p_x from ...utils.u...
the-stack_0_13759
from mollie.api.objects.refund import Refund from .utils import assert_list_object PROFILE_ID = "pfl_v9hTwCvYqw" def test_get_profile_refunds_by_profile_id(client, response): """Get refunds relevant to profile by profile id.""" response.get(f"https://api.mollie.com/v2/refunds?profileId={PROFILE_ID}", "refun...
the-stack_0_13760
import sys import time import subprocess def check_for_libportaudio2(): if sys.platform == 'linux': try: output = subprocess.run(['apt', 'list', '--installed', 'libportaudio2'], stdout=subprocess.PIPE, ...
the-stack_0_13762
class RadialDistortion(): """ Mix-in for sensors that use a radial distortion model. """ @property def usgscsm_distortion_model(self): """ Expects odtk to be defined. This should be a list containing the radial distortion coefficients Returns ------- ...
the-stack_0_13765
import os import struct import numpy as np """ Loosely inspired by http://abel.ee.ucla.edu/cvxopt/_downloads/mnist.py which is GPL licensed. """ def read(dataset = "training", path = "."): """ Python function for importing the MNIST data set. It returns an iterator of 2-tuples with the first element bein...
the-stack_0_13767
#!/usr/bin/env python3 # # Copyright (c) 2013-2022, Intel Corporation # 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...
the-stack_0_13771
#!/usr/bin/env python # Copyright 2015 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 required ...
the-stack_0_13775
import setuptools with open("README.md", "r") as f: long_description = f.read() with open("requirements.txt") as f: requires = f.read().splitlines() setuptools.setup( name="ondewo-client-utils", version="0.1.0", author="Ondewo GbmH", author_email="info@ondewo.com", description="This libra...
the-stack_0_13776
""" TODO: Implement a test that proves file configs override rather than overwrite the defaults. Unfortunately this functionality will have to be implemented first. """ import os from unittest import mock import pytest import requests from pianodb.pianodb import (number_of_workers, gen_dummy_cmd, get_con...
the-stack_0_13777
from cms.api import create_page from djangocms_helper.base_test import BaseTestCase from djangocms_reversion2.models import PageVersion from djangocms_reversion2.utils import revert_page from . import testutils class PageRevisionCreateTestCase(BaseTestCase): def test_a_revise_page(self): language = 'en...
the-stack_0_13779
import os import numpy as onp from numpy.testing import assert_allclose import pytest from jax import jit, pmap, random, vmap from jax.lib import xla_bridge import jax.numpy as np from jax.scipy.special import logit import numpyro import numpyro.distributions as dist from numpyro.distributions import constraints fro...
the-stack_0_13780
from torch.nn import LSTM, Linear, BatchNorm1d, Parameter import torch import torch.nn as nn import torch.nn.functional as F import numpy as np class NoOp(nn.Module): def __init__(self): super().__init__() def forward(self, x): return x class STFT(nn.Module): def __init__( self,...
the-stack_0_13781
EMBED_SIZE = 200 NUM_LAYERS = 2 LR = 0.0001 MAX_GRAD_NORM = 5.0 PAD_ID = 0 UNK_ID = 1 START_ID = 2 EOS_ID = 3 CONV_SIZE = 3 # sanity # BUCKETS = [(55, 50)] # BATCH_SIZE = 10 # NUM_EPOCHS = 50 # NUM_SAMPLES = 498 # HIDDEN_SIZE = 400 # test BUCKETS = [(30, 30), (55, 50)] BATCH_SIZE = 20 NUM_EPOCHS = 3 NUM_SAMPLES = ...
the-stack_0_13783
# module from __future__ import print_function import argparse from tqdm import tqdm import torch import torch.nn.functional as F from torchvision import datasets, transforms from torchvision.utils import save_image import time import torch.nn as nn from SSGE import Attack,resnet18 import torchvision from attack impor...
the-stack_0_13787
# Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import contextlib from telemetry import decorators from telemetry import page as page_module from telemetry import story from telemetry.page import cache_te...