text
stringlengths
8
6.05M
# Generated by Django 2.2.10 on 2020-02-24 10:47 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('user', '0002_auto_20200223_2349'), ] operations = [ migrations.AlterField( model_name='message...
from Jumpscale import j import netaddr import random import nacl import os def chat(bot): """ This chat is to deploy 3bot container on the grid """ explorer = j.clients.explorer.explorer cl = j.clients.s3.get("deployer") AWS_ID = cl.accesskey_ AWS_SECRET = cl.secretkey_ user_info = b...
# cd /Users/AL/Dropbox/0. AL Current Work/3. To Submit/Dr K/AL/python/ import sdm import sdm_utils from numpy import * def mem_write_x_at_x(count=10): for i in range (count): b=sdm.Bitstring() sdm.thread_write(b,b) def mem_write_x_at_random(count=10): for i in range (count): b=sdm....
from django.conf.urls import * from tagging_autocomplete.views import list_tags urlpatterns = [ # 'tagging_autocomplete.views', url(r'^list$', list_tags, name='tagging_autocomplete-list'), ]
import numpy from numpy import array from numpy import mean from numpy import cov, var from PIL import Image from numpy.linalg import eigh, norm from matplotlib.pyplot import * import matplotlib.pyplot as plt import math f = open('ts.txt', 'r') train_images = [] tf = open('tss.txt', 'r') test_images = [...
# author: Wenrui Zhang # email: wenruizhang@ucsb.edu # # install required package using: pip install -r requirements.txt # run the code: python main.py import numpy as np from sklearn.preprocessing import StandardScaler, LabelEncoder import sklearn.model_selection as model_s from sklearn import neighbors from sklearn...
from Pages.drag_drop import DragDropPage from Utils.locators import DragDropLocators import time from Utils.Logger import Logging import allure from allure_commons.types import AttachmentType @allure.severity(allure.severity_level.NORMAL) class Test_DragDrop: logger = Logging.loggen() ################## ...
from django.shortcuts import render, get_object_or_404 from decimal import Decimal from django.conf import settings from django.urls import reverse from paypal.standard.forms import PayPalPaymentsForm from django.views.decorators.csrf import csrf_exempt import pymysql connection = pymysql.connect(host='localhost',user=...
""" :mod:`pysgutils.sg_pt` ~~~~~~~~~~~~~~~~~~~~~~ Python port of sg_pt.h from sg3_utils Comments from sg_pt.h: Copyright (c) 2005-2014 Douglas Gilbert. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the BSD_LICENSE file. """ from __future__ import absolute_import...
import matplotlib import numpy as np import matplotlib.cm as cm import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import axes3d, Axes3D def initial_plot(f): matplotlib.rcParams['xtick.direction'] = 'out' matplotlib.rcParams['ytick.direction'] = 'out' delta = 0.025 x = np.arange(-5.0, 5.0, del...
from django.conf.urls import patterns, include, url from django.contrib import admin from apps.web import views from apps.api.views import GameViewSet from rest_framework import routers router = routers.DefaultRouter() router.register(r'games', GameViewSet) urlpatterns = patterns('', url(r'^', include(views)), ...
""" Heber Cooke 10/31/2019 Chapter 6 Exercise 9 Write a program that computes and prints the average of of the numbers in a text file. You should make use of two higher-order functions to simplify the design. """ import random inpu = input("Enter a file name or C to create one ") if inpu == 'C' or inpu == 'c': # crea...
# Generated by Django 2.2.8 on 2020-06-09 08:25 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('myapp', '0002_teach_time'), ] operations = [ migrations.AlterField( model_name='teach', name='time', fie...
#!/usr/bin/python """ Author Paula Dwan Email paula.dwan@gmail.com Student ID 13208660 Subject COMP47270 (Computational Network Analysis and Modeling) Date Jan-2015 Lecturer Dr. Neil Hurley LABORATORY | CASE STUDY 2 : laplacian.py """ # import the networkx network analysis package i...
import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, Gio from gi.repository.GdkPixbuf import Pixbuf class openSessionWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="Open Session Overlay") self.set_border_width(10) hb = Gtk.HeaderBar(title="Ope...
# -*- coding: utf-8 -*- # @Time : 2019/11/28 15:30 # @Author : Jeff Wang # @Email : jeffwang987@163.com OR wangxiaofeng2020@ia.ac.cn # @Software: PyCharm import cv2 import numpy as np canvas = np.zeros((300, 300, 3), dtype='uint8') green = (0, 255, 0) red = (0, 0, 255) white = (255, 255, 255) cv2.line(canv...
"""empty message Revision ID: 76453dfdcd53 Revises: 2e68164a73a9 Create Date: 2020-03-29 00:39:54.361536 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '76453dfdcd53' down_revision = '2e68164a73a9' branch_labels = None depends_on = None def upgrade(): # ...
import torch import torch.nn as nn import torchvision.models as models from tqdm import tqdm from torch.utils.data import DataLoader from sklearn.metrics import accuracy_score from dataset import TextDataset from utils import get_val_augmentations, preprocess_data def main(): BATCH_SIZE = 64 NUM_WORKERS = 8 ...
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-12-15 22:48 from __future__ import unicode_literals import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('course', '0003_grade_is_canceled'), ] operations = [ ...
import os,re,math from time import gmtime, strftime from flask import Flask,render_template,request,session,g,redirect, url_for,abort, flash app = Flask(__name__) @app.route('/') def index(): return render_template('index.html') # Static routing # Please check the files ending in .html in the templates folder to...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import os """dir = "cleaned_df/" file_list = os.listdir(dir) for i,element in enumerate(file_list) : print(i) df=pd.read_csv(dir+str(element)) plt.plot(df["engergy"]) plt.title(str(element)) plt.savefig("./img/"+element.re...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- import os import numpy as np import torch import rasterio import rasterio.mask from rasterio.windows import Window from rasterio.plot import show # Inference def predictor_arg(tensor,model): """ args: - tensor : tensor of size N,C,W,H - model...
# -*- coding: utf-8 -*- """ Created on Tue Sep 12 17:45:23 2017 @author: modellav """ #The goal of this project is to scrape data from Google Finance #To determine the top gainers and top losers of the market, with corresponding % change #IMPORT PACKAGES import urllib.request as ul from bs4 import BeautifulSoup imp...
''' Created on Jul 10, 2013 @author: emma ''' from UnitTesting.page_objects.base_page_object import base_page_object from selenium.webdriver.common.action_chains import ActionChains import time class booksellers(base_page_object): def __init__(self, webd_wrap): base_page_object.__init__(self, webd_wr...
#!/usr/bin/python # Iskandar Setiadi 13511073@std.stei.itb.ac.id # Institut Teknologi Bandung (ITB) - Indonesia # Final Project (c) 2015 # mongodb_testcase2.py __author__ = 'freedomofkeima' import sys import time from pymongo import MongoClient def main(args): client = MongoClient('52.74.132.58', 27017) # Neare...
#对数 import matplotlib.pyplot as plt import numpy as np x = np.arange(0.01,10,0.01) y1 = np.log(x)#python以e为底 y2 = np.log(x)/np.log(0.5) plt.plot(x,y1,c='red') plt.plot(x,y2,c='yellow') plt.show()
class Call(object): def __init__(self,unique_id,class_name,caller_phone_num,timeofcall,reason_for_call): self.unique_id = unique_id self.class_name = class_name self.caller_phone_num = caller_phone_num self.timeofcall = timeofcall self.reason_for_call = reason_for_call ...
from django.http import JsonResponse from index.models import Products from .models import Message from user.models import UserProfile import json from user.logging_check import logging_check # Create your views here. @logging_check('POST') def message(request): if request.method == 'GET': goods_id = requ...
下雨天 hello 下午学习git 秦岭一日游 wo men dou yi yang
weight = float(input('Enter your weight in kgs: ')) height = float(input('Enter your height in metres: ')) result = weight / (height**2) print('Your BMI is {:.2f}'.format(result))
#!/usr/bin/env python3 from termcolor import cprint from nubia import command, argument, context @command(name_or_function="gcloud") class GCLOUD: """ Google Cloud Platform commands set. This is still not implemented. """ def __init__(self) -> None: pass @command def info(self): ...
import os import re class LanguageModelContent: def __init__(self, words,count): self.words = words self.count = count def __str__(self): return self.words + '\t' +self.count if __name__ == "__main__": dir_list = sorted(os.listdir('/Users/geekye/Documents/Dataset/LM/UniBiG...
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # File Name: Action.py # By: Daniel Lamothe # # Purpose: A simple object representing an Action a Creature can take. Used to house Action information. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
"""Define test cases for KFLR.""" from test.extensions.secondorder.secondorder_settings import GROUP_CONV_SETTINGS SHARED_NOT_SUPPORTED_SETTINGS = GROUP_CONV_SETTINGS LOCAL_NOT_SUPPORTED_SETTINGS = [] NOT_SUPPORTED_SETTINGS = SHARED_NOT_SUPPORTED_SETTINGS + LOCAL_NOT_SUPPORTED_SETTINGS
import os import importlib from gmc.conf import global_settings ENVIRONMENT_VARIABLE = "GMC_SETTINGS_MODULE" class Settings: """ Module to load settings to configure gmc """ def __init__(self, *args, **kwargs): self.settings = None self.settings_module = None def __getattr__(self, ...
import os import PIL from PIL import Image from PIL import ImageEnhance from tqdm import tqdm first_num = 82 last_num = 84 folder_name = "201013-vib" for th in tqdm((1,2,3,4,5,6,7,8,9,10)): TH=str(th) os.mkdir("enhance_test/"+folder_name+"_"+TH) for num in tqdm(range (first_num,last_num)): im_nam...
import unittest import testutil import hdbfs class HiguQueryCases( testutil.TestCase ): def setUp( self ): self.init_env() h = hdbfs.Database() h.enable_write_access() red_obj = h.register_file( self._load_data( self.red ) ) yellow_obj = h.register_file( self._load_data...
# -*- coding: utf-8 -*- import scrapy import time import labsql import copy class PanyuspiderSpider(scrapy.Spider): name = 'panyuSpider' allowed_domains = ['qx.panyu.gov.cn'] start_urls = ['http://qx.panyu.gov.cn/pyinterface/wap/sk_zd.jsp'] # create sql server session conn = labsql.LabSQL('172.16...
class Section: section_number = None type = None days_of_the_week = None start_time = None end_time = None def __init__(self, json_dict=None): if json_dict is None: self.section_number = None self.type = None self.days_of_the_week = None s...
# -*- coding: utf-8 -*- ################################################################################ ## Form generated from reading UI file 'downloaderFNzIGb.ui' ## ## Created by: Qt User Interface Compiler version 5.15.2 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! #########...
import board import neopixel import time pixels = neopixel.NeoPixel(board.D18, 20) for i in range (0,20): pixels[i] = (0,0,255)
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import dataclasses import functools import itertools import json import logging import os.path from dataclasses import dataclass from pathlib import Pur...
from django.db import models GENRE_CHOICES = ( ("rock", "Rock"), ("blues", "Blues"), ) class Artist(models.Model): first_name = models.CharField(max_length=255) last_name = models.CharField(max_length=255) artistic_name = models.CharField(max_length=255) picture_url = models.URLField() po...
#!/usr/bin/python # # Sample python code using the standard http lib only # import httplib ## Your Infinispan WAR server host hostname = "localhost:8080" webapp_name = "infinispan-server-rest" cache_name = "___defaultcache" key = "my_key" #putting data in print "Storing data on server %s under key [%s] over REST" ...
# Generated by Django 3.2.4 on 2021-07-07 13:41 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('churrasco', '0002_auto_20210706_1629'), ] operations = [ migrations.AlterField( model_name='produto', name='nome', ...
import numpy as np import cv2 import math import struct import time import serial ser1=serial.Serial('com7',9600) time.sleep(2) detect_cascade=cv2.CascadeClassifier('/home/jayesh/Desktop/cv2_test/haarcascade_a.xml') detectc_cascade=cv2.CascadeClassifier('/home/jayesh/Desktop/cv2_test/haarcascade_star.xml') ca...
# -*- encoding:utf-8 -*- # __author__=='Gan' # 实现一个函数,根据标题序列生成相应的标题序号。 # 输入参数,一个 Array,每个元素都是 # 为前缀的标题,保证层级连续,然后返回解析好的数据结构。 # 输入 # ["# a", "## b", "## c", "### d", "# e"] # # # 输出 # [{"hn": "1", "title": "a"}, # {"hn": "1.1", "title": "b"}, # {"hn": "1.2", "title": "c"}, # {"hn": "1.2.1", "title": "d"}, # {"hn": "2", ...
#!/usr/bin/python def isAGirl(nome): nomiMaschili = ["LUCA","GIANLUCA","MATTIA","NICOLA","ANDREA","ELIA","ENEA"] numeri = ["1","2","3","4","5"] #il numero della classe es 1R stampa = True for i in numeri: #print i if nome.find(i) > 0: #print nome.find(i),i conf = nome.find(i) nome = nome[1:conf] #...
# -*- coding: utf-8 -*- from numpy import zeros from numpy import int16 import scipy.io.wavfile from constantes import * from operator import add import math as m """ coeff_lissage est un entier paramétrant l'intensité du lissage indispensable pour éviter de commencer trop tôt à cause du bruit (à déterminer) t_mi...
""" 切片(slice) 切片是取出序列中一个范围对应的元素 """ a = list(range(10)) print(a) print(a[2:3]) # 2 print(a[5:9]) # [5, 6, 7, 8] print(a[5:-1]) # [5, 6, 7, 8] print(a[-5:9]) # [5, 6, 7, 8] print(a[-5:-1]) # [5, 6, 7, 8] # 缺省 print(a[5:]) # [5, 6, 7, 8, 9] print(a[:5]) # [0, 1, 2, 3, 4] print(a[100:]) # [] print(a[:100]) # [0, 1, 2,...
#!/usr/bin/env python # -*- coding:utf-8 -*- MATRIX_INT = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] MATRIX_STR = [['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h', 'i']] # 示例一、获取矩阵第二列的内容------------------------------------------------- # 列表解析 res = [row[1] for row in MATRIX_I...
[gtfsrt://<name>] feed = <string> auth = <string>
import valkyrie class UniqueList: def __init__(self, unique): self.list = [] self.unique = unique def add (self, item): idx = 0 if self.unique: # make a function pointer item_equals = item.equals for ref in self.list: if item_equals(ref): return idx idx += 1 idx = len(self.li...
#!/usr/bin/env python # # Copyright (c) 2019 Opticks Team. All Rights Reserved. # # This file is part of Opticks # (see https://bitbucket.org/simoncblyth/opticks). # # 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...
import matchAndSend import form_extraction import config import sys def main(): config.config(sys.argv) # Get new Bell Ringers if not config.DISABLE_EXTRACT: form_extraction.extract(is_listener = False) form_extraction.organize_form() matchAndSend.matchAndSend() if __name__ == '__main_...
import json import requests youtube_url = "https://www.youtube.com/watch?v=y6XX39DaEL4" #transcript_json_url = "https://00e9e64bac4a30dc976c87ac7bed719495328d5a37d54a496e-apidata.googleusercontent.com/download/storage/v1/b/citeit_speech_text/o/freakonomics%2F280-why-is-my-life-so-hard-times-original.json?qk=AD5uMEvDxi...
a = 11 b = 22 c = a >= b # c 會等於 False d = a <= b # d 會等於 True e = c == d # e 會等於 False f = a != b # f 會等於 True # 檔名: exp_demo06.py # 作者: Kaiching Chang # 時間: July, 2014
#!/usr/bin/env python # -*- coding:utf-8 -*- """ 1、编写函数有什么意义? 减少代码冗余 提高代码的重复利用率 便于修改 2、什么时候 python 将创建函数? python 执行到 def 语句时 3、当一个函数没有 return 语句时,返回什么? None 4、在函数定义内部的语句什么时候运行? 函数被调用时 5、检查传入函数的对象类型有什么错误? 会破坏函数的灵活性,把函数限制在特定的类型上 不检查对象类型,则函数可能处理所有的对象类型 """
from django.shortcuts import render from .models import Employee, Student from rest_framework import viewsets from employee.serializers import EmployeeSerializers, StudnetSerializers, LoginSerializers from django.http import JsonResponse, HttpResponse from rest_framework.parsers import JSONParser from django.views.deco...
# coding: utf-8 """ Telstra SMS Messaging API The Telstra SMS Messaging API allows your applications to send and receive SMS text messages from Australia's leading network operator. It also allows your application to track the delivery status of both sent and received SMS messages. OpenAPI spec version:...
from datetime import datetime from tensorboardX import SummaryWriter import torch import torch.distributed as dist from torch.utils.data import DataLoader from torchvision.utils import save_image import torch.nn.functional as F import os import numpy as np import time import parameters as params from dataset impor...
a = True b = False c = a and b # c 會等於 False d = a or b # d 會等於 True e = not b # e 會等於 True # 檔名: exp_demo03.py # 作者: Kaiching Chang # 時間: July, 2014
"""!@mainpage HPTools @section intro_sec Introduction Python Tools to manipulate, analyze and plot DNA helical parameter data TcB @ Louisiana Tech 2018 contributions from Zilong Li, Ran Sun @page HPTools HPTools Usage: HPTools.py @page Run-Me RunMe Usage: Run-Me.py """ import sys...
#!/usr/bin/env python # Author: Benjamin Smith # Date: 6th Feb 2017 # File: bot.py # Purpose: Retweet tweets associated toward computer science topics # import libraries import os import tweepy import json import logging import warnings import time import http.client from random import randint from pprint import p...
from django.shortcuts import render, Http404, HttpResponseRedirect from django.http import HttpResponse from django.views.decorators.csrf import csrf_exempt from django.db.models import Q from datetime import datetime from index.models import * # Create your views here. # 判断用户是否登录 def user_auth(func): def inn...
#!/usr/bin/env python PACKAGE = "drive_ros_custom_behavior_trees" from dynamic_reconfigure.parameter_generator_catkin import * gen = ParameterGenerator() #Parameters: name, type, level, description, defalut value, min, max gen.add("mode", str_t, 0, "The driving mode (OBSTACLES or PARKING)", "DFAULT") gen.add("tick_f...
import tweepy,sys, os, newt, argparse, datetime, csv, random,math import networkx as nx import newtx as nwx import urllib, unicodedata def checkDir(dirpath): if not os.path.exists(dirpath): os.makedirs(dirpath) parser = argparse.ArgumentParser(description='Data about list members') group = parser.add_mutua...
"""Perform operations to find Reference Notes zones.""" import ReferenceOps as ro import ZoneNeutralOps as zno import numpy as np import pandas as pd import os pd.options.mode.chained_assignment = None # pd.set_option('display.max_colwidth', -1) # pd.set_option('display.max_rows', None) class reference_overhead(obje...
answer = input("Is it your birthday today?") if answer == "yes": print("Wow! Have a great celebration!") elif answer == "no": answer2 = input("Is your birthday over?") if answer2 == "yes": print("Hope you had a great celebration!") elif answer2 == "no": print("I look forward to your celebration!") els...
# flake8: noqa from .attention_reporter_callback import EvalAttentionReporter from .csv_callback import EvalCSVReporter from .google_sheets_callback import EvalGoogleSheetsReporter from .handler import EvalCallbackHandler from .progress_bar_callback import EvalProgressBarCallback from .simple_logger_callback import Eva...
from django.http import HttpResponse from django.shortcuts import render from django.template.loader import get_template # DRY - > Dont Repeat Yourself def home_page(request): data = "Home" context = {"title":data} if request.user.is_authenticated: context["mylist"] = [1,2,3,4,5] return render(request, "home.htm...
import random healthe = 10 health = 10 class Creature: def __init__(self, name, the_level): self.name = name self.level = the_level def __repr__(self): return "{}, Level {}".format( self.name, self.level ) def game_loop(): creatures = [ Creature('Rand...
""" LICENCE ------- Copyright 2013-2016 by Kitware, Inc. All Rights Reserved. Please refer to KITWARE_LICENSE.TXT for licensing information, or contact General Counsel, Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065. """ import copy import functools import logging import operator as op # noinspection PyUn...
import turtle bob = turtle.Turtle() bob.speed(30) for i in range(180): bob.forward(100) bob.right(30) bob.forward(20) bob.left(60) bob.forward(50) bob.right(30) bob.penup() bob.forward(30) bob.pendown() bob.dot() bob.penup() bob.setposition(0,0) bob.pendown() bob.right(2) turtle.done()
import tensorflow as tf import numpy as np class Add: def __init__(self): pass def execute(self, a, b): return tf.constant(a) + tf.constant(b) class Mean: def __init__(self): pass def execute(self): x_array = np.arange(18).reshape(3, 2, 3) x2 = tf.reshape(x_ar...
# -*- encoding: utf-8 -*- import json from datetime import datetime from django.views.generic import View from django.views.decorators.csrf import csrf_exempt from django.utils.decorators import method_decorator from django.utils.datastructures import MultiValueDictKeyError from django.http import (HttpResponse, HttpR...
from keras.datasets import cifar10 from keras.utils import np_utils import matplotlib.pyplot as plt import numpy as np #데이터 불러오기 (x_train, y_train), (x_test, y_test) = cifar10.load_data() #300개로 나누기 from sklearn.model_selection import train_test_split x_train, x_val, y_train, y_val = train_test_split(x_train, y_trai...
#!/usr/bin/python arr = [line.rstrip('\n') for line in open('problem_11.in')] max = 0 for i in range(0, len(arr)): arr[i] = arr[i].split() for i in range(0, 20): for j in range(0, 20): arr[i][j] = int(arr[i][j]) for i in range(0, 16): for j in range(0, 16): num = arr[i][j] * arr[i][j + 1...
# -*- coding:utf-8 -*- import os import cv2 import math import xml.etree.ElementTree as ET Base_dir = r"C:\Users\maggie\Desktop\dir_points" rootdir = './r_xml' # 存有xml的文件夹路径 img_path = './JPEGImages' new_xml_path = './Annotations' def file_name (file_dir): L = [] for root, dirs, files in os.walk(file_dir)...
# Generated by Django 2.2 on 2020-01-29 11:50 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] opera...
""" Given an array of integers sorted in ascending order, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the order of O(log n). If the target is not found in the array, return [-1, -1]. For example, Given [5, 7, 7, 8, 8, 10] and target value 8, return [3...
from django.views.generic import View from django.http import JsonResponse from django.conf import settings from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger class CoreView(View): """ 所有API基类 """ permission_view_map = { } superuser_required_action = [] app_name = ""...
from rich.live import Live from selenium.webdriver.chrome.webdriver import WebDriver from pages.base import BasePage from pages.cancelrequest import CancelRequests from pages.closerequest import CloseRequests from pages.createrequest import CreateRequests from pages.home import HomePage from pages.login import LoginPa...
""" test dryrun, that PyGemini can correctly invoke Gemini3D """ import shutil import pytest import sys from pathlib import Path import importlib.resources import gemini3d import gemini3d.run import gemini3d.job as job import gemini3d.web @pytest.mark.skipif(sys.version_info < (3, 8), reason="test requires Python >...
# -*- coding: utf-8 -*- """MRI RF excitation pulse design functions, including SLR and small tip spatial design """ import sigpy as sp from sigpy.mri import rf as rf from sigpy import backend __all__ = ['stspa'] def stspa(target, sens, coord, dt, roi=None, alpha=0, b0=None, tseg=None, st=None, phase_u...
#!/usr/bin/python i = input( " in") print i a = input("out") print a
import curses, time def main(screen): curses.curs_set(0) current_row=0 height, width = screen.getmaxyx() # Options to show play = 'Play.' score = 'Score.' exit = 'Exit.' # init_pair is a function that create a pair, first arg is identifier for color_pair # second arg is foreground color, las...
import os import numpy as np from types import SimpleNamespace import core.utils as utils def next_expr_name(path_dir, n_digit_length, id_only=False): myhost = os.uname()[1] myid = os.getlogin() if id_only: start_pattern = myid.lower() + '_' + "e" else: start_pattern = myid.lower() ...
#!/usr/bin/python from __future__ import division from ete3 import Tree import sys import copy from blosum import * from Bio.PDB import * import urllib2 tree_test = sys.argv[1] newick_file = sys.argv[2] name = sys.argv[3] matrix = BlosumMatrix('./blosum62.txt') probability_matrix = ProbabilityMatrix(tree_test,matrix)...
# usage: python cv.py --genofile 'myAveImpGenotype_wheat183.csv' --phenfile 'y8new.txt' [--CVfolds 5 --ridge 0 -3 -9] import sys import csv import matplotlib.pyplot as plt import numpy as np import random import math from argparse import ArgumentParser from collections import Counter def parse_args(): 'Parse the ...
from pathlib import Path import itertools def get_numbers(): yield from (int(x) for x in Path('data/day_01.txt').read_text().strip().split()) def part_1(): return sum(get_numbers()) def part_2(): sums = set() sum = 0 for n in itertools.cycle(get_numbers()): sum += n if sum in s...
import numpy as np from ..io import get_bb_all2d, get_bb_all3d def seg2Count(seg,do_sort=True,rm_zero=False): sm = seg.max() if sm==0: return None,None if sm>1: segIds,segCounts = np.unique(seg,return_counts=True) if rm_zero: segCounts = segCounts[segIds>0] ...
class LinkedList: def __init__(self, nodes=None): self.head = None if nodes is not None: node = Node(data=nodes.pop(0)) self.head = node for elem in nodes: node.next = Node(data=elem) node = node.next def __repr__(self): ...
import matplotlib.pyplot as plt import numpy as np import scipy.stats from sklearn.manifold import TSNE import tensorflow as tf from scipy import stats import os import time from matplotlib import animation from tf_util.stat_util import approx_equal from dsn.util.dsn_util import assess_constraints def plot_opt( m...
import os from qtgui.cli import run_gui if __name__ == '__main__': # Full (absolute) path to finlandia_talo.py file root = os.path.dirname(__file__) #run_gui(os.path.join(root, "simple_scenario.py")) run_gui(os.path.join(root, "finlandia_talo.py"))
from AND_Gate import AND from OR_Gate import OR from NAND_Gate import NAND def XOR(a1, a2): x1 = NAND(a1, a2) x2 = OR(a1, a2) y = AND(x1, x2) return y if __name__ == '__main__': for i in [(0, 0), (1, 0), (0, 1), (1, 1)]: y = XOR(i[0], i[1]) print(str(i) + " -> " + str(y))
'''30 sept 2018 @Mkchaudhary''' #Nonuniform Bspline curve using python opengl from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * from math import * from time import * import sys t=[0 for i in range(20)] def init(): glClearColor(0.0,1.0,1.0,0.0) glColor3f(1.0,0.0,0.0) glMatrixMode(GL_PROJECTI...
import os import sys, subprocess, socket, string import wmi, win32api, win32con import win32com.shell.shell as sh command = 'runas /user:DOMAIN\username "D:/Python27/python.exe myscript.py"' pst = subprocess.Popen(command, shell=True, stdin=subprocess.PIPE) pst.communicate("password123")
# https://wikidocs.net/29 # import mod # print(mod.add(10, 20)) # print(mod.sub(20, 10)) from mod import * import sys print(add(10, 20)) print(sub(20, 10)) print(PI) a = Math() print(a.solv(2)) print(sys.path)
# Enter your code here. Read input from STDIN. Print output to STDOUT # This works but is super-slow. Not sure about the faster solution. # Enter your code here. Read input from STDIN. Print output to STDOUT from math import ceil, floor, sqrt t = int(raw_input()) for _ in xrange(t): min, max = map(int, raw_input()...