content stringlengths 5 1.05M |
|---|
"""Interface for drivers."""
import abc
from collections import namedtuple
from typing import Any
from mpf.core.platform import DriverConfig
PulseSettings = namedtuple("PulseSettings", ["power", "duration"])
HoldSettings = namedtuple("HoldSettings", ["power", "duration"])
# Python 3.7 supports a defaults arg in named... |
import os
import numpy as np
from functools import reduce
import random
DATASET_DIR='D:/dataset/cifar-10-batches-py'
TARGET_SAVE_DIR='D:/dataset/cifar-10-batches-py/prepDat'
TRAIN_TEST_RATIO=[0.8, 0.8, 0.5, 0.8, 0.5, 0.8, 0.8, 0.8, 0.8, 0.5]
CIFAR_MEAN=[125.3, 123.0, 113.9]
CIFAR_LABEL={0:"airplane", 1:"autom... |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
"""Unit test module for internationalization logic"""
from __future__ import unicode_literals # isort:skip
from flask import current_app
from flask_login import login_user
from portal.models.i18n import get_locale
from portal.models.user import User
from tests import TEST_USER_ID, TestCase
class TestI18n(TestCase):... |
#!/usr/bin/env python
# coding: utf-8
#############################################
# File Name: setup.py
# Author: whzcorcd
# Mail: whzcorcd@gmail.com
# Created Time: 2020-06-08
#############################################
from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_des... |
# MODE = 'django'
#
# SOURCE_VOCAB_SIZE = 2490 # 2492 # 5980
# TARGET_VOCAB_SIZE = 2101 # 2110 # 4830 #
# RULE_NUM = 222 # 228
# NODE_NUM = 96
#
# NODE_EMBED_DIM = 256
# EMBED_DIM = 128
# RULE_EMBED_DIM = 256
# QUERY_DIM = 256
# LSTM_STATE_DIM = 256
# DECODER_ATT_HIDDEN_DIM = 50
# POINTER_NET_HIDDEN_DIM = 50
#
# MAX_QU... |
from lxmert.lxmert.src.tasks import vqa_data
from lxmert.lxmert.src.modeling_frcnn import GeneralizedRCNN
import lxmert.lxmert.src.vqa_utils as utils
from lxmert.lxmert.src.processing_image import Preprocess
from transformers import LxmertTokenizer
from lxmert.lxmert.src.huggingface_lxmert import LxmertForQuestionAnswe... |
import torch
import torchvision
import torch.nn as nn
import torchvision.transforms as transforms
from torch.utils.data import DataLoader, random_split
from torch.autograd import Variable
import numpy as np
class CustomDataset:
def __init__(self,args,graph,vec):
self.args = args
self.data = ve... |
from django.http import HttpResponse
from django.core.mail import send_mail
from django.core.context_processors import csrf
from django.core.mail import send_mail
from django.conf import settings
from django.shortcuts import render_to_response, render
from django.template import loader,RequestContext
import xlab.settin... |
import argparse
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from os import listdir
from os.path import isfile, join
font = {'size' : 12}
matplotlib.rc('font', **font)
def get_args():
parser = argparse.ArgumentParser('python')
parser.add_ar... |
#<pycode_BC695(py_netnode)>
netnode.alt1st = netnode.altfirst
netnode.alt1st_idx8 = netnode.altfirst_idx8
netnode.altnxt = netnode.altnext
netnode.char1st = netnode.charfirst
netnode.char1st_idx8 = netnode.charfirst_idx8
netnode.charnxt = netnode.charnext
netnode.hash1st = netnode.hashfirst... |
# -*- coding: utf-8 -*-
""" Module for interfacing decomp++ with cmf (Versions of late Oct. 2009) """
from __future__ import division, print_function, absolute_import, unicode_literals
import decomp
import numpy as np
class CmfConnector(object):
"""Class for creating decomp++ instances for each layer in a cmf cel... |
from kuri_edu import PowerMonitor
import threading
import mobile_base_driver.msg
import fakerospy
import maytest
class TestPowerMonitor(maytest.TestBase):
def setUp(self):
super(TestPowerMonitor, self).setUp()
self.patch("kuri_edu.power_monitor.rospy", fakerospy)
self.power_pub = fake... |
import copy
import sys
sys.path.append("../URP")
from utils import *
from tqdm import tqdm
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from sklearn.svm import SVC
def parameter_count(model):
count=0
for p in model.parameters():
count+=np.prod(np.array(li... |
"""
Render slices through a volume, by uploading to a 2D texture.
Simple and ... slow.
"""
import imageio
from wgpu.gui.auto import WgpuCanvas, run
import pygfx as gfx
canvas = WgpuCanvas()
renderer = gfx.renderers.WgpuRenderer(canvas)
scene = gfx.Scene()
vol = imageio.volread("imageio:stent.npz").astype("float32")... |
import unittest
from test_text_aug import TestTextAug
from test_time_parser import TestTimeParser
from test_location_parser import TestLocationParser
from test_idiom_solitaire import TestIdiomSolitaire
from test_money_parser import TestMoneyParser
from test_time_extractor import TestTimeExtractor
from test_money_extr... |
from flask.ext.wtf.recaptcha import fields
from flask.ext.wtf.recaptcha import validators
from flask.ext.wtf.recaptcha import widgets
__all__ = fields.__all__ + validators.__all__ + widgets.__all__
|
import argparse
import torch
import torch.nn
import torchaudio
import numpy
import preprocess
import utils
from test import inference_an_input
from pathlib import Path
from mir_eval.separation import bss_eval_sources
def evaluate(model_paths: list[str], in_dir: str, n_fft: int, win_length: int,
hop_len... |
from django.db import connection
from django_elasticsearch_dsl import Index
class MultiTenantIndex(Index):
@property
def _name(self):
if connection.tenant.schema_name != 'public':
return '{}-{}'.format(connection.tenant.schema_name, self.__name)
return self.__name
@_name.sett... |
import re
import pandas as pd
import matplotlib.pyplot as plt
from .auto_set_dtypes import auto_set_dtypes
# from auto_set_dtypes import auto_set_dtypes # local only
def load_dataset(name, **kws):
'''
maybe cache in the future https://github.com/mwaskom/seaborn/blob/master/seaborn/utils.py
'''
if name... |
"""Class implementation for the rotation_around_point interface.
"""
from typing import Any
from typing import Dict
from apysc._animation.animation_rotation_around_point_interface import \
AnimationRotationAroundPointInterface
from apysc._type.dictionary import Dictionary
from apysc._type.int import Int
... |
from copy import deepcopy
import numpy as np
import operator
def find_keys(dictionary, sep="~", k=[]):
aux = {}
keys = dictionary.keys()
for key in keys:
k.append(key)
if isinstance(dictionary[key], dict):
aux.update(find_keys(dictionary[key], "~", k))
else:
i... |
from api.app import create_app, db
from api.models import User,user_schema, users_schema
from flask import request,redirect,jsonify
app = create_app()
@app.route("/api/v1/add", methods=['GET','POST'])
def create():
name = request.json["name"]
email = request.json["email"]
password = request.json["passwor... |
# -*- encoding=utf8 -*-
__author__ = "eeorunix"
import time
import random
from airtest.core.api import *
from airtest.aircv import *
from airtest.core.settings import Settings as ST
ST.CVSTRATEGY = ["tpl"]
ST.THRESHOLD = 0.8
ST.SAVE_IMAGE = False
ST.RESIZE_METHOD = None
DEBUG = 0
import logging
logger ... |
# -*- coding: utf-8 -*-
"""
CALFEM Editor Example
Written by Karl Eriksson
"""
import calfem.editor as cfe
import calfem.geometry as cfg
import calfem.mesh as cfm
import calfem.vis_mpl as cfv
import calfem.utils as cfu
import calfem.core as cfc
import numpy as np
# --- Creating a square geometry with two markers
g... |
import sys
import os
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import linregress
if __name__ == '__main__':
if __package__ is None:
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from scripts.data_handler import get_system
else:
f... |
'''
@说明 :草动用户接口。
@时间 :2020/2/13 下午4:28:26
@作者 :任秋锴
@版本 :1.0
'''
from typing import List
from .base import base
class user(base):
def __init__(self, token):
super().__init__(token)
def list(self,
storeIdKey=None, companyId=None, mobile=None,
pageNum=1, pageSize=1... |
from synapse.tests.common import *
import synapse.lib.scope as s_scope
class ScopeTest(SynTest):
def test_lib_scope(self):
syms = {'foo': 'woot', 'bar': 30, 'baz': [1, 2]}
scope = s_scope.Scope(**syms)
self.eq(scope.get('bar'), 30)
self.eq(scope.get('foo'), 'woot')
self.e... |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2010 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... |
# coding=utf-8
"""
wecube_plugins_itsdangerous.common
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
本模块提供系统通用包
""" |
from django.conf import settings
from django.conf.urls import url
from django.conf.urls.static import static
from . import views
urlpatterns = [
url(r'^$', views.page, name='index'),
url(r'^unlinked-pages/$', views.unlinked_pages, name='unlinked_pages'),
url(r'^schedule/$', views.schedule_view, name='sche... |
"""Slow-running tests for nightly continuous integration."""
from functools import partial # noqa: F401
import os
import ixmp
import message_ix
from message_ix.testing.nightly import (
download,
iter_scenarios,
)
import numpy as np # noqa: F401
import pytest
pytestmark = pytest.mark.skipif(
os.environ.... |
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from go_and_do_people_info.models import (Country, Event, Ministry, News,
Prayer, Ticket, UserProfile,
Volunteer)
from go_and_do_people_info.se... |
# Copyright (c) 2017 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 i... |
from mylib import RelationData
from pathlib import Path
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument("input", type=Path)
parser.add_argument("--tex", action="store_true")
parser.add_argument("--all", action="store_true")
args = parser.parse_args()
def get_stat(data):
stat_en... |
from pymongo import MongoClient
from pymongo.database import Database
import requests
import json
import schedule
import datetime
import os
from tweet import Tweet
from threading import Thread
now = datetime.datetime.now()
CUR_TIMESTAMP = int(datetime.datetime(year=now.year, month=now.month, day=now.day, hour=now.ho... |
import math
import sys
import xy
def load_paths(filename):
paths = []
with open(filename) as fp:
for line in fp:
points = filter(None, line.strip().split(';'))
if not points:
continue
path = [tuple(map(float, x.split(','))) for x in points]
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# tiapp parser
#
import os, types, uuid , fnmatch
import codecs, time, sys
from xml.dom.minidom import parseString
from StringIO import StringIO
def getText(nodelist):
rc = ""
for node in nodelist:
if node.nodeType == node.TEXT_NODE:
rc = rc + node.data
return r... |
#!/usr/bin/env python3
# step 1: import the redis-py client package
import redis
# step 2: define our connection information for Redis
# Replaces with your configuration information
redis_host = "0.0.0.0"
redis_port = 6379
redis_password = ""
def hello_redis():
"""Example Hello Redis Program"""
# step ... |
import sys
import math
with open(sys.argv[1]) as file:
lines = []
for line in file:
lines.append(line)
cordinates = []
for x in range(0, 3):
nums = lines[x].split()
cordinates.append(nums[0])
cordinates.append(nums[1])
cord1X = int(cordinates[0])
cord1Y = int(cordinates[1])
cord2X =... |
"""
This is an Azure Function that responds at GET /api/greeting.
Using the built-in authentication and authorization capabilities (sometimes
referred to as "Easy Auth") of Azure Functions, offloads part of the authentication
and authorization process by ensuring that every request to this Azure Function has
an ... |
TOKEN = open("token.txt", "r").read()
|
from top2vec import Top2Vec
import re
from bs4 import BeautifulSoup
from nltk.stem.wordnet import WordNetLemmatizer
import nltk
from wordcloud import WordCloud
nltk.download('wordnet')
global wnl
wnl = WordNetLemmatizer()
# list of custom stopwords
stopwords= set(['br', 'the', 'i', 'me', 'my', 'myself', 'we', 'our',... |
"""Test cases for base order's interface."""
import pytest
from quantfinpy.instrument.instrument import Instrument
from quantfinpy.order.limit import LimitOrder
from quantfinpy.order.order import Order, OrderSide
from quantfinpy.order.stop_limit import StopLimitOrder
@pytest.mark.parametrize(
["quantity", "expe... |
#
# ovirt-engine-setup -- ovirt engine setup
# Copyright (C) 2015 Red Hat, 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 r... |
from optparse import OptionParser
class InputError(Exception):
"""Exception raised for errors in the input.
Attributes:
expression -- input expression in which the error occurred
message -- explanation of the error
"""
def __init__(self, message):
self.message = message
def add_args_to_dict(... |
# Credit to:
# A. Hindle, N. Ernst, M. W. Godfrey, R. C. Holt, and J. Mylopoulos.
# Whats in a name? on the automated topic naming of software maintenance
# activities.
# https://github.com/ishepard/pydriller
# This program takes the names of repo directories as command line arguments
# and... |
#!/usr/bin/python
# Base imports for all integrations, only remove these at your own risk!
import json
import sys
import os
import time
import pandas as pd
from collections import OrderedDict
import requests
from integration_core import Integration
from IPython.core.magic import (Magics, magics_class, line_magic, cel... |
import battlecode as bc
import random
import sys
import traceback
class IStructure:
"""This is the IStructure interface"""
def __init__(self, gameControl, unitControl, unit, missionControl):
self.gameControl = gameControl
self.unitControl = unitControl
self.missionControl = mi... |
# 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 ... |
def super_root(number):
maximum = 10
minimum = 1
temp = (maximum+minimum)/2
while abs(temp**temp-number) > 0.001:
if temp**temp > number:
maximum = temp
else:
minimum = temp
temp = (maximum+minimum)/2
print(temp)
return temp
if __name__ == '__... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: modules/drivers/canbus/proto/can_card_parameter.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from goo... |
import pandas
import json
def process_entries(args, entries):
df = pandas.DataFrame(entries)
for groupby in args.groupby:
print(df.groupby(groupby)[args.metrics].mean())
print()
def main(args):
fname = args.subgoal_result_file
with open(fname, 'r') as f:
data = json.load(f)
... |
# *******************************************************************************
# Copyright 2017 Dell 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/L... |
checkpoint_config = dict(interval=1)
# yapf:disable
log_config = dict(
interval=50,
hooks=[
dict(type='TextLoggerHook'),
dict(type='TensorboardLoggerHook')
])
# yapf:enable
dist_params = dict(backend='nccl')
log_level = 'INFO'
load_from = 'pretrain/cascade_rcnn_x101_32x4d_fpn_1x_coco_202003... |
import os
import time
from datetime import datetime
from os.path import join
from pathlib import Path
from shutil import copy
import yaml
class LogManager:
def __init__(
self,
filename=None,
prefix=None,
base_folder=None,
base_filename=None,
... |
"""API documentation"""
from pathlib import Path
from typing import Dict
from yaml import load, SafeLoader
with open(Path(__file__).parent / 'resources' / 'openapi.yml', 'r') as apd_file:
api_docs = load(apd_file, Loader=SafeLoader)
def get_app_info() -> Dict[str, str]:
return {
k : v for k,v in ap... |
postagliste_en= {
"CC":"coordinating conjunction",
"CD":"cardinal digit",
"DT":"determiner",
"EX":"existential there (like: 'there is' ... think of it like 'there exists')",
"FW":"foreign word",
"IN":"preposition/subordinating conjunction",
"JJ":"adjective 'big'",
"JJR":"adjective, comparative 'bigger'",
"JJS":"adjecti... |
#!/usr/bin/env python
COPY_GOOGLE_DOC_KEY = '1RdyJt-k8cDntAuyBUwYa_MhwL9m4fwaoGcQ8nQPUPTc'
|
# Solution of;
# Project Euler Problem 430: Range flips
# https://projecteuler.net/problem=430
#
# N disks are placed in a row, indexed 1 to N from left to right. Each disk
# has a black side and white side. Initially all disks show their white side.
# At each turn, two, not necessarily distinct, integers A and B be... |
# -*- coding: utf-8 -*-
from io import open
from os.path import dirname, join
from shutil import rmtree
from unittest import TestCase
from nose.tools import eq_, assert_in, assert_not_in
from sphinx.cmdline import main as sphinx_main
from sphinx.util.osutil import cd
class Tests(TestCase):
"""Tests which require... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#Python的线程池实现
# https://blog.51cto.com/1238306/1742627
import queue
import threading
import sys
import time
import urllib
import subprocess
import os
#替我们工作的线程池中的线程
class MyThread(threading.Thread):
def __init__(self, workQueue, resultQueue, timeout=5, **kwargs):
... |
import logging
import sigopt
from distilbert_run_and_hpo_configurations.distilbert_squad_run_parameters import OptimizationRunParameters
from squad_fine_tuning.optimize_squad_distillation import OptimizeSquadDistillation
class RunsOptimizeSquadDistillation(OptimizeSquadDistillation):
def __init__(self, args_dict... |
from pbhhg_py.abstract_syntax import *
from pbhhg_py.utils import *
def build_tbl(proc_functional):
def _split(argv):
check_arity(argv, [1, 2])
argv = yield from map_strict(argv)
check_type(argv, String)
src, delimiter = (argv + [String('')])[:2]
if delimiter.value:
... |
import re
import pytest
from mimesis import Science
from mimesis.data.int.scientific import SI_PREFIXES, SI_PREFIXES_SYM
from mimesis.enums import MeasureUnit, MetricPrefixSign
from mimesis.exceptions import NonEnumerableError
from . import patterns
class TestScience:
@pytest.fixture
def science(self):
... |
# Generated by Django 2.2.16 on 2020-09-28 19:48
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('tracker', '0010_merge_20200926_1759'),
('tracker', '0012_merge_20200928_1510'),
]
operations = [
]
|
import unittest
from server import FlaskTestServerList
class FlaskTestServerListTestCase(unittest.TestCase):
def test_initialization(self):
server_list = FlaskTestServerList()
self.assertEqual(server_list.len(), 2)
d = {
"AWS": "95.69.98.253",
"GCP": "43.56.87.99"... |
# import threading
# from core.tools.DBTool import *
# from core.tools.RedisTool import *
# from core.const.Do import *
# from core.const.Protocol import *
# from runfunc.runGlobalVars import isCluster
# from runfunc.initial import *
# from allmodels.DubboInterface import DubboInterface
# from allmodels.DubboTestcase i... |
from datetime import datetime
from datetime import date
from django.db import models
from django.db.models import Avg
from django.db.models.fields.files import FileField
from itertools import chain
class User(models.Model):
username = models.CharField(max_length=255, unique=True, verbose_name="账号")
password = ... |
import json
from typing import Optional, Type, Tuple
import pygments.formatters
import pygments.lexer
import pygments.lexers
import pygments.style
import pygments.styles
import pygments.token
from pygments.formatters.terminal import TerminalFormatter
from pygments.formatters.terminal256 import Terminal256Formatter
fro... |
# class : AI for Remote Sensing
# prof. : Dr. Jungho Im (ersgis@unist.ac.kr)
# date : 7, March, 2018
# TA : Daehyeon Han (dhan@unist.ac.kr)
# objectives:
# 1. To load Tensorflow and learn how to use it.
# 2. To run Random Forest with your own retely sensed data in Python.
# Import libraries
import tens... |
# Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
|
#!/usr/bin/env python3
################################################################
# Setup Kestrel Jupyter Kernel
#
# This module setups the Kestrel Jupyter kernel:
# 1. install the kernel to Jupyter environment (local env)
# 2. generate codemirror mode for Kestrel based on the
# instal... |
from loadmodels import loaddiffi, loadlogit, arraydif, arraylogit, loadtheta, arraytheta
from data.dataManipulation import transpose
from data.ReadFile import openfiletest, openfile
from data.CreateCsvFile import create_csv
class main:
data = openfiletest()
# traspose data for diff
diff_data = tra... |
# MusicPlayer, https://github.com/albertz/music-player
# Copyright (c) 2012, Albert Zeyer, www.az2000.de
# All rights reserved.
# This code is under the 2-clause BSD license, see License.txt in the root directory of this project.
import sys, os
if sys.platform != "darwin":
print "GUI: your platform is probably not su... |
from unittest import TestCase
class ActionModelTests(TestCase):
pass
|
#!/usr/bin/env python
#
# Public Domain 2014-2016 MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as ... |
from Test import Test, Test as test
'''
Complete the solution so that it returns true if the first argument(string) passed in ends with the 2nd argument (also a string).
Examples:
solution('abc', 'bc') # returns true
solution('abc', 'd') # returns false
'''
def solution(string, ending):
return True if string[-l... |
#!/usr/bin/env python
from thrift_version import add_sys_path
add_sys_path(__file__)
import re
from interfaces import InterfacesService
from interfaces.ttypes import *
from interfaces.constants import *
from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrif... |
import logging
import azure.functions as func
from backlogapiprocessmodule import *
def main(req: func.HttpRequest) -> func.HttpResponse:
logging.info('-------Python HTTP trigger function processed a request.')
configFilePath = '/home/site/wwwroot/BacklogApiTimerTrigger/config.yml'
loggingConfigFi... |
'''jpredDataset.py
This class downloads the dataset used to train the secondary structure predictor.
It can be used as a reference dataset for machine learning applications.
This dataset includes the ScopID, sequence, DSSP secondary structure assignment,
and a flag that indicates if data point was part of the trainin... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2010 Mads Chr. Olesen <mchro@cs.aau.dk>
#This program is free software: you can redistribute it and/or modify it
#under the terms of the GNU General Public License version 3, as published
#by the Free Software Foundation.
#
#This program ... |
"""
Contains public website logic and assets.
"""
|
"""
PASSENGERS
"""
numPassengers = 22956
passenger_arriving = (
(4, 4, 4, 5, 5, 1, 2, 3, 0, 2, 1, 1, 0, 6, 10, 3, 7, 3, 8, 0, 4, 3, 2, 0, 0, 0), # 0
(6, 7, 9, 7, 5, 0, 2, 1, 2, 3, 1, 1, 0, 5, 8, 4, 2, 3, 4, 1, 3, 3, 2, 1, 1, 0), # 1
(10, 6, 11, 6, 6, 4, 5, 1, 3, 1, 2, 1, 0, 12, 3, 8, 2, 5, 3, 4, 3, 0, 2, 1, 0, ... |
from sqlalchemy import Column, Integer, String, Sequence, Boolean, ForeignKey
from app.models.base import *
class Returns(Base):
__tablename__ = 'returns'
id = Column(Integer, primary_key=True)
returned = Column(Boolean)
date = Column(String(255))
tool_condition = Column(String(33000), nullable=Fa... |
"""
Testing for the base all_in_bottom strategy class
"""
import pytest as pt
import pandas as pd
import lib.base_strategy as bs
from specific_strategies import all_in_bottom
from test_all_tests import get_test_data_path
def test_all_in_bottom_start_min():
"""
Test that having a min at the start returns expect... |
#!/usr/bin/env python
# Copyright 2017 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
import sys
def main(argv):
with open(argv[2], 'w') as f:
f.write(argv[1])
return 0
if __name__ == '__main__':
sy... |
import asyncio
import logging
import sys
from crawler.api import create_app
from crawler.config import Config
from structlog import get_logger
config = Config()
logging.basicConfig(
format="%(message)s", stream=sys.stdout, level=config.LOG_LEVEL.upper()
)
logger = get_logger()
logger.debug("config:", config=confi... |
import os
import re
from flaskr.models.file import createFile
from flaskr.models.word import createOrUpdateWord
class FileToDBService:
file_name = None
file_content = None
word_list = []
def setFileName(self, file_name):
self.file_name = file_name
def setFileContent(self, content):
... |
import keras.applications as kapp
from keras.preprocessing.image import ImageDataGenerator
import os
import data_tools as dt
import numpy as np
import keras.utils
from keras.models import Model
from keras.layers.core import Dense
from keras.layers import GlobalAveragePooling2D
from keras_retinanet.preprocessing.csv_g... |
import unittest
from checkov.terraform.checks.resource.aws.KinesisStreamEncryptionType import check
from checkov.common.models.enums import CheckResult
class TestKinesisStreamEncryptionType(unittest.TestCase):
def test_failure(self):
resource_conf = {
'name': ["terraform-kinesis-test"],
's... |
import cv2 as cv
import os
import numpy
import numpy as np
import torch
# uv = torch.tensor([[[345, 240], # 0
# [300, 225],
# [255, 195],
# [210, 180],
# [180, 180],
# [195, 255], # 5
# [120, 255],... |
import numpy as np
from advopt.target.search import cached
def test_compare():
from scipy.optimize import root_scalar
methods = ['bisect', 'brentq', 'brenth', 'ridder', 'toms748']
errors = dict([ (name, list()) for name in methods ])
n_iters = dict([(name, list()) for name in methods])
for _ in range(100)... |
from pyarrow import feather
import numpy as np
""" Safe Drugs Data Retrieval Library """
class file_connector:
"""
read data from filesystem
args:
datafile: path to feather-formatted file
"""
def __init__(self, datafile):
self.datafile = datafile
self.data = feather... |
# Copyright (c) 2021, NVIDIA CORPORATION. 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 appli... |
from flask import request, make_response, render_template
from flask import current_app as app, Response
from sqlalchemy import exc, func
from .models import db, \
SdStatement, \
Property, \
association_table
from flask_babel import _
import json
@app.route('/v1/sdstatement/create', methods=['GET'])
def c... |
from django.apps import AppConfig
class Djangox2Config(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'djangox2'
|
# Copyright 2020 Pulser 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 i... |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 28 11:23:26 2017
@author: rickdberg
Create maps
"""
import numpy as np
import matplotlib.pyplot as plt
import rasterio
import cartopy.crs as ccrs
import cartopy
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
from user_parameters import (st... |
# -*- coding: utf-8 -*-
# Model_deployment.py
# Alessio Burrello <alessio.burrello@unibo.it>
#
# Copyright (C) 2019-2020 University of Bologna
#
# 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 Li... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.