index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
993,800 | 642d72fac44706505376fcc2ff0cc5cada6fa67e | """Views for news-here."""
import webapp2
import models
import view_utils
class MainPage(webapp2.RequestHandler):
"""Handler for landing page."""
def get(self):
"""Show dummy page for now."""
self.response.write(view_utils.render('base.html', {}))
class AddNewsItem(webapp2.RequestHandler)... |
993,801 | 21c130cd0199462a90b0a1f73cec1eb4392b7cc7 | #lesson 6 follow-along
#flow control: while loop
spam = 0
while spam <5:
print('Hello, world!')
spam = spam +1
#the "while" line checks for true/false of the statement
#while true, it will run the block
#so it stops when spam reachs 5
print()
name = ''
while name != 'your name':
print('Please type your... |
993,802 | 32d1b59225b1a675e4cc02e1aba0943103e70550 | # Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from bottle import Bottle, request, response, abort
import json
import logging
import os
from audit import init_audit
from controller import Controller
from utils import Encoder
log = logging.getLogger("sphere11.api")
logging.basicConfig(... |
993,803 | 833bcde268ce223a1ea07e6cd666907b8bb11d79 | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
import sys
import argparse
import os
from util import mkdir, image_trans
this_script_path = os.path.dirname(__file__)
sys.path.insert(1, this_script_path + '/../src')
import Parser as rp
def read_params(args):
parser = argparse.ArgumentParser(description='''diff p... |
993,804 | 4d1f68fca8ea3f06451a22dfd49587c6217fb277 | _file = open("input.txt", "r")
word = _file.readline()
MARKER_LENGTH = 14
for char in range(MARKER_LENGTH, len(word)):
substr = word[char - MARKER_LENGTH:char]
if len(set(substr)) == MARKER_LENGTH:
print(char)
break
|
993,805 | 3addeabedb0a08925b4e2391be8508740f8f0f85 | from django.db import models
from user.models import User
from comment_counts.models import CommentCounts
from open_date_time.models import OpenDate
from utils.base_model.base_comment_model import BaseCommentModel
from utils.base_model.base_image_model import BaseImageModel
from utils.base_model.base_tag_model import B... |
993,806 | c899eadf0960d91e9d4a3f661328e9f1122cba9b | from django.shortcuts import render, get_object_or_404, redirect, reverse, HttpResponseRedirect
from recipe.forms import AddRecipeForm, AddAuthorForm, LoginForm
from recipe.models import Author, Recipe
from django.contrib import messages
from django.contrib.auth import login, logout, authenticate
from django.contrib.au... |
993,807 | 97b796e041bd1f7c5c7a1579f13e7883b1a35eaa | import json, os, datetime, uuid, logging
import issues_conf as conf
logger = logging.getLogger(__name__)
DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
def timestamp():
return datetime.datetime.utcnow().strftime(DATETIME_FORMAT)
def load_data(filename, **kwargs):
try:
return json.load(open(filename, 'r'), *... |
993,808 | f0b6010b9a454e0ba92f8292f81afabd2ec7da71 | from project.player.player import Player
class BattleField():
@staticmethod
def fight(attacker: Player, enemy: Player):
if attacker.is_dead or enemy.is_dead:
raise ValueError("Player is dead!")
if attacker.__class__.__name__=="Beginner":
attacker.health+=40
... |
993,809 | 0c442b5279a9ac5e810be6f5e774b866701e2569 | # Generated by Django 2.2.6 on 2019-11-02 03:19
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('courses', '0012_delete_courseresource'),
]
operations = [
migrations.RenameModel(
old_name='SharedResource',
new_name='Cours... |
993,810 | ed460893474f568e801e8d02e8351d56229ea6f8 | """
Useful subroutines for working with bokeh in general.
"""
from functools import wraps
def servable(title=None):
"""
Parametrizes a decorator which returns a document handle to be passed to bokeh.
Search "embed server" on bokeh.org to find more context.
Example:
```python
@servable()
... |
993,811 | 56c6eca440d4b85f960378a4739f31b6fd4b30bf | # -*- coding: utf-8 -*-
"""
@author:XuMing(xuming624@qq.com)
@description:
"""
import numpy as np
from text2vec.utils.rank_bm25 import BM25Okapi
from text2vec.utils.tokenizer import Tokenizer
from text2vec.utils.log import logger
class BM25(object):
def __init__(self, corpus):
"""
Search sim do... |
993,812 | 2b62b08594ed4fed564b5152d8cc6d17da233423 | import unittest
import numpy as np
from sklearn.utils._testing import assert_array_almost_equal
from maze import MazeEnvSample3x3, MazeEnvSpecial4x4, MazeEnvSpecial5x5
from ipendulum import InvertedPendulumEnv
from qlearning import QTableLearning
from value_iteration import ValueIteration
from policy_learning import ... |
993,813 | a8d83f1e1c516ab94e2e4dd0062986439c1b2eed | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import seaborn as sns
from sklearn.preprocessing import MinMaxScaler
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_absolute_error, mean_squared_error, explained_variance_score
from t... |
993,814 | af403de35b3e9f2132bb98b27d2c4a7a1f4c93f3 | #! /bin/python
import argparse
parser = argparse.ArgumentParser(description='Search for words inclupding partial words')
parser.add_argument('snippet', help='partial or complete string to search for in words file')
args = parser.parse_args()
snippet = args.snippet.lower()
words = open('/usr/share/dict/words').readl... |
993,815 | 4be3b80b8aa9f447bfff1019e12b51334fd35d65 | import csv
print ("Stand by please, building list......")
#r = raw_input("Enter Yes or No: ") # -- ASk if you want Yes people or No people
ylst = list() # Create empty list for Yes People
nlst = list() # Create empty list for No people
d = dict() # Create a Dictionary if needed
with open('vcwater.csv', 'rb') as f:
... |
993,816 | 40577eec44d287fa651baab0519608be2ca54318 | import sys
#sys.stdin = open('input.txt','r')
k,n = map(int, input().split())
a = [int(input()) for _ in range(k)]
def Count(num):
cnt = 0
for i in a:
cnt += (i // num)
return cnt
res = 0
left = 1
right = max(a)
while left <= right:
mid = (left+right)//2
if Count(mid)>= n:
result = ... |
993,817 | 39e400ba3465dc617761b6e0fd06d8eb305a2441 | import unittest
import shutil
import os
import tempfile
from trovenames.index import TroveIndexBuilder, TroveIndex, TroveSwiftIndexBuilder, TroveSwiftIndex
class testIndex(unittest.TestCase):
def setUp(self):
pass
def test_create_index(self):
"""Create an index"""
indexfile = tem... |
993,818 | 345d321e1eb7694f172905f0bb7fe810c2d80f3f | #!/usr/bin/env python
# coding: utf-8
print(list)
print(tuple)
print(set)
print(dict)
print({a for a in dir(__builtins__) if isinstance(getattr(__builtins__, a), type)
and a.islower()} - {'__loader__'})
|
993,819 | 8a8e8785b073a65aaaf381f38cb17eed5b5df112 | class Node:
def __init__(self, data):
self.data = data
self.next = None
def insert_at(prev_node, data):
new_node = Node(data)
new_node.next = prev_node.next
prev_node.next = new_node
class LinkedList:
def __init__(self):
self.head = None
def print(self):
cu... |
993,820 | eaadf8deeaf606108a39eab319f9169b0aa549a7 | # coding:utf-8
import socket
import threading
# 处理客户端请求的任务
def handle_client_req(new_socket, ip_port):
print('客户端的ip和端口号为:', ip_port)
while True:
# 5.循环接收容户端的数据
recv_data = new_socket.recv(1024)
if recv_data:
recv_content = recv_data.decode('gbk')
print('接收到的客户... |
993,821 | 75e1a75c3e49c132e726868e0f2d06a0bccbf211 | # https://www.hackerrank.com/challenges/maximize-it/problem
from typing import List
def just_maximize_it(lists: List[List[int]], m: int):
s_values = {0}
for list_ in lists:
new_s_values = set()
for prev_val in s_values:
for num in list_:
new_s_values.add((num**2 + p... |
993,822 | e3bcac08a4f082453df8c5db62a0513f20d54a9d | secreat_number=8
guess_limit=3
number_of_tries=0
while number_of_tries < guess_limit:
number=input('Please guess the number ')
if secreat_number == int(number):
print('You guessed it right !')
break
else:
print('Try Again !!')
number_of_tries+=1
else:
print('Sorry you failed... |
993,823 | 6dcbede79e1d4884dc729d45a84676759eae1084 | from django.conf.urls import patterns, url
from .views import LoginView, RegisterView
urlpatterns = patterns('',
url(r'^login$', LoginView.as_view(), name='login'),
url(r'^salir$', 'users.views.salir', name='salir'),
url(r'^register$', RegisterView.as_view(), name='register'),
) |
993,824 | 06cdf88de856399ffcc01ed5a4717fac841d0f25 | import pickle
import numpy as np
from scipy.sparse import csr_matrix
import pandas as pd
def load_dict1():
with open('model1/id_to_itemid.p', 'rb') as fp:
id_to_itemid = pickle.load(fp)
with open('model1/id_to_userid.p', 'rb') as fp:
id_to_userid = pickle.load(fp)
with open(... |
993,825 | e5aceeee28c5443637ed1e566c0d6ebe439d5b80 | # Generated by Django 2.2 on 2020-12-07 13:58
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('store', '0012_auto_20201207_2116'),
]
operations = [
migrations.RenameField(
model_name='commoditytoshop',
old_name='shop_id',... |
993,826 | 14c47b4e4e2d6709835b35017d65f6585ed628a7 | #!/usr/bin/python
import sys
import json
class LexicalEntry:
def __init__(self, l, f, t):
self.lexeme=l.strip()
self.formula=f.strip()
self.type=t.strip()
out = open(sys.argv[2],'w')
with open(sys.argv[1]) as f:
for line in f:
tokens = line.split("\t")
if len(tokens) > 2:
continue
... |
993,827 | 57d8d04f999bce6bb6107373756dabb157985e23 | #!/usr/bin/env python3
from app import app
from app import views
app.run()
|
993,828 | 15f93f7d7c65d78d8e959db6e53eb3c5d5b94a9c | {
'name':'Last Mile theme',
'description': 'A starting theme ex.',
'version':'0.1.0',
'author':'Samuel Smith',
'data': [ 'views/layout.xml' ],
'category': 'Theme/Creative',
'depends': ['website', 'website_theme_install', 'sale'],
} |
993,829 | f1c4e8eae52a67eda043ccf1d0632f4689725398 | import logging , sys
def get_logger(name, flog_name, stdout=True):
logger = logging.getLogger(name)
h_file = logging.FileHandler(flog_name)
h_file.setFormatter(logging.Formatter('%(message)s'))
logger.addHandler(h_file)
logger.setLevel(logging.INFO)
if stdout:
h_stdout = log... |
993,830 | cb8bedae198a5ea4b5a0f7b67ee4d9cf755cff35 | import sys
sys.path.append(r"C:\Users\evans\Google Drive\Code\Python\Project Euler\functions")
|
993,831 | 6372dba59444526fa39d0d1301da2cde28a87812 | from django.http import Http404
from rest_framework.response import Response
from rest_framework.mixins import ListModelMixin
from rest_framework.decorators import list_route
class AutoCompletionMixin(ListModelMixin):
"""
Add a route to the ViewSet to get a list of completion suggestion.
"""
@list_r... |
993,832 | 0e90afd37a17d4e2815c8e821386c4320988cd0f | from pages.StartSurvey import StartSurvey
import unittest
import pytest
import utilities_config.custom_logger as cl
from utilities_config.Input import *
import logging
@pytest.mark.usefixtures("start_survey")
class TestStartSurvey(unittest.TestCase):
log = cl.customLogger(logging.DEBUG)
@pytest.fixture(autous... |
993,833 | 2468bbd5e9e0f73cd86c1c36307f2e7c8e3bf341 | def findrepn(li):
li.sort()
rep=[]
a=len(li)
for i in range(1,a):
if li[i]==li[i-1] :
if li[i] in rep :
continue
rep.append(li[i])
print(rep)
def main():
try:
li=[]
a=int(input())
for i in range(a):
li.append(int(input()))
findrepn(li)
except:
print('Unique')
mai... |
993,834 | 757eb5e64733a88d21177f259025f1dcadb1d2c2 | """
Lagrello API
API specification for Lagrello, a simple to use authentication service # noqa: E501
The version of the OpenAPI document: 1.0.0
Contact: support@lagrello.com
Generated by: https://openapi-generator.tech
"""
import unittest
import lagrello_client
from lagrello_client.api.interna... |
993,835 | 324f7b12060fb8eb24f9b5c072ce84c54c5c9c9d | from rest_framework import serializers
from .models import MuscleSubportion, Muscle, MuscleGrouping
class MuscleSubportionSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = MuscleSubportion
fields = ['name']
class MuscleSerializer(serializers.HyperlinkedModelSerializer):
... |
993,836 | 388bb0519ba623b9d99f7600eea064cef188af6e | #!/usr/bin/env python3
"""
Usage: ./day5-q6.py <histone_file1> <histone_file2> ... <histone_file4> <samples.ctab>
"""
import sys
import os
import pandas as pd
import numpy as np
import statsmodels.formula.api as sm
import matplotlib.pyplot as plt
means = {}
h3k4me1 = sys.argv[1].split(os.sep)[-1]
m1 = pd.read_table... |
993,837 | 41ef43560fa6060b9ab0e8500ff736db2e66cf88 | """
Auto catalogue.
Developed by Grigorev Albert.
"""
from CarClass import Car
def accept_command():
""" Asks for the command number. """
# TODO
def add(lst):
""" Asks user about the car. """
# TODO
def read():
""" Reading from the file. """
# TODO
def write(lst):
""" Writing to the... |
993,838 | 1237b7c27d6b5796d71bc172ff52284415612ec7 | #coding=utf8
# auther:shixingjian time:2020/07/15
from poWeb.BasePage import BasePage
from selenium.webdriver.common.by import By
class LoginPage(BasePage):
def __init__(self):
super().__init__()#执行父类的构造方法
self.username_locator = (By.ID,'username')#元素定位方法
self.password_locator = (By.ID,'pas... |
993,839 | ddacbd6e947c1c9d8316494229996613e98700a8 | dict1 = {'Name': 'Nataraj', 'colour': 'black'}
print(dict1.items())
k = dict1.keys()
courses = {'raja': ["math", "scenice", "social"],
'pradheep': ["tamil", "programming"]}
keys = courses.keys()
for name in keys:
print("The course taken by", name)
for listofcourse in courses[name]:
print(li... |
993,840 | 1fc7205c3a27a01fab02aad2b08d2e12b98cb350 | from moddemodfunc import *
def generateIQ(Nt, N, mod, tx_mode):
# Nt = no. of antennas
# N = number of samples
# mod = modulation scheme, BPSK, QPSK, ..., 1024QAM
# BPSK=1, QPSK=2, ... 1024QAM=10
# TODO: improve the time-consuming loop
c = np.asmatrix([[np.complex(0,0)]*N]*Nt)
if tx_mode ... |
993,841 | e023f5d95da5f8d0baa3b0623fd5e411f340b0ec | A=int(input())
B=int(input())
C=int(input())
D=int(input())
tickets = [A,B]
kippu = [C,D]
print(min(tickets)+min(kippu)) |
993,842 | c75ede00a6c1a1a3b8d03b7a5aa49cec5c1c8f8b | __version__ = '1.1.0'
from .urljects import url, URLView, url_view, view_include
from .routemap import RouteMap
from .patterns import *
|
993,843 | b4f7a9b4b43a9a34e7c64d52d294c805df87c1ed | class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
d = {}
start_point = -1
answer = 0
for idx, c in enumerate(s):
if c in d:
start_point = max(start_point, d[c]) #update for start_point(boundary)
... |
993,844 | 21ecc7253fd11ab193cee8ad85c881c9bc996008 | # 读取文件,传入文件名和标示符
f = open('D:/test.txt', 'r') # 标示符'r'表示读,文件路径用"/"或者"\\"
# 如果文件不存在,open()函数会抛出IOError错误,并给出错误码和详细信息
# 若文件打开成功,接下来调用read()方法一次读取文件的全部内容,用str对象表示
a = f.read()
print(a)
# 最后调用close()关闭文件。文件使用完后必须关闭,因为文件对象会占用操作系统的资源,且操作系统同一时间能打开的文件数量也是有限的
f.close()
# 由于文件读写时都有可能产生IOError,一旦出错,f.close()就不会调用... |
993,845 | 04ec3614136f91cc593974ac5610f6116d9e4338 | import abc
import warnings
from typing import Optional, Set
from observer.lib import Observer
class Subject(metaclass=abc.ABCMeta):
""" Abstract event producer. """
_observers: Set[Observer] = set()
def attach(self, observer: Observer) -> None:
""" Attaches new observer to the subject. """
... |
993,846 | 28559ba9ea074d81add7eea1103b61b6c6706cce |
import numpy
from matplotlib import pyplot as plot
from matplotlib.backends.backend_pdf import PdfPages
# Generate the data
data = numpy.random.randn(24, 1024)
# The PDF document
pdf_pages = PdfPages('histograms.pdf')
# Generate the pages
nb_plots = data.shape[0]
nb_plots_per_page = 6
nb_plots_p... |
993,847 | 5096c1b5838f9152e6555aa57cf2760dc8c3e38f | import requests
import json
import dateutil.parser
from dateutil.tz import tzutc
import datetime
import os
import humanize
valid_execution_states = {'starting', 'idle', 'busy'}
from typing import List, TypedDict
class Session(TypedDict):
path: str
last_activity: datetime.datetime
execution_state: str
de... |
993,848 | a388acd673a3d80133ae963c86633c4c214283a5 | import pandas as pd
import numpy as np
from generator import *
# data and metric imports
import sklearn.model_selection
import sklearn.datasets
import sklearn.metrics
from sklearn.feature_selection import SelectFromModel
from sklearn.ensemble import RandomForestClassifier
from skbio.stats.distance import permanova
from... |
993,849 | 47a1fb3a1303cc1b981dfd7a783bc2ee7de88146 | #!/usr/bin/env python
import numpy as np
import h5py
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
def get_wave(data, key, ch, tick_min, tick_max):
frame = np.array(data[key])
wave = frame[tick_min:tick_max, ch]
return wave
def show_frame(data, event, apa, tag) :
key = '/%d/frame_%s%... |
993,850 | 8072836644f02d179530bbdfed7c328df7e8a202 | #!/usr/bin/env python3
import __main__
import math
import os.path
from northstar.srv import get_orientation
from turtlesim.msg import Pose
import rospy
class orientation_service:
"""
A turtlesim-specific service to return the orientation of the turtle with respect to
True North. An orientation returned ... |
993,851 | cc5bea557193ca8c59b31a62d71cd06e898ea72e | from conans import ConanFile, tools, CMake
from conans.tools import check_min_cppstd
import os
class RepackedCorrade(ConanFile):
name = "repacked_corrade"
homepage = "https://github.com/werto87/repacked_corrade"
description = "repacked corrade https://github.com/mosra/corrade.git"
topics = ("utility",... |
993,852 | 977c3b9b17c414be9a54390f33f7a012123e6393 | datefile=open('date.info', 'r')
date = datefile.read()[:-1]
rasterfilepath=open('FLIP_'+ date + '.asc', 'r')
rasterfile = rasterfilepath.readlines()
with open('Corr_' + date + '.asc', 'w') as txt:
for i in xrange(6):
txt.write(rasterfile[i])
for j in xrange(len(rasterfile)-6):
txt.write(rasterfile[len(rasterfile)... |
993,853 | 7289434f0410f73305efa0c752878508d08af3d6 | # ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# notebook_metadata_filter: all
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.14.5
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python... |
993,854 | e42230af564c27ce25271e5bc3fe73d4df9404df | email = "peterukpong.pou@gmail.com"
name = "Peter Ukpong"
hng_id = "HNG-02417"
lang = "Python"
print("Hello World, this is "+ name +" with HNGi7 ID " + hng_id + " using "+ lang + " for stage 2 task email " + email) |
993,855 | 401e52015764a103bc5f24cec9d9ee23bd4935fc | class Task:
def __init__(self,
name,
description,
status,
date_stop,
user_id,
task_id = 0,
date_start = ""
):
self.name = name
self.description = description
... |
993,856 | c78fb4cf9816ff2215c8fc454240151710f7762e | arr = [(1,3), (2,4)]
if __name__ == '__main__':
for x,y in arr:
print(x)
print(y) |
993,857 | d0541b4de09d89e172ea2468552bb2e6b7523641 |
from . import base
from .sensors_packet_pb2 import sensors_packet as pkt
class Producer(base.SensorProducer):
event_name = 'temperature'
schema = {
'type': 'object',
'properties': {
'temperature': {
'type': 'number'
},
},
'required': ['... |
993,858 | 6da00f1cd9a3421685ec555ef505c419ea7250a4 | # Generated by Django 2.2.1 on 2019-08-30 08:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('maps', '0014_auto_20190830_0657'),
]
operations = [
migrations.AlterField(
model_name='map',
name='bbox',
... |
993,859 | ec79cb4774052bd83ec16a5f17e7fdacf416aaca | import paho.mqtt.client as mqtt
import myMqtt as my
import pymysql as sql
brkIp = my.brkIp
brkPort = my.Port
brkKeepAlive = my.brkKeepAlive
tls_arr = my.tls_arr
conn = sql.connect(host = '127.0.0.1', user = 'root', password = 'ziumks', db = 'jeju', charset = 'utf8')
def on_connect(client, userdata, flags, rc):
... |
993,860 | accb129371acf79771eeb6d4d0ae1b217d702812 | """Custom serializers for oscarapi."""
import warnings
from django.core.urlresolvers import reverse, NoReverseMatch
from rest_framework import serializers
from oscarapi import serializers as oscarapi_serializers
from oscar.core.loading import get_class, get_model
Selector = get_class("partner.strategy", "Selector")
... |
993,861 | 7a5bb64becd53c68fce3975381b5c12faf6fe9e7 | #coding:utf-8
import numpy as np
import pickle
import jieba
with open('newkey.txt','w',encoding='utf8') as newkey,open('newvalue.txt','w',encoding='utf8') as newvalue,open('test.txt','w',encoding='utf8') as testFile ,\
open('testoutput.txt','w',encoding='utf8') as testoutputFile ,open('wordlist.json', 'wb') as wordlist... |
993,862 | 03312319f71eb9612dc9f36d8065ee4fc73b2f6c | print("hello world")
print("Done the work")
print("Edited again") |
993,863 | e77ce799d4e1811ad7f62de94be5e9861e1df66a | import os
import random
import string
from configparser import ConfigParser
import netifaces
from scale.logger import create_logger
from scale.network.node import Node
class VPNManager:
def __init__(self, config):
self.logger = create_logger('VPN')
self.config = config
self.nodes: list[N... |
993,864 | c0da824b8560a155a94e9d371528a4d9a5226490 | import subprocess
import glob
import os
path = "/media/edison/STORAGE/Files/Music/"
songs = glob.glob(path + "*.mp4")
name = "/media/edison/STORAGE/Files/Music/Juice\ WRLD\ –\ Lucid\ Dreams.mp4"
# subprocess.call("cd venv", shell=True)
# subprocess.call("cd media/edison/STORAGE/Files/Screen\ Record")
# subprocess.call... |
993,865 | d85c4aea96f53f8721c946921be7aed5b4e453ad | import pickle
d = {}
count = 0
name = "jesus"
with open("game_data_" + name + ".txt", "r") as f:
for line in f:
count += 1
if (count % 1000000 == 0):
print(count)
temp = line.strip().split(" ")
if (len(temp) < 3):
print("test" + line + "test")
d[int(temp[0])] = [int(temp[1]), int(temp[2])]
print("Dat... |
993,866 | cd825716fa3fece7c9a33a709a8ff5708da80ef4 | GOOGLE_PLACES_API_KEY = 'AIzaSyCLNuufBC6PSot71KVsulAMHEppB4192CI' |
993,867 | fbdfc8d5da55aae72f872661eb7ab03bb8ff6304 | #!/usr/bin/env python
#coding=utf-8
"""def spam(text):
print text,"spam"
def spamSum(a,b):
print a+b
print "ffff"
X = 88
def f():
global x
x = 99
message = "First version 22"
def printer():
print "reloaded:", message
def tester():
print "It's Christmas in Heaven.."
if __name__ == "__m... |
993,868 | 50d1276122d7d86cc84a980c015acacff1d676cd | import itertools
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
for i in sorted(list(set(itertools.combinations_with_replacement(a, m)))):
print(*i)
|
993,869 | be79be05173ab97b3fd1fd667b6cf74be00d2cd1 | a,b=list(map(str,input().split()))
for i in range(1,int(b)+1):
print(a)
|
993,870 | 0d335122ecf48dcfb339d044d35c9b87f0e9f2be | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 12 19:21:32 2020
@author: gaurav baba
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
train=pd.read_csv("C:/daase/titanic_train.csv")
train.head()
train.isnull()
sns.heatmap(train.isnull()... |
993,871 | d8769ba2d3ea8fd11c3fe822d9e87ad40be8f2a2 | import numpy as np
import pandas as pd
from sklearn.cluster import KMeans
from sklearn import metrics
import matplotlib.pyplot as plt
'''K-means算法在手写体数字图像数据上的使用示例'''
'''
# 读取训练集和测试集
digits_train = pd.read_csv('optdigits.tra', header=None)
digits_test = pd.read_csv('optdigits.tes', header=None)
# 分离出64维度像素特征和1维度数字目标
x_... |
993,872 | ceb12818c79f4700b4f7deee6158412e1fc73b85 | #! coding:utf-8
# tools.py
import unittest
from operator import attrgetter
from copy import deepcopy
import random
import numpy as np
class Individuale(object):
def __init__(self, pop):
self._x = np.asarray(pop)
self._fitness_values = None
self._fitness_valid = False
... |
993,873 | fe325bc347b4b7b5a024444a89f1029f14970619 | import numpy as np
from gmpy2 import mpz
from .curve import Point
def to_np(msg_cipher):
return np.array([[(u.x, u.y) for u in t] for t in msg_cipher],
dtype=np.int).reshape(-1)
def from_np(np_cipher):
return [
tuple(Point(*(int(d) for d in u)) for u in e)
for e in np_c... |
993,874 | 9918cb47ce73bb1b962a114a636a310d6d6e0938 | from __future__ import absolute_import, division
import numpy as np
import math,sys,os,re
from scipy.sparse.csgraph import connected_components,csgraph_from_dense
from itertools import izip
from Bio import SeqIO
from ghost.util.distance import hamming
import networkx as nx
import collections
__author__ = "CDC/OID/N... |
993,875 | f9ba92e5b5f8baaa2c551a7e03ecc0ded4277c45 | class Node(object):
"""
Node object which is being used to test the functions.
Delete before submitting.
Args:
data (:anything): Data which is contained in the LinkedList node.
next_node (:obj type Node): Pointer to the subsequent node in the linkedList.
Attributes:
data ... |
993,876 | b7623deac8e147d827fd847ae810b1d93d6a967b | k=int(input())
def s(n):
m=str(n)
l=list(m)
l=map(int,l)
return n/sum(l)
p=1
q=0
for i in range(k):
print(p)
if s(p+10**q)>s(p+10**(q+1)):
q+=1
p+=10**q |
993,877 | e59bb0714649209b9d26b6af39dbd7aead3fea05 | from datetime import datetime
from flask import abort, current_app as app, request, g
from flask_restplus import Resource
from werkzeug.exceptions import BadRequest
from ...database.models import Activity
from ..restplus import api
from ..serializers import activity_request, activity_response
import logging
log = log... |
993,878 | 0b609ce1c96ba138a24e12f976b889bd77c0eee7 | try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import unittest
import sys
import time
from serial import Serial
PORT = '/dev/ttyACM0'
class TestSettings(unittest.TestCase):
def setUp(self):
self.held, sys.stdout = sys.stdout, StringIO()
def test_00_echo(self):... |
993,879 | 156aabf8a03ee0197c6094733614cae345cd3070 | # -*- coding: utf-8 -*-
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.contrib.auth import logout
from django.contrib.auth.models import User, Group
from django.http import HttpResponseRedirect, HttpResponseForbidden, HttpResponse
import datetime
from logapp... |
993,880 | abb7a373786a45177f303baf91095ee219ced55e |
import numpy as np
from collections import namedtuple
class ObjectInsertion:
"""
This class will handle every object manipulation inside the background image area
"""
def __init__(self, max_iou=0.4):
self._max_iou = max_iou
self._Centroid = namedtuple('Centroid', 'x, y, w, h')
de... |
993,881 | abb223ca47f1104f8345b9273ab2bb63099eef06 | from django.contrib import admin
from . import models
admin.site.register([
models.Blog,
models.Author,
models.Entry
]) |
993,882 | aaf47db225475a3ab58932327d28d48e116f5863 | from setuptools import setup
setup(
name='array_to_struct',
version='1.0',
description='',
author='',
author_email='',
url='',
packages=['transp_solution'],
include_package_data=True,
zip_safe=False
) |
993,883 | a8aa4938391df1604ba7337789e7225314c86534 | class Solution(object):
def isIsomorphic(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
if len(t) != len(s):
return False
d_s = [-1 for _ in xrange(256)]
d_t = [-1 for _ in xrange(256)]
s_index = range(len(s))
t... |
993,884 | e4bba0d0acb89cd2b6f84b190711487674794203 | import math
def next_position(m,i,j,d):
if not m[j-1][i-1] == 1:
m[j-1][i-1]=5
else:
#print("Error: Position Error")
return -1
#print("{} {} {}".format(i,j,d))
if d == 1:
j += 1
elif d == 2:
i += 1
elif d == 3:
j -= 1
else:
i -= 1
if j>10 or i>10 or i<1 or j<1 or m[j-1][i-1] == ... |
993,885 | c2cf748f8f5e568f5cf432cc8eed72e93574f07f | import numpy as np, pandas as pd, os
# import my functions
import vwap
# read file. Only allows ONE product in each file!
# Make sure the titles are
# ['ProductionYear', 'VolIGWh', 'Price', 'TradeDate', 'CY', 'TradeYear', 'TradeMon', 'VolTimesPrice', 'DummyDate']
# only these are used: ProductionYear, VolIGWh... |
993,886 | 50b367470b0ada99b801fd46216bca8fee772454 | # This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.12
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (2, 7, 0):
def swig_im... |
993,887 | aaf09570f7efa4fe18c8860e106eb008e90c551f | import pytest
from solution import validate
data_ok = [
('Timmy', 'password', 'Successfully Logged in!'),
('Alice', 'alice', 'Successfully Logged in!'),
]
@pytest.mark.parametrize(
"username, password, result", data_ok
)
def test_should_succesfully_login(username, password, result):
assert validate... |
993,888 | 3d25575916bf92ec19cfeaf4833255f8a7b4f5eb |
leagues = {}
base_url = 'http://www.football-data.co.uk/mmz4281/'
seasons = ['1819', '1718', '1617', '1516', '1415', '1314']
for league in leagues:
if leagues[league]['hasSeasons']:
for season in seasons:
url = '{0}{1}/{2}.csv'.format(base_url, season,
leagues[league]['slug'])
els... |
993,889 | 83cc94ab18287e595b7504692f384704f880ef46 | #!/usr/bin/python
# Route Time
# Displays leave and return time for city routes
# Parts needed LCD Pi Plate, 4 7 segment displays
# ! Imports
import Adafruit_CharLCD as LCD
from Adafruit_LED_Backpack import SevenSegment
import Adafruit_Trellis
# Trellis setup
# Momentary mode LED lights only when pressed
# Latching ... |
993,890 | 71c24a2a51c521728caea6e508757544a71fc8ab |
input = "$0859: .BYTE $41,$20,$27,$4C,$49,$54,$54,$4C\n$0861: .BYTE $45,$20,$53,$4F,$4D,$45,$54,$48\n$0869: .BYTE $49,$4E,$47,$27,$20,$46,$52,$4F\n$0871: .BYTE $4D,$20,$49,$52,$49,$44,$49,$53\n$0879: .BYTE $2D,$41,$4C,$... |
993,891 | 3fb93b782f6afc9049f9f2a5b90b251f7611f25b | import csv
import requests
import json
import re
import logging
from bs4 import BeautifulSoup
from six.moves.html_parser import HTMLParser
from functools import reduce
from datetime import datetime
from dateutil.parser import parse
import pandas as pd
now = datetime.now().isoformat().replace(':', '').split('.')[0]
aca... |
993,892 | d2d518c13036e655f74ea5b12921996d99722a1e | NUM_SEGMENTS = 5
def push_on_stack(segment):
line = [
"@%s" % segment,
"D=M",
"@SP",
"A=M",
"M=D",
"@SP",
"M=M+1",
]
return line
def restore_call(segment, iframe):
line = [
"@%s" % iframe,
"D=A",
"@R13",
"A=M-D",... |
993,893 | 2015866dc1b380f2d4456ba71a768be3834afe2e | # Samuel Fandiño #
num1=input('Introduzca el primer número ')
num1=int(num1)
num2=input('Introduzca el segundo número ')
num2=int(num2)
while num1 >= num2:
num2=input('Introduzca el segundo número nuevamente ')
num2=int(num2)
print('Los números introducidos fueron: '+str(num1)+' '+str(num2))
|
993,894 | 2bdbe984ae4b52d6b2758429f28a98b9fdabb34a | from django.conf.urls import url
from django.views.generic import RedirectView
from oscar.apps.catalogue.app import (
BaseCatalogueApplication as DefaultCatApp,
ReviewsApplication as DefaultReviewsApp
)
from shop.catalogue.views import product_or_category
class BaseCatalogueApplication(DefaultCatApp):
d... |
993,895 | 88e90ae388b10478681576c34cb255ff1afae0e2 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
#
# This file is part of Womoon.
# Copyright: Kamila Chyla, 2006
#
# Womoon is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the Lic... |
993,896 | 56e29abbd66bff7eb2902f06c953e27d4033bc5e | from sqlalchemy import Table, Column
class Victories(object):
def __init__(self,uid,won,lost):
self.uid=uid
self.won=won
self.lost=lost |
993,897 | f90bccc2ffec169328d9642b5b0eab036cd444a1 | class Guest:
def __init__(self, name, celebration, status, wallet, favourite_song):
self.name = name
self.celebration = celebration
self.status = status
self.wallet = wallet
self.favourite_song = favourite_song
def pay_fee(self, room):
if self.status == "VIP... |
993,898 | f439918b6995f36a7a6fb1a0285b9f744fd5905c | from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import GridSearchCV
from imblearn.over_sampling import SMOTE
from sklearn.model_selection import KFold
from sklearn.model_selection import train_test_split
from sklearn.svm import SVC, LinearSVC
from sklearn.metrics import confusion_matrix
fr... |
993,899 | c287b5f834c313060f4ad2004de99619a66b123a | def small_words(words):
for word in words:
if len(word) <= 3:
yield word
print [w for w in small_words(["The", "quick", "brown", "fox"])]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.