text
stringlengths
38
1.54M
# -*- coding: utf-8 -*- # Generated by Django 1.10.8 on 2017-09-24 05:45 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('users', '0005_user_token'), ] operations = [ migrations.AddField( ...
from django.shortcuts import render from django.views import generic from .models import Author, Blog, Comment # Create your views here. def index(request): """ View function for home page site It has numbers of various models """ # Number of authors num_author = Author.objects.count() # all...
def add(x, y): return x + y def subtract(x, y): return x - y def multiply(x, y): return x * y def divide(x, y): return x / y def power(x, y): return x ** y def main(): while True: print("Select calculator function please.") print("1 = Add") print("2 =...
""" This is a Pure Python module to hyphenate text. Wilbert Berendsen, March 2008 info@wilbertberendsen.nl License: LGPL. """ import sys import re __all__ = ("Hyphenator") hdcache = {} parse_hex = re.compile(r'\^{2}([0-9a-f]{2})').sub parse = re.compile(r'(\d?)(\D?)').findall def hexrepl(matchObj): return uni...
#!/usr/bin/python3 # -*- coding: utf-8 -*- """Hodor voting contest: level 3 Script that votes exactly 'votes_total' times for a given ID. Using the 'requests' module, this task requires to send as POST the ID, the 'holdthedoor' fields for which to properly tally a vote, and a key field from the form hidden from view....
from django.urls import path,include,re_path from rest_framework.routers import DefaultRouter from quiz import views from quiz.views import SaveUsersAnswer,UsersAnswerSerializer,Resultview router=DefaultRouter() router.register('Quiz',views.QuizViewSet) router.register('Questiondetail',views.QuestionDetailViewset) ...
# -*- coding: utf-8 -*- """ @Time : 2020/6/6 11:13 @Author : QDY @FileName: 25. K 个一组翻转链表_hard.py 给你一个链表,每k个节点一组进行翻转,请你返回翻转后的链表。 k是一个正整数,它的值小于或等于链表的长度。 如果节点总数不是k的整数倍,那么请将最后剩余的节点保持原有顺序。 示例: 给你这个链表:1->2->3->4->5 当k= 2 时,应当返回: 2->1->4->3->5 当k= 3 时,应当返回: 3->2->1->4->5 说明: 你的算法...
#First test evolution function. Oddly, performs only a little worse than Runge-Kutta. def Euler_Step(x,xres,dydx,Y): return dydx(x,xres,Y)*xres,xres def Ystep_euler(g,mx,sigmav,xstep=1e-2,Deltax=1e-4): Yeqset = lambda x: Yeq(mx,mx/x,g,0,0) neqset = lambda x: neq(mx,mx/x,g,0,0) #Find a point shortly be...
from django.contrib import admin from .models import CarOwner admin.site.register(CarOwner) from .models import Car admin.site.register(Car) from .models import OwnerShip admin.site.register(OwnerShip) from .models import DrivingLicense admin.site.register(DrivingLicense)
from numpy import* n=input("") i=0 d=3 o="." s="" while(i<len(n)): if(i<(len(n)-4)): s=s+n[i:d]+o else: s=s+n[i:d] i=i+3 d=d+3 print(s)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Apr 6 10:38:45 2023 @author: george """ #%matplotlib qt from matplotlib import pyplot as plt import numpy as np import skimage.io as skio from skimage.filters import threshold_otsu from skimage.morphology import closing, square, remove_small_objects,...
#encoding:utf-8 from django.db import models from django.contrib.auth.models import User # Create your models here. # Clase abstracta para el modelo de Personas que participan en el congreso class Persona(models.Model): username = models.CharField(max_length=30, unique=False) password = models.CharField(max_l...
import json from pathlib import Path from card2vec.feature_extraction.data_reading import read_cards, read_decks def test_read_cards(fixtures_dir): expected = json.load(Path(fixtures_dir, "read", "cards.json").open()) expected["int_to_card"] = {int(k): v for k, v in expected["int_to_card"].items()} actua...
# Generated by Django 2.2 on 2020-11-14 02:04 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('paper', '0068_paper_sift_risk_score'), ] operations = [ migrations.RemoveField( model_name='paper', name='sift_risk_score', ...
S=str(input("Introduceti sirul de caractere:")) a=S.count('A') print('Numarul de caract, "A" in sir: ', a) b=S.replace("A", "*") print('Substituirea caracterului A prin caract. *', b) c=S.translate({ord('B'):None}) print('Sirul fara de caract. B: ', c) d=S.count("MA") print("Numarul de silabe MA in sir: ", d) ...
import csv with open('C:\Users\Venric\Desktop/productsales.csv') as csvfile: mpg = list(csv.DictReader(csvfile)) print mpg for adict in mpg: print adict['PREDICT']
# -*- coding: utf-8 -*- import os import sys from functools import partial import maya.api.OpenMaya as om from Qt import QtWidgets, _loadUi from hz.naming_api import NamingAPI from lgt_import_tool.core import assign_shader, core, utils from lgt_import_tool.gui import basic_gui class PreviewWidget(QtWidgets.QWidget):...
# http://www.hackerrank.com/contests/python-tutorial/challenges/itertools-combinations from itertools import combinations s, k = input().split() for i in range(1, int(k)+1): print('\n'.join(sorted(map(lambda tup: ''.join(sorted(tup)), combinations(s, i)))))
import unittest import os, sys sim_path = os.path.abspath(os.path.join('..',)) sys.path.append(sim_path) from simulators.tennis import tennis_match, tennis_set, tennis_game import pandas as pd class TennisSimulatorTest(unittest.TestCase): ### Tests for Game class ### def test_game_minimum_amount_of_points(sel...
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-04-26 02:18 from __future__ import unicode_literals import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('order', '0004_auto_20160426_1058'), ] operations = [ migrati...
# -*- coding: utf-8 -*- __author__ = 'chuter' import util as qa_util from weixin.message.handler.message_handler import MessageHandler from core import emotion from weixin.message import generator from watchdog.utils import watchdog_warning, watchdog_error """ 默认的消息处理,对任何消息均回复自动回复内容 """ cl...
from django.shortcuts import render, redirect from django.contrib import messages from .models.import User # Create your views here. def index(request): return render(request, 'index.html') def register(request): errors = User.objects.registration_validator(request.POST) if len(errors) > 0: for...
# priority Queue using minheap here highest priority given to lowest value class minheap: #creating minheap class pq=list() #heap array def __init__(self,arr=list()): #constructor function if(len(arr)==0): for i in input("Enter the enements for priority queue:").split(): ...
# Generated by Django 3.1.7 on 2021-04-06 06:55 import django.core.validators from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Class', ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os, sys from winsys._compat import unittest import win32api import win32security from winsys.tests import utils as testutils from winsys import accounts @unittest.skipUnless(testutils.i_am_admin(), "These tests must be run as Administrator") cla...
from SMU_device import SMUDevice from PUND.PUND_waveform import create_waveform from PUND.plot_fig import * instrument_id = 'GPIB0::24::INSTR' smu = SMUDevice(instrument_id) smu.connect() """ params is a dictionary with key parameters for a PUND sweep. Vf - first voltage Vs - second voltage rise - number of measure...
#!/usr/bin/env python from fuzzyui import fuzzyui items = ["baseball", "football", "soccer", "programming", "cooking", "sleeping"] initial_search = '' fui = fuzzyui() found = fui.find(items) print(found)
# -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-12-03 11:55 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('system', '0042_insured_insured_ec_number'), ] opera...
import requests import json import string from pmisimilarity import * from cui_methods import * from nltk.corpus import stopwords from threading import Thread import nltk nltk.download('stopwords') # Construct the CUI matrix and store as a global variable print("--------------------------------------------------") pr...
#!/usr/bin/env python3 """ :Author: Anemone Xu :Email: anemone95@qq.com :copyright: (c) 2019 by Anemone Xu. :license: Apache 2.0, see LICENSE for more details. """ import preprocessing import settings import numpy from _theano.tokenizer import * def load_data(data_dir: str, label_dir: str, tokenizer: ...
from django.contrib import admin from models import Article class ArticleModelAdmin(admin.ModelAdmin): list_display = ["Title", "Start", "End"] list_display_links = None list_filter = ["Tag"] search_fields = ["Tag"] class Meta: model = Article admin.site.register(Article, ArticleModel...
from django.urls import path from systems import views urlpatterns = [ path ('', views.home, name='home'), #redirects to views.py and searches for home function for functionality path ('', views.base, name='base'), path ('', views.carList, name='carList'), path ('', views.popularCar, name='popul...
# coding: utf-8 from django.conf.urls import patterns, include, url from django.views.generic import DetailView from .views import HomeView from .views import Noticia urlpatterns = patterns('', url(r'^$', HomeView.as_view(), name='home'), url(r'(?P<secao>\w+)/$', HomeView.as_view(), name='capa-secao'), u...
from selenium import webdriver driver = webdriver.Firefox() driver.get("http://ocjene.skole.hr/") element = driver.find_element_by_name("user_login") element.send_keys("EMAIL_GOES_HERE") elementP = driver.find_element_by_name("user_password") elementP.send_keys("PASSWORD_GOES_HERE") driver.find_element_by_css_selecto...
#!/usr/bin/env python ''' Order merging for normalized eShel spectra. Author: Leon Oostrum E-Mail: l.c.oostrum@uva.nl ''' from __future__ import division import os import sys import glob from distutils.util import strtobool from bisect import bisect_left, bisect_right import numpy as np import matplotlib.pyplot as pl...
if __name__=="__main__": str = 'Runoob' print(str) # 输出字符串 print(str[0:-2]) # 输出第一个到倒数第二个的所有字符 print(str[0]) # 输出字符串第一个字符 print(str[2:5]) # 输出从第三个开始到第五个的字符 print(str[2:]) # 输出从第三个开始后的所有字符 print(str * 2) # 输出字符串两次 print(str + '你好') # 连接字符串
import sys def main(locid): f=open('tests','r') lines=f.readlines() newtxt='' for line in lines: newtxt+=line.replace('LOCID',locid) print newtxt if __name__ == '__main__': main(sys.argv[1])
#! /usr/bin/env python # Copyright (c) 2017, Cuichaowen. All rights reserved. # -*- coding: utf-8 -*- try: from caffe_pb2 import * except ImportError: raise ImportError(' No module named caffe_pb2 . ')
import os import re import requests import subprocess import sys from string import Template def load_template(filename): if os.path.isfile(filename): with open(filename, 'r') as template_file: template_string = template_file.read() if template_string: return Templa...
TEST_SETTINGS = { "CELERY_TASK_ALWAYS_EAGER": True, "CELERY_TASK_EAGER_PROPAGATES": True, "CELERY_BROKER_URL": "memory", "LOG_LEVEL": "ERROR", }
from scarpkg.log import logStart, logStop, logMsg, Log from scarpkg.get_variables import get_info, save_info from scarpkg.bot import Bot from scarpkg.bitso_functions import create_api import scarpkg.bitso_functions import scarpkg.images
"""This module contains the ``PlaywrightMiddleware`` scrapy middleware""" from importlib import import_module from scrapy import signals from scrapy.exceptions import NotConfigured from scrapy.http import HtmlResponse import random from .http import PlaywrightRequest from playwright.sync_api import sync_playwright ...
# Generated by Django 2.2.4 on 2020-02-04 08:33 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('organizations', '0097_remove_disciplinecredit_control_form'), ] operations = [ # migrations.AlterUniqueTogether( # name='studentdisciplin...
import numpy as np import matplotlib.pyplot as plt import cv2 import math img = cv2.imread("../img/Emma.jpg") img = cv2.resize(img,(600,800)) img_gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) kernel_size = (25,25) gauss = cv2.GaussianBlur(img_gray, kernel_size, 0) umbral_minimo = 85 umbral_maximo = 275 canny = cv2.Ca...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from copy import copy class Buckets: def __init__(self, length=0, default=None): # set default 'length' and 'default' so it passes b = Buckets() test self.default = copy(default) # copy passes assertNotEqual(id(default), id(b.default)) test ...
# Generated by Django 3.1.2 on 2020-10-17 16:43 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('users', '0004_auto_20201017_1540'), ] operations = [ migrations.RenameField( model_name='savedhouses', old_name='favourites'...
# MIT LICENSE # # Copyright 1997 - 2020 by IXIA Keysight # # 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 to use, copy, modify,...
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim: ai ts=4 sts=4 et sw=4 nu from __future__ import (unicode_literals, absolute_import, division, print_function) import logging from snisi_core.models.Projects import Domain logger = logging.getLogger(__name__) PROJECT_BRAND = "SMIR" DOMAIN_S...
# What is your favourite day of the week? Check if it's # the most frequent day of the week in the year. # You are given a year as integer (e. g. 2001). # You should return the most frequent day(s) of the week in that year. # The result has to be a list of days sorted by the order of days in week # (e. g. ['Monday...
# Generated by Django 2.2 on 2020-08-08 14:41 from django.db import migrations import django_resized.forms class Migration(migrations.Migration): dependencies = [ ('accounts', '0004_auto_20200808_1638'), ] operations = [ migrations.AlterField( model_name='menu', ...
#!/usr/bin/env python from modshogun import StreamingVwFile from modshogun import T_SVMLIGHT from modshogun import StreamingVwFeatures from modshogun import VowpalWabbit parameter_list=[[None]] def streaming_vw_modular (dummy): """Runs the VW algorithm on a toy dataset in SVMLight format.""" # Open the input file ...
# Created by MechAviv # ID :: [4000022] # Maple Road : Adventurer Training Center 1 sm.showFieldEffect("maplemap/enter/1010100", 0)
# -*- coding: utf-8 -*- # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.model.document import Document import re class EmployeeChangeIBAN(Document): def valida...
""" =============== Specific images =============== """ import matplotlib.pyplot as plt import matplotlib from skimage import data matplotlib.rcParams['font.size'] = 18 ###################################################################### # # Stereo images # ============= fig, axes = plt.subpl...
from django.http import HttpResponse from django.template import loader from django.http import JsonResponse from django.core import serializers import json import sys import OmniDB_app.include.Spartacus as Spartacus import OmniDB_app.include.Spartacus.Database as Database import OmniDB_app.include.Spartacus.Utils as...
class Solution(object): def maximumProduct(self, nums): """ :type nums: List[int] :rtype: int """ # maximum product must be max1 * max2 * max3 or max1 * min1 * min2 max1 = - sys.maxint max2 = - sys.maxint max3 = - sys.maxint m...
from backend.myBluePrint.ericic.paramVerify.dataCenterCheck import DataCenterCheck from backend.myBluePrint.ericic.service.dataCenterSercice import DataCenterService from backend.customer.myCustomer import APiMethodView from flask import request, make_response import uuid class DataCenter(APiMethodView): check_cl...
# Uses python3 #TFind the minimum number of coins needed to change the input value (an integer) into coins # with denominations 1, 5, and 10. # Input Format. The input consists of a single integer m. # Constraints. 1 ≤ m ≤ 103. Output Format. # Output the minimum number of coins with denominations 1, 5, 10 that cha...
from django.urls import path from trivia_builder.views import (TriviaQuizDeleteView, TriviaQuizUpdateView, TriviaQuizCreateView, TriviaQuizDetailView, TriviaQuizListView) urlpatterns...
import pygame import db.db_service DefenseMode = 0 AttackMode = 1 # Id, Size, Moverange, Healthpoints, Firerange, Firepower, Cannon sound # TODO use a dictionary instead? Scout = (0, 2, 4, 4, 3, 2, 'cannon_small') Avenger = (1, 3, 3, 5, 4, 3, 'cannon_big') QueenMary = (2, 4, 2, 6, 4, 4, 'cannon_big') class Ship: ...
import os, time, string, re import numpy as np if __name__ == "__main__": vocab = np.asarray([]) occurance = np.asarray([]) start_time = time.time() count = 0 with open("test_train.txt") as fx: for review in fx: temp = re.sub(r'[^\w\s]','', review).upper().split() ...
from django.contrib.admin.sites import AdminSite from jobadvisor.polls.admin import VariantInline from jobadvisor.polls.models import Variant # def test_variant_admin(rf): # request = rf.get("") # variant_inline = VariantInline(parent_model=Variant, admin_site=AdminSite()) # assert not variant_inline.has_...
word = input() word_askii = 'a' count_list = [0 for i in range(26)] max_count = 0 max_count_index = 0 same_count = 0 for i in range(0, len(word)): word_askii = ord(word[i]) if 90 >= word_askii > 64: count_list[word_askii - 65] = count_list[word_askii - 65] + 1 elif 122 >= word_askii > 96: ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Sep 14 10:28:01 2017 @author: kthomas1 """ next_week = 3 import warnings warnings.filterwarnings('ignore') # import pandas and numpy for import pandas as pd import numpy as np # connect to PostgreSQL import psycopg2 conn=psycopg2.connect("dbname='n...
import argparse import math import os import pdb import pickle import random import shutil import time from pprint import pprint import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.utils.data import torchvision import torchvision.models as mode...
try: import sys except ImportError: print("Module sysT not available.") try: import xmltodict except ImportError: print("Module xmltodict not available.") try: import xml.dom.minidom as dom except ImportError: print("Module XML.DOM.MINDOM not available.") pass try: import x...
 import os import random as rd board = [" "," "," "," "," "," "," "," "," "] computer_board = ['1', '2', '3', '4', '5', '6', '7', '8','9'] empty_error = False wrong_place = False wrong_input = False player = 'X' choice = None def print_header(): print(''' _____ _ ____ _____ ____ ____ _____ ____ ...
from django import forms from django.db import models from .models import Persona from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm class FormularioPersona(forms.ModelForm) : class Meta: model = Persona fields = ('nombre' ,'apellido', 'email...
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2019-03-26 18:38 from __future__ import unicode_literals import apps.store.models from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('store', '0002_auto_20190325_2357'), ] operations = [ ...
#%% import math import os from operator import itemgetter import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from graspy.cluster import GaussianCluster from graspy.embed import AdjacencySpectralEmbed, OmnibusEmbed from graspy.models import SBMEstimator from graspy.plot import ...
''' _ protected __ private ''' _a = "Protected" __a = "Private" class Produto: def __init__(self, nome, valor) -> None: self.__nome = nome self.__valor = valor # Getter def ler_nome(self): return self.__nome # Getter def ler_valor(self): return self.__val...
# -*- python -*- # ex: set syntax=python: import distroconf # This is a sample buildmaster config file. It must be installed as # 'master.cfg' in your buildmaster's base directory (although the filename # can be changed with the --basedir option to 'mktap buildbot master'). # It has one job: define a dictionary name...
from Camera import Camera class CameraHubsand(Camera): def createCamera(self): super().createCamera() return "Cámara de Hubsand"
from PIL import Image import PIL from python.utils.image_helper_utils import image_color_detection, landscape def append_exif_scoring_comments(model_comments, images1, tech_exif_score, null_count, flag_dim_v1, flag_dim_v2, flag_iso_v1, flag_iso_v2, flag_res_v1, flag_res_v2, flag_ape_v...
import requests import json apikey = "ENTER YOUR KEY HERE" response = requests.post("https://api.capmonster.cloud/getBalance", json = { "clientKey": apikey }) errorId = json.loads(response.text)['errorId'] try: balance = json.loads(response.text)['balance'] except KeyError: print("Invalid api key! Error co...
from django.conf.urls import url from Ufanisi import views app_name= 'Ufanisi' urlpatterns = [ url(r'^$', views.HomePageView.as_view()), url(r'^about/$', views.AboutPageView.as_view(),name='about'), url(r'^projects/$', views.MissionPageView.as_view(),name='projects'), url(r'^blog/$', views.BlogPageView....
#-*- encoding=UTF-8 -*- """ Crie uma função que retorna o fatorial de um dado número. o fatorial é representado pela seguência. 1,1,2,3,5,..n, onde um número k é sempre a soma dos seus dois anteriores. """ def fatorial(n): """ >>> fatorial(1) 1 >>> fatorial(2) 1 >>> fatorial(3) 2 >>> fatorial(5) 5 """ re...
import numpy as np import requests, torch, os, json import numpy as np from torch import nn from config import setting import tensorflow class UniversalEncoder(): FEATURE_SIZE = 512 BATCH_SIZE = 32 storage_dir = str(os.path.realpath("."))+"/search_data/faiss.json" def __init__(self, host, port): ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # pesquisa.py # # Copyright 2018 20181bsi0121 <20181bsi0121@SR6192> # # def main(): sexo = ''; olhos = ''; cabelo = ''; idade = ''; maior_idade = 0; total = 0; total_filtro = 0; porcentagem = 0; # recebendo valores print((total+1),'º) CADASTRO: ') sexo = ...
""" Compare observed and modeled amplitude and phase for all constituents at all stations. The goal is to determine optimum factors to use when modifying the tidal forcing in the model. """ import os import sys pth = os.path.abspath('../../LiveOcean/alpha') if pth not in sys.path: sys.path.append(pth) import Lfu...
# encoding:utf-8 from rest_framework.pagination import PageNumberPagination from rest_framework.response import Response from rest_framework.views import APIView from omv.serializers import OmvSerializer from rest_framework import status from rest_framework.permissions import IsAuthenticated, AllowAny from omv.models...
# coding: utf-8 """ """ import torch import torch.optim as optim import torch.nn as nn import os import time import copy import numpy as np import torch.nn.functional as F from tensorboardX import SummaryWriter from sklearn.metrics import confusion_matrix from visual_confuse_matrix import make_confusion_matrix from dat...
import os import cv2 import sys from sqlite3 import connect from PIL import Image import numpy as np from PIL.ImageQt import ImageQt from PySide6.QtCore import QThread, Signal from PySide6.QtCore import * from PySide6.QtGui import QIcon, QPixmap from PySide6.QtWidgets import QApplication, QWidget, QStackedWid...
#!/usr/bin/env python3 # Copyright (c) 2019 Bitcoin Association # Distributed under the Open BSV software license, see the accompanying file LICENSE. from test_framework.key import CECKey from genesis_upgrade_tests.test_base import GenesisHeightBasedSimpleTestsCase from test_framework.height_based_test_framework impor...
# Напишите программу, которая считывает со стандартного ввода целые числа, # по одному числу в строке, и после первого введенного нуля выводит сумму # полученных на вход чисел. s = 0 while True: a = int(input()) i = a s += i if a == 0: break print(s)
#!/usr/bin/env python3 ''' A friend of mine created this version. It's slower (2x), but more pythonic. A 25% gain was seen by using my file write function; although, that function could be improved. ''' import collections import itertools import sys #delims = (' ', '\n', '\t') delims = (32, 10, 9) def strcspn(hayst...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import fantaapp.models import fantaapp.models.auxfun class Migration(migrations.Migration): dependencies = [ ('fantaapp', '0021_auto_20150808_1507'), ] operations = [ migrations.AddF...
import cv2 import numpy as np lighting = { 'regular_lower_blue' : np.array([100, 160, 50]), 'regular_upper_blue' : np.array([135, 255, 255]), 'regular_lower_red1' : np.array([0,180,120]), 'regular_upper_red1' : np.array([10,255,255]), 'regular_lower_red2' : np.array([170,180,120]), 'regular_upp...
from vpyp.corpus import Vocabulary def segmentations(word): for k in range(1, len(word)+1): yield word[:k], word[k:] def affixes(words): prefixes, suffixes = zip(*[seg for w in words for seg in segmentations(w)]) prefixes = Vocabulary(start_stop=False, init=set(prefixes)) suffixes = Vocabulary...
#!/usr/bin/env python3 n, *a = map(int, open(0).read().split()) A = 1 for i in a: A *= 2 - i%2 print(3**n - A)
#!/usr/bin/python3 import dnstwist import whois import sys import signal import time import argparse import warnings from os import path, environ from sendgrid import SendGridAPIClient from sendgrid.helpers.mail import Mail import json import queue global args def standardize_json(domains=[], fields=['fuzzer','domai...
import unittest from exc01 import divide_ten class TestExc01(unittest.TestCase): def test_divide(self): self.assertEqual(divide_ten(0), 'fail!') if __name__ == '__main__': unittest.main()
# x만큼의 데이터를 입력 받아서 x+1 의 값을 예측해낸다. #Import the libraries import math import pandas_datareader as web import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from keras.models import Sequential from keras.layers import Dense, LSTM import matplotlib.pyplot as plt plt.style.use(...
# Copyright (c) 2013, Pullenti. All rights reserved. Non-Commercial Freeware. # This class is generated using the converter UniSharping (www.unisharping.ru) from Pullenti C#.NET project (www.pullenti.ru). # See www.pullenti.ru/downloadpage.aspx. import typing from pullenti.unisharp.Utils import Utils from pul...
#!/usr/bin/python # UDP Reflector # # Displays and optionally forwards packets to a wireshark receiver # Listens on a well known port 27000 (ie fixed) # By default displays all packets but will filter using simple character matching (no wild carding) # # # Command line options # # filterstring - display packets contai...
# Copyright 2021 Collate # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software...
from django.contrib.auth.forms import AuthenticationForm from django import forms from models import * from django.db import models from django.forms import ModelForm # If you don't do this you cannot use Bootstrap CSS class LoginForm(AuthenticationForm): username = forms.CharField(label="Usuario", max_length=30, ...
#! /usr/bin/env python3 ''' A module providing a test class that tests the API independent of the actual underlying database, ''' __author__ = 'Russel Winder' __date__ = '2012-08-20' __version__ = '1.2' __copyright__ = 'Copyright © 2010–2012 Russel Winder' __licence__ = 'GNU Public Licence (GPL) v3' from personRecor...
from rest_framework import serializers from .models import order from products.models import product from products.serializer import productSerializer class oderSerializer(serializers.ModelSerializer): #orderProduct=productSerializer(many=True) class Meta: exclude=('seen',) model=order
from app1.models import * from app1.util.utils import * def delStudent(request): ''' URL: http://127.0.0.1:8000/app6/delStudent?stid=2019003 调用参数: 学生编号:stid ''' try: if(request.method=='POST'): studata=json.loads(request.body) data=studata["data"] ...