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
5608c2685a13bbb12383af0f8b9c53d3278f9816
rarose67/Python-practice-
/Exercises/Ch11. Ex.py
UTF-8
10,180
4.46875
4
[]
no_license
"""1. Write a program that allows the user to enter a string. It then prints a table of the letters of the alphabet in alphabetical order which occur in the string together with the number of times each letter occurs. Case should be ignored. A sample run of the program might look like this: Please enter a sentence: Th...
true
22345c5c089c6ca27790d5408b813dacdb3787d4
southpawgeek/perlweeklychallenge-club
/challenge-184/ealvar3z/python/ch-1.py
UTF-8
1,000
3.71875
4
[]
no_license
# -*- coding: utf-8 -*- #!/usr/bin/env python3 """ Created on Wed Oct 12 11:30:17 2022 @author: Erly.Alvarez You are given list of strings in the format aa9999 i.e. first 2 characters can be anything 'a-z' followed by 4 digits '0-9'. Write a script to replace the first two characters with sequence starting ...
true
094b44bbad2eca4368f8ebe865732ecd717b2661
neatelyle/QPT-CleverGo
/pgutils/text.py
UTF-8
1,902
3.359375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- # @Time : 2021/10/7 11:44 # @Author : He Ruizhi # @File : text.py # @Software: PyCharm import pygame from typing import List, Tuple, Union import os current_path = os.path.dirname(__file__) def draw_text(surface: pygame.Surface, text: Union[str, pygame.Surface], ...
true
78c06e602d99ee09b66e1fef5da01888a1dd5315
xuelang201201/PythonCrashCourse
/02-变量和简单数据类型/动手试一试/number_cases.py
UTF-8
1,229
4.53125
5
[]
no_license
""" 数字8:编写 4 个表达式,它们分别使用加法、减法、乘法和除法运算,但结果都是数字 8。为使用 print 语 句来显示结果,务必将这些表达式用括号括起来,也就是说,你应该编写 4 行类似于下面的代码: _______________________________________________________________________________________ print(5 + 3) ——————————————————————————————————————————————————————————————————————————————————————— 输出应为 4 行,其中每行都只包含数字 8。 ""...
true
53a6dc43f7aa6f3932242bb8b03afdf627782e5a
vvf/vvf-all
/py/gen-zip.py
UTF-8
1,180
2.84375
3
[]
no_license
#!/usr/bin/env python import uuid import zipfile import random import string from lxml import etree from lxml.builder import E MAX_LEVEL = 100 MIN_LEVEL = 1 MAX_OBJECTS_NUMBER = 10 NUMBER_FILES_IN_ZIP = 100 NUMBER_ZIP_FILES = 50 ZIP_COMPRESSION = zipfile.ZIP_DEFLATED def get_random_string(minlen=10, maxlen=50): ...
true
318f96170809806e0e882361237570a25d1dcaf9
DennisJr1217/nucamppython_fundamentals
/week1-2/cc_reverse.py
UTF-8
130
4.53125
5
[ "MIT" ]
permissive
def reverse(str): str = input("What is your name? ") return str [::-1] print("Your name reversed is: ", reverse(str))
true
b89bf9d09604aea4b5ebec7aa9ebff71f42ec034
IonesioJunior/URI
/Beginner/1178.py
UTF-8
119
3.234375
3
[]
no_license
#coding: utf-8 n = float(raw_input()) loop = 0 while(loop < 100): print "N[%d] = %.4f" % (loop,n) n /= 2 loop += 1
true
34b802dc27e30a131542cda4b10dc041ab5b2761
jl36042n/CIS-101
/LynesJlDicePython4.py
UTF-8
679
4.1875
4
[]
no_license
import random a=True tries = 1 die1 = random.randint(1,6) die2 = random.randint(1,6) dice = die1 + die2 print("Welcome to the Rolling Dice Program!") num = int(input("Enter a number 2 to 12: ")) print(num) if(num < 2 or num > 12): a = False print("Not a real value for this game! Restart and try again...
true
38e364bf27bd79236da209c1d8c0735a6619950e
sshivaji/authnzerver
/authnzerver/frontendbase.py
UTF-8
37,158
2.53125
3
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- # frontendbase.py - Waqas Bhatti (wbhatti@astro.princeton.edu) - Sep 2018 '''This is an example Tornado BaseHandler that knows how to authenticate users and verify API keys using HTTP and the pre-shared secret key to talk to the authnzerver. It runs the authentication/aut...
true
bdb368ff38061a9008a7068bdd093f4223157da3
Aasthaengg/IBMdataset
/Python_codes/p03283/s377459389.py
UTF-8
604
2.703125
3
[]
no_license
import sys sys.setrecursionlimit(10 ** 7) input = sys.stdin.readline n, m, q = map(int, input().split()) train = [[0 for _ in range(n)] for __ in range(n)] for _ in range(m): l, r = map(int, input().split()) train[l-1][r-1] += 1 ans = [[0 for _ in range(n+1)] for __ in range(n+1)] for i in range(n): fo...
true
dc04da783cfa8ea32ec6f204e77dc31c7f588431
DSM-ESD/SelfmadeIoT-Software
/widgets/CodeWidget.py
UTF-8
2,241
2.796875
3
[]
no_license
from PyQt5.QtGui import QPainter, QColor from PyQt5.QtCore import QPoint, pyqtSignal from PyQt5.QtWidgets import QWidget from .LabelWidget import * class CodeWidget(LabelWidget): exitFunction = pyqtSignal(QWidget) def __init__(self, color, border, parent, code = None): super().__init__(color, border, p...
true
06cddb744b8e62e92b871a9d16a3c2303e303340
hshrimp/letecode_for_me
/letecode/121-240/169-192/189.py
UTF-8
1,647
4.15625
4
[]
no_license
#!/usr/bin/env python # encoding: utf-8 """ @author: wushaohong @time: 2020/7/14 下午8:40 """ """189. 旋转数组 给定一个数组,将数组中的元素向右移动 k 个位置,其中 k 是非负数。 示例 1: 输入: [1,2,3,4,5,6,7] 和 k = 3 输出: [5,6,7,1,2,3,4] 解释: 向右旋转 1 步: [7,1,2,3,4,5,6] 向右旋转 2 步: [6,7,1,2,3,4,5] 向右旋转 3 步: [5,6,7,1,2,3,4] 示例 2: 输入: [-1,-100,3,99] 和 k = 2 输出: [3,...
true
05787eb52158086d786521e8cca8cc76970aa048
yizhiyan1992/LeetCode_problems
/47_Permutations_II_solution2.py
UTF-8
1,590
3.53125
4
[]
no_license
#solution 2 to remove duplicates. #1) sort the order of nums first. #2) for the same number, it can be used only if its prior same number are used. # e.g. [1,1,1,3,4,4] for number 1, the third 1 can only be used if the first two 1s are used. Otherwise it cannot be used. class Solution: def permuteUnique(self, nums:...
true
589c565c6335dd77b66910d51273ae5c55c0396e
wtraceback/Pygame-Practice
/Arkanoid/sound_effect.py
UTF-8
754
2.984375
3
[]
no_license
import pygame class SoundEffect(): """这是一个关于 游戏音效 的类""" def __init__(self, sets): self.sets = sets self.init_setting() # 准备音效(Sound 模块不能加载 mp3,必须将 mp3 转为 wav 格式) self.collid_baffle = pygame.mixer.Sound(self.sets.baffle_music_name) self.collid_brick = pygame.mixer.Soun...
true
0dcd020194a0c0e83ae103ef1ed1e6657317a8b7
meahesachin/statscalc
/Statistics/SimpleRandomSampling.py
UTF-8
109
2.546875
3
[ "MIT" ]
permissive
import random def simple_rand_sampling(sample,N): Nitems = random.sample(sample,k=N) return Nitems
true
c8f9643bf795cf056408a870d08f2bbb5439c110
dhassoun2021/onto_x
/src/main/python/onto/onto_data.py
UTF-8
385
3
3
[]
no_license
class EntityData: __classId: str __label: str __parents: tuple def __init__(self,classId, label, parents): self.__classId = classId self.__label = label self.__parents = parents def getClassId(self): return self.__classId def getLabel(self): return self...
true
e60095e525a1c72a6d4f6120001401f99c374d35
zbcstudy/python
/classStudy/fuc.py
UTF-8
467
3.75
4
[]
no_license
def test(a, *b): print(type(b)) print("a=", a, "b=", b) for i in b: a = a + i return a t = test(2, 3, 4, 5) print(t) n = 1 def func(a, b): global n # 显示声明局部变量为全局变量 n = b return a * b func(2, 3) print(n) ls = [] def new_func(a, b): ls.append(b) return a * b # 对于列表...
true
ec3539f1075cd81eba7a4752a2a70d2f703d1519
RINKESH0806/ga-learner-dsmp-repo
/Telecom-Churn-Prediction-with-Boosting/code.py
UTF-8
2,635
2.8125
3
[ "MIT" ]
permissive
# -------------- import pandas as pd from sklearn.model_selection import train_test_split #path - Path of file # Code starts here df=pd.read_csv(path) X=df.drop(['customerID','Churn'],1) y=df['Churn'] X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.3,random_state=0) # -------------- import numpy ...
true
b4a2ee60f8c3158d22e5ebcdc2253d6aee22f41c
mjenior/analysis-scripts
/pfba_contextualize.py
UTF-8
9,898
2.609375
3
[]
no_license
#!/usr/bin/python ''' Dante Transcriptomic Integration via Stepwise Flux Minimization Thresholding based on Abundance Distribution Please cite when using: Jenior ML and Papin JA. (2018) DANTE. BioRxiv. DOI Example usage 1: my_model = cobra.io.read_sbml_model('my_model.sbml') gene_bins = read_transcription_file('reads...
true
b1844aaa63a0e8980d23ac5cd968fe87afb38a21
surabhisnath/Survival-Analysis
/Assignment4.py
UTF-8
7,269
2.796875
3
[]
no_license
# coding: utf-8 # In[93]: import numpy as np import math import matplotlib.pyplot as plt import pandas as pd # # Question 1 # In[2]: # data input format # type: list = s # [sublist, num_groups, length_study] # sublist = # [subsublist, num_participants] # subsublist = # [time...
true
f58316a7d6441a10a3f17e79a50d115ed92bbee5
Satily/leetcode_python_solution
/solutions/solution228.py
UTF-8
957
3.703125
4
[ "MIT" ]
permissive
class RangeParser(object): def __init__(self, nums): self.nums = nums def __iter__(self): if len(self.nums) == 0: return left = right = self.nums[0] for num in self.nums[1:]: if num == right + 1: right = num else: ...
true
37ef1da041d175fc413b4d949426cf31c32af5b3
hydratk/hydratk-ext-testenv
/src/hydratk/extensions/testenv/rest_handler.py
UTF-8
30,404
2.765625
3
[ "BSD-3-Clause" ]
permissive
# -*- coding: utf-8 -*- """Handles REST operations .. module:: testenv.rest_handler :platform: Unix :synopsis: Handles REST operations .. moduleauthor:: Petr Rašek <bowman@hydratk.org> """ from hydratk.core.masterhead import MasterHead from hydratk.extensions.testenv.db_handler import DbHandler from web import...
true
87b87dfba610f710a47d94967644ed0f49e7172a
madolphe/projetUdes_imgMedicale2
/tp2.py
UTF-8
8,163
2.5625
3
[]
no_license
from histogramme import test_afficher_histogramme, test_joint_histogramme from transformation import * from similarite import test_afficher_similarites from transformation_interpolations import test_rotation_scipy, test_translation_scipy from recalage import test_lucas_kanade_recalage, test_translation_recalage, test_...
true
1b05d77a62b949f99bf93fc3adb6a8c2dad1cf51
RainMoun/nowcoder_program
/剑指offer/only_test.py
UTF-8
29
2.625
3
[]
no_license
a, b = 1, 2 print(a) print(b)
true
ef589902f8a51baccb21872aad5533cb738c1572
SemikO123/YODA
/Test.py
UTF-8
1,090
3.328125
3
[]
no_license
from random import * A = [randint(0,9) for i in range(int(input('Введите кол-во элементов : ')))] Y1 = [0]*len(A) Y2 = [0]*len(A) R1 = R2 = -1 for i in A: print(i, end=' ') print() for i in range(1,len(A)): if i > R1: x = 1 else: x = min(A[R1+L1-i], R1-i) + 1 while i-x >...
true
095a466b7fe1b070a0e9819b80e29610873b5502
upupming/algorithm
/BasicLevel_Python/1011 A+B 和 C (15 分).py
UTF-8
208
3.46875
3
[ "MIT" ]
permissive
N = int(input()) for i in range(N): a, b, c = tuple(map(int,input().split())) if a+b > c: print("Case #{}: true".format(int(i+1))) else: print("Case #{}: false".format(int(i+1)))
true
74fb76171fcdd6b115c1d467ffc9b813b4a6b899
ucfcs/Fall2020-Group-20
/bin/Tree.py
UTF-8
2,606
2.640625
3
[]
no_license
from pathlib import Path import re space = ' ' branch = '│ ' tee = '├── ' last = '└── ' with open(Path(__file__).parent.parent / '.gitignore', 'r') as f: lines = f.read().splitlines() new_lines = [] for line in lines: if len(line) > 0 and line[0] not in ['#']: new_line = str(line) ...
true
fac25dd07355505b535878a11041c6f4ed8db247
ARES3366/aladdin
/aladdin-cas/unit_test/test_analysis_content.py
UTF-8
450
2.5625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys,os,time import unittest from analysis_package.analysis_content import match_keywords class TestAnalysisContent(unittest.TestCase): def test_match_keywords(self): content='hello world'*1024 word_loc=match_keywords(content,['hello', 'world']) ...
true
f98ae87aa4bdd30fa00ae94a19911aa6e84e1f15
atlassian/sentry
/tests/sentry/analytics/test_event.py
UTF-8
1,421
2.734375
3
[ "BSD-2-Clause" ]
permissive
from __future__ import absolute_import import pytest from sentry.analytics import Attribute, Event, Map from sentry.testutils import TestCase class ExampleEvent(Event): type = 'example' attributes = ( Attribute('id', type=int), Map('map', (Attribute('key'), )), Attribute('optional', type=bo...
true
58d6f13bfb70b50d038a68dbc74a9bc18635f31c
soumya9988/Python_Machine_Learning_Basics
/Python_Basic/8_FileIO/file_io_reverse.py
UTF-8
1,121
4.4375
4
[]
no_license
def reverse_file(path): """ Function reads and display the contents of the file in reverse order. """ sentence_list = [] with open(path, 'r', errors='ignore') as f_name: contents = f_name.readline() while contents: sentence_list.append(contents.strip()) conte...
true
e308cfd3f4f3b3d67daabb95b3797b017a49d602
charlessokolowski/Problems
/palindrome/longest_palindrome.py
UTF-8
1,219
4.25
4
[]
no_license
""" Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. Test case = "abccccdd" """ class Solution(object): def longestPalindrome(self, s): """ :type s: str :rtype: int """ # mu...
true
f8801c70cbf030fda70db6c36ff63a8b5f896f5c
igorich/RbChronoOnline
/repository/base_repo.py
UTF-8
771
2.578125
3
[]
no_license
import pymysql.cursors import json #from race import Race, RaceEncoder db = pymysql.connect(host="localhost",# your host, usually localhost user="dbuser", # your username password="stopdb", # your password db="RbChrono", # name of the data ...
true
a49fe82a22093379f024419253ef9c6e003ccb72
Sonu-UB/LeetCode_Problems
/ArrayToBST.py
UTF-8
493
3.40625
3
[]
no_license
from typing import List, Optional class TreeNode: def __init__(self,val,left,right): self.val = val self.right = right self.left = left def arrayToBST(nums:List[int])->Optional[TreeNode]: def helper(l,r): if l>r: return None m = (l+r)...
true
eb988f88365f9700dedbdacef5d26925203031c2
Mindol2/test4
/p-9.py
UTF-8
138
3.578125
4
[]
no_license
import math num=float(input("실수: ")) print(num,":",math.ceil(num)) print(num,":",math,floor(num)) print(num,":",math.frunc(num))
true
a6c59cf6a00b20895b1087a9129ebc26821822ba
emman27/immutapy
/tests/test_stdlib_dict.py
UTF-8
1,493
3.609375
4
[ "MIT" ]
permissive
from immutable import Dict def test_str(): """ Renders correctly on str """ assert str(Dict({'a': 1})) == "{'a': 1}" def test_getitem(): """ Allows the getting of a key """ d = Dict({'a': 1}) assert d['a'] == 1 def test_equality(): """ Dicts are equal if the underlying ...
true
a5dc3b087c1fb1d5b72ac66a26e3c194d8bb7cc9
alexandraback/datacollection
/solutions_5646553574277120_0/Python/neizod/c-less-money.py
UTF-8
1,460
3.109375
3
[]
no_license
#!/usr/bin/env python3 from itertools import combinations def make_table(value, coins): table = [None for _ in range(value+1)] table[0] = NotImplemented for size in range(1, len(coins)+1): for take in combinations(coins, size): try: table[sum(take)] = True e...
true
3fbc0d5240ad26e321e66f6511dafa665f9f3f29
lytenica/Zadachi
/12count_vowels/test.py
UTF-8
279
3.078125
3
[]
no_license
from solution import count_vowels import unittest class vowelsTest(unittest.TestCase): def test_solution(self): self.assertEqual(2,count_vowels("Python")) self.assertEqual(8,count_vowels("A nice day to code!")) if __name__ == '__main__': unittest.main()
true
25e9ea2d2986f86c6f063072caa072486ff98c37
jason2133/python_for_machine_learning
/naver_machineLearning_python/ml8_deque1.py
UTF-8
253
3.328125
3
[]
no_license
from collections import deque a = deque() for i in range(5): a.append(i) print(a) a.appendleft(10) print(a) a.rotate(2) print(a) a.rotate(2) print(a) print(deque(reversed(a))) a.extend([5, 6, 7]) print(a) a.extendleft([5, 6, 7]) print(a)
true
a54f5515f17f49e99db707e3281ceb141f589b64
bakhirevairina/cs102
/entity.py
UTF-8
629
3.84375
4
[]
no_license
class Enity: def __init__(self, age:int, name:int): self.age = age self.name = name @staticmethod def getNameClass(): print("Enity") def getInfo(self): print("Info Name: ", self.name) class People(Enity): def __init__(self, is_alive: bo...
true
92c0d17a4235b3352278c21ab33f0009ef0f0677
AswinSatheesh/Count-the-words-in-a-file
/count.py
UTF-8
116
3.578125
4
[]
no_license
file= open("text.txt","r") data=file.read() words=data.split() print("Number of words in a text file :",len(words))
true
88bbc7f22c0c1aff405a1215830990d1a6fdedb0
yingchengsun/IntelBase
/crawlers/exercises/csvCoding.py
UTF-8
1,239
2.796875
3
[]
no_license
''' Created on Dec 4, 2017 @author: yingc ''' import csv import unicodecsv import json a = {u'name': u'FC Bayern M\xfcnchen', u'age': 24} aa= [[u'name', u'FC Bayern M\xfcnchen'], [u'age', 24]] aaa = {'has_media': True, 'is_reply': False} b = {u'name': u'John Doe', u'age': 24} b = {u'name': u'John Doe...
true
be4899fe45eba4416e4545465178c0088319dc75
moonlightshadow123/aca
/src/jsonData.py
UTF-8
7,324
3.0625
3
[]
no_license
import json import copy from cst import cst class jsonData: def __init__(self, file_name): self.file_name = file_name self.data = None self.act_dict = {} with open(file_name, "r") as f: self.data = json.load(f) with open(file_name+".bak", "w") as f: ...
true
caa804a50ecdf49a1416fa13f39bb353535699e4
ati-ozgur/course-python
/2019/Labs/Lab06/find_missing.py
UTF-8
203
3.171875
3
[ "Apache-2.0" ]
permissive
from random import sample numbers = sample(range(1,101),99) #print(numbers) for index in range(1,101): if index in numbers: continue else: print("missing",index) break
true
2004fefed23b7c7120b29dac21818d60cb2dfb25
xuyemei/pythonCode
/t1/for.py
UTF-8
1,357
3.9375
4
[]
no_license
#!/usr/bin/env python3 # -*- coding:utf-8 -*- from collections import Iterable,Iterator print(isinstance('acv',Iterable)) print(isinstance([1,2,3],Iterable)) def g(): yield 1 yield 2 yield 3 print('Iterable?[1,2,3]:',isinstance([1,2,3],Iterable)) print('Iterable?\'abc\':',isinstance('abc',Iterable)) prin...
true
d9e3b8d741355b01a45cdd07c5073b740b96dc82
vikaslone/Python_Coding
/Functions/makes_twenty.py
UTF-8
278
3.78125
4
[]
no_license
# Given two integers, return True if the sum of the integers is 20 or if one of the integers is 20. If not, return False def check_twenty(int1,int2): return int1 == 20 or int2 == 20 or int1+int2==20 print(check_twenty(20,1)) print(check_twenty(2,1)) print(check_twenty(2,18))
true
ee93695d991327069c8a05f54ff74fe7dae11ffa
rscarvalho/alchemydumps
/flask_alchemydumps/helpers/backup.py
UTF-8
6,489
2.859375
3
[ "MIT" ]
permissive
# coding: utf-8 import gzip import re from datetime import datetime from flask import current_app from ftplib import FTP, error_perm from tempfile import mkstemp from time import gmtime, strftime from unipath import Path class Backup(object): """Manages backup files through local or FTP file systems""" def ...
true
0b93b57555f58d0a6689febcf3873b23bb34761b
lshdfp726/-algorithm015
/Week_02/group-anagrams.py
UTF-8
167
2.9375
3
[]
no_license
import collections class Solution(object): def groupAnagrams(self, strs): if __name__ == '__main__': print(Solution().groupAnagrams(["eat", "tea"]))
true
d9425ece24c0e0acf19b18b3cab489cd5356df29
zeeshan-emumba/GoogleCodingInterviewQuestions
/microSoft_2.py
UTF-8
1,274
3.203125
3
[]
no_license
input , input5 = [51, 71, 17, 42], [5,9,6,8] input2, input3 = [42, 33, 60], [51, 32, 43] input4, input6 = [598888888,688888888,5988888881111,6888888881111], [59,68] def stringAdder(digit): digit = str(digit) temp = 0 res = [temp + int(x) for x in digit] return sum(res) def stringChecker(input): re...
true
e7be847a15c9eb27115d650f544fb5006812ceea
zhangchen6523/test
/lianjia/urllib_test.py
UTF-8
6,430
2.953125
3
[]
no_license
import pandas as pd import numpy as np import seaborn as sns import matplotlib as mpl import matplotlib.pyplot as plt from IPython.display import display plt.style.use("fivethirtyeight") sns.set_style({'font.sans-serif':['simhei','Arial']}) # %matplotlib inline # 检查Python版本 from sys import version_info if version_in...
true
4fc41abfa2f8f91b322dfa949c9ba14471c74081
lcreteig/ci-python-example
/test_joke.py
UTF-8
125
3.390625
3
[]
no_license
import joke def test_is_string(): the_joke = joke.tell() assert type(the_joke) == str, "The joke is not a string..."
true
cb1d720d513613981f5f31a824642ce8e0257ad7
ArtyomKolosov2/Programming-languages-labs
/lab24/task_main.py
UTF-8
3,374
3.453125
3
[]
no_license
# Программа считывает данные из файла с успеваемостью студентов # обрабатывает данные и создает новый файл, который содержит # результаты по каждому студенту # # Version: 1.0 # Group: 10701219 # Author: Колосов Артём Александрович # Date: 16.4.2020 def output_to_user(msg, s=' ', e='\n'): print(msg, sep=s, end=e) ...
true
00b574ebd8d2c0598efa9f48fad49b83c93f5c62
rohan8594/DS-Algos
/leetcode/medium/DP/LongestIncreaseSubseq.py
UTF-8
1,401
3.8125
4
[ "MIT" ]
permissive
# Given an unsorted array of integers, find the length of longest increasing subsequence. # Example: # Input: [10,9,2,5,3,7,101,18] # Output: 4 # Explanation: The longest increasing subsequence is [2,3,7,101], therefore the length is 4. # Note: # There may be more than one LIS combination, it is only necessary for y...
true
286ad7e5dcc2380184f05ddd93c5e87dee756632
Peace411/stepik-auto-tests-course
/testunit.py
UTF-8
2,002
2.796875
3
[]
no_license
from selenium import webdriver import time import unittest class Testauth(unittest.TestCase): def test_registration1(self): link = "http://suninjuly.github.io/registration1.html" browser = webdriver.Chrome() browser.get(link) input1 = browser.find_element_by_css_selector('.first...
true
d4e43aea5cc492ff901e1e66da092deeb315e89a
deepd/TAMU
/AI/hw1_equation_solver/search.py
UTF-8
15,805
3.421875
3
[]
no_license
from utils import * from helperfns import * import math, random, sys, time, bisect, string counter = 0 currentstate = 0 #______________________________________________________________________________ class Problem(object): """The class for a formal problem. You should subclass this and implement the methods...
true
397cdcfc0525ca56b4ca21498f1eccc578539600
hyangit/gomoku
/utils/top_n.py
UTF-8
860
3.734375
4
[]
no_license
class TopN: def __init__(self, size, sort_key=None, compare_func=None): self.size = size self.sort_key = sort_key self.compare_func = compare_func self.top = [] def push(self, item): if len(self.top) < self.size: self.top.append(item) self.top.sor...
true
5717b870d242e460bde20733622ffb0c809f12ee
bnajafi/Scientific_Python_Assignments_POLIMI_EETBS
/Assignment 9 Matplotlib Deadline Dec 5th/assignment9_riva.py
UTF-8
1,187
3.3125
3
[]
no_license
#ASSIGNMENT 9 import pandas as pd import matplotlib.pyplot as plt H_L_Values=[1149.2,1240,92.4] #heating load C_L_Values=[547.5,514.6,43.12] #cooling load Label=["walls","ceilings","door"] Color=["red","blue","aqua"] plt.figure() fig1=plt.pie(H_L_Values,labels=Label,colors=Color,startangle=90,explode=(...
true
1bcd2c2bc4b5b0e92327107a565e984360ad34c5
sdhawan1/sceneSearchFinal
/add_doc.py
UTF-8
4,278
2.71875
3
[]
no_license
import sys import os import nltk import pickle import operator from nltk.corpus import stopwords from nltk.probability import FreqDist from operator import itemgetter #----------------------------------------------------------------# #preliminary checks #confirm that a '.txt' file is entered as a command line argumen...
true
cc145bc295dbea3db15e1150ec54f22a8024ce04
Maria1395/Web-Page-Advertisement-Filtering-And-Reporting-System
/cnnimg.py
UTF-8
4,102
3
3
[]
no_license
""" dumpimages.py Downloads all the images on the supplied URL, and saves them to the specified output file ("/test/" by default) Usage: python dumpimages.py http://example.com/ [output] """ from bs4 import BeautifulSoup as bs from urllib.request import ( urlopen, urlparse, urlunparse, urlretrieve) imp...
true
a9adcb3f5b379535d461c3d5de5058e49f72a573
damiati-a/CURSO-DE-PYTHON-2
/ex084.py
UTF-8
1,073
4.125
4
[]
no_license
# um programa que mostre as pessoas mais pesadas # quantas pessoas foram cadastradas # mostrar as pessoas mais leves pessoas = list() principal = list() maior = menor = 0 while True: pessoas.append(str(input(f'Nome da pessoa: '))) pessoas.append(float(input(f'Peso da pessoa: '))) if len(princip...
true
26cf788a1567c39dc0d0aa67edd56aec5be09f58
egakoji/django-wallets
/tests/test_forms.py
UTF-8
8,782
2.53125
3
[ "MIT" ]
permissive
from test_plus.test import TestCase from . import factories from wallets import forms from wallets import api import mock class TestWithdrawForm(TestCase): def setUp(self): self.user = factories.UserFactory() self.bcy = factories.BcyFactory(user=self.user) def test_amount_field_label(self): ...
true
21821795994465c168d8df7d0150fd20aa9463bd
13671148038/pyghonbase
/zhixingshidai/com.baidu/lists.py
UTF-8
2,426
4.3125
4
[]
no_license
from collections import deque # 数组的定义1 squares = [1, 2, 3, 4, 5, 6, 7, 8, 9] # 数组的定义2 squares = [] for x in range(2, 10): squares.append(x ** 2) print(squares) # 数组的定义3 squares = list(x for x in range(6)) print(squares) # 数组的定义4 squares = list(map(lambda x: x ** 3, range(10))) print(squares) # 根据索引获取数组中的元素 squar...
true
d728b3337484336cc9b4bafd1a33f9f1eea4de55
godats7/python_GUI
/gui_basic/14_grid.py
UTF-8
3,333
2.546875
3
[]
no_license
from tkinter import * root = Tk() root.title("wookdol GUI") # 창에 뜨는 타이틀 root.geometry("640x480") # btn1 =Button(root, text="버튼1") # btn2 =Button(root, text="버튼2") # btn3 =Button(root, text="버튼3") # # btn1.pack() # # btn2.pack() # # btn1.pack(side="left") # # btn2.pack(side="right") # btn1.grid(row=...
true
769d2ed55e49a75e00dac5555779318e2d36a3bc
marattang/keras2
/keras73_3_hores_human.py
UTF-8
1,829
2.734375
3
[]
no_license
# 실습 # 약속 잘 지키기 왕 # 말과 사람 데이터셋 완성 from tensorflow.keras.preprocessing.image import ImageDataGenerator import numpy as np from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Dropout, Conv2D, GlobalAveragePooling2D, MaxPool2D from sklearn.model_selection import train_test_split from ...
true
c7cdb24f635479bf0c24490965866a21520bb061
mukuld/python
/find_sqrt.py
UTF-8
776
4.625
5
[]
no_license
# Program to determine square root of any given number # Programmer: Mukul Dharwadkar # Date: Apr 15 2020 # Python version 3 def get_number(): response = None while response is None: response = float(input("Please choose a number to find a square root of: ")) return response def create_guess(inp):...
true
a829d73943fc4449b1e0d86fdb81ff6bf7e150ba
sas044/H2plus_Born_Oppenheimer
/vibrational_BO.py
UTF-8
20,938
2.9375
3
[]
no_license
""" Solving the vibrational part of the H2+ problem in the Born Oppenheimer approximation. One can either save the vibrational eigenstates, or save the full laser interaction hamiltonian. Running the main() method will execute both of these programs. The problem parameters should be filled in in the problem_paramet...
true
82397128ac3c0ad1bc7363078fa020881d98e239
da1907/AlgorithmWithPython
/withPython/BOJ/브루트포스 - 순열/[10973]이전순열.py
UTF-8
581
3.265625
3
[]
no_license
N = int(input()) arr = [] arr = list(map(int, input().split())) def before(arr): for i in range(N-1, -1, -1): if i == 0: return elif arr[i] < arr[i-1]: a = i break for i in range(N-1, a-1, -1): if arr[i] < arr[a-1]: b = i brea...
true
fcf0dd3dcc492008867004e65172a0e3c1dcc224
Mat4wrk/Software-Engineering-for-Data-Scientists-in-Python-Datacamp
/4.Maintainability/Refactoring for readability.py
UTF-8
471
4.0625
4
[]
no_license
def polygon_perimeter(n_sides, side_len): return n_sides * side_len def polygon_apothem(n_sides, side_len): denominator = 2 * math.tan(math.pi / n_sides) return side_len / denominator def polygon_area(n_sides, side_len): perimeter = polygon_perimeter(n_sides, side_len) apothem = polygon_apothem(n...
true
148b9d318fca2e4715a120411eaf73da85c2a79d
guidorony/oredenamiento-por-insercion
/script2.py
UTF-8
1,745
3.828125
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Jun 28 20:37:56 2020 @author: Rony """ numero1=float(input('Ingrese primer valor : ')) numero2=float(input('Ingrese suegundo valor : ')) def suma(a,b): return a+b adicion=round(suma(numero1,numero2),2) def res(a,b): return a-b diferencia=round(res(numero1,numero2),2) ...
true
e32d3198c7580dbb1a95d67aa3037616df1010c9
CallmeNezha/xml-ormz
/xo/orm/convert.py
UTF-8
747
2.640625
3
[]
no_license
from lxml import etree from .field import StringField, FloatField, IntegerField from .field import Optional def toElement(model) -> etree._Element: """Convert model into etree element. TODO: maybe rewrite it into none recursive callback will be better, Hope it never meets stack overflow... """ el...
true
c7280511a4c3ddf286b7f87fdf5395403a248446
nthmost/persuadertron
/TF_IDF/word_frequency_per_corpus.py
UTF-8
1,208
3.296875
3
[]
no_license
# produces a DataFrame of comparative word frequencies from a natural language texts. # # First step in TF / IDF analysis. # http://en.wikipedia.org/wiki/Tf%E2%80%93idf # # --@nthmost 2/22/2014 import os import pandas as pd PUNC=set("()$!,./;'?&\'\":") CORP_DIR = './corpora/' f = open('frequent_words_less.txt', 'r'...
true
6c4fa9b1ffa12d8e4667dcbf2e0d37004b3b685d
hotheat/LeetCode
/067. Add Binary/67.py
UTF-8
547
3.140625
3
[]
no_license
class Solution: def addBinary(self, a, b): """ :type a: str :type b: str :rtype: str """ l = max(len(a), len(b)) if len(a) < len(b): a, b = b, a b = b.zfill(l) ans = '' i, div, mod = 0, 0, 0 while i < l: ...
true
b32856b7c7fd4a9061da6ca10b06dae0bbef4884
sakuma17/PythonTraining
/0203/leapyear.py
UTF-8
330
3.65625
4
[]
no_license
def is_leapyear(year): if year%400==0: return True if year%4==0 and year%100!=0: return True return False year=int(input('西暦何年?>')) if is_leapyear(year): print('西暦{}年はうるう年です'.format(year)) else: print('西暦{}年はうるう年ではありません'.format(year))
true
bf03064bbf1444db117318b4967eaad1c820617f
fabiolv/fii-basic
/fii_basic/fii_basic.py
UTF-8
3,093
2.828125
3
[]
no_license
from flask.wrappers import Response import requests import unicodedata from flask import jsonify, Blueprint from bs4 import BeautifulSoup # Builds the Blueprint for fii_basic fii_basic = Blueprint('fii_basic', __name__) def get_data_from_web(ticker): url = f'https://www.fundsexplorer.com.br/funds/{ticker}' #...
true
9024ca90d8677e8778652bf23f46cb8bcc970796
hhoangphuoc/data-structures-and-algorithms
/cracking_the_coding_interview/trees_and_graphs/flood_fill.py
UTF-8
1,724
4.03125
4
[]
no_license
# coding: UTF-8 ''' Flood fill algorithm helps in visiting each and every point in a given area. It determines the area connected to a given cell in a multi-dimensional array. Problem: Micro just bought a maze, that can be represented as a matrix A of size M*N. Each cell of the matrix can be either...
true
c01d770bc3553903b06ff483795fb0b1a893321b
cahharmip/ShapeEstimationForAnimationTools
/Program/Graph.py
UTF-8
6,711
2.84375
3
[]
no_license
import cv2 import math import numpy as np def makeArray(vertexList): xArray = [] yArray = [] for point in vertexList: xArray.append(point[0]) yArray.append(point[1]) return xArray, yArray def GroupToOldLine(vertex,line,verticesList,newline,kStepList): #checkSSE with vertex and line that intersect points on -...
true
600c6529c4d98dba1da9314c6f657218161ddd4d
sushmitajaiswal/PythonPrograms
/biggestno.py
UTF-8
141
3.421875
3
[ "MIT" ]
permissive
n1=int(input("enter first no.")) n2=int(input("enter second no.")) if n1>n2: print("biggest no. is:",n1) else : print("biggest no. is",n2)
true
62cdc3438754089d1a5928957f56abef4cbeb754
fineguy/Music-Genre-Analyzer
/converter.py
UTF-8
2,002
2.875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Apr 8 23:25:43 2015 @author: timasemenov """ import scipy.io as sio import numpy as np import pydub from scipy.io import wavfile from os import listdir, path, remove # ffmpeg binary pydub.AudioSegment.converter = '/usr/local/Cellar/ffmpeg/2.6.1/bin/ffmpeg' genres = ['Rap'...
true
9afd169a7cc8f095b88a8e39535f4a5d2a393c80
tshirai/raspi-sensor
/sample.py
UTF-8
727
3.171875
3
[ "MIT" ]
permissive
#! /usr/bin/env python """ See https://developers.google.com/sheets/api/quickstart/python """ from helper import get_spreadsheets, SHEET_ID def sample(): SAMPLE_RANGE_NAME = 'Class Data!A2:E' sheets = get_spreadsheets() # Call the Sheets API result = sheets.values().get(spreadsheetId=SHEET_ID, ...
true
f13e9b41a3ef7b4f25971ec5e6630955e39e6058
kingnas/Bmi_Calculator
/bmi.py
UTF-8
2,268
4.03125
4
[]
no_license
from time import asctime # prompt user for name name = str( input( "Enter your name: " ) ) # prompt user for age and convert string to integer age = int( input( "Enter your age: " ) ) # prompt user for weight in kilograms and # convert it to floating number weight = float( input( "Enter your weight in kilogram: " ) ...
true
4fefcb6c21aa8a79389590295282091986d33dfd
JPstCode/SGN-13006
/ex1/linfit.py
UTF-8
875
3.140625
3
[]
no_license
import numpy as np from matplotlib import pyplot as plt from scipy import stats xvalues = [2, 3, 4, 2, 4, 1, 1, 1, 2, 4] yvalues = [1, 1, 1, 2, 2, 3, 4, 5, 4, 5] n = len(xvalues) a1 = np.sum(np.prod([xvalues,yvalues],axis=0)/n) a2 = (np.sum(xvalues)/n)*(np.sum(yvalues)/n) a3 = np.sum(np.power(xvalues,2))/n a4 = np....
true
72e03b8ba6ccdf7de2aaa724506138981ff128f2
lucasefdias/cs50
/pset6/cash/cash.py
UTF-8
992
3.953125
4
[]
no_license
# ---------------------------------------------- # CS50 Problem Set 6: Sentimental - Cash # # Summary: Reimplements Cash in Python # Asks the user for an input (amount of change # owed) and prints the number of coins necessary # for the change # # Lucas Emidio Fernandes Dias # 03 October 2018 # ------------------------...
true
6fdf4215749e36ae5dfd997a01ae18bb338a4346
jalondono/holbertonschool-machine_learning
/supervised_learning/0x09-transfer_learning/0-transfer.py
UTF-8
3,205
2.78125
3
[]
no_license
#!/usr/bin/env python3 """Transfer Knowledge """ import numpy as np import scipy import tensorflow as tf # config = tf.ConfigProto() # config.gpu_options.allow_growth = True # sess = tf.Session(config=config) import tensorflow.keras as K from tensorflow.keras.applications import resnet50 import matplotlib.pyplot as pl...
true
2c5716d78afcd85e6c604008cd3d8d0dbe56a31c
leandrolrs18/IotComVisaoComputacional
/iot/bodymin.py
UTF-8
3,718
2.921875
3
[]
no_license
import cv2 import mediapipe as mp import time import math class poseDetector (): def __init__(self, mode = False, upBody = False, smooth = True, detectionCon = 0.5, trackCon = 0.5): #inicialmente ao chamar essa classe, essas variaveis é criada pro usuario. Por exemplo, ao chamar a...
true
c20d7113c5fdf3f1b071f1efd3c6c050fcc81bfc
mfkiwl/QuickFusing
/Scripts/ShowOnline.py
UTF-8
1,190
2.71875
3
[]
no_license
# Created by steve on 17-6-13 上午9:24 import numpy as np import matplotlib.pyplot as plt import mpl_toolkits.mplot3d.axes3d as p3 import matplotlib.animation as animation import time import os class RealTimePlot: def __init__(self, file_name): self.file_name = file_name self.n_time = os.stat(file_...
true
d19b39cebd0da5ae9b34d2f54974567f0b7f95a7
bhi5hmaraj/APRG-2020
/Assignment 3/flood_fill_solutions/BMC201963/BMC201963.py
UTF-8
1,115
2.84375
3
[]
no_license
import sys sys.setrecursionlimit(10**6) def vertex (v,n): x = v[0] y = v[1] if x < (n+1) and x > 0 and y < (n+1) and y > 0: return(True) else: return(False) def BFS (v,n,B): a = [] p = [v] c = [0 for i in range(n*n)] for i in B: c[(((i[0]-1)*n)+i[1]-1)] = 1 wh...
true
324361378861ccb6d6e239e372bae7a8e91ea432
ottolote/matte4d
/ex08/4.py
UTF-8
256
3.8125
4
[]
no_license
def f(x): return x**3 - 7 def f_d(x): return 3*x**2 def newton(x_n): return x_n - f(x_n)/f_d(x_n) # start iterating from s = 1 s = 1 s_prev = 0 # Run until s = s_prev while s != s_prev: s_prev = s s = newton(s) print('%.3f' % s)
true
8d5cee50b23d755da735bf8c402a80f63cd9708b
luckily18894/python_centos
/basic/multi1.py
UTF-8
455
2.578125
3
[]
no_license
import ipaddress from basic.ping_one import ping1 from multiprocessing import Pool as ProcessPool def multi_ping(ipadd): pool = ProcessPool(processes=150) l1 = [] ipaddr = ipaddress.ip_network(ipadd) for ip in ipaddr: if pool.apply_async(ping1, args=(str(ip),)).get() == '1': l1.a...
true
a6914013d92ef4908014a827cd40440da63ddb0e
FatUncle-Z/PackageApkTool
/ui/JChannelSDKListPanelUI.py
UTF-8
6,551
2.515625
3
[]
no_license
#!/usr/bin/env python # -*-coding:utf-8 -*- import wx import os import platform import wx.lib.agw.ultimatelistctrl as ULC from utils.ConfigUtils import * SDK_ID = 'sdk_id' # 渠道id SDK_NAME = 'sdk_name' # 渠道名 SDK_VERSION = 'sdk_version' # 渠道别名 SDK_PATH = 'sdk_path' # 资源路径 # 渠道SDK已下载资源列表布局面板 class JChannelSDKList...
true
a16394dfe24486af0950e964f9c3161871568cf3
timothyvanco/computer_vision
/practical_cases/object_tracking/track.py
UTF-8
1,124
2.546875
3
[]
no_license
import numpy as np import argparse import time import cv2 ap = argparse.ArgumentParser() ap.add_argument("-v", "--video", help="path to the video file") args = vars(ap.parse_args()) whiteLower = np.array([200, 200, 200], dtype="uint8") whiteUpper = np.array([255, 255, 255], dtype="uint8") camera = cv2.VideoCapture(a...
true
15fd302971a9bc8d14b22319d4401a560d063868
nagybalint/advent-of-code-2020
/day_10/task1.py
UTF-8
679
3.296875
3
[]
no_license
import os from typing import List PREABMLE_LENGTH = 25 def parse_input(file_name: str) -> List[int]: with open(file_name) as in_file: return [int(line.strip()) for line in in_file.readlines()] def calculate_answer(in_list: List[int]) -> int: in_list.append(0) in_list.sort() diffs = {1: 0, 2: ...
true
ed7c314f7c47d1eb54a9a15b68b6239887ab67b3
SaadIbnRouf/Python-Calculator
/PyGUi.py
UTF-8
3,156
3.40625
3
[]
no_license
from tkinter import * f_num = 0 expression = "" root = Tk() root.title("SImple calculator") e = Entry(root, width=35, borderwidth=5) e.grid(row=0, column=0, columnspan=3, padx=10, pady=10) def button_click(number): current = e.get() e.delete(0, END) e.insert(0, str(current) + str(number)) ...
true
75a67ee898c5573214ace3fcedd46938b55b7611
blackbianca/Mathematical-and-Numerical-Methods
/new exs/montecarlo.py
UTF-8
900
3.15625
3
[]
no_license
import numpy as np import random as rn import matplotlib.pyplot as plt Nvec = [int(1e3), int(5e3), int(1e4), int(5e4), int(1e5), int(5e5), int(1e6), int(5e6)] Ivec = [] #rn.seed(190909) def func(x): y = np.sin(1./(x*(2.-x)))**2. return y for k in range(len(Nvec)): N = Nvec[k] counter = int(0) ...
true
cf6c0dae5d037264fc036b4473c453bdc9b49ea4
samadarshad/crowdsourced_ocr_corrections
/mock_data/bin/make_data.py
UTF-8
4,146
2.921875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 import os.path import json import uuid from ocr_package import ocr_image, ocr_json, ocr_noise # This is a totally hacked script to mock up some data for the Udacity # capstone project. Don't expect elegance or particularly good # programming practice here. Some things like the range of page # ...
true
923cf02c7839e2653ca479d137a863a3e7483e92
DrorEf/pythonCourse3.6.5
/130/pysys.py
UTF-8
1,883
3.03125
3
[]
no_license
import sys import ast ###python pysys.py "hello python" 345 "metallicode" ##print(sys.argv) ##print(type(sys.argv)) ### Abstract Syntax Trees module #####"[12,234,5,12,'nony', 'kobi', 2.4]" ##listFromArg = ast.literal_eval(sys.argv[1]) ##print(listFromArg) ##print(type(listFromArg)) ###tuple of strings giving all m...
true
f1ab89df7a50d1a1bfc2fe929502d4b6e782bec3
satchidananda-tripathy/PythonHacks
/In13_Prime1.py
UTF-8
552
4.34375
4
[]
no_license
#Enter two numbers and print all prime numbers between them def is_a_prime(num): for x in range(2,num,1): if num%x == 0: return 0 break else: return 1 num1,num2=int(input('Enter first Number: ')),int(input('Enter second Number: ')) ## If num1 > num2 consider swapping...
true
9bbf5d5d8253f128b204a3645e7cd4260487b367
bryantbyr/LeetCode-solutions
/815. Bus Routes.py
UTF-8
8,273
2.859375
3
[]
no_license
# -*- coding: utf-8 -*- # @Time : 2019/1/17 # @Author : qirui # @FileName: 815. Bus Routes.py import collections # 44 / 45 test cases passed. Status: Time Limit Exceeded # class Solution(object): # def numBusesToDestination(self, routes, S, T): # """ # :type routes: List[List...
true
30a7eca4b0b6b3598aca1b09145b44c8394d3673
shuribuzz/fish
/parselogtodb.py
UTF-8
980
3.109375
3
[]
no_license
import sqlite3 logs = open('./logs.txt') list = [list.split() for list in logs] for row in list: del row[0:2] datetime = row[0] + ' ' + row[1] row.insert(0, datetime) del row[1:5] url = row[2] cat = url.split('/')[3] row.append(cat) product = '' if len(url.split('/')) > 4: ...
true
8730ca0753dcd2d7591bb8d1730b5674d4313b8f
smjtgupta/Virus-Pose-Estimation
/source/test.py
UTF-8
764
2.78125
3
[]
no_license
from keras.layers import merge, Convolution2D, MaxPooling2D, Input, Dense, Flatten from keras.models import Model # first, define the vision modules digit_input = Input(shape=(27, 27, 1)) x = Convolution2D(64, 3, 3)(digit_input) x = Convolution2D(64, 3, 3)(x) x = MaxPooling2D((2, 2))(x) out = Flatten()(x) vision_mod...
true
236994368a7587f8ec8db38264abf60fc1c9af59
DunHe/ocr_digits
/python/ocr_digits/imgcrop/crop.py
UTF-8
2,297
2.78125
3
[]
no_license
# -*- coding: utf-8 -*- ''' Create on 2016-01-18 10:29:14 @author: huangzhenghua ''' import copy import cv2 import numpy as np from ocr_digits.imgproc.binary import digit_resize from ocr_digits.imgproc.graystren import gamma_correction from ocr_digits.imgcrop.contours import inner_findContours from ocr_digits.imgcrop...
true
86d889ee9a4bbe21333a1587cd7177bb1fd06dd6
txt/ase19
/src/xomo.py
UTF-8
44,025
2.84375
3
[ "BSD-2-Clause" ]
permissive
#!/usr/bin/env python3 # vim: nospell:sta:et:sw=2:ts=2:sts=2 import sys sys.dont_write_bytecode=True def demo(f=None,demos=[]): if f: demos.append(f); return f for d in demos: print('\n--|',d.func_name,'|','-'*40,'\n',d.__doc__,'\n') d() def test(f=None,tests=[]): if f: tests.append(f); return f o...
true