text
stringlengths
8
6.05M
""" commons.py Author: Jan Zahalka (jan@zahalka.net) Common utility functions used by various parts of the system. """ import time def t(): """ A timestamp for printouts. Returns ------- str The timestamp. """ return "[" + str(time.strftime("%d %b, %H:%M:%S")) + "]" def tf(s...
""" This module contains functions that help rank airbnb comment topic vectors by similarity to user input. That is, when views.py calls `Calculate_similarities` This function in turn calls helper functions in this module. The inputs are a string (representing the yourbnb.xyz user's preferences), a pandas series of t...
""" ======================= Statistical Analysis ======================= The MOABB codebase comes with convenience plotting utilities and some statistical testing. This tutorial focuses on what those exactly are and how they can be used. """ # Authors: Vinay Jayaram <vinayjayaram13@gmail.com> # # License: BSD (3-clau...
from game.items.item import Hatchet from game.skills import SkillTypes class SteelHatchet(Hatchet): name = 'Steel Hatchet' value = 200 skill_requirement = {SkillTypes.woodcutting: 6} equip_requirement = {SkillTypes.attack: 20} damage = 122 accuracy = 316
# -*- coding:utf-8 -*- class Solution: def findBestValue(self, arr: list, target: int) -> int: arr.sort() less_idx = -1 for i in range(0, len(arr)): the_sum = sum(arr[0:i]) + arr[i] * (len(arr)-i) if the_sum >= target: break else: ...
import cv2 import imutils import time import numpy as np # Show debug info debug = True # if false an image of an dog is shown showVideo = True # set frame size FrameWidth = 1280 FrameHeight = 720 # time to remind the user to smile smileReminder = 15 # time the user has to smile timeToSmile = 10 # Get webcam cam...
# coding=utf-8 from django.db.models.query import QuerySet from django.db.models.sql.query import Query from django.http import HttpResponseRedirect, HttpResponse from django.views.generic.edit import CreateView, UpdateView from django.shortcuts import render_to_response, redirect from django.views.generic.list ...
import sys, getopt, re from subprocess import Popen, PIPE, STDOUT opts = getopt.getopt( sys.argv[1:], 'f', ['file'] ) try: file = opts[1][0] except: print '-f (--file) must be specified with a valid file path' sys.exit( 2 ) stdout = Popen( '/usr/local/bin/ffmpeg -i '+file, shell=True, stdout=PIPE, stderr=STDOUT ...
import requests from bs4 import BeautifulSoup import re import csv from janome.tokenizer import Tokenizer information=[] html=requests.get('http://recipe.hacarus.com/') soup=BeautifulSoup(html.text,'html.parser') for news in soup.findAll('li'): # 各メニューのURLを取得する html2=requests.get('http://recipe.hacarus.com'+...
# !/usr/bin/python """ ----------------------------------------------- Bardel Shot Light Core Written By: Colton Fetters Version: 1.2 First release: ----------------------------------------------- """ # Import module import os.path import maya.OpenMaya as om import maya.cmds as cmds import maya.mel as mel ...
userinput = raw_input("welcome to the chatbot... ") #this input will be changed once integrated with other code shopsDict = ['Wilkinsons', 'SPAR', 'Boots', 'Marks & Spencers' ] clothingDict = ['Topshop', 'Topman', 'H&M', 'Riverisland', 'Debenhams', 'JD', 'Sportsdirect', 'Footlocker', 'Primark', 'Newlook' ] upcomingGam...
# Mostra a média de duas notas (com 1 casa decimal) n1 = int(input('Digite a nota 1: ')) n2 = int(input('Digite a nota 2: ')) print('A média das notas {} e {} é {:.1f}'.format(n1, n2, (n1+n2)/2))
#-*- coding:utf8 -*- import time import datetime import json from celery.task import task from celery.task.sets import subtask from django.conf import settings from common.utils import update_model_fields, replace_utf8mb4 from .models import WeiXinUser,WXOrder,WXProduct,WXProductSku,WXLogistic,WeixinUnionID from .serv...
f = open("one.txt", "r") print(f.read()) print() f = open("one.txt", "r") print(f.readline()) print(f.readline()) f = open("one.txt", "r") print(f.read(10))
import os import config from sklearn.model_selection import KFold import numpy as np from collections import defaultdict import math # Leave one subject out # data_format: # image_path label1,label2,?label_ignore1,?label_ignore2 #/orig_img_path BP4D/DISFA # tab split, #/orig_img_path means '#': orignal im...
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html import json from twisted.enterprise import adbapi from hashlib import md5 import MySQLdb.cursors import logging log = logging....
from terminaltables import AsciiTable from colorclass import Color def colored_status(status, text): if status == u'passed': return Color('{autogreen}%s{/autogreen}' % text) elif status == u'skipped': return Color('{autocyan}%s{/autocyan}' % text) else: return Color('{autored}%s{/a...
""" wraper api for native os """ import os from mamp_cli.base import ApiBase class OsApi(ApiBase): def __init__(self, config: Config): pass
# Generated by Django 2.1.7 on 2019-03-30 22:29 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('budget', '0027_auto_20190329_0719'), ] operations = [ migrations.AlterModelOptions( name='subcategory', options={'ordering':...
from django.db import models # Create your models here. class orderDetails_db(models.Model): timestamp = models.DateTimeField(auto_now=True) rollNo = models.IntegerField(); itemName = models.CharField(max_length = 100) company = model.CharField(max_length=1, choices=[ 'zomato':'Zomato...
# a easy String test def findComplement(num): """ :type num: int :rtype: int """ bit_str = bin(num)[2:] result = [] for i in bit_str: if i == '0': result.append('1') else: result.append('0') ''.join(result) return int(''.join(result), 2) if _...
# Natural Language Processing With Python and NLTK p.1 Tokenizing words and Sentences # import nltk from nltk.tokenize import sent_tokenize, word_tokenize # tokenizing - word tokenizer... sentence tokenizer = way of splitting strings # lexicon and corporas # corpora - body of text. ex: medical journal, presidential s...
### Gap Statistics Function ### Input: X = read_csv() ### Outputs: ks, Wks, Wkbs, sk ### Wks and Wkbs are logarithmic from numpy import genfromtxt import numpy as np import random from numpy import zeros def bounding_box(X): xmin, xmax = min(X,key=lambda a:a[0])[0], max(X,key=lambda a:a[0])[0] y...
from django.test import TestCase from django.contrib.auth.models import User from .models import User as UserModel, AccountDetail, Transaction from rest_framework.test import APIClient from rest_framework import status from django.urls import reverse from faker import Faker class ModelTestCase(TestCase): """Class...
from django.db import models class Rsa(models.Model): """ 秘钥 """ status_choices = ( (1, '启用'), (2, '停用'), ) status = models.PositiveSmallIntegerField(verbose_name='状态', choices=status_choices) user = models.CharField(verbose_name='用户', max_length=32, default='root') private_key...
import time import os import yaml import pygame from pygame.locals import * import owr_screenplay import owr_behavior def HandleScreenplayViewportSelectInput(self, game): """Extending out Core's input handler""" # If they hit ESC, clear selection if self.input.IsKeyDown(K_ESCAPE, once=True): game.ui_se...
# coding: utf-8 import torch import torch_interpolations import numpy as np import matplotlib.pyplot as plt points = [torch.arange(-.5, 2.5, .2) * 1., torch.arange(-.5, 2.5, .2) * 1.] values = torch.sin(points[0])[:, None] + 2 * torch.cos(points[1])[None, :] + torch.sin(5 * points[0][:, None] @ points[1][None, :]) gi ...
# Created by @RGuitar96 using @sethoscope heatmap and Tweepy library for the Twitter API # Dependencies: # pip install tweepy # pip install textblob import json from tweepy import Stream from tweepy import OAuthHandler from tweepy.streaming import StreamListener ckey = 'HS38Z8lPuAiaOcogMVybFBtzR' ...
from django.shortcuts import render, redirect from django.views.generic import CreateView from django.urls.base import reverse_lazy from django.contrib.messages import success, error # Create your views here. from account.models import Customer from .models import OrderItem, Order from .forms import CheckoutForm from...
import json new_data = [] # Loading or Opening the json file with open('universities.json') as sfile: file_data = json.load(sfile) for item in file_data: # print(item) new_item = {} new_item["name"] = item.get("name") new_item["website"] = item.get("web_pages")[0] prin...
import numpy as np class SFT(object): def __init__(self, sigma=0.1): self.sigma = sigma def __call__(self, emb_org): emb_org_norm = np.linalg.norm(emb_org, 2, 1).reshape((-1, 1)).clip(min=1e-12) emb_org_norm = emb_org / emb_org_norm W = np.matmul(emb_org_norm, emb_org_norm.T) ...
import os from pyspark.sql import SparkSession from pyspark.sql.functions import col, desc if __name__ == "__main__": spark = SparkSession.builder.appName("SparkSQLExampleApp").getOrCreate() csv_file = f"{os.path.dirname(os.path.realpath(__file__))}/data/departuredelays.csv" df = ( spark.read.fo...
from django import forms # forms go here class birthdayEmailForm(forms.Form): message = forms.CharField(widget=forms.Textarea, max_length=1000)
""" Solution 1: keep a stack, which is allways increasing. each time it comes to a lower number x, compute area based on now idx and count, set all bigger int to x and push them back to stack s Solution 2: dp solution keep a most left and most right dp array to keep the left and right bound for each point trick poin...
# -*- coding: utf-8 -*- """ Created on Fri Jan 08 11:16:09 2016 @author: David astro598algorithms lecture, file myprogram.py """ import mymath a = mymath.Complex(1.0,2.0) b = mymath.Complex(3.0,4.0) c = mymath.Complex.add(a,b) print c.real print c.imag
class Solution: def cnt(self, s): if len(s) == 1: if (s == "*"): return 9 elif (s == "0"): return 0 else: return 1 elif len(s) == 2: if (s[0] == "0"): return 0 if (s[0] == "1")...
from django.forms import ModelForm, inlineformset_factory from .models import BillHeader, BillLines class BillHeaderForm(ModelForm): class Meta: model = BillHeader fields = ['company_name', 'street_address', 'city', 'state', 'phone', 'email'] BillLineFormSet = inlineformset_factory(BillHeader, Bi...
from django.conf.urls.defaults import patterns, url urlpatterns = patterns('shopapp.jingdong.views', url(r'login/$', 'loginJD', name='login_jd'), url(r'login/auth/$', 'loginAuthJD', name='login_auth_jd'), )
import csv def nameParser(s): res = ""; addSpace = False; for char in s: if char.isalpha(): addSpace = True; res += char; elif addSpace and char != '\'': res += ' ' addSpace = False; return res; writer = open("schoolByYear.csv",...
from fastapi import FastAPI from fastapi.middleware.gzip import GZipMiddleware from fastapi.openapi.utils import get_openapi from loguru import logger from app.api.v1.api import api_router from app.core import settings from app.core.events import create_start_app_handler, create_stop_app_handler from app.views import ...
# -*- coding: utf-8 -*- """ Created on Tue Dec 4 15:10:32 2018 @author: home """ # while val in nums: # nums.remove(val) # res = len(nums) # return res #def solution(nums, val): # nums = list(filter(lambda x: x != val, nums)) # res = len(nums) # # return res ...
from django.db import models from accounts.models import User # Create your models here. class Animal(models.Model): kind = models.CharField(max_length=100) class Species(models.Model): species = models.CharField(max_length=100) animal = models.ForeignKey(Animal, on_delete=models.CASCADE, related_name="sp...
from __future__ import unicode_literals import pickle import pandas as pd import numpy as np from nltk.tokenize import word_tokenize from nltk import pos_tag from nltk.corpus import stopwords as stpwrd from nltk.stem import WordNetLemmatizer from sklearn.preprocessing import LabelEncoder from sklearn import model_selec...
#!/usr/bin/env python # encoding: utf-8 class read(object) : def __init__(self,num) : self.num = int(num) self.sumup = 0 def sum_up(self) : number = self.num while int(number) : self.sumup += number % 10 number //= 10 print ("%d的各位数总和是%d" % (se...
def multiple3or5(n): if n % 3 == 0 or n % 5 == 0: return True else: return False sum = 0 for i in range(1,1000): print ("checking", i) if multiple3or5(i): #print ("multiply ist im Ordnung", i) sum = sum + i #print ('sum is', sum) print (sum)
__author__ = 'timothyahong' class BaseVolumeEstimator(): pass class SimpleVolumeEstimator(BaseVolumeEstimator): def estimate(self, cap_values): return [ self._determine_volume(cap_value_row) for cap_value_row in zip(*cap_values) ] def _determine_volume(self, cap_value_row): ...
# Enter your code here. Read input from STDIN. Print output to STDOUT i, m = input(), set(map(int, input().split())) i, n = input(), set(map(int, input().split())) diff = sorted(m.symmetric_difference(n)) print(*diff, sep ='\n')
from .rangerlars import RangerLars optimizer = RangerLars(model.parameters(), lr=lr, weight_decay=weight_decay, betas=(adam_beta1, adam_beta2), )
import datetime import os from mongoengine import * from course.models import Course from user.models import Teacher # Create your models here. """ 资源实体类 """ class Resource(Document): id = SequenceField(primary_key=True) # 自增id name = StringField(max_length=100,default='资源标题') type = StringField(max_leng...
# python 3 # -*- coding: utf-8 -*- """ Created on Thu Jun 6 10:49:31 2019 @author: Prachi Singh """ import sys,os import copy import numpy as np from scipy import misc from scipy import ndimage import matplotlib.pyplot as plt from scipy.interpolate import UnivariateSpline from scipy.optimize import cu...
# Generated by Django 2.2.5 on 2019-11-11 11:20 import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('usermanagement', '0001_initial'), ] operations = [ migrations.AlterField( model_name='patient', name...
from .character_error_rate import character_error_rate from .word_error_rate import word_error_rate
#!/usr/bin/env python # XXX: clean up. # XXX: relative links to root are wrongly handled. # XXX: use option parser. # XXX: add template stuff 'extract urls from an html page' import htmllib import HTMLParser as xhtmllib import os import re import sys import urllib from formatter import NullFormatter def getSearchPa...
# -*- coding: utf-8 -*- import threading from collections import deque import os import zmq import zhelpers import zsync_utils from zsync_network import Transceiver, Proxy import config import logging import zlib from zsync_logger import MYLOGGER, log_file_progress class ZsyncThread(threading.Thread, Transceiver): ...
import math import matplotlib.pyplot as plt from local_pathfinding.msg import latlon from utilities import getDesiredHeading import numpy as np class State: def __init__(self, x, y): self.x = x self.y = y def getX(self): return self.x def getY(self): return self.y ''' posit...
""" The manage subscription views. """ import morepath from onegov.election_day import _ from onegov.election_day import ElectionDayApp from onegov.election_day.collections import UploadTokenCollection from onegov.election_day.forms import EmptyForm # from onegov.election_day.layouts import ManageUploadTokenItemsLayo...
from src.functions.Functions import Functions as Selenium import unittest import time class Test_006(Selenium, unittest.TestCase): def setUp(self): Selenium.abrir_navegador(self, "http://chercher.tech/practice/frames-example-selenium-webdriver") def test_006(self): Selenium.get_...
# Generated by Django 2.0.2 on 2018-02-27 17:29 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('tafaha', '0002_answer_image'), ] operations = [ migrations.AlterField( model_name='test', name='picture', ...
""" Class module prefDialog.py defining the PrefAutoDialog class thet builds automatically a simple Qt modal dialog for specifying application's preferences.""" # Imports from PyQt4.QtGui import * from PyQt4.QtCore import * from PyQt4.uic import * from application.lib.instrum_classes import * # DEBUGGER #*********...
from django.contrib.auth.forms import UserCreationForm, UserChangeForm from .models import CustomUser from django import forms class PhoneWidget(forms.MultiWidget): def __init__(self, code_l, n_l, attrs=None, *args): widgets = [forms.TextInput(attrs={'size':code_l, 'maxlength': code_l}), ...
from heapq import heapify, heappop heapp = heapify([]) print type(heapp)
from MAINTENANCEpack.PayMaintenance.PayOperation import PayOpe db=PayOpe class OpeValues: def values(self,no, pdate): ope = PayOpe() res = ope.show(no, pdate) print(res) if res==True: print("insert successfully") # ope.selectQuery() # ope...
import numpy as np import random import itertools class graph(): def __init__(self, visited=False, id=None, adjacent=None, directed=False, color=-1, low=-1, index=-1): self.visited = visited self.id = id self.adjacent = adjacent if adjacent != None else [] self.directed = directed...
import sys, cv2, math, numpy import phase1, phase2, time if len(sys.argv) > 2: print 'skipping to frame', sys.argv[2] if len(sys.argv) < 2: print 'err: need argument mentioning video number' sys.exit() vnum = int(sys.argv[1]) ########### big_windows = 'ignore/' if vnum == 0 else '' ########### ########### # chec...
# 1392. Longest Happy Prefix ''' A string is called a happy prefix if is a non-empty prefix which is also a suffix (excluding itself). Given a string s. Return the longest happy prefix of s . Return an empty string if no such prefix exists. Example 1: Input: s = "level" Output: "l" Explanation: s contains 4 prefix...
''' Tests for chronicler.models.create_audit ''' from django.contrib.contenttypes.models import ContentType from django.contrib.auth.models import User from chronicler.models import AuditItem, create_audit from chronicler.tests import TestCase from chronicler.tests.models import Person, Group, Membership class TestC...
#!/usr/bin/python import sys, os.path, time, stat, socket, base64,json import boto3 import shutil import requests import yapl.Utilities as Utilities from subprocess import call,check_output, check_call, CalledProcessError, Popen, PIPE from os import chmod, environ from botocore.exceptions import ClientError from yapl.T...
class MyClass: def __init__(self, n): self.n = n print("__init__(%d) called" % self.n) def __del__(self): print("__del__(%d) called" % self.n) a1 = MyClass(1) a2 = MyClass(2) a3 = MyClass(3) # l = [] # for i in range(10,21): # l.append(MyClass(i)) for i in range(10,21): x = ...
#import sys #input = sys.stdin.readline def main(): N, K = map( int, input().split()) # if N%K == 0: # print(0) # return print( min(N%K, K - N%K)) if __name__ == '__main__': main()
import argparse import joblib import pandas as pd from sklearn.linear_model import LogisticRegression from sklearn.svm import SVC from typing import Text import yaml def train(config_path: Text) -> None: """Train model Args: config_path {Text}: path to config """ config = yaml.safe_load(open(c...
###################################################################################################################################################################### ###### A list of functions useful to the tensorflow model. #########################################################################################...
'''Question 9 Level 2 Question£º Write a program that accepts sequence of lines as input and prints the lines after making all characters in the sentence capitalized. Suppose the following input is supplied to the program: Hello world Practice makes perfect Then, the output should be: HELLO WORLD PRACTICE MA...
from .abstractmodel import AbstractClassificationModel import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim # Abstract focal model class AbstractFocalModel(AbstractClassificationModel): # compile model def compile_model(self, net): print("Learning rate i...
''' Created on Dec 18, 2013 @author: anbangx ''' if __name__ == '__main__': def f(): return 0 def g(): return 1 f = g print(f())
# Copyright 2016 Husky Team # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
#from models import User from models import User from fastapi import FastAPI from starlette.routing import Host import uvicorn app = FastAPI() @app.post('/users/', response_model=User) def create_user(user:User): return user if __name__ == "__main__": uvicorn.run(app, Host = "0.0.0.0", port = 8000)
from assignmentelasticsearch.search import app from assignmentelasticsearch.search.functions import find_most_expensive, find_greenest, find_allweeklong @app.endpoint("most-expensive") def mostexpensive(): return {"most expensive 10 product": find_most_expensive()} @app.endpoint("greenest") def greenest(): ...
from game.items.item import Hatchet from game.skills import SkillTypes class RuneHatchet(Hatchet): name = 'Rune Hatchet' value = 12800 skill_requirement = {SkillTypes.woodcutting: 41} equip_requirement = {SkillTypes.attack: 50} damage = 306 accuracy = 850
from Tkinter import * import random import string import tkMessageBox root=Tk() root.geometry("300x400") root.title("Password generator") Label(root, text="Website: ").grid(row=0, sticky=W) Label(root, text="Username: ").grid(row=1, sticky=W) Label(root, text="Password: ").grid(row=2, sticky=W) Label(root, te...
#!/usr/bin/python -u """ git threading hammer test """ import os from multiprocessing import Pool, log_to_stderr import logging import tempfile from shutil import rmtree import subprocess from time import sleep from random import random import itertools import traceback import sys import logging try: from tendo im...
from . import views from django.urls import path app_name="Myapp" urlpatterns = [ path('', views.index, name="index"), path('learn', views.learn ,name="learn"), path('codeform', views.codeform, name="codeform"), path('pro', views.pro ,name="pro"), path('compare', views.compare,name="compare"), ]
""" This program solves ProjectEuler problem 44, which asks the following: If pentagonal numbers are of the form n(3n-1)/2, find the difference D between the pair of numbers P1 and P2 that minimize D and satisfies: P1 and P2 are pentagonal, and so is their sum and their difference. My first program was too slow, but f...
### import import datetime import pytest from quizzer.models.quiz import Quiz, QuizQuestion, QuizQuestionChoice ### test Quiz def test_good_quiz(class_, teacher): quiz = Quiz( name=u'Object-oriented data structure design', class_=class_, percentage=100, owner=teacher, qu...
import schedule import time def job(): import sqlite3 con2=sqlite3.Connection('Email') cur2=con2.cursor() cur2.execute('select * from email') recipient_email=cur2.fetchall() sender_email='divyanshsengarjuet@gmail.com' password='26060000' import smtplib date=time.localtim...
from flask import Flask, render_template, request, session from flask import redirect, url_for import utils app = Flask(__name__) @app.route("/") @app.route("/home") def home(): return render_template('home.html') @app.route("/login", methods = ["GET", "POST"]) def login(): if "logged" not in session: ...
from src.domain.environments.real_world_environment import RealWorldEnvironment from src.domain.environments.vision_environment import VisionEnvironment from src.domain.objects.target_zone import TargetZone from src.vision.coordinate_converter import CoordinateConverter class RealWorldEnvironmentFactory(object): ...
import time class ProfileStats: _instance = None @staticmethod def instance(): if ProfileStats._instance is None: ProfileStats._instance = ProfileStats() return ProfileStats._instance @staticmethod def add(profile_time): ProfileStats.instance()._...
from django.db import models from django.contrib.auth.models import User from django.core.validators import MinValueValidator class Car(models.Model): owner = models.ForeignKey(User, on_delete=models.CASCADE, related_name='cars',) brand = models.CharField(max_length=100) model = models.CharField(max_lengt...
#!/usr/bin/python def nested(l): if not l: return 1 count = 1 for item in l: if type(item) is list: count = 1 + nested(item) return count print(nested([]))
# Generated by Django 3.0.3 on 2020-08-06 15:10 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('weekly', '0001_initial'), ] operations = [ migrations.RenameModel( old_name='Agents', new_name='Agent', ), m...
#I have tested this code for winows and it works please chech it for other systems # # where ever you see C:\\Users\\Nathaniel\\Dropbox\\code change it and put the path to your dropbox # # this was the path for my dropox therefor it may not work for you # #i have a common place where i store all my projects local...
class Solution: # dynamic programming def longestPalindrome0(self, s): """ :type s: str :rtype: str """ # store bool of i ,j as a palindrome from i to j. # cannot use i to indicate the center # there exists even cases dp = [[False,] * len(s) for i ...
from flask import Blueprint, Flask,redirect, session, g, render_template, url_for,request, send_from_directory ,Response #imports import requests import os import sys from flask_celery import make_celery from flask_pymongo import PyMongo import random from random import choice,randint import time import datetime from...
from apps.team.models import Team, UserTeamAssignment from rest_framework import serializers from api.api_auth.serializers import UserSerializer class UserTeamAssignment(serializers.ModelSerializer): user = UserSerializer() class Meta: model = UserTeamAssignment exclude = ['id', 'team'] class...
def es_primo(num): for n in range(2, num): if num % n == 0: return False return True n = int(input()) i = 0 sw = True j = 2 a = 1 cntS = 2 while i < n: if es_primo(j): if sw: print(a,'/',j,sep='') sw = False else: print(j,'/',a,sep='') ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import py ASYNC_DIR = py.path.local(os.path.abspath(__file__)).dirpath("async") def pytest_ignore_collect(path, config): # Ignore async tests if not supported. if sys.version_info < (3, 6) and path.common(ASYNC_DIR) == ASYNC_DIR: r...
""" Student ID: 2594 4800 Name: JiaHui (Jeffrey) Lu Aug-2017 """ import numpy as np import matplotlib.pyplot as plt x = np.arange(-10, 10, 0.01) y = x * (1 + np.power(np.tan(x), 2)) / np.tan(x) y1 = np.tan(x) plt.subplot(1, 2, 1) plot1, = plt.plot(x, y, label="condition") plot2, = plt.plot(x, y1, "g", label="functio...
"""Methods and constants for creating animations""" # Standard Library from typing import List from random import choice, sample # Third party import gif import numpy as np import plotly.graph_objects as go # TODO: add more colors COLORS = [("#155b92", "#15925e"), ("#9b76bc", "#618da7"), ("#ffba...
# -*- coding: utf-8 """ Created on 17:07 27/07/2018 Snakemake workflow for rMATS If you use rMATs, please cite Shen, Shihao, et al. "rMATS: robust and flexible detection of differential alternative splicing from replicate RNA-Seq data." Proceedings of the National Academy of Sciences 111.51 (2014): E5593-E5601. """...
""" created by ldolin """ import urllib.request # https://httpbin.org/get 测试请求头 url = 'http://httpbin.org/get' # response = urllib.request.urlopen(url) # text = response.read().decode('utf-8') # print(text) # { # "args": {}, # "headers": { # "Accept-Encoding": "identity", # "Host": "httpbin.org", # ...