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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
de24b948950fea8fe059ee56e24e0d2eb0f95681 | Python | parduman/lovebabbar450 | /tree/inorderTreeTraversal.py | UTF-8 | 716 | 4.09375 | 4 | [] | no_license | class Node:
def __init__(self, data=None, left=None, right=None):
self.data = data
self.left = left
self.right = right
def inorderTraversalRecursion (node):
if not node:
return
if node.left:
inorderTraversalRecursion(node.left)
print(node.da... | true |
fcf2ffff2f47aad7c4a85fcb80bab0498461b513 | Python | GMwang550146647/network | /0.leetcode/3.刷题/3.数学/???.素数(core).py | UTF-8 | 1,332 | 3.859375 | 4 | [] | no_license | from fundamentals.test_time import test_time
import math
"""
寻找 [2,n)范围的素数
"""
class Solution():
def __init__(self):
pass
@test_time
def countPrimes(self, n):
"""
从2 计算到 n**0.5
"""
def isPrime(n):
i = 2
while (i ** 2 <= n):
... | true |
e66c1c3d76f90c1475fd11f5ce1825d9165f0c70 | Python | VINITHAKO/pro | /41.py | UTF-8 | 486 | 2.640625 | 3 | [] | no_license | c1,d1=input().split()
c1=int(c1)
d1=int(d1)
m2=''
n1=2
if(c1+d1<=3):
for i in range(0,c1+d1):
if(i%2!=0):
m2=m2+'0'
else:
m2=m2+'1'
else:
for i in range(0,c1+d1):
if(i==n1):
m2=m2+'0'
if(n1==d1):
n1=n1+2
else... | true |
126190f5d09e97abf7e73a67cba64c4aa9166423 | Python | baranbbr/MinecraftChatbot | /inputConsole.py | UTF-8 | 476 | 2.890625 | 3 | [] | no_license | # This file is for testing the code within the console.
import meaning
from ChatBot import inputRefactor
from ChatBot import messageHandler
refactorer = inputRefactor.InputRefactor()
meaning = meaning.Meaning()
messageHandler = messageHandler.MessageHandler()
while True:
msg = input("Talk to me: ")
refactore... | true |
5bed25b7b9f52ea2b2ee15b373e8db7b69f4dab5 | Python | OrganizaP/Python | /Sort algorithms/bubble.py | UTF-8 | 373 | 3.71875 | 4 | [] | no_license | import numpy as np
a = -12.
b = 12.
N = 4
# Generates a random array of N elements between a and b
v = np.random.rand(N)*(b-a) + a
#print (v)
# Bubble sort (ascending order)
while(True):
count = 0
print (v)
for i in range(N-1): # Starts with 0 to N-1
if (v[i+1]<v[i]):
v[i], v[i+1] = v[i+1], ... | true |
9243e309e7a7298be833c3b64ad750839dc6fd89 | Python | kimkh0930/practice | /python/my_first_module/my_email.py | UTF-8 | 333 | 3.078125 | 3 | [
"MIT"
] | permissive | class Email:
def __init__(self):
self.from_email = ''
self.to_email = ''
self.subject = ''
self.contents = ''
def send_mail(self):
print('From: '+ self.from_email)
print('To: '+ self.to_email)
print('Subject: '+ self.subject)
print('Contents: '+ s... | true |
a655371794ad7a18d94f259cd561d30b75c85ed1 | Python | guyBy/PythonWEB | /Lesson1/BasicVars.py | UTF-8 | 588 | 3.515625 | 4 | [] | no_license | i = 7
print(f'i = {i}')
i = i + 5
print(f'i after add = {i}')
i -= 5
print(f'i after subtruct = {i}')
i /= 2
# note that divide i converted to float
print(f'i after divide = {i}')
i *= 4
print(f'i after multiply = {i}')
# integer divide as float
print(f'i after integer divide i = {i}, integer divide = {i // 3},'
... | true |
865c9c5272e70dcf34c3fd89acdcd33e4d463d16 | Python | tfboyd/benchmark_harness | /oss_bench/tools/nvidia_test.py | UTF-8 | 2,108 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | """Tests nvidia_tools module."""
import unittest
from mock import patch
import tools.nvidia as nvidia
class TestNvidiaTools(unittest.TestCase):
@patch('tools.local_command.run_local_command')
def test_get_gpu_info(self, run_local_command_mock):
"""Tests get gpu info parses expected value into expected compo... | true |
f8454778ab3ac778df40d217b756945d4412d0be | Python | cveazey/ProjectEuler | /2/e2.py | UTF-8 | 311 | 3.453125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import itertools
def fib(upper):
seq = [1, 1]
while True:
next = seq[-2] + seq[-1]
if next > upper:
break
seq.append(next)
return seq
def main():
s = sum(itertools.ifilterfalse(lambda x: x%2, fib(4000000)))
print('sum is {0}'.format(s))
if __name__ == '__main__':
main() | true |
a2fad8c396bf2c095340d89b11ea1a4bb2fb794d | Python | daniel-reich/ubiquitous-fiesta | /g3BokS6KZgyYT8Hjm_22.py | UTF-8 | 142 | 3.5 | 4 | [] | no_license |
def shift_to_left(x, y, ans=2):
if y == 0:
return x
if y == 1:
return x*ans
return shift_to_left(x, y-1, 2*ans)
| true |
f796b537c9853da3fee4deb1a61714178fbba997 | Python | grafana/graphite-web | /webapp/graphite/intervals.py | UTF-8 | 4,533 | 3.203125 | 3 | [
"Apache-2.0"
] | permissive | INFINITY = float('inf')
NEGATIVE_INFINITY = -INFINITY
class IntervalSet:
def __init__(self, intervals, disjoint=False):
self.intervals = intervals
if not disjoint:
self.intervals = union_overlapping(self.intervals)
self.size = sum(i.size for i in self.intervals)
def __r... | true |
c5e489f48afc28e64eb57caad63e4c5bbd5cfbde | Python | Rinatgi/budget | /ui.py | UTF-8 | 456 | 3.453125 | 3 | [] | no_license | ''' Программа контроля
рахода семейного бюджета'''
from tkinter import Tk
def create_window():
window = Tk()
# ширина экрана
w = window.winfo_screenwidth()
# высота экрана
h = window.winfo_screenheight()
window.title('Бюджет семьи')
window.geometry('{}x{}'.format(w, h))
... | true |
1973ebf240faee2002e0cdb0dae36834daccfd6c | Python | ramsaran-vuppuluri/LearningPythonHardway | /learnPythonTheHardWayEx16.py | UTF-8 | 577 | 3.875 | 4 | [] | no_license | fileName = raw_input("Enter file path")
print "We're going to erase %r."%fileName
print "If you don't wasnt press CTRL+C (^+C)."
print "If you want to continue press RETURN."
raw_input("?")
print "Opening the file"
file = open(fileName, 'w')
print "Truncating the file"
file.truncate()
print "Now I'm going to ask y... | true |
f5b9bc8b1bb57c8aafa9a734491bebfd3387ddcf | Python | dhairyap99/TileMatchingGame | /app.py | UTF-8 | 2,156 | 3.15625 | 3 | [] | no_license | #importing the pygame module and specific modules of display and event from pygame
import pygame
import game_config as gc
from animal import Animal
from time import sleep
from pygame import display, event, image
def find_index(x, y):
row = y // gc.IMAGE_SIZE
col = x // gc.IMAGE_SIZE
index = row * gc.NUM_T... | true |
091784d69800243d54e98a3d73a6d1558792da31 | Python | kateliev/TypeRig | /Lib/typerig/proxy/fl/objects/sampler.py | UTF-8 | 12,534 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | # MODULE: Typerig / Proxy / Sampler (Objects)
# -----------------------------------------------------------
# (C) Vassil Kateliev, 2020 (http://www.kateliev.com)
# (C) Karandash Type Foundry (http://www.karandash.eu)
#------------------------------------------------------------
# www.typerig.com
# No wa... | true |
90718b9f14097d05c4b55bcea2e915870ac0f1ea | Python | imtiaz-rahi/Py-CheckiO | /O'Reilly/I Love Python!/creative-3.py | UTF-8 | 385 | 2.8125 | 3 | [] | no_license | # https://py.checkio.org/mission/i-love-python/publications/gyahun_dash/python-3/except-me-in-the-lie/
def i_hate(language):
if language == 'Python':
raise MemoryError(language)
else:
return 'I hate {}!'.format(language)
def i_love_python():
try:
return i_hate('Python')
except M... | true |
ca5505ccf435a63558dfaa4c9dd2d5269a323b3c | Python | MrLIVB/BMSTU_AA | /hw_01/algorithm.py | UTF-8 | 806 | 3.1875 | 3 | [
"MIT"
] | permissive | def alg(matr, rows, cols):
avg = 0 # 1
avg_cnt = 0 # 2
for i in range(rows):
for j in range(cols):
avg = avg + matr[i][j] # 3
avg_cnt = avg_cnt + 1 # 4
avg = avg / avg_cnt # 5
max_el = matr[0][0] * avg #... | true |
185ed25255e8092276f8be0d78850feef8e3fab3 | Python | lixiang2017/leetcode | /adventofcode/2021/day12/part1/paths.py | UTF-8 | 1,005 | 2.921875 | 3 | [] | no_license |
from collections import defaultdict
def paths_count(file_name):
graph = defaultdict(list)
big = set()
with open(file_name) as f:
for line in f:
line = line.strip()
u, v = line.split('-')
graph[u].append(v)
graph[v].append(u)
for x in [u... | true |
f86fb2b085ae58e4f109115a568fdbf77ddbeb98 | Python | lucaskotres/EPMProcessorExamples | /advanced/distance_between_coordinates.py | UTF-8 | 282 | 3.5 | 4 | [
"MIT"
] | permissive |
from math import cos, asin, sqrt
def distance(lat1, lon1, lat2, lon2):
p = 0.017453292519943295 #Pi/180
a = 0.5 - cos((lat2 - lat1) * p)/2 + cos(lat1 * p) * cos(lat2 * p) * (1 - cos((lon2 - lon1) * p)) / 2
return 12742 * asin(sqrt(a))
print(distance(25,49,26,53)) | true |
588bfb23a1357b742c08ae9c472b42072dac4000 | Python | gmonkman/python | /opencvlib/perspective.py | UTF-8 | 5,068 | 2.84375 | 3 | [] | no_license | # pylint: disable=C0103, too-few-public-methods, locally-disabled,
# no-self-use, unused-argument
'''edge detection and skeletonization
'''
#Link to integration
#https://stackoverflow.com/questions/13320262/calculating-the-area-under-a-curve-given-a-set-of-coordinates-without-knowing-t
#https://www.khanacademy.org/mat... | true |
ffbdeb67ca45b39f7f3c35ca05e9ba4176b11d10 | Python | Pedrocereja/Pinball | /arduino.py | UTF-8 | 365 | 2.703125 | 3 | [] | no_license | from pyfirmata import Arduino, util, INPUT, OUTPUT
from time import sleep
class Sensor:
def __init__(self, pin, valor, board):
self.pin = board.get_pin('d:{0}:i'.format(pin))
self.valor = valor
self.pin.enable_reporting
sleep(0.05)
def status(self):
return self.pin.read()
#sensor = Sensor(2,500)
#while ... | true |
5b7532b5a7a8087a3b335a9a3a07a7eb6cc1369e | Python | vmkhlv/rusenteval | /probing/arguments.py | UTF-8 | 2,047 | 2.515625 | 3 | [] | no_license | from dataclasses import field, dataclass
@dataclass
class ProbingArguments(object):
"""
An object to store the experiment arguments
"""
seed: int = field(default=42, metadata={"help": "random seed for initialization"})
prepro_batch_size: int = field(
default=128, metadata={"help": "batch ... | true |
7be7b8ca83eb23d3cf7f5d5e70ed3c01f6e942b5 | Python | newcanopies/moon | /Kobuki/Kobuki_line_glider | UTF-8 | 5,907 | 2.828125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import roslib
import sys
import rospy
import cv2
import numpy as np
from cv_bridge import CvBridge, CvBridgeError
from geometry_msgs.msg import Twist
from sensor_msgs.msg import Image
class LineFollower(object):
def __init__(self):
self.bridge_object = CvBridge()
self... | true |
4ebaef8dbc669ce2e56391dc20be8d7bbabf1c83 | Python | CameronLuyt69/Python-Work | /DataTypesEx2.py | UTF-8 | 588 | 3.640625 | 4 | [] | no_license | Num = [56, 78, 34, 21, 56, 34, 125, 45, 89, 75, 12, 12, 56]
Sum = [56+78+34+21+56+34+124+45+89+75+12+56]
print(Sum)
Num = [56, 78, 34, 21, 56, 34, 125, 45, 89, 75, 12, 12, 56]
Num.sort()
print(Num)
print("Smallest element is:", min(Num))
print("Largest element is:", max(Num))
Num = list(dict.fromkeys(Num))
print(Num)
... | true |
ab1e3a4ecc4fd24ebee8af0f66d451b97d76b119 | Python | yuedongyang/GRASP | /evaluation.py | UTF-8 | 4,898 | 2.625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
'''
Usage:
python3 evaluation.py --mode='single'
--test_dataset='ph'
--train_model='py'
--window_size=37
'''
import argparse
import json
from sklearn.externals import joblib
from utils import *
if __name__=="__main__":
parser = argparse.ArgumentParser()
parser.add_argu... | true |
8a2747b40cf4179f4a8c88e25b19fbb5a856a6f6 | Python | anhaeh/pyescoba | /pygame_entities/sprites.py | UTF-8 | 1,971 | 3.046875 | 3 | [] | no_license | import pygame
from pygame.locals import RLEACCEL
class CardSprite(pygame.sprite.Sprite):
def __init__(self, card, posx, posy, index, show_card):
self.image_number = card.number
if card.number > 7:
self.image_number = card.number + 2
pygame.sprite.Sprite.__init__(self)
... | true |
845d45732da9cf465acc8e1d3d9940a4693272e4 | Python | RickyHuo/leetcode | /python/python2/uncommon-words-from-two-sentences.py | UTF-8 | 553 | 3.1875 | 3 | [] | no_license | class Solution(object):
def uncommonFromSentences(self, A, B):
"""
:type A: str
:type B: str
:rtype: List[str]
"""
items = {}
res = []
for i in A.split(" ") + B.split(" "):
if items.has_key(i):
items[i] += 1
els... | true |
c2ef9df26ad6bf9334390528fabf4d11aaa8d872 | Python | Abhijith-1997/pythonprojects | /array/pop.py | UTF-8 | 63 | 2.734375 | 3 | [] | no_license | lst=[1,2,3,4,5]
# lst.pop(2)
# print(lst)
lst.pop()
print(lst) | true |
b7c5bdacae6151bc34930575b9103d5131b8052d | Python | rundongliu/leetcode-python | /Pascal's Triangle.py | UTF-8 | 417 | 3.03125 | 3 | [] | no_license | class Solution:
# @return a list of lists of integers
def generate(self, numRows):
result = []
if numRows==0:
return result
result.append([1])
for i in range(2,numRows+1):
lst = [1]
for j in range(1,i-1):
lst.append(result[-1][j... | true |
9ba138e0f3a12be8c7a179a07e7c67f73cfd081c | Python | mollinaca/ac | /code/practice/abc/abc020/b.py | UTF-8 | 88 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
n,m = input().split()
print (int(n+m)*2)
| true |
1102f389120000da978d08f07f63f300fd1bd163 | Python | swmmrman/TempMonitor | /live_monitor.py | UTF-8 | 740 | 2.84375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""Live monitor for the arduino chinchilla room temperature monitor"""
import sys
import time
import serial
try:
mon = serial.Serial('/dev/ttyUSB0', 115200)
while True:
line = mon.readline().decode('utf-8').strip()
t = time.asctime(time.localtime(time.time()))
... | true |
58d7f1567af6463a60e7046198f8672888d7aed1 | Python | Shamir-Lab/Recycler | /paper/tally_hits.py | UTF-8 | 4,264 | 2.671875 | 3 | [] | permissive | import argparse, sys
sys.path.insert(0, '../recycle/')
from recycle.utils import *
import numpy as np
def count_property_range_hits(prop, node_dict, hits):
""" picks which values to use in tuples based on property
counts vals having min_val <= val < max_val
unless max_val == overall_max, where min_val <= val <=... | true |
8aa8cb342a59fa79045b983f2010490ab4258fca | Python | Bayonetta/ZSChatSystem | /check.py | UTF-8 | 661 | 3.140625 | 3 | [
"Apache-2.0"
] | permissive | from binascii import b2a_hex, a2b_hex
from Crypto.Cipher import DES
import sys
#key = '12345678'
while 1:
key = raw_input('Please input the key(8 bytes): ')
if key == '12345678':
file = open('history', 'r')
try:
text = file.read()
finally:
file.close()
... | true |
2f69cab1f6c54b5ea04ebab413e73dc88f8759ac | Python | markhdavid/NYBC | /PyYiddish/corpus_builder.py | UTF-8 | 2,756 | 3.03125 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | import nltk
from xml.etree import ElementTree as et
import json
import codecs
import argparse
def crappy_tokenize(path):
prefix = "{http://www.mediawiki.org/xml/export-0.8/}"
all_wiki_pages = et.parse(path)
root = all_wiki_pages.getroot()
structured_data = {}
raw_data = {}
id_ = 0
for page ... | true |
868171a525e7848d25207f0dab842b9a26674570 | Python | edfan/Project-Euler | /38.py | UTF-8 | 846 | 3.734375 | 4 | [] | no_license | def pandigital(x):
currentnum = []
for y in str(x):
currentnum.append(int(y))
currentnum.sort()
if currentnum == [1, 2, 3, 4, 5, 6, 7, 8, 9]:
return True
else:
return False
currentmax = 0
for x in range(10, 34):
concenated = int(str(x) + str(2 * x) + str(3 * x) + str(4 ... | true |
9d3ab2640ae5581b35ff61e261a1f7c756954084 | Python | yuolvv/TestSpider | /xiaobai/MongoQueue.py | UTF-8 | 3,528 | 3.1875 | 3 | [] | no_license | from datetime import datetime,timedelta
from pymongo import MongoClient,errors
class MongoQueue():
#初始状态
OUTSTANDING = 1
#正在下载状态
PROCESSING = 2
#下载完成状态
COMPLETE = 3
def __init__(self,db,collection,timeout=300):
#初始mongodb连接
self.client = MongoClient()
self.Client =... | true |
513849c55c5105baf5a06a00711938b64464fb87 | Python | n0execution/Cracking-the-code-interview | /Stacks_Queues/python/LimitedStack.py | UTF-8 | 866 | 3.578125 | 4 | [] | no_license | from exceptions import StackFullException, StackEmptyException
class LimitedStack(object):
def __init__(self, max_size):
self.max_size = max_size
self.size = 0
self.top = None
self.elements = []
def __str__(self):
return self.elements.__str__()
def push(self, x):
... | true |
ba124f038f63ace2a0106ef750af00a92f0b00dd | Python | sara/garfield | /garfield/dashboard/util.py | UTF-8 | 545 | 3.171875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | import datetime
import pytz
def daterange(start_date, end_date):
for n in range(int((end_date - start_date).days)):
yield start_date + datetime.timedelta(n)
def daterange_by_week(year, week):
start_date = datetime.datetime.strptime("{0} {1} 1".format(year, week),
... | true |
61a72a952b76885e2d5c1733e22cb5a4dbcfdeaa | Python | mosesxie/CS1114 | /Lab #11/q4.py | UTF-8 | 522 | 3.15625 | 3 | [] | no_license | def html_table_generator(filename):
f = open(filename, 'r', encoding="UTF-8")
html = "<html> \n<table> \n"
for line in f:
row = line.split(",")
html = html + "\t <tr> \n"
for word in row:
html = html + "\t\t<th>" + word + "</th>\n"
html = html + "\t</tr> \... | true |
7038a994503a1106925eee57e712cd2c4fce0d5b | Python | 8devendra/python-openCV-project | /07_date_video.py | UTF-8 | 795 | 2.671875 | 3 | [] | no_license | import cv2
import datetime
cap=cv2.VideoCapture(0)
w=str(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
h=str(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
print(w)
print(h)
##you can set size of cam win
#set(cv2.CAP_PROP_FRAME_WEIDTH,202)
while(cap.isOpened()):
ret, frame=cap.read()
if ret == True:
font=cv2.FONT_HERSHEY_S... | true |
c3294d14dcfcd9340c61bc2ac7e9fbe76f58e860 | Python | miocalla/LCA_Python | /LCA_Python/LCA_Test.py | UTF-8 | 2,591 | 3.421875 | 3 | [] | no_license | import unittest
from LCA import *
root = Node(1)
root.left = Node(2)
root.right = Node(3)
root.left.left = Node(4)
root.left.right = Node(5)
root.right.left = Node(6)
root.right.right = Node(7)
'''
1
/ \
2 3
/\ /\
4 5 6 7
'''
class testLowestCommonAncestor(unittest.TestCase)... | true |
0637422638e477dfeeec7bbf592a9e489949fd8d | Python | eraserxp/energy_transfer | /changing_field_orientation/center_locations.py | UTF-8 | 396 | 2.625 | 3 | [] | no_license | from numpy import *
from pylab import *
x, y = loadtxt("center_locations.dat", usecols=[1,2], unpack=True)
#(a, b) = polyfit(x,y,1)
#angle = arctan(a)*180/pi
#angle = angle.round(decimals=1)
#yfit = polyval([a,b],x)
title("The motion of wavepacket in space")
plot(x,y, 'k.')
xlabel('x')
ylabel('y')
#plot(x,yfit,'r')
sa... | true |
d017a70d825bd4f94ab11394bba8c341c5b9dd87 | Python | rajikalk/Scripts | /Modules/sfrimann/binned_statistic.py | UTF-8 | 1,135 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
# so that python 2.x and 3.x will work the same
from __future__ import print_function, absolute_import, division
from scipy.stats import binned_statistic as bin_stat
import numpy as np
def binned_statistic(xdata,ydata,range=None,xlog=False,ylog=False,nbin=10,sigma=1.):
if range is None:
i... | true |
7d4113d59a09fca22a47b35baad1dab3825819b6 | Python | miniyk2012/leetcode | /leetcode_projects/leetcode_78/solution.py | UTF-8 | 630 | 3.328125 | 3 | [] | no_license | from typing import List
class Solution:
def subsets(self, nums: List[int]) -> List[List[int]]:
if not nums:
return [[]]
rets = []
self.dfs_subsets(nums, 0, rets, [])
return rets
def dfs_subsets(self, nums, index, rets, ret):
if index >= len(nums):
... | true |
836759ce41b239cf596a05544059103e1e51de0f | Python | soyoonjeong/python_crawling | /soyoon news/main.py | UTF-8 | 706 | 2.796875 | 3 | [] | no_license | import requests
from flask import Flask, render_template, request
base_url = "http://hn.algolia.com/api/v1"
# This URL gets the newest stories.
new = f"{base_url}/search_by_date?tags=story"
# This URL gets the most popular stories
popular = f"{base_url}/search?tags=story"
# This function makes the URL to get the d... | true |
e0b2e962db2ea1fb7fdf06cb5ef53f6988a405d8 | Python | tfredwell/cs4500 | /cozmo_taste_game/robot/cozmo_robot.py | UTF-8 | 2,419 | 2.84375 | 3 | [] | no_license | import asyncio
from asyncio import sleep
from typing import List
from cozmo.robot import Robot
from cozmo_taste_game.robot import EvtWrongFoodGroup, EvtCorrectFoodGroup, EvtUnknownTag, EvtNewGameStarted
import logging
logger = logging.getLogger('cozmo_taste_game.robot')
class RealTasterBot:
def __init__(self)... | true |
2696f6499ed2f39bd3100a0aef7be905b2e7ccb7 | Python | keisuke-isobe/Magic8Ball | /cs2a-flask/flask_final_project.py | UTF-8 | 6,643 | 3.484375 | 3 | [] | no_license | """
This flask app presents a webpage which acts as an interactive Magic 8 Ball. It has a
larger variety of responses (and more ambiguity) than your traditional Magic 8 Ball.
There are two necessary APIs for this project: the indico.io API which was used in class,
and the Google Cloud Natural Language Processing API. T... | true |
ac08b61ccebd169a259706cbf8fc64795e79f0f7 | Python | zhifanzhu/Local-Mid-Propagation | /mmdet/models/losses/bootstrapped_sigmoid_classification_loss.py | UTF-8 | 2,782 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | import torch
import torch.nn as nn
import torch.nn.functional as F
from .utils import weight_reduce_loss
from ..registry import LOSSES
@LOSSES.register_module
class BootstrappedSigmoidClassificationLoss(nn.Module):
"""From Google's Object Detction API:
Bootstrapped sigmoid cross entropy classification loss f... | true |
ab8eaac7282d3a3c45b375544a8ddb290676f8b2 | Python | sympy/sympy | /sympy/core/containers.py | UTF-8 | 11,315 | 3.4375 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | """Module for SymPy containers
(SymPy objects that store other SymPy objects)
The containers implemented in this module are subclassed to Basic.
They are supposed to work seamlessly within the SymPy framework.
"""
from collections import OrderedDict
from collections.abc import MutableSet
from typing impo... | true |
5e3e0d8e5be24172b13d78b40738af7b2c53e418 | Python | nvnnv/Leetcode | /1717. Maximum Score From Removing Substrings.py | UTF-8 | 699 | 2.875 | 3 | [] | no_license | class Solution:
def maximumGain(self, s: str, x: int, y: int) -> int:
if x > y:
df = ['ab', 'ba']
p = [x, y]
else:
df = ['ba', 'ab']
p = [y, x]
q = []
x = s
ans =0
for i in range(len(df)):
for j in r... | true |
fd184647b32187f497b68c383b444e03578ea89e | Python | leisquare/study_bigdata | /10_Django/ch02_wordcnt/wordcnt/views.py | UTF-8 | 781 | 2.6875 | 3 | [] | no_license | from django.shortcuts import render
# Create your views here.
def wordinput(request):
return render(request, "wordinput.html")
def result(request):
full = request.GET['fulltext'] #안녕 방가 안녕
strlength = len(full)
words= full.split() # ['안녕', '방가', '안녕']
words_dic = {} #{'안녕':,'방가':1}
for wor... | true |
d2b877bb7c98b93800d88a573a34992ec57840de | Python | Dmevo/WebTheater | /application/model/entity/categoria.py | UTF-8 | 1,142 | 2.671875 | 3 | [] | no_license | class Categoria:
def __init__(self, id = None, nome = None, url_foto = None, descricao_categoria = None, lista_video = None):
self.id = id
self.nome = nome
self.quantidade_videos = 0
self.url_foto = url_foto
self.lista_video = lista_video
def set_nome(self, nome):
... | true |
73d08c117822ded5988478ca1cec380c15168919 | Python | nuarlyss/python_test_kemampuan_dasar | /matauang.py | UTF-8 | 232 | 3 | 3 | [] | no_license | #konversi mata uang usd2eur
dmatauang2idr = {'IDR': 1, 'USD': 14425, 'EUR': 16225}
def usd2eur(usd):
USD = dmatauang2idr['USD'] * usd
EUR = USD / dmatauang2idr['EUR']
value = EUR
return value
print(usd2eur(100))
| true |
a5dfd8abba90e103d6cd5da1ff3ddedeae641be0 | Python | gabriellaj45/BoardBooster | /matchTemplate.py | UTF-8 | 1,697 | 2.828125 | 3 | [] | no_license | import cv2
import os
from histogramColorClassifier import HistogramColorClassifier
def matchTemplate(image):
histClassifier = HistogramColorClassifier(channels=[0, 1, 2],
hist_size=[128, 128, 128],
hist_range=[0, 256, 0, 2... | true |
0565bcc445d34aa61db09332862ac4598dc94ba5 | Python | vlmikov/Python | /Multidimensional lists/03. Primary Diagonal.py | UTF-8 | 448 | 3.59375 | 4 | [] | no_license | def sum_primary_diagonal(matrix):
the_sum = 0
rows = len(matrix)
for r in range(rows):
the_sum += matrix[r][r]
return the_sum
def read_matrix(size):
matrix = []
rows = size
for r in range(rows):
current = list(map(int, input().split(" ")))
matrix.append... | true |
1abc7e4fb415806ad8349bb51dd35f9a08f194ec | Python | stryker2k2/examprep | /CR_Training_Student_VS2015/Python/01. Python Practice/test_cases.py | UTF-8 | 3,082 | 2.609375 | 3 | [] | no_license | import unittest
from test_module import testDir, chngLetters, correctSentences, reverseWords, obfuscatedStrings, combineSentences, key,\
insertSentences, deleteWords, correctDict, ERROR_INVALID, ERROR_NOT_FOUND
import test_code
class TestDictionaryMethod(unittest.TestCase):
def test_dictionary(self):
o... | true |
99f37f9582965de26cb027ffb2d65b5ed9fe0f1f | Python | pvu1984/cage-challenge-2 | /CybORG/CybORG/Agents/Wrappers/TrueTableWrapper.py | UTF-8 | 3,796 | 2.65625 | 3 | [
"MIT"
] | permissive | from copy import deepcopy
from pprint import pprint
from prettytable import PrettyTable
from CybORG.Shared.Enums import TrinaryEnum
from CybORG.Agents.Wrappers.BaseWrapper import BaseWrapper
class TrueTableWrapper(BaseWrapper):
def __init__(self,env=None,agent=None, observer_mode=True):
super().__init__(e... | true |
245735d9adf8a9fb6499490e839447eb6189fd16 | Python | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/bob/81246fcb208d4654bf83664b46f9825d.py | UTF-8 | 641 | 3.46875 | 3 | [] | no_license | import re
class Bob:
def hey(self,str):
'''
if(str.strip() == ''):
return 'Fine. Be that way!'
if(re.match(r"[A-Z]",str) and re.match(r"[a-z]",str) != None):
return 'Woah, chill out!'
if(re.match(r"\?\Z",str)):
return "Sure."
return "Whatever."
'''
if not str.strip():
return "Fine. B... | true |
0452dd36c744042acb64074f64169ed5a20d915d | Python | lileijava/lianjia_crawl | /transposed_test.py | UTF-8 | 95 | 3.203125 | 3 | [] | no_license | array = [[1,2,3,4],[5,6,9],[7,8]]
transposed = zip(*array)
print(array)
print(list(transposed)) | true |
5ade3248d1c814857ecc19af8ad95384952effc9 | Python | msbhati08/Airflow | /src/unittest/dags/my_dag_tests.py | UTF-8 | 1,777 | 2.71875 | 3 | [
"Unlicense"
] | permissive | import unittest
from airflow.models import DagBag
class TestMySampleDAG(unittest.TestCase):
"""Check MyDAG expectation"""
def setUp(self):
self.dagbag = DagBag()
def test_task_count(self):
"""Check task count of MyDAG"""
dag_id = 'simple-airflow'
dag = self.dagbag.get_dag... | true |
a8343c53088be203d6b4a36803e909fe805ef665 | Python | dreadlordow/Python-Fundamentals | /3.Lists_basics/4.Search.py | UTF-8 | 260 | 3.609375 | 4 | [] | no_license | n = int(input())
word = input()
string = []
for _ in range(n):
sentence = input()
string.append(sentence)
string_with_word = []
for j in string :
if word in j :
string_with_word.append(j)
print(string)
print(string_with_word) | true |
b74fe0b51faed63613cf1d30dca34a6a30a9ad04 | Python | leventarican/cookbook | /python/import_modules.py | UTF-8 | 597 | 3.828125 | 4 | [] | no_license | # we have build in functions
print('for sure this one is build in')
print( 'python chars [use of str and len functions]: ' + str(len('python')) )
# now lets extend our vocabulary; like random, sys, os and math
import random # import module called random
a_random_number = random.randint(0,9)
print(a_random_number)
#... | true |
7aa381bebf30f22240036f29dbc4a8fe3766e829 | Python | NikilMunireddy/SmartChain | /SmartChain/RestAPI/RestAPI/API/Packages/auth_api/RandomNumberPool/delete_number.py | UTF-8 | 793 | 2.890625 | 3 | [] | no_license | import argparse
from .. import db_connection
# Delets a number from database and returns the count of rows removed
def delete_number(number,conn):
conn =db_connection.get_connection()
cursor = conn.cursor()
SQL_QUERY = "DELETE FROM random_number_pool WHERE random_number =%s"
value=(number,)
curso... | true |
41d23b98eb1704f1af017139bc1f4111b2ce9adb | Python | xiaoloinzi/pycharm_02 | /20190422/make_excel_file.py | UTF-8 | 547 | 3.046875 | 3 | [] | no_license | #encoding = "utf-8"
import locale,datetime,time
from openpyxl import Workbook
wb = Workbook()#创建文件对象
ws = wb.active #获取第一个sheet
ws['A1'] = 42 #写入数字
ws['B1'] = "光荣之路"+"automation test"#写入中文
ws.append([1,2,3])#写入多个单元格
ws['A2'] = datetime.datetime.now()#写入一个当前时间
#写入一个自定义的时间格式
locale.setlocale(locale.LC_CTYPE,'chinese'... | true |
2311ff4cf28f72c20b4f2e012ae41bd970fa46c0 | Python | rogueflynn/NetworkProgramming | /pythonCode/xmlParsing.py | UTF-8 | 219 | 2.796875 | 3 | [] | no_license | import xml.etree.ElementTree as Et
xmlData = "<data><email>vgvgonzalez8@gmail.com</email><message>hello</message></data>"
tree = Et.ElementTree(Et.fromstring(xmlData))
root = tree.getroot()
print(root[1].text)
print(root[0].text)
| true |
638d2840ae1524530ad03071237ebbf59eb80644 | Python | Vagacoder/Python_for_everyone | /Ch05/2017-8-21_1.py | UTF-8 | 1,228 | 4 | 4 | [] | no_license | ## Ch05 P 5.15
def reverse(string):
if string == "":
return string
else:
return reverse(string[1:]) + string[0]
print(reverse('flow'))
## Ch05 P 5.16
def isPalindrome(string):
if len(string) <2:
return True
if string[0] == string[-1]:
test = True
... | true |
83101b05aca3a9f4da1e71baf1d2c72bf579cc24 | Python | dashboardijo/algorithm007-class02 | /Week_06/G20200343040180/coinChange.py | UTF-8 | 784 | 3.59375 | 4 | [] | no_license | #!/usr/bin/env python
'''
https://leetcode-cn.com/problems/coin-change/description/
322. 零钱兑换
给定不同面额的硬币 coins 和一个总金额 amount。编写一个函数来计算可以凑成总金额所需的最少的硬币个数。如果没有任何一种硬币组合能组成总金额,返回 -1。
示例 1:
输入: coins = [1, 2, 5], amount = 11
输出: 3
解释: 11 = 5 + 5 + 1
示例 2:
输入: coins = [2], amount = 3
输出: -1
说明:
你可以认为每种硬币的数量是无限的。
'''... | true |
09cecc7597bed65fda07a55f0d6cd82a392c3bb7 | Python | Kenn3Th/Physics_at_UiO | /INF1100/Project/SIR_class.py | UTF-8 | 3,453 | 3.140625 | 3 | [] | no_license | class ProblemSIR():
def __init__(self, nu, beta, S0, I0, R0, T):
if isinstance(nu, (float,int)):
self.nu = lambda t: nu
elif callable(nu):
self.nu = nu
if isinstance(beta, (float,int)):
self.beta = lambda t: beta
elif callable(beta):
se... | true |
8bb7a2a80e47813e3320cae492ed6ba341484fe4 | Python | motivatedLeroy/WebIntelligence | /Analysis/subscribed_users_by_events.py | UTF-8 | 1,413 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python3
# Count the number of events per subscribed user and print the result to
# subscribed_users_by_events.txt
import json
from operator import itemgetter
import os
input_fname = 'one_week/20170101'
output_dir = 'results/'
subscribed_uids_fname = output_dir + 'subscribed_userIds.txt'
output_fname = ... | true |
e0fb84114f4bc52281d2b36ed2b183f157adbfbd | Python | amitgajbhiye/box-embeddings | /box_embeddings/modules/intersection/tf_hard_intersection.py | UTF-8 | 1,467 | 2.890625 | 3 | [] | no_license | from typing import List, Tuple, Union, Dict, Any, Optional
import tensorflow as tf
from box_embeddings.parameterizations import TFTBoxTensor
from box_embeddings.modules.intersection._tf_intersection import (
_TFIntersection,
)
def tf_hard_intersection(
left: TFTBoxTensor, right: TFTBoxTensor
) -> TFTBoxTensor... | true |
3c2f1dac50b4c3cdbb67136d69ef33059594708b | Python | Chen-Yufeng/ComicDownloader | /main.py | UTF-8 | 2,672 | 2.78125 | 3 | [] | no_license | #!/bin/python3
from bs4 import BeautifulSoup
import requests
import sys
import time
import os
import re
import img2pdf
def validate_file_name(origi_name):
rstr = r"[\/\\\:\*\?\"\<\>\|\.]" # '/ \ : * ? " < > |'
new_title = re.sub(rstr, "_", origi_name) # 替换为下划线
return new_title
def get_html(url):
... | true |
312abd4421fb765070eb2d34947092b919bd0d45 | Python | zengcong1314/python1205 | /lesson03_data_type_list/homework.py | UTF-8 | 2,255 | 4.4375 | 4 | [] | no_license | # 1、.删除如下列表中的"矮穷丑",写出 2 种或以上方法:
info = ["yuze", 18, "男", "矮穷丑", ["高", "富", "帅"], True, None, "狼的眼睛是啥样的"]
info.remove("矮穷丑")
print(info)
# info.pop(3)
# print(info)
# del info[3]
# print(info)
#
# 2、现在有一个列表 li2=[1,2,3,4,5],
# 请通过相关的操作改成li2 = [0,1,2,3,66,4,5,11,22,33],
li2=[1,2,3,4,5]
li2.insert(0,0)
li2.insert(4,66)
li2... | true |
d007f372f47a8940a12679b6ade7e6cbad0f30e1 | Python | imSamiul/Python_Exercrsises | /raf3.py | UTF-8 | 512 | 3.625 | 4 | [] | no_license | def exercise():
exe = input("Which exercise have you taken?\n")
return exe
def diet():
die = input("Which food have you taken?\n")
return die
j = 1
while j <= 5:
x = input("What do you want for lock?\n"
"1 for 'Diet'\n"
"2 for 'Exercise\n"
"You can try 5... | true |
3408af5b253feb459f06e17353a53679b21842b7 | Python | Aasthaengg/IBMdataset | /Python_codes/p02714/s038637276.py | UTF-8 | 427 | 2.90625 | 3 | [] | no_license |
N = int(input())
S = input()
ris = [i for i, s in enumerate(S) if s == "R"]
gis = [i for i, s in enumerate(S) if s == "G"]
bis = [i for i, s in enumerate(S) if s == "B"]
all = len(ris) * len(gis) * len(bis)
cnt = 0
for i in range(N):
for j in range(i+1, N):
k = 2*j - i
if 0 <= k < N:
... | true |
08ba517915cfe578970138b691811c0a3da6d951 | Python | danielwun/Handwriting-number-classification-1 | /tools/nulinear.py | UTF-8 | 1,360 | 2.609375 | 3 | [] | no_license | import csv
import glob
import math
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
from libsvm.python.svmutil import *
from libsvm.python.svm import *
import os
def readLabel(file):
t=[]
f = open( file, 'r' )
for row in csv.reader... | true |
06ba23c7a287a9783fdf7e11f14a430a8ee0af44 | Python | AlexanderFabisch/distance3d | /distance3d/geometry.py | UTF-8 | 15,675 | 2.96875 | 3 | [
"Zlib",
"MIT",
"BSD-3-Clause",
"BSD-3-Clause-Clear",
"BSL-1.0",
"Unlicense"
] | permissive | """Tools for geometric computations."""
import math
from itertools import product
import numba
import numpy as np
from .utils import (
norm_vector, transform_point, plane_basis_from_normal,
scalar_triple_product)
def convert_rectangle_to_segment(rectangle_center, rectangle_extents, i0, i1):
"""Extract lin... | true |
38c41976f0c899ed0656aaf5c5b7f4776c0242e5 | Python | peyton/761project | /feature_lian/render.py | UTF-8 | 1,284 | 2.703125 | 3 | [] | no_license | import numpy
import matplotlib.pyplot as plt
import time
#plot the result
def render(x, y, fileName, setFlag = True):
x = numpy.array(x)
y = numpy.array(y)
fig, ax = plt.subplots(1,1)
#ax.set_xticks(numpy.arange(0,1,0.1))
if setFlag:
ax.set_xscale("log")
ax.set_yscale("log")
... | true |
3dc1bf6a8692b413209db89c00e045dee603bd15 | Python | lefft/network_demos | /py/networkx_demo.py | UTF-8 | 1,681 | 3.375 | 3 | [] | no_license |
# coding: utf-8
# ### scratchpad for `networkx` graph demos
# ###### timothy leffel, feb06/2018 <hr style='height:2px; background-color:gray'>
# In[1]:
import networkx as nx
import matplotlib.pyplot as plt
from numpy import random
get_ipython().magic('matplotlib inline')
random.seed(6933)
# In[2]:
# simple ... | true |
d129d0bfb88f86e840dbca770aed57fda45162c3 | Python | Kartikeya97/Automated-attendance | /DatabaseInitializer.py | UTF-8 | 4,765 | 3.171875 | 3 | [] | no_license | import pymysql.cursors
import csv
class DatabaseInitializer:
def __init__(self):
self.connection = 0
def ReadCSVRollList(self, file_name):
roll_list = []
# Opening and reading CSV File
with open(file_name, newline='') as csvfile:
file_reader = csv... | true |
d16f827380682937f457531c80a499456a74f285 | Python | vamsikrishna6668/python | /constructor1.py | UTF-8 | 878 | 3.34375 | 3 | [] | no_license | class schl_student:
std_idno=int(input("Enter a student Idno:"))
std_name=input("Enter a Student Name:")
def __init__(self):
self.std_class=int(input("Enter a student which class he/she belong to:"))
self.std_lang=input("Enter a student Mother Tongue Language:")
print("Iam a ... | true |
a5991b6f618b85e1395740a30b1fecb218988e0a | Python | mauryquijada/scrapr | /scraper.py | UTF-8 | 1,776 | 3 | 3 | [] | no_license | import csv
import urllib
import time
from bs4 import BeautifulSoup
from flask import Flask, render_template, request, url_for, redirect
app = Flask(__name__)
@app.route("/")
def home():
# It's just a plain vanilla form. Just return it.
return render_template('index.html')
@app.route("/scrapr", methods=['POST'])
de... | true |
b54b62d8c3db48a169d0e0a9dfeb25e8e51a0d82 | Python | Uchiha-Itachi0/The-Complete-FAANG-Preparation | /1]. DSA/3]. 450 DSA by ( Love Babbar Bhaiya )/Python/01]. Array/03_)_Kth_Max_Min_Element.py | UTF-8 | 289 | 3.796875 | 4 | [
"MIT"
] | permissive | # Question link : https://practice.geeksforgeeks.org/problems/kth-smallest-element5635/1#
def kth_min_element(arr, k):
"""
Time complexity : O(nlogn)
Space Complexity : O(1)
"""
arr.sort()
return arr[k - 1]
print(kth_min_element([1, 2, 3, 4, 5], 3))
| true |
b4376f8a8b07f263ebe9a8264afbf097133733bd | Python | jamesob/uncertainties | /uncertainties.py | UTF-8 | 4,146 | 3.765625 | 4 | [] | no_license | #!/usr/bin/env python
# by jamesob
# because I love physics lab
import math
class UncertainVariable(object):
"""A class defining a variable with associated uncertainty stored as a
physical quantity and a percentage. Uncertainties are automatically
calculated and maintained as the variable is operated on.... | true |
6769aadbdda8ad311acb14fa0e8af2e156f9df20 | Python | adityasarvaiya/coding | /Crio/LinkedList/5_RemoveNthNodeFromEndOfList/RemoveNthNodeFromEndOfList.py | UTF-8 | 720 | 2.984375 | 3 | [] | no_license | from Solution import *
# CRIO_SOLUTION_START_MODULE_L1_PROBLEMS
# CRIO_SOLUTION_END_MODULE_L1_PROBLEMS
def createList(numbers):
if(len(numbers) == 0):
return None
head = ListNode(numbers[0])
node = head
for i in range(1, len(numbers)):
node.next = ListNode(numbers[i])
node = node.next
return head
def extr... | true |
7099d1e628b13bd5d501a473904fcaff449e683d | Python | Tanuruha-Majumdar/The-Invisible-Cloak-with-adjustable-colour-of-cloak | /hsv_masking.py | UTF-8 | 2,243 | 2.515625 | 3 | [] | no_license | import cv2
import numpy as np
def noise_removal(mask):
cv2.imshow("mask", mask)
# kernel=np.ones((10, 10), np.uint8)
# mask = cv2.erode(mask, kernel, iterations=5) # noise removal
# mask = cv2.dilate(mask, kernel, iterations=8)
mask = cv2.morphologyEx(mask, cv2.MORPH_OPEN, np.ones((3... | true |
a9cb44f53d8005916cdcaf269c8977e772515f2d | Python | JosephLevinthal/CoronaMail | /coronavirusEmails.py | UTF-8 | 8,804 | 3 | 3 | [] | no_license | from selenium import webdriver
class CoronaVirus:
import schedule
import time
# Função que inicia o contato com o Google Chrome para o web scraping
def __init__(self):
self.driver = webdriver.Chrome("chromedriver.exe")
# Função que faz o web scraping dos dados da CNN, NBC, CNBC e organiz... | true |
2273a7102422ce8546fed4396e01180b1965f5bb | Python | omongo/prime_factors | /prime_factors.py | UTF-8 | 440 | 3.65625 | 4 | [] | no_license | class PrimeFactors:
def __init__(self, number):
self.number = number
self.data = []
def get_data(self):
number = self.number
for i in range(2, self.number + 1):
number = self._add_prime(i, number)
return self.data
def _add_prime(self, prime, number):
... | true |
5b7893035cea27df3fe6a7056c195a6e629883ed | Python | wookkl/backjoon-problemsolving | /[7568]덩치.py | UTF-8 | 177 | 3.296875 | 3 | [] | no_license | p = [list(map(int, input().split())) for _ in range(int(input()))]
for i in p:
c = 1
for j in p:
if i[0] < j[0] and i[1] < j[1]:
c += 1
print(c)
| true |
7956c6b87b88dd9d91cda88d882fa2cade349686 | Python | HerculesGit/python3 | /introducao_A_programacao/televisao.py | UTF-8 | 576 | 3.09375 | 3 | [] | no_license | class Televisao:
def __init__(self, cmin, cmax):
'Televisao'
self.ligada = False
self.canal = 2
self.cmin = cmin
self.cmax = cmax
def muda_canal_para_cima(self):
if (self.canal+1 <= self.cmax):
self.canal+=1
else:
pass #canal = cmin
... | true |
1c04aae7d2e1abc3c1277d181287d5c5dd9e800b | Python | MatheMatrix/SensorDataDownload | /ObliData.py | UTF-8 | 2,740 | 2.765625 | 3 | [] | no_license | from DataKernel import *
class ObliData(DataKernel):
"""load Obliquitous data from remote data server"""
def __init__(self, server, db, uid, pwd, path, sensType):
'''Init some argvs
'''
DataKernel.__init__(self, server, db, uid, pwd, path)
self.sensType = sensType
def Ge... | true |
b9e093f1479cf48f5d028d8ec7e97c3815fd61eb | Python | sliri/nextpy | /nextpy 1.1.4.py | UTF-8 | 594 | 4.15625 | 4 | [] | no_license | # 1.1.4
################
import functools
def list2str(num):
"""Convert an integer to a list of its digits, each of which is a string"""
return list(str(num))
def str2int(num):
"""Convert an integer to a list of digits, each of which is an integer"""
return list(map(int, num))
def add(x, y):
... | true |
d6dec035e76ab76cf8e63ba19ac6549038108769 | Python | njsmith/async_generator | /async_generator/util.py | UTF-8 | 209 | 2.578125 | 3 | [
"MIT"
] | permissive | class aclosing:
def __init__(self, aiter):
self._aiter = aiter
async def __aenter__(self):
return self._aiter
async def __aexit__(self, *args):
await self._aiter.aclose()
| true |
0fc571632c2ae7c820f415b45b15f46290ecae39 | Python | Nishinomiya0foa/Old-Boys | /homework/ftp_homework/core/upload.py | UTF-8 | 818 | 2.515625 | 3 | [] | no_license | import os
import struct
import json
from homework.ftp_homework.core import message_head
def upload():
head = message_head.head()
filelist = os.listdir(head['path'])
# print(filelist)
dic = {}
print("文件列表如下:请选择想要上传的文件。")
for i in range(len(filelist)):
dic[i] = filelist[i]
print(... | true |
2c7c58c3e10a732f7af76160d42ab69af123075f | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2176/60621/249520.py | UTF-8 | 197 | 2.90625 | 3 | [] | no_license | a=input()
b=[]
for i in range(1,len(a)+1):
b.append(a[len(a)-i:len(a)])
c=set(b)
b=list(c)
b.sort()
st=""
for i in b:
st+=str(a.rfind(i)+1)
if i!=b[len(b)-1]:
st+=" "
print(st) | true |
06007abcfa69b83a4c1bd1685b522df75239331a | Python | hsiehpinghan/trident | /trident/data/transform.py | UTF-8 | 12,970 | 2.65625 | 3 | [
"MIT"
] | permissive | import numbers
from abc import ABC, abstractmethod
from collections import Iterable
from typing import Sequence, Tuple, Dict, Union, Optional, Callable, Any
import collections
import numpy as np
import cv2
from trident.backend.common import OrderedDict
from trident.backend.common import *
from trident.backend.tensor... | true |
45b41779c982ac9a14386029fb1e39391f0cf79d | Python | hilltran/Python2020 | /RemoveSpaceBetweenLines.py | UTF-8 | 635 | 3.09375 | 3 | [] | no_license | # output = open('/Users/hieu/Desktop/1_Excel/deleteBlankLinesOutputFile3-20.txt', 'w')
output = open('deleteBlankLinesOutputFile3-20.txt', 'w')
#remove blank lines by opening the original file and r = read only
# with open('/Users/hieu/Desktop/1_Excel/removeBlankLine.txt','r') as file:
with open('removeBlankLine.txt'... | true |
59026612a61c66280d7b3f4e6a23d0347da9e97a | Python | CleitonSilvaT/URI_Python | /1-Iniciante/1013.py | UTF-8 | 135 | 3.5 | 4 | [] | no_license | # -*- coding: utf-8 -*
info = input().split(' ')
a = int(info[0])
b = int(info[1])
c = int(info[2])
print(max(a, b, c), "eh o maior") | true |
e17b8bd38e2c96b849ba77f8487a9e389f3af47e | Python | tahertaher0511/pythonProject14 | /main.py | UTF-8 | 4,879 | 3.40625 | 3 | [] | no_license | import random
class Game:
def __init__(self):
self.board = {(x, y): " " for y in range(3, 0, -1)
for x in range(1, 4)}
self.available_co = list(self.board.keys())
self.moves = {"X": 0, "O": 0, " ": 0}
self.user = User("user")
self.comp = Computer("comp... | true |
c6ca4bf00dfc8504f4725f0f2ffb190e0ab37e9b | Python | vkWeb/vikivedia | /encyclopedia/util.py | UTF-8 | 1,584 | 3.046875 | 3 | [] | no_license | import re
from django.core.files.base import ContentFile
from django.core.files.storage import default_storage
# Enter directory name relative to BASE_DIR
ENTRIES_DIR_NAME = "entries"
def list_entries():
"""
Returns a list of all names of encyclopedia entries.
"""
_, filenames = default_storage.lis... | true |
0a26109b14c1c9a6b6658d77d9aaf137d73cd32f | Python | shivaj15/klc | /sum1.py | UTF-8 | 146 | 2.65625 | 3 | [] | no_license | #!/usr/bin/python
print str(sum((11,12,13,14,15,16,17)))
print str(sum((11,12,13,14,15,16,17)))[0:1]
print str(sum((11,12,13,14,15,16,17)))[1:2]
| true |