text
stringlengths
8
6.05M
from car import Car #Simple version of electric car class class ElectricCar(Car): """Represents simple version of electric car""" def __init__(self,make,model,year): """Inherit and initialize attributes of car""" super().__init__(make,model,year) self.battery = Battery() class Ba...
import configparser import logging import os import sqlite3 import time import scripts.genetic as gen dirname = os.path.dirname(__file__) logging.basicConfig(filename='resources/gen.log', level=logging.INFO) logging.info(f'--------- Genetic eval: {time.asctime()} ----------') conf = configparser.ConfigParser() conf...
#!/usr/bin/env python # # Copyright 2016 MIT Lincoln Laboratory, Massachusetts Institute of Technology # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use these files except in compliance with # the License. # # You may obtain a copy of the License at # # http:#www.apache.org/license...
#!/usr/bin/env python # -*- coding: UTF-8 -*- # # Copyright (c) 2013-2014, gamesun # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above ...
from django.shortcuts import render from rest_framework import viewsets, status, mixins from rest_framework.decorators import action from rest_framework.response import Response from rest_framework.views import APIView from rest_framework.permissions import IsAuthenticated, AllowAny, IsAdminUser from rest_framewo...
from socketIO_client import SocketIO, BaseNamespace from sysPathList import * import base64 from encryptFS import * from decrpyter import * import sys import os sys.path.insert(0, '../python-tools') from Tracket import speak from multiprocessing import Process import getpass from pygame import mixer # Load t...
from typing import Tuple import pytorch_lightning as pl import torch import torch.nn as nn from omegaconf import DictConfig from pytorch_lightning.core import LightningModule from pytorch_lightning.metrics.functional import accuracy from torch import optim from torch.optim.lr_scheduler import ExponentialLR, ReduceLROn...
from flask import request,jsonify,abort from app import app import base64,os,json,shutil #myIPBroadcaster @app.route('/api/v1.0/ip_upload',methods=['POST']) def ip_upload(): data=[] json_dict=request.get_json() myPath="/tmp/visionquest/conf/" if not os.path.exists(myPath): os.makedirs(myPath) ...
from django.test import TestCase from apps.core.models import News from apps.api.tests import data_creator class NewsTestCase(TestCase): def setUp(self): News.objects.bulk_create([News(**data) for data in data_creator(400)]) def test_get_news(self): news = News.objects.get(site='example345.co...
import os import warnings import pytest import numpy as np import yaml from contextlib import contextmanager # import pkg_resources from pyrealm import pmodel # RPMODEL bugs # rpmodel was using an incorrect parameterisation of the C4 ftemp kphio curve # that is fixed but currently (1.2.0) an implementation error in t...
import csv import operator class IrysSpecificator(object): def __init__(self): """ load sample data and generate characteristics """ self.sample_data = 'iris.csv' self.species = ({ 'setosa': { 'sepal_length': [], 'sepal_width': []...
# -*- coding: utf-8 -*- import os import irc3 from stat import S_ISFIFO __doc__ = r''' ========================================== :mod:`irc3.plugins.fifo` Fifo plugin ========================================== Allow to cat something to a channel using Unix's fifo .. >>> from irc3.testing import IrcBot >>> fro...
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import numpy as np # Import data df = pd.read_csv('medical_examination.csv') # Add 'overweight' column cm_m = (df['height']/100)**2 bmi = df['weight']/ cm_m df['overweight'] = bmi.apply(lambda x:1 if x>25 else 0 ) # Normalize data by making 0...
import hashlib from selenium import webdriver import urllib.request import urllib import os from deepface import DeepFace import cv2 import urllib.request import re from webdriver_manager.chrome import ChromeDriverManager class ChromefoxTest: def __init__(self, url, nameoffolder , paging, max=None): self...
# -*- coding: utf-8 -*- from unittest import TestCase from ..identity import ( identity_text_normalizer, ) class IdentityTextNormalizersTestCase(TestCase): def test_identity_text_normalizer_normalize(self): result = identity_text_normalizer.normalize( sentence='我超懶惰 我就是想耍廢 KerKer ><', ...
# -*- coding: utf-8 -*- from transition import * from state import * import os import copy from sp import * from parser import * from itertools import product from automateBase import AutomateBase class Automate(AutomateBase): def succElem(self, state, lettre): """State x str -> list[State] ...
import os import csv # Path to collect data from the Resources folder dir_path = os.path.dirname(os.path.realpath(__file__)) #print(dir_path) os.chdir(dir_path) budget_csv = os.path.join('Resources','election_data.csv') #start to read my CSV file with open(budget_csv, 'r',encoding="utf-8") as csvfile: # Split...
# number = sum = counter = 0 # while number != 999: # number = float(input("Digite o numero: ")) # if number != 999: # sum += number # counter += 1 # print(f'Numbers: {counter}') # print(f'Sum: {sum}') sum = counter = 0 while True: number = int(input('Enter a number: ')) if number == ...
#!/usr/bin/env python import socket import time import sys import subprocess from multiprocessing import Process global clientName global s clientName = "" """ Get local inet_ip address """ def getInetIP(): try: socket.gethostbyname(socket.gethostname()) except socket.error as msg: print "Not connect...
Author = 'Liu Lei' from lib.aa import C obj=C() print(obj.__module__)#输出模块 print(obj.__class__)#输出类
#################################DATA INPUTS################################## run = "2019-09-20_R1-2" pulls = 6 pullRejMan = [] pullAutoAgree = "y" pullRejJump = ["y",0.1] pullRejHys = ["y",9.0,"y"] pullRejRValue = ["y",0.9,"y"] #################################PLOT CONTROLS################################ pullShowRaw...
"""A module for post processing BigDFT calculations. """ def _system_command(command, options): """ Run the command as ``os.system (command + options)`` Args: command (str): the actual command to run. options (str): the options to pass to the command. """ from subprocess import cal...
# @Title: 求根到叶子节点数字之和 (Sum Root to Leaf Numbers) # @Author: 2464512446@qq.com # @Date: 2020-10-29 00:49:03 # @Runtime: 36 ms # @Memory: 13.6 MB class Solution: def sumNumbers(self, root: TreeNode) -> int: def helper(root,prev): if not root: return 0 total = prev * 1...
#!/usr/bin/env python2 # extract_social_statistics.py --- # # Filename: extract_social_statistics.py # Description: # Author: Niels Zeilemaker # Maintainer: # Commentary: # # # # # Change Log: # # # # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public...
import collections from inputplotdataISM import inputplotdict #plotlist=['figTztrackstart_m12m_warmout'] plotlist=['figsfrmockturtot_m11_m12'] #plotlist=['figpcrpthgrid_m12'] #plotlist=['figTztrackstart_m12i_hotfastout'] #plotlist=['figTztrackstart_m12i_warmssout'] #plotlist=['figTztrackstart_m12i_warmslowout'] #plotli...
# 2D List application: # grids (screen pixels) # tabular data (spreadsheet, table) # matrices ==> "Graphs" # game boards # storing, accessing data from scientific experiments # 2D indices can be used to access DOM elements # 2D list = list of lists # Maze can be interpreted as graphs -> * as ob...
from flask import Flask, render_template app = Flask(__name__) @app.route("/home") @app.route("/") def home(): return "<h1>Hello World!</h1>" @app.route("/tempage") def tempage(): return render_template("template.html") if __name__ == "__main__": app.debug = True app.run(host="localhost", p...
if __name__ == "__main__": n, p, x, y = map(int, input().split()) meowth_pages = p // (n - 1) my_pages = p if n % p == 0: meowth_pages += 1 print(meowth_pages * y + my_pages * x)
import logging import sqlalchemy_utils from scripts import udf from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker import scripts.env_vars as env_vars from scripts import config from scripts.models import models as db logger = udf.setup_logging() logger = logging.getLogger(__name__) engine ...
from design_corpus import design #test1: get 3phone sorted by total selected 0.5h duration. test_design = design(csv_path='metadata.csv', skip=3, read_mode='ljspeech', sorted_mode=0, log_file='./logs/test_ljspeech_3phone_bytype_by0.5dur.log') sentences = test_design.get_sent(num=None, wavs_dir='../data/LJSpeech-1.1/wa...
#!/usr/bin/env python ''' Name: blink_port.py Purpose: Blinks one of the 28 valid ports Author: Aldo Nunez ''' # Import GPIO module import wiringpi as wipi import time import sys def check_port ( phys_port ): # number of ports plus one N = 41 # checks if physical port number is between 0 - 40 ...
from django.contrib import admin from .models import Mydb @admin.register(Mydb) class MydbAdmin(admin.ModelAdmin): list_display = ['id','name','age','address','mobile']
from datetime import timedelta def daterange(start_date, end_date): for n in range(int ((end_date - start_date).days + 1)): yield start_date + timedelta(n) def hours_minutes(td): days = td.days hours = td.seconds//3600 minutes = (td.seconds//60)%60 hours = hours + (days * 24) if hours < 0: return ...
from django.db import models from django.contrib.auth.models import User from django.contrib import admin import PIL from PIL import Image class Album(models.Model): title = models.CharField(max_length=60) album_cover = models.ImageField(upload_to="images/", blank=True, null=True, ) user = models.ForeignK...
#!/usr/bin/python """Unittest for the class FileStorage""" import unittest import pep8 from datetime import datetime from models.engine.file_storage import FileStorage from models.user import User from models import storage class FileStorageTest(unittest.TestCase): """Defines tests for class BaseModel""" de...
#!/usr/bin/env python3 """Convert a GECAS-AMS date string to a sqlite date column.""" import sys import datasimple.sqlite as sqlite3 # Use our standin helper def log(msg, *args): """Simple output function.""" if args: msg = msg.format(*args) print(msg) def main(): """Entry point.""" ...
immediate_family = [{ "Name": "Julia", "Last name": "Carranza", "Relationship": "Mother" }, {"Name": "July", "Last name": "Carranza", "Relationship": "Sister" }]
from textblob import TextBlob import praw import statistics reddit = praw.Reddit(client_id='', client_secret="", password='', user_agent='Python', username='') def search(sub,num=25): topic="Post Game Thread:" all = reddit.subreddit(sub) ...
# Generated by Django 3.1.1 on 2020-11-25 02:42 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('core', '0002_authgroup_authgrouppermissions_authpermission_authuser_authusergroups_authuseruserpermissions_django'), ('core', '0002_authtokentoken'), ] ...
import sys import re txt="""39 61 61 56 20 5C 61 54 1E 20 6B 61 67 20 65 61 5E 68 57 56 20 61 60 57 20 5F 61 64 57 20 55 5A 53 5E 5E 57 60 59 57 20 5B 60 20 6B 61 67 64 20 5C 61 67 64 60 57 6B 20 20 46 5A 5B 65 20 61 60 57 20 69 53 65 20 58 53 5B 64 5E 6B 20 57 53 65 6B 20 66 61 20 55 64 53 55 5D 20 20 49 53 65 60 19 6...
""" This program defines a function that counts the number of valid rhyme schemes with 'k' lines. Each line of the poem is assigned a letter so that all lines with the same letter rhyme with one another. The first time that a letter is used in a rhyme scheme, it must be the earliest letter in the alphabet yet to be use...
#!/usr/bin/python3 def lookup(obj): """Returns the dir as a list""" return dir(obj)
def main(): a = int(input("Digite seu primeiro número: ")) b = int(input("Digite seu segundo número: ")) c = int(input("Digite seu terceiro número: ")) def ordem(num1, num2, num3): if num1 <= num2 and num2 <= num3: print("crescente") else: print("não está em ordem crescente") ordem(a,b,c) main()
from django.contrib import admin import nested_admin from .models import * # Register your models here. class ProductInOrdersInline(nested_admin.NestedTabularInline): fk_name='order' model = ProductInOrders extra = 0 class OrderAdmin(nested_admin.NestedModelAdmin): list_display = ('customer_name','total_price'...
from uf import XFN import unittest class XFNTestCase(unittest.TestCase): def setUp(self): self.xfn_invalid = """<a href="http://anders.conbere.org" rel="tag">Anders Conbere</a>""" self.xfn_valid = """<a href="http://anders.conbere.org" rel="contact colleague something">Anders Conbere</a>""" ...
from itertools import islice nums = [int(line) for line in open('in').readlines()] low = nums[0] prev25 = set(islice(nums, 0, 25)) ans = None # 466456641 # 52858841 for idx, num in enumerate(islice(nums, 25, None)): canbeformed = False for addend in prev25: if num - addend in prev25: canbefor...
import uuid from cassandra.cqlengine.models import Model from cassandra.cqlengine import columns from .comment_udt import CommentUDT class InviteModel(Model): id = columns.UUID(primary_key=True, default=uuid.uuid4) date = columns.date() establishment_id = columns.UUID() artist_id = columns.UUID() ...
import tkinter import windnd from tkinter.messagebox import showinfo def dragged_files(files): msg = '\n'.join((item.decode('gbk') for item in files)) print(msg) tk = tkinter.Tk() tk.title("请拖放文件") windnd.hook_dropfiles(tk,func=dragged_files) tk.mainloop()
import os import shutil if __name__ == '__main__': part = 'valid' labelPath = 'D:/PythonProjects_Data/CMU_MOSEI/Metadata/standard_%s_fold/' % part dataPath = 'D:/PythonProjects_Data/CMU_MOSEI/AudioPart/Step2_AudioCut/' savePath = 'D:/PythonProjects_Data/CMU_MOSEI/AudioPart/Step3_SeparateFold/%s/' % par...
def print_max(a, b): if a > b: print(a, 'is maximum') elif a == b: print(a, 'is equal to', b) else: print(b, 'is maximum') # for some reason it wants two lines both before and after function definitions print_max(3, 4) print_max(42, 42) x = 5 y = 7 print_max(x, y) # Local Varia...
def fibonacci(n): cajaA = 1 cajaB = 0 count = n - 1 fibList = [1] while count > 0: cajaB = cajaA + cajaB cajaA = cajaB count = count - 1 fibList.append(cajaB) continue print(cajaA) print(fibList) n = int(input("Number? ")) fibonacci(n)
import utils import sys import gv import inout from update_manifest import project_manifest_name from logger import L def main(args): show_version_manifest() pass def show_version_manifest(): num_version = gv.cdn_version() cdn_path = utils.join_path(gv.cdn_path(), project_manifest_name) client_pat...
# coding=utf-8 """ pyserial 简单测试(python2) """ import serial import struct import logging def run_server(): ser = serial.Serial('COM3', 38400, timeout=0, parity=serial.PARITY_EVEN, rtscts=1) s = ser.read(100) print struct.unpack('!f', s[:4]) ser.write(str...
import sqlite3 from flask import Flask, render_template, redirect, url_for, request app = Flask(__name__) #just gonna go ahead and add some dummy thingys for now, since we're really just looking to exploit this data and read/edit/delete it #SELECT * from usernames where name = usr OR 1=1 @app.route('/login', method...
import socket import thread import time __author__ = "Sushant Raikar" __email__ = "sushantraikar123@yahoo.com" class SocketClient: """ ================= Pub Sub Generic Client ================= Description: This is a generic client implementation. All interaction with the broker is done throug...
#!/usr/bin/python """ ----------------------------------------------- DTX Select All Controls Written By: Colton Fetters Version: 1.0 First release: 12/19/2016 -------------------------------------------------- """ import maya.cmds as cmds class SelectControls(object): def do_select_all_ctrls(self,...
#!/usr/bin/python # -*- coding: utf-8 -*- # #*** <License> ************************************************************# # This module is part of the repository CNDB. # # This module is licensed under the terms of the BSD 3-Clause License # <http://www.c-tanzer.at/license/bsd_3c.html>. # #*** </License> **************...
####################################################################### ## Objeto que representa un comando ## ####################################################################### ## Importa objeto padre from objects import Thing ## Definicion del objeto class Command(Thing): ...
from pyautogui import typewrite, hotkey import time, os, sys parentdir=os.path.abspath(os.path.dirname(os.path.dirname(__file__))) sys.path.insert(0,parentdir) from autoFunction import click, clickd, move, moved, scroll, write, writec, exist, dec, drag, shot def testcase(): move('xiaoshou', dx = 0, dy= -15) c...
""" Contains upgrade tasks that are executed when the application is being upgraded on the server. See :class:`onegov.core.upgrade.upgrade_task`. """ from onegov.core.upgrade import upgrade_task from onegov.org.models import Organisation from sqlalchemy import Column, Integer, Enum from onegov.core.orm.types import U...
from distutils.core import Extension, setup from Cython.Build import cythonize # define an extension that will be cythonized and compiled ext = Extension(name="FingerPrint", sources=["FingerPrint.py"]) setup(ext_modules=cythonize(ext))
# https://www.kaggle.com/c/noaa-fisheries-steller-sea-lion-population-count/discussion/33900 # https://www.kaggle.com/c/noaa-fisheries-steller-sea-lion-population-count/discussion/34546 #import numpy as np #import pandas as pd #import cv2 #import sys import os #import matplotlib.pyplot as plt import PIL import PIL.I...
import os import shutil images_label = '/mnt/data/rsna-pneumonia-detection-challenge/stage_2_train_labels.csv' images_path = '/mnt/data/rsna-pneumonia-detection-challenge/stage_2_train_images_jpg/' new_images_path = '/mnt/data/rsna-pneumonia-detection-challenge/new_stage_2_train_images_jpg/' with open(images_label) a...
from hpp.corbaserver.manipulation.constraint_graph_factory import ConstraintFactoryAbstract, GraphFactoryAbstract from tools import Manifold, Grasp, PreGrasp, OpFrame, EndEffector from .solver import Solver ## Affordance between a gripper and a handle. # # This class allows to tune the behaviour of the robot when gras...
W = int(input()) N, K = map( int, input().split()) A = [0]*N B = [0]*N dp = [[0 for _ in range(W+1)] for _ in range(K+1) ] for i in range(N): a, b = map( int, input().split()) A[i] = a B[i] = b for i in range(1,K+1): for j in range(W,0,-1): for k in range(N): a, b = A[k], B[k] ...
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-02 09:46 from __future__ import unicode_literals from django.conf import settings import django.core.validators from django.db import migrations, models import django.db.models.deletion import django_countries.fields import taggit.managers import userprof...
""" Faça um programa que faça o computador jogar jokenpô com você """ from random import choice PPT = ('PEDRA', 'PAPEL', 'TESOURA') condicao = True while condicao: escolhadopc = choice(PPT) suaescolha = str(input('Escolha (Pedra, Papel ou Tesoura): ')).upper().strip() if suaescolha in PPT: print...
from setuptools import setup, find_packages setup(name='shapefile2geojson', version='0.1', description='Processor for converting Shapefiles to GeoJSON format', url='http://github.com/geoedf/shapefile2geojson', author='Rajesh Kalyanam', author_email='rkalyanapurdue@gmail.com', licens...
num = input() sum = 0 for x in num: sum += eval(x) pinyin = ['ling', 'yi', 'er', 'san', 'si', 'wu', 'liu', 'qi', 'ba', 'jiu'] for k, v in enumerate(str(sum)): if k != 0: print(' ', end='') print(pinyin[eval(v)], end='')
from flask import Flask, render_template import os app = Flask(__name__) tabs = [ { 'name': 'Work', 'index': 'work', 'template': 'work.html' }, { 'name': 'About', 'index': 'about', 'template': 'about.html' }, { 'name': 'Support', ...
""" 给定一个三角形 triangle ,找出自顶向下的最小路径和。 每一步只能移动到下一行中相邻的结点上。相邻的结点 在这里指的是 下标 与 上一层结点下标 相同或者等于 上一层结点下标 + 1 的两个结点。也就是说,如果 正位于当前行的下标 i ,那么下一步可以移动到下一行的下标 i 或 i + 1 。 示例 1: 输入:triangle = [[2],[3,4],[6,5,7],[4,1,8,3]] 输出:11 解释:如下面简图所示: 2 3 4 6 5 7 4 1 8 3 自顶向下的最小路径和为 11(即,2 + 3 + 5 + 1 = 11)。 示例 2: 输入:triangle = [[-10]]...
import numpy from keras.models import Sequential from keras.layers import Dense from keras.layers import LSTM from keras.layers.embeddings import Embedding from keras.preprocessing import sequence from keras.callbacks import ModelCheckpoint import json import word_table as w_t from keras.utils import np_utils from erro...
# -*- coding: utf-8 -*- # Copyright: (C) 2018-2020 Lovac42 # Support: https://github.com/lovac42/HoochieMama # License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html CUSTOM_SORT = { 0:["None (Equivalent to V2)", "order by due, random()"], # == User Config ======================================...
import logging import os from . import questions def get_datasets(prob, questions_dir, batch_size, cache_dir=None, cache_mem=False): def get_question_batches_dataset(p, k): q = questions.individual.get_dataset(questions_dir, p) if cache_dir is not None: cache_path = os.path.join(cache...
import os from django.utils.translation import ugettext_lazy as _ import dj_database_url SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY') gettext = lambda s: s BASE_DIR = os.path.dirname(os.path.dirname(__file__)) DATA_DIR = os.path.join(BASE_DIR) """ Django settings for CBF project. Generated by 'django-admin sta...
def insertionsort(l): for i in range(1,len(l)): ele = l[i] j = i-1 while(ele<l[j] and j>=0): l[j+1] = l[j] j-=1 l[j+1] = ele print(l) insertionsort([19,2,5,8,-9,99,34,-1])
from django.urls import path,include from .import views from django.contrib.auth import views as auth_views urlpatterns = [ # post views #path('login/', views.user_login, name='login'), #path('login/',auth_views.LoginView.as_view(),name='login'), #path('logout/',auth_views.LogoutView.as_view(),name='logout'), #pat...
# coding: utf-8 from .NeteaseDownloader import Downloader import sys, os, requests, argparse import threading import queue def download_music(queue, folder, name): while not queue.empty(): item = queue.get_nowait() content = requests.get(item['url']).content with open('%s/%s - %s.mp3' %(fo...
def reader(fname): fopen = open(fname, "r") result = [] for line in fopen: list = line.split() try: list[0] = int(list[0]) list[2] = int(list[2]) list[3] = int(list[3]) list[4] = float(list[4]) except: fopen.close() ...
a = 50 #正常定义,自动选类型 b = int(50.1) #float 强制转换 int c = round(50.7) #输出int,取小数点后约数 d = float(50) #float e = "Hello Ass!" #字符串 f = ''' HIHI Your ASS!! '''#输出段落 g = 'This is \na string'#断开字段 h = "Hello" i = 'This is %s string' % h #连接字符串1 j = 'This is {} string'.format(h)#连接字符串2 k = (1,2,3,4,5,6,7,8,9)#tupl...
from discord.ext import commands from rubybot.utils import checks class Admin(commands.Cog): def __init__(self, bot): self.bot = bot @commands.command(hidden=True) @checks.is_owner() async def sudoku(self, ctx): await ctx.send("Bye bye") exit(0) def setup(bot)...
""" Game Board app views. """ from django.shortcuts import render def llist_game_board(request): """Redirect to the game board view.""" # Change this to the actual React frontend for game board when ready. print("here") return render(request, 'index.html')
# Arrange benchmark data into table fromLevel = 0 toLevel = 193 def main(): table = [] for i in range(fromLevel, toLevel + 1): with open('times/time%d' % i) as f: time = f.read().strip() #print '%d -> %lf' % (i, float(time)) table += [float(time)] p...
from Tokenizer import Tokenizer from Constants import Symbols, Keywords, TokenTypes from os import remove from sys import exit class CompilationEngine: _class_subroutine_dec_keywords = {Keywords.METHOD, Keywords.CONSTRUCTOR, Keywords.FUNCTION} _class_var_dec_keywords = {Keywords.FIELD, Keywords.STATIC...
plik = open('mojplik.txt', 'r') linijka = plik.readline() print(len(linijka)) #sprawdzam pozycje kursora print(plik.tell()) linijka = plik.readline() print(linijka) plik.close()
import logging.config from path import Path import json SRC_DIR = Path(__file__).abspath().dirname() ROOT_DIR = SRC_DIR.dirname() with open(ROOT_DIR / 'vars.json', 'r') as f: _VARS = json.load(f) # logging logger = logging.getLogger('console') # parameters RTF22_FILE = SRC_DIR / 'mol-prms' / 'top_all22_prot_cha...
print('hello') print("Hello") print("I'm going on a run") print("hello \n world") print('hello \t world') print(len('hello')) print(len('I am cool'))
import bottle import os import random @bottle.route('/') def static(): return "the server is running" @bottle.route('/static/<path:path>') def static(path): return bottle.static_file(path, root='static/') @bottle.post('/start') def start(): data = bottle.request.json game_id = data.get('game_id') ...
from ubidots import ApiClient import time import board import busio import adafruit_bme280 # Create I2C device i2c = busio.I2C(board.SCL, board.SDA) bmp280 = adafruit_bme280.Adafruit_BME280_I2C(i2c) # Create an ApiClient object api = ApiClient(token='your-token') # Get a Ubidots variable pressure = api.get_variable(...
num1=20 num2=20 num3=num1+num2 print(num3) num3=num1-10 print(num3) num3=num1*num2 print(num3) num3=num1%num2 print(num3) num3=num1/num2 print(int(num3)) print(2**3)#2 to the power of 3 print('hello')#some more changes
#!/usr/bin/env python # Funtion: # Filename: import networkx as nx import matplotlib.pyplot as plt g = nx.Graph() g.add_edge(1,2) g.add_edge(2,3) g.add_edge(3,1) nx.write_edgelist(g,"edgelist.txt") nx.draw((g)) plt.show()
from django import forms class ZalogujForm(forms.Form): loginClass = forms.TextInput(attrs={'class': 'form-control'}) hasloClass = forms.PasswordInput(attrs={'class': 'form-control'}) login = forms.CharField(widget=loginClass, label="Login", max_length=50, required=True) haslo = forms.CharField(widget...
from .get_env_or_error import get_env_or_error, EnvNotFound
class PagSeguroTransactionSearchResult: date = None resultsInThisPage = None totalPages = None currentPage = None transactions = None def getDate(self): return self.date def setDate(self, date): self.date = date def getResultsInThisPage(self): return self.resu...
import numpy as np # toy function def objF(x): return sum(x**2) # inital guess x0 = np.array([2.1, -1]) # one of pybrain's optimization things from pybrain.optimization import CMAES l = CMAES(objF, x0) # all the optimization algorithms actually maximize by default so this has to be set l.minimize = True # stoppi...
import tensorflow as tf def get_model_params(): gvars = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES) return {gvar.op.name: value for gvar, value in zip(gvars, tf.get_default_session().run(gvars))} def restore_model_params(model_params): ''' type(model_params):dict ''' gvar_names ...
import datetime import time import requests url = 'http://iatw.cnaf.infn.it/eee/monitor/' def valentina(school): now = datetime.date.today() today = now.strftime('%d/%m/%Y') monitor = requests.get(url) if str(today)+'</span></td><td>' + school in monitor.text: return True else: ...
import sys input = sys.stdin.readline def main(): A, B, M = map( int, input().split()) a = list( map( int, input().split())) b = list( map( int, input().split())) X = [ tuple( map( int, input().split())) for _ in range(M)] ans = min(a) + min(b) for x, y, c in X: if a[x-1] + b[y-1] - c < ...
import dash_core_components as dcc import dash_html_components as html from app import app from pages import home, preface, price, energy, density, relation, sodium, summary, ending, joke server = app.server app.layout = html.Div([ home.layout, preface.layout, price.layout, energy.layout, density....
# Generated by Django 3.0.7 on 2020-10-22 14:40 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('cl_table', '0068_stock_favorites'), ('custom', '0010_itemcart_type'), ] operations = [ migrations.A...