index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
995,300 | 6fc8bc5d635cf488eb969a753bb0c73d17d1ea61 | from setuptools import find_packages, setup
setup(
name='petshop',
version='1.0',
packages=find_packages(),
include_package_data=True,
install_requires=[
'flask',
'sqlalchemy',
'Flask-SQLAlchemy',
'mysqlclient',
'faker',
'APScheduler',
'reques... |
995,301 | cb6b97b6e74c27374439f0db04a5b36bf929b1a2 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'damonhao'
from tornado import ioloop, gen
from net import TcpClient, NetAddress
from common import RpcBase
from stub import stub_factory
class RpcClient(RpcBase):
def __init__(self, io_loop, netAddress):
super(RpcClient, self).__init__()
self._client... |
995,302 | ea67ee0a313bcce444ee227e7cf3e129ba3eb1c8 | import pickle
import os
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--dev', action='store_true', help='Use dev')
parser.add_argument('--train', action='store_true', help='Use train')
parser.add_argument('--n_sample', type=int, default=-1, help='N_h')
parser.add_argument('--syn', action='stor... |
995,303 | 3c59d5428cdbecc4cc102df75b2cb68fce27256a | #coding:utf-8
from common import Hash
import time,requests
from locust import HttpLocust,TaskSet,task
from locust.contrib.fasthttp import FastHttpLocust
from common import login_lanting
#澜渟APP直播接口压测
#定义用户行为
class User(TaskSet):
#下面是请求头header
header = {
'User-Agent': 'LanTingDoctor/2.0.2 (iPad; iOS 10... |
995,304 | 1121e1bc3feb2cd7f9adb4c602f3297688a48199 | # -*- coding: utf-8 -*-
# @Time: 2020/12/09 14:46
# @Author: 李运辰
# @Software: PyCharm
# 导入requests包
import requests
from lxml import etree
# 网页链接
url = "https://jobs.51job.com/pachongkaifa/p1/"
# 请求头
headers = {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q... |
995,305 | e865e497a3c8a80c83f57a3ff7de5ced197ad7b6 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... |
995,306 | 18750c38493a619fb28ea52ef6b1ce2cfb9a502b | from django.contrib import admin
from django.urls import path
from .views import home_page, about_us
urlpatterns = [
path('admin/', admin.site.urls),
path('', home_page),
path('about-us', about_us)
]
|
995,307 | b47ac6d82321e05e9f6dc6c1e1b81454690d1030 | import glob
import os
import sys
#input_dir = sys.argv[1]
def convert_folder(input_dir):
for filename in glob.glob(input_dir + '/*.bam'):
print filename
out_name = os.path.dirname(os.path.dirname(input_dir)) + '/'
out_name += 'beds/'
out_name += os.path.basename(filename).partitio... |
995,308 | 6e5b49ea30cf41c3aa537a1d658800e0fdd64a43 | # Django
from django import forms
# Local
from .models import Device
class DeviceForm(forms.ModelForm):
class Meta:
model = Device
exclude = ['timestamp']
|
995,309 | 4549a54739576e5909e667a111ec2302a037f97f | import pdb
import streamlit as st
import streamlit.components.v1 as components
import pandas as pd
import numpy as np
import seaborn as sns
import Statistics as stats
import base64
from pandas_profiling import ProfileReport
import os
from streamlit_pandas_profiling import st_profile_report
def run(st,data)... |
995,310 | a547e8d781241ffc6be9a142be5b43bba2d03daf | from django.apps import AppConfig
class PixelMappingConfig(AppConfig):
name = 'pixel_mapping'
|
995,311 | 1ddca0197a9c39726e834c6692088ee4df7e7ffe | #Import Libraries
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.optimizers import SGD,RMSprop,adam
from keras.utils import np_utils
from keras.models import model_from_json
import numpy ... |
995,312 | 6b223814d0b5f6635d439cd4cce2397e4b53eca5 | # -*- coding: utf_8 -*-
# fibonacci.py: muestra los numeros de fibonacci hasta n
fib1 = 0
fib2 = 1
temp = 0
n = int(raw_input("Ingrese un numero natural: "))
print ("Serie de Fibonacci hasta " + str(n) + ": ")
if n >= 0:
print (fib1)
if n >= 1:
print(fib2)
for x in range(2, n+1):
temp = fib2 + fib1
... |
995,313 | f081d3b60efb9cf4e8ca8380b7d199ec43835121 | import os
import sys
import math
divisors = []
def isInt(x):
try:
int(x)
return True
except ValueError:
return False
def isPrime(x, f=2):
if x == 2 or x == 3:
return True
elif x < 2:
return False
elif x > 2:
while f <= math.ceil(math.sqrt(x)):
... |
995,314 | f91b6f7fa55d479b6b0c9da50cde9750d7aa861b | from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.core.urlresolvers import reverse
from django.views import generic
from django.contrib.auth.decorators import login_required
from django.forms.formsets import formset_factory
from django... |
995,315 | 4f333d686e9bcef7977515fe0de9efeb3b7cd64e | '''
try / except
When the first conversion fails - it
just drops into the except: clause
and the program continues
When the second conversion
succeeds - it just skips the except:
clause and the program continues
astr = 'Hello Bob'
try:
istr = int(astr)
except:
istr = -1
print 'First', istr
astr = '123'
try:
istr =... |
995,316 | 8e419fbd8899c7e942cc19df92d5eb3634354efc | from clase import Auto
mustang = Auto('MUSTANG','ROJO','5.5')
mustang.arranca()
mustang.frena()
mustang.set_color("AZUL")
mustang.get_color()
jetta = Auto('JETTA','BLANCO','2.5')
jetta.arranca()
jetta.frena()
jetta.get_color()
|
995,317 | ae6b50cd09e7ad54872419233035df1b51ab5599 | """le but est simple il faut faire une liste qui contier le nombre de fruit et déclaré une variable avec le nombre de fruit à retirer """
fruit_a_retirer = 7
liste = [15,3,18,21]
affichage = [nb_fruits-fruit_a_retirer for nb_fruits in liste if nb_fruits>fruit_a_retirer]
print(affichage)
|
995,318 | e0c1a5aee18b97ca93740d710ff479528b3f5403 | """
█▀▄▀█ █▀▀ ▀█▀ █▀▀ █▀█ █▀ ▀█▀ ▄▀█ ▀█▀
█░▀░█ ██▄ ░█░ ██▄ █▄█ ▄█ ░█░ █▀█ ░█░
The code is licensed under the MIT license.
"""
import os
from .mutations import create, update, delete, apply
from .checks import find_duplicate
from .generators import generate_uid
from .utils import create_station_dict, merge_dicts, get_... |
995,319 | ba572dfb72c4ab6a3dc7fff8aba1734ec4ff6ecb | from meow_letters.storage.meowdb import MeowDatabase
database = MeowDatabase()
database.db.execute("""CREATE TABLE highscores (id integer primary key autoincrement,
username text, highscore integer)""")
database.db.close()
|
995,320 | de8b39792532c5442085ce9bedbdc820055882cf | from utils import *
def reverse_list(node:ListNode):
head = curr = node
while curr.next:
temp = curr.next
curr.next = temp.next
temp.next = head
head = temp
return head
if __name__ == "__main__":
n = create_nodes([1, 3, 5, 7, 9])
print("Initial")
print_nodes(... |
995,321 | 18a2b9dec94d0ec0ba8728c09066d85159d55f64 |
class dispatcher:
name = 'dispatcher'
def __init__(self, function_to_exec):
self.function = function_to_exec
return self.function
def get_name(self):
return self.name
def function_one(a,b):
return a + b
def function_two():
return 'function two' |
995,322 | 3af9f8a3713bd0981e688da88c71f53fdfb74fac | '''
select * from member
/* => 주석처리
from 이후에는 내가 생성한 db 테이블 이름 F5를 눌러서 실행하면
테이블에서 생성한 데이터를 보여줌
*/
--데이터 베이스 구축하기
--데이터 정의어(DDL) : 데이터베이스 만들기
create database Test02;
/*
create database <database명>
위의 쿼리문은 데이터 정의어(DDL) 중의 하나인 create문을 이용하는 쿼리입니다.
위의 쿼리문을 실행시키기 위해서 해당 쿼리문을 블록처리하고 F5를 눌러 실행시킵니다.
그리고... |
995,323 | c4690558ec24603b6480566c288e5e2b86473362 | import Tkinter
from PIL import ImageTk, Image
def _exit(event):
print("Exit")
main_window.destroy()
main_window=Tkinter.Tk()
print("yuiop")
w = main_window.winfo_screenwidth()
h = main_window.winfo_screenheight()
main_window.overrideredirect(1)
main_window.geometry("%dx%d+0+0" % (400, 300))
#main_window.bind("<Esca... |
995,324 | a78be66ed07d6512e422dc44f429ac82809526a4 | import os
from os import path
from wordcloud import WordCloud
import matplotlib.pyplot as plt
import nltk
import string
from nltk.tokenize import sent_tokenize, word_tokenize
from nltk.corpus import stopwords
from Sastrawi.Stemmer.StemmerFactory import StemmerFactory
# remove whitespace from text
def remove_whites... |
995,325 | 249bf9afb9a8d464883a4f7d5e9ed63c47e2bbe3 | from django.db import models
# Create your models here.
class News(models.Model):
link = models.CharField(max_length=200)
article = models.CharField(max_length=200)
body = models.TextField()
class Meta:
verbose_name_plural = "news"
def __str__(self):
return self.article |
995,326 | 063ae50696f672c6630a9315a3892d50927fac09 | #!/usr/bin/python3
# coding=UTF-8
from __future__ import unicode_literals
from django.db import models
from django import forms
from django.forms import ModelForm
import django.core.management as manage
#sources
# form
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Save data f... |
995,327 | 2572ef6785a4acbad77cb74dc0e4636b1bdfcd24 | """
Digital root is the recursive sum of all the digits in a number.
Given n, take the sum of the digits of n. If that value has more than one
digit, continue reducing in this way until a single-digit number is produced.
This is only applicable to the natural numbers.
Examples
16 --> 1... |
995,328 | 273c9a1c698c7b681ed276da68580ff44e3da402 | # predict.py
import argparse
import sys
import os
import glob
import numpy as np
import urllib
import cv2
from keras.models import load_model as load_keras_model
from keras.preprocessing.image import img_to_array, load_img
from flask import Flask, jsonify
app = Flask(__name__)
os.environ['TF_CPP_MIN_LOG_LEVEL'] = ... |
995,329 | 32b0ebc7f61f5f21a7203fd70f255b505f94c216 | from sqlalchemy import Column, Integer, DateTime, Numeric, String, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
class Txn(Base):
__tablename__ = 'txn'
hash_id = Column(String(64), nullable=False, primary_key=True)
q... |
995,330 | f6bcdbd27800d94a5ab04671889ef8d5002dd70e | # coding=utf-8
"""
author: wlc
function: 微博检索业务逻辑层
"""
# 引入外部库
# 引入内部库
from src.dao.weiboDao import *
from src.entity.retrieveResult import *
class WeiboOperator:
def __init__ (self):
# 该业务逻辑功能
self.intent = '微博检索'
# 该业务逻辑子功能
self.subintent = {
0: '微博热搜检索',
1: '关键字检索'
}
def get_realtimehot (sel... |
995,331 | cd95ecdc946a70a40d6d01416fbb986a722cb2e9 | # -*- coding: utf-8 -*-
import sys
import codecs
import nltk
def tokenizza(frasi): #tokenizza le frasi prese in input
tokens = []
for frase in frasi:
tok = nltk.word_tokenize(frase)
tokens = tokens + tok
return tokens #restituisce i tokens
def calcoloNTokens(file, t... |
995,332 | 3208f27bec0c4738ed10b5e265ccb7d223301977 | """ from https://github.com/keithito/tacotron """
'''
Defines the set of symbols used in text input to the model.
'''
_pad = '_'
_punctuation = ';:,.!?¡¿—…"«»“” '
_letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZÜÖÄabcdefghijklmnopqrstuvwxyzüöäß'
#_letters_ipa = "ɑɐɒæɓʙβɔɕçɗɖðʤəɘɚɛɜɝɞɟʄɡɠɢʛɦɧħɥʜɨɪʝɭɬɫɮʟɱɯɰŋɳɲɴøɵɸθœɶʘɹɺɾɻʀ... |
995,333 | bb4312c05896fa7f035d0d61b4ab70fffbb6e972 | import os
import sprinter.lib as lib
def execute_commmon_functionality(formula_instance):
install_directory = formula_instance.directory.install_directory(
formula_instance.feature_name
)
cwd = install_directory if os.path.exists(install_directory) else None
if formula_instance.target.has("env... |
995,334 | 0010eebb0ea6af9802f9fb8712c7a4f3442e8eed | #interactive program to calculate compound interest
import math
def amount_CI(p , r , t , n): #function for amount calculation
a =p*( math.pow( (1.0+(r/100*n)) , n*t ))
return a
#Inputs taken and result
principal = float(input("Enter the principal:")) #type-casted to float for performing mathematical operation... |
995,335 | 6e6830b29f5b8d5aa82897abe1d3c726fbbf2807 | import logging
import os
import sys
import traceback
from cliff import app
from cliff import commandmanager
from keystoneclient import session
from keystoneclient.auth import cli
from keystoneclient.auth.identity import v3
LOG = logging.getLogger(__name__)
def env(*vars, **kwargs):
"""Search for the first defi... |
995,336 | 008553e22a98eac846a8d23965a7253291a91e3e | # AUTHOR : Karthik Shetty
# DATE : 15 / 03 / 2017
#=======================================================================
# question 1
# 12/(4+1) = 2
# integer division
#=======================================================================
#question 2
# 26**100
# output: 3142930641582938830174357788501626427282... |
995,337 | 40560f875a86eaeef63c70b172b3a44e804c4d24 | import typing
from ..._auxiliary_lib import HereditaryStratigraphicArtifact
from ...juxtaposition import calc_rank_of_first_retained_disparity_between
from ._calc_rank_of_earliest_detectable_mrca_between import (
calc_rank_of_earliest_detectable_mrca_between,
)
def does_have_any_common_ancestor(
first: Hered... |
995,338 | 4cf66651d5ddc889fbee3a5f7b3a2641d239bdd3 | # import requests
import pandas
from bs4 import BeautifulSoup
with open(r"C:\Users\333051\Documents\Udemy\Python Mega Course\app7-webscraping\website\RockSprings.html") as file:
r = file.read()
soup = BeautifulSoup(r, "html.parser")
# print(soup.prettify)
ALL = soup.find_all("div", {"class":"propertyRow"})
l=... |
995,339 | 7a32e37dd9fd101b6355361077b7b041d0d1a756 | import config
from selenium import webdriver
from selenium.webdriver.common import action_chains
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0
from selenium.webdriver.support import expected_conditions as EC # available since 2.26... |
995,340 | 297f17308e73d14bc3f831194ae3d120ae5ba566 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 13 08:00:59 2020
@author: shrutikshirsagar
"""
from __future__ import print_function
import os
import numpy as np
import keras.backend as K
from keras.models import Model
from keras.layers import Input, Dense, Masking, LSTM, TimeDistributed, Bidi... |
995,341 | 07f8fcb27290b4f6d759f99931bae15d1e4148f7 | import unittest
import requests
from pathlib import Path
import json
import mysql.connector
from common import (
HTTP_API_ROOT,
CONFIG_PATH,
run_environment
)
from http_test_helpers import (
wait_predictor_learn,
check_predictor_exists,
check_predictor_not_exists,
check_ds_not_exists,
... |
995,342 | dd3441d0a4c9259b83e4afa2b462b861fb51aead | import asyncio
import functools
import time
from contextlib import contextmanager
"""
from stackoverflow: https://stackoverflow.com/q/44169998/532963
"""
def duration(func):
""" decorator that can take either coroutine or normal function
I cannot get this to work w/ FastAPI async methods
"""
@contex... |
995,343 | c8a2896998d479c8d509e2ed74b634e7721ce406 | from gflags import *
if not FLAGS.has_key('fake_storage'):
DEFINE_boolean('fake_storage', False, 'Should we make real storage volumes to attach?') |
995,344 | 8e6511df08777546068029501515502ea5dee2b5 | from django.apps import apps
from django.conf import settings
# Load source app from various apps
# Caveat: Either loaded model classes have no app_label
# or app_label must be named after app name. Conflicting
# app_label creates error.
def get_model (*args):
# Select app name
if hasattr(settings, "MODEL_APP... |
995,345 | 8f920049e555c4bac206929aa7fb3085d2317f5a | #!/usr/bin/env python
from ConfigMaster import ConfigMaster
class Params(ConfigMaster):
defaultParams = """
#!/usr/bin/env python
#####################################
## GENERAL CONFIGURATION
#####################################
## debug ##
# Flag to output debugging information
debug = False
# Forecast ... |
995,346 | 6d17e647e0e9ce0b3bd48fa987dfebe09cdb94cc | def pythagoras(base,height,hypotenus):
if base == str("x"):
height=int(height)
hypotenus=int(hypotenus)
return ("base = " + str(((hypotenus**2) - (height**2))**0.5))
elif height == str("x"):
base=int(base)
hypotenus=int(hypotenus)
r... |
995,347 | 79e5461eed350b0e0953ca96e0b50c1e8cabc335 | # Generated by Django 3.0.8 on 2020-07-27 14:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cmsauth', '0003_user_thumbnail'),
]
operations = [
migrations.AlterField(
model_name='user',
name='thumbnail',
... |
995,348 | ab4bdb862cdba70175105c1a0337859cfd3588bf | import pydash
pydash.initialize(0, "")
array = pydash.ArrayLV(3)
array[0] = pydash.LV(1, "first")
array[0]
|
995,349 | 724eeda2d920f7d841f4523c5d0531c066d41d09 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 13 21:06:23 2019
Need to reinstall module, at the moment I need to be in npy2pd module, same for basic plots
@author: ibladmin
"""
from npy2pd import *
from basic_plots import *
from glm import *
#Input folder with raw npy files
psy_raw = load_data(... |
995,350 | 23d04dd7342ac37bf5db0aac7ce8ac941cc0c790 | '''server 3 should recieve json data from server 2, and give CSV to server 1'''
from bottle import run, get, post, request
import time
import requests
run(host="127.0.0.1" , port=3333 , debug=True , reloader=True ) |
995,351 | 037af3293da892e30f34e5d69f0008136c8e14d6 | class Config(object):
DEBUG = False
TESTING = False
SQLALCHEMY_TRACK_MODIFICATIONS = False
class ProductionConfig(Config):
SQLALCHEMY_DATABASE_URI = "mysql+pymysql://root:root@localhost:3306/flask-mysql"
class DevelopmentConfig(Config):
DEBUG = True
SQLALCHEMY_DATABASE_URI = "mysql+pymysql://roo... |
995,352 | 624a98ff6996cfc51456f6a02fb269fdeedbdd06 | ##################################
# fichier mot-de-passe-du-village-validation.py
# nom de l'exercice : Mot de passe du village
# url : http://www.france-ioi.org/algo/task.php?idChapter=646&idTask=0&sTab=task&iOrder=1
# type : validation
#
# Nom du chapitre :
#
# Compétence développée :
#
# auteur :
##############... |
995,353 | 69295b21b8f1a7813a850f1984be5f2adae7bdf8 | import redis
import json
import sys
import mysql.connector
with open('config.json', 'r') as f:
config = json.load(f)
mydb = mysql.connector.connect(**config["mysql"])
cursor = mydb.cursor()
red = redis.Redis(host='localhost', port=6379, db=0, decode_responses=True)
pub = red.pubsub()
pub.subscribe('newLogin')... |
995,354 | abef2bdca7baf32eb872c72e9ab6918b4917ed49 | from heapq import heapify, heappop
import random
from sortedcontainers import SortedDict
# !1.堆的删除与遍历通过while循环实现
pq = [random.randrange(1, 100) for _ in range(10)]
heapify(pq)
# !删除堆中小于10的元素
while pq and pq[0] < 10:
heappop(pq)
###########################################################
# !2.遍历字典删除k... |
995,355 | d9216055ccc2a16ab80893accef4bcef7a556a30 | ../hyperparameters.py |
995,356 | af1e0ee224b19a7524c979ac9ce16c456565356f | # ------------------------------------------
# Name: task_functions
# Purpose: Functions creating/managing tasks/displaying.
#
# Author: Robin Siebler
# Created: 5/6/15
# ------------------------------------------
__author__ = 'Robin Siebler'
__date__ = '5/6/15'
import arrow
import platform
import util
from t... |
995,357 | 144db73eb16b40d8070c56aa748bd844accdf006 | #!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Michael A.G. Aivazis
# California Institute of Technology
# (C) 1998-2005 All Rights Reserved
#
# {LicenseText}
#
# ~~~~~~~~~~~~~~~~~~~~~~~~... |
995,358 | 0abe478e6018680a6414debc3168ef4480c731d2 | """ Open Loop Controller for Spot Micro. Takes GUI params or uses default
"""
import numpy as np
from random import shuffle
import copy
# Ensuring totally random seed every step!
np.random.seed()
FB = 0
LAT = 1
ROT = 2
COMBI = 3
FWD = 0
ALL = 1
class BezierStepper():
def __init__(self,
pos=np.a... |
995,359 | 665088b035058b0f09e705b6d4af9e9192d4468d | import os
import pandas as pd
import shutil
rootDir = "../TRAC2018/"
# input
devInfile = rootDir + "english/agr_en_dev.csv"
testInfile1 = rootDir + "trac-gold-set/agr_en_fb_gold.csv"
testInfile2 = rootDir + "trac-gold-set/agr_en_tw_gold.csv"
trainInfile = rootDir + "english/agr_en_train.csv"
# ouput
vuaDir = "VUA_form... |
995,360 | 74a9ba727c2a44af0b59fea1a5bc03cd41cefe83 | def fib(n):
numList = []
curr = 1
prev = 0
while len(numList)<n:
numList.append(curr)
curr, prev = curr + prev, curr
print(*numList, sep='\n')
n = int(input('Enter number of digits\n'))
fib(n)
|
995,361 | 75e4229e9a5945dc63e3a7869ff5bcc7ccc2c0c5 | def logger(func):
def inner(*args, **kwargs):
print(func.__name__ + "(%s, %s)" % (args, kwargs))
return func(*args, **kwargs)
return inner
|
995,362 | 9d3a54107875808f9bd589baaf2efc242570f302 | '''
Created on 8.5.2017
TODO - packages not loaded but applicable
- geojson
- shapely
- seaborn as sns
- shapely.wkt, wkt = http://www.geoapi.org/3.0/javadoc/org/opengis/referencing/doc-files/WKT.html
@author: Markus.Walden
'''
#Array
from datetime import datetime
import shapefile
import geopandas as gp
... |
995,363 | fc759d6b3017b377b2ef3cb301494e92ea953d66 | def magic_date(c,m,y):
m = m.lower()
if m == 'gennaio':
d = 1
elif m == 'febbraio':
d = 2
elif m == 'marzo':
d = 3
elif m == 'aprile':
d = 4
elif m == 'maggio':
d = 5
elif m == 'giugno':
d = 6
elif m == 'luglio':
d = ... |
995,364 | 680087defc309eb72979e9b10b98b6937f021744 | # -------------------------------------------------------- 1 ----------------------------------------------------------
import time
import itertools
class TrafficLight:
__color = [["red", [7, 31]], ["yellow", [2, 33]], ["green", [7, 32]], ["yellow", [2, 33]]]
def running(self):
for light in itertoo... |
995,365 | 96a3040b82e7ee0f0ca09b660ffdc18122a88855 | #I have created File:-Raoshanks
from django.http import HttpResponse
from django.shortcuts import render
def index(request):
return render(request, 'index.html')
def ex1(request):
s= '''<h2>NavigationBar<br></h2>
<a href=https://www.youtube.com>youtube</a><br>
<a href='https://www.facebook.com'>facebo... |
995,366 | b3a6cf6523c2eb1f7a91a327f69fd7c3f588c2bf | import numpy as np
import cv2
import math
def cropImage(base,filename,filetype):
openfile=base+"/"+filename+"."+filetype
# Load an color image in grayscale
og_image = cv2.imread(openfile,0)
#cv2.imshow('Original sudoku',og_image)
#cv2.waitKey(0)
#cv2.destroyAllWindows()
blank_image = np... |
995,367 | d42c0d5645a4a4b9c0f372cd6248b4fb5ae239c6 | from django.shortcuts import render
from django.http import HttpResponse
import random
import string
from .models import URL
# Create your views here.
def index(request):
return render(request, 'url_shorten/index.html')
def shortened(request):
if request.method == 'POST':
long_url = request.POST['ur... |
995,368 | 21fdb7c843a6580350f8b6443dc33bf48ecef8fd | n, l, u = map(int,input().split())
temp = 0
for i in range(n):
update = int(input())
if update > u:
print("BBTV: Dollar reached {} Oshloobs, A record!".format(update))
u = update
elif temp != 0:
if temp > update:
print("NTV: Dollar dropped by {} Oshloobs".format(temp-upd... |
995,369 | 7c5962497257c801ced74862abc11b7722607e95 | #! /usr/bin/env python
PKG = "eddiebot_node"
import roslib;roslib.load_manifest(PKG)
from dynamic_reconfigure.parameter_generator import *
gen = ParameterGenerator()
gen.add("update_rate", double_t, 0, "Polling rate for the parallax eddie.", 30.0, 60, 30.0 )
drive_mode = gen.enum([ gen.const("twist", str_t, "twis... |
995,370 | 3e7e9fa1251df819f6373bd910c67b32884ab3f2 | """ Test Configuration """
import pytest
from disco_dan import settings
def test_configured():
assert True
def test_settings_load():
assert settings
|
995,371 | a6ee56d8b240adc021cfecce4ca7dccf0da6411e | from rest_framework.generics import (
ListAPIView,
RetrieveUpdateDestroyAPIView,
CreateAPIView,
DestroyAPIView,
RetrieveAPIView,
)
from rest_framework.filters import (
SearchFilter,
OrderingFilter,
)
from rest_framework.permissions import (
AllowAny,
IsAdminUser,
IsAuthenticated,... |
995,372 | 567b3ddda979a80e460084a115f90784f4b0d6ec | import os
class Initialize:
def __init__(self):
pass
@staticmethod
def get_version_number():
return "0.1.0"
@staticmethod
def create_dirs():
if not os.path.isdir("data"):
os.mkdir("data")
if not os.path.isdir("data/left"):
os.mkdir("data/left")
if not os.path.isdir("data/ke... |
995,373 | 26a6bacd78313d1dfb45206c3ce4db7bcbeeb2c9 | # Generated by Django 3.0.8 on 2020-07-25 21:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('grade_predictions', '0008_auto_20200725_2135'),
]
operations = [
migrations.AddField(
model_name='grade',
name='stat... |
995,374 | 77569d035cbcf12c47183172b007c8fd25764d5b | import math
import numpy as np
#from icecream import ic
class BrapiVariants():
def __init__(self, gd, request):
self.gd = gd
self.request = request
self.status_messages = []
self.data_matrices = []
self._parse_request(request)
self._count_variants()
self.... |
995,375 | 7e688e11e2d2fafe566a18a2e05a38700795c867 | import flask
from flask import request
import requests
from flask_cors import CORS, cross_origin
app = flask.Flask(__name__)
cors=CORS(app)
app.config["CORS_HEADERS"] = 'Content-Type'
@app.route('/', methods=['GET'])
@cross_origin()
def home():
storeType = brand = pkgtype = ""
try:
storeType = reques... |
995,376 | b08621d2e36481132319ef456013a4c6cdf798f6 | def searchFile(Path, a) :
with open(Path,'r') as file :
for line in file :
if a in line :
print(line)
break
else :
print("Searching..")
print("<Name Not Found>")
def splitNames(Path) :
first = []
last = []
c = 1
temp = ''
with open(Path, 'r') as file :
for line in file :
for l in li... |
995,377 | ac38483240b952cae6baf075381e29c7aa11d464 | from tkinter import *
import tkinter as tk
import platform
from config import *
from OSUtilities import isFile
class CourseChoice:
def __init__(self):
self.root = tk.Tk()
self.root.geometry("800x600")
self.canvas = tk.Canvas(self.root)
self.configureCanvasToBeScrollable()
self.frame = tk.Frame(self.can... |
995,378 | b6ad123b6a6e30050d60f93f20edfeb1887dff20 | import getopt
import requests
import random
import sys
import time
def _buildName():
fnames = [
'Abraham',
'Andrew',
'Barack',
'Benjamin',
'Calvin',
'Chester',
'Dwight',
'Franklin',
'George',
'Gerald',
'Grover',
'Harry... |
995,379 | 6c73e15a32cb431d04290f703ae854fe27550a5e | from pymongo import MongoClient
import feedparser
import string
import html # Convert HTML accents to text
import unidecode # Remove accents
import re
client = MongoClient('localhost', 27017)
db = client.aula
news = db.news
# 1. Parseamos o RSS diante da URL do RSS do EM
em_rss = feedparser.parse('http://www.em.co... |
995,380 | 9df3a1dfeb231820e1d228e27eff0950a87e48ee | import csv
list = ["james"]
big_list = list * 100
print(big_list)
# court_list = ["Barack James Obama", "Roger Ramjet"]
# search_terms = "Barack"
# matches = []
# for name_string in court_list:
# for word in search_terms.split(" "):
# if word not in name_string:
# break
# else:
# m... |
995,381 | 145453b84bb197ba6f41dc740f5875387ad79550 | def reverse(arr):
print("Input Array : {} ".format(arr))
ptr1 = 0
ptr2 = len(arr) - 1
while ptr1 < ptr2:
swap(arr, ptr1, ptr2)
ptr1 += 1
ptr2 -= 1
def swap(arr, ptr1, ptr2):
temp = arr[ptr1]
arr[ptr1] = arr[ptr2]
arr[ptr2] = temp
arr = [1, 2, 3, 4, 5, 6]
reverse(a... |
995,382 | c4d763f55e9833c52ea09ac0238398780f08edc1 | from django import template
from django import forms
from django.http import HttpResponseRedirect
import datetime
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from pirate_core import HttpRedirectException, namespace_get, FormMixin
from pirate_social.models impor... |
995,383 | 5199b59f90f1dc4f8c18270baff6e66dc91cc408 | from __future__ import print_function
import sys
import os
import numpy as np
from tqdm import trange
import matplotlib
# matplotlib.use('agg')
import matplotlib.pyplot as plt
from models_v1 import *
import cv2
class Trainer(object):
def __init__(self... |
995,384 | 5d01086ed7e42f066f74ae12cb2f95e7503b57a7 | from typing import List
##Vectors
Vector = List[float]
height_weight_age = [70, #inches,
170, #pounds,
40 ] #years
grades = [95, # exam1
80, # exam2
75, # exam3
62 ] # exam4
#Vectors add componentwise, meanign if two vectors are the same l... |
995,385 | f0d3ccb04443db57a11c6d703758b898e1ae295c | from flask import url_for
class TestExtTable:
def test_download_tables(self, client, token):
res = client.get(
url_for("admin_api.download_tables", source_id="99YYYYY"),
headers={"token": token}
)
assert res.json["meta"]["code"] == 200 or res.json["meta"]["code"] ==... |
995,386 | f76162b550213cd69e0d604c39ae6a8f440b4ae6 | import sys
sys.path.append("/files/rostam")
from rostam.start import main
from mock import patch
def begin():
args = ["start.py", "-l", "/data", "-o", "/data/rostam.log"]
with patch.object(sys, 'argv', args):
main()
if __name__ == "__main__":
begin()
|
995,387 | ada499b4d7b8482377e241907a00288e6238780d | from django.apps import AppConfig
class OmniConfig(AppConfig):
name = 'omni'
|
995,388 | 5f14acc576236c3869fc058e611d80a4d84b4969 | import json
from flask import Flask
from flask_cors import *
from game import devices_data
from game import host_data
app = Flask(__name__)
CORS(app, supports_credentials=True) # 设置跨域
# GET, 根据用户ID查询特定用户
@app.route('/devices', methods=['GET'])
def get_devices():
return json.dumps(devices_data)
# # 也可以自定义其他的方法
... |
995,389 | ad639d69f4f091d595b7885b85e97b46e5fb8d8d | import numpy as np
from testFunction import returnChosenFunction
class Vector2D:
x = None
y = None
def __init__(self,x = 0, y = 0, vector = 0, whichConstructor = 0):
if(whichConstructor==0):
self.x = x
self.y = y
elif(whichConstructor==1):
se... |
995,390 | aebe2abcbb3e25cda50add0860057150da631949 | import sys
#捕获单个异常
try:
s = input('please enter two numbers separated by comma: ')
num1 = int(s.split(',')[0].strip())
num2 = int(s.split(',')[1].strip())
...
except ValueError as err:
print('Value Error: {}'.format(err))
#捕获多个异常
#写法一
try:
s = input('please enter two numbers separated by comma:... |
995,391 | a201860c3bad2bedc078673213bf0265cc9fb974 | from django.core import urlresolvers
from django import shortcuts
from django.views.generic import list_detail, create_update
from django.contrib.auth import decorators
from college import models
@decorators.login_required
def delete_student(request, pk):
student = shortcuts.get_object_or_404(models.Student, pk = ... |
995,392 | 3a66ac5b206ed9f84c6fd0c4c6411c865d9eb163 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2018-03-09
# @Author : Chloé Artaud (chloe.artaud@univ-lr.fr), Nicolas Sidère (nicolas.sidere@univ-lr.fr)
# @Link : http://findit.univ-lr.fr/
# @Version : $Id$
import os
import logging
import argparse
import csv
import collections
import sys
from argparse ... |
995,393 | db2e7cc93e78f7964c94952b57bb0c3e6ba83dd1 | from django import forms
from .models import Post
class PostForm(forms.ModelForm):
category_csv = forms.CharField(required=True, label='Categories (comma serparated)')
class Meta:
model = Post
fields =('title', 'content', 'category_csv') |
995,394 | a61fda6f471f35e36a0f582fcb881df8485b2230 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: ZhangXiaocheng
# @File: restful.py
# @Time: 2019/4/18 20:48
from flask import views
from app.decorators import set_response, exception_handler, token_validator
class RESTfulView(views.MethodView):
decorators = [exception_handler]
@classmethod
de... |
995,395 | f2ef6c4843727597cf8c4b38981a6b94e04522a3 | # @Time : 2019/7/1 10:18
# @Author : young
from flask import Blueprint, current_app, make_response
from flask_wtf import csrf
html = Blueprint("html", __name__)
@html.route("/<re('.*'):html_file_name>")
def get_html(html_file_name):
if not html_file_name:
html_file_name = "index.html"
... |
995,396 | 0193210bd67238dee2478516c20df17d374d4dc8 |
# themodelbot
import tweepy as tp
import time
import os
# credentials to login to twitter api
consumer_key = '3oItC280vFgNLtHa9FLCUSrn6'
consumer_secret = 'J1GwmtT3JbNi3SSkRpqlZHhTaJFwuHOEDI0uaTvlNz0fAmbFTw'
access_token = '1009266220984659969-XekO15oXO6wURY4DVgAm6PNtFDqIUO'
access_secret = 'Nu2NIHSDYfRrVghQiA07Kz0S... |
995,397 | cab65111492fa6bdfd74c003ff0fff45e51865ce | import fbchat
import requests
from tkinter import *
from tkinter import ttk
from tkinter import filedialog
from tkinter import messagebox
from collections import defaultdict
from math import ceil
from io import BytesIO
from PIL import ImageTk, Image
from os import path
class AutoHideScrollbar(Scrollbar):
'''
... |
995,398 | 2e9042aedbae76b97eb1893a57c5ce2d937683f4 | import lib.messages as messages
def turn(state):
"""
This function is responsable for propelling the game forward.
"""
victory = defeat = False
state.months_since_founding += 1
messages.turn_prompt(state.months_since_founding)
if state.months_since_founding > 5:
defeat = True
... |
995,399 | 789c748122946f90f670fe9a4addb9baf2619b5c | import numpy as np
def numero_a_letras(n):
"""Dado un entero, devuelve un string con su nombre en castellano"""
especiales = {0: 'cero', 10: 'diez', 11: 'once', 12: 'doce', 13: 'trece', 14: 'catorce', 15: 'quince', 20: 'veinte', 100: 'cien', 1000: 'mil'}
if n in especiales:
return especiales[n]
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.