text
stringlengths
38
1.54M
#============================================================================== # ou_simulation_1D is used for # inputs # x0:initial state for OU # n = length of sampling period # step = aggregation period # a = drift of OU # sigma = diffusion constant of OU # outputs # obs = aggregated observations (using trapezoid...
from django.db import models # Create your models here. class Students(models.Model): name=models.CharField(max_length=30) age=models.IntegerField() email=models.EmailField() def __str__(self): return self.name class Meta: db_table='student'
""" Neurons represent connections and states. A rudimentary encoding algorithm has been created for visualization purposes. """ class Neuron(object): def __init__(self, state=0): self.state = state self.connections = [] self.parents = [] @staticmethod def crush(neurons): ...
''' Datafeeder 2018-07-06 TODO: [] Fix batch length difference [] Add batch to output file w/ speaker info ref: - https://www.github.com/kyubyong/deepvoice3 ''' import ipdb as pdb import os import glob import random import numpy as np import tensorflow as tf import pandas as pd import textgrid from tqdm import tqdm ...
# Copyright (c) 2017 XLAB d.o.o. # # 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...
#A simple transliteration from DMG p.122ff #d% = [monster,number of,type of,fraction change for treasure,level modifier for treasure] level_1 = { 4: ["centipede (medium)","d3","critter",0.2,0], 9: ["dire rat","d3+1","critter",0.2,0], 14: ["fire beetle (giant)","d3+1","critter",0.2,0], 17: ["scorpion (sm...
from __future__ import division from DPLocalSolver import DFS_Rec_for_Non_Monotone_General from util import * import os import copy import IPython import time import random import numpy as np from random import sample from collections import OrderedDict import Polygon as pn from random import uniform, random from iter...
a = [1,2,3,2] k = 5 from collections import deque def maxLength(a, k): q = deque() m = 0 s = 0 for i in a: q.append(i) s += i if s <= k: m = max(m, len(q)) else: s -= q.popleft() return m print maxLength(a, k)
import hashlib import json import os from pathlib import Path import pickle import shutil import subprocess import uuid from enum import IntEnum from django.apps import apps from django.conf import settings from django.core.exceptions import ValidationError from django.core.mail import send_mail from django.db import...
# !/usr/bin/env python3.7 # encoding: utf-8 # site:D:\users\lenovo\PycharmProjects\untitled # Time : 2019/4/24 16:04 # Author : 御承扬 # e-mail:2923616405@qq.com # site: # File : ID3_code.py # @oftware: PyCharm import math import operator def createDataSet(): # outlook: 0 rain 1 overcast 2 sunny # tem: ...
#!bin/usr/env python import numpy as np import matplotlib.pyplot as plt """ Reads 2 column data file with each column formated as "-----[dat1]-------[dat2]" where dashes are whitespace and [dat1] and [dat2] are the columns, each containing """ def readDat(f): """ Reads file and converts two column data into...
import time, datetime, vk_api, os def main(): token = os.environ.get('token') vk_session = vk_api.VkApi(token=str(token)) try: def countdown(stop): while True: difference = stop - datetime.datetime.now() count_hours, rem = divmod(difference.seconds, 3600...
keywords = ["giant", "norco", "jamis", "trek", "\bgt\b", "specialized", "liv", "cannondale", "marin"] url = '''https://www.kijiji.ca/b-markham-york-region/bikes/k0l1700274?ll=43.879401%2C-79.414110&address=23+Farmstead+Rd%2C+Richmond+Hill%2C+ON+L4S+1V8%2C+Canada&radius=50.0&dc=true'''
# Generated by Django 2.0.7 on 2019-01-15 15:13 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('main', '0018_auto_20190104_1113'), ] operations = [ migrations.RenameField( model_name='caseresult', old_name='result_status...
import tensorflow as tf import numpy as np from tensorflow import keras as K if __name__ == "__main__": a = np.array([[1, 1, 1, 1], [2, 2, 2, 2], [3, 3, 3, 3]]) b = np.array([[[1], [1], [1], [1]], [[2], [2], [2], [2]], [[3], [3], [3], [3]]]) aa = tf.Variable(initial_value=a) bb = tf.Variable(initial_v...
#====MAXIMUM PATH SUM BETWEEN TWO LEAF NODES LOGIC==== # If node is None then don't do anything just return # if node is a leaf node then return its data # if node is not a leaf then update the max sum and return max(l,r)+node.data # IMPORTANT: since we are passing a list(or array) to the function, the list is upda...
import torch import torchvision.models as models import numpy as np from tqdm import tqdm import matplotlib.pylab as plt from insilico_Exp_torch import TorchScorer from grad_RF_estim import grad_RF_estimate, gradmap2RF_square from GAN_utils import upconvGAN from ZO_HessAware_Optimizers import CholeskyCMAES from layer_h...
class Node: def __init__(self, data): self.left = None self.right = None self.data = data def isSymmetricSubTree(left,right): if left is None and right is None: return True if left is not None and right is not None: return left.data == right.data and \ ...
class Time(object): def __str__(self): #So we don't print time as 10:7 instead of 10:07 if self.minute < 10: return str(int(self.hour)) + ":" + "0" + str(int(self.minute)) return str(int(self.hour)) + ":" + str(int(self.minute)) def __init__(self, hour, minute): ...
''' This script creates a heat map in form of a latex table which visualizes an alignment matrix in csv format ''' import argparse import operator import sys parser = argparse.ArgumentParser(description='Reads an alignment matrix from stdin ' 'and creates latex code which displays it as he...
import emoji import random from functions import * class Commands: def __init__(self, bot, db): self.bot = bot self.db = db self.commands = { "start": self.start, "menu": self.menu } self.cache = { #states # last_seen } s...
# given a pile of cards represented as array of integers (points) # two players take turn to draw 1 to 3 cards from the left end # returns the highest score of either player def max_score(points): """ start from the base case when there're <= 3 cards (iterate from right to left) dp[i]: how much the current...
import psycopg2 class HorseDatabase(): def __init__(self): self.conn = None def connect(self, host="localhost", dbname="", user="", password=""): self.conn = psycopg2.connect("host={} dbname={} user={} password={}".format(host, dbname, user, password)) def get_conn(self): return s...
from ckeditor.widgets import CKEditorWidget from ckeditor.fields import RichTextField from django.core.mail import send_mail from django import forms from django.contrib.auth.models import User from django.forms import ModelForm from job.models import Job, Employee, Applicant, ApplicationTime, Messages, UsersMessage fr...
class cached_property(object): """ Decorate a class method to turn it into a cached, read-only property. Works by dynamically adding a value member that overrides the get method. **Warning:** Only works for read-only properties! Example:: def very_expensive_function(): pri...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Aug 14 12:01:04 2020 @author: danielfurman """ # This file unzips climate tifs downloaded from Worldclim.org, and # the expanded files are saved to a HardDrive folder "output_dir". # Manually unzipping eight tif files for a single ssp scenario # took 3 ...
import os import sys import traceback import webbrowser import pyqrcode import requests import mimetypes import json import xml.dom.minidom import urllib import time import re import random from traceback import format_exc from requests.exceptions import ConnectionError, ReadTimeout import html UNKONW...
# # onlinestore-multi # simple online store application # (c) smit thakakar smitthakkar96@gmail.com # 2015 # GPL # ################################ IMPORT ################################ import os CURDIR = os.path.abspath(os.path.dirname(__file__)) PS = os.path.sep import sys sys.path.append(CURDIR) import re...
import json import asyncio import requests from bs4 import BeautifulSoup class Item: def __init__(self, name: str, id: int): self.name = name self.id = id async def get_item_price(self): response = requests.get(url=f'https://catalog.roblox.com/v1/search/items/details?id={self.id}')...
''' @ junhyeon.kim @ emil - sleep4725@naver.com @ 한국 관광공사 - 지역코드 @ 2019-01-26 ''' # ================================== import requests from yaml import load, load_all, YAMLError import sys from urllib.parse import urlencode import pprint import re import json import time # ================================== class PROJ:...
n = 1000000 primes = [True if i > 1 else False for i in range(n+1)] for p in range(2, n+1): if p*p <= n and primes[p] is True: for i in range(p * p, n+1, p): primes[i] = False for p in range(2, n+1): if primes[p] is True: _i, s = [p], str(p) for i in range(len(s)-1): s = s[1:] + s[0] if s[...
from django.conf.urls import include, url from . import views urlpatterns = [ url(r'^username/$', views.username, name="username"), url(r'^profile/$', views.profile_redirect, name="profile_redirect"), ]
import numpy as np number_of_leaves = 9 epsilon = 0.15 delta = 0.15 uniform_samples = 500 iterations = 50 def beta(s): return np.log(number_of_leaves / delta) + np.log(np.log(s) + 1) class Node: def __init__(self, name, left_child, middle_child, right_child, parent, is_root=False, is_max_node=False): ...
from __future__ import absolute_import, division, print_function from dials.array_family import flex from dials_algorithms_centroid_simple_ext import * from dxtbx import model
''' @author: aby ''' from django.db import models from tinymce.models import HTMLField from jsonfield.fields import JSONField from django.core.urlresolvers import reverse from django.utils.text import slugify from django.utils import timezone from django.utils.translation import ugettext_lazy as _ from django.db.model...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # @Date : Nov-29-20 16:18 # @Author : Kelly Hwong (dianhuangkan@gmail.com) import os import argparse from datetime import datetime import tensorflow as tf from keras_fn.resnet import model_depth, resnet_v2 from keras_fn.transfer_utils import transfer_weights...
""" At Chip's Fast Food emporium there is a very simple menu. Each food item is selected by entering a digit choice. Here are the three burger choices: 1 – Cheeseburger (461 Calories) 2 – Fish Burger (431 Calories) 3 – Veggie Burger (420 Calories) 4 – no burger Here are the three drink choices: 1 – Soft Drink ...
import os import json import h5py import numpy as np from scipy import sparse import collections import math import torch import caption.readers.base NUM_RELS = 6 UNK_WORDEMBED = np.zeros((300, ), dtype=np.float32) PIXEL_REDUCE = 1 class ImageSceneGraphFlatReader(caption.readers.base.CaptionDatasetBase): def __ini...
import numpy as np import random number_of_try=1000 number_of_restart=10 # number_of_try=100 # number_of_restart=5 FileName="large" with open(FileName+".txt") as f: file=f.readlines() f.close() minizinc="" file = [x.strip() for x in file] file = [x.split(" ") for x in file] #file = [x.split("\t") for x in fi...
# https://leetcode-cn.com/problems/ba-shu-zi-fan-yi-cheng-zi-fu-chuan-lcof/ # 剑指 Offer 46. 把数字翻译成字符串 class Solution: def translateNum(self, num: int) -> int: num = str(num) cnt = 0 def recur(p: int): nonlocal cnt if p >= len(num) - 1: cnt += 1 ...
"""Check if userbot alive. If you change these, you become the gayest gay such that even the gay world will disown you.""" import asyncio from telethon import events from telethon.tl.types import ChannelParticipantsAdmins from platform import uname from userbot import ALIVE_NAME from userbot.utils import admin_cm...
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
import os path = r'/home/igeng/PycharmProjects/google_recog/Spoken_Number_Recognition_mfcc/codes/google_commands/audio_tr/' for name in range(30): os.mkdir(path+str(name))
import random pool_size=10 mutation_prob=0.2 cross_prob=0.8 def marking_function(x): value=int(x, 2) return 2*(value*value+1) def roulette_sum(genes): sum=0 for x in genes: sum+=marking_function(x) return sum def prob(x,sum): return marking_function(x)/sum def select_genes(...
def count(fileData): inputData = open(fileData,'r') lines = inputData.readlines() N = int(lines[0]) open('output.txt', 'w').close() outputData = open('output.txt', 'a') j = 1 i = 0 maxim = 10000000 last_num = 0 while j <= N: i += 1 list_num = set() number = int(lines[i]) for x in r...
# -*- coding: utf-8 -*- """ Created on Tues Jun 03 08:00:53 2014 @author: nataliecmoore Script Name: USDA_AJ_PY018_SCRAPER Purpose: Find the Georgia f.o.b. dock quoted price on broilers/fryers Approach: Found the relevant section of the website and used python string parsing to find the quoted price. Author: Nata...
# Stdlib import datetime import time import pdb # 3rd party from dateutil.parser import parse as date_parse import pytz # Custom from .constants import THIS_DIR from .regex_ import make_bdry_regex, match_all """ times = [ '', 'abc', 'abc:def', '4:3', '40:3', # Fail '09:50', '10:25', ...
import requests from assessment import price_result, create_file def main(): """ Main function will convert the data into json format and storing into Data varaible """ url = 'https://api.coinranking.com/v1/public/coin/1/history/30d' get_data = requests.get(url) json_data = get_data.json() data = json_data['d...
import numpy as np from astropy.io import ascii from astropy.constants import c import astropy.units as u import naima from naima.models import (ExponentialCutoffBrokenPowerLaw, Synchrotron, InverseCompton) ECBPL = ExponentialCutoffBrokenPowerLaw(amplitude=3.699e36 / u.eV, ...
cont = 0 maior = menor = 0 maior_nome = [] menor_nome = [] while True: name = input('Nome: ') weight = float(input('Peso : ')) if cont == 0: menor = maior = weight elif cont >= 1: if weight > maior: maior = weight maior_nome.append(name) if weight < menor...
#Program that allows a user to access two different financial calculators: #an investment calculator and a home loan repayment calculator import sys import math #Determine type of calculator the user requires print("Choose either 'investment' or 'bond' from the menu below to proceed:") print("\nInvestment\...
""" Homework 8 max """ # if-block if 1 == 1: x = 123 print("global x =", x) if x == 123: print("x is a global variable") else: print("x is not a global variable") # for-block for i in (1,2,3): pass if i == 3: print("i is a global variable") else: print("i is not a global variable")
import itertools import sys import time import unittest import numpy as np import pandapower as pp import pandas as pd from lib.data_utils import indices_to_hot, hot_to_indices from lib.dc_opf import ( StandardDCOPF, LineSwitchingDCOPF, TopologyOptimizationDCOPF, MultistepTopologyDCOPF, GridDCOPF,...
# Sample : https://qiita.com/Kosuke-Szk/items/eea6457616b6180c82d3 REPLY_ENDPOINT = 'https://api.line.me/v2/bot/message/reply' def post_text(reply_token, text): header = { "Content-Type": "application/json", "Authorization": "Bearer {ENTER_ACCESS_TOKEN}" } payload = { "replyToken...
from numpy import exp, array, random, dot import numpy as np class randomise(): # Creating the neuron layer and randomising the weights. def __init__(self, numberNeurons, numberInputs): self.weights = 2 * random.random((numberInputs, numberNeurons)) - 1 class NeuralNetwork(): def __in...
import base64, ast import pandas as pd def decode_game_state(state): decoded = base64.b64decode(state) dict_string = decoded.decode("UTF-8") data = ast.literal_eval(dict_string) df = pd.DataFrame(data) grid = pd.DataFrame(df['gridObj']) grid = grid.drop(grid.index[0]) grid.reset_index(inpla...
__author__ = 'Markus Prim' def rgb_to_hex_rep(r, g, b): color = str() color += "#" color += str(hex(r)[2:]).zfill(2) color += str(hex(g)[2:]).zfill(2) color += str(hex(b)[2:]).zfill(2) return color
import logging import os LOG = logging.getLogger() INFO = 'INFO' DEBUG = 'DEBUG' WARNING = 'WARNING' FATAL = 'FATAL' # lp = r'\(' # rp = r'\)' # lb = r'\[' # rb = r'\]' # # lbp = lb + lp # rbp = rb + rp # # LOG_LEVEL = r'[A-Z]+' # LOG_TID = r'\d+' # LOG_TIME = r'.*' # LOG_FILE_LINE = r'.*:\d+' # LOG_FUNC_NAME = r'\w...
import hashlib from django.core.mail import send_mail from django.template import loader from flask import render_template from flask_mail import Message from app.ext import mail from app.models import Cart, Goods from settings import SERVER_HOST, SERVER_PORT def hash_str(source): return hashlib.new('sha512', ...
import matplotlib.pyplot as plt import numpy as np from sklearn import datasets, linear_model from sklearn.metrics import mean_squared_error, r2_score def visualise_dataset_sample(features, targets, num_samples = 20): indices = list(range(features.shape[0])) num_samples = min(num_samples, len(indices)) sam...
# -*- coding: utf-8 -*- # @Time: 2020/3/28 11:48 # @Author: Rollbear # @Filename: test_label_pick.py # 测试附件一(三级标签)的抓取 from entity.label import LabelNode from util.xl_read import * import openpyxl def main(): # 两种方式: # 从excel表格获取所有标签,组成树形结构 root = read_labels("../xls/e1.xlsx") # 从excel表格读取标签,组成列表 ...
#Tal Aizikov 101150420 #This will display a calculation and solve it print("Do you want to know what (2.019x10^-9 x 5.76x10^-7) / (7.16x10^-4 + 9.23x10^-7)") #getting user engaged num = ((2.019*(10^-9) * 5.76*(10^-7)) / (7.16*(10^-4) + 9.23*(10^-7))) #Calculating what it is #The line above is not neccesary b...
# import from zipfile import * import os # set build path builddir = r'C:\Users\roey.c\Desktop\lab_days' # for all sub-folders inside the build folder for subdir, dirs, files in os.walk(builddir): print subdir, dirs, files # change the current directory os.chdir(subdir) # for each file in the curren...
from .callbacks import supports_callbacks __version__ = '0.2.0' __doc__ = """ This library allows you to place decorators on functions and methods that enable them to register callbacks. """
#!/usr/bin/python -S """ oheap2_test.py: Tests for oheap2.py """ from __future__ import print_function import unittest from ovm2 import oheap2 # module under test class Oheap2Test(unittest.TestCase): def testAlign4(self): self.assertEqual(0, oheap2.Align4(0)) self.assertEqual(4, oheap2.Align4(1)) se...
""" Routable Cherry Controllers This code let's you combine CherryPy's nice default hierarchial dispatcher with the ability to setup arbitrary routes to chosen targets. Routes are attached directly to the method that handles the request rather than in a separate configuration file For example: AccountsController(Bas...
# -*- coding: utf-8 -*- import scrapy import collections import json class AirbnbSpider(scrapy.Spider): name = 'airbnb' allowed_domains = ['www.airbnb.com'] start_urls = ['http://www.airbnb.com/'] def start_requests(self): url = ('https://www.airbnb.ca/api/v2/explore_tabs?_format=for_explore_s...
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2014-Today Jonathan Finlay <jfinlay@riseup.net>. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # ...
import constants as C def checkTop(host,target): rect = host.rect target = target.rect # since it is 2 pixels, it breaks when we get closer than 2 pixels on a given edge # Need to make it so that the code will move our object back if it will overlap, # Perhaps checking if top+1 will make us on...
from django.shortcuts import render from stats.models import Master, Batting, Fielding, Pitching from rest_framework.generics import ListCreateAPIView, RetrieveUpdateDestroyAPIView from stats.serializers import MasterSerializer, BattingSerializer, FieldingSerializer, PitchingSerializer class MasterListCreateAPIView(Li...
# Generated by Django 3.1 on 2020-08-30 20:32 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ...
# -*- coding: utf-8 -*- from hearthstone.entities import Entity from entity.spell_entity import SpellEntity class LT21_016_(SpellEntity): """ 颅骨之尘4 嗞啦会获得流血(5)。 """ def __init__(self, entity: Entity): super().__init__(entity) def equip(self, hero): pass
from django.urls import reverse from rest_framework import status from rest_framework.test import APITestCase, APIRequestFactory from .models import Room from .views import ListCreateRoomAPIView, RetrieveUpdateDestroyRoomAPIView class CreateRoomTest(APITestCase): def setUp(self): self.view = ListCreate...
# Generated by Django 2.1.7 on 2019-05-21 13:27 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('cv', '0008_auto_20190517_0952'), ] operations = [ migrations.AlterField( model_name='job', ...
#quicksort python implementation ##pseudocode #quicksort(A,start,end) #if(start<end) #partition(A,start,end) #quicksort(A,start,pIndex-1) #quicksort(A,pIndex+1,end) # #partition(A,start,end) #pivot = A[end] #pIndex = (start-1) #for(0 to end-1) #{if(A[i]<=pivot) #swap A[i],A[pIndex] #pIndex = pIndex+1 #} #swap A[pIndex+...
import pandas as pd from sqlalchemy import create_engine engine = create_engine('mysql+pymysql://Joe:sjjgtjytz@localhost:3306/quant') sql_query = 'select * from user;' df_read = pd.read_sql_query(sql_query, engine) test = df_read.to_json(orient='records') print(test)
import json import sys from src.common.Logger import Logger from src.common.app import App from src.common.AppiumScreenshot import ScreenShot log = Logger("main").logger() with open('../config/MyObservatoryEle.json') as json_file: ele = json.load(json_file) class MyObservatory(App): @classmethod def my...
def style(output): def decorate(f): if output == "bold": def wrap(): return "<bold>" + f() + "</bold>" elif output == "italics": def wrap(): return "<i>" + f() + "</i>" return wrap return decorate def bold(): print "bold() cal...
import argparse import tarfile from collections import defaultdict from typing import Dict, List from sacrerouge.data import Metrics, MetricsDict from sacrerouge.io import JsonlWriter def load_summaries(eval_tar_2: str): summaries = defaultdict(dict) with tarfile.open(eval_tar_2, 'r') as tar: for mem...
import subprocess from config import * vert_imname_res = [ re.compile(r'cm[em][0-9]+$'), re.compile(r'knk[clq][0-9]+$'), re.compile(r'nk2[cj][0-9]+$'), re.compile(r'ssk[ikno][0-9]+$'), re.compile(r'zps[efim][0-9]+$'), ] # 哪些文件是横向文字 for k, v in dict_image.items(): language = 'jpn' for vert...
import math import numpy as np import matplotlib.pyplot as plt # http://nghiaho.com/?page_id=671 fig = plt.figure() axes1 = plt.subplot(111) axes1.axis("equal") original_pts_np = np.mat([[0,1.0],[2.0,2.0],[1.0,0]]) rot_angle = np.pi/4.0 c = math.cos(rot_angle) s = math.sin(rot_angle) ground_truth_rot_mat = np.mat([[...
import os.path as osp import cv2 import os import numpy as np import torch import models.modules.EDVR_arch as EDVR_arch import math from torchvision.utils import make_grid testpath = '/input/testpngs' out_path = '../results' index = 0 def read_img(img_path): """Read an image from a given image path Args: ...
import objPais import pickle import btree as b btree = b.BTree(4) binaries = open('binaries.kbb', 'rb') arq = open('tourism.pkl', 'wb') for i in range(1, 196): pais = pickle.load(binaries) print (pais.name) btree.insert([pais.tourism, pais.name, i]) pickle.dump(btree, arq) binaries.close(...
# BASIC STATISTICS # DATA ANALYSIS # _______________ # GET TO KNOW YOUR DATA # LITTLE DATA -> SIMPLY LOOK AT IT # BIG DATA -> ??? # NUMPY HAS FRIENDLY STATISTICAL FUNCTIONS SUCH AS: # _________________________________________________ # np.mean(), np.median(), np.corrcoef() to check for correlations # np.std() for sta...
import os import re import difflib import datetime def find_max(data, devices): try: if devices == "2DVD": output = max(data) return output elif devices == "OTT": list_ott = [] for i in data: list_ott.append(datetime.datetime.strptime(...
from selenium import webdriver import time driver = webdriver.Chrome() url = "https://www.dailyobjects.com/auth/login" driver.get(url) phone_number=driver.find_elements_by_class_name("mat-form-field-autofill-control")[0] phone_number.click() phone_number.send_keys("9999999999") time.sleep(2) driver.find_elements_b...
#!/usr/bin/env python3 # Copyright 2019 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). import shutil import subprocess from glob import glob from common import die, green def main() -> None: ensure_shellcheck_installed() run_shellcheck() def e...
import math def Fahrenheit_to_Kelvin(F): return 273.5 + ((F - 32.0) * (5.0/9.0)) Pt=2068000 #1500psi --> Pa #Pt is chamber pressure gam = 1.3 #property of your working fluid Tt=Fahrenheit_to_Kelvin(3539.93) #temperature in the chamber p0=101352.932 #free stream pressure outside nozzle -> Pa 1 atm? Averag...
import unittest from my_jc import ActionProcessor class JCTest(unittest.TestCase): # Negative Tests def test_neg_1(self): data = '{"abc":"run", "time": 10}' s = ActionProcessor() res = s.addAction(data) self.assertEqual(res, -1) stats = s.getStats() self.assertEqu...
from django.test import TestCase from django.contrib.auth.models import User from .models import TravelType, Trip, Questions import datetime from .forms import TripForm, TravelTypeForm, QuestionsForm from django.urls import reverse_lazy, reverse # Create your tests here. class TravelTypeTest(TestCase): def setUp(s...
from pynag.Model import Host from pynag.Control.Command import send_command from wb_services.hosts import Hosts from wb_services.hosts.ttypes import Datapoint ATMO_HOSTGROUP_NAME = 'atmo-vms' ATMO_HOST_TEMPLATE = 'atmo_vm' ATMO_HOST_FILE = '/etc/nagios/atmo-hosts.cfg' class Handler(Hosts.Iface): def __init__(se...
# halite -d "30 30" "python3 shummiev3-6.py" "python3 shummiev3-5.py" import subprocess import re from collections import Counter num_games = 100 games_played = 0 rank_list = [] while games_played < num_games: if games_played % 5 == 0: print("Running Game #:" + str(games_played)) #stdoutdata = subpro...
from bota.web_scrap.dotavoyance.dotavoyance import Dotavoyance from bota.web_scrap.heroes_process import find_hero_name from bota.image_processing import add_border_to_image, write_text_pil import cv2 import os from bota import constant from bota.help import TEAM_CMD_EXAMPLE DV = Dotavoyance() SORT_BY_KEYS = ['high', ...
"""UI module of Colorium's Asset Management Tool. This module creates the UI using Colorium's CUI module.""" import maya.cmds as cmds import colorium.ui as ui import colorium.asset_type_definition as asset_type_definition import colorium.scene_name_parser as scene_name_parser import colorium.command as command import ...
""" README.md example """ import goenrich # build the ontology G = goenrich.obo.graph('db/go-basic.obo') # use all entrez geneid associations form gene2go as background # use goenrich.read.goa('db/gene_association.goa_ref_human.gz') for uniprot background = goenrich.read.gene2go('db/gene2go.gz') goenrich.enrich.set_...
import os import numpy as np import pandas as pd import pickle from sklearn.model_selection import train_test_split from utils import taLogging logger = taLogging.getFileLogger(name='util',file='log/util.log') sep=' ' max_len = 60 flags = r'[。!?;]' import re line_max = 20 def get_entity(x,y,id2tag): """ 组合实体 ...
# # SPDX-FileCopyrightText: Copyright (c) 1993-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # 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...
import os import math import random import pyautogui import subprocess from system_hotkey import SystemHotkey import time time.sleep(5) # Playing around with pyautogui and SystemHotkey packages in Paint pyautogui.FAILSAFE = False # pyautogui.PAUSE = 0.5 def abort(self): print("ABORT") os....
import cv2 import numpy as np from os import listdir from os.path import isfile, join ################## Data set collection ################# face_classifier = cv2.CascadeClassifier('C:/Users/Abhilasha kumari/IdeaProjects/Face_Recognition_Mini_Project/opencv-master/data/haarcascades/haarcascade_frontalface_defaul...
# -*- coding: utf-8 -*- import utils.sqlbase as sqlbase import utils.sqlitebase as sqlitebase import initres TBL_NAME = 'tbl_wall' DB_NAME = initres.bingpath + '/wall.db' _DB_SCRIPT = """ CREATE TABLE tbl_wall ( "day" VARCHAR(128) NOT NULL default '', "urlbase" VARCHAR(256) NOT NULL...