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
2c9ee1dba198cd997f1e3e09f1d9ea3bd45050ea
Python
israelj013-zz/SD-Hacks
/available_times.py
UTF-8
1,008
3.125
3
[]
no_license
import datetime def available_schedule(schedule, start, end): diction = { 'Sun': {'times': []}, 'Mon': {'times': []}, 'Tue': {'times': []}, 'Wed': {'times': []}, 'Thu': {'times': []}, 'Fri': {'times': []}, 'Sat': {'times': []} } current = datetime.t...
true
1849e6aed53c9a88faa0c8aeb131897b0c5a6728
Python
smhosseinsn/analogComputer
/compiler/parser.py
UTF-8
2,964
3.03125
3
[]
no_license
import re from tdparser import Lexer, Token #Grammar definition Precedence #Range #dep var #ind var #const #arg1 + arg2 => expr 10 #arg1 - arg2 => expr 10 #arg1 * arg2 => expr 20 #arg1 / arg2 => expr 20 ...
true
0e2b018cedf68526511777083284a61c4222d3bb
Python
mseckykoebel/CT3
/agent.py
UTF-8
4,963
3.203125
3
[]
no_license
import random from gpt_api import ( get_animal, get_single_why, get_comparison_why, get_insane_comparison_why, random_name_generator, ) from concept_net_api import ( get_class_of_object, get_object_from_class, get_related_to, get_animals_from_class, get_classes_from_animal, ) c...
true
d745d232bad0d53129af77fe87c738b7a23f407a
Python
TianFangzheng/OpenCV-programming-foundation
/20.Contour_discovery.py
UTF-8
830
2.625
3
[ "Apache-2.0" ]
permissive
import cv2 as cv import numpy as np #轮廓发现 def contous_image(image): dst = cv.GaussianBlur(image, (3, 3), 0) gray = cv.cvtColor(dst, cv.COLOR_BGR2GRAY) ret, binary = cv.threshold(gray, 0, 255, cv.THRESH_BINARY | cv.THRESH_OTSU) cv.imshow("binary", binary) contours, heriachy = cv.findConto...
true
0347123ab239ff0f1e80716f544f62378efb75f2
Python
noellekimiko/HMC-Grader
/app/userViews/common/root.py
UTF-8
2,299
2.53125
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- #import the app and the login manager from app import app, loginManager #Import the flask functions we need from flask import g, request, render_template, redirect, url_for, flash from flask.ext.login import current_user, login_required #Import the models we need for these pages from app.stru...
true
037e88a7f3478bd2be82daaacb045470c90945d2
Python
tusharcool/Python_project
/main.py
UTF-8
1,757
3.53125
4
[]
no_license
from spy_details import spy from start_chat import start_chat import re spy =spy('Tushar','Mr.',34,6.0) print 'Let\'s get started' question='Do you want to continue as'+spy.salutation+" "+spy.name+ ' (y/n) ' existing=raw_input(question) # check validating user input if (existing=='Y' or existing=='y'): spy.name...
true
9a4d1bfad5949bcacf8e58621d3a671cf8435765
Python
luke-mao/Data-Structures-and-Algorithms-in-Python
/chapter4/q11.py
UTF-8
387
3.296875
3
[]
no_license
def unique(data): if len(data) == 1: return True else: if unique(data[1:]): for value in data[1:]: if value == data[0]: return False return True else: return False if __name__ == '__main__': data = [1, 5, 2, 3, 5, 7] data2 = [...
true
24f51092919426f3c357c33efa7247870d0d5d9a
Python
kuc-k/Pomomo
/bot/src/voice_client/vc_accessor.py
UTF-8
625
2.6875
3
[ "MIT" ]
permissive
import discord from discord.ext.commands import Context def get_voice_client(ctx: Context): voice_client = ctx.voice_client if not (voice_client and voice_client.is_connected()): return return voice_client def get_voice_channel(ctx: Context): vc = get_voice_client(ctx) if not vc: ...
true
715721605ab7bcaaa784db12fa1e3ff29942a4f1
Python
raghukul01/Randomized_Algorithms
/Project/plot.py
UTF-8
1,575
2.78125
3
[]
no_license
import math import matplotlib.pyplot as plt fname = 'test' f1 = open(fname, "r") temp = map(int, f1.read().split()) N = temp[0] Px = [] Py = [] for i in range(1, len(temp)): if i%2 == 1: Px.append(temp[i]) else: Py.append(temp[i]) f2 = open('circle', "r") tmp = map(float, f2.read().split()) N = len(tmp) / 3 C =...
true
e71b2e264702877995db27b97464b571d7bd4502
Python
Markczy/Leecode
/分类/双堆/295.数据流的中位数.py
UTF-8
2,885
4.34375
4
[]
no_license
""" 中位数是有序列表中间的数。如果列表长度是偶数,中位数则是中间两个数的平均值。 例如, [2,3,4] 的中位数是 3 [2,3] 的中位数是 (2 + 3) / 2 = 2.5 设计一个支持以下两种操作的数据结构: void addNum(int num) - 从数据流中添加一个整数到数据结构中。 double findMedian() - 返回目前所有元素的中位数。 示例: addNum(1) addNum(2) findMedian() -> 1.5 addNum(3) findMedian() -> 2 进阶: 如果数据流中所有整数都在 0 到 100 范围内,你将如何优化你的算法? 如果数据流中 99%...
true
67fe22c38798c345e2d269003f314b65b59f3ba9
Python
sebdumancic/ScientificallyApprovedPredictionMethods
/forestEvo2.py
UTF-8
6,493
2.984375
3
[]
no_license
from dtree import * from id3 import * import random import sys def get_file(): """ Tries to extract a filename from the command line. If none is present, it prompts the user for a filename and tries to open the file. If the file exists, it returns it, otherwise it prints an error message and ends ...
true
820e63f785aa0d2dcbf7f7804f8bb995ee85e8c9
Python
bradyz/sandbox
/hackerrank/warmup/solvemesecond.py
UTF-8
181
2.90625
3
[]
no_license
import sys if __name__ == "__main__": for i, line in enumerate(sys.stdin): if i > 0: parsed = [int(x) for x in line.split()] print(sum(parsed))
true
dacbad18d449fc8e707d64d942abdb627ecae618
Python
KMalika/2018-2-level-labs
/lab_4/calculate_test.py
UTF-8
7,285
3.03125
3
[]
no_license
""" Labour work #4 TfIdfCalculator class calculate function tests """ import unittest import math from lab_4.main import TfIdfCalculator class CalculateTfIdfTest(unittest.TestCase): '''Checks calculating tf-idf of a given texts''' def test_check_calculate_tf_idf_ideal(self): """check tf_idf calcul...
true
d3abd3eaeeaa287665cd402d7a789017cac433f1
Python
f1amingo/leetcode-python
/图论 Graph/79. 单词搜索.py
UTF-8
1,342
3.21875
3
[]
no_license
from typing import List class Solution: def exist(self, board: List[List[str]], word: str) -> bool: def dfs(x: int, y: int, i: int) -> bool: if i == len(word): return True if x < 0 or y < 0 or x >= m or y >= n or visited[x][y]: return False ...
true
ea3738460ca9a4ae3977fc0f3db4e6512037bf56
Python
ChiragVhora/AI_and_ML_Hackathon
/Day_24_Fake_News_Detectioin_and_Confusion_Matrix_ML/1_TRAIN_and_TEST_fake_news_detection_MNB.py
UTF-8
4,216
3.109375
3
[]
no_license
from sklearn.naive_bayes import MultinomialNB from sklearn.feature_extraction.text import CountVectorizer from sklearn.model_selection import train_test_split from sklearn import metrics import matplotlib.pyplot as plt import pandas as pd import numpy as np import itertools # var################################# FAK...
true
255c4e02af608ba07420d70a2c9d7595da6ab59b
Python
singular-value/MDF
/src/modeci_mdf/standard_functions.py
UTF-8
3,653
2.875
3
[ "Apache-2.0" ]
permissive
import math import numpy import modeci_mdf.onnx_functions as onnx_ops mdf_functions = {} def _add_mdf_function(name, description, arguments, expression_string): mdf_functions[name] = {} mdf_functions[name]["description"] = description mdf_functions[name]["arguments"] = arguments mdf_functions[nam...
true
f6aad7f4059e0c8d5627aedb705d7b19f1c205f7
Python
sendurr/spring-grading
/submission - Homework3/set2/KYLE DAVID SHEPARD_11081_assignsubmission_file_hw3 kyle shepard/hw3_1.py
UTF-8
244
3.296875
3
[]
no_license
def area(vertices): xy1=vertices[0] xy2=vertices[1] xy3=vertices[2] area=0.5*(xy2[0]*xy3[1]-xy3[0]*xy2[1]-xy1[0]*xy3[1]+xy3[0]*xy1[1]+xy1[0]*xy2[1]-xy2[0]*xy1[1]) return area triangle=[[0,0],[1,0],[0,2]] print area(triangle)
true
ca81410dd8ce2b51f5fe803f7e8b8417d4681135
Python
kukukuni/Python_ex
/3day/Quiz01_2.py
UTF-8
520
3.96875
4
[]
no_license
# Quiz01_2.py items = {"콜라":1000,"사이다":900,"씨그램":500,"우유":700,"활명수":800} print("=== 음료 자판기 입니다 ====") print("[콜라][사이다][씨그램][우유][활명수] 중 선택") print("복수 선택 시 --> 예) 사이다,우유 ") # 선택목록 item, 가격 price item = input() # 사이다,우유 items2 = item.strip().split(',') prices = [p for i,p in items.items() if i in items2] price =...
true
3900ab7e7c38b33eb749c9990db0569a737aa7b3
Python
EMMELINEMARTENS/python
/Python/helloworld.py
UTF-8
552
3.71875
4
[]
no_license
# name = input('What is your name?') from datetime import datetime from sense_hat import SenseHat first_name = 'Emmeline' last_name = 'Martens' output = 'Hello, {} {}'.format(first_name, last_name) print(output) first_num = input('Enter first number ') second_num = input('Enter second number ') print(first_num + sec...
true
6677341372f53b4472ec1a32b0b1476645fe7f04
Python
nir20ane/Python
/Sorting/HeapSort.py
UTF-8
759
3.84375
4
[]
no_license
class HeapSort(object): def sorts(self, arr): n = len(arr) for i in range(n-1/2, -1, -1): self.heapify(arr, n, i) for i in range(n-1, -1, -1): temp = arr[0] arr[0] = arr[i] arr[i] = temp self.heapify(arr, i, 0) def heapify(se...
true
e39c8ed6cebdf1b8e872180a0facd70a62507725
Python
reddevil1996/Python-DS
/Stack.py
UTF-8
1,283
4.78125
5
[]
no_license
class Stack: def __init__(self): self.list = [] def push(self, x): self.list.append(x) def pop(self): if not self.list: return -1 else: return self.list.pop() def top(self): if not self.list: return -1 ...
true
5a2659588b6107baac009aa91dcaa0833fc7ff1f
Python
pbar1/codewars
/weight.py
UTF-8
291
3.0625
3
[]
no_license
def sum_digits(numstr): return sum(list(map(int, list(numstr)))) def order_weight(strng): l = strng.split(' ') l.sort(key = lambda x: sum_digits(x)) print(list(map(sum_digits, l))) return ' '.join(l) print(order_weight("2000 10003 1234000 44444444 9999 11 11 22 123"))
true
af3e2dc31900c2ba04c70951b87796a168236de6
Python
xiehuangjun/BIM_Project_3Nodes
/subfunction.py
UTF-8
139
3.0625
3
[]
no_license
def getSize(fileobject): fileobject.seek(0,2) # move the cursor to the end of the file size = fileobject.tell() return size
true
0c60a9056b98f7e2d8877d2e8a435d2d7baa1ab8
Python
aitoralmeida/timeline_streamer
/timeline_streamer.py
UTF-8
4,010
2.546875
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- """ Created on Mon Nov 02 11:51:52 2015 @author: aitor """ from datetime import datetime import json import os import sys import time import twitter # last processed tweet ids last_ids = {} # Screen names to follow screen_names = [] # Get credentials and log in credentials = json.load(open(...
true
22b0ab31d23276e547beb6658e9e666a41e05bbc
Python
gh0jhs/TIL
/1009/2018_KAKAO/방금그곡.py
UTF-8
2,088
2.640625
3
[]
no_license
def solution(m, musicinfos): answer = '' data = [] for i in range(len(musicinfos)): data.append(musicinfos[i].split(',')) music_time = [] for i in range(len(data)): time = 0 time += (int(data[i][1][:2]) * 60 + int(data[i][1][3:])) - (int(data[i][0][:2]) * 60 + int(da...
true
3c32fb0108dffe43cee3c0bc4656b212a45b8a54
Python
aleandromatheus/Linguagem-Python
/Exercicios-CursoemVideo/ex019.py
UTF-8
443
4.34375
4
[ "MIT" ]
permissive
# Programa que auxilia um professor a sortear um dos alunos from random import choice print('Olá professor!\nEstá com difuculdade em sortear um aluno?\n') al1 = input('Insira o nome do 1.º aluno: ') al2 = input('Insira o nome do 2.º aluno: ') al3 = input('Insira o nome do 3.º aluno: ') al4 = input('Insira o nome do 4...
true
0a15cb66c6fe3073a6d86ceb1232a4d79689c3bd
Python
noahc66260/ProjectEuler
/problem41.py
UTF-8
362
3.1875
3
[]
no_license
''' No nine digit pandigital number is prime because the sum of the digits is 45. Likewise for eight, but not for seven. ''' from problem24 import permN from problem27 import isPrime from math import * m = 0 for i in range(factorial(8), 0, -1): n = ''.join([str(j) for j in permN(i, 1, 8)]) if isPrime(int(n)) ...
true
dd83c0f78ca17769d4cb9973ceaafe9fd18f4059
Python
AROMAeth/robo_code
/catkin_ws/src/devel_scripts/stepper.py
UTF-8
966
2.984375
3
[ "MIT" ]
permissive
import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) control_pins = [7,11,13,15] for pin in control_pins: GPIO.setup(pin, GPIO.OUT) GPIO.output(pin, 0) halfstep_seq = [ [1,0,0,0], [1,1,0,0], [0,1,0,0], [0,1,1,0], [0,0,1,0], [0,0,1,1], [0,0,0,1], [1,0,0,1] ] # speed from 0 to 1 (one bei...
true
aa18052cdda7e53384b022612ccbe27478bd0eec
Python
varshitha8142/interview_cake_assignment
/10_rectangular_love.py
UTF-8
2,079
4.09375
4
[]
no_license
""" A crack team of love scientists from OkEros (a hot new dating site) have devised a way to represent dating profiles as rectangles on a two-dimensional plane. They need help writing an algorithm to find the intersection of two users' love rectangles. They suspect finding that intersection is the key to a matching...
true
f2af01d5567a32e96379648798fb0e3877a05688
Python
NKI-CCB/cnr
/cnr/cnrcplex.py
UTF-8
31,018
2.75
3
[ "MIT" ]
permissive
"""Classes and functions to generate cplex.Cplex for CNR problem.""" import cplex import numpy as np import sympy import cnr.cplexutils from cnr.data import PerturbationPanel ############################################################################### # # Helper functions def _add_direct_target(nodes, pert_name,...
true
d41798f31480a49f9bfba9a85a2576a2ab3c24fb
Python
minghegao/kdd_2018_air_quality_predict
/model/nn+gbdt/nn+GBDT.py
UTF-8
11,794
2.6875
3
[]
no_license
import pandas as pd import numpy as np from sklearn.model_selection import KFold from sklearn.model_selection import train_test_split import h5py import pickle import sklearn from keras.callbacks import Callback from keras.models import Model from sklearn.preprocessing import MinMaxScaler # 这是标准化处理的语句,很方便,里面有标准化和反标准化...
true
40c0453e352daeed4ab46dc509449b8e502005ed
Python
pykello/london2012-olympics
/data.py
UTF-8
12,499
2.59375
3
[ "Apache-2.0" ]
permissive
population = dict([ ('China', 1347350000), ('India', 1210193422), ('United States', 314065000), ('Indonesia', 237641326), ('Brazil', 192376496), ('Pakistan', 180327000), ('Nigeria', 166629000), ('Bangladesh', 152518015), ('Russia', 143117000), ('Japan', 127530000), ('Mexico',...
true
3a2f9f1b2f5888f1c30caeea108802af1f1e8d80
Python
huyi93/DataStructure
/code/ch01/compress_string.py
UTF-8
1,964
4.125
4
[]
no_license
""" 链接:https://leetcode-cn.com/problems/compress-string-lcci 字符串压缩。利用字符重复出现的次数,编写一种方法,实现基本的字符串压缩功能。 比如,字符串aabcccccaaa会变为a2b1c5a3。 若“压缩”后的字符串没有变短,则返回原先的字符串。你可以假设字符串中只包含大小写英文字母(a至z)。 示例1: 输入:"aabcccccaaa" 输出:"a2b1c5a3" 示例2: 输入:"abbccd" 输出:"abbccd" 解释:"abbccd"压缩后为"a1b2c2d1",比原字符串长度更长。 提示: 字符串长度在[0, 50000]范围内。 """ ...
true
605a5d294e787ac2f6e5bc3ab0ab43ffcbe96d32
Python
martoro/algorithms
/combinatorics/combinatorist_test.py
UTF-8
9,736
3.09375
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python import unittest from combinatorist import Combinatorist from namedlist import namedlist class CombinatoristTest(unittest.TestCase): def test_binom(self): Args = namedlist('Args', ['n', 'k']) args = Args(n=10, k=3) combinatorist = Combinatorist(args) expect...
true
997e4e0b0b82bae31f1963f7369ac55890ba934f
Python
ryuseiasumo/Gazoshori100knock
/Question_51_60/q59.py
UTF-8
3,388
2.515625
3
[]
no_license
import cv2 import numpy as np def Otsu2(_img): th = 0 max_b = 0 th_max = 0 for th in range(255): H, W = _img.shape img = _img.copy() img[img >= th] = 255 img[img < th] = 0 img0 = img[img == 0] img1 = img[img == 255] w0 = len(img0) w1 = ...
true
aa53733ebd0c0bca8179aa82b3957a0a77d9957b
Python
fgomesc/data_science_do_zero
/modulos/cap_1_visu_dados/grafico_barra3.py
UTF-8
516
3.4375
3
[]
no_license
from matplotlib import pyplot as plt mentions = [500, 505] years = [2013, 2014] plt.bar([2016.6, 2013.6], mentions, 0.8) plt.xticks(years) plt.ylabel("# de vezes que ouvimos alguem dizer 'data sciences' ") # se voce nao fizer isso, o matplotlib nomeará o eixo x de 0, 1 # e entao adiciona a +2.013e3 para fora do can...
true
aa8a43e0d095a5b89e6dac3381bd56f4a943741b
Python
xiangkangjw/interview_questions
/leetcode/python/393_utf8Validation.py
UTF-8
1,484
3.171875
3
[]
no_license
class Solution(object): def validUtf8(self, data): """ :type data: List[int] :rtype: bool """ data = map(lambda a:"{0:08b}".format(a), data) index = 0 while index < len(data): expected_continuition = len(data[index].split('0')[0]) # pri...
true
952d72b6f91437c52217616ca91bf583755b9363
Python
DESm1th/temerty-scc-code
/convert_scans.py
UTF-8
13,748
2.828125
3
[]
no_license
#!/usr/bin/env python """ Converts the scans stored in <input_dir> to the formats listed in <project_settings>. Results of conversion are stored in each scan's parent folder under a subdirectory named after the format. E.g. /input_dir/parent_folder/scan1/scan1_Fractional_Aniso converted to nifti would be stored at /in...
true
8a9cb8cce2e790222b77869a89a8e1087cecc0e1
Python
filiptronicek/teamtrees-stats
/header.py
UTF-8
584
2.859375
3
[]
no_license
from datetime import datetime date = datetime.now() countFile = "data/"+date.strftime("%Y.%m.%d")+"-count.csv" rateFile = "data/"+date.strftime("%Y.%m.%d")+"-rate.csv" def init(file): #We read the existing text from file in READ mode src=open(file,"r") fline="count,date\n" #Prepending string oline=sr...
true
1ce9c54c830ccc274d205c85df3d2af48524ca12
Python
can19960229/PythonGUI_tkinter
/1/sevendigitv1.py
UTF-8
1,050
3.59375
4
[]
no_license
import turtle,time #绘制数码管间隔 def drawGap(): turtle.penup() turtle.fd(5) #绘制数码管间隔 def drawLine(draw): drawGap() turtle.pendown() if draw else turtle.penup() turtle.fd(40) drawGap() turtle.right(90) #绘制单段数码管 def drawDigit(digit): drawLine(True) if digit in [2,3,4,5,6,8,9] else drawLine(False) drawLine(True) if d...
true
5a87b695d0feb90db427827e68cb2b94ee3a94dc
Python
gkgg123/TIL
/baekjoon/15686_치킨배달.py
UTF-8
1,190
3.140625
3
[]
no_license
import itertools def direction(x,y): global home return [abs(x-h[0])+abs(y-h[1]) for h in home] N,M=map(int,input().split()) arr=[list(input().split()) for _ in range(N)] home=[] chi=[] for i in range(N): for j in range(N): if arr[i][j]=='1': home.append((i,j)) elif arr[i][j]=...
true
fe964104e60c25a49c9ce0e8b42d8151c317ca2f
Python
litded/lessons
/Py1_spc-master/Lec6/main.py
UTF-8
668
3.90625
4
[]
no_license
""" Цикл - локальный участок кода, выполняющийся заранее опеределенное количество раз или имеющий известное условие остановки цикла. В Python 2 цикла: while/for """ # while expression: # body # for expression: # body i = 0 while i < 10: print("Element:", i) i += 1 # i = i + 1 print("Done!") """...
true
46261a7d61a416c987e062c7da7a8546da142a36
Python
tazbingor/learning-python2.7
/python-exercise/4-error/py138_exception.py
UTF-8
687
3.390625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 18/1/3 下午6:37 # @Author : Aries # @Site : # @File : py138_exception.py # @Software: PyCharm ''' 10-7. 异常 下面两代码段a,b有何区别? a. try: statement_A except ...: ... else: statement_B b. try: statement_A s...
true
ba49a75c3da08cd4a589492fa74ac3eede4b70ae
Python
mingyujohn0520/amp-tests
/question2_IncreasingListClass.py
UTF-8
2,938
4.03125
4
[]
no_license
import sys import json class IncreasingList(list): def append(self, val): if self.__len__() == 0: self.extend([val]) else: try: while self.__len__() > 0 and self[-1] > val: self.pop() self.extend([val]) except ...
true
5302c17eb745c08ed5193d0b1cf6063dec042d3d
Python
pdevra/legendary-octo-sniffle
/fibonacci.py
UTF-8
135
3.453125
3
[]
no_license
a,b = 0,1 print(b, end=' ') for i in range(0,50): a,b = b,b+a if b <= 50: print(b,end=' ') 1 1 2 3 5 8 13 21 34
true
2665203fd138d2b69b8c23cbafba68954561038a
Python
liuyang1/test
/course/AlgoDesign/3/task/task.py
UTF-8
2,414
3
3
[ "MIT" ]
permissive
#! /usr/bin/python # 2012-04-16 00:04:09,liuyang1@dorm # homework AlgoImpl 3-1 # independtent task optimize manger # usage:./task.py < input.txt > output.txt # --------------------------------------------------------------- # greedy algo is wrong, # but preprocess so that,first handle job which cost most time # so can ...
true
0b641e37b949263a0fdb9183521ec734231c9603
Python
Miging/BangtalChool
/RoomEscape.py
UTF-8
5,242
2.59375
3
[ "Apache-2.0" ]
permissive
from bangtal import * startscene=Scene('','images/시작.png') title=Object('images/제목.png') title.locate(startscene,100,50) title.setScale(2) title.show() timer=Timer(0.1) endtimer=Timer(5) startBtn=Object('images/시작버튼.png') startBtn.locate(startscene,850,50) startBtn.setScale(0.7) startBtn.show() scene1=Scene('룸1','...
true
7cc6883561636c537ef823e5a09abc4ca2da05ef
Python
luizhmfonseca/Estudos-Python
/AULA 04 - Primeiros comandos em Python3/exemplo 02.py
UTF-8
75
3.421875
3
[ "MIT" ]
permissive
nome = input('Digite seu nome: ') print(f'É um prazer te conhecer {nome}')
true
89bbfe490e4d06a4142219095dc88aa46ee04521
Python
JingkaiTang/github-play
/early_place/high_man/work/work_and_work.py
UTF-8
243
2.671875
3
[]
no_license
#! /usr/bin/env python def point_and_eye(str_arg): little_life_or_last_case(str_arg) print('number') def little_life_or_last_case(str_arg): print(str_arg) if __name__ == '__main__': point_and_eye('leave_company_from_hand')
true
a0dc8fa5df30ce001b3aa07652fc6e4796be54cd
Python
benhassenwael/AirBnB_clone_v2
/models/engine/db_storage.py
UTF-8
2,277
2.53125
3
[]
no_license
#!/usr/bin/python3 """Database storage engine using SQLAlchemy with a mysql+mysqldb database connection """ import os from models.base_model import Base from models.amenity import Amenity from models.city import City from models.place import Place from models.state import State from models.review import Review from mo...
true
5e69097b196fd5ce54374894bded9b4abfbdcdd2
Python
darraes/coding_questions
/v2/_leet_code_/0226_invert_binary_tree.py
UTF-8
1,352
3.28125
3
[]
no_license
# Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def invertTree(self, root): """ :type root: TreeNode :rtype: TreeNode """ if root is None:...
true
13b8a5c08bb1ecf850e13cc152626963d81c1051
Python
JunchuangYang/Machine-Learning
/Adaboost算法/Adaboost+疝气病数据集/Adaboost.py
UTF-8
5,927
3.078125
3
[]
no_license
#-*- coding:utf-8-*- import pandas as pd import numpy as np """ 函数功能:获得数据的特征和标签 参数说明: path: 数据路径 返回: xMat:样本特征 yMat:样本标签 """ def get_Mat(path): dataSet = pd.read_table(path,header = None) xMat = np.mat(dataSet.iloc[:,:-1].values) yMat = np.mat(dataSet.iloc[:,-1].values).T return xMat,yMat """ 函数功能:...
true
88d14df29e6ac26da44d219491018f528679ed3d
Python
RiddhimGupta/Python
/problem11send.py
UTF-8
227
2.5625
3
[]
no_license
import socket recv_ip='127.0.0.1' recv_port=4444 s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) while True: msg=input("Enter message: ") s.sendto(msg.encode('ascii'),(recv_ip,recv_port)) if msg=='q': exit() s.close()
true
2b67c8d9ddb05dae36d0e6f58ca4f5299b99efe6
Python
pratripat/Zombie-World
/LevelEditor/scripts/selector_panel/selector_panel.py
UTF-8
2,317
2.875
3
[]
no_license
from LevelEditor.settings import * from .selector import Selector import json class Selector_Panel: def __init__(self, w, h): self.w = w self.h = h self.initialize_selectors() def show(self): #Rendering background pygame.draw.rect(screen, colors['selector'], (0,0,self....
true
5313c33784ba5138c15abacff393e1f2983e02b2
Python
HansKappert/RealTimeDetection
/code/create_lmdb.py
UTF-8
3,546
2.875
3
[]
no_license
""" Title :create_lmdb_d.py Description :This script divides the training images into 2 sets and stores them in lmdb databases for training and validation. Author :Adil Moujahid modifications by Hans Kappert Date Created :20160619 Date Modified :20210222 version :0.2...
true
02c7ac8806e1f5d7306391beeff582ba6868d20d
Python
teodorklaus/PythonSamurai
/Fesianov_Ihor/week_3/Task_2_unittest.py
UTF-8
1,220
3.34375
3
[]
no_license
__author__ = 'Ihor' import unittest from Fesianov_Ihor.week_3.Task_2 import Number class TestNumber(unittest.TestCase): def test__add__(self): test_num = Number(4) + Number(5) self.assertEqual(test_num.value, Number(9).value) def test__sub__(self): test_num = Number(4) - Number(5) ...
true
401097cf9cbe2108deaf026d4570cf2f26981a18
Python
Montage-Inc/python-montage
/montage/api/role.py
UTF-8
1,204
2.703125
3
[ "MIT" ]
permissive
import warnings class RoleAPI(object): def __init__(self, client): self.client = client def create(self, name, add_users=None): payload = { 'name': name, 'add_users': add_users or [] } return self.client.request('roles', method='post', json=payload) ...
true
a4d807bce35eeb959dfadd661d95aa3a27a27080
Python
bunshue/vcs
/_4.python/__code/Python大數據特訓班(第二版)/ch05/npcompute3.py
UTF-8
285
3.640625
4
[]
no_license
import numpy as np a = np.random.randint(100,size=50) print('陣列的內容:', a) print('1.標準差:', np.std(a)) print('2.變異數:', np.var(a)) print('3.中位數:', np.median(a)) print('4.百分比值:', np.percentile(a, 80)) print('5.最大最小差值:', np.ptp(a))
true
c7049a0ebb45fe88762dd2194ae0a771be762042
Python
dragonOrTiger/pythonDemo
/out.py
UTF-8
151
3.578125
4
[]
no_license
print('''line1 line2 line3''') age = input('please input your age:') if int(age) >= 18: print('you are adult') else: print('you are teenager')
true
5f7947ee15983b0d2fe58bbf2c817e2ec059bd5a
Python
yangtian1018/machine_learning
/study_daily/project_2/scantter.py
UTF-8
4,314
2.796875
3
[]
no_license
#-*- coding: utf-8 -*- """ 该module主要负责根据关键字去豆瓣爬取相关电影信息 并组装创建一个Movie对象 """ from media import Movie import urllib import json import sys from bs4 import BeautifulSoup reload(sys) sys.setdefaultencoding('utf-8') # 搜索结果返回个数 search_count = 5 def get_douban(key): """ This function for search movie info with k...
true
cf114abd678725da1d93cc4b704d331c45b185dc
Python
dangkhiem91/codeforces
/467A.py
UTF-8
158
3.109375
3
[]
no_license
n = int(input()) count = 0 for i in range(n): pi, qi = map(int,input().split()) d = qi - pi if int(d) >= 2: count += 1 print(count)
true
22c9bdf4586ab160b8249946fb4f1ca7b791f70c
Python
wallace123/adventofcode
/2021/day9.py
UTF-8
1,692
3.40625
3
[]
no_license
#!/usr/bin/python3 class Cave: def __init__(self): self.puzzle = self._parse_input() self.lows = [] self.risk = 0 def _parse_input(self): with open('data/day9.txt', 'r') as infile: return [line.rstrip() for line in infile.readlines()] def ge...
true
ef25645c0b62988e41576bedc921a3af25f9da5e
Python
ronakraj/advent_of_code
/2020/challenge_1_part_1.py
UTF-8
1,121
4.03125
4
[]
no_license
# Day 1 - Report Repair # Part 1 # Read data from file into array # Hard coded, can abstract filename as input with open("input_1.txt", "r") as fd: data_str = fd.read().splitlines() # Convert array of string to int data_int = [int(item) for item in data_str] # Sort data in ascending order data_int.sort() # Find...
true
ed021b785bc1645ee6e81b468c7fccaa31785c59
Python
Dhruvisgoat/skeletris
/src/worldgen/worldgen.py
UTF-8
16,700
2.875
3
[]
no_license
import random from src.world.worldstate import World from src.game.enemies import EnemyFactory import src.world.entities as entities import src.utils.colors as colors import src.game.music as music NEIGHBORS = [(-1, 0), (0, -1), (1, 0), (0, 1)] DIAGS = [(-1, -1), (1, -1), (1, 1), (-1, 1)] class Room: def __i...
true
6b97147d4d47a8132d8616e1da6e6045981ac5e7
Python
KidAlien1209/leetcode_py
/2.add-two-numbers.py
UTF-8
1,457
3.359375
3
[]
no_license
# # @lc app=leetcode id=2 lang=python3 # # [2] Add Two Numbers # # https://leetcode.com/problems/add-two-numbers/description/ # # algorithms # Medium (31.25%) # Likes: 5395 # Dislikes: 1386 # Total Accepted: 911.8K # Total Submissions: 2.9M # Testcase Example: '[2,4,3]\n[5,6,4]' # # You are given two non-empty l...
true
1371715841d4dae659128e77f12024cf808a3055
Python
andrei-kozel/100daysOfCode
/python/day027/main.py
UTF-8
844
3.5
4
[]
no_license
from tkinter import * window = Tk() window.title("Mile to Km Converter") window.minsize(width=300, height=100) window.config(padx=30, pady=30) window.columnconfigure(0, weight=1) window.columnconfigure(2, weight=1) window.rowconfigure(0, weight=1) window.rowconfigure(2, weight=1) mile_text = Label(text="Miles") mile...
true
0a9673baa36544267cd4b104b75e28833d8ff8db
Python
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_117/1080.py
UTF-8
6,100
2.765625
3
[]
no_license
''' Created on Apr 12, 2013 @author: jean ''' import itertools TRUE = set([True,]) _DEBUG=False class grass(object): def __init__(self, target): self.target = target nr = len(target) nc = len(target[0]) self.nc=nc self.nr=nr mx = self.getMax() self.curr...
true
6fcddc32ed5b85d068722fc60bb8d6c13f7d7496
Python
syurskyi/Python_Topics
/095_os_and_sys/examples/ITVDN Python Essential 2016/09-binary_file.py
UTF-8
1,299
3.578125
4
[]
no_license
"""Пример использования бинарного файла""" from array import array import os.path prefix = os.path.join('data', 'ex09_') # Создание списка чисел numbers = list(range(300, 400)) # Запись в текстовый файл with open(prefix + 'text.txt', 'w') as txt_file: print(numbers, file=txt_file) # Создание массива, поддежив...
true
e599f5bd58992c7e60cf27a4b1f5c82a0af21536
Python
profeJoel/TPA2021-1
/Python/SitioWeb/ejemplo4.py
UTF-8
643
3.125
3
[]
no_license
from flask import Flask, redirect, url_for, render_template, request app = Flask(__name__) @app.route("/") #indica que será la página de inicio def inicio(): return render_template("nueva.html") @app.route("/login", methods = ["POST", "GET"]) def login(): if request.method == "POST":#obligatoriamente en mayu...
true
35df39bec1a11dc6d127e8d766c7ae357fd09be0
Python
KeithTheEE/Barcodes
/wordSearch.py
UTF-8
4,412
2.875
3
[]
no_license
#!/usr/bin/env python #Word Search #print "Importing dictionaryToArrays..." import dictionaryToArrays D2 = {} def threshold_Edit(D, count_Threshold, length_Threshold): D2 = {} word_Array = [] count_Array = [] hold_Array = [] hold_Array = dictionaryToArrays.dictionary_To_Arrays(D) word_Arra...
true
7fc7b1c11d2989a03bc44673ff22cd8b8652676c
Python
Sasha-boot/testpogodabot
/pogoda.py
UTF-8
6,095
2.609375
3
[]
no_license
# ПРОГНОЗ ПОГДЫ v6.23b (пред релиз бота ).) import pyowm import telebot from telebot import types import tg_analytic bot = telebot.TeleBot("1109671417:AAHPUpsg0sixLTgQyedhBURbQ11-jyYfGNM") owm = pyowm.OWM('bc48aa759c9c8cc16f9a2ac2164aad2c', language ="ru") joinedFile = open("/joined.txt", "r") joinedUse...
true
70da71a505a049610e15afefbad5a1624200593b
Python
vtsozik/interviews
/hackerrank/python/mergethetools.py
UTF-8
363
3.109375
3
[]
no_license
def merge_the_tools(string, k): sl = len(string) u = set() for i, c in enumerate(string): if i > 0 and i % k == 0: u = set() print("") if c not in u: print(c, end="") u.add(c) print("") if __name__ == '__main__': string, k = input(), i...
true
df04a6343e5712d710ffc489cefd372078e6b936
Python
NonCover/Algorithms
/佛洛依德算法/main.py
UTF-8
1,743
4.21875
4
[]
no_license
""" floyd algorithm """ MAX_VALUE = float('inf') path = [[0, 2, 6, 4], [MAX_VALUE, 0, 3, MAX_VALUE], [7, MAX_VALUE, 0, 1], [5, MAX_VALUE, 12, 0]] ## path[i][j] 代表从i -> j的所需的路程(下标表示节点) ## path[i][j] = MAX_VALUE 代表从i -> j走不通 ## path[i][j] = 0 表示 i = j,意味着从i 走向 i路程为0 """ 佛洛依德算法本质上就是动态规划。 例如 我们从...
true
6b135ecda9f2dc1a44773b5e452ed9c2ffbfc557
Python
phuocding/encrypt-and-decrypt
/decode.py
UTF-8
2,176
3.203125
3
[ "MIT" ]
permissive
import base64 import os.path def checkFile(title, file_name, hint_or_show): if os.path.isfile(file_name): # print("File exist") f = open(file_name, "a") f.write(title + ": " + hint_or_show + "\n") f.close() print("Saved") else: print("File not exist") ...
true
2107d107331239833d03dffac45239f0ac5e84b6
Python
Madhan13K/python-programs
/rapsbeeryi.py
UTF-8
219
2.71875
3
[]
no_license
import Rpi.GIPO as GPIO import time pwm_obj=GPIO.PWM(18,400) pwm_obj.start(100) pwm_obj.ChangeDutyCycle(50) while True: GPIO.output(18,True) time.sleep(0.5) GPIO.output(18,False) time.sleep(0.5)
true
2395c9a74cad4b637055cbe8a82c8dc2d1110b09
Python
lpares12/IPoL
/prototypes/sender.py
UTF-8
451
2.515625
3
[]
no_license
import RPi.GPIO as GPIO from time import sleep, time from random import randrange ledPin = 18 GPIO.setmode(GPIO.BCM) GPIO.setup(ledPin, GPIO.OUT) led = GPIO.PWM(ledPin, 100) led.start(0) toSend = [1,0,1,0,1,1,0,1] # Start connection BIT led.ChangeDutyCycle(100) sleep(0.02508) for i in range(8): #randBit = randr...
true
32a13f34bd651edaed78b9845d6248c158348b68
Python
connorourke/lammps_potenial_fitting
/potentials.py
UTF-8
3,638
3.046875
3
[]
no_license
from potential_parameters import buckingham_parameters class BuckinghamPotential(): """ Class that contains the information for each buckingham potential, where parameters are BuckinghamParameter objects. """ def __init__(self, labels, atom_type_index, a, rho, c): """ Initialise eac...
true
64827ccdd72350d09385b08c12c290324587fe64
Python
AswinSampath1401/DataStructures
/Strings/replaceab.py
UTF-8
192
3.234375
3
[]
no_license
def fun(s): count=1 while(True): s=s.replace("ab","bba") print(s) if(s.find("ab")==-1): break count+=1 return count print(fun("aab"))
true
5a0ef4dcb495e890644db0fcf3deaff7ad9d26ce
Python
AnnieHdez/LeetCode-Practice
/Compare Version Numbers.py
UTF-8
679
3.125
3
[]
no_license
class Solution: def compareVersion(self, version1: str, version2: str) -> int: ver1 = version1.split(".") ver2 = version2.split(".") n = len(ver1) m = len(ver2) for i in range(min(n,m)): if int(ver1[i])>int(ver2[i]): return 1 e...
true
2e8a19a2df1f6b2bd8816c61a7eb4c81cdee0a88
Python
sairam-py/CodeForces-1
/ArrivaloftheGeneral.py
UTF-8
1,318
3.875
4
[]
no_license
__author__ = 'Devesh Bajpai' ''' https://codeforces.com/problemset/problem/144/A Solution: Interesting problem. Firstly, we prefer to get the largest value on the left-most index and smallest value on the right-most index. This way we reduce the swaps in case of duplicates for largest/smallest values. Once we have t...
true
65671bc2756bdc410b60ea8b6b187e700fbe6336
Python
nsambold/halogenase_SVM
/encoder.py
UTF-8
2,588
2.65625
3
[]
no_license
import converter from Bio import AlignIO from sklearn import svm from combinatorics import m_way_unordered_combinations as choose_n """ makes a svm where 0 is hydroxylase and 1 is halogenase """ hydro_name = "WP_107105619HWD" ancestor_name = "hand_pickedHWG" dic = converter.dic alignment_files = [ "/Appli...
true
40c4471f0a74af19f3d6265ce4df672fc4a378a5
Python
userasr/boto3S3Utils
/archiveObjects.py
UTF-8
1,169
2.671875
3
[]
no_license
import boto3 from datetime import datetime # CONFIGURATIONS bucketName = 'BUCKETNAME' # Enter the bucket name prefix = 'ANYPREFIX' # Enter the prefix name threshold = 30 # Enter the Threshold value, number of days after which the Storage Class of the objects to be changed to Glacier Deep Archive s3 = boto3.client(...
true
b86d3ed32b00151d5a486657b6103cf13a0c289c
Python
GregStephen/python_practice
/zipping_unzipping.py
UTF-8
743
2.828125
3
[]
no_license
import zipfile import shutil f = open('fileone.txt', 'w+') f.write('ONE FILE') f.close() f2 = open('filetwo.txt', 'w+') f2.write('TWO FILE') f2.close() comp_file = zipfile.ZipFile('comp_file.zip', 'w') comp_file.write('fileone.txt', compress_type=zipfile.ZIP_DEFLATED) comp_file.write('filetwo.txt', compress_type=zi...
true
ec510dc7d62901d18d21bfdbbe875620b0cbfb0f
Python
FabianSchuetze/mergesort
/python/mergesort.py
UTF-8
2,842
3.109375
3
[]
no_license
r""" Tries to write the merge path problem as a sequential problem""" import numpy as np # def intersection(list_a, count_a, list_b, diag): # import pdb; pdb.set_trace() # a_top = min(diag, count_a) # b_top = max(diag - count_a, 0) # a_bottom = b_top # while True: # mid = (a_top - a_bottom...
true
1389a8623878fbcdba5a095620bf7966eebb9e27
Python
karlicoss/HPI
/my/calendar/holidays.py
UTF-8
1,581
2.78125
3
[ "MIT", "LicenseRef-scancode-proprietary-license" ]
permissive
""" Holidays and days off work """ REQUIRES = [ 'workalendar', # library to determine public holidays ] from datetime import date, datetime, timedelta from functools import lru_cache from typing import Union from ..core.time import zone_to_countrycode @lru_cache(1) def _calendar(): from workalendar.registry...
true
b44d9127613b81c9dd263f1aa437ffa39b2bc070
Python
janus-magnus/PP_S1_B1
/Les2/FA2.py
UTF-8
1,338
3.515625
4
[]
no_license
stations = ['Schagen', 'Heerhugowaard', 'Alkmaar', 'Castricum', 'Zaandam', 'Amsterdam Sloterdijk', 'Amsterdam Centraal', 'Amsterdam Amstel', 'Utrecht Centraal', "s-Hertogenbosch", 'Eindhoven', 'Weert', 'Roermond', 'Sittard', 'Maastricht'] while True: beginStation = input('Wat is je beginst...
true
84437bea00fecbbd7cd3253ccc375c0472ab78b5
Python
Onethity/2020-2-Atom-QA-Python-D-Lukianov
/hw2/tests/test_auth.py
UTF-8
743
2.625
3
[]
no_license
import pytest from tests.base_test_case import BaseTestCase class TestAuth(BaseTestCase): """ Тесты на авторизацию """ @pytest.mark.UI def test_auth_negative(self): """ Негативный тест на авторизацию с неверным форматом логина """ self.main_page.auth('wrong_login', 'wrong_pass') a...
true
89c368ae576d5f8c14b072233424fafa8037a029
Python
Digital2Slave/UrbanRegionFunctionClassification
/bak/UrbanRegionClassification/scut/analysis/write2excel.py
UTF-8
2,771
2.859375
3
[]
no_license
# -*- encoding:utf-8 -*- import datetime import xlwt from xlwt import * # add workbook by set encoding='utf-8' workbook = xlwt.Workbook(encoding='utf-8') # set border of cell borders = xlwt.Borders() borders.left = xlwt.Borders.THIN borders.right = xlwt.Borders.THIN borders.top = xlwt.Borders.THIN borders....
true
2501b716ea8268db9c564add89cf2f08aacd68eb
Python
ooojos/quovadis
/Footsteps.py
UTF-8
2,127
3.484375
3
[]
no_license
import random from playermodule import player from playermodule import randomplayer from playermodule import sequenceplayer from playermodule import smartplayer print("Hi! welcome to Quo Vadis\n") gametype = 0#int(input("What game type? 1=human vs machine, 0=comp vs comp")) numRounds = 100000 debug=0 if(g...
true
02e8027e3dd3975fe43b6c110f9b81100a536015
Python
thibaultdesurrel/Generate_PI_with_NN
/Datasets/Create_dataset_square.py
UTF-8
4,238
2.75
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # # Create dataset square and save it # In[1]: import matplotlib.pyplot as plt import numpy as np import gudhi as gd import gudhi.representations from tqdm import tqdm import multiprocessing from time import time from sklearn.neighbors import KernelDensity # ### Define the ...
true
5737a5acd485830631af4bf8e81f5445347e4fc8
Python
patsonev/Python_Basics_Exam_Preparation
/safari.py
UTF-8
373
3.71875
4
[]
no_license
budget = float(input()) count_litre = float(input()) day = input() total_price = count_litre * 2.1 + 100 if day == 'Saturday': total_price *= 0.9 else: total_price *= 0.8 if total_price < budget: print(f'Safari time! Money left: {budget - total_price:.2f} lv.') else: print(f'Not enough ...
true
988add5536cbd78352d789601afe031f368d4b96
Python
uxlsl/leetcode_practice
/flatten-a-multilevel-doubly-linked-list/solution.py
UTF-8
839
3.484375
3
[]
no_license
# leetcode # https://leetcode-cn.com/problems/flatten-a-multilevel-doubly-linked-list/ # Definition for a Node. class Node(object): def __init__(self, val, prev, next, child): self.val = val self.prev = prev self.next = next self.child = child class Solution(object): def flatt...
true
c1f564109668adaf0999fbbef7c2000e77554560
Python
simonrw/network-checker
/networkcheck/types.py
UTF-8
1,215
2.765625
3
[]
no_license
from typing import Any, NamedTuple, Match PingSummary = Any # TODO PingResultBase = NamedTuple( "PingResultBase", [ ("nbytes", int), ("ip_addr", str), ("icmp_seq", int), ("ttl", int), ("time_ms", float), ], ) class PingResult(PingResultBase): @classmethod ...
true
6238d74aaa51e5e9122cb303145ff614010056a6
Python
Aki78/blender_barchart_race
/data/format_global_covid_data.py
UTF-8
663
2.640625
3
[]
no_license
import pandas as pd #example_df = bcr.load_dataset('covid19_tutorial') df = pd.read_csv('../data/melted_global_covid_data.csv') df = df[['date', 'Country/Region', 'value', 'Province/State']] df = df.rename(columns={'Country/Region' : 'country', 'value' : 'n_infected', 'Province/State' : 'Province'}) df['date'] = pd.to...
true
6dcecc2a1502c02f5950ca56d8c5cc861d4f3dd4
Python
CrimsonVista/Playground3
/src/playground/network/common/PortKey.py
UTF-8
1,526
3.09375
3
[]
no_license
class PortKey: def __init__(self, source, sourcePort, destination, destinationPort): self.source = source self.sourcePort = sourcePort self.destination = destination self.destinationPort = destinationPort def inverseKey(self): return PortKey(self.dest...
true
85b28352cff80d7ec1dd9e78b795a693e7bafa3b
Python
linbo0518/BLPose
/test/test_utils_layers.py
UTF-8
1,338
2.53125
3
[ "MIT" ]
permissive
"""BLPose Test: Utils Layers Author: Bo Lin (@linbo0518) Date: 2020-12-08 """ import sys from torch import nn sys.path.append("../") from blpose.utils.profiler import Profiler from blpose.utils.layers import * p = Profiler() with p.profiling("Test get_conv1x1"): print(f"ref: {nn.Conv2d(3, 64, kernel_size=1, st...
true
5f6fdc250e12f99b02209d5dc84648dbb774be4b
Python
OthmaneHanyf/DataStructers-Algorithms
/algorithms/trace.py
UTF-8
195
3.3125
3
[]
no_license
def tr(matrix): try: n = len(matrix) except TypeError : return matrix s = 0 for i in range(n): s += matrix[i][i] return s print(tr([[1, 1], [3, 1]]))
true
d751906f5e2e544b697002c0bf7814019dae18b7
Python
adam-git-ai/Malignant-Breast-Cancer-Diagnosis
/dataprocessing.py
UTF-8
2,948
3.1875
3
[ "MIT" ]
permissive
import csv import os.path import numpy as np def make_files(numerator): print("Dividing data, using",(numerator*10//10)*10,"% for training...") trainingD = open('trainingdata.csv', 'w') validationD = open('validationdata.csv', 'w') with open('data.csv', 'r') as original: reader = [line.split("...
true
11aea3a869fa6fd5bc6b7667e511aebd68a92c22
Python
yiyangzhang2020/Biostat821-Projects
/test_ehr_analysis.py
UTF-8
2,075
3.109375
3
[]
no_license
import ehr_analysis def test_num_older_than(): ''' A test function that checks whether the num_older_than function returns the correct number We used a sample output from ehr_analysis ''' assert ehr_analysis.num_older_than(ehr_analysis.patients, 50) == 77 def test_sick_patients(): ''' ...
true
3363e28c31ffb0d5317afd9c04faa7f0abeb8aea
Python
Lokesh-pavan-kumar/Classifiers
/LogisticRegression.py
UTF-8
5,281
3.953125
4
[]
no_license
def sigmoid(X: np.ndarray): return 1 / (1 + np.exp(-X)) def normalize(X: np.ndarray): return (X - X.mean(axis=0)) / X.std(axis=0) class LogisticRegression: """ Logistic Regression Numpy implementation 1. Identify the size of the data i.e number of features(m) and dimensionality (n). 2. Init...
true