index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
992,400
28d2c60d4c8452cedf4b829f48348802436a4b04
def qbrt(x): qube = lambda x: x * x * x square = lambda x: x * x def qbrt_iter(guess, x): def good_enough(guess, x): return abs(qube(guess) - x) < 0.001 def improve(guess, x): return ((x / square(guess)) + 2 * guess) / 3 ...
992,401
cf8dfd7c7487dcaef9add3ad09571c761fabff2e
from django.db import models from django.utils import timezone from django.contrib.auth.models import User #import menu items many to many from apps.pages.models import MenuItems from mptt.models import MPTTModel, TreeForeignKey from apps.blog import image from django.utils.translation import ugettext_lazy as _ #enco...
992,402
f560761c2cf96237df6d0a7e1684db27cbefb0c2
import time import requests import json import datetime import os if __name__ == '__main__': host = "https://anti-epidemic.ecnu.edu.cn/" str_ids = os.environ["ECNUID"] ids = str_ids.split(",") for id in ids: s = requests.Session() r = s.get(host + "/clock/user/v2/{}".format(id)) ...
992,403
e58583e228fc905543caa77d74e3d8ca9c55d139
from django.apps import AppConfig class QcmanagerConfig(AppConfig): name = 'qcmanager'
992,404
267add0f166d9d1666bdcb79dae9522a9f3252e4
E=int(input()) SS=list(map(int,input().split())) SS.sort() for H in SS: print(H,end=" ")
992,405
d2950b4637cade956ef86e04dc5e9b2dbe0db0af
import warnings import numpy as np import pandas as pd from sklearn.cross_validation import KFold, StratifiedKFold from sklearn.metrics import accuracy_score import bokeh.plotting as bkp colors = ['#32CD32', '#FF8C00', '#00BFFF'] # colors = ['0fce1b', '#f84525', '#25b3f8'] line_colors = ['#00FF00', '#FFA500', '#baf6...
992,406
9ebe829e9a3051ab7abe75036735bb36c6055ca5
# Copyright 1999-2021 Alibaba Group Holding Ltd. # # 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 a...
992,407
53fb335d563e520dbfb6b82ad4c01d5dedc90285
''' Provide meta data for recording data. ''' import os import re import time import tobids from joblib import Memory from pyedfread import edfread from scipy.io import loadmat from scipy.io.matlab.miobase import MatReadError memory = Memory(cachedir='/Users/nwilming/u/flexible_rule/cache', verbose=0) def identify...
992,408
ca9f8e8dfd4b95e18bfa1c1924df2b104c3948f8
''' Code written by: Steff Groefsema, Tomas van der Velde and Ruben Cöp Description: Agent is a subclass of the turret and plane classes. It handles basic functionality of these agents like the communication between them and updating of knowledge. ''' import random import numpy as np class Agent: def __init_...
992,409
c74d7922c2cbe25d9f32ebb72b2e242d1d730773
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'MainWindow.ui' # # Created by: PyQt5 UI code generator 5.13.0 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): Mai...
992,410
625b0b647f8098079c34e44830d1f2fcbf9d72c6
numero_funcionario = int(input('Número do Usuário: ')) horas_trabalhadas = int(input('Quantidade de horas trabalhada: ')) valor_por_hora = float(input('Valor hora: ')) salario = horas_trabalhadas * valor_por_hora print(f'NUMBER = {numero_funcionario} \nSALARY = U$ {salario}')
992,411
d21bf423fcf4005d21e2980c816aa0714003e8a3
from tkinter import * __author__ = 'sci-lmw1' """ CP1200 2015 SP1 Demo. Lindsay Ward, 19/05/2015 GUI with list of buttons """ INITIAL_WELCOME = "Welcome. Enter name:" class App(): def __init__(self): self.window = Tk() self.window.title("CP1200 Demo") self.introLabel = Label(self.win...
992,412
9faac9b49b38d0d755b77995e49ed21cb8a88ddb
import random import math from operator import itemgetter #sorting # Creates a list containing 5 lists, each of 8 items, all set to 0 h = 1000 w = 4 + h # radius of the circle circle_r = h # center of the circle (x, y) circle_x = 0 circle_y = 0 Matrix = [[0 for x in range(w)] for y in range(h)] ...
992,413
9733fe1b973f5f64e509670a0d892775a9484a50
def right_justify(s): needed_whitespace = 70 - len(s) print(' ' * needed_whitespace + s) def do_twice(f): f() f() def print_grid(rows, columns): for i in range(0, rows): print('+ - - - - ' * columns + '+') for j in range(1, 4): print('| ' * columns + '|') pr...
992,414
204bd20405eb73f6b24c2064a4e062e0a0f4876f
# problem 2 - https://projecteuler.net/problem=2 upper_limt=4000000 first=1 second=2 carry=0 sum=2 for i in range(1,upper_limt,1): if first < upper_limt: first = first + second #print(f'First=',first) carry = second second = first if first %2 == 0: sum=sum+first ...
992,415
ad22841b9580c260eb238a178b2645d545ec9afc
""" Jonathan Reem January 2014 Functional programming utility functions. """ # pylint: disable=C0103, W0142, W0622 from infix import Infix from collections import namedtuple Unit = namedtuple("Unit", "") def curry(func, args): "Curries a function." return lambda *a: func(args + a) def const(first, _): ...
992,416
ad3e576bd9246c8cf347f936d2b779f2bac27bec
# sampling - radiant #run pro import numpy as np import pandas as pd cancer = pd.read_csv('cancer.csv', engine = 'python') # sample number 추출 rn = np.random.randint(0, # 시작값 cancer.shape[0], # 끝값 size = round(cancer...
992,417
448e0ed9d94acec68253f195478496d231f55c7e
def main(): s = '123' print (len(s)) main()
992,418
a35b7de74bf752f454a4a5f830ee418ed7f3ed50
"""Constants for the Healthchecks integration.""" DOMAIN = "healthchecks"
992,419
e18b0caa633fa2ec031ec3bdcfacfa47f357b0ba
import gensim import matplotlib as mpl from imp import reload from nltk.corpus import stopwords from collections import Counter import pandas as pd import numpy as np import nltk,re,pprint import sys,glob,os import operator, string, argparse, math, random, statistics class vectorize: def __init__(self,data,factorN...
992,420
1fe4d2add4e7f632951131fbaa681e198fe59c93
version https://git-lfs.github.com/spec/v1 oid sha256:2fa2b9a6c916723c5be4a4aab049986033b2e92215b5762f96286e1ef14f367b size 46731
992,421
76e7be6fb27cc41900f567011d7477f09cd6d130
import MapReduce import sys """ Word Count Example in the Simple Python MapReduce Framework """ mr = MapReduce.MapReduce() # ============================= # Do not modify above this line def mapper(record): # key: document identifier # value: document contents i = 0 N = 5 k= 0 list = [...
992,422
b1768b06c5caf4edf7cbf9182ad3b1a29c2aa517
#!/usr/bin/env python3 from datamodel_parser.application import Argument from datamodel_parser.application import Store from sdssdb.sqlalchemy.archive.sas import * from json import dumps import time print('Populating filespec table.') arg = Argument('filespec_archive') options = arg.options if arg else None store = ...
992,423
890131b14e1e2c839f33077662f350f2b4679c94
# start the flask server if __name__ == "__main__": from arpatm.server import run run()
992,424
6ff77cdcc6c62bb077bc7a81105042389d7d8c3a
class Student(Person): # Class Constructor def __init__(self,firstName, lastName, idNum, scores): super().__init__(firstName, lastName, idNum) for i in scores: self.scores = sum(scores) self.scores = self.scores/len(scores) # Parameters: # firstN...
992,425
b739f85ad379d77252e6e624427b14e775e57b0a
from ._configurationService import *
992,426
9875c38e38dda6c8b0ad46c1119e8b92196b75a3
from .RMQ import RMQ import time import logging import os logger = logging.getLogger(__name__) class Logger(RMQ): """ ENV requires: RMQ_HOST=127.0.0.1 RMQ_PORT=5672 RMQ_USER=guest RMQ_PASS=guest RMQ_EXCHANGE= RMQ_EXCHANGE_TYPE=direct RMQ_LOGGER= """ def __init__(self): ...
992,427
f0fe7051708cc86dafb98a97ef0f2e6467e1b8e4
from I3Tray import * from icecube import icetray from icecube.icetray import traysegment from icecube import icetray, dataclasses, dataio @icetray.traysegment def L3_Monopod(tray, name,year,Pulses='OfflinePulses', AmplitudeTable="/data/sim/sim-new/downloads/spline-tables/ems_mie_z20_a10.abs.fits", TimingTable=...
992,428
199807dfa3c653f0b5f2a89c5eebad06e13e95fe
import pytest from three_musketeers import * left = 'left' right = 'right' up = 'up' down = 'down' M = 'M' R = 'R' _ = '-' board1 = [ [_, _, _, M, _], [_, _, R, M, _], [_, R, M, R, _], [_, R, _, _, _], [_, _, _, R, _] ] def test_create_board(): create_board() ...
992,429
76b015f65efd256ad72bb82bd18ebaa9da61c2bf
# -*- coding: utf-8 -*- """ Created on Thu Jan 05 16:37:36 2017 基础的文件夹删除,文件读取,文件写入数据库 @author: Acer """ import os import pandas as pd import MySQLdb import sys reload(sys) sys.setdefaultencoding("utf-8") ############################################### ############################################### ###########删除xls文件 ...
992,430
fff571b9ecb52deba250f96288f7973dd004a3e1
################# # # INFO, WARNING, ERROR # ################# # chiamerà via XML-RPC engine # per i log locali usa il modulo di logging di python #import logging #TODO: integrazione con engine class LogWrapper(object): _log_singletons = {} def __new__(inst, *args, **kwds): if not inst._log_singletons.has_key(in...
992,431
18090851ca879ab3b20a19d12a15401d91e8921f
import os import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.patches as patches from skimage import io, img_as_uint from skimage.morphology import skeletonize, medial_axis, skeletonize_3d from skimage.measure import regionprops, label from skimage.filters import threshold_otsu fr...
992,432
9cc023028dff22a1fb62ae0db859914b381df7dd
s = input() s_list = list(s) for i in range(len(s_list)): if s_list[i] == 'A': s_list[i] = '4' elif s_list[i] == 'E': s_list[i] = '3' elif s_list[i] == 'G': s_list[i] = '6' elif s_list[i] == 'I': s_list[i] = '1' elif s_list[i] == 'O': s_list[i] =...
992,433
1458dfdf0dfd6425cf9195e7f3374b363003f9e1
# -*- coding: utf-8 -*- ## Animal is-a object (yes, sort of confusing) look at the extra credit class Animal(object): #创建“Animal”父类 pass ## is-a class Dog(Animal): # 创建“Dog”子类(继承自“Animal”父类) def __init__(self, name): # 在Dog子类下创建的空对象 ## has-a self.name = name # 初始化 ## is-a class Cat(Animal): # 创建“Cat”子类(继承自“An...
992,434
932616548bfd2c66da012b1c25aad7c7b819b89d
from kivy.animation import Animation from kivy.properties import NumericProperty from kivy.uix.widget import Widget from configurables import heartSize, healthDistance, healthLeaveTime, healthGrowSize class Health(Widget): health = NumericProperty(3) def __init__(self, *args, **kwargs): super(Health...
992,435
e7fb8dcb364b96d189ba4c5840c9635dac502609
import csv from numpy import mat import random from sklearn import tree from sklearn.model_selection import train_test_split import numpy as np filename = 'D:\课\机器学习\机器学习作业\机器学习作业\heart.csv' with open(filename) as f: reader = csv.reader(f) l = list(reader)[1:] # np.random.shuffle(l) labels = [] res...
992,436
82024d16da886bf0d69c4fe4a293cd4e72e0fb2c
import urllib, urllib2 import re from readability.readability import Document sig = '<table cellspacing=0 cellpadding=2>' url_sig = '<a href="' amount_sig = '<td align="right" nowrap>' amount_web_sig = '<span class="nums" style="margin-left:120px">' def read_baidu(url): req=urllib2.Request(url) req.add_he...
992,437
b57b8ea5e5d3dc6cfcc08d63aa5469bc5cd1efb3
class Solution(object): def findDisappearedNumbers(self, nums): res = [] if nums: n = len(nums) for i in range(n): val = abs(nums[i]) - 1 if nums[val] > 0: nums[val] = -nums[val] for i in range(n): ...
992,438
00b2563e12eb5b06da5f052bad42fdd9f9cb9a0d
for x in range(1, 100, 1): if i % 3 == 0 and i % 5 == 0: print(i," fizzbuzz\r") elif i % 3 == 0: print(i," fizz") elif i % 5 == 0: print(i," buzz") else: print(i,"\r")
992,439
94db6ed383071d9d6ad012fef420cbe8bbf248a6
from torch.utils.data import Dataset from PIL import Image from utils import data_utils class ImagesDataset(Dataset): def __init__(self, source_root, target_root, opts, target_transform=None, source_transform=None): self.source_paths = sorted(data_utils.make_dataset(source_root)) self.target_paths = so...
992,440
be632030769cef5017226df085549c4821876fe2
# SPDX-FileCopyrightText: 2021 Carnegie Mellon University # # SPDX-License-Identifier: Apache-2.0 # Some basic setup: # Setup detectron2 logger import detectron2 from detectron2.utils.logger import setup_logger setup_logger() import copy import glob import json import os import pickle as pk import shutil import time...
992,441
09adec2315258b068601a808d947a470138e7f23
import scipy.io as sio import matplotlib.pyplot as plt import numpy as np import itertools def predict_y(x, w): """ Find predicted y vector given x and w vectors for a polynomial evaluation """ r = [] n = len(w) for i in range(len(x)): temp = 0 for j in range(n): te...
992,442
a56623ff4d1835c168294a9458cb699db374efd8
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='listhostname', fields=[ ('id', models.AutoField...
992,443
8bf5bff9753552805285fda6e35ccfa3fde26b24
# Generated by Django 3.2.2 on 2021-06-07 11:18 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('product', '0001_initial'), ] operations = [ migrations.AlterModelOptions( name='category', options={'verbose_name': 'Категор...
992,444
1cf91b3303ec90afe5d8849a9dc537c8cfe735c5
n=int(input()) a=1 b=1 print(a) i=1 while i<n: i+=1 a,b=b,a+b print(a)
992,445
83e50b6bdc57f96698686c347904f3b8d907cb85
# -*- coding: utf-8 -*- # Tichy # # copyright 2008 Guillaume Chereau (charlie@openmoko.org) # # This file is part of Tichy. # # Tichy is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either ve...
992,446
16a387d6ad706a4e9e4b02e73bfc12a0d009d422
# Project Euler Problem 47 import time startTime = time.clock() NUMBER_OF_FACTORS = 4 def primeFactors(n): factors = [] d = 2 while n > 1: while n % d == 0: factors.append(d) n //= d d = d + 1 if d * d > n: if n > 1: factors.app...
992,447
39d6feafea6ae8ecfc6d33d5d8306059eccc89d0
from django.contrib import admin from import_export.widgets import ForeignKeyWidget from import_export.admin import ImportExportMixin,ImportExportModelAdmin,ImportExportActionModelAdmin,ExportMixin,ExportActionModelAdmin from import_export import fields,resources from municipios.models import Municipio from .models imp...
992,448
d776b14b69be7b564ab4b5871deff9b2557639b7
import random """Importing random values for taking random values into the list""" class ConsoleGame: """Defining class for the game""" def generate(self): """In this function we generate the random 8X8 matrix in list by importing random values""" self.lst=[] for i in range(8): ...
992,449
74afc8f42b7b69e18bf2bff7d125c3415bf512ed
import random from board import Board, XO class GameOrganizer: act_turn = 0 winner = None def __init__(self, px, po, nplay=1, show_board=True, show_result=True, stat=100): self.px = px self.po = po self.players = {XO.PLAYER_X: px, XO.PLAYER_O: po} self.nwon = {XO.PLAYER_X...
992,450
dae4d2f90ed5a8a93833ff43b5cd1199dc8de278
#!/usr/bin/python import sys sys.path.append('./') import unittest import numpy as np from hybmc.termstructures.YieldCurve import YieldCurve from hybmc.models.AffineShortRateModel import AffineShortRateModel, CoxIngersollRossModel, fullTruncation, lognormalApproximation, quadraticExponential from hybmc.simulations.M...
992,451
785574fa81cc6e6d370ef50d79c22f53d88a9792
def convert_to_double_byte(str_hex): """ 毫秒和微妙太小,可能会导致亚秒对应的十六进制字符串不足两个字节(2B),如字符串型十六进制数'0xab'对应的十六进制字符串b'ab'只有一个字节(一个 字母在十六进制数中代表4个比特位,8个比特位为一个字节),需要考虑在前面补充'00',填补成两个字节,成为'0x00ab' :param str_hex: 字符串型十六进制数。至少有一位有效位,即类似于'0x0'型 :return: 填充成两个字节的字符串型十六进制数 """ if len(str_hex) == 6: # 如果就是4个字节,除...
992,452
bf3540869cd84942f604019fd88db5eea27584a9
from enum import Enum class Direction(Enum): north = n = 1 northeast = ne = 2 east = e = 3 southeast = se = 4 south = s = 5 southwest = sw = 6 west = w = 7 northwest = nw = 8 class Node(object): def __init__(self): self.entities = set() self.travel_directions = {} ...
992,453
c283911ccac2ae88d2aea8c1ba0e37ff00ad0307
import yaml import os from collections import namedtuple def read_circle_region_params(parameters): """ :param parameters: parameters obtained from yaml. :return: named tuple of circle region detection parameters. """ circle_tuple = namedtuple('circle_region', ['ksize...
992,454
c6e979408b71cb916a34c5ca35014529e6bc3dd7
#!/usr/bin/env python # parse command line options def cli_opts(argv, inp, call_conv): import sys, getopt def print_ft_exit(): print call_conv sys.exit(2) try: opts, args = getopt.getopt(argv, ':'.join(inp.keys()) + ':') except getopt.GetoptError as e: print_ft_exit() print e exce...
992,455
67f3b591b4e3060fc9f02973c195b3dfbc6479a7
import spice_api as spice import tvdb_api import re import os from datetime import datetime from datetime import timedelta import pytz import tkinter as tk import json import pickle import libagents exitFlag = 0 t = tvdb_api.Tvdb() animeList = [] memoizedAir = {} path = os.path.dirname(os.path.abspath(__file__)) ...
992,456
6fed7c28cd2721811f31e3fc73248b1b3dd9b523
""" Напишите программу-калькулятор, которая: в первой строке считывает число (начальный результат); в последующих строках считывает символ мат. операции и число, применяет операцию к результату; как только прочитан символ «=», выводит результат и завершает работу. * Программа должна обрабатывать некорректный ввод. try:...
992,457
14b75bdce35b3025a35cbf1a786312b77501b9ed
print('='*50) print('Sequencia Fibonacci') print('='*50) # Código principal vqtde = int(input('Quantas vezes você quer repetir: ')) t1 = 0 t2 = 1 # o contador começa em 3 porque ja mostrei 2 posições count = 3 t3 = 0 print('{} - {} - '.format(t1,t2) , end = '') while count <= vqtde: t3 = t1 + t2 ...
992,458
f42797d81becae5b224ce5a2e2562709fc905682
""" Створити програму, для виклику таксі • Користувач може вибрати такcі певної категорії зі списку (prices.json) Приклад виводу переліку категорій у вигляді таблички: Name Estimate UberX $13-17 SUV $50-64 • Після, користувач може вказати назву категорії та відстань в кілометрах • Як результат на екран виводиться ...
992,459
a313edad9bd5a111d1da4a260365da41a6158d84
"""This component provides Switches for Unifi Protect.""" import logging try: from homeassistant.components.switch import SwitchEntity as SwitchDevice except ImportError: # Prior to HA v0.110 from homeassistant.components.switch import SwitchDevice from homeassistant.config_entries import ConfigEntry fro...
992,460
1d66720539e0f87574f311dd930a4e7355e31fe3
from common import Day class Day_2020_15(Day): def parse(self): return [int(x) for x in self.input.split(",")] def simulate(self, initialization, n): history = dict() for turn in range(1, len(initialization) + 1): number = initialization[turn - 1] history[num...
992,461
b434f0a3043e750032d5e3d893bbd46b29855cad
from django import forms from .models import * import re from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm,AuthenticationForm from django.contrib.auth import authenticate, get_user_model,login class InternSignUpForm(UserCreationForm): class Meta: model = ...
992,462
8470a976bbacfdf25e644f67e631dfebd60aa8b5
# * # * * # * * # * * * Author:Aditya Joshi # * * # * * # https://www.hackerrank.com/challenges/minimum-swaps-2/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=arrays arr = [2, 3, 4, 1, 5] # arr = [1, 3, 5, 2, 4, 6, 7] # arr = [4, 3, 1, 2] swa...
992,463
0468aca7823e8267e3ca93a446333cabfe7abc7b
"""Business Insider Model""" __docformat__ = "numpy" import json import logging from typing import Tuple import pandas as pd from bs4 import BeautifulSoup from openbb_terminal.decorators import log_start_end from openbb_terminal.helper_funcs import get_user_agent, request from openbb_terminal.rich_config import cons...
992,464
97303f5315451cd156e73b345a399eaf061395df
#!/usr/bin/env python #-*- coding:utf-8 -*- """ @file: auth.py @time: 2018/12/16 @software: PyCharm """ from rest_framework.authentication import BaseAuthentication from rest_framework.exceptions import AuthenticationFailed from api import models # 登录认证 class LufyyAuth(BaseAuthentication): def authentica...
992,465
513469baf1db210cb589fbefd53b3968e0320a5d
instMin = min(instructions) instMax = max(instructions) if instMin==instMax: return 0 cost = 0 nums = [] for i in instructions: j = 0 numL = 0 while j < len(nums): if nums[j] >= i: numL = ...
992,466
4301e2dad6d849cdca4c23c5cc90075ebc3a7e06
#!/usr/bin/python #coding:utf-8 import tushare as ts from time import sleep import tkinter import tkinter.messagebox #这个是消息框,对话框的关键 #关注的股票 listStock_Code = ['600740', '600416'] while True: df = ts.get_realtime_quotes(listStock_Code) # Single stock symbol # df[['code','name','price','bid','ask','v...
992,467
6287abd40ee0813ee49c7369f2412d853a0161d1
import numpy as np import cv2 import glob from scipy.misc import imread, imresize, imsave import matplotlib.pyplot as plt # %matplotlib qt # prepare object points, like (0,0,0), (1,0,0), (2,0,0) ....,(6,5,0) objp = np.zeros((6*9,3), np.float32) # print("objp") # print(objp) objp[:,:2] = np.mgrid[0:9,0:6].T.reshape(-1,...
992,468
a956494f34cdc2bc978bd1eab9b16b73d918a51b
#!/usr/bin/python # SCAR - Serverless Container-aware ARchitectures # Copyright (C) GRyCAP - I3M - UPV # # 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/LICE...
992,469
f2a062c52583843b63ba3e2fabc7e71686f04d76
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jul 6 17:10:47 2019 题目:翻转字符串里的单词 给定一个字符串,逐个翻转字符串中的每个单词。 示例 1: 输入: "the sky is blue" 输出: "blue is sky the" 示例 2: 输入: " hello world! " 输出: "world! hello" 解释: 输入字符串可以在前面或者后面包含多余的空格,但是反转后的字符不能包括。 示例 3: 输入: "a good example" 输出: "example good a" 解释: 如果两个单...
992,470
af170e8f3164e0642bf162f0dda78c4b66b9f03d
''' Tests for check_password() ''' from password import check_password
992,471
6fb2a909741132e05ffc6f198ac185e8976f59ff
# https://gist.github.com/yrevar/942d3a0ac09ec9e5eb3a # imagenet index label import os, sys # import tensorflow as tf import numpy as np import logging import argparse sys.path.insert(0, '/root/') sys.path.insert(0, '/root/tfrpc/client') from pocket_tf_if import TFDataType class IsolationControl: NAMESPACE = True ...
992,472
665416cef7d3f05b8ccac818134bd2c6a5fb877b
#coding:utf-8 from django import forms import models class UserForm(forms.ModelForm): class Meta: model = models.User fields = '__all__' labels = { 'name':'姓名', 'password':'密码', 'age':'年龄', "role":'角色' } widgets = { ...
992,473
24d785eecae75fc110a379e60a7df9827bca81e2
import epa_modules import os.path import argparse import sys from epa_modules import * #init Config and Control module objects Config = epa_modules.ConfigMod.ConfigMod() Control = epa_modules.ControlMod.ControlMod() print("mode: ", Config.mode) if(Config.bootstrap): #Bootstrap for testing purposes, bypasses interac...
992,474
08dad64fecc74fa6dcc9ece0587ad59b5145cda6
import ROOT import math def deltaRpT(vec1,vec2): dEta = vec1.Eta() - vec2.Eta() dPhi = ROOT.TVector2.Phi_mpi_pi(vec1.Phi() - vec2.Phi()) dPt = vec1.Pt() - vec2.Pt() return math.sqrt(dEta*dEta + dPhi*dPhi + dPt*dPt) def deltaR(vec1,vec2): return vec1.DeltaR(vec2)
992,475
746dc8738561b7ef94c11544dc592be5032a1ce7
#!/usr/bin/env python '''libraries''' import time import numpy as np import rospy import roslib import cv2 from geometry_msgs.msg import Twist from sensor_msgs.msg import CompressedImage from tf.transformations import euler_from_quaternion, quaternion_from_euler global LSD LSD = cv2.createLineSegmentDetector(0) # ...
992,476
3b40da8109929d9dfc1f2a43baa36400fa30434f
# -*- coding: utf-8 -*- from PyQt5.QtWidgets import QStackedWidget, QWidget, QToolTip, QPushButton, QApplication, QMessageBox, QMainWindow, QAction, QTextEdit, QGridLayout, QLabel, QLineEdit, QSlider, QLCDNumber from PyQt5.QtGui import QIcon, QFont, QImage, QPixmap from PyQt5.QtCore import Qt, QCoreApplication, pyqtSig...
992,477
b6dfa3d2bcf5d297e2312bcb562a65e190e0ceea
import urllib,re,os,sys import xbmc, xbmcgui, xbmcaddon, xbmcplugin from resources.libs import main from t0mm0.common.net import Net as net #Mash Up - by Mash2k3 2012. addon_id = 'plugin.video.movie25' selfAddon = xbmcaddon.Addon(id=addon_id) art = main.art smalllogo=art+'/smallicon.png' prettyName = 'Noobroom' u...
992,478
41adecfd7555cddc03fa22c533df106657561837
""" Django response reader """ from sap.cf_logging.core.response_reader import ResponseReader class DjangoResponseReader(ResponseReader): """ Read log related properties out of Django response """ def get_status_code(self, response): return response.status_code def get_response_size(self, respon...
992,479
2e38ea2efa0654c67f6d9eb406693b8fd0b30484
import tensorflow as tf g1=tf.Graph() with g1.as_default(): v=tf.get_variable("v", shape=[1,], initializer=tf.zeros_initializer) g2=tf.Graph() with g2.as_default(): v=tf.get_variable("v", shape=[2,3,5], initializer=tf.ones_initializer) with tf.Session(graph=g1) as sess: tf.global_variables_initializer()....
992,480
82a2f45a9c99fc04e05976eacf7c618b7869b1e3
# Generated by Django 2.2.2 on 2019-06-07 11:41 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('annonce', '0003_annonces_prix'), ] operations = [ migrations.AddField( model_name='annonces', name='image', ...
992,481
3b489b01fa96217456e243dd511fe5a7ff2c7407
EMAIL_ADRESS = "codage.mangdar@gmail.com" PASSWORD = "" DESTINATAIRE = ["p.goemans@hotmail.fr","codage.mangdar@gmail.com"]
992,482
c25544ed439ac43c65f2f24dcca692863cc0e653
def is_sorted(lst): pass print(is_sorted([17, 23, 27, 19, 31, 11])) # Output: False print(is_sorted([1, 24, 26, 30, 33])) # Output: True print(is_sorted([9, 30, 39, 43, 43, 44])) # Output: True print(is_sorted([18, 14, 16, 5, 25])) # Output: False
992,483
467b7bbac3856c2e0226ab0bf7a788d2ded23bb4
class BaseFactor(object): """ Base class for Factors. Any Factor implementation should inherit this class. """ def __init__(self): pass
992,484
1a3b609a0c14ce71400efd2371f07ad5f1f6facd
from pprint import pprint import json import numpy as np import os, sys # sys.path.append(os.environ['ENV_DIR']+'DaD/jsonFiles/') with open(os.environ['ENV_DIR']+'resources/jsonFiles/monsters.json') as f: data = json.load(f) #pprint(data) # Prints out all of the Json File monstNames = [] monstCRs = [] i = 0 for...
992,485
65e70aef8ddbe45a6729bcb55da671b3892db1e9
import requests from bs4 import BeautifulSoup import time import datetime import random import math from multiprocessing.dummy import Pool as ThreadPool from functions import fn_timer from json import loads as JSON import re import time import datetime @fn_timer def main(): # 获得当前时间戳 now = datetime.datetime....
992,486
9b215a67d28e8205c053cbae8f8e32d077428d9c
from PIL import Image validFormats=['jpg','jpeg','png'] name = input("Image : ") if (name !='' and len(name.split(".")) != 1): print("Leave feilds empty If you don't wish to change") height = input("Height : ").strip() width = input("width : ").strip() quality = input("Quality (in percentage) : ").stri...
992,487
29a1652721b5d762b91d372a307869ab98840998
from django.shortcuts import render, redirect from collection.forms import ClimbingShoeForm from collection.models import ClimbingShoe from django.template.defaultfilters import slugify from django.contrib.auth.decorators import login_required from django.http import Http404 # Create your views here. def index(reques...
992,488
5f248a801f223d4b2d8c1440497284597f3ff255
n=int(input("please input a year:")) if n%400==0 or n%100!= 0 and n%4==0: print("this year have {} day".format(366)) else: print("this year have {} day".format(365))
992,489
46d397d7b5152e978da27960fa53ba477b53fa00
import os basedir = os.path.abspath(os.path.dirname(__file__)) # DEBUG = False # DATABASE = 'flasktaskr.db' WTF_CSRF_ENABLED = True SECRET_KEY = 'my_precious' # define the full path of the database # DATABASE_PATH = os.path.join(basedir, DATABASE) # the database URI # SQLALCHEMY_DATABASE_URI = 'sqlite:///' + DATABAS...
992,490
8651e4aac40b244d428cb29c0ff4214e8d03801b
import json, requests class Creator: """ Class for Data Creation """ def read_file(self, entity_type): """ read the file """ with open('res/' + entity_type + '.json') as json_file: data = json.load(json_file) return data def create_entities(self, entity_type): ...
992,491
c3e36d9555e1013efee8934953f39839273fa2aa
#!/usr/bin/env python # -*- coding: utf-8 -*- # # petla_for.py # def main(args): liczba = int(input('Podaj liczbę początkowa: ')) liczba2 = int(input('Podaj liczbę końcowa: ')) while liczba2 <= liczba: liczba2 = int(input('Błędny zakres! Podaj liczbę początkowa: ')) fo...
992,492
a413db63fa4a75309602309e10cef6181b69b471
import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec def sample2fig(samples, rows, cols): fig = plt.figure(figsize=(4, 4)) gs = gridspec.GridSpec(rows, cols) gs.update(wspace=0.05, hspace=0.05) for i, sample in enumerate(samples): sample = sample.reshape((sample.shape[0], sa...
992,493
bd5f0b3358d69f915ad00e0ad90f164a26f4c2e4
import pandas as pd import tushare as ts import datetime as dt from sql_conn import * import os from pytz import timezone from pandas.tseries.offsets import Day source_db = 'postgresql' username = 'postgres' pwd = 'sunweiyao' ip = '119.28.222.122' port = 5432 db = 'quant' engine = sql_engine(source_db=source_db, ...
992,494
41013d9bb5c60dab8f05d7efb778e68478193586
import sciunit import sciunit.scores as sci_scores import morphounit.scores as mph_scores # import morphounit.capabilities as mph_cap import morphounit.plots as mph_plots import os import copy import json import neurom as nm import numpy as np import quantities class NeuroM_MorphStats_Test(sciunit.Test): """Te...
992,495
c0706709e5f266e7ceef233489e62c2b5f5c9834
from ansibleawx.api import Api
992,496
b02bb8b7a79e8384d43b5194e44e545c1cb009f1
import numpy as np import pandas as pd import sklearn from tqdm import tqdm import string from collections import OrderedDict import os import math import time from random import randint from sklearn.metrics.pairwise import cosine_similarity import nltk from nltk.tokenize import word_tokenize import gensim from gensi...
992,497
c6c1949bf04b85cfb2416458906f28c639c414ee
# -*- coding: utf-8 -*- import urlparse import json from django.views.generic import TemplateView from django.shortcuts import redirect, render from django.http import JsonResponse from models import Sala, Debate, Usuario from google import google, images from google.modules.youtube_search import search class SalaR...
992,498
96fa42a1df578bd57067424e54621e74f49aec79
#calss header class _ONSHORE(): def __init__(self,): self.name = "ONSHORE" self.definitions = [u'moving towards land from the sea, or on land rather than at sea: '] self.parents = [] self.childen = [] self.properties = [] self.jsondata = {} self.specie = 'adjectives' def run(self, obj1, obj2): ...
992,499
e2ebd19dd9046243ca6659050bd41bc78d3e1a71
#! /usr/bin/env python # -*- coding: latin-1 -*- import parser from parser import ParseError, UnexpectedTokenError class Type(object): def __init__(self, typename, supertypes=None): self.name = typename if supertypes is None: supertypes = [objectType] self.supertypes =...