index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
986,500 | 1af0fde6387b66ff70eaf67e283c4508fdfe28c2 | from flask import Blueprint, redirect, url_for, request, flash, jsonify
from flask_login import login_user, logout_user, login_required
from werkzeug.security import generate_password_hash, check_password_hash
from api.book.models import User
from . import db
auth = Blueprint('auth', __name__)
@auth.route('/login',... |
986,501 | 21e1d62ac37a49e090d3c4546df5d3fa2bde0c00 | # -*- coding: utf-8 -*-
from app import logging
from app.remote.redis import Redis as redis
from app.telegram.app import get_client as telegram_get_client
from app.vk.app import start_polling as vk_start_polling
from threading import Thread
from time import sleep
import logging
import asyncio
if __name__ == "__main_... |
986,502 | 529e4fee5a3bfdf483c526c4b3313e0e16744853 | from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^edx2canvas/', include('edx2canvas.urls', namespace="edx2canvas")),
url(r'^auth_error/', 'edx_in_canvas.views.lti_auth_error', name='lti_auth_error'),
)
|
986,503 | 5916f3ac2abaa8c6fb04a469c71590a6a9055240 | from compiler.ast import *
from HelperClasses import *
from compiler.ast import *
import varAnalysis, astpp
#Combines the func list and ast into a list of tuples (funcname, ModLambda)
#all code not in a lambda will be put into main
def standardize(ast, l):
ast.nodes.append(Return(Const(0)))
return l + [("ma... |
986,504 | e913c79e74f8e212378e2aeecf867a66221eee3f | import dao.JWTUserImplementation as JWTDao
async def isUserPresentByEmail(email: str) -> bool:
res = await JWTDao.isUserPresentByEmail(email)
return True if res is not None else False
async def getUserByEmail(user: JWTDao) -> dict:
res = await JWTDao.getUserByEmail(user)
if res is None:
ret... |
986,505 | 661c98b729343cfd53b800627117162f9910568d | """Unit-tests for ``sfini``."""
|
986,506 | 360d4ae3668369408b933c3db5e987799a63227b | from django.conf.urls.defaults import *
from twitter.tcal.views import main
#from django.contrib.comments.models import FreeComment
urlpatterns = patterns('',
url(r'^$', main.main, name='tcal'),
url(r'^week/$', main.week, name='anonymous_week'),
url(r'^week/(?P<username>\w+)/$', main.week, name='this_... |
986,507 | 6bc975e59e4c1e291ccc1ef58cc7e9b23113d87c | import ccxt
from tabulate import tabulate
"""
Show exchanges list.
"""
def run(ctx):
table = [[exchange] for exchange in ccxt.exchanges]
print(tabulate(table, ['Exchanges'], tablefmt="grid"))
|
986,508 | f1fc1209589bd6b771fdb155ab30db9cc2569dc5 | import pygame
pygame.init() #초기화 (반드시 필요)
#화면 크기 설정
screen_width = 480 #가로크기
screen_height = 640 #세로크기
screen = pygame.display.set_mode((screen_width, screen_height))
# 화면 타이틀 설정
pygame.display.set_caption("Nado Game") #게임이름
#배경 이미지 불러오기
background = pygame.image.load("C:\\Users\\ljs74\\OneDrive\\바탕 화면\\임정석\\Python... |
986,509 | aaac55b122718d888273841d0750c32247fe18fb | # 근우의 다이어리 꾸미기
# 그리디 또한 규칙을 찾는 것이 중요함
n = input()
check = '1' * len(n)
if len(n) == 1:
print(1)
elif int(n) >= int(check):
print(len(n))
else:
print(len(n)-1) |
986,510 | 0ac11e6af41f5e76addccf7053b61afb5a1bf6d7 | from Entity.SystemFunction import SystemFunction
p= SystemFunction("01002")
result=p.get_section_function_json()
print result
|
986,511 | 4a1649b0803fdc009e23c132a9cc42c0febc84ac | #!/usr/bin/env python
PACKAGE="micvision"
from dynamic_reconfigure.parameter_generator_catkin import *
gen = ParameterGenerator()
gen.add("inflation_radius", double_t, 0, "The inflation radius(m)", 0.3, 0, 1)
gen.add("robot_radius", double_t, 0, "The robot radius(m)", 0.2, 0, 0.5)
gen.add("laserscan_circle_step", in... |
986,512 | 2eb79af4023726526799ac8c88b637bf34349d98 | # -*- coding: utf-8 -*-
from . import helpers
from . import models
import numpy as np
class WymSim:
#default init values
__dparms = np.array([3.,2.,0.1,100.])
__drtot = np.array([0.001,0.0025,0.005,0.01,0.025,0.05])
__dlrange = np.array([0.001,100.,2.])
__drp = 3
__dst = 3333
__dns = 0.05
... |
986,513 | 4cd87dc9bc1c5ce52ae70764efb34aa790e87104 | from __future__ import print_function
import keras
from keras.models import load_model
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import Conv2D, MaxPooling2D
import time
from PIL import ImageGrab
import cv2
import numpy as np
from press_k... |
986,514 | 9ae9bf029f8c64e54e1c750174a9598a9126ae8f | import csv
from datetime import datetime
class CsvSaveAndRetrievePlastic(object):
# TODO make the file name and path coded here, not in the tests
file_name = 'NEXI/01a.plastic_setup/plastic_output.txt'
def write_plastic_to_file(self, test_case, plastic, date, embossing_file):
# this method write... |
986,515 | b0e7bad386015aa3283a6d5c44677fe99a328308 | from EC.EC import *
ec = EC(7,11,593899)
x = 12345
x *= 10
messagelist = [i for i in xrange(x, x+10)]
for m in messagelist:
p1,p2 = ec.at(m)
if ec.is_valid(p1):
print p1
elif ec.is_valid(p2):
print p2
pass
|
986,516 | 4d04c95db4c50577622ebd892fb6f7c3044cefeb | from venue_objects.helper import add_attr_db, convert_params
class PhrasesSample:
def __init__(self, db, db_result=None, **query):
attr_db = {
"id": "_id",
"text": "text",
"indices_start": "indices_start"
}
if db_result is None:
db_result = ... |
986,517 | 7ea286d5c9e7e3f3106a43dd0025c52764e7b4be | print("Entrez une note.")
nn = input()
print("Entrez la note maximale à attribuer.")
pp = input()
note = int(nn)
lim = int(pp)
ratio = note/lim
if ratio == 1:
print("SS")
elif 1 > ratio >= 0.95:
print("S")
elif 0.95 > ratio >= 0.80:
print("A")
elif 0.80 > ratio >= 0.60:
print("B")
elif 0.60 > ratio >=... |
986,518 | 5d856960daa8582e074ba87d398315e793712508 |
N = [[0.1, 0.5, 1, 0.5, 0.1],
[0.05, 0.7, 1, 0.7, 0.05],
[0.05, 0.2, 1, 0.2, 0.05],
[0.05, 0.05, 0.05, 0.05, 0.05],
[0.05, 0.05, 0.05, 0.05, 0.05]]
S = [[0.05, 0.05, 0.05, 0.05, 0.05],
[0.05, 0.05, 0.05, 0.05, 0.05],
[0.05, 0.2, 1, 0.2, 0.05],
[0.05, 0.7, 1, 0.7, 0.05],
[0.1, 0... |
986,519 | 72d41a5f77de2873b1e463452345ca0cf575222e | import pymysql
from common import database
# 글 정보를 저장아는 함수
def add_board_content(board_subject, board_content, board_writer_idx, board_info_idx, board_image) :
conn = database.get_connection()
sql = '''
insert into board_table(board_subject, board_writer_idx, board_date, board_content, board_image, bo... |
986,520 | dce54d2d43eac03e9870a12774a1715fe49b0583 | #!/usr/bin/python
import json
import os
import urllib.request
import requests
# 下载歌曲并且设置参数
from base import set_mp3_info, xstr, init_folder, check_base_path
base_url = "http://39.98.194.220:3300"
def download_item(count, song_url, name, pic, artist, album, savePath):
if song_url is None or name is None:
... |
986,521 | 3818ba960f299f48fc406a6f2107ac24216f4f61 | # -*- coding: utf-8 -*-
"""
dynamic_learn.testsuite
~~~~~~~~~~~~~~~~~~~~~~~
:license: BSD, see LICENSE for more details.
"""
import unittest
import versus.tools.dataIO as dio
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
class LocalTestCase(unittest.TestCase):
"""
Setup rele... |
986,522 | 35df0c11ddff67d1fe4f67d8fa2e1970529c1833 | #!D:\Py_projects\mjunitfw3_testsuite_nose\venv\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'unittest-parallel==1.0.5','console_scripts','unittest-parallel'
__requires__ = 'unittest-parallel==1.0.5'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r... |
986,523 | 7d7f03abb3d8d442544e629a1b0c286cd7eef1cf | from package import *
class twisted(EasyInstallPackage):
pass
|
986,524 | 277a169653e10ad26c1f361676bd611569d55cfd | """
source: https://leetcode.com/problems/palindrome-number/
"""
x = -121
def isPalindrome(x):
if x < 0:
return False
else:
return x == int(str(x)[::-1])
print(isPalindrome(x)) |
986,525 | abcbedad86bdc9505bcbb07cb743d0b8707b8bc1 | # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3
from . import res_partner
from . import res_company
from . import account_invoice
from . import sale_export
from . import res_country
from . import product
from . import stock_picking
|
986,526 | df8cd9d587ce9a2302905f5c38fdc9b1a2ff34ca | import requests
import calendar;
import time;
from collections import Counter
from utils import utils
starting_time = calendar.timegm(time.gmtime())
########################################getting movie list#####################################################
movie_id_list = utils.get_total_media_ids(["primary_releas... |
986,527 | b048fe974882d8f2a4f6ee5ebc7fee70eee93e2a | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import time
import re
import os
import tempfile
import shutil
import subprocess
from automation import Automation
from ... |
986,528 | 46e31575b33ee71a79fa77c194b6b2ad276bd8fb | """
Homework #06
CSCI-UA.003-001 Fall 2020
Edmund Cheng
ec3219
2020-11-01
"""
import random
def generate_word(syllables):
available_words = [
['age', 'roof', 'plain', 'slime', 'floor', 'fig', 'rode', 'oomph', 'flab', 'chit', 'creek', "we'll", 'brail', 'bay', 'big', 'salve', 'yaws', 'heal', '... |
986,529 | 8066267a7a74fcc9d7a995b197aa4e347024da23 | class Schema:
BODY = 'body'
QUERY_PARAMETER = 'query_parameter'
URL_PARAMETER = 'url_parameter'
@staticmethod
def validate_body(schema):
return {Schema.BODY: schema()}
@staticmethod
def validate_query_parameter(schema):
return {Schema.QUERY_PARAMETER: schema()}
@stati... |
986,530 | dd345b87f74ed09a249069c74eaaf6a17cf34a72 | from ..classes import Message
from ..helpers import SendMessage, UpdateConfig, print_bridge_network, print_LAN_network
import math
def implement_protocol(bridge_network, LAN_network):
"""
Implements the Spanning Tree Protocol algorithm after
the construction of the network topology.
"""
spawned = [] # stores m... |
986,531 | b05c85d66e3b6d649c60f10601cc4423028eb0c2 | #!/usr/bin/python
import irctestframework.irctest
m = irctestframework.irctest.IrcTest()
c1a = m.new('c1a')
m.connect()
m.send(c1a, "FAKEREPUTATION 127.0.0.1 500")
m.expect(c1a, "Confirm setting reputation", "Reputation for.*127.0.0.1.*500");
m.clearlog()
print
|
986,532 | ce2df328194842d586b1abc3b16311b74faf4027 | from tkinter import *
SQUARE_SIZE = 100
SQUARE_DST = 10
SQUARE_COLOUR = "#ffffff"
BG_COLOUR = "#e05e00"
FIELD_BG_COLOUR = "#000000"
WIN_FONT = "consolas 9"
WIDGET_PADDING = 5
PLAYER_TYPES = ["Human", "Random Bot", "Easy Bot", "Medium Bot", "Hard Bot", "Extreme Bot", "Impossible Bot", "Greedy Bot"]
HUMAN, RANDOM, E... |
986,533 | 45a4eb5333215f148ce6faaf92ffff9adce82860 | #%%
import xarray as xr
if __name__ == '__main__':
data_dir = '/home/zzhzhao/data/CMFD_Prec'
with xr.open_mfdataset(f'{data_dir}/*.nc', concat_dim='time', parallel=True) as ds:
### 青藏高原范围
lat_min, lat_max = 27, 40
lon_min, lon_max = 73, 105
### 提取该范围
ds_TP = ds.sel(lat... |
986,534 | 5931d8e991e05144fc912a4cb6a6fbb77a77c263 | import _plotly_utils.basevalidators
class PatternValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="pattern", parent_name="bar.marker", **kwargs):
super(PatternValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... |
986,535 | 9fdffd5c9b329a511604680cf075c85387ac2a62 | from abc import abstractmethod
from enum import Enum
from typing import TYPE_CHECKING
from galaxy_crawler.models import utils
if TYPE_CHECKING:
from typing import List, Optional
from sqlalchemy.orm.session import Session
class ModelInterfaceMixin(object):
@classmethod
@abstractmethod
def from_j... |
986,536 | 9066899e0801e4888f658bbf29755728529a26d6 | from Parser import differentiate
import argparse
from Function_Parser import parse_function
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--var', default='x', type=str)
parser.add_argument('expression')
return parser
if __name__ == '__main__':
arg_parser = parse_args(... |
986,537 | fe194e9bf3b85115c4a6daab15a815a0b989ff7f | import logging
import logging.config
import os
from time_delta import DatetimeDelta
class TimezoneFormatter(logging.Formatter):
def __init__(self, fmt, datefmt,timezone=None):
#self.timezone = timezone or pytz.timezone('Asia/ShangHai')
super(TimezoneFormatter, self).__init__(fmt, datefmt)
def... |
986,538 | 1f48478d02433c65490b17aceee7652112e4c457 | """@package docstring
District class contains district information.
This class is a parameter to all the metric fucntions,
either individually or a part of the district plans.
"""
class District:
def __init__(self, id=None, population=None, votes=None, party_votes=None, geometry=None):
"""
:par... |
986,539 | c42e3426c2c9ce8c395af6c3d1affe8188daffb0 |
__author__="Harshit.Kashiv"
import MySQLdb
if __name__ == '__main__':
print 'Hi'
host="localhost"
user="root"
password="Km7Iv80l"
database="cja_test_anand"
unix_socket="/tmp/mysql.sock"
db = MySQLdb.connect(host = host, user = user, passwd=password, db = database, unix_socket = unix_socket)
cur = cursor = ... |
986,540 | 48c8512184c00e2da80d704cb4bd778b6a67ffde | import asyncio
import os
from . import toolbox, mask, fs
from aiohttp_session import get_session
@asyncio.coroutine
def route(request):
session = yield from get_session(request)
if 'uid' in session:
uid = session['uid']
else:
return toolbox.javaify(403,"forbidden")
query_parameters = ... |
986,541 | 650a08368e607d487fabe65690a479b3d0c5bfd4 | locations_dict = {
'PT': [
[[-6.90628, 40.726315], [['1543314339', 'https://live.staticflickr.com/2070/1543314339_2d965ddb0a_s.jpg']]],
[[-8.408253, 40.196675], [['7718394114', 'https://live.staticflickr.com/8284/7718394114_eb94cd238a_s.jpg']]],
[[-8.712349, 39.459728], [['4637039854', 'https://live.stati... |
986,542 | dc9e9f0dd44013f1911e9eb89abb8134dca98761 | import sys
import os
import django
sys.path.append('../../../platform_manage')
os.environ['DJANGO_SETTINGS_MODULE'] = 'platform_manage.settings'
django.setup()
|
986,543 | d022cbb75ae80cd18919091478f224a40ed648f4 | class Solution:
def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]:
hashtable = {}
HT = {}
result = []
for i in nums1:
if i in hashtable.keys():
hashtable[i] += 1
else:
hashtable[i] = 1
... |
986,544 | 7d343ef75f50eefa9616dc4f51866183f02dc47b | # coding=utf-8
#
# @lc app=leetcode id=860 lang=python
#
# [860] Lemonade Change
#
# https://leetcode.com/problems/lemonade-change/description/
#
# algorithms
# Easy (50.28%)
# Likes: 318
# Dislikes: 60
# Total Accepted: 31.3K
# Total Submissions: 61.7K
# Testcase Example: '[5,5,5,10,20]'
#
# At a lemonade stand... |
986,545 | 380d9a9d09586b1fc3a30ce4a4169c5e8d422bd8 | # -*- coding: utf-8 -*-
"""
Created on Mon May 3 16:51:24 2021
@author: Will
"""
#exception to force user to input an integer
while True:
try:
n = input("Please enter an integer: ")
n = int(n)
break
except ValueError:
print("Input not an integer; try again")
... |
986,546 | 253a18f54bc420d883e70df5c03dcc01057f055c | from arms import arms
import os
import pygame
import sys
import time
import math
import random
from bullet import bullet
from pygame.locals import *
class explosion(arms):
def __init__(self, x, y,radius=-1):
pygame.sprite.Sprite.__init__(self, self.containers)
sheet = pygame.image.load('Sprites/en... |
986,547 | 82a4fda86c56ff115ce3fed28d4a84efd1c6477c | from {{cookiecutter.project_slug}}.analytics.{{cookiecutter.feature_name}}.parse_cli_args import parse_cli_args
from {{cookiecutter.project_slug}}.analytics.{{cookiecutter.feature_name}}.common.setup_logging.setup_logging import initialise_logging
def main(command_line, environment):
args = parse_cli_args(command... |
986,548 | e5625738220b3525759c0c2476074e0270f61934 | # -*- coding: utf-8 -*-
# @Author : Lee
# @Time : 2021/7/13 10:46
# @Function: 示例3 : Mauna Loa CO2 数据中的 GRR
#
import numpy as np
from matplotlib import pyplot as plt
from sklearn.datasets import fetch_openml
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import... |
986,549 | 0889fad3c96ec00078bea2092b9bd62fe03dc671 | from django.db import models
import uuid
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from userena.models import UserenaBaseProfile
from django.core.validators import URLValidator
from django.contrib import admin
import tagulous.models
#from phonenumber_field.modelfie... |
986,550 | d5027cf75ea452c38b4ef41e768b5edcfea79ba0 | from PIL import ImageGrab
from PIL import Image
import requests
import io
import time
def screen_shot():
img = ImageGrab.grab()
roiImg = img.crop()
imgByteArr = io.BytesIO()
roiImg.save(imgByteArr, format='JPEG')
imgByteArr = imgByteArr.getbuffer()
return imgByteArr
def image_to_... |
986,551 | 1479bbba636268707d7e2f05d2f10506504cb36b | # -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-25 11:09
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('userapi', '0009_remove_location_status'),
]
operations = [
migrations.AddFi... |
986,552 | 5308f9fd194feae515e3d20cc2309d4709751887 | import builtins
import logging
from types import SimpleNamespace
from lumigo_tracer import lumigo_utils
from lumigo_tracer.spans_container import SpansContainer
import mock
import pytest
from lumigo_tracer.lumigo_utils import Configuration, get_omitting_regex, get_logger
from lumigo_tracer.wrappers.http.http_data_cla... |
986,553 | 4b4ae0e9049372bc2adea7c1d3fbff12ec157000 | import shlex
import varchs.i386 as e_i386
def eflags(vdb, line):
"""
Shows or flips the status of the eflags register bits.
Usage: eflags [flag short name]
"""
trace = vdb.getTrace()
argv = shlex.split(line)
if len(argv) not in (0, 1):
return vdb.do_help('eflags')
if len(arg... |
986,554 | 0c92663f229aa12ba3e4d06c0bcffa81057d1eec | from rest_framework import serializers
from apps.warehouse.models import HashTag, Tweet, TweetUser, TweetMedia
class TweetMediaSerializer(serializers.ModelSerializer):
class Meta:
model = TweetMedia
fields = ('url',)
class TweetUserSerializer(serializers.ModelSerializer):
class Meta:
... |
986,555 | 10ec818e13f6b00528ed73890e36e79d98a9e12c | x, y, z, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
A = A[::-1]
B = B[::-1]
C = C[::-1]
a = 0
b = 0
c = 0
visited = [[0 for i in range(max(x, y, z))] for i in range(3)]
myA = 0
... |
986,556 | 0fbd9d06737277c55c085ba33f022fd608b9ed89 | '''OPGAVE
Schrijf een functie groep waaraan een reeks (een lijst of een tuple) van strings moet doorgegeven worden die een groep stenen voorstelt.
De functie moet een dictionary teruggeven die de gegeven groep stenen voorstelt.
Schrijf een functie uitleggen waaraan twee dictionaries moeten doorgegeven worden. De eerst... |
986,557 | d4660f0ff279ccec93ace2f6f781cd33ea8d1ea5 |
SUMPAR = 0
SUMIMP = 0
CUEPAR = 0
for I in range(0,271,1):
NUM = int(input("Ingresa un numero entero positivo: "))
if NUM != 0:
if ((-1) ** NUM) > 0:
SUMPAR += NUM
CUEPAR += 1
else:
SUMIMP += NUM
else:
I += 1
PROPAR = SUMPAR / CUEPAR
print(f"El p... |
986,558 | a475a2f47a1f4f084b72e5c7d5ff0c7276abd470 | #!/usr/bin/env python
from twisted.internet import reactor
from settings import settings
from webserver.site import site
def main():
print 'Start listening on http://localhost:8080/'
reactor.listenTCP(8080, site)
reactor.run()
if __name__ == '__main__':
from utils import autoreload
autoreload.m... |
986,559 | dbd5997fa3dd925790d0a6115bbd2bf470ca9620 | import numpy as np
import cv2
cap = cv2.VideoCapture('forward_6sec.mp4')
cap_rev = cv2.VideoCapture('reverse_6sec.mp4')
fgbg = cv2.createBackgroundSubtractorMOG2()
fgbg.setShadowValue(0)
kernel5 = np.ones((5,5), np.uint8)
kernel7 = np.ones((7,7), np.uint8)
kernel3 = np.ones((3,3), np.uint8)
i=1
while(1):
ret, frame... |
986,560 | f72fd2f37f7f077344325d4fa23d52c7d214d9bf | import sys
import os
path = os.getcwd()
sys.path.append(os.path.join(*[path, "bin"]))
from source.component import Slot, Car
class Singleton(object):
_instance = None
def __new__(cls, *args, **kwargs):
if not cls._instance:
cls._instance = super(Singleton, cls).__new__(cls, *args, **kwar... |
986,561 | 2736716763d80400edf1e35163103d6a269c062b | import numpy
import skimage.io
import sys
fnames = sys.argv[1:]
for fname in fnames:
im = skimage.io.imread(fname)
if numpy.count_nonzero(im[0:2, :, :]) == 0:
continue
print(fname)
im2 = numpy.zeros((im.shape[0]+4, im.shape[1]+4, 3), dtype='uint8')
im2[2:-2, 2:-2, :] = im
im2[0:2, :, :... |
986,562 | ff8164af9bf7e1c0344478d001fdd014a681dfcc | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# auth: wallace.wang
import imp
import json
from tornado import web
from com.utils.MyLog import MyLog
from utils.handlerData import handler_data
from utils.auth import AuthToken
class AuthHandler(web.RequestHandler):
def initialize(self):
"""
identit... |
986,563 | 54d6533af09dda94939ef42cafd2f9ce333e9638 | import time
from django.test import TestCase
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
from django.conf import settings
class TestLogin(TestCase):
def setUp(self):
chrome_options = Options()
chr... |
986,564 | a09bd54b3b5682dd6889885afeaa005924c8e573 | import urllib.request
import json
from group import Group
from member import Member
class Jsonstream:
def get_json_object(self):
url = "https://toonhq.org/api/v1/group/"
headers = {"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0"}
request = url... |
986,565 | 32a0f77d4e0b7a5d62079edb89bbfa5411f7553f | from django.db import models
class ChatObjManager(models.Manager):
def save_via_form(self,*args,**kwargs):
#{'mesenge': 'asdas', 'status': 'O', 'change_user': <SimpleLazyObject: <CustomUser: fdsd dfg>>, 'task_id': 1}
cls = {}
cls['mesenge'] = kwargs['mesenge']
cls['change_user'] ... |
986,566 | d49239ccbd22233e659ae98896896722f5af09db | import pprint
from gdax_client import get_balance as get_gdax_balance
from binance_client import get_balance as get_binance_balance
INVESTED = 11000
def merge_balances(b1, b2):
balances = {}
for k, v in b1.iteritems():
if k not in balances:
balances[k] = v
else:
balan... |
986,567 | 334321d46112aec057616ee504108f75c5a33dce |
"""
Testing module for httpimport
"""
__version__ = '0.3.4'
__name__ = 'searcher'
__author__ = 'AK'
|
986,568 | 30a84e0ee12f6ebae9c35051698cc79468fc9b77 | r_HBx = 11.5 # HB vertical radius
r_HBfym = -4.13 # HB entrance -y
r_HBfyp = 11.75 # HB entrance +y
r_HBmenym = -5.45 # HB mag entrance -y
# (4.13 + (20.06/115.22) * (11.71 - 4.13))
r_HBmenyp = 11.74 # HB mag entrance +y
r_HBmexym = -10.25 # HB mag exit -y
# (4.13 + (95.19/... |
986,569 | 1626b8c11fd1aeb1ed9d15aecd651c203d472546 | import os
import sys
import warnings
from pathlib import Path
import pandas as pd
from classifiers.basic import BasicClf
from classifiers.personal import PersonalClf
from utils.csv_generator import CSVGenerator
from utils import ctmtocsv
def warn(*args, **kwargs):
# Used to remove warnings to prin... |
986,570 | d071a7bc85dba350e646659bb532442163d4f364 | import cv2
import numpy as np
def rotate(ImageName):
img = cv2.imread(ImageName, 1)
# 0 means Black and white image and 1 means coloured
shape = img.shape
rotate = np.zeros((shape[0], shape[1]), dtype=object)
for i in range(len(img)):
for j in range(len(img[i])):
x = len(img)... |
986,571 | aa99a49fe2a4738c221bc6fe53511af0c0e933ba | #
# Sharded Library
# Authors: Tomas, Nick, Tianyu
#
# This library allows you to configure one computer to run a python program with
# the power of multiple computers.
#
# On each of the Workers (auxilary computers), run run_worker.py, please ensure
# the computer is configured with any libraries code that needs to ... |
986,572 | 04f0d4a252e43e482942d569493767aa0ac3843a | from collections import deque
def recursive(list, result):
if len(list) == 1 :return result
if len(list) == 2: return result +1
if list[2] == 0: return recursive(list[2:], result +1)
return recursive(list[1:], result +1)
def jumpingOnClouds(c):
return recursive(c, 0)
print(jumpingOnClouds([0,... |
986,573 | e917961af8fc85336f601a46c1a9baffbaf726b9 | '''
Created on Sep 26, 2015
@author: sumit
'''
import logging
from cookielib import logger
class GetStaticFile(object):
'''
classdocs
'''
def __init__(self, params):
logger = logging.getLogger(__name__)
'''
Constructor
'''
@staticmethod
def get_stati... |
986,574 | 870906025ad463dc1d91b278fa904b1d6eac33c2 | """
Plot the energy spectra for the Hamiltonian of two coupled SSH chains
system defined in the article:
Li, C., Lin, S., Zhang, G., & Song, Z. (2017). Topological nodal
points in two coupled Su-Schrieffer-Heeger chains. Physical Review B,
96(12), 125418.
as a function of the hoppings v/t on a 2xN ladder with open... |
986,575 | 3d4c67ca7e70470c590db1e467607f5f0b74852e | add_two_numbers = 2 + 2
print(add_two_numbers) |
986,576 | a1b402311f6b89be2ab44ac61ee284044135aed7 | import argparse
parser = argparse.ArgumentParser(description="""Preprocess data, creating the subtokens.txt file from
subtokens, train_nodes from python100k_train.json, or test_nodes from python50k_eval.json
""")
parser.add_argument('--generate-subtokens', action="store_true", help="Generate subtokens file from infile... |
986,577 | a66860390243e59db957d1f9bdb78fe226314762 | from scrapy.cmdline import execute
# execute("scrapy crawl cyb_link".split(" "))
# execute("scrapy crawl sh_link".split(" "))
# execute("scrapy crawl sz_link".split(" "))
# execute("scrapy crawl company_info".split(" "))
# execute("scrapy crawl info_lrb".split(" "))
# execute("scrapy crawl info_zcfzb".split(" "))
exec... |
986,578 | ba64020cfbb8057edfd63432a65463631d63820c | # -*- coding: utf-8 -*-
"""
Created on Mon Apr 15 18:49:08 2019
@author: Tara
"""
p = [-4, 6, 2, 0]
#my polynomial is 2x^2 + 6x - 4
j = []
h = []
def polynomial(x):
for ii in range(len(p)):
k = x**i
j.append(p[ii]*l)
return sum(j)
print(sum(p(-4)))
def p_derivative(n):
for i... |
986,579 | 5468b67652e0d906310b1a80c62400283c4652fc | """
We want to make a row of bricks that is goal inches long.
We have a number of small bricks (1 inch each) and big bricks (5 inches each).
Return True if it is possible to make the goal by choosing from the given bricks.
This is a little harder than it looks and can be done without any loops.
make_bricks(3... |
986,580 | 7074ebd54fd41881f5876af1388fc750ae94a6c7 | from django.db import models
from django.contrib.auth.models import User
class Post(models.Model):
title=models.CharField(verbose_name="Ad",max_length=123,default="Başlık")
image1=models.ImageField(verbose_name="Profil",blank=True,null=True)
who=models.TextField(max_length=500,verbose_name="Hakkımda",bla... |
986,581 | de5ec303648ca6044478ee2ac4d9e36d03365ab0 | """
This module contains template tags for instance for a unified pagination
look and feel.
"""
from django.conf import settings
from django.utils.dateformat import format
from django import template
register = template.Library()
@register.filter('datetime')
def datetime(value):
return format(value, settings.DATE... |
986,582 | 9403376a20ce6e58aa165c9abce3b07fa45c5945 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from pandas_datareader import data, wb
if __name__ == '__main__':
# collect time series for S&P 500
sp500 = data.DataReader('^GSPC', data_source='yahoo', start='1/1/2000')
# estimate two-month and one-year trends
sp500['42d'] =... |
986,583 | 622c58529bf02615e838445cce8cfe79caf2c791 | # llia.synths.orgn.orgn_pp
from __future__ import print_function
import llia.util.lmath as math
from llia.performance_edit import performance_pp
def amp_to_db(amp):
return int(math.amp_to_db(amp))
def pp_rdrum(program, slot=127):
def db (key):
amp = program[key]
rs = int(amp_to_db(program[... |
986,584 | 82b3c000ed38b079b554c0927cd4c2e86e9f2484 | from collections import namedtuple
from typing import List
class Stack:
def __init__(self, id: int, timestamp: int, clazz: str, frames: List[str]):
self.id = id
self.ts = timestamp
self.clazz = clazz
self.frames = frames
def eq_content(self, stack: 'Stack'):
return sel... |
986,585 | 1dbf3730eb617813320194d54b2c429e615c742f | # -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html
import scrapy
from scrapy import Field
class InformationItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
table_nam... |
986,586 | 95c033185c3884dce7d5ab1f94afa4bb6f171b94 | from .api import MediaCloud
from .storage import *
__version__ = '2.53.0'
|
986,587 | a049ff67818b26540379811581401cdf50b0efe6 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
"name": "Odoo Logs",
"version": "0.0.1",
"category": "Tools",
"installable": True,
"application": True,
"depends": ["ihub"],
"data": [
],
}
|
986,588 | d096dffe20a6b1ebc702b0a02d0a388f2bb1a52f | from rlsa import rlsa
import cv2
import pandas as pd
import copy
def get_block_stats(stats, centroids):
"""
Get block stats in a pandas DataFrams
Parameters:
stats ():
centroids ():
Returns:
block_stats ():
"""
stats_columns = ["left", "top", "width", "height", "area"]... |
986,589 | 76130618b1f826d77103b3521c9c40a3f70ea811 | import os
from os.path import join
from sets import Set
import tempfile
from kjbuckets import kjGraph
from useless.base import Error
from useless.base.util import ujoin, RefDict, strfile, filecopy
from useless.sqlgen.clause import one_many, Eq, In
from useless.db.midlevel import Environment
from paella.base.objects... |
986,590 | 1832fc677724dd34120d85b9a296731ed67c65c3 | '''
environments
tundra, space, rainforest
desert, grassland, jungle, ocean, rainforest, space, tundra
'''
INSTANT_DEATH = -100
DEATH = -50
POOR = -20
NEUTRAL = 0
FAIR = 20
EXCEPTIONAL = 50
ENVIRONMENTS = ['desert', 'grassland', 'jungle', 'ocean', 'forest', 'tundra', 'arctic']
SKIN = {'fur': {'arctic': EXCEPTIONAL, ... |
986,591 | 0b4c92cfd92691dd2abbf47ca394fa84de19b2cb | from sqlalchemy import inspect
from jet_bridge_base.serializers.model_serializer import ModelSerializer
def get_model_serializer(Model):
mapper = inspect(Model)
class CustomModelSerializer(ModelSerializer):
class Meta:
model = Model
model_fields = list(map(lambda x: x.key, ma... |
986,592 | 96ea1c2014f4b0c2fb0e78c6721bc5f7564e3fd7 | #//
#//----------------------------------------------------------------------
#// Copyright 2010-2011 Synopsys, Inc.
#// Copyright 2010 Mentor Graphics Corporation
#// Copyright 2010-2011 Cadence Design Systems, Inc.
#// Copyright 2019-2020 Tuomas Poikela (tpoikela)
#// All Rights Reserved Worldwide
#//
#// ... |
986,593 | 484f4ac67c624021605f23807470cf4e00cd30e9 | from tornado import gen, web, tcpserver, iostream
import struct, socket
import logging, ujson
from bridge import message_factory
logger = logging.getLogger(__name__)
# connection from BOT to SCRAPER
class ScraperTCPConnection(object):
def __init__(self, stream, server):
self.stream = stream
self.server ... |
986,594 | e376735aa4c71287878058e0a0a3b6832b2b448a | import pylab
import sklearn
from sklearn import svm
from sklearn.ensemble import RandomForestClassifier
import pandas as pd
from sklearn.cross_validation import cross_val_score
import numpy as np
from sklearn.cross_validation import StratifiedKFold
from random import shuffle
import gzip
import sys
# ### Ingest data:
#... |
986,595 | 2d7d7e78ebbdd09f0867dcba881bc5d7f38952fc | import unittest
from unittest.mock import patch
from app.utils.handlers.notification_handler import NotificationHandler
class TestNotificationHandler(unittest.TestCase):
def test_init(self):
notification_handler = NotificationHandler('title', 'subtitle', 'description')
self.assertEqual(notificati... |
986,596 | 2d4575135be019ca30d7702e234bf95c0d3a1f1f | """empty message
Revision ID: 540209e25f1d
Revises: f69a6dfd554a
Create Date: 2021-09-27 15:59:32.223483
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '540209e25f1d'
down_revision = 'f69a6dfd554a'
branch_labels = None... |
986,597 | cc9ec17de3b552cf5865a92c3fcdf5d8ab62e875 | import scrapy
from scrapy import Selector
from scrapy.shell import inspect_response
from scrapy_splash import SplashRequest
#This function can extract all the singaopre hotel url on the current page, press the next button, and continue until end of hotel
MAIN_URL = 'https://www.tripadvisor.com.sg'
class TravelSpide... |
986,598 | f68920abc036f470bd919e98f467f74468cbb3a4 | from . import views
from . import api
from django.conf.urls import url
from django.contrib import admin # We can remove this later on.
from django.urls import include, path # Do we need to import path..?
from django.views.decorators.csrf import csrf_exempt
from rest_framework import routers
from rest_framework.authto... |
986,599 | 971af3e0b1ed7ae92e6e2fe93d7828d7e0736722 | from marshmallow import Schema, fields, validate
class UserSchema(Schema):
name = fields.Str(required=True, allow_none=False, )
username = fields.Str(required=True, allow_none=False, )
twitter_username = fields.Str(required=True, allow_none=True)
github_username = fields.Str(required=True, allow_none=... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.