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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d2cecff2220496aae14bd317c88fcdab4bd3d7f2 | Python | piratejon/kernelhopping | /parseko.py | UTF-8 | 344 | 2.53125 | 3 | [] | no_license | #!/usr/bin/python
from bs4 import BeautifulSoup
import sqlite3
import sys
def get_kernel_path():
soup = BeautifulSoup(sys.stdin.read())
latest_link = soup.find("td", id="latest_link")
relative_url = latest_link.a['href']
version_string = latest_link.a.string
return(relative_url)
if __name__ == '__main__':
pr... | true |
f495c81a73d985d72e985b89b89ff4718d060a3d | Python | shenme123/NaturalLanguageProcessing | /PCFG parsing model/question6_2.py | UTF-8 | 5,719 | 2.640625 | 3 | [] | no_license | import json
from collections import defaultdict
def read_counts(file):
# read in counts from file genenrated by count_cfg_freq.py
# return counts for nonterminal, unary rules and binary rules in dicts
nonterm = defaultdict(int)
unary = defaultdict(int)
binary = defaultdict(int)
for line in file... | true |
fd4fdc7c11d99a2c4c74fc03ed9d4b5e681cfb5d | Python | qzson/Study | /keras/keras63_fashion_imshow.py | UTF-8 | 511 | 2.578125 | 3 | [] | no_license | # 과제 1
import numpy as np
from keras.datasets import fashion_mnist
from keras.utils import np_utils
from keras.models import Sequential
from keras.layers import Dense, LSTM, Conv2D
from keras.layers import Flatten, MaxPooling2D, Dropout
import matplotlib.pyplot as plt
(x_train, y_train), (x_test, y_test) = fashion_mn... | true |
ae8ff06bd652e46ac81aacbe927e49296c7c5136 | Python | Sami1309/OneLinePython | /953.py | UTF-8 | 221 | 3.234375 | 3 | [] | no_license | # https://leetcode.com/problems/verifying-an-alien-dictionary/
class Solution:
def isAlienSorted(self, words, order: str) -> bool:
return words == sorted(words, key=lambda w: [order.index(let) for let in w])
| true |
f7e9c93b8657b4a2732d28a55040dc902ea62ef6 | Python | lisa0826/pyDataAnalysis | /02/ex-week2.py | UTF-8 | 5,862 | 4 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# flag = False
# name = 'python'
# if name == 'python':
# flag = True
# print('welcome boss')
# else:
# print(name)
# num = 2
# if num == 3: # 判断num的值
# print('boss')
# elif num == 2:
# print('user')
# elif num == 1:
# print('worker')
# elif num < 0: ... | true |
402f4604090eabef6ebf79387fc75a06ce0c8b9c | Python | wonkodv/s5 | /s5/shared/util.py | UTF-8 | 2,732 | 3.03125 | 3 | [] | no_license | """
Helpers that do not belong anywhere else
"""
import sqlite3
def groupwiseIterator(iterable, n):
""" return iterator that yields iterator that yields at most n values of it
list(map(list,groupwiseIterator(range(5),2))) ->[[0,1],[2,3],[4]]
"""
it = iter(iterable)
r = range(1, n)
def su... | true |
3e7e687dd676346ca49b7e0d8d5bfbbfb1985000 | Python | gferreira/zdogpy | /Demos/not-working/burger.py | UTF-8 | 1,906 | 2.59375 | 3 | [
"MIT"
] | permissive | ### BUGGY !!!
from importlib import reload
import zDogPy.boilerplate
reload(zDogPy.boilerplate)
import zDogPy.illustration
reload(zDogPy.illustration)
import zDogPy.anchor
reload(zDogPy.anchor)
import zDogPy.hemisphere
reload(zDogPy.hemisphere)
from zDogPy.boilerplate import TAU
from zDogPy.illustration import Illust... | true |
3660f79a15e86df46f3135e71f581591c0b019a1 | Python | qbig/bio-course | /course0/gibsSampling.py | UTF-8 | 3,420 | 2.890625 | 3 | [] | no_license | import sys # you must import "sys" to read from STDIN
import random as rd
lines = sys.stdin.read().splitlines() # read in the input from STDIN
k, t, N = [int(i) for i in lines[0].split()]
DNAs = lines[1:]
def hamming(x, y):
res = 0
for i, c in enumerate(x):
if c != y[i]:
res += 1
return res
def getConsensus(... | true |
cdc373eec3179cc69a11fb51792b26e3a29383c2 | Python | Jasonluo666/LeetCode-Repository | /Python/Daily Temperatures.py | UTF-8 | 455 | 3.015625 | 3 | [] | no_license | class Solution(object):
def dailyTemperatures(self, T):
"""
:type T: List[int]
:rtype: List[int]
"""
ans = [0 for x in T]
stack = []
for index, element in enumerate(T):
while len(stack) > 0 and stack[-1][1] < element:
prev ... | true |
e45f2f0a21cfa2854e0cb497334761ae19522625 | Python | PabloTabilo/platzi-ia-ml | /05_CursoPOO_y_algo/knaspackProblem.py | UTF-8 | 1,066 | 2.734375 | 3 | [] | no_license |
def recursiveSolve(s, w, v, n):
if n==0 or s==0:
return 0
if w[n-1] > s:
return recursiveSolve(s, w, v, n-1)
return max(v[n-1] + recursiveSolve(s - w[n-1], w, v, n-1), recursiveSolve(s, w, v, n-1))
def solve(s,w,v,n):
dp = [0 for i in range(n)]
# {A}, {B}, {C}, {D}
for i in ran... | true |
8f954526e27656aa1eeaaef6a856afbe2a807274 | Python | satyans24/CodeSprints | /CodeSprint-2012-10-27-(3)/ConcatenatedPalindrome/cp.py | UTF-8 | 1,053 | 2.828125 | 3 | [
"BSD-2-Clause"
] | permissive |
import string
import sys
def addk(t, s):
if s == '':
return
c = s[0]
if not t.has_key(c):
t[c] = {}
addk(t[c], s[1:])
def palin(s):
k = len(s)
for i in range(len(s)):
palin = True
for j in range(int((k - i) / 2) + 1):
if s[j] != s[k - i - j - 1]:
... | true |
4af5eb68bb7d781199e41b158e8e59594bafa5f7 | Python | jswilson28/OptimizationApplication | /ScheduleCompilation.py | UTF-8 | 22,309 | 2.65625 | 3 | [] | no_license | # This file contains postalizers (which compile individual plates) and other schedule manipulators and compilers.
from AddressCompilation import ExistingAddressBook, NewAddressBook
from openpyxl import load_workbook
from GeneralMethods import today
import os
def day_name_from_day_num(day_num):
day_lis... | true |
9c38667e8dddc8bb4072b458f64d6719fb98ae6f | Python | ljia2/leetcode.py | /solutions/binary.search/878.Nth.Magical.Number.py | UTF-8 | 1,998 | 4.28125 | 4 | [] | no_license | class Solution:
def nthMagicalNumber(self, N, A, B):
"""
A positive integer is magical if it is divisible by either A or B.
Return the N-th magical number. Since the answer may be very large, return it modulo 10^9 + 7.
Example 1:
Input: N = 1, A = 2, B = 3
Output:... | true |
e0ba442b37df99162ae13699d257b0a114cb56d6 | Python | baoanh1310/project_euler | /pe001/fast.py | UTF-8 | 612 | 4.34375 | 4 | [] | no_license | """Mathematical approach to solve problem 1."""
def sum_divisible_by(num, upper):
"""Return sum of all divisible number by 'num' below 'upper'"""
return num * (upper // num) * (upper // num + 1) // 2
def multiples_3_or_5(upper):
"""Return the sum of all the multiples of 3 or 5 below upper"""
return su... | true |
ca229821a61e0fcc2d23d9d0dbaaf71f4fa3743b | Python | ekutukcu/SmartLock | /sensor/calibration.py | UTF-8 | 1,822 | 2.90625 | 3 | [] | no_license | from magnetometer import Magnetometer
from utime import sleep_ms
import ujson
import math
class DataLogger:
"""Logs data from the magenetomer for implementing the calibration levels"""
def __init__(self, magnetometer=None):
if magnetometer==None:
self.magnetometer = Magnetometer()
e... | true |
0d5350a3f33765b5c84a67457202645e33a18b4a | Python | TozzoL/codecademy-python-project | /run.py | UTF-8 | 388 | 2.53125 | 3 | [] | no_license | from fetch_data import *
#Create a song in the style of Paramore
lyrics('urls.csv', 'lyrics.txt')
new = new_song('lyrics.txt', 3)
print(new)
read_out_loud(new)
#possibly useful commands for debugging
#from pprint import pprint
#pprint(lyrics)
#print(soup.prettify())
#print(soup.find_all(id="lyrics"))
#print(lyr... | true |
252c838d06d2ecf07107b6b898072bcb2b15b817 | Python | s-light/OLA_test_pattern_generator | /pattern/gradient_integer.py | UTF-8 | 12,621 | 3.140625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python2
# coding=utf-8
"""
gradient pattern.
generates a test pattern:
gradient
this version only used integer values.
position values 0..1000000 (*A)
color values 0..655535 (16bit)
*A: this is enough for about 5h fade duration at 20ms/50Hz updaterate
for some more informat... | true |
30d5c069eda92bdbfb53148734d5b55f3513821a | Python | pdx-1491/stheener-bootcamphw | /Python Homework Repository/PyPoll/main.py | UTF-8 | 3,126 | 3.5 | 4 | [] | no_license | import csv
import os
csvpath = os.path.join('Resources', 'election_data.csv')
# the total amount of rows aka "votes" in the csv
votes = []
# the unique candidates in csv
candidates = []
# the aggregated votes for each candidate
candidate_votes = {}
# percentage of the vote total that each candidate received
candid... | true |
66f7c15e057053524cf78417337e95a6f2f45f42 | Python | PolinaToivonen/ITMO_ICT_WebDevelopment_2020-2021 | /students/K33422/Toivonen_Polina/task3_server.py | UTF-8 | 584 | 2.8125 | 3 | [
"MIT"
] | permissive | import socket
import codecs
server = socket.socket()
host = '127.0.0.1'
port = 14900
server.bind((host, port))
server.listen(5)
print('Entering infinite loop; hit Ctrl+C to exit')
while True:
client, (client_host, client_port) = server.accept()
print('Got connection from', client_host, client_port... | true |
135230b04f9854ec240b8bd5a048caa2d75deda6 | Python | johnwelt/titanic | /montecarlo.py | UTF-8 | 3,911 | 3.53125 | 4 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import timeit
"""
Monte Carlo Simulation from Empirical Distributions
Function 1 ecdf: compute empirical cumulative distribution function (ecdf) using existing data
Function 2 generate_rv: use random unif(0,1) and inverse t... | true |
f1b574408f07a8da0ba07962f3021b9e906b8cc4 | Python | vgtomahawk/TrollDetectionShapleyValue | /GRQCDataset/processCAGRQC.py | UTF-8 | 4,527 | 2.59375 | 3 | [] | no_license | import igraph
import random
def readGraphFromFile(fileName="CA-GrQc.txt"):
g=igraph.Graph()
vertexId=0
vertexMap={}
vertexReverseMap={}
for line in open(fileName):
words=line.split()
src=int(words[0])
dest=int(words[1])
if src not in vertexMap:
vertexMap[src]=vertexId
vertexReverseMap[vertexId]=src
... | true |
2657a2ea2d43be325d8cdf1eb643ea477e1d0038 | Python | SanketRevankar/TournamentManagementPy | /helpers/CloudServerHelper.py | UTF-8 | 1,724 | 2.640625 | 3 | [] | no_license | from django.http import HttpResponseServerError
from helpers.Util.CloudServerUtil import CloudServerUtil
from constants import StringConstants as sC
from firestore_data.ServerData import ServerList
class CloudServerHelper:
def __init__(self, config):
"""
Initiate Cloud Server Helper
This ... | true |
d9b08b0324030c924c7e26e2eb7ebf194c7d06f5 | Python | m-rahimi/ML_module | /reduce_memory_usage.py | UTF-8 | 1,365 | 3.1875 | 3 | [] | no_license | def reduce_memory_usage(df, deep=True, verbose=True, categories=True):
# All types that we want to change for "lighter" ones.
# int8 and float16 are not include because we cannot reduce
# those data types.
# float32 is not include because float16 has too low precision.
numeric2reduce = ["int16", "in... | true |
fa0e321b51ecd4fb2f3dd1b1aa7f9838f3ca0827 | Python | Maksym-Gorbunov/python1 | /test.py | UTF-8 | 1,747 | 3.828125 | 4 | [] | no_license | '''
# open and write text to the file
fo = open('test.txt', 'w+')
text = 'Maksym write this code again'
fo.write(text)
fo.close()
# open and append text in new line
fo = open('test.txt', 'a')
text = '\nand this one ...'
fo.write(text)
fo.close()
# read from the file
fo = open('test.txt', 'r+')
text = fo.read()
#chec... | true |
9d26c69a2edb43fb1c610eeec3d50ddac95b9cd5 | Python | aliciawyy/CompInvest | /tests/test_load.py | UTF-8 | 1,821 | 2.96875 | 3 | [
"MIT"
] | permissive | """
This file contains unittests for the loading functions in
.load
"""
import datetime as dt
from load.load_ticker import load_cac40_names, load_valid_cac40_names
from load.load_local_data import load_local_data_from_yahoo
from load.load_data import load_stock_close_price
from nose.plugins.attrib import attr
def t... | true |
2047d4823c77ec439097280a2f66e305a9d438aa | Python | trriplejay/django-hiddenblade | /rosters/tests/test_models.py | UTF-8 | 2,714 | 2.515625 | 3 | [] | no_license | from django.test import TestCase
from django.core.urlresolvers import reverse
from django.template.defaultfilters import slugify
from ..models import Player
from ..models import Roster
class modelTestMixin():
def setUp(self):
self.player1 = Player.objects.create(
username='player1',
... | true |
8d50cd5c1ce2cdb8fed5a045ea1b27226b2cff60 | Python | anniekli/Portfolio | /superhero-text-adventure.py | UTF-8 | 4,216 | 3.453125 | 3 | [] | no_license | start = '''
You just found out that your sister has been kidnapped and is
being held in a castle guarded by dragons!
You must now become a superhero to save her!
'''
print(start)
super_power = input("Do you want super strength or super speed? Type 'strength' or 'speed'.")
time = 45
def print_time(time):
print("Yo... | true |
07686f85aa5ddf741d83f939a4740080f77d2604 | Python | cornelinux/python-yubico | /examples/rolling_challenge_response | UTF-8 | 8,590 | 2.71875 | 3 | [
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python
#
# Copyright (c) 2011, Yubico AB
# All rights reserved.
#
"""
Demonstrate rolling challenges.
This is a scheme for generating "one time" HMAC-SHA1 challenges, which
works by being able to access the HMAC-SHA1 key on the host computer every
time the correct response is provided.
GPGME would've b... | true |
fdc051bfe908ae995073028d897670e29a8a35a7 | Python | PoonamPrusty/Python_tasks | /listprogram.py | UTF-8 | 999 | 4.0625 | 4 | [] | no_license | scores = []
choice = None
while choice != 0:
print """High Score Keeper
0 - Exit
1 - Show Scores
2 - Add a score
3 - Delete a score
4 - Sort scores """
choice = (raw_input("Choice: "))
if choice == "0":
print "Bye!"
... | true |
a60b619ec7ba692267b21a20e00dc15faff1d171 | Python | Macchiato0/Py_sort_search_data_structure | /queue(FIFO).py | UTF-8 | 1,427 | 4.875 | 5 | [] | no_license | # Queue is a linear data structure that stores items in First In First Out (FIFO) manner.
# With a queue the least recently added item is removed first.
# Operations associated with queue are:
# Enqueue: Adds an item to the queue. If the queue is full, then it is said to be an Overflow condition
# Dequeue: Removes an... | true |
264724712338429d41983634c5b674427477b1d1 | Python | antrad1978/SentimentAnalysis | /SentimentAnalysis/analysis.py | UTF-8 | 521 | 2.859375 | 3 | [] | no_license | import json
from nltk.sentiment.vader import SentimentIntensityAnalyzer
def analyze_sentiment(sentence):
print(sentence + "\n")
sid = SentimentIntensityAnalyzer()
ss = sid.polarity_scores(sentence)
for k in sorted(ss):
print('{0}: {1}, '.format(k, ss[k]), end='')
print()
#sentence = json.l... | true |
3d0e9a31a15426b572caec4b1c90f9d45588cb02 | Python | shcqupc/hankPylib | /leetcode/LC0016_R1001_mergelist.py | UTF-8 | 1,207 | 4.0625 | 4 | [] | no_license | '''
面试题 10.01. 合并排序的数组 难度 简单
给定两个排序后的数组 A 和 B,其中 A 的末端有足够的缓冲空间容纳 B。 编写一个方法,将 B 合并入 A 并排序。
初始化 A 和 B 的元素数量分别为 m 和 n。
示例:
输入:
A = [1,2,3,0,0,0], m = 3
B = [2,5,6], n = 3
输出: [1,2,2,3,5,6]
'''
class Solution(object):
def merge1(self, A, m, B, n):
"""
:type A: List[int]
:type m: int
... | true |
67bb72c9ec5e8e8e03ca4ac763c1b032616439e0 | Python | itmanni/annotated-py-projects | /flask/flask-0.5/flask/globals.py | UTF-8 | 1,261 | 2.875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
flask.globals 说明:
- 全局对象定义
- 上下文对象
- 给当前激活的上下文, 定义全部的全局对象.
~~~~~~~~~~~~~
Defines all the global objects that are proxies to the current
active context.
"""
# 关键依赖:
# - 需要看下 werkzeug 如何实现的
from werkzeug import LocalStack, LocalProxy
##############################... | true |
315fb063fb0060313fc7c6d0ce5c5dfa801d4f59 | Python | zhengnengjin/python_Learning | /Day25/类的特殊成员.py | UTF-8 | 232 | 2.875 | 3 | [] | no_license | #__author: ZhengNengjin
#__date: 2018/10/9
class F:
def __init__(self):
print('init')
def __call__(self, *args, **kwargs): # 对象后面加俩()自动执行
print('call')
obj = F()
obj()
print(F.__dict__)
| true |
30343f9cd71218a78ebdf51e2eaa54e3aafa3d9a | Python | Dora-H/HousePricePredict_CCA_Testing | /CCA_Testing.py | UTF-8 | 1,043 | 3.421875 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as mp
import seaborn as sns
data = pd.read_csv("./train.csv")
print(data.isnull().sum())
print(r'總紀錄筆數:{}'.format(data.shape[0]))
print(r'總紀錄Columns:{}'.format(data.shape[1])) # 23
var_na = [col for col in data.columns if data[col].isnull().mean() > 0]
print('... | true |
9c6249d4d5f9820e38fff01c13bf1e19d07933f6 | Python | MZandtheRaspberryPi/pi_watch | /scripts/get_transit.py | UTF-8 | 7,434 | 2.578125 | 3 | [] | no_license | import requests
import json
import pprint
from datetime import datetime
import pytz
import copy
# get_transit.py shows real time arrival predictions for stops
# for bart direction, 203806 is south
# issue for why gotta set encoding
# https://github.com/kennethreitz/requests/issues/2296
# notes on format of response
#... | true |
d7abf0f7841b0c6cf4d343263fd6811e938c7413 | Python | selvin-joseph18/training2019 | /Desktop/file_handling/csv_writer.py | UTF-8 | 271 | 3.015625 | 3 | [] | no_license | import csv
with open('data.csv','r') as file1:
csv_reader = csv.reader(file1)
#print(csv_reader)
with open('copy','w') as file2:
csv_writer = csv.writer(file2,delimiter='-')
for line in csv_reader:
csv_writer.writerow(line)
| true |
7ae1c00529a704dda4265945f2f6b7ac3359381b | Python | karpov78/rosalind-algo | /python/mend.py | UTF-8 | 681 | 2.921875 | 3 | [] | no_license | import python.ctbl
def depthFirst(node):
if len(node.edges) == 0:
return 1 if node.value == 'AA' else 0, \
1 if node.value == 'Aa' else 0, \
1 if node.value == 'aa' else 0
aa = depthFirst(node.edges[0])
bb = depthFirst(node.edges[1])
res_1 = aa[0] * bb... | true |
28d53bc929bab889a87fed626fac112d86d72fbd | Python | rovaughn/hilbert-lab-encoding | /py/color.py | UTF-8 | 2,384 | 3.1875 | 3 | [] | no_license |
class RGB:
__slots__ = ('r', 'g', 'b')
def __init__(self, r, g, b):
self.r, self.g, self.b = r, g, b
def toLab(self):
return self.toXYZ().toLab()
def toXYZ(self):
def f(t):
if t > 0.04045:
t = ((t + 0.055) / 1.055) ** 2.4
else:
t /= 12.92
return 100.0*t
r,... | true |
3746e2d5f06e089a6325608ce7e1936e3743a12d | Python | siddharthbharthulwar/Synthetic-Vision-System | /Pipeline/basegrid.py | UTF-8 | 6,920 | 2.578125 | 3 | [
"MIT"
] | permissive | #file containing functions useful in initial aggregation of DSM data
import numpy as np
import rasterio as rio
import matplotlib.pyplot as plt
import numpy.ma as ma
import math
import cv2 as cv
import rasterio.warp
import rasterio.features
from mayavi import mlab
from scipy.ndimage.filters import gaussian_filter
imp... | true |
6a6446df760b2983c4d7384a7591bdd83644dc8b | Python | FerJuaresCoria/Tarea-de-EDD | /semana03/Cliente.py | UTF-8 | 279 | 3.15625 | 3 | [] | no_license | class Cliente(object):
def __init__(self, nombre = "nombre generico", dni = "12345678"):
self._nombre = nombre
self._dni = dni
def __str__(self):
return f"Nombre: {self._nombre} \nDNI: {self._dni}"
def enviar_mensaje(mensaje):
pass
| true |
5facb3af3c5e75f267bedf2f9ed1ed9ba4f2aa12 | Python | Overdron/face_recognition_pavlov_andrey_2021 | /webcam_emotion_recognition.py | UTF-8 | 4,021 | 2.5625 | 3 | [] | no_license | import cv2
import numpy as np
import tensorflow as tf
import os
from zipfile import ZipFile
from google_drive_downloader import GoogleDriveDownloader as gdd
def load_model():
if '3_trt' in os.listdir('./'):
emotion_model = tf.keras.models.load_model('3_trt/')
elif 'model.zip' in os.listdir(... | true |
f795a2a8b54f84fa9f3c8b8017eeb6bf9ae55d8d | Python | Mezgrman/K8055 | /lcd.py | UTF-8 | 7,114 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# K8055 4Bit LCD display
# © 2013 Mezgrman
import argparse
import hashlib
import os
import psutil
import pyk8055
import random
import re
import sys
import termios
import time
import tty
from k8055_classes import K80554BitLCDController, K8055LCDUI
from subprocess import che... | true |
44c1902b3dcedc47400502b19e889e18fea700da | Python | lishan1047/PythonTeachingSample | /DataAnalysis/PandasNorthwind3.py | UTF-8 | 613 | 2.90625 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
data = pd.read_table('Northwind.txt', sep=',')
# (2) 求解销售相关性最强的两个产品。(解法二)
data = data.where(data.OrderYear != 2008)
products = pd.DataFrame(data.ProductName.unique()).dropna()
products = products.to_numpy().reshape(1, len(products))[0]
pg = [data[data.ProductName == p].gr... | true |
78956647532388d4dff9f5872cec8e2a7c1a3525 | Python | yzhxrain/polyu_AI_concept_2020 | /src/common/example.py | UTF-8 | 8,965 | 3.4375 | 3 | [] | no_license | '''
Using census.csv for evaluation
'''
# Import libraries necessary for this project
import numpy as np
import pandas as pd
from time import time
from IPython.display import display # Allows the use of display() for DataFrames
# Import supplementary visualization code visuals.py
import visuals as vs
# Import sklearn... | true |
5a35cd09dffe4f0176dd2a7bfdc903d92e725602 | Python | afshinatashian/PreBootcamp | /Tamrin8.py | UTF-8 | 406 | 3.109375 | 3 | [] | no_license | obj=eval(input())
#obj = {'Science': [88, 89, 62, 95], 'Language': [77, 78, 84, 80]}
print(type(obj))
exit()
key=obj.keys()
l=len(key)
result=[]
result2={}
for k in key:
temp=obj[k]
for i in range(len(temp)):
if len(result)<i+1:
result.append({})
result2.update(result[i])
res... | true |
c6843e2c83dde09894b0d4d956ef7187b79faba7 | Python | MohamedAboBakr/Machine_Learning_WU_Specialization_Regression | /W2_Predicting House Prices/Assignment.py | UTF-8 | 1,628 | 2.796875 | 3 | [] | no_license | import random
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import PolynomialFeatures
from sklearn import metrics
from sklearn.model_selection import train_test_split
import seaborn as sns
import statsmodels.formula... | true |
f95a03d1aeae27b11a9436aad84234cec317fbef | Python | Ginkooo/overthewire | /natas/natas11.py | UTF-8 | 868 | 2.671875 | 3 | [] | no_license | import base64
from itertools import cycle
xored_and_64 = b'ClVLIh4ASCsCBE8lAxMacFMZV2hdVVotEhhUJQNVAmhSRwh6QUcIaAw=' # cookie
decoded = base64.decodebytes(xored_and_64) # decoded cookie
text = b'{"showpassword":"no","bgcolor":"#ffffff"}' # xored decoded cookie
ret = []
for i, l in zip(text, decoded):
ret.app... | true |
960d84d912d493c189eb8288820e2040b3dd0e3e | Python | puk18/phishingwebsitesprediction | /logisticRegression/untitled0.py | UTF-8 | 1,132 | 2.828125 | 3 | [] | no_license | # Import the dependencies
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import classification_report
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
import pandas as pd
import numpy as np
imp... | true |
b34da551e1ff9b6df5fb476550d37dfa30cb57c7 | Python | RishikaMachina/Trees-2 | /Problem_2.py | UTF-8 | 826 | 3.734375 | 4 | [] | no_license | # Runs on Leetcode
# Runtime- O(n)
# Memory- O(1)
'''
1) Recursively travel through tree till we reach left leaf node of the tree. and then right nodes.
2) Maintaining the sum till last level in temp variable and adding it to result when we reach any leaf node of the tree
'''
class Solution:
def sumNumbers(sel... | true |
8d1cf5e8d56fd5b278483fabe06a14cf92f4972c | Python | kopanswer/gao | /basic_course/demo2.py | UTF-8 | 1,390 | 3.90625 | 4 | [] | no_license | # -*- coding:utf8 -*-
"""
@discription: 函数
@author: xxx
@date: 2019-03-09
"""
def add1(a,b):
return a+b
# 默认参数
def add2(a=1,b=2):
return a+b
# 可变参数
def sum(*numbers, tip): # * 代表参数有若干个,传入的参数是对的,然后把 args 封装为一个 tuple
print(type(numbers))
sum = 0
for number in numbers:
sum += nu... | true |
c0de01ce090e77300623f57199747f1dc335bd67 | Python | piotut/Pong | /pong.py | UTF-8 | 3,340 | 2.984375 | 3 | [] | no_license | #!/usr/bin/python
import pygame
from pygame.locals import * # importujemy nazwy (klawiszy)
from sys import exit
from math import *
from random import randint
#internal classes
from paddle import Paddle
from ball import Ball
from arena import Arena
from sound import Sound
from referee import Referee
from tracking impo... | true |
d67c38e19dea7962f076badf26c00bb9b613d966 | Python | pmhalvor/Hello_World_II | /Python/Diet/recipe.py | UTF-8 | 609 | 2.734375 | 3 | [] | no_license | import requests
import json
apiKey = 'a0ab8407037c4a36a9f1e77fa128f2be'
url = 'https://api.spoonacular.com'
def get_recipe(ingredients=None):
'''
ingredients: csv string of ingredients
'''
params = {
'ingredients': ingredients,
'apiKey': apiKey
}
data = requests.get(url+'/reci... | true |
4855f5bfc35ea5fe02e5d9dd0fa61b1f240b923c | Python | stephentu/forwarder | /messages.py | UTF-8 | 661 | 2.734375 | 3 | [] | no_license | import struct
# Commands
CMD_NEW_CONN = 0
CMD_DATA = 1
CMD_CLOSE_CONN = 2
# read modes
MODE_CMD = 0
MODE_PAYLOAD_LEN = 1
MODE_PAYLOAD = 2
# Message formats:
#
# New connection:
# [ CMD_NEW_CONN (1-byte) ]
#
# Data:
# [ CMD_DATA (1-byte) | payload_length (4-bytes) | payload (payload_length bytes) ... | true |
e01c9e546bc9c1ae1dafbeb8d855cf6be2035e5f | Python | aleda145/bike | /blog/models.py | UTF-8 | 1,363 | 2.703125 | 3 | [] | no_license | import datetime
from django.db import models
from django.utils import timezone
class BlogPost(models.Model):
title = models.CharField(max_length=200)
slug = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
body = models.TextField()
def __str__(self):
ret... | true |
c5d59f9001dc37e4e579921513ea738f9f7656a8 | Python | Alpha5714/pybasic | /class.py | UTF-8 | 141 | 2.765625 | 3 | [] | no_license | class Roll:
def g(self):
print('Nice stuff bro')
def toph(self):
print('Nice')
r = Roll()
r.toph()
r.g()
| true |
4e069670ff35d785a6f450b4653bd41f12ec25af | Python | bioinf/proteomics2014 | /lioznova/ht1/hw1.py | UTF-8 | 9,518 | 2.53125 | 3 | [] | no_license | import sys
import os
import copy
import argparse
def read_fasta(fp):
name, seq = None, []
for line in fp:
line = line.rstrip()
if line.startswith(">"):
if name: yield (name, ''.join(seq))
name, seq = line, []
else:
seq.append(line)
if name: yield (name, ''.join(seq))
def get_seqs(input_file_name):
... | true |
cb75b0c1a8baa77b1bb6a04b3658358bbcc2a6cb | Python | liyaguo6/data-analynsis | /RandomForest/test.py | UTF-8 | 717 | 2.703125 | 3 | [] | no_license | import pandas as pd
from sklearn.model_selection import train_test_split
import numpy as np
from sklearn.preprocessing import StandardScaler
def type_converters(s):
it = {'医疗': 0, '其它': 1}
return it[s]
df = pd.read_csv(r'C:\Users\10755\Desktop\test215.csv',header=0 \
,encoding='gbk',converter... | true |
87e15621372a19b385c35f3d1209439f461de4ff | Python | thanhtam4692/sidneysraspberry | /python/desk_light_0_on.py | UTF-8 | 1,174 | 2.640625 | 3 | [] | no_license | #!/usr/bin/python
import RPi.GPIO as GPIO
import time
import datetime
from pymongo import MongoClient
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
mongoclient = MongoClient("mongodb://localhost:27017")
db = mongoclient.sidneyspi
homeonDB = db.homeon
# init list with pin numbers
pinList = [24]
# loop through pins ... | true |
613be3d4ac5aa488e09d682ffe9d48b59b61354b | Python | akleeman/xray | /xray/test/test_formatting.py | UTF-8 | 2,448 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
import pandas as pd
from xray.core import formatting
from xray.core.pycompat import PY3
from . import TestCase
class TestFormatting(TestCase):
def test_get_indexer_at_least_n_items(self):
cases = [
((20,), (slice(10),)),
((3, 20,), (0, slice(10))),
... | true |
6428319a24166793f9156723766cb27780814abe | Python | manna422/ProjectEuler | /002.py | UTF-8 | 429 | 3.625 | 4 | [] | no_license | '''
It's unavoidable to solve this without computing most of the fibonacci sequence.
To reduce the amount of brute-forcing used we can take advantage of the fact that
the fibonacci series follows a pattern of odd then odd then even and so on.
'''
tests = input()
for i in xrange(tests):
n = input()
result = 0
... | true |
db2b0c5281616d0f0738531a7232ef887e1e4fb4 | Python | petroniocandido/mlstuff | /conexionist/activations.py | UTF-8 | 2,860 | 2.828125 | 3 | [] | no_license | import numpy as np
import mlstuff.conexionist.function as func
class Identity(func.UnivariateFunction):
def __init__(self, **kwargs):
super(BinaryStep, self).__init__(name='Binary Step', **kwargs)
def function(self, data):
return data
def derivative(self, data):
return 1
class ... | true |
d4f7e0c042a2dfde616624156d15718e29ea2fa2 | Python | yklu0330/FinTech_2019 | /HW1/ohlcExtract.py | UTF-8 | 648 | 2.921875 | 3 | [] | no_license | import csv
import sys
with open(sys.argv[1], newline='', encoding='Big5') as csvfile:
dataList = csv.reader(csvfile)
list = []
for row in dataList:
if row[3] >= '084500' and row[3] <= '134500' and row[1] == 'TX ':
list.append(row)
list2 = []
for i in range(len(list)):
... | true |
03d80e5525ac50fb2e0a79841ea6a11dc8d258a1 | Python | zm6148/2020_insight_de_traffic | /kafka_producer/src/functions.py | UTF-8 | 5,683 | 2.984375 | 3 | [] | no_license | import face_recognition as fr
import os
import cv2
import face_recognition
import numpy as np
from PIL import Image
################################################################################
# function to encode faces
# take in the path of faces you want to detect
def get_encoded_faces(known_faces_path):
"""... | true |
b6e309d7bf58f3880deacbebe10d9b9c489f2fd2 | Python | LucBerge/RobAIR | /catkin_ws/src/robairdock/scripts/dockmain.py | UTF-8 | 5,378 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
###########
# Imports #
###########
import rospy
import cv2
import cv2.aruco as aruco
import numpy as np
from math import *
from std_msgs.msg import Byte
from std_msgs.msg import String
from geometry_msgs.msg import Pose
###################
# Robot Constants #
###################
MarkerWid... | true |
dd2c628ac30105a98e42fc45180e6919604a2544 | Python | abhireddy96/Leetcode | /003_Longest_Substring_Without_Repeating_Characters.py | UTF-8 | 1,058 | 4 | 4 | [] | no_license | """
https://leetcode.com/problems/longest-substring-without-repeating-characters/
Given a string, find the length of the longest substring without repeating characters. For example, the longest
substring without repeating letters for "abcabcbb" is "abc", which the length is 3. For "bbbbb" the longest substring
is "b", ... | true |
858b0ac8e5819ecf5280cbf0a2bce1a03dd82cdc | Python | eggtart93/Phantom | /testcode/servo.py | UTF-8 | 487 | 2.8125 | 3 | [] | no_license | import wiringpi2 as wiringpi
SERVO_PIN = 12
class ServoManager(object):
def __init__(self):
wiringpi.wiringPiSetupGpio()
wiringpi.pinMode(SERVO_PIN,2)
wiringpi.pwmSetMode(0)
wiringpi.pwmSetClock(375)
angle = 90
dutyCycle = int(angle/180.0*(0.14*1024)) + 6
wiri... | true |
3e27cae18f2cd6b712b0265cf2224ebacad7ed8b | Python | AkarshanSrivastava/Data-Science-With-Python | /HYPOTHESIS TESTING/Hypothesis+testing+.py | UTF-8 | 5,525 | 3.03125 | 3 | [] | no_license | #importing the pacakages which are required
import pandas as pd
import numpy as np
import scipy
from scipy import stats
import statsmodels.api as sm
#install plotly package
import plotly.plotly as py
import plotly.graph_objs as go
from plotly.tools import FigureFactory as FF
#Mann-whitney test
data=p... | true |
1dd0c0023454a822aff1900fea3f649a3cc7bcfc | Python | lkfo415579/NMT_programs | /zh-pt-worker-NMT/worker/generalization/RE_test.py | UTF-8 | 1,868 | 3.171875 | 3 | [] | no_license | #encoding=utf-8
# this program is used to check the RE.
import sys
import re
if __name__=='__main__':
# ******Type the test Regular expression here******
RE = r''
count = 0
# Main Program
if len(sys.argv) == 1 or len(sys.argv) > 5:
print 'Launch format:'
print "python RE_test.py input_file [output_file]"
... | true |
1354c06b46d3fad21266cb61c3631a505010e193 | Python | daniel-reich/ubiquitous-fiesta | /2iETeoJq2dyEmH87R_13.py | UTF-8 | 92 | 2.921875 | 3 | [] | no_license |
def count_digits(n, d):
return ''.join(str(i ** 2) for i in range(n + 1)).count(str(d))
| true |
5e5b01f25cd1afc2d47e553fccbb69d33e904fda | Python | yurjeuna/teachmaskills_hw | /rekursii.py | UTF-8 | 1,757 | 3.453125 | 3 | [] | no_license | import string
def palindrom(string1):
a = string1.lower()
for i in set(a).intersection(set(string.punctuation)):
a = a.replace(i, '')
a = ''.join(a.split(' '))
re_a = a[::-1]
return a == re_a
def numb_of_negatives(my_list):
count = 0
if my_list[count] < 0:
co... | true |
1f24eb1548eda9138e22583097db35b1340637e3 | Python | Alexsandr0x/rSoccer | /rsoccer_gym/Entities/Frame.py | UTF-8 | 4,934 | 2.90625 | 3 | [] | no_license | import numpy as np
from typing import Dict
from rsoccer_gym.Entities.Ball import Ball
from rsoccer_gym.Entities.Robot import Robot
class Frame:
"""Units: seconds, m, m/s, degrees, degrees/s. Reference is field center."""
def __init__(self):
"""Init Frame object."""
self.ball: Ball = Ball()
... | true |
746e31de1d07ef8c011b8a52d8a53a0ba744e348 | Python | lorgiorepo/python-basico | /project07/db_version.py | UTF-8 | 572 | 3.140625 | 3 | [] | no_license | #!/usr/bin/python2.7
import MySQLdb
# Establecemos la conexion con la base de datos
db = MySQLdb.connect("localhost", "bcochile", "bcochile", "bancochile", 3306)
# Preparamos el cursos que nos va a ayudar a realizar las operaciones con la base de datos
cursor = db.cursor()
# Ejecutamos un query SQL usando el metodo... | true |
ab31b75a8f40cf33ac783565df56d62ad6ded4a8 | Python | jasonyzhang/phd | /src/util/video.py | UTF-8 | 5,343 | 2.890625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | permissive | import os
import shutil
import subprocess
import tempfile
import matplotlib.pyplot as plt
from tqdm import tqdm
def images_to_video(output_path, images, fps):
writer = VideoWriter(output_path, fps)
writer.add_images(images)
writer.make_video()
writer.close()
def sizeof_fmt(num, suffix='B'):
"""... | true |
553b89bdf8903005a1c20e51d9bdc5264aa84925 | Python | Hencya/WordPuzzleSearch | /WordPuzzleSearch_bruteforce.py | UTF-8 | 8,394 | 3.328125 | 3 | [] | no_license | import string
import time
#Bruteforce
class bruteforce:
def verticalDown(self,grid, col, row, hasilGrid):
concateGrid = grid[col][row]
hasilGrid["arrayHasil"].append(concateGrid)
hasilGrid["posisi"].append(f"{col},{row}")
hasilGrid["jenis"].append("Vertical Down")
col += ... | true |
5f85615da4a99c6e05a36c233c8aa3cc208498e4 | Python | jhuinac1/Learning-Flask | /starting-demo/app.py | UTF-8 | 1,268 | 2.6875 | 3 | [] | no_license | from flask import Flask, redirect, url_for, request, render_template
from data.books import books as books_data
app = Flask(__name__) #name determines the name of the application, this is the main file of the application
# @app.route('/profile/<int:id>')
# def profile(id):
# return '<h1>This is an profile page for... | true |
8ff3b3ef4f52ed05858e1bad7fca5f11dd1f67f7 | Python | danforthcenter/persistent_homology | /old_scripts/bottleneck-distance-parallel.py | UTF-8 | 6,799 | 2.609375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import argparse
import os
import sys
from math import ceil
def options():
"""Parse command line options.
Args:
Returns:
argparse object.
Raises:
IOError: if dir does not exist.
IOError: if the program bottleneck-distance does not exist.
IOError:... | true |
e65f20ed89b0c7ae36db59e92e2d6d272a9a6c48 | Python | kukushdi3981/sel-1_test-project | /task16_cloud_test1.py | UTF-8 | 1,664 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | import pytest
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
def test_example():
driver = webdriver.Chrome() # Optional argument... | true |
982751157147227d688245a96ba177cd79a79167 | Python | chair-dsgt/mip-for-ann | /sparsify/cp_losses.py | UTF-8 | 669 | 2.734375 | 3 | [
"MIT"
] | permissive | import cvxpy as cp
from training.utils import one_hot
def softmax_loss(last_layer_logits, y):
"""marginal softmax based on https://ttic.uchicago.edu/~kgimpel/papers/gimpel+smith.naacl10.pdf
Arguments:
last_layer_logits {cvxpy variable} -- decision variable of the solver approximated output to the... | true |
16db450417677eac34be5ede3a7cdf459021131b | Python | SuyashPandya/Word-Sense-Disambiguation | /p1.py | UTF-8 | 2,277 | 2.890625 | 3 | [] | no_license | from nltk.corpus import wordnet as wn
from nltk.stem import PorterStemmer
from itertools import chain
from nltk import pos_tag
from sys import stdout
import MySQLdb as sql
import CGIHTTPServer
CGIHTTPServer.test()
#Connect with database
db = sql.connect("localhost","root","","my_python")
#prepare a cursor
... | true |
4508465153f961a47f0a1bd7047e3a8c233c4e5f | Python | elango-ux/CodeTrainingProject | /Python/extending_buit_in_type.py | UTF-8 | 106 | 2.96875 | 3 | [] | no_license | class Text(str):
def duplicate(self):
return self + self
text = Text("Python")
text.lower() | true |
50389c8e4caed610805e927356ac0c70a7e31d7a | Python | laurobmb/ScriptsPaloAltoNetworks | /info_vacinas.py | UTF-8 | 2,004 | 2.53125 | 3 | [] | no_license | from xml.etree import ElementTree
import urllib.request
import ssl,os,sys
import time as time
import datetime
from time import strptime
import pyautogui
os.system('clear')
def barra( nome ):
barra="======================================================================================"
titulo=nome
pr... | true |
99c0bb527a0b69909c002accae605fd44a1387b0 | Python | fmaida/caro-diario | /caro-diario/diario/configurazione.py | UTF-8 | 1,557 | 3.15625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import os
import json
class Configurazione:
def __init__(self, p_file=None, p_percorso=None):
"""
Inizializza la classe
"""
if not p_percorso:
p_percorso = os.path.expanduser("~")
if not p_file:
p_file = ".config.json"
... | true |
e8a32dcd0f5fa9da6c0ef4e96036730b69e337ef | Python | zhuzaiye/HighLevel-python3 | /chapter04/class_var.py | UTF-8 | 666 | 4.09375 | 4 | [] | no_license | """
1、类变量和实例变量的认识
2、类变量和实例变量的区别
"""
class A:
# 类变量, 永远不可能通过实例进行修改,只能通过类自己进行修改
# aa是所有实例共享的
aa = 1
def __init__(self, x, y):
self.x = x # 实例变量
self.y = y
if __name__ == '__main__':
a = A(2, 3) # 实例化
# 对A类进行类变量修改
A.aa = 11
# 这里其实不是修改A.aa这个类变量,而是重新创建一个和x,y一样的aa实例变量
... | true |
7b6ec67f909c041bf4a543583f34a3b6ffca9655 | Python | CastleWhite/LeetCodeProblems | /242.py | UTF-8 | 364 | 3.265625 | 3 | [] | no_license | class Solution:
def isAnagram(self, s: str, t: str) -> bool:
if len(s) != len(t):
return False
reco = [0]*26
for i in s:
reco[ord(i)-ord('a')] += 1
for i in t:
if reco[ord(i)-ord('a')] == 0:
return False
reco[ord(i)-or... | true |
b6653d91f57b7d12487a3fc19b006b342b3009ab | Python | YuyaYoshioka/kenkyuu | /DMD/gaussian_fourie.py | UTF-8 | 4,779 | 2.96875 | 3 | [] | no_license | import math
import numpy as np
from numpy import dot, exp, pi, cos, sin
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from scipy.linalg import eigh
from scipy.integrate import solve_ivp
from scipy import integrate
# 各種定数の設定
dt = 0.0008 # 時間刻み
xmin = 0.0
xmax = 2.0*math.pi
N =100
dx = (xmax ... | true |
18e86dee3df44e850b572bbf8450992c4835af4a | Python | jiangshen95/UbuntuLeetCode | /InsertionSortList.py | UTF-8 | 938 | 3.328125 | 3 | [] | no_license | class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def insertionSortList(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
if head==None:
return head
front = ListNode(0)
cur = ... | true |
2753c61d01a36fc4e1254500de436f1b081fc667 | Python | nikio8/Python | /sandwMaker.py | UTF-8 | 2,329 | 4.25 | 4 | [] | no_license | # Sandwich Maker
# Write a program that asks users for their sandwich preferences. The program should use PyInputPlus to ensure that they enter valid input, such as:
# Using inputMenu() for a bread type: wheat, white, or sourdough.
# Using inputMenu() for a protein type: chicken, turkey, ham, or tofu.
# Using inp... | true |
bfa04a7c3959f82ebd7b05a3b342b58c6e3deed3 | Python | jsamoocha/stravalib | /stravalib/field_conversions.py | UTF-8 | 1,757 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | import logging
from datetime import timedelta
from functools import wraps
from typing import Any, Callable, List, Optional, Sequence, Union
import pytz
from pytz.exceptions import UnknownTimeZoneError
from stravalib.strava_model import ActivityType, SportType
LOGGER = logging.getLogger(__name__)
def optional_input... | true |
14a67789c8f68f609b8ec8ee8fe9fa0f6e7808ec | Python | florije1988/flask_large | /api/utility/time_utility.py | UTF-8 | 1,937 | 3.234375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
__author__ = 'florije'
from datetime import datetime
import time
DATAFORMATE = '%Y-%m-%d %H:%M:%S'
def datetime_to_timestamp(date_time):
"""
datetime(datetime.datetime) -> timestamp(int)
2014-10-27 16:56:11 -> 1414400171
:param date_time:
:return:
"""
return int(t... | true |
2c56f2e38c6fbb3a8f2626fafb25bbd83708df3a | Python | AMDS123/leetcode_python | /ReverseInteger.py | UTF-8 | 596 | 3.765625 | 4 | [] | no_license | # Reverse digits of an integer.
#
# Example1: x = 123, return 321
# Example2: x = -123, return -321
#
# click to show spoilers.
#
# Note:
# The input is assumed to be a 32-bit signed integer.
# Your function should return 0 when the reversed integer overflows.
class Solution(object):
def reverse(self, x):
"... | true |
0b19b5ba10e2b08b4c80689b92633eba38c14fbd | Python | Arnav-17/Random-Problems | /Library Management.py | UTF-8 | 4,164 | 3.40625 | 3 | [] | no_license | import time
def signup():
username = input('Enter username: \n')
password = input('Enter password: \n')
with open('Login.txt', 'a') as f:
f.write(username)
f.write(',')
f.write(password)
f.write('\n')
print('Signed up successfully')
def login():
... | true |
1d6a232960dd086bd2b7959252c3d6712a8f2890 | Python | hananbeer/pyon | /test.py | UTF-8 | 1,363 | 3.078125 | 3 | [
"MIT"
] | permissive | import json
from pyon import *
js = '{ "a": {"b": [0, 1.2, {"c": 3}, "pi"] }, "d": {"e": 5}, "z": 14 }'
data = json.loads(js)
p = PyonObject(**data)
def test(expr, expc=None):
res = eval(expr, globals())
passed = ''
if res == expc:
passed = 'PASSED!'
elif expc is not None:
raise Exception... | true |
55a0717858c6a4bf4dd248ae5cced8ab38731199 | Python | beagleboard/cloud9-examples | /BeagleBone/Blue/EduMIP/python/balance.py | UTF-8 | 5,744 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# Makes the robot balance
# Based on: https://github.com/mcdeoliveira/pyctrl/raw/master/examples/rc_mip_balance.py
import math
import time
import warnings
import numpy as np
import sys, tty, termios
import threading
import pyctrl
def brief_warning(message, category, filename, lineno, line=None)... | true |
b574ee7ac1e2b66559729ee1259e20bb5fafaff5 | Python | daikosh/youtube-streamlit | /main.py | UTF-8 | 2,766 | 3.5 | 4 | [] | no_license | import streamlit as st
import numpy as np
import pandas as pd
from PIL import Image
import time
## タイトルの表示
st.title("Streamlit 超入門")
## テキストの表示
st.write("DataFrame")
## データフレームの表示
df = pd.DataFrame({
"1列目": [1, 2, 3, 4],
"2列目": [10, 20, 30, 40]
})
st.write(df.style.highlight_max(axis=0))
st.dataframe(df.styl... | true |
f33a2bb142497a06015bff6cc6a20eed6f974927 | Python | pom2ter/immortal | /monster.py | UTF-8 | 14,501 | 2.625 | 3 | [] | no_license | import libtcodpy as libtcod
import math
import copy
import game
import util
import mapgen
import item
class Monster(object):
def __init__(self, typ, name, unid_name, icon, color, dark_color, level, health, damage, article, ar, dr, weight, corpse, flags):
self.type = typ
self.name = name
self.unidentified_name ... | true |
4613f1334f589546c2b4cd090f2891c4242090e5 | Python | CG2016/barkovsky_3 | /lab6/manipulation.py | UTF-8 | 13,332 | 2.65625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import argparse
import math
import tkinter as tk
import tkinter.messagebox as tk_messagebox
import PIL.ImageTk
import PIL.Image
import numpy as np
IMAGE_SIZE = (600, 400)
class ImageManipulationWindow:
def __init__(self, image_path):
self.root = tk.Tk()
self.root.grid_colu... | true |
e21a078e0e52b270bd9a0d39f9dbb0927def7a39 | Python | robyparr/barmycodes | /barmycodes/barmycodes.py | UTF-8 | 3,565 | 2.5625 | 3 | [
"MIT"
] | permissive | from flask import Flask, render_template, request, Response, redirect
from reportlab.pdfgen import canvas
from reportlab.lib.utils import ImageReader
from io import BytesIO
from .models.barcode import Barcode
from .config import Config
# Setup Flask app
app = Flask(__name__)
app.config.from_object(Config)
def _get_... | true |
b6f745f543567e2954b169998f560e4ec06b6ccc | Python | TwitchPlaysPokemon/pokecat | /pokecat_test.py | UTF-8 | 30,377 | 2.65625 | 3 | [] | no_license |
import json
import os
import unittest
import warnings
from copy import deepcopy
import yaml
import pokecat
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
def load_test_docs(name):
path = os.path.join(ROOT_DIR, "testdocuments", "{}.yaml".format(name))
with open(path, encoding="utf-8") as f:
re... | true |
8d32fee9f358bea0ec12a52d4b73c302cb7914c8 | Python | xiangcong/image-tool | /convertToGray.py | UTF-8 | 371 | 2.890625 | 3 | [] | no_license | import PIL
import sys
import os
from PIL import Image
def convert(path):
im = Image.open(path).convert('L')
dotPos = path.rfind('.')
newPath = path[0:dotPos] + 'Gray' + '.jpg'
im.save(newPath)
if __name__ == '__main__':
if len(sys.argv) != 2:
print('usage: python {} imagePath'.format(sys.... | true |