index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
13,800 | a80de19d410872eb28e884f17815c1fffb29d156 | import numpy as np
def is_ccw(points):
"""
Check if connected planar points are counterclockwise.
Parameters
-----------
points: (n,2) float, connected points on a plane
Returns
----------
ccw: bool, True if points are counterclockwise
"""
points = np.asanyarray(points, dtype... |
13,801 | e8870f0e2ee8ddfb45cf9847dc870e8711991f76 | #! /usr/bin/env python
from sys import stdin
import numpy as np
from bisect import bisect
ntest = input()
for test in xrange(ntest):
n = input()
y = 0
z = 0
naomi = sorted([float(i) for i in stdin.readline().strip().split(' ')])
ken = sorted([float(i) for i in stdin.readline().strip().split(' ')]... |
13,802 | 82f5e2c2120104fd0529b8cf33da57343c86261e | # Generated by Django 3.0.2 on 2021-05-07 15:10
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='CsvImportado1',
fields=[
... |
13,803 | ce6c8a99e4dad584e41bd4e661f3c199cbaebd81 | """
* get simple rms vs mag stats for CDIPS LCs
* plot them.
* assess how many all-nan LCs there are.
* move allnan light curves to a graveyard directory to collect dust
* supplement the statsfile by matching against Gaia DR2 and CDIPS catalogs.
usage:
$ (cdips) python -u get_cdips_lc_stats.py |& tee logs/s6_stat... |
13,804 | 1c958beb4d01d57ae32dc6a9bc4d11b4400f8061 | height = float(input("Chiều cao?"))
weight = float(input("Cân nặng?"))
BMI = weight/(height**2)
print(BMI)
if BMI < 16:
print("Severly underweight")
elif BMI >= 16 and BMI < 18.5:
print("Underweight")
elif BMI >= 18.5 and BMI < 25:
print("Normal")
elif BMI >= 25 and BMI < 30:
print("Overweight")
else:... |
13,805 | 3be78019786bb386b09a2be94298c8f51fb63b3a | from sys import stdin
s = str(stdin.readline().strip())
result = []
while(s != '.'):
array = []
flag = 0
for i in range(len(s)):
if s[i] == '(' or ')' or '[' or ']':
if len(array) == 0 and s[i] == '(' or s[i] == '[':
array.append(s[i])
print(... |
13,806 | e4bb3f1f91b1b2c38a065d2d6b02b95eea0d6ef3 | # -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
from __future__ import print_function
from keras.models import Sequential
from keras.layers import Dense
from keras.utils import np_utils
from sklearn.feature_extraction import FeatureHasher
from sklearn.feature_extraction import DictVectorizer
from sklearn import prepro... |
13,807 | 8fbbcc9add056ad90b5d8158c36cb2b85fb5b046 | from unittest import TestCase
from mock import patch, Mock, mock_open
from docker.errors import ImageNotFound, BuildError, APIError
from samcli.local.docker.lambda_image import LambdaImage
from samcli.commands.local.cli_common.user_exceptions import ImageBuildException
class TestLambdaImage(TestCase):
def test... |
13,808 | 74af5fe080bec8675684fcaa342d72babe380a87 | # -*- coding: utf-8 -*-
import configparser
from klass.singleton import Singleton
class AppConfig(metaclass=Singleton):
__config = None
def __init__(self, file):
self.__config = configparser.ConfigParser()
self.__config.read(file)
def section(self, name):
return self.__config[nam... |
13,809 | 09ef2592fe5d231dd1dd404209a5e457e996d4a7 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
# 读配置文件
import ConfigParser
config = ConfigParser.ConfigParser()
config.read("ODBC.ini")
sections = config.sections() # 返回所有的配置块
print "配置块:", sections
o = config.options("ODBC 32 bit Data Sources") # 返回所有的配置项
print "配置项:", o
v = config.items("ODBC 32 bit ... |
13,810 | ec91c37aeeb77ac62043c15d7d628007424ec514 | # split(' ') preserves multiple spaces
def capitalize(string):
return ' '.join([word.capitalize() for word in string.split(' ')])
'''
# changes need to be done in same list
# as indefinite number of spaces
def capitalize(string):
words=string.split()
res=[]
for word in words:
capital = word[0]... |
13,811 | 3e04f3ffa056a5deee860d837706b2bebfdc89fe | # Generated by Django 2.1.1 on 2018-10-17 01:10
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('course', '0001_initial'),
('shop', '0001_initial'),
]
operations = [
migrations... |
13,812 | cb6847d2fb9b42734ba39b34b4fdcc4064d931ad | version='3.0.2'
|
13,813 | c544c792f31f44ac724330d2833293fc984848a5 | # Generated by Django 2.1 on 2019-04-26 21:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('policies', '0002_auto_20190424_1622'),
]
operations = [
migrations.AddField(
model_name='policy',
name='cash_back_days... |
13,814 | abf67b937bfb8b41bc8c23067063505df958729c | t = int(input())
ans = []
"""
def find_fib(index):
if index == 1:
return 0
else:
#index += 1
print(index)
a = (round(((1.618**index)-(-0.618**index))/2.236)) % 10
return a
"""
def find_fib(n):
# fibo = 2.078087 * math.log(n) + 1.672276
"""phi = (1 + 5*... |
13,815 | 5ce0bf3328fa59c72f7ed35dbf9dc404fec4d0e1 | import pygame
# NEVER START THE PROGRAM!!!
# pygame.init()
# screen = pygame.display.set_mode((640, 480))
#
# while True:
# pygame.display.flip()
import pygame.examples.stars
pygame.examples.stars.main()
|
13,816 | c1df02d19dbbbae2bb6d255318cabe938d9b113c | import os, openpyxl
os.chdir('C:\\Users\\Zig0n\\Documents\\VSCode Projects\\atbs_excercises\\Ch_13')
wb = openpyxl.load_workbook('example.xlsx')
sheet = wb['Sheet1'] # Get a sheet from the workbook.
print(sheet['A1']) # Get a cell from the sheet.
print(sheet['A1'].value) # Get the value from the cell.
# Get another... |
13,817 | 54f61ddac94ac8c346329612bb5819075972c11b | #!/usr/bin/python3
# -*-coding:utf-8 -
"""
Labyrinth constants
"""
import pygame
pygame.init()
# Dimensions of labyrinth
NB_SPRITE = 15
SPRITE_SIZE = 30
SCREEN_SIDE = NB_SPRITE * SPRITE_SIZE
# Customization window...
WINDOW = pygame.display.set_mode((SCREEN_SIDE + 90, SCREEN_SIDE))
# Without this... |
13,818 | 63efe6806f761ea3c12b45a63e211bfa0a8085c1 | # -*- coding: utf-8 -*-
__author__ = 'damon'
from common.utils import *
class Solution:
def rotateRight(self, head: ListNode, k: int) -> ListNode:
if not head:
return head
cur = head
n = 0
while cur:
n += 1
cur = cur.next
k %= n
slow = head
fast = head
i = 0
while i < k and fast:
fa... |
13,819 | cc33365a37cb4ba51d574253d4a2690887c6b179 | import os
from django.core.mail import send_mail
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
if __name__ == '__main__':
send_mail(
'来自django练手项目的测试邮件',
'欢迎访问django项目,我们在测试邮件发送!',
'xxxx@163.com',
['xxxxx@qq.com'],
) |
13,820 | d9354389a89dfdd30e3022e5cf246eea4ee9d43f | import time
def dynamo_create_save_token_func(dynamo, token_model):
""" dynamo save_token function for authlib.integrations.flask_oauth2.AuthorizationServer's save_token param """
def save_token(token, request):
if request.user:
user_id = request.user.get_user_id()
else:
... |
13,821 | 93d248a2e21d6ec200abaaaf6749d1dc74e4ced3 | import itertools
import sympy as sp
from means.approximation.mea.mea_helpers import get_one_over_n_factorial, derive_expr_from_counter_entry
def generate_dmu_over_dt(species, propensity, n_counter, stoichiometry_matrix):
r"""
Calculate :math:`\frac{d\mu_i}{dt}` in eq. 6 (see Ale et al. 2013).
..... |
13,822 | 66e6359405eb4cc180305664f8090fe6b42c88dd | h ,w = map(int,input().split())
a = [list(map(int, input().split())) for i in range(h)]
minlist = []
suma = []
for i in range(h):
minlist.append(min(a[i]))
suma.append(sum(a[i]))
print(sum(suma)-(min(minlist)*h*w)) |
13,823 | b9eb367e30fa62b32300d7fdbb09f4d1a62ae182 |
class ApiException(Exception):
def __init__(self, code):
self.code = code
print("We got a problem! {}".format(self.code))
|
13,824 | 2fa916805abe3e1f654f1de35e73dc0c5afb06c4 | import serial
import matplotlib.pyplot as plt
import numpy as np
from time import sleep, time
values = []
plt.ion()
s = serial.Serial('COM7',9600) # check your arduino code baudrate
#plt.ion()
#plt.show()
#while True:
# print([float(item) for item in str(s.readline()).split(',')[1:-1]])
data = np.random.random(5... |
13,825 | aa1d0a3d822939fc6ea9588f084314b3fd227734 | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 1 21:22:55 2016
"""
#==============================================================================
# The function get unprocessed email text, removes the header and returns
# only the body of the email for further processing.
#=====================================... |
13,826 | ad41ebe98df5aad61776c19f7fe6eaf292f43391 | import unicornhathd
from random import randint
from flask import Flask, request, jsonify, render_template
app = Flask(__name__)
width, height = unicornhathd.get_shape()
unicornhathd.brightness(1.0)
@app.route('/', methods=['GET'])
def index():
return render_template('index.html')
@app.route('/paint', methods=['P... |
13,827 | 223be7cea879796c52940d78afc7b1d5fe1e181e |
in_file = 'A-large.in'
Type = 'large'
out_file = 'A-{0}.out'.format(Type)
with open(in_file,'r') as f:
data = f.readlines()
Tt = int(data[0])
del data[0]
OUT = []
for k in range(Tt):
# Simple loop through (both sides???)
Seq, K = data[k].split()
Seq = [1 if l == "+" else 0 for l in Se... |
13,828 | 40f8762b270a0ba2548fd57200dcf6fe45c2eb26 | # -*- coding: utf-8 -*-
"""proj.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1HZAHtZ5EyfBGqT_9kt3rIWTo1YS9iYpg
"""
import numpy as np
import matplotlib.pyplot as plt
from keras.models import Sequential
from keras.layers import Dense
# import k... |
13,829 | 2113e51af36f616cac3d40e176f1bfe39dcb32e4 | import os
import torch
import torch.nn as nn
from torchvision.utils import save_image
class FaceGAN:
def __init__(self):
if not os.path.exists(f'models/FaceGAN_dir/faces'):
os.makedirs('models/FaceGAN_dir/faces')
self.device = torch.device('cpu')
self.latent_size = 512
... |
13,830 | 9cc62b9bee9503a5c9137c8ba1f59ec2e042f521 | #script iterates through each juror. Transcribes speech to text so that it can be implemented for NLP
#to predict sentiment of each juror towards specific topics.
import speech_recognition as sr
import pyaudio
import pandas as pd
from helperFunctions import *
import numpy as np
#load model
loaded_model = lo... |
13,831 | d4a8c684fa1190741a57e2f580f5e8e0f2d41c8c | import numpy as np
from sklearn import metrics
from model.sklearn_multiclass import sklearn_multiclass_prediction
from model.self_multiclass import MulticlassSVM
if __name__ == '__main__':
print('Loading data...')
mnist = np.loadtxt('data/mnist_test.csv', delimiter=',')
X_train = mnist[:len(mnist)//2, 1:... |
13,832 | 63562b3789c1e6a5c003d5733f568e14111c94bb | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from zabbix_api import ZabbixAPI
zapi = ZabbixAPI(server="http://192.168.25.3")
zapi.login("Admin", "zabbix")
hosts = zapi.host.get({
"output": [
"hostid",
"host"
],
"sortfield": "host"
})
for x in hosts:
print x["hostid"], "- ", x["host"]
|
13,833 | 8bb30f74c42eb1fb94acd365ad7d816bf89895ee | # Generated by Django 2.0.8 on 2018-10-08 14:13
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='permisos',
fields=[
('id', models.AutoField... |
13,834 | db0017a862a785d30768995752b1c453649ab02c | from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, DateTime
from sqlalchemy.orm import relationship
from db_models.base_class import Base
class DimField(Base):
__tablename__ = "dim_field"
field_key = Column(Integer, nullable=False, primary_key=True)
project_id = Column(String(255), nullab... |
13,835 | adaa6e582fe533affd05303a07256280f910d889 | from django.contrib.auth.models import AbstractUser
from django.db import models
from django.conf import settings
from django.db.models.signals import post_save
from django.dispatch import receiver
from rest_framework.authtoken.models import Token
# from django.contrib.auth.models import User
@receiver(post_save, sen... |
13,836 | b4bba7196c2d700a3f23a8c47d2d7178cce1a3e6 | # Write a program to sort a list of tuples using Lambda.
# Original list of tuples: [('English', 88), ('Science', 90), ('Maths', 97), ('Social sciences', 82)] Sorting the List of Tuples: [('Social sciences', 82), ('English', 88), ('Science', 90), ('Maths', 97)]
marks = [('English', 88), ('Science', 90), ('Maths', 97... |
13,837 | e6a62a9f023489e25084fa8c5a9fd77f75340639 | from base import Base
from globals import PEOPLE, presence_state
from typing import Tuple, Union
"""
Class LowBatteryManager manages the low battery warning TTS
"""
class LowBatteryManager(Base):
def initialize(self) -> None:
"""Initialize."""
super().initialize() # Always call base ... |
13,838 | 9784f69a3356e9cf372353e92ad48256e46e37ef | class Test():
def __init__(self,name,duration,machines,resources):
self.name=name
self.duration=duration
self.machines=machines
self.resources=resources
self.run_time=0
def can_run(self,target_machine):
if not self.machines:
return True
if... |
13,839 | 6aceac3cdbb1e47a96edb5bf6e5aae1b94d3f0bf | #P4HW1
#CTI110
#Fatmata Dumbuya
#07/05/2018
speed = int(input("what is the speed of the vechicle in mph:"))
hours = int(input("how many hours has it travelled:"))
count = 0
print ("Hours Distance travelled")
print ("........................")
while count < hours:
count = count + 1
print(" ", count... |
13,840 | b37c4ac9d938f0364aa08774214e29f730509a7c | from method import df_banknote
def main():
df = df_banknote
# question 1
data = df['class'].tolist()
# set the color
color = []
for row in data:
if row == 0:
color.append('green')
else:
color.append('red')
# add color column
df.insert(5, 'Color'... |
13,841 | 372651d7a91a6c704044d1a9ae1cae94f4d996b5 | # -*- coding: utf-8 -*-
"""
YOUR HEADER COMMENT HERE
@author: Sarah Barden
"""
import random
import math
from load import load_seq
random.seed(5845)
from amino_acids import aa, codons, aa_table # you may find these useful
def shuffle_string(s):
"""Shuffles the characters in the input string
NOTE: th... |
13,842 | 1980f25fa5af936a160ec78a7c8cdb1e9e4f9bab | import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
def preprocess( data ):
data = data[["density","ratio_suger","label"]]
mean = data.groupby( "label" ).mean().values
data_mat = data[["density","ratio_suger"]].values
label_mat = data[["label"]].values
return data_mat, label_mat, mean
#... |
13,843 | 463622420370c80760f47d48c5b95887cb93a112 | #!/bin/python
def evalue(n):
l = [x for x in str(n)]
return len(set(l)) == len(l)
def evaluate(x, y, z):
l = [x for x in str(x)+str(y)+str(z)]
return len(set(l)) == 9 and len(l) == 9
s = set()
for x in range(10000):
if '0' not in str(x) and evalue(x):
for y in range(10000):
if '0' not in str(y) and '0' n... |
13,844 | 3959e1163c18ca054b2800a76dc4003bbe14d569 | from __future__ import unicode_literals
from httoop import URI
def test_simple_uri_comparision(uri):
u1 = URI(b'http://abc.com:80/~smith/home.html')
u2 = URI(b'http://ABC.com/%7Esmith/home.html')
u3 = URI(b'http://ABC.com:/%7esmith/home.html')
u4 = URI(b'http://ABC.com:/%7esmith/./home.html')
u5 = URI(b'http://... |
13,845 | ff4ab4b0a3a8c119fa97f7fc6a0acbdf017d9e40 | timeout = 0
workers = 2
|
13,846 | 9f86709b223ef19744d54896175dd2267b8167a0 | from django.contrib import admin
from .models import Blog
from .models import Portfolio
admin.site.register(Blog)
admin.site.register(Portfolio) |
13,847 | 0e377f2c78e91552f4464e0ce43c01e20644ffd3 | #!/usr/bin/env python
import sys
for input_line in sys.stdin:
#line = input_line.strip ()
print '%s%s%d' % ("a", "\t", 1)
|
13,848 | f9a277512e0318cd29c5707f723b7b0bc98ac154 | """
:Author: Pauli Virtanen <pauli@ltl.tkk.fi>
:Organization: Low Temperature Laboratory, Helsinki University of Technology
:Date: 2005-2006
A solver for Keldysh-Usadel 1D circuit equations.
To find out how this library can be used, you should peek at
- `solver.Geometry`: How to specify a geometry
- `... |
13,849 | 49285b20e9ca63b0b76404da0cfd0b3eb22c8dd3 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.home, name="home"),
url(r'^login/$', views.login, name="login"),
url(r'^logout/$', views.logout, name="logout"),
url(r'^create/account/$', views.new_account, name="newaccount"),
url(r'^chats/$', views.chats, name="chats"),
ur... |
13,850 | 85aed7b348f2e0a57515349e87d3b82a899a0285 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# for localized messages
from . import _
from collections import OrderedDict
from Components.ActionMap import ActionMap
from Components.Sources.List import List
from xStaticText import StaticText
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from ... |
13,851 | 8d8c64d0e4abce069198ca94e87510059f6f5981 | game_txt = [ '게임 제목을 입력하세요\n',
'아무것도 입력되지 않았습니다. 다시 진행하세요\n',
'입력하신 "%s"게임 제목은 최대 20자를 초과할 수 없습니다. 다시 입력하세요\n',
'v1.0.0\n',
'게이머의 이름을 입력하세요?\n',
'이름이 입력되지 않았습니다. 다시~\n',
'다시 게임을 할까요?(yes/no) 대소문자 관계 없이 입력\n',
'정확하게 (yes/no)로 입력하세요\n',
'game over !! bye bye~'
]
game_txtEx = { 'GAME_INTRO'... |
13,852 | a42bcbb9b1f0a1bd08cbac5cd705b118aac81028 | # -*- coding: utf-8 -*-
'''
Created on 2018. 12. 31.
@author: Taehyoung Yim
'''
import unittest
from pathlib import Path
import pathlib
class TestUtils(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
self.data_path = str(pathlib.Path(__file__).re... |
13,853 | 3ac27ead79db13c03756e47f56855f8dd0bd1a86 | # coding: utf-8
# Tem Vogais Adjacentes | UFCG - PROGRAMAÇÃO 1
# (C) | Alessandro Santos, 2015
def tem_vogais_adjacentes(palavra):
for i_palavra in range(len(palavra) - 1):
if palavra[i_palavra].lower() in "aeiou" \
and palavra[i_palavra + 1].lower() in "aeiou":
return "sim"
return "nao"
palavra = raw_input... |
13,854 | c36f9d7d6e70bd5f5e3a91780efb6108ff70fad3 | A,B,C,D=map(int,input().split()) #1行で1スペースあけて入力
l=A+B
r=C+D
if l>r:
print('Left')
elif r==l:
print('Balanced')
else:
print('Right') |
13,855 | 2de6c08d2d616c9ea19d1bba13ac26e275d6c187 |
class StorageRepos(object):
def list(self, filters):
raise NotImplementedError
class Filters(object):
def items(self):
raise NotImplementedError
|
13,856 | d9ead81b9aadb9d80006e6041af3a1e43295fef0 | import random
from Player import Player
from Gamestate import Gamestate
from TreeNode import TreeNode
class MCTSPlayer(Player):
"""AI Player that uses MCTS for choosing action"""
def __init__(self, DISPLAYSURF, actions, actionTime):
super().__init__(DISPLAYSURF)
self.actions = actions
s... |
13,857 | ba06cd26581ff47817f8f25e82037938bb1e373c | string = "这是新增的文件 为的是看不同commit的效果" |
13,858 | 224508cc10f8c7908af46c243b1d1107f9325729 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on 2017/12/27 14:51
@author: Pete
@email: yuwp_1985@163.com
@file: cdfdemo.py
@software: PyCharm Community Edition
"""
import math
import matplotlib.pyplot as plt
import numpy as np
import sys
"""
The empirical CDF is usually defined as
CDF(x) = "number of sa... |
13,859 | 85be602315f29abca01845a5195d6fd57cb3df2f | import torch
import torch.nn as nn
import torch.nn.functional as F
class ChildSum(nn.Module):
def __init__(self, dim_hidden):
super(ChildSum, self).__init__()
self.i1 = nn.Linear(dim_hidden, dim_hidden)
self.i2 = nn.Linear(dim_hidden, dim_hidden)
self.g1 = nn.Linear(dim_hidden, dim... |
13,860 | 56b2ed5f44a7cc2e09def1e90158e61527b1c960 | print('Здрасьте') |
13,861 | a779757b77fb5964b9a613d4f406fe47c1f9a183 | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
np.random.seed(0)
def linear_regression(X, y, W_init, lr, max_nsteps):
N, D = X.shape
# Assign bias values
X_ = np.ones((N, D+1))
X_[:, 1:] = X
# Initialize weights
W = W_init
# Log history
history =... |
13,862 | b849237821dcc49283a06b65ce94e3d5bc030d0e | # encoding='utf-8'
import requests
import re
import time
import copy
from bs4 import BeautifulSoup
from collections import defaultdict
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'
'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36'}
WIKI_PREFIX = ... |
13,863 | 483f928bbd14ffdd20cf21d077f3158bbdbec619 | import os
import cv2
import random
import numpy as np
from glob import glob
from pathlib import Path
video_count = 0
img_file_count = 0
save_path = "data"
def get_basename(file_path) -> str:
file_name = os.path.basename(file_path).split(".")[0]
return file_name
def get_total_frames_num(pat... |
13,864 | c42330e46ae7efcad240d123a9ad9e54059e81a0 | '''
execfile('work11.py')
execfile('work16.py')
def indexx2(indl):
sum=0
for i in range(len(inmap)):
sum=sum+len(inmap[i])
if(indl>sum):
continue
else:
indl=indl-sum
break
return (i)
innmap=[]
for w in inmap:
for x in w:
innmap.append... |
13,865 | 11b1189b86b5ebd0d155f21260751aaa0e610966 |
# coding: utf-8
# In[61]:
import requests
import time
import lxml
from lxml import etree
# In[62]:
def Get_Html(url):
headers = {'user-agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Mobile Safari/537.36 Edg/86.0.622.63'}
respon... |
13,866 | fb11f1003cb16bc7523db874d461d63d4bec5409 | CONFIG = {
'kafka_broker': 'brokerip',
'port': 'port',
'topics': ['array_of_topics']
} |
13,867 | 7225c3c6f470d3df7d24e0b6098262a4d3aee285 | from django.conf import settings
from django.http import HttpResponse, get_host
SETTINGS = getattr(settings, "SITE_ACCESS_SETTINGS", {})
class BasicAuthMiddleware(object):
def process_request(self, request):
if get_host(request).startswith(SETTINGS["basic-auth"]["domain"]):
return self.proc... |
13,868 | e6c4fbc73eb197439ed83a79e9e57798cbd0431a | from abc import ABC, abstractmethod
from data_type.sentence import Sentence, ProcessSentence
class AbstractPreProcessor(ABC):
@abstractmethod
def transform(self, sent: Sentence, process_sent: ProcessSentence = None) -> Sentence:
return NotImplementedError |
13,869 | 236f6fa78e09d53e460c712e0666e1b892aba5f8 | #the pass keyword can be used to leave areas of the code empty so that they can be worked on later
bool=True
if bool==True:
print("Python in Easy steps")
else:
pass
#if the pass keyword was not inserted after else and a set of commands were also not present then the
#program would have displayed a syntax e... |
13,870 | 2718ba4ff6b4624296e30b6b2742c124c259d5bb | from __future__ import division, print_function, absolute_import
import pickle
import numpy as np
import config
import os.path
import codecs
import tflearn
from tflearn.layers.core import input_data, dropout, fully_connected
from tflearn.layers.conv import conv_2d, max_pool_2d
from tflearn.layers.normalization import ... |
13,871 | 011d7062b113e5933daf14fd4782821c37f312a9 | """
Dependency-Injected HTTP metadata.
"""
from typing import Any, Dict, Mapping, Sequence, Type, Union, cast
import attr
from hyperlink import DecodedURL
from zope.interface import Interface, implementer, provider
from twisted.python.components import Componentized
from twisted.web.iweb import IRequest
from .inter... |
13,872 | 27ac3895691276cf545da7147b8eb2195213dba9 | #!bin/python3
def is_hamiltonian_path(vert_con, v, l, n, s):
if len(l) == n:
return 1
try:
for i in vert_con[v]:
if i not in l:
s += is_hamiltonian_path(vert_con, i, l+[i], n, 0)
else:
pass
return s
except:
return 0
... |
13,873 | c764f80a12851abc3f8c42fc58296038fff3192c | """
Django settings for webapp project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... |
13,874 | 3d0bdebf29a522508c423272a82679cdb597f517 | from temboo.Library.PagerDuty.Alerts.ListAlerts import ListAlerts, ListAlertsInputSet, ListAlertsResultSet, ListAlertsChoreographyExecution
|
13,875 | aa261aba8e8daab64e60e438fc24bb88f322e7f4 | #!/usr/bin/env python
import ROOT
from array import array
from CMGTools.VVResonances.plotting.TreePlotter import TreePlotter
from CMGTools.VVResonances.plotting.MergedPlotter import MergedPlotter
from CMGTools.VVResonances.plotting.StackPlotter import StackPlotter
from CMGTools.VVResonances.statistics.Fitter import Fi... |
13,876 | 5de9e72a52fc2dd0d5043eb48f1f922574c84dab | #!/usr/bin/env python
#import unicornhat as unicorn
import sys
import os
path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
if not path in sys.path:
sys.path.insert(1, path)
del path
import Lifi.UnicornWrapper as unicorn
import weakref
from Lifi.tx import LifiTx
if __name__ == "__main__":
... |
13,877 | 2c6cfd2a3a8c67c2ec4ffc804c61bee487d82a40 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
#packeges
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# In[3]:
# Get the Data
#
# Avg. Session Length: Average session of in-store style advice sessions.
# Time on App: Average time spent on App in minutes
# Time... |
13,878 | 495207596f2a11011c74f1d029117adeea6f4677 | import vega.algorithms.nas.modnas.compat
from .compat import ModNasArchSpace
|
13,879 | 10b0b6b973999dda814dcf2ca3e19001008b095a | #!/usr/bin/env python
from PyQt5.QtGui import QColor
from PyQt5.QtWidgets import QColorDialog, QFileDialog
class SettingsController(object):
def __init__(self, model):
self.model = model
def update_default_directory(self, directory = None):
"""Change default directory."""
if not direc... |
13,880 | d62131efd3f628b6a78d52a9f6c6b4b6c5404708 | import unittest
from osrf_pycommon.terminal_color import impl
assert impl._enabled is True
class TestTerminalColorImpl(unittest.TestCase):
test_format_str = "@{r}red @!bold red @|normal @{rb}red bg"
test_str = "\x1b[31mred \033[1mbold red \x1b[0mnormal \x1b[41mred bg"
def test_ansi(self):
ansi ... |
13,881 | 370fadbfea65fa486468493caae3fbc81a41256b | import pytest
from glom import glom, Path, T, Spec, Glommer, PathAssignError
from glom.core import UnregisteredTarget
from glom.mutable import Assign, assign
def test_assign():
class Foo(object):
pass
assert glom({}, Assign(T['a'], 1)) == {'a': 1}
assert glom({'a': {}}, Assign(T['a']['a'], 1)) =... |
13,882 | fb705628b9c18fb313f8c8bf1c66afdf04f40924 | import numpy as np
import pandas as pd
import matplotlib
matplotlib.use("TkAgg")
import matplotlib.pyplot as plt
matplotlib.rcParams['text.usetex'] = True
matplotlib.rc('font', size=12)
def plot_learning(result_dir, ax, smooth=50, interval=50, error_bar=True, **kwargs):
data = np.load(result_dir)
d... |
13,883 | c3eaabdc5fbae076d00732f6d3a827a67e7aa912 |
class RouterResult(object):
def __init__(self, data, params):
self.data = data
self.params = params
@staticmethod
def not_match(params={}):
return RouterResult(None, params)
@property
def match(self):
return self.data is not None
|
13,884 | 2dc99069416dd72d92cf3e30295a0cfb33063c6e | #!/usr/bin/python3
"""Module for Blueprint"""
from flask import Blueprint, make_response, jsonify
from models.user import User
def get_view(view, view_id):
"""GET view"""
obj_v = storage.get(view, view_id)
if not obj_v:
abort(404)
return jsonify(obj_v.to_dict())
def get_view_parent(view_pare... |
13,885 | 32f2af45e6d7f4380175702a3127fe7cd721e71b | # Generated by Django 3.0.8 on 2021-02-11 09:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0002_discountadvertisement'),
]
operations = [
migrations.CreateModel(
name='Comments',
fields=[
... |
13,886 | 993eafb084f7dc2a552143dddbb3d9120a3ca1a7 | import math
import numpy as np
import cv2 as cv
import urllib.request
import IPython
import base64
import html
# Utility function to show an image
def show(*images, enlarge_small_images = True, max_per_row = -1, font_size = 0):
if len(images) == 2 and type(images[1])==str:
images = [(images[0], images[1])]
... |
13,887 | ac3e7ddf6e1aa4cab763234f815e9a0de3296401 | import logging
from pprint import pprint
from sys import stdout as STDOUT
# Example 1
def gcd(pair):
a, b = pair
low = min(a, b)
for i in range(low, 0, -1):
if a % i == 0 and b % i == 0:
return i
# Example 2
from time import time
numbers = [(1963309, 2265973), (2030677, 3814172),
... |
13,888 | 604f087bfe5510361df689bfce3a8b40fde078b6 | import cv2,serial,time
import numpy as np
def pid(gp, gi, gd, e, ePast):
i += e*gi
p = e*gp
d = (e-ePast)*gd
pidReturn = p+i+d
return pidReturn
#arduino = serial.Serial('COM9', 9600, timeout=.1)
#arduino.write()
cap = cv2.VideoCapture(0)
appleLocation=[0,0]
while True:
a = raw_input... |
13,889 | 28e9df2eb041d8355362179361ca82a66261ce43 | import webview
import os
import sys
import socket
import threading
import logging
from random import random
try:
from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
from SocketServer import ThreadingMixIn
except ImportError:
from http.server import SimpleHTTPReq... |
13,890 | 15bcd6b330bd7c45d459157b990343d02ede1fd5 | # -*- coding: utf-8 -*-
from unittest import main
from tornado.escape import url_escape, xhtml_escape
from knimin.tests.tornado_test_base import TestHandlerBase
from knimin import db
class TestAGEditBarcodeHandler(TestHandlerBase):
def test_get_not_authed(self):
response = self.get('/ag_edit_barcode/')
... |
13,891 | b747ff8aab2c5923c00bbea36b09eb91502a04c0 | acc = {'ttH_powheg_JHUgen_125_2e2mu_njets_pt30_eta2p5_genbin3_recobin4': 0.06229813324574369, 'ggH_powheg_JHUgen_125_2e2mu_njets_pt30_eta2p5_genbin3_recobin4': 0.0057692307692307696, 'ggH_powheg_JHUgen_125_2e2mu_njets_pt30_eta2p5_genbin3_recobin3': 0.0057692307692307696, 'ggH_powheg_JHUgen_125_2e2mu_njets_pt30_eta2p5_g... |
13,892 | 551904adc44347259c75285069a553c0c9c51857 | 成长基金 = 90
月卡 = 60
总价 = 成长基金+月卡
print(总价) |
13,893 | 483e56583886865c5101da12b63b3a5076a5d7b6 | def binadd (A, B):
C = [0]*(len(A)+1)
carry = 0
for i in range(len(A)-1, -1, -1):
C[i+1] = (A[i] + B[i] + carry)%2
if A[i] + B[i] == 2:
carry = 1
else:
carry = 0
C[0] = carry
print(C)
binadd([1,0,1,0,1,0,1,0], [1,1,0,0,1,1,0,0]) |
13,894 | 469581f95d7344d51a9c0270eb12071b7c1f2bce | for i in range(int(input())):
n = int(input());print("1 "*n)
|
13,895 | d3401d1d3998df964c1d315a804af24e6ee4938c | class Diagnostico():
# metodo construtor
def __init__(self,nome_arq):
self.pessoa = []
# abre o arquivo db.txt em modo leitura e passa os dados para
# uma lista de listas de str
self.my_dict = dict()
arquivo = open(nome_arq,'r')
for s,r in [x.replace('\n','').spli... |
13,896 | 6cab252a933ed316a1417ff13f808e0cf71b07ad | from base.interfaces import InterfacesBase
from base.modul import Modul
import math
class MenaraAir(Modul):
name = "Menara Air"
def init_formula(self, interfaces: InterfacesBase):
interfaces.get_float("h1",
brief="Tinggi air diatas lubang",
desk... |
13,897 | 6e363277b7a235a20d9ee0009d09f9f9f22801ba | #coding: utf-8
from mymodule import say_hi, __version__ #不建议使用这种方式,容易出现名称冲突
say_hi()
print('version', __version__)
|
13,898 | d68528f7b180e10984b47290e55fc71e5b58bd9f | from bluelens_log import Logging
options = {
'REDIS_SERVER': "{YOUR_REDIS_SERVER_IP}",
'REDIS_PASSWORD': "{YOUR_PASSWORD}"
}
log = Logging(options)
log.debug("debug log")
log.info("info log")
log.error("error log")
|
13,899 | df9ae7cce24c05295fe0773147b0a48dbd9b248a | import encode
import phoneme_info
import pytest
@pytest.mark.parametrize('tokens,expected', [
('h ai', [('h', 'ai', '')]),
('k A t s', [('k', 'A', 't s')]),
('s p ai i z', [('s p', 'ai', ''),
('', 'i', 'z')]),
])
def test__find_nuclei(tokens, expected):
tokens = to... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.