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 |
|---|---|---|---|---|---|---|---|---|---|---|
850354d38caef9226ed9ae5b5ec4b8fe3536ca87 | Ericsong2333/partia-flood-warning-system | /Task1C.py | UTF-8 | 497 | 2.640625 | 3 | [
"MIT"
] | permissive | from floodsystem.geo import stations_within_radius
from floodsystem.stationdata import build_station_list
from haversine import haversine, Unit
def run():
"""requirements for Task1C"""
Cambridge_coordinate = (52.2058,0.1218)
stations = build_station_list() #build list of stations
prin... | true |
b89ca30809e5195afea8c7694f6f4df10a132c57 | kandarpck/networksecurity2018 | /labs/lab1/src/lab2_protocol/SITHPacket.py | UTF-8 | 1,857 | 2.546875 | 3 | [
"MIT"
] | permissive | from playground.network.packet import PacketType
from playground.network.packet.fieldtypes import BUFFER, STRING, LIST
from playground.network.packet.fieldtypes.attributes import Optional
from .SITHPacketType import SITHPacketType
class SITHPacket(PacketType):
DEFINITION_IDENTIFIER = "SITH.kandarp.packet"
DE... | true |
10150e96de4316b00b3dbf90b4b5e23371f4b918 | ELIFE-ASU/parallel-programming-mpi | /scripts/serial_info.py | UTF-8 | 1,189 | 3.0625 | 3 | [] | no_license | from os.path import abspath, dirname, join
import numpy as np
import pandas as pd
import pyinform as pi
def sig_mutual_info(xs, ys, alpha=0.05, nperm=1000):
"""
Compute the mutual information between `xs` and `ys` using a permutation
test to assess statistical significance.
:param xs: first variable
... | true |
286843e7f64ac3dc28b9fd610b9a11f9d47323bd | zmiller22/RANSAC-Image-Analysis | /test.py | UTF-8 | 3,039 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 10 15:14:56 2020
@author: tracingpc1
"""
import my_functions as my_func
import skimage as si
import numpy as np
import scipy as scipy
from sys import getsizeof
import time
test_path = my_func.convert_to_wsl_path(r"C:\Users\TracingPC1\Documents\zbra... | true |
3f05eb062956041cadcafebe0acc1c4b22678e44 | Justin-Chairez/Algorithms | /binary_search.py | UTF-8 | 998 | 4.15625 | 4 | [] | no_license | import random
import time
#Initial test array
list1 = [1,3,6,7,11,12,18,21]
def binary_search(array,target):
length = len(array)
start = 0
end = length-1
#Continue searching so long as we have not reached the end
while start <= end:
#Split the current section of the array in ha... | true |
7c4ce6e916ceeaf536ccd9a0aa9f46d029327722 | MathSquared/txlr | /txlr/utils.py | UTF-8 | 5,204 | 3.078125 | 3 | [] | no_license | """Various utility functions."""
import arrow
# Change these to modify the behavior of current_session.
# TODO factor these out into a config file or something.
CURRENT_SPECIAL = (0, 0)
UPCOMING_SPECIAL_PREFILE = arrow.Arrow(2000, 1, 1, tzinfo='US/Central')
UPCOMING_SPECIAL_CONVENE = arrow.Arrow(2000, 1, 1, tzinfo='... | true |
e51fb8ed93a25d2f29f346be9288e252bfd40941 | matiasgalvez/Selenium-with-Python | /src/test/test_002.py | UTF-8 | 888 | 3.46875 | 3 | [] | no_license | import unittest
class FirstTest(unittest.TestCase):
def set_up(self):
pass
def test_002(self):
self.a = 1
self.b = 1
self.res = self.a + self.b
self.assertEqual(self.a, self.b, f'{self.a} no es igual a {self.b}')
def test_003(self):
self.a = 1
se... | true |
865385a06a28c93ae5f84b23d98a611cd75a52b9 | yangninghua/python_songsong | /Week2(36集)/day5(8集)/代码/string_method04.py | UTF-8 | 1,898 | 4.375 | 4 | [] | no_license | # isalpha() 是否是字母 isdigit() 是否是数字
s ='abcd'
result = s.isalpha()
print("result=",result)
s='6688'
result = s.isdigit()
print(result)
# sum = 0
# for i in range(3): # 0,1,2
# num = input('请输入数字:') # ll
# if num.isdigit():
# num = int(num)
# sum+=num
# print('sum=',sum)
sum = 0
i... | true |
849b6c8b67b8ee0176d4cc029329ace0d199a1ca | ASAD5401/PYTHON-CODE | /plus minus(ps-hr).py | UTF-8 | 318 | 2.859375 | 3 | [] | no_license | n=int(input())
s=str(input()).split()
l=list()
k=list()
j=list()
for i in s:
c=int(i)
if c>0:
l.append(i)
if c==0:
k.append(i)
if c<0:
j.append(i)
q=len(l)/n
w=len(j)/n
e=len(k)/n
print("{0:.6f}".format(q))
print("{0:.6f}".format(w))
print("{0:.6f}".format(e)) | true |
34070d9c69aa5abb62112f90f1b0ff20e2912953 | buildkdom/buildset | /py3/chap3/3.2.17.py | UTF-8 | 659 | 4.125 | 4 | [] | no_license | # Introducing Python
# 3.2.17 정렬하기: sort()
list1 = ["hyosung", "samsung", "KBS", "topfield", "LG"]
list2 = ["(1) windows CE", "(2) embedded linux", "(3) Android"]
list3 = ["student", "soldier", "engineer"]
#
# python internal sorted()
#
reference = sorted(list3)
print (list3)
print (reference)
print ('--------------... | true |
b0fc3801fe66de482be6758a09db0d3ca70f7075 | OWLxx/DiscreteOptimization | /FacilityLocation/test1.py | UTF-8 | 1,181 | 2.8125 | 3 | [] | no_license | from gurobipy import *
import math
def distance(a,b):
dx = a[0] - b[0]
dy = a[1] - b[1]
return math.sqrt(dx*dx + dy*dy)
# Problem data
clients = [[0, 1.5],[2.5, 1.2]]
facilities = [[0,0],[0,1],[0,1],
[1,0],[1,1],[1,2],
[2,0],[2,1],[2,2]]
charge = [3,2,3,1,3,3,4,3,2]
numFacilities = ... | true |
3663ab1c37d7eb97f312be989d18c25c5804268d | luix/aws-deep-racer-league | /reward-functions/FirstTrainingModel.py | UTF-8 | 940 | 3.40625 | 3 | [] | no_license | def reward_function(params):
'''
Example of rewarding the agent to follow center line
'''
import math
# Read input parameters
track_width = params['track_width']
distance_from_center = params['distance_from_center']
speed = params['speed']
waypoints = params['waypoints']
all_wh... | true |
93b13e4d2059992a558c457eec6a00624e464e7d | dkauf42/bayota | /castjeeves/tests/test_sector.py | UTF-8 | 555 | 2.6875 | 3 | [
"BSD-3-Clause"
] | permissive | import pytest
import pandas as pd
from castjeeves.sourcehooks import Sector
@pytest.fixture(scope='module')
def resource_a(request, source_resource):
return Sector(sourcedata=source_resource)
def test_sector_all_names_query_as_list(resource_a):
retval = resource_a.all_names(astype=list)
assert ('Agricu... | true |
993eb88ddc949ac02eaeef488a964353e9ed1b15 | ClemsonRSRG/beginToReason2 | /data_analysis/views.py | UTF-8 | 2,899 | 2.625 | 3 | [
"BSD-3-Clause"
] | permissive | """
This module contains our Django views for the "data_analysis" application.
"""
from django.shortcuts import render, redirect
from accounts.models import UserInformation
from data_analysis.py_helper_functions.lesson_stats import get_main_set_stats, get_main_set_info
from data_analysis.py_helper_functions.graph_view... | true |
b18407f210866b5dcfd9db0621de933810bcc2b7 | NeelamMahapatro/Image-Processing | /lab7/weiner.py | UTF-8 | 1,453 | 2.9375 | 3 | [] | no_license | import numpy
import cv2
import math
import matplotlib.pyplot as plt
image = cv2.imread('cameraman.tif')
m=image.shape[0]
n=image.shape[1]
greyImage = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
#generate A and H(u,v)
cMatrix = numpy.zeros((m,n),dtype= complex)
deg_fun=numpy.zeros((m,n),dtype=complex)
a=0.001
b=0.1
T=1.000... | true |
68d126283502569b303216ca89ea7b0a99980f3e | abirmoy/Python-Everyday | /Data Scraping/BJTU_faculty.py | UTF-8 | 1,291 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Dec 7 19:29:39 2019
@author: Abirmoy
"""
import requests
from bs4 import BeautifulSoup
def html_soup(url):
r = requests.get(url)
html_content = r.text
html_soup = BeautifulSoup(html_content, 'html.parser')
return html_soup
def email_soup(url, element, element_cl... | true |
0ab5eabe31383f77e5e0cc80e5fde52676e9f45b | leogtzr/python-cookbook-code-snippets | /strings_and_text/sanitizing1.py | UTF-8 | 186 | 2.625 | 3 | [] | no_license | import unicodedata
import sys
s = 'pýtĥöñ\fis\tawesome\r\n'
remap = {
ord('\t'): ' ',
ord('\f'): ' ',
ord('\r'): None # Deleted
}
a = s.translate(remap)
print(a)
| true |
92b92e3ad1c963764e63122b013545e5d7e65a88 | CissaNina/Aula1Python | /Nina/Aula9/armazene.py | UTF-8 | 195 | 3.21875 | 3 | [] | no_license | '''Escreva um programa que armaze uma lista com o título
dos contéudos que já aprendemos e mostre os dois ultimos itens'''
aprendendo =['for','booleanas','and','while']
print(aprendendo[2:4]) | true |
77711c128955780bb2ff0eea3c90b4ebfc70e907 | 21368236/1 | /RICHTER.py | UTF-8 | 438 | 3.203125 | 3 | [] | no_license | richter = input("Richter scale")
richter = int (richter)
if (richter >= 8):
print ("Most structures fall")
elif (richter >= 7):
print ("Many buildings destroyed")
elif (richter >= 6):
print ("Many buildings considerably damaged, some collapse")
elif (richter >= 4.5):
print ("Damage to poorly co... | true |
3f50a609e4c90ba93c58c38f4067e2e6de0a01d9 | project-renard-survey/nwb | /branches/epic/fulfilling_dataset/datarequests/models.py | UTF-8 | 1,545 | 2.890625 | 3 | [] | no_license | """
These are the data request models. You work with them as follows:
>>> data_request = DataRequest()
>>> data_request.get_status_display()
u'unfulfilled'
"""
from django.db import models
from epic.core.models import Item
REQUEST_STATUS = (
('U' , 'unfulfilled'),
('F' , 'fulfilled'),
('C' , 'canceled'... | true |
18130e8e87d17ba725db49d6571a421f2b817af6 | hexterisk/cryptopals-solutions | /S01C01.py | UTF-8 | 473 | 2.6875 | 3 | [] | no_license | # Imports
from base64 import b64encode
def main():
# Given
hex_string = "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d"
target_string = "SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t"
byte_array = bytes.fromhex(hex_string)
base64_byte_array =... | true |
bda9b3925ecd783ab1cbe7a9db53335a54f9555b | YuanshengZhao/AlphaZero_Gomoku | /opening_generator.py | UTF-8 | 1,795 | 2.890625 | 3 | [
"MIT"
] | permissive | import random
# apmv(7,7)
# apmv(6,8)
indir=[[5,9],[6,9],[7,9],[8,9],[9,9],
[7,8],[8,8],[9,8],
[8,7],[9,7],
[8,6],[9,6],
[9,5]]
# nms=[["長星 Chosei ","-= "],
# ["峡月 Kyogetsu ","1-0"],
# ["恒星 Kosei ","1-0"],
# ["水月 Su... | true |
dbe9794bfef282cfad2ea35cde077a1057db765e | Aasthaengg/IBMdataset | /Python_codes/p03695/s473795722.py | UTF-8 | 463 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python3
N = int(input())
A = [int(i) for i in input().split()]
rate = [400,800,1200,1600,2000,2400,2800,3200]
R = [False]*len(rate)
red_plus = 0
for a in A:
if a >= rate[-1]:
red_plus += 1
else:
for i,r in enumerate(rate):
if a < r:
R[i] = True
... | true |
a54dccd095b39b355119945b1257e05bdc1186e5 | kester2015/cs231n | /assignment1/hyperparam_plot.py | UTF-8 | 3,007 | 3.25 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def poly_contour_plot(results):
"""
Takes as an input the dict containing tuples
results[(lr,reg)] = (acc_train,acc_val)
Functions fits a 2D-polynomial to the data in log10-space
that is ax^2+by^2+cx+dy*exy+f
Returns a contour plot f... | true |
32ec08abb779f7fcad9c231c179f16cbb8d593c2 | blackwings001/algorithm | /leetcode/51-100/_85_maximalRectangle.py | UTF-8 | 1,412 | 3.296875 | 3 | [] | no_license | class Solution(object):
def maximalRectangle(self, matrix):
"""
:type matrix: List[List[str]]
:rtype: int
"""
if len(matrix) == 0 or len(matrix[0]) == 0:
return 0
row = len(matrix)
col = len(matrix[0])
max_area = 0
heights = [0 fo... | true |
1729d1c93e492b74f996b2f6476857d22af2342e | ZibingZhang/Level-Up | /server/dao/messageDao.py | UTF-8 | 780 | 2.671875 | 3 | [
"MIT"
] | permissive | from constants import cursor
def add_message(player_name, message):
cursor.execute(
"INSERT INTO levelup.messages ("
"SENDER, MESSAGE"
") VALUES ("
"%s, %s"
")", (player_name, message)
)
def reset():
cursor.execute(
"DELETE FROM levelup.messages"
... | true |
717e04adebe8504438351b2ad6ad12f7496f8f57 | codacy-badger/yt-media | /tests/extensions/storage/test_captcha.py | UTF-8 | 540 | 2.8125 | 3 | [] | no_license | """测试验证码"""
import pytest
from smorest_sfs.extensions.storage.captcha import CaptchaStore
class TestCapture:
@pytest.mark.parametrize("key", [("test1"), ("test2"), ("test1")])
def test_save_restore_capture(self, key: str):
store = CaptchaStore(key)
value = store.generate_captcha()
stor... | true |
bbbf7834dab2d15b37ced24371e30fa49ab4f4d3 | Abhishek734/Py-files | /programs/vowels in string.py | UTF-8 | 321 | 3.796875 | 4 | [] | no_license | # vowels in string.py
strr = input("Enter the string : ")
li = []
vowels = ['a','e','i','o','u','A','E','I','O','U']
count = 0
for s in strr:
if s in vowels:
count += 1
print("Vowel Encountered : ",s)
li.append(s)
print("{} volumns are present here".format(count))
print("And they are : ",li)... | true |
7d052cbe8dbd2d9bfad4098e1cab6ca8b0e1827a | mohit266/Python | /JOIN_FUNC.py | UTF-8 | 182 | 4 | 4 | [] | no_license | list = ["Rohan", "Mohit", "Rahul", "Dhiraj", "David"]
# for i in list:
# print(i, "and", end=" ")
# join function
a = " and ".join(list)
b = " , ".join(list)
print(a)
print(b)
| true |
9348ab8fb67a31ac9ecb83068cf2ec8bdc6df9d0 | edwgk/Python_class | /reto1.py | UTF-8 | 330 | 3.53125 | 4 | [] | no_license | #mensajes
'''mas mensajes'''
def promedio_salarial(Laura:int,Juan:int,Andres:int,Sara:int,Natalia:int)->str:
promedio=round(((Laura*3600)+(Juan)+(Andres)+(Sara*3600)+(Natalia*3600))/5,2)
return f'El promedio salarial es: {promedio} pesos colombianos'
pass
print(promedio_salarial(1050,1800000,2750000,2100,... | true |
05a882679c0f2e34162674a0dbb5f6c2e09aa18a | taijiji/python-memo | /merge_sort.py | UTF-8 | 1,110 | 4.125 | 4 | [
"MIT"
] | permissive | def merge_sort(array):
if len(array) <= 1:
return array
middle = len(array) // 2
left = array[:middle]
right = array[middle:]
#print('middle : ' + str(array[middle]))
#print('left : ' + str(left))
#print('right : ' + str(right))
left = merge_sort(left)
right = mer... | true |
88b5b3557a6a2b7f551a95e3d572a8153b59bdbe | alansmello/cursoProgramacaoEmPythonDoBasicoAoAvan-ado | /capitulo 04/Exercicios capitulo 04/exe14.py | UTF-8 | 336 | 4.3125 | 4 | [] | no_license | """
Leia um ângulo em graus e apresente-o convertido em radianos. A fórmula de conversão é: R = G * PI / 180,
sendo G o ângulo em graus e R em radianos e PI = 3.14.
"""
grau = float(input('digite um ângulo em grau: '))
pi = 3.14
radiano = grau * pi / 180
print(f'o valor informado convertido em radiano é igual a {ra... | true |
8729f51e325b40874a5353c6b0ad5a04b29d9133 | ruhinayar/pythonprojects | /fibonacci.py | UTF-8 | 266 | 3.59375 | 4 | [
"MIT"
] | permissive | x = raw_input('How many numbers?')
Last_num = 0
Last_last_num = 1
x=int(x)
while len(Fibonacci_Series) < x:
New_num = Last_num + Last_last_num
Last_last_num = Last_num
Last_num = New_num
Fibonacci_Series.append(New_num)
print Fibonacci_Series
| true |
ecca18cdd0a426ab0976efe026de190ef261188b | leizhen10000/learnPython | /tools/re_train/simple_re.py | UTF-8 | 1,626 | 3.46875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__title__ = ''
__author__ = 'leizhen'
__mtime__ = '2017/8/10'
# code is far away from bugs with the god animal protecting
I love animals. They taste delicious.
┏┓ ┏┓
┏┛┻━━━┛┻┓
┃ ☃ ┃
┃ ┳┛ ┗┳ ┃
... | true |
c1e3ba8bb172701d8b2495fab492c726f967e441 | poohcid/class | /e-Judge/What.py | UTF-8 | 350 | 3.59375 | 4 | [] | no_license | """What"""
def main():
"""function"""
import math
values = float(input())
angle = float(input())
rad = angle*(math.pi/180)
sqr = math.sqrt(angle)
sqr = (angle*math.sin(1.0472)+sqr)**0.5
sqr = ((angle**3)+sqr)**0.5
total = (values*math.cos(rad))-sqr
total = abs(total)*(-1)
pr... | true |
0bbb3aa7bd33b0e8edf6f0b5704f14c382e8f976 | ZakBibi/PracticePython | /CodingPractice/PythonAssignments/excercises/GuessLetters.py | UTF-8 | 213 | 3.1875 | 3 | [] | no_license | def matching_letter(comp_word, user_letter, lst):
for i, e in enumerate(comp_word):
if user_letter == e:
lst[i] = e
def is_game_over(lst, comp_word):
return ''.join(lst) == comp_word
| true |
d19efdf63a9e2a935279d90649e5ba6a944fed2b | Svedrin/ruggers | /benchmark.py | UTF-8 | 1,370 | 2.71875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import sys
import json
import uuid
import random
import socket
import time
def main():
targets = sys.argv[1:]
if not targets:
print("Give me some hosts please")
return 1
targets = [ (ip, int(port)) for (ip, port) in [
target.split(":", 1) for target in targe... | true |
58b20aa4b3eb86990abfb48524eb7d97ca32a24c | yochannah/plenoptic | /plenoptic/tools/display.py | UTF-8 | 43,143 | 3.15625 | 3 | [
"MIT",
"Python-2.0"
] | permissive | """various helpful utilities for plotting or displaying information
"""
import warnings
import torch
import numpy as np
import pyrtools as pt
import matplotlib.pyplot as plt
from .data import to_numpy, torch_complex_to_numpy
try:
from IPython.display import HTML
except ImportError:
warnings.warn("Unable to impo... | true |
8b07e9b5848633aeb8758de3baaf8a554775e7f0 | nathancmoore/data-structures | /binheap.py | UTF-8 | 2,113 | 4.125 | 4 | [
"MIT"
] | permissive | """Define a BinHeap-class object and its nodes."""
class Node(object):
"""Define Node-class objects."""
def __init__(self, index=None, value=None):
"""Assign attributes to the Node object."""
self.index = index
self.value = value
self.left = 2 * self.index + 1
self.rig... | true |
ac04348e91a25ad9dfb886adbd78125a71a83bc0 | Michal-Pos/instagraph | /networkx_tools.py | UTF-8 | 1,627 | 2.734375 | 3 | [] | no_license | import networkx as nx
from networkx.algorithms import community as nxcom
import matplotlib.pyplot as plt
import pandas as pd
import os
edges_path = r'C:\Users\micha\PycharmProjects\instagraph 3.0\data\edges\\'
main_list=['mikeshehad', 'nawrocenie','_kubawilk_', 'rzibi', 'wervel', 'zuciezaleczka']
def creating_data... | true |
865c54bc9160a82cf3c47c80ec8910e3f479ebbc | manichekuri99/Segnet | /utils.py | UTF-8 | 405 | 2.859375 | 3 | [] | no_license | from data import Data
def data_generator(path, batchsize):
while True:
d = Data(path, batchsize)
ret, x, y = d.next()
while ret:
yield x, y
ret, x, y = d.next()
def counter(path, batchsize):
d = Data(path, batchsize)
ret, x, y = d.next()
count = 0
... | true |
17e2db5f0fb30c900fbc844e3361da7eb0d2826a | joaossmacedo/FPL | /fixtures.py | UTF-8 | 3,118 | 3.21875 | 3 | [] | no_license | from team import *
FPL_URL = "https://fantasy.premierleague.com/api/"
teams_dict = get_teams_dict()
def get_every_team_fixtures(first_gameweek: int, last_gameweek: int) -> List[List]:
"""
:param first_gameweek: the first gameweek in the list of fixtures
:param last_gameweek: the last gameweek in the list... | true |
02112f8a559f95973f0575cbaa939ca9d1064d3b | Anjaneyavarma/Python | /python-practice/function.py | UTF-8 | 224 | 3.921875 | 4 | [] | no_license | def add():
a = int(input("Enter a "))
b = int(input("Enter b"))
print(a+b)
add()
#
def oddlist():
lst = [1,2,3,4,5,6]
for i in lst:
if(i%2==1):
print(i, end=" ")
oddlist()
| true |
eea4d69afa11a0e8dd16be0ed732bdba1874e470 | yangyangangela/animate_worm_motion | /label_maker_v2.py | UTF-8 | 17,000 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python
from tkinter import *
from tkinter import filedialog
import tkinter.constants as tkconstants
import pandas as pd
import time
import os
import numpy as np
from copy import deepcopy
from statusMonitor import *
from timeSeriesPanel import *
# The data load from file, can only be read by other fu... | true |
ff33040317bbf4c90c10f89326e6c6dfac7d8fd4 | Vaishnavi-Gajinkar/Bridgelabz | /Week2/Calendar.py | UTF-8 | 3,087 | 3.875 | 4 | [] | no_license | class calender:
def month_starts_on(self,year,month,day=1):
y = year
m = month
d = day
y0 = y - (14 - m) // 12
x = y0 + y0 // 4 - y0 // 100 + y0 // 400
m0 = m + 12 * ((14 - m) // 12) - 2
d0 = int((d + x + (31 * m0 // 12))) % 7 #d0 stores d... | true |
b5c386e63bc3339c4958e307989b67d3915a9bae | FangHaokun/PublicDataMatching | /KeyManager.py | UTF-8 | 2,042 | 2.515625 | 3 | [] | no_license | import socket
from phe import paillier
import pickle
def createKeyPairs():
public_key, private_key = paillier.generate_paillier_keypair()
return public_key, private_key
def createKeyPairsFiles(publicKey, privateKey):
privateFile = open('pkls/privateKey.pkl', 'wb')
pickle.dump(privateKey, privateFile... | true |
683207995ef281a3f5ccb7713046e91f411f2c11 | kasperyvonne/SMD | /Blatt4/plots/Aufgabe3.py | UTF-8 | 6,688 | 2.671875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from functools import reduce
##Einlesen der Daten ##
Pzero = pd.read_hdf('zwei_populationen.h5',key='P_0_10000')
Pone = pd.read_hdf('zwei_populationen.h5',key='P_1')
P01 = pd.read_hdf('zwei_populationen.h5',key='P_0_1000')
p01x = np.array(P01['x']... | true |
b9f11973f396b3a215a6ea6c3b6bbf2fcb2a5f41 | zuodongzhou/DeepLearning | /Projects/TransferLearning/InceptionV3_botteleneck.py | UTF-8 | 2,258 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
# @Author: LiangHaozan
# @Date: 2018-04-12 10:21:50
# @Last Modified by: Marte
# @Last Modified time: 2018-04-12 14:04:34
import tensorflow as tf
import numpy as np
#模型目录
INCEPTION_MODEL_FILE = 'model/classify_image_graph_def.pb'
#BOTTLENECK_FILE = 'test_bottleneck'
# inception-v3模型参数
BOT... | true |
ed851661f7755a460d4c80e64194e1d3a9d229c8 | muratcancicek/Assignment-Projects | /CS401/GG-Project/GG-Project/Sparker/MLlibTests/ParallelStochasticGradientDescent.py | UTF-8 | 1,943 | 2.546875 | 3 | [] | no_license | from .MlLibHelper import *
def fm_gradient_sgd_trick(X, y, W, regParam):
"""
Computes the gradient for one instance using Rendle FM paper (2010) trick (linear time computation)
"""
xa = np.array([X])
x_matrix = xa.T.dot(xa)
VX = xa.dot(W)
VX_square = (xa*xa).dot(W*W)
phi = 0.5*(VX*VX ... | true |
658ce0e5cbe9115dc194ab09373c0159a7f7eec2 | starrain3/Blog-samples | /deeplearning/Tensorflow/basic/tf_03_mnist_cnn.py | UTF-8 | 3,994 | 2.640625 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
def weight_varible(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial)
def bias_variable(shape):
initial = tf.constant(0.1, shape=shape)
return tf.Variable(initial)
def conv2d(x, W):
... | true |
12ce07dfc83338c360a60a1faaaa9af9b21ee433 | durgas4/Python---DS-and-Algo-assignments- | /solution5.py | UTF-8 | 2,619 | 3.96875 | 4 | [] | no_license | #The library at the Hogwarts School of Witchcraft and Wizardry has computerized its book issuing process.
#The relevant information is provided as text from standard input in three parts: information about books,
#information about borrowers and information about checkouts. Each part has a specific line format, descr... | true |
55354e2e5013fc7f10d165417fe6513ea248f66e | msabramo/happy | /happy/__init__.py | UTF-8 | 854 | 3.09375 | 3 | [
"MIT"
] | permissive | """
Quickly set up and tear down Heroku apps!
"""
from .heroku import Heroku
from time import sleep
def create(tarball_url):
"""Creates a Heroku app-setup build.
:param tarball_url: URL of a tarball containing an ``app.json``.
:returns: A tuple with ``(build_id, app_name)``.
"""
api = Heroku()
... | true |
ad0aa6f55c36ed8525f2fc7b4fbace6f381274fa | Nicolas-Constanty/sentimentAnalysisWebApp | /sentimentAnalysisWebApp/app/python/libTwitterAnalysis.py | UTF-8 | 3,439 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python3
import tweepy
import os
import requests
import json
import time
from nltk.sentiment.vader import SentimentIntensityAnalyzer as SIA
import nltk
import requests
import json
import time
from nltk.sentiment.vader import SentimentIntensityAnalyzer as SIA
import nltk
import time
nltk.download('vader_... | true |
0982255b420a513d8dc9702a5b59b283ebd7bf2c | MDCGP105-1718/portfolio-Ellemelmarta | /Python/ex2.py | UTF-8 | 1,330 | 4.78125 | 5 | [] | no_license | print("These are how many animals I have:")
print("Cows", 15+30/6)
#The + sign is doing addition and the / sign is doing division.
print("Sheep", 100-30*3%4)
#The - sign is doing subtraction and the * sign is doing multiplication.
print("Now I will count my plants:")
print(3+2+1-5+4%2-1/4+6)
#Calculation for plants.
... | true |
f593bcf434ee16df87a54e81287871c853a361e9 | OneOneFour/NeuralSnake | /snake.py | UTF-8 | 6,675 | 3.1875 | 3 | [] | no_license | import pygame
from abc import ABC, abstractmethod
import math
import random
import numpy as np
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
class Game:
def __init__(self,network,score, width=400, height=400):
self.width, self.height = width, height
self.isRunning = True
self.screens = []
... | true |
b02ed1de19b9fc54c695edd0aca7b3f515891179 | solitaryzero/XLink | /modules/WordManager.py | UTF-8 | 1,459 | 2.8125 | 3 | [] | no_license | """
WordManager holds all words who have embeddings.
"""
from modules.VecModel import VecModel
class WordManager:
vec_model = None # type: VecModel
def get_word_vec_model(self, vec_path=""):
if self.vec_model is None:
self.vec_model = VecModel(vec_path)
return self.vec_model
... | true |
1655d0f955ab8e2519d7e106672e5e22a48bb4ad | malekijoo/P-DecovNet | /Processing.py | UTF-8 | 1,630 | 2.5625 | 3 | [] | no_license | import tensorflow as tf
def preprocess(image, label=None, height=360, width=480):
if image.dtype != tf.float32:
image = tf.image.convert_image_dtype(image, dtype=tf.float32)
image = tf.image.resize_image_with_crop_or_pad(image, height, width)
image.set_shape(shape=(height, width, 3))
if not ... | true |
f9588fe55b28fede86e3f9dc455e0a440260d603 | bartselen/heights-solutions | /20.3/portscanner.py | UTF-8 | 802 | 2.921875 | 3 | [] | no_license | # BT Port Scanner - Exercise 6.19 Solution
from scapy.all import sr1, IP, TCP
print "[BT PORT SCANNER]\n"
dest = raw_input("Enter destination IP address: ")
for i in range(20, 1025):
tcp_seg = TCP(dport=i, sport=2057, flags='S')
tcp_packet = IP(dst=dest)/tcp_seg
tcp_res = sr1(tcp_packet, timeout=1, verbos... | true |
5eb8db554d03e1d8dec8d20645cfa94e13a3fd53 | Holert/HMMER-DB | /GenbankToFASTAandOrganismTableRow.py | UTF-8 | 7,329 | 3.0625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
Created by: Lee Bergstrand
Description: A program that extracts the proteins annotations from a Genbank file and as well as some
information about the organism in the file. Stores the protein annotations as a Fasta.
Appends organism info to a csv file.
Requirements: - This script... | true |
441948d85af250a406f16b4bdd011b7efcc6fd78 | avishayp/simcoin | /code/tests/test_bash.py | UTF-8 | 462 | 2.546875 | 3 | [
"MIT"
] | permissive | import bash
from mock import patch
from mock import mock_open
@patch('subprocess.check_output')
def test_check_output(mock):
mock.return_value = b'test\ntest\ttest\t\n\n'
output = bash.check_output('cmd')
assert output == 'test\ntest\ttest'
@patch("builtins.open", mock_open())
@patch('subprocess.call'... | true |
0bbbade47ada678c8898417c628084a036371252 | Sberlos/AI2019 | /src/genetic.py | UTF-8 | 11,792 | 2.828125 | 3 | [] | no_license | import numpy as np
import random
import os
if 'AI' in os.getcwd():
from src.utils import *
else:
from AI2019.src.utils import *
from src.constructive_algorithms import *
from src.local_search import *
class Genetic:
@staticmethod
def gen(solution, instance, populationSize=30, mutationRate = 0.015,
... | true |
37da4b567d5df074a1c3846e8f5e93ff3d58082f | DavidGugea/Data-Structures | /Data structures ( code in python )/Linear Data Structures/Stack ( Python Code )/Tutorials and tests/Stack_BeginTutorial.py | UTF-8 | 576 | 4.0625 | 4 | [] | no_license | class Stack():
def __init__(self):
self.items = list()
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()
def is_empty(self):
return self.items == list()
def peek(self):
if self.items:
return self.items[len(s... | true |
6c45528405a81a92f047b651feb1d2018fbf1a8f | AndresPitta/DSCI_522_Group-308_Used-Cars | /scripts/eda.py | UTF-8 | 6,044 | 3.109375 | 3 | [
"CC-BY-2.5",
"MIT"
] | permissive | # authors: Andres Pitta, Braden Tam, Serhiy Pokrovskyy
# date: 2020-01-24
'''This script will generate exploratory data analysis visualizations. It takes as arguments the file were the root
file is, the path where the visualizations will be saved.
Usage: eda.py [--DATA_FILE_PATH=<DATA_FILE_PATH>] [--EDA_FILE_PATH=<E... | true |
a32d1459be88358ea5e132a76293129520f98e8a | nik-weter/pybursa | /3/task2.py | UTF-8 | 593 | 3.34375 | 3 | [] | no_license | # -*- utf8 -*-
def get_max_len(s):
max_len = 0
max_words = []
s = s.strip()
s = s.replace('.', '')
words = s.split()
for word in words:
if len(word) > max_len:
max_len = len(word)
for word in words:
if len(word) == max_len:
max_words.append(word)
r... | true |
8b838b9d41a81abd725e0a4fd830e7084fb05a4e | Kibur/PyPotArduino | /arduinoserial.py | UTF-8 | 1,091 | 3.03125 | 3 | [] | no_license | __author__ = 'Kibur'
import sys
from serial import Serial, SerialException
import time
class ArduinoSerial:
def getSerialPort(self):
return self._port
def getBaudRate(self):
return self._bps
def __init__(self, port, bps=9600):
self._port = port
self._bps = bps
tr... | true |
359bbe7487bdefe11ea31db2a37ec08033cda905 | erkghlerngm44/aniffinity | /tests/test_affinity_calculations.py | UTF-8 | 1,944 | 2.609375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | import mock
import malaffinity
from . import const
from . import mocks
from . import vcr
@vcr.use_cassette("test-user.yaml")
def test_affinity__unrounded_with_dummy():
"""
Test affinity with DUMMY_LIST
"""
ma = malaffinity.MALAffinity(const.TEST_USERNAME, round=False)
with mock.... | true |
2c2f25fc5f3d3a0281abbab3dff26c967d367bdf | theGuyWithBlackTie/Deep-Extreme-Multi-Label-Learning | /model.py | UTF-8 | 834 | 2.671875 | 3 | [
"MIT"
] | permissive | import torch.nn as nn
import torch.nn.functional as F
class DXML(nn.Module):
def __init__(self, x_dimension, mid_embedding_size, resultant_embedding_size, dropout = 0.1):
super(DXML, self).__init__()
self.W1 = nn.Linear(x_dimension, mid_embedding_size)
self.RELU = nn.ReLU()... | true |
da066bce48438c3cfa7f7d3dbb785e8256628199 | h4rm41n/kelas-python-basic | /latihan_4.py | UTF-8 | 253 | 3.078125 | 3 | [] | no_license | # operator perbandingan
# convarison operator
# ==
# <=
# >=
# <
# >
var_1 = 8
var_2 = 5
print(int((var_1 == var_2)))
print(int((var_1 <= var_2)))
print(int((var_1 >= var_2)))
print(int((var_1 > var_2)))
print(int((var_1 < var_2)))
print(var_1!=var_2) | true |
2e0c7a4211f74e13a50b205ce587936088c3c218 | GoodluckTian/PointRCNN-1 | /utils/parameterize.py | UTF-8 | 4,594 | 2.859375 | 3 | [] | no_license | import numpy as np
import math
CENTER_SEARCH_RANGE = 3.0 # in meters
NUM_CENTER_BIN = 12
CENTER_BIN_SIZE = CENTER_SEARCH_RANGE * 2 / NUM_CENTER_BIN # in one direction
NUM_HEADING_BIN = 12
NUM_OBJ_CLASSES = 4
# Car, Pedestrian, Cyclist
type_mean_size = np.array([[3.88311640418,1.62856739989,1.52563191462],
[0.8442... | true |
8eb535734b22f54ff349e60582fc118f5bab58cc | akshitshah702/Akshit_Task_5 | /# Task 5 Q4.py | UTF-8 | 329 | 3.5625 | 4 | [] | no_license | # Task 5 Q4
print('Enter correct username and password')
count=0
while count < 3:
username = input('Enter username: ')
password = input('Enter password: ')
if password=='Abcd@123' and username=='admin':
print('Access granted')
break
else:
print('Write password again')
cou... | true |
d6ac2734d064f23f57b4a46560ffb4de94574ad0 | MattGring/Python | /SQL_Select_Test.py | UTF-8 | 596 | 2.765625 | 3 | [] | no_license | import pyodbc
# create the connection
print("Attempting to connect to SQL Server...\n")
cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=PC763\SQL;DATABASE=Stocks;UID=sa;PWD=perry')
print("Successfully connected to SQL Server!\n")
#create the cursor
cursor = cnxn.cursor()
cursor.execute("select distinct * from tbl... | true |
3baa91095e1611f858e7c9bcb472153f8f7a5a38 | Labbeti/MLU | /mlu/utils/types.py | UTF-8 | 4,154 | 3.796875 | 4 | [
"MIT"
] | permissive |
import math
from typing import Callable, Optional, Union
def str_to_bool() -> Callable[[str], bool]:
"""
Convert a string to bool. Case insensitive.
- x in ["true", "1", "yes", "y"] => True,
- x in ["false", "0", "no", "n"] => False,
- _ => RuntimeError
:returns: The function for convert a value to the... | true |
588d3b95b5e4361681f6ace70c7e574396a9330b | maybe-another-name/pyppeteer-testing | /pyppeteer_connect_testing.py | UTF-8 | 1,045 | 2.5625 | 3 | [] | no_license | import asyncio
from pyppeteer import connect
# this expects the browser be started with remote debugging enabled, for example:
# chromium --remote-debugging-port=9222
# it will then report it's id, as follows:
# DevTools listening on ws://127.0.0.1:9222/devtools/browser/e3b807df-40cb-4922-97bb-2e8ffc519d7... | true |
67ee02f323f6de8f5abcc23efeea8ab732bd4f1a | Semert/Algorithms-Data-Structures | /HackerRank/E - Taum and B'day.py | UTF-8 | 259 | 2.921875 | 3 | [] | no_license | # https://www.hackerrank.com/challenges/taum-and-bday/problem
def taumBday(b, w, bc, wc, z):
diff=abs(bc-wc)
if diff<=z:
return b*bc+w*wc
else:
if bc>wc:
return (b+w)*wc+b*z
else:
return (b+w)*bc+w*z | true |
4cf5dfd957f9fbf9249982959e5606258a89bf14 | jrz371/IntroToNurbsPython | /BezierDerivatives.py | UTF-8 | 2,103 | 3.140625 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
from BezierMatrix import MatrixBezier
from Bezier import BernsteinBasis
def BernsteinFirstDerivative(n, i ,t):
return (i - n * t) / (t * (1. - t)) * BernsteinBasis(n, i, t)
def BernsteinSecondDerivative(n, i, t):
numerator = pow(i - n * t, 2) - n * pow(t, 2) ... | true |
1d281aa867253fcb130ab435da2c9f58717cf4b2 | gistable/gistable | /all-gists/4b09ad285340c8ec2661/snippet.py | UTF-8 | 7,993 | 3.859375 | 4 | [
"MIT"
] | permissive | # maybe.py - a Pythonic implementation of the Maybe monad
# Copyright (C) 2014. Senko Rasic <senko.rasic@goodcode.io>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, in... | true |
d931d00d074ebb0c736885c7c8483e32fe29ec40 | shubham-debug/Python-Programs | /uglyNumberDp.py | UTF-8 | 566 | 3.53125 | 4 | [] | no_license | # ugly numbers dp
def solve(n):
ugly = [0 for i in range(n)]
ugly[0] = 1
i2 = i3 = i5 = 0
n2 = 2
n3 = 3
n5 = 5
for i in range(1,n):
ugly[i] = min(n2,n3,n5)
if(ugly[i] == n2):
i2 += 1
n2 = ugly[i2]*2
if(ugly[i] == n3):
... | true |
60cccbac5aa2b5d1ee708986e65aa28ea435abc5 | performance12345/RISPerformance | /common/DateTimeData.py | UTF-8 | 1,136 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/2/26 14:29
# @Author : Zhangyp
# @File : DateTimeData.py
# @Software: PyCharm
# @license : Copyright(C), eWord Technology Co., Ltd.
# @Contact : yeahcheung213@163.com
import datetime
def today_horizon2str(): # '2020-02-26 00:00:00|2020-02-26 23:59:5... | true |
693baabca1da04436d0294c440009280fd6dfc37 | nepomnyashchii/TestGit | /old/old08092019/pandas/024.py | UTF-8 | 265 | 3.15625 | 3 | [] | no_license | # importing pandas module
import pandas as pd
# making data frame
df = pd.read_csv("zillow.csv", index_col=0, skipinitialspace=True)
ser = pd.Series(df["Beds"])
print(ser)
data = ser.head(10)
print(data)
data=data[3:6]
print(data)
data=data.loc[3:6]
print(data)
| true |
1fabb44163d639ac79ca76f8e5f9fca8ff121c89 | stummalapally/Week2 | /rounding.py | UTF-8 | 214 | 3.859375 | 4 | [] | no_license | #List numbers from 0 to 10, divide each by 3,
# print result as 2 decimal places
#round()
#format()
divisor=3
decimal_places=2
for i in range(0,11):
print("This is my rounded decimal{0:.2f}".format(i/divisor)) | true |
cbbef0f61d02d213e02e75ba7fd4a0c1a8b18cd2 | cinemanjac/skillfactory | /module_0/test1.py | UTF-8 | 2,076 | 4.0625 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
import numpy as np
# In[ ]:
def game_core_v3(number):
'''Устанавливается произвольное число в диапозоне от 1 до 100.
Затем диапозон произвольного числа изменяется и значение перезадается в новом диапозоне в зависимости от того, больше произвольное число или ... | true |
77654bbbe926cffe650124732b63d449a43bbe05 | jaelyangChoi/CodingTest | /bfs/성곽.py | UTF-8 | 1,797 | 3.3125 | 3 | [] | no_license | # https://www.acmicpc.net/problem/2234
"""벽 하나 부수기 => 완전 탐색으로 하나하나 부숴본다"""
# bfs 기록해둔 것 활용하기 위해, 영역 번호와 넓이 기록
from collections import deque
def bfs(i, j, sect, sect_no):
# check = [[False] * m for _ in range(n)] 있는 정보 활용해
sect[i][j] = sect_no # 영역 번호 새기기
q = deque()
q.append((i, j))
space = 0
... | true |
e747b6330f00021f517e629003bcbef608cdd37e | bgoonz/UsefulResourceRepo2.0 | /_REPO/MICROSOFT/c9-python-getting-started/more-python-for-beginners/07_-_Reading_and_writing_files/manage.py | UTF-8 | 385 | 3.46875 | 3 | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | permissive | # Open manage.txt file to write text
stream = open("manage.txt", "wt")
# Write the word demo to the file stream
stream.write("demo!")
# Move back to the start of the file stream
stream.seek(0)
# write the word cool to the file stream
stream.write("cool")
# Flush the file stream contents to the file buffer
stream.fl... | true |
be67de8d49ffee73f04ca8d725c96ce9332065ea | coolxv/DL-Prep | /04_Algorithms/Leetcode/myDFS.py | UTF-8 | 3,084 | 3.234375 | 3 | [] | no_license | from collections import defaultdict
## geeks for geeks version
class Graph:
def __init__(self):
# default dictionary to store graph
self.graph = defaultdict(list)
# function to add an edge to graph
def addEdge(self, u, v):
self.graph[u].append(v)
# A function used ... | true |
ea0b649e4466c092b3df2c77e145b27cc20d837c | morningsky/target-offer | /014-剪绳子/014-剪绳子-贪心.py | UTF-8 | 1,018 | 3.90625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu May 03 10:47:29 2018
@author: sky
"""
"""
用贪婪算法实现剪绳子问题
"""
"""
用贪婪算法时,每一步都可以做出一个贪婪选择,基于这个选择,我们能确定的到最优解?同时需要用数学证明这个贪婪选择是对的。
当n>=5时,可证2(n-2)>n且3(n-3)>n,就是说当绳子长度大于等于5时可以切成2或3。另外当n>=5时,3(n-3)>=2(n-2),因此要竟可能剪出长度为3的段。
当长度为4时2*2>1*3,所以要切成2*2的段
"""
def maxProductAfterCutting(length... | true |
e1c2ae80021263face3af89c12f26fcaaf8ac042 | ploxiln/host_pool | /test_host_pool.py | UTF-8 | 883 | 2.71875 | 3 | [] | no_license | """
this is a py.test test file
"""
import host_pool
def test_basic():
pool = host_pool.HostPool(['a', 'b', 'c'])
assert [pool.get(), pool.get(), pool.get(), pool.get()] == ['a', 'b', 'c', 'a']
pool.failure('a')
pool.failure('b')
assert pool.get() == 'c'
pool.success('c')
assert pool.get()... | true |
55aea89083f7e6421567d3588c1492e74af642a7 | porrizxx/AutoTest | /thread.py | UTF-8 | 533 | 3.515625 | 4 | [] | no_license | import time
import threading
def run():
print(threading.current_thread().getName(), "开始工作")
time.sleep(2) # 子线程停2s
print("子线程工作完毕", time.ctime())
for i in range(3):
t = threading.Thread(target=run, )
t.setDaemon(True) # 把子线程设置为守护线程,必须在start()之前设置
t.start()
if __name__ == '__main__':
t... | true |
47eccda76e786860ee76cba16f685384cb189c0b | NihalNazim33582/c99 | /c99/organizing.py | UTF-8 | 476 | 3.390625 | 3 | [] | no_license | import os
import shutil
path=input('Enter the name of the directory you would like to organize: ')
NumOFolders=os.listdir(path)
for num in NumOFolders:
name,extention=os.path.splitext(num)
extention=extention[1:]
if extention=='':
continue
if os.path.exists(path+'/'+extention):
shuti... | true |
7ffc6254e43a0f13dfb2e77a4ef1233bac8fb016 | jki14/competitive-programming | /2021/atcoder.jp/abc/218/prod.py | UTF-8 | 738 | 2.875 | 3 | [] | no_license | from sys import stdout
def solution(s):
n = len(s)
d = {}
for p in s:
if p[0] not in d:
d[p[0]] = {}
d[p[0]][p[1]] = True
res = 0
for p in s:
for q in s:
if p[0] < q[0] and p[1] < q[1]:
if q[1] in d[p[0]]:
if p[1] ... | true |
4b3d13d8e7e525e704c1d9974c124fb45001c5b3 | chlxry/cp2019 | /practical_3/q7_convert_ms_to_hours_minutes_seconds.py | UTF-8 | 563 | 4.375 | 4 | [] | no_license | # Write a method convert_ms(n) that converts milliseconds to hours, minutes, and seconds.
# The method returns a string as hours:minutes:seconds.
# For example, convert_ms(5500) returns a string 0:0:5,
# convert_ms(100000) returns a string 0:1:40,
# and convert_ms(555550000) returns a string 154:19:10.
def convert... | true |
ce2beb4ecd2f7d9eb5b3471ee0884aab75c78acd | toradex/torizon-samples | /sht31/sht31-influxdb/gps/gps.py | UTF-8 | 992 | 2.765625 | 3 | [
"Unlicense"
] | permissive | #!/usr/bin/python3
import sys
import pynmea2
import serial
class GPS:
def __init__(self, pname,brate,timeout):
self.port_name = pname
self.baud_rate = brate
self.timeout = timeout
try:
self.ser = serial.Serial(self.port_name,self.baud_rate, 8, 'N', 1, self.timeout)
except:
... | true |
21845ef20d9992cb9f0e8f53c11fba9069a0e50d | csingh/PythonFunctionTest | /FunctionTester.py | UTF-8 | 2,527 | 3.375 | 3 | [] | no_license | import inspect
from PurrdyPrinter import *
import traceback
class FunctionTester:
def __init__(self, function):
self.function = function
self.args = inspect.getargspec(function).args
self.tests = []
def numArgs(self):
return len(self.args)
def addTest(self, expected_val, *... | true |
efe0bb09b1141f45aab3924295354bfa67c998cb | slayer321/Graduate_Admissions_Prediction | /streamlit-app/rest/app.py | UTF-8 | 4,793 | 2.6875 | 3 | [
"MIT"
] | permissive | from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score ,mean_squared_error
from sklearn.tree import DecisionTreeRegressor
from sklearn.ensemble import RandomForestRegressor
from sklearn.neighbors import KNeighborsRegressor
from sklearn.svm import SVR
from sklearn.ensemble ... | true |
88c36849c268200d1c1ae9a9b80172194db09a2e | Hodaaa/Test | /GUI.py | UTF-8 | 10,067 | 2.828125 | 3 | [] | no_license | from Tkinter import *
from PIL import Image, ImageTk
from play import run
buttons =''
class GUI:
background = None
def __init__(self, root):
self.root = root
root.title("Reversi Game")
root.configure(background="#CFFFBF")
self.background_image = PhotoImage(file="Media/Backgro... | true |
4ad5309e473caf34b34b656c7d1336d9aa7c17d1 | kylepw/ctci | /q43.py | UTF-8 | 2,177 | 4.40625 | 4 | [
"MIT"
] | permissive | """
q43.py
~~~~~~
List of Depths: Given a binary tree, design an algorithm which creates
a linked list of all the nodes at each depth (e.g. if you have a tree
with depth D, you'll have D linked lists).
Hints: #107, #123, #135
"""
from math import log
import unittest
class Node:
def __init... | true |
04acb3d3921c37d0168669ba0a41cdd0fb431d11 | codeformuenster/muenster-dashboard | /import-scripts/stillplaetze/stillplaetze.py | UTF-8 | 1,725 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import csv
import re
from elasticsearch import Elasticsearch
def main():
"""The class's docstring"""
elasticsearch_url, index_prefix = os.environ['ELASTICSEARCH_URL_PREFIX'].rsplit("/", maxsplit=1)
elastic = Elasticsearch(elasticsearch_url)
w... | true |
5ae7a2b968853b7127655cc170b14f61583bb300 | fengjixuchui/IDAPythonEmbeddedToolkit | /find_mem_accesses.py | UTF-8 | 4,870 | 2.890625 | 3 | [
"MIT-0",
"MIT"
] | permissive | ##############################################################################################
# Copyright 2017 The Johns Hopkins University Applied Physics Laboratory LLC
# All rights reserved.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentati... | true |
b0bbacba19ed643a659d432e892400cc4e83f04a | gursharan-info/punjabiqa | /qa/cogm.py | UTF-8 | 7,911 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, division
import numpy as np
import math
from collections import Counter
import relationship_calulator as rc
import bonus
# Calculates CoGM (Center of Gravity Metric) value
lex_words = [
'N_NN',
'N_NNP',
'V_VM',
'V_VM_VNF',
'V_VM_VINF... | true |
7325c4db25422bf3882c82a9335edf1f31a533d3 | Prashant-mahajan/Python-Codes | /Hackerrank/Algorithms/jumpingOnTheClouds.py | UTF-8 | 278 | 3.015625 | 3 | [] | no_license | # Problem: https://www.hackerrank.com/challenges/jumping-on-the-clouds/problem
#!/bin/python3
n = int(input())
c = list(map(int, input().rstrip().split()))
count = -1
i = 0
while(i<n):
if i < n-2 and c[i+2] == 0:
i += 1
i += 1
count += 1
print(count)
| true |
c2cb2ede2c6dfe5cd149c7dabfda612e013410fa | preethamsridhar/advancedPython | /graphDensity.py | UTF-8 | 564 | 3.25 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Thu May 2 15:19:01 2019
@author: preet
"""
from graphTheory2 import Graph
g = { "a" : ["d","f"],
"b" : ["c","b"],
"c" : ["b", "c", "d", "e"],
"d" : ["a", "c"],
"e" : ["c"],
"f" : ["a"]
}
complete_graph = {
"a" : ["b","c"],
"b" : ["a... | true |