content
stringlengths
5
1.05M
""" Module: 'flowlib.simple' on M5 FlowUI v1.4.0-beta """ # MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11-284-g5d8e1c867 on 2019-08-30', machine='ESP32 module with ESP32') # Stubber: 1.3.1 - updated from typing import Any class MQTTClient: """""" def _clean_sock_buffer(self, *argv...
#!/usr/bin/env python # -*- coding: utf-8 -*- # ------------------------ # Penji OpDev Fall 2019 # Course Scraping Run Wrapper # Author: Cory Paik # Updated: # ------------------------ # General import os import argparse import importlib.util # Local from core.config import cfg from core.utils import setup_logger, loa...
# # Copyright The NOMAD Authors. # # This file is part of NOMAD. # See https://nomad-lab.eu for further info. # # 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/lic...
from flask import Flask, render_template, abort, redirect, url_for from flask_script import Manager from jinja2 import TemplateNotFound app = Flask(__name__) app.config['TESTING'] = True manager = Manager(app) @app.route('/', endpoint='frontend-index') def root(): # Redirect Base URL for the real Index Page. ...
# Give an output statement to write one line of a table # containing a product descrip­tion, quantity, unit price, # and total price in dollars and cents. You want the columns # to line up, like this: # Item Qty Price Total # Toaster 3 $29.95 $89.85 # Hair Dryer 19 $24.95 $24.95 # Car V...
upscale_factor = 2 dolphin_path = "~\\Documents\\Dolphin Emulator" extension_whitelist = ["png"] name_contains_blacklist = [ "672x736", "512x512", "352x256", "336x368", "256x256", "256x96", "176x128", "512x192" ] upscale_command = '{0}\\waifu2x\\waifu2x.exe -i "{1}" -o "{2}" -n 2 -s {3}' startup_message ...
"""Extractor to get messages from Pubsub""" #pylint: disable=super-on-old-class #pylint: disable=too-many-nested-blocks import time from gcloud.datastores.pubsub import PubsubSubscriber from etl_framework.config_mixins.FiltersMixin import FiltersMixin from etl_framework.Extractor import Extractor class PubsubExtrac...
class A: def f(self): pass # 比较存在/缺失type hinting条件下,重构函数f的效果。 # 注意,如果有另外一个库也用命名为f的函数,且没有添加type hinting,那么依然会被纳入重构范围。 # 不要忘记核对dynamic_references中是否纳入了错误的重构目标。 class B: def f(self): pass class C: # def __init__(self, a, b): def __init__(self, a: A, b: B): self.a = a ...
# -*- coding: utf-8 -*- __author__ = 'Arseniy' from model.group import Group import random def test_edit_first_group(app, db): if len(db.get_group_list()) == 0: app.group.create(Group(name="sdfsf")) old_groups = db.get_group_list() target_group = random.choice(old_groups) group = Group(name="t...
''' You are assigned to put some amount of boxes onto one truck. You are given a 2D array boxTypes, where boxTypes[i] = [numberOfBoxesi, numberOfUnitsPerBoxi]: - numberOfBoxesi is the number of boxes of type i. - numberOfUnitsPerBoxi is the number of units in each box of the typ...
import mysql.connector from database import login_info db = mysql.connector.Connect(**login_info) cursor = db.cursor() cursor.execute("SELECT id, name, family FROM animal") animals = cursor.fetchall() for animal in animals: id = animal[0] name = animal[1] family = animal[2] cursor.execute("SELECT COU...
""" Дни рождения Karkyshka 14.12 burik 12.09 Шулаева Оксана 27.09 Вартас 22.03 Мотыль 31.10 Эксайтёр 08.12 Рома slalus 11.08 Света Луковская 30.05 megalohobot 19.03 Макс Шаар 22.01 Пабз 06.01 Alexandr Gorodnichev 12.08 Дашин Милый 25.06 Прокол 01.06 Лера Бурмистрова 18.01 Dgoo0 12.06 Женя Пятак 12.01 ...
import numpy as np import pandas as pd def integral(df,data): integral = [0] for i in range(len(df.index) - 1): dt_ = df.time[i + 1] - df.time[i] integral_ = data[i] * dt_ integral_ += (data[i + 1] - data[i]) * dt_ / 2.0 integral.append(integral[i] + integral_) ...
import torch import torch.nn as nn import torch.nn.functional as F import sys import os from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) import copy import argparse from models.layers import * class Generator(nn.Module): def __init__(self, latent_dim, style_length=5, conte...
import matplotlib.pyplot as plt from scipy.signal import savgol_filter Dataset = "CIFAR100" # [8][3] titles = [ #0 ["Basic flip0.1", "Basic flip0.3", "Basic flip0.6"], #1 ["Basic unif0.1", "Basic unif0.3", "Basic unif0.60" ], #2 ['...
import pytest import _pickle as pickle import numpy as np from homog import hrot, htrans, axis_angle_of, axis_ang_cen_of from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor from worms import * import time from worms.tests import only_if_pyrosetta, only_if_pyrosetta_distributed from worms.util import ...
# Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights # reserved. Use of this source code is governed by a BSD-style license that # can be found in the LICENSE file from exec_util import exec_cmd import os import sys if sys.platform == 'win32': # Force use of the git version bundled with depot_to...
from __future__ import division import math import cell import geometry class Line(object): """ Representation of a line joining two points. """ def __init__(self, start, end): """ Initialize with start and end Cell objects. """ self.start = start self.end = end...
import argparse import os import sys import re import cv2 import pydicom as pyd import torch import torch.nn as nn import numpy as np from math import log10, sqrt from skimage.measure import compare_ssim parser = argparse.ArgumentParser() parser.add_argument("--checkpoint", type=str, required=True, help='path of chec...
from retrobiocat_web.app.biocatdb import bp from flask import flash, url_for, request, jsonify from flask_security import roles_required, current_user from retrobiocat_web.mongo.models.biocatdb_models import Sequence, Activity, Paper, EnzymeType from retrobiocat_web.app.app import user_datastore from retrobiocat_web.ap...
from pynq import GPIO # Pins dont exist in CPython so...lets make our own! class Pin: IN = 0 OUT = 1 LOW = 0 HIGH = 1 PULL_NONE = 0 PULL_UP = 1 PULL_DOWN = 2 id = None _value = LOW _mode = IN pynq_gpio = None def __init__(self, pin_id): self.id = pin_id d...
import torch from torch import nn import torch.nn.functional as F class ProjectionHeadAE(nn.Module): def __init__(self, input_dim=2048, hidden_dim=2048, output_dim=128): super(ProjectionHeadAE, self).__init__() self.projection_head = nn.Sequential( nn.Linear(input_dim, hidden_dim, bia...
# Generated by Django 3.0 on 2020-05-19 11:29 from django.db import migrations, models import django.db.models.deletion import systems.models.fields class Migration(migrations.Migration): dependencies = [ ('environment', '0002_auto_20190520_0649'), ('schedule', '0004_scheduledtask_user'), ] ...
import bpy, bmesh, math, random def console(data, level = "OUTPUT"): for window in bpy.context.window_manager.windows: screen = window.screen for area in screen.areas: if area.type == 'CONSOLE': override = {'window': window, 'screen': screen, 'area': area} ...
#! /usr/bin/env python from seleniumrequests import Chrome from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.chrome.options import Options import time import argparse MAX_POSTS = 5000 def run_delete(): parser = argparse.ArgumentParser() parser.add_argument("-E", ...
#pandas for dataframes read and write #numpy for around function used here import pandas as pd import numpy as np dataset=pd.read_csv("../input/titanic-dataset/train (1).csv") #the path here is according to Kernel in kaggle path . testset=pd.read_csv("../input/titanic-dataset/test.csv") trainedSurvived=dataset.iloc[:...
import pytest from ftw import testrunner, errors @pytest.fixture def modsec_logger_obj(): """ Modsec logger object to access in the verifier @TODO """ return None def test_modsecurityv2(modsec_logger_obj, ruleset, test, destaddr): """ Modsec specific test """ runner = testrunner.Te...
import os import pickle import click import numpy as np import pandas as pd @click.command("predict") @click.argument("input-dir") @click.argument("model-dir") @click.argument("output-dir") def predict(input_dir: str, model_dir: str, output_dir: str): data = pd.read_csv(os.path.join(input_dir, "data.csv"), index...
""" Unit-tests for the types module. """ import pandas as pd import numpy as np from . import PandasTestCase import doctest import unittest from texthero import _types """ Doctests. """ def load_tests(loader, tests, ignore): tests.addTests(doctest.DocTestSuite(_types)) return tests class TestTypes(Panda...
# Test04.py print('너의 이름은...') a=input() print("%s 님 어서와 여기는 처음이지" % a)
import numpy as np from sklearn.metrics.pairwise import cosine_similarity engsentenceembedding = open('','r') desentenceembedding = open('','r') # process sentence embedding file engsent = [] desent = [] for line in engsentenceembedding: word = '' vectorlist = [] for char in line: if ...
# Starting point for lab06, CMPSC 8, S18 import pytest # The following function is copied from a previous lab, both as an # example of how to check for type, and because it is generally useful def isList(x): """ check whether parameter is a list """ return "stub" # @@@ READ OVER THIS FUNCTION---T...
# -*- coding: utf-8 -*- """ aes128 encryption handler module. """ from cryptography.fernet import Fernet import pyrin.configuration.services as config_services from pyrin.security.encryption.decorators import encrypter from pyrin.security.encryption.handlers.base import SymmetricEncrypterBase @encrypter() class AE...
from django.apps import AppConfig class SortingalgorithmsConfig(AppConfig): name = 'sortingAlgorithms'
def my_func(): print("Hey I am in module.py")
categories = { 1:'amazon-devices', 2:'boost', 3:'appliances', 4:'mobile-apps', 5:'arts-crafts', 6:'audible', 7:'automotive', 8:'baby-products', 9:'beauty', 10:'books', 11:'music', 12:'photo', 13:'wireless', 14:'fashion', 15:'coins', 16:'pc', 17:'digital-educational-resources', 18:'electronics', 1...
from collections import Counter from typing import Dict, List def count_lanternfish(contents: List[str], days: int = 80) -> int: """Count number of lanternfish after certain days given initial population. Args: contents (List[str]): the file contents days (int, optional): number of days to co...
""" This configuration file contains data required for testing scientific pygaps functions on real or model data. In this file there are: - references to sample isotherm files """ from pathlib import Path DATA_PATH = Path(__file__).parent.parent.parent / 'docs' / 'examples' / 'data' DATA_IAST_PATH = DATA_PATH /...
""" Example of solving a Kaggle problem using schemaflow's API. This script performs an end-to-end analysis and prediction of the Kaggle exercise https://www.kaggle.com/c/house-prices-advanced-regression-techniques It demonstrates the advantages of explicitly declaring the types in the Pipe (using Schemaflow's API). ...
from django.contrib import admin from .models import Pessoa, Fisica, Juridica, Contato, Telefone admin.site.register(Pessoa) admin.site.register(Fisica) admin.site.register(Juridica) admin.site.register(Contato) admin.site.register(Telefone)
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) import os import unittest import gevent from ava.spi.defines import AVA_USER_XID, AVA_AGENT_SECRET from ava.runtime import settings from ava.core.agent import Agent class AgentTest(un...
import json import pyautogui with open('output.json') as json_file: data = json.load(json_file) # print(data) while True: for d in data: type = d['type'] args = d['args'] if type == "mouse_moveTo": x = int(args[0]) y = int(args[1])...
from flask import Blueprint, render_template, abort, request import numpy as np import json eos_routes = Blueprint('eos', __name__, template_folder='templates') @eos_routes.route('/eos') def eos(): return render_template('eos/eos.html') @eos_routes.route('/eos/t-s', methods=['GET', 'POST']) def ts(): if r...
#!/usr/bin/env python # coding:utf-8 import rospy import time from super_minitaur.msg import ImuMsg from super_minitaur.msg import LegControlMsg from super_minitaur.msg import FourLegCurrentMsg from super_minitaur.msg import FourLegPosMsg import numpy as np from settings import * from math import * class InitStand: ...
import numpy import cv2 def Crop(image, rectangle): """ Returns cropped image. Args: image: Bitmap rectangle: Rectangle Returns: Bitmap """ h, w, _ = image.shape x0 = max(min(w, rectangle[0]), 0) x1 = max(min(w, rectangle[2]), 0) y0 = max(min(h, rectangle[1...
import unittest import attr import lxml.etree from xmlunittest import XmlTestMixin from flask_saml2.idp.xml_templates import AssertionTemplate, ResponseTemplate from flask_saml2.signing import RsaSha1Signer, Sha1Digester, SignatureTemplate from flask_saml2.types import XmlNode from flask_saml2.utils import ( cert...
import numpy as np a3 = np.array([ [ [10, 11, 12], [13, 14, 15], [16, 17, 18] ], [ [20, 21, 22], [23, 24, 25], [26, 27, 28] ], [ [30, 31, 32], [33, 34, 35], [36, 37, 38] ] ...
#!/bin/python import listify_circuits listify_circuits.optimize_circuits(36, 'forward')
# -*- coding: utf-8 -*- """ Created on Mon Sep 13 20:54:20 2021 @author: levon """ import numpy as np from Moments import MomentSolver def UpdateLattice(mom,a): dB = [-.18236*a[1], .213640*a[3], -.18236*a[5]] qstart = [0.00425*a[0], 0.10655*a[2], 0.20895*a[4]] qend = [qstart[0]+0.01, qstart[1]+0.01, qst...
import pytest from unittest import mock from lxml import etree from share.harvesters.oai import OAIHarvester from tests import factories @pytest.mark.django_db class TestOAIHarvester: OAI_DC_RECORD = etree.fromstring(''' <record xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns...
#! /usr/bin/env python # GPTune Copyright (c) 2019, The Regents of the University of California, # through Lawrence Berkeley National Laboratory (subject to receipt of any # required approvals from the U.S.Dept. of Energy) and the University of # California, Berkeley. All rights reserved. # # If you have questions ab...
import unittest from .django.schema1 import schema class SchemaTest(unittest.TestCase): def setUp(self): self.schema_documentation = schema.get_documentation() def _search_schema(self, root=None, **criteria): if root is None: root = self.schema_documentation if isinstanc...
import tensorflow as tf import numpy as np from guide import get_critic,get_guide
import chainer import numpy as np # https://github.com/shelhamer/fcn.berkeleyvision.org/blob/master/surgery.py def _get_upsampling_filter(size): """Make a 2D bilinear kernel suitable for upsampling""" factor = (size + 1) // 2 if size % 2 == 1: center = factor - 1 else: center = factor ...
from typing import Dict from typing import List from typing import Union from pydantic import BaseModel class Post(BaseModel): id: int title: str content: str image: str class Config: orm_mode = True class JsonApiResponse(BaseModel): data: Union[Dict, List[Dict]] ok: bool = Tru...
import argparse import sys import os import errno import shutil import tensorflow as tf layers = tf.layers import numpy as np import horovod.tensorflow as hvd import socket FLAGS = None default_batchsize = 16 input_height = 480 input_width = 640 n_classes = 10 display_step = 1 filter_size = 3 depth_in = 3 depth_out1 ...
import os.path import tempfile import pytest import acdb def driver_easy_case(driver): driver.set('name', b'acdb') assert driver.get('name') == b'acdb' assert driver.all() == ['name'] driver.rm('name') with pytest.raises(Exception): driver.get('name') def emerge_easy_test(emerge): ...
#!/usr/bin/env python from setuptools import setup def readme(): with open('README.rst') as f: return f.read() setup(name='yahoo_fantasy_api', version='2.4.0', description='Python bindings to access the Yahoo! Fantasy APIs', long_description=readme(), url='http://github.com/spil...
# -*- coding: utf-8 -*- from sage.functions.other import floor from sage.matrix.constructor import Matrix from sage.rings.integer import Integer from sage.rings.rational_field import Q as QQ from sage.symbolic.relation import solve as _solve from sage.symbolic.ring import SR from .array3d import Array3D from .assoc_sch...
from django.db import models # create models here
from ...common_descs import * from .objs.tag import HekTag from supyr_struct.defs.tag_def import TagDef color = Struct("color", ascii_str32('name'), QStruct("color", INCLUDE=argb_float), SIZE=48, ) colo_body = Struct("tagdata", reflexive("colors", color, 512, DYN_NAME_PATH='.name'), ...
import unittest from pyalgs.algorithms.graphs.topological_sort import DepthFirstOrder from tests.algorithms.graphs.util import create_dag class DepthFirstOrderUnitTest(unittest.TestCase): def test_topological_sort(self): G = create_dag() topological_sort = DepthFirstOrder(G) print(' =>...
""" Plot histograms """ from numpy import array from numpy import dstack from numpy import unique from pandas import read_csv from matplotlib import pyplot # load a single file as a numpy array def load_file(filepath): dataframe = read_csv(filepath, header=None, delim_whitespace=True) return dataframe.values ...
import tensorflow as tf import os import glob import zipfile import time from datetime import datetime import wget import pathlib # need to be installed for program to run: # PIL is now Pillow # import PIL # import scipy # remove warning for cpu os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' ImageDataGenerator = tf.keras....
########################################################################## # # Copyright (c) 2017, Image Engine Design 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: # # * Redistrib...
"""Defines WebotsVehicle Class""" from coordinate_system import CoordinateSystem class WebotsVehicle(object): """WebotsVehicle class defines user configurable vehicle to use in Webots environment""" CITROEN_C_ZERO = 201 CITROEN_C_ZERO_SIMPLE = 202 TOYOTA_PRIUS = 203 TOYOTA_PRIUS_SIMPLE = ...
# Note - this code must run in Python 2.x and you must download # http://www.pythonlearn.com/code/BeautifulSoup.py # Into the same folder as this program import re import urllib from BeautifulSoup import * url = raw_input('Enter - ') c_input = raw_input('Enter count: ') p_input = raw_input('Enter position: ') if len(...
import pytest from unittest import mock from .utils import ( init_app, init_db, clean_db, add_flow, add_run, add_artifact, add_step, add_task, add_metadata, _test_list_resources, _test_single_resource ) pytestmark = [pytest.mark.integration_tests] # Fixtures begin @pytest.fixture def cli(loop, aiohtt...
from typing import TYPE_CHECKING import os import peewee from .constants import NAME_SQLITE, RequestState from .exceptions import StartupError if TYPE_CHECKING: from .application import ApplicationState database_proxy = peewee.DatabaseProxy() class BaseModel(peewee.Model): class Meta: database = ...
''' Extracts speech features and saves as spectrogram images I want to see if MFCC vs FBANK vs STFT work better/worse for 1) speech recognition 2) gender classification 3) handling noise Do a check to ensure no ids are in the same groups... (ie. mixing of data in labels) ''' import time import os, errno import p...
from yggdrasil.languages.Python.YggInterface import YggRpcClient def model_function(in_buf): # The global_scope keyword is required to ensure that the comm persists # between function calls rpc = YggRpcClient('server_client', global_scope=True) print("client(Python): %s" % in_buf) ret, result = rp...
#!/usr/bin/python import sys import subprocess import os import math import string from rnaseq_align_and_qc import * def make_track_file(sample_info_file, path_start, aligner): runs = get_sample_info(sample_info_file) outp = open(path_start+"ucsc_track_names.txt", "w") output_url = "http://public.himeslab.org/" ...
# Copyright 2021 AIPlan4EU project # # 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...
import sys import time import threading from twisted.internet import reactor sys.path.append('.') import marionette_tg.channel as channel class ServerThread(threading.Thread): def run(self): print 'Starting server...' self.channel_ = None while True: ch = channel.accept_new_...
from django.conf.urls import url,include from .views import CommentView,InfoView urlpatterns = [ url(r'^amazon/info/(?P<isbn13>\d+)/$',CommentView.as_view()), url(r'^amazon/comments/(?P<isbn13>\d+)/$',InfoView.as_view()), ]
#!/usr/bin/env python __author__ = ('Francesco Asnicar (f.asnicar@unitn.it), ' 'Francesco Beghini (francesco.beghini@unitn.it), ' 'Mattia Bolzan (mattia.bolzan@unitn.it), ' 'Nicola Segata (nicola.segata@unitn.it)') __version__ = '3.0.18' __date__ = '27 November 2020' import...
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. import _utilities from...
class TimeTrigger: def __init__(self, game, creation_time, duration, callback): self.game = game self.creation_time = creation_time self.duration = duration self.callback = callback def check(self): if (self.game.time - self.creation_time) < self.duration: se...
#!/usr/bin/python import mechanize import re from bs4 import BeautifulSoup import json import urllib from sys import exit from optparse import OptionParser import os from getpass import getpass import codecs import io # Options parsing constants OUTPUT_FILEPATH_VAR="output_filepath" NOTE_SORT_TYPE_VAR="note_sort_type...
""" @Project : DuReader @Module : word_index.py @Author : Deco [deco@cubee.com] @Created : 5/16/18 5:46 PM @Desc : """ from collections import Counter def word_index(): word2index = {} index2word = {} vocab = ['word', 'another'] # vocab = list({'word', 'another'}) for i, word in en...
#!/usr/bin/env python TEST_PROG = """ nop +0 acc +1 jmp +4 acc +3 jmp -3 acc -99 acc +1 jmp -4 acc +6 """ def parse_prog(lines): lines = lines.strip().split("\n") def parse_op(op, val): return (op, int(val)) prog = [parse_op(*line.strip().split()) for line in lines] return prog def run_mo...
# ██╗░░░░░██╗███╗░░██╗░██████╗░░░░██████╗░██╗░░░░░░█████╗░░█████╗░██╗░░██╗ # ██║░░░░░██║████╗░██║██╔════╝░░░░██╔══██╗██║░░░░░██╔══██╗██╔══██╗██║░██╔╝ # ██║░░░░░██║██╔██╗██║██║░░██╗░░░░██████╦╝██║░░░░░███████║██║░░╚═╝█████═╝░ # ██║░░░░░██║██║╚████║██║░░╚██╗░░░██╔══██╗██║░░░░░██╔══██║██║░░██╗██╔═██╗░ # ███████╗██║██...
from __future__ import unicode_literals import re from django.db import models # from fantasy import lineup, standings, team TEAM_URL = 'http://games.espn.go.com/ffl/clubhouse?leagueId={league}' \ '&teamId={team}&seasonId={season}' STANDINGS_URL = 'http://games.espn.go.com/ffl/standings?leagueId={league}' ...
# -*- coding: utf-8 -*- from setuptools import setup, find_packages with open('README.rst') as f: readme = f.read() with open('LICENSE') as f: license = f.read() setup( name='grammar_school', version='0.1.0', description='Hopefully a well-constructed Python package', long_descripton=readme, ...
import os import aiohttp from pyrogram import Client, filters from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, InlineQueryResultArticle, InputTextMessageContent from pyshorteners import Shortener BITLY_API = os.environ.get("BITLY_API", None) CUTTLY_API = os.environ.get("CUTTLY_API", None) SHORTC...
from django.conf.urls import url from posts import views # Create your views here. urlpatterns = [ #url(r'^$', # views.home, # name='blog_home' # ), # #url(r'^page/(?P<page>\d+)/{0,1}$', # views.home, # name='blog_home'), # url(r'^cat...
import sys sys.path.append("/home/ming/gittest/GraphGAN_数据半采样半SDNE/src/evaluation") from evalne.evaluation.evaluator import LPEvaluator from evalne.evaluation.split import EvalSplit from evalne.evaluation.score import Scoresheet from evalne.utils import preprocess as pp import scipy.io as scio import numpy as np def ...
from rest_framework import permissions from backend import models class IsKit(permissions.BasePermission): """ The user is a Kit. """ def has_object_permission(self, request, view, obj): return isinstance(request.user, models.Kit) class IsObjectRequested(permissions.BasePermission): """ ...
# -*- coding:utf-8 -*- ''' @Author: LiamTTT @Email: nirvanalautt@gmail.com @Project: TCTPreprocess @File: sampling.py @Date: 2021/9/17 @Time: 上午9:53 @Desc: sampling according to voc annotations xml file. ''' import cv2 import numpy as np def sampling(bnd, source, src_type): """ Sampling tile from source. The sou...
import nextapm.lib.logger as logger from nextapm.lib.util import validateConfig from nextapm.lib.constants import * import os import json import requests def sendData(data): if not validateConfig(): return if data is None or type(data) is not dict: logger.error('[sendData] empty data passed'...
##################################################################### # # # zlock.py # # # # Copyright 2013, Monash University ...
# Author: Roi Yehoshua # Date: July 2020 from collections import defaultdict class TDPrediction(): """Temporal difference prediction for estimating the state value function""" def __init__(self, env, policy, gamma, alpha, n_episodes, max_episode_len=None): """ :param env: an instance of gym env...
#!/usr/bin/env python # -*- coding: utf-8 -*- from openpyxl import utils import pandas as pd import requests import json """ # Purpose Convert source variable contained in str variable to destination variable. """ def util_replace(text, source, destination): # if text has source if text.find(s...
from django.apps import AppConfig class NoticeConfig(AppConfig): name = 'segmentfault.apps.notice'
# The MIT License (MIT) # # Copyright (c) 2017 Dean Miller for Adafruit Industries. # # 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 rig...
from collections import defaultdict from typing import Dict, List import networkx as nx import numpy as np from grams.algorithm.data_graph import CellNode from grams.algorithm.literal_match import TextParser from grams.algorithm.semantic_graph import SGColumnNode from grams.inputs.linked_table import LinkedTable from...
# -*- coding: utf-8 -*- # Copyright 2018 The Blueoil 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 # # Unles...
from setuptools import setup, find_packages setup( name='annuity_lib', packages = find_packages(), )
from .util import * def test_banchi(): write_item("\r\n".join([ '01106,"005 ","0050865","ホッカイドウ","サッポロシミナミク","トキワ(1-131バンチ)","北海道","札幌市南区","常盤(1〜131番地)",1,0,0,0,0,0', '01106,"005 ","0050840","ホッカイドウ","サッポロシミナミク","フジノ(400、400-2バンチ)","北海道","札幌市南区","藤野(400、400−2番地)",1,0,0,0,0,0', '011...
import os import sys from mock import Mock sys.modules['ROOT'] = Mock() from lobster.core.data import task class TestCommands(object): def test_expansion(self): cmd = ["foo", "@inputfiles", "--some-flag"] args = ["-a"] infiles = ["bar", "baz"] outfiles = [] result = ["f...