text
stringlengths
8
6.05M
import cv2 import numpy as np import matplotlib.pyplot as plt import random from numpy.core.fromnumeric import reshape from numpy.lib.type_check import imag import weight_mask from skimage import io from scipy import ndimage from scipy.signal import convolve2d from scipy.signal import wiener import math import pywt im...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import random # a_list = [1,2,3] # print(sum(a_list)) # input_result = input("Big or Small:") # a_list = [] # point1 = random.randrange(1,7) # point2 = random.randrange(1,7) # point3 = random.randrange(1,7) def roll_dice(numbers=3,points=None): print("<<<<< ROLL THE ...
#!/usr/bin/env python # coding: utf-8 # # P4 Panoramas and Stereo # ## P4.1 Spherical Reprojection # # As we discussed in class, to make a panorama we need to reproject the images onto a sphere, something you will be implementing in this question. I have given you some starter code that you should use to reproject t...
#!/usr/bin/python3 print("content-type:text/html") print() import cgi import subprocess f=cgi.FieldStorage() cmd=f.getvalue("x") a=subprocess.getoutput("sudo " + cmd) print(a)
from roboclaw import * def counterClockwise(speed): M1Forward(128, speed) M2Forward(128, speed) M2Forward(129, speed) def clockwise(speed): M1Backward(128, speed) M2Backward(128, speed) M2Backward(129, speed) def right(): M1Backward(128, 60) M2Backward(128, 60) M2Forward(129, 1...
#ASSIGNMENT6 #QUESTION:1 Take 10 integers from the user and print it on the screen. #SOLUTION: l=[] for n in range(0,10): l.append(int(input("enter the integer: "))) print(l) #QUESTION:2 Write an infinite loop.An infinite loop never ends.Condition is always true. #SOLUTION: #...
#!/usr/bin/python3 import numpy as np from cpa import CPA traces_file="traces_capdir58/knownrand_fixed/knownrand_fixed_P58_data/traces/2016.06.01-11.54.29_traces.preprocessed.npy" key_file="traces_capdir58/knownrand_fixed/knownrand_fixed_P58_data/traces/2016.06.01-11.54.29_keylist.npy" plaintext_file="traces_capdir58/...
class Employee(): def __init__(self,last_name,first_name,salary): self.first_name=first_name self.last_name=last_name self.salary=salary def give_raise(self,increment=0): self.salary=5000 self.salary+=increment
from ..models import Dish from django.forms import ModelForm from django.forms import Select, TextInput class DishForm(ModelForm): class Meta: model = Dish fields = '__all__' widgets ={ 'name':TextInput(attrs={'class': 'form-control mr-3'}), 'unit':Select(attrs={'cla...
import os import requests from qubell.api.private.testing import environment, instance, values from qubell.api.tools import retry from testtools import skip from test_runner import BaseComponentTestCase def eventually(*exceptions): """ Method decorator, that waits when something inside eventually happens ...
import cv2 import numpy as np import tensorflow as tf from collections import defaultdict from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip def read_labels(filename='../tensorflow/labels.txt'): # Read label file label_file = open(filename, 'r') labels = label_file.read().split() label_f...
from sqlalchemy.orm import Session from . import models, schemas def get_player(db: Session, player_id: int): return db.query(models.Player).filter(models.Player.id == player_id).first() def get_players(db: Session, skip: int = 0, limit: int = 100): return db.query(models.Player).offset(skip).limit(limit)....
import json import re import os import numpy as np import scipy.stats as stats import pandas as pd import datetime as dt folder = 'Analysed_Data/' lumis = ['PLT','HFLumi', 'BCM1F', 'HFLumiET'] fillr = 'output(\d+).*\.json' dirs = [i for i in os.listdir(folder) if i[0] != 'F' and int(i[:4]) >= 5718] cols = ['timesta...
locations = { (0,0): 'house', (0,1): 'lake', (1,0): 'park', (1,1): 'market', } description = { (0,0): "A BIG DARK HOUSE WITH NO LIGHTS", (0,1): 'A LAKE USED FOR DUMPING RUBBISH', (1,0): 'A SUNNY PARK FULL OF PEOPLE', (1,1): 'A MARKET FULL OF FOOD STALLS', } items = { (0,0): 'ca...
from os import listdir from os.path import isfile, join from ofxparse import OfxParser import pandas as pd import numpy as np from decimal import Decimal import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec UNCATEGORIZED = 'uncategorized' def load_ofxs(path): files = [] for f in listdir(pa...
from Jumpscale import j import netaddr import ipaddress def chat(bot): """ """ user_info = bot.user_info() name = user_info["username"] email = user_info["email"] ips = ["IPv6", "IPv4"] default_cluster_name = name.split(".3bot")[0] expiration = j.data.time.epoch + (60 * 60 * 24) # for...
#!/usr/bin/env /data/mta/Script/Python3.8/envs/ska3-shiny/bin/python ################################################################################################# # # # hrma_plot_trends.py: create hrma src data tren...
from collections import defaultdict import cv2 import numpy as np from matplotlib import pyplot as plt from maximumIndependentSet import MaximumIndependentSet from occupancyGrid import OccupancyGrid from utils import Direction, Point, Submap class GridSubmapper: def __init__(self, occ_grid): self.occ_grid = ...
""" A) A dezena mais frequente B) A dezena menos frequente C) Tabela de frequencias de dezenas D) Tabela de frequencias de duplas dezenas E) Tabela de frequencias de triplas dezenas """ import libplnbsi from operator import itemgetter def combina(listaDezenas, qtd, dicDezenas): i = 0; j = 0 while i < len(listaD...
# -*- coding: utf-8 -*- """ Created on Mon Dec 3 15:52:21 2018 @author: Administrator """ import socket import threading import time import struct import queue import serial import numpy as np from scipy import signal from ringbuf import RingBuffer import matplotlib.pyplot as plt from matplotlib import animation f...
import gym from gym_recording.playback import scan_recorded_traces import numpy as np import os import tensorflow as tf import matplotlib.pyplot as plt from collections import defaultdict from pprint import pprint from dps import cfg from dps.datasets import Dataset, ImageDataset, ArrayFeature, ImageFeature from dps.u...
import argparse import os import sys import pandas as pd import numpy as np import pickle import sagemaker_containers import torch import torch.nn as nn import torch.optim as optim import torch.utils.data import torch.nn.functional as F from io import StringIO from six import BytesIO # import model from model import...
visa_free_countries_string = ''' Azerbaijan (up to 90 days) Albania (up to 90 days) Antigua and Barbuda from 29 June 2018 of the year (up to 90 days for 180 days) Argentina (up to 90 days) Armenia Belarus Bosnia and Herzegovina (up to 30 days). You may need tickets back, host invitation or travel voucher. Brazi...
# Generated by Django 2.1 on 2018-08-22 18:17 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('basic_app', '0013_remove_userprofileinfo_questions'), ] operations = [ migrations.RemoveField( model_name='questions', ...
import numpy as np from numpy.linalg import solve import findMin from scipy.optimize import approx_fprime import utils class logReg: # Logistic Regression def __init__(self, verbose=0, maxEvals=100): self.verbose = verbose self.maxEvals = maxEvals self.bias = True def funObj(self, ...
# Copyright 2023 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). import sys import pytest from pants.build_graph.address import Address from pants.core.target_types import FileTarget from pants.core.util_rules import adhoc_binaries from pants.core.uti...
# -*- coding: utf-8 -*- # MLC (Machine Learning Control): A genetic algorithm library to solve chaotic problems # Copyright (C) 2015-2017, Thomas Duriez (thomas.duriez@gmail.com) # Copyright (C) 2015, Adrian Durán (adrianmdu@gmail.com) # Copyright (C) 2015-2017, Ezequiel Torres Feyuk (ezequiel.torresfeyuk@gmail.com) # ...
from node import Node class SplayTree: def __init__(self): self._nil = Node() self._root = self._nil def _successor(self, local_root: Node) -> Node: succ = local_root if succ.right is not self._nil: succ = self._min(succ.right) else: while succ...
import scrapy from scrapy.linkextractors import LinkExtractor from scrapy.spiders import CrawlSpider, Rule from redis import Redis from zlsPro.items import ZlsproItem class MovieSpider(CrawlSpider): name = 'movie' # allowed_domains = ['www.xxx.com'] start_urls = ['http://www.4567kan.com/frim/index5.html'] ...
n,k = int(input()),int(input()) xx = list(map(int,input().split())) ans = 0 for x in xx: if k-x > x: ans += x*2 else: ans += (k-x)*2 print(ans)
"""tool for reconstructing a cryptarchive index.""" import sys import json import re import os from cryptarchive.index import Index def find_all_ids(s): """find all ids in s.""" q = r'\"id\": ?\"[0-f]+' # q = r'\"id\": ?\"[a-zA-Z0-9/_\- \(\)]+' matches = re.findall(q, s) result = [] for m in ...
# -*- coding: utf-8 -*- # import os # import random # import urllib #import json # from django.utils import simplejson as json # import pickle # from google.appengine.ext.webapp import template #import cgi # from google.appengine.api import users # from google.appengine.ext import webapp # from google.appengine.ext.web...
from datetime import date, timedelta def u_to_g(d): if d < date(1582, 10, 5): g_date = d elif date(1582, 10, 5) <= d < date(1700, 2, 28): g_date = d + 10 elif date(1700, 3, 1) <= d < date(1800, 2, 28): g_date = d + 11 elif date(1800, 3, 1) <= d < date(1900, 2, 28): g_dat...
import numpy as np import cv2 img = cv2.imread('images/model.png') cv2.imshow('original', img) subimg = img[200:300, 200:400] cv2.imshow('cutting', subimg) #200~300 행과 200~400열을 ROI로 잡는다. img[100:200, 100:300] = subimg #잘라낸 subimg를 해당 좌표에 집어 넣는다. print(img.shape) print(subimg.shape) cv2.imshow('modified', img) #수정된 ...
# coding: utf-8 # # Problem 7 # # **Letter frequencies.** This problem has three (3) exercises worth a total of ten (10) points. # Letter frequency in text has been studied in cryptoanalysis, in particular frequency analysis. Linguists use letter frequency analysis as a rudimentary technique for language identifica...
import datetime import json import random import time import traceback # import faker import requests # from tqdm import tqdm import os # Data source: # https://raw.githubusercontent.com/BlankerL/DXY-COVID-19-Data/master/json/DXYArea-TimeSeries.json # fake = faker.Factory.create("zh-CN") # api = "http://8.210.248.203...
#!/usr/bin/env python3 # -*- encoding: utf-8 -*- # File: osc4py3/as_comthreads.py # <pep8 compliant> """Use of osc4py3 in own created threads for communication. Functions defined here allow to use OSC with a mixed scheduling whehre communications and encoding/decoding are realized in background threads, but methods ca...
from base64 import b64encode from datetime import datetime from manticora.models.database_functions.account import ( query_user_accounts_by_user, query_account_by_id, find_all_extrato, query_all_account_in_rest, change_status, query_all_requests_from_user) from manticora.models.database_function...
from django.contrib import admin from django.http import HttpRequest from django.http import HttpResponse from django.urls import path from task4.views import view def hello_world(request: HttpRequest): return HttpResponse("hello world") urlpatterns = [ path('admin/', admin.site.urls), path("hw/", hello...
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # 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 applicab...
# The logger subscribes to various topics and creates a local and remote log from mqtt_client import MQTT_Client from hbmqtt.mqtt.constants import QOS_1 import asyncio # For making GET/POST request to WEB import requests # For structuring data import json # Configuration of TOPICS and addresses from config import * ...
from spack import * class Yoda(Package): url = "http://cern.ch/service-spi/external/MCGenerators/distribution/yoda/yoda-1.6.5-src.tgz" version('1.6.5', '634fa27412730e511ca3d4c67f6086e7') depends_on('root') depends_on('py-cython', type='build') def install(self, spec, prefix): with working...
# Types from OFP STR = "String" ARRAY = "Array" BOOL = "Boolean" GROUP = "Group" NUM = "Number" OBJ = "Object" SIDE = "Side" # Types from ARMA CODE = "Code" CONF = "Config" CTRL = "Control" DISP = "Display" SCRPT = "Script(Handle)" STRUCTURED = "Structured Text" # Types from ARMA2 DIARY = "Diary_Record" TASK = "Task...
#!/usr/bin/python2 #coding=utf-8 #The Credit For This Code Goes To lovehacker #If You Wanna Take Credits For This Code, Please Look Yourself Again... #Reserved2020 import os,sys,time,datetime,random,hashlib,re,threading,json,urllib,cookielib,requests,mechanize from multiprocessing.pool import ThreadPool from requests...
#Use backtracking to generate binary strings of a n bit binary string A=[None]*3 def binaryStrings(n): #print "Hello" if (n<1): print A return A[n-1]='0' binaryStrings(n-1) A[n-1]='1' binaryStrings(n-1) binaryStrings(3)
# -*- coding: utf-8 -*- """ 语言版本: python:3.7 scrapy:1.6 功能:不使用正则表达式,改用scrapy爬取段子. """ import scrapy class DuanZiSpider(scrapy.Spider): name = "duanSpider" allowed_domains = ["duanziwang.com"] start_urls = ['http://duanziwang.com/category/经典段子/'] def parse(self, response): duanzi_list = respon...
import sys,os,time import PLstats from PyQt4 import QtCore, QtGui, uic,QtSql from PLtable_auto import * import sqlite3 import PLpoints_mod import PLresults_mod class MyWindowClass(QtGui.QMainWindow, Ui_MainWindow): def __init__(self, parent=None): for j in range(1,2,1): QtGui.QMainW...
# -*- coding: utf-8 -*- """ Created on Mon Apr 20 12:42:14 2020 @author: insun """ import re,string from nltk.tokenize import word_tokenize from RealOrNot.code import engAbbrCorpus abbreviations = engAbbrCorpus.abbreviations contractions = engAbbrCorpus.contractions class DataClean : def __init__(self, datafram...
# -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt import math J = 2 # Cout du jeton # Si modif des valeurs, garder la 3 en meilleure machine ou adapter l'algo du regret def testGain(k) : if k == 1 : mu = 0.2 elif k == 2 : mu = 1.2 elif k == 3 : mu = 1.5 ...
import pyupbit import numpy as np # OHLCV(open, high, low, close, volume)로 당일 시가, 고가, 저가, 종가, 거래량 데이터 취득 df = pyupbit.get_ohlcv("KRW-XRP", count=3) # # 전략부분 # 변동성 돌파 기준 범위 계산 (고가 - 저가) * k값 df['range'] = (df['high'] - df['low']) * 0.5 # target(매수가), range 컬럼을 한칸씩 밑으로 내림 (shift(1)) df['target'] = df['open'] + df['ran...
APPLICATION_NAME = 'stag.datalink_v2.streaming' APPLICATION_VERS = "1.0.0"
# Data Preprocessing final steps # Importing the libraries import numpy as np import matplotlib.pyplot as pyplot import pandas as pd # Importing the dataset dataset = pd.read_csv("Data.csv") # Matrix of features x = dataset.iloc[:, :-1].values # IV array y = dataset.iloc[:, -1].values # Taking care of missing data f...
"""Initial migration. Revision ID: 57ef1a3f1d22 Revises: Create Date: 2021-01-21 17:15:13.816196 """ from alembic import op import sqlalchemy as sa import sqlalchemy_utils # revision identifiers, used by Alembic. revision = '57ef1a3f1d22' down_revision = None branch_labels = None depends_on = None def upgrade():...
import sys def solution(): # input # points : (duration - T) + bonus duration, inter_n, street_n, car_n, bonus = map(int, input().split()) adj = [list() for _ in range(inter_n)] name_to_street = {} street_count = {} cars = [] for _ in range(street_n): s, e, name, L = input().spl...
import json import torchvision import numpy as np import os import torch from torch.utils.data import Dataset from PIL import Image from augmentations import SobelTransform from functools import reduce def compute_weight_map(mask: torch.tensor): """ Computes a weight map for a given mask, to balance am...
from __future__ import division import os from astropy.io import ascii data_sequence = 'all' GRB_name = 'GRB190114C' model_name = 'CPL+BB_'+data_sequence #change if you want to change the time pulse bin, also change if you change the SNR # Read PHA files from an ascii file listed in table pha_files = ascii.read...
import heapq class Solution: # @param A : list of integers # @param B : list of integers # @return a list of integers def solve(self, A, B): size = len(A) A.sort(reverse=True) B.sort(reverse=True) heap = [] for anum in A: for bnum in B: ...
[<name>] username = password =
n,m=input().split() n1,m1=input().split() n=int(n) m=int(m) n1=int(n1) m1=int(m1) print(abs(n-n1),abs(m-m1))
from src.reddit_handler import RedditHandler from src.polarization_classifier import PolarizationClassifier from src.textstatistics_generator import TextStatisticGenerator out_folder = 'RedditHandler_Outputs' extract_post = True # True if you want to extract Post data, False otherwise extract_comment = True # True if...
#Created on 1/23/2015 #@author: rspies # Python 2.7 ###################################################################################################### #This script contains several functions for calculating error statistics: #1 pct_bias: percent bias #2 nash_sut: nash sutcliffe #3 ma_error: mean absolute e...
def firstFit(capacity, weights): binlist = [] for weight in weights: foundBin = False for bin in range(len(binlist)): if binlist[bin] >= weight: binlist[bin] -= weight foundBin = True break if foundBin == False: bin...
# Bài 10: Cho list sau: ["www.hust.edu.vn", "www.wikipedia.org", "www.asp.net", "www.amazon.com"] # Viết chương trình để in ra hậu tố (vn, org, net, com) trong các tên miền website trong list trên. my_list = ["www.hust.edu.vn", "www.wikipedia.org", "www.asp.net", "www.amazon.com"] my_tuple = [] for i in my_list : ...
""" This module demonstrates the ACCUMULATOR pattern in three classic forms: SUMMING: total = total + number COUNTING: count = count + 1 IN GRAPHICS: x = x + pixels Authors: David Mutchler, Valerie Galluzzi, Mark Hays, Amanda Stouder, and their colleagues. September 2015. """ # --------...
#!/usr/bin/env python """ Tool for debugging the dependence of a rpy2 RandomForest classifier on various features in order to determine/debug mismatched of noisy featutes. TODO: - should use two different Debosscher arff, with features generated from differeing algorithms. - Should be able to disable certain fe...
#!/usr/bin/env python """ """ import os from util import libtool, liblogger import ujson as json from collections import defaultdict import math #=== file settings === using_cache = bool(os.environ["using_cache"]) lex_count_dict = json.load(open(os.environ["lex_count_dict_file"])) converted_file = os.environ["conver...
#!/usr/bin/env python2.7 """Facilitates the measurement of current network bandwidth.""" import collections class Bandwidth(object): """Object containing the current bandwidth estimation.""" def __init__(self): self._current = 0 self._previous = 0 self._trend = collections.deque(max...
import pytest from dict import locators from selenium import webdriver import time @pytest.fixture(scope="session") def driver(): driver = webdriver.Chrome('C:/Python34/Lib/site-packages/selenium/webdriver/common/chromedriver') return driver def test_togo(driver): driver.get(locators['url']) ...
import numpy as np import os import json import re from collections import Counter from nltk.corpus import stopwords from time import time english = stopwords.words('english') class Data(object): def __init__(self): self.vocab = [] self.keys_vocab = [] self.index_map = {} self....
from calendar import weekday DAYS = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] def most_frequent_days(year): beg = weekday(year, 1, 1) end = weekday(year, 12, 31) return DAYS[beg:end + 1] if beg <= end else DAYS[:end + 1] + DAYS[beg:]
import requests import openpyxl import json import os book = openpyxl.Workbook() for vol in range(1, 55): print(vol) type = "all" prefix = "https://raw.githubusercontent.com/nakamura196/genji_curation/master/docs/iiif" prefix2 = "/Users/nakamurasatoru/git/d_genji/genji_curation/docs/iiif" url =...
from django.shortcuts import render from django.contrib import auth from django.http import HttpResponseRedirect # 會員登入 login_action、redirect to main if member exist def member_login(request): if request.user.is_authenticated: if request.session.get("as") == "student": return HttpResponseRedir...
''' I really wanna finish this lab here is docstring ''' import ngrams.ngram_trie as ngrams from lab_4.main import WordStorage from lab_4.main import encode_text from lab_4.main import decode_text from lab_4.main import NGramTextGenerator from lab_4.main import LikelihoodBasedTextGenerator from lab_4.main import BackOf...
# -*- coding: utf-8 -*- """ Created on Thu Jan 22 22:22:55 2015 @author: lenovo """ """ 优势: 可以使一个蕴含递推关系且结构复杂的程序简洁精练,增加可读性 特别是在难于找到从边界到解的全过程的情况下,如果把问题推进一步,其结果仍然维持原问题的关系 劣势: 嵌套层次深,函数调用开销大 重复计算 """ """ 汉诺塔问题 """ count = 0 def hanoi(n,A,B,C): global count if n == 1: print "Move disk",n,...
""" Random Walker or Drunkard's Walk is the Programg where a Drunkard is in the middle of the city laid out like a grid. Drunkard is taking random choice to move in East, West, North or South. Drunkard starts from Origin(0,0) and makes a random choice to move to East, West, North or South Direction. Let's...
import math def union(R, S): return R + S def difference(R, S): return [t for t in R if t not in S] def intersect(R, S): return [t for t in R if t in S] def project(R, p): return [p(t) for t in R] def select(R, s): return [t for t in R if s(t)] def product(R, S): return [(t,u) for t in R ...
from django.urls import path,include from . import views from rest_framework import routers from rest_framework.urlpatterns import format_suffix_patterns router = routers.DefaultRouter() router.register('items',views.ItemsView) urlpatterns = [ path('',include(router.urls)), ]
numeroDePessoas = int(input()) pessoas = input().split(' ') menor = pessoas.copy() menor.sort() menor = menor[0] print( str (pessoas.index(menor) + 1 ) )
from django.db import models from workprogramsapp.models import Topic, WorkProgram from django.conf import settings class AdditionalMaterial(models.Model): """ Материалы тем """ topic = models.ForeignKey('Topic', on_delete=models.CASCADE, verbose_name='тема рабочей программы', ...
import temp import time print("Press CTRL-C to interupt within 5 seconds") for _ in range(5): print(".") time.sleep(1) temp.main()
import logging import sys requests_log = logging.getLogger("requests.packages.urllib3") requests_log.setLevel(logging.DEBUG) requests_log.propagate = True class ExitOnCriticalHandler(logging.StreamHandler): def emit(self, record): super().emit(record) if record.levelno is logging.CRITICAL: ...
#!/usr/bin/env python import re import sys import binascii from struct import unpack from .helpers import * def analyze(fp): fp.seek(0) while not IsEof(fp): line = dataUntil(fp, b'\x0a', 1).decode('utf-8') m = re.match(r'^:(..)(....)00(.*)(..)', line) if m: (count...
from django import template from stories.models import Comment register = template.Library() @register.simple_tag def get_verbose_field_name(instance, field_name): """ Returns verbose_name for a field. """ return instance._meta.get_field(field_name).verbose_name.title() @register.simple_tag def g...
# This program will open a .txt file, change the format of the strings in this file # and then write the reformatted strings into a new .txt file def main(): print("This program converts an all lower case text file to all capital letters") input= open('Before.txt',"r") output= open('After.txt', "w") f...
from flask import Flask, render_template from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager from flask_oauthlib.client import OAuth import os import markdown app = Flask(__name__) if "DEBUG" in os.environ: app.config.from_object("config.Config") elif "TESTING" in os.environ: app.conf...
from random import randint numero = randint(0,5) resp = int(input('Digite o número que o computador pensou:')) if numero == resp: print('Parabéns você acertou!') else: print('Que pena você errou feio!! errou rude')
# 生成一个随机字符串 # 密钥定为 043 import os import hashlib import socket sk = socket.socket() sk.bind(('127.0.0.1',43)) sk.listen() conn,addr = sk.accept() ret = os.urandom(32) #生成一个 参数长度 的随机字符串 print(ret) conn.send(ret) sha = hashlib.sha1(b'043') sha.update(ret) yanzheng = sha.hexdigest() yansheng2 = conn.recv(1024).deco...
import os import sys import yaml from bioblend import toolshed """ A simple program to update the tool revisions in a tools.yml file. The program will either replace the list of revisions with just the latest revision available on the ToolShed, or append the latest revision (if a newer revision is available) to the e...
#!/usr/bin/env python3 #coding:utf-8 from main import Run def t(): r = Run() r.main()
# -*- coding: utf-8 -*- import json import time from appium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By from appium.webdriver.common.touch_action import TouchAction import os import ...
import os #manipulate files with open("mydata.txt", mode="w", encoding="utf-8") as myFile: #a for append myFile.write("some random text\nMore random filestext\n") with open("mydata.txt", encoding="utf-8") as myFile: #read() readline() readlines() print(myFile.read()) print(myFile.closed) print(myFile.name)...
#!/usr/bin/env python import pytraj as pt traj = pt.iterload('./RAN.rst7', './RAN.parm7') t0 = traj[:] flist = [] for deg in range(-180, 175, 5): pt._rotate_dih(t0, resid='1', dihtype='chin', deg=deg) flist.append(t0[0].copy()) print(pt.calc_chin(flist, top=t0.top)) pt.write_traj('combined_traj.nc', flist, ...
import requests import json import csv import datetime # Modify these to suit your needs TOKEN = "YOURTOKEN" COMMUNITY = "YOURCOMMUNITYID" DAYS = 14 # No need to modify these GRAPH_URL_PREFIX = "https://graph.facebook.com/" GROUPS_SUFFIX = "/groups" # Default paging limit for Graph API # No need to modify, unless yo...
import os, pickle, pyaes, sys, random, pycurl key = "This_key_for_demo_purposes_only!" aes = pyaes.AESModeOfOperationCTR(key) #size of the database dbsize=20000 #size of elements elesize=10 def deciph(ciphertext): return aes.decrypt(ciphertext) #size of partition partisize = int(sys.argv[1]) size_buc =1 rr=random....
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Filename: step06_run_weilbull_hazard_test # @Date: 2020/3/25 # @Author: Mark Wang # @Email: wangyouan@gamil.com """ python -m ConstructRegressionFile.Stata.step06_run_weilbull_hazard_test """ import os from Constants import Constants as const if __name__ == '__main_...
import os import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.patches as patches from skimage import io, img_as_uint from skimage.morphology import skeletonize, medial_axis, skeletonize_3d from skimage.measure import regionprops, label from skimage.filters import threshold_otsu fr...
#------------------------------------------------------------------------------------------------ # Flight time and delay predictor # Description: Simple python script that runs a regression to predic actual flight time # and probability of delay of airlines by route # Creation Date: Nov 23, 2016 #------...
# Admin Request Handler # Manager for adding books and configure database # Later will support users manage import logging import tornado.web class IndexHandler(tornado.web.RequestHandler): """ Admin page Index Request Handler """ def get(self): self.write("Hello I am admin manager") cl...
print("Hello World! I am Joel Okpara")
from django.db import models class Contact(models.Model): # primary_key id = models.AutoField(auto_created=True, primary_key=True) # contact_type = models.CharField(max_length=32, verbose_name="문의 유형") contact_type = models.CharField(max_length=32, verbose_name="문의 유형") # contact_user = models.For...