text
stringlengths
38
1.54M
from YourLesson import login, downloads from YourLesson import setting import time if __name__ == "__main__": teaching_class_type = "" print("请选择你选择的课程的类型: ") print("(A) 本班课程") print("(B) 方案内课程") print("(C) 方案外课程") print("(D) 校公选课") while True: case = input("请输入A,B,C,D: ") ...
## This is just an example file # To train it on your own detections your need to have the ground truth 2d data. # Unfortunately, we are not allowed to share this data due to licensing reasons. ## import torch.optim from torch.utils import data from utils.data import H36MDataset import torch.optim as optim import mode...
import progressbar import pandas as pd from sklearn.cluster import AgglomerativeClustering import numpy as np from sklearn.metrics.pairwise import cosine_similarity as cs from typing import List from config import * from category_identificator.ANEA_annotator.graph.node import Node from category_identificator.ANEA_anno...
from util.observe import Observable, ObservableList, ObservableDict from tests.mock.mockbuddy import MockBuddy from util import Storage from Queue import Queue __metaclass__ = type class MockConversation(Observable): def __init__(self): Observable.__init__(self) bud = MockBuddy('fakebuddy') ...
import sys _module = sys.modules[__name__] del sys config_rodnet_cdc_win16 = _module config_rodnet_cdc_win16_mini = _module config_rodnet_cdcv2_win16_mnet = _module config_rodnet_cdcv2_win16_mnet_dcn = _module config_rodnet_hg1_win16 = _module config_rodnet_hg1v2_win16_mnet = _module config_rodnet_hg1v2_win16_mnet_dcn ...
import os import brownfunk as bf def makeFolder(path): if not os.path.isdir(path): os.mkdir(path) def makeFileWithContent(filename, path, content=[]): fullPath = os.path.join(path, filename) if not os.path.exists(fullPath): bf.saveTxt(fullPath, content) def photoVideoExt(): return ...
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2019-08-04 20:54 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion import tinymce.models class Migration(migrations.Migration): initial = True dependencies ...
import re f=open('lumlist','r') x='[LUM]{3}[0-9]{2}[PY]{2}[0-9]{3}' f1=open('lumfnlist','w') for i in f: s=i.rstrip('\n') m=re.fullmatch(x,s) if m!=None: print(s) f1.write(s+"\n")
import datetime import factory import factory.fuzzy from factory.compat import UTC from django.conf import settings from django.contrib.auth.models import User from . import models class AlertTradeFactory(factory.django.DjangoModelFactory): class Meta: model = models.AlertTrade
import signal import time from multiprocessing import Queue, Event from dequeue import Dequeue from enqueue import Enqueue if __name__ == '__main__': queue = Queue() stop_flag = Event() enqueue_process = Enqueue(q=queue, interval=1, stop_flag=stop_flag) dequeue_process = Dequeue(q=queue, interval=1, ...
import math import numpy as np def getTrajectory(x_0,y_0,xi_0,px_0,py_0,pz_0,t0,iter,plasma_bnds,mode,sim_name): # Returns array of x, y, xi, z, and final x, y, xi, z, px, py, pz if (sim_name.upper() == 'OSIRIS_CYLINSYMM'): import include.simulations.useOsiCylin as sim elif (sim_name.upper() == 'QUASI...
class Student: def __init__(self, name, grades): self.name = name self.grades = grades def average_grades(self): return sum(self.grades) / len(self.grades) student = Student("Elvis", (88, 99, 78, 100, 51)) student2 = Student("Bob", (96, 78, 44, 86, 100)) print(student.name, student.a...
# -*- coding: utf-8 -*- from AniChou import signals from AniChou.tracker.watcher import Watcher __doc__ = """ This module provides tracker. """ __all__ = ['start', 'stop', 'set_config'] WATCHER = False CONFIG = None def set_config(cfg): global CONFIG CONFIG = cfg @signals.Slot('start_tracker') def star...
dock_dir ='/home/malgorzata/Desktop/rDock_2013.1_src' chimera_dir ='/home/malgorzata/chimera/bin' work_dir ='/home/malgorzata/Desktop/rDOCK_IFD/test2' receptor ='1aq1' apo ='1aq1' ligand ='HMD' rec_ligand ='STU' no_poses ='10' act_chain ='A' soft = 'soft_docking.prm' hard = 'hard_docking.prm' rec_chain = 'A'
""" Test cases for the WorkerThread class. In these test cases, we verify that the WorkerThread correctly builds, saves results, and updates Github with the correct results. WHITEBOX TESTING: def test_worker_runs_in_seperate_thread(self): def test_init_saves_queue(self): def test_worker_reads_first_id_if_q...
import sqlite3 as sql import csv import os import numpy as np from PIL import Image COLUMNS = {"click": ("id", "event", "start_time", "mouse_position_press_x", "mouse_position_press_y", "mouse_position_release_x", "mouse_position_release_y", "total_time", "frame"), "screenPan": ("id", "...
# -*- coding: utf-8 -*- # @Author: Ved Prakash # @Date: 2021-02-18 10:48:30 # @Last Modified by: Ved Prakash # @Last Modified time: 2021-02-21 22:01:42 # Main Script to run for Questions 1 and 2 in Outline of readme file import pandas as pd import argparse import json import numpy as np import scipy.sparse as sp...
from OneImage import * from mask import * from image_analysis import construct_12_subplots from matplotlib.mlab import PCA import matplotlib.pyplot as plt from pprint import pprint def PCA_image(image): image_arr = np.array(image.image) line_mask = get_black_line_mask(image) mask = np.zeros(shape=(651,651...
#Code name: pythoncode3.py #Programmed by: Saili Sawant import MySQLdb #import Statements import datetime <<<<<<< HEAD conn = MySQLdb.connect(user='root', passwd='itmd521',db='itmd521sss',host='127.0.0.1') ======= conn = MySQLdb.connect(user='root', passwd='itmd521',db='Week04',host='127.0.0.1') >>>>>>> 3...
#! /usr/bin/env python3 import os import subprocess import sys def main(args): """ Determine which subcommand to execute, or show available subcommands. Keyword arguments: args -- List of arguments from stdin, excepting the program name- sys.argv[1:] """ # This is ...
from linked_list.likedlist import LinkedList, Node def equals(linked_list1, linked_list2): aux1 = linked_list1.head aux2 = linked_list2.head while aux1 and aux2: if not aux1 or not aux2 or aux1.value != aux2.value: return False aux1 = aux1.next aux2 = aux2.next retu...
__author__ = 'Shade390' import traceback from flask import Flask, redirect, render_template, session, g, current_app as app, url_for import sqlite3 from tools.pictures import get_user_profile_pic, get_profile_pic_path def home_page(username, db): posts = [] try: c = db.cursor() d= db.cursor()...
import requests from datetime import datetime import currency_graph as cg def read_year(): year = input('Input year (default - current year) ') try: year = int(year) except ValueError: year = datetime.today().year return year def read_currencies(): currencies = [] while True: ...
from __future__ import absolute_import, print_function from chronam.core import models as m from . import LoggingCommand class Command(LoggingCommand): help = "Updates the Title.has_issues property appropriately" # NOQA: A003 def handle(self, *args, **options): q = m.Title.objects.filter(pk__in=m....
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # libs import requests from requests_toolbelt.utils import dump import json import os import sys from dotenv import load_dotenv from pathlib import Path # create a custom requests object, modifying the global module throws an error # provides intrinic exception handling ...
from django.db.models import fields from rest_framework.serializers import ModelSerializer from django.contrib.auth import get_user_model User = get_user_model() from .models import Quiz from questions.models import Question, Answer class QuizSerializer(ModelSerializer): class Meta: model = Quiz ...
from pynng import Surveyor0, Respondent0, Timeout import time address = 'tcp://127.0.0.1:13131' with Surveyor0(listen=address) as surveyor, \ Respondent0(dial=address) as responder1, \ Respondent0(dial=address) as responder2: # give time for connections to happen time.sleep(0.1) surveyor....
from time import time import pandas as pd import matplotlib from keras.utils.np_utils import to_categorical from keras.callbacks import EarlyStopping from tensorflow.python.keras.layers import Input, Embedding, LSTM, GRU, Conv1D, Conv2D, GlobalMaxPool1D, Dense, Dropout,SpatialDropout1D matplotlib.use('Agg') import ma...
import sys sys.stdin = open('input3.txt', 'r') tc = int(input()) for t in range(1, tc+1): num = int(input()) print('#{} {}'.format(t), end='')
# Generated by Django 3.2.5 on 2021-08-06 14:28 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('shop', '0003_auto_20210806_1618'), ] operations = [ migrations.RemoveField( model_name='order', name='ordered_date', ...
""" @Author: Phani @Version 1.0 Module to create the pdf report format for reportlab """ # for pdf from reportlab.pdfgen import canvas from reportlab.lib import colors from reportlab.lib.pagesizes import A4, inch, landscape from reportlab.platypus import SimpleDocTemplate, Table, TableStyle, Paragraph, Image...
import tensorflow as tf ''' 梯度计算整体逻辑 一阶导 二阶导计算 常用激活函数求梯度 sigmoid tanh relu 常用损失函数求梯度 softmax+mse softmax+cross_entropy ''' w = tf.constant(1.) x = tf.constant(2.) b = tf.constant(3.) y = x*w with tf.GradientTape() as tape: tape.watch([w]) y2 = x * w # y = x*w的计算并没有包裹到tape中,所以无法求得梯度 grad1 = tape.gradient(y, [w]...
from django.contrib import admin from .models import allgEingaben, Bauteil # Register your models here. class allgEingabenAdmin(admin.ModelAdmin): list_display = ['projekt_name','user',] admin.site.register(allgEingaben, allgEingabenAdmin) class BauteilAdmin(admin.ModelAdmin): list_display = ['bautteil_na...
# coding:utf-8 import tensorflow as tf import sys import logging import pickle import random import os from tensorflow.contrib import rnn os.environ["CUDA_VISIBLE_DEVICES"]="0" class Word: def __init__(self,val,tf,df): self.val = val self.tf = tf self.df = df def __repr__(self): ...
try: with open("text_2.txt", "r+") as file: file.write( "Lorem ipsum dolor sit amet, consectetur adipiscing elit," " sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\n" "Nisi vitae suscipit tellus mauris a.\n" "Rutrum quisque non tellus orci ...
# -*- coding:utf-8 -*- # @author :adolf class AttrDict(dict): def __init__(self, *args, **kwargs): super(AttrDict, self).__init__(*args, **kwargs) self.__dict__ = self if __name__ == '__main__': a = {"a": 1, "b": 2, "c": 3} cfg = AttrDict(a) print(cfg.a) print(cfg.keys())
#!/usr/bin/env python3 -u import datetime import time import sys import os from tabulate import tabulate sys.path.append(os.path.join(os.path.dirname(__file__), 'lib')) from config import config_from_yaml # noqa: E731 from logstats import LogStats # noqa: E731 from traffic_mon import TrafficMon, STATUS, NotEnoughDat...
from django.conf.urls import url, include from django.contrib import admin from oscar.app import application from oscar_accounts.dashboard.app import application as accounts_app from oscar_accounts.api.app import application as api_app admin.autodiscover() urlpatterns = [ url(r'^dashboard/accounts/', include(ac...
import os import pickle as pkl import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt try: os.environ['SESNPATH'] os.environ['SESNCFAlib'] except KeyError: print ("must set environmental variable SESNPATH and SESNCfAlib") sys.exit() cmd_folder = os.getenv("SESNCFAlib") if cm...
# Generated by Django 2.2.5 on 2021-06-07 13:53 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('concepts', '0002_auto_20210607_2158'), ] operations = [ migrations.AlterField( model_name='conc...
import os import datetime import errno import pytz from juliabox.jbox_util import LoggerMixin, unique_sessname from juliabox.db import JBoxUserV2, JBoxDynConfig from jbox_volume import JBoxVol from juliabox.cloud import JBPluginCloud, Compute class VolMgr(LoggerMixin): STATS = None STAT_NAME = "stat_volmgr" ...
import re from enum import Enum SLACK_ID_PATTERN = re.compile(r"^<@[^>]+>$") class MessageChannelType(Enum): DM = "im" CHANNEL = "channel" GROUP = "group" def get_slack_id(user_id: str) -> str: """ Formats a plain user_id (ABC123XYZ) to use slack identity Slack format <@ABC123XYZ> for highl...
from django.conf import settings from django.conf.urls import url, include from django.conf.urls.static import static from .views import * urlpatterns = [ url(r'^$', ListCreateProducts.as_view(), name='product_list'), url(r'(?P<pk>\w+)/$', RetrieveUpdateDestroyProducts.as_view(), name='product_detail'), # ...
x = input() if len(x) % 4 != 0: x = x + 'a' * (4 - (len(x) % 4)) s1 = [] g1 = 0 r1 = 0 b1 = 0 y1 = 0 for i in range(0, len(x), 4): s1 = x[i:i + 4] if 'R' not in s1 and '!' in s1 and 'a' not in s1: r1 = r1 + 1 if 'B' not in s1 and '!' in s1 and 'a' not in s1: b1 = b1 + 1 if 'Y' not in...
from swap_meet.item import Item class Clothing(Item): def __init__(self, condition=None): if condition == None: super().__init__(category="Clothing") else: super().__init__( condition=condition, category='Clothing') def __str__(self): return "The fi...
from tmp_parser import get_candles_by_figi, to_local_time from tmp_utils import load_yaml TMP_OTHER_COMPANIES = dict() GREEN_HEART = "\U0001F49A" RED_HEART = "\U0001F494" def tmp_monitor_other_companies(chat_id, other_companies_queue): global TMP_OTHER_COMPANIES make_other_companies(chat_id) other_comp...
from tkinter import * root = Tk() #Creating label widget myLabel1 = Label(root, text="Hello World!") myLabel2 = Label(root, text="My Name is Nikhil Kovelamudi") #Shoving it onto the screen myLabel1.grid(row = 0, column = 0) myLabel2.grid(row = 1, column = 0) root.mainloop()
import os from flask import Flask, render_template, send_from_directory, jsonify, url_for, redirect, request import pdb import json #----------------------------------- # initialization #----------------------------------- app = Flask(__name__) app.config.update( DEBUG = True, ) #----------------------------------...
# # 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...
import pytest import pytech.utils as utils def test_iterable_to_set(): """Test and make sure that a set is returned.""" test_iterable = ['AAPL', 'MSFT', 'AAPL', 'FB', 'MSFT'] returned_set = utils.iterable_to_set(test_iterable) assert len(returned_set) == 3 test_iterable = (1, 2, 3) returned_...
import sys sys.path.append(".") from . import state from . import State2 from . import State3 class StateInit(state.State): """ Etat initiale de l'automate. Première lecture de la question. Renseignement de la partie : SELECT """ def __init__(self,prevState=None): self.prevState=prevSta...
from pwn import * global p # context.log_level = 'debug' # 0x804c590 def menu(): p.recvuntil("refresh): ") def create(): log.info("Make: ") p.sendline("C") p.recvuntil("ID ",timeout=0.1) id = p.recvline()[:-1] log.info("Created: " + str(id)) menu() return id def edit(index, q): l...
import colorsys import os import webbrowser import os.path import click from pathlib import Path import subprocess as sp @click.command() @click.option('--name','-n',prompt = 'Enter the filename',help = '--Enter The File Name') def create( name ): print("The file name is" + name + ":") if(os.path.exists(...
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html import scrapy class SportItem(scrapy.Item): # define the fields for your item here like: #title = scrapy.Field() #url = scrapy.Field() start_time = s...
# -*- coding: utf-8 -*- ''' Created on 2015-5-12 @author: zqh ''' from poker.entity.dao.lua_scripts.util_scripts import LUA_FUN_TY_TOBMBER ALIAS_GET_BEST_TABLE_ID_LUA = 'GET_BEST_TABLE_ID_LUA' GET_BEST_TABLE_ID_LUA = ''' local datas = redis.call("ZRANGE", KEYS[1], -1, -1, "WITHSCORES") redis.call("ZREM", KEYS...
from patterns import Pattern def generate(x=10, y=10, z=10, time_steps=10): return Pattern(data=[ [[[calculate_rgb(x, y, z, t) for zi in range(z)] for yi in range(y)] for xi in range(x)] for t in range(time_steps) ]) def calculate_rgb(x, y, z, t): if t % 2: return (1, 1, 1) e...
# -*- coding: utf-8 -*- from concurrent.futures import ThreadPoolExecutor import requests import json import traceback import sys from .utils_tools_init import initlog class BaseQuerier: def __init__(self, querier_fun, **kwargs): self.querier_fun = querier_fun def build_query(self, args): ...
# -*- coding: utf-8 -*- ''' Created on April , 2015 @author: stevey ''' from sklearn import datasets iris = datasets.load_iris() digits = datasets.load_digits() # show digits' data and shape print(digits.data) print(len(digits.data[0]), len(digits.data)) print(digits.target, len(digits.target)) clf = svm.SVC() ...
myList = [11, 22, 23, 99, 81, 93, 35] sum = 0 # 계산용 sum 변수 생성 for i in range(len(myList)) : # myList 길이 만큼 for문 반복 sum += myList[i] # 차례대로 더함 print(sum) #결과 출력
# 피보나치 수와 비슷한 규칙을 찾아 동적 계획법으로 푸는 문제 # 문제 # 오른쪽 그림과 같이 삼각형이 나선 모양으로 놓여져 있다. 첫 삼각형은 정삼각형으로 변의 길이는 1이다. 그 다음에는 다음과 같은 과정으로 정삼각형을 계속 추가한다. 나선에서 가장 긴 변의 길이를 k라 했을 때, 그 변에 길이가 k인 정삼각형을 추가한다. # # 파도반 수열 P(N)은 나선에 있는 정삼각형의 변의 길이이다. P(1)부터 P(10)까지 첫 10개 숫자는 1, 1, 1, 2, 2, 3, 4, 5, 7, 9이다. # # N이 주어졌을 때, P(N)을 구하는 프로그램을 작성하시오. ...
from src.main.video.youtube import accessor as youtube class YoutubeVideoInfo: @property def video_id(self): return self.__video_id @property def title(self): return self.__title @property def description(self): return self.__description @property def tags(se...
import os import sys import transaction import subprocess from types import DictType from sqlalchemy import engine_from_config from pyramid.paster import ( get_appsettings, setup_logging, bootstrap, ) from ..models import ( init_model, DBSession, Base, Group, UserGroup, GroupPerm...
# -*- coding: utf-8 -*- """ @author: Prabhu <prabhu.appalapuri@gmail.com> """ import torch import torch.nn as nn # latent space_vectors --> size of the input (here considered as 100) # num_Outputchannels --> orignal image channels (i.e 3 for RGB, 1 for Gray scale) # Generator class Gen(nn.Module): def __init__(se...
import pexpect import os import sys username = 'cisco' password = os.getenv('ciscopass') device_ip = '192.168.1.76' debug = False ssh_newkey = "Are you sure you want to continue connecting" ssh_asa = 'ssh {}@{}'.format(username, device_ip) child = pexpect.spawnu(ssh_asa) if debug: child.logfile = sys.stdout r...
from enum import Enum class Errors: ''' Errors for the simulator class. These focus on errors that aren't about undefined runtime behavior but rather about invalid logic, addresses, too many constraints, etc. ''' class TranslatorError(Exception): pass class InvalidConstraints(Exceptio...
# Arseny: when you write tests the good practice is # Arseny: using the `pytest` lib or the `unittest` lib import unittest from typing import Any, Tuple from server import index, login, create_game, join_game from models import User, Users, Game
# Copyright (c) 2017 Xiaoyong Guo # www.guoxiaoyong.com import dis import marshal import struct import sys import time import types import py_compile try: from StringIO import StringIO except ImportError: from io import StringIO def interpret_code_flags(flag): flags = {} flags['CO_OPTIMIZED'] = 0x0001 fl...
"""empty message Revision ID: 8dfa36dddd77 Revises: aee59ca73cc9 Create Date: 2020-04-01 18:59:57.630417 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '8dfa36dddd77' down_revision = 'aee59ca73cc9' branch_labels = None depends_on = None def upgrade(): # ...
User1 = input("Input User1: ") User2 = input("Input User2: ") while True: User1selection = input(User1 + ", Do you want to choose rock, scissors or paper? ").lower() User2selection = input(User2 + ", Do you want to choose rock, scissors or paper? ").lower() if User1selection == User2selection: ...
# coding: utf-8 # -*- coding: utf-8 -*- __author__ = "Jalpesh Borad" __email__ = "jalpeshborad@gmail.com" import re import os from base.context import get_spark_context from base.decorators import time_taken from configs.config import DATA_DIR sc = get_spark_context("WordCount") def normalize_words(text): re...
# gffgfgffggfd print('Hello, Django girls!') if 3>2: if 3>2: print('It works!') if 5>2: print('5 is indeed greater than 2') else: print('5 is not greater than 2') name = 'Sonja' if name == 'Ola': print('Hey Ola!') elif name == 'Sonja': print ('Hey Sonja!') else: print('Hey anonymous!') volume = 57 if volume <...
import matplotlib.pyplot as plt import numpy as np import cv2 def showImage(title, image, pos = 111, effect = None): plot = plt.subplot(pos) plot.set_yticks([]) plot.set_xticks([]) plot.set_title(title) plot.imshow(image, cmap = effect) def linksUnion(links, directions): for i in range(4): ...
from collections import Counter from tqdm import tqdm def preprocess2(tokenized_docs, min_length, min_counts, max_counts): """Tokenize, clean, and encode documents. Arguments: docs: A list of tuples (index, string), each string is a document. nlp: A spaCy object, like nlp = spacy.load('en'). ...
import pygame as PG from game import Surface as SU from tab import Tab, Tbline import random wegth = 300 hegth = 600 FPS = 60 distansX = 80 firstLineX = wegth // 2 -distansX secondLineX = wegth // 2 thredLineX = wegth // 2 +distansX WHITE = 255,255,255 AZURE = 0,255,255 PURPLE = 255,0,255 YELLOW = 255,255,0 RED = 255,...
print("EJERCICIO N°10") #El programa determinara el tiempo en que recorre el niño de su casa hacia el colegio #INPUT velocidad =int(input("La velocidad es: ")) distancia = int(input("la distancia es: ")) aceleracion_1 =int(input("la aceleracion es: ")) #PROCESSING tiempo = ((distancia / velocidad)*aceleracio...
#!/usr/bin/env python ##### Setup ### Libraries import argparse import logging import math import os from PIL import Image, ImageColor, ImageDraw, ImageFont, ImageOps import re import sys ### System Settings # Default font paths for Mac OS X. # Order of list will be searchable order. font_dirs = ['/System/Library/...
import gi import sys import detectusb import KeyGen gi.require_version('Gtk', '3.0') from gi.repository import Gtk class MyWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title='This Encryption Method is stupid') self.set_border_width(10) self.box = Gtk.Box(spacing=6) ...
from functools import reduce temperatury = [10, 13, 14, 15, 10] acc = 1 for x in temperatury: acc = acc * x print(acc) def multiply(elem1, elem2): return elem1 * elem2 acc2 = reduce(lambda elem1, elem2: elem1*elem2, temperatury) print (acc2) # [10, 13, 14, 15, 10] # [130, 14, 15, 10] # [1820, 15, 10] # [27...
from tkinter import * import tkinter as tk import os import sys from subprocess import call root = Tk() root.title("Smart Bot") root.minsize(300,300) root.geometry("500x500") thelabel = Label(root,text="Innovate & Secure") thelabel.pack() topFrame = Frame(root) topFrame.pack() bottomFrame = Frame(root) bottomFrame.pac...
# Author:丁泽盛 # data:2020/10/6 10:55 import pygame from pygame.sprite import Sprite class Alien(Sprite): '''初始化单个外星人的类''' def __init__(self,ai_settings,screen): '''初始化外星人并设置其起始位置''' super(Alien, self).__init__() self.screen=screen self.ai_settings=ai_settings ...
"""TimestampAdminTest class""" from unittest.mock import Mock from django.contrib import admin from django.contrib.admin.sites import AdminSite from django.contrib.auth.models import User from django.db import connection from django.db import models from django.db.utils import ProgrammingError from django.forms impor...
# This is a new module for my new feature # This commit in master # This line is added by the feature branch
import os import time import unittest from base.base_report import BaseReport if __name__ == '__main__': # 获取所有的要运行的方法(scripts文件夹下的所有继承TestCase的test开头的方法) suite = unittest.defaultTestLoader.discover("./scripts", "test_*.py") # 运行!1111111 BaseReport().run_suite_with_report(suite)
# -*- coding: utf-8 -*- # 作者 gongxc # 日期 2021/5/27 21:56 # 文件 small_link import time import requests from tkinter import * from tkinter import messagebox import tkinter as tk def update_link(turl): data={'turl':turl} params={'ajaxtimestamp':str(int(time.time()*1000))} r = str(requests.post('https...
# Generated by Django 3.0.7 on 2020-07-04 16:01 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='LocalPayIdEntity', fields=...
import numpy as np import pandas as pd from joblib import dump from sklearn import svm from sklearn.ensemble import GradientBoostingClassifier, RandomForestClassifier, ExtraTreesClassifier from sklearn.linear_model import SGDClassifier from sklearn.metrics import mean_absolute_error from sklearn.model_selection import ...
#!/usr/bin/python2.7 # Contest: AtCoder - Typical DP Contest [2014-08-31] # Problem: B - Game # Author: Masatoshi Ohta import sys def read_line(): return sys.stdin.readline().strip() def read_int(): return int(sys.stdin.readline()) def read_ints(): return [int(x) for x in sys.stdin.readline().split()] def solve(): ...
# The MIT License # # Copyright (c) 2011 Wyss Institute at Harvard University # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # ...
""" spaceshooter.py Author: Funjando Credit: Don-the-wott, Payton-man (like....so much) Assignment: Write and submit a program that implements the spacewar game: https://github.com/HHS-IntroProgramming/Spacewar """ #Imports import math from ggame import App, Sprite, ImageAsset, Frame from ggame import SoundAsset, Sou...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import numpy as np DATA_DIRECTORY = "data" # Params for MNIST IMAGE_SIZE = 28 NUM_CHANNELS = 1 PIXEL_DEPTH = 255 NUM_LABELS = 10 VALIDATION_SIZE = 5000 # Size of the validation set. DEFAULT_DATA_A...
import sys, os, os.path as path import numpy as np from utils.util import load_file from utils.articles import Articles from utils.scorer import report_score import tensorflow as tf def compute_accuracy(v_x, v_y): global prediction # input v_x to nn and get the result with y_pre y_pre = sess.run(predictio...
import json from django.contrib.auth.decorators import login_required from django.db.models import Count from django.http import HttpResponse from django.utils import timezone from django.shortcuts import render from django.views.decorators.csrf import csrf_exempt from nix import settings import datetime from .models...
import warnings import unittest2 from mock import Mock import shippo from shippo.test.helper import ShippoUnitTestCase VALID_API_METHODS = ('get', 'post', 'delete') class HttpClientTests(ShippoUnitTestCase): def setUp(self): super(HttpClientTests, self).setUp() self.original_filters = warning...
# print((5>=10) or(1<2)) """ 2. my_list=[0]*6 [0, 0, 0, 0, 0, 0] print(my_list) """ """ my_list=[1,2,3,4,5,6] A=[my_list]*3 [[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6]] print A my_list[2]=45 [[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6]...
## soal 1 n = input() for i in range(n): print '0 ' * (i) + ' '.join(map(str, range(i + 1, n + 1))) ''' contoh input -> 5 contoh output -> 1 2 3 4 5 0 2 3 4 5 0 0 3 4 5 0 0 0 4 5 0 0 0 0 5 '''
def promising(i, vcolor): result = True j = 0 while j < i and result: if W[i][j] and vcolor[i] == vcolor[j]: result = False j += 1 return result def color(i, vcolor): if promising(i, vcolor): if i == n-1: print(vcolor) else: for c...
import sys sys.path.remove('/opt/ros/kinetic/lib/python2.7/dist-packages') import cv2 from core.detectors import CornerNet_Saccade from core.vis_utils import draw_bboxes detector = CornerNet_Saccade() image = cv2.imread("demo.jpg") bboxes = detector(image) image = draw_bboxes(image, bboxes) cv2.imwrite("demo_out....
#!/usr/bin/env python """ Created on Tue Oct 20 13:20:27 2015 @author: John Swoboda """ import os, inspect,glob import scipy as sp import shutil from RadarDataSim.utilFunctions import makedefaultfile from RadarDataSim.operators import makematPA from RadarDataSim.IonoContainer import MakeTestIonoclass from RadarDataSim...
# -*-coding:utf-8-*- import random def get_random_int(x,y): num = random.randint(x,y) return num print(get_random_int(10,20))
''' A place for some no-brainer basics :) ''' from PyQt5 import QtCore from PyQt5.QtWidgets import * class BasicTreeView(QTreeView): def __init__(self, parent=None): QTreeView.__init__(self, parent=parent) self.setAlternatingRowColors( True ) self.setSortingEnabled( True ) def setMod...