text
stringlengths
38
1.54M
""" This is where all image conversions occur """ from PIL import Image import numpy as np import cv2 def pil_to_cv(img_array): """ PIL image object to an OpenCV image object """ # pylint: disable=no-member return cv2.cvtColor(np.asarray(img_array), cv2.COLOR_RGB2BGR) def cv2_to_pil(img_array): ...
import time import random from bot.src.user_session import UserSession from bot.src.structures import User from bot.src.resources import current_user, media PAUSE_FOR_NEW_ITER = [3000, 5000] class Bot(object): """ >> bot = Bot(user: user) >> await bot.start() """ def __init__(self, user: User)...
# coding=utf-8 # Copyright 2021 The Ravens 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...
from dataset.imdb import IMDB from dataset.pascal_voc import PascalVOC from dataset.cityscape import CityScape from dataset.coco import coco from dataset.DOTA import DOTA_oriented,DOTA from dataset.UCAS import UCAS
user_pwd = { "bob": "bob@123", "sally": "sally@123", } user_names = { "bob": "Welcome, Bob!", "sally": "Welcome, Sally!", } def users_info(): return user_pwd, user_names
#Day 6 Assignment a=[] b=int(input("Enter the numner of element you want in the list:")) for i in range(0,b): c=int(input("Enter the number:")) a.append(c) print(a) e=0 d=0 for j in a: if j%2==0: e += 1 else: d +=1 print("Even number in the list: ",e) print("odd number in the...
from django.shortcuts import render, redirect from django.http import HttpResponse, HttpResponseRedirect from django.http import JsonResponse from .forms import * import copy import json import urllib.request import urllib.parse from django.views.decorators.csrf import csrf_exempt from django.views.decorators.cache imp...
import pytest, json, logging, hashlib, uuid from flask import Flask, request, json from app import cache from blueprints import db, app from blueprints.article.model import Articles from blueprints.article_topic.model import ArticleTopics from blueprints.user.model import Users def call_client(request): client = a...
#import the ncessary packages import imutils import cv2 class BasicMotionDetector: def __init__(self, accumWeight=0.5,deltaThresh=5,minArea=5000): #determine the openCv version, followed by storing the # frame accumlation weight, the fixed threshold for te delta # image, and finally the minimum area eqruied ...
import unittest import sys from os.path import join, abspath, dirname sys.path.insert(0, abspath(join(dirname(''))) + '/..' ) from tokenizer import TokenType, generate_tokens class TestTokenizer(unittest.TestCase): def setUp(self): code_js_file = open('fixtures/syntax.js') self.code_js = unicode...
#!/usr/local/bin/pyenv python # Created by carrot at 2018/6/20 """ """ def main(): pass if __name__ == "__main__": main()
def main(): N=int(input()) for num in range(0,N): string = input() arr = [] flag=0 for s in string: if s in arr: print("Yes") flag=1 break else: arr.append(s) if flag==0: print("No") if __name__ == "__main__" : main()
## Preprocess functions import os, pickle, glob import pandas as pd import numpy as np from skimage import io from skimage.transform import resize from keras.preprocessing.text import Tokenizer from keras.preprocessing.sequence import pad_sequences #from skip_thoughts import configuration #from skip_thoughts import enc...
"""TcEx Framework Module""" # third-party from requests import Session # first-party from tcex.api.tc.v3.case_attributes.case_attribute import CaseAttribute, CaseAttributes class CaseManagement: """Case Management Args: session: An configured instance of request.Session with TC API Auth. """ ...
from bs4 import BeautifulSoup from datetime import datetime try: from urlparse import urljoin except ImportError: from urllib.parse import urljoin import requests import os from tools import create_folder, download_image_wget if __name__ == '__main__': created_time = datetime.now() date = str(crea...
# Written by Nick Napora and Alex MacLeod for CPSC 250L Spring 2019 at Christopher Newport University # Assignment written by Matthew Bartgis # Adapted from Tom's Pong # Rabbototo character created by Nick Napora import math import os import pygame from pygame.locals import * import struct SIZE = WIDTH, HEIGHT = 512,...
from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * import sys class MyPyOpenGLTest: def __init__(self, width=640, height=480, title='MyPyOpenGLTest'): glutInit(sys.argv) glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH) glutInitWindowSize(width, height) ...
from rest_framework import generics from rest_framework.response import Response from .models import Card, TaskSatuses from .serializers import CardSerializer class DisplayCards(generics.ListCreateAPIView): serializer_class = CardSerializer def get_queryset(self): return Card.objects.filter(assignee...
import os import copy import logging import multiprocessing import statistics from typing import List, Tuple, Callable, Dict, Any from .interfaces import TimeInterval, Time, Token, ProcessorSnapshot from .processor import ProcessorConfig, Processor, ProcessorIPC class Board: class ProcessState: def __init...
# coding: utf-8 # Encontra Menores # (C) 2016, Yovany Cunha / UFCG, Programação 1 def encontra_menores(num,lista): menor = 0 outro_menor = 0 count = 0 aux = 0 while count < len(lista): if lista[count] < num: menor = lista[count] return menor break count += 1 if count == len(lista): return -1 lis...
import random from hashlib import sha256 # from pyunit_prime import get_large_prime_length #随机生成指定长度大素数 # from pyunit_prime import is_prime #判断素数 # from pyunit_prime import prime_range #输出指定区间素数 p = 18604511303632357477261733749289932684042548414204891841229696446591 q = 2238810024504...
import json import cv2 import pickle as pkl import torchvision.models as models import torch import torch.nn as nn mode_list=['train', 'val', 'test'] with open('word_list.pkl', 'rb') as f: n = pkl.load(f) word2idx = pkl.load(f) idx2word = pkl.load(f) for mode in mode_list: print(mode) file_name =...
# Generated by Django 2.1.5 on 2019-02-25 11:28 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('catalogue', '0015_auto_20190225_1127'), ] operations = [ migrations.AlterModelOptions( name='supplier', options={'ordering':...
# Generated by Django 2.2.5 on 2019-09-23 15:06 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('student', '0002_auto_20190923_2050'), ] operations = [ migrations.AddField( model_name='studentdetailinfo', ...
# Copyright - Yasen Kostov, 2020 # Bratac.net # https://github/ykostov # 23 XI 20 import time print () print ("Welcome to the Crossbill cypher. You are now in Crossbill - Text mode ") time.sleep(2) a = input("Type your Crossbill: ") a_new = a.replace('31415', 'a').replace('32284', 'b').replace('62643', 'c').repla...
pontos=int(input("pontosinicias")) sorteio1=int(input("sorteio1")) sorteio2=int(input("sorteio2")) from math import* dano1=int(((5*sorteio1)**0.5+pi**(sorteio2/3))) dano2=((5*sorteio2)**0.5+pi**3) danos=dano1+dano2 total=pontos-dano1 print(total)
''' 给定一个仅包含数字 2-9 的字符串,返回所有它能表示的字母组合。 给出数字到字母的映射如下(与电话按键相同)。注意 1 不对应任何字母。 示例: 输入:"23" 输出:["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"]. 说明: 尽管上面的答案是按字典序排列的,但是你可以任意选择答案输出的顺序。 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/letter-combinations-of-a-phone-number 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 ''' class ...
#!/usr/bin/env python import os import sys import getopt from sys import stderr import boto.ec2 _ec2 = None def short_usage(): print >>stderr, """Usage: ec2-host [-t TAG] [NAME] ec2-host django8 => ec2-XX-19-113-121.compute-1.amazonaws.com Try `ec2-ssh --help' for more information.""" def full_usage():...
# Generated by Django 3.2 on 2021-04-23 14:29 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('authentication', '0006_followmodel_followers'), ('index', '0012_alter_post_views'), ] operations = [ ...
from PIL import Image, ImageDraw import json data = json.load(open('stats/width_height.json')) canvas_w = 25000 canvas_h = 25000 im = Image.new('RGBA', (canvas_w, canvas_h), (255, 255, 255)) draw = ImageDraw.Draw(im) for x in data: print(data[x]) height = float(data[x]['hw'][0]) width = float(data[x]['hw'][1]) ...
N = int(input()) k = int(input()) left = 1 # k 번째 수는 k보다 클 수가 없다. right = k while left <= right: mid = (left + right) // 2 cnt = 0 # A 행렬은 index 1부터 시작하므로 1~N for i in range(1, N+1): # i행에 x보다 작은 숫자의 갯수는 x를 i로 나눈 몫임 (단, N보다 클 수 없음) cnt += min(mid//i, N) if cnt < k: left = ...
__author__ = 'Lisa' import jsonmaker import pickle data = pickle.load(open('../data/taggedData.txt')) wordFrequenciesByYear = [] print len(data) #year based processing letters = [] currentYear = 2013 outgoingLetters = 0 incomingLetters = 0 outgoingLetterTraffic = [] outgoingWordTraffic = [] incomingLetterTraffic = ...
#_*_ encoding:utf-8 _*_ from __future__ import division,print_function import os import logging import shutil import sys """ 确保oracle 软件的安装路径和所建立数据库名称(db_name)与要拷贝的数据库名称一致, 并且在关闭状态. """ # Print iterations progress def printProgressBar (iteration, total, prefix = '', suffix = '', decimals = 1, length = 50, fill = '█...
import tensorflow as tf from tensorflow.keras import Model from tensorflow.keras.layers import Layer, Conv2D, BatchNormalization, LeakyReLU,\ ReLU, Conv2DTranspose, Dropout, ZeroPadding2D, Input, Activation from tensorflow.keras.activations import tanh import tensorflow_addons as tfa # For testing INPUT_SHAPE = ...
""" You are given a string s consisting of only lowercase English letters. In one operation, you can: Delete the entire string s, or Delete the first i letters of s if the first i letters of s are equal to the following i letters in s, for any i in the range 1 <= i <= s.length / 2. For example, if s = "ababc", then in...
import util.classify import util.text_utils from util import io as dt import numpy as np from sklearn.datasets import fetch_20newsgroups from keras.datasets import imdb from rep import pca, ppmi, awv # import nltk # nltk.download() from data import process_corpus from util.save_load import SaveLoad from util import spl...
from API import audio from time import sleep from analysis import audio as analysis_audio from plot import plotter from stepperControl import StepperControl StepperControl.initialize() api = audio() api.setup() a = 1 while( int(a) != 0): a = raw_input() StepperControl.stepper_move(int(a)) StepperControl.st...
from django.core.exceptions import ValidationError from django.utils.translation import ugettext_lazy as _ def validate_even(value): if value % 2 != 0: raise ValidationError( '%(value)s is not an even number', params={'value': value}, ) def clean_email(value): email = value if ".edu" in email: raise...
users=[] f1=open('../in-yh//industry_yh_node_num_n.txt','r') f2=open('../in-yh//计数_cora.txt','w') for line in f1.readlines(): line = line.strip() s = line.split() users.append(int(s[1])) user_dict = {} for user in users: if user not in user_dict: user_dict[user] = 1 else: user_dict[...
import bs4 import os import io import sys import svgwrite import csv import math as m mult=float(sys.argv[2]) def adjsort(adjlist): return int(adjlist.get('node')) def spherical2decart(shPoint,radius): decPoint = [] decPoint.append(radius*m.cos(shPoint[0])*m.sin(shPoint[1])) decPoint.append(radius*m.sin(shPo...
# Python | a += b is not always a = a + b....! # # In python a += b doesn’t always behave the same way as a = a + b, # same operands may give the different results under different conditions... list1 = [5, 4, 3, 2, 1] list2 = list1 list1 += [1, 2, 3, 4] print(f"list1 : {list1}") print(f"list2 : {list2}") # expressio...
import pytest from contextlib import ExitStack as does_not_raise from linkedlist import Node class Solution: def partition(self, node, x): """ Partition a list into a left and right section, with a given boundary value x. Create two lists (using dummy nodes), and add each item of the list...
# -*- coding: utf-8 -*- from government_spider.items import GovSpiderItem import scrapy import re # 从日志上来看是没问题的 class GuiZhouSpider(scrapy.Spider): name = "guizhou" def start_requests(self): yield scrapy.Request('http://www.gzsggzyjyzx.cn/jygkjsgc/index_1.jhtml') yield scrapy.Request('http://w...
import nltk from nltk.stem import RSLPStemmer #nltk.download('rslp') #nltk.download('punkt') def Tokenize(sentence): sentence = sentence.lower() sentence = nltk.word_tokenize(sentence) return sentence def Stemming(sentence): stemmer = RSLPStemmer() phrase = [] for word in sentence: ...
# -*- encoding: utf-8 -*- import consort from zaira.materials.background_dynamic_attachment_expression.definition \ import background_dynamic_attachment_expression from zaira.materials.sustained_rhythm_maker.definition \ import sustained_rhythm_maker wind_tranquilo_music_specifier = consort.MusicSpecifier( ...
from django.shortcuts import render, redirect from django.views.generic import ( TemplateView, ListView, DetailView, UpdateView, CreateView, DeleteView, FormView, ) from django.contrib.auth.mixins import LoginRequiredMixin from .forms import ExistenciaForm, FilterExistenciaForm from .models import Existencia import ope...
class IdentifyingWood: def check(self, s, t): s=sorted(s) t=sorted(t) for c in t: if c in s: s.remove(c) else: return "Nope." return "Yep, it's wood." IdentifyingWood().check("xoxoxoxo","ooxxoo")
#coding=utf-8 import os import chardet from bs4 import BeautifulSoup import glob from com.missArthas.bs4.Html2Text import Html2Text class PairFinder(object): ''' URL模式的底表 字符集底表 ''' enFlagList = ['en', 'eng', 'english', 'en-us'] cnFlagList = ['zh', 'zh-cn', 'ch', 'chi', 'sc', 'schi', 'han', 'u...
from appium import webdriver from selenium.webdriver.support.wait import WebDriverWait import os import time import traceback class BiLin(object): driver = None launch_time = 15 wait_time = 3 net_wait_time = 5 message_content = '支付宝年终大回馈,超大红包免费领,你还不知道吗?,打开支付宝首页搜索“499754”,即可领红包,每天都可以领取哦20181202' ...
#import pyximport #pyximport.install(pyimport = True) import numpy as np import sys import os.path #np.random.seed(13) import glob from keras.models import Sequential, Model from keras.layers import Embedding, Reshape, Activation, Input, Flatten, merge from keras.layers.merge import Dot from keras import regularizers...
import json from datetime import datetime from rmf_fleet_msgs.msg import Location #from rna_task_msgs.msg import Location as rna_pos import nudged class map_transformer: def __init__(self, doman_pionts, range_pionts): # list of [x,y] points self.trans = nudged.estimate(doman_pionts, range_pionts)...
# coding: utf-8 import pandas as pd from flood_data.project_db_scripts.get_server_data import data_dir def clean_lists(l, first): combined = [a[0] + "&" + a[1] for a in l] combined_clean = [a.replace("'", "") for a in combined] if first: combined_clean = [a.replace("&", " & ") for a in comb...
from google2pandas import * query = {\ 'ids' : '71568478', 'metrics' : 'pageviews', 'dimensions' : ['date', 'pagePath', 'browser'], 'filters' : ['pagePath=~iPhone', 'and', 'browser=~Firefox'], 'start_date' : '8daysAgo', 'max_results' : 10} conn = GoogleAnalyticsQu...
from tkinter import * # In this question you will complete a tkinter interface. # This interface is designed to help students understand # even and odd numbers. The interface has one entery in # which users will type an integer. (feel free to assume # that the users will correctly type an integer, that is, # it is OK ...
# Definition for an interval. class Interval: def __init__(self, s=0, e=0): self.start = s self.end = e class Solution: # @param intervals, a list of Intervals # @param newInterval, a Interval # @return a list of Interval def insert(self, intervals, newInterval): if len(inte...
from . import Anime from . import Games from . import Members from . import Pets from . import Utils
def area_rectangulo(altura, anchura): return altura * anchura print('area del renctangulo con 3 de alto y 4 de ancho: ', area_rectangulo(3, 4))
# #########selection sort############## # def sel(arr): # for i in range(len(arr)): # min = arr[i] # flag = i # for j in range(i+1, len(arr)): # if arr[j]<min: # min = arr[j] # flag = j # arr[i], arr[flag]= min, arr[i] # print(arr) ...
''' Description Given two array A1[] and A2[], sort A1 in such a way that the relative order among the elements will be same as those in A2. For the elements not present in A2. Append them at last in sorted order. It is also given that the number of elements in A2[] are smaller than or equal to number of elements in A...
# Make a random choice from a list of options global choose async def choose(message, args): choices = args[0].split(' or ') if len(choices) < 2: choices = args[0].split(', ') if len(choices) < 2: choices = args[0].split(' ') if len(choices) < 2: await sendEmbed(message.channel, 'Choose', 'Please give m...
#!/usr/bin/env python from vigir_sm_generation.sm_generation import generate_sm from vigir_synthesis_msgs.srv import GenerateFlexBESMRequest from vigir_synthesis_msgs.msg import ( SynthesisErrorCodes, FSAutomaton, AutomatonState ) from flexbe_msgs.msg import StateInstantiation import unittest import yaml ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Aug 27 23:37:42 2018 @author: lywang Problem 42: Coded triangle numbers """ import unittest ordAm1 = ord('A') - 1 def read_words_file(file_name): with open(file_name) as f: data = f.read() f.close() data = data.split(',') dat...
#Add print(2 + 7) #sub print(2-7) #into print(2*7) #div print(2/7) #power print(2**3) #interger number print(2//7) #String print('Python') print('Python ' + 'is ' + 'awesome') print('python '*2) print(8+.2)
from django import forms from django.contrib.auth.models import User from models import * class RegistrationForm(forms.Form): first_name = forms.CharField(max_length=100) last_name = forms.CharField(max_length=100) username = forms.CharField(max_length=50) email = forms.CharField(max_length=50) password = forms...
from sklearn.decomposition import PCA from sklearn.preprocessing import StandardScaler as scaler %run ML_data %run define_pca_model data0 = ML_data(generate_random = True, nrandom_templates = 3000) data1 = ML_data() data2 = ML_data(evol_model = False) data = [data0, data1, data2] fpca, lpca = combine_ml_data(data) f...
import discord import os import time import requests import json import random from discord import FFmpegPCMAudio from pypresence import Presence import discord.ext from googleapiclient.discovery import build from discord_slash import SlashCommand, SlashContext from discord.utils import get from discord.ext import comm...
#捕获未知错误 try: num = int(input("请输入整数:")) result = 8 / num print(result) except ValueError: print("输入正确的整数") except Exception as result: print("未知错误%s" %result) #输出未知异常result
from django.db import models class Price(models.Model): title = models.CharField("Название", max_length=50, unique=True) price = models.IntegerField("Удельная цена за 1 час") description = models.TextField("Описание", blank=False, null=True) def __str__(self): return self.title class City(m...
import pandas as pd filename = "chicago.csv" df = pd.read_csv(filename) df['Start Time'] = pd.to_datetime(df['Start Time']) df['hour'] = df['Start Time'].dt.hour # print(df['hour'].isnull().sum().sum()) popular_hour = df['hour'].value_counts().idxmax() popular_hour_1 = df['hour'].mode()[0] # print(df.head()) # ...
from django.contrib import admin from .models import Product_List, Traders class TradersListAdmin(admin.ModelAdmin): fields = ['trader_name'] admin.site.register(Traders,TradersListAdmin) class ProductListAdmin(admin.ModelAdmin): fieldsets = [ ('業者 商品名', {'fields':['trader']}), (None,{'fi...
from .Car import Car def fib(num): if num == 0: return 0 elif num == 1: return 1 else: return fib(num-1) + fib(num-2)
from __future__ import unicode_literals from django.apps import AppConfig class MytutorialAppConfig(AppConfig): name = 'mytutorial_app'
# Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import _ from odoo.addons.website_sale.controllers.main import WebsiteSale from odoo.http import request, route class L10nARWebsiteSale(WebsiteSale): def _get_mandatory_fields_billing(self, country_id=False): """Extend m...
from .form_digest_auth import HttpFormDigestAuth, HttpFormDigestAuthException __all__ = ('HttpFormDigestAuth', 'HttpFormDigestAuthException')
from .activationView import EmailActivationView from .passwordView import ForgotPasswordView, ResetPasswordView, CheckResetPasswordTokenView # from .loginView import UserLoginView
from Products.Archetypes.public import listTypes from Products.Archetypes.Extensions.utils import installTypes, install_subskin from Products.CcWorldwide.config import PROJECTNAME, GLOBALS from StringIO import StringIO def install(self): out = StringIO() installTypes(self, out, listTypes(PROJECTNAME), PROJEC...
#!/usr/bin/env python3 import pdb, csv, os from datetime import datetime from PaySlip import PaySlip from CsvFile import CsvFile if __name__ == "__main__": src_field_names = ['First Name', 'Last Name', 'Annual Salary', 'Super Rate', 'Payment Start Date'] out_field_names = ['Name', 'Pay Period', 'Gross Income...
from math import cos, sin from typing import Tuple from code2021.MyGeometric.linesegment import LineSegment from code2021.MyGeometric.polyline import PolyLine from code2021.railway.huanhe import Huanhe from excel.excel import FlatDataModel from excel.railwayroute.mileage import Mileage from vector3d import Vector3D ...
from controller import * class UIFrigider: def __init__(self): self.__ctrl=ControllerAlimente() self.__ctrl.getRepo().loadFromFile("a") def filtrare(self): nrzile=raw_input('Numar zile: ') try: nrzile = int(nrzile) lista = self.__ctrl.filtrareDupaZ...
import numpy as np import pandas as pd import random import matplotlib.pyplot as plt def fitness(route): route = list(route) route.insert(0, 0) route.append(0) xy = cities.iloc[route] sub = xy - xy.shift(1) subsquared = sub[:-1] ** 2 euclid = np.sqrt(subsquared.sum(1)) dist = sum(eucli...
import sys def number_of_moves(n: int): if n == 1: return 1 else: return 2 * number_of_moves(n - 1) + 1 def hanoi(n, source, destination, auxiliary): if n==1: print(source + " " + destination) return hanoi(n - 1, source, auxiliary, destination) print(source + " " ...
try: from colorama import Fore, init, Back pass except ImportError: print("[-] Install Colorama using pip or pip3...") from main_func.write_func import * from main_func.read_func import * from utils.write_util import * from utils.read_util import * from max_msg_length import * import optparse imp...
#!/usr/bin/python from House import House from Event import Event from Player import Player from Mask import Mask class Game(): Turns = 5 Event = None House = None Players = [] nOfPlayers = 0 BestSolution = None TempSolution = None Solution = [] MaxMissConvergence = 0 #FileName = "" def __init__(Turns =...
f1=open("d:\\testfile1.txt","r+") f2=open("d:\\testfile.txt","w+") line1=f1.read() line2=f2.read() f2.write(line1.replace('\"','\\\"')) f1.close() f2.close()
""" TESTS is a dict with all of your tests. Keys for this will be the categories' names. Each test is a dict with "input" -- input data for a user function "answer" -- your right answer "explanation" -- not necessarily a key, it's used for an additional info in animation. """ TESTS = { "Basics": [ ...
class Solution: def isMonotonic(self, A): """ :type A: List[int] :rtype: bool """ n=len(A) index1,index2=0,0 for i in range(1,n): if A[i]>=A[i-1]: continue else: index1=1 for i in range(1,n): ...
from typing import Tuple from selenium.webdriver import Chrome,ChromeOptions from selenium.webdriver.common.keys import Keys from selenium.webdriver import ActionChains from time import sleep import logging from datetime import datetime as dt from os import getcwd from Python.Wifi import Wifi from Python.Segment impo...
from __future__ import unicode_literals from django.apps import AppConfig class SarpensteinConfig(AppConfig): name = 'sarpenstein'
#Embedded file name: eve/client/script/environment/spaceObject\playerShip.py """ the PlayerShip class handles ships that are controlled by players. """ import trinity import math from eve.client.script.parklife.states import lookingAt from eve.client.script.environment.spaceObject.ship import Ship class PlayerShip(Shi...
import argparse from argparse import RawTextHelpFormatter from blockstats.blockstats_importer import BlockstatsImporter from blockstats.mongo import Mongo from blockstats.stats import Stats from blockstats import blockstats_logging from blockstats import snapshots_printer COMMANDS_HELP = """ import - imports data fro...
# 322. Coin Change # https://leetcode.com/problems/coin-change/ class Solution: def coinChange(self, coins: List[int], amount: int) -> int: dp = [amount+1]*(amount+1) dp[0] = 0 for i in range(1, amount+1): for j in range(len(coins)): if coins[j] <= i: ...
from gainful.models import * from gainful.onereach import * from controller_helpers import * from flask import Blueprint, redirect, render_template, request, url_for from flask_login import login_required import requests users = Blueprint('users', __name__) @users.route("/") @login_required def list(): """Renders...
from visual import * from particula import * from vecinosHash import * import operacionesVectoriales class Dinamica: def __init__(self, sistemaParticulas, h): self.sistemaParticulas = sistemaParticulas self.numeroParticulas = sistemaParticulas.getNumeroParticulas() self.distanc...
#!/usr/bin/evn python3 # python speech emotion revcognitin usin ravdess dataset # import needed packages import os import librosa import numpy as np import pandas as pd import ntpath import sys sys.path.append('/media/bagustris/bagus/dataset/Audio_Speech_Actors_01-24/') from read_csv import load_features # n...
import os WIDTH = '18' WID = 16 DEPTHNAME = '4k' DPTH = 4096 PTRN_LEN = 4 DEPTH = str(int(DPTH/PTRN_LEN)) PERLINE = f'{int(256/(PTRN_LEN*WID))}' print(PERLINE) # data = [ # '"3f000 0f000 0f000 0f000"', # '"0f000 3f000 0f000 0f000"', # '"0f000 0f000 3f000 0f000"', # '"0f000 0f000 0f000 3f0...
""" 230. Kth Smallest Element in a BST Medium Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may assume k is always valid, 1 ≤ k ≤ BST's total elements. Example 1: Input: root = [3,1,4,null,2], k = 1 3 / \ 1 4 \ 2 Output: 1 Example 2: Input:...
# 718. Maximum Length of Repeated Subarray # https://leetcode.com/problems/maximum-length-of-repeated-subarray/description/ class Solution: def findLength(self, A, B): """ :type A: List[int] :type B: List[int] :rtype: int 更好的 DP 版本 改善點 1 ) dp array size 直接多設一...
# Generated by Django 2.2.2 on 2019-06-24 17:05 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('interviews', '0002_auto_20190624_1756'), ] operations = [ migrations.RemoveField( model_name='interview', name='interview_da...
from django.db import models from .slice import * # Create your models here. class Book(models.Model): title = models.CharField(max_length=50, default="", unique=True) page_number = models.PositiveIntegerField() page = models.ImageField(null=True, blank=True, upload_to="img/%y") def __str__(self): ...
# -*- coding: utf-8 -*- import KBEngine from KBEDebug import * import utility import const import random class iRoomRules(object): def __init__(self): # 房间的牌堆 self.tiles = [] self.meld_dict = dict() def swapSeat(self, swap_list): random.shuffle(swap_list) for i in range(len(swap_list)): self.players_...