text
stringlengths
38
1.54M
from django.contrib import admin from django.urls import path, include from django.conf import settings from django.conf.urls.static import static from . import views as mainpgviews urlpatterns = [ path('', mainpgviews.home, name = 'home'), path('ask/', mainpgviews.ask.as_view(), name = 'askQ'), path('like...
import json import csv import os def open_file_json(file): output_data=[] for f in file: with open(f,"r",encoding="utf-8") as op_f: input_data=json.load(op_f) for data in input_data: output_data.append(data) op_f.close() return output_data def open...
# Generated by Django 2.0.3 on 2018-03-27 20:01 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('dashboard', '0006_auto_20180327_2037'), ] operations = [ migrations.AlterField( model_name='projectstatus', name='st...
""" import tkinter as tk window=tk.Tk() def open(): pass def exit(): window.quit() menubar = tk.Menu(window) filemenu=tk.Menu(menubar) filemenu.add_command(label="열기",command=open) filemenu.add_command(label="종료",command=exit) #quit menubar.add_cascade(label="파일", menu=filemenu) window.config(menu=menub...
import os is_pyd = os.environ.get('PYD') is_pynih = os.environ.get('PYNIH') def test_issue_39(): from issues import StaticMemberFunctions s = StaticMemberFunctions() assert s.add(1, 2) == 3 assert s.add(2, 3) == 5 assert StaticMemberFunctions.add(3, 4) == 7 def test_issue_40_c(): from issue...
""" Source: Stack Abuse Jump Search is similar to binary search in that it works on a sorted array, and uses a similar divide and conquer approach to search through it. It can be classified as an improvement of the linear search algorithm since it depends on linear search to perform the actual comparison when searchin...
def partition(arr, left, right): pivot = arr[(left+right) // 2] while left <= right: while arr[left] < pivot: left += 1 while arr[right] > pivot: right -= 1 if left <= right: arr[left], arr[right] = arr[right], arr[left] left += 1 right -= 1 return left def quicksort(arr, left, right): ...
"""Various car classes.""" from interact_drive.car.car import Car from interact_drive.car.fixed_velocity_car import FixedVelocityCar from interact_drive.car.planner_car import PlannerCar from interact_drive.car.linear_reward_car import LinearRewardCar from interact_drive.car.base_rational_car import BaseRationalCar fro...
__author__ = 'kummef' import Prisoner class SatanPrisoner(Prisoner.Prisoner): def chooseNextMove(self): return self.mean
from django.contrib import admin from . import models # Register your models here. admin.site.site_header = 'AmisCake Admin' admin.site.site_title = 'AmisCake Admin' admin.site.index_title = 'AmisCake Admin' @admin.register(models.Producto) class ProductoAdmin(admin.ModelAdmin): list_display = [ 'id', ...
import pickle from schafkopf.game_modes import SOLO, WENZ, PARTNER_MODE from schafkopf.suits import HEARTS, ACORNS from schafkopf.players.data.data_processing import switch_suits_player_hands, switch_card_suit, \ switch_suits_played_cards infilename = 'train_data.p' solo_filename = 'train_data_solo.p' wenz_filena...
from django.shortcuts import render # Create your views here. # import viewsets from rest_framework import viewsets from rest_framework.decorators import permission_classes from rest_framework.permissions import IsAuthenticated from rest_framework.authentication import TokenAuthentication # import local data from .se...
from grid import Grid import os import unittest class TestStringMethods(unittest.TestCase): def testCreateGrid(self): true = [0, 2, 4, 2], [0, 2, 8, 16], [0, 0, 0, 0], [2048, 0, 0, 1] test = Grid(true) for r in range(4): for c in range(4): self.assertEqual(test....
n = input() count = 0 for i in range(n): count = count + 1 wrd = raw_input() l = list(wrd) p = [] for j in l: if(len(p) == 0): p.append(j) elif(j >= p[0]): p.insert(0,j) else: p.append(j) str1 = ''.join(p) print "Ca...
from rest_framework import serializers from payments.models import StripeConnect from payments.utils import get_connect_url class StripeConnectSerializer(serializers.ModelSerializer): """ """ connected = serializers.SerializerMethodField() authorization_url = serializers.SerializerMethodField() ...
import logging import flask import flask_config from wsgiref.util import FileWrapper from pywkher import generate_pdf app = flask.Flask(__name__) app.static_folder = "public" app.SEND_FILE_MAX_AGE_DEFAULT = 0 @app.route('/') def home(): """Returns html that is useful for understanding, debugging and extending ...
import sys sys.path.insert(0, "..") import argparse import numpy as np from metric import score, human_score from utils import summary_level_correlation, system_level_correlation, get_realsumm_data def realsumm_by_examples(version=2): """ version=2 expected output: ================ System Level ==========...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Dec 2 18:26:56 2018 @author: loey """ import time import sys import csv import re csv.field_size_limit(sys.maxsize) filenames = dict() def main(): start_time = time.time() for i in ["train", "valid", "test"]: with open('split/training_'...
from __future__ import absolute_import, division, print_function, unicode_literals import tensorflow as tf import shutil from tensorboard.plugins.hparams import api as hp import matplotlib.pyplot as plt import os import io import utils.birds_dataset_utils as dataset_utils print("Num GPUs Available: ", len(tf.config....
from tweepy import OAuthHandler import tweepy import asyncio from discord.ext import commands import json class TwitInfo: A = B = C = D = None TI = TwitInfo() with open("twitter_keys.json", "r") as f: twitinfo = json.load(f) for k, v in twitinfo.items(): TI.__setattr__(k, v) # this is needle...
# coding=utf-8 # Copyright 2020 The Real-World RL Suite 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 appl...
#! /usr/bin/env python3 # contains class encapsulating data structure that holds reminders __copyright__ = 'Yovary' __author__ = 'karepker@gmail.com (Kar Epker)' import datetime import logging import sortedcontainers import threading class Reminders: """Holds reminders and controls insertion and sending of t...
import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot3d.axes3d import Axes3D # cmap=cm.coolwarm cmap=cm.rainbow def Print2DFunction(V, range_x, range_y, title='', path=None): assert V.shape == (len(range_x), len(range_y)) x,y = np.mgrid[range_x, range_y] fig...
class RouterTrieNode: def __init__(self): self.handler = None self.children = {} def insert(self, path): self.children[path] = RouterTrieNode()
def solution(array, commands): answer = [] for i in commands: l = sorted(array[i[0]-1:i[1]]) answer.append(l[i[2]-1]) return answer # Best Solution # def solution(array, commands): # return list(map(lambda x:sorted(array[x[0]-1:x[1]])[x[2]-1], commands)) def main(): array = [1,...
from time import time from functools import lru_cache # 题目链接: https://leetcode-cn.com/problems/climbing-stairs/ # 递推公式: f(n) = f(n-1) + f(n-2) (f(1)=1,f(2)=2) # 当n较大时,用递归会存在大量重复的存储与计算,效率低 # 自定义装饰器 # 参考链接: https://blog.csdn.net/mp624183768/article/details/79522231 def memo(func): cache = {} def wrap(*args): ...
"""Base implementations of the :mod:`pymap.interfaces.message` interfaces.""" from __future__ import annotations import re from collections.abc import Collection, Iterable, Mapping, Sequence from datetime import datetime from typing import Any, Final from .bytes import Writeable from .flags import SessionFlags from ...
# Generated by Django 3.2.4 on 2021-06-24 04:02 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('trivia', '0003_score'), ] operations = [ migrations.AddField( model_name='questionnaire', name='image', ...
import ee # Function to join two image collections based on images with the nearest dates. def data_join(left, right): data_filter = ee.Filter.maxDifference( difference=(24*60*60*1000), leftField='system:time_start', rightField='system:time_start' ) filter_join = ee.Join.saveBest(...
import base64 import json import pickle import zlib from typing import Any, ClassVar, Dict, Protocol, Type DEFAULT_CONTENT_TYPE = "pickle_compat" # Highest version of the protocol, understood by Python2. PICKLE_PY2_COMPAT_PROTO = 2 class Codec(Protocol): @classmethod def serialize(cls, message: Any) -> str:...
######################################## # create by :ding-PC # create time :2018-03-08 12:02:25.983533 ######################################## ''' 初始化权限资料 ''' from seeds.models_rm import * from app.models import * from app import create_app_swagger def init_rm_data(config): app = create_app_swagger(config).app ...
from selenium import webdriver # For using sleep function because selenium # works only when the all the elemets of the # page is loaded. import time from selenium.webdriver.common.keys import Keys # Creating an instance webdriver browser = webdriver.Chrome('C:/Users/ITPeople/code/Python/Autom...
from django.conf.urls import include, url from lost_and_found.views.sign_up import member_signup from lost_and_found.views.log_in import member_login from lost_and_found.views.update_user_info import update_user_info from lost_and_found.views.get_user_info import get_user_info from lost_and_found.views.check import ch...
# 一些PyTorch基础练习 import numpy as np import torch print(torch.eye(3)) points = 100 points = np.arange(points) print(points) np.random.shuffle(points) print(points) #print() result = torch.zeros(1, 9517) print(result) a = np.ones(3) x = torch.from_numpy(a) print(x) x = torch.Tensor([[1, 2, 3], [4, 5...
#https://www.thepythoncode.com/article/get-youtube-data-python from requests_html import HTMLSession from bs4 import BeautifulSoup as bs # importing BeautifulSoup videos = ["https://www.youtube.com/watch?v=tkvJQ5x-eEY&list=PLq1I6GEIwH6fdea1RoWbPwME0Bzjt8pnH", "https://www.youtube.com/watch?v=OKMoxMSCFng", ...
from xml.etree import ElementTree import yaml import pytest from vuecli.provider.provider import Provider @pytest.fixture def render_index(tmp_path): def render(config=None): tmp_path.joinpath("vuepy.yml").write_text(yaml.dump(config or {})) provider = Provider(tmp_path) return provider....
##### ANTECESSOR E SUCESSOR ##### """ CURSO EM VÍDEO - EXERCÍCIO PYTHON 005: Faça um programa que leia um número Inteiro e mostre na tela o seu sucessor e seu antecessor. Link: https://youtu.be/664e0G_S9nU """ ############################################################################### ### INÍCIO...
import torch from torch.nn.modules.loss import _Loss from torch.distributions import kl_divergence from .utils import mmd_rbf, mmd_imq, shuffle_code class MMDTCVAELoss(_Loss): def __init__(self, args): super().__init__() self.args = args if args.mmd_kernel == 'rbf': self.mmd =...
# projectile.py """updating projectile.py provides a simple class for modeling the flight of projectiles.""" from math import sin, cos, radians class Projectile: """Simulates the flight of simple projectiles near the earth's surfaces, ignoring wind resistance. Tracking is done in two dimensions, height (y) ...
import os import django def createClient(first_name, last_name, email): client = Client(first_name=first_name, last_name=last_name, email=email) client.save() return client def createExercise(name, description, time): exercise = Exercise(name=name, description=description, time=time) exercise.save...
from behave import * import ast from katas.your_order_please.your_order_please import your_order_please @given("sentence = {sentence}") def set_up_params_for_your_order_please(context, sentence): context.sentence = ast.literal_eval(sentence) @when("function 'your_order_please' is called with these params") def ex...
from moviepy.editor import * import sys import os import numpy as np min_fps = 10 min_colors = 40 min_dimension = 160 limit_size = 1000000 # FUNCTIONS DEFINATION # Get the width of the clip. def getClipWidth(clip): # Get the first frame of the clip. frame = clip.get_frame(0) return np.size(frame, 1) #...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import datetime class Migration(migrations.Migration): dependencies = [ ('slobbbyApp', '0005_auto_20141115_1348'), ] operations = [ migrations.AlterField( model_name='eve...
# -*- coding: utf-8 -*- import logging import time from apscheduler.schedulers.background import BackgroundScheduler from zvdata import IntervalLevel from zvt import init_log from zvt.recorders.joinquant.quotes.jq_stock_kdata_recorder import JqChinaStockKdataRecorder logger = logging.getLogger(__name__) sched = Bac...
''' Contém métodos para pesquisar informação na wikipedia usando a wikimedia API search_wiki(search_field, lang) -> recebe o conceito a pesquisar e a linguagem da wikipedia a usar e retorna o resumo da página encontrada ''' import wikipedia def search_wiki(search_field, lang='PT'): ''' Usa a API da wikimedia...
# Generated by Django 2.2 on 2019-05-26 11:20 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('survey', '0047_auto_20190526_1102'), ] operations = [ migrations.AlterField( model_name='question', name='answer_type'...
"""Registration code of Gym environments in this package.""" import gym from ._rom_mode import RomMode def _register_mario_env(id, **kwargs): """ Register a Super Mario Bros. (1/2) environment with OpenAI Gym. Args: id (str): id for the env to register kwargs (dict): keyword arguments for...
from functools import wraps import logging def log_and_discard_exceptions(fun): """ Wraps fun. If exceptions is caught, log the error and return None """ @wraps(fun) def decorator_function(*args, **kwargs): try: return fun(*args, **kwargs) except BaseException as e...
#!/usr/bin/env python3 import pypdfchptsplit if __name__ == '__main__': pypdfchptsplit.main()
from pathlib import Path import numpy as np import yt from astropy import table from . import run_attributes import sys sys.path.append(str(Path(__file__).parent.parent / "analysis_functions")) import age_spreads yt.funcs.mylog.setLevel(50) # ignore yt's output # =================================================...
n = int(input()) A = list(map(int, input().split())) second = 0 find_or_not = False main = -1 while not find_or_not: main += 1 second = main while second + 1 < n: if A[main] == A[second + 1]: find_or_not = True break second += 1 print(A[main])
from django.db import models from django.conf import settings from django_countries.fields import CountryField from django.contrib.auth.models import User from django.db.models.signals import post_save CATEGORY_CHOICES = ( ('Solid Neon Colour Adapter','Solid Neon Colour Adapter'), ('Solid Neon Color Blunt Box','Sol...
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'zach powers' __email__ = 'zcharlop@rockefeller.edu' __version__ = '0.1.0' from quickD3map import PointMap
# Create your models here. from django.db import models # Create your models here. from django.urls import reverse TYPE = ( ('VEHICLE', 'veh'), ('DUSTBIN', 'dust'), ) VEHICLE_TYPE = ( ('Mini', 'mini'), ('MICRO','micro'), ('SEDAN','sedan'), ('SUV','suv'), ) class Dustbin(models.Model): ...
def valid_parentheses(string): right = 0 for c in string: if right == 0 and c == ")": return False else: if c == ")": right += 1 elif c == "(": right -= 1 else: continue if right ...
#!/usr/bin/env python from os import path import logging as log import facebook import webapp2 from webapp2_extras import sessions import jinja2 from google.appengine.ext import db from google.appengine.api.app_identity import get_application_id FACEBOOK_APP_ID = "522368114539124" FACEBOOK_APP_SECRET = "e75e283da7fc0...
# encoding: utf-8 # import math import torch import itertools import numpy as np import torch.nn as nn import torch.nn.functional as F from grid_sample import grid_sample # from torch.autograd import Variable from tps_grid_gen import TPSGridGen import pdb class CNN(nn.Module): def __init__(self, num_output): ...
import numpy as np import scipy import matcompat # if available import pylab (from matlibplot) try: import matplotlib.pylab as plt except ImportError: pass def SAE(X, S, lamb): # Local Variables: A, C, B, S, W, X, lambda # Function calls: sylvester, SAE #% SAE is Semantic Auto-encoder #% Inp...
import os import sys sys.path.append('/home/will/Documents/data/lib/libsvm-3.17/python') from svmutil import * from voice import Voice import config #root_dir = '/home/will/Documents/data/luyin' def train(diretory = config.root_dir): '''Train all the files in diretory 'luyin' The diretory is made up of two subdiret...
import sys def giveBooks(): global N, M, want, given cnt = 0 for left, right in want: for book in range(left, right+1): if given[book] == 0: given[book] = 1 cnt += 1 break print(cnt) if __name__ == '__main__': TC = int(input(...
# -*- coding: utf-8 -*- # # Copyright 2018 Spotify AB. # # 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...
# Copyright (c) 2012, Walter Bender # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.utils import six import logging logger = logging.getLogger('django-send-messages-sms') class SMSMessage(object): """ A container for SMS information. """ encoding = None # None => use settings default def __init__(sel...
#region import import tornado.web import asyncio import json from pricelists.PriceListClient import PriceListClient from modules.kinetic_core.DateTimeEncoder import DateTimeEncoderCompact from web.handlers.BaseHandler import * #endregion class PricesListJSONHandler(BaseHandler): @allowedRole(Role.PHARMA_CLIENT) ...
import newspaper import newsapi from newsapi import NewsApiClient from newspaper import Article newsapi = NewsApiClient(api_key='b887d1939c004198a6f027703cb318e6') url = 'https://edition.cnn.com/2020/05/15/politics/trump-2016-instincts-pandemic-second-term/index.html' article = Article(url) article.download() article...
import torch import math import numpy as np import torch.nn as nn from models.encoder import PCNNEncoder, SACNNEncoder, CNNEncoder, SingleEncoder, SALayer from models.decoder import Decoder from models.cnn import PCNN, SelfAttentionConv, CNNLayer, ChannelParallelismCNN, FastCNNLayer, BlurCNNLayer, FCNNLayer from utils....
import argparse from pathlib import Path def build_parser() -> argparse.ArgumentParser: """ build parser :return: Argument parser """ DESCRIPTION = "Extract snippet in coq file (.v) generate by alectryon." parser = argparse.ArgumentParser(DESCRIPTION) INPUT_FILES_HELP = "coq file '.v'" ...
#!/Users/i346261/Documents/git/personal/django-first-project/my_ve/bin/python3.6 from django.core import management if __name__ == "__main__": management.execute_from_command_line()
#!/usr/bin/env python import optparse import os, sys, stat def which(program): ''' Returns the path to a given executable, or None if not found ''' import os if os.name == "nt": program += ".exe" def is_exe(fpath): return os.path.exists(fpath) and os.access(fpath, os.X_OK) fp...
import requests stranka = requests.get('http://thecatapi.com/api/images/get?format=src&type=gif') stranka.raise_for_status() print(stranka.status_code)
# 2021Feb07 Dog Food Timer from adafruit_circuitplayground import cp import time # 10 hours = 10 LEDs countdown_seconds = 60*60*10 # 10 hour production countdown_seconds = 60 # 1 minute test Rdefault = 0 Gdefault = 0 Bdefault = 0 # Countdown illumination Ron = 10 Gon = 10 Bon = 200 R = Rdefault G = Gdefault B = B...
from django.conf.urls.defaults import * from models import Entry # relative import info_dict = { 'queryset': Entry.objects.all(), 'date_field': 'pub_date', } urlpatterns = patterns('django.views.generic.date_based', (r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[\w-]+)/$', 'object_detai...
# f = open("h1.txt","w+") # li = ["hello world\n","this is nyc\n"] # f.writelines(li) # f.close() # f = open("h1.txt","a+") # # context = "goodbye" # # f.write(context) # f.close() # import os # if os.path.exists("h1副本.txt"): # os.remove("h1副本.txt") import os li = os.listdir(".") print(li) if "hello.txt" in l...
import json import requests from flask import Blueprint, request from app import config, utils, translations init_apis = Blueprint('init_apis', __name__) @init_apis.route('/api/config/v1/locations') @init_apis.route('/api/config/v1/keys') def locations(): if 'key' not in request.args: return utils.erro...
# This script takes a list of real values and finds the locations # of all local minima. The list of values is first smooth to reduce # noise and only return more 'legitimate' local minima. The function # returns the values of the list, at the minima. import numpy as np def findLocalMinima( list ) : # First use a...
import discord import os import asyncio from discord.ext import commands async def update_embed(listpages, page, url, f, message): newpage = listpages[page] if newpage[2] == "None": embed = discord.Embed(title=f'Document {f}', description=f'Page {page+1}') else: embed = discord.Embed(title=...
# ======================= # Importing the libraries # ======================= import sys directory = '/home/marquesleandro/lib_class' sys.path.insert(0, directory) from tqdm import tqdm from time import time import numpy as np import scipy.sparse as sps import scipy.sparse.linalg import search_file import import_ms...
# Copyright 2013 Google Inc. # # 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, merge, publish, dis- # trib...
class Lemmikki: def __init__(self, nimi, omistaja): self.nimi = nimi self.omistaja = omistaja def tulosta_tiedot(self): print(self.nimi) print(self.omistaja) class Koira(Lemmikki): def __init__(self, nimi, omistaja, rotu): super().__init__(nimi, omistaja) ...
import numpy n, m = map(int, input().split()) a = [] for i in range(n): a.append(list(map(int, input().split()))) my_array = numpy.array(a) print(numpy.mean(my_array, axis=1)) print(numpy.var(my_array, axis=0)) print(numpy.std(my_array))
from math import* r = float(input()) a = float(input()) n = int(input()) va = (4*(pi)*(r**3))/3 vc = ((pi)*(a**2)*(3*r-a))/3 com= va-vc if(n == 1): print(round(vc,4)) if(n == 2): print(round(com,4))
from rpy2ica import fastica as rica import numpy as np class TestICA: def setup(self): self.signals = np.vstack([np.sin([x/20.0 for x in xrange(1,1001)]),(1.0 + np.mod(xrange(1000),200) - 100.0)/100.0]) self.mixing = np.array([[0.291, 0.6557], [-0.5439, 0.5572]]) self.X = np.dot(self.mixing,...
import glob PATHS_REQUIRING_HEADER = ["kedro_server", "tests"] LEGAL_HEADER_FILE = "legal_header.txt" LICENSE_MD = "LEGAL_NOTICE.md" RED_COLOR = "\033[0;31m" NO_COLOR = "\033[0m" LICENSE = """Copyright (c) 2020 - present """ def files_at_path(path: str): return glob.glob(path + "/**/*.py", recursive=True) de...
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup entry_point = 'peer_count_reporter_component=peer_count_reporter_component:PeerCountReporterComponent' setup( name='trinity-peer-count-reporter-component', py_modules=['peer_count_reporter_component'], entry_points={ 'trini...
import os import csv bank_csv_path = os.path.join("..","Resources","budget_data.csv") results_txt_path = os.path.join("..","Output","budget_data_result.txt") with open (bank_csv_path,"r",newline = "") as bankfile: bankreader = csv.reader(bankfile,delimiter = ",") bankheader = next(bankreader) #...
''' Created on 15.08.2020 @author: Max Weise ''' '''This file contains all custom exceptions used in the 'main.py' module''' class NameException(Exception): message = '\n === Name may not contain spaces === \n' class NotFoundException(Exception): message = '\n === Element not found === \n' ...
import RPi.GPIO as GPIO, time GPIO.setmode(GPIO.BOARD) GPIO.setwarnings(False) red=11 yellow=13 green=15 GPIO.setup(red, GPIO.OUT) GPIO.setup(yellow, GPIO.OUT) GPIO.setup(green, GPIO.OUT) while (True): GPIO.output(red, GPIO.HIGH) time.sleep(5) GPIO.output(yellow, GPIO.HIGH) time.sleep(2) GPIO.output(red...
from Warhammer_2ed_Karta_Postaci.MaszynaLosująca import RzutyKoscia """ aby wylosować imie człowieka wpisz: wybierz_imie_czlowiek_mezczyzna() lub wybierz_imie_czlowiek_kobieta() aby wylosowac imie elfa wpisz: wybierz_imie_elf_mezczyzna() lub wybierz_imie_elf_kobieta() aby wylosowac imie krasnoluda wp...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 24 17:19:23 2020 @author: billcoleman Exploring and data munging for the emodb database .wav audio files labelled for emotions Based on: https://towardsdatascience.com/building-a-vocal-emotion-sensor-with-deep-learning-bedd3de8a4a9 # read file...
from airtravel import * flight = Flight("AB1234", Aircraft("G-UETP", "Airbus plane", num_rows=22, num_seats_per_row=6)) print(type(flight)) print(flight.number()) print(flight._number) print(flight.airline()) print(flight.aircraft_model())
''' M/M/1 ''' import simpy import numpy as np def generate_interarrival(): return np.random.exponential(1./5.0) def generate_service(): return np.random.exponential(1./4.0) def factory_run(env, servers): i = 0 while True: i += 1 yield env.timeout(generate_interarrival()) ...
# -*- coding: utf-8 -*- """ <DefineSource> @Date : Fri Nov 14 13:20:38 2014 \n @Author : Erwan Ledoux \n\n </DefineSource> The Documenter """ #<DefineAugmentation> import ShareYourSystem as SYS BaseModuleStr="ShareYourSystem.Standards.Guiders.Nbconverter" DecorationModuleStr="ShareYourSystem.Standards.Classors.Cl...
from .pages.product_page import ProductPage from .pages.basket_page import BasketPage from .pages.login_page import LoginPage import pytest import time @pytest.mark.authorized_user class TestUserAddToBasketFromProductPage(): @pytest.fixture(scope="function", autouse=True) def setup(self, browser): ema...
#problem 1 #the function isint(x) checks whether the string x is made of integer or has decimal def isint(x): for i in range(0,10): #assert: x is a string with a single element #invariant: the string does not contain intgers from 0 to i-1 #note here instead of str function indiviual ...
def get_role(number: int): invites_keys = roles.keys() invites_keys = sorted(invites_keys, reverse=True) for invites_needed in invites_keys: if number >= invites_needed: return roles[invites_needed] return None def get_next_role(number: int): invites_keys = roles.keys() inv...
# In order to run this file, please install bibtexparser, titlecase. # Both of them can be installed through pip. import bibtexparser from bibtexparser.bwriter import BibTexWriter from bibtexparser.bparser import BibTexParser from bibtexparser.customization import author, page_double_hyphen import re from titlecase im...
from core.sintaxe import sintaxe from util.field_util import rename_field from core.load_dump_file import ler_df from core import constants as constant import sys import getopt def compare_triggers(table1, table2) ->str: dif = False command = "" result_trigger_list = list() ## retira trigg...
class minmax_val(object): def __init__(self, min, max): self.min = min self.max = max def __iter__(self): yield self.min yield self.max def minmax(items, key=lambda x: x): min, max = None, None for item in items: if min is None or key(min) > key(item): ...
# Author Caozy from operation.models import UserAsk from django import forms import re class UserAskForm(forms.ModelForm): class Meta: model = UserAsk fields = ['name', 'mobile', 'course_name'] def clean_mobile(self): mobile=self.cleaned_data['mobile'] REGEX_MOBILE= "^(((13[0-...
# coding=utf-8 # shell class import random import config import datetime, time import math class Game: def __init__(self, contestmanager): self.contestmanager = contestmanager self.bot = contestmanager.bot self.questionData = None self.answers = [] self.star...