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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
313a96903c5efd5d62f7f6d9fc0cfb710f3734d8 | Python | nahyland/RPi---Class | /VelotoPosit.py | UTF-8 | 742 | 3.328125 | 3 | [] | no_license |
## Variable setup ##
min_posit = 0 # Lower extreme position, from input voltage
max_posit = 5 # Upper extreme position position, from input voltage
des_posit = 3 # Desired position, based on voltage
dc = 0 # Duty cycle of PWM output to motor
# Range calculation
posit_range = max_posit - min_posit
#- Loop for ... | true |
f3e45c07f3367b2985b029baab9c4a23086d8820 | Python | westminsterandrew/pyclass | /helloWrld.py/друг.py | UTF-8 | 337 | 4.40625 | 4 | [] | no_license |
import random
name = input("Enter your name: ")
salary = int(input("Enter your salary: "))
raise_per = (random.randint(1, 100))
raise_amount = (raise_per / 100) * salary + salary
print(name + ", your current salary is $" + str(salary))
print("Your raise is %" + str(raise_per))
print(name + ", your new salary is $" + s... | true |
6704ae2d0b5cd980dfb33378f957a7e16a694d31 | Python | milan001/BlindPeopleAssistant | /VehicleDetTrak/Vehicle.py | UTF-8 | 5,609 | 2.5625 | 3 | [] | no_license |
import cv2
import sys
import os
import re
tracker = cv2.TrackerMedianFlow_create()
def bb_intersection_over_union(boxA, boxB):
# determine the (x, y)-coordinates of the intersection rectangle
xA = max(boxA[0], boxB[0])
yA = max(boxA[1], boxB[1])
xB = min(boxA[0]+boxA[2],boxB[0]+ boxB[2])
yB = mi... | true |
2a725a4366abec6d646a3e3df9c9f6c8b28746fb | Python | DanHefrman/stuff | /RANDOM/limnpy/limnpy/dashboard.py | UTF-8 | 1,705 | 2.5625 | 3 | [] | no_license | import csv, yaml, json
import os, logging
import datetime
from operator import itemgetter
from collections import Sequence, MutableSequence
import codecs
#import colorbrewer
import itertools
import pandas as pd
import pprint
import copy
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
class Dashboar... | true |
20606b644116cafa3503f00e2c20afb46ba053f5 | Python | rstaniek/taxi-dataset-analysis | /csv-splitter/tmanager.py | UTF-8 | 5,704 | 2.90625 | 3 | [] | no_license | import threading
import multiprocessing
import time
from datetime import datetime
#from utils import Executable
class ThreadRunException(Exception):
def __init__(self, message, errors=None):
super(Exception, self).__init__(message)
self.errors = errors
class ProcessThread(threading.Thread):
... | true |
6672a6e77f872e38fe8c0518ecf0f89cd807cb7a | Python | BenjaminUJun/slick | /pox/ext/slick/elements/DnsDpi/loadcache.py | UTF-8 | 978 | 2.90625 | 3 | [] | no_license | import glob
from collections import defaultdict
class LoadCache:
"""LoadCache for laoding the blocked domain names."""
def __init__(self):
DNS_BLOCK_LIST_DIR = "/tmp/blacklists" # Make it programmable.
self.data = defaultdict(list) # A dictionary with Domain Name as key and IP address list as resolved addresses.... | true |
04c5817fa8347b5b6d5c97ae68fdba75e212c873 | Python | V1cK1m/The-Group-Forex | /Forex/simple_forecast.py | UTF-8 | 7,213 | 3.671875 | 4 | [] | no_license | # import necessary libraries
import sys
import matplotlib.pyplot as plt
import pandas as pd
# import necessary modules
sys.path.append("/home/excviral/Pycharm/PycharmProjects/Adaptive-forex-forecast/Adaptive filters/")
sys.path.append("/home/excviral/Pycharm/PycharmProjects/Adaptive-forex-forecast/Feature extractor... | true |
b32a2e9e81eb335e8e522be23a5910f47b3f699f | Python | breylee/PythonPractice | /04-Sequences.py | UTF-8 | 903 | 3.90625 | 4 | [] | no_license | #sequences
#lists
print("list demo")
x = [5,12,13,200]
print(x)
x.append(-2) #[5,12,13,200,-2]
print(x)
del x[2] #[5,12,200,-2]
print(x)
z = x[1:3] #[12,200]
print(z)
yy = [3,4,5,12,13]
print(yy[3:]) #[12,13]
print(yy[:3]) #[3,4,5]
print(yy[-1]) #[13]
x.insert(2,28) #[5,12,28,200,-2]
print(x)
print(28 in x) #True... | true |
3e51f3048d015aed080e9d1d80e5901f5d4d5612 | Python | JConwayAWT/pgss15cb | /spec/other/Testing2.py | UTF-8 | 3,664 | 2.703125 | 3 | [] | no_license |
#updated version, using better data structure
import os
from lottka_volterra_sim import *
class Result():
def __init__(self, result = False, name = None, description = None, status = None):
self.result = result
self.name = name
self.description = description
self.... | true |
9c0360b9dd7512c46916dd6a12d528aefe3572d4 | Python | CoreSheep/python | /python/daySixteen/ArgsAndKwargs.py | UTF-8 | 751 | 3.546875 | 4 | [] | no_license | """
using **args and **kwargs in python function definition
"""
def args_test(Id, *args):
print("Student Id: %d" % Id)
print("profile:")
Index = 1
for arg in args:
print("info{}: {}".format(Index, arg))
Index += 1
print()
def kwargs_test(Id, **kwargs):
print("the first pa... | true |
8bf0bd75b696d3993b527653fbdc80665e13f397 | Python | Vishvas-Enjamuri/MQTools | /mqtools/examples/testit.py | UTF-8 | 827 | 2.625 | 3 | [
"Python-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import sys
from ruamel.yaml import YAML
import json
def dumpData(data):
if "Q_NAME" in data:
qname = data["Q_NAME"]
fn = "./queues/"+qname+".yml"
with open(fn, 'w') as outfile:
print("file name",fn)
yaml.dump(data, outfile)
el... | true |
100fe3cf99cb94ed159c3034105e417041269a3d | Python | robertodevpython/analytics-scripts | /v2/etl/user.py | UTF-8 | 1,455 | 2.5625 | 3 | [] | no_license | import sqlalchemy as db
from utils import log
from v2.etl import ETL
from v2.models import User
class ETLUser(ETL):
def extract(self):
from resources.database import connection
log.info("Carregando usuários do sistema...")
statement = db.sql.text(
"""
SELECT
... | true |
6debb860bc24ae0b8b0d2ee6daa9c8c68863a6f0 | Python | roobiuli/Serv_cl | /Server.py | UTF-8 | 1,414 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python
import socket
import sys
import os
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_port = int(sys.argv[1])
server_address = ('localhost', server_port)
print >>sys.stderr, 'starting up on %s port %s' % server_address
sock.bind(server_address)
sock.listen(1)
def listCurrentDir():
... | true |
7304d48b9f4d7f8efc5979cf83741e2f32c0e1bf | Python | Bondzio/rmqClient | /util/functions.py | UTF-8 | 632 | 2.671875 | 3 | [] | no_license | import re
def is_cidr(str_cidr):
pattern='^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$'
m=re.match(pattern,str_cidr)
if m == None:
return False
else:
return True
def is_ipv4(str_ipv4):
pattern='... | true |
8425b5e7701ada1d44e8d79627e24b5daddbb0f6 | Python | takeshisToCoding/Covid19-CSSE | /graph_covid.py | UTF-8 | 2,756 | 2.90625 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from scipy.signal import savgol_filter
import sys
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Graph country curves.')
parser.add_argument('--country', action='store',
... | true |
689df451760b70af53f2f055bf16a965353e7ad8 | Python | KalinHar/OOP-Python-SoftUni | /exams/apr2020/tests/test_battlefield.py | UTF-8 | 2,558 | 2.875 | 3 | [] | no_license | from project.battle_field import BattleField
from project.player.beginner import Beginner
from project.player.advanced import Advanced
from project.card.trap_card import TrapCard
from project.card.magic_card import MagicCard
from unittest import TestCase, main
class TestBattleField(TestCase):
def setUp(self):
... | true |
0d7b630647a8c73c6176ebc7c61dd0a713336bfb | Python | tomlxq/ps_py | /huawei/test_FindMinNum.py | UTF-8 | 363 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
from FindMinNum import FindMinNum
class test_FindMinNum(unittest.TestCase):
def test_func(self):
self.assertEquals("0", FindMinNum.func(self, "10", 1))
self.assertEquals("200", FindMinNum.func(self, "10200", 1))
self.assertEquals("... | true |
cd008dfa45e0db6d06f111dc6b5864c80aa07cb7 | Python | Cheribat/6.189Python | /assignment/hw2/OPT2_1.py | UTF-8 | 340 | 4.09375 | 4 | [] | no_license | # author : Will Fu
# date : 2016-09-09
def list_int(a_list):
""" Return the elements of the list
of type int.
"""
new_list = []
for value in a_list:
if isinstance(value, int):
new_list.append(value)
return new_list
list1 = [0, 'A', 12.5, 8, "hello", 583]
pr... | true |
3ca09dc5d7cf73755ac138160008e88756ad8a09 | Python | DaMacho/data-science-school-5th | /day20 advanced topics/argparse_example/argparse_ex1.py | UTF-8 | 353 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# help text 예제
# 실행 인자를 주지 않을 경우, 자동으로 help text 안내
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("num", help="number you want to print from 1")
args = parser.parse_args()
num = int(args.num)
for i in range(1, num+1):
print i,
# python argparse_ex1.py 10
| true |
20ecb45b6fc385b2769a550106036809c1d46e36 | Python | matthewssullivan/CybersecurityFinalProject | /returnPortDescription.py | UTF-8 | 1,108 | 3.21875 | 3 | [] | no_license | #CSCI 5742
#Cybersecurity Programming
#Final Project
#Portscanner interface with CVE
#Jonathan Trejo and Matt Sullivan
#11/27/2018
#returnPortDescription.py
import csv
def returnPortDescription(portNum): #function to return the description from the list of ports
with open("service-n... | true |
61368c0ece44a700ea1bae0040cccdee858389fb | Python | timokoch/porespy | /porespy/filters/__funcs__.py | UTF-8 | 26,839 | 2.859375 | 3 | [] | no_license | from collections import namedtuple
import scipy as sp
import scipy.ndimage as spim
import scipy.spatial as sptl
from scipy.signal import fftconvolve
from tqdm import tqdm
from numba import jit
from skimage.segmentation import clear_border
from skimage.morphology import ball, disk, square, cube
from skimage.morphology i... | true |
46df3b31f74e0a4595c2f4124610f43c8b3e8f37 | Python | houdinis/wsgi | /app.py | UTF-8 | 2,060 | 2.78125 | 3 | [] | no_license | from wsgiref.simple_server import make_server
from webob import Response, Request
from webob.dec import wsgify
from webob.exc import HTTPNotFound
import re
# application函数不用了, 用来和app函数对比
# def application(environ: dict, start_response):
# # 请求处理
# request = Request(environ)
# print(request.method)
# pr... | true |
0529ea5f892352530e49c139081872d2473b463d | Python | aenshtyn/safepass2 | /user_test.py | UTF-8 | 462 | 2.734375 | 3 | [] | no_license | import unittest
from user import User
class TestUser(unittest.TestCase):
def setUp(self):
self.new_user = User("NewUser", "12345")
def test_init(self):
self.assertEqual(self.new_user.username, "NewUser")
self.assertEqual(self.new_user.password, "12345")
def test_save_user(self):
... | true |
32c8bc84431d6224d8f34642cbf5b928f45ed941 | Python | Freshield/LEARN_TENSORFLOW | /19_help_figure_error/model0916.py | UTF-8 | 7,118 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Sep 16 14:41:31 2017
@author: Linstancy
"""
import tensorflow as tf
import numpy as np
import preprocessing as prepro
import cv2
import csv
import os
import skimage.data
import skimage.transform
from tensorflow.contrib.layers import flatten
from sklearn.util... | true |
4c337846f33b1aba300d3eee789dfa6e391450f6 | Python | aqueed-shaikh/submissions | /7/duda_justin/helloflask.py | UTF-8 | 660 | 3.359375 | 3 | [] | no_license |
from flask import Flask
from flask import render_template
app = Flask(__name__)
@app.route("/")
def home():
return "<h2>Hello World!</h2>"
if __name__ == '__main__':
app.run()
def fact(n):
ans = 1
while(n > 1):
ans *= n
n -= 1
return ans
def fib(n):
a = 1
b = 1
ans = ... | true |
f90a62337ccd421b2231fd0679859c05921b1bdc | Python | MilesCranmer/bnn_chaos_model | /figures/spock/modelfitting.py | UTF-8 | 5,354 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | import pandas as pd
from sklearn.metrics import precision_recall_curve
from sklearn.metrics import roc_curve, confusion_matrix, auc
from sklearn import metrics
import numpy as np
def hasnull(row):
numnulls = row.isnull().sum()
if numnulls == 0:
return 0
else:
return 1
def train_test_split(... | true |
f1dcb34a6042a920663d3521b681d9d9479eb3db | Python | prograsshopper/five-questions-for-a-week | /term10th/week_5/subsets.py | UTF-8 | 275 | 3.125 | 3 | [] | no_license | import itertools
class Solution:
def subsets(self, nums):
result = []
for i in range(0, len(nums)+1):
combi_iter = itertools.combinations(nums, i)
for combi in combi_iter:
result.append(combi)
return result
| true |
005e0e254119990ecc4ff94120a39f872747528d | Python | MelvinDunn/Algorithm_Implementations | /algorithms/algorithms/word2vec.py | UTF-8 | 4,664 | 3.109375 | 3 | [] | no_license | """
CBOW implementation is used here.
"""
import numpy as np
def get_data(filepath):
f = open(filepath, 'r')
message = f.read()
return message
def clean_text(corpus):
return corpus.lower().split()
def create_vocabulary(corpus):
#set will just output whatever order so it has to be sorted.
re... | true |
4db7f50cd10def8cde2d9edf067c751e621fd72e | Python | gracetian6/mai21-learned-smartphone-isp | /tools/dng2png.py | UTF-8 | 1,036 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | ##############
# DNG to PNG #
##############
import numpy as np
import imageio
import rawpy
import sys
import os
if __name__ == "__main__":
input_dir = sys.argv[1]
if not os.path.isdir(input_dir):
print("The folder doesn't exist!")
sys.exit()
input_dng = [f for f in os.listdir(input_dir) ... | true |
fc298a6c96b342dff7a653986b16de6b4d351d52 | Python | aydogan4288/registration-login | /login_and_registiration/login.py | UTF-8 | 3,461 | 2.625 | 3 | [] | no_license | from flask import Flask, render_template, session, request, redirect, flash
from mysqlconnection import connectToMySQL
import re
EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$')
from flask_bcrypt import Bcrypt
app = Flask(__name__)
bcrypt = Bcrypt(app)
mysql = connectToMySQL('mydb')
app.secret... | true |
1f253980a9b8783494009d5d3e16ded85ae45e84 | Python | helloyan/learning_tf | /4-7 trainmonitored.py | UTF-8 | 753 | 2.625 | 3 | [] | no_license | """
摘要:tf.train.MonitoredTraining Session
该函数可以直接实现保存及载入检查点模型的文件。与前面的方式不同,本例中并不是按
照循环步数来保存,而是按照训练时间来保存的。通过指定save_checkpoint_secs参
数的具体秒数,来设置每训练多久保存一次检查点。
作者:Lebhoryi@gmail.com
时间:2019/01/28
"""
import tensorflow as tf
tf.reset_default_graph()
global_steps = tf.train.get_or_create_global_step()
step = tf.... | true |
c0a6229787e0ed92b477c94d5b1b4f686cbaa501 | Python | LTstrange/pushbox | /search_F.py | UTF-8 | 9,771 | 2.921875 | 3 | [] | no_license | #!/user/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'LTstrange'
import copy
import time
"""
用穷举和剪枝的方法,找到推箱子的最佳走法,广度优先
对每一步的field都与先前的步骤的field比对,重复则剪枝
先前的field储存在T_field里面
U,R,D,L 分别为上右下左
"""
step = 0
T_field = []
def in_field():
code = 1
T_line = []
while True:
li... | true |
0d4805c9d8230a625d8222732a5cd3563046a349 | Python | Hiking-Apprentice/python_spider | /scrapy爬取2020考研调剂学生信息/Kaoyan_tiaoji/Kaoyan_tiaoji/spiders/kaoyan_tiaoji.py | UTF-8 | 1,115 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from ..items import KaoyanTiaojiItem
class KaoyanTiaojiSpider(scrapy.Spider):
name = 'kaoyan_tiaoji'
allowed_domains = ['chinakaoyan.com']
start_urls = ['http://chinakaoyan.com/']
def start_requests(self):
for i in range(1,411):
url="http://www.... | true |
6b1b30bda7fe39b5fa3c73e95588e32f4caaa6ed | Python | denysgerasymuk799/Logistic_system | /LogisticSystem/loc_item_vehicle.py | UTF-8 | 746 | 3.625 | 4 | [] | no_license | class Location(object):
"""class to create a Location"""
def __init__(self, city, postoffice):
"""
Description
"""
self.city, self.postoffice = city, postoffice
class Item(object):
"""class to create an Item"""
def __init__(self, name, price):
"""
Desc... | true |
a65330340d11589c2c9af70ae79f1a81f0be0e9b | Python | Ressull250/code_practice | /part4/153.py | UTF-8 | 503 | 3.03125 | 3 | [] | no_license | class Solution(object):
def findMin(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if not nums: return 0
if len(nums) == 1: return nums[0]
l,r = 0,len(nums)-1
while l<r:
mid = (l+r) / 2
if nums[r] > nums[mid]:
... | true |
5e6ae5cd9f4ba48615bc0f25407f9f2dbb9d0cad | Python | paraslonic/Genome-Complexity-Browser | /gcb_server/app/gene_graph/source/old/genes_coordinates_finder.py | UTF-8 | 1,641 | 2.53125 | 3 | [] | no_license | import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--orfiles', default='no', type=str, help='OrthoFinder output file')
parser.add_argument('--main_chain_file', default='no', type=str, help='File with main chain, generated by start.sh utilite')
parser.add_argument('-o', '--output_file', default='S... | true |
c9f1768e2f2dd47d637c2e577067eb6cd163e972 | Python | blenature/python_advanced-1 | /modules/mod6.2.functools/partial.py | UTF-8 | 171 | 3.421875 | 3 | [] | no_license | from functools import partial
def power_func(x, y, a=1, b=0):
return a*x**y + b
new_func = partial(power_func, 2, a=4)
print(new_func(4, b=1))
print(new_func(1))
| true |
f551bbbc6c01d937a78df7dee976c1cc6533a9f5 | Python | winnee0solta/cn-scrapper | /programs/ReactPost/autoreact-kawai.py | UTF-8 | 11,835 | 2.625 | 3 | [] | no_license | '''
Author : Winnee Creztha
Desc : scrapper for auto reaction
CN Auto React random posts replies
uses account.json for login
'''
import requests
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
import os
import shutil
import time
import ran... | true |
6f47c238681423c6113c0fe98ca5e106359ae045 | Python | SecMatrix/Machine-Learning-and-Practice-code | /2.1.1.1 LogisticRegression.py | UTF-8 | 2,224 | 3.328125 | 3 | [
"MIT"
] | permissive | # breast-cancer-wisconsin 乳腺癌
import datetime
import pandas as pd
import numpy as np
# 分割 训练集、测试集
from sklearn.model_selection import train_test_split
# 标准化
from sklearn.preprocessing import StandardScaler
# 逻辑斯蒂回归、随机梯度…
from sklearn.linear_model import LogisticRegression
# 分类报告 classification_report
from sklearn.metri... | true |
dd561eb652b2ff1427738468a42752aeca025c52 | Python | PriyaPareek635/QR-Code | /window.py | UTF-8 | 364 | 2.53125 | 3 | [] | no_license | import webbrowser
f = open('home.html','w')
message="""<!DOCTYPE html>
<html>
<head>
<title>Home </title>
</head>
<body>
<center>
<form method="get" action="F:/QR/qrcode-reader-master/index.html">
<button type="submit"><h1>QR Code</h1></button>
</form>
</center>
</body>
</html>"""
f.write(message)
f.cl... | true |
6332b8e9341556b3c0ffea41a1ac53856fe874fc | Python | FreedomConsultingGroup/tnt-analytics | /python/analytic2.py | UTF-8 | 4,780 | 3.375 | 3 | [] | no_license | #!/usr/bin/env python
############################################################################################
# Name: ToilAndTrouble Analytic
# Author: Scott A. Beall
# Date: 21-March-2019
# Org: Freedom Consulting Group
# Purpose:
# This program is part of the ToilAndTrouble Tech Challenge... | true |
d0af2a0129ecdf8dec83db0da6de80c446519901 | Python | juanchi1789/Machine_Learning | /Linear_logistic_Regression_and_unsupervised_learning/unsupervised learning and LR/aj_nuevo.py | UTF-8 | 4,744 | 2.921875 | 3 | [] | no_license | import pandas as pd
import numpy as np
df = pd.read_csv(r'/Users/juanmedina1810/PycharmProjects/Machine_Learning/TP4/TP/acath.csv').interpolate()
datos_maximos = 20
datos = df.drop(['sex','tvdlm'], axis=1).dropna().sample(n=datos_maximos, random_state = 123)# Tomo menos datos para mejor visualizacion
datos.reset_ind... | true |
643437f4b57f1b236c1ecd9f2fd63f71c77323ae | Python | rishi4758/machine-learning-programmes-and-projects | /programme/svm from scrarch.py | UTF-8 | 680 | 3.03125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from matplotlib import style
from sklearn import svm
style.use('ggplot')
a={'1':np.array([[1,2],[2,3],[2,5]]),'0':np.array([[6,5],[7,3],[6,9]])}
def class mongo:
def __init__(self,visualization=True):
self.colors={1:'r',0:'k'}
if self.visua... | true |
7ef7229ed40f04d9f3455e2f89e7d918c3848372 | Python | Hebertprata/ChatbotCultural | /chatbot.py | UTF-8 | 5,339 | 2.703125 | 3 | [] | no_license | import json as js
import numpy as np
import nltk
from nltk.stem.rslp import RSLPStemmer
import tensorflow as tf
import tflearn as tfl
import random
import os
import speech_recognition as sr
from gtts import gTTS
from playsound import playsound
from selenium import webdriver
driver =webdriver.Chrome('C:/Us... | true |
a3d1b29be7443e18f4b6f06d2c4155b33d89112d | Python | Spumiglio/progettoTirocinio | /evaluation.py | UTF-8 | 12,502 | 2.53125 | 3 | [] | no_license | import itertools
from multiprocessing import cpu_count
from warnings import catch_warnings, filterwarnings
from statistics import mean
from statistics import stdev
from math import sqrt
from joblib import Parallel, delayed
from sklearn.metrics import mean_squared_error
from dataPreparation import datasplitter
from f... | true |
41553246c449e8ddc7916356823afd567003f782 | Python | christophernhill/bigdataonpi | /test-and-dev/simpleplot.py | UTF-8 | 1,187 | 3.21875 | 3 | [
"MIT"
] | permissive | # Load needed Python modules
import netCDF4
import matplotlib.pyplot as plt
# Switch to directory containing file(s)
cd '/nfs/cnhlab003/cnh/mur-sst'
# Create "handle" to access netCDF file
# the variable "tFile" is not a simple variable but is an instance of
# a the netcdf4.Dataset class ( see - http://unidata.git... | true |
7d2168687cc09c496a1ef98da844828092cb6d8d | Python | bchellew15/DustProject | /BrandtFiles/make_BOSS_textfile.py | UTF-8 | 1,340 | 3.171875 | 3 | [] | no_license | #take sky_radec.dat and extract latitude and longitude
#output text file with just those
#1st coordinate column is 0 through 360, so it's longitude, then latitude.
#based on the Readme, this is same order as SFD code.
import numpy as np
from astropy.coordinates import SkyCoord
all_info = np.loadtxt("sky_radec.dat")... | true |
3682ff77f003b4c3457608f7c7648ca7bc9db23b | Python | sake224/new_demo | /main.py | UTF-8 | 430 | 4.1875 | 4 | [] | no_license | ## initializing string
string = "tokyo"
## initializing a dictionary
duplicates = {}
for z in string:
## checking whether the char is already present in dictionary or not
if z in duplicates:
## increasing count if present
duplicates[z] += 1
else:
## initializing count to 1 if not present
... | true |
3d4f595971330885738e4cf4347c5ffae9623f1b | Python | IdiotCirno/MFTI | /Arrays/E.py | UTF-8 | 3,282 | 3.578125 | 4 | [] | no_license | N = int(input())
A = []
def summ(A):
s = 0
for a in A:
s += a
return s
for i in range(N):
#A.append([0])
A.append([])
while True:
x = input()
if x == '#':
break
else:
x = x.split()
A[int(x[0])].append(int(x[1]))
#A[int(x[0]... | true |
4a6c26b1a4ad48d152e2d4a4c8c08fe3281c2b4f | Python | graevskiy/mit_6.0001 | /PSet2/hangman.py | UTF-8 | 12,473 | 4.3125 | 4 | [] | no_license | # Problem Set 2, hangman.py
# Name:
# Collaborators:
# Time spent:
# Hangman Game
# -----------------------------------
# Helper code
# You don't need to understand this helper code,
# but you will have to know how to use the functions
# (so be sure to read the docstrings!)
import random
import string
WORDLIST_FILEN... | true |
8e1b6fba3862516592717d6cb8e861750794d6bc | Python | tectronics/scientists-analysis | /preprocessing/baseline_collection.py | UTF-8 | 1,773 | 2.546875 | 3 | [
"MIT"
] | permissive | '''
Created on May 28, 2016
@author: Tania
'''
import os
import sys
from wikitools import wiki, api
import wikipedia
import csv
def wiki_search(keyword):
title=""
site = wiki.Wiki("https://en.wikipedia.org/w/api.php")
# get the title of the article
params = {'action':'query', 'list':... | true |
0b317997bff0c026849249b1bd0c7ab233215d14 | Python | AndrewMurd/Computational-Science | /Midterm/Answers/fillA.py | UTF-8 | 161 | 2.703125 | 3 | [] | no_license | import numpy as np
def fillA(n):
A = np.zeros((n,n))
for i in range(n):
for j in range(n):
A[i,j] = 1.0/(1.0+(i-j)**2)
return A
| true |
103b4ff0ba3c96e08aaad11ae89cd844204073a2 | Python | SKShah36/Design_Patterns | /Patterns/template.py | UTF-8 | 1,575 | 3.265625 | 3 | [] | no_license | # This code is adapted from https://www.geeksforgeeks.org/template-method-design-pattern/
import abc
from abc import abstractmethod
class OrderProcessTemplate(metaclass=abc.ABCMeta):
isGift: bool
@abstractmethod
def do_select(self)->None:
pass
@abstractmethod
def do_payment(self) -> Non... | true |
a36c3b408abae6101e8f5f5aee7c9fc70ab3b535 | Python | mjhossain/note-app-python | /playground/arg-test.py | UTF-8 | 225 | 2.765625 | 3 | [] | no_license | import argparse
parser = argparse.ArgumentParser(description="Some function")
parser.add_argument("-a","--add", help="to add", type=int, metavar='')
args = parser.parse_args()
if __name__ == "__main__":
print(args.add) | true |
7a1524f77294f3285057f3e140b470ab4039ebbe | Python | isperetz/Test | /week1 - problem 1-2.py | UTF-8 | 793 | 4.40625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 5 11:49:48 2017
@author: isperetz
"""
#week 1 problem 1
#Write a program that counts up the number of vowels contained in the string s.
# Valid vowels are: 'a', 'e', 'i', 'o', and 'u'.
#For example, if s = 'azcbobobegghakl', your program should print:
# Number of vowels... | true |
4054343d0a364beffd8c627bd04ccfee5eaaf670 | Python | domperor/dotfiles | /xkcd.py | UTF-8 | 2,835 | 2.59375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from sys import argv
try:
from PIL import Image
except:
from sys import stderr
stderr.write('[E] PIL not installed')
exit(1)
from io import BytesIO
from urllib.request import Request, urlopen
from urllib.parse import urlencode
import json
import re
import s... | true |
5d9d33ddd3847c854218171d00a2d56f23059a93 | Python | noaOrMlnx/sonic-utilities | /tests/synchronous_mode_test.py | UTF-8 | 1,383 | 2.578125 | 3 | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | permissive | from click.testing import CliRunner
import config.main as config
class TestSynchronousMode(object):
@classmethod
def setup_class(cls):
print("SETUP")
def __check_result(self, result_msg, mode):
if mode == "enable" or mode == "disable":
expected_msg = """Wrote %s synchronous mod... | true |
a8d0ff312b48123153aed2343dbcb9fcc70f07d7 | Python | ValeUrbina/ProteinCurationServices | /spcleaner/mafft_align.py | UTF-8 | 596 | 2.59375 | 3 | [] | no_license |
import sys
import os
# Use mafft to align a fasta alignment
# https://www.ebi.ac.uk/Tools/msa/mafft/
# https://mafft.cbrc.jp/alignment/software/
def mafft_align(fasta_path, aligned_fasta_path):
myCmd = 'mafft --auto ' + fasta_path + ' > '+aligned_fasta_path
os.system(myCmd)
def main():
fasta_path = sy... | true |
ddfe87ec4f2f7880150d189b7a0213825eb9e737 | Python | syn-plataforma/syn | /syn/model/build/common/encode_structured_data.py | UTF-8 | 3,172 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python3
import argparse
import os
import time
import pandas as pd
from pymongo import MongoClient
from syn.helpers.environment import load_environment_variables
from syn.helpers.logging import set_logger
from syn.helpers.mongodb import get_default_mongo_client
from syn.helpers.mongodb import load_data... | true |
9d36b4bbd1350b4b2eda4891d78aedc82708d6d3 | Python | mythreyiramesh/learning-mpi | /1dtemp.py | UTF-8 | 662 | 2.734375 | 3 | [] | no_license | import numpy as np
timesteps = 10;
alpha = 1;
delX = 1;
delT = 1;
const = alpha/delX**2;
domain_size = 10;
xgrid = np.linspace(1,10,domain_size);
old_temp = np.sin(xgrid);
new_temp = np.zeros(domain_size);
# since we are using only the previous and next step
lines = ["["]
for j in range(timesteps):
print(old_... | true |
3eb8ce837ff0dfcbd928e31c9d8936d7b8526ce3 | Python | DanielOjo/Lists | /Classroom exercises/Development/Task1.py | UTF-8 | 1,218 | 4.21875 | 4 | [] | no_license | #DanielOgunlana (40730)
#Lists Development Exercise Task 1
#05/01/15
def random_number():
import random
random_num = random.randint(1,11)
return random_num
def countrys():
country_list = ["England","US","France","Spain","Belgium","Japan","China","Italy","Germany","Canada"]
return cou... | true |
49915d62fdef84ddd3841ced77012a94adfeef26 | Python | flores-jacob/RoboND-Rover-Project | /code/path_generation_helpers.py | UTF-8 | 47,623 | 3.203125 | 3 | [] | no_license | import numpy as np
from collections import namedtuple
from pathfinding.core.diagonal_movement import DiagonalMovement
from pathfinding.core.grid import Grid
from pathfinding.finder.a_star import AStarFinder
def to_polar_coords_with_origin(origin_x, origin_y, x_pixels, y_pixels):
y_diffs = y_pixels - float(origin... | true |
4b7cc70fd427c3fb2ffe3e9466b9dbdd308d4a89 | Python | mfkiwl/self_drive_rtk | /src/test.py | UTF-8 | 285 | 2.96875 | 3 | [] | no_license | import os
import sys
print('os.getcwd():', os.getcwd())
print('dirname(sys.path[0]):',os.path.dirname(sys.path[0]))
print('dirname(abspath(sys.argv[0])):',os.path.dirname(os.path.abspath(sys.argv[0])))
print('dirname(realpath(__file__)):',os.path.dirname(os.path.realpath(__file__)))
| true |
8d2bfbc6e211aa36608efb8fdcebe739e83d54b1 | Python | jpatel3/nlp-playground | /summary.py | UTF-8 | 7,981 | 3.296875 | 3 | [] | no_license | # coding=UTF-8
from __future__ import division
import re
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
#Naive method for spliting a text into sentences
def split_content_to_sentences(self, content):
content = content.replace("\n",". ")
return content.split(". ")
#Naive method for split... | true |
692b7e2ff7958eaa98085e02cc5d13f9e3b35f18 | Python | yishuen/python-strings-indepth-lab | /string_functions.py | UTF-8 | 2,265 | 3.734375 | 4 | [] | no_license | def say_hello(name):
n = str(name)
return "Hi my name is {}".format(n)
# takes in a name and returns the string "Hi my name is " plus the name
# use whichever form of interpolation is most appropriate
def replace_given_substring(str_to_replace, str_to_insert, string):
return string.replace(str_to_... | true |
4b14f2b5a4205b6308ec56427cd0d4395b6b2dad | Python | ktan2020/tooling | /misc/luhn_check.py | UTF-8 | 1,360 | 3.234375 | 3 | [
"MIT"
] | permissive |
import sys
import re
import unittest
def luhn_check1(cc_no):
cc_no = [ int(d) for d in re.sub("[ \t]", "", cc_no) ]
l,s,flag = len(cc_no),0,0
for i in range(l-1,-1,-1):
n = cc_no[i]
s += sum(divmod((n*2),10)) if flag else n
flag = (flag+1) & 1
return s%10 == 0
def luhn_ch... | true |
e6da859ca549e11eb75ab8e74ffcd3a99f45b07d | Python | team5419/fingerprint-scanner | /main.py | UTF-8 | 2,157 | 2.640625 | 3 | [] | no_license | import requests
import getpass
import pyfingerprint
def login(session, email, password):
res = session.post(
"https://timesheet.team5419.org/sessions",
data={
"email" : email,
"password" : password
}
)
print(res.status_code)
print("logged in!")
ret... | true |
15f7e72c7be8b12447d203fc8f986044e95f47d5 | Python | konker/isoveli | /meerkat/meerkat/filters/dummy.py | UTF-8 | 344 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#
# meerkat.meerkat.filters.uppercase
#
# Copyright 2012 Konrad Markus
#
# Author: Konrad Markus <konker@gmail.com>
#
from meerkat.filters import BaseFilter
class Uppercase(BaseFilter):
def filter(self, data):
return str(data).upper()
class Lowercase(BaseFilter):
def filter(... | true |
e9afa76b4543c7b89183317c72421abf68b95b2e | Python | Yiyang-C/Data-Mining | /hw3/task2.py | UTF-8 | 7,498 | 2.578125 | 3 | [] | no_license | import sys
import json
import networkx as nx
import itertools
import copy
import collections
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.naive_bayes import MultinomialNB
def readInput(fp):
data =... | true |
4eb0654ab8880963d3d5bdcd91dd3ae6f294b8e1 | Python | jtyr/ansible-yaml_list_inventory | /tests/conditions.py | UTF-8 | 12,222 | 2.671875 | 3 | [
"MIT"
] | permissive | import os
import unittest
import yaml
from ansible import constants as C
from yaml_list import InventoryModule
class MyInventoryModule(InventoryModule):
def get_option(self, key):
# Override for 'optional_key_prefix'
return '_'
class MyTestCase(unittest.TestCase):
def _getenvbool(self, name,... | true |
b7585722096c0571c24da4fcb3ef78b06039d9b3 | Python | dwangproof/1337c0d3 | /2_Add_Two_Numbers/solution.py | UTF-8 | 2,626 | 4.09375 | 4 | [] | no_license | """
Problem: 2. Add Two Numbers
Url: https://leetcode.com/problems/add-two-numbers/description/
Author: David Wang
Date: 12/26/2017
You are given two non-empty linked lists representing two non-negative integers.
The digits are stored in reverse order and each of their nodes contain a
single digit. Add the two number... | true |
1efcdbd3416ed516c41ee3f225c709ee64051b18 | Python | VeritasOS/krankshaft | /krankshaft/auth.py | UTF-8 | 3,829 | 2.671875 | 3 | [
"MIT"
] | permissive | # TODO fire signal on auth failure?
from . import authn, authz
class Auth(object):
'''
Bind a request to this object and centralizes all Authentication and
Authorization interfaces.
For convenience, you may test it in a boolean way to ensure the request
is both authenticated and authorized.
... | true |
953702068f69dda5c0cfa950705df721033ff2a9 | Python | LewisAn/python_repository | /send_email_test.py | UTF-8 | 457 | 2.515625 | 3 | [] | no_license | from poplib import POP3_SSL as pssl
client = pssl("pop.qq.com")
client.user("913248383@qq.com")
client.pass_("gcimhvyjknaxbccg")
all_num, all_sz = client.stat() # message count, mailbox size
print("There are {} messages in total".format(all_num))
print("There are {} bytes in total".format(all_sz))
print("Client lis... | true |
58c994fc7a332fcc3e8337c33cedc12ad70f933d | Python | thoughteer/edera | /edera/lockers/directory.py | UTF-8 | 1,904 | 2.703125 | 3 | [
"MIT"
] | permissive | import contextlib
import errno
import logging
import os
import os.path
import sqlite3
import edera.helpers
from edera.exceptions import LockAcquisitionError
from edera.locker import Locker
class DirectoryLocker(Locker):
"""
A directory-level locker.
A directory-level lock works as an inter-process mute... | true |
c5c4c31026aba9b2d17341074f7f0227f2d164bd | Python | BrayanSolanoF/EjerciciosPython | /quiz.py | UTF-8 | 376 | 3 | 3 | [] | no_license |
def tres_cinco(N):
if isinstance(N,int) and N >=8:
return tres_cinco_aux(N,0,0,0)
else:
return "Error"
def tres_cinco_aux(N,a,b,resultado):
resultado = 3 * a + 5 * -b
if resultado == N:
return a,b
elif N%3 == 1:
return 3 * a + 5 * -b,tres_cinco_aux(N,... | true |
d0a539b7c4818abc90e25d5138073ff94c025f16 | Python | kr-MATAGI/coursera | /3-NLP_with_Sequence_Models/Week2/Assignment/Deep_N-grams/train_model.py | UTF-8 | 2,453 | 2.8125 | 3 | [] | no_license | from trax.supervised import training
# UNQ_C4 (UNIQUE CELL IDENTIFIER, DO NOT EDIT)
# GRADED FUNCTION: train_model
def train_model(model, data_generator, batch_size=32, max_length=64, lines=lines, eval_lines=eval_lines, n_steps=1, output_dir='model/'):
"""Function that trains the model
Args:
model (t... | true |
68f6e88a305b7c9135441f9d695b5e00bf8f201c | Python | jmaroeder/adventofcode2018 | /adventofcode2018/day08.py | UTF-8 | 1,605 | 3.265625 | 3 | [] | no_license | import contextlib
import re
from pathlib import Path
from typing import Set, MutableSet, Iterable, MutableMapping, MutableSequence, Sequence, Tuple
class Node:
def __init__(self):
self.children: MutableSequence[Node] = []
self.metadata: MutableSequence[int] = []
def parse_nodes(numbers: Sequence... | true |
ba4e97cc4c2232af6cefc44bcc6afc011c001b32 | Python | pblackman/NN_calibration | /scripts/resnet_birds_cars/load_data_cars.py | UTF-8 | 4,260 | 3.09375 | 3 | [
"MIT"
] | permissive | # Loading in Stanford Cars Dataset data
import scipy.io
import numpy as np
from os import listdir
from os.path import isfile, join
from PIL import Image
# Paths to files, change if necessary
TEST_LABELS_PATH = '../../data/data_cars/cars_test_annos_labels.mat'
TRAIN_LABELS_PATH = '../../data/data_cars/cars_train_annos... | true |
68d8344058c409b30c3f3c2e2d07452588e1d725 | Python | abinashp437/OCR-summariser | /text_summarisation.py | UTF-8 | 1,461 | 2.9375 | 3 | [] | no_license | import pandas as pd
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.decomposition import TruncatedSVD
from nltk.tokenize import sent_tokenize, word_tokenize
from nltk.corpus import stopwords
from sklearn.decomposition import TruncatedSVD
import sys
# import nltk
# nltk.download('punkt')
# ... | true |
0022d38a74fbd1fbe9045775d6851df27fa625cc | Python | minq92/Tutorial.code | /Python/처음 시작하는 파이썬(Introducing Python)/Chap_06_07.py | UTF-8 | 2,882 | 3.203125 | 3 | [] | no_license | # Chap 6
from collections import namedtuple
#Chap 7
import unicodedata as ud
def unicode_test(value):
name = ud.name(value)
value2 = ud.lookup(name)
print('value="%s", name="%s", value2 = "%s"' % (value, name, value2))
unicode_test('A')
unicode_test('$')
unicode_test('\u00a2')
unicode_test('\u20ac')
uni... | true |
a6eee1df9e7b04ec30db1b28cfbb113e7b8a6999 | Python | sevskii111/ravn-norm-pokaz | /ravn.py | UTF-8 | 753 | 2.640625 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from shared import *
def ptheor(a, b, m):
return np.full(m, 1 / m)
def x(a, b, r):
return np.random.uniform(a, b, r)
def M(a, b):
return (a + b) / 2
def D(a, b):
return (b - a) ** 2 / 12
c = int(input('m:'))
a = float(input('a:'... | true |
7f71d9d0096ce72921957ffe180ae9c66d41bab2 | Python | GermanNoob/pybotvac | /pybotvac/account.py | UTF-8 | 3,966 | 2.625 | 3 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | """Account access and data handling for beehive endpoint."""
import logging
import os
import shutil
import requests
from .exceptions import NeatoRobotException
from .robot import Robot
from .session import Session
_LOGGER = logging.getLogger(__name__)
class Account:
"""
Class with data and methods for int... | true |
d90748655a99237396b7cc8b297c8f4522c7ee02 | Python | aishwaryaprasher/isha | /june28.py | UTF-8 | 914 | 2.5625 | 3 | [] | no_license | from tkinter import *
from tkinter.filedialog import askopenfile
def cmd1():
lb1.configure(text="xyz")
def cmd2():
a=askopenfile()
root = Tk()
menu=Menu(root)
root.config(menu=menu) #root ka menu bar new menu assign kia h
filemenu=Menu(menu)
menu.add_cascade(label='file' , menu=filemenu)
filemenu.add_comma... | true |
acb3f64eee45c6c21b2c847d4e01ad0b919e6e14 | Python | bvermeulen/Django | /update_currencies.py | UTF-8 | 2,555 | 2.78125 | 3 | [
"MIT"
] | permissive | ''' update currency is meant as a cron job to update the currencies in the database
used in howdimain for table stock_currency. It is not using the Django ORM
but directly with sql.
'''
from decouple import config
import requests
import psycopg2
from howdimain.utils.plogger import Logger
logformat = '%(asctime... | true |
9621f72d70c49a3f8e0afed4cf6e71f894c6ee69 | Python | anyatran/school | /CG/SciPy/file_append_1.py | UTF-8 | 1,160 | 3.625 | 4 | [] | no_license | """
Program name: file_append_1.py
Objective:Write multiple lines to a file.
Keywords: file write, append, create, open
============================================================================79
Explanation: NOTE: Once there is data in a file you can add new data onto
the end ("a"=append) using FILE = ... | true |
295e1387f8a170de09d22c959c5437d3477759e6 | Python | sfade070/keras_min | /custom_layers/pooling.py | UTF-8 | 3,119 | 3.109375 | 3 | [] | no_license | import numpy as np
from numpy.lib.stride_tricks import as_strided
def pool2d(a, kernel_size, stride, padding, pool_mode='max'):
"""
2D Pooling
Parameters:
a: input 4D array
a.shape = (D,H,W,C)
kernel_size: int, the size of the window
stride: int, the stride of the wind... | true |
b2aeaae5140ff994403520117626a09427e9890a | Python | corne12345/Project-_Euler | /005.py | UTF-8 | 209 | 3.234375 | 3 | [] | no_license | result = 2520
prime = 2
while True:
if prime == 20:
print (result)
break
elif result % prime == 0:
prime = prime + 1
else:
result = result + 2520
prime = 2 | true |
f8507bdd97f930da79515300974c43ead4d2ae45 | Python | ykravtsow/qa | /DZ3/src/test_square.py | UTF-8 | 470 | 3.15625 | 3 | [] | no_license | import pytest
import sys
sys.path.append(".")
from square import Square
from figure import Figure
S = Square('my square', 40)
F = Figure('test figure')
def test_square_area():
assert S.area == 1600
def test_square_perimeter():
assert S.perimeter == 160
def test_square_angles():
assert S.angles == 4
... | true |
79f6213293a7c1ee87c2f4dbec87fbf0754b168a | Python | ab41j1t4000/software_stuff | /Python/practice/Webscraper/flipkart_scrapper.py | UTF-8 | 758 | 2.609375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import pandas as pd
products = []
prices = []
ratings = []
content = requests.get("https://www.flipkart.com/laptops/~buybac+k-guarantee-on-laptops-/pr?sid=6bo%2Cb5g&uniq")
response = content.content
# content = driver.page_source
soup = BeautifulSoup(response,"html.parser"... | true |
5ec149f6a82ea4532ac0bdc6ffee1ce9a771a2f6 | Python | ruhanjot/DistributedReplays | /backend/utils/global_functions.py | UTF-8 | 960 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | import logging
from flask import Flask, g
from backend.utils.checks import get_checks
from backend.database.objects import Player
logger = logging.getLogger(__name__)
def create_jinja_globals(app: Flask, global_object):
is_admin, is_alpha, is_beta = get_checks(global_object)
app.jinja_env.globals.update(i... | true |
4cf19bf55561ea9598cd740a3b984f1a2af34bd6 | Python | AI-Jiny/Python-Practice | /Problem/03_for문/01_구구단.py | UTF-8 | 95 | 3.6875 | 4 | [] | no_license | a = input()
for i in range(1,10):
a = int(a)
print("{} * {} = {}".format(a, i, i * a)) | true |
7891e9e63f44147ea65185c8aa2a7162c4003997 | Python | daniel-reich/ubiquitous-fiesta | /CzrTZKEdfHTvhRphg_11.py | UTF-8 | 1,082 | 2.78125 | 3 | [] | no_license |
def gcd(d,n):
while d%n!=0:
rem=d%n
d=n
n=rem
return n
def reducefrac(frac_p):
while gcd(int(frac_p[frac_p.index('/')+1:]),int(frac_p[0:frac_p.index('/')]))!=1:
n,d=int(frac_p[0:frac_p.index('/')]),int(frac_p[frac_p.index('/')+1:])
frac_n=str(n//gcd(d,n))
... | true |
f8d020c9f10a756123f3159fcefe98f2de1faadf | Python | willcrichton/psypl-experiments | /psypl/experiments/variable_span.py | UTF-8 | 2,597 | 2.5625 | 3 | [] | no_license | import pandas as pd
from scipy.stats import wasserstein_distance
from ..base import Experiment
from ..utils import all_names, rand_const, sample, shuffle
class VariableSpanExperiment(Experiment):
all_n_var = [3, 4, 5, 6]
def exp_name(self, N_var, N_trials):
return f"varmem_{N_var}_{N_trials}"
d... | true |
499c8b503b5e6452228f64be3183510dd3aa27e7 | Python | itm-dsc-idc-2020-1/idc-practica-6-raspberry-pi-sincronizacion-de-tiempo-EstherPH | /hora.py | UTF-8 | 745 | 3 | 3 | [] | no_license |
import datetime
from time import ctime
import os
import ntplib
servidor_de_tiempo = "pool.ntp.org"
print("\nObteniendo la hora del servidor NTP:")
cliente_ntp = ntplib.NTPClient()
respuesta = cliente_ntp.request(servidor_de_tiempo)
print(respuesta.tx_time)
hora_actual = datetime.datetime.strptime(ctime(respuesta.tx... | true |
eafdd060812422cf7edd7e8e39df88c6d27c3fc1 | Python | kunweiTAN/techgym_ai | /Wk2S.py | UTF-8 | 1,526 | 3.4375 | 3 | [] | no_license | #AI-TECHGYM-3-11-A-1
#回帰問題と分類問題
#インポート
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
from sklearn.linear_model import LinearRegression, Ridge, Lasso
from sklearn.model_selection import train_test_split
from sklearn.metrics import r2_score
from sklearn.metrics ... | true |
34115542afcfa95d83679d4ecd1135994b469fdf | Python | xyeras/AnimalFarm | /Tests/Black Box/sikuliTests/viewDataBenchmark.sikuli/viewDataBenchmark.py | UTF-8 | 743 | 2.859375 | 3 | [] | no_license | #we are seeing how much it takes to load data from database to meet our NFR1
#ONE MUST ALREADY BE LOGGED IN AND IN THE DASHBOARD
import unittest
#you should already be logged into dashboard so this will cause you to go to that screen
click("1525678946189.png")
#measure the time it takes for the database to load
class... | true |
d1908e0a6d6acb5501aa84b6867899002ef90101 | Python | Hamza-Bik/python | /pythonScripting.py | UTF-8 | 4,148 | 3.453125 | 3 | [] | no_license | import os
text = "this is not a reversed text"
# text = "said"
def reverse(x):
output=""
for s in range(len(x)):
output += x[len(x) - (s+1) : len(x) - s]
return output
# print("the reversed text is: "+reverse(text))
# print('said'[len('said')-2:len('said')-1])
# no_list = [10,20,30,40]
def avera... | true |
ed02e2904c63794810bc62578179f94bf03193bd | Python | kres0167/Programmering | /MicroPython koder/temp med led kode.py | UTF-8 | 489 | 3.34375 | 3 | [] | no_license | # importere Pin, ADC and PWM klasserne
from machine import Pin, ADC, PWM
# Importere sleep klassen fra time modulet
from time import sleep
led = PWM(Pin(4), 5000)
# Instantiere ADC objekt kaldet potentiometer
temp = ADC(Pin(36))
temp.width(ADC.WIDTH_10BIT)
temp.atten(ADC.ATTN_11DB)
while True:
temp_val = temp.read(... | true |
e859982ba92d9e38525c786e72fde1a804fedec2 | Python | teaglebuilt/bocadillo | /bocadillo/error_handlers.py | UTF-8 | 1,713 | 3.34375 | 3 | [
"MIT"
] | permissive | from .request import Request
from .response import Response
from .errors import HTTPError
# Built-in HTTP error handlers.
async def error_to_html(req: Request, res: Response, exc: HTTPError):
"""Convert an exception to an HTML response.
The response contains a `<h1>` tag with the error's `title` and,
i... | true |
8932bc5c84239dc73d910d00dcc6fa895075e5e5 | Python | SuyangChen/MPSE | /MPSE/mview/old/mds.py | UTF-8 | 17,556 | 2.734375 | 3 | [] | no_license | ### MDS implementation ###
import numbers, math, random
import matplotlib.pyplot as plt
import numpy as np
import misc, distances, gd
class MDS(object):
"""\
Class with methods to solve MDS problems.
"""
def __init__(self, D, dim=2, verbose=0, title='', labels=None):
"""\
Initializes M... | true |