index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
11,800 | 1ed36610592ce4ea2d4b797da8a87fac8419a6d8 | #!/usr/bin/python
# -*- encoding: utf-8 -*-
# Copyright 2015 LeTV Inc. All Rights Reserved.
__author__ = 'guoxiaohe@letv.com'
"""
using for content desktop spider
"""
import traceback
import re
from scrapy.http import Request
from scrapy.selector import Selector
from scrapy.spider import Spider
from scrapy import log
... |
11,801 | 770bbdbd0a29ccea60efce362b7229e09dc4f437 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'openProjectWindow.ui'
#
# Created by: PyQt5 UI code generator 5.11.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog... |
11,802 | 61a486eb3b0856c72b03d6f34b6be4fc7b27c63e | #encoding:utf-8
from django.forms import ModelForm
from django import forms
from principal.models import Arbitro, Jugador, Pareja, Partido, Pista
from django.contrib.auth.models import User
class JugadorForm(ModelForm):
class Meta:
model = Jugador
class ParejaForm(ModelForm):
class Meta:
model = Pareja... |
11,803 | 81b300ddd5f55a754a8b88a6ecdda92b8accb51c | from Author import Author
from Blog import Blog
from Post import Post
from Tag import Tag
from Comment import Comment |
11,804 | 0766361b1ccad03d58c41e003b72561e1d574fee | # Generated by Django 3.1.5 on 2021-01-24 10:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0005_auto_20210124_1034'),
]
operations = [
migrations.AlterField(
model_name='topic',
name='learning',
... |
11,805 | 3b321e3703baa0853289b0b6a31f06555fd28e72 | # 14500.py 테트로미노
def back(x, y, k, total):
if k == 4:
global MAX
MAX = max(MAX, total)
return
# ㅗ 모양
if k == 2:
tmp = []
for dx, dy in (-1, 0), (1, 0), (0, -1), (0, 1):
nx, ny = x + dx, y + dy
if -1 < nx < N and -1 < ny < M and not visit[nx][n... |
11,806 | 5a854b745f9a32e83486c547159092e6a53073ca | # -*- coding: utf-8 -*-
numero = int(input("digite o valor de numero="))
PAR = (numero*0.5)
z = PAR%2
q = PAR%4
s = PAR%6
o = PAR%8
if z or q or s or o :
print("PAR")
else :
print("IMPAR")
|
11,807 | cf497f5c8c497bde159b23d7ac132c1877be1d8f | """
This short program applies the boundary recoverer operation to check
the boundary values under some analytic forms.
"""
from gusto import *
from firedrake import (as_vector, PeriodicRectangleMesh, SpatialCoordinate,
ExtrudedMesh, FunctionSpace, Function, errornorm,
Vect... |
11,808 | d178f6e24513ac9fac633afdc7598d068db0d4ea | class Solution:
def shuffle(self, nums: List[int], n: int) -> List[int]:
mid = len(nums) // 2
x, y, arr = nums[:mid], nums[mid:], list()
lenx, leny = len(x), len(y)
for i in range(lenx+leny):
arr.append((x if i % 2 == 0 else y).pop(0))
return arr
|
11,809 | f5cc500aac2f3b3e3c4ae80f12670e7cf32082d8 | import asyncio
import os
from zuscale.providers import ALL_CLOUDS
zuscale_hosts = []
async def get_hosts():
for provider, _cloud in ALL_CLOUDS.items():
# Skip providers that are not the provider specified in environ.
if "PROVIDER" in os.environ and provider != os.environ["PROVIDER"]:
... |
11,810 | da40af1027a26565b5b94fcda72e3e0325617a41 | """
Author: Yijia Xu
Usage:
# Detect the child speech segments based on the manually annotated mom speech segments,
# modify mom speech segment intervals, and output both to textgrids
# export both wav segments, and transcribe them using kaldi ASPIRE model
# write transcription results to json file
$ pyt... |
11,811 | c4ac94da8d4e8eddd9a0739e359ffd35d17efe94 | """
_simulations_options.py: Parses position initialization options for simulations.
Copyright (c) 2020 Charles Li // UCSB, Department of Chemical Engineering
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 t... |
11,812 | 3b887afa0cf1f136abb6773b5af90b02bc24b787 |
from flask_restful import Api
from .Task import Task
from .TaskBYID import TaskBYID
from app import flaskAppInstance
restServer=Api(flaskAppInstance)
restServer.add_resource(Task, "/api/v1.0/task")
restServer.add_resource(TaskBYID,"/api/v1.0/task/id/<string:taskId>")
|
11,813 | f4d252815aff9139353a0d0b37e51532b0d775f7 | #This program is used to just clean up the Pronunciation Dictionary and
#remove all the consonants
def main():
print("testing 123")
file = open("PronunciationDictionary.txt")
word_dict = {}
consonant_set = {"B", "CH", "D", "F", "G", "K", "L", "M", "N",
"NG", "P", "R", "S", ... |
11,814 | 9f48090fe110438d33bd79cd92b01930758ce719 | from django.apps import AppConfig
class FamedicUsersConfig(AppConfig):
name = 'famedic_users'
|
11,815 | 199e588c33ecc1465eaf973d4a0766effcb61896 | from pack import all_packs, cust_packs
|
11,816 | 6bf1fd682a6ff9427d37383340eb9861fec9bcda | from PIL import Image
from tempfile import NamedTemporaryFile
import os
def is_image_compressable(path):
ACCEPTABLE = [".jpg", ".png"]
ext = os.path.splitext(path)[1].lower()
return ext in ACCEPTABLE
def _detect_valid_format(path):
ext = os.path.splitext(path)[1].lower()
return {".jpg": "jpeg", ... |
11,817 | 9e4c6530739f7f3e5a64bfdbfaa3ce0e4966d61d |
from __future__ import division
a = int(input())
b = int(input())
m = int(input())
print(int(a/b))
print(a%b)
print(divmod(a, b)) # Divmod is in built python function gives you division, and remainder
# PowerMod
print(pow(a,b))
print(pow(a,b,m))
|
11,818 | bdadf47612db4b10bf758e6d7084cd75be07b437 | import re
# caracter "?": o caracter anterior pode vir uma ou nenhuma vez.
regex = re.compile('a?b')
print(regex.match('b'))
print(regex.match('ab'))
print(regex.match('aab'))
# {m,n}: pode implementar qualquer um dos repetidores que vimos anteirormente. m e n são parâmetros integer.
# m: caracter anterior terá pelo ... |
11,819 | 49a9211ba4c974a704439fd470109c99fb696756 | import math
import matplotlib.pyplot as plt
N = 10
print("Com uma lista de %d elementos" %N)
print("Busca linear = %d" %N)
print("Busca binária = %d" %(math.log2(N)+1))
n = list(range(1,N))
p = [math.log2(i)+1 for i in n]
plt.title("Performance busca linear x busca binária")
plt.xlabel("Quantidade de elementos")
plt... |
11,820 | 31631cd068fcd30f22bca973207856fcb7f4ebe1 |
# coding: utf-8
# In[33]:
import tensorflow as tf
import tensorflow.keras as keras
import tensorflow.keras.backend as K
from sklearn.metrics import confusion_matrix, precision_recall_fscore_support
from tensorflow.keras.layers import Conv2D, MaxPooling2D, Dense, Flatten, Dropout
from tensorflow.keras.layers import... |
11,821 | fcf9e82ce1523a9b72c9992a2c969edb51f8089d | print("%d" % 432)
print("%d %d" % (432, 345))
print("%f" %432.123)
print("%f %f" %(432.123, 10.3))
print("%f" %432.123456)
print("%f" %432.12345651)
print("%s" % "GeekyShows")
print("%s %s" % ("Hello", "GeekyShows"))
print("%d %s" % (432, "GeekyShows"))
#print("%s %d" % (432, "GeekyShows")) TypeError
print("%(nm)s ... |
11,822 | 4372c94c18afafbf0b148da02d718319c3f6c8eb | # -*- coding: utf-8 -*-
"""Gasoline signals."""
from flask.signals import Namespace
__all__ = ['event']
signals = Namespace()
# used to notify various events
event = signals.signal('event')
# used to notify activity
activity = signals.signal('activity')
# triggered at application initialization when all plugins h... |
11,823 | 148b9613dc46a6b2c68b898657b1fded522bf4e9 | #!/usr/bin/python
#-*-coding:utf8-*-
from pprint import pprint
from weibopy.auth import OAuthHandler
from weibopy.api import API
from weibopy.binder import bind_api
from weibopy.error import WeibopError
import time,os,pickle,sys
import logging.config
from multiprocessing import Process
import sqlite3 as sqlite
import... |
11,824 | 50bef73e8d6d216e9d2a68ef462d1b37e3a71671 | class employee:
_employee_name = ''
_employee_salary = 0.0
_employee_designation = ''
def __init__(self, employee_name, employee_salary, employee_designation):
self._employee_name = employee_name
self._employee_salary = employee_salary
self._employee_designation = employee_designation
def get_emp... |
11,825 | 9b8fde63a99d8626218022892048061a91ea0691 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from config.template_middleware import TemplateResponse
from tekton import router
from gaecookie.decorator import no_csrf
from gaepermission.decorator import login_not_required
from classificacaof1_app import facade
from routes.classificac... |
11,826 | 4a37fd7798268796b57220e9f08a88f4a645bafc | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2019 Ben Kurtovic <ben.kurtovic@gmail.com>
#
# 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 ... |
11,827 | de4dc0d7e09c2e5c2909673d0c6eef402351bf9c | #!/usr/bin/python3
import pandas as pd
from pandas.compat import StringIO
import os
from pathlib import Path
import subprocess
import re
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
# identify folder path
filepath = '/var/www/wou/tmp/'
# identify upload target filename
with open("/var/ww... |
11,828 | 166f1dca5c8c995701224886a4e8e1cff2c9b023 | import csv
file = open("./jian.txt","r")
file2 = open("./fan.txt","r")
read = csv.reader(file)
read2 = csv.reader(file2)
a = ""
b= ""
for line in read:
a = line[0]
for line2 in read2:
b = line2[0]
print(a)
print(b)
with open("./all.txt","a+",encoding="utf-8") as f:
f.write("{")
if len(a) == len(b):
... |
11,829 | e8720c2715321e10c040c94db7a949ed9ba84a35 | from .flowsomtool import flowsom
from .__version__ import __version__
__all__ = ['flowsom', '__version__'] |
11,830 | f21f10effdc2dfcc8c258faad991a36964ccb9d4 | import numpy as np
from tf_util.tf_logging import tf_logging
class NLIPairingTrainConfig:
vocab_filename = "bert_voca.txt"
vocab_size = 30522
seq_length = 300
max_steps = 100000
num_gpu = 1
save_train_payload = False
class HPCommon:
'''Hyperparameters'''
# data
# training
ba... |
11,831 | 37c91cacbd4ba5752809b3811df72794bc81da93 | #!/usr/bin/env python
# -*- coding: ascii -*-
"""
Festis.telestaff: downlaods data from telestaff
"""
__author__ = 'Joe Porcelli (porcej@gmail.com)'
__copyright__ = 'Copyright (c) 2017 Joe Porcelli'
__license__ = 'New-style BSD'
__vcs_id__ = '$Id$'
__version__ = '0.1.0' #Versioning: http://www.python.org/dev/peps/pep... |
11,832 | 5bf052868fbe272947118bc72c7fd3d6d6817182 | import itertools
import math
l = []
n = int(input())
for i in range (n):
xy = list(map (int,input().split()))
l.append(xy)
com = list(itertools.combinations(l, 3))
for j in range (n*(n-1)*(n-2)//6):
if com[j][0][0] - com[j][1][0] == 0:
if com[j][2][0] == com[j][0][0]:
print('Yes')
... |
11,833 | 58580d3026c1ea44bfadf30562900bcc9f99b0dd | from django.conf.urls import url
from .views import ChannelsView
from .views import ChannelsDetailView
urlpatterns = [
url(r'^$', ChannelsView.as_view(), name='list'),
url(r'^channels/(?P<uid>[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12})', ChannelsDetailView.as_view(), name='detail'... |
11,834 | df213ebee6ea1d39d86d854d407774e9896212df |
from flask import Flask, jsonify, request
import spotifyconnect
app = Flask('SpotifyConnect')
# #API routes
# Login routes
@app.route('/login/_zeroconf', methods=['GET', 'POST'])
def login_zeroconf():
action = request.args.get('action') or request.form.get('action')
if not action:
return jsonify(... |
11,835 | c97f4366a10ee02cc81685bc96c3561f75f0c3ad | __all__ = ['block', 'connection', 'entity', 'facing', 'minecraft', 'nbt', 'util', 'vec3']
|
11,836 | 25302cbaca1e8214af167b4bd0bd235b493821d4 | # encoding: utf-8
# module PyQt4.QtGui
# from /usr/lib64/python2.6/site-packages/PyQt4/QtGui.so
# by generator 1.136
# no doc
# imports
import PyQt4.QtCore as __PyQt4_QtCore
class QPainterPath(): # skipped bases: <type 'sip.simplewrapper'>
# no doc
def addEllipse(self, *args, **kwargs): # real signature unkn... |
11,837 | b9c5b85ad7a2caccac689e6b5391c55a66aad5f5 | import numpy as np
import os
from os.path import join as pjoin
import pandas as pd
import tqdm
from dipy.io.image import load_nifti
import seaborn as sns
import matplotlib.pyplot as plt
import scipy.stats as stats
PPMI_PATH = '/media/theo/285EDDF95EDDC02C/Users/Public/Documents/PPMI'
ADNI_PATH = '/media/theo/285ED... |
11,838 | bbe01509133f9bf461cb809e398cb5a7ab5b2969 | #线性插值法
def linear(x,x1,x2,y1,y2):
if x2-x1==0:
result=y1
else:
result=y1+(x-x1)*(y2-y1)/(x2-x1)
return result |
11,839 | 8c6db741398a6c8a336b7635f94cb603f487938e | # -*- coding: utf-8 -*-
"""
@author: Gregory Krulin
Added variable HumanCount to store count of rock paper or scissor choice as
naively counting is too costly when amount of rounds increases
Added function fequency to assign probability list
"""
import numpy as np
from random import randint
def UpdateGame... |
11,840 | 49fa5dea62da0ee4902f20ca185615f972bace57 | # Enter your code here. Read input from STDIN. Print output to STDOUT
# input defect probability (p) and failure trial (n)
nums = list(map(int, input().split()))
p = nums[0] / nums[1]
n = int(input())
# print rounded geometric distribution probability
print(round(((1-p)**(n-1)) * p, 3))
|
11,841 | 63f8be70d2c6630de6b98c90ff2a2f86ddb9ad25 | from kata import two_sum as ts
def test_two_sum_success():
nums, target = [2,7,11,15], 9
summer = ts.Solution()
# assert summer.twoSum(nums, target) == [0,1]
nums, target = [3,2,4], 6
assert summer.twoSum(nums, target) == [1,2]
nums, target = [3, 3], 6
# assert summer.twoSum(nums, target... |
11,842 | a682ac928073ddfed2ff44c24c1cbebb43a0671e | def get():
i=int(input("请输入当月利润为:"))
salary = 0
if i<=10:
salary=i*0.1
print("应发放奖金为%d"% salary)
elif i>10 and i<=20:
salary=(10*0.1)+(i-10)*0.075
print("应发放奖金为%d" %salary)
elif i>20 and i<=40:
salary=(10*0.1)+(10)*0.075+(i-20)*0.05
print("应发放奖金为%d" %salary)
else:
salary=(10*0.1)+(10)*0.... |
11,843 | c69343ae5ecb50d8eb7a46a39c9209e4ee625b10 | def sum_array(array):
'''
Args:
array: an array or list containing values.
Returns:
int: the sum of the array/list
Examples:
>>> sum_array([1,2,3])
6
'''
if len(array) == 0:
return 0
else:
return array[0] + sum_array(arra... |
11,844 | ae7ce020d2a245a04013e5cd0ee4ade9d5500e8c | class Locker:
def __init__(self, adminno, date, location, size, lockerno):
self.__id = ''
self.__adminno = adminno
self.__date = date
self.__location = location
self.__size = size
self.__lockerno = lockerno
def get_id(self):
return self.__id
def set_... |
11,845 | 417058ff65bfb0a7005c82e60c74a1e191229f5b | SlabColourChosen = ""
ConstSlabColourOptions = ["grey", "red", "green"]
SlabColourCustom = ""
SlabColourCheck = False
SlabColourCustomCheck = False
SlabDepthChosen = 0
ConstSlabDepthOptions = ["38", "45"]
SlabDepthCheck = False
ConstSlabShapeOptions = ["square", "rectangle", "round"]
SlabShapeChosen = ""
Slab... |
11,846 | 74abd1329835a3b89531082ca883c31f4e4cf641 | #!/usr/bin/env python2.7
# ROS python API
import rospy
# Laser pixel coordinates message structure
from drone_laser_alignment.msg import Pixel_coordinates
# Joy message structure
from sensor_msgs.msg import Joy
# 3D point & Stamped Pose msgs
from geometry_msgs.msg import Point, Vector3, PoseStamped, TwistStamped
from ... |
11,847 | 7c5406c01403c200d7ff3b6c9f98c5f3e89e03ec | name = ""
output = "string"
if not name:
output = "One for you, one for me."
else:
output = "One for " + name + " , one for me."
print(output) |
11,848 | 365728666e057160e6e487ec2beae62dee47e980 | # -*- coding: utf-8 -*-
from django.core.exceptions import ValidationError
from rest_framework import serializers
from formidable.models import Formidable
from formidable.serializers import fields
from formidable.serializers.common import WithNestedSerializer
from formidable.serializers.presets import PresetModelSeri... |
11,849 | d6486d9b8d87fb982880829ba1a44aefb303278e | from Bio.Seq import Seq #Using Biopython to find the reverse complement.
f = open("rosalind_dbru.txt","r") #extracting the input from a file.
inputv = f.readlines()
s = []
for i in inputv:
s.append(i.strip())
srv = []
for i in s: #determining the revese co... |
11,850 | 4c50a6e03937b97f47a184a3752897f6077a8032 | #Atividade 1 - 08/04 - Marcos Silva 1902671
num1 = int(input())
num2 = int(input())
mult = 1
num = 0
while mult <= num2:
num = num + num1
print(num)
mult = mult + 1
|
11,851 | a086065db79c5bdc4938ac961beefcb741a698da | import requests
import json
import sys
userData = {
"username": "wz634",
"password": "root",
}
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
requests.post('http://localhost:3000/login', data = json.dumps(userData), headers = headers) |
11,852 | 394b90a65ebe5a8e9df3e8bf61b163b57dfcd4b2 | # Generated by Django 2.2.5 on 2019-09-18 18:30
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('CareerFlash', '0014_auto_20190918_0310'),
]
operations = [
migrations.AddField(
model_name='profil... |
11,853 | 4a611644722a15e30454c3048cd2b158a4a9b94c | #coding:utf8
import socket
import time
import threading
class Client:
def __init__(self,address,port,nickname):
self.address=address
self.port=port
self.client_socket=None
self.nickname=nickname
def socketConnect(self):
self.client_socket=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
... |
11,854 | b9177113405bf270f1adfeba5f46408c5d27eecc | #!/usr/bin/python
import socket
import cPickle
import os
import sys
import signal
PORT = 54321
def handle(cs, addr):
print "Conn from", addr
cs.sendall("HAI\n")
try:
l = cPickle.loads(cs.recv(1024))
#cs.sendall("--- pickle.loads() --- %s\n" % l)
s = sum(l)
#cs.sendall("--... |
11,855 | 826a0b36b408e499ef850e9eccd117f696037f10 | from rest_framework import views
from rest_framework.routers import DefaultRouter
from rest_framework.permissions import IsAdminUser
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework.urlpatterns import format_suffix_patterns
class SecuredDefaultRouter(DefaultR... |
11,856 | afcebef571f357e317951a469bc820b77218ea57 | #!/usr/bin/env python
import numpy as np
import math
import sys
filein=sys.argv[2];
infile_fs=open(filein,"r");
inlines=infile_fs.readlines();
length=len(inlines);
infile_fs.close();
infile_fs=open(filein,"r");
cell_p=8.386494280;
angle=float(sys.argv[1]);
delta=math.tan(angle/180.0*math.pi)*cell_p/4;
inline=infile_fs.... |
11,857 | d1c9f5375234c806f64df505a6b5af4c5914fe1d | #sending a mail
import smtplib
FROM="bogadipayal573@gmail.com"
TO="xxx@gmail.com"
SUBJECT="mail test"
TEXT="pyhton"
pwd="xxxxxxxxxxxxx"
message="SUBJECT:%s\n\n%s"%(SUBJECT,TEXT)
print(message)
server=smtplib.SMTP("smtp.gmail.com",587)
server.ehlo()
server.starttls()
server.login(FROM,pwd)
server.sendma... |
11,858 | 7640460ccfd68ec5eb290aaac5871102d6317ad5 | from pinkfrog.targetgroup.group_creator import TargetGroup |
11,859 | 5b897e5d26238a89ef063bed30d79746b8bc2cc7 | #mayor y nemor
campo1 = raw_input('primer numero: ')
campo2 = raw_input('segundo numero: ')
salir = str(raw_input('y'))
if campo1 < campo2:
print ("el menor es" ,campo1)
elif campo1 > campo2:
print ('el mayor es' ,campo1)
elif campo1 == campo2:
print 'ambos son iguales'
print 'desea salir?' ... |
11,860 | d5bf92200957b2ce27b8b846295a9e98a14b3e8a | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
# Create your models here.
#models.Model to convert a class to a Model
class Article(models.Model):
id = models.AutoField(primary_key=True)
title = models.TextField(max_length=254)
body = models.TextField()
likes = mode... |
11,861 | 37525033a33c665afc27eccfdf2867ce34cd00d2 | from flask import Flask, render_template, request, make_response, g
from redis import Redis
import os
import socket
import random
import json
exp_docker_low = os.getenv('EXP_OPTION_A', "exp_docker_low")
exp_docker_medium = os.getenv('EXP_OPTION_B', "exp_docker_medium")
exp_docker_high = os.getenv('EXP_OPTION_C', "exp_... |
11,862 | 80778df11dc069024bda791556d4003b2918ca47 | import re
def main():
'''Program to check weather the enter text is a valid email id or not'''
string = input('Enter the text to be checked for email id: ')
if re.findall(r'[a-z0-9]+(\.[a-z0-9]+)?@[a-z]+(\.[a-z]+)+',string) and not re.findall(r'\.\.',string):
print('The entered string is a vali... |
11,863 | e824107edc1bb1536e61676dd9009d41c14ef2a0 | # 494. 双队列实现栈
# 中文English
# 利用两个队列来实现一个栈的功能
#
# 例1:
# 输入:
# push(1)
# pop()
# push(2)
# isEmpty() // return false
# top() // return 2
# pop()
# isEmpty() // return true
# 例2:
#
# 输入:
# isEmpty()
from collections import deque
class Stack:
"""
@param: x: An integer
@return: nothing
"""
def __init__... |
11,864 | 7e6ae50604f752609b4ef64df51ab7638bb03804 | '''
Maximum sum of contiguous sub-array using DnC
'''
def helper(nums,l,m,h):
tot=0;leftsum=float('-inf')
for i in range(m,l-1,-1):
tot+=nums[i]
leftsum=max(leftsum,tot)
tot=0;rightsum=float('-inf')
for i in range(m+1,h+1):
tot+=nums[i]
rightsum=max(rightsum,tot)
... |
11,865 | 53cadab79b8c53c58f113cc6ab7f632e10f036de | import re
delimiter = "id is_deleted creator_id input_params log execution_finished_at"
f = open("allLogs.txt")
#data = f.read()
count = 0
for line in f:
queries = line.split("Query:")
for i in range(1, len(queries)):
fw = open('queries/q'+str(count)+'.txt', 'w')
fw.write(queries[i])
fw.close()
... |
11,866 | fdc0fde5bc40dfba16cbc29e2c8b620b6c7e19fc | # Generated by Django 3.2 on 2021-05-02 04:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('quiz', '0005_auto_20210501_1348'),
]
operations = [
migrations.AlterField(
model_name='home',
name='url',
... |
11,867 | e894d4cfe2804956e7c585513aad5af43fa0d00f | import datetime
import flask
import rds.mailChecker
import rds.load_datapage
from flask import Flask, g, request
from dateutil import relativedelta
import sqlite3
import flask_excel
from flask.json import jsonify
from flask_cors import CORS
app = Flask(__name__)
flask_excel.init_excel(app)
CORS(app)
@app.route('/d... |
11,868 | 99ad1ec03cce44f62cd0e9b6735323d6918c15fe | A1 = 1
A2 = 1
n = input("")
i = 2
while i < n:
A_sum = A2 + A1
A1 = A2
A2 = A_sum
i += 1
print (A_sum) |
11,869 | 737a140fd620cde47d7894794a60a0434462a6e7 | from microbit import *
button_long_a_pressed = "button_long_a"
button_long_b_pressed = "button_long_b"
button_a_pressed = "button_a"
button_b_pressed = "button_b"
button_together_pressed = "button_together"
button_long_together_pressed = "button_long_together"
class ButtonHandler(object):
both_button_pus... |
11,870 | dcd9971f0950373c77d8232a81304a753aaddd41 | # coding=utf-8
from concurrent import futures
import urllib2
import datetime
import time
import requests
from lxml import html
import urllib,urllib2,httplib,cookielib,os,sys
from bs4 import BeautifulSoup
import lxml.html
import socket, traceback
import random
import linecache
import base64
from pyDes import *
from xm... |
11,871 | 511e3a7f9480acb2dbd2d35ef97d5bc03705bf1e | # -*- coding: utf-8 -*-
"""
RNA Library Item
================
"""
import numpy
from typing import List, Dict
from neoRNA.library.shape_mapper.shape_profile_item import ShapeProfileItem
from neoRNA.library.shape_mapper.shape_reactivity_item import ShapeReactivityItem
from neoRNA.sequence.sequence import Sequence
fro... |
11,872 | 70584bad5605f5c6855f60dfb8a5cb90e9ceaad7 | #!/usr/bin/env python3
import discord
from discord.ext import commands
from db import insertNewPlayer, findCode, findDiscordId
TOKEN = "ENTERTOKENHERE"
client = commands.Bot(command_prefix="&")
@client.event
async def on_ready():
print(":: Bot launched")
await client.change_presence(activity=discord.Game("&... |
11,873 | 2de94e0eb629b89563421fb4e708be891337a338 | # https://www.codewars.com/kata/59c633e7dcc4053512000073/train/python
'''
Given a lowercase string that has alphabetic characters only and no spaces,
return the highest value of consonant substrings. Consonants are any letters
of the alphabet except "aeiou".
We shall assign the following values: a = 1, b = 2, c = ... |
11,874 | b0edfe48cb688e3a1cde9d1c71749970c57cbd37 | from netmiko import Netmiko
net_connect = Netmiko(
"10.223.252.122",
username="DSV.API",
password="bale-pE3WFx!",
device_type="cisco_ios",
)
print(net_connect.find_prompt())
net_connect.disconnect() |
11,875 | f63c3c4fd3ff6fc1607fa98d74632f9bf93b9af2 | #!/usr/bin/env python
# Copyright (c) 2017, Daniel Liew
# This file is covered by the license in LICENSE.txt
# vim: set sw=4 ts=4 softtabstop=4 expandtab:
"""
Read two result info files and generate a scatter plot of execution time
"""
from load_smtrunner import add_smtrunner_to_module_search_path
add_smtrunner_to_modu... |
11,876 | fd4a95a01065019a61ccd184f767dab0e5c978a9 | import numpy as np
from sklearn.ensemble import RandomForestRegressor
from sklearn import linear_model
import matplotlib.pyplot as plt
def create_dataset(samples, tile_size):
margin = (tile_size - 1) / 2
n = np.random.randint(0, high=40000, size=(samples))
i = np.random.randint(margin, high=120 - margin, ... |
11,877 | a575a42ad7c24df1d1ccfdfa9bfa1786f25834ee | import copy
import numbers
import astropy.units as u
import numpy as np
from EXOSIMS.util.get_dirs import get_cache_dir
from EXOSIMS.util.get_module import get_module
from EXOSIMS.util.keyword_fun import get_all_args
from EXOSIMS.util.vprint import vprint
class PlanetPopulation(object):
r""":ref:`P... |
11,878 | a217570b465bc9c19cb1cb9bcfc88ac00e036e7a | class NumStr(object):
def __init__(self, num = 0, string = ''):
self.__num = num
self.__string = string
def __str__(self):
return '[%d :: %r]' % (self.__num, self.__string)
__repr__ = __str__
def __add__(self, other):
if isinstance(other, NumStr):
... |
11,879 | df3c6199abf5b1fe76e04cf910ff19e1c1b05845 | import asyncio
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import datetime
import sys, traceback
import time
########################################
def get_prefix(bot, message):
prefixes = ['>?', 'lol ', '##']
if not message.guild:
return '?'
r... |
11,880 | 400b0c60ebe273f8999c0d21465ae7f633d22e3e | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from .models import CategoryChallenge, PlotChallenge, Challenge
# Register your models here.
#admin.site.register(Person)
admin.site.register(CategoryChallenge)
admin.site.register(PlotChallenge)
admin.site.register... |
11,881 | b2da068d2661b35b2a593308a59fb9bf14f3b087 | import os
import traceback
from click.testing import CliRunner
import show.main as show
show_interfaces_alias_output="""\
Name Alias
----------- -------
Ethernet0 etp1
Ethernet4 etp2
Ethernet8 etp3
Ethernet12 etp4
Ethernet16 etp5
Ethernet20 etp6
Ethernet24 etp7
Ethernet28 etp8
Ethernet32 ... |
11,882 | ed5356356efb918281fe52cb01afc123bcfcf8a2 | #!/usr/bin/env python3
import _thread
import sys
import cfg
import uuid
from xmlrpc.client import ServerProxy
from enums import ReduceStatus, Status
from fake_fs import FakeFS
import map_libs.word_count
import os
import importlib.util
import json
# fake mapper client for testing
# communication reducer and mapper
cla... |
11,883 | 7ea2331e02160fae3cb2c8f49aa850a76081c2b0 | import numpy as np
from typing import List
from classifier import Classifier
class DecisionStump(Classifier):
def __init__(self, s:int, b:float, d:int):
self.clf_name = "Decision_stump"
self.s = s
self.b = b
self.d = d
def train(self, features: List[List[float]], labels: List[int]):
pass
... |
11,884 | c57eaea649fe5e2df37a9609db2b2924c74dd74a | def align_legend(legend):
"""
Aligns text in a legend
Parameters
----------
legend : matplotlib.legend.Legend
"""
renderer = legend.get_figure().canvas.get_renderer()
shift = max([t.get_window_extent(renderer).width for t in legend.get_texts()])
for t in legend.get_texts():
... |
11,885 | b248c076e85cc61bc942113c77103b20e210dbfb | # 学校:四川轻化工大学
# 学院:自信学院
# 学生:胡万平
# 开发时间:2021/10/7 14:23
'''add () 通过重写 add ()方法,可使用自定义对象具有“+”功能
通过重写 len ()方法,让内置函数len()的参数可以是白定义类型
'''
a = 20
b = 100
c =a + b #两个整数类型的对象的相加操作
d = a.__add__(b)
print(c)
print(d)
class Student:
def __init__(self, name):
self.name = name
def __ad... |
11,886 | 28379fc36e57704ef7bae7468f92036a8cc92ab1 | hungry= input("Are you really hungry")
if hungry=="yes":
print("Eat Pizza")
else:
print("contimue github") |
11,887 | 27ec697bf60bfd38e0b286b9a54a62baa0f12c63 | import logging
from typing import List
import boto3
from item import Item
db = boto3.client("dynamodb")
try:
db.create_table(
TableName="items",
AttributeDefinitions=[
{
"AttributeName": "Id",
"AttributeType": "S"
}
],
KeySc... |
11,888 | 1a004af88ae3bbae54b005c489683d67c3caac80 | # This program is used to read 2 files. the first file is "Top25HalloweenSongs
#Contains halloween songs and the second one file is Top25HalloweenSongs_Comments
# contains a matching comment to the song information
# written on 10/16/17 by john paul lucia
HeaderStr = "## Welcome to my scary Halloween song sel... |
11,889 | c999cfe205a90a313253c00034b4aa1382b1e5ff | from django.apps import AppConfig
class PetConfig(AppConfig):
name = 'pet'
|
11,890 | 98d7ebdc7c12e4847c8e341dfd2e72f891850196 | n = int(input())
bala = 0
for i in range(n):
if 2**i == n:
bala = 1
break
if bala == 1:
print("yes")
else:
print("no")
|
11,891 | 3bfb2bba57d4b1d83954f381b9f09fb8023cdaba | # -*- coding:utf-8 _*-
"""
@author:Runqiu Hu
@license: Apache Licence
@file: data.py
@time: 2020/10/07
@contact: hurunqiu@live.com
@project: bikeshare rebalancing
* Cooperating with Dr. Matt in 2020
"""
import numpy as np
import pandas as pd
distance_matrix = pd.read_csv("/Users/hurunqiu/aaai/ffbs_dynamic/resources... |
11,892 | 5e657dbc100ecc58eecf22366b3e231623a6c51f | class atm(money):
def __init__(self, model, color, company, speed_limit):
self.model = model
self.color = color
self.company = company
self.speed_limit = speed_limit
def start(self):
print("started")
return 1
def stop(self):
print("stoppe... |
11,893 | 9c2c1007c4ca63f91c52ef62022ba28ed126a9d4 | def user_groups(request):
context = {
'user_groups': request.user.groups.values_list('name', flat=True)
}
return context
|
11,894 | 707935dd66e2acf746dfd1e6869620f7824e3289 |
def temporal_iou(span_A, span_B):
"""
Calculates the intersection over union of two temporal "bounding boxes"
span_A: (start, end)
span_B: (start, end)
"""
union = min(span_A[0], span_B[0]), max(span_A[1], span_B[1])
inter = max(span_A[0], span_B[0]), min(span_A[1], span_B[1])
if inter... |
11,895 | 8beb75233bccee2b5a79a068dd510eb4e84a4a22 | #
# commands.py
# Parses !sdvxin commands and does work based on the command
# # Only discord related work should be done, such as sending/editing/reacting messages
# # sdvx.in related work should be sent to sdvx.py
#
# External imports
import re
import configparser
import discord
# Internal imports
from command impo... |
11,896 | 18160c1a6e85d26f38962570129a619af01a8655 | # Generated by Django 2.2.4 on 2021-06-05 20:26
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('build_pc_app', '0012_auto_20210605_1100'),
('build_pc_app', '0012_order_user_order'),
]
operations = [
]
|
11,897 | 0e67127c1fe4667ff633cda6528f12de5a664035 | from django.db import models
# Create your models here.
class diagnosis(models.Model):
glucose = models.FloatField()
insulin = models.FloatField()
bmi = models.FloatField()
age = models.IntegerField()
def __str__(self):
return self.glucose
|
11,898 | 649d518fadae649669c00645c40d958dd8ac2058 | from __future__ import print_function
import math
import pandas as pd
import numpy as np
import random
import time
import tensorflow as tf
from sklearn.preprocessing import LabelEncoder
from sklearn.compose import ColumnTransformer
from sklearn.pipeline import Pipeline
from sklearn.impute import SimpleImputer
from skl... |
11,899 | 90b9437265487678ab458ffd044e83dbed0304f5 | x:int = 1
y:bool = True
x = False
y = 2
z = 3
x = z = 4
x = z = None
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.