text
stringlengths
38
1.54M
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models # Create your models here. class BaseModel(models.Model): name = models.CharField(max_length=32) note = models.TextField(null=True, blank=True) createtime = models.DateField(null=True, blank=True, auto_now_add = ...
class Mention: def __init__(self, span=(), mtype='', mesh_id='', wid=-1, chebi_id=-1): self.span = span self.mtype = mtype self.mesh_id = mesh_id self.wid = wid self.candidates = list() self.chebi_id = chebi_id self.name = '' @staticmethod def find_co...
import urllib.request def main(): #Step 1: add function from urllib.request # Open http://www.cnn.com mySite = urllib.request.urlopen('http://www.cnn.com') #Step 2: Read in the webpage as a string mySiteString = mySite.read() #Step 3: Print the string and #print the length of the we...
with open('Day 5/input.txt') as f: for intcode in f: original_intcode = list(map(int, intcode.strip().split(','))) intcode = original_intcode.copy() # intcode = [1002,4,3,4,33] program_input = 1 p = 0 while True: # Opcode handler # if intcode[p] == (3 or 4 or 99): opcode = intcode[p] ...
import pygame import socket import pickle from _thread import * from Player import Player players = {} def threaded_client(conn, player): conn.send(pickle.dumps(player)) while True: try: data = pickle.loads(conn.recv(2048)) if not data: print("Disconnected") ...
T = int(input()) def sumDivisibleBy(n ,p) : num = int(p/n) sum = num * (num + 1) sum = sum >> 1 return int(n * sum) for _ in range(T): N = int(input()) result = sumDivisibleBy(3, N - 1) + sumDivisibleBy(5, N - 1) - sumDivisibleBy(15, N - 1) print(result)
import os import tornado.web #from lib.config import config from web.app.amiup import AmIUpHandler from web.app.home import HomeHandler from web.app.slides import * class App(tornado.web.Application): def __init__(self): handlers = [ (r"/amiup", AmIUpHandler), (r"/", HomeHandle...
class Solution: def getHint(self, secret: str, guess: str) -> str: secret = list(secret) guess = list(guess) count = {} A = 0 B = 0 for c in secret: try: count[c]+=1 except KeyError: count[c] = 1 ...
import math # 1 print('Введіть a,b,c') a = float(input()) b = float(input()) c = float(input()) p = (a+b+c)/2 print(math.sqrt(p*(p-a)*(p-b)*(p-c))) # 2.1 print('Введіть x,y') x = float(input()) y = float(input()) if math.fabs(x*y) < 1 and x < 0: print(1) print((x+y)/math.exp(x*y)) elif 2 < x and y <= 0: p...
# # Copyright (c) 2023 Airbyte, Inc., all rights reserved. # from abc import ABC from typing import Any, Iterable, List, Mapping, MutableMapping, Optional, Tuple, Union import requests from airbyte_cdk.models import SyncMode from airbyte_cdk.sources import AbstractSource from airbyte_cdk.sources.streams import Strea...
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim: ai ts=4 sts=4 et sw=4 nu """ (c) 2014 Ronan Delacroix Versionning Utility - Pre Commit Git Hook :author: Ronan Delacroix """ import sys import os import os.path import six import re from datetime import date if six.PY3: raw_input = input def main(): major...
import base64 from .base import TestBase from pymap.imap import IMAPServer class TestSession(TestBase): async def test_login_logout(self, imap_server: IMAPServer) -> None: transport = self.new_transport(imap_server) transport.push_login() transport.push_logout() await self.run(...
# Copyright (C) 2013 Craig Phillips. All rights reserved. import re, os from libgsync.output import debug from libgsync.drive import Drive class SyncFileFactory(object): @staticmethod def create(path): debug("SyncFileFactory.create(%s)" % repr(path)) drive = Drive() if drive.is_driv...
"""Test for selection sort.""" import pytest from .selection import selection_sort def test_empty_selection_sort(): """Test empty selection sort.""" assert selection_sort([]) == [] def test_small_selection_sort(): """Test small selection sort.""" assert selection_sort([1, 2, 3, 4]) == [1, 2, 3, 4] ...
from flask import Flask, jsonify, request from flask_mysqldb import MySQL #Setting app and MySQL User and Database → Watch DB! app = Flask(__name__) app.config['MYSQL_USER'] = 'testuser' app.config['MYSQL_HOST'] = 'localhost' app.config['MYSQL_PASSWORD'] = 'testpw' mysql = MySQL(app) #Test on MainPage for check if G...
from functools import update_wrapper from inspect import isgeneratorfunction, signature import io def should_be_file(file_argname, mode="rb"): """Decorator to enforce the given argument is a file-like object. If it isn't, it will be seen as a filename, and it'll be replaced by the open file with the given...
# -*- coding: utf-8 -*- import re from scrapy import Request from Spider.xinlang.xinlang.items import XinlangItem from lxml import etree from scrapy_redis.spiders import RedisSpider import json import time class XinlangSpider(RedisSpider): name = 'xinlang' redis_key = 'myspider:start_urls' # ...
""" Manages the different versions of the schema. """ from .base import (BaseObject, SchemaObjectType, Order) from .schema import (SchemaObject) from .change import (Change) FATAL_TYPE = SchemaObjectType('fatal') ERROR_TYPE = SchemaObjectType('error') WARNING_TYPE = SchemaObjectType('warning') NOTE_TYPE ...
""" PGT: Accurate News Recommendation Coalescing Personal and Global Temporal Preferences Code Authors: - Bonhun Koo, (darkgs@snu.ac.kr) Data Mining Lab. at Seoul National University. - U Kang, (ukang@snu.ac.kr) Associate Professor. File: src/comp_selection_simple.py - Competitor function for selectio...
from apps.models import mydb import numpy as np import matplotlib.pyplot as plt from pylab import mpl import jieba import jieba.posseg as ps import jieba.analyse from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.cluster import KMeans import nltk from collections import Counter # mpl.rcParams['fo...
import numpy as np import datetime import matplotlib.pyplot as plt from sklearn.metrics import f1_score, precision_score, recall_score from scipy.stats import sem, t import itertools import os def load_csv(fname, ids=None, dt=float, skip_header=False, idxs=None, targets=None, struct='list', id_dtype=int, delim=','): ...
import functools import json import logging import threading import time from signal import Signals from typing import Callable, Tuple, Union import psycopg2 import psycopg2.errors from psycopg2._psycopg import ReplicationMessage from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT from psycopg2.extras import Di...
class PetriNet(object): def __init__(self): self.places = [] self.transtions = [] self.inputs = [] self.outputs = [] self.connections = {} def from_alpha(self,alpha_model, dotfile="dot.dot"): self.transitions = alpha_model.footprint.activities self.inp...
from django.views import View from verifications.libs.captcha.captcha import captcha from django_redis import get_redis_connection from django.http import HttpResponse,JsonResponse from verifications.libs.captcha.captcha import captcha from verifications.libs.yuntongxun.ccp_sms import CCP from celery_tasks.sms.tasks im...
import copy from collections import OrderedDict from collections import defaultdict from conans.model.env_info import EnvValues from conans.model.options import OptionsValues from conans.model.scope import Scopes, _root from conans.model.values import Values class Profile(object): """A profile contains a set of ...
import tensorflow as tf tf.compat.v1.disable_eager_execution() with tf.device('/cpu:0'): a = tf.constant([1.0,2.0,3.0],shape=[3],name='a') b = tf.constant([1.0,2.0,3.0],shape=[3],name='b') with tf.device('/gpu:1'): c = a+b #注意:allow_soft_placement=True表明:计算设备可自行选择,如果没有这个参数,会报错。 #因为不是所有的操作都可以被放在GPU上,如果...
import click from service import process_source, SOURCES from utils import configure_sentry @click.command() @click.option("--id", required=True, help="id of the source") @click.option("--username", required=False, default=None, help="username of the source") @click.option("--password", required=False, default=None,...
""" :Copyright: 2006-2021 Jochen Kupperschmidt :License: Revised BSD (see `LICENSE` file for details) """ import pytest import byceps.announce.connections # Connect signal handlers. from byceps.events.tourney import ( TourneyMatchReady, TourneyMatchReset, TourneyMatchScoreSubmitted, TourneyMatchScore...
#Sieve of eratosthenes def soe(n): t=[] for i in range(n+1): t.append(1) t[0]=0 t[1]=0 for i in range(len(t)): if t[i]==1: j=i while j<=n: j+=i if j<=n: t[j]=0 ...
# Copyright The OpenTelemetry 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 applicable law or agreed to in ...
from tsuruclient.base import Manager as Base class Manager(Base): """ Manager deploys (despite that name, it only shows deploy's info). """ def list(self, deploy_id=None, **kwargs): """ Display deploy information. When the deploy_id argument is assigned, show only info about th...
#!/usr/local/bin/python3 from myModule import funcLib __all__=['test1', 'test2'] def test1(): print('myModule func test1') def test2(): print('myModule func test2') def test3(): print('myModule func test3') def test4(): print('myModule func test4')
from django.contrib.sitemaps import Sitemap from django.urls import reverse class MarketingSitemap(Sitemap): priority = 1 changefreq = 'weekly' def items(self): return 'marketing:index', 'marketing:tos', 'marketing:version' def location(self, obj): return reverse(obj)
from django.conf.urls import patterns, include, url from django.contrib.staticfiles.urls import staticfiles_urlpatterns import CartaDeAmor.views as views urlpatterns = patterns('', url(r'^$', views.HomeView.as_view()), url(r'^create/$', views.CreateView.as_view()), url(r'^create/new/$', views.process_creat...
import unittest import torch import numpy as np from naslib.search_spaces import NasBench201SearchSpace from naslib.search_spaces.core import Metric from naslib.search_spaces.core.primitives import AbstractPrimitive from naslib.search_spaces.nasbench201.conversions import * SPEC = (2, 2, 3, 4, 3, 2) def create_dumm...
import sys import socket def start_server(PORT): print 'Port:{0}'.format(PORT) s = socket.socket() # new socket s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # [Errno 98] Address already in use (for more fast socket closing) (reuse the address within the TIME_WAIT period) s.bind(("",PORT)) # wai...
from django.conf.urls import url from django.contrib.auth.views import login, logout from .views import custom_login, register, edit, edit_password, password_reset, password_reset_confirm, dashboard urlpatterns = [ url(r'^login/$', custom_login, name='login'), url(r'^logout/$', logout, name='logout', kwargs={...
class BaseBackboneComponent(object): def __init__(self): pass def process(self, **kwargs): """ 处理函数,处理来自head的数据 """ pass def __call__(self, *args, **kwargs): return self.process(**kwargs)
import numpy as np import random from graphviz import Digraph import itertools class AST: def __init__(self, depth): #木の深さ self.depth = depth #最大要素数(深さ"depth"での完全二分木の要素数) self.max_size = 2**self.depth-1 #ASTの配列 self.ast = np.array([None for i in range(self.max_size)]...
from SyntaxNodes.StatementSyntaxNode import StatementSyntaxNode class IfStatementSyntaxNode(StatementSyntaxNode): def __parseIf(self, ctx): condition = ctx.parExpression().expression().getText() trueBranch = StatementSyntaxNode(ctx.statement(0), nodeType='IfTrueBranch', packageName=sel...
""" Extracts geographic region. Example: python subset.py '/u/devon-r0/shared_data/ers/floating_/latest/AntIS_E2_REAP_ERS_ALT*' Notes: Bedmap boundaries: -b -3333000 3333000 -3333000 3333000 Ross boundaries: -b -600000 400000 -1400000 -400000 """ import os import sys import h5py import pyproj import nump...
import os import numpy as np from PIL import Image class Minion(): def __init__(self,minionType,image): self.minionType = minionType self.image = image width,height = image.size self.center = (int((width/2)),int((height/2))) self.bboxwidth = width self.bboxheight = ...
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-07-03 19:33 from __future__ import unicode_literals import datetime from django.db import migrations, models from django.utils.timezone import utc class Migration(migrations.Migration): dependencies = [ ('podcast', '0014_auto_20160630_0537'), ...
import argparse import pdb import slog_graph import numpy as np def print_info(log, time_range): log.set_time_range(time_range) thrust = np.mean(log.get_col_data(18)) rudder = np.mean(log.get_col_data(4)) avg_rot = np.mean(log.get_col_data(2)) avg_speed = np.mean(log.get_col_data(16)) print("RO...
from url_checker import * urls = get_urls() ctr = 1 for url in urls: print("{}. {}".format(ctr,url.rstrip())) if check_url_validity(url): print("Valid") else: print("Invalid") ctr += 1
from pathlib import Path competition_name = 'rsna-miccai-brain-tumor-radiogenomic-classification' path = Path.home() / '.kaggle'/ competition_name
import time import datetime a = time.asctime(time.localtime(time.time())) print(a) print(datetime.datetime.fromtimestamp(time.time())) b = [1, 2, 3, 4, 5] print(b[-1:])
x = int(raw_input()) c = 0 for i in range(0, x): xx = map(int, raw_input().split(' ')) xy = xx[0] + xx[1] + xx[2] if (xy > 1): c = c + 1 print c
#!/usr/bin/env python import server.amqp.controller as amqp_ctrl import server.domain_controller.controller as domain_ctrl from server.utils.settings import conf __author__ = 'akurilin' class Controller(amqp_ctrl.Controller): _queue = "manage" _states = {"start": {"message": "Starting...", ...
# class User: # # 类空间中定义的变量,是类变量 # category = '未知类型' # # def __init__(self, name='admin', passwd='passwd'): # self.name = name # self.passwd = passwd # # # # 通过类引用赋值的变量,也属于类变量 # User.type = '通用用户' # # print(User.category) # User.category = '整型' # print(User.category) # # u = User() # # 当对象本身...
from flask import Flask, render_template, jsonify from api import question_list, questions, question_date app = Flask(__name__) @app.route('/') def index(): return render_template('home.html') @app.route('/api/v1/about/') def about(): return render_template('about.html') @app.route('/api/v1/question_date/'...
from django.contrib import admin from common.models import LRPModel @admin.register(LRPModel) class LRPModelAdmin(admin.ModelAdmin): list_display = ('user', 'created_on', 'version')
""" Example usage of RerF module. Paths to dataset are relative from "Python" source directory. """ from multiprocessing import cpu_count import numpy as np from rerf.RerF import fastPredict, fastPredictPost, fastRerF datatype = "iris" # datatype = "mnist" if datatype == "iris": datafile = "../packedForest/...
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
fname=input("please enter the file name:") #Or just press enter without entering any file name # to open a default .txt file. In this case I had # used clown.txt if len(fname) < 1: fname="clown.txt" hand=open(fname) di = dict() for lines in hand: lines=lines.rstrip() #print(lines) words=lines.split(...
# TODO(developer): Uncomment and set the following variables project_id = 'plsgoogol' compute_region = 'us-central1' model_id = 'IOD1766646904998854656' file_path = r'D:\GCloud\20191005_204349046_iOS.jpg' score_threshold = '0.5' from google.cloud import automl_v1beta1 as automl import json from google.protobu...
# coding=utf-8 ''' Author: Kangchen Wei Email: weixk@cifutures.com.cn Application : machine learning for investment date: 2019/4/25 19:51 desc: ''' from factors.Frequency import DailyFrequency from factors.Category import TechnicalIndicatorFactor from factors.sql import pl_sql_oracle from factors.util.TechnicalIn...
from django.shortcuts import render from .models import Recomendacion from .forms import RecomendacionesForm from django.views.generic import ListView, CreateView, UpdateView, DeleteView from django.urls import reverse_lazy from django.db.models import Q # Create your views here. def listar_recomendaciones(request): ...
# # License: BSD # https://github.com/splintered-reality/py_trees_ros_tutorials/raw/devel/LICENSE # ############################################################################## # Documentation ############################################################################## """ Behaviours for the tutorials. """ ####...
# -*- coding: utf-8 -*- import os from setuptools import setup, find_packages from datapurge import __version__ as version README = open(os.path.join(os.path.dirname(__file__), 'README.md')).read() # allow setup.py to be run from any path os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))...
# Trees Ex1 class Node: def __init__(self, data=-float("inf"), left=None, right=None): self.data = data self.left = left self.right = right def pre_order_print_node(self): print(self.data) if self.left: self.left.pre_order_print_node() if self.right: self.right.pre_order_print_node() class Tree:...
from math import floor for t in range(int(input())): n = int(input()) x = floor(n**0.5) while n%x != 0: x -= 1 print(abs(x-(n//x)))
pelicula = 'Batman' peliculas = ['Batman', 'Spiderman', 'TLOTR'] cantantes = list(('J. Lo', 'Eminem', 'La Raíz')) years = list(range(2020, 2050)) variada = [False, 'Aitor', 22, 33.3] print(peliculas) print(cantantes) print(years) print(variada) print('\n') print(years[0:10]) print(peliculas[2:]) # a...
import os import json import numpy as np import pickle import re import pprint def read_blacklist(): with open('blacklist.txt', 'r') as f: blacklisted_tags = f.readlines() return [t.strip() for t in blacklisted_tags] def read_hashtags(filename, img_name='img'): """ Reads the hash-tags from ...
#!/usr/bin/env python3 from env import env from run_common import print_session from run_terminate_s3_bucket import run_terminate_s3_bucket from run_terminate_s3_vue import run_terminate_s3_vue _, args = dict(), list() if __name__ == "__main__": from run_common import parse_args _, args = parse_args() ####...
import random ## Dice Model that other dice types will inherit from class Dice: def __init__(self): print('init') def role(self): raise "you must implement this method" ## Specific Dice that contains basic sequential numbers class NumericDice(Dice): def __init__(self, number=6): self.number = numbe...
#!/usr/bin/python2 import pyping r=pyping.ping("192.168.122.11") if r.ret_code == 0: print "Success" else: print "failure"
from pyro.infer import Predictive from ._decorators import auto_move_data class AutoMoveDataPredictive(Predictive): @auto_move_data def forward(self, *args, **kwargs): return super().forward(*args, **kwargs)
#!/usr/bin/python # -*- coding: utf-8 -*- from __future__ import print_function if __name__ == '__main__': import _libpythonpath_ #type: ignore (Add libPython\.. into PYTHONPATH when unittest ) import argparse import os import sys import platform if __name__ == "__main__": print("======= Environment Variables ===...
"""abbreviations URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.9/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Cla...
#!/usr/bin/python """ Interface for current simulation class. """ __author__ = "barbanas" import rospy from std_msgs.msg import Bool from auv_msgs.msg import NavSts, NED from geometry_msgs.msg import TwistStamped class CurrentSim(object): """ Abstract class for current simulation. It provides the templa...
# -*- coding: utf-8 -*- import sys import os # ------------------------------------------------------------------------- # Configure extensions extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.graphviz', 'sphinxcontrib.traceables', ] sys.path.append(os.path.abspath('../../tests')) # -------------------...
from django.db import models from django.core.validators import FileExtensionValidator class Test(models.Model): file = models.FileField( upload_to='uploads/%Y/%m/%d/', verbose_name='採点ファイル', validators=[FileExtensionValidator(['pdf', ])], ) # Create your models here.
from logger import log testlog = log("test.log", "test program") for l in testlog: testlog.send("this is a test message...") print "sent one log message..." testlog.send("this is another log message..") print "Sent another log message..." testlog.send(None)
class Timer: def __init__(self, count=100,step=1,cycles=0,stop=False): self.count = count self.current_cnt=0 self.step = step self.cpu_cycles=cycles self.stop=False #decrements count by step value #Set the timer to count value, passed by from the simulator def s...
# -*- coding: utf-8 -*- """ Created on Sat May 23 00:15:03 2020 @author: guosj """ import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns data = pd.read_csv('data_final.csv') startdate = pd.to_datetime(data['starttime']).dt.date data['time'] = startdate pres_202...
from django.shortcuts import render def main(request): return render(request,'board/main.html') def space1(request): return render(request,'board/space1.html') # Create your views here.
# syntax error print("Hello world") # runtime error 10 * ("2/0") # semantic error name = ("Alice") print("Hello name")
# -*- coding: utf-8 -*- """ Created on Sat May 29 13:13:13 2021 @author: Ammar """ import os import numpy as np from Preprocess_mammo import Preprocess import matplotlib.pyplot as plt from matplotlib.pyplot import figure from utility import padimages from utility import load_inbreast_mask #from skimage...
from math import* a = int(input()) n = 0 f = 2 exp = 0 sinal = 1 acr = 0 while n < a: acr += sinal*(1/((f-1)*(3**exp))) exp += 1 sinal = sinal *(-1) f += 2 n += 1 acr = sqrt(12)*acr print(round(acr,8))
# import filex class FileReadProvider(object): def __init__(self, filename): self.filename = filename def is_present(self): pass def get_text(self): pass def get_binary(self): pass def get_size(self): pass def get_create_time(self): pass def get_last_write_time(...
from collections import Counter, defaultdict from time import time def listRightIndex(alist, value): return len(alist) - alist[-1::-1].index(value) -1 if __name__ == "__main__": with open('day15.txt') as fin: contents = [(int(line)) for line in fin.read().split(',')] turn_cnt = 1 number_spo...
from odoo import models, fields, api class UserCreation(models.TransientModel): _inherit = 'user.creation' _description = 'User Creation Wizard' hr = fields.Boolean('HR') @api.multi def confirm(self): user = super(UserCreation, self).confirm() remove_user = [(3, user.id)] ...
examplePuzz = [ [0, 0, 4, 0, 9, 8, 3, 7, 5], [5, 7, 0, 0, 0, 6, 2, 9, 1], [0, 9, 2, 1, 0, 7, 0, 0, 0], [0, 0, 3, 0, 0, 0, 5, 6, 0], [2, 0, 0, 0, 0, 0, 0, 0, 4], [0, 1, 6, 0, 0, 0, 7, 0, 0], [0, 0, 0, 6, 0, 2, 8, 5, 0], [0, 4...
#! /usr/bin/python import time import numpy import os import glob import sys import collections import re ###functions#################################################################### TIME_INDEX = 0 NODE_INDEX = 1 SEGMENT_NR_INDEX = 2 SEGMENT_DUR_INDEX = 3 SEGMENT_REP_INDEX = 4 SEGMENT_BITRATE_INDEX = 5 S...
# Generated by Django 2.1 on 2018-10-11 19:23 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('recipes', '0003_auto_20181011_0054'), ] operations = [ migrations.RemoveField( model_name='recipe', name='direction', ...
import bpy from bpy.props import ( BoolProperty, FloatProperty, StringProperty, ) from bpy_extras.io_utils import ( ExportHelper, axis_conversion, orientation_helper, ) from mathutils import Matrix from . import export_vem, export_ves bl_info = { 'name': 'Vulpes Engine Mesh Format', '...
# -*- coding: utf-8 -*- from zope.interface import implements from zope.component import provideUtility from zope.app.component.hooks import getSite from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm from zope.schema.interfaces import IVocabularyFactory from trem.passagens.config import MessageFactory as...
# -*- coding: utf-8 -*- """ Created on Thu Jun 13 19:16:36 2019 @author: Arunkumar """ import pandas as pd import numpy as np jan2018=pd.read_excel("FY15.xlsx") col=jan2018.columns.tolist() jan2018.loc[jan2018['Beaureau']== 0,'Beaureau']=0 jan2018.loc[jan2018['Beaureau'] == -1, 'Beaureau']=-1 j...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for the review file implementation.""" from __future__ import unicode_literals import unittest import l2tdevtools.lib.reviewfile as reviewfile_lib class ReviewFileTest(unittest.TestCase): """Tests the review file implementation.""" # pylint: disable=prote...
import numpy as np from keras.datasets import mnist from keras.models import Sequential from keras.layers import Dense, Dropout, Flatten from keras.layers.convolutional import Conv2D, MaxPooling2D (X_train, y_train), (X_test, y_test) = mnist.load_data() # 训练数据集图像是 28 * 28 的格式 标签是0-9的数字 X_train = X_train.reshape(X_...
import csv from operator import itemgetter, attrgetter import server import cv2 import numpy as np width = 864 height = 648 def get_boxes(response_dict): boxes = {} # key is person's index, value is list of centers for person for person in response_dict["Persons"]: try: box = person["Perso...
import logging import math ''' Created on 18 May 2012 @author: sh695 ''' def rank_results(results): """Ranks genes based on number of each of the four reads/amplicons that hit the gene Step 1: The results are summed Gene Counts Sum DRB1*01:01 [120,...
#!/usr/bin/python3 import sys import gmpy2 sys.path.append('../../') from crypto.utilities import char_mapping ciphertext = [(949, 2750), (8513, 28089), (5513, 8421), (4769, 4261), (18352, 12856), (17914, 28599), (25231, 9196), (3809, 5997), (1477, 19626), (19108, 2...
#Faça um programa que mostre a tabuada de vários números, um de cada vez, # para cada valor digitado pelo usuário. O programa será interrompido quando o número solicitado for negativo. n = 0 resp = '' while True: n = int(input('Digite um número inteiro: ')) if n < 0: break else: for c in ran...
import os import webbrowser import threading import time def startService(): os.system("python app.py") def openWeb(): webbrowser.open('http://127.0.0.1:5000/', 0, False) threads=[] t1 = threading.Thread(target=startService) threads.append(t1) t2 = threading.Thread(target=openWeb) threads.append(t2) if __name...
# coding=utf-8 import logging from nose.plugins.attrib import attr from modelscript.interfaces.environment import Environment from modelscript.test.framework import TEST_CASES_DIRECTORY from modelscript.tools.use.engine import ( USEEngine) import os import modelscript.scripts.objects.parser from modelscript.scrip...
import ast import functools import numpy as np import logging from vaex.dataframe import DataFrame, _hidden from vaex.docstrings import docsubst from vaex.utils import (_parse_n, _parse_f, _ensure_strings_from_expressions, _ensure_list, _expand_limits, _expand_shape, _expand, _parse_reduction, _issequence, ...
# Generated by Django 3.0.4 on 2020-03-25 11:02 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('posts', '0003_auto_20200320_2149'), ] operations = [ migrations.AddField( model_name='post', name='views', ...
# Print Personal Information name = input("enter your name") roll = int(input("enter your roll number")) section = input("enter your section number") print("Your name is",name, "Your roll number is",roll, "Your Section is",section)