blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
68028ebe87f34890b05193d670108f72dc7ebed9 | Python | satojkovic/algorithms | /problems/recursive_mult.py | UTF-8 | 1,571 | 2.859375 | 3 | [] | no_license | def recursive_mult(x, y):
def mult(smaller, larger):
if smaller == 0:
return 0
elif smaller == 1:
return larger
s = smaller >> 1
rets = mult(s, larger)
retl = rets
if smaller % 2 != 0:
retl = mult(smaller - s, larger)
return... | true |
cd1dbfc278bf456e4ccd899586a79b739b1300df | Python | Revnic/Dev1 | /Assignment4/ExerciseOne/ExerciseOne/ExerciseOne.py | UTF-8 | 160 | 3.75 | 4 | [] | no_license | Fahrenheit = float(input("Enter Fahrenheit to convert into Celsius \n"))
Celsius = (Fahrenheit - 32)* 5.0/9.0
output = round(Celsius,2)
print output, "Celsius"
| true |
fd5a0b7a85b3038f8e7257ad5363cddc8c98edd7 | Python | danhlk/solutions_cryptohack | /MATHEMATICS/What's a Lattice.py | UTF-8 | 94 | 2.578125 | 3 | [] | no_license | import numpy as np
v = np.array([[6, 2, -3], [5, 1, 4], [2, 7, 1]])
print(np.linalg.det(v))
| true |
60bdb69b37eeaf199613501035026820d99c450b | Python | 20186103/20186103 | /CSPP1/m5/GuessMyNumber/guess_my_number.py | UTF-8 | 342 | 3.4375 | 3 | [] | no_license |
def main():
'''main function'''
num = int(input())
adict = {}
i = 0
while i < num:
data = input()
list1 = data.split(" ")
if list1[0] not in adict:
adict[list1[0]] = [int(list1[1])]
else:
adict[list1[0]].append(int(list1[1]))
i += 1
... | true |
3014e20c4d47812b68d38afee0c0f32200faa22d | Python | jbjb4790/Pybo | /pybo/naverapi.py | UTF-8 | 2,031 | 3.078125 | 3 | [] | no_license | # 네이버 검색 API예제는 블로그를 비롯 전문자료까지 호출방법이 동일하므로 blog검색만 대표로 예제를 올렸습니다.
# 네이버 검색 Open API 예제 - 블로그 검색
import os
import sys
import urllib.request
import json
def naverbook(bookname):
client_id = "HdEj1IvYA2VfnJXdPcor"
client_secret = "awfL5sujnt"
encText = urllib.parse.quote(bookname)
url = "https://openapi.n... | true |
1f43a8feaa483f5b329f8cfcb222da765a0a784f | Python | TheOldPresbyope/moode-radio-utils | /savemyradios.py | UTF-8 | 5,272 | 2.96875 | 3 | [] | no_license | #!/usr/bin/python3
# moOde utility to save user-defined radio stations
# Rev 2/20200822 - revamp for moOde r660 changes to database schema
# and locations of radio-related files; not compatible
# with previous releases of moOde
# Rev 1/20190822 - tell user and don't create empty tar f... | true |
0e65b38c7c74aca586e6486fb42e62594b983015 | Python | chriskwon96/Algorithm_codes | /SW Expert Academy/5110_수열합치기/5110_수열합치기.py | UTF-8 | 2,357 | 3.71875 | 4 | [] | no_license | class Node:
def __init__(self, d=0, n=None):
self.data = d # 정수값
self.next = n # 다음 노드 주소
class LinkedList:
def __init__(self):
self.head = None # 첫 번째 노드
self.tail = None # 마지막 노드
self.size = 0 # 노드의 수
def printList(lst):
if lst.head is None: return
cur = lst.... | true |
acfd6191021f32549e0c8cca3989101b816b1f17 | Python | yxu1998/miscellaneous-stuffs | /lab5_skel.py | UTF-8 | 7,258 | 4.25 | 4 | [] | no_license | # lab_skel.py
# October 3, 2018
"""
Part I: warm up exercises. Complete the functions below
"""
def sum_list(xs):
"""
xs: list, a list of integers
returns: int, sum of all elements in xs
precondition: none (if list is empty, 0 should be returned)
"""
pass
acc=0
for char in xs:
... | true |
ebcf5e37f916bf22610512b615a831b8949c9f85 | Python | asamarin/pycuda-motion-detector | /src/Filters/threshold.py | UTF-8 | 645 | 2.625 | 3 | [] | no_license | from filter import Filter
class ThresholdFilter(Filter):
# Valor discriminante (menores que este -> MIN_PIXEL_VALUE mayores que este -> MAX_PIXEL_VALUE)
level = 127
def __init__(self, *images, **kwargs):
self.images = []
super(ThresholdFilter, self).__init__(*images)
try:
... | true |
883ff02f6b0948964779f0745ec5c98c00f2e269 | Python | CrescentLuo/SCseqAnalysis | /bked.py | UTF-8 | 4,348 | 2.5625 | 3 | [] | no_license | """
An implementation of the kde bandwidth selection method outlined in:
Reference: Z. I. Botev, J. F. Grotowski and D. P. Kroese
"KERNEL DENSITY ESTIMATION VIA DIFFUSION" ,Submitted to the
Annals of Statistics, 2009
Based on the implementation in Matlab by Zdravko Botev.
"""
import scipy
imp... | true |
a4e7142e3b563560947e107ff96aa52f77050b58 | Python | rensg001/test_scripts | /django_sites/src/trees/management/commands/generate_tree.py | UTF-8 | 3,359 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author rsg
#
import copy
import json
import logging
import time
from collections import defaultdict
from django.core.management import BaseCommand
from django.forms import model_to_dict
from trees.models import TreeNode
logger = logging.getLogger(__name__)
def cre... | true |
52c557a0018db47171f78953067245c45e038108 | Python | soobun/Python_Exercise | /CH_10/10_6.py | UTF-8 | 836 | 4.90625 | 5 | [] | no_license | # 10-6 加法运算:提示用户提供数值输入时,常出现的一个问题是,用户提供的是文本而不是数字。
# 在这种情况下,当你尝试将输入转换为整数时,将引发TypeError 异常。
# 编写一个程序,提示用户输入两个数字,再将它们相加并打印结果。在用户输入的任何一个值不是数字时都捕获TypeError 异常,
# 并打印一条友好的错误消息。对你编写的程序进行测试:先输入两个数字,再输入一些文本而不是数字。
print('Input 2 numbers,')
try:
first_num = input('Input the first number here: ')
first_num = int(first_num)... | true |
77e67cb06cf6322ee5a6d2bcb90263ac17307304 | Python | conan7882/construct-deep-rnn | /lib/model/cells.py | UTF-8 | 5,580 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: cells.py
# Author: Qian Ge <geqian1001@gmail.com>
import numpy as np
import tensorflow as tf
from tensorflow.python.ops.rnn_cell import RNNCell
class BasicLSTM(RNNCell):
def __init__(self, hidden_size, forget_bias=0.0):
print('*** LSTM ***... | true |
618d31058e97b42e71c69b185ba5bbd3ce083b7b | Python | Diniz-G/Minicurso_Python | /minicurso_python/ex4.py | UTF-8 | 46 | 2.96875 | 3 | [] | no_license | lista = [10, 4, 6]
lista.sort()
print(lista) | true |
2766170c6a192371dfb33b28816b80693f661fa4 | Python | DastanB/BF-Django | /week1/hackerrank/easy/08.py | UTF-8 | 433 | 3.078125 | 3 | [] | no_license | n = int(input())
l = []
for x in range(n):
st = input().split(" ")
com = st[0]
if com == "print":
print(l)
if com == "append":
l.append(int(st[1]))
if com == "insert":
l.insert(int(st[1]),int(st[2]))
if com == "remove":
l.remove(int(st[1]))
if com == "pop" and... | true |
7739c8bb7d5dca0ac1b906483c5ee51cb4340f61 | Python | mbejger/pycbc | /pycbc/psd/analytical.py | UTF-8 | 3,390 | 2.53125 | 3 | [] | no_license | #!/usr/bin/python
# Copyright (C) 2012 Alex Nitz, Tito Dal Canton
#
# This program 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 License, or (at your
# option) any later version.
#
# ... | true |
b4da4f55bfa2be90ac6dfc8b248e763d76f0a515 | Python | tudzl/smartdevice | /UnitV k210/test code/Optical Flow Example.py | UTF-8 | 1,317 | 3.328125 | 3 | [] | no_license | # Optical Flow Example
#
# Your OpenMV Cam can use optical flow to determine the displacement between
# two images. This allows your OpenMV Cam to track movement like how your laser
# mouse tracks movement. By tacking the difference between successive images
# you can determine instaneous displacement with your Op... | true |
bc6e9c858f39307b4f6b5fcf74f1002896af312e | Python | gilachus/AWS-PYTHON-videotranslate-etc | /main.py | UTF-8 | 1,374 | 2.734375 | 3 | [] | no_license | import time
import boto3
import uuid
# este es el servicio de transcribe
transcribe = boto3.client('transcribe')
# los jobs deben tener nombre unicos y el nombre todo pegado o con guiones
job_name = "transcribe_" + uuid.uuid4().hex + "_" +"mi_job"
#para saber en que job estoy
print(job_name)
# "The S3 object locatio... | true |
43175ef32b1851e63d1ca0a19286c77f726eced5 | Python | indahanf/NB-machinelearningtupro1.1 | /TUPRO1_ML_1301164004.py | UTF-8 | 2,421 | 3.1875 | 3 | [] | no_license | from functools import reduce
import csv
import pandas as pd
import pprint
class Classifier():
data = None
atribut = None
priori = {}
cp = {}
hipotesis = None
def __init__(self,filename=None, atribut=None ):
self.data = pd.read_csv(filename, sep=',', header =(0))
... | true |
b978914b8998345f15ac8495fe231613b3cda077 | Python | ghkd7214/PYTHON | /study/2021_02_22/turtleex.py | UTF-8 | 513 | 3.09375 | 3 | [] | no_license | import turtle as t
import math
a = t.Turtle()
a.pensize(4)
a.penup()
a.setposition(-300, 200)
a.pendown()
a.circle(60)
a.penup()
a.setposition(-450, -100)
a.pendown()
a.forward(900)
a.penup()
a.setposition(-100, -80)
a.pendown()
a.setheading(90)
a.forward(150)
a.rt(90)
a.forward(100)
a.rt(90)
a.forward(150)
a.penu... | true |
4af2cd454b8060ef9cfcbf7ac63e5abd8d3d9d16 | Python | AFlyingCar/Py2D | /Py2D/IterativeLoop.py | UTF-8 | 1,350 | 2.6875 | 3 | [] | no_license | import pygame
from Managers import ScreenManager,InputManager,SoundManager
from EventBus import *
class IterativeLoop(object):
def __init__(self,name="Default Name",cfg=""):
self.name = name
self.screenManager = ScreenManager.ScreenManager.getInstance()
self.soundManager = SoundMa... | true |
1e4515c4366b86ae551c57a588e26bf4428381b9 | Python | Idealfiller/ttide15 | /ttide.py | UTF-8 | 6,746 | 2.671875 | 3 | [] | no_license | # plotting the energy budget from a structure D.
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
import matplotlib.gridspec as gridspec
import matplotlib.cm as cm
import scipy.signal as signal
def plotEnergyBudget(D):
xl = [-40.,100.]
yl=[0.,400.]
Pu... | true |
8e56ef1bbedce6d5a16520029f5fc5514bd45a21 | Python | smohapatra1/scripting | /python/practice/day4/dictonaties.py | UTF-8 | 240 | 3.71875 | 4 | [] | no_license | #!/usr/bin/python
#Use of Dictionaries
fruits = {"Mango":10 , "Apple":20 , "Grapes":30}
print fruits["Mango"]
#Assign a new value
fruits["Apple"] = 50
print (fruits)
#Remove a values
del fruits["Apple"]
fruits["Mango"] = 100
print fruits
| true |
43afa800b90d05ce85f6851123481ad939f77c90 | Python | doug-101/TreeLine | /source/treespot.py | UTF-8 | 8,452 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python3
#******************************************************************************
# treespot.py, provides a class to store locations of tree node instances
#
# TreeLine, an information storage program
# Copyright (C) 2018, Douglas W. Bell
#
# This is free software; you can redistribute it and/or m... | true |
dae1c86475bae8c8f1c43d0f45abb7248601b0f7 | Python | Ranjit-97/GitDemo | /Python/ExceptionPython.py | UTF-8 | 191 | 3.328125 | 3 | [] | no_license | ItemsIncart = 0
#2 items are added to the cart
if ItemsIncart != 2:
raise Exception('products cart are not matching')
# a = 2
# if a!=2:
# raise Exception("error")
# else :
# print(a)
| true |
b56f31dfbb3653baad0f157866b34653fa7edea8 | Python | DingYuan0118/PythonProgramming | /Chapter9-10/Ex9_2_1.py | UTF-8 | 1,356 | 3.53125 | 4 | [] | no_license | import logging
#logging.basicConfig(level=logging.INFO)
class Car():
"""一次模拟汽车的简单尝试"""
def __init__(self, make, model, year):
self.make = make
self.model = model
self.year = year
self.odometer_reading = 0
def get_descriptive_name(self):
long_name = str(self.year) + ' ' + self.make + " " + self.model
... | true |
d4a5c702f443a2aad5b4f59ec5cd174ae5237991 | Python | as35396425/Touhou-like-STG-based-on-PyGame | /Game/Scene/scene_menu.py | UTF-8 | 4,469 | 2.65625 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
import pygame
from pygame.locals import *
import sys
import globe
from Scene import scene_menu_confirm
from PIL import Image, ImageFilter
# 定义了全局变量: globe.scene_menu_choose, 用于指示暂停菜单的首层选定状况
# 定义了全局变量: globe.scene_menu_flag, 用于向第二层暂停菜单传递首层暂停菜单的选定项
# 这两个全局变量只在 "scene_menu_confirm.py" 中被使用.
clas... | true |
ee3105761b574ac074a1a5ee2cb47bcfd2cc3729 | Python | jpzoll/myPong | /buttonClass.py | UTF-8 | 973 | 3.578125 | 4 | [] | no_license | import pygame
class Button:
def __init__(self, color, x, y, width, height, text = ''):
self.color = color
self.x = x
self.y = y
self.width = width
self.height = height
self.text = text
def draw(self, win, text, x, y):
pygame.draw.rect(w... | true |
6ed00f6dc8b5fb143619041788d6d20dfdffbcb3 | Python | mpenumal/Algos-and-DS-with-Python | /Coding Assignment 3/seamcarver.py | UTF-8 | 11,601 | 3.59375 | 4 | [] | no_license | """
This file provides implementation of Seam Carving.
"""
import pylab
from skimage import filters
from skimage import img_as_float
import numpy
def dual_gradient_energy(img):
"""
Dual gradient energy is the sum of the square of a horizontal gradient and a vertical gradient.
Use skimage.filter.hsobel and... | true |
0c41d01c4aa6cc300a6a1230f4f30e377c808cf0 | Python | zengcong1314/python1205 | /lesson05_if/demo08_运算总结.py | UTF-8 | 468 | 3.734375 | 4 | [] | no_license | # 比较、成员、逻辑运算
print(not None) # NoneType类型 True 表示不为空
#当你进行逻辑运算时,不为 0 的代表 True,0 代表 False
#字符串:空字符串 ==》False,否则就是 True
#表示空,0,False,否则就是True
print(not 1) # False
print(not 0) # True
print(not -1) #False
print(not "abc")
print(not " ")
print(not "")
print(not ["b"])
print(not [])
print(not {})
#不是返回布尔类型
#自己去试试
print(2 ... | true |
f84aa9c08c41ea4b21519e9aed413bbf5a18e9e0 | Python | foreverben1986/mc-begain-learning | /least_mean/lib/data_generation.py | UTF-8 | 448 | 3.265625 | 3 | [] | no_license | import numpy as np
def linearEquation(a, b, c):
x1 = np.random.uniform(-10, 10, 30)
x2 = np.random.uniform(-10, 10, 30)
y = a * x1 + b * x2 + c
return (x1, x2, y)
def linearEquationWithNoise(a, b, c):
linearEquationResult = linearEquation(a, b, c)
noise = np.random.uniform(-10,10,30)
resul... | true |
1f0f87216498a87225c59eeee2376d081696d78d | Python | ptr-yudai/ptrlib | /examples/pwn/ex_sock.py | UTF-8 | 688 | 3.078125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
from ptrlib import *
# establish connection
sock = Socket("www.example.com", 80)
# send request
request = b'GET / HTTP/1.1\r\n'
request += b'Host: www.example.com\r\n\r\n'
sock.send(request)
# receive request until Content-Length
sock.recvuntil("Content-Length: ")
# receive a line
l = int(soc... | true |
94e1e612d422e6b0903f58e7857002595d90adad | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_95/2205.py | UTF-8 | 1,770 | 2.9375 | 3 | [] | no_license | import argparse, sys
code = {'a': 'y', ' ': ' ', 'c': 'e', 'b': 'h', 'e': 'o', 'd': 's', 'g': 'v', 'f': 'c', 'i': 'd', 'h': 'x', 'k': 'i', 'j': 'u', 'm': 'l', 'l': 'g', 'o': 'k', 'n': 'b', 'p': 'r', 's': 'n', 'r': 't', 'u': 'j', 't': 'w', 'w': 'f', 'v': 'p', 'y': 'a', 'x': 'm', 'q': 'z', 'z': 'q'}
alphabet = 'abcdefg... | true |
cd9b8f2236bb58710b12bf77c416dfc78b136f8e | Python | YuwenXiong/Homework-for-Applied-Mathematics-for-Computer-Science | /hw3/hw3.py | UTF-8 | 3,788 | 2.6875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def generate_data():
mean1 = [3, 0]
mean2 = [-1, -3]
mean3 = [4, 5]
sigma1 = np.diag((1, 4))
sigma2 = np.diag((4, 3))
sigma3 = np.array([[2, 1], [1, 2]])
# mean1 = [3, 0]
# mean2 = [4, 5]
# mean3 = [-5, -6]
# sigma1... | true |
f3ca6c7ef5c4c973d1e0c7154917376398f30f49 | Python | Agha-Muqarib/NumPy-Basics-Arrays-And-Vectorized-Computation | /Numpy.py | UTF-8 | 11,298 | 4.28125 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# Installing Numpy Library
# In[1]:
pip install numpy
# Numpy Basic Array Manipulations
# In[2]:
import numpy as np
# Multidimenional array objects (nd arra... | true |
417550544d39b62fbfe07f76544743e3936eb2dd | Python | claraj/web-autograder | /autograder/github_utils.py | UTF-8 | 2,445 | 3.078125 | 3 | [
"Unlicense"
] | permissive | import os
import requests
import logging
logger = logging.getLogger(__name__)
def findFile(repo_url, file):
""" file might be a regular filename 'code.java' or a package+file 'package.code.java' or just the name without extension 'code' """
if not repo_url or not file:
logger.info('Provide file and ... | true |
fa0e7cbd4060bddb8f8c924b171f1146c729acbe | Python | mbarraco/Estadistica_Teorica_2018 | /misc/nonparametric_binomial_test.py | UTF-8 | 1,347 | 3.109375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 24 17:49:07 2018
@author: mm
"""
import pandas as pd
from scipy.stats import binom
import matplotlib.pyplot as plt
import numpy as np
plt.close('all')
datasets_path = "/Users/mm/code/Estadistica_Teorica_2018/datasets/"
df = pd.read_csv(f"{datas... | true |
4de71f19326902fa1ca47a366b9e0fd55128ac44 | Python | Max6411/Python_ | /Matplotlib-4-legend.py | UTF-8 | 996 | 3.390625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(3, 3, 50)
y1 = 2*x + 1
y2 = x**2
plt.figure()
plt.xlim((-1, 2))
plt.ylim((-2, 3))
new_sticks = np.linspace(-1, 2, 5)
plt.xticks(new_sticks)
plt.yticks([-2, -1.8, -1, 1.22, 3], ['really bad', 'bad', 'normal', 'good', 'really good'])
l1, = pl... | true |
2cf91eb148177054349cfb672ffc3e973a25a189 | Python | sohomghosh/Analysis-of-Computer-Science-Publication-Data | /code2.py | UTF-8 | 450 | 2.71875 | 3 | [] | no_license | import nltk
from nltk.corpus import stopwords
stop = stopwords.words('english')
fp=open("out1_clean.csv",'r')
fp1=open("out1_clean3.csv",'w')
while True:
line=fp.readline()
tk=line.split(',')
a=str(tk[0])
if not line:
break
a=a.lower()
k=[i for i in a.split() if i not in stop]
for i ... | true |
19d09b48c9e656f9b1dbfb17131ea9890a6ce7d0 | Python | fmihaich/test_sample_web_app | /tests/system/test_sample_web_app/features/steps/new_user_assertions.py | UTF-8 | 435 | 2.828125 | 3 | [] | no_license | import logging
from behave import step
from hamcrest import assert_that, is_in
@step(u'I see a "{expected_feedback}" feedback message')
def check_input_feedback(context, expected_feedback):
web_app_page = context.current_page
current_feedback = web_app_page.get_feedback_message()
logging.info('Current fe... | true |
48e24af72db4f105a73abae0109e2e29d4b02f1c | Python | Artemiusch/Create-a-platform-for-measurement-disturbances-analyses | /imu-simulation_master/imu_model/imu.py | UTF-8 | 1,448 | 2.59375 | 3 | [
"MIT"
] | permissive | from abc import ABCMeta, abstractproperty
from imu_model.base import Platform
from imu_model.sensors import Accelerometer, Gyroscope
from imu_model.trajectories import StaticTrajectory
from imu_model.environment import Environment
class IMU(Platform):
def __init__(self, accelerometer=None, gyroscope=None,
... | true |
f115c0a64486e2a143d19f6f83b3f8971c538e77 | Python | ethan-jiang-1/ANN-HAPT | /inspect/disp_main_raw_n.py | UTF-8 | 2,732 | 2.59375 | 3 | [] | no_license | # import os
# import sys
import signal
import numpy as np
import matplotlib.pyplot as plt
import os, sys
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.append(parentdir)
from s_data_loader import data_path
plt.style.use('bmh')
def signal_exit_handler(sig, fr... | true |
284e04173f69280830e969d2b6eebd5750537dca | Python | leethomason/saberCNC | /plane.py | UTF-8 | 3,051 | 2.90625 | 3 | [] | no_license | import math
import sys
from mecode import G
from material import init_material
from utility import calc_steps, run_3_stages, GContext, CNC_TRAVEL_Z, nomad_header
import argparse
OVERLAP = 0.80
def square(g, mat, dx, dy, fill : bool):
with GContext(g):
g.relative()
if fill:
num_lines =... | true |
704cb19c31b44a5393a5d93d905797ce99ed3259 | Python | Puzyrinwrk/Stepik | /Поколение Python/email.py | UTF-8 | 1,051 | 3.828125 | 4 | [] | no_license | """
Будем считать email адрес корректным, если в нем есть символ собачки (@) и точки. Напишите программу проверяющую
корректность email адреса.
Формат входных данных
На вход программе подаётся одна строка – email адрес.
Формат выходных данных
Программа должна вывести строку «YES», если email адрес является корректным... | true |
caf3e47a50602eb1296308d6c5cfc7c6f356b6d0 | Python | changwang/VoteNerds | /votes/views.py | UTF-8 | 7,618 | 2.609375 | 3 | [] | no_license | import datetime
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.shortcuts import render_to_response, redirect
from django.template import RequestContext
from django.contrib.auth.forms import UserCreationForm
from django.views.dec... | true |
30ee4b5c95ec0993ba1db85b0b4d3c0dbf14cb70 | Python | CaptainTsao/myDL | /tf_DNN.py | UTF-8 | 8,608 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 26 15:29:39 2018
@author: Administrator
"""
import math
import numpy as np
import h5py
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.python.framework import ops
def load_dataset():
train_dataset = h5py.File('datasets/train_sign... | true |
a67b02c3bc166a18bf9d90decc0dd301751e494c | Python | mida-hub/hobby | /practice/python/basic/061_070/066_binary_search.py | UTF-8 | 832 | 3.765625 | 4 | [] | no_license |
def binary_search(arr, target):
left = 0 # 探索の左端
right = len(arr) - 1 # 探索の右端
for i in range(len(arr)):
search_idx = (left + right) // 2 # 中間値
# print(f'left:{left}')
# print(f'right:{right}')
# print(f'search_idx:{search_idx}')
if arr[search_idx] == target:
... | true |
7bd493969c5bce38a25ee08ed736e924368c8cc3 | Python | computerteach/CSE | /3.2.4/course.py | UTF-8 | 158 | 3.046875 | 3 | [] | no_license | class Course:
def __init__(self, course_name):
self.course_name = course_name
def __str__(self):
return self.course_name | true |
205015ea5bbfb6bdb0233fe8f654784b44a16ce5 | Python | LeitnerD/RLSTUFF | /ave.py | UTF-8 | 120 | 2.625 | 3 | [] | no_license | import os, sys
tmp=file(sys.argv[1],'r')
num=0
count=0
for l in tmp:
num=num+float(l)
count=count+1
print(num/count)
| true |
d20b173e46d09e4acfe41433e74348f90fcf93b1 | Python | OktayGardener/LeetCode | /Python/_3.py | UTF-8 | 406 | 3.203125 | 3 | [] | no_license | class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
n = len(s)
seq = set()
i = 0
j = 0
mmax = 0
while i < n and j < n:
if s[j] not in seq:
seq.add(s[j])
j += 1
mmax = max(mmax, j - i)
... | true |
d290e81f2ff34f3b6c9432919d54fd31d70595a7 | Python | KalePrajwal/PythonDB | /Delete_Book.py | UTF-8 | 1,158 | 3.03125 | 3 | [] | no_license | import mysql.connector as my
con = my.connect(host='bplx7zjluj8ztqdment0-mysql.services.clever-cloud.com', user='utdc4xugroxopi4q', password='l3A4aV1qVd3bMPBHITBG', database='bplx7zjluj8ztqdment0')
curs=con.cursor()
try:
id = int(input('Enter Book id : '))
curs.execute("Select * from Books where Book_I... | true |
7acad3c0b2eafbbc685b6d1f98752152c5449f0a | Python | nemesmarci/Advent-of-Code-2015 | /4/common.py | UTF-8 | 293 | 3.015625 | 3 | [] | no_license | from hashlib import md5
from itertools import count
def find_hash(zeros=5):
with open('input.txt') as data:
base = data.read()
return next(i for i in count(start=1)
if md5((base + str(i)).encode('utf-8'))
.hexdigest()[:zeros] == '0' * zeros)
| true |
6cb993d4be8347e90a9575afe4ceb2b35e8275a2 | Python | lynhan/whiteboard | /tree/tree-diff.py | UTF-8 | 691 | 3.921875 | 4 | [] | no_license | """
Given directed tree
removing an edge will result in two subtrees
tree diff = tree1_sum - tree_sum
Return
min tree diff
"""
def set_tree_sum(node): # assumes node has value
if not node.children:
node.tree_sum = node.val
return node.val
node.sum = node.val
for child in node.c... | true |
ab6876b9167c17c1754edc25df8220e8339f757b | Python | XuanHeIIIS/BNMTF | /experiments/experiments_gdsc/time/nmf_np_time.py | UTF-8 | 2,064 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | """
Run NMF NP on the Sanger dataset.
We can plot the MSE, R2 and Rp as it converges, against time, on the entire dataset.
We give flat priors (1/10).
"""
import sys, os
project_location = os.path.dirname(__file__)+"/../../../../"
sys.path.append(project_location)
from BNMTF.code.models.nmf_np import NMF
from BNMTF... | true |
1a666e720c489f942a333046d89e6b9e68ebf309 | Python | hulkrider/Python-ChatBot | /Deepak_chatbot.py | UTF-8 | 5,782 | 3 | 3 | [] | no_license | class Object:
def __repr__(self):
return '<%s>' % getattr(self, '__name__', self.__class__.__name__)
def is_alive(self):
return hasattr(self, 'alive') and self.alive
class Agent():
def __init__(self):
def program(percept):
return input('Percept=%... | true |
65baf4a601abf57d183c724c54ed73afd60a3e86 | Python | wyseguy7/nonreversible | /build/lib/nrmc/neuro.py | UTF-8 | 51,159 | 2.890625 | 3 | [] | no_license | import numpy as np
from scipy.sparse import csr_matrix
from scipy.special import softmax
from typing import List, Dict, Tuple
def estimate_target_distribution(probs: Dict, dim_t: int = 2) -> np.ndarray:
"""
Estimate target distribution via the average of sorted source probabilities
Args:
probs: a... | true |
f9e450be6150402c52381a2ae4b22a05b7781648 | Python | daniel-zm-fang/Cracking-the-Coding-Interview | /Chapter 2/Intersection.py | UTF-8 | 765 | 4.0625 | 4 | [] | no_license | '''
Given two (singly) linked lists, determine if the two lists intersect. Return the
intersecting node. Note that the intersection is defined based on reference, not value. That is, if the
kth node of the first linked list is the exact same node (by reference) as the jth node of the second
linked list, then they are i... | true |
9bf6f12a64d954f3345060073142afcc0416ef1a | Python | jaryo/myleet | /8.py | UTF-8 | 850 | 3.34375 | 3 | [] | no_license | class Solution(object):
def myAtoi(self, str1):
"""
:type str: str
:rtype: int
"""
str1 = str1.strip()
if(str1 == ''):
return 0
if(str1[0] != '-' and str1[0] != '+' and (str1[0] < '0' or str1[0] > '9')):
return 0
sign = False
... | true |
5319eb10bc13c537847972d1a852152304e43f8c | Python | tristantyler/BlockGame-AC | /HouseObject.py | UTF-8 | 1,394 | 2.8125 | 3 | [] | no_license | import random
from Settings import chestImages
import Blocks
class HouseObject(object):
def __init__(self, width, height):
self.blocksetlist = [Blocks.BlockSet(x * Blocks.mapDict["GRID_SIZE"], y * Blocks.mapDict["GRID_SIZE"], "empty")
for y in range(height) for x in ... | true |
32997321e229b9f1b31323163cf46f152b4952c1 | Python | fgeller/euler | /problem_001/solution.py | UTF-8 | 238 | 3.328125 | 3 | [] | no_license | def findSum(limit=1000):
sum = 0
for number in range(3, limit):
if number % 3 == 0:
sum += number
continue
if number % 5 == 0:
sum += number
print sum
findSum()
| true |
adab87c7135f80bf3440925132fc0e92bbafefcb | Python | predictable-success/predictable_success | /comp/tests.py | UTF-8 | 722 | 3 | 3 | [] | no_license | from django.test import TestCase
from org.models import Employee
from comp.models import CompensationSummary
class CompensationSummaryTest(TestCase):
def test_str(self):
expected = 'John Doe compensation FY2012'
john = Employee(full_name='John Doe')
compensation_summary = CompensationSummar... | true |
f31b362c97c7e1b37f0fbb0b315cd09a20e6de67 | Python | machen/RadiumSorption | /Sorption Experiments/CalcEquilSampleFromScintData.py | UTF-8 | 1,865 | 3.109375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 07 11:31:22 2016
@author: Michael
"""
import numpy as np, pandas as pd
fileLocation = "RaFHYArtificialWater2\\" #Working folder, which contains the input folder and output
dataFile = 'RaFHYArtificialWater2.xlsx' #Name of files
resultFile ='RaFHYArtificialWater2 Equilibr... | true |
1a2cda8039b3c20015454a721e0c67551c8eac42 | Python | mfwarren/FreeCoding | /test/fc_2014_09_30_nose.py | UTF-8 | 266 | 2.53125 | 3 | [
"MIT"
] | permissive | from fc_2014_09_30 import Borg, SubBorg
def test_borg():
a = Borg()
b = Borg()
a.a = 'hi'
assert b.a == 'hi'
def test_subborg():
a = Borg()
b = SubBorg()
a.a = 'HI'
b.b = 'AWESOME'
assert b.a == 'HI'
assert a.b == 'AWESOME'
| true |
0996a0ebf0f3c30415ed7cc2a21956403a6d8bf5 | Python | SiLab-Bonn/testbeam_analysis | /testbeam_analysis/tools/kalman.py | UTF-8 | 23,698 | 2.53125 | 3 | [
"MIT"
] | permissive | import numpy as np
from numba import njit
from numpy import linalg
from testbeam_analysis.tools import geometry_utils
@njit
def _filter_predict(transition_matrix, transition_covariance,
transition_offset, current_filtered_state,
current_filtered_state_covariance):
"""Calcu... | true |
dbb7e160357ac0fea6cc0f07146f1467161712ad | Python | kieferyap/forkpi | /libraries/pynfc-0.0.7.1/build/lib.linux-armv6l-2.7/rfid/libnfc/pycrypto1.py | UTF-8 | 10,217 | 3.109375 | 3 | [] | no_license | """Pycrypto1 module, based on public domain optimized code by I.C.Weiner"""
# Pynfc is a python wrapper for the libnfc library
# Copyright (C) 2009 Mike Auty
# PyCrypto1 is based on public domain optimized code by I.C.Weiner
# See (http://cryptolib.com/ciphers/crypto1/crypto1.c)
#
# This program is free software... | true |
6113d8268157ff84e8efe502353e2e49d73a5893 | Python | Shreyash-310/Sololearn_practice | /regular_exp.py | UTF-8 | 778 | 3.84375 | 4 | [] | no_license | import re
"""pattern = r"spam"
#re.match function can be used to determine whether it matches at the beginning of a string.
if re.match(pattern, "eggspamsausagespam"):
print("Match")
else:
print("No Match")
# The function re.search finds a match of a pattern anywhere in the string.
if re.search(pa... | true |
42fd4b3f119d9d8322d04b82bdd68cf9aadffdcf | Python | s2051497/LeetCode-Easy | /LeetCode #020 - Easy - Valid Parentheses.py | UTF-8 | 4,268 | 3.546875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Jan 21 16:44:11 2021
@author: Jeff
"""
# LeetCode #020 - Easy - Valid Parentheses
#%% Solution 1
class Solution(object):
def isValid(self, s):
"""
:type s: str
:rtype: bool
"""
checklist = {"(":")","[":"]","{":"}"}
... | true |
ce2b406a106915f9b54f1753adef383b05957888 | Python | imn00133/algorithm | /BaekJoonOnlineJudge/CodePlus/500BruteForce/Recursion/baekjoon_1248.py | UTF-8 | 1,528 | 3.125 | 3 | [] | no_license | # https://www.acmicpc.net/problem/1248
# Solved Date: 20.04.17.
import sys
read = sys.stdin.readline
def check(index, arr, ans):
acc = 0
for i in range(index, -1, -1):
sign = arr[i][index]
acc += ans[i]
if sign == 1 and acc <= 0:
return False
elif sign == -1 and ac... | true |
e5f9c88aa53efc1a9d39087561d834f750cf5938 | Python | aahmadai/communities | /communities/algorithms/hierarchical_clustering.py | UTF-8 | 2,643 | 2.921875 | 3 | [
"MIT"
] | permissive | # Standard Library
from itertools import product
from math import sqrt
from statistics import mean
# Third Party
import numpy as np
# Local
from ..utilities import modularity_matrix, modularity
##############
# MATH HELPERS
##############
def inverse_euclidean_dist(A):
p1 = np.sum(A ** 2, axis=1)[:, np.newaxi... | true |
bcd44b900a9d7414ffe1061504c636ec223f8d96 | Python | Khan/engblog | /src/supporting-files/txn_safety.py | UTF-8 | 27,983 | 2.53125 | 3 | [
"CC-BY-4.0",
"MIT"
] | permissive | """Code that monkey-patches GAE's db and ndb classes to ensure txn safety.
"Transaction safety" means detecting and logging instances of possible
corruption of datastore contents. For more information, see
http://engineering.khanacademy.org/posts/transaction-safety.htm
This system works to detect safety violatio... | true |
2fef2d911e1ecce4565d23eb3469274e3b148b28 | Python | vishal-rajpoot/web-scrapping | /main.py | UTF-8 | 1,817 | 4 | 4 | [] | no_license | #INSTALL ALL THE REQUIREMENTS
# pip install requests
# pip install bs4
print("************** DEVELOPED BY VISHAL RAJPUT **************")
# STEP 1:- IMPORT MODULES
import requests # "REQUEST" MODULE DEFINES FUNCTIONS AND CLASSES WHICH HELP IN OPENING URL'S.
import bs4 # HERE "BEAUTIFUL ... | true |
8c80ee1199ef97906f2b036a1df782b4715dc761 | Python | pas/pattern-recognition-2018-purple | /04 - Signature Verification/features.py | UTF-8 | 3,875 | 3.546875 | 4 | [] | no_license | ##
#
# Calculates the feature vectors.
#
##
from math import sqrt
import pandas as pd
import numpy as np
class Features:
EXPECTED_NUM_FEATURES = 4
def __init__(self):
return
# Generates a dictionary. The key is the name of the signature txt file.
# The value is the feature vector of the sig... | true |
f8a057c91bb88e8f330df6d6bc93215dfc0c87c1 | Python | bufferbandit/python_similarweb | /similarweb.py | UTF-8 | 1,336 | 2.84375 | 3 | [] | no_license | from urllib.parse import urlparse
from multiprocessing import Pool
from threading import Lock
import statistics,requests,sys
GREEN = '\033[1;32;48m'
RED = '\033[1;31;48m'
UNDERLINE = '\033[4;37;48m'
END = '\033[1;37;0m'
api_url = "https://data.similarweb.com/api/v1/data?domain="
lock = Lock()
def num_to_word(number... | true |
4f14a89c55bbb073d41924469a477b988f690bfc | Python | rootulp/exercism | /python/atbash-cipher/atbash_cipher.py | UTF-8 | 956 | 2.953125 | 3 | [
"MIT"
] | permissive | import string
class Atbash:
PLAIN = 'abcdefghijklmnopqrstuvwxyz'
PRIME = 'zyxwvutsrqponmlkjihgfedcba'
CIPHER = dict(zip(list(PLAIN), list(PRIME)))
EXCLUDE = set(string.punctuation + ' ')
@staticmethod
def encode(self, msg):
return self.split_every_five(self, self.encoded(self, msg))
... | true |
6fb87f47d19b7c9c1ca879dd54ed1156e2e67b35 | Python | edubraga/Dojo-Myfreecomm | /2011-04-27/intervalos/teste_intervalos.py | UTF-8 | 2,078 | 3.34375 | 3 | [] | no_license | # coding: UTF-8
from unittest import TestCase, main
from intervalos import intervalos
class TestIntervalos(TestCase):
def test_sequencia_curta_continua(self):
entrada = [1, 2, 3]
saida_esperada = '[1-3]'
saida = intervalos(entrada)
self.assertEqual(saida, saida_esperada)
de... | true |
a05d9c7550aad259d4a4aad639da6d107426444b | Python | jorgearanda/advent-of-code-2017 | /day_10.py | UTF-8 | 1,566 | 3.09375 | 3 | [] | no_license | lengths = [int(x) for x in open('inputs/d10-input.txt', 'r').read().strip().split(',')]
ascii_lengths = [ord(x) for x in open('inputs/d10-input.txt', 'r').read().strip()]
ascii_lengths = ascii_lengths + [17, 31, 73, 47, 23]
string = [x for x in range(256)]
def knot_hash_cycle(string, lengths, position=0, skip=0):
... | true |
ca8b3a11e0b1901b1b801c147c833f365c3a0063 | Python | asnaylor/ProductionSystem | /productionsystem/utils.py | UTF-8 | 1,192 | 3.03125 | 3 | [
"MIT"
] | permissive | """Package utility module."""
import os
import shutil
from tempfile import NamedTemporaryFile, mkdtemp
def expand_path(path):
"""Expand filesystem path."""
return os.path.abspath(os.path.realpath(os.path.expandvars(os.path.expanduser(path))))
def igroup(sequence, nentries):
"""
Split a sequence into... | true |
d2f55d1db57a4ad69e6096848ea8990d6b6357fc | Python | paveldedik/neon-py | /tests/test_decoder.py | UTF-8 | 1,628 | 3.1875 | 3 | [
"BSD-3-Clause"
] | permissive | from datetime import datetime
import neon
NEON_DECODE_SAMPLE = """
# neon file - edit it now!
name: Homer
address:
street: 742 Evergreen Terrace
city: "Springfield"
#asdf
country:
- a
whatever:
- b
phones: { home: 555-6528, work: {
asdf: 555-7334,
wtf: 1234,
... | true |
10c31348011918913ff7bfd31e1aa7f135fd98af | Python | germanolleunlp/python-training | /src/helpers/grades.py | UTF-8 | 431 | 3.1875 | 3 | [] | no_license | from statistics import mean
def calculate_average_grades(assignments):
grades = {}
for assignment in assignments:
student = assignment.student.name
try:
grades[student]
except KeyError:
grades[student] = []
finally:
grades[student].append(as... | true |
bd305e8f40b84ee964c9445e89846b203538187c | Python | tcontis/robocup-software | /soccer/gameplay/evaluation/shooting.py | UTF-8 | 6,588 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | import constants
import robocup
import main
## Find the chance of a shot succeeding by looking at pass distance and what robots are in the way
# The total goal angle as well as the percent covered is taken into account
# @param from_point The Point the shot is coming from
# @param excluded_robots A list of robots ... | true |
d272b921fa037e3cb8f3e8b17e9b75c3a6221e7e | Python | mbrannon88/tronn | /tronn/nets/util_nets.py | UTF-8 | 9,396 | 2.578125 | 3 | [
"MIT"
] | permissive | """description: helpful util functions for tensor management
"""
import logging
import numpy as np
import tensorflow as tf
from tronn.util.utils import DataKeys
def build_stack(inputs, params, stack):
"""take a stack of layers (functional, not object oriented)
and stack them
"""
outputs = dict(inpu... | true |
080826834cb399b5ce22bbdead7142e8403d5565 | Python | cj215/large_media | /tutorials/darcy_thermo_mech/moose_team.py | UTF-8 | 2,524 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgpl... | true |
461719893f0741959531d4d11ee78d52bb386c56 | Python | oppianmatt/python-practice | /src/interview_questions/largest_sum_non_adj.py | UTF-8 | 6,906 | 4.4375 | 4 | [] | no_license | '''
Question
========
You are given an array full of positive integers. Write a function that returns
the largest sum you can get by adding together numbers in non-adjacent indices
from the array. I.e. you if you include the things stored in arr[i] in your sum,
you can't include what is stored in arr[i-1] or arr[i+1]... | true |
d2117167f439dd41d96f30eb1c8297c548de183d | Python | eday69/evolveU_exercises | /t_tdd2/oo1_101.py | UTF-8 | 510 | 3.640625 | 4 | [] | no_license | import unittest
class myObject:
def __init__(self, city, height, size):
self.city = city
self.height = height
self.size = size
self.altitude = 1000 + height
def addHeight(self, adding):
self.altitude += adding
class TestOo1(unittest.TestCase):
def test_myObject(s... | true |
2cc0f038ff38b6f54a8de4d46ede750dde51ce65 | Python | kumbharswativ/Core2Web | /Python/DailyFlash/12feb2020/MySolutions/program1.py | UTF-8 | 259 | 4.03125 | 4 | [] | no_license | '''
Write a Program to print series of Deficient Numbers up to nth
element. Where n is number entered by user.
'''
n=int(input("Input:"))
sum=0
for i in range(1,n):
for j in range(1,i):
if(i%j==0):
sum=sum+j
if(sum<i):
print(i,end=" ")
sum=0
| true |
ad98adedbb77d2522f1fd065193f0cbed09fedfa | Python | chriskang24/StockTracker | /StockTracker.py | UTF-8 | 1,246 | 3.09375 | 3 | [] | no_license | """pip install yahoo_fin - on CMD
use: stock_info.get_live_price() -> to call live stock price of stock required
"""
from yahoo_fin import stock_info
from tkinter import *
from datetime import date, timedelta
import matplotlib.pyplot as plt
def stock_price_checker():
stockprice = stock_info.get_live_pr... | true |
0e22da79a0e93659b27e5463104142e3eff117aa | Python | jm-avila/REST-APIs-Python | /Refresher/05_lists_tuples_sets/code.py | UTF-8 | 708 | 4.0625 | 4 | [] | no_license | # List
friendsList = ["Bob", "Rolf", "Anne"]
print("friendsList: ", friendsList[0], friendsList[1], friendsList[2])
friendsList.append("Caro")
print("friendsList: ", friendsList[3])
friendsList.remove(friendsList[0])
print("friendsList: ", friendsList[0])
print()
# Tuple
# Can't be modified.
friendsTuple = ("Bob", "Ro... | true |
56389393649fa74346c65ff4f4664500e9925c43 | Python | crdroidandroid/android_art | /tools/checker/file_format/common.py | UTF-8 | 2,117 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | # Copyright (C) 2014 The Android Open Source Project
#
# 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 ... | true |
7c1c748c65786eb8e57e6ac914b90fab9e6fb05b | Python | agiksyah/simplecrudpy | /fetchall.py | UTF-8 | 308 | 2.59375 | 3 | [] | no_license | #!/usr/bin/python
import MySQLdb as db
import sys
kon = db.connect('localhost', 'root', '', 'crudpy');
cur = kon.cursor()
try:
sql = "SELECT * FROM `user`"
cur.execute(sql)
user = cur.fetchall()
for val in user:
print "Name : %s" %val[1]
except:
print "Select Failed"
if kon:
kon.close() | true |
eba055eb50028fa31ccdb9ba14abb6e57927ae79 | Python | brendaspears/cmfinal | /newnumerical.py | UTF-8 | 1,316 | 3.6875 | 4 | [] | no_license | from sympy import Symbol, Derivative
def f(x):
return x**4 - 3*x**3 + 6*x**2 - 10*x - 9
def derivative1(f, x, h):
return (f(x+h) - f(x-h))/ (2*h)
def derivative2(f, x, h):
return (f(x+h) - 2*f(x) + f(x-h)) / (h**2)
def forward(f,x,h):
return (f(x+h) - f(x))/ h
def backward(f,x,h):
return (f(x) ... | true |
1be3aa73809cd818dcd1dda586e3fa7c504501ec | Python | liuzhiyiyi/badgame | /game/game_functions.py | UTF-8 | 12,702 | 2.53125 | 3 | [] | no_license | import pygame , sys
from bullet import Bullet
from aline import Aline
#from random import randint
from time import sleep
from high_energy_bullet import Highbullet
#from pygame.sprite import Sprite
import random
#from threading import Timer
import _thread
def update_screen(duixiang,screen,data,ship,bullets,alines,... | true |
e05a9e67470e7525df8558838da2b93f7b706344 | Python | kkneomis/thinkful-mentor | /python/requests-test/futures.py | UTF-8 | 903 | 2.875 | 3 | [] | no_license | from requests_futures.sessions import FuturesSession
import time
# session = FuturesSession()
# # first request is started
# future_one = session.get('http://httpbin.org/get')
# # second requests is started immediately
# future_two = session.get('http://httpbin.org/get?foo=bar')
# # wait for the first request to comp... | true |
6170cdf9e349f122c861f1d8ef58756089a54514 | Python | toku-toku-toku/burger_war | /burger_war/scripts/bola_de_arroz.py | UTF-8 | 847 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from navirun import NaviBot
from attackrun import AttackBot
from attack_strategy import AttackStrategy
import rospy
def bola_de_arroz_main():
navi_bot = NaviBot()
attack_strategy = AttackStrategy()
r = rospy.Rate(5) # change speed 5fps
changed = True
... | true |
7a1691afd8e457fa331edd203eb1af997f91f148 | Python | fank-cd/python_leetcode | /Problemset/palindrome-partitioning/palindrome-partitioning.py | UTF-8 | 470 | 3.265625 | 3 | [] | no_license |
# @Title: 分割回文串 (Palindrome Partitioning)
# @Author: 2464512446@qq.com
# @Date: 2019-12-03 11:48:28
# @Runtime: 92 ms
# @Memory: 11.8 MB
class Solution:
def partition(self, s):
res = []
self.helper(s, [],res)
return res
def helper(self,s, tmp,res):
if not s:
... | true |
d10cbaca3cf67c40c452c7393c80b431bc1c10a9 | Python | anderson-jason573/edgeconnect-python | /pyedgeconnect/orch/_gms_smtp.py | UTF-8 | 8,813 | 2.578125 | 3 | [
"MIT",
"BSL-1.0"
] | permissive | # MIT License
# (C) Copyright 2021 Hewlett Packard Enterprise Development LP.
#
# gmsSMTP : Orchestrator server SMTP configuration
def get_gms_smtp_settings(
self,
) -> dict:
"""Get Orchestrator SMTP configuration
.. list-table::
:header-rows: 1
* - Swagger Section
- Method
... | true |
218d65e282590e21cca46b3a555cec1acc798246 | Python | Guanyan1996/LPC_MOT | /learnable_proposal_classifier/svonline/core/affinity.py | UTF-8 | 17,847 | 2.546875 | 3 | [
"MIT"
] | permissive | import numpy as np
from data_types import *
from node import *
from utils import *
from enum import Enum
from abc import ABCMeta, abstractmethod
def sparse2dense(sparse, num):
ret = np.zeros((num,), dtype=np.float32)
ret[:] = MAX_AFFINITY_VAL
for i, v in zip(sparse[0], sparse[1]):
ret[i] = v
re... | true |
a6619dd1b44651f302b6767a1a4488a7080692a1 | Python | Nikkurer/gb_py_basics | /Lesson_3/ex6.py | UTF-8 | 1,991 | 4.53125 | 5 | [] | no_license | """
Реализовать функцию int_func(), принимающую слово из маленьких латинских букв и
возвращающую его же, но с прописной первой буквой. Например,
print(int_func(‘text’)) -> Text.
Продолжить работу над заданием. В программу должна попадать строка из слов,
разделенных пробелом. Каждое слово состоит из латинских букв в ни... | true |
cf64f450f3697446c0c431ef5100de2810e1c6ac | Python | oahehc/tensorflow_example | /VAE.py | UTF-8 | 5,128 | 2.59375 | 3 | [] | no_license | '''
Reference:
https://arxiv.org/pdf/1312.6114.pdf
https://www.youtube.com/watch?v=8zomhgKrsmQ&t=112s
http://blog.csdn.net/jackytintin/article/details/53641885
https://jmetzen.github.io/2015-11-27/vae.html
https://github.com/oduerr/dl_tutorial/blob/master/tensorflow/vae/vae_demo.ipynb
'''
import numpy as np
import ten... | true |
1d248323e1891072a3729ca4b4f2b590dc8b9642 | Python | ATomkowiak/Milionerzy | /pytania.py | UTF-8 | 13,518 | 2.96875 | 3 | [] | no_license | import random
import os
import time
import colorama
import sys
import pyfiglet
from tkinter import *
import termcolor
#NAPRAW KTOS TEN JEBANY BLAD ZE NIE DZIALA CALY PROGRAM
screen = Tk()
screen.geometry("230x298")
screen.resizable(0, 0)
screen.title("Milionerzy")
large_font = ('Verdana', 15)
x = 230
y = 300
e_y = 64... | true |
02fb77cafd590665c02f39501504f400bda84f22 | Python | GuilhermeLaraRusso/python_work | /ch_5_if_statements/5_8_if_elif_else.py | UTF-8 | 758 | 4.625 | 5 | [] | no_license | # Often, you’ll need to test more than two possible situations, and to evaluate
# these you can use Python’s if-elif-else syntax. Python executes only one
# block in an if-elif-else chain. It runs each conditional test in order until
# one passes. When a test passes, the code following that test is executed and
# Pytho... | true |