index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
991,200
21c8befa7df3f766cdb54409180ad396334b84a8
#!/usr/bin/python import argparse import numpy as np import re import sys import time # noqa, disable flycheck warning from matplotlib import pyplot as plt # noqa, disable flycheck warning from os import listdir, mkdir from os.path import isfile, join from scipy.misc import imread, imsave from sklearn.neighbors.neares...
991,201
04a25df867c84ddb273fc692faafa5c834a83c5c
# Main Workflow import discord from discord import message from discord import file from discord.ext import commands import os from dotenv import load_dotenv from datetime import datetime from github import Github import git import pytz # Custom classes from helpers.emojis import Emojis # Load/run nessesary componen...
991,202
fec1f43bf1eee599d2a701b644be8a2e226de7d3
from .names import ( list_pvs, list_devices, list_elements, device_to_element, element_to_device )
991,203
a9a11ffd8c08a3fd1e0ef32f2d6e455aff1fab28
arr = [17,18,5,4,6,1] arr1 = [] for i in range(len(arr)-1): arr1.append(max(arr[i+1:])) arr1.append(-1) print(arr1)
991,204
72f0d4ab78cc60bfb32339f8924de90b51e70c7c
def create_user(email, password, f_name, l_name): """check if email exists, hash the password, create user object, save to db""" pass def delete_user(id): """grab user from db, delete user""" pass def update_user(id): """grab user from db, update the users field, commit changes to db""" pass ...
991,205
47326511e43b178ba1bc2a56c4cc3c8fbd0e2c3d
'''Step 1: Data Definition - Need to be able to pop/push values into a stack; also recognize when can no longer push/pop Step 2: Signature - (int->int) input values into stack and output values Step 3: Test Cases - self.assertTrue(s1.is_empty()) self.assertFalse(s1.is_empty()) ...
991,206
1c3bb554fb1e72b9a950c3496ee96314a19897c8
class Vehicle(): def __init__(self, registration_no, drivers_age): self.registration_no = registration_no self.drivers_age = drivers_age
991,207
8450d1648d573fd5c82576db34d6f8bf7d771cb3
#!/usr/bin/python3 from events.Events import Events events = Events() recorder = events.recorder() @recorder.subscribe def a(parent, text): print('a prints: '+text) @recorder.subscribe('a', 1) def b(parent, text): parent('b prepends: '+text) #events.subscribe(a, 0) #events.subscribe(b, 0, 'a') events.invo...
991,208
1a3ccd7e8b4089f6391f855c666e0aa7da0c824a
def valor_maximo(lista): vmax = 0 for i in range(0,len(lista)): if lista[i] > vmax: vmax = lista[i] return vmax
991,209
254c706d2459f9cde426e66b2178806b8e8c706b
#!/usr/bin/python3 """This modules supports building CMake projects.""" _MAJOR = 0 _MINOR = 5 _PATCH = 0 _STRING = "{}.{}.{}".format(_MAJOR, _MINOR, _PATCH)
991,210
b66c41a694e1ef83b1269b336e3f4b6df5ea4494
from collections import deque words = """ 428a2f98 71374491 b5c0fbcf e9b5dba5 3956c25b 59f111f1 923f82a4 ab1c5ed5 d807aa98 12835b01 243185be 550c7dc3 72be5d74 80deb1fe 9bdc06a7 c19bf174 e49b69c1 efbe4786 0fc19dc6 240ca1cc 2de92c6f 4a7484aa 5cb0a9dc 76f988da 983e5152 a831c66d b00327c8 bf597fc7 c6e00bf3 d5a79147 06ca635...
991,211
5276fba23319f0450dc7e5ee2f892f075f7212e0
# Copyright (c) 2017 Dell Inc. or its subsidiaries. # All Rights Reserved. # # 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 requi...
991,212
d20bf077dc0ee794344bac80c8c3d3dceae762d7
#!/usr/bin/env python # -*- coding:utf-8 -*- from setuptools import setup, find_packages from opps import social install_requires = ["opps"] classifiers = ["Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Ope...
991,213
96be9778f735b25acb9bd1b0afff60d7d7d02e06
import pandas as pd import matplotlib.pyplot as plt df=pd.read_csv('DistanceRandom.csv', sep=',',header=None) print(df) data = [] data.append(0) y = [] y.append(0) columns = list(df) for item in columns: #print(df[item][0]) tmp = float(df[item][0]) if (tmp >= data[-1]): data.append(tmp) y.append(item) plt...
991,214
9e86a1b54c42d5c8f212a138117f234b9d97a405
import numpy as np a=np.array([[1,2],[3,4],[5,6]]) print('array is',a) ##array is [[1 2] ## [3 4] ## [5 6]] #print('未传递 Axis 参数。 在插入之前输入数组会被展开。' ,np.insert(a,3,[11,12])) #在插入之前输入数组会被展开。 [ 1 2 3 11 12 4 5 6] ##print('沿轴 0 广播:' ) ##print(np.insert(a,1,[11],axis = 0) ) ##沿轴 0 广播: ##[[ 1 2] ## [11 11] ## [ 3 4]...
991,215
e140574b193736bdadb9f71efcdcfb33a6c60ae8
# -*- coding: utf-8 -*- """ Created on Wed Jan 29 16:32:41 2020 @author: Yuki-F """ from ._fir1 import fir1 from ._fir2 import fir2 from ._firls import firls from ._firpm import firpm from ._kaiserord import kaiserord from ._sgolay import sgolay
991,216
d4cc45c5b58fb2ba405793cc37d59a79e9b6eb03
from urllib.request import urlopen as request import requests import json import streamlit as st from pandas.io.json import json_normalize import matplotlib.pyplot as plt; plt.rcdefaults() import numpy as np import pandas as pd def autolabel(rects): for rect in rects: height = rect.get_he...
991,217
47d019ed6bdad323438abb8a00ede24912e2b2f4
# coding=utf-8 from django.contrib.auth.forms import UserCreationForm from django import forms from .models import Usuario class UserAdminCreationForm(UserCreationForm): class Meta: model = Usuario fields = ['username', 'email'] class UserAdminForm(forms.ModelForm): class Meta: m...
991,218
24bf83883a869c1f05c756ddd9142c37cf876d28
#!/usr/bin/env python3 import os from _decimal import Decimal import time from supplychainpy import simulate from supplychainpy import model_inventory __author__ = 'kevin' def main(): start_time = time.time() orders_analysis = model_inventory.analyse_orders_abcxyz_from_file(file_path="data.csv", z_value=D...
991,219
8db33282cfed02ed627d1a527f28acf57a3a0734
import pandas as pd import matplotlib.pyplot as plt from matplotlib.font_manager import FontProperties df = pd.read_csv('BetPayOff_WithCode.csv') data = df.drop(['rawdatatype', 'gametype', 'website'], axis=1) requiredata = data[data.loc[:, "code"] == 5902] font = FontProperties(fname=r"c:\windows\fonts\simsun.ttc", si...
991,220
f1f9d7395b928a2f7b55e63401d0bdaa19ffa107
def sum_of_multiples(limit, factors=[3, 5]): result = 0 while 0 in factors: factors.remove(0) for i in range(limit): for f in factors: if i % f == 0: break else: continue # If you've reached here, it's a multiple result += i ...
991,221
d4fd01cc92ae0f5ece8f14aff83b699044de849b
import random class Dinosaur: def __init__(self, name): self.name = name self.health = 100 self.attacks = ('Smash', 'Slash', 'Bite') self.attack_power = [30, 50, 70] self.energy = 40 self.energy_drain = [0, 20, 30] def attack(self, robot): attack_c...
991,222
aa7465408088a35ce3ec5ef044be4c409b63879e
""" (C) Copyright 2020 Scott Wiederhold, s.e.wiederhold@gmail.com https://community.openglow.org SPDX-License-Identifier: MIT """ if __name__ == '__main__': import argparse from gfhardware.cam import capture, GFCAM_LID, GFCAM_HEAD parser = argparse.ArgumentParser(description='CaptureThread jpeg image fr...
991,223
5724b65b05d9d67aa551ec680003e531223ca167
import pandas as pd from tqdm import tqdm tqdm.pandas() from utils import peak, ave, end Session_2014_base_cols = ['QueryLength', 'QueryDwellTime', 'NewTerm', 'QuerySim', 'ClickCount', 'KeyDocCount', 'RelDocCount', 'AvgContent', 'TotalContent', 'AveClickRank', 'ClickDe...
991,224
520c0a87714b0aab2b904bb9a2650ef927c15c73
input = [line.rstrip() for line in open("day22/input.txt").readlines()]
991,225
342812218443b40b4d1598dfff0f25170b85eb01
import numpy as np from . import ADAS_file as adas from scipy import interpolate from sdp.settings.unitsystem import SI class Collisions: r""" Class containing all the physics about the collisions Read the files from ADAS database, compute the lifetime, and the cross-sections (cubic spline interpolat...
991,226
bcd4101ed1f75887eb951787172a691783b69406
class Solution: def flipAndInvertImage(self, A): for index, value in enumerate(A): A[index] = value[::-1] for i in range(len(A)): for j in range(len(A[0])): A[i][j] = (A[i][j]+1)%2 return A # 这个列表生成式和异或操作用的很6 def flipAndInvertImage1(...
991,227
07ea0862aa853ef551fdbcb3bf82c836ffd97300
""" 2D Array - DS THis function should take a random 6x6 array and postion wise get a sum of all of the elements in the """ import traceback def hourglass_max_sum(d_array: list) -> int: """ Params: an array that is a 6X6 Return: a max value of the patern defined in the array """ # print(d_array) ...
991,228
fee1452b9b047ccd0f941c3ebd1766337f60f524
"""Given a 26 letter character set, which is equivalent to character set of English alphabet i.e. (abcd….xyz) and act as a relation. We are also given several sentences and we have to translate them with the help of given new character set.""" # utf-8 def newString(charset,input): oricharset = "abcdefghijklmnopqrs...
991,229
36c61ac4c46d0fd24c275c3bb92bc1bda8de1542
#!/usr/bin/env python HELP = """ [hh] Help [qq] Quit [rr] Reset Input (Letters): <a-z>... """ WORDS = [ 'about', 'after', 'again', 'below', 'could', 'every', 'first', 'found', 'great', 'house', 'large', 'learn', 'never', 'other', 'place', 'plant', 'point', 'right', 'small', 'sound', 'spell'...
991,230
43297ff15d5fd3695d0026a3bb5917d627cef411
import torch import torch.nn.functional as F from fairseq.criterions import FairseqCriterion, register_criterion @register_criterion('ocrseq_loss') class OCRSeqLossCriterion(FairseqCriterion): def __init__(self, args, task): super(FairseqCriterion, self).__init__() self.args = args self....
991,231
b31ec74fc907ae955ec8019fe515df3eeeb9e9e0
from django.shortcuts import render from django.views.generic import View from django.http import HttpResponseRedirect from django.urls import reverse import random import string from kimo.models import Device, Copil from kimo.models import Copil from kimo.models import Legatura from settings import SESSION_USER_I...
991,232
d5a835d9b09d6e9cd4cc1c044bce5cacba8dbf2c
with open('./doc.txt') as f1, open('./docie.txt') as f2: for line1, line2 in zip(f1, f2): print(line1 + line2)
991,233
c4538f013f8f8d7f310da668f0d29201055f6b10
import abc import argparse import json import re import psycopg2 from flask import ( Flask, request, make_response, ) app = Flask(__name__) class TaskStore(metaclass=abc.ABCMeta): @abc.abstractmethod def add(self, summary, description): pass @abc.abstractmethod def get_tas...
991,234
1837bc17b0ce2a263ee53859b9826274f2b6e0f5
import cv2 import numpy as np import matplotlib.pyplot as plt import matplotlib.image as mpimg def get_object(input): BLACK_THRESHOLD = 200 LOW_SIZE_THRESHOLD = 30 MAX_SIZE_THRESHOLD = 450 # Denoising imgray = cv2.GaussianBlur(input, (5, 5), 0) # imgray = cv2.cvtColor(imgray, cv2.COLOR_BGR2GRA...
991,235
d7736c6e5f7ed8305f50ffeac7845078968c26ac
import math from exercise_4 import arc try: # see if Swampy is installed as a package from swampy.TurtleWorld import * except ImportError: # otherwise see if the modules are on the PYTHONPATH from TurtleWorld import * def petal(t, r, angle): for i in range(2): arc(t, r, angle) lt(...
991,236
0c80d91f5f95ed0a069f72bcfaa1258be9178c54
from sqlalchemy import Column, String from models import DecBase class User(DecBase): """ A user is a person who interacts with the solar network by browsing, posting, or commenting in beams. Attributes: seed: BIP32 XPrivKey used to generate Bitcoin wallets url: address of users pe...
991,237
c80bd314d62607628bf1e0f436f000f2bad0c5a4
from django.shortcuts import render, redirect, render_to_response from django.http import HttpResponse, HttpResponseRedirect,Http404 from .forms import LoginForm, LogupForm, CommentForm from .models import MyUser, Artical, Comment, Poll from django.contrib.auth.models import User from django.contrib.auth import authent...
991,238
93ed55d989436d902cefb258b4ada4b4fcfcc860
#!/usr/bin/env python shellcode = "\x83\xec\x7f\x6a\x0b\x58\x99\x52\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x31\xc9\xcd\x80" nopsled = "\x90"*(80 - len(shellcode)) eip = "\xba\xf7\xff\xbf" payload = nopsled + shellcode + eip print payload
991,239
efdc34dda06c9e07d1b8ad7ad375f20ac613dc40
import json data = { 'no': 1, 'name': 'Runoob', 'url': 'http://www.runoob.com' } json_str = json.dumps(data) print(json_str) python_dic = json.loads(json_str) print(python_dic) # 读取文件中的数据 with open('json_example.json', 'r', encoding='utf-8') as file: data1 = json.load(file) print(data1.__class__...
991,240
00d5fd442023cdaf05cde33110975438da58035f
class Solution: def isArmstrong(self, N: int) -> bool: k = len(str(N)) sum = 0 for ch in str(N): sum += int(ch) ** k if sum == N: return True return False
991,241
6499ed0532ca13f7a5383d101707541d3938506a
import numpy as np import pandas as pd train = pd.read_csv("train.csv", dtype={"Age": np.float64}, ) test = pd.read_csv("test.csv", dtype={"Age": np.float64}, ) train.head(10) train_corr = train.corr() train_corr def correct_data(train_data, test_data): # Make missing values ​​for training ...
991,242
24ff0619b75fc39f04a2b1c14d68dcb381c838bc
import cv2 import numpy as np import matplotlib.pyplot as plt cv2.namedWindow("Camera", cv2.WINDOW_KEEPRATIO) cam = cv2.VideoCapture(0) if not cam.isOpened(): raise RuntimeError("Camera broken") cascade = cv2.CascadeClassifier( 'lectures\src\haarcascade_frontalface_default.xml') while cam.isOpened(): r...
991,243
e01663632cd8b45d5dc40b1162b2fbae376c7e72
import cv2 import numpy as np img = cv2.imread('download.jpeg') ret, threshold = cv2.threshold(img, 12, 255, cv2.THRESH_BINARY) im2gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) ret, threshold = cv2.threshold(im2gray, 10, 255, cv2.THRESH_BINARY) adaptive_threshold = cv2.adaptiveThreshold(im2gray, 255, cv2.ADAPT...
991,244
1ce852870bdefbb37b32284437c62122f2aedd69
celsius = input('please input temperature in Celsius: ') fahrenheit = float(celsius) * 9 / 5 + 32 kelvin = float(celsius) + 273.15 print('degree in fahrenheit: ', fahrenheit) print('degree in kelvin: ', kelvin) def temperature_function(celsius): fahrenheit = float(celsius) * 9 / 5 + 32 kelvin = float(celsius)...
991,245
a9fe2d46638f0e2327b8b4ae6a7bdc64b7028c44
#!/usr/bin/env python # vim: set ts=2 sw=2 expandtab: import game from optparse import OptionParser import sys import random def main(): parser = OptionParser() parser.add_option("-U", "--username", dest="username", help="username of login") parser.add_option("-P", "--password", dest="passwo...
991,246
b5df8ffe4028c127f66a2af7d960f6dd791f90e9
name = input('请输入你的名字: ') print('wellcome,',name) print("1024 * 768 =",1024*768) print('''line1 line2 line3''') # r表示内部字符串不转义 print(r'''hello,\n world''')
991,247
c29167472c1b2cf03d2337e95724aa428408e9ef
import json import random import re import string import threading from datetime import datetime import psycopg2 import requests import email_verification import general_settings import validater rand = lambda len: ''.join( random.SystemRandom().choice(string.ascii_lowercase + string.ascii_upperca...
991,248
4ac0b8bd83ed4f9e1d5f7423dede83803cc63136
from django.db import models class FanPage(models.Model): name = models.CharField(max_length=100) def __str__(self): return self.name class Article(models.Model): fanpage = models.ForeignKey(FanPage, on_delete=models.CASCADE) text = models.TextField() time = models.DateTimeField() u...
991,249
62f79e1708785d6eacd7eda0edde2e1da8fa202b
# Copyright 2017 Neural Networks and Deep Learning lab, MIPT # # 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 applicab...
991,250
6bf50364d8153e8509974dc773a94e64c5c98ce4
import os import pytest import hetio.hetnet import hetio.readwrite from .readwrite_test import formats, extensions def test_creation(tmpdir): # Convert py._path.local.LocalPath to a string tmpdir = str(tmpdir) # Construct metagraph metaedge_tuples = [ ('compound', 'disease', 'treats', 'bot...
991,251
1cfab9f015f23eb9965d8431f9d16cd6519ae972
#moving files from my desktop to a #specific folder on my desktop import os import shutil #Be sure to be in the directory your python program is in before running sourcePath = '/Path/To/Your/Source' source = os.listdir(sourcePath) destinationPath = '/Destination/You/Want/Your/File/Moved/To' def scanAndMoveFiles(): ...
991,252
c3b3ffed6825b3158830baabb629d608dd63fc4c
import asyncio, random import os, io, gettext import time from hangupsbot.utils import strip_quotes, text_to_segments from hangupsbot.commands import command import appdirs ### NOTAS ### @command.register def recuerda(bot, event, *args): """Guarda un mensaje en la libreta de notas\nUso: <bot> recuerda [nota]""" ...
991,253
cb633ac84da15cfe4181bc30f0067dd1e75ae320
# Generated by Django 2.2.1 on 2019-06-08 01:31 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='About', fields=[ ('id', models.AutoField(au...
991,254
05941d7c4ba5c357b08c0bdfa682925299f90b3f
def gcd(a, b): if(a % b == 0): return b return gcd(b, a % b) import sys out = sys.stdout sys.stdin = open('toral.in', 'r') sys.stdout = open('toral.out', 'w') s = raw_input().split() n = int(s[0]) m = int(s[1]) print(gcd(n, m))
991,255
f173af4a87bffc6ec97d428ffa2425241f2e686e
from __future__ import annotations import sqlite3 from dataclasses import dataclass from pathlib import Path from typing import Optional, Tuple, Union from lib.classifier.datasets import Category @dataclass class PostsEntry: id: str prediction: Category probability: float @classmethod def from_...
991,256
1263d3a3430e7334280e16e29b5d34a05548e422
from functools import reduce import binascii def reverse_circular_sublist(array, start, end): if end >= start: wraps=False else: wraps = True if wraps == False: subarray = array[start:end+1] else: subarray = array[start:] + array[:end+1] subarray.reve...
991,257
3eb411f58111baa719f7bfea6f1a96c46133dd79
# Generated by Django 3.0.6 on 2020-07-11 01:00 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('store', '0012_auto_20200710_2050'), ] operations = [ migrations.AlterField( model_name='ordencompra', name='status',...
991,258
1fa13dc89774890147456f1d663ab603b9e5e13e
# -*- coding: utf-8 -*- __version__ = '0.1.2' program_name = 'refseq_masher' program_desc = 'Mash MinHash search your sequences against a NCBI RefSeq genomes database'
991,259
df61aab31369626be0953847387075e8e1b70950
from django import http from django.http.response import HttpResponse from django.shortcuts import render,redirect from django.contrib.auth.models import User from myapplication.models import Singup from myapplication.forms import SignUpForm,LoginForm,UpdateForm from django.contrib import messages from django.contrib.a...
991,260
8ab0ecb085cc7b0e9ffb8d6ccb52e0cd76730a71
a=input().split(",") for i in range(len(a)): a[i]=int(a[i]) a.sort() print(a[0])
991,261
9eb467a0786bb961de70456690c32e44e4a17e9a
# Generated by Django 3.1.7 on 2021-03-19 14:37 from django.conf import settings import django.contrib.auth.models import django.contrib.auth.validators from django.db import migrations, models import django.db.models.deletion import django.utils.timezone import encrypted_fields.fields class Migration(migrations.Mig...
991,262
3098b1140e29f77e1308f97680f2eda709e67441
#Python for Beginner 제4장_06 #연산자 우선순위 #연산자가 여러 개 동시에 나오면 어떤 것을 먼저 처리할지 고려 우선순위 연산자 의미 =================================================================== 1 () [] {} 괄호, 리스트, 딕셔너리, 세트 등 2 ** 지수 3 + - ~ 단항 연산자 ...
991,263
b9a8fc64090f7c2f4e553beea28a92a7e34ecd9c
n = int(input()) arr = [int(x) for x in input().split()] sum = 0 for i in arr: sum ^= i print(sum)
991,264
a12775024d8eb003e159c316fea70912e7fb5db5
import itertools import os from pydub import AudioSegment from utils import pairwise def concat_audio_files(audio_files, out_file): _, out_file_ext = os.path.splitext(out_file) audio_segments = (AudioSegment.from_file(file) for file in audio_files) sum(audio_segments).export(out_file, format=out_file_ex...
991,265
270ed5bc348c5d45ff82516423c468d974585558
import torch from torch import nn ### CONVERTED FROM https://github.com/tensorflow/tensor2tensor/blob/master/tensor2tensor/models/research/universal_transformer_util.py#L1062 class ACT_basic(nn.Module): def __init__(self,hidden_size): super(ACT_basic, self).__init__() self.sigma = nn.Sigmoid...
991,266
c80983ea0b8c9cec10ad6f2b499ea3c36b8cb596
# This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO import collections if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise E...
991,267
f1eacbe9ce5d936928bda97704e16584ef784392
from Framework.Genetics.LocationBuildController import LocationBuildController from Framework.RunController import RunController from NQueens.LocationCreators.NQueensLocationBuilderParameters import NQueensLocationBuilderParameters from NQueens.NQueensDemeBuilder import NQueensDemeBuilder from NQueens.NQueensHistorical...
991,268
7668898a1e0536a9f13d25acfa8cf9278ff55cf1
# Question 15:write a program that ask the user to enter two numbers ,x and y,and computes |x-y|/x+y. x = float(input('Enter x: ')) y = float(input('Enter y: ')) print(abs(x-y)/x+y)
991,269
fd2345dfb339589f2cc3022acd167c47e789dd1f
from abaqusGui import * from abaqusConstants import ALL import osutils, os ########################################################################### # Class definition ########################################################################### class _rsgTmp322_Form(AFXForm): #~~~~~~~~~~~~~~~~~~~~~~...
991,270
c49248531904d59e685fe5d1242556b4e18d06c1
from turtle import * pidge = Turtle() pidge.color('orange') pidge.pensize(5) pidge.speed(5) pidge.shape('turtle') pidge.turtlesize(5,5,5) for x in range(4): pidge.forward(100) pidge.left(90) mainloop()
991,271
2bd64565505c7e80a00259e87085949275143037
# Generated by Django 3.1.6 on 2021-02-19 04:54 from django.db import migrations, models import djmoney.models.fields class Migration(migrations.Migration): dependencies = [ ('order', '0004_auto_20210218_2132'), ] operations = [ migrations.AddField( model_name='order', ...
991,272
bac2e4af3aafe7f2bc6488dbe4a0b09cf18cb310
# A full-feature game of Blackjack from random import shuffle from time import sleep from os import system class Card(): """ base card class. Allows us to create any cards to put them in the deck later on. """ suits = ["spades", "diamonds", "hearts", "clubs"] values = [None, None, "2"...
991,273
e83a3ab4e38e89534b3ffc1e1bf95e2d17529aa1
"""initial migration Revision ID: 55ca2c0b5330 Revises: Create Date: 2018-12-29 20:10:44.477132 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '55ca2c0b5330' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto ...
991,274
b29c3f26970376fc106335b367f4e87c0cb1cc9d
def average(x,y,z): m= (x+y+z)/3 return ("{:.2f}".format(m)) if __name__ == '__main__': n = int(input()) student_marks = {} for i in range(n): name, *line = input().split() scores = list(map(float, line)) student_marks[name] = scores query_name = input() print(averag...
991,275
d713ad01f97b3c00cf7d82c709965124140b67ee
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'HandsOn_GUI_Layout.ui' # # Created by: PyQt5 UI code generator 5.5.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWind...
991,276
65626faf1afb754839d03bc3cf46f3da53d27f5a
from random import randint class Ghost(object): def __init__(self): colors = ['white', 'yellow', 'purple', 'red'] self.color = colors[randint(0,len(colors)-1)] c1 = Ghost() print(c1.color)
991,277
0b05c617a3e4cfeff2e235930ff8b2d349e21d5d
# MAXUSBApp.py # # Contains class definition for MAXUSBApp. import time from ..core import FacedancerApp from ..USB import * from ..USBDevice import USBDeviceRequest class MAXUSBApp(FacedancerApp): reg_ep0_fifo = 0x00 reg_ep1_out_fifo = 0x01 reg_ep2_in_fifo ...
991,278
30fd23d3de4a569db9b1dfd4b1d89d6d44629e5a
from sympy import Line, Point, intersection import numpy as np import yaml import os.path from os.path import realpath, dirname class ParameterCompute(object): """ Schoepflin, T.N., and D.J. Dailey. 2003. “Dynamic Camera Calibration of Roadside Traffic Management Cameras for Vehicle Speed Estimation.” ...
991,279
15c4afb7835dfb0bf9dc467aad5a451a86d45543
from rdflib import Namespace, Graph, Literal, RDF, URIRef from rdfalchemy.rdfSubject import rdfSubject from rdfalchemy import rdfSingle, rdfMultiple, rdfList from brick.brickschema.org.schema._1_0_2.Brick.AHU_Discharge_Air_Temperature_Cooling_Setpoint import AHU_Discharge_Air_Temperature_Cooling_Setpoint from brick.br...
991,280
6714e9ff514d251f7723971c6dca8cde95499ed6
from fabrik_chain_3d import Bone as Bone, Joint as Joint, Mat as Mat, Utils as Util import math import numpy as np class FABRIK(): def __init__(self, chain_length, target_position, target_orientation,is_base_bone_fixed,base_bone_constraint_uv,fixed_base_location): self.target_position = target_position ...
991,281
2633b298f9424406a1ac82a6c06fe7fc54348252
from board import Board import pyglet class SquareWidget: widthpx = heightpx = 100 offsetpx = 40 def __init__(self, sq): self.square = sq self.column = 3 - sq.coord[0] self.row = sq.coord[1] self.letter = sq.letter def draw_square(self, batch): x = SquareWidge...
991,282
25349f6c9b1baa4211209c86da2e05a525d59260
"""Database module, including the SQLAlchemy database object and DB-related utilities.""" from myapp.extensions import db from sqlalchemy.inspection import inspect # Serialization mixin. The serialization function basically fetches all attributes the SQLAlchemy inspector # exposes and puts it in a dict. Another opt...
991,283
2541f2ae9c56515bd68ed70ca50b7f731657e4b2
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ from __future__ import print_function import keras from keras.application.vgg16 import VGG16 from keras.models import Sequential , Model from keras.layers.core import Dense, Activation, Dropout from keras.layers import Conv2D, MaxPooling2...
991,284
56bde6d86ae34dc7cb3d4cb42ae11342b9649c3f
class Solution: def stoneGameIII(self, stoneValue): length = len(stoneValue) alice, bob = 0, 0 alice_total, bob_total = 0, 0 turn = "alice" while True: if alice >= length or bob >= length: break if turn == "alice": tm...
991,285
be5dab1bc460e1433de160348344f77ce2530aa4
import csv import requests from fake_useragent import UserAgent from lxml import etree from time import sleep from random import randint def get_html(url): """获得html""" headers = {'User-Agent': str(UserAgent(path="C:/Users/Hanrey/Desktop/ua.json").random)} # headers = {'User-Agent': 'Mozilla/5.0 (Windows ...
991,286
65de37eada91a75cc02b863dbdbe15d59d769d1e
from flask import Flask,render_template,request,redirect,url_for,session from model import check_user,add_user_Todb,check_product,addproduct_todb app = Flask(__name__) app.secret_key = 'hello' @app.route('/') @app.route('/home') def home(): return render_template('home.html',title = 'home') @app.route('/about') d...
991,287
7b480b508fc082bd44699b3765985666f6a32593
# r/dailyprogrammer # easy #380 # Smooshed Morse Code 1 # write Moorse code generator def smorse(text): code = { 'a' : '.-', 'b' : '-...', 'c' : '-.-.', 'd' : '-..', 'e' : '.', 'f' : '..-.', 'g' : '--.', 'h' : '....', 'i' : '..', 'j' : '.---', 'k' : '-.-', 'l' : '.-..', 'm' : ...
991,288
375dba8ce959807684362b295f5a624259d62236
import requests import json ## Swiftly API URLS routes_url = 'http://api.transitime.org/api/v1/key/dca04420/agency/san-joaquin/command/routes?format=json' route_details_url = 'http://api.transitime.org/api/v1/key/dca04420/agency/san-joaquin/command/routesDetails?r=' times_vert_url = 'http://api.transitime.org/api/v1/k...
991,289
010f53728ccc228fcd3a07477b315c4b1f2298b2
from itertools import chain, takewhile, dropwhile from itertools import combinations, permutations a = [1, 2, 3] b = 'abc' print [(x, type(x)) for x in chain(a, b)] print [u''.join(x) for x in combinations(b, 2)] print [u''.join(x) for x in permutations(b, 2)] print list(takewhile(lambda x: x % 2 == 1, a)) print list(...
991,290
48828acc1a9417a217bc85d5e4c82312f77c0017
import math math.pi print("Inserire 1 se si vuole calcolare il volume del cubo") print("Inserire 2 se si vuole calcolare il volume della sfera") s=input() s=int(s) if s==1 : l=input("Inserire il lato del cubo ") l=int(l) v=l**3 print("Il volume del cubo e ",v) elif s==2 : r=input("Inserire il raggio della sfera ")...
991,291
b2afd36bf2dd6e651fce7110f7baf9f9d716050c
from django.shortcuts import render_to_response from django.template import RequestContext def contato(request): return render_to_response( 'contato.html', locals(), context_instance=RequestContext(request), )
991,292
08704c3de92db48b535b8ac83b24ed9cbbe5a089
#!/usr/bin/env python import os import getpass import tempfile import tarfile import operator import sqlalchemy as sa import numpy as np import pandas as pd import click try: import sh except ImportError: import pbs as sh @click.group() def cli(): pass @cli.command() @click.argument('tables', nargs...
991,293
77664bc81bc81721dc376defdceed2f4bf701ad2
from django.db import models from datetime import datetime import json # Create your models here. class UtilsManager(models.Manager): def retornar_fecha(self, fecha=None): if fecha != None: print('La fecha recibida es: ' + fecha) return datetime.strptime(fecha, '%Y-%m-%d %H:%M:%S')...
991,294
639285ffc92289b235e58e434061bdbe809467ae
from __future__ import print_function import os, sys #os.environ["CUDA_VISIBLE_DEVICES"] = "1" #per_process_gpu_memory_fraction = 0.45 gpu_memory_allow_growth = True from shutil import * import tensorflow as tf from utils import pp, makedirs from print_hook import PrintHook import numpy as np import scipy.ndimage FL...
991,295
afabca0540e7ee6246b7f22f3af2c78a847feb5b
from utils import load_doc import numpy as np from keras.preprocessing.text import Tokenizer from keras.utils import to_categorical from keras.models import Sequential from keras.layers import Dense, LSTM, Embedding from pickle import dump def define_model(vocab_size, seq_length): model = Sequential() model.add(Em...
991,296
c2dd55f26cb8de329ba31cd147970aaa4e1a9ddb
import scripts.other_module as om from h3 import h3 om.get_me() translate_statistic = {'Med': 'Median', 'Mean': 'Mean'} translate_pollutant = {'BC': 'BC', 'NO': 'NO', 'NO2': r'NO$_2$'} concentration_labels = { 'BC': r'$\mu$g m$^{-3}$', 'NO': r'ppb', r'NO$_2$': r'ppb' } def to_geojson(df, h3_address='h3_a...
991,297
5733aa417624ff8594071cc9eb89e63536c99536
#!/usr/bin/env python3 from ba.data import Generator import sys if __name__ == '__main__': if len(sys.argv) < 2: print('No arguments given') sys.exit() gen = Generator(sys.argv[1:]) gen.run()
991,298
7f8ec043c395900c2107e301eb271f1e027e0daa
""" Remote control of thermoelectric chiller by Solid State Cooling Systems, www.sscooling.com, via RS-323 interface Model: Oasis 160 """ __version__ = '0.0.0' import traceback import psutil, os, sys import platform #https://stackoverflow.com/questions/110362/how-can-i-find-the-current-os-in-python p =...
991,299
82d5d32f5ce3d00cd9434260e8368556dea4996f
# -*- coding: utf-8 -*- """ # 对尾盘策略的进行回测; # 主要的纠结点在于板块的龙头股的确定; Tue 2018/04/02 @author: Tracy Zhu """ # 导入系统库 import sys # 导入用户库 sys.path.append("..") from stock_data_task.find_hot_block import * from stock_base.stock_file_api import * picture_out_folder = ".\\stock_backtest\\picture\\" trading_day_list = get_tra...