index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
12,300
656dd9c359030c5265d3ef6459d5aaadf1068c76
import requests as requests import random import credentials url = credentials.telegramURL start_command = '/start' end_command = '/stop' reset_amazonURL_command = '/resetAmazonURL' test_command = '/runTest' add_new_refresher = '/addNewRefresher' pause_refresher = '/pause' resume_refresher = '/resume' valid_commands...
12,301
9feb32ec6aed3cb3d284581ee9f7b535b628cb73
import networkx as nx class Regions: def __init__(self, dominator, code_blocks): self.gen = [set() for _ in range(dominator.N)] self.kill = [set() for _ in range(dominator.N)] self.code_blocks = code_blocks self.instructions = [] self.parse_instructions() self.class...
12,302
0af3cc8733b87fa3e5f1320b07cbf22b80a9fb05
import moeda n = float(input('Digite o valor R$')) moeda.resumo(n, 20, 12)
12,303
8ff29191b39a6b38a9f1c125f356c3727ee00f88
from django.db import models import string import random def random_chassis(size=17, chars=string.ascii_uppercase + string.digits): v = ''.join(random.choice(chars) for _ in range(size)) return v class Car(models.Model): marca = models.CharField(max_length=75, null=False) modelo = models.CharField(m...
12,304
85379c86d83f61c2c36346a21606976d35afe200
def sample(s): new_s = "" d = {} for i in range(len(s)-1): if s[i] != s[i+1]: new_s = new_s + s[i] print(new_s + s[-1]) temp = s.split("_") print(temp) for i in range(len(temp)): temp[i] = temp[i][0].upper() + temp[i][1:] # temp[i] = "".join(temp[i].split(...
12,305
408104d44e464175d25fab6898f465b692683686
import time from homework3.task2 import calc_with_mp def test_calc_with_mp(): start_time = time.time() calc_with_mp(25) end_time = time.time() - start_time print(end_time) assert (end_time <= 10) is True
12,306
0a4214257a3e4ed04e17b452d5605a0d25973f78
import layout; import menu; import messages; def menu(name,options): clear(); drawHeader(name); showOptions(options); drawFooter(name); ask(name,options); def clear(): for i in range(0,layout.CLEAR_SIZE): print ""; def drawHeader(name): header = ""; for i in range(0,layout.LENGTH): header += layout.PAT...
12,307
7d66095a4f4ccfc6b195e14cbfe6e72eab3b2788
from opcodes import INST_OP_CODE from instruction import Instruction class UnaryInst(Instruction): def __init__(self, name=None, op_code=None, value=None): super(UnaryInst, self).__init__(name, op_code) self.operands.append(value) @property def op_code(self): return self._op_code @property def value(sel...
12,308
ba5557bb2f7c2578b5b058c7dde35ff40e4f4ea7
import unittest import loss_functions as lf import numpy as np class TestLossFunctions(unittest.TestCase): def test_logistic_loss(self): result = lf.logistic_loss(np.array([.9, 0.02, .8, .73]), np.array([1, 0, 1, 1]), 4) expected_result = 0.165854 difference = result - expected_result ...
12,309
ab9392d68a05bb8a93c74ae5de7d23e992cbcf3d
class Library(): def __init__(self, list_of_books, library_name): self.lend_data = {} self.list_of_books = list_of_books self.library_name = library_name for books in self.list_of_books: self.lend_data[books] = None def display_book(self): for i...
12,310
6948f72dae3dc1e5e25a9d69d06529cfa709818a
import socket import time import threading import os import sys from random import randint host = raw_input("enter IP address: ") port = 5000 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.bind((host, port)) def StopAndWait(file_name, addr): with open(file_name, 'rb') as f: # bytesToSend...
12,311
2c4f5564d985ba5c7bdb13c0a9f13c96040ad0f1
## contect manager using self define class class My_Open_File(): def __init__(self,filename, mode): self.filename = filename self.mode = mode def __enter__(self): self.file =open(self.filename, self.mode) return self.file def __exit__(self, exc_type, exc_val, traceback): ...
12,312
f4ae13c8b31bb17a6b1f712aac542d06f2465d7c
import argparse import torch import torch.nn as nn import re import numpy as np import os import pickle from data_loader import get_loader from data_loader import get_images from build_vocab import Vocabulary from model import EncoderCNN, DecoderRNN from torch.autograd import Variable from torch.nn.utils.rnn import ...
12,313
c87b23c46f69323da337d1ee50fc016f834551f7
# -*- coding: utf-8 -*- # @Author: iori # @Date: 2016-11-17 13:56:19 # @Last Modified by: lei gao # @Last Modified time: 2017-11-01 14:12:27 from __future__ import division import heapq import numpy as np import copy from collections import defaultdict import random import math import logging logger = logging.get...
12,314
e991e386818912e5c7d933c32f33b6c42ad02732
names = input("Podaj imiona osób, które chcesz powitać oddzielone spacją!") names = names.split() for e in names: e = e.capitalize() print("Hello", e+'!')
12,315
053c61d1745d1e2683f4370f2140f2c2be7b71e6
import json import subprocess from concurrent.futures import ThreadPoolExecutor import bcrypt import tornado.escape import tornado.httpserver import tornado.ioloop import tornado.options import tornado.web from tornado.web import RequestHandler from db import torndb from core.player import Player class BaseHandler(...
12,316
3a16874c4090d06c73aafd03cfb2f0b160db2e3f
import random chars = 'abcdefghijklnopqrsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890' num = int(input('enter number of passwords')) lenght = int(input('enter lenght of passwords')) for i in range(num): password = '' for x in range(lenght): password += random.choice(chars) print(pass...
12,317
82082c89883f6ddf69a7b7d8e35b5b4e13cbbf92
from os import read from .views import about_us, acidity, beans, blend, culture, customizing, grind, home, machines, products from django.urls import path urlpatterns = [ path('',home, name="home_page"), path('products/', products,name='products'), path('machines/', machines,name='machines'), ...
12,318
2fcf5ba869ee1fad4f18c14bbf214cf16012b2c1
# vim: filetype=python ts=2 sw=2 sts=2 et : from sym import Sym s=Sym(all="aaaabbc") assert 4==s.seen["a"] assert 1.378 <= s.spread() <=1.38
12,319
676de88b908a0360c13813e17ce8234a5274e977
# -*- coding: utf-8 -*- #------------------------------------------------------------------ # LEIA E PREENCHA O CABEÇALHO # NÃO ALTERE OS NOMES DAS FUNÇÕES # NÃO APAGUE OS DOCSTRINGS #------------------------------------------------------------------ ''' Nome: Gulherme Navarro NUSP: 8943160 Ao preencher...
12,320
4cd008a1cf96025c0a128f439c71942564622c06
import matplotlib; matplotlib.use("agg") import theano from theano import tensor as T import lasagne from lasagne.layers import * from lasagne.objectives import * from lasagne.nonlinearities import * from lasagne.updates import * from lasagne.utils import * from lasagne.init import * import numpy as np #import cPick...
12,321
3325944bf20e491d82b61afc155c77f7bcb283fb
""" https://leetcode.com/problems/rotate-image/ rotate through diagonal and then columns wise swapping """ class Solution: def rotate(self, matrix: List[List[int]]) -> None: """ Do not return anything, modify matrix in-place instead. """ n = len(matrix) for dig in range(n):...
12,322
fb31bc2b81ce6a79de789dd2957e17006cf88b4c
import cv2 import numpy as np def findCentre(frame,initial_pos): centre = initial_pos hsv = cv2.cvtColor(frame,cv2.COLOR_BGR2HSV) low_green = np.array([35, 52, 50]) high_green = np.array([70, 255, 230]) # Red color low_red = np.array([161, 155, 84]) high_red = np.array([179, 255, 255])...
12,323
ec8fa49baa8380ac08d4d122130f8d6906495127
pages = input() goal = input() start = goal // 2 end = (pages - goal) // 2 if pages % 2 == 0: end += goal % 2 if end > start: print(start) else: print(end)
12,324
1c6b11a4d7366b8f70243f766d3e2d028c3ddec2
from __future__ import annotations import logging import os from helpers.data_source_fixture import DataSourceFixture logger = logging.getLogger(__name__) class SparkDataSourceFixture(DataSourceFixture): def __init__(self, test_data_source: str): super().__init__(test_data_source) def _build_confi...
12,325
0c59954bc2b685b7a31e562cb51d889be4741273
# Servidor TCP import socket from threading import Thread def conexao(con, cli): while True: msg = con.recv(1024) if not msg: break print(msg) print('Finalizando conexao do cliente', cli) con.close() # Endereco IP do Servidor HOST = '' # Porta que o Servidor vai escut...
12,326
249cd889504af560de3f5cc4ec8654ea4635fec5
# Generated by Django 3.1.8 on 2021-09-15 16:30 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('geocontext', '0001_initial'), ] operations = [ migrations.AddField( model_name='service', name='layer_geometry_field...
12,327
f6fb95cc472e7b71e8ea81e6608767f24872b157
""" Affine, ReLU, SoftmaxWithLoss 클래스들을 이용한 신경망 구현 """ import numpy as np from ch05.ex05_relu import Relu from ch05.ex07_affine import Affine from ch05.ex08_softmax_loss import SoftmaxWithLoss np.random.seed(106) # 입력 데이터: (1,2) shape의 ndarray X = np.random.rand(2).reshape((1, 2)) print('X =', X) # 실제 ...
12,328
0bf6fc6c0ddc64a657f5c408465a49735fdf7f02
import streamlit as st from streamlit_webrtc import VideoProcessorBase, webrtc_streamer, WebRtcMode, ClientSettings import av import cv2 import numpy as np import pandas as pd import mediapipe as mp import tensorflow as tf from sklearn.pipeline import make_pipeline from sklearn.ensemble import RandomForestClassifier fr...
12,329
674d97dfa8890f66a53213c9cea47f2193db9cd9
#!/usr/bin/env python from vmwc import VMWareClient def main(): host = '192.168.1.1' username = '<username>' password = '<password>' print 'WARNING - you must acknowledge that by executing the code below will result in deletion of all switches. (remove the "return" statement and re run this script t...
12,330
caa0b907c9b983cf50c203457ca28783e62a1f26
#!/usr/bin/env python # -*- coding: utf-8 -*- from IPython.core.display import display, HTML display(HTML("""<style> @font-face { font-family: 'Cooper Hewit' ; src: url(utils/CooperHewitt-Medium.otf); } @font-face { font-family: 'Cooper Hewit Bold' ; src: url(utils/CooperHewitt-Bold.otf); } @font-fa...
12,331
7466c91b749666f885ca0cd7e4160a00747e056f
from appium.webdriver.common.mobileby import MobileBy from djcelery.admin_utils import action from selenium.webdriver.common.by import By from test_app.page.base_page import BasePage class Search(BasePage): #todo: 多平台、多版本、多个定位符 _name_locator = (MobileBy.ID, "name") def search(self, key: str): se...
12,332
548e577eccf0898da0dd128f6b27a6083e8ebbb0
import threading import Queue import time addr_q = Queue.Queue() reply_q = Queue.Queue() i1 = 9 i2 = 9 data1_1 = None #192.168.1.3 data1_2 = None #192.168.1.4 def read_data(q,reply_q): global data1_1,data1_2,i1,i2 #print "Running read_data" s = q.get() name = s[0] try: if name == "192.168.1.3": i1 = i1 +...
12,333
9462ef377e7ad3724cf5426c5227696911dc48b6
# _*_ coding: utf-8 _*_ """获取一个数组中的前 m 个元素,共有 n 个元素,即 m <= n""" """ 基本思路:可以先排序,然后取前 m 个元素, 时间复杂度 nlogN """
12,334
99289212a29997e056d1ab3d329ef61add818d8e
class Stationery: title = 'None' def draw(self): print('Запуск отрисовки') class Pen(Stationery): def draw(self): print('Рисуем ручкой') class Pencil(Stationery): def draw(self): print('Рисуем карандашом') class Handle(Stationery): def draw(self): print('Рисуем ма...
12,335
007cf01723b9dfff1c9456ca2809386eeb7dfa14
from django.urls import path from django.views import generic from drug import views, viewsets from django.urls import path, include app_name = 'drug' urlpatterns = [ # path('', generic.TemplateView.as_view(template_name='drug/index.html'), name='index'), path('<str:table>/<str:col>/json/', views.APIView....
12,336
45fea2c37a8d48dc480d57807eea72c60a43aaa2
"""Module provider for Name.com""" from __future__ import absolute_import import logging from argparse import ArgumentParser from typing import List from requests import HTTPError, Session from requests.auth import HTTPBasicAuth from lexicon.exceptions import AuthenticationError from lexicon.interfaces import Provid...
12,337
2585b4761fd6c8d4d75cacedaeec6dbebbb2f474
# Сортировка выбором. Сложность О(n^2) def find_smallest(arr): sm = arr[0] ind = 0 for i in range(1, len(arr)): if arr[i]<sm: sm = arr[i] ind = i return ind def selection_sort(arr): L = [] for i in range(len(arr)): si = find_smallest(arr) L.appe...
12,338
63a97f17a8dcdad2024c3e893d434c089ebf1b19
from __future__ import (absolute_import, division, print_function) from .util import extract_vars def get_accum_precip(wrfin, timeidx=0): ncvars = extract_vars(wrfin, timeidx, varnames=("RAINC", "RAINNC")) rainc = ncvars["RAINC"] rainnc = ncvars["RAINNC"] rainsum = rainc + rainnc return rainsum...
12,339
e0f0bc3e7638d05cf02fff57a4529b41d21fa0ac
import builtins as _mod_builtins __builtins__ = {} __doc__ = None __file__ = '/home/chris/anaconda3/lib/python3.6/site-packages/sklearn/utils/_logistic_sigmoid.cpython-36m-x86_64-linux-gnu.so' __name__ = 'sklearn.utils._logistic_sigmoid' __package__ = 'sklearn.utils' __test__ = _mod_builtins.dict() def _log_logistic_s...
12,340
8d9838cc4b2e4a4240b6ec1091576989deb4d969
""" URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based vie...
12,341
d450b8dba116ccb9bbe4f3106ee3b68e3408222c
import os import pytest from concard.app import run def create_card(**kwargs) -> str: card = {} for key, value in kwargs.items(): card[key] = value args = {'action': 'create', 'card': card} response = run('test', args) return response['card_uid'] def read_repo(filters=None) -> list: ...
12,342
7e9c9807e56a0d0c06c7c99bab4bdbb2b4e058a2
import time from app.db.base import Session from app.model.history import History from .config_service import ConfigService class LimitService: _instance = None def __init__(self, config_service: ConfigService, db_session: Session): LimitService._instance = self self.config_service = config_...
12,343
0932709aafe018fbdca30243a8a51cffe38a0a89
t=int(input()) for i in range(t): n=int(input()) bn=bin(n) num=bn.count('1',0) if num==1: print(bn.index('1')) else: print(-1)
12,344
9f00c532fae4226c751084a093ab054160629250
#!/usr/bin/env python import sys from datetime import datetime, timedelta from xml.etree import ElementTree as ET import csv weekdays = ('Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat', 'Sun') # locations = {} # with open('lost-locations.csv') as locfile: # reader = csv.DictReader(locfile) # for line in reader: # ...
12,345
9bf2bcc7832b0262037699da34fff6d9cfe6bbc0
from django.shortcuts import render from .load_data import load_job_data from .forms import LoadData from .queries import data DATA_TO_BE_FETCHED = [("dev ops", 10),("contador", 10),("administracion", 10), ("diseno", 10)] def home(request): return render(request, "workdata/home.html") def load_data_form(reques...
12,346
592cad3acb8bf03c44511dfd5cf6a4c36357e358
from django.contrib import admin from priton.models import Person, Phrase, Comics, Essense class PersonAdmin(admin.ModelAdmin): list_display = ('full_name', 'short_name',) #list_editable = ('sort', ) class PhraseAdmin(admin.ModelAdmin): list_display = ('phrase', 'author',) class EssenseInline(admin.Tab...
12,347
13911b8ed07372539c36b7b4578e2bd7cccd5b60
from _collections import deque import heapq def solution(jobs): waiting, cand, jobs_size = deque(sorted(jobs)), [], len(jobs) curr_time = total = done = 0 while done < jobs_size: if cand: time, input_time = heapq.heappop(cand) curr_time += time total += curr_tim...
12,348
c5d8f21e8b781975d57fc093a56945b06ce99173
import matplotlib.pyplot as plot import math f = open("/home/pi/Documents/rpi_xc111/test_envelope_data/7_5_2019_11_28_34_UTC.txt") filelines = f.readlines() testlines = [] data = [] if __name__ == '__main__': testlines = filelines[10:630] # actual start: 99 mm # actual length: 400 mm # actual end: 499...
12,349
4f493076b3d8a27e8a78711cb423a33cc9055799
from django.shortcuts import render, redirect from django.http import HttpResponse from django.contrib import messages from . import dbsearch def deleteLicense(request): if request.method == "GET": if dbsearch.deleteLicense(request.GET.get('Lno'))==True: return redirect('/') else: ...
12,350
b5781ade95f1def3f7788c26925b14d803f16b60
import datetime import pytz tzinput=input('Enter TZ :') ustime = datetime.datetime.now(pytz.timezone(tzinput)) a=ustime.strftime("%Y-%m-%d %H:%M:%S") print(a)
12,351
9af9adf77fdb7e1a3751f8ee57dafe861801f864
""" This is the deployments module and supports all the ReST actions for the ci collection """ from pprint import pformat from flask import abort, make_response from config import app, db from models import CI, CISchema def read_all(): """ This function responds to a request for /api/ci with the complet...
12,352
d99dd9a962fe5a82930d5aabecf0d16b0999f73c
from selenium import webdriver from selenium.webdriver.chrome.options import Options class FirstSelenium: options = Options() options.add_argument('--ignore-certificate-errors') options.add_argument('--test-type') driver = webdriver.Chrome(executable_path="/home/richard-u18/PycharmProjects/SeleniumPyt...
12,353
1e33a50887fd1c663b46507a5899cd1ed4d1e8d5
from simulation import Simulation def simulator(parameters): pass #print(parameters) simulation = Simulation(parameters={ 'SNR': [0, 10, 20, 30], 'τ': [0.6, 1] }, function=simulator) simulation.run()
12,354
ba0eb73d5ab9685b11f09eeb55358e74e348177d
# finger Exercise 3 (2.4) # Write a program that asks the user to input 10 integers, and then prints the largest odd number that was entered. # If no odd number was entered, it should print a message to that effect. def finger(numbers): """Print the largest odd number Arguments: numbers {list} --...
12,355
e9533c264643630ea32de6ec0be2252bb0401120
from django.apps import AppConfig class KellycalcConfig(AppConfig): name = 'kellycalc'
12,356
da92343a0a9b652999bb2fd11e6c514901fce00c
import json import requests import time import os import sys import random def getprox(): proxies = ['u2.p.webshare.io:10000', 'u3.p.webshare.io:10001', 'u2.p.webshare.io:10002', 'u2.p.webshare.io:10003', 'u2.p.webshare.io:10004', 'e1.p.webshare.io:10005', 'u1.p.webshare.io:10006', 'u1.p.webshare.io:10007', 'u2.p...
12,357
7fd168c4478fa00857626b2062c3a7c604227a54
from django.contrib import admin from webapp.models import riderride from webapp.models import ridermaster from webapp.models import limitwattsrider from webapp.models import Document # Register your models here. admin.site.register(ridermaster) admin.site.register(riderride) admin.site.register(Document) admin.site.re...
12,358
98709fda19a73f15ea9eb4b1e3a80bbe7309039c
#!/usr/bin/env python # -*- coding: UTF-8 -*- ''' Creado 26/04/2016 @author: Cinthya Ramos. 09-11237 @author: Patricia Valencia. 10-10916 ''' import sys from lexer import tokens, find_column, lexer_error, lexer_tokenList, analyzeNeo if __name__ == '__main__': #Comprobacion de los parametros de entrada. if ...
12,359
d15d99872c85c0d87db13725113b87f61fd4f3c1
print("Дан одномерный массив. Найти среднее арифметическое его элементов. Вывести на экран только те элементы массива, которые больше найденного среднего арифметического.") arr = [1, -1, 2, 0, 3, 5, 11] print('Массив: ', arr) i = 0 mid = 0 while i < len(arr): mid += arr[i] i += 1 mid = mid/len(arr) print('Ср...
12,360
68de12957760f4bb53cf1c85a0697e0f95f4ad18
def query(start, end, groupby, conditions=None, filter_keys=None, aggregations=None, rollup=None, arrayjoin=None, limit=None, orderby=None, having=None, referrer=None, is_grouprelease=False, selected_columns=None): aggregations = (aggregations or [['count()', '', 'aggregate']]) filter_keys = (filter_keys or { ...
12,361
b83e0edf938eba545f8679363bb37cc51fa4d6c8
(ur'^password_reset/$', 'django.contrib.auth.views.password_reset'), (ur'^password_reset/done/$', 'django.contrib.auth.views.password_reset_done'), (ur'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm'), (ur'^reset/done/$', 'django.contrib.auth.views.pa...
12,362
06306afe1d8703454af5b1103e7855ea6c6e8a2d
from django.contrib import admin from main.models import Ship, Container, Dock, Employee, DockHistory admin.site.register(Ship) admin.site.register(Container) admin.site.register(Dock) admin.site.register(Employee) admin.site.register(DockHistory)
12,363
5a5fef206c1aa15be1669684c738ca15ccb55cef
from keras.models import Model from keras.datasets import mnist from keras.callbacks import ModelCheckpoint from keras.utils.np_utils import to_categorical from keras.layers import Dense, Dropout, Flatten, Conv2D, MaxPooling2D, Input, add, concatenate # load the mnist data (x_train, y_train), (x_val, y_val) = mnist.l...
12,364
1b7d15da67ae50b2c2f705f28027e91689c460c6
import json import os from paver.easy import pushd import numpy as np import pickle import csv from sklearn import metrics import argparse import multiprocessing import time import matplotlib matplotlib.use('Agg') #in the case of perform on server import matplotlib.pyplot as plt #--------------------------------------m...
12,365
336d069cf2d2bc05f0e50805caf5ddb1b5087f33
#!/usr/bin/python #-*- coding=utf-8 -*- """ Usage: start_api_server.py [--p=<argument>] --p=PORT web server port [default: 1235] """ __author__ = ['"wuyadong" <wuyadong@tigerknows.com>'] import logging.config import sys import docopt from server.service import WebService logging.config.fileConfig(sys.path[0] + "...
12,366
2dae9231a816f292aa82a0c321f79c43eb642bb1
#!/usr/bin/env python3 # # This script normalizes a YAML file. # # More information at: # https://github.com/julianmendez/tabulas # import json import sys import yaml def main(argv): help = "usage: python3 " + argv[0] + " (YAML input/output file)\n" + \ " python3 " + argv[0] + " (YAML input file) ...
12,367
e5668b4539b8fe32ffd29126e048ca439e5680df
import os, datetime, codecs, random, string, json, re, time, sqlite3, shutil from flask import Flask, render_template, request, url_for, abort, redirect, send_from_directory, g, Response, escape from werkzeug import secure_filename from functools import wraps import email.parser, smtplib from validate_email import vali...
12,368
cb5956d5b34e2e07f1d6307a084cfe68999a62e0
from datetime import timedelta def add(moment): return moment+timedelta(seconds=+10**9)
12,369
88b349a074dec1215c79d02bbaef790249c68775
#!/usr/bin/env python from __future__ import print_function import rospy import cv2 import sys from sensor_msgs.msg import Image from cv_bridge import CvBridge, CvBridgeError if __name__ == '__main__': node_name = 'image_listener' topic_name = '/cam' if len(sys.argv) > 1: topic_name = s...
12,370
f81967bcc108b20d5cd9d7b8cb55661dac060ed3
#!/usr/bin/python3 """ Mopdule for Place tests """ from tests.test_models.test_base_model import test_basemodel from models.place import Place import unittest import inspect import time from datetime import datetime from unittest import mock import models class test_Place(test_basemodel): """ Class for tests Plac...
12,371
23cc52166b7698e035b1087ccce048fc85c0d85b
import tkinter as tk import tkinter.ttk as ttk from tkinter import StringVar from tkinter import messagebox import sqlite3 import os.path listOfMovies = [] window = tk.Tk() class Movie: def __init__(self, name, category, description, price): self.__name = name self.__category = category se...
12,372
53cc7cfd99e4835b13f9523cb50bd79a382b3123
# coding=utf-8 from django.shortcuts import render, render_to_response from django.http import HttpResponseRedirect, HttpResponse from web.models import User, information, Out from django import forms from django.template import RequestContext from data import * import datetime from dateutil import tz import pytz, time...
12,373
fabb519fc00f1396ca95c5361a54d2523d43186b
"""Put all your globals here. Things like layout and FPS are pretty universal, so for convenience, just load up a global """ # http://www.aleax.it/Python/5ep.html class Borg(object): _shared_state = {} def __init__(self): self.__dict__ = self._shared_state # # Any instance of GlobalState() # has t...
12,374
89f5c3b8ee6755ba2f74f6d84761ba03e60b158f
import pylab sum_digits_raised=[] linear=[] for i in range(500000): sum_digits_raised.append(sum(int(d)**5 for d in str(i))) linear.append(i) pylab.plot(sum_digits_raised, label='Sum of digits to the fifth power') pylab.plot(linear, label='linear') pylab.legend(loc = 'upper left') pylab.figure() pylab.show(...
12,375
ced54cbf85ff4e2ff88b55fd426df898ca64502a
# -*- coding: utf-8 -*- """ Created on Mon Jun 3 21:11:27 2019 @author: HP """ n = 0 #starting number while (True): #condition print (n) n = n + 1 #increment by one if(n==10): #condition checkin...
12,376
1d842cf79389246451d2313f3793263ac479774e
word="ametikool" used_word=["_,""_,""_,""_,""_,""_,""_,""_,""_,"] used_letters= [] alphabet = "abcdefghijklmnopqrstuvwxyz" letters = list(word.lower()) while True: print (used_wordg) print ("kasutatud tähed"+ str(used_letters)) letter=input("sisestage üks täht :") used_letters.append(letter...
12,377
1ef6235d088a133f58dd36ac8b69641f69caf6de
#!/usr/bin/env python3 import logging import asyncio import json import sys import uvloop asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) import aiohttp from aiohttp import web import litecord logging.basicConfig(level=logging.DEBUG, \ format='[%(levelname)7s] [%(name)s] %(message)s') loggers_to_info =...
12,378
36dfd10265bdb89736e99df069448d82ec2aaf8b
from datetime import datetime import re import os # DATETIME def convWebTimeStrToDatetime(timeStr): return datetime.strptime(timeStr,"%d %b %Y, %H:%M") def convInputStrToDatetime(timeStr): return datetime.strptime(timeStr,"%Y-%m-%d %H:%M:%S") def convTimeToStr(dateT): return datetime.strftime(dateT,"%Y-%...
12,379
48d1ef5143bff5bc85f32b0ef6fc80c1a9a11904
har=int(input()) x,y=0,1 while har>0: print(y,end=' ') x,y=y,x+y har=har-1
12,380
1fb05c6be9434a065e8ae5bdc6e9d1347f9a0f05
from django.shortcuts import render,redirect,get_object_or_404 from .forms import UserForm,ProfileForm,PrescriptionForm,AppointmentForm,PatientForm,DoctorForm,ProfileForm1,AccountForm from .models import Profile,Patient,Doctor,Appointment,Prescription,Reception,HR,Accounts from django.contrib.auth.models import auth,Us...
12,381
2c00ce4c0cbfad5600ee73b779841211b27ef1f5
# Import libraries. import gdal import os.path import cv2 import os import numpy as np from numpy import inf import rasterio import matplotlib.pyplot as plt path = r"C:/Users/Tim/Desktop/BOKU/GIS/GISproject/landsat/" bands = ["band1", "band2", "band3", "band4", "band5", "band6", "band7"] # File from whic...
12,382
9f6420520d51fa5d05e4dc1a3adca5a0dd32dd9b
from django.shortcuts import render from django.http import HttpResponse, Http404 # Create your views here. def index(request): return render(request, 'ninja/index.html') # def show(request, color): # # context = { # # 'id' : color_id # # } # return render(request, 'ninja/show.html') # def show(request, color_i...
12,383
345cec0b20a9874073fea8b1a94594a8269c87e7
#8/6/14 #read in pairs of data(Jilian date. temperature), check it for validity #keep reading in until user says stop total = 0.0 counter = 0 tot_temp = [0] * 366 count_slips = [0] * 366 user_date = input('Type in a Julian date or STOP ') while(user_date.upper() != 'STOP'): #reads in and checks down the date ...
12,384
2c4c5f761e371c00b731a98c9c33f39dfa9a7f0e
target_distribution_methods = {} def register(target_distribution_method_name, target_distribution_method): target_distribution_methods[target_distribution_method_name] = target_distribution_method def create_action(task, source, filename, target): return target_distribution_methods[target['distribution_method']]...
12,385
64cd0434c8f447b709db7a1c19ce3dfaf4c7f50e
import json from pathlib import Path import ipywidgets as ipw import requests_cache import traitlets as tl from aiida import orm from aiidalab_eln import get_eln_connector from IPython.display import clear_output, display ELN_CONFIG = Path.home() / ".aiidalab" / "aiidalab-eln-config.json" ELN_CONFIG.parent.mkdir( ...
12,386
6b8249e774581593f74cafb9922ac42247bd8be7
# Copyright 2018 PIQuIL - All Rights Reserved # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache Licens...
12,387
61dec3be7345236553c19d46eac221f3f66502d8
# 16th program - copyfile import sys if len(sys.argv) == 3: f1 = str(sys.argv[1]) f2 = str(sys.argv[2]) fs = open(f1, "r") fd = open(f2, "w") data = fs.read() fd.write(data) fs.close() fd.close() print("File copied successfully\nDestination data: ") fp = open(f2, "r") p...
12,388
93e441996fae26eae28a9005f09a05cb54e44bf9
# This script generates the texture containing the triangle patches for the # triangle wave VFX. # Needs Pillow to run: pip install pillow # The script is not perfect, there's artifacts between the triangle patches. import numpy as np from PIL import Image # Adjust these values to change resolution and number of tria...
12,389
58f34bd81d444e602ca5a11378252ceda4fe35ec
def cointoss(): import random heads = 0 tails = 0 for toss in range(5000): result = random.randint(1,2) if result == 1: heads += 1 else: tails += 1 print "there were {} heads and {} tails.".format(heads, tails) cointoss()
12,390
c53610992b8f0d16e6d2a8c64410cf72461bb0bd
import numpy as np from multiprocessing import Process, Value, Pool, Lock, Queue import time class Knn2: def __init__(self, data, k, **kwargs): self.kwargs = kwargs self.data = data self.k = k def classify(self, tupla): # if tupla in self.data[:,:-1].tolist(): # print('ALERT') # else: ...
12,391
1dada32c35e4f3ef9d2755031ef6ba8e3e033093
# Created by MechAviv # Quest ID :: 34933 # Not coded yet sm.setSpeakerID(3001510) sm.setSpeakerType(3) sm.flipDialogue() sm.setBoxChat() sm.boxChatPlayerAsSpeaker() sm.setBoxOverrideSpeaker() sm.flipBoxChat() sm.flipBoxChatPlayerAsSpeaker() sm.setColor(1) sm.sendNext("#face4#All clear. Perfect! Let's get out of here!...
12,392
b24c98ade315f6846bce4a08e63e010b7aecf132
from NeuralNetwork import NeuralNetwork from MySingletons import MyDevice import numpy as np import torch class AutoEncoder(NeuralNetwork): _greedy_layer_bias = None _greedy_layer_output_bias = None @property def latent_space(self): return self.layer_value[self.latent_space_posi...
12,393
67599a3e1fd0bf9668cd0a3fef44140fcf293458
import pygame from pygame.locals import * def draw(display_surf,image_surf): bx = 0 by = 0 for i in range(0,M*N): if maze3[ bx + (by*M) ] == 1: display_surf.blit(image_surf,( bx * block_width , by * block_width)) blocks.append([bx*block_width,by*block_width]) ...
12,394
67e1be6d5efb2b08bfbfd0d7684c5d8f53ddceae
from django.test import TestCase from brambling.views.utils import FinanceTable from brambling.tests.factories import (TransactionFactory, EventFactory, PersonFactory, OrderFactory) class FinanceTableTestCase(TestCase): def setUp(self): self.order = OrderFactory(co...
12,395
6947a18d4cad28ee4ef7310eef9503cbbce74e0c
import numpy as np import tensorflow as tf import random, math import matlab import matlab.engine as me from dataSetup import generateData, generateWeights, generateWeights_topk from recovAnalysis import recovery, structDiff from trainerUtil import tensorInit, train, train_topk, init_weights import argparse argparser ...
12,396
5e5297eef360c376700dc4b65d3297405b9a460d
""" Copyright 2017 ARM Limited 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 distr...
12,397
474bf5c5f65af221d4d2ec80a024595582f187ba
''' Author: Suryakiran Menachery George Date: March-19-2018 ver1 Date: March-22-2018 final Purpose: EE 544 Mini Project, Harmonics & Inter-modulation Products Calculator ''' import sys print('\033[1;34mEnter the first frequency in MHz\033[1;m') val1 = sys.stdin.readline() print('\033[1;34mEnter the second ...
12,398
7f19ad893e642cb8b4ca429928bf5e5b5f7c1170
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed May 30 15:11:25 2018 @author: bitzer """ import helpers import numpy as np import matplotlib.pyplot as plt import os import scipy.stats #%% define model targets = helpers.cond * np.r_[1, -1] cov = helpers.dotstd * np.eye(2) def evidence(dots): ...
12,399
c1d8f20ce7619ff9427f7e448da4cde2e4236d86
from django.conf.urls import url from django.contrib import admin from .import views app_name='accounts' urlpatterns=[ url(r'^signup/$', views.signup_view, name="signup"), url(r'^details/$', views.details_view, name="details"), url(r'^$',views.login_view,name="login"), url(r'^signup/(?P<account_key>[\w |\w-]+)/$', vi...