blob_id
large_string
repo_name
large_string
path
large_string
src_encoding
large_string
length_bytes
int64
score
float64
int_score
int64
detected_licenses
large list
license_type
large_string
text
string
download_success
bool
b5ae7a723e898c8751623183df5a370996ef00d6
christy-kuo/project101
/t.py
UTF-8
952
2.625
3
[]
no_license
#!/usr/bin/python import json import pandas as pd from pandas import DataFrame import numpy as np from sqlalchemy import create_engine import sqlite3 from datetime import datetime #Connecting to the database conn = sqlite3.connect('air_now.sqlite') #create a Cursor object,allow python to execute command cursor = con...
true
b2a666e3c13cc30fbc598865a61603e703696c48
matthew-eads/RecordRight
/RRSMS/add_db.py
UTF-8
1,542
2.9375
3
[]
no_license
## Adds a patient record to the database at the specified url ## url defaults to localhost:5000, but can be changed with the -u/--url arg ## (do not add /update to the url - that is done automatically) ## username and password for the db are provided from stdin (if the db ## doesn't need a username/password, just put w...
true
edb118cbecd5c038c9edb5d94e57387faf7d0094
Joaquin1798/Primer_proyecto
/Proyecto 4.py
UTF-8
819
3.625
4
[]
no_license
a = str(input('Introduce un número: ')) k = 0 n = 0 m = 0 p = 0 q = 0 r = 0 s = 0 t = 0 u = 0 v = 0 for i in a: if i == '0': k += 1 elif i == '1': n += 1 elif i == '2': m += 1 elif i == '3': p += 1 elif i == '4': q += 1 elif i == '5...
true
2efbdfed0c4b4797e50547c8e76982f2f78960a0
MatthewDaws/TileMapBase
/tilemapbase/cache.py
UTF-8
6,373
3.4375
3
[ "MIT", "LicenseRef-scancode-proprietary-license" ]
permissive
""" cache ~~~~~ Provides a base class for caching objects which are associated with a "request" object. Concrete implementation using a sqlite database. A "request" object is simply any object such that `str(obj)` returns a unique identifier of the request. Any object which can be converted to `bytes` by `bytes(obj...
true
e3eb90f0e3b70198bf22e6886079bcf8c2497346
joydip29/test1
/Student.py
UTF-8
523
3.90625
4
[]
no_license
class Student: stu_name = [] def insert_name(self,student_name): self.stu_name.append(student_name) return len(self.stu_name)-1 def fetch_name(self,student_roll): if student_roll >= len(self.stu_name): return 'No student is there with that name' else: return self.stu_name[student_roll] if __name_...
true
75f8c531808a0acd4d93caacb8b009930deafcce
himanshu0137/codechef
/COOKMACH.py
UTF-8
410
2.84375
3
[]
no_license
def power2(a): n = 0 while a > 1: if a&1: return -1 n += 1 a = a>>1 return n def func(a, b): if a == b: return 0 if power2(a) >= 0: return abs(power2(a)-power2(b)) else: return 1+func(a>>1, b) def main(): a, b = map(int, raw_input()...
true
d61c364d5ce6003676a0e44669d30ca9cbaea9e7
AlexIvanin/match.com-auth
/core/files.py
UTF-8
401
2.546875
3
[]
no_license
from core.logs import Logs import sys class Files: def get_file(file_name,check): file = open(file_name) list = [] for line in open(file_name): list.append(line.strip()) if (check): if (len(list) < 1): Logs.error(file_name + " empty") ...
true
3afd3b5165c8109ffbf04cda380a6b08120683b2
nilaybhatia/manim
/tests/test_writing.py
UTF-8
1,069
2.734375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
from manim import * from testing_utils import utils_test_scenes, get_scenes_to_test # NOTE : All of these tests use cached data (in /test_cache) # Cache functionality is tested within test_CLI. class TextTest(Scene): def construct(self): t = Text("testing", font="Arial") self.play(Animation(t)) ...
true
ec7ec6e7d10d380c77ae80ac6e5ec349cbfd7cb8
AdamZhouSE/pythonHomework
/Code/CodeRecords/2356/60715/303122.py
UTF-8
485
3
3
[]
no_license
def find(num): if len(num)<=2: return num[0] for i in range(1,len(num)-1): left=[] right=[] for j in range(i+1): left.append(num[j]) for k in range(i,len(num)): right.append(num[k]) if num[i]==sorted(left)[len(left)-1] and num[i]==sorted(ri...
true
a38832521d1b881c52d74f2ee5926e4edc422b3d
Dayoming/PythonStudy
/codingdojang/unit16/quiz.py
UTF-8
600
4.0625
4
[]
no_license
# 팩토리얼 구하기 # 팩토리얼(fantorial) : 1부터 n까지 숫자를 차례대로 곱한 값 # n = 5 # factorial = 1 # # for i in range(1, n + 1): # factorial = factorial * i # # print(factorial) # 표준 입력으로 정수가 입력됩니다. # 입력된 정수의 구구단을 출력하는 프로그램을 만드세요(input에서 안내 문자열은 출력하지 않아야 합니다). # 출력 형식은 숫자 * 숫자 = 숫자처럼 만들고 숫자와 *, = 사이는 공백을 한 칸 띄웁니다. dan = int(input()) ...
true
3dd607589fe206e4c954297f395b3c56b3819462
sanket-patil/Complex-Networks
/adaptable networks/experiments/analyses/statistics/distribution.py
UTF-8
1,312
3.203125
3
[]
no_license
def computeDistribution(seq, a = 0.0, b = 1.0, interval = 1, normalization = 1.0): dist = {} for i in range(int(a/interval), int(b/interval) + 1): dist[i] = 0.0 for i in seq: i = int(i/interval) dist[i] = dist[i] + 1.0 for k in dist.keys(): dist[k] = dist[k]/flo...
true
e0a7507b77723eca862ec45eab4892f86ccb8498
odibua/bayesianOptimalDesign
/psoMethods.py
UTF-8
9,585
3.515625
4
[]
no_license
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Mon Nov 13 11:32:25 2017 @author: Ohi Dibua ClassPSO that defines different version of the particle swarm optimization algorithm for execution. These algorithms are clasically used to solve typical optimization problems: min f(x,y)=min f(x) or max...
true
1bce4ac9092e548f9fdc774655f7e8aa2a29fec6
brendano257/Summit
/analyses/central/dateConv.py
UTF-8
5,361
3.796875
4
[ "Apache-2.0" ]
permissive
""" dateConv is a centralized script that contains a variety of functions useful for quickly and rapidly converting datetimes. This is a common issue to a large number of datasets. The functions in here are used for analyses across the entire root folder. """ from numba import njit import numpy as np def toYearFracti...
true
927a74c28a4155d40e08e96fd40a35cba01a4374
pwildfe1/featherGenerator
/eGeometry/interpolateGeo.py
UTF-8
31,777
3.03125
3
[]
no_license
import numpy as np import os import sys from scipy.interpolate import CubicSpline def vecRotate(vec,ang,axis): cos = m.cos(m.pi/180*ang) sin = m.sin(m.pi/180*ang) v = vec u = [axis[0]/np.linalg.norm(axis),axis[1]/np.linalg.norm(axis),axis[2]/np.linalg.norm(axis)] R1,R2,R3 = [] , [] , [] c = 1-cos R1.append(c...
true
0ac7fdaa3a2da0079a5e20558f9e13721c8e0b15
hoodakaushal/Assignments
/zzz/NLP/Assignment 3/evaluator.py
UTF-8
2,191
2.6875
3
[]
no_license
__author__ = 'hooda' import os from random import randint import ner f = 'features' t = 'training' m = 'crfmodel' def splitter(infile): infile = open(infile) def read_train(infile): infile = open(infile) data = [] sentence = [] for line in infile: if line == '\n': data += ...
true
c36a1d3e9ebb7401642e8954b5e16a19fd6bf05f
AdamZhouSE/pythonHomework
/Code/CodeRecords/2445/60885/311795.py
UTF-8
403
3.34375
3
[]
no_license
def create_s(): s = input() return s def create_ans(s): if s in ['s = "anagram", t = "nagaram"','s = "meat", t = "meta"']: return 'true' if s in ['s = "kiss", t = "kill"','s = "rat", t = "car"','s = "room", t = "home"']: return 'false' return False def print_ans(ans): print(ans...
true
3610c99b1016372b7bca15254f0b49b501c68eb4
1124418652/Morse_code
/Morse_code.py
UTF-8
3,272
3.640625
4
[]
no_license
# -*- coding: utf-8 -*- import re def get_string(): print("please choose the mode:") print("mode \"a\" means change Morse code to English letters,") print("mode \"b\" means change English letters to Morse code.") mode = input("mode \"a\" or mode \"b\":") str = "" if mode=="a": #模式a ...
true
75a4d82bf456413dca8dde21eaba6270965f65c4
kazu-bot/python_movie
/roboter.py
UTF-8
1,311
3.359375
3
[]
no_license
import os def recommend(): #ファイルの内容を読み込んでおすすめのレストランを紹介する。 #Yesが選択された場合はファイル書き込みに遷移し、処理終了 #Noが選択された場合は2行目も出力する #再度Noが選択された場合はレストラン入力をさせるようmainに返す with open('restaurant.csv','a+') as f: for row in f: fileList = row.readline() fileList = sorted(fileList, reverse=True, k...
true
98cf4f06f324ddab92b9fa466ddef74082a712d4
ExodusGemini/PythonForKids
/contractdb.py
UTF-8
4,373
2.875
3
[]
no_license
#!/usr/bin/python import os, time import random con1Header = "Hack a school website" con2Header = "Invent a hacking backpack" con3Header = "#" con4Header = "#" con5Header = "#" con6Header = "#" con7Header = "#" con1Full = "A privilege escalation request on www.sjva.org\nwas requested by an anonymous source.\nDue: Decem...
true
8b4a136e566f8906b57849b0e07fbe7e41860b62
boaass/Leetcode
/700. Search in a Binary Search Tree/Search in a Binary Search Tree/main.py
UTF-8
1,912
4.34375
4
[ "ICU" ]
permissive
# -*- coding: utf-8 -*- # Given the root node of a binary search tree (BST) and a value. You need to find the node in the BST that the node's # value equals the given value. Return the subtree rooted with that node. If such node doesn't exist, you should # return NULL. # # For example, # # Given the tree: # 4 ...
true
84c6a834ffa5bf98d50b72c5d1c8c456b44335bc
Elhamyali/tms
/translation_service/src/po_file.py
UTF-8
10,876
3.609375
4
[ "Apache-2.0" ]
permissive
PO_LINE_LEN = 80 # Max line length .po files prefer for printing on first line of msgstr class MsgElement: """Class for a message element from a .po file Attributes: msgheader: A list of header lines for the msg element. msgid: A list of msgid lines for the msg element (text line...
true
1b9450e6b92d14f2dd3e64fc06ce56d724c7c81e
nevesnunes/env
/common/code/snippets/fonts/opentype-bitmap.py
UTF-8
2,324
2.703125
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # opentype-bitmap - generate opentype bitmap (.otb) from BDF/PCF fonts # NOTE # Greater than version 20190413 is needed. Otherwise ensure your fontforge # has commit 79f9e0b8442631ac39ab907af20b813ac584298f import argparse import fontforge import gzip import os.path import sys from tempfile i...
true
24b42362d9671d9dee89bebb9a5ddc00a1753af1
Kyoungminn/Algorithm-Study
/Subin/stage1/k번째수.py
UTF-8
168
2.875
3
[]
no_license
def solution(array, commands): answer = [] for li in commands: i, j, k = map(int, li) answer.append(sorted(array[i-1:j])[k-1]) return answer
true
a29f563b842d74fd152bd329aaabde8b026c537b
Songtingt/SIFT
/student.py
UTF-8
21,133
2.90625
3
[]
no_license
import numpy as np from numpy.linalg import det, lstsq, norm import matplotlib.pyplot as plt from skimage import filters, feature, img_as_int from skimage.measure import regionprops import math import cv2 def get_interest_points(image, feature_width,r_thre,min_d): ''' Returns interest points for the input ima...
true
7bdc476271dcbc83a7e3b84cb4db8e70d13f55f8
Kawser-nerd/CLCDSA
/Source Codes/AtCoder/agc030/A/4644946.py
UTF-8
164
3.15625
3
[]
no_license
# -*- coding: utf-8 -*- A, B, C = input().split() A = int(A) B = int(B) C = int(C) if C > B + A: ans = A + B + B + 1 else: ans = B + C print(ans)
true
aa50d3b7b712ee60b6b39871d32c29e3dc3e2613
hsuCasper/PCReDive_Maho
/PCReDive_Maho/Name_manager.py
UTF-8
1,207
2.8125
3
[]
no_license
""" 每6小時清空暫存的DC暱稱資料 """ import gc from discord.ext import tasks import Discord_client @tasks.loop(hours=6) async def clear_list(): global people_list # 重設雜湊表 people_list = dict() gc.collect() print('已重置雜湊表') def init(): clear_list.start() # 獲取使用者nick(若無則為本名) async def get_nick_name(message, member_id)...
true
51a1f0d99cac0564523927b9a0462a8264272291
rebelbread/MySpider
/MySpider.py
UTF-8
723
2.984375
3
[]
no_license
from bs4 import BeautifulSoup import requests url = requests.get("https://movie.douban.com/top250", "lxml") soup = BeautifulSoup(url.text) page_set = {"https://movie.douban.com/top250"} movie_titles = [] for link in soup.find("div", attrs={"class": "paginator"}).find_all("a"): page_set.add("https://movie.douban.co...
true
72253b33a89efd980d35ccf1c3fe93a162ed98e4
trhongbinwang/data_science_journey
/deep_learning/keras/keras_function_api.py
UTF-8
11,344
3.640625
4
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- """ Created on Thu Nov 17 10:29:58 2016 keras functional api the key is that, it is more expressive and flexible. @author: hongbin """ #- A layer instance is callable (on a tensor), and it returns a tensor #- Input tensor(s) and output tensor(s) can then be used to define a `Model` #steps ...
true
8d7aca824c6dbcd149890cafdd2ebbe51a27fce8
qingmm/leetcode
/python/63.DP-Unique Paths II.py
UTF-8
721
2.734375
3
[]
no_license
class Solution(object): def uniquePathsWithObstacles(self, obstacleGrid): """ :type obstacleGrid: List[List[int]] :rtype: int """ import numpy as np m, n = len(obstacleGrid), len(obstacleGrid[0]) dp = np.zeros([m, n]) if obstacleGrid[0][0] == 1: ...
true
f5f24bc744dd2cdc7e237f8656e8df645bf489b9
Mumulhy/LeetCode
/497-非重叠矩形中的随机点/Pick.py
UTF-8
1,088
3.390625
3
[]
no_license
# -*- coding: utf-8 -*- # LeetCode 497-非重叠矩形中的随机点 """ Created on Thu Jun 9 09:58 2022 @author: _Mumu Environment: py38 """ from bisect import bisect_left from itertools import accumulate from random import randint from typing import List class Solution: def __init__(self, rects: List[List[int]]): self....
true
f05414d78bbde5e2a6f8cc9fed804b7900642782
Star-Coder-7/ProgramFlowControl
/aug_assign.py
UTF-8
370
3.875
4
[]
no_license
print("An\taugmented\tassignment\tis\ta\tmathematical\toperator\tin\tfront\tof\tan\tequal\tsign.") x = 23 x += 1 print(x) # 24 x -= 4 print(20) # 20 x *= 5 print(x) # 100 x //= 4 print(x) # 25 x /= 5 print(x) # 5.0 x **= 2 print(x) # 25.0 x %= 5 print(x) # 0.0 greeting = "Good " greeting += ...
true
b01cf5b61456515b15fc0fa8d1f804366d69323e
ebteles/PhytonVideoOpenCV
/frameToVideo.py
UTF-8
2,169
3.109375
3
[ "MIT" ]
permissive
import os import cv2 def frame_to_video(path_input, num_max_frames=0, files=[], verbose=False): """ Compõe vídeo a partir de um conjunto de imagens sequencialmente numeradas em uma pasta. O resultado é gravado na pasta 'video_output' dentro de "path_input Parâmetros: path_input....: pas...
true
bbb764a252e54878c0932d680df599857513551d
DanielJohnHarty/SQL_Software_Eng_Evaluation_Project
/DSTI_db_interface/tests/test_queries_and_dynamic_queries.py
UTF-8
1,886
2.546875
3
[]
no_license
# Standard Library Imports import os import sys PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) # Add project root to sys.path sys.path.insert(0, PROJECT_ROOT) # Local Imports # local import part of test suite import DSTI_db_interface.queries_and_dynamic_queries as q # 3rd Party Imports i...
true
2aba31455102df96c5322d1e878c6b9c8c13edaf
Darmo117/Wiktionary
/models-modules/lang_codes.py
UTF-8
227
2.71875
3
[]
no_license
import lupa with open('langues/data.lua', encoding='UTF-8') as f: langs = lupa.LuaRuntime().execute('\n'.join(f.readlines())) for code, name in sorted(langs.items()): print(f'* [[{code}]] - [[{name["nom"]}]]')
true
b7f6973e5578891acfa55f9ca1c89f369ed384de
foof/advent-of-code-2020
/22/1.py
UTF-8
696
3.21875
3
[]
no_license
deck_1 = [] deck_2 = [] with open('./data') as f: for p_no, deck_section in enumerate(f.read().split("\n\n")): for line in deck_section.split("\n")[1:]: if p_no == 0: deck_1.append(int(line)) else: deck_2.append(int(line)) def combat(deck_1, deck_2)...
true
48aa79742f9c6f337cb381f0e91d3001d1ad4058
phucduongBKDN/100exercies
/100 exercise/no124.py
UTF-8
206
3.484375
3
[]
no_license
#Valid Perfect Square num = int(input("nhap so")) def validPerfectSpare(num): for i in range(int(num/2)): if num == i*i: return True return False print(validPerfectSpare(num))
true
cd3957a99810976cc3f73409fa1249d034d97e6c
Mr-cpc/idea_wirkspace
/learnp/basic/bupt_2017_11_08/stcom.py
UTF-8
904
3.265625
3
[]
no_license
def stcom(chars:list)->(list,int): i = 1 d = {} while i < len(chars): if chars[i] == chars[i-1]: count = 1 tmp = i #here is very important,otherwise the line 11 will record the last same character not the first while i < len(chars) and chars[i] == chars[i-1]: ...
true
1c2c88084958236536e7a184d30f436a3abffed7
zy041225/python_bin
/tabTools/calculate_tab.py
UTF-8
1,617
2.96875
3
[]
no_license
#!/usr/bin/python3 def parameter_parser(argv): para_lst = [] tmp = argv.split(',') for i in tmp: if '-' in i: bg, ed = i.split('-')[:] bg = int(bg)-1 ed = int(ed) for j in range(bg, ed): para_lst.append(j) else: i = int(i)-1 para_lst.append(int(i)) return sorted(para_lst) def calculate(...
true
ba29cbe00b3c3b7b41f237fa68b0ab43f67dc94c
kaleketan07/Leet_assignments
/rob.py
UTF-8
411
3.296875
3
[]
no_license
## Incomplete def rob(nums): if len(nums) == 0: return 0 elif len(nums) == 1: return nums[0] elif len(nums) == 2: return max(nums[0], nums[1]) else: curr = 0 prev = 0 for i in range(len(nums)): curr, prev = prev, max(curr + nums[i], prev) ...
true
31196b965e71d50de81fdc7550ece7b7dae42fed
rgu-selfback/OpenEndedHAR
/merge.py
UTF-8
5,788
2.71875
3
[]
no_license
import os import random import time import csv from datetime import datetime COMMA_DELIMITER = ","; SEPERATER = "\\"; RAW_FOLDER = ""; NEW_FOLDER = ""; WRIST = "wrist34"; THIGH = "thigh34"; activityType = ["jogging", "sitting", "standing", "walkfast", "walkmod", "walkslow", "upstairs", "downstairs"...
true
fd314c07202409eafe0dce539505189ffde1e75b
lsn199603/leetcode
/19-全排列.py
UTF-8
3,288
3.765625
4
[]
no_license
""" 给定一个不含重复数字的数组 nums ,返回其 所有可能的全排列 。你可以 按任意顺序 返回答案。 输入:nums = [1,2,3] 输出:[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]] DFS """ def dfs(nums, length, depth, path, used, res): """ 状态:每一个结点表示求解问题的不同阶段 深度优先遍历在回到上一层结点需"状态重置" 状态变量 :param nums: 输入数组 :param length: 数组的长度 :param depth: 递归到第几层...
true
2fdb12a879933ee57454cb7f137aaafdd869810c
JWiryo/LearnAlgorithms
/DynamicProgramming/DP_UniquePaths.py
UTF-8
2,014
3.390625
3
[]
no_license
# Brute Force Recursive DP Solution # Time Complexity: O(2^(M+N)) # Space Complexity: O(M+N) class UniquePaths: def bruteForceUniquePaths(self, m: int, n: int) -> int: # Movement List -> Down, Right moves = [[1,0], [0,1]] # Setup global count variable self.count = 0 def findPath(...
true
8eb79de0f11a6bbdc0550b156c7a727f8d41282e
jairock282/pythonWorshop
/Clase9/imagen.py
UTF-8
1,362
3.609375
4
[]
no_license
##Procesamiento de imagenes ##importamos Image desde PIL from PIL import Image from PIL import ImageFilter ##Utilizar excepciones try try: ##Creamos un objeto que almacene la imagen para poder manipularla img = Image.open("imagenes/chester.jpg") ##modo de una imagen #print(img.mode) ##determinado pixel #print(...
true
ef783e43dc4c94760a784ef026b57a859d74c203
jocelo/rice_intro_python
/practice_excercises/week_4b/04_challenge.py
UTF-8
1,098
3.125
3
[ "MIT" ]
permissive
# Ball radius control - version 2 import simplegui WIDTH = 300 HEIGHT = 200 ball_radius = 10 ball_growth = 0 BALL_GROWTH_INC = .2 # Handlers for keydown and keyup def keydown(key): global ball_growth # add code here if key == simplegui.KEY_MAP['up']: ball_growth += BALL_GROWTH_INC if key == ...
true
597c9995ee08e439230f33ecd28891b911736f2b
MengSunS/daily-leetcode
/fb高频/32.py
UTF-8
1,300
3.265625
3
[]
no_license
# Method 1: stack class Solution: def longestValidParentheses(self, s: str) -> int: stack = [] # index of (, and index of unpaired ) as wall res = 0 n = len(s) for i in range(n): if s[i] == '(': stack.append(i) else: i...
true
740900910656f040739b66e57a4518fba0d9494a
SecretAardvark/Python
/pycrashcourse/rivers.py
UTF-8
442
3.625
4
[]
no_license
rivers = { 'Nile': 'Egypt','Mississippi': 'Louisiana', 'Volga': 'Russia', 'Rhine': 'Germany'} for k, v in rivers.items(): if 'Nile' in k: print('The Nile runs through %s'.format(k)) if 'Mississippi' in k: print('The Mississippi runs through %s'.format(k)) if 'Volga' in k: print('...
true
52cbdf67d09d989457492a97f1cab2e92b240389
harshitpoddar09/HackerRank-Solutions
/Python/Polynomials.py
UTF-8
118
3.03125
3
[]
no_license
import numpy coefficients=list(map(float, input().split())) x=float(input()) print(numpy.polyval(coefficients,x))
true
2d5dcb196f95eed6e0835c5f7221e48797cf885c
sauxpa/meowmeowbeenz
/meowmeowbeenz/meowmeowbeenz.py
UTF-8
9,401
2.921875
3
[]
no_license
import abc from collections import deque import numpy as np import scipy import networkx as nx from functools import lru_cache from copy import copy from tqdm import tqdm from typing import List RATINGS = [1, 2, 3, 4, 5] MAX_RATING = 5 MIN_RATING = 1 class MeowRandomRatings(abc.ABC): """Generic class to simulat...
true
9e5d36bcdf69f6ec9042770c64d8515f0e13cc50
waltman/advent-of-code-2017
/day14/disk_defrag.py
UTF-8
2,001
2.78125
3
[]
no_license
#/usr/bin/env python3 from sys import argv import networkx as nx def knot_hash(lens_str): myList = [x for x in range(0,256)] STD_SUFFIX = [17, 31, 73, 47, 23] lens = [ord(c) for c in lens_str] + STD_SUFFIX p = 0 skip = 0 for round in range(1,65): for myLen in lens: end = p...
true
dc465d78ee5b15b33db94d7dfb8d81c78924c521
jonathanlurie/pythonStuff
/test_wxPython/test04.py
UTF-8
1,304
2.875
3
[]
no_license
import wx import wx.html2 import time # Frame specialized to display youtube content class HtmlDisplay(wx.Frame): _browser = None _youtubeUrlPattern = r""" <iframe width="853" height="480" src="https://www.youtube-nocookie.com/embed/{ID}?autoplay=1" frameborder="0" allowfullscreen></iframe> "...
true
f637562c91228b65c5db601ed484aee043d50fdb
evelisko/Sergey_Keldibekov_Python
/Lesson_7/task_1.py
UTF-8
2,557
4.375
4
[]
no_license
# 1. Реализовать класс Matrix (матрица). Обеспечить перегрузку конструктора класса (метод init()), # который должен принимать данные (список списков) для формирования матрицы. # Подсказка: матрица — система некоторых математических величин, расположенных в виде прямоугольной схемы. # Примеры матриц вы найдете в методич...
true
d68e7290ccd6d2c84c948d53bf484cd46c0445c9
bzhangGo/paraphrasing-bleu
/scripts/sample_random_codes.py
UTF-8
741
3.15625
3
[]
no_license
#!/usr/bin/python import argparse import random argparse = argparse.ArgumentParser() argparse.add_argument('numsents', type=int, help='Total number of codes to generate') argparse.add_argument('--code_range', nargs=2, type=int, required=True, help='Id numbers of first and la...
true
44006ad7fcbfb3b2d69a3614fe8a399dc721174b
a-valado/python
/Práctica 6/p6.7.suma.limite.py
UTF-8
683
4.5625
5
[]
no_license
#Albert Valado Pujol #Práctica 6 - Ejercicio 7 #Escribe un programa que pida un número (límite) y luego te pida números hasta que la suma de los números introducidos supere el límite inicial. #El programa termina escribiendo la lista de números. limite=int(input("Introduzca el número límite que quiera. \n")) num=int(i...
true
c62227543ae247e98cefccb6d80eee7c4513a316
karthikeyan0312/Games
/connect 4/connect-4.py
UTF-8
4,787
3.171875
3
[]
no_license
import numpy as np import pygame as py import os import math ROW_COUNT=6 COLUMN_COUNT=7 #colors BLUE=(0,0,255) BLACK=(0,0,0) RED=(255,0,0) YELLOW=(255,255,0) #assigning size SQUARESIZE=100 width=COLUMN_COUNT*SQUARESIZE height=(ROW_COUNT+1)*SQUARESIZE size=(width,height) RADIUS=int(SQUARESIZE/2-5) ...
true
de4d19dc6530e4b3774096e47497998a6bfa7a01
south-coast-science/scs_core
/tests/climate/ah_calculator.py
UTF-8
2,122
3.203125
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 """ Created on 4 Feb 2019 @author: Bruno Beloff (bruno.beloff@southcoastscience.com) https://www.aqua-calc.com/calculate/humidity https://carnotcycle.wordpress.com/2012/08/04/how-to-convert-relative-humidity-to-absolute-humidity/ https://planetcalc.com/2167/ """ import math # --------------...
true
d4bd51b862436cff68bcb7cb5ae527a2a11cdce6
MyoMyoCU/Python-Exercises
/ex34.py
UTF-8
463
3.96875
4
[ "MIT" ]
permissive
animals = ['bear', 'python3.6', 'peacock', 'kangaroo', 'whale', 'platypus'] bear = animals[0] python = animals[1] peacock = animals[2] kangaroo = animals[3] whale = animals[4] platypus = animals[5] print(f"the first animal is at 0 and is a {bear}") print(f"The third animal is at 2 and is a {peacock} ") print(f"The fi...
true
61eb39b4f02c462eb57d7353e97fcdc13a3877b7
JamesMakovics/PythonClassProjects
/Programs/StringsExercises/endsWith.py
UTF-8
225
3.9375
4
[]
no_license
#Checks if the substring matches the end of the string def endsWith(s,sub): subLength = len(sub) + 1 if s[subLength:] == sub: return True elif s == sub: return True else: return False
true
c059b7295c12b436f32418125f48a497d1542faa
berinhard/sketches
/militares/militares.pyde
UTF-8
2,982
2.6875
3
[]
no_license
import os from random import shuffle IMAGES_OFFSET = 4 WIDTH = 1000 HEIGHT = 1000 IMG_HEIGHT = 80 NUM_LINES = HEIGHT / IMG_HEIGHT WHITE = color(235) WHITE_LINE = color(185) RED = color(218, 12, 10) BLACK = color(17, 17, 17) generals = [] generals_right_position = [] people = [] def settings(): people_images = os...
true
7c836878c0c5e5a68fd394ffad1f7aa738f561b0
elfeto/ZeroForcingSet
/Graph.py
UTF-8
2,124
3.265625
3
[]
no_license
class Graph: def __init__(self, graph_struct = None): if graph_struct: self.graph = graph_struct else: self.graph = [[0, [], 0]] def GetGraph(self): return self.graph def GetAllNodes(self): nodes = [] for node in self.graph: nodes.append(node[0]) return nodes def GetGraphSize(self)...
true
b59de8e333474da60a54d320092edf051a74f810
eareyan/negotiationmediator
/deprecated/BO1D.py
UTF-8
4,352
2.625
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from skopt import gp_minimize from valuations import read_xml as xml, scenario_factory from skopt.plots import plot_convergence from skopt.acquisition import gaussian_ei import xml.etree.ElementTree as ET from util import util # Fix randomness so we can recreate exper...
true
a7e8fedeef5f350d864fcc79016fc31f45810158
The-Daishogun/coding-exercises
/tamrin 3, 4.py
UTF-8
408
3.984375
4
[]
no_license
def count_letter(string, letter): fruit = string count = 0 for char in fruit: if char == letter: count += 1 return count def count_letter2(string, letter): count = 0 for i in range(len(string)): m = string.find(letter, i) if i == m: count += 1 ...
true
ad339f4517b76d14c655847fa2579295d9897cb5
jabe1204/BaqueroJohan_Ejercicio28
/graficador.py
UTF-8
407
2.859375
3
[]
no_license
import numpy as np import matplotlib.pylab as plt datos = np.loadtxt("ejercicio28.dat") xDrag = datos[:,0] yDrag = datos[:,1] xSDrag = datos[:,2] ySDrag = datos[:,3] plt.plot(xDrag,yDrag, color = "green", label = "Con Resistencia") plt.plot(xSDrag,ySDrag, color = "red", label = "Sin Resistencia") plt.title("Proyecti...
true
029f386694ad817fba3a47a0ffcf524249718b58
chrmorais/hex_editor
/GUI/command_line.py
UTF-8
1,119
3.125
3
[]
no_license
import curses class CommandLine(): def __init__(self, view_zone): view_zone.height = 1 self.draw_zone = view_zone self.active = False self.color = 1 self.text = '' self.cursor_pos = 0 @property def draw_zone(self): return self.__draw_zone @draw...
true
d68dddbd5cb293be61feed05c44a9ec1bd8ed3b1
yancborges/code_nebula
/Discord bots/move_scrapping.py
UTF-8
143
2.65625
3
[]
no_license
import urllib.request from move import move name = input('Target move: ') move = move(name,'','','','','') move.scrap() print(move.toString())
true
629d45d9fe023cfc2b8dfb4dd09bd72498ed8d31
StevenLOL/cnn-vizlib
/die/label.py
UTF-8
1,730
2.734375
3
[]
no_license
#!/usr/bin/env python2.7 # encoding: utf-8 '''Inspected the die images manually. Noted what rotation corresponds to what class. Here we generate the dataset. ''' import os import matplotlib.pyplot as plt import numpy as np path = os.path.split(__file__)[0] if path == '': path = '.' files = sorted([ os.path.join(p...
true
0424b0690fe1a90292488f008cf80b792255ed8a
jaimersoncorreia/cg
/aulas/parteI/012imports.py
UTF-8
327
3.265625
3
[]
no_license
""" Autor: Jaimerson Correia Descrição:Usando código já pronto: importando módulos """ #Tipos de imports #import math #import math as matematica from math import sqrt as raiz from math import log2 as l2 #perde referência do módulo math #math=10 #print(math.sqrt(81)) #print(matematica.sqrt(81)) print(raiz(81)) print...
true
203301883744fd922d73aaf5ca980bd86cc1a60a
neu-velocity/code-camp-debut
/codes/Aiamjay/Week4-Day4/55. Jump Game.py
UTF-8
1,251
3.40625
3
[]
no_license
# encoding = utf-8 import numpy as np class Solution: def solution(self, nums): length = len(nums) if length < 2: return True dp = [0] * length dp[0] = nums[0] for i in range(1, length): flag = False for j in range(i - 1, -1, -1): ...
true
598cdf995e9b5dd8573fa155a2db71d757a229ec
HakanYildizz/Python3
/sınıf projesi/calıştır.py
UTF-8
1,269
3.6875
4
[]
no_license
# -*- coding: utf-8 -*- """ https://hakannyildiz.wordpress.com/ Hakan Yıldız """ from ogrenci import * print("""*********************************** Kütüphane Programına Hoşgeldiniz. İşlemler; 1. Öğrenci Ekle 2. Öğrenci Sil Çıkmak için 'q' ya basın. ***********************************""") s...
true
f0688e71cd5ef41ac71f499eecaa81349cfc6ecd
AlaskanEmily/Whittler
/whittler.py
UTF-8
5,982
2.53125
3
[]
no_license
# Copyright (c) 2017 AlaskanEmily # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from emirc import emirc from whittler import fmc, nesparty import ConfigParser # get ...
true
451617471cc74e475c248f6a2c2b613d3d3e6be3
vradja/leetcode
/sliding_window/average of contiguous subarray.py
UTF-8
1,717
4.09375
4
[]
no_license
import functools import itertools # Given an array, find the average of all contiguous subarrays of size ‘K’ in it. def find_averages_of_subarrays_1(K, arr): result = list() window_sum, window_start = 0.0, 0 for windowEnd in range(len(arr)): window_sum += arr[windowEnd] window_start = w...
true
12929085808f0c7eef7cd3ebb6f656b8b81f2a9c
jeanP-tech/Swimming-Website
/swimapp/models.py
UTF-8
1,405
2.6875
3
[]
no_license
from django.db import models from datetime import datetime class City(models.Model): city_name = models.CharField(max_length = 20, default='') def __str__(self): return self.city_name class Pool(models.Model): city = models.ForeignKey(City, default='', on_delete = models.CASCADE) pool_name = m...
true
5f8802c17adb39b74b8822db1c1c41ec29a48139
srihari-macha/selenium_basics
/dining_table.py
UTF-8
20,777
2.609375
3
[]
no_license
from selenium import webdriver import time driver=webdriver.Firefox() driver.get("http://www.customfurnish.com/tables/?legColor=natural_1_sheesham&topColor=natural_1_sheesham") time.sleep(3) for i1 in range(1,4): #3 shape_tab = driver.find_element_by_xpath(".//*[@id='body-wrapper']/div[5]/div[1]/div/div[2]/cf-to...
true
4229ffb8ab7e3b9a423f7d946882d10068c21d27
lululeta2014/mihaib
/forge/old/prjeuler/p71.py
UTF-8
458
3.140625
3
[]
no_license
from fractions import Fraction if __name__ == '__main__': max_d = 1000000 solution = Fraction(2, 5) solution = 0 upper_limit = Fraction(3, 7) for d in range(1, max_d + 1): min_n = int(solution * d) for n in range(min_n, d): candidate = Fraction(n, d) if cand...
true
cd2739d106a86d94214a2618017200e877b6f119
farhadkpx/Python_Short_Programms
/sumOfMultidimensional.py
UTF-8
368
3.25
3
[]
no_license
def myFunction(myList): total =0 number_of_rows = len(myList) number_of_columns = len(myList[0]) rows = 0 while rows < number_of_rows: columns = 0 while columns < number_of_columns: total = total + myList[rows][columns] columns = colu...
true
4f6904601e1fadb8504a7eb746132e9b8911f254
MikeOcc/MyProjectEulerFiles
/Euler_4_171c.py
UTF-8
693
3.046875
3
[]
no_license
summ = 0 from itertools import combinations,permutations sq = [i*i for i in xrange(0,10)] lst = [] x = combinations(sq,3) for y in x: print y if sum(y)==144: print y exit() ''' for a in xrange(18): for b in xrange(10): for c in xrange(10): for d in xrange(10): for e in xrange(10): ...
true
0b1efb1d7f306189f5ffa43d48ab14c5d3daa646
whoiskx/com_code
/history/Facebook/News_xinhua_praise/excel_read_and_write.py
UTF-8
2,148
3.109375
3
[]
no_license
from openpyxl import load_workbook, Workbook from setting import urun # 读取excel文件 def read_excel(file_name=''): # 打开 默认可读写 wb = load_workbook(file_name) # 获取工作表 # sheet = wb.get_sheet_names() sheet = wb.active # 获取单元格 # 获取某个单元格的值,观察excel发现也是先字母再数字的顺序,即先列再行 # b4 = sheet['B4'] # ce...
true
384c4965acbf6b6f478c937c9bacb98c34440384
LightTag/lighttag-convertors
/lighttag/conflict_resolver.py
UTF-8
2,796
2.65625
3
[ "MIT" ]
permissive
from typing import List, Optional import warnings from typing_extensions import TypedDict from lighttag.type_definitions.lighttag_result_types import Annotation class Span(TypedDict): start :int end:int def overlaps(a:Span,b:Span): if a['end'] <b['start'] or b['end'] <a['start']: return False ...
true
67b131f51e58fa8018333370493a359a9dc6990d
peluche/chicken-wire
/chicken-wire.py
UTF-8
3,916
3.375
3
[]
no_license
from collections import namedtuple from PIL import Image Point = namedtuple('Point', ['x', 'y', 'z']) def add_altitude(world): return [[Point(x=p.x, y=p.y + p.z, z=p.z) for p in row] for row in world] def rotate_x_y_45(world): ''' rotate and skew the world ''' i = Point(x=1, y=0.5, z=0) j = Point(x=-...
true
11061d2e36b65c96331c4251b929ca822866b7de
zzcheah/Foobar
/power-hungry/solution.py
UTF-8
1,524
2.734375
3
[]
no_license
def solution(xs): leftOut = -1001 posCount = 0 negCount = 0 neutralCount = 0 posProduct = 1 negProduct = 1 finalProduct = 1 if len(xs) == 1 : if xs[0] < 0: return str(xs[0]) for num in xs: if num == -1: neutralCount = n...
true
dcc6c283cf6053ce90b40beb78cc6a773aa6128f
syurskyi/Algorithms_and_Data_Structure
/_algorithms_challenges/leetcode/lc-all-solutions/363.max-sum-of-rectangle-no-larger-than-k/max-sum-of-rectangle-no-larger-than-k.py
UTF-8
847
2.9375
3
[]
no_license
import bisect class Solution(object): def maxSumSubmatrix(self, matrix, k): """ :type matrix: List[List[int]] :type k: int :rtype: int """ ans = float("-inf") dp = [[0] * len(matrix[0]) for _ in range(len(matrix))] for i in range(0, len(matrix)): for j in range(0, len(matrix[0]...
true
b342ade74d5524d8b1fb4813110d70f4cbea85c6
WhoDaFuhhh/Beginner_Python
/calculator.py
UTF-8
412
4.5625
5
[]
no_license
print ('Enter number 1') number1 = int(input()) print('Do you want to add +, subtract -, multiply * or divide /') operator = str(input()) print('Enter number 2') number2 = int(input()) if operator == '+': print (number1 + number2) elif operator == '-': print (number1 - number2) elif operator ==...
true
3be191eb8b96e5d05312cf119ec6f4b7323e9209
biinari/wxsql
/app/editor/editor.py
UTF-8
1,045
2.84375
3
[]
no_license
#!/usr/bin/env python """ MySQL Query Editor control. """ import wx class QueryEditorCtrl(wx.TextCtrl): """ MySQL Query Editor control. """ def __init__(self, *args, **kwargs): """ Create MySQL Query Editor Control """ wx.TextCtrl.__init__(self, *args, **kwargs) class QueryEditorPanel(wx.Pan...
true
2a068fbadc8f5707eddf340e65747717e33b76e4
m-samik/aws
/aws_cli_ebs_ec2.py
UTF-8
1,541
2.65625
3
[]
no_license
import json import os # Launching Instance os.system("aws ec2 run-instances --image-id ami-0ad704c126371a549 --instance-type t2.micro --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=Iamfromcli}]' --key-name myawskey > instance.json") file_in = open("instance.json") data_in = json.load(file_i...
true
1e968ac52cce1abc86103629ddff9a857af8fbaf
growgeorges/MagicBot
/MagicBot/server.py
UTF-8
340
2.9375
3
[]
no_license
import socket port = 8080 print("hostname : " + str(socket.gethostbyname(socket.gethostname()))) s = socket.socket() print("Socket successfuly created") s.bind(("", port)) s.listen(5) print("Socket is listenning") while True: c, addr = s.accept() print("Got connection from : " + str(addr)) c.send(b'te...
true
30d7c120748edfd62f687045d5bb82d97a39bd19
xcg1993/spider
/process_/p4.py
UTF-8
1,303
2.9375
3
[]
no_license
import os import time import uuid from multiprocessing import Process, Pipe import urllib from requests import request BASE_DIR=os.path.dirname(os.path.dirname(os.path.abspath(__file__))) IMG_DIR=os.path.join(BASE_DIR,'images') def downloader(conn): while True: url=conn.recv() if url=='0': ...
true
e2d1b85effdfced59f89ea3744c9f035c619b8ce
twoodhouse/leucopus-py
/alpha/library.py
UTF-8
10,594
2.640625
3
[]
no_license
import requests import inspect from case import Case from rhManager import ReuseHypothesis import random # from time import sleep class Librarian(): def __init__(self, infoRoutes, actionRoutes, initialActions = [], maxCaseSize = None): self.infoRoutes = infoRoutes self.actionRoutes = actionRoutes ...
true
21c0b7dbbb6b3d1bf74e4815aeab16b57cc5d182
visor517/GeekBrains_python
/lesson1/task3.py
UTF-8
310
4.28125
4
[]
no_license
# 3. Узнайте у пользователя число n. Найдите сумму чисел n + nn + nnn. Например, пользователь ввёл число 3. Считаем 3 + 33 + 333 = 369 n = input('Введите число n: ') result = int(n) + int(n*2) + int(n*3) print(result)
true
f2f837082ca878c94c5e143f0788d41e44fd6edd
randbrown/python-examples
/minutesdisplay.py
UTF-8
129
3.390625
3
[ "MIT" ]
permissive
def hour_min(mins): return '{0}:{1:02d}'.format(mins/60,mins%60) for i in range(0, 200, 5): print i, ' = ', hour_min(i)
true
a6649a7cdd078a5dbdd847fba4102300156633b7
callmess/Pyth
/practice/list.py
UTF-8
131
3.296875
3
[]
no_license
p=[] n=0 while n<100: p.append(n) n=n+1 print(p) print(p[1:5]) print(p[-7:-5]) print(p[-7:]) print(p[:10:3]) print(p[:1:2])
true
529acd10f2ecb6bc584c6fec85105490c5a1722f
chogan72/CryptoPriceChecker
/CryptoPriceChecker.py
UTF-8
5,879
2.515625
3
[]
no_license
import time, json, requests, colors #BTC def bitstamp(): BitStampTick = requests.get('https://www.bitstamp.net/api/ticker/') return BitStampTick.json()['last'] def bitfinex(): BitFinexTick = requests.get("https://api.bitfinex.com/v1/ticker/btcusd") return BitFinexTick.json()['last_price'] def coinbase(): Co...
true
24c3304e2a06080c1990bc3af44b276e54ba0589
GustasStankus/College-work
/RockPaperScissor.py
UTF-8
1,999
3.515625
4
[]
no_license
def main(): end = 1 score = 0 while end == 1: from random import randint Rock = u"\u25A0" # 2 Paper = u"\uFE4F" # 3 Scissors = u"\u2702" # 1 comChose = randint(1,3) print (comChose) # the code starts perChose = int(input(""" You chose first...
true
e57baa38fdb15d490ba3fb0e822a8aeec256abff
gkswkcjswo00/pytuon_gift
/if.py
UTF-8
49
2.921875
3
[]
no_license
x=1 if x>0: print('x는 양수다')
true
aca0cb385dc9e5b0e4e291addc44e547df2d791f
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_201/1829.py
UTF-8
2,165
3.359375
3
[]
no_license
def find_idx_of_max(num_list): maximum = max(num_list) idx = num_list.index(maximum) return idx def find_max_min(num): if num <= 1: return 0, 0 elif num == 2: return 1, 0 elif num % 2 == 0: #even value = num / 2 return value, value - 1 else: # odd val...
true
7e276532d6a4cb92498574a05173e5d82c4a1b26
qnib/alpn-diamond
/usr/share/diamond/collectors/docker_stats/docker_stats.py
UTF-8
3,777
2.625
3
[ "Apache-2.0" ]
permissive
""" The DockerStatsCollector collects stats from the docker daemon about currently running containers. """ import diamond.collector from diamond.utils.signals import SIGALRMException try: import docker except ImportError: docker = None def env_list_to_dict(env_list): env_dict = {} for pair in env_list: t...
true
7121014afada8292a04145ba568832a8d98b05ed
lfarnsworth/GIS_Python
/Coding_Challenges/Challenge3/push_limit.py
UTF-8
545
3.96875
4
[]
no_license
# Bad Password Generator # Takes 3 arguments (Name, Street, Birth year) and generates awful password # Load library to get command-line arguments and select random value import sys import random street_name = sys.argv[1] birth_year = sys.argv[2] first_name = sys.argv[3] special_char = random.choice('`~!@#$%^&*()_+') ...
true
1596e155f963178fee52a273c774609ea12e2fd5
davidko/autorecord
/main.py
UTF-8
4,645
2.703125
3
[]
no_license
#!/usr/bin/env python3 """ Based off of a sample program from https://python-sounddevice.readthedocs.io/en/0.4.1/examples.html#recording-with-arbitrary-duration """ """ The soundfile module (https://PySoundFile.readthedocs.io/) has to be installed! """ import argparse import tempfile import queue import sys import...
true
915b9a93bb0c5d247e94f21d39a71121ccee8684
XkhldY/LeetCode
/solutions/1093. Statistics from a Large Sample/1093.py
UTF-8
968
3.078125
3
[]
no_license
class Solution: def sampleStats(self, count: List[int]) -> List[float]: minimum = 0 maximum = 0 mean = 0 leftMedian = 0 rightMedian = 0 mode = -1 numCount = sum(count) newNumCount = 0 maxCount = 0 for i, c in enumerate(count): if c > 0: minimum = i break ...
true
4215953c14a2dfc78982264c240d14a6887d9bda
Duongthien1809/dulo_website
/web/forms.py
UTF-8
2,056
2.546875
3
[]
no_license
from django import forms import re from django.contrib.auth.models import User from .models import PostModel class RegisterForm(forms.Form): username = forms.CharField(label='Benutzername', max_length=30) email = forms.EmailField(label='Email') password = forms.CharField(label='Password:', wid...
true
1e6db6b8e36111a7becc6ab59665148ca9a6e531
deepjyoti-dev/datascience
/day-23.py
UTF-8
1,784
2.703125
3
[]
no_license
import pandas as pd ''' #### read json and plot overall column df_reader = pd.read_json('part.json', lines = True) json_df = df_reader['overall'].value_counts().head(5) print(json_df) json_df.plot.bar() ####### read json and plot reviewText column df_reader1 = pd.read_json('part.json', lines...
true
426de0992883e3a907cf4113835e2ef445e63b4b
SnoringFrog/trivial_brainfuck_interpreter
/tbi.py
UTF-8
2,128
2.921875
3
[ "MIT" ]
permissive
import re import sys #TODO: # arguments for common bf trivial substitutions # option to supply string to represent all commands # options to toggle wrapping/negative cells/etc # debugging options? # print tape, at least cells = 30000 cell_bits = 8 tape = [0]*cells ptr = 0 loop_idx_stack = {} commands...
true