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
0ebc2cb90676e41b1ffdcbf898847452dfca09f0
Python
Shawley-Codes/Incrementor
/increment+2.py
UTF-8
7,403
4
4
[]
no_license
#6/5/2019 #Scott Hawley #imports import time #Incrementor #Class holds 2 functions class incrementor: #Score #increment score based on current increment amount over time, then print def scoreInc(score, increment): score += increment print("Score: ", score) #Money ...
true
3cbff2900f2f273eae26d8e66a6adfd8e2124c84
Python
icantnotfindaname/smi_project
/main.py
UTF-8
1,638
2.734375
3
[]
no_license
""" @Constant: learning_rate = 0.1 batch_size = 64 epoch = 5 # 测试阶段 真正训练需要百代以上 model_save_path = '' """ def train_pathnet(cpu = True,): # 一些常量 learning_rate = 0.1 batch_size = 64 epochs = 1 # 将整体数据迭代多少代 # TODO: 改造主程序 封装pathnet训练函数和 overlapnet训练函数 if __name__ == '__main__': # 先制作 DataLoader trainset = datas...
true
0ab1b68f17bd6f88cfae7dcd5e19756b9d34f58f
Python
sadatusa/PCC
/8_11.py
UTF-8
698
4.53125
5
[]
no_license
# 8-11. Unchanged Magicians: Start with your work from Exercise 8-10. Call the # function make_great() with a copy of the list of magicians’ names. Because the # original list will be unchanged, return the new list and store it in a separate list. # Call show_magicians() with each list to show that you have one list of...
true
d4db69920278bff4f18034436df06ce79d6090f7
Python
laobadao/Python_Learn
/PythonNote/ml/knn/knn.py
UTF-8
5,189
3.609375
4
[ "Apache-2.0" ]
permissive
# -*- coding: UTF-8 -*- """ k-近邻算法步骤如下: 计算已知类别数据集中的点与当前点之间的距离; 按照距离递增次序排序; 选取与当前点距离最小的k个点; 确定前k个点所在类别的出现频率; 返回前k个点所出现频率最高的类别作为当前点的预测分类。 """ import numpy as np import operator """ 函数说明:创建数据集 :parameter 无 :returns group - 数据集 labels -分类标签 :date 2017-9-29 """ def createDataSet(): ...
true
cfc94fb0c0b59724342c45bbcf89f8a440742d06
Python
gw1770df/python-test
/get-filetype/t.py
UTF-8
962
2.921875
3
[]
no_license
#! /usr/bin/python # -*- coding: utf-8 -*- # pythontab提醒您注意中文编码问题,指定编码为utf-8 # import struct # import IPython # 支持文件类型 # 用16进制字符串的目的是可以知道文件头是多少字节 # 各种文件头的长度不一样,少则2字符,长则8字符 FILE_TYPE_MAP = {"FFD8FF": "JPEG", "89504E47": "PNG"} # 获取文件类型 def filetype(filename): binfile = open(filename, 'rb') # 必...
true
b6adaa9e398428caa3cbde567e5684177457fcf3
Python
kharrigian/covid-mental-health
/scripts/acquire/twitter/retrieve_timelines_api.py
UTF-8
4,479
2.625
3
[]
no_license
####################### ### Imports ####################### ## Standard Library import os import sys import json import gzip import argparse from time import sleep ## External Libraries import tweepy import pandas as pd from mhlib.util.logging import initialize_logger ####################### ### Configuration #####...
true
0aa2272fd5db353f938d6604ba80388fa66cb042
Python
walyncia/ConvertString
/StringConversion.py
UTF-8
1,234
4.3125
4
[]
no_license
import time def StringToInt (): """ This program prompts the user for a string and converts it to a integer if applicable. """ string = input('Desired Number:') print('The current state:\nString:',string,' ->', type(string)) if string == '': #handle no input raise Exception ('In...
true
711a1e26fcbdd043d48b3ca748713b5b33827ecd
Python
TKSanthosh/tutorial-programme
/ExampleProgramme/pythagorasnumbers.py
UTF-8
215
3.6875
4
[]
no_license
from math import sqrt n= int(input("Maximum number?")) for a in range(1,n+1): for b in range(a,n): c_square=a**2+b**2 c=int(sqrt(c_square)) if (c_square==c**2): print(a,b,c)
true
7e4c26355987fbae5b250afa1311a7a90b80d263
Python
MattWellie/refparse
/refparse/GBParser.py
UTF-8
13,157
2.75
3
[ "MIT" ]
permissive
from Bio import SeqIO __author__ = "mwelland" __version__ = 2.0 __version_date__ = "06/08/2020" class GBParser: """ Notes: Isolated class to deal exclusively with GBK/GB files Should return dictionary, not write full output Parses the input file to find all the useful values This wil...
true
1a7f5b560febcb92aa0fc3c287aace99773d17dc
Python
Crazy-Jack/VisualConceptRouting
/data_process/to_100k.py
UTF-8
2,221
2.875
3
[]
no_license
"""Extract 100k img from .mdb into byte img in folder""" import io import os import argparse from shutil import copyfile import lmdb import pandas as pd from PIL import Image import numpy as np from tqdm import tqdm def set_args(): parser = argparse.ArgumentParser("Export from .mdb file to flat folder") parse...
true
da578ccc2dba857a579c4c2b0be4a2f17cec127e
Python
PrincessGrouchy/na-rocky-mountain-2020-public
/problems/forcedchoice/submissions/accepted/forcedchoice-zf.py
UTF-8
148
2.71875
3
[ "MIT" ]
permissive
#!/usr/bin/python3 n, p, s = map(int, input().split()) for _ in range(s): print ("KEEP" if p in list(map(int, input().split()))[1:] else "REMOVE")
true
553f47bb8b0320997878d555d3afe65c830c8c9d
Python
BLSQ/geohealthaccess
/geohealthaccess/worldpop.py
UTF-8
1,847
2.921875
3
[ "MIT" ]
permissive
"""Download WorldPop population count datasets. Notes ----- See `<https://www.worldpop.org/>`_ for more information about the WorldPop project. """ from loguru import logger import requests from geohealthaccess.utils import download_from_url logger.disable("__name__") BASE_URL = "https://data.worldpop.org/GIS/P...
true
8b61c776da78efc8d75cf5a4c8a7dc0ab3b63078
Python
callmeliuchu/LeetCode
/Problems/39CombinationSum.py
UTF-8
593
3.171875
3
[]
no_license
class Solution: def combinationSum(self, candidates, target): """ :type candidates: List[int] :type target: int :rtype: List[List[int]] """ ans = [] self.f(candidates,target,[],ans) return ans def f(self,arr,target,res,ans): if tar...
true
49b1fcd845b076366212d6406117d9b6c285d3e0
Python
GRSEB9S/linconfig
/qgis/qgis2/python/plugins/qProf/geosurf/surfaces.py
UTF-8
3,112
2.953125
3
[]
no_license
from numpy import * # general import for compatibility with formula input from .deformations import calculate_geographic_scale_matrix, calculate_geographic_rotation_matrix, calculate_geographic_offset from .deformations import define_deformation_matrices from .errors import AnaliticSurfaceCalcException def...
true
d93c12198e8eab80213b0d6fcaf15596a9fbd005
Python
zuzanna-f/pp1
/03-FileHandling/03.21.py
UTF-8
392
3.59375
4
[]
no_license
with open('numbersinrows.txt', 'r') as file: ile = 0 suma = 0 for line in file: temp = [] temp = line.split(',') for i in range(len(temp)): temp[i] = int(temp[i]) suma = suma + temp[i] ile = ile + ...
true
f4c369eddeca257d9ea6b1e21e5700848b836263
Python
WIEQLI/performance-testing
/ptdockertest/prepare_benchmark.py
UTF-8
871
2.5625
3
[]
no_license
""" Created on 22/09/2015 @author: Aitor Gomez Goiri <aitor.gomez-goiri@open.ac.uk> Script to create database. """ from argparse import ArgumentParser from models import PerformanceTestDAO, Test def main(database_file): dao = PerformanceTestDAO(database_file) session = dao.get_session() for num_containe...
true
f2fa722e9343dfd5667190fba69e5be2fecbb2f6
Python
pantlavanya/tic_tac_toe_game
/src/game_pattern_based.py
UTF-8
3,788
3.015625
3
[]
no_license
import copy, random from game_common_feature import GameCommonFeature from template import WON_MESSAGE, CONTINUE_MESSAGE class GamePatternBased(GameCommonFeature): @staticmethod def get_all_keys_for_x_and_o(board_dict): """ get all keys for both players :param board_dict: :re...
true
6917a1842582a23e84bae6783f6df190387ac22d
Python
SJLMax/NLP
/最大匹配/segword.py
UTF-8
4,309
2.9375
3
[]
no_license
import xlrd import datetime import re # 读取文献 def readtxt(path): data=[] with open(path,'r',encoding='utf8') as f: line = f.readlines() for i in line: i = i.strip(' ') i = i.replace('\n','').replace('\u3000','').replace('\xa0','').replace(' ','') ...
true
a5f41d97a4315dce63c1f3a7d5bbbfbf535686e2
Python
cpe202spring2019/lab1-pietrok29
/lab1_test_cases.py
UTF-8
2,887
3.234375
3
[]
no_license
import unittest from lab1 import * # A few test cases. Add more!!! class TestLab1(unittest.TestCase): def test_max_list_iter(self): """This test checks for the value Error in the max_list_iter functinon""" tlist = None with self.assertRaises(ValueError): # used to check for exception ...
true
2ee00fd5f59bbfd816e72314a27a7672bdeec82a
Python
sumrdev/Code-Portfolio
/PYTHON BASIS/calcpy.py
UTF-8
533
2.765625
3
[]
no_license
import math from decimal import * getcontext().prec = 300 def calculatePi(k): calculations = 12 a = (426880*math.sqrt(10005)) pi = 0 for i in range(calculations): currentK = math.factorial(6*k)*(545140134*k+13591409)/(math.factorial(3*k)*math.pow(math.factorial(k),3)*math.pow(-262537412640...
true
9340f5ccfd8f5ef594ce56728a031435b62aabf8
Python
hh1802/hh
/flask02/App/models.py
UTF-8
1,689
2.6875
3
[]
no_license
from _datetime import datetime from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() class Student(db.Model): s_id = db.Column(db.Integer, autoincrement=True, primary_key=True) s_name = db.Column(db.String(16), unique=True) s_age = db.Column(db.Integer, default=18) grades = db.Column(db.Integer,...
true
58fa7972275ed20f57b3383c4c70ab3c5c498681
Python
anhtm/python-data-structures-clrs
/implementation/linked_list/node.py
UTF-8
208
3.09375
3
[]
no_license
class Node: def __init__(self, key = None): self.key = key self.next = None class DoublyNode(Node): def __init__(self, key = None): Node.__init__(self) self.prev = None self.key = key
true
1f6bbd9477f9cc86d079d41b0a57c610bd5206fd
Python
AhmedWael205/MI-Go-Game
/ServerConfig.py
UTF-8
2,870
2.6875
3
[]
no_license
import json import numpy as np from game import Game from Stones import Turn import asyncio def server_config(GameConfig,FileName=None,mode=1,GuiObject=None): if(FileName is None): GameConfig = GameConfig else: with open(FileName, 'r') as f: GameConfig = json.load(f) #print("1")...
true
d2b3bce79feaa1effde9414b7b64d9f8cb83f74c
Python
icaros7/python_study
/lab6_my_1.py
UTF-8
4,823
4.125
4
[]
no_license
""" 챕터 : Day 6 주제 : Class 문제 : Fraction 메서드의 4칙 연산을 완성하라 작성자 : 이호민 작성일 : 2018.10.24 """ # 최대공략수를 찾아주는 math.gcd 를 쓰기위해 math 모듈 중 gcd import from math import gcd # 분수 클래스 정의 class Fraction: def __init__(self, n, d): """ 초기화 함수 :param n: 분자 :param d: 분모 """ self.numer...
true
54ff2beed3e651a0481c733dc8af39a14e2a647c
Python
Vicky1-bot/barcode-detection
/detect_barcode.py
UTF-8
1,569
2.828125
3
[]
no_license
# import the necessary packages import simple_barcode_detection from imutils.video import VideoStream import argparse import time import cv2 # construct the argument parse and parse the arguments ap = argparse.ArgumentParser() ap.add_argument("-v", "--video", help="path to the (optional) video file") args = ...
true
be2aa7552b3a330fc1b8028d2ae0e5c131703dbd
Python
TrellixVulnTeam/InterfaceTest_94CO
/ConferenceSignSystem2.0/ConferenceSignSystemTestFramework2.0/interface/md5_get_event_list.py
UTF-8
2,924
2.515625
3
[]
no_license
# 增加签名+时间戳 # 对Event接口进行测试 # 发布会查询接口 import unittest import requests import os import sys parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, parentdir) from db_fixture import test_data import time import hashlib class GetEventListTest(unittest.TestCase): """...
true
f84e158fe6042f1e71544fe192fb60a552d47d1a
Python
Isaias301/Questions-URI
/1178.py
UTF-8
372
3.484375
3
[]
no_license
def main(): valor = input() teste(valor) def teste(valor): vetor = [None]*100 for i in range(len(vetor)): if i == 0: vetor[i] = float(valor) print("N[%i] = %.4f" % (i, vetor[i])) else: vetor[i] = vetor[i-1]/2 print("N[%i] = %.4f" % (i,...
true
9072d4d060539348a2ceddf56de6089f06914f60
Python
EDA2021-1-SEC02-G02/Reto4---G02
/App/model.py
UTF-8
4,816
2.71875
3
[]
no_license
""" * Copyright 2020, Departamento de sistemas y Computación, * Universidad de Los Andes * * * Desarrolado para el curso ISIS1225 - Estructuras de Datos y Algoritmos * * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published b...
true
e6a89b0b16d9f447a4bef16ead9e0a96fdc0b4d2
Python
wickman/rainman
/rainman/torrent.py
UTF-8
1,680
2.5625
3
[]
no_license
import hashlib from .codec import BDecoder, BEncoder from .metainfo import MetaInfo from .handshake import PeerHandshake class Torrent(dict): @classmethod def from_file(cls, filename): with open(filename, 'rb') as fp: torrent, _ = BDecoder.decode(fp.read()) if 'info' not in torrent or 'announce' no...
true
2f903d1af0966c3dda82ad9f2e7ca4c3e1c1ad5b
Python
toticavalcanti/HackerHank
/Diagonal_Difference.py
UTF-8
709
3.390625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Feb 15 12:07:33 2018 @author: toti.cavalcanti """ #!/bin/python3 import sys def diagonalDifference(a): # Complete this function diagonal_left_to_right = 0 diagonal_right_to_left = 0 for i in range(n): diagonal_left_to_right += a[i][i] ...
true
290b16ffc555cb3f6f763644ab10d3c277b7b489
Python
whyadiwhy/Awesome_Python_Scripts
/GUIScripts/Contact Management System/contact_management_system.py
UTF-8
14,521
2.90625
3
[ "MIT" ]
permissive
# Import Required Modules from tkinter import * import sqlite3 import tkinter.ttk as ttk import tkinter.messagebox as tkMessageBox #--------------------------------------------------------------------------------------------------------------------------------------------------------------------- root = Tk() # Sett...
true
a249811235c4403d7727c5bee1e9db347d7afee6
Python
haeunnam/Algorithm
/SWEA/1970.쉬운거스름돈.py
UTF-8
435
3.421875
3
[]
no_license
def calculate_change(money, idx): if money < 10: return while money >= unit[idx]: money -= unit[idx] change[idx] += 1 calculate_change(money, idx+1) return for tc in range(1, int(input())+1): money = int(input()) change = [0] * 8 unit = [50000, 10000, 5000, 1000, 5...
true
f9f73da8838422c97b2b52aa9c3a513ee891c2fd
Python
christinecoco/python_test
/test46.py
UTF-8
353
4.21875
4
[]
no_license
#求输入数字的平方,如果平方运算后小于 50 则退出 print('如果输入数字的平方小于50,程序则会退出') while True: i=int(input('请输入一个数:')) sum=i*i if sum<50: print('%d的平方是%d'%(i,sum)) break else: print('%d的平方是%d'%(i,sum))
true
c779401142435481b8693942c74eee26705760e7
Python
mayank888k/Python
/tupleeee.py
UTF-8
313
3.515625
4
[]
no_license
lst=[5,6,7,8,9] #tuple is Immutable like strings tple=(1,2,3,4) #you cant append or remove like list tple2=tuple(lst) tple3=tple + tple2 print(tple3) print(tple3[5:10]) #you can access it by index print(tple3[::-1]) print(max(tple3)) del tple3 #You can delete whole tuple
true
e23288915cb0c0ee790cf393fd5a5ced4d6f3d2d
Python
piter104/dices
/dice_counter.py
UTF-8
4,240
2.671875
3
[]
no_license
import cv2 as cv import numpy as np import random as rng import copy import matplotlib.pyplot as plt def remove_everything_below_std_and_mean(image): treshold = round(np.std(image) + np.mean(image)) return np.array((image > treshold) * 255, dtype=np.uint8) def __draw_contours(image): copy_image = copy.d...
true
32b40baa290a3bb56dadcaff0ea4436b7da6877b
Python
ellynhan/challenge100-codingtest-study
/suyeonsu/Implement_23290.py
UTF-8
3,411
3.484375
3
[]
no_license
from collections import deque def moveFish(): moved = [[[] for _ in range(5)] for _ in range(5)] dx = [0, 0, -1, -1, -1, 0, 1, 1, 1] dy = [0, -1, -1, 0, 1, 1, 1, 0, -1] for x in range(1, 5): for y in range(1, 5): for direction in origin[x][y]: d = direction ...
true
3f0f873185d7b3162380a9f82abe16399db37adb
Python
arlinnshimimana/python-basis
/py6.3.py
UTF-8
175
3.015625
3
[]
no_license
def lang_genoeg(lengte): if lengte > 120 or lengte == 120: print('je bent lang genoeg') else: print('Sorry,je bent te klein') print(lang_genoeg(177))
true
70b76d695d6142c83c76733e5789f7355defe0e8
Python
chosaihim/jungle_codingTest_study
/JAN/20th/sh_체육복.py
UTF-8
594
2.890625
3
[]
no_license
def solution(n, lost, reserve): lost.sort() reserve.sort() tmp=[] for student in lost: tmp.append(student) for student in tmp: if student in reserve: reserve.remove(student) lost.remove(student) borrow = 0 for student in lost: ...
true
8bbbc37e3c684f0fc31e44ea3e78d8a65fc5dc7c
Python
meechaguep/MCOC-Intensivo-de-Nivelacion
/21082019/000226.py
UTF-8
696
4.15625
4
[]
no_license
print "Este dia estudiaremos listas" #intento 1 lista1= [14,21,3,-14,-21,-3] print "la lista es:" print lista1 #intento 2 print "agreguemos un numero a la lista" lista1= [14,21,3,-14,-21,-3] lista1.append(1313) print lista1 #intento 3 print "ahora agreguemos una frase a esta lista de numeros" ...
true
fa47727a25426c905e72ceb4dd8d3aed8896aeda
Python
juliaheisler/CSE-231
/proj07.py
UTF-8
7,280
4.375
4
[]
no_license
############################################################################## # Computer Project 7 # # Algorithm # # Project uses 7 functions to take a network provided and suggests a friend\ # to inputed user that has the most friends in common (not already friends). # # open_file: attempts opening .txt fil...
true
cd50ad882f10f716ad13a97faad52b87ef87b972
Python
jackwallace180/python24-9
/while loops.py
UTF-8
574
3.734375
4
[]
no_license
# keeps looping an iterating until a condition is met # OR it comes into a break statement #while<condition>: #block # if <condition>: #break #import time #counter = 0 #while counter <10: #print(counter) #print('hello') #counter += 1 #time.sleep(1) #counter = 0 #while True: #print(c...
true
f2939b80968fe76ccbcf64474f70f16da45b2b1c
Python
abhigupta4/Competitive-Coding
/SPOJ/AKVQLD03.py
UTF-8
553
2.96875
3
[]
no_license
def getsum(index): sum1 = 0 while index > 0: sum1 += BIT[index] index -= index & (-index) return sum1 def updateBIT(n,index,val): while(index <= n): BIT[index] += val index += index & (-index) def cons(n): for i in xrange(n): updateBIT(n,i,list1[i]) BIT = [0] * (10**6 + 2) list1 = ...
true
2aee592c660987143f5ed54cfd9ccf86a0c98ef0
Python
TTWen/test
/test9.py
UTF-8
634
2.703125
3
[]
no_license
#cs231n:批量归一化 import numpy as np #定义一个双层网络随机初始化 def init_two_layer_model(input_size,hidden_size,output_size): model = {} model['W1'] = 0.0001 * np.random.randn(input_size,hidden_size) model['b1'] = np.zeros(hidden_size) model['W2'] = 0.0001 * np.random.randn(hidden_size,output_size) model['b2'] = n...
true
61d3ae63d80ac578f48424b53446228536e94e76
Python
nekapoor7/Python-and-Django
/PRACTICE_CODE/fibo_series_sum.py
UTF-8
539
3.671875
4
[]
no_license
class Fibonacci: def __init__(self): self.cache = {} def __call__(self,n): if n not in self.cache: if n == 0 : self.cache[0] = 0 elif n == 1: self.cache[1] = 1 else: self.cache[n] = self.__call__(n-1) + self.__...
true
71b5311e66bc2c7da973e2855e1fbd48bdf04b40
Python
jhson989/algorithm
/Grammar/Array/cal_avg.py
UTF-8
240
2.78125
3
[]
no_license
import sys C = int(sys.stdin.readline()) for _ in range(C): num, *L = [int(e) for e in sys.stdin.readline().split()] avg = sum(L)/len(L) chk = [1 if e>avg else 0 for e in L] print( "%.3f" % (100.0*sum(chk)/len(chk)) + "%" )
true
c40aeef764c90edaf477c20165885829108e2bc5
Python
inkysigma/ACM-UCI-Website
/src/data/long_distance_social_distance_i.py
UTF-8
87
3.46875
3
[ "MIT" ]
permissive
T = int(input()) for _ in range(T): n = int(input()) print((n//2)*6 + 4*(n%2))
true
fb562df2d405d3368276acd17bb450584ac7caf8
Python
StRobertCHSCS/fabroa-PHRZORO
/Working/PracticeQuestions/1_1_4_Variables.py
UTF-8
62
3.046875
3
[]
no_license
name = ("Keisha") my_number = 10 print(name) print(my_number)
true
a9cae2987a11b5ca46129473866fb2e67332763e
Python
MartinMxn/NailTheLeetcode
/Python/Hard/Review_OK_84_H_Largest Rectangle in Histogram.py
UTF-8
2,719
3.359375
3
[]
no_license
class Solution: def largestRectangleArea(self, heights: List[int]) -> int: # brute force TLE # find the min height for every height # if len(heights) == 0: # return 0 # res = heights[0] # pt = 0 # def check(heights, end_idx): # res = m...
true
9dc8f3873b4f25a976f75a06291c302ba2eed72c
Python
eckiss/diplomovka
/csvsave.py
UTF-8
1,581
2.8125
3
[]
no_license
import tweepy import csv import datetime from operator import add from authentication import authentication auth = authentication() # Twitter API credentials consumer_key = auth.getconsumer_key() consumer_secret = auth.getconsumer_secret() access_key = auth.getaccess_token() access_secret = auth.getaccess_token_se...
true
19b876ac128c4271627f92ca2b31e8c4af3105f0
Python
RobotronicsClubIITMandi/syncUAVs
/testing/gps_basic.py
UTF-8
628
2.75
3
[]
no_license
# requires sudo # RX -> Pin 8 # TX -> Pin 10 import serial from serial.serialutil import SerialException from gps_decoder import decodeGPGGA, NotGPGGAError, FixNotAcquiredError port = "/dev/serial0" ser = serial.Serial(port, baudrate=9600, timeout=1.0) while True: try: line = ser.readline() try: ...
true
cfef923e352ba13d0dbb4ff467bff5e963a2e627
Python
outlander85/python_courses
/HomeWorks/main.py
UTF-8
18,129
3.59375
4
[]
no_license
print('Hello, \nWorld!') # a = 1 b = 2 c = a + b print(c) # a = 56 print(a%10) # a = 56 b = 78 print(a > b) # a = 56 b = 78 print(a, b) # userName = 'Petr' print('Name:', userName) # a = 10 b = 20 c = 0 print(a < b and b > c) # a = 10 b = 20 c = 0 print(a < b and b < c or not c) #a = input() #print(a) #a = in...
true
6b6859595ed93abec7bf4e3142bff5b411becebe
Python
hse-labs/PY111-template
/Tasks/c2_recursive_binary_search.py
UTF-8
401
4.21875
4
[]
no_license
from typing import Sequence, Optional def binary_search(elem: int, arr: Sequence) -> Optional[int]: """ Performs binary search of given element inside of array (using recursive way) :param elem: element to be found :param arr: array where element is to be found :return: Index of element if it's p...
true
a3f7934509af756e3795dc74e48ad548c3353a79
Python
ohandyya/ml-app
/others/first_app.py
UTF-8
4,852
3.421875
3
[]
no_license
import streamlit as st import base64 # To make things easier later, we're also importing numpy and pandas for # working with sample data. import datetime import numpy as np import pandas as pd import time import logging logger = logging.getLogger(__name__) VALID_PASSWORD = ["password"] password = st.sidebar.text_inp...
true
4fe5d5a067919d1faef41020ad4b6bbd63f1f0fd
Python
shoriwe-upb/PreInformeFunciones
/a-potencia-b.py
UTF-8
524
4.125
4
[ "MIT" ]
permissive
def pow(a, b): result = 1 for i in range(b): result *= a return result def main(): results = [] for i in range(2): a = int(input(f"numero a{i + 1}: ")) b = int(input(f"numero b{i + 1}: ")) results.append(pow(a, b)) if results[0] > results[1]: print(f"{re...
true
dec27506e9777c8109608d0d11d46a5f24a91d35
Python
Aasthaengg/IBMdataset
/Python_codes/p02842/s109159848.py
UTF-8
160
3.03125
3
[]
no_license
import math N=int(input()) if (N/1.08).is_integer()==True: S=int(N/1.08) else: S=math.ceil(N/1.08) if (S*1.08)//1==N: print(S) else: print(':(')
true
c82e785aa1ed2684a9298576f5d6196800736d5e
Python
narendraaa/Python_learning
/memory.py
UTF-8
170
2.765625
3
[]
no_license
a= [1,2,[4,5],3] b= a print('b:',b ,end =' ') print('a:',a) print('after chcGING VALUES') a[2][0]=23 a[2][1]='naren' print('b:',b ,end =' ') print('a:',a)
true
ad5ec9d9004b2f2ea5a6e221bf6864805277efb7
Python
Hypha5/twitter_bot
/search.py
UTF-8
591
2.765625
3
[]
no_license
import tweepy import time consumer_key = 'QWsvG3JxGUQRtSHWmUXc2jMpY' consumer_secret = 'HEgF2toVbkS8gduVI26Y98VMN1TiwPxx0Jx2ZI3zAp5apsUq9w' key = '767967551305297920-NBKUDZAKMZoNXD8qTd2biG5LeWoL5pI' secret = 'csQ4J8heCG37EzOL5hW1yW8GrkMXHPp9pkdc5mygsvikz' auth = tweepy.OAuthHandler(consumer_key, consumer_se...
true
d64256e63cbebc41e33dd54580fe422b2a49e86c
Python
CurtisThompson/spotify-history
/src/statistics.py
UTF-8
8,287
2.796875
3
[]
no_license
import os import numpy as np import pandas as pd import spotipy from spotipy.oauth2 import SpotifyClientCredentials def read_data(path='../data/ExampleData/', year=2021): """Import JSON streaming data.""" data_dfs = [] # Get list of streaming history files directory_files = os.listdir(path) direc...
true
368a284af4a989846288b5edb18ea6744d83b9ad
Python
ModifiedClass/hisx
/note-django rest framework/07drf解析器.py
UTF-8
1,201
2.984375
3
[]
no_license
#django rest fromework解析器 #1请求头要求 Content-Type:application/x-www-form-urlencoded, request.POST中才有值(去request.body中解析数据) #2数据格式要求: para1=value1&para2=value2 $.ajax({ data:{para1:value1,para2,value2} }) #内部转化para1=value1&para2=value2 $.ajax({ data:JSON.stringfy({para1:value1,para2,value2}) }) #json.loads(request...
true
2e2e96fb68f700289b8fb5a32c090292fdcdf2fe
Python
sumit2303/sustcitymgmt
/data_collector/data_collector.py
UTF-8
1,720
2.671875
3
[]
no_license
import db import data_fetching as df import data_processor as dp import time import datetime def create_tables(db_file, tables_data): for table in tables: print(table, tables_data[table]) db.create_db_tables(db_file, table, tables_data[table]) bike_data = db.get_bike_data() pollution_data = db.get_...
true
6d2a34fdc989ca0d60530945dd9a0d8153646be4
Python
TamuYokomori/hangman
/challenge10.py
UTF-8
162
3.46875
3
[]
no_license
# find words having 'oo' after some characters. import re docs = "The ghost that says boo haunts the loo." m = re.findall(".oo", docs, re.IGNORECASE) print(m)
true
7bc40c4c2b3e5becaed25ffd7d88133a197a6dbb
Python
2575614015/python_test
/ihome/ihome06/ihome/web_html.py
UTF-8
2,319
3
3
[]
no_license
# -*- coding:utf-8 -*- # 此文件,专门处理静态文件的访问. 不做模板的渲染, 只是转发文件路径 from flask import Blueprint, current_app, make_response from flask_wtf.csrf import generate_csrf html = Blueprint('html', __name__) # (.*) # 我们只需要1个路由来搞定静态文件的访问 @html.route('/<re(r".*"):file_name>') def web_html(file_name): ''' 127.0.0.1:5000/ ...
true
0fec0913690a753efbc2bba05583b038afbe6ec9
Python
haakensonb/advent_of_code_2018
/day_2/day_2_part_2.py
UTF-8
1,456
4.125
4
[]
no_license
""" Advent of Code Day 2 Part 2: Confident that your list of box IDs is complete, you're ready to find the boxes full of prototype fabric. The boxes will have IDs which differ by exactly one character at the same position in both strings. For example, given the following box IDs: abcde fghij ...
true
d173b5cb3d3d2b3be8f9ac7abf7561a9f2b1eec2
Python
ichbinhandsome/sword-to-offer
/查找/旋转数组中的查找.py
UTF-8
1,440
4.03125
4
[]
no_license
''' Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). You are given a target value to search. If found in the array return its index, otherwise return -1. You may assume no duplicate exists in the array. Your algorith...
true
67c7ad9c73e922dce0dffa272cb420c92116d5a3
Python
reeddunkle/MSP7
/parse_DAT.py
UTF-8
1,060
2.84375
3
[]
no_license
import struct class ParseMPS7(object): def __init__(self, file_path): with open(file_path, 'rb') as f: self.file = f.read() @property def header(self): magic_string = self.file[:4] return { "magic_string": magic_string, "version": self.version, ...
true
5db524ef2bebfeaefee81be0f190060e6290252d
Python
mx1001/animation_nodes
/nodes/interpolation/evaluate.py
UTF-8
619
2.515625
3
[]
no_license
import bpy from ... base_types.node import AnimationNode class EvaluateInterpolationNode(bpy.types.Node, AnimationNode): bl_idname = "an_EvaluateInterpolationNode" bl_label = "Evaluate Interpolation" def create(self): self.width = 150 self.inputs.new("an_FloatSocket", "Position", "position...
true
54c83f6465e5668aa0584fd1e8b28d59b919a23c
Python
Alsant205/StartOfPython
/Lesson_2/Lesson_2_Task_1.py
UTF-8
941
3.5
4
[]
no_license
"""Создать список и заполнить его элементами различных типов данных. Реализовать скрипт проверки типа данных каждого элемента. Использовать функцию type() для проверки типа. Элементы списка можно не запрашивать у пользователя, а указать явно, в программе.""" # Список типов из методички data_types = [ 4, 4.4, 5+6j,...
true
d0a2865cb37358a54fa712d2dff27fee03203e68
Python
aiedward/CCIR
/code/SVM/feature2.py
UTF-8
3,512
2.765625
3
[]
no_license
# -*-coding: utf-8 -*- from get_words_for_CCIR import * import numpy as np import gensim import sys import os from feature import * reload(sys) sys.setdefaultencoding("utf-8") def get_feature_vector(word, model): try: vector = model[word] except KeyError: vector = np.array([0 for k in range(12...
true
33cd71e9f25c27c8a32d3bebec636df77f307d24
Python
pawelpiatekProjects/pythonWebscraping
/models/Flat.py
UTF-8
676
3.09375
3
[]
no_license
class Flat: def __init__(self, title, location, website, buildingType, rooms, price, area, description, link): self.title = title self.location = location self.website = website self.buildingType = buildingType self.rooms = rooms self.price = price self.area =...
true
28ff0d6496615199ca25ed56cbd8b64455130645
Python
RoccoFortuna/advent_of_code_2020
/d4_passport_processing/problem4.py
UTF-8
6,681
3.359375
3
[]
no_license
from typing import List, Dict def parse_input_file() -> List[Dict[str, str]]: input_path = "./d4_passport_processing/input.txt" with open(input_path, "r") as file: passports_str = file.read().strip().split("\n\n") passports = [] for passport_str in passports_str: passport_s...
true
4cfa1416572cbb555eadf0bb27b2fdcb0d2a2050
Python
KJThoma/arista-automation
/arista-version.py
UTF-8
763
2.515625
3
[ "MIT" ]
permissive
from netmiko import ConnectHandler # our devices info to connect and session log files to save output arista_1 = { 'device_type': 'arista_eos', 'ip': 'your_ip', 'username': 'your_username', 'password': 'your_password', 'session_log': 'sw1.txt' } arista_2 = { 'device_type': 'arista_eos', 'i...
true
97eac8e89d7cdfcf9e06c820621eb8102252ccac
Python
Sona1414/luminarpython
/collections/LIST/DEMO.py
UTF-8
536
3.828125
4
[]
no_license
#list lst=[] #first method using square bracket print(type(lst)) #2nd method usint list function sa=list() print(type(lst)) #supports hetrogenous data lst=[1,10.6,"sona",True,False] print(lst) #whether inseryion order is preserved lst=[10,15,6,7,3,3,2,1,1,"sona","neena"] print(lst) #duplicate value supported or no...
true
3c4b80ff80add96f029d8b8dc870e4308fe9e04d
Python
albigel/RK_ode_ivp
/RK.py
UTF-8
3,992
2.796875
3
[]
no_license
from numpy.linalg import norm as np_norm import numpy as np def c_(x): return np.array(x) norm_1 = lambda x: np.sum(abs(x)) RK_METHODS = { 'FE': [c_([[0]]), c_([1]), c_([0]), False], #Explicit Euler 'BE': [c_([[1]]), c_([1]), c_([1]), True], #Implicit Euler 'IMP': [c...
true
5e32c952ef3e4197e2f0e83d2a3a923788814f15
Python
umutku94/blog
/blog.py
UTF-8
11,180
2.65625
3
[]
no_license
#------------------------MODULES-------------------------------------- from flask import abort,Flask, render_template, flash, redirect, url_for, request, session, logging from flask_mysqldb import MySQL from wtforms import Form,TextAreaField,StringField,PasswordField, validators from passlib.hash import sha256_cryp...
true
cc56477c09a3e3bc8a4e90cfffba30f4818592c4
Python
bhusain/GenPair
/preprocess.py
UTF-8
2,037
3.015625
3
[]
no_license
# Preprocessing Script # Rachel Eimen # 2/16/18 # Description: Program reads in GEM, deletes points <= 0, and populates # an array of size 361 with a condensed version of the data import pandas as pd import matplotlib.pyplot as plt import math data = pd.read_csv('Hsapiens-9606-201603-2016-RNASeq-Quantile-CancerGenome...
true
cde8c85f28d6e6e4e1cde25da152eef3c0e639b6
Python
IDP-L211/controllers
/driver/modules/motion.py
UTF-8
4,995
3.21875
3
[ "MIT" ]
permissive
# Copyright (C) 2021 Jason Brown # # SPDX-License-Identifier: MIT """Class file for the motion controller""" import numpy as np tau = np.pi * 2 class MotionCS: """ All MotionCS methods will return an array of left and right motor velocities To be used via robot.motors.velocities = MotionControlStrategi...
true
e386b844226c72dbf52040769ed2518875a937d3
Python
avim2809/CameraSiteBlocker
/venv/Lib/site-packages/docs/likegeeks_tutorial/md_to_html.py
UTF-8
699
2.8125
3
[ "Apache-2.0" ]
permissive
import markdown import codecs def md_to_html(md_filename): html_filename = u"{fn}.html".format(fn=u'.'.join(md_filename.split(u'.')[:-1])) with codecs.open(html_filename, mode='w') as html_file: html_file.write("""<!DOCTYPE html> <html> <meta charset="UTF-8" /> <link rel="stylesheet" type="text/cs...
true
71d41cb3b5e2955d0e3cf74cc37f1f8308cefddc
Python
yanone/dancingshoes
/Sample files/myFP/features.py
UTF-8
2,329
2.78125
3
[]
permissive
from dancingshoes import DancingShoes from dancingshoes.helpers import SubstitutionsFromCSV import string def MakeDancingShoes(glyphnames): # Your features, in the order you want them in the font features = ('aalt', 'locl', 'numr', 'dnom', 'frac', 'tnum', 'smcp', 'case', 'calt', 'liga', 'ss01', 'ss02', 'ss03') ...
true
5ce2bd4677f02edc7f66b28ec43731ee0e2488ff
Python
gavingavinchan/lusca
/computerVision/thresholdIMG.py
UTF-8
998
2.625
3
[ "MIT" ]
permissive
import cv2 as cv import numpy as np from matplotlib import pyplot as plt img = cv.imread('checkerboardIMG.jpg',cv.IMREAD_GRAYSCALE) imgHeight = img.shape[0] imgWidth = img.shape[1] #print(img.shape) #ret,thresh = cv.threshold(img,) #cv.imshow('image',img) resizeIMG = cv.resize(img,(int(imgWidth/10),int(imgHeight/10...
true
b02d18cb4ab423b1f535ad8e8da23ead2c36f289
Python
TorpidCoder/Algorithm-in-Flow
/Sorting/reeverse.py
UTF-8
271
3.46875
3
[]
no_license
def reverse_only_string(list): if(len(list)<=1): return list return reverse_only_string(list[1:]) + list[0] print(reverse_only_string('abc')) def rev_1(lst): if not lst: return lst else: return lst[-1:] + rev_1(lst[:-1])
true
703a51161c69b23baffc9dc0c0734315da733b99
Python
HarshaniSomarathne/ExtractEXIF
/EXIF.py
UTF-8
938
2.984375
3
[ "MIT" ]
permissive
import exifread import optparse import sys def openImage(path_name): """Open image file for reading (binary mode)""" image = open(path_name, 'rb') return image def getData(tags, key): """get EXIF info according to the tag key""" for tag in tags.keys(): if key in tag: print "...
true
c0b4920abe13f9e9534962ca1b2ef166caa66835
Python
UMass-Rescue/OakContentScraper
/content_scraper/scrapers/utils.py
UTF-8
490
3.03125
3
[]
no_license
from abc import ABC, abstractmethod class Scrape(ABC): @abstractmethod def collect_batch(self): """Collect batch of text contents""" pass @abstractmethod def batch_monitor(self): pass @abstractmethod def continuous_monitor(self): pass def vdir(obj): """S...
true
94d48fd81e73763daf1f1b672ca3a4b15103014f
Python
JeroenVanGelder/citadels-machiavelli
/tests/test_character_card_draft.py
UTF-8
5,502
2.984375
3
[]
no_license
import unittest, random from machiavalli_game import MachiavelliGame from player.playerDescriptions import PlayerDescription from test_machiavelli_game import TestMachiavelliGame class CharacterCardDraftTest(TestMachiavelliGame): def setUp(self): self.game = MachiavelliGame() self.game.registerPla...
true
15839166485a645e5dc3e8bb080ef91fab05d9e4
Python
ptucker9/PythonClass-2015
/ordinal_test.py
UTF-8
723
3.390625
3
[]
no_license
import unittest #You need this module import ordinal #This is the script you want to test class mytest(unittest.TestCase): def test_ord(self): self.assertEqual("11th", ordinal.ordinal_type(11)) def test_ord1(self): self.assertEqual("Put in an integer.", ordinal.ordinal_type(23.4)) def test_or...
true
b94e0dadbc4c54c1273dcf3583d305d114d5fc13
Python
tszdanger/phd
/learn/ctci/1804-number-of-2s_test.py
UTF-8
523
2.984375
3
[]
no_license
from labm8.py import app from labm8.py import test FLAGS = app.FLAGS MODULE_UNDER_TEST = None # No coverage. # Write a method to count the number of 2s that appear in all the numbers # between 0 and n (inclusive). # # EXAMPLE # Input: 25 # Output: 9 (2, 12, 20, 21, 22, 23, 24, 25) # def count_2s(n): count = 0 ...
true
74dd7079091d4847c998f1e0edb9ac61ea05a896
Python
oyorooms/hue
/desktop/core/ext-py/josepy-1.1.0/src/josepy/b64_test.py
UTF-8
2,326
2.921875
3
[ "Apache-2.0" ]
permissive
"""Tests for josepy.b64.""" import unittest import six # https://en.wikipedia.org/wiki/Base64#Examples B64_PADDING_EXAMPLES = { b'any carnal pleasure.': (b'YW55IGNhcm5hbCBwbGVhc3VyZS4', b'='), b'any carnal pleasure': (b'YW55IGNhcm5hbCBwbGVhc3VyZQ', b'=='), b'any carnal pleasur': (b'YW55IGNhcm5hbCBwbGVhc3V...
true
9a40a167d334c6cbaa6ef82ca561546e1addf41b
Python
zk1013/mobileTestToolkit
/utils/adbkit.py
UTF-8
21,360
2.53125
3
[]
no_license
""" @Time : 2021/3/1 11:15 上午 @Author : lan @Mail : lanzy.nice@gmail.com @Desc : TODO: 提交 pr, wlan_ip() 里面没有做无权限设备获取IP的处理,可以添加上 """ import re import os import logging import platform import datetime import subprocess from random import random import adbutils import functools from MyQR import m...
true
b35a9f8c291c4c0546ad5e33cc305bbdec33e16b
Python
catherinetmoyo/CEBD1100_Work
/WEEK4/exercise2.py
UTF-8
96
2.53125
3
[]
no_license
my_list = ["A", "B", "C"] copied_list_1 == my_list copied_list_2 = my_list.copy() origina
true
f34d67638bb225d98d6bf141753d5fbdacd60d25
Python
jbayardo/metnum-tp2
/generadores/contador.py
UTF-8
467
3.3125
3
[]
no_license
file = open('train.csv', 'r') cantidades = [0,0,0,0,0,0,0,0,0,0] c = 0 for line in file: if c == 0: c = 1 # el primero es un label. continue partes = line.split(",") cantidades[int(partes[0])] = cantidades[int(partes[0])] +1 file.close() print cantidades sum = 0 for i in cantidades: ...
true
82d46021c3d28606d8bea61dbfb29209b6c1dda3
Python
RubyPatil/7_Class
/Webtable.py
UTF-8
415
2.84375
3
[]
no_license
from selenium import webdriver driver=webdriver.Chrome() driver.get("file:///C:/Users/Dell/Desktop/webtable2.html") driver.maximize_window() driver.implicitly_wait(30) #ele=driver.find_elements_by_xpath("//*[@id='emp']/thead/tr/th") ele=driver.find_elements_by_xpath("//*[@id='emp']/tbody/tr[1]/td") # For first row le...
true
5a20b912540ac601ae98a350833f0d5d1bb1f265
Python
beeven/pyZenWheels
/microcar.py
UTF-8
1,578
2.640625
3
[]
no_license
from bluetooth import * ADDR = '00:06:66:61:A3:EA' STEER = [b'\x81' + x.to_bytes(1, byteorder='big') for x in range(128)] SPEED = [b'\x82' + x.to_bytes(1, byteorder='big') for x in range(128)] SIDELIGHT_LEFT = [b'\x83\x00', b'\x83\x01', b'\x83\x02', b'\x83\x03', b'\x83\x04' ] SIDELIGHT_RIGHT = [b'\x84\x0...
true
c0083a17147e345e0cc2c37f83517682e47ba173
Python
caique-santana/CursoEmVideo-Curso_Python3
/PythonExercicios/ex030 - Par ou Ímpar.py
UTF-8
508
4.5
4
[ "MIT" ]
permissive
# Crie um programa que leia um número inteiro e mostre na tela se ela o PAR ou IMPAR # Meu num = int(input('Digite um número: ')) if num % 2 == 0: print('O número {} é \033[7;30m\033[1mPAR\033[m.'.format(num)) else: print('O número {} é \033[7;30m\033[1mIMPAR\033[m.'.format(num)) # Gustavo Guanabara número = i...
true
61a3ced71324f20ead873381dfe4363cb879b030
Python
jeklen/todolist
/toDoList-3/first.py
UTF-8
446
2.71875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2015-12-20 16:32:25 # @Author : Your Name (you@example.org) # @Link : http://example.org # @Version : $Id$ from Tkinter import * root = Tk() v = StringVar() def addItem(event): content = v.get() label = Label(root, text=content) label.grid() pri...
true
6d3632a82dea4ba8ea26707fa30ab8082f872286
Python
xiaole0310/leetcode
/659. Split Array into Consecutive Subsequences/Python/Solution.py
UTF-8
953
2.953125
3
[]
no_license
class Solution: def isPossible(self, nums): """ :type nums: List[int] :rtype: bool """ counts = {} for num in nums: if num not in counts: counts[num] = 0 counts[num] += 1 needs = {} for num in nums: i...
true
5d544b01497453888a275ac0b07129e7e7c3769d
Python
Vidhu-Chaudhary/Art_Of_Turtle_Programming
/Assembler/pass1.py
UTF-8
2,871
2.875
3
[]
no_license
from Opcode import * from SymbolTable import * labels = list() def pass1(): locptr = 0 arr = list() error = False stp = False with open("input.txt","r") as f: for x in f: x = x.strip("\n") arr = x.split(' ') # print(arr) st = "" if len(arr) == 1 and arr[0] == st: print("Error: Line is ...
true
4f360016f50a34fd9c906b70c4610f557c630523
Python
mahajanrahul24/demo_cba
/inc.py
UTF-8
58
2.96875
3
[]
no_license
def inc(input_user): return input_user+1 print(inc(10))
true
5d5505f9a93cb5bf30054304a2d6e86fda9017d7
Python
IkerSedanoSanchez/TIC-II-20_21
/7_letra_funcion2_IkerSedano.py
UTF-8
1,176
4.25
4
[]
no_license
def letra_funcion(): print """ ***MENU*** S de suma R de resta M de multiplicacion D de division""" interruptora=1 while(interruptora==1): numero=input ("Introcuzca el primer numero: ") numero2=input ("Introduzca el segundo numero: ") funcion=raw_in...
true
67b8041add0e2a75689411d94fc7848d61c0ca54
Python
pozdnyakovx/AlfaBattle2.0
/Alfa.py
UTF-8
8,915
2.515625
3
[]
no_license
# Alfa Battle 2.0 baseline # Task 2 (default prediction) # Features: # * app_id - Идентификатор заявки. заявки пронумерованы так, что более поздним заявкам соответствует # более поздняя дата # * amnt - Нормированная сумма транзакции. 0.0 - соответствует пропускам # * currency - Идентификатор валюты транзакции # * op...
true
338d0aa406d19fed370cb160f679ce45f29a31c4
Python
francescozanini/RPG
/story.py
UTF-8
1,871
3.484375
3
[]
no_license
from fight import * from tools import * import random class Story: def __init__(self, name, difficulty_level): self.name = name self.location = 'Home' self.is_alive = True self.difficulty_level = difficulty_level def get_diffuculty_level(self): return 'novice' if self....
true
77636afb1335b88128604070fed28463af6cc08e
Python
bignatezzz/LMSClub
/calender3/calender3.py
UTF-8
1,338
4.46875
4
[]
no_license
# # Program: This is an example program that shows how to use str functions. # 1. We are printing captilize Schedule # 2. find if the schedule has a day of your intrest # Author: Aashrith # Date : 10/03/20 def capitalizeMySchedule(str): print(str.upper()) def isMyDayPresent(str, findStr): ...
true