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 |
|---|---|---|---|---|---|---|---|---|---|---|
4b809e907f8b1c74fbbcf71986bae992f5c73ed3 | creator110/raspberry | /taster.py | UTF-8 | 736 | 3.234375 | 3 | [] | no_license | # wenn der Taster auf Pin 18 betaetigt wird,
# Blinkt die LED kurz auf
import RPi.GPIO as GPIO
import time
# Pin-Nummer wie auf dem Raspberry verwenden
GPIO.setmode(GPIO.BOARD)
# Pin 18 als Input deklarieren und Pull-Down Widerstand aktivieren
GPIO.setup(18, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
# Pin 7 als Output d... | true |
66635374d8dbf0da48bc9fe24835370fbbb4635a | Pohjois-Tapiolan-lukio/raspberry_pi-projects | /projects/rc-car/microbit_controlled_car/usb_serial_microbit_controlled_car.py | UTF-8 | 2,792 | 2.671875 | 3 | [] | no_license | # Usb-kaapelilla autoon kytketyn kiihtyvyysanturi toimii auton
# ohjaimena. Kallistele microbittia.
# Tyo havainnollistaa Raspberry pi:n ja microbitin valista vuorovaikutusta
# usb-serialin kautta
from time import sleep
# from l293d_pwm import L293DPWM
from drv8835 import DRV8835
# from testing_motor import TestingMoto... | true |
464a3f9556bdf7f91d4f3c12a94e4dd0351c5a15 | blue157751/estudoPython | /ex013.py | UTF-8 | 180 | 3.28125 | 3 | [] | no_license | preço = float(input('quanto custava o produto que você deseja comprar?'))
cinco = preço*5/100
print('com 5% de desconto, o produto irá custar R$:{:.2f}'.format(preço-cinco))
| true |
cd8013b5438613bfb53518d2c527d78eec8f654f | Demenkop/tgautopost | /main.py | UTF-8 | 1,119 | 2.625 | 3 | [] | no_license | import os, random, time
import telebot
#imports
workfolder = "/path/to/your/folder" #полный путь к папке
timetospeep = 1800 #промежуток между постами в секундах
token = "" #Токен бота
channelid = "" #айди канала где бот в админах
#variables
bot = telebot.TeleBot(token)
@bot.message_handler(commands=['sta... | true |
ecf39c1a30fc6118ace4774730dfc2671d74d26f | fjfhfjfjgishbrk/AE401-Python | /zerojudge/a244.py | UTF-8 | 370 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 26 20:41 2020
@author: fdbfvuie
"""
n = int(input())
for i in range(n):
a = [int(j) for j in input().split(" ")]
if a[0] == 1:
print(a[1] + a[2])
if a[0] == 2:
print(a[1] - a[2])
if a[0] == 3:
print(a[1] * a... | true |
a9e4ee7d4907dafabebf7ed4af717cb9e9e61baa | saikiranece043/ciphers | /src/ciphers/vigenecipher.py | UTF-8 | 2,195 | 2.78125 | 3 | [] | no_license | import src.ciphers.preprocess as pre
import os
import src.attackciphers.attackVigenere as av
import matplotlib.pyplot as plt
from scipy.signal import argrelextrema
from scipy.signal import argrelmax
from scipy.signal import find_peaks
import numpy as np
import math
"""This program is used to implement vigenere cipher t... | true |
753e3a20c32e2aea966c19117c53c6d3d158ea74 | silverstar03/python-study | /pangram.py | UTF-8 | 206 | 3.28125 | 3 | [] | no_license | def is_pangram(target):
alphabets = "abcdefghijklmnopqrstuvwxyz"
target = target.replace(" ", "").lower()
for a in alphabets:
if a not in target:
return False
return True | true |
63601b127ea6eb1b502f83a6651fa9db1e65bc51 | SuperFola/HashCode | /hashcode/hc_parser.py | UTF-8 | 1,991 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python3
# coding: utf-8
from . import evalfile, pexist, gob, fbasenoext, fbasename, rm_eol
from . import rlines, prtnice, reporter, dcopy
from typing import List, Tuple
@reporter("hc_parser.reader")
def reader(fields: List[Tuple[str, type]], filename: str, callback) -> dict:
content = None or rlin... | true |
cfcea40aebae17225fb64e630f043bfc439afced | DiegoSGIT/pythonexercises | /examples/functions.py | UTF-8 | 71 | 3.046875 | 3 | [] | no_license |
factorial(a=3,b=4,c='hola')
def factorial(**args):
print(args)
| true |
ce06caf765a78bfaaf5c0cb9c603470d4d9519a8 | Aasthaengg/IBMdataset | /Python_codes/p02646/s269228410.py | UTF-8 | 192 | 3.09375 | 3 | [] | no_license | A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
set_position = abs(B-A)
move = V-W
if move*T >= set_position:
print("YES")
else:
print("NO") | true |
104aff57742ebeaf7627e7d22c7cb853dbdc51fb | whglamrock/leetcode_series | /leetcode445 Add Two Numbers II.py | UTF-8 | 1,858 | 3.328125 | 3 | [] | no_license |
from collections import deque
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def addTwoNumbers(self, l1, l2):
if (not l1): return l2
if (not l2): return l1
head1, head2 = l1, l2
len1, len2 = 0, 0
... | true |
e1607ac770f95ae6126501246f281a3718d83538 | mukeshslg/pythonSampleCode | /com/packone/Day2Demo2.py | UTF-8 | 4,760 | 3.671875 | 4 | [] | no_license | import sys
import random
import os
from functools import reduce
import math
'''
Basic data types:
integer,String,float,complex numbers,booleans
'''
# print(type(10))
# print(type(10.5))
# print("integer max size:", sys.maxsize)
# print(sys.float_info.max)
#
# # real + imaginory
# f=9+4j #legal in python
# print(f)
... | true |
b60a9ab58e44720ab874dfe2e17e8ad4240b722f | ZhaoyueCheng/Image-Style-Recognition | /Pre-Code/rotate.py | UTF-8 | 926 | 2.546875 | 3 | [] | no_license | from PIL import Image
import random as rd
def imgRandomTrans (img):
img = img.rotate(rd.randint(-45,45))
scaleR = rd.uniform(0.77,1.3)
img = img.resize((int(img.height*scaleR),int(img.width*scaleR)))
if rd.randint(0,1)==1 :
img = img.transpose(Image.FLIP_LEFT_RIGHT)
return img
for i in range(1,7001):
imageName... | true |
48b9341b57e0cbf11448cc2c9408d688e27e9452 | Akanksha-Verma31/Python-Programs | /loop7.py | UTF-8 | 64 | 3.1875 | 3 | [] | no_license | # for first 10 odd numbers
for i in range(1,20,2):
print(i)
| true |
4b25d4cfe005798e3f047418fac26bac45ed39c6 | xandrefreire/frikr_talentum | /frikrapp/photos/forms.py | UTF-8 | 959 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from django import forms
from models import Photo
class LoginForm(forms.Form):
user_username = forms.CharField(label="Nombre de usuario")
user_password = forms.CharField(label="Password", widget=forms.PasswordInput())
# lista de tacos http://goo.gl/G2nCu7
#BADWORDS = (u'aparcabicis',... | true |
04ee6206c40fcc55342fe90dd4c608bd1d58d212 | jonathancox1/Python105 | /import_export_to_json.py | UTF-8 | 427 | 2.609375 | 3 | [] | no_license | # DONT RUN THIS CODE #
# NOTE TAKING ONLY #
####################
#how to save a variable to a .json file on the HDD
import json
file_name = 'my_file.json'
with open(file_name, 'w') as file_to_save:
json.dump(python_variable_to_save, file_to_save)
#how to import a variable from a .json file
import json
file_name... | true |
230092558b14d1e72a58f23327abf072be22216b | VitrSantos/cursoemvideo | /ex070.py | UTF-8 | 691 | 3.84375 | 4 | [] | no_license | tot = tot1000 = cont = menor = barato = 0
while True:
produto = str(input('Digite o nome do produto: '))
preço = int(input('Preço: R$ '))
tot += preço
cont += 1
if preço >= 1000:
tot1000 += 1
if cont == 1 or preço < menor:
menor = preço
barato = produto
resp =' '
... | true |
d29b2631794f351f934f3e59e1d40aff03376ce7 | geroge-gao/Algorithm | /LeetCode/python/21_合并两个有序链表.py | UTF-8 | 527 | 3.140625 | 3 | [] | no_license | class Solution:
def mergeTwoLists(self, l1, l2):
head = ListNode(0, None)
node = head
p = l1
q = l2
while p is not None and q is not None:
if p.val <= q.val:
node.next = p
node = p
p = p.next
else:
... | true |
dacffbd08ab41d278e4893746b4db45a4f3d0c43 | M-Sabrina/AdventOfCode2020 | /Tag-13/shuttle_search2.py | UTF-8 | 1,855 | 3.5 | 4 | [] | no_license | import numpy as np
# brute force: test works, but real thing runs for ever and ever and ...
# def shuttle_search2(contents):
# notes = contents.splitlines()
# lines_list = notes[1].split(",")
# lines = np.array([int(i) if i != "x" else 0 for i in lines_list])
# n = 1
# found = False
# while True:
# ... | true |
e29e7c01ed08fc5cef0d2eeb50da36e3c86ffa25 | Ryuji-commit/AtCoder-Python | /ABC165/165_B.py | UTF-8 | 163 | 3.125 | 3 | [] | no_license | import math
X = int(input())
now = 100
count = 0
while(True):
count += 1
now = math.floor(now * 1.01)
if now >= X:
print(count)
break
| true |
1e504eec271bbc940323b433faf0f7b9c670fc3d | Vemnym/vk_to_telegram_bot | /main/main.py | UTF-8 | 5,088 | 2.59375 | 3 | [] | no_license | import random
import psycopg2
import requests
import telebot
import config
import re
import bitlyshortener
# Setup short_maker_url
shortener = bitlyshortener.Shortener(tokens=config.shortcut_token, max_cache_size=256)
# Setup telegram bot
bot = telebot.TeleBot(config.telegram_TOKEN)
@bot.message_handler(commands=[... | true |
74aef04d11425068d4324ae42b10a831451d19bc | vu1seek/Non-uniform-cues | /Backbone/dataset.py | UTF-8 | 7,599 | 2.609375 | 3 | [] | no_license | from __future__ import print_function, division
import cv2
import numpy as np
import random
import torch
import time
import os
import imgaug.augmenters as iaa
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms
from skimage.feature import local_binary_pattern
# np.array
class RandomEra... | true |
8058a16a5adca470ecb21a8abb893dda58ec53cb | petrfejfar/reinforcement-learning-inverted-pendulum | /src/qtable.py | UTF-8 | 10,140 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python3
"""
Copyright (c) 2016 Petr Fejfar, Martin Vana
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, including without limitation the rights
to use, copy, mo... | true |
e3345cabdc4a5899568960721cb7aa81baf07fbc | tjtuom/ObservableCollections | /test/ObservableDict/mutation_test.py | UTF-8 | 3,551 | 3.53125 | 4 | [
"MIT"
] | permissive | import unittest
from reactive.ObservableDict import ObservableDict
class ObservableDictMutationTests(unittest.TestCase):
def setUp(self):
self.od = ObservableDict({1: 'Crash', 2: 'Coco', 3: 'Pura', 4: 'Tiny Tiger'})
self.empty = ObservableDict()
def test_ObservableDict_get_method_returns_ap... | true |
073bc62471ef97e7078bf2e1a11a08d88329d81b | Alves5/codigosempython | /avf-11.py | UTF-8 | 277 | 3.59375 | 4 | [] | no_license | print("**** Exame de Doping ****")
print("="*25)
nome = input("Nome do atleta: ")
testosterona = int(input("Digite a testosteronado atleta: "))
if testosterona > 1400:
print("Resultado: POSISTIVO.\nSua testosterona está acima de 1400.")
else:
print("Resultado: NEGATIVO.") | true |
4f2f3d9b46200728d90f5a7c7ddfdb016bc0d478 | millanmilu/Learn-Python-with-Milu- | /Method_Resolution_order.py | UTF-8 | 316 | 2.53125 | 3 | [] | no_license | class A:
def __init__(self):
print("a")
class B:
def __init__(self):
print("b")
super().__init__()
class X(B) :
def __init__(self):
print("xx")
super().__init__()
class d(A,B):
"""docstring for d"""
def __init__(self, arg):
super(d, self).__init__()
self.arg = arg
| true |
46edc3f8fee2045f65ad0eeb391e84034840fff0 | daedalaus/practice | /Python3网络爬虫开发实战/chapter10/section1/login.py | UTF-8 | 3,075 | 2.625 | 3 | [] | no_license | import requests
from lxml import etree
from pyquery import PyQuery
class Login(object):
def __init__(self):
self.headers = {
'Host': 'github.com',
'Referer': 'https://github.com/',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like '
... | true |
4d4389251ec1b8dfae25beffb0a85e9408786111 | zonggit/test_proxy | /test_proxy/test.py | UTF-8 | 541 | 2.765625 | 3 | [] | no_license | import random
import time
import requests
def get_random_proxy():
'''随机从文件中读取proxy'''
while 1:
with open('proxies.txt', 'r') as f:
proxies = f.readlines()
if proxies:
break
else:
time.sleep(1)
proxy = random.choice(proxies).strip()
return pr... | true |
52b549efce8b2b7e8ff19e2184e0ad0a31d41fa7 | mithundevkate/python | /hackerank/probklemsolving/xml_solution.py | UTF-8 | 725 | 3.09375 | 3 | [] | no_license | string2 = 'mithun'
position = 3
character = 'l'
string1 =list(string2)
print(string1)
string1[position] = character
print("".join(string1))
string = 'ThIsisCoNfUsInG'
sub_string = 'is'
print(string.find(sub_string))
x = string.find(sub_string)
if x == -1 :
x = 0
print(x)
else:
print(x)
import re
d = len... | true |
5cb6fc52d65bef5d40a1b01125ba2f8a65e7e29e | KseniiaP-20/Django_Project | /city/models.py | UTF-8 | 13,906 | 2.671875 | 3 | [] | no_license | # База городов и их описание
city_db = [
{
'name': 'Лондон',
'description': ('Лондон — это ожившие картинки из учебника английского языка: '
'Биг-Бен, Букингемский дворец, красные телефонные будки и '
'двухэтажные автобусы.<p> Маршрут на 8 км по основным '
'д... | true |
577657c2733128314caeadede8bcec8eac473750 | Tiemendejong/Learning-Community | /question 7.py | UTF-8 | 73 | 2.609375 | 3 | [] | no_license | time = 14
resttime = 51 % 24
alarmtime = time + resttime
print(alarmtime) | true |
98026429c82e79559ea7e48965d96ce392a3390e | robinarthur/MineSweeperBot | /data/grid_detect.py | UTF-8 | 2,473 | 2.953125 | 3 | [] | no_license | import cv2
import numpy as np
import pandas as pd
import imutils
#f = 'full_snap.png'
f = 'screengrab.png'
img = cv2.imread(f)
cv2.imshow("test",img)
"""
some of my blue pixels
R: between 98 and 128
G: between 176 and 211
B: between 255
h: between 210 and 200
s: between 100 and 48
v: between 68 and 100
hsv/2 in open... | true |
1fa53345f57743087d4f1dd5e4daebc87613587b | nicolageorge/play | /algorithms/cavity_map.py | UTF-8 | 604 | 3.09375 | 3 | [] | no_license | import sys
n = int(raw_input().strip())
def check_elem(matr, i, j):
global n
if i+1 > n-1 or i-1 < 0 or j+1 > n-1 or j-1 < 0:
return matr[i][j]
# print i, j, n
max_close = max( [matr[i][j+1], matr[i][j-1], matr[i+1][j], matr[i-1][j]] )
if matr[i][j] > max_close:
return 'X'
el... | true |
c5e3c35c81201b721c4f8d8b094a8b2668ea9a22 | hoanglinh171/Programming-Methodology | /Assignment 4: Lists with Graphic/sunset.py | UTF-8 | 1,434 | 3.859375 | 4 | [] | no_license | """
File: sunset.py
----------------
Stanford CS106A Sunset Project
Add additional comments here.
"""
import tkinter
import time
from graphics import Canvas
CANVAS_WIDTH = 600 # Width of drawing canvas in pixels
CANVAS_HEIGHT = 300 # Height of drawing canvas in pixels
SUN_SIZE = 70 # Width and heig... | true |
aa817c6a7d51dabe923f6421e42f2acebd9d4753 | rabjohnston/E81HW3 | /HW3ScratchpadSplit.py | UTF-8 | 9,412 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# requires sciket-learn 0.18
# if required, conda update scikit-learn
import math
import pandas as pd
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.preprocessing import label_binarize
from sklearn.multiclass import OneVsRestClassifier
from sklearn.metrics i... | true |
d6e07557dae070da136952eb2b264d00f3729b42 | surtich/TFG_Manuel_R | /Tema_6_2_Patrones_de_filtrado/valoresNoRepetidos.py | UTF-8 | 1,315 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
from mrjob.job import MRJob
import re
#Expresion regular para validar ip
ip = ('^(?:(?:25[0-5]|2[0-4][0-9]|'
'[01]?[0-9][0-9]?)\.){3}'
'(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$')
IP_RE = re.compile(ip)
class valoresNoRepetidos(MRJob):
def mapper(self,_, line):
... | true |
b5be92f5873e885877afe056cc4c8ea98cea14d9 | r4khic/bet_machine | /data_calculation.py | UTF-8 | 576 | 3.1875 | 3 | [] | no_license | from getting_colors import GetData
from collections import Counter, OrderedDict
def main():
data = GetData()
# colors_data = data.get_data() # contain 2 lists 0 index str,1 index datetime
white_color_dates = data.get_white_color_date()
compare(white_color_dates)
def compare(white_color_dates):
... | true |
4aea056f27becec34c465e7216f01c52f9c4d0bf | 0d3ng/iot-server-tcp | /client.py | UTF-8 | 583 | 3.0625 | 3 | [] | no_license | # Python TCP Client A
import socket
host = socket.gethostname() #silakan disesuaikan dengan alamat host server
print("host: " + host)
port = 2004 # silakan disesuaikan dengan port server
BUFFER_SIZE = 2000
MESSAGE = input("Enter message/ Enter exit:")
tcpClientA = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
tcp... | true |
ec2428a0e79279bc02a7db05eb6160660a74b036 | shriyaEsha/FYP-Panorama-3D | /stitcher_warped.py | UTF-8 | 10,887 | 2.859375 | 3 | [] | no_license | import cv2, numpy as np
import math
import argparse as ap
DEBUG = False
def blend_linear_interpolation(img1, img2, x, y, left=False):
height1, width1 = img1.shape[:2]
height2, width2 = img2.shape[:2]
img1_gray = cv2.cvtColor(img1, cv2.COLOR_BGR2GRAY)
img2_gray = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)
... | true |
94c0b052fc3efeb6b1ab982b6698fc33f2524456 | sonyarpita/ptrain | /SQL/create_table.py | UTF-8 | 396 | 2.53125 | 3 | [] | no_license | import pymysql
#database connection
connection=pymsql.connect(host="localhost",user="root",passwd="",database="Employee")
cursor=connection.cursor()
#query for creatig table
EmpTableSql="""CREATE TABLE Besant(
ID INT(20) PRIMARY KEY AUTO_INCREMENT,
EMPID INT(20),
NAME CHAR(20) NOT NULL,
DESIGNATION CHAR(20),
EXPERIENC... | true |
96a0233e1ed6a1c43419f5c3fff63db006aebf7c | guiferviz/recipipe | /tests/test_utils.py | UTF-8 | 4,090 | 2.796875 | 3 | [
"MIT"
] | permissive |
from unittest import TestCase
import pandas as pd
from recipipe.utils import add_to_map_dict
from recipipe.utils import default_params
from recipipe.utils import flatten_list
from recipipe.utils import fit_columns
from tests.fixtures import create_df_3dtypes
class UtilsTest(TestCase):
def test_flatten_one_nes... | true |
e39288f2a17afa5e9ce9079603b67c8eb4c65717 | annusingh100995/Data_Analysis | /Extras/content_based_collaborative_filtering.py | UTF-8 | 8,136 | 3.6875 | 4 | [] | no_license | # https://blog.cambridgespark.com/tutorial-practical-introduction-to-recommender-systems-dbe22848392b
# https://www.analyticsvidhya.com/blog/2018/06/comprehensive-guide-recommendation-engine-python/
""" Implementing a simple recommender system. This analysis is only to find the movies which are similarto certain other... | true |
f36748d97d20544ac121c1e1f30a1f617249d8a8 | jvdmeijs/ProjectEuler | /problem3/problem3.py | UTF-8 | 344 | 3.390625 | 3 | [] | no_license | #!/bin/python
def primefactor(n):
all_factors =[]
d = 2 #smallest primefactor
while n>1:
while n % d ==0:
all_factors.append(d)
n /= d
d = d + 1
if d*d >n:
if n>1:
all_factors.append(n)
break
return all_factors
primefactor = primefactor(600851475143)
largest_primefactor = max(primefactor)
pr... | true |
041bb15021b6f7a714f9afa53668ef6ce596dbe5 | huanghyw/akshare | /akshare/stock_feature/stock_sse_margin.py | UTF-8 | 4,099 | 2.5625 | 3 | [
"MIT"
] | permissive | # -*- coding:utf-8 -*-
# /usr/bin/env python
"""
Date: 2021/2/8 16:40
Desc: 上海证券交易所-融资融券数据
http://www.sse.com.cn/market/othersdata/margin/sum/
"""
import pandas as pd
import requests
def stock_margin_sse(
start_date: str = "20010106", end_date: str = "20210208"
) -> pd.DataFrame:
"""
上海证券交易所-融资融券数据-融资融券汇总... | true |
9f034555a3428910b6e5aab730d4647731bffd1c | declerambaul/fhmm | /src/db.py | UTF-8 | 6,921 | 3.046875 | 3 | [] | no_license | #
# Fast HMM Mapping
# Fabian , dec08
#
# hmm.py : A class representing the motif HMM that we are looking for in the db
#
#
#from pylab import *
#import numpy
#import scipy
import os
from hmm import *
#alphabet = [ 0, 1, 2, 3]
#alphabet = ['A','C','G','T']
class DB:
def __init__(self,alphabet,nam... | true |
1fb159425a4edf22306ccd262e02f9160b7dd32d | shelajev/ut.parallel_computing_2010_project | /researching/first_solution/bicgstab.py | UTF-8 | 2,282 | 2.890625 | 3 | [] | no_license | import numpy as np
import parallel
TOLERANCE=1E-9
MAX_ITER=1000
def solve(A, b, comm):
rank = comm.Get_rank()
master = (rank == 0)
prec = None # For future use :)
if master:
# Initial guess:
x = np.zeros((A.n,1))
print 'b', b.shape, 'A', (A.m,A.n), 'x', x.shape
... | true |
31a2ac7aa923db40fecdc29fa135a6a68fe314f8 | HaigangLiu/spatial-temporal-py | /SampleDataLoader.py | UTF-8 | 5,753 | 3.21875 | 3 | [] | no_license | import pandas as pd
def load_rainfall_data(option = 'monthly'):
if option == 'monthly':
retained_var_list = ['STATION','YEAR', 'MONTH','LATITUDE','LONGITUDE','ELEVATION', 'PRCP', 'SST']
monthly_data = pd.read_csv('./data/with_sst_1_year.csv')[retained_var_list]
sample_data = monthly_data[(... | true |
6548f655ead812d4107c067cc29103f2dc3b1e50 | Propellerhead-Interactive/goslow | /app/helper/utils.py | UTF-8 | 929 | 2.5625 | 3 | [] | no_license | import nltk
import sys
from nltk.tokenize import RegexpTokenizer
from nltk.corpus import stopwords
sys.path.append( 'app/model/')
from models import Tweet, db
from peewee import SQL
class Utils:
@staticmethod
def frequent_words(count):
go_stop = [u'https', u'go', u'gobus', u'station', u'hi', u'we', u't... | true |
6ff24e407a4f9ce1a64db02c863e4f8b04769183 | ShantanuBal/Code | /Scripts/longest_string.py | UTF-8 | 685 | 2.8125 | 3 | [] | no_license | a = "ghelloworldx"
b = "zeslogrd"
def find(a,b):
a = "0" + a
b = "0" + b
opt = []
for each in range(len(b)): opt.append([0]*len(a))
for i in range(1,len(b)):
for j in range(1,len(a)):
if b[i] == a[j]:
opt[i][j] = 1 + opt[i-1][j-1]
else:
opt[i][j] = max(opt[i-1][j],opt[i][j-1])
print
print " ",... | true |
5563e5a0df4fd38554cebc345317d56a7a0e77a7 | coolxv/DL-Prep | /04_Algorithms/Leetcode/L399_EvaluateDivision.py | UTF-8 | 2,380 | 2.984375 | 3 | [] | no_license | import copy
class Solution:
def calcEquation(self, equations, values, queries):
node = {}
flag = 0
equa = copy.deepcopy(equations)
val = copy.deepcopy(values)
i = 0
equalen = len(equa)
while equa:
if i>=len(equa):
i = 0
... | true |
bce0c11fe8eda990656d433dd5f518aa73f6c506 | jwbrooks0/AIMS | /config1.py | UTF-8 | 1,095 | 2.59375 | 3 | [] | no_license |
"""
This code is just a test of the functions of this library.
"""
# import libraries
#import LCD2004 as lcd
#import button
#import time
import m5e
import RPi.GPIO as GPIO
import pandas as pd
#import numpy as np
from AIMS import aimsLib; reload(aimsLib)
# instruct the RPi to ignore warnings
GPIO.setwarnings(False)... | true |
c2920b0657f7a2d5bec5230c29e894dff78571f5 | alvas-education-foundation/ISE_3rd_Year_Coding_challenge | /4AL17IS006_VISHAK_AMIN/22May20/fourth.py | UTF-8 | 1,126 | 3.96875 | 4 | [] | no_license | # Given the names and grades for each student in a Physics class of students, store them in a nested list and print the name(s) of any student(s) having the second lowest grade.
# Note: If there are multiple students with the same grade, order their names alphabetically and print each name on a new line.
# Input For... | true |
3100a746115f17963fd04efeb20b5866510ebd38 | Sindhu-dot-R/Python_excercise | /FactEndZero.py | UTF-8 | 353 | 3.84375 | 4 | [] | no_license | def findFactZero(n):
count = 0
i = 5
while (n/i>= 1):
count += int(n / i)
i *= 5
return int(count)
def fact(n):
if n==1:
return n
else :
return n*fact(n-1)
num = int(input("enter the number "))
print(fact(num))
print("Count of 0's in",num,"fact... | true |
06c1f3a9a939453a1404d7677c9ce527aba60112 | BurkaV/Test_Task | /text_output/views.py | UTF-8 | 1,192 | 2.90625 | 3 | [] | no_license | """
That file contains functions for working with the project frontend
1. Function 'text_apply' processing the form of word input and output word count calculation
2. The 'date_method' function displays a list of all records in the database
"""
from django.shortcuts import render
from text_output.models import AcceptsT... | true |
e8acbfef170f3101ed874663545849013da22229 | mahynski/pychemauth | /pychemauth/regressor/pls.py | UTF-8 | 26,045 | 2.8125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | """
Projection to Latent Structures (PLS).
author: nam
"""
import copy
import matplotlib.pyplot as plt
import numpy as np
import scipy
from sklearn.base import BaseEstimator, RegressorMixin
from sklearn.cross_decomposition import PLSRegression
from sklearn.utils.validation import check_array, check_is_fitted, check_X... | true |
ed3fc184941376716d087b838435fdda19cf9d83 | wancongji/python-learning | /lesson/10/杨辉三角升级.py | UTF-8 | 281 | 3.234375 | 3 | [] | no_license | triangle = []
m = 8
k = 3
for i in range(m):
if i == 0:
triangle.append([1])
else:
pre = triangle[i-1]
cur = [1]
for j in range(0,i-1):
cur.append(pre[j]+pre[j+1])
cur.append(1)
triangle.append(cur)
print(cur[k])
| true |
523072c6c0e12c2d8f81019888f7bbe6884aee4c | haohsun/TQC-Python | /PYD104.py | UTF-8 | 242 | 3.59375 | 4 | [] | no_license | # TODO
import math
radius = eval(input())
perimeter = radius * 2 * math.pi
area = radius * radius * math.pi
print("Radius = {:.2f}".format(radius))
print("Perimeter = {:.2f}".format(perimeter))
print("Area = {:.2f}".format(area)) | true |
01e01683ac404d5570a7c16cd902e3500a8d65aa | tolgasaglik/distributional-semantics-project | /data_cleaning.py | UTF-8 | 2,259 | 3.140625 | 3 | [] | no_license | #Everything should work by changing the file paths.. if you think, more processing is need.. let me know
import os, re
from gensim.parsing.preprocessing import remove_stopwords
import gensim
from nltk.stem import PorterStemmer
from nltk.stem.snowball import SnowballStemmer
from nltk.tokenize import sent_tokenize, wor... | true |
f3ef57bd85cab646bc0ea6aa6bc5c707f1abf20b | elliebui/technical_training_class_2020 | /data_structures/stacks_and_queues/stacks/stack_using_array.py | UTF-8 | 2,259 | 4.3125 | 4 | [] | no_license | class Stack():
def __init__(self, initial_size=10):
self.arr = [0 for _ in range(initial_size)]
self.next_index = 0
self.num_elements = 0
def push(self, value):
if self.num_elements == len(self.arr):
print("Out of space! Increasing array capacity ...")
se... | true |
22a6b9191f574b2d0e5880578b2736cc2528588f | aaronjzap/Almost-equienergetics_graphs | /operaciones_matrices.py | UTF-8 | 1,412 | 2.984375 | 3 | [] | no_license | import random
import numpy as np
import networkx as nx
def Grafo2matriz(ws,n):
matriz=np.zeros((n,n))
edges=ws.edges()
for e in edges:
matriz[e[0]][e[1]]=1
matriz[e[1]][e[0]]=1
return matriz
def Crear_matriz(ws, n):
matriz=np.zeros((n,n))
edges=ws.edges()
for e in ed... | true |
75d4e4ecf09215f754c4de7be972198d7fc2a444 | cyrusBaker/Dre4mTe4m-Project | /fb2.py | UTF-8 | 2,330 | 2.703125 | 3 | [] | no_license | from ipywidgets import widgets as w
from IPython.display import display
#from sidecar import Sidecar as sc
user_out = w.Output(layout={'border': '1px solid black'})
user_out
# Requirement: A user can upload a file to be inserted into the database
file_upload = w.FileUpload(
accept='', # Accepted file extension e... | true |
5ab4c03a5e5276a56dc6920e38f470d09bfc39e1 | jcondea/raspberrypi-projects | /RPi-1-blink.py | UTF-8 | 606 | 3.203125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
########################################################################
# Filename : RPi-1-blink.py
# Description : Prende y apaga un LED por [n] veces.
# Author : jcondea
# modification: 2020/10/06
########################################################################
import time
imp... | true |
0eb1f1983f9c3de0146415e700f9b6d0bc7b4b84 | clayg/udacity | /ud120/3.22/main.py | UTF-8 | 1,264 | 3.421875 | 3 | [] | no_license | #!/usr/bin/env python
import matplotlib.pyplot as plt
from prep_terrain_data import makeTerrainData
from class_vis import prettyPicture, draw_features
# your imports go here
from sklearn.svm import SVC
# the training data (features_train, labels_train) have both "fast" and "slow"
# points mixed together--separate t... | true |
0e71b7b3e8ab7c58d75d1f4414b82b517d1810c3 | fscivittaro42/CS123-Project | /unused/MRJob/mrjobtaxiavgfare.py | UTF-8 | 634 | 3.140625 | 3 | [] | no_license | # Arif-Chuang-Scivittaro
# CMSC 123 Spring 2017
# Chicago Taxi Data Project
#
# Test MRJob code for NYC Yellow Taxi Data
# Average tip as a proportion of fare
from mrjob.job import MRJob
class TaxiAvgFare(MRJob):
def mapper(self, _, line):
column = line.split(',')
fare = float(column[12])
tip = f... | true |
8a66d3ba40621cac5f2cf5e06f786e51854df8db | walrusfruitcake/multiarb | /multiarbnodes.py | UTF-8 | 2,491 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python
# for arbitrary-precision arithmetic without float-type errors
import decimal as d
# Node representing a currency, to be updated with its value in base (USD|BTC)
class CurrencyNode:
# Default constructor.
# @param acronym the code for the currency
# both Decimal objects:
# @param exchan... | true |
e9d1baaa3a3637efe55de404c8a1510344a33bfb | marineHero1/PythonApplication1 | /PythonApplication1/leetcode242.py | UTF-8 | 607 | 3.46875 | 3 | [] | no_license | #242. 有效的字母异位词
#low
class Solution(object):
def isAnagram(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
def fun(string):
res={}
for i in string:
if i not in res:
res[i]=1
else:
... | true |
d7afc2df53b188feb84521965345261b711d8fe4 | DanielVasev/SeleniumWithPython | /ScrollingPage.py | UTF-8 | 1,047 | 2.515625 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
import time
driver = webdriver.Chrome(executable_path=r"D:\STUDING\Python\WebDriver\chromedriver_win32\chromedriver.exe")
driver.get("https://www... | true |
5bb16ec0b710a47d9bd09ccd727a9bf92123db8d | harshdeep1230/fishprediction | /FlaskApp.py | UTF-8 | 861 | 2.609375 | 3 | [] | no_license |
import numpy as np
import pickle
import pandas as pd
from flask import Flask, request
from flask import Flask, request, jsonify, render_template
app=Flask(__name__)
model = pickle.load(open('finalized_model.pkl', 'rb'))
@app.route('/')
def home():
return render_template('index.html')
@app.... | true |
a9a17f5423cff6103791cd4f024745c82ba3d756 | ConradDavis/Python__class__ | /_class/class.py | UTF-8 | 1,961 | 3.65625 | 4 | [] | no_license | s="hello world".split(' ')[0]#取hello第一位
print(s)
#第三次开始
#数值类型
print(888)
print(0X10,0o10,0B01)
print(555.555)
print(66+66j)#负数 print(type(66+666j)) (运算符重载,函数重载)
#字符串
"hello world"
'fgs'
"""fgsm"""
print("%d%c"%(65,66))
print("%2.5f"%3.1415926)
#序列
#[6,6,6]#list 可以变
#(6,6,2)#tuple 元组,不变
#{6,6,6}#set
s={6,6... | true |
0b946de4f0490425d3e94e3a788bcf86063e985f | wonjongah/JAVA_Python_Cplusplus | /Python/chapter09 리스트와 튜플/value.py | UTF-8 | 122 | 3.03125 | 3 | [] | no_license | nums = list(range(10))
nums2 = nums[:]
print(nums)
print(nums2)
print("수정 후")
nums[0] = 100
print(nums)
print(nums2) | true |
7a8ed0d1b915805674536f2b680cf3511c9fafd6 | tlxxzj/leetcode | /257. Binary Tree Paths.py | UTF-8 | 683 | 3.3125 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def binaryTreePaths(self, root: Optional[TreeNode]) -> List[str]:
ret = []
q = [(root, str(r... | true |
da3259d73e6b03004c9b4c0728a0ff94baa73ace | gaepury/DocsCare | /backend/flaskr/image/service.py | UTF-8 | 5,708 | 2.6875 | 3 | [] | no_license | import io
import os
import urllib
import boto3
import cv2
import nltk
import numpy as np
import settings as settings
from PIL import Image
from app import model
from konlpy.tag import Okt
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from pdf2image import convert_from_path
from pytesseract ... | true |
6d1e64fe67810f651b7b051a200aba016ba4c39e | shiki7/algorithm | /select_sort/select_sort.py | UTF-8 | 343 | 3.40625 | 3 | [] | no_license | def select_sort(arr):
for i in range(len(arr)):
min_val = min(arr[i:])
min_idx = arr.index(min_val)
arr[i], arr[min_idx] = min_val, arr[i]
return arr
# デバック
if __name__ == "__main__":
arr = [3, 4, 6, 10, 2, 1, 7, 11]
print("before: ", arr)
arr = select_sort(arr)
print("... | true |
a9e2897280e271b7bb44eabbc2d59559fa308458 | Anvesh8263/python-lab-30 | /$print.py | UTF-8 | 105 | 3.578125 | 4 | [] | no_license | inp = int(input())
for i in range(1,inp+1): print('$'i) if i<=int(inp/2) else print('$'(i-int(inp/2)))
| true |
1dc8ffb0afaae3a75edc102155ace0b7543c1c1d | emfriis/SDV602-2021-V2 | /controller/User/register_button.py | UTF-8 | 926 | 2.65625 | 3 | [
"MIT"
] | permissive | """
Register controller
"""
import sys
sys.dont_write_bytecode = True
import PySimpleGUI as sg
def accept( event, values,state):
keep_going = True
if event == "Register":
# Just testing
print("Got Register - just testing")
# Work with a UserManager object
from ... | true |
d9c618dbcf48fcdedc115c82fac8396b313a6c58 | srvn-nm/someComputing | /someComputing.py | UTF-8 | 273 | 3.75 | 4 | [] | no_license | # author : Sarvin Nami
firstNumber = int(input("please enter an integere number between 1 - 9\n"))
secondNumber = (int((firstNumber * 2 + 8 + firstNumber - 2) / 3) - firstNumber) * 4
print("for each number you have chosen our resault of calculation will be : ",secondNumber) | true |
023a5e9f0eafe4d3439d3c3723dd2324a01c50ea | frbor/act-workers | /act/workers/generic_uploader.py | UTF-8 | 6,194 | 2.625 | 3 | [
"ISC"
] | permissive | #!/usr/bin/env python3
"""General ACT backend uploader. Reads facts as JSON
from the stdin, uploading accordingly"""
import argparse
import json
import sys
import time
import traceback
from logging import error, warning
from typing import Iterable, Text
import act.api
from act.api.libs import cli
from act.workers.l... | true |
1ef2cf61d7209de336b757213fd3b7ae1809ecce | samuelsilveiram/python | /machine-learning/classificacao/classificacao.py | UTF-8 | 2,573 | 3.203125 | 3 | [] | no_license | from collections import Counter
import pandas as pd
data_frame = pd.read_csv('situacao.csv')
x_df = data_frame[['recencia','frequencia','semanas_de_inscricao']]
y_df = data_frame['situacao']
xdummies_df = pd.get_dummies(x_df)
ydummies_df = y_df
x = xdummies_df.values
y = ydummies_df.values
porcentagem_de_treino = 0... | true |
5b720694df1e0c3e61f78b6ae9d8e6078c5513ce | lppier/Hackerrank_Python | /LeetCode/merge_intervals.py | UTF-8 | 773 | 3.203125 | 3 | [] | no_license | class Solution:
def merge(self, intervals: List[List[int]]) -> List[List[int]]:
intervals = sorted(intervals)
new_list = []
i = 0
while i < len(intervals):
print(f'i = {i}')
temp_interval = intervals[i]
print(f'temp {temp_interval}')
j ... | true |
8c8b8e1306996582b783c91587ba8c882a5593d4 | Ragnra/FortiManagerAPI | /fmg_modules/fmg_api.py | UTF-8 | 11,911 | 2.8125 | 3 | [] | no_license | import requests, json
class FMGApi:
def __init__(self, ip, user, passwd, verify=False):
#create login url through the jsonrpc api
self.url = 'https://' + ip + '/jsonrpc'
#establish a requests session
self.s = requests.Session()
#login_url for jsonrpc
self.login_url =... | true |
6d08afa2a2a1bf8be9a44e38b7356e9a04cf4c31 | senryyankee/Tarea4 | /pie/pie.py | UTF-8 | 252 | 2.828125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import math
import random
h = 0.01
n_points = int(6.0/h)
x = np.linspace(-1.0,1.0,n_points)
y=np.sqrt(1 - (x*x))
integral = sum(y) * h
print integral
plt.bar(x,y, width=h)
plt.show()
plt.close()
| true |
01d129acd692a4c578a5e5f22429871651e53bf2 | slychai85/Python | /Learn_Python/Projects/table223.py | UTF-8 | 2,751 | 2.765625 | 3 | [] | no_license | from sqlalchemy import create_engine, Column, Integer, String
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
# Выбор базы данных и название файла для его создания
engine = create_engine('sqlite:///table223.sqlite')
# Сессия работы с БД - соединение с Б... | true |
a95e4724be6f053bddde4c59d72cc7ca708ac624 | Diggerfdf/Python_Mega | /Exercises/S02L47.py | UTF-8 | 146 | 2.953125 | 3 | [] | no_license | my_file = open("Files/fruits_2.txt")
content = my_file.read()
my_file.close()
content = content.splitlines()
for i in content:
print(len(i))
| true |
917c5447db56612f94b27b96ccd694fd7c1f8391 | octinhuh/hdvid21 | /tests/luma_scale.py | UTF-8 | 1,111 | 2.75 | 3 | [] | no_license | # demonstration of how the luma-scaler hardware should output
import numpy as np
import cv2
IMAGE_NAME = 'me.png'
if __name__ == "__main__":
img = cv2.imread(IMAGE_NAME)
img2 = cv2.cvtColor(img, cv2.COLOR_RGB2YCrCb)
img_conv = cv2.cvtColor(img, cv2.COLOR_RGB2YCrCb)
img_scaled = cv2.cvtColor(img, cv2.COLOR_R... | true |
d3fabf363137511b2f032b86c0a23128d16754e4 | folkvir/sage-sparql-void | /server/sage-agg/sage/database/hdt_file_connector.py | UTF-8 | 3,327 | 3 | 3 | [
"MIT"
] | permissive | # hdt_file_connector.py
# Author: Thomas MINIER - MIT License 2017-2018
import os.path
from hdt import HDTDocument
from sage.database.db_connector import DatabaseConnector
from sage.database.db_iterator import DBIterator
class HDTIterator(DBIterator):
"""An HDTIterator implements a DBIterator for a triple patter... | true |
e231f53a79887de25ffc2400a4f350a5ae73b760 | Igorcervelin/RNA---Rain-in-Seattle | /rain.py | UTF-8 | 1,863 | 3.0625 | 3 | [] | no_license | from keras.models import Sequential
from keras.layers import Dense
import numpy as np
from numpy import loadtxt
from sklearn.model_selection import train_test_split
import sys
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix
from sklearn import metrics
dataset = loadtxt('dataset.... | true |
60c440da9ce75f3e3191c16c9dbfb345df135006 | wanghaoListening/python-study-demo | /functional-programming/sorted.py | UTF-8 | 627 | 4.21875 | 4 | [] | no_license |
'''
Python内置的sorted()函数就可以对list进行排序
sorted()函数也是一个高阶函数,它还可以接收一个key函数来实现自定义的排序
'''
sorted([36, 5, -12, 9, -21])
sorted([36, 5, -12, 9, -21], key=abs)
#字符串忽略大小写,按照字母序排序。要实现这个算法
sorted(["acdnew","ASdwokec","dwnwwu","dfwGR","REWCXH"],key=str.lower)
#要进行反向排序,不必改动key函数,可以传入第三个参数reverse=True
sorted([3,45,213,543,12,54,1... | true |
22de254bf7a0285139a51e779a9b14ea749996f4 | trevorgud/python-chess | /chess.py | UTF-8 | 6,480 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python3
import jsonpickle
import pygame
import socket
import time
from ChessBoard import ChessBoard
from MoveStatus import MoveStatus
from gui import Banner, Button, CheckStatus, Text, TextInput, TurnText
from utils import *
def updateDisplay(screen, img, rect, board, click = None):
# Blit the boar... | true |
0e76542e17fe652172d3c463d84431dab484d1b5 | franck179/holonome | /venv/Robot.py | UTF-8 | 6,909 | 2.859375 | 3 | [
"MIT"
] | permissive | import Adafruit_PCA9685, time, pygame,math
import numpy as np
from escInitThread import *
import threading
def scale(x, in_min, in_max, out_min, out_max):
"""
Equivalent de la fonction map() en arduino
:param x: valeur à mapper
:param in_min: borne inférieure d'entrée
:param in_max: borne supérieure... | true |
486a25d43eb5177ecbe0c19a2bd273382941580a | TobKed/Workout-App | /gui_version/files/settings_lib.py | UTF-8 | 1,663 | 2.78125 | 3 | [] | no_license | import configparser
class Borg:
_shared_state = {}
def __init__(self):
self.__dict__ = self._shared_state
class Settings(Borg):
def __init__(self, filename):
Borg.__init__(self)
self.filename = filename
self.config_parser = configparser.ConfigParser()
self.read_c... | true |
b3f8dffc495de482dd8e760ecd7b1476d064fcb3 | starrcaft/InformationProtection | /assignment/[IS00]_06_201603867_조성환/프로그램/sixserver/server.py | UTF-8 | 650 | 2.71875 | 3 | [] | no_license | import socket
import MCipher
def server_program():
host = '127.0.0.1'
port = 5462
f = open("mypriKey.pem", "r")
pubkey = MCipher.readPubKey()
prikey = MCipher.readPriKey()
key = 'thisisbadkeyokeythisisbadkeyokey'
encryptKey = MCipher.RSA_Encrypt(pubkey, key)
iv = 'ivisinitialvetor'.e... | true |
ac56947cba23e5d15b38dc4928057594a6b6c622 | iamTanTanTan/python_programming | /040数组中只出现一次的数字.py | UTF-8 | 795 | 4.25 | 4 | [] | no_license | '''
一个整型数组里除了两个数字之外,其他的数字都出现了两次。请写程序找出这两个只出现一次的数字。
'''
'''
思路一:利用python自带的counter库
思路二:异或运算
'''
from collections import Counter
class Solution:
def once_appeared_num(self, array):
# 返回一个列表,map(f,input),对input进行f操作,第一个参数lambda函数,意思取返回值中的第一个数,因为counter函数返回的是字典,
# counter().most_... | true |
7c6179c97f0e10d1b322e70166110ad52911338a | nithinj/CodingPuzzles | /geeks4geeks/min_depth_bt.py | UTF-8 | 1,190 | 3.84375 | 4 | [] | no_license |
class Node():
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def mindepth(root):
que = []
depth = 0
que.append({'node': root, 'depth': 1})
if not root:
return 0
while que:
... | true |
5d095d261ddfb5aa04665c1a4447ada0b4930f1f | noname129/CT_TEST | /main.py | UTF-8 | 2,384 | 3.296875 | 3 | [] | no_license | import tkinter
from tkinter import ttk
import datetime
def calculate_remaining(year, month, day):
given = datetime.datetime(year=year, month=month, day=day)
now = datetime.datetime.now()
diff = given - now
if diff.days < 0:
diff = datetime.timedelta()
return diff
def apply_label():
... | true |
f1c880090ff9e95a50be8c4bd8d4ab2ba6c44537 | therako/bqsqoop | /bqsqoop/utils/math_util.py | UTF-8 | 1,391 | 3.203125 | 3 | [
"MIT"
] | permissive | import math
from datetime import datetime, timedelta
def _calculate_splits_for_int(min_value, max_value, n):
count_per_batch = int(
math.ceil((max_value - min_value + 1) / (n * 1.0)))
splits = []
for i in range(n):
splits.append({
'start': (count_per_batch * (i) + min_value),
... | true |
ff3de8919380782e8e32fb36dab71c5603d65dea | talmo/gpuhackathon-sleap | /tensorrt/benchmark_model.py | UTF-8 | 5,929 | 2.53125 | 3 | [] | no_license | """This script is written from benchmark_models.ipynb. Do not edit directly."""
# Disable tensorflow spam (needs to happen before tensorflow gets imported)
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" # set to "2" to see TensorRT errors
import logging
logging.getLogger("tensorflow").setLevel(logging.ERROR)
logg... | true |
016fc7093fd9b3b49433cbc26c72301504eb0c5b | warriorarmentaix/lfd | /kinematics/test/test_region_algebra.py | UTF-8 | 1,090 | 2.734375 | 3 | [] | no_license | import numpy as np
from kinematics import region_algebra as ra
def test_grid2():
array = np.array([
[0, 0, 0, 0],
[0, 1, 1, 0],
[0, 1, 1, 0],
[0, 0, 0, 0]])
xticks0 = np.array([3, 4, 5, 6])
xticks1 = np.array([4.2, 5.2, 6.2, 7.2])
yticks0 = np.array([0, 1, 2, 3]... | true |
c2331266a249bdf0755e939614ee74333cda1894 | wangcunxin/gwspark | /python/ml/reduce_dimension.py | UTF-8 | 1,302 | 3.453125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import numpy as np
import urllib
__author__ = 'kevin'
if __name__ == '__main__':
'''
降维:
特征选择完成后,可以直接训练模型了,但是可能由于特征矩阵过大,导致计算量大,训练时间长的问题
降维方法:主成分分析法(PCA)和线性判别分析(LDA)
'''
# url with dataset
url = "http://archive.ics.uci.edu/ml/machine-learning-databases/pima-indians-d... | true |
56e7dfe8b8201bf8905cc832866cecf44b90cf52 | nicolascoco85/EjerciciosCFP34 | /juegosalternativos_TFL.py | UTF-8 | 992 | 3.3125 | 3 | [] | no_license | tirada=[3,3,3,3,1]
def ordenar_tirada(tirada):
#Comentario:
tirada_ordenada=sorted(tirada)
return tirada_ordenada
def esEscalera(tirada_ordenada):
tirada_ordenada=ordenar_tirada(tirada_ordenada)
if(tirada_ordenada==[1,2,3,4,5] or tirada_ordenada==[2,3,4,5,6]):
return True
else:
... | true |
cb888b9785e512a87be7b72df536676eae9cc828 | polyactis/gwasmodules | /pymodule/plot/yh_matplotlib.py | UTF-8 | 13,107 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python
"""
2008-10-07 simple functions related to matplotlib
"""
import os,sys
from scipy import stats
def assignMatPlotlibHueColorToLs(name_ls, debug=0):
"""
2008-10-07
assign continuous HSL color spectrum to a list (in order).
"""
if debug:
sys.stderr.write("Assigning matplotlib hue color t... | true |