text
stringlengths
38
1.54M
import math import torch import torch.nn as nn import torch.nn.functional as F class Denoise_RNN(nn.Module): def __init__(self, inp_sz, hidden_sz, num_layers, dropout, bidirectional): super(Denoise_RNN, self).__init__() self.LSTM = torch.nn.LSTM(input_size=inp_sz, hidden_size=2, num_layers=num_lay...
#!/usr/bin/python # -*- coding: utf-8 -*- # by:Adil class SSK_SVC(): # 此方法只适用于SNP数据或者普通字符串数据: # eg.:['ACGTAGCTAGCTAC', 'ACGTAGCGATCGATC',.....] # eg :['Are you ok', 'Yes, I'm ok'] # clf为SVC分类器 # kernel 为string核函数 # feats_train为字符串数据转化为SVC输入的中间量,不需要使用者考虑 def __init__(self): self.c...
# Copyright 2017-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" fil...
#!/usr/bin/env python3 import os import time import subprocess import yaml import logging import pprint from poor_mans_mailer import PoorMansMailer logging.basicConfig(level=logging.INFO) pp = pprint.PrettyPrinter(indent=4) DEFAULT_SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) DEFAULT_CONFIG_FILE = "%s/co...
import sys import base64 def encode(name): fp = open(name) data = fp.read(32000); # max-size in data-uri I think print base64.b64encode(data) if __name__ == '__main__': encode(sys.argv[-1])
from swarmtransport.representations import CityMap, BusRepresentation from swarmtransport.publictransport import SimpleBus, DecisiveBus import swarmtransport.passenger as ps from vispy import app, scene from vispy.ext.six import next import vispy.io from vispy.visuals.transforms.linear import AffineTransform import...
# -*- coding: utf-8 -*- """Test suite for models defined in pathshare_api.models.""" import pytest from datetime import datetime from uuid import uuid4 # Used to generate tokens from pathshare_api.models import Ride, User from pathshare_api.utilities import encrypt_password def test_ride_model() -> None: ...
# -*- coding: utf-8 -*- """ Created on Wed Mar 28 18:44:35 2018 @author: Mohammad SAFEEA """ import math from io import BytesIO from iiwaaControler.Senders import Senders from iiwaaControler.Getters import Getters from iiwaaControler.check import check_size, check_scalar, check_non_zero import numpy as np def checkA...
import os import sys sys.path.append('../') import time import torch import random import numpy as np import pandas as pd import collections import pdb from utils import get_logger, load_pkl import argparse from io_utils import get_prefix from tile_env import * from tile_env import neighbors as tile_neighbors from til...
import ee from constant.gee_constant import DICT_COLLECTION import argparse from datetime import date, timedelta import json from utils.cloud_filters import filter_clouds ee.Initialize() # l def eedate_2_string(date): """ Args: date: ee.Date Returns: string """ str_day = conver...
# load flask sub-systems from flask import Flask,render_template,url_for,request # from flask.views import MethodView # load application vars # from public import app from config.site import defaults #default title from reddit_user_api import * from graph_api import * app = Flask(__name__) # testing @app.route('/') ...
""" This file defines how to handle the MNIST dataset. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf import numpy as np import os import csv import preprocessing from preprocessing import image_preprocessing import configparse...
import argparse import collections import os from pathlib import Path from matplotlib.pyplot import xticks import numpy as np import torch import models from base import get_optimizer from dataloader import Dataloader from parse_config import ConfigParser from trainer import Trainer from utils.loss import AvgPerplexi...
#!/usr/bin/env python3 import hashlib """Hand-made cipher function. Expected to be pretty safe, as long as HASHFUNC is know safe and BLOCK_SIZE long enough""" HASHFUNC = hashlib.sha256 BLOCK_SIZE = 16 def _kiter(key:bytes): # need an iterator bc we don't know string's length in advance """Iterates on the key...
""" Runs TestHarness for BioModels. Creates: *.png figure that plots relative errors *.pcl file with data collected from run *.log file with information about run Common usage: # Access information about command arguments python SBstoat/mainTestHarness.py --help # Process the BioModels 1-800, crea...
import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output, State import pandas as pd import plotly.graph_objs as go from Visualization import ( Overview, Sankey, SVA_Research, utils ) from utils import Header, get_header, g...
from django.contrib import admin from cocukcacim.apps.activities.models import Activity, EventActivity class EventActivityInline(admin.StackedInline): model = EventActivity class EventAdmin(admin.ModelAdmin): list_display = ('title', 'created_at', 'updated_at') list_filter = ('created_at', 'updated_at')...
from discord.ext import commands import discord class help(commands.Cog): def __init__(self , client): self.client = client @commands.command() async def help(self ,ctx , name : str = None): help_dictionary = { "ping" : "Check bot latency \nAliases: Latency \nUsage: -ping", ...
class Solution(object): def maxSubArray(self, nums): # 以 nums[i] 为结尾的最大子数组和为 dp[i] dp = [0] * len(nums) for i in range(len(nums)): dp[i] = max(nums[i], nums[i] + dp[i - 1]) return max(dp) if __name__ == '__main__': S = Solution() print(S.maxSubArray([-2, 1, -3, ...
import bpy import os import math import random directory = os.path.dirname(bpy.data.filepath) path = directory + "//STLs" print(path) gridsize = 80 gridx = 5 gridy = 5 i = 0 def importStls(i): for stl in os.listdir(path): stlpath = path+"//"+stl print(stlpath) xOffset = grid...
num = int(input("enter any number=")) a = num i = 0 while i<=num: rem = num%10 sum = rem+num num = num //10 i+=1 if a%sum==0: print(a,"is a harshad number") else: print("not a harshad number") j = 1 while j<=1000: sum = 0 i = 1 a = i while i<= j: rem = i%10 sum =...
import workstation as ws class WorkstationFactory: def __init__ (self): self.current_id = 0 self.map = dict() def createWorkstation(self): w = ws.Workstation(self.current_id) self.current_id = self.current_id + 1 return w def addWorkstation(self, w): if type(w) is ws.Workstation: self.map[w.getName()...
import os, pdb def write_placemark( file_obj, place_mark_name, coords_kml, bubbledata, bubbleFields, geom_type ): """ General function that creates the placemark tag. This works for polylines, polygons and points. """ # Write opening placemark tag and name. All geom_types share this ...
x=1 y=1.0 z=5j print(type(x)) print(type(y)) print(type(z)) x=102002 y=-22222 print(type(x)) print(type(y)) x=1.22222222222222222 y=-1.4454 print(type(x)) print(type(y)) x=53+24j y=-35j print(type(x)) print(type(y)) x=1 y=1.0 z=2j a=int(y) b=float(x) c=complex(x) print(a) print(b) print(c) pr...
class ShareInterface: def draw(self): pass class Circle(ShareInterface): def draw(self): print("Circle.draw") class Square(ShareInterface): def draw(self): print("Square.draw") class ShareFactory: @staticmethod def getShape(typ): if typ == 'circle': ...
+num=21 +num2=int(input()) +print(num1-num2) +num2=int(input()) +print(num1-num2) +num2=int(input()) +print(num1-num2)
# Generated by Django 2.2 on 2019-04-17 15:50 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('standings', '0001_initial'), ] operations = [ migrations.AlterModelOptions( name='standings', options={'ordering': ['league_na...
from django.views.decorators.csrf import csrf_exempt from django.shortcuts import render from rest_framework import renderers from django.contrib.auth.models import User from rest_framework.response import Response from rest_framework.viewsets import ReadOnlyModelViewSet, ModelViewSet from rest_framework.permissions im...
# -*- coding: utf-8 -*- """ Created on Sun Dec 22 02:46:16 2019 @author: VIVEK VISHAN """ #Tuples coordinates = (3, 4, 5) print(coordinates[1]) coordinates = (3, 4, 5) #coordinates[1] = 10 print(coordinates[1]) coordinates =[(3, 4),(6,7),(80,34)] print(coordinates)
import sqlite3 class Mitarbeiter_Data(): def __init__(self): self.conn = sqlite3.connect("mitarbeiter.db") self.c = self.conn.cursor() def neuer_mitarbeiter_speichern(self, vorname, nachname, status): params = (vorname, nachname, status) sql = "INSERT INTO mitarbeiter ...
""" Django settings for spacesuite project. Generated by 'django-admin startproject' using Django 1.10.6. For more information on this file, see https://docs.djangoproject.com/en/1.10/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.10/ref/settings/ "...
import glob import numpy as np import matplotlib.pyplot as plt import matplotlib.image as mpimg class CarDataset: def __init__(self): vehicle_images = glob.glob('../data/vehicles/**/*.png') notvehicle_images = glob.glob('../data/non-vehicles/**/*.png') self.cars = [] self.notcars = ...
from typing import List, Optional from src.graph import Graph from src.treasure_map import TreasureMap class TreasureFinder: _graph: Graph _start: int _destination: int def __init__(self, treasure_map: TreasureMap): self._start = treasure_map.start self._destination = treasure_map.tr...
#!/usr/bin/python3 from partitioning import Partitioning import logging from matplotlib import pyplot as plt def get_index_communities(n, n_comm): '''Returns SBM-style community blocks.''' width = n // n_comm return [set(range(i * width, (i + 1) * width)) for i in range(n_comm)] def infer_index_communit...
""" Geo operations. v_color, plot_coords, plot_bounds, plot_line, create_geohash_df, create_bin_geohash_df, decode_geohash_to_latlon, """ from typing import Optional, Text, Tuple, Union import geohash2 as gh import numpy as np from matplotlib.pyplot import axes from numpy import ndarray from pandas import DataFrame...
#Author: Kai Huang #Date: 2015.04.01 import sys sys.path.append("../tools") import time import datetime def SecsToDateString(secs): if secs >= 0: return time.strftime("%Y%m%d",time.gmtime(secs)) else: return "0000.00.00" def SecsToYear(secs): if secs >= 0: return time.strftime("%Y",time.gmtime(secs)) e...
# -*- coding: utf-8 -*- """ Created on Wed Nov 15 21:26:53 2017 @author: James """ import numpy as np def pearson_r(x, y): """Compute Pearson correlation coefficient between two arrays.""" # Compute correlation matrix: corr_mat corr_mat = np.corrcoef(x, y) # Return entry [0,1] return corr_mat[0,1...
import logging logger = logging.getLogger(__name__) class BaseStorageEngine(object): def save(self, fp, location): logger.error("Unimplemented save method") raise NotImplementedError def read(self, location): logger.error("Unimplemented read method") raise NotImplementedError ...
import os from pathlib import Path import PIL from PIL import Image def create_sprites(imagepaths, spritefilepath, cssfilepath): """ Creates a sprite image by combining the images in the imagepaths tuple into one image. This is saved to spritefilepath. Also creates a file of CSS classes saved to css...
#import urllib2 from bs4 import BeautifulSoup import urllib.request from flask import Flask,request,render_template,flash,url_for,redirect import pymysql app=Flask(__name__) db=pymysql.connect("localhost","root","","IPP", autocommit=True) cursor=db.cursor() app.secret_key='some_secret' url="https://india.gov...
import json import sys import getpass from account import Account from authorization import Authorization import pdb class Operation: def __init__(self): self.authorized = False self.start() def start(self): self.login_prompt() response = raw_input() self.login(response...
def is_anagram(s: str, t: str) -> bool: # return sorted(s) == sorted(t) if len(s) != len(t): return False s_map = {} for i in list(s): if i in s_map.keys(): s_map[i] = s_map[i] + 1 else: s_map[i] = 1 for i in list(t): if i in s_map.keys(): ...
# -*- coding:utf-8 -*- ''' Created on 2015年12月22日 @author: zhaojiangang ''' from datetime import datetime, timedelta import unittest from biz.mock import patch from entity.hallshare_test import share_conf from entity.hallstore_test import clientIdMap, item_conf, products_conf, \ store_template_conf, store_default...
from celery.schedules import crontab import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "scrum.settings") from django.conf import settings from celery import Celery from .tasks import say_hi app = Celery('scrum', backend='amqp', broker='amqp://rabbit_admin:scrum@2016!@rabbitmq//?heartbeat=30') app.config_fro...
from NE import NeuroEvolution class SANE(NeuroEvolution): def initialize(self): raise NotImplementedError() def terminate(self): raise NotImplementedError() def compute_fitness(self): raise NotImplementedError() def recombine(self): raise NotImplementedError() d...
#!/usr/bin/python3 If only on linex # variables.py Dyer # def main(): print("This is the variables.py file.") if __name__ == "__main__": main()
def test_select_leaf_root(setup_complete_tree): tree, nodes = setup_complete_tree nodes[0].is_expanded = False leaf = tree.select_leaf() assert leaf is nodes[0] def test_select_leaf(setup_complete_tree): tree, nodes = setup_complete_tree leaf = tree.select_leaf() assert leaf is nodes[2...
from os import write import argparse import numpy as np from ADTs.adt import ListNode, MatrixNode class Graph: def __init__(self): self.graph_repr = None def __repr__(self) -> str: return str(self.graph_repr) def read_graph(self, path: str, represent_as="matrix"): with open(pa...
__version__ = "0.0.14" __banner__ = \ """ # multiplexor %s # Author: Tamas Jos @skelsec (info@skelsecprojects.com) """ % __version__
import os import json from flask import Flask, request from subprocess import run import requests app = Flask(__name__) # process_data @app.route('/uflassist/process_question', methods=['GET']) def process_pages(): question = request.args.get('question') header = {'Content-Type': 'application/json'} payl...
from .abstract_result import AbstractResult, AbstractResultCodec class ResultAsServer(AbstractResult): ... class ResultAsServerCodec(AbstractResultCodec[ResultAsServer]): ...
list1 = ["one", "two", "thee", "four", "five"] list2 = [1, 2, 3, 4, 5, ] dic = {} for i in list1: for j in list2: dic[i] = j list2.remove(j) break print(dic)
f = input("enetr: ") x = 0 for i in range(len(f)): if f[i] == ".": x = i print("the filename is: ", f) print("the extension of the file is: ", f[x+1: ])
import math def mysqrt(a): ''' estimate the square root of a :param a: :return: the square root of a ''' x = 3 epsilon = 0.0000001 while True: # print(x) y = (x + a / x) / 2 if abs(x - y) < epsilon: return y break ...
""" Definition of forms. """ from django import forms from django.forms import ModelForm from app.models import Ticket from app.models import Tech_update from django.contrib.auth.models import User from django.forms import BaseModelFormSet from django.contrib.auth.forms import AuthenticationForm from django.utils.tra...
from tools.tools_module import * import wolframalpha appId = 'TKAPVA-Q2GP6VU62E' client = wolframalpha.Client(appId) question = "" answer ="" def ask_quesion(inputType,self): global answer speak('Thank you.... Now I am ready to give, your answer. Please ask me,') speak('I can answer to computational and ...
# -*- coding: utf-8 -*- """ Created on Tue Oct 2 06:15:46 2018 @author: Scott Warnock """ def cumulative_Data(period_DataFrame): cum_DataFrame = period_DataFrame cum_DataFrame.loc['Cumulative Total Cost'] = cum_DataFrame.loc['Period Total Cost'].cumsum() cum_DataFrame.loc['Cumulative Planned ...
# coding: utf8 from django.core.mail import send_mail from django.http import HttpResponse, Http404, HttpResponseRedirect from django.shortcuts import render from django.shortcuts import render_to_response from django.template import Context from django.template.loader import get_template from models import Book import...
import pymysql import json from app import app from flask import jsonify,session from flask import flash, request from flask_restful import Resource, Api from flaskext.mysql import MySQL from datetime import date, timedelta from time import mktime mysql = MySQL() # MySQL configurations app.config['MYSQL_DATABASE_USE...
# Copyright (c) 2020 Dell Inc. or its subsidiaries. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
import re # import os # # path = "./data/openssl_openssl" # files = os.listdir(path) # # for file in files: # if os.path.getsize(os.fspath(path + '/' + file)) == 0: # 文件大小为0 # print(file + '是空文件,即将执行删除操作!') # os.remove(os.fspath(path + '/' + file)) # 删除这个文件 # print(file) # with open('./data/op...
#!/usr/bin/env python import argparse import utils import os.path import subprocess import numpy as np import random import numpy.random import tensorflow as tf import keras #os.environ['TF_CPP_MIN_LOG_LEVEL'] = '1' #random.seed(2018) #np.random.seed(2018) #tf.set_random_seed(2018) #os.environ['PYTHONHASHSEED'] = '2...
from django.conf.urls import url from . import views app_name = 'tracker' urlpatterns = [ url(r'^$', views.index, name='index'), url(r'^overview/$', views.overview, name='overview'), url(r'^(?P<book_id>[0-9]+)/change_read_status/(?P<status>[\w-]+)/$', views.change_read_status, name='change_read_status'),...
# Sorting Practice def selectionSort(): enum = len(aList) # go through list elements, swap min_num for i in range(enum): # for going through sorted list. min_index = i for j in range(i+1, enum): # swap for smallest num in unsorted list if aList[j] < aList[min_index]: ...
from abc import ABC, abstractmethod from copy import deepcopy from dataclasses import dataclass, field from textwrap import indent from typing import Any, Callable, Dict, MutableMapping, Optional import numpy as np from local_migrator import REGISTER, class_to_str from PartSegCore.algorithm_describe_base import ( ...
# -*- coding: utf-8 -*- """ Created on Wed Jun 13 20:56:34 2018 @author: Rushi Varun """ from sklearn.datasets import fetch_20newsgroups from sklearn.preprocessing import StandardScaler from sklearn.feature_extraction.text import CountVectorizer from sklearn.naive_bayes import MultinomialNB from sklearn.metrics import...
def pasc_tri(row,col): if row == 0: return 0 if col == 1: return 1 return pasc_tri(row-1, col-1) + pasc_tri(row-1,col) print(pasc_tri(3,1)) # 1 # 1 1 # 1 2 1 # 1 3 3 1 # 1 4 6 4 1
# -*- coding: utf-8 -*- import re from nose.tools import eq_ from mkt.users.helpers import emaillink, user_data from mkt.users.models import UserProfile def test_emaillink(): email = 'me@example.com' obfuscated = unicode(emaillink(email)) # remove junk m = re.match( r'<a href="#"><span clas...
import datetime from eppy.doc import EppRenewCommand from registrobrepp.common.periodtype import PeriodType class BrEppRenewDefRegCommand(EppRenewCommand): def __init__(self, roid: str, curexpdate: datetime, period: int, periodtype: PeriodType = PeriodType.YEAR): dct = { 'epp': { ...
""" :Copyright: 2006-2021 Jochen Kupperschmidt :License: Revised BSD (see `LICENSE` file for details) """ from unittest.mock import patch from pytest import raises from byceps.services.ticketing import ( event_service, ticket_code_service, ticket_creation_service, ticket_service, ) def test_create_...
#!/usr/bin/env python #we make the class for base tree of nodes here class tree: def __init__(self,left,right,parent): self.parent = parent self.left = left self.right = right #we make the class alphabet here class alphabet: def __init__(self,char,probability,leaf): self.char = char self.probability = pro...
#Confeccione un algoritmo en diagrama de flujo que, # al leer el neto de una factura, # calcule el I.V.A. y de cómo salida el total de la factura. total = 0 neto = 0 iva = 0 print("Ingrese el Valor NETO de la Factura") neto = int(input()) iva = int(neto * 0.19) total = int(neto + (neto * 0.19)) print(f"El Total de ...
# -*- coding: utf-8 -*- import re from django import forms from django.contrib.auth import forms as django_forms from django.http.request import HttpRequest from django.urls import reverse from easy_select2 import select2_modelform, apply_select2 from captcha.fields import CaptchaField from django.contrib import auth f...
maior = 0 codigo = 0 qtd = int(input()) for i in range(qtd): cod, nota = input().split() if float(nota) > maior: maior = float(nota) codigo = cod if float(maior) >= 8: print(codigo) else: print('Minimum note not reached')
import socket import json import sys import time datem = { "apid":551, "RequestNumber":300001, "Code": 9807, "CustId": 72752308, "TranCode": 7288, "IP1": 231, "IP2": 233, "IP3": 205, "IP4": 127, "gender": 2, "Eng_1": "G", "dele_time": "2018-06-26 17:47:32", "exec_time": "2018-06-26 17:47:34", "resp_time": "2018-06-26 ...
# Generated by Django 3.0.2 on 2020-01-25 07:54 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('gov', '0008_category_email'), ] operations = [ migrations.AlterField( model_name='event', name='location', ...
import logging from pylons import request, response, session, tmpl_context as c, url from pylons.controllers.util import abort, redirect from brokenapp.lib.base import BaseController, render import os log = logging.getLogger(__name__) class LogtoobigController(BaseController): def index(self): # Return...
#!/usr/bin/env python3 # created by: Trinity Armstrong # created on: October 2019 # This module contains constants for the "Number Guessing Game" CORRECT_NUMBER = 5
from abc import ABC, abstractmethod class Component(ABC): @abstractmethod def operation(self): pass class ReturnComponent(Component): def operation(self): return 'Меня зовут Компонент' class Decorator(Component): _component = None def __init__(self, component: Component): ...
#Kinect v2 stereo calibration import numpy as np import cv2 import shelve import os import const from glob import glob def getImagePoints(imageNames): img_points = [] for fileName in imageNames: filebla = shelve.open(fileName) img_points.append(filebla['img_points']) return img_points def...
name = input('usrname:') pwd = input('password:') if name == 'alex' and pwd == '123': print('yes') else: print('no')
from scattertext.Scalers import dense_rank from scattertext.termscoring.DeltaJSDivergence import DeltaJSDivergence from scattertext.termcompaction.AssociationCompactor import JSDCompactor from scattertext import SampleCorpora, whitespace_nlp_with_sentences, produce_frequency_explorer, RankDifference from scattertext....
import forecastio from geopy.geocoders import Nominatim from utils.mongo import Mongo import re from .baseprovider import BaseProvider local = { 'ru': re.compile('(?i)погода'), 'en': re.compile('(?i)weather') } class WeatherProvider(BaseProvider): @staticmethod def get(query, config, params={}, lang=...
# project euler problem 5 # smallest multiple divisible by 1 through 20 from math import gcd # lcm is from python 3.9 and I've got 3.8.5 sadly def lcm(x, y): return int((x * y) / gcd(x, y)) num = 1 for itr in range(1, 21): num = lcm(num, itr) print(num)
import pygame from towers import Tower import os import numpy as np from time import time class CannonTower(Tower): def __init__(self,x,y): super().__init__(x,y) self.tower_imgs = [] self.archer_imgs = [] self.archer_count = [] self.tower_imgs = [] self._load_offlin...
import numpy as np import argparse import os import os.path as osp import torch import torch.utils.data as data import glob import random from TorchTools.DataTools.Prepro import aug_img, aug_img_np, crop_img, crop_img_np, downsample_tensor, rggb_prepro from TorchTools.DataTools.FileTools import tensor2np import torchvi...
ENDPOINT = 'https://5apps.com/rs/oauth/cyroxx' #ENDPOINT = 'https://heahdk.net/authorizations/new?login=cyroxx' CLIENT = 'Vault' SCOPES = ['vault:rw']
from django.http import HttpResponse from django.shortcuts import render, redirect from django.views import View import random import datetime from core import models class IndexPageView(View): def get(self, request, *args, **kwargs): date = datetime.datetime.now() books = models.Item.objects.al...
def FIBO(number): if(number==0): return (0) elif(number==1): return 1 else : return FIBO(number-1)+FIBO(number-2) a=int(input("enter the no.")) if a<0: print("error:the no. entered is -ve") else: print(FIBO(a))
# from django.db.models import query # from django.db.models.query_utils import Q #from django.shortcuts import render from django.views.generic import ListView from .models import User_Package_Detail from django.db.models import Q # search result class... class SearchClass(ListView): model = User_Package_Detail ...
import sys sys.path.append('../includes') from db import DB from common_functions import parse_company_prices, parse_ftse_prices, get_seconds_from_date,get_date_after,parse_currency import datetime import urllib.request import requests import ssl import re context = ssl._create_unverified_context() url_to_complete = "...
#Emily Murphy #2017-10-04 #betterAdditionGameDemo.py - asks addition problem until user gets 5 right from random import randint numCorrect = 0 while numCorrect < 5: num1 = randint(-10,10) num2 = randint(-10,10) question = 'What is ' + str(num1) + ' + ' + str(num2) + '?' answer = int(input(question)) ...
# Copyright (c) Alibaba, Inc. and its affiliates. import math import os from collections import namedtuple from typing import Dict import torch import torch.nn as nn import torch.nn.functional as F from torch import Tensor from modelscope.metainfo import Models from modelscope.models.builder import MODELS from model...
#!/usr/bin/python # Copyright Justin Buist # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 import contextlib import pango import pygtk import gtk import gobject import pyaudio import wave import threading import os import sys pygtk.require('2.0') TARGET_TEXT = 'HARRIET' # Use in a 'with' block to supress stde...
from rest_framework import serializers, exceptions class QuizIDSerializer(serializers.Serializer): quiz_id = serializers.IntegerField()
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-05-06 22:27 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.Creat...
from serif.model.tokenizer_model import TokenizerModel class PlainWhiteSpaceTokenizer(TokenizerModel): '''Does nothing but return a tokenization according to whitespace (doesn't attempt to split off final punctuation)''' def __init__(self,**kwargs): super(PlainWhiteSpaceTokenizer,self).__init__(**kwa...
""" test_Lx(z) Author: Jacob Jost Affiliation: University of Colorado at Boulder Created on: Thu June 4 09:00:00 MDT 2015 --- = spacing between different sections of a code $$$ = spacing between different parts of codes The redshift can be set so the same redshift is used for each plot or can be set for ...
from PyQt5.QtCore import QTimer,Qt,QDateTime,QUrl,pyqtProperty from PyQt5.QtWidgets import QApplication,QWidget,QGridLayout,QListWidget,QLabel,\ QVBoxLayout,QHBoxLayout,QPushButton from PyQt5.QtWebEngineWidgets import * from PyQt5.QtWebChannel import QWebChannel from MySharedObject import MySharedObject import sys #嵌...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for the helpers for command line tools.""" import io import os import unittest try: import win32console except ImportError: win32console = None from dfvfs.lib import definitions from dfvfs.helpers import command_line from dfvfs.path import factory as path_sp...