index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
989,200
718ebbb65dbfb909339adda8a9a1ff1750433113
import datetime from distutils.version import StrictVersion import hashlib import os import random import re import seesaw from seesaw.config import NumberConfigValue, realize from seesaw.externalprocess import WgetDownload from seesaw.item import ItemInterpolation, ItemValue from seesaw.pipeline import Pipeline from s...
989,201
d6c0788962b84adb461ccd11ea720f7e8962ed04
#Diseñar un algoritmo tal que dados como datos dos variables de tipo entero, obtenga el resultado de la siguiente función: class Ejercicio9: def _init_ (self): pass def variables (self): NUME= int(input("Primer variable:")) VA= int(input("Segunda variable ")) NUME+VA ...
989,202
15bc64f3d44c2544aa94e70321600b351b2bd7d4
from flask import render_template from website import app @app.errorhandler(403) def not_authorized(path): return render_template('status/403.html'), 403 @app.errorhandler(404) def page_not_found(path): return render_template('status/404.html'), 404 @app.errorhandler(410) def resource_gone(path): retu...
989,203
7c36bf5ac7d2aba5c4959d9c91d90fc01dcd7270
import unittest from . import main class TestLongestCommonSubstring(unittest.TestCase): def test_sample1(self): s1 = "AACCTTGG" s2 = "ACACTGTGA" actual = main.find_longest_common_subsequence(s1, s2) expected = ["AACTGG", "AACTTG"] self.assertIn(actual, expected) if __na...
989,204
32dbd28dd03fa8395577f14650123d3f279dcd17
# -*- coding:utf-8 -*- from const.const import Const,LogConst from fluctuation_invest import FluctuationInvest from naive_invest import NaiveInvest from log.logger import Logger class InvestManager(object): def __init__(self): self.invests = { Const.NAIVE_INVEST:NaiveInvest(), Const.FLUCTUATION_INVEST:Fluctu...
989,205
bebc557b8a83fbe094d9058b01016dfb5b069775
# -*- coding: utf-8 -*- import tornado.web from models import MGMessage class IndexHandler(tornado.web.RequestHandler): def get(self): messages = MGMessage().getMessages() self.render('index.html', TITLE='留言板', messages=messages) def post(self): name = self.get_argument('name') ...
989,206
a3c37052694fc33a0bd29ed01bcd67be4d36bb1b
from django.apps import AppConfig class ReadyConfig(AppConfig): name = 'ready'
989,207
a2a5b9665624557c7b9d76400392df573435e385
# -*- coding: utf-8 -*- """ Created on Thu Apr 11 16:49:09 2019 @author: HP """ # -*- coding: utf-8 -*- """ Created on Fri Apr 5 17:49:46 2019 @author: HP """ # -*- coding: utf-8 -*- """ Created on Sat Mar 23 17:00:45 2019 @author: HP """ # -*- coding: utf-8 -*- """ Created on Wed Mar 13 14:27...
989,208
7f096fb19c75bc5cffd27c6ba013f2033b15e9c2
# -*- coding: utf-8 -*- """ Created on Mon Aug 24 17:28:22 2015 @author: A30123 """ #import time #from datetime import date, time, timedelta #p=time.strptime("2015-08-24 17:26:48","%Y-%m-%d %H:%M:%S") #d= timedelta(days=2.5) #d2=time.strptime("2.5","%d") #p="2015-08-24 17:26:48" #d # #time_limit="03:00:00" #time_limi...
989,209
ba374ba15335bcdcd323dd18d254719990548532
#!/usr/bin/env python3 # -*- coding:utf-8 -*- """ @description: 根据省份分割列表/Segmentation by province @file_name: segmentation_by_province.py @project: my_love @version: 1.0 @date: 2019/05/16 22:35 @author: air """ __author__ = 'air' import pandas as pd def segmentation_by_province(province_list): """ 根据省份分割列表...
989,210
04e792e4f04dc38ba834d672c8b4d62498072a95
# email_outbound/functions.py # Brought to you by We Vote. Be good. # -*- coding: UTF-8 -*- from .models import FRIEND_ACCEPTED_INVITATION_TEMPLATE, FRIEND_INVITATION_TEMPLATE, LINK_TO_SIGN_IN_TEMPLATE, \ VERIFY_EMAIL_ADDRESS_TEMPLATE from django.template.loader import get_template from django.template import Cont...
989,211
cd9da8bc5ef59f80282a08ba15b0c6950feb52d6
from sklearn.linear_model import LinearRegression import matplotlib.pyplot as plt import numpy as np import pandas as pd def get_gradient_at_b(x, y, b, m): N = len(x) diff = 0 for i in range(N): x_val = x[i] y_val = y[i] diff += (y_val - ((m * x_val) + b)) b_gradient = -(2 / N) ...
989,212
427c7917c8379e7a968904ec68fa5e6d99c04baf
class Solution(object): def permute(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ result = [] def isSolution(nums, n): if len(nums) == n: return True else: return False def constru...
989,213
3a0ab9b6e5b1c7d19746aa0c2e476af1aa400bc7
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from urllib2 import urlopen print urlopen(sys.argv[1],open(sys.argv[2]).read()).read()
989,214
157111e31a14bfd41be3878500430b610d1ff6a1
from spacy.matcher import PhraseMatcher, DependencyMatcher def dependencymatch(term, nlp): matcher = DependencyMatcher(nlp.vocab) matcher.add("dependency", [term]) return matcher
989,215
e6a8a6dd69fd758728ebdccfbdbe383140dcd013
import pdb import calcROI from matplotlib import pyplot from matplotlib import cm #Function to detect the heart region in all the given images def detect_heart_region(images): #(num_slices, num_times, width,height) = images.shape rois,circles = calcROI.calc_rois(images) return rois,circles;
989,216
0cb8a3376aed5c8876b6298223a918c92b6ff054
#!/usr/bin/python # -*- coding: utf-8 -*- import zenodorequest from zenodorequest import * from bottle import route, run, request, response """ enable cross domain ajax requests when using json of another domain""" def enable_cors(fn): def _enable_cors(*args, **kwargs): # set CORS headers response...
989,217
b43465f521b01e663f3bf425310fdd9dd4e8bbe3
import requests import os import json import unittest import stableconfigs import time class APITest(unittest.TestCase): URL = 'http://localhost:5005/' START = URL + 'task' GETSTATUS = URL + 'status/' TERMINATE = URL + 'terminate/' def test_basic_local_server(self): monomer_input...
989,218
0a0c6c4bf139a100f1a50389ad91c8791b526053
'''el resultado es un documento en sql que sube UNA LINEA de info a la db etapas: 1) nombre del pkmn en tabla pokemon 2) asociacion del pkmn con sus tipos en pkmn_tipos 2.1) agrega un tipo 2.2) pregunta si tiene segundo tipo 2.2.1) agrega segundo tipo 3) imprime el documento la información debe agregarse a la lista da...
989,219
5f9ad2a0df91ad0f58a2e5c90a081b32251ab1b5
from django.contrib import admin from django.urls import path, include from rest_framework.routers import SimpleRouter from . import views router = SimpleRouter() router.register('banner', views.BannerView, 'banner') urlpatterns = [ # path('', include(router.urls)), ] urlpatterns += router.urls
989,220
8eb978b5b68e279f2ee26a727fdddab376b29328
# you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def emailCompare(s1,s2): if(s1 == ' ' or s2 == ' '): return False if(s1 == s2): return True #check if domains are equal email1 = s1.split('@') email2 = s2.split('@') if(email1[1] == ema...
989,221
0b9e2660e2cb7054279f75452ce9174b4bee75f6
# -*- coding: utf-8 -*- # Generated by Django 1.11.12 on 2018-07-04 16:05 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('responsitory', '0011_auto_20180704_0124'), ] operations = [ migrations.RenameField...
989,222
cf4f938939a1c7dd06f1f4bd7a4841941eef0da4
import torch import torchsl from torchsl._extensions import _has_ops from ._helpers import * __all__ = ['pclda'] # =========================================================== # Pairwise-Covariance Linear Discriminant Analysis # =========================================================== def pclda(X, y, y_unique=Non...
989,223
86e2f5c46a7de76df2bf67e2fc7ba76b8c77b31d
from enum import Enum class PersonType(Enum): S = "Student" T = "Teacher"
989,224
0cf4107cb5e78aad059f017b254d29a3a5a2532a
from typing import Dict class BaseException(Exception): title: str status_code: int def __init__(self, message: str = '', status_code: int = 400, payload: Dict[str, str] = {}, title: str = ''): Exception.__init__(self) self.message = message if status_code is not None: ...
989,225
a88713cace5e399ea2f0fc24edf3be96f45f8d66
from typing import List, Dict import os import tempfile import logging from functools import lru_cache import datetime import pytz import numpy as np from jinja2 import Template import pandas as pd from epanet import epamodule from typing import Union import constants import math import tensorflow as tf import matplot...
989,226
65aa596ad6b7b475018db4171d784dbaca6dfe0d
from django.contrib import admin # registrando as classes no admin from .models import Produto, Cliente # criando uma classes para listar as informações na administração do django. class ProdutoAdmin(admin.ModelAdmin): list_display = ('nome', 'preco', 'estoque') class ClienteAdmin(admin.ModelAdmin): list_d...
989,227
d5ba846567465b6a0ef64a3f780166216c4e33aa
""" Copyright (c) 2020 COTOBA DESIGN, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distri...
989,228
45e04911a777459c4128832535fe4f80855211ef
from qiskit.wrapper import load_qasm_string from qiskit.dagcircuit import DAGCircuit from qiskit.transpiler import PassManager, transpile from qiskit.transpiler._basepasses import TransformationPass class BugPass(TransformationPass) : def run(self, dag): print("Activating") return DAGCircuit()...
989,229
9447e8e698c1dfce076fb0052217a7d0cf49d558
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 22:39:24) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license()" for more information. >>> # Aprendizaje automático 01 importar numpy como np # Creando un arreglo print ( 'Dígito número de elementos:' ) n = int ( entra...
989,230
73e1b578a88297f6d81fc4f2702773aa276509b0
from setuptools import setup setup( name='gmusic-alarm', version='0.0.1', description='Alarm clock using Google Play Music radio stations', url='https://github.com/cmurphy/gmusic-alarm', author='Colleen Murphy', author_email='colleen@gazlene.net', license='Apache-2.0', packages=['gmusic...
989,231
c69661a65ee2f45956036825d264c798e9af1086
class Solution: def subsets(self, nums: List[int]) -> List[List[int]]: # New Solution 1: Backtracking (40ms: 53.60%) # Can be improved by not using length (32ms: 87.28%) res = [] def backtracking(sub_res, index): res.append(sub_res) for i in range(index, len(n...
989,232
cf1babe542a09e7d2dde1a0141be3ffec36e49d4
import numpy as np from exceptions import ValueError import random import libfunctions class RbfNetwork(object): def __init__(self, input_size, output_size, sigma): self.input_size = input_size self.output_size = output_size self.sigma = sigma self.kernels = None se...
989,233
69a79456c8f552b624f84a0582b03a8eaabfb8d3
#!/usr/bin/env python # encoding: utf-8 #coding=utf-8 ''' http://localhost:12345/params?content=12\tabc http://localhost:12345/params?content=2\t3 ''' from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler from SocketServer import ThreadingMixIn import sys import urllib #from sklearn.externals impor...
989,234
292e8de0a651a93bd5be72101762f019ef9db95c
with open('staff.txt', 'r') as data: print('Сотрудники с окладом менее 20 тыс. руб.: ') for i, line in enumerate(data): staff = line.split(' ') if int(staff[1]) < 20000: print(staff[0]) count = 0 with open('staff.txt', 'r') as data: count = len(data.readlines()) with ope...
989,235
730b1f92c2dcac24ab6a0c2c77303e2cbb633ada
''' URL = https://leetcode.com/problems/sort-transformed-array/description/ 360. Sort Transformed Array 45 mins to solution Complexity Let N := len(nums) Time = O(N) Space = O(N) ( EXP ) O(1) ( IMP ) Edge Cases (A) [1,2,3,4,5] 1 2 3 (B) [-5,-4,-3,-2,1] 1 2 3 (C) [1,2,3,4,5] -1 -2 -3 (D) [-5,-4,-3,-2,-1] -1 -2 -3 (...
989,236
dd98e43d1aee0d9c5252e16a036a4180b6c27f38
""" 参考 https://deepblue-ts.co.jp/python/pypi-oss-package/ """ import setuptools from os import path version = '1.4' package_name = "scraping_toolkit" root_dir = path.abspath(path.dirname(__file__)) def _requirements(): return [name.rstrip() for name in open(path.join(root_dir, 'requirements.txt')).readlines()] ...
989,237
6523cb9ed496d56e993b486574d6cec406eda3c2
import mock import pytest from api.base.settings.defaults import API_BASE from osf_tests.factories import AuthUserFactory @pytest.mark.django_db class TestThrottling: @pytest.fixture() def user(self): return AuthUserFactory() @pytest.fixture() def url(self): return '/{}test/throttle...
989,238
5725a346ff6c0a1dd01293510c3d1f9d5318c826
# coding=utf-8 from selenium import webdriver import unittest from time import sleep import os import sys import signal class TestLogin(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.base_url = "http://10.110.1.55:8082/admin/home.html" #目前这个网址http:...
989,239
e84c0bb9ed7acc0cbbef95f0e3f8ec08cb523ad3
import matplotlib.pyplot as plt import numpy as np ''' 就是简单的把x y 对应的关系plot出来''' x = np.linspace(-1,1,50) y = 2*x +1 plt.plot(x,y) plt.show()
989,240
f33ef9434f760d7ab113b9b916a1df406e7d06c6
from scipy.stats import norm import random import os import numpy as np import sys sys.path.append('../timeseries') from timeseries import TimeSeries from arraytimeseries import ArrayTimeSeries from sizedcontainertimeseriesinterface import SizedContainerTimeSeriesInterface sys.path.append('../cs207rbtree') import redbl...
989,241
e1aea8b2fae7b447c5bf2c7dc8d6944355817412
#!/usr/bin/python3 #import文 import RPi.GPIO as GPIO from time import sleep import time,os,pickle #ポート設定 GPIO.setmode(GPIO.BCM) GPIO.setup(25, GPIO.OUT) GPIO.setup(24, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) #初期化数据 os.chdir('/home/pi/Documents/Degu/Data') trail = 0 time0 = time.time() #始まりの時間 time1 = time.t...
989,242
5bd35c9d71e4dd61a8221b80567cc861c2d88693
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage from django.shortcuts import render, redirect from django_redis import get_redis_connection from shop.models import Shop_SKU, Shop_sort, Lunbo, Active, Active_zone def shop_index(request): # 商城主页 # 查询轮播图 luns = Lunbo.objects.filter(isD...
989,243
cf7f79b99f98217a6e5158db078843471a2409d5
""" @project PalavrasHttpEndpoint @since 02/08/2017 @author Alencar Rodrigo Hentges <alencarhentges@gmail.com> """ import json from flask import Flask from flask import request from utils.FraseUtil import FraseUtil from utils import StringUtil app = Flask(__name__) @app.route('/palavras/analisar/', methods=['GET']...
989,244
4f919e2eba7b5123e07b53a3ab7f7cd75418ccf8
import errno #This class takes care of files needed in discordbot class Files(): def __init__(self, filename): self.filename = filename #Read a file line by line and store it to list & return def readFile(self): try: s = open(self.filename, "rt") questions = s.readlines() s.close() e...
989,245
e99fd102efb4cf06f571cf7ace677bb46a600cbc
# Problem Title: Zigzag Iterator class ZigzagIterator(object): def __init__(self, v1, v2): """ Initialize your data structure here. :type v1: List[int] :type v2: List[int] """ self.v1 = v1 self.v2 = v2 self.p1 = 0 self.p2 = 0 self.n1 =...
989,246
9332c1b58d50e2e54ba020389bde2b24d0489b65
from django.conf import settings from django.contrib.auth.models import User from django.test import TestCase from django.urls import reverse from hx_lti_assignment.models import Assignment, AssignmentTargets from hx_lti_initializer.models import LTICourse, LTIProfile, LTIResourceLinkConfig from lti import ToolConsumer...
989,247
14cd4d108d0905eb2858439f34654ceb9995d0f4
import math import threading import matplotlib.pyplot as plt class plots: def __init__(self): self.__plots = [] self.__plot_ind = 0 self.__nplots = 0 self.minExp = -16 self.__minY = math.pow(10,self.minExp) self.__automaticXScale = True self.__aut...
989,248
407ce24c4ec741c4a470ebbeccd7a3358e6c8f61
# 问题1: 最长回文子串 def maxLen(s,i,j): while i>=0 and j<len(s) and s[i]==s[j]: i-=1 j+=1 return j-i-1 def longestHuiwenSubStr1(s): maxL=1 for i in range(len(s)): maxL=max(maxL,maxLen(s,i,i),maxLen(s,i,i+1)) return maxL def longestHuiwenSubstr2(s): N=len(s) if N==0: ...
989,249
033f854e5965879d6ad1fa138ce973e5c2c4b71d
# SimpleCOMServer.py class PythonUtilities: _public_methods_ = ['SplitString'] _reg_progid_ = "PythonDemos.Utilities" # NEVER copy the following ID # Use print pythoncom.CreateGuid() to create a new one _reg_clsid_ = "{1DCE0ACF-7F78-4280-A87C-E3182AE57BBF}" # implementation def SplitStrin...
989,250
c40b0eff02ba6bab1f3790bd7775e2b3155f03cc
from selenium import webdriver from selenium.webdriver.common.keys import Keys import oculow driver = webdriver.Chrome() # Capture apptim website driver.get("http://www.google.com") assert "Google" in driver.title oculow.capture_screen(driver) # Capture lince website driver.get("http://www.project-lince.com") assert ...
989,251
8fa1941e0029a471670e18454e2447b5ec17ad02
import logging from copy import deepcopy from typing import Any, Dict, List, Optional, Union from tqdm import tqdm from haystack.errors import HaystackError from haystack.schema import Document, Answer from haystack.nodes.translator.base import BaseTranslator from haystack.lazy_imports import LazyImport logger = lo...
989,252
7348df1499fd12f08fd8bf4a3c0c4c35e894d5f2
#!/usr/bin/env python # encoding: utf-8 ''' @author: xuqiang @license: (C) Copyright 2013-2022. @contact: xq-310@163.com @software: wallet @file: views.py.py @time: 2019/7/14 下午6:23 @desc: ''' from flask import Blueprint,request from rpc.eth_rpc_client import EthRpcClient from db.eth_db import EthDb from decimal import...
989,253
bcaec29ac60cec404e2897c8316f43d1425799cb
import sys sys.path.insert(0, ".") import atomium pdb = atomium.open("tests/time/{}.{}") #pdb.save("tests/time/temp.pdb")
989,254
0bac01a70bddefd0e15f4a3275ec66b7879e9492
# Copyright 2019 NOKIA - 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 required by applicable la...
989,255
3fafc7a1b9e7915b0eac43582b0193ff54bdee5f
from __future__ import unicode_literals from django.db import models class Diputado(models.Model): nombre = models.CharField(max_length=100) ciudad = models.CharField(max_length=50) pais= models.CharField(max_length=50) email = models.EmailField(max_length=50) fechaNacimiento= models.DateField() foto = models....
989,256
0d2e61a19c70f7958706b7353a5d654152f7b40c
import gym from DQN import DQN PATH_SAVE = "cartpole" env = gym.make('CartPole-v0').unwrapped dqn_train = DQN(env=env, env_type="Gym", nb_action = 2, skip_frame=1) dqn_train.train_loop()
989,257
53514ba7dbecdf995e8134fec2ed6aaf49493f20
import fruits def boy(no_of_seeds): if no_of_seeds == 1: print(fruits.one_seed_fruit()) elif no_of_seeds == 0: print(fruits.seedless_fruit()) boy(1)
989,258
4dc56faa55095fde0a67a2b1441a9688ec6c2782
# CS266: Fall 2019 # HW1 # # Pratik Prajapati # Ashraf Saber # import MerkleTree as mtree import Block as blk # a test script to check various functions of the Block() class. # txList = ['alice', 'carol', 'duck', 'bob'] txList.sort() m = mtree.MerkleTree(txList) m.generateTree() # just any random hash to test prevH...
989,259
8f56191e398890b4aa71158920136557a6266d93
# Generated by Django 3.0.8 on 2021-04-21 18:02 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('miweb', '0016_datosscrapy_url'), ] operations = [ migrations.RemoveField( model_name='datosscrapy', name='url', ), ...
989,260
56f92268cf45235ceff3271c78a2d31327ed4a4b
class FontWeightEnum(object): Light = .4 Normal = .6 Bold = .9 class OutlineLenghtEnum(object): NoOutline = 0 Little = 0.125 Medium = 0.25 Big = 0.5
989,261
0b000a4e2172e40d19c80788d8db88efedb78cb1
#imiport minimize and the circuit eigenfinder from Diag_trans import trans from scipy.optimize import minimize import numpy as np import matplotlib.pyplot as plt #this function creates a loss function and calculates its value for given circuit parameters that are used to calc energies def loss(x): #x is Ec, Ej as an...
989,262
ef963248dd8cc13f4ddbd152aaa98a701988a1da
#!/usr/bin/env python # This is a command line program to download a user's avatar from # GitHub. Usage: 'python get_avatar.py <GitHub_username> import sys import json import argparse import requests import shutil # Parse command line arguments parser = argparse.ArgumentParser() parser.add_argument('username') args...
989,263
bde8ac94db66afbb5907285d752fbf82108530e4
# code_logzero.py from logzero import logger, logfile, setup_logger import logging import config_logzero as log import modulo_interno # Log messages log.config_log().info("This log message saved in the log file") log.config_log().warning("This log message saved in the log file") modulo_interno.funcion_en_modulo_inte...
989,264
b18ec9813adc21d2e98618cbf3ed232f72d05df9
# 定义一个0~1000之间的随机整数n为答案,提示用户输入一个整数k参与游戏猜答案 # 如果k != n,提示:猜错了,并要求重新输入 # 如果k == n,提示:经过x次猜测,恭喜回答正确,答案是n import random as r n = r.randint(0, 1000) # 正确答案 k = -1 # 猜测的答案 x = 0 # 猜测的次数 # 如果回答错误,就提示再次输入答案 while k != n: if x: # 已经至少猜测过1次 print('猜大了' if k > n else '猜小了') # print('猜大了'...
989,265
c67dd4dab3e7b1d19a6543da0df8309636cf0581
from rankor import app def uwsgi(settings): app.start('pyramid') return app.make_wsgi_object() def tests(settings): app.start('tests')
989,266
dcb86be0a53616ead7f05bf67a67b54f6969b819
# Import the Degree Programs I saved from the ATA Outcomes file into Django """ In this long comment I'm going to go ahead and put down a few notes on the .csv we're reading from. The first thing to understand is that this CSV was exported from an excel spreadsheet that was meant to be looked at, not fed into a com...
989,267
78ea8a7ec69051d3614e758ff2a0a245bf6b085a
import sys import seaborn as sns import pandas as pd import numpy as np import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt args = sys.argv with open(args[1], "r") as f: lines = f.read().splitlines() firstLine = lines[0].split(" ") maxLevel = int(firstLine[0]) N = int...
989,268
fd38433524cc67240996c93ec121fff66296ec5d
from os import walk import subprocess import string import sys source_dir = str(sys.arg1) print source_dir f = [] for (dirpath, dirnames, filenames) in walk("/home/kreid/music"): #TODO: Generalize this PS1 f.extend(dirnames) #get the names of the music folders break f = sorted(f, key=str.lower) tarball = ...
989,269
50dda3e5e861e8fce1ed24fa0e7444bd832b260e
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Feb 17 12:15:53 2019 @author: TEB """ import numpy as np import matplotlib.pyplot as plt from nengo.processes import Piecewise from World import Time class Stimulus(Time): def __init__(self, temperature, time_instance = 0): s...
989,270
0ba2f25d2e4b2b6dbf34b5e176b66173592a729a
from django.shortcuts import render from produce.models import ProduceType,ProgrameType,ProduceTypeTwo # Create your views here. def get_type_navigation(): produce_type = ProduceType.objects.all() return produce_type def get_type_navigation_two(): produce_type_two = ProduceTypeTwo.objects.all() return...
989,271
075ad320f728d30925f42884f09c630699fce5dc
import tornado.web import tornado.escape import pymongo from gmail import GMailPy from ATLiteExceptions import * class EMailer(tornado.web.RequestHandler): def initialize(self): #self.connection = pymongo.connection.Connection() #self.db = self.connection.atlitepy self.client = MongoClient() s...
989,272
36f9f3334fe4ee937c8742b2765c864a6f4c0460
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def __init__(self): self.res = [] def maxDepth(self, root): """ :type root: TreeNode :rtype: int ...
989,273
3c02db350d6e934d3f444f11cb7d4f61b18a78a5
from flask import Flask, render_template, flash, url_for, redirect, request from sqlalchemy_searchable import make_searchable from user import User from extensions import db, mail, login_manager, bcrypt def configure_extensions(app): db.init_app(app) # login_manager.refresh_view = 'user.reauth' login_mana...
989,274
7d42d8dc0ac24c689fb274efe6989a3443770d57
# Author: Alexander Bokovoy <abokovoy@redhat.com> # Tomas Babej <tbabej@redhat.com> # # Copyright (C) 2014 Red Hat # see file 'COPYING' for use and warranty information # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published ...
989,275
81be200ff9ecbdddd911170bf6f7809bf1b7924d
import turtle as trt import math as mp trt.shape( 'turtle') trt.speed( 10) trt.penup() trt.goto(-300, 0) trt.pendown() SIDE = 30 DIAG = SIDE * mp.sqrt(2) SPACE = 20 def middle_side(q): trt.penup() if q == 1: trt.pendown() trt.forward( SIDE) trt.right( 13...
989,276
440732ac37fe3b16c5facd64bad272839ed792a8
import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib import style style.use('fivethirtyeight') filename = 'emperors.csv' # strfile = unicode(str(filename), errors='replace') df = pd.read_csv('../emperors.csv', index_col=0, encoding='latin-1') # ***** I'm thinking we need Python run...
989,277
62b991ba0e1a44347b71fd0925fa83618a6cb51e
# -*- coding: utf-8 -*- ''' Created on 2017-12-21 10:13 --------- @summary: --------- @author: Boris ''' import base.base_parser as base_parser import utils.tools as tools from utils.log import log SITE_ID = 1712200003 NAME = '爱奇艺' # 必须定义 添加网站信息 @tools.run_safe_model(__name__) def add_site_info(): log.debug('添加...
989,278
db13b75756209d26d09ddb6f4169f846fa56e827
#!/usr/bin/env python3 """problem_108.py Problem 108: Diophantine reciprocals I In the following equation x, y, and n are positive integers. 1/x + 1/y = 1/n For n = 4 there are exactly three distinct solutions: 1/5 + 1/20 = 1/4 1/6 + 1/12 = 1/4 1/8 + 1/8 = 1/4 What is the least value of n for whi...
989,279
549689adbf669f40e58d4fae22a2583283985def
async def test_non_existing_container(container_requester): async with container_requester as requester: response, status = await requester('GET', '/db/non') assert status == 404 async def test_non_existing_registry(container_requester): async with container_requester as requester: r...
989,280
b2c9e387163d2b84ead032af253c9d3e5213d62e
# -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-08-08 21:26 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('people', '0010_auto_20160808_2114'), ] operations = [ migrations.RemoveField...
989,281
e1c22307a8e5a870c11388c12003ea745386bd9b
""" Overview =============================================================================== +----------+------------------------------------------------------------------+ | Path | PyPoE/poe/file/specification/errors.py | +----------+------------------------------------------------------...
989,282
86a2597f9fbfbfbe7d7b5ddd5bd5f6c5d72652ca
#!/bin/python import sys n = int(raw_input().strip()) a = map(int,raw_input().strip().split(' ')) numOfSwaps = 0 for i in range(len(a)-1, 0, -1): for j in range(i): if (a[j] > a[j+1]): temp = a[j] a[j] = a[j+1] a[j+1] = temp numOfSwaps += 1 print a print...
989,283
5f5524c28dd7c59876bdba3401c79cb7f0318008
from collections import defaultdict v = defaultdict(list) mod = 10**9+7 N, K = map(int, input().split()) for _ in range(N-1): a, b = map(int, input().split()) v[a].append(b) v[b].append(a) visited = [False]*(N+1) ans = 1 q = [(1, 0, 0)] while q: pos, parent, score = q.pop() visited[pos] = True ...
989,284
6f27bf84d9392070f91384b5d081dcabc8935850
from utils import session, expose, render_template, Response, url_for from models import Category, SubCategory, Scenario from models import User, AppFamilyPermission, AppPermission from authenticate_user import authenticateuser from authenticate_user import verifyloggedin from authenticate_user import authorizeuseronca...
989,285
cc6b2969cd37693e110f5d715801f0708c923fcd
from Salarie import * class directeurF(salarie): def __init__(self, nom, prenom, echelonSal, id, anneeNomination): salarie.__init__(self, nom, prenom, echelonSal, id) self.__anneeNomination = anneeNomination def afficher(self): print("* [id = ",self._id,"] Nom et Prenom : ",self._nom,...
989,286
8886efaabe72b1cd97e08d06e31a5661bb43d244
import time start = time.time() string = str(2**1000) result = 0 for i in string: i = int(i) result += i eslaped = time.time() - start print (result,eslaped)
989,287
72de4e096e78cccc161b16e7c5531fa4d6b51560
import cv2 import numpy as np class PointCloud: def __init__(self): self.points3D = {}
989,288
5f1b99ed5a3de1862542dcd314fa061cd90764e3
import sys, time import numpy as np from cassandra.query import named_tuple_factory, BatchStatement, SimpleStatement from cassandra.cluster import Cluster, ExecutionProfile, EXEC_PROFILE_DEFAULT from cassandra.policies import RetryPolicy, WhiteListRoundRobinPolicy from cassandra import ConsistencyLevel from numpy.cor...
989,289
c74bc3db9a8e7c7bbcf8aa841bcdaca20777ddf3
# -*- coding: utf-8 -*- ''' (Compute the volume of a cylinder) Write a program that reads in the radius and length of a cylinder and computes the area and volume using the following formulas: area = radius * radius * π volume = area * length Here is a sample run: Enter the radius and length of a cylinder: ...
989,290
bd7f92f1c5cdcb36874e051c061d2be04c10b214
# -*- coding: utf-8 -*- import sys from hw1_ui import Ui_MainWindow import cv2 from PyQt5.QtWidgets import QMainWindow, QApplication import time class MainWindow(QMainWindow, Ui_MainWindow): def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.setupUi(self) ...
989,291
eb15d09d7f2e8aaf1e98a7073a02bc8295fa772c
#!/usr/bin/python import datetime def getSpeed(data, recency): if data == {} : return "N/A" filtered = dict((key,value) for key, value in data.iteritems() if key > datetime.datetime.now() - datetime.timedelta(seconds=recency)) if filtered == {} : return "N/A" data_points = filtered.values() return re...
989,292
941419981603a1ee618374e48e763e588928c2df
# coding: utf-8 from __future__ import unicode_literals, absolute_import from django.contrib import admin from .models import Author, Publisher, Book admin.site.register([Author, Publisher, Book])
989,293
8d23dae7f56a8215cfaa6beedc06fdcb9708ed04
# Normalising data to same size to improve accuracy of machine learning model from PIL import Image import os url_path = "/Users/josh/Hackathons/ru_hacking/downloads/Not hotdog/" for filename in os.listdir(url_path): route = url_path+filename if os.path.isfile(route): try: im = Image.open(...
989,294
98136601d7efa49734324b5648050b305b28bd2a
from tbselenium.tbdriver import TorBrowserDriver from tbselenium.utils import start_xvfb,stop_xvfb import subprocess,os from tbselenium.utils import launch_tbb_tor_with_stem import Config as cm from utils import ReadWebList, getTime, get_tor_circuits, SetOutputPath, writeLog, RemoveTmpFile, getGuard, writeStreamInfo fr...
989,295
301108fa03bed433f00927c9836ef61d3126b42f
from xai.brain.wordbase.nouns._bush import _BUSH #calss header class _BUSHES(_BUSH, ): def __init__(self,): _BUSH.__init__(self) self.name = "BUSHES" self.specie = 'nouns' self.basic = "bush" self.jsondata = {}
989,296
76ad02b6b99dcd8534d1eb9ba14603907fc46fe4
# pylint: disable=no-self-use,invalid-name import pytest import pathlib from allennlp.common import Params from allennlp.common.util import ensure_list from csqa.data.dataset_readers import QEReader class TestQEReader: FIXTURES_ROOT = (pathlib.Path(__file__).parent / ".." / ".." / ".." / "te...
989,297
998b222da79249c23e7ef7efeeb2f25147578a2c
# #!/usr/bin/env python from netmiko import Netmiko from credentials import password1, username1 cisco1 = { "host": "10.223.252.122", "username": username1, "password": password1, "device_type": "cisco_ios", } cisco2 = { "host": "10.223.148.202", "username": username1, "password": passwo...
989,298
4e89ca060c5ef884a9abd54524b1f79fd5e2a9ae
if __name__ == "__main__": import django import os import sys import inspect from pathlib import PurePath root = PurePath(os.path.abspath(inspect.getfile(inspect.currentframe()))).parent.parent sys.path.append(str(root)) os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'distantworlds2.se...
989,299
6d3bc56131591a99a3773aede65781918fc62917
# 帮帮Stish # Description # # Satish wants to prepare for tommorow's exam . He knows the distribution of marks for the subject along with time to learn the concepts.You are given remaining time for the exam along with marks for each topic and passing marks for the subject.Find the max marks Satish can attain by studing m...