blob_id large_string | language 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
09353e34ffec3547a510acdadb3b8f3316a5e2b6 | Python | Muratam/yukicoder-nim | /yukicoder/inprogress/hoge.py | UTF-8 | 485 | 2.90625 | 3 | [] | no_license | from itertools import permutations
n = int(raw_input())
a = map(int, raw_input().split())
m = int(raw_input())
b = map(int, raw_input().split())
a.sort()
b.sort()
b.reverse()
res = m + 1
for perm in permutations(a, n):
print res
temp = b[:]
i, j = 0, 0
while i < n and j < m:
if temp[j] >= per... | true |
3c8235f2efdf2f208e53a3adfb494adced00f35f | Python | CesarHera/POO-Algoritmos-Py | /polimorfismo5.py | UTF-8 | 625 | 3.640625 | 4 | [] | no_license | class Persona:
def __init__(self, nombre):
self.nombre = nombre
def anvanza(self):
print('Ando caminando')
class Ciclista(Persona):
def __init__(self, nombre):
super().__init__(nombre)
def anvanza(self):
print('Ando pedaleando')
class Nadador(Persona):
def... | true |
8d53b0f90e12d49f45c26a08d5d85b9db31c38d1 | Python | sksundaram-learning/agate-sql | /tests/test_agatesql.py | UTF-8 | 5,775 | 2.921875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf8 -*-
from decimal import Decimal
import agate
import agatesql # noqa
from sqlalchemy import create_engine
class TestSQL(agate.AgateTestCase):
def setUp(self):
self.rows = (
(1.123, 'a', True, '11/4/2015', '11/4/2015 12:22 PM'),
# See issue... | true |
319ef6777f36329faa8ea7a1732b06cccbba1e12 | Python | theoptips/algorithm_exercise | /python_list_comprehension.py | UTF-8 | 497 | 3.625 | 4 | [] | no_license | # python list comprehension
# times table example
times_table = [i*j for i in range(1,10) for j in range(1,10)]
print (times_table)
# coursera exercise list of all possible ids letterletterdigitsdigits e.g. xy04
lowercase = 'abcdefghijklmnopqrstuvwxyz'
digits = '0123456789'
answer = [str(i)+str(j)+str(k)+str(m) for i... | true |
4c6c8f9104df28f2b80812069f8be307adb98111 | Python | zara9006/naver_news_search_scraper | /naver_news_search_crawler/press_list.py | UTF-8 | 442 | 2.625 | 3 | [] | no_license | from .utils import get_soup
def get_press_list():
def parse(link):
oid = link['href'].split('oid=')[-1].split('&')[0]
name = link.text
return oid, name
url = 'https://news.naver.com/main/officeList.nhn'
soup = get_soup(url)
links = soup.select('ul[class=group_list] a')
pres... | true |
5d7f138202f0d4c83081335ad3b740efde910570 | Python | JCGSoto/Python | /Frecuencia_de_letra.py | UTF-8 | 351 | 4.125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Frecuencia de letra
Este programa emite la frecuencia de una letra en un texto
como pocertanje entero
@author: JCGS
"""
text = input('Ingrese un texto: ')
letter = input('Ingrese una letra: ')
a = text.count(letter)
c = len(text)
if a > 0:
b = (a/c)*(100)
print... | true |
e1201d911955e5f267cdbcdb131b8179a6d97b43 | Python | guori12321/todo | /todo/models.py | UTF-8 | 1,417 | 3.796875 | 4 | [
"MIT"
] | permissive | # coding=utf8
class Task(object):
"""
One task looks like
1. (x) Go shopping
if this task not done, leave there blank.
Attrributes
id int
content str
done bool
"""
def __init__(self, id, content, done=False):
self.id = id
self.content =... | true |
6c1705075cde2498f7acb8804c23929130543072 | Python | Latikeshnikam/zelthy-assignments | /assignment-1/main.py | UTF-8 | 1,078 | 2.609375 | 3 | [] | no_license | from flask import Flask
import requests
import json
from io import BytesIO
from flask import render_template
import csv
app = Flask(__name__, template_folder='template')
# To display the fetched data
@app.route('/', methods=['GET'])
def get_data():
data = requests.get('https://606f76d385c3f0001746e93d.mockapi.io/... | true |
a07f69d9c8f2603bf46fe1604ec9e23952a11da7 | Python | IvanHornung/IoT-RaspberryPi | /Course 2 - Interfacing with the Raspberry Pi/Module 3 - Protocol Libraries & APIs/TwittersAPI.py | UTF-8 | 688 | 2.625 | 3 | [] | no_license | #Twitter's API
"Twitter's API"
#Raspberry Pi can run several SDKs for Twitter's API
#RPi can make tweets
#RPi can respond to tweets
# -May look for a tag
#Twython is the package we will use
#Installing Twython
'''
sudo apt-get update
sudo apt-get install python-pip
sudo pip install twython
'''
#Pip is an installer f... | true |
3f64ae51e2ec7a387f20d2a2664b8c73f8cc0c5f | Python | davidma/gizmo | /client.py | UTF-8 | 2,493 | 2.6875 | 3 | [] | no_license | import os
import sys
import apiai
import uuid
import json
import pyowm
APIAI_CLIENT_TOKEN = 'bdbdfb49786b44b7bc4e0eddd4dba9ae'
PYOWM_CLIENT_TOKEN = 'ba58abbdec163813716f64cf4138d36b'
DEBUG = False
def main():
ai = apiai.ApiAI(APIAI_CLIENT_TOKEN)
print ("=====================================================... | true |
4044066b62b5814adc21737b77594e9e0ef0b43d | Python | safiyesarac/python_projects | /two_body_simulation/two_body_animation.py | UTF-8 | 3,106 | 2.765625 | 3 | [] | no_license |
import math;
import tkinter;
import sys
import matplotlib.animation as ani
from matplotlib.patches import Circle
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
states=[]
steps=0
class View :
... | true |
c501ca8f0ece9587841ef244f7fad0dacc710915 | Python | yovanycunha/P1 | /opbancarias/opbancarias.py | UTF-8 | 500 | 3.0625 | 3 | [] | no_license | #coding: utf-8
# Operações Bancárias
# (C) 2016, Yovany Cunha/UFCG, Programaçao I
cliente,saldo = raw_input('').split()
saldo = float(saldo)
while True:
entrada = raw_input('')
if entrada == '3': break
operacao,quantia = entrada.split()
operacao = int(operacao)
quantia = float(quantia)
if operacao == 1:
#qu... | true |
508687d46649043a7284031c2baad9e9d6fd508c | Python | daniel-reich/ubiquitous-fiesta | /FwCZpyTZDH3QExXE2_14.py | UTF-8 | 97 | 2.828125 | 3 | [] | no_license |
def amount_fib(n):
x,y, cnt = 0,1,0
while x<n: x,y,cnt = y, x+y, cnt+1
return cnt
| true |
5dcace6aa3a20e1242fc7466550fe2b1d335dce5 | Python | yangjian615/My_python_pro | /python_workspace/CSA_code_demo/cylon_funcs.py | UTF-8 | 10,791 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python
import datetime as dt
import glob
import numpy as np
from collections import Counter # for size_mode()
def mon_no(month):
'''To return the Mon as a string number''' #This could return a string, e.g. '01', '02', etc?
months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',... | true |
6c9d391e913387c6337374ccae3c6afb53247b9d | Python | frank6866/python-scripts | /testing/consumeMemory.py | UTF-8 | 410 | 3.03125 | 3 | [] | no_license | import sys
import time
def consume_memory(v_increase_by_mb_per_second):
strs = []
while True:
print len(strs)
strs.append(' ' * int(v_increase_by_mb_per_second) * (2 ** 20))
time.sleep(1)
if __name__ == "__main__":
increase_by_mb_per_second = 10
if len(sys.argv) == 2:
... | true |
95d3960fe267ed450064cdd2f3273407061d4628 | Python | cs-richardson/fahrenheit-albs1010 | /Convert C to F.py | UTF-8 | 640 | 4.5 | 4 | [] | no_license |
# Albert
# It asks for a number input from the user in numeric form
your_number = input("Enter a whole number in Celsius ")
def convert(number):
# Function that tries the number and converts to F, if not a valid number, error.
try:
value = int(number)
if value >= -273:
new_number = v... | true |
4abc3f9514815675d0106c0ea96b8a223e6dd1be | Python | montenegrodr/daftlistings | /examples/sale_agreed_properties.py | UTF-8 | 819 | 3.375 | 3 | [] | no_license | # Get the current sale agreed prices for properties in Dublin 15 that are between 200,000 and 250,000.
from daftlistings import Daft, SaleType
daft = Daft()
daft.set_county("Dublin City")
daft.set_area("Dublin 15")
daft.set_listing_type(SaleType.PROPERTIES)
daft.set_sale_agreed(True)
daft.set_min_price(200000)
daft.s... | true |
43c01a8d25b66afa1f1ab5f96f7f15b22d67733d | Python | NeoMindStd/CodingLife | /baekjoon/11772py/a.py | UTF-8 | 88 | 2.984375 | 3 | [] | no_license | s=0
for i in range(int(input())):
p=input()
s+=int(p[:-1])**int(p[-1])
print(s)
| true |
127f436a22d863413f8b92cbbc33a35177d34ee1 | Python | JoukoRintamaki/mooc-ohjelmointi-21 | /osa05-11_kertomat/src/kertomat.py | UTF-8 | 273 | 3.5 | 4 | [] | no_license | def kertomat(n: int):
kertomatDictionary = {}
i = 1
while i <= n:
j = i
lukuKertoma = 1
while j > 0:
lukuKertoma *= j
j -= 1
kertomatDictionary[i] = lukuKertoma
i += 1
return kertomatDictionary | true |
2494d0f7939e7d40e84e472784de5c1725685455 | Python | andreikee/pyTextGames | /tic_tac_toe/tic_tac_toe.py | UTF-8 | 3,326 | 4 | 4 | [
"MIT"
] | permissive | """
Tic-tac-toe (American English), noughts and crosses (Commonwealth English), or Xs and Os/“X’y O’sies” (Ireland), is a paper-and-pencil game for two players, X and O, who take turns marking the spaces in a 3×3 grid. The player who succeeds in placing three of their marks in a diagonal, horizontal, or vertical row is... | true |
4fde598ca6b03824625177f00d528f1ed79501a7 | Python | holim0/Algo_Study | /python/boj9935.py | UTF-8 | 824 | 3.125 | 3 | [] | no_license | from collections import deque
string = input()
explosion = input()
exlen = len(explosion)
string.rstrip("\n")
explosion.rstrip("\n")
stack= []
cur = deque([])
for s in string:
stack.append(s)
if len(cur)<exlen:
cur.append(s)
else:
cur.popleft()
cur.append(s)
... | true |
f3cb6379f7e624f042c0e5e6b4259111ceaf8005 | Python | wilcockj/AdventOfCode2020 | /day7/main.py | UTF-8 | 3,375 | 3.0625 | 3 | [] | no_license | import fileinput
from collections import Counter
import re
inputlist = []
for line in fileinput.input():
inputlist.append(line.strip())
baglist = []
canholdgold = {}
bagdict = {}
testbagdict = {}
parents = []
bagnumberdict = {}
# make dicitionary write if a bag can contain shiny gold
# then look through and see if... | true |
f8b35f8619628d26c532c6885750ecb3da2d9d93 | Python | ryujaehun/baseline | /code/model/srcnn.py | UTF-8 | 1,832 | 2.75 | 3 | [] | no_license | import torch
import torch.nn as nn
from math import sqrt
class ConvBlock(torch.nn.Module):
def __init__(self, input_size, output_size, kernel_size=4, stride=2, padding=1, bias=True, activation='relu', norm='batch'):
super(ConvBlock, self).__init__()
self.conv = torch.nn.Conv2d(input_size, output_siz... | true |
374c1f123d22b6b46195e0c05f8361b5ea0830c2 | Python | ryanoh98/pepper_study | /posture2.py | UTF-8 | 1,386 | 2.625 | 3 | [] | no_license | import qi
import argparse
import sys
import time
import almath
def posture2(session):
motion_service = session.service("ALMotion")
motion_service.setStiffnesses(["Head", "Shoulder", "Elbow"], [1.0, 1.0, 1.0])
names = ["HeadYaw", "HeadPitch", "LShoulderRoll", "RShoulderRoll", "LElbowRoll", "RElb... | true |
a2d75cbea23dd05d525ba7364ef2d5298bec8d2e | Python | zhaotong139/4043 | /main_car.py | UTF-8 | 2,839 | 3.78125 | 4 | [] | no_license | import time
#导入time,用到系统当前时间
'''使用面向对象的思路实现『停车收费』场景:
1. 车主开车进入停车场,产生停车记录,
2. 车主开车继续向前,将车停到车位上,修改前面的停车记录,
3. 车主停车完成,
一段时间(购物、吃饭...)之后,车主驾车准备离开停车场,
4. 车主开车离开车位,修改停车记录,
5. 车主开车到达出口,系统根据停车的时间生成订单,
6. 车主缴纳停车费,
7. 车主离开停车场。
至此,整个停车收费的场景完成。
'''
#定义car类,属性包含车牌号,车主,联系方式,入库时间,出库时间
class Car():
#模拟,定义车位数,存出车列表
... | true |
160b4c4f45e118280dd8bf2006f9667912d08cdf | Python | Alucardmini/nlp_base_learning | /vae/vae_gen_poem.py | UTF-8 | 3,637 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python
#coding:utf-8
"""
@author: wuxikun
@software: PyCharm Community Edition
@file: vae_gen_poem.py
@time: 12/19/18 11:34 AM
"""
import keras.backend as K
from keras.layers import Dense, Lambda, Conv1D, Embedding, Input, GlobalAveragePooling1D, Reshape
from keras.losses import mse, categorical_crossentro... | true |
b086a0fe446bc23ee4c3471705392488db3b3390 | Python | Hallis1221/klassekartlager | /liste.py | UTF-8 | 5,697 | 3.625 | 4 | [
"MIT"
] | permissive | # load a Tkinter listbox with data lines from a file,
# sort data lines, select a data line, display the data line,
# edit the data line, update listbox with the edited data line
# add/delete a data line, save the updated listbox to a data file
# used a more modern import to give Tkinter items a namespace
# tested... | true |
95a677bc44e8e5e27216419d54ddee262a5d70f1 | Python | jlindsey15/oneshot | /match_net_generalize.py | UTF-8 | 9,431 | 2.546875 | 3 | [] | no_license | import numpy as np
import time
import sys
cur_time = time.time()
mb_dim = 32 #training examples per minibatch
x_dim = 28 #size of one side of square image
y_dim = int(sys.argv[1]) #possible classes
y_dim_alt = int(sys.argv[2])
n_samples_per_class = 1 #samples of each class
eps = 1e-10 #term added for numerical stab... | true |
310c5169df85532a9f2586a1da075233b26443fc | Python | XuHangkun/tianchi_channel_1 | /code/utils/padCollate.py | UTF-8 | 2,355 | 3.328125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
a variant of callate_fn that pads according to the longest sequence in
a batch of sequences
~~~~~~~~~~~~~~~~~~~~~~
:author: Xu Hangkun (许杭锟)
:copyright: © 2020 Xu Hangkun <xuhangkun@ihep.ac.cn>
:license: MIT, see LICENSE for more details.
"""
import torch
def pad_te... | true |
354f60b6d0a26639af1af51a759be5ec1c38bdce | Python | salamwaddah/nd004-1mac | /triangle.py | UTF-8 | 123 | 3.453125 | 3 | [] | no_license | import turtle
juno = turtle.Turtle()
juno.color("white")
for side in [1, 2, 3]:
juno.forward(100)
juno.left(120)
| true |
46d051c157a5199f99177df706ed014fab650c5a | Python | kiirudavid/Recipe-project | /app/requests.py | UTF-8 | 3,352 | 2.65625 | 3 | [
"MIT"
] | permissive | import urllib.request,json
from .models import Recipe
# Getting api key
# api_key = None
# app_id = None
# Getting the recipe base url
base_url = None
def configure_request(app):
global api_key, app_id, base_url
api_key = app.config['RECIPE_API_KEY']
app_id =app.config['APP_ID']
base_url = app.con... | true |
b3fdccf6b89290528577d48ba2dbac0c70dd9299 | Python | ceteongvanness/100-Days-of-Code-Python | /Day 4 - Beginner - Randomisation and Python Lists/2. Who's Paying/main.py | UTF-8 | 369 | 3.78125 | 4 | [] | no_license | import random
test_seed = int(input("Create a seed number: "))
random.see(test_seed)
namesAsCSV = input("Give me everybody's names, seperated by a comman. ")
names = namesAsCSV.split(",")
num_items = len(names)
random_choice = random.randint(0, num_items - 1)
person_who_will_pay = names[random_choice]
print(person... | true |
6b4d255384f411353e0fe311172c73c80ec0d8fd | Python | JLUVicent/crawler | /1_urllib的基本使用.py | UTF-8 | 518 | 3.765625 | 4 | [] | no_license | # 使用urllib来获取百度首页源码
# (1)定义一个url,就是要访问的地址
import urllib.request
url = 'http://www.baidu.com'
# (2)模拟浏览器向服务器发送请求 response响应
response = urllib.request.urlopen(url)
# (3)获取响应中的页面源码
# read方法 返回字节形式的二进制数据
# 将二进制数据转换为字符串
# 二进制--》字符串 解码 decode('编码的格式')
content = response.read().decode('utf-8')
# (4)打印数据
print(content)
| true |
467361c41a51f8980208d6c91652ebd601ec95a7 | Python | drewverlee/Course-Projects | /topology/test_tools.py | UTF-8 | 2,424 | 3.0625 | 3 | [] | no_license | """
File : test_tools.py
Author : Drew Verlee
Date : 17.10.13.
Email : drew.verlee@gmail.com
GitHub : https://github.com/Midnightcoffee/
Description : test the various tools used for topological sorting
"""
import unittest
from tools import file_to_graph, inverse_graph, find_sources
clas... | true |
3686e413f06988fd99a702be595627780f08a2ad | Python | srinivasycplf8/LeetCode | /weight_interval.py | UTF-8 | 3,179 | 2.953125 | 3 | [] | no_license | def merge_sort(given_length,given_array):
n=len(given_array)
if n<2:
return
mid=n//2
left=given_array[0:mid]
right=given_array[mid:n]
merge_sort(given_length,left)
merge_sort(given_length,right)
S=merge_two_sorted_arrays(left,right,given_array)
if len(S)==int(given_length):
... | true |
ddc38f4e35d02b558e0a74984752edee10e4c482 | Python | rsprenkels/python | /aoc/2019/aoc2019_08.py | UTF-8 | 1,458 | 3.390625 | 3 | [] | no_license | from collections import defaultdict
def image_checksum(all_layers, image_size):
histogram = []
for index, layer in enumerate(range(0, len(all_layers), image_size)):
histogram.append(defaultdict(int))
layer_data = all_layers[layer:layer + image_size]
for pixel in layer_data:
... | true |
e52a6d4cf9c82c459f1abfcf82cf17ae580593fd | Python | pooyanjamshidi/BO4CO | /utils/unit_tests/test_expconf_merge.py | UTF-8 | 3,281 | 2.65625 | 3 | [
"BSD-2-Clause-Views",
"BSD-3-Clause"
] | permissive | import unittest
import os
import tempfile
from merge_expconfig import *
class TestExpConfMerge(unittest.TestCase):
@classmethod
def setUpClass(cls):
base_path = os.path.dirname(os.path.realpath(__file__))
file_path = os.path.join(base_path, 'files')
def fpath(*names):
ret... | true |
40a7d4ec850b6bcc0350dd974d5663b1f196ed3c | Python | iilunin/gainloss-calc | /gainloss/ReportLoader.py | UTF-8 | 3,608 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | import io
import time
from functools import wraps
import requests
import datetime
import threading
import yaml
import gdax
import pandas as pd
import numpy as np
def rate_limited(max_per_second: int):
"""Rate-limits the decorated function locally, for one process."""
lock = threading.Lock()
min_interval =... | true |
b84e9fd285b29705416a09a07488019c8f703584 | Python | semikite/study_python | /hellp.py | UTF-8 | 1,073 | 3.921875 | 4 | [] | no_license | class Dog:
def __init__(self, name):
self.name = name
print(self.name, " was Born")
def speak(self):
print("YELP!", self.name)
def wag(self):
print("Dog's wag tail")
def m1(self):
print("m1")
def m2():
print("m2")
def __del__(self):
... | true |
46e9ead65dae36152e59ced3e95dbe343c1f5244 | Python | FernandoDGonzalez/My-CookBook | /User_input.py | UTF-8 | 98 | 3.515625 | 4 | [] | no_license | print("Hello")
name = input("Please enter your name: ")
print("Nice top meet you, " + str(name))
| true |
b02ad173d131f8d5981a015d843d62731c05810e | Python | mink007/structure_learning | /project1.py | UTF-8 | 11,476 | 3.078125 | 3 | [] | no_license | #%matplotlib inline
#Using python 2.7*
#This file is for small.csv data set. Please change the inputfilename and outputfilename paths for medium and large data sets accordingly.
import sys
import networkx as nx
import pandas as pd
import numpy as np
import math
import time
import copy
import ntpath
imp... | true |
54f8ed3f6508de7f15726e68b24229128e4dc85e | Python | Andida7/my_practice-code | /35.py | UTF-8 | 1,217 | 4.46875 | 4 | [] | no_license | """
Write a program that predicts the approximate size of a population of organisms. The
application should use text boxes to allow the user to enter the starting number of organisms,
the average daily population increase (as a percentage), and the number of days the
organisms will be left to multiply. For examp... | true |
efb3bb968dbdf62249517eb2a2dc98b8374fafe6 | Python | zht200/KNN-RF | /RandomForest.py | UTF-8 | 739 | 3.5625 | 4 | [] | no_license | '''
This file runs Random forest on the Bank Marketing dataset.
The user will need to input the number of trees and whether to use bagging in the algorithm in the console.
'''
from RF import RF
import RFdataProcessing as RFData
isBagging = True
userInput = input("Please enter the number of trees:")
TreeNum = ... | true |
91ef2e9ae2f760c9dd273ecd2b473aaa2e0990d9 | Python | gsanz95/sudokusolver | /board.py | UTF-8 | 5,022 | 3.78125 | 4 | [] | no_license | import copy
import math
from misc import *
#from block import Block
class Board:
# Creates board and saves ID and difficulty
# and initiates a list for the cells.
def __init__(self, boardId, difficulty = "NORMAL"):
self.id = boardId
self.difficulty = difficulty
self.cells = []
... | true |
de6f93e6b8b7e92139e63db6303e38c1c7d4e3ab | Python | aa10402tw/NCTU_Machine-Learning | /4_Expectation–Maximization/HW4_EM.py | UTF-8 | 4,332 | 2.625 | 3 | [] | no_license | from numpy.linalg import inv
import numpy as np
import matplotlib.pyplot as plt
import math
from math import e
from math import log
from numpy import linalg
import sys
import sympy
from sympy import *
from IPython.display import display, HTML
import random
from math import log
from math import exp
# %matplotlib inline... | true |
e8316c9ccf35bdaa617dd0420661bf34904965a5 | Python | ganeshskudva/Algorithms | /HackerRank/Game_of_Stones.py | UTF-8 | 76 | 3.25 | 3 | [] | no_license | for _ in xrange(input()):
print ["First","Second"][input()%7 in [0,1]]
| true |
f672117746932192d3ec24b9590608d9939cfb8e | Python | Giri-5/Data-Structures-and-Algorithms | /Linked_lists/Doubly_LinkedList.py | UTF-8 | 2,430 | 3.71875 | 4 | [] | no_license | class Node:
def __init__(self,data):
self.data = data
self.next = None
self.prev = None
class Linkedlist:
def __init__(self):
self.head = None
self.tail = None
self.length = 0
def append(self,data):
new_node = Node(data)
if self.head == None:
self.head = new_node
self... | true |
059d212f970416edff0a93a844a03a2a9bda2f45 | Python | lwoodyiii/AbstractAlgebra | /Vector.py | UTF-8 | 938 | 3.40625 | 3 | [] | no_license | class Vector:
def __init__(self, t):
super().__init__()
self.elements = t
self.dim = len(t)
def scalar_multiplication(self, other):
x = []
for i in self.elements:
x.append(i * other)
return Vector(tuple(x))
# Also known as the dot product
def... | true |
df29e29c4f28758bb31e34c4f32fb7b74c31b7a5 | Python | Zimbra/zm-load-testing | /zmmboxsearch/response_time.py | UTF-8 | 1,046 | 2.875 | 3 | [] | no_license | import re
import numpy as np
log_file_path = '/opt/zimbra/log/mailbox.log'
# Pattern to match lines containing "time elapsed"
pattern = r"SearchMultiMailboxRequest elapsed=(\d+)"
time_elapsed_values = []
# Read the log file and extract "time elapsed" values
with open(log_file_path, "r") as file:
for line in fil... | true |
ab282363edc3f8d97c35bd8bd43034b958d779be | Python | Educorreia932/Pokemon-Origins | /plot.py | UTF-8 | 1,110 | 3.109375 | 3 | [] | no_license | import csv
import matplotlib.pyplot as plt
import pandas as pd
import matplotlib.image as mpimg
import numpy as np
origins = {}
# Read data file
with open('data.csv', newline='') as csvfile:
reader = csv.reader(csvfile, delimiter=',')
for row in reader:
if row[1] != "" and row[1] != "Origin":
... | true |
33e31e60ec731aa6093bfbe3f03031432b83946a | Python | wukm/pycake | /merging.py | UTF-8 | 7,901 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python3
import numpy as np
import numpy.ma as ma
from scipy.ndimage import label
from skimage.morphology import remove_small_objects
import matplotlib.pyplot as plt
"""
this module contains implementations of several (simple) strategies of
turning a Frangi stack into a single image, i.e. simple segmen... | true |
0e5fee26994b35cd5bd788f42ce452bc9d810c6b | Python | Gabriel-Fernandes1917/lab-the-python | /class 2708/exercise1.py | UTF-8 | 204 | 3.5625 | 4 | [
"MIT"
] | permissive |
dictionary ={None:None}
loop = "sim"
while(loop == "sim"):
dictionary[0]=input('informe o nome\n')
dictionary[1]=input('informe o cpf\n')
loop = input('deseja continuar ?')
print(dictionary)
| true |
e9b8bff691770c8ee9aae307dd495333046f2a00 | Python | Kineolyan/lego-dir | /v2_test.py | UTF-8 | 13,235 | 2.953125 | 3 | [
"MIT"
] | permissive | import unittest
import os
import v2
from fs import TestApi
def simple_entry(location, element):
return {
"location": location,
"selection": [element]
}
class V1FormatEntryTest(unittest.TestCase):
def setUp(self):
self.fs = TestApi(cwd = '/a/b/c')
def test_with_absolute_path(self):
entry = v2.format_ent... | true |
9076ef8d82d04b336093922a068a6d1e62a7220d | Python | Alexandre1212/Householdfinance- | /Householdfinance.py | UTF-8 | 1,245 | 3.046875 | 3 | [] | no_license | import tkinter as tk
class Main(tk.Frame):
def __init__(self,root):
super().__init__(root)
self.init_main()
def init_main(self):
toolbar = tk.Frame(bg='#d7dBe0',bd=2)
toolbar.pack(side=tk.TOP,fill=tk.X)
self.add_img = tk.PhotoImage(file="\\home\\Ale... | true |
be7fcb7c7b52cb70cb2d7d063b05d79466c87792 | Python | Xutete/TransPy | /testgui.py | UTF-8 | 2,284 | 2.875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
@author: Zhanhong Cheng
"""
import matplotlib as mpl
import numpy as np
# mpl.use('Qt5Agg')
from matplotlib import pyplot as plt
# mpl.matplotlib_fname()
# mpl.rcParams['backend']= 'Qt5Agg'
fig = plt.figure()
ax = fig.add_axes([0,0,1,1])
ax.fill_between([1,2,3], [2,3,4], [3,5,4.5], where=Non... | true |
b9ad511ec2af30de0658b4f7e5650b947f6d9420 | Python | z-kidy/python-app | /socket_server.py | UTF-8 | 1,849 | 2.890625 | 3 | [] | no_license | # encoding=utf-8
# disigned by kidy zhang
import socket
import sys
from pymouse import PyMouse
# import thread
import json
HOST = '' # Symbolic name meaning all available interfaces
PORT = 10002 # Arbitrary non-privileged port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print 'Socket created'
try:
... | true |
68c8ecd0b85b18af05b54239ffc339b013f07107 | Python | pipkin0265/CTI-110 | /P4HW2_MealTipTax_MichaelPipkin (1).py | UTF-8 | 748 | 4.28125 | 4 | [] | no_license | #Calculates the total amount of a meal purchased at a restaurant
#09/24/2020
#CTI-110 P2HW1 - Meal Tip Tax Calculator
#Michael Pipkin II
num1 = float(input('Enter food cost: '))
num2 = float(input('Enter tip amount of 15, 18, or 20: '))
#validating tip percentage
if (num2 == 15):
print('15%')
elif(nu... | true |
581b04b37a1d18f2b5a62b99fd04d6bbceada04d | Python | nasosmon/python-projects | /a1.py | UTF-8 | 343 | 2.84375 | 3 | [] | no_license |
d = open(r"C:\Users\nasos\Desktop\destiny2.txt").read().split()
d.sort(key = len, reverse = True)
k = [None] * 5
for i in range (0, 5):
k[i] = d [i]
j = 0
for x in k:
a = k[j]
a = a.translate({ord(i): None for i in "aeiou"})
print (a[::-1])
j = j + 1
... | true |
c0ff52dd7a8447af85303cbefba554f748946f0c | Python | smohapatra1/scripting | /python/practice/day46/print_triangle_problem_180_degree_roration.py | UTF-8 | 424 | 3.703125 | 4 | [] | no_license | def triangle_180(n):
#Number of spaces
if n <= 50:
k = 2*n - 2
for i in range(0,n):
for j in range(0,k):
print (end =" ")
# decrementing k after each loop
k = k - 2
for j in range(0, i+1):
print ("* ", end="")
... | true |
404add1153ee7a8c6a5d4533f85d279938b19d2e | Python | cpe202fall2018/lab0-darrylyeo | /planets.py | UTF-8 | 349 | 3.8125 | 4 | [] | no_license | # Assignment:
# http://users.csc.calpoly.edu/~phatalsk/202/labs/lab00/lab00.pdf
def weight_on_planets():
weight = float(input('What do you weigh on earth? '))
output = '\nOn Mars you would weigh {} pounds.\nOn Jupiter you would weigh {} pounds.'.format(weight * 0.38, weight * 2.34)
print(output)
if __name__ == '__... | true |
47f2adc522c1d050be138349aa5eb3b63b91f3b6 | Python | WarrenWeckesser/odeintw | /setup.py | UTF-8 | 1,937 | 2.625 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
# Copyright (c) 2014, Warren Weckesser
# All rights reserved.
# See the LICENSE file for license information.
from os import path
from setuptools import setup
def get_odeintw_version():
"""
Find the value assigned to __version__ in odeintw/__init__.py.
This function assumes that t... | true |
f28033c092fc0f4743d9199971f2ce0d70ecbcde | Python | patataofcourse/yaBMGr | /main.py | UTF-8 | 924 | 2.546875 | 3 | [] | no_license | import click
import bmg
VERSION = "v1"
click.echo(f"yaBMGr {VERSION} by patataofcourse")
@click.group(help="converts BMG to RBMG and back",options_metavar='')
def cli():
pass
@cli.command( "unpack",
help="converts a BMG into the readable format RBMG",
no_args_is_help = True,
... | true |
3a051f8f37a2c44160d8cd94495351b948e83507 | Python | fcchou/tensorflow_models | /tensorflow_models/dbn.py | UTF-8 | 3,540 | 2.78125 | 3 | [] | no_license | import tensorflow as tf
from tensorflow_models.mlp import MultiLayerPerceptron
from tensorflow_models.rbm import RBMLayer, RBM
class DeepBeliefNet(MultiLayerPerceptron):
def __init__(
self,
input_size,
hidden_layer_sizes,
n_output_class=2,
learning_rate=0.001,
regu... | true |
278bde4732c6458eb8e72471064f6e6aed9df920 | Python | webserver3315/Laptop_Ubuntu_PSBOJ | /3-2/PuEn/2020_src/parse_tree.py | UTF-8 | 4,943 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python
class Node():
def __init__(self,data, parent, index, id = None, scope = ["global"]):
self.data = data
self.children = []
self.parent = parent
self.index = index
self.id = id
self.scope = scope
def __repr__(self, level = 0):
value... | true |
a8ad5c484b4119b5fcf07ebb072a96535ed9c8c5 | Python | kokoa-naverAIboostcamp/algorithm | /Algorithm/solution/BOJ2602.py | UTF-8 | 641 | 2.890625 | 3 | [] | no_license | # 2602번: 돌다리 건너기 (라이언)
scroll=' '+input()
bridge=[' '+input() for _ in range(2)]
size=len(bridge[0])
dp=[[[0]*size for _ in range(2)] for _ in range(len(scroll))]
# 처음에 초기화
for y in range(0,size):
for x in range(2):
dp[0][x][y]=1
for i in range(1,len(scroll)):
for y in range(1,size):
for x in ... | true |
f65d88b015fe805a39b7264d215ad491936c1ca6 | Python | jmdavi/exercism_practice | /python/leap/leap.py | UTF-8 | 368 | 3.640625 | 4 | [] | no_license | def leap_year(year):
#start with general case of every four years
if int(year) % 4 == 0:
#check the special cases of 100 year intervals, that aren't divisible by 400
if int(year) % 100 == 0 and int(year) % 400 != 0:
return False
#for non-special case of not 100 years, always ... | true |
451bea51cc194fd8e9cd54fa89041d3c5f63a483 | Python | nlml/liamlib | /liamlib/labelimg_tools.py | UTF-8 | 1,748 | 2.734375 | 3 | [] | no_license | import xml.etree.ElementTree as ET
import matplotlib.pyplot as plt
import matplotlib.patches as patches
def plot_img_with_rects(im, rects, edgecolor='r'):
# Plots an image with bounding boxes superimposed
fig, ax = plt.subplots(1, figsize=[7, 7])
# Display the image
ax.imshow(im)
for r in rects:
... | true |
f2099c99f5613cc8ef8c2d8dbc568c5f0eca7af3 | Python | mmngreco/py_est2 | /1 - VA DISCRETA /EST2_practica_t1.py | UTF-8 | 1,331 | 4.28125 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import scipy.stats as st
print '''
20. El **numero de maquinas reparadas** por un tecnico en un dia de trabajo sigue una **distribucion de Poisson de media 3**, calcular la probabilidad de que:
a. un dia cualquiera repare al menos 5.
b. un dia repare 5 sabiendo que ya ... | true |
135f8c337cc2981187e0f822566f0cff50c3efdb | Python | StefanBratovanov/PythonCourse | /Lecture5/Test2_sys_os.py | UTF-8 | 406 | 2.6875 | 3 | [] | no_license | import sys
import os
# print(sys.platform)
# print(sys.argv)
# print(os.access('.../.../..', os.W_OK))
# print(os.path.dirname('../Lecture5/Tests.py'))
# print(os.path.basename('/Lecture5/Tests.py'))
# print(os.path.exists('../Lecture5/Tests.py'))
for root, dirs, files in os.walk('../Lecture5'):
print(root, '---... | true |
58697aa5d5a1b224aea90fc01bb11646f2aed02e | Python | UVoggenberger/CEUAS | /CEUAS/public/uncertainties/analyse_DistributionsPlevels.py | UTF-8 | 5,525 | 2.765625 | 3 | [] | no_license | """ Plotting the errors distributions for different pressure levels
Author: Ambrogi Federico, federico.ambrogi@univie.ac.at
"""
from uncertainties_utils import *
""" Dirs, definitions, select datasets """
cov_file = 'data/covariance_matrices.npy'
variables = ['temp', 'uwind','vwind','speed','direction', 'r... | true |
76f2e70f25e5ea393ddabef04bee5dc2395e6b63 | Python | shnizzedy/SM_openSMILE | /utilities/recurse/recurse.py | UTF-8 | 2,971 | 3.40625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
recurse.py
Script to recursively collect files.
Author:
– Jon Clucas, 2017 (jon.clucas@childmind.org)
© 2017, Child Mind Institute, Apache v2.0 License
@author: jon.clucas
"""
import argparse, os
def recurse(top_dir):
"""
Function to recursively c... | true |
83279da6a64ad1b2ba4dc0dcb9920b0a941e6d7d | Python | Aasthaengg/IBMdataset | /Python_codes/p03549/s197691985.py | UTF-8 | 257 | 2.65625 | 3 | [] | no_license | import sys
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n, m = list(map(int, readline().split()))
t1 = n - m
t2 = m
print(int((t1 * 100 + t2 * 1900) / (1 / 2) ** t2))
if __name__ == '__main__':
solve()
| true |
f7d7d1235097a8f1ee7312aeba97c671628675d2 | Python | madengr00/Mission_to_Mars | /mission_to_mars.py | UTF-8 | 4,166 | 2.953125 | 3 | [] | no_license | #Dependencies
from bs4 import BeautifulSoup
from splinter import Browser
from splinter.exceptions import ElementDoesNotExist
import requests
import pandas as pd
def scrape_info():
executable_path = {'executable_path': 'chromedriver.exe'}
browser = Browser('chrome', **executable_path, headless=False)
#a di... | true |
03728ab0e4ae6295b93ef686e0ec4f85440396e9 | Python | arpithaupd/TrifonovRS.Deep_Learning_Portfolio.github.io | /Project 20: Sms spam collection/Dense_models.py | UTF-8 | 9,702 | 3.234375 | 3 | [] | no_license | """
PROJECT 20: Sms spam collection
TASK: Natural Language Processing to predict a SMS is spam or not spam
PROJECT GOALS AND OBJECTIVES
PROJECT GOAL
- Studying Feed-forward neural network for NPL
- Studying tokenization, text vectorisation and embedding
PROJECT OBJECTIVES
1. Exploratory Data Analysis
2. Training severa... | true |
10a3e53e3bc065d7097e7dc4e010ae162f861841 | Python | gynvael/arcanesector | /attic/keytest.py | UTF-8 | 304 | 3.0625 | 3 | [] | no_license | class A(object):
def __init__(self, a, b):
self.a = a
self.b = b
def __hash__(self):
return hash(self.a) ^ hash(self.b)
def __eq__(self, obj):
return self.a == obj.a and self.b == obj.b
a = A("ala", "kot")
b = A("ala", "kot")
c = A("ala", "kxt")
d = {a: "costam"}
print d[a]
| true |
a81dd8829e719d8c43aa977063fa4ff6f4756dde | Python | alejandrozorita/Python-Pensamiento-computacional | /doc_string.py | UTF-8 | 166 | 2.734375 | 3 | [] | no_license | def funcion_1(param_1):
"""descripción de la función
param_1 int cualquier entero
:return param_1 + 5
"""
return param_1 + 5
help(funcion_1)
| true |
39a78544f35be6ef9bef4d434c0609cc0f0f6d53 | Python | svebk/DeepSentiBank_memex | /workflows/images-incremental-update/image_dl.py | UTF-8 | 11,040 | 2.8125 | 3 | [
"BSD-2-Clause"
] | permissive | import requests
imagedltimeout=3
class UnknownImageFormat(Exception):
pass
def get_image_size_and_format(input):
# adapted from https://github.com/scardine/image_size
"""
Return (width, height, format) for a given img file content stream.
No external dependencies except the struct modules from cor... | true |
2f9a190a4faaa89b9c141cf6069f77bf1d849746 | Python | juliendossantos/course-RIL13 | /Python/CesiRIL13/exo28.py | UTF-8 | 309 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Dos Santos Julien'
import threading
import time
def MyTimer(tempo = 5.0):
## initialisation du timer
threading.Timer(tempo, MyTimer, [tempo]).start()
## affichage de l'heure
print time.strftime('%d/%m/%y %H:%M:%S',time.localtime())
MyTimer() | true |
e0a460f5e36d2ccf04e160af423ecd68fa14ca08 | Python | domishana/hato-bot | /library/hukidasi.py | UTF-8 | 1,257 | 3.21875 | 3 | [
"MIT"
] | permissive | # coding: utf-8
import unicodedata
# Sudden Death(元にしたコードのライセンスは以下の通り)
# MIT License
# Copyright (c) 2016 koluku
# https://github.com/koluku/sudden-death/blob/master/LICENSE
def text_length_list(text):
"""突然の死で使う関数"""
count_list = list()
for t in text:
count = 0
for c in t:
... | true |
a1c4a432c92a3392faef71aca30c7b3ce8afa8e5 | Python | akamakim/synology | /script/folderit | UTF-8 | 1,985 | 3 | 3 | [] | no_license | #!/usr/bin/env python
'''
use this script to group files in a "tagged" folder.
'''
import os
import sys
import re
import shutil
def system_mv(src,dst):
# python mv function is too slow, use system mv.
os.system("mv '%s' '%s'"%(src,dst))
try:
os.chdir(sys.argv[1]);
except:
print "chdir failed"
exit()
# disp... | true |
88f851f702cd8583c813f556659281e60e9ca655 | Python | spather/CousinsCodingCamp | /Lessons/03/lesson3.py | UTF-8 | 583 | 2.6875 | 3 | [
"MIT"
] | permissive | WIDTH = 500
HEIGHT = 300
alien = Actor("alien")
alien.pos = 100, 56
asteroid = Actor("asteroid")
asteroid.left = WIDTH
asteroid.top = 50
def draw():
screen.fill((0, 102, 255))
alien.draw()
asteroid.draw()
def update():
asteroid.left -= 2
if alien.colliderect(asteroid):
alien.image = "ali... | true |
bf711fb4287ed41f82b00d034794259a3e2da46e | Python | jimgrund/capstone | /top_universities/scrape_top_university_list.py | UTF-8 | 4,327 | 2.765625 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from bs4 import BeautifulSoup
from pathlib import Path
import pandas as pd
import re
import os
import urllib
import time
from random import randint
UNIVERSITIES_CACHE_FILE = "universi... | true |
bceefb396269e3cd7698d40c908a9239991f89b2 | Python | GraceRonnie/my-isc-work | /python/TempProbeSerial.py | UTF-8 | 1,187 | 2.9375 | 3 | [] | no_license | #!/usr/bin/python2.7
import serial as ser
import time
import datetime
ser = ser.Serial(
port = '/dev/ttyUSB0',
baudrate = 9600,
bytesize = ser.EIGHTBITS,
parity = ser.PARITY_NONE,
stopbits = ser.STOPBITS_ONE
)
#for i in range(3): #here we created a for loop to read the temp every 10 seconds f... | true |
702c4e0f0159f9a30c59fb2a7277a6a0bc438538 | Python | Mabo-IoT/every2mqtt | /MqttClient.py | UTF-8 | 920 | 2.515625 | 3 | [] | no_license | import paho.mqtt.client as mqtt
import yaml
import logger
class MQTTclient:
client = None
clientid = None
host = ''
port = None
keepalive = None
def __init__(self):
'''
初始化,从配置文件读取MQTT参数
'''
try:
# 读取配置文件
f = open("config.yaml","r+",e... | true |
750dc375504f55ca53365c29b6e70348a2b94d78 | Python | BrunoPedrinha/Discord-Music-Bot | /UnknownPyBot/UnknownPyBot/MusicCommands.py | UTF-8 | 909 | 2.796875 | 3 | [] | no_license | import discord
from discord.ext import commands
import MusicPlayer
music_player = MusicPlayer.MusicPlayer()
#cog class for the music commands.
class MusicCommands:
global music_player
def __init__(self, client):
self.client = client
@commands.command(pass_context=True, brief='Paste url or use "S... | true |
4e5eeaa8fd3eaa2057e8f4ddf7937b7387bf04f8 | Python | yjthay/Python | /Codility/codility_MinAvgTwoSlice.py | UTF-8 | 3,047 | 4.125 | 4 | [] | no_license | """A non-empty array A consisting of N integers is given. A pair of integers (P, Q), such that 0 ≤ P < Q < N, is called a slice of array A (notice that the slice contains at least two elements). The average of a slice (P, Q) is the sum of A[P] + A[P + 1] + ... + A[Q] divided by the length of the slice. To be precise, t... | true |
cc8ab0feb2b622d086e8a91a7042c7ca422ae546 | Python | EvaldoFilho098/ProjetoAGR | /example.py | UTF-8 | 17,328 | 2.578125 | 3 | [] | no_license | #encoding: utf-8
from tkinter import Tk, StringVar, Frame,Entry,Label,Button,Menu,BooleanVar,Checkbutton,PhotoImage,END,RIGHT,LEFT,TOP,BOTTOM,CENTER,VERTICAL,Y,HORIZONTAL,X
from tkinter import messagebox
from tkinter import ttk
from Banco import Banco
import pandas as pd
from variaveis import *
from Classes im... | true |
5400235e1abf8dabe1e1f5dc0ae70163bf63a932 | Python | g0pher98/CTF | /2019/x-mas/web/rigged_Election/md5table_gen.py | UTF-8 | 492 | 3.203125 | 3 | [] | no_license | from hashlib import md5
md5table = {}
elements = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
salt = "watch__bisqwit__"
def hashing(depth, now=0, string=""):
if depth == now:
enc = md5()
enc.update(salt+string)
md5table[string] = enc.hexdigest()
return
for e in elements:
hashing(dept... | true |
d703fe94d0f1a7a7d3815b053d6674cbdeb5d169 | Python | thiagomayllart/Flipper | /Flipper/HTTPRequester.py | UTF-8 | 2,211 | 2.578125 | 3 | [
"MIT"
] | permissive | import re
import urllib2
import base64
from base64 import b64encode, b64decode
requests_file = None
arr = None
file_string = None
def set_file(file_location):
global requests_file, file_string
requests_file = open(file_location, "r")
file_string = requests_file.read()
requests_file.clo... | true |
6a899d675d7e33b367cb2343674a8f78a0aebb8d | Python | S-GH/Keras_Basic | /keras21_1save.py | UTF-8 | 551 | 2.625 | 3 | [] | no_license | from numpy import array
import numpy as np
from keras.models import Sequential
from keras.layers import Dense, LSTM
# 13 * 3
x = array([[1,2,3],[2,3,4],[3,4,5],[4,5,6],
[5,6,7],[6,7,8],[7,8,9],[8,9,10],
[9,10,11],[10,11,12],
[20,30,40],[30,40,50],[40,50,60]])
y = array([4,5... | true |
7eb23b0ce7dfb1410a9686d5313071e3bdd235cc | Python | lingyk/Code_Interview | /CompetitiveGaming.py | UTF-8 | 679 | 3.140625 | 3 | [] | no_license | class solution(object):
def CompetitiveGaming(self, k, score):
rank = []
count = 0
level = 0
score = sorted(score, reverse=True)
for i in range(len(score)):
if score[i] != score[i-1]:
rank.append(i+1)
else:
count += 1
... | true |
437233cdcff0200bb4cf3ada91972a508be43c25 | Python | SitaramRyali/SDCND_Particle_Filters | /Particle_Filters_in_python/robot_with_particles_ingrid.py | UTF-8 | 925 | 3.203125 | 3 | [] | no_license | from math import pi
import random
from robot_class import robot
myrobot = robot()
myrobot = myrobot.move(0.1,5.0)
Z = myrobot.sense()
print(Z)
print(myrobot)
N =1000
p = []
for _ in range(N):
x = robot()
x.set_noise(0.05,0.05,5.0)
p.append(x)
p2 =[]
for i in range(N):
p2.... | true |
2dd4e4bf4e668ab96283e1a4be34ef3913e75b5a | Python | Bobowski/crypto-protocols | /oblivious-transfer/dh_simple.py | UTF-8 | 1,342 | 2.8125 | 3 | [] | no_license | import random
from charm.toolbox.ecgroup import ECGroup, ZR, G
from charm.toolbox.eccurve import prime192v1, prime256v1
class DHSimple:
def __init__(self, group_obj):
global group
group = group_obj
def gen_params(self):
g = group.random(G)
a = {'g': g}
b = {'g': g}
... | true |
587dc91f670b02cda9a0ef72f48535b6a848ca90 | Python | zohmg/zohmg | /src/zohmg/utils.py | UTF-8 | 2,011 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | true |
fc783a46ad42c4fae45b0518373608b083398e88 | Python | SaLuX8/Koneoppiminen | /T11.py | UTF-8 | 2,394 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 19 17:25:22 2020
@author: Sami
"""
import tensorflow as tf
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data() # haetaan kerasin valmis datasetti mnist
#näin voidaan jakaa koo... | true |
2a83c602a344b078ba5d38d18139e9bff7b2b0aa | Python | aineko-macx/python | /ch7/7_3.py | UTF-8 | 483 | 3.5 | 4 | [] | no_license | import math
def square_root(a):
x = a/3 #first guess
epsilon = 0.00000001
while True:
#print(x)
y = (x + a / x) / 2
if abs(y-x) < epsilon:
break
x = y
return x
def test_square_r... | true |
fdba14f05aea694ee1b27a516c8661044b55b840 | Python | xlyw236/python_exercise | /loops_start.py | UTF-8 | 194 | 3.203125 | 3 | [] | no_license | #
# Example file for working with loops
# (For Python 3.x, be sure to use the ExampleSnippets3.txt file)
def main():
for x in range(5,10):
print x
if __name__ == "__main__":
main()
| true |
136afc572ad1c2b81295e89305b400c4fde3e333 | Python | PiCoder314/kickass-tui | /src/main.py | UTF-8 | 2,205 | 2.984375 | 3 | [] | no_license | #!/bin/python3
from requests import get, RequestException
from contextlib import closing
from bs4 import BeautifulSoup as soup
import inquirer
import os
def simple_get(url):
"""
Attempts to get the content at `url` by making an HTTP GET request.
If the content-type of response is some kind of HTML/XML, re... | true |
8229d9189886177c88c57b13b52effd07cfc901f | Python | hrishikeshshenoy/website | /server.py | UTF-8 | 843 | 2.765625 | 3 | [] | no_license | from flask import Flask,render_template,request,redirect
import csv
app = Flask(__name__)
@app.route('/')
def hello_world2():
return render_template('index.html')
@app.route('/<page_name>')
def hello_world6(page_name):
return render_template(page_name)
def write_to_data(data):
with open('database.c... | true |
f4211182c83661cc63d3c3d38e66ab45f4a3bdc6 | Python | JamesP2/adventofcode-2020 | /day/12/day12-2.py | UTF-8 | 2,134 | 3.640625 | 4 | [] | no_license | import argparse
from enum import IntEnum
import math
parser = argparse.ArgumentParser(description="Rain Risk")
parser.add_argument("file", metavar="INPUT_FILE", type=str, help="Input filename")
parser.add_argument(
"--verbose", "-v", action="store_true", default=False, help="Verbose output"
)
args = parser.parse_... | true |