index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
5,800 | 30e7fc169eceb3d8cc1a4fa6bb65d81a4403f2c7 | from selenium import webdriver
from time import sleep
import os.path
import time
import datetime
driver =webdriver.Chrome(executable_path=r'C:/Users/Pathak/Downloads/chromedriver_win32/chromedriver.exe')
counter=0
while True :
driver.get("https://www.google.co.in/maps/@18.9967228,73.118955,21z/data=!5m1!... |
5,801 | 3b11d514b15775e4c818a7a2adf9a80e89dca968 | import requests
from bs4 import BeautifulSoup
from urllib.request import urlretrieve
import json
import time
#功能一:下载单一歌曲、歌词
def single_song(song_id,path,song_name): #下载单一歌曲,输入为歌曲id,保存路径,歌曲名称
song_url = "http://music.163.com/song/media/outer/url?id=%s" % song_id
down_path = path +'... |
5,802 | 807e19f09f4a46b6c39457b8916714e2c54c3e8d | # -*- coding:utf-8 -*-
'''
@author:oldwai
'''
# email: frankandrew@163.com
def multipliers():
return lab1(x)
def lab1(x):
list1 = []
for i in range(4):
sum = x*i
list1.append(sum)
return list1
#print ([m(2) for m in multipliers()])
def func1(x):
list2 = []
... |
5,803 | 676caabb103f67c631bc191b11ab0d2d8ab25d1e | import json
from django.core.management import call_command
from django.http import JsonResponse
from django.test import TestCase
from django.urls import reverse
URLS = ['api_v1:categories', 'api_v1:main_categories', 'api_v1:articles']
class GetJsonData(TestCase):
def test_post_not_login_no_pk(self):
f... |
5,804 | 2bf057621df3b860c8f677baf54673d2da8c2bd1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... |
5,805 | c585b1439217fff42945eeb9e02512d73f8ba19f | import DB as db
import os
from Chart import Chart
import matplotlib.pyplot as plt
import numpy as np
table = db.get_researcher_copy()
chart_path = '../charts/discipline '
def get_discipline_with_more_female():
docs = table.aggregate([
{'$match':{'gender':{'$exists':1}}},
{'$unwind':'$labels'},
{'$group':{'_id'... |
5,806 | c69c8ba218935e5bb065b3b925cc7c5f1aa2957b |
import matplotlib.pyplot as plt
import numpy as np
x = [1, 2, 2.5, 3, 4] # x-coordinates for graph
y = [1, 4, 7, 9, 15] # y-coordinates
plt.axis([0, 6, 0, 20]) # creating my x and y axis range. 0-6 is x, 0-20 is y
plt.plot(x, y, 'ro')
# can see graph has a linear correspondence, therefore, can use linear regression ... |
5,807 | f0fa85f240b74b003ade767ffe8642feacdfaa32 | import argparse
from train import train
from test import infer
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--mode', type=str, default='train',
help='could be either infer or train')
parser.add_argument('--model_dir', type=str, default='model',
... |
5,808 | 2ccc5e01a3b47a77abcb32160dee74a6a74fcfbb | import socket
import sys
from datetime import datetime
from threading import Thread
import logging
class RRConnection():
def __init__(self):
self._listenerSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self._inSock = None
self._inThread = Thread(target=self.inLoop)
self... |
5,809 | 9f1cbc655a5d8f14fa45cf977bb2dcee4874b188 | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 23 20:44:38 2018
@author: user
"""
import fitbit
import gather_keys_oauth2 as Oauth2
import pandas as pd
import datetime as dt
from config import CLIENT_ID, CLIENT_SECRET
#Establish connection to Fitbit API
server = Oauth2.OAuth2Server(CLIENT_ID, CLIENT_SECRET)
server... |
5,810 | 72bbd100a37a86dec7684257f2bec85d7367c009 | from rest_framework import serializers
from .models import *
class VisitaSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Visita
fields = ('id', 'usuario', 'lugar', 'fecha_visita', 'hora_visita') |
5,811 | c9f29a92ec8627593b54f7d9569dcfd589fa7fff | '''
Binary_to_C
Converts any binary data to an array of 'char' type to be used inside of a C program.
The reason to want to do that, is to emulate a 'Windows Resource System' on Linux.
Linux does not allow inclusion of binary data in application (I am OK with that, I like that actually).
Windows, however, does. On... |
5,812 | 9d6516ea099e035fb97e5165071103698a7ec140 | # Generated by Django 2.2.8 on 2019-12-10 10:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fieldsapp', '0003_pole_avatar'),
]
operations = [
migrations.AddField(
model_name='pole',
name='email',
... |
5,813 | 6a9e18cde94258b01a37f459eceaac58118b4976 | NUM_CLASSES = 31
AUDIO_SR = 16000
AUDIO_LENGTH = 16000
LIBROSA_AUDIO_LENGTH = 22050
EPOCHS = 25
categories = {
'stop': 0,
'nine': 1,
'off': 2,
'four': 3,
'right': 4,
'eight': 5,
'one': 6,
'bird': 7,
'dog': 8,
'no': 9,
'on': 10,
'seven': 11,
'cat': 12,
'left': 1... |
5,814 | f49c15dca26d987e1d578790e077501a504e560b | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
class TestMark:
@pytest.mark.demo1
def test_case1(self):
print("testcase1")
@pytest.mark.demo1
def test_case2(self):
print("testcase1")
@pytest.mark.demo2
def test_case3(self):
print("testcase1")
@pytest... |
5,815 | 6d80a89a47b68fd8d81739787897355671ca94e9 | '''
Функція replace() може використовуватися для заміни будь-якого слова у рядку іншим словом.
Прочитайте кожен рядок зі створеного у попередньому завданні файлу learning_python.txt і замініть слово Python назвою іншої мови,
наприклад C при виведенні на екран. Це завдання написати в окремій функції.
'''
def reader():... |
5,816 | 629353392e3a4f346f734543ae3f2b8dc616a6c3 | #https://docs.python.org/3.4/library/itertools.html#module-itertools
l = [(1, 2, 9), (1, 3, 12), (2, 3, 8), (2, 4, 4), (2, 5, 7), (3, 5, 5), (3, 6, 2), (4, 5, 2), (4, 7, 10),
(5, 6, 11), (5, 7, 2), (6, 8, 4), (7, 8, 4), (7, 9, 3), (8, 9, 13)]
b = ['America', 'Sudan', 'Srilanka', 'Pakistan', 'Nepal', 'India'... |
5,817 | b3ce17401476afe2edfda3011d5602ba492cd705 | import matplotlib.pyplot as pt
import numpy as np
from scipy.optimize import leastsq
####################################
# Setting up test data
def norm(x, media, sd):
norm = []
for i in range(x.size):
norm += [1.0/(sd*np.sqrt(2*np.pi))*np.exp(-(x[i] - media)**2/(2*sd**2))]
return np.array(norm)... |
5,818 | ee22d6226f734c67be91a3ccf1c8c0024bb7dc08 | import numpy as np
from board_specs import *
from board_components import *
import constants
import board_test
# List of resources available to be distributed on the board
RESOURCE_NAMES = constants.RESOURCE_NAMES
# Create a dictionary of each resource and a corresponding number id
res_dict = dict(zip(RESOURCE_NAMES,... |
5,819 | d3f80deb72ca2bd91fc09b49ad644f54d339f962 | #! /home/joreyna/anaconda2/envs/hla/bin/python
import argparse
import os
import sys
import time
import numpy as np
import copy
import subprocess
import math
project_dir = os.path.join(sys.argv[0], '../../')
project_dir = os.path.abspath(project_dir)
output_dir = os.path.join(project_dir, 'output/', 'pipeline/', 'sa... |
5,820 | 0ac99e2b33f676a99674c9a8e5d9d47c5bce084b |
plik=open("nowy_zad_84.txt", "w")
print(" Podaj 5 imion")
for i in range(1,6):
imie=input(f" Podaj imie nr {i} ")
# plik.write(imie)
# plik.write("\n")
plik.write(f" {imie} \n")
plik.close()
plik=open("nowy_zad_84.txt", "a")
for i in range(1,101):
plik.write(str(i))
plik.w... |
5,821 | f7d0d7dda955acd07b6da010d21dc5f02254e1ed | from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
from . import views
app_name = 'produce'
urlpatterns = [
# Inbound SMS view:
url(r'^sms/$', views.sms, name='sms'),
# List and Detail Views:
url(r'^list/', views.SeasonalView.as_view(), name='list'),
url(r'^(?P<pk... |
5,822 | 00228facd19c72bebd9afbbe52597e390233d41e | import requests
import logging
import json
class Handler(object):
def __init__(self):
"""
This class is used to handle interaction towards coffee interface.
"""
super(Handler, self).__init__()
logging.warning('Initializing coffeeHandler....')
# get an active token ... |
5,823 | 890841c8892e89375bb022f0d469fefc27414a2b | from abc import abstractmethod
from anoncreds.protocol.repo.public_repo import PublicRepo
from anoncreds.protocol.types import ClaimDefinition, PublicKey, SecretKey, ID, \
RevocationPublicKey, AccumulatorPublicKey, Accumulator, TailsType, \
RevocationSecretKey, AccumulatorSecretKey, \
TimestampType
from an... |
5,824 | ac0f0fbb9bcb450ac24198069ef8bea8b049ef47 | '''
删除排序数组中的重复项:
给定一个排序数组,你需要在原地删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。
不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成。
示例 1:
给定数组 nums = [1,1,2],
函数应该返回新的长度 2, 并且原数组 nums 的前两个元素被修改为 1, 2。
你不需要考虑数组中超出新长度后面的元素。
示例 2:
给定 nums = [0,0,1,1,1,2,2,3,3,4],
函数应该返回新的长度 5, 并且原数组 nums 的前五个元素被修改为 0, 1, 2, 3, 4。
你不需要考虑数组中超出新长度后... |
5,825 | 386e491f6b10ca27f513d678c632571c29093ad2 | # -*- coding: utf-8 -*-
import numpy as np
from . import BOID_NOSE_LEN
from .utils import normalize_angle, unit_vector
class Individual:
def __init__(self, color, pos, ror, roo, roa, angle=0, speed=1.0, turning_rate=0.2):
"""Constructor of Individual.
Args:
color (Color): color for ... |
5,826 | 3ec858c04a7622ae621bf322730b6b3ba9f4d07e | import datetime
from httpx import AsyncClient
from testing.conftest import (LESSONS_PATH, REVIEWS_PATH, pytestmark,
register_and_get_token)
class TestReview:
async def test_review_add_get(self, ac, fill_db):
# Creating users first
token = await register_and_get_tok... |
5,827 | 047b3b25cb064115a46cde1f1480ce55a1256bc1 | N = int(input())
StopPoint = N
cycle = 0
ten = 0
one = 0
new_N = 0
while True:
ten = N//10
one = N%10
total = ten + one
new_N = one*10 + total%10
cycle += 1
N = new_N
if new_N == StopPoint:
break
print(cycle) |
5,828 | d55043c2a18b935478d9be442aaf7305231edc7d | from os.path import dirname
import binwalk
from nose.tools import eq_, ok_
def test_firmware_squashfs():
'''
Test: Open hello-world.srec, scan for signatures
verify that only one signature is returned
verify that the only signature returned is Motorola S-rec data-signature
'''
expected_result... |
5,829 | 778ef68b5270657f75185b27dc8219b35847afa1 | import cv2
import sys
import online as API
def demo(myAPI):
myAPI.setAttr()
video_capture = cv2.VideoCapture(0)
print("Press q to quit: ")
while True:
# Capture frame-by-frame
ret, frame = video_capture.read() #np.array
frame = cv2.resize(frame, (320, 240))
key = cv2.w... |
5,830 | 4c752c96b7e503ae5c9bc87a038fcf6dc176b776 | def TriSelection(S):
""" Tri par sélection
Le tableau est constitué de deux parties : la 1ère constituée des éléments triés
(initialisée avec seulement le 1er élément) et la seconde constituée des éléments
non triés (initialisée du 2ème au dernier élément) """
for i in range(0, len(S)-1):
... |
5,831 | 48affa1b823a2543b6bbda615247324f5c249a69 | onfiguration name="test3" type="PythonConfigurationType" factoryName="Python" temporary="true">
<module name="hori_check" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<opt... |
5,832 | 39197b3f9f85d94457584d7e488ca376e52207f1 | from operator import itemgetter
import math
def get_tf_idf_map(document, max_freq, n_docs, index):
tf_idf_map = {}
for term in document:
tf = 0
idf = math.log(n_docs)
if term in index and term not in tf_idf_map:
posting_list = index[term]
freq_term = sum([p... |
5,833 | ff331dc0c72378222db9195cce7c794f93799401 | from matplotlib import pyplot as plt
import pandas as pd
import numpy as np
from sklearn.cluster import KMeans
cols = ['Clump Thickness', 'Uniformity of Cell Size', 'Uniformity of Cell Shape',
'Marginal Adhesion', 'Single Epithelial Cell Size', 'Bare Nuclei', 'Bland Chromatin',
... |
5,834 | c33d625ebd6a40551d2ce0393fd78619601ea7ae |
# This module is used to load pascalvoc datasets (2007 or 2012)
import os
import tensorflow as tf
from configs.config_common import *
from configs.config_train import *
from configs.config_test import *
import sys
import random
import numpy as np
import xml.etree.ElementTree as ET
# Original dataset organisation.
DIR... |
5,835 | edc7c74a19a272bdd6da81b3ce2d214a2b613984 | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
5,836 | a5dcc66ece4e58995fe86c3a399c45975a596b1a | from utilities import SumOneToN, RSS, MSE, R2Score
import numpy as np
import scipy.stats as st
class RidgeLinearModel:
covariance_matrix = None # covariance matrix of the model coefficients
covariance_matrix_updated = False
beta = None # coefficients of the modelfunction
var_vector = None
var_vecto... |
5,837 | 885e02cbf78412d77bd17eba64a8a1a52aaed0df | from slacker import Slacker
import vk_api
import time
import logging
from settings import SLACK_TOKEN, VK_LOGIN, VK_PASSWORD, GROUP_ID, TOPIC_ID, ICON_URL
slack = Slacker(SLACK_TOKEN)
class Vts:
def __init__(self):
self.last_comment_id = 0
self.vk = None
def update_vk(self):
if s... |
5,838 | b051a3dbe1c695fda9a0488dd8986d587bbb24a6 | from math import log
from collections import Counter
import copy
import csv
import carTreePlotter
import re
def calEntropy(dataSet):
"""
输入:二维数据集
输出:二维数据集标签的熵
描述:
计算数据集的标签的香农熵;香农熵越大,数据集越混乱;
在计算 splitinfo 和通过计算熵减选择信息增益最大的属性时可以用到
"""
entryNum = len(dataSet)
labelsCount... |
5,839 | 56cae7b7a0338bd4a405cdc3cdcd9945a9df8823 | a = 2
while a == 1:
b = source()
c=function(b)
|
5,840 | 6306acd1508698687842ba6b55a839743af420cc | from extras.plugins import PluginConfig
from .version import __version__
class QRCodeConfig(PluginConfig):
name = 'netbox_qrcode'
verbose_name = 'qrcode'
description = 'Generate QR codes for the objects'
version = __version__
author = 'Nikolay Yuzefovich'
author_email = 'mgk.kolek@gmail.com'
... |
5,841 | 111186f1d45b9cf3bf9065c7fa83a8f3f796bbe1 | # -*- coding: utf-8 -*-
"""Labeled entry widget.
The goal of these widgets is twofold: to make it easier for developers
to implement dialogs with compound widgets, and to naturally
standardize the user interface presented to the user.
"""
import logging
import seamm_widgets as sw
import tkinter as tk
import tkinter.... |
5,842 | 33938a28aad29e996255827825a0cdb1db6b70b7 | import tkinter as tk
import random
root = tk.Tk()
main_frame = tk.Frame(root)
var = tk.StringVar()
ch = [ "hello world" , "HI Pyton", "Mar Java", "Mit Java", "Lut Java" ]
var.set("Hello world I am a Label")
label = tk.Label(main_frame,textvariable=var,
bg="black",fg="white",font=("Times New Roman",24,"bold"))
... |
5,843 | 547844eca9eab097b814b0daa5da96d6a8ccee55 | import numpy as np
import xgboost as xgb
from sklearn.grid_search import GridSearchCV #Performing grid search
import generateVector
from sklearn.model_selection import GroupKFold
from sklearn import preprocessing as pr
positiveFile="../dataset/full_data/positive.csv"
negativeFile="../dataset/full_data/negative.csv"
... |
5,844 | 4a546222082e2a25296e31f715baf594c974b7ad | #!/usr/bin/env python
#coding=UTF8
'''
@author: devin
@time: 2013-11-23
@desc:
timer
'''
import threading
import time
class Timer(threading.Thread):
'''
每隔一段时间执行一遍任务
'''
def __init__(self, seconds, fun, **kwargs):
'''
seconds为间隔时间,单位为秒
fun为定时执行的任务... |
5,845 | 774f5d01cd274755626989c2b58bde68df349d8e | class Solution:
def isToeplitzMatrix(self, matrix: List[List[int]]) -> bool:
h = len(matrix)
w = len(matrix[0])
for curRow in range(h) :
val = matrix[curRow][0]
i = 0
while i < h-curRow and i < w :
# print(curRow+i,i)
if mat... |
5,846 | 25b7af2a8036f35a0bca665867d1729b7c9c113c | from ._monitor import TMonitor as TMonitor, TqdmSynchronisationWarning as TqdmSynchronisationWarning
from ._tqdm_pandas import tqdm_pandas as tqdm_pandas
from .cli import main as main
from .gui import tqdm as tqdm_gui, trange as tgrange
from .std import TqdmDeprecationWarning as TqdmDeprecationWarning, TqdmExperimental... |
5,847 | a1ebb00d7cda65cb528b2253e817d925214cdce3 | # 1.闭包
# 2.装饰圈初识
# 3.标准版装饰器 |
5,848 | c907f6b954aa3eae21a54eba9d54c116576bd40a | """
Constants to be used throughout this program
stored here.
"""
ROOT_URL = "https://api.twitter.com"
UPLOAD_URL = "https://upload.twitter.com"
REQUEST_TOKEN_URL = f'{ROOT_URL}/oauth/request_token'
AUTHENTICATE_URL = f'{ROOT_URL}/oauth/authenticate'
ACCESS_TOKEN_URL = f'{ROOT_URL}/oauth/access_token'
VERSION = '1.1'... |
5,849 | 223413918ba2a49cd13a34026d39b17fb5944572 | from selenium import webdriver
driver = webdriver.Chrome(executable_path=r'D:\Naveen\Selenium\chromedriver_win32\chromedriver.exe')
driver.maximize_window()
driver.get('http://zero.webappsecurity.com/')
parent_window_handle = driver.current_window_handle
driver.find_element_by_xpath("(//a[contains(text(),'privacy')])... |
5,850 | 4bd928c16cd0f06931aad5a478f8a911c5a7108b | #source: https://www.pyimagesearch.com/2015/05/25/basic-motion-detection-and-tracking-with-python-and-opencv/
from imutils.video import VideoStream
import argparse
import datetime
import imutils
import time
import cv2
#capture the video file
b="blood.mp4"
c="Center.avi"
d="Deformed.avi"
i="Inlet.avi"
... |
5,851 | 65b30bbe737b331447235b5c640e9c3f7f6d6f8c | def slope_distance(baseElev, elv2, dist_betwn_baseElev_elv2, projectedDistance):
# Calculate the slope and distance between two Cartesian points.
#
# Input:
# For 2-D graphs,
# dist_betwn_baseElev_elv2, Distance between two elevation points (FLOAT)
# baseElev, Elevation of first ... |
5,852 | a283fd1e4098ea8bb3cc3580438c90e5932ba22f | #!/usr/bin/env python
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
# Workaround for segmentation fault for some versions when ndimage is imported after tensorflow.
import scipy.ndimage as nd
import argparse
import numpy as np
from pybh import tensorpack... |
5,853 | 198beb5a17575d781f7bce1ab36a6213ad7331b3 | import pandas as pd
import numpy as np
import inspect
from script.data_handler.Base.df_plotterMixIn import df_plotterMixIn
from script.util.MixIn import LoggerMixIn
from script.util.PlotTools import PlotTools
DF = pd.DataFrame
Series = pd.Series
class null_clean_methodMixIn:
@staticmethod
def drop_col(df: D... |
5,854 | e9ea48dec40e75f2fc73f8dcb3b5b975065cf8af | class Solution:
def findAndReplacePattern(self, words: List[str], pattern: str) -> List[str]:
def convert(word):
table = {}
count, converted = 0, ''
for w in word:
if w in table:
converted += table[w]
else:
... |
5,855 | 399a22450d215638051a7d643fb6d391156779c5 | /home/khang/anaconda3/lib/python3.6/tempfile.py |
5,856 | 91959f6621f05b1b814a025f0b95c55cf683ded3 | from pyparsing import ParseException
from pytest import raises
from easymql.expressions import Expression as exp
class TestComparisonExpression:
def test_cmp(self):
assert exp.parse('CMP(1, 2)') == {'$cmp': [1, 2]}
with raises(ParseException):
exp.parse('CMP(1)')
with raises(P... |
5,857 | f9dd21aac7915b9bbf91eeffb5fd58ffdb43c6c3 | '''
Unit test for `redi.create_summary_report()`
'''
import unittest
import os
import sys
from lxml import etree
from StringIO import StringIO
import time
import redi
file_dir = os.path.dirname(os.path.realpath(__file__))
goal_dir = os.path.join(file_dir, "../")
proj_root = os.path.abspath(goal_dir)+'/'
DEFAULT_DATA_... |
5,858 | aa15d51760c16181907994d329fb7ceede6a539b | import re
text = "Python is an interpreted high-level general-purpose programming language."
fiveWord = re.findall(r"\b\w{5}\b", text)
print("Following are the words with five Letters:")
for strWord in fiveWord:
print(strWord)
|
5,859 | d077f32061b87a4bfd6a0ac226730957a4000804 | ###
### Copyright 2009 The Chicago Independent Radio Project
### All Rights Reserved.
###
### Licensed under the Apache License, Version 2.0 (the "License");
### you may not use this file except in compliance with the License.
### You may obtain a copy of the License at
###
### http://www.apache.org/licenses/LICENS... |
5,860 | f882b73645c6a280a17f40b27c01ecad7e4d85ae | import logging
from datetime import datetime
import boto3
from pytz import timezone
from mliyweb.api.v1.api_session_limiter import session_is_okay
from mliyweb.api.v1.json_view import JsonView
from mliyweb.dns import deleteDnsEntry
from mliyweb.models import Cluster
from mliyweb.resources.clusters import ClusterServi... |
5,861 | c80ae9d2eb07fd716a80a5e2d7b5237925fda02c | # Pose estimation and object detection: OpenCV DNN, ImageAI, YOLO, mpi, caffemodel, tensorflow
# Authors:
# Tutorial by: https://learnopencv.com/deep-learning-based-human-pose-estimation-using-opencv-cpp-python/
# Model file links collection (replace .sh script): Twenkid
# http://posefs1.perception.cs.cmu.edu/OpenPose/... |
5,862 | 7d2335c956776fc5890a727d22540eabf2ea4b94 | umur = raw_input("Berapakah umurmu?")
tinggi = raw_input("Berapakah tinggimu?")
berat = raw_input("Berapa beratmu?")
print "Jadi, umurmu adalah %r, tinggumu %r, dan beratmu %r." % (umur, tinggi, berat)
|
5,863 | 84d154afe206fd2c7381a2203affc162c28e21c1 | import sqlite3
from flask_restful import Resource, reqparse
from flask_jwt import JWT, jwt_required
#import base64
import datetime
import psycopg2
class User:
def __init__(self, _id, username, password, user_name, address, contact):
self.id = _id
self.username = username
self.password =... |
5,864 | 3bf1b4cfce55820605653d9dc57bab839f2dea55 | #!/usr/bin/env python
###############################################################################
# \file
#
# $Id:$
#
# Copyright (C) Brno University of Technology
#
# This file is part of software developed by Robo@FIT group.
#
# Author: Tomas Lokaj
# Supervised by: Michal Spanel (spanel@fit.vutbr.cz)
# Date: 12/... |
5,865 | 3f3ed40bf800eddb2722171d5fd94f6c292162de | #!/usr/bin/env python
import sys
def trim_reads(fastq, selection, extra_cut, orientation, output, outputType,
seqLen, trim):
# Store all read/sequence ids that did not match with KoRV
ids = []
with open(selection, 'r') as f:
for line in f:
ids.append(line.strip())
... |
5,866 | 8ec257d5dfe84e363e3c3aa5adee3470c20d1765 | import sys
import time
import numpy as np
import vii
import cnn
from cnn._utils import (FLOAT_DTYPE,
_multi_convolve_image,
_opencl_multi_convolve_image,
_relu_max_pool_image,
_opencl_relu_max_pool_image)
GROUPS = 25, 20... |
5,867 | 539431649e54469ddbe44fdbd17031b4449abdd9 | import boto3
import os
from trustedadvisor import authenticate_support
accountnumber = os.environ['Account_Number']
rolename = os.environ['Role_Name']
rolesession = accountnumber + rolename
def lambda_handler(event, context):
sts_client = boto3.client('sts')
assumerole = sts_client.assume_role(
Role... |
5,868 | 75c00eec7eacd37ff0b37d26163c2304620bb9db | from django.contrib.auth.hashers import make_password
from django.core import mail
from rest_framework import status
from django.contrib.auth.models import User
import time
from api.tests.api_test_case import CustomAPITestCase
from core.models import Member, Community, LocalCommunity, TransportCommunity, Profile, Noti... |
5,869 | e09f914f00e59124ef7d8a8f183bff3f7f74b826 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import asyncio
from typing import TYPE_CHECKING, Optional
if TYPE_CHECKING:
from myshell.environment import Environment
from myshell.job import Job, JobState
class JobManager:
"""事务管理器,用以调度前台和后台事务"""
def __init__(self, environment: "Environment"):
self... |
5,870 | 6e7cca4f766ca89d2e2f82a73f22742b0e8f92a8 | from .ros_publisher import *
|
5,871 | 2269e74c006833976c3a28cd52c238e2dde20051 | from .__main__ import datajson_write, datajson_read
|
5,872 | 0ff96b2314927d7b3e763242e554fd561f3c9343 | #!/usr/bin/env python3
# coding=utf-8
import fire
import json
import os
import time
import requests
import time
import hashlib
import random
root_path, file_name = os.path.split(os.path.realpath(__file__))
ip_list_path = ''.join([root_path, os.path.sep, 'ip_list.json'])
class ProxySwift(object):
... |
5,873 | 8dbc0b9b80aae4cb5c4101007afc50ac54f7a7e7 | #!/usr/bin/python
def sumbelow(n):
multiples_of_3 = set(range(0,n,3))
multiples_of_5 = set(range(0,n,5))
return sum(multiples_of_3.union(multiples_of_5))
#one linear:
# return sum(set(range(0,n,3)).union(set(range(0,n,5)))),
# or rather,
# return sum(set(range(0,n,3) + range(0,n,5)))
if __name__ == '__ma... |
5,874 | 7a69a9fd6ee5de704a580e4515586a1c1d2b8017 | # (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from .agent import agent
from .clean import clean
from .config import config
from .create import create
from .dep import dep
from .env import env
from .meta import meta
from .release import release
from .run impor... |
5,875 | 199872ea459a9dba9975c6531034bdbc1e77f1db | # -*- coding: utf-8 -*-
# caixinjun
import argparse
from sklearn import metrics
import datetime
import jieba
from sklearn.feature_extraction.text import TfidfVectorizer
import pickle
from sklearn import svm
import os
import warnings
warnings.filterwarnings('ignore')
def get_data(train_file):
targ... |
5,876 | a8341bf422a4d31a83ff412c6aac75e5cb8c5e0f | # Задание 1
# Выучите основные стандартные исключения, которые перечислены в данном уроке.
# Задание 2
# Напишите программу-калькулятор, которая поддерживает следующие операции: сложение, вычитание,
# умножение, деление и возведение в степень. Программа должна выдавать сообщения об ошибке и
# продолжать работу при ввод... |
5,877 | 26fb607623fda333c37e254470ca6d07708671a8 | from app.request import send_tor_signal
from app.utils.session_utils import generate_user_keys
from app.utils.gen_ddg_bangs import gen_bangs_json
from flask import Flask
from flask_session import Session
import json
import os
from stem import Signal
app = Flask(__name__, static_folder=os.path.dirname(
os... |
5,878 | d429f03c0f0c241166d6c0a5a45dc1101bcaec16 | #!/usr/bin/env python3
import matplotlib
from matplotlib.colors import to_hex
from matplotlib import cm
import matplotlib.pyplot as plt
import numpy as np
import itertools as it
from pathlib import Path
import subprocess
from tqdm import tqdm
from koala import plotting as pl
from koala import phase_diagrams as pd
fr... |
5,879 | 6c6026a7ff0345c37e62de7c0aac0ee3bcde2c82 | import pymongo
myclient = pymongo.MongoClient('mongodb://localhost:27017/') #We create the database object
mydb = myclient['mydatabase'] #Create a database
mycol = mydb['customers'] #Create a collection into my mydatabase
mydict = [{"name": "Eric", "address": "Highway 37"}, {"name": "Albert", "address": "Highway 37... |
5,880 | fb1974ad7ac9ae54344812814cb95a7fccfefc66 | # - Generated by tools/entrypoint_compiler.py: do not edit by hand
"""
NGramHash
"""
import numbers
from ..utils.entrypoints import Component
from ..utils.utils import try_set
def n_gram_hash(
hash_bits=16,
ngram_length=1,
skip_length=0,
all_lengths=True,
seed=314489979,
... |
5,881 | 1af6e66c19078a9ee971f608daa93247911d8406 | from tensorflow.keras.applications.resnet50 import ResNet50
from tensorflow.keras.preprocessing import image
from tensorflow.keras.applications.resnet50 import preprocess_input, decode_predictions
import numpy as np
model = ResNet50(weights='imagenet', # Learned weights on imagenet
include_top=True)
... |
5,882 | 6edb1f99ca9af01f28322cbaf13f278e79b94e92 | # -*- coding: utf-8 -*-
c = int(input())
t = input()
m = []
for i in range(12):
aux = []
for j in range(12):
aux.append(float(input()))
m.append(aux)
aux = []
soma = 0
for i in range(12):
soma += m[i][c]
resultado = soma / (t == 'S' and 1 or 12)
print('%.1f' % resultado)
|
5,883 | 9baf55eb2fb70e9fa0d92df22d307962b8d6c6d4 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import json
import urllib2
#this is executed by a cron job on the pi inside the pooltable
secret ='secret'
baseurl='https://pooltable.mysite.com/'
url = baseurl + 'gettrans.php?secret=' + secret
req = urllib2.Request(url)
f = urllib2.urlopen(req)
response = f.read()... |
5,884 | 9f3ca0d5a10a27d926a0f306665889418f8d6a0c | from src.produtos import *
class Estoque(object):
def __init__(self):
self.categorias = []
self.subcategorias = []
self.produtos = []
self.menu_estoque()
def save_categoria(self, categoria):
pass
def save_subcategorias(self, subcategoria):
pa... |
5,885 | 6fa9dfadc60108e1718c6688f07de877b0ac0afd | #!usr/bin/python
# -*- coding:UTF-8 -*-
'''
Introduction:
Implementation of Stack
Created on: Oct 28, 2014
@author: ICY
'''
#-------------------------FUNCTION---------------------------#
class Stack(object):
def __init__(self):
self.items = []
def is_empty(self):
return self.items == []
... |
5,886 | 4f87c2602e3233889888e419296f67fe40a2db0f | #!/usr/bin/python
#==========================================================================
#
# Copyright Insight Software Consortium
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at... |
5,887 | 8c4006ed8f4b1744f0316a61d95458b227653fee | /Users/AbbyPennington/anaconda/lib/python3.5/os.py |
5,888 | 2a6ae615b427a7c970aacf9804865ea7952d065f | # -*- coding: utf-8 -*-
"""
Created on Sun Dec 20 14:48:56 2020
@author: dhk1349
"""
n = int(input()) #목표채널
m = int(input())
broken=[int(i) for i in input().split()] #망가진 버튼
normal=[i for i in range(10)] #사용가능한 버튼
ans=abs(n-100) #시작 시 정답
for i in broken:
normal.remove(i)
tempnum=0
iternum=1
def solve(ls... |
5,889 | 8a04166e091e2da348928598b2356c8ad75dd831 | #usage:
#crawl raw weibo text data from sina weibo users(my followees)
#in total, there are 20080 weibo tweets, because there is uplimit for crawler
# -*- coding: utf-8 -*-
import weibo
APP_KEY = 'your app_key'
APP_SECRET = 'your app_secret'
CALL_BACK = 'your call back url'
def run():
token = "your access token got... |
5,890 | b86dedad42d092ae97eb21227034e306ca640912 | class mySeq:
def __init__(self):
self.mseq = ['I','II','III','IV']
def __len__(self):
return len(self.mseq)
def __getitem__(self,key):
if 0 <= key < 4 :
return self.mseq[key]
if __name__ == '__main__':
m = mySeq()
print('Len of mySeq : ',len(m))
for i in range(len(m.mseq)):
print(m.mseq[i]) |
5,891 | 38184ed4117b1b7dcf9e135ce8612fa13c44a99c | i = 0
while i >= 0:
a=input("Name is: ")
print(a)
if a == "Zeal":
print("""Name_Zeal.
Age_16.
Interested in Programming.""")
elif a=="HanZaw":
print("""Name_Han Zaw.
Age_18.
Studying Code at Green Hacker.""")
elif a == "Murphy":
print("""Name_Murphy.
... |
5,892 | f39945f35b13c0918c3ef06224bca65ae6166ebc | import numpy as np
a=np.array([1,2,3])
b=np.r_[np.repeat(a,3),np.tile(a,3)]
print(b)
|
5,893 | 87a62f76027e0653f6966f76a42def2ce2a26ba3 | #! /usr/bin/python3
print("content-type: text/html")
print()
import cgi
import subprocess as sp
import requests
import xmltodict
import json
db = cgi.FieldStorage()
ch=db.getvalue("ch")
url =("http://www.regcheck.org.uk/api/reg.asmx/CheckIndia?RegistrationNumber={}&username=<username>" .format(ch))
u... |
5,894 | 1c6e6394a6bd26b152b2f5ec87eb181a3387f794 | #!/usr/bin/python
# Find minimal distances between clouds in one bin, average these per bin
# Compute geometric and arithmetical mean between all clouds per bin
from netCDF4 import Dataset as NetCDFFile
from matplotlib import pyplot as plt
import numpy as np
from numpy import ma
from scipy import stats
from haversin... |
5,895 | 1f0680c45afb36439c56a1d202537261df5f9afc | from eventnotipy import app
import json
json_data = open('eventnotipy/config.json')
data = json.load(json_data)
json_data.close()
username = data['dbuser']
password = data['password']
host = data['dbhost']
db_name = data['database']
email_host = data['email_host']
email_localhost = data['email_localhost']
sms_host =... |
5,896 | 90324392e763ac6ea78c77b909c4bea667d45e6c | from admin_tools.dashboard.modules import DashboardModule
from nodes.models import Node
from slices.models import Slice
class MyThingsDashboardModule(DashboardModule):
"""
Controller dashboard module to provide an overview to
the user of the nodes and slices of its groups.
"""
title="My Things"
... |
5,897 | 14e1af3d60efef842c72bf9b55143d0e14f3a7b8 | import asyncio
import json
from functools import lru_cache
from pyrogram import Client
SETTINGS_FILE = "/src/settings.json"
CONN_FILE = "/src/conn.json"
def load_setting(setting: str):
with open(SETTINGS_FILE) as f:
return json.load(f)[setting]
@lru_cache()
def get_bot_name():
return load_setting(... |
5,898 | bf40b516e202af14469cd4012597ba412e663f56 | import nltk
import A
from collections import defaultdict
from nltk.align import Alignment, AlignedSent
class BerkeleyAligner():
def __init__(self, align_sents, num_iter):
self.t, self.q = self.train(align_sents, num_iter)
# TODO: Computes the alignments for align_sent, using this model's parameters. Return... |
5,899 | fbd7868a37a2270e5dc86843adff50a94436404d | from openvino.inference_engine import IENetwork, IECore
import numpy as np
import time
from datetime import datetime
import sys
import os
import cv2
class MotionDetect:
# Klasse zur Erkennung von Bewegung
def __init__(self):
self.static_back = None
def detect_motion(self, frame, reset=False):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.