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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
56357769ac3e5404ad93021d7c27d3ff7db580fb | Python | NatalieP-J/python | /usinginit.py | UTF-8 | 402 | 4.09375 | 4 | [] | no_license | #!/usr/bin/python
#File exploring capabilities of __init__
class Colour:
def __init__(self,colour,age):
self.colour=colour
self.age=age
def colourScheme(self):
print 'The colour of the TARDIS is', self.colour
print 'The doctor is', self.age, 'years old'
p=Colour(raw_input('What... | true |
9687a924db55c78007c58930a4852b713c61757d | Python | SebaVGit/plt_reader | /utils/fun.py | UTF-8 | 2,924 | 2.53125 | 3 | [] | no_license |
import sys
import glob
import os
import numpy as np
import pandas as pd
import datetime as dt
from datetime import date
from datetime import timedelta
import matplotlib.ticker as tkr
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from matplotlib.ticker import FormatStrFormatter
import locale
from co... | true |
089589dea5c1970a905f37aa8c8a1755c8e7159c | Python | LauZyHou/VisualAnalytics_Back | /DataProcess/genres_sublabel.py | UTF-8 | 546 | 2.65625 | 3 | [] | no_license | import pandas as pd
from typing import List, Dict, Set
"""
*本文件作废
生成genres子标签
"""
if __name__ == '__main__':
# links: pd.DataFrame = pd.read_csv('../DataSet/links.csv')
movies: pd.DataFrame = pd.read_csv('../DataSet/movies.csv')
# ratings: pd.DataFrame = pd.read_csv('../DataSet/ratings.csv')
# tags: p... | true |
03fe8dc4e2a07bf2d760414870139756edadc314 | Python | RafaelMRosa/alphaFactory | /alpha_research/factor_transformation.py | UTF-8 | 857 | 3.296875 | 3 | [] | no_license | import pandas as pd
import numpy as np
def normalize_factor(factor: pd.DataFrame, mean=None, std=None) -> pd.DataFrame:
if mean is None:
mean = factor.mean()
if std is None:
std = factor.std()
return (factor - mean) / std
def sigmoid(factor: pd.DataFrame) -> pd.DataFrame:
s = 1 / (1 ... | true |
6ba1e1a1cfdae9ed155d41d289aef6f934b60c37 | Python | Bubai-Rahaman/CP_2020_Assignment2 | /question_5.py | UTF-8 | 2,229 | 2.71875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
#define f(t,x,x')
def f(t,x,xp):
g=10
return -g
#define partial derivative of f(t,x,x') w.r.t x
def fx(t,x,xp):
return 0
#define partial derivative of f(t,x,x') w.r.t x'
def fxp(t,x,xp):
return 0
#define exact solution
def x_true(t):
g=10
tf=10
return -g*t**2/2... | true |
c3a19617c82457b827c8d2262b9db159c410f25a | Python | SCIInstitute/UncertainSCI | /tests/test_quad.py | UTF-8 | 3,416 | 2.609375 | 3 | [
"MIT"
] | permissive | import unittest
from math import ceil
import numpy as np
from UncertainSCI.utils import quad
from UncertainSCI.families import JacobiPolynomials, jacobi_weight_normalized
from UncertainSCI.families import HermitePolynomials
class QuadTestCase(unittest.TestCase):
"""
Testing for quadrature routines.
"""
... | true |
9975b051a6983b6480a95d3f8adfa57fca7f4469 | Python | matiasg/allocation | /tests/test_classes_properties.py | UTF-8 | 197 | 2.546875 | 3 | [] | no_license | import pytest
from allocation.allocating import Allocation
def test_Allocation():
allocation = Allocation([('a', '1'), ('b', '2'), (None, '3'), ('c', None)])
assert len(allocation) == 2
| true |
99cc49df8459d5071c9ba25eaa6367c113e4726e | Python | dangillet/Pythoria | /pythoria/events.py | UTF-8 | 4,565 | 3.375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# From http://stackoverflow.com/a/7294148/893822
import weakref
class WeakBoundMethod:
"""
Wrapper around a method bound to a class instance. As opposed to bare
bound methods, it holds only a weak reference to the `self` object,
allowing it to be deleted... | true |
2fba805bbdea389fb152beee3c781c440bd0dd9c | Python | mcorley1/Intro_Biocom_ND_319_Tutorial5 | /Exercise_5_Part_2.py | UTF-8 | 448 | 3.359375 | 3 | [] | no_license | import pandas
df=pandas.read_csv('wages.csv')
#df=wages.csv data
#Highest earner
highest_earner=df.nlargest(1,'wage')
#output is under highest_earner (male,5,11,39.808917197)
#Lowest earner
lowest_earner=df.nsmallest(1,'wage')
#Output is under lowest_earner (female,9,11,0.07655561)
#Number of females in the top 10
n... | true |
999cc110852149b545d3a8e1f14a92771f054000 | Python | kitoriaaa/Algorithms | /ITP1/10_B.py | UTF-8 | 220 | 3.265625 | 3 | [] | no_license | import math
a, b, c = map(int, input().split())
S = (1/2)*a*b*math.sin(math.radians(c))
d_double = a**2 + b**2 - 2*a*b*math.cos(math.radians(c))
d = (d_double)**(1/2)
L = a + b + d
h = S*2/a
print(S)
print(L)
print(h) | true |
a3d3f6f0fc6a01b19b96901b05af766e704711ef | Python | LEEPPEUM/final_project | /DB/juno/connect_mariadb.py | UTF-8 | 336 | 2.671875 | 3 | [] | no_license | import pymysql
db = pymysql.connect(host='localhost',port=3306,user='root',passwd='tiger',db='yojulabdb',charset='utf8',autocommit=True)
cursor = db.cursor(pymysql.cursors.DictCursor)
cursor.execute("SELECT* from DATASET LIMIT 5")
data = cursor.fetchall()
for infor in data:
print("economic : %s " % infor['title'])... | true |
2d8707e2db85c2c82f39865e31dc85be0d46d18f | Python | unbadfish/NetEase-id-geter | /old/byre.py | UTF-8 | 961 | 3.0625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: UTF-8 -*-
import re
'''
Copyright 2020 unbadfish@github
Licensed under the Apache License, Version 2.0
'''
def get_id_re(in_string):
id_work = ''
try:
match1 = re.finditer('"id":([0-9]+,)"v":[0-9]*?,"alg":[a-z]+?', in_string) # find all
for each_match in match1:
ea... | true |
de9c89b414f42b0045c58ae261a5ede6faaba439 | Python | hivehelsinki/remote-challs | /chall01/rjaakonm.py | UTF-8 | 648 | 3.0625 | 3 | [] | no_license | #!/usr/bin/python3
import sys
morse = [".-",
"-...",
"-.-.",
"-..",
".",
"..-.",
"--.",
"....",
"..",
".---",
"-.-",
".-..",
"--",
"-.",
"---",
".--.",
"--.-",
".-.",
"...",
"-",
"..-",
"...-",
".--",
"-..-",
"-.--",
"--.."]
def main():
if (len(sys.argv) != 2) or (len(sys.argv[1]) == 0):
... | true |
963a9f32edec57675ade2010d73f58c9fe68279f | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_138/1184.py | UTF-8 | 1,044 | 3.015625 | 3 | [] | no_license |
import fileinput
def solveD(A,B):
C = sorted(zip(A,[0]*len(A))+zip(B, [1] *len(B)), key = lambda x: x[0])
aux = 0
loses = 0
for i in range(len(C)):
if C[i][1] == 1:
aux += 1
elif C[i][1] == 0:
aux -= 1
if aux < 0:
loses += ... | true |
db276c8a4ec9ca0275b58a342d5ab6740a9fa71a | Python | daishengliang/coding-challenge | /Google/246. Strobogrammatic Number.py | UTF-8 | 898 | 4.125 | 4 | [] | no_license | """
A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down).
Write a function to determine if a number is strobogrammatic. The number is represented as a string.
For example, the numbers "69", "88", and "818" are all strobogrammatic.
"""
class Solution(object):
d... | true |
f15208337d94a368f19eed2200424061cc1176ba | Python | ikeda-hitomi/mypkg | /scripts/turtle.py | UTF-8 | 1,127 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist
from turtlesim.msg import Pose
cmd_vel = Twist()
cmd_vel.linear.x = 2.0
cmd_vel.angular.z = 0.0
pose = Pose()
nowRotating = False
def update_pose(data):
global pose
pose.x = data.x
pose.y = data.y
def update_cmd_vel():
global cmd_vel... | true |
7b6fc07740b6224855731ecef524f20d5d50d4d8 | Python | wum5/I529-Group-Projects | /Project2/Python/PredProStr_ghmm.py | UTF-8 | 11,770 | 2.96875 | 3 | [] | no_license | #parse the given training set protein sequence file and generate two list of protein sequence and corresponding feature of i,m,o
import sys, math, argparse
from itertools import groupby
import re
#this class check input format and parse fasta file into two list containing index and sequence
class classFASTA:
def ... | true |
8971fb9fb9c60c68d525a19c2b00ebeb72c8c160 | Python | fossilwu/python-News | /excel001/tkui.py | UTF-8 | 873 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: set fileencoding=latin1:
# from tkinter import *
# from tkinter.filedialog import askdirectory,askopenfilename
from start_2 import maines
#
# filename = "1"
# def selectPath():
# path_ = askopenfilename()
# # print path_
# # global filename
# # filena... | true |
06f7efb25865ccf49e6483ba359b8e01cb9682b7 | Python | smallfishxz/Practice_Algorithm | /brownbag/task_scheduler.py | UTF-8 | 2,637 | 3.859375 | 4 | [] | no_license | # We have a list of various types of tasks to perform.
# Task types are identified with an integral identifier: task of type 1, task of type 2, task of type 3, etc.
# Each task takes 1 time slot to execute, and once we have executed a task we need cooldown (parameter) time slots to recover
# before we can execute an... | true |
4d45ebaf7d0781ad37777b7ed36630b300740c34 | Python | rctcwyvrn/advent | /advent2020/day9/cleaned.py | UTF-8 | 834 | 3.359375 | 3 | [] | no_license | def check(buf, val):
for x in buf:
for y in buf:
if x + y == val:
return True
return False
def find_xmas_weakness(nums):
buf = []
ctr = 0
invalid = None
for x in nums:
if ctr >= 25:
if not check(buf, x):
invalid = x
... | true |
90c25504e2442d455ee7e36e26db0d1f41395b92 | Python | SarthakU/DailyProgrammer | /Python/Daily013_intermediate/ReversedStringA.py | UTF-8 | 275 | 3.0625 | 3 | [] | no_license | ## REVERSED STRING
##
## challenge #13 (intermediate)
## http://www.reddit.com/r/dailyprogrammer/comments/pzo7g/2212012_challenge_13_intermediate/
##
##
## sarthak7u@gmail.com
##
string = list(raw_input("Enter String:"))
string.reverse()
open("reverse.txt", "w").write("".join(string)) | true |
aae9e1275486a8507b55e915d40e66985dadfc22 | Python | jtlai0921/Python- | /ex07/test07_4.py | UTF-8 | 228 | 3.421875 | 3 | [] | no_license | def f(n) :
if (n > 3) :
return 1
elif (n == 2) :
return 3 + f(n+1)
else :
return 1 + f(n+1)
def g(n) :
j = 0
for i in range(1, n) :
j = j + f(i)
return j
print(g(4))
| true |
7c0008ffd898a9f879ec2494b649f71578d19d13 | Python | archane/python | /twitter_feed_tweepy.py | UTF-8 | 1,466 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
# Created by Frank Jensen
# This code printed out the username and msg of anyone in the follow list to stdout
# Tweepy is the only required module for this program
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener
from tweepy import Stream
import json
from StringIO impor... | true |
e923fdbb51d997358f188ce5b815bbd8c5433a34 | Python | Been-H/Simulations | /simulations/NatSelecPredation.py | UTF-8 | 2,443 | 2.75 | 3 | [] | no_license | class NatSelectPredationSim(Simulation):
def __init__(self, num_generations, max_organisms, hunting_rate):
super().__init__(num_generations)
self.max_organisms = max_organisms
self.hunting_rate = hunting_rate
self.average_speeds = []
def handle_predation(self):
survived... | true |
29fb1fe00534ea263566b4f15dcab4d0f4b81e43 | Python | Narendranthangavelu/map_alteration | /saya_bringup/script/best_fit_line_finder.py | UTF-8 | 1,713 | 3.765625 | 4 | [] | no_license | #!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
def plot_graphs(x1,y1,x2,y2,x_best_fit_1,y_best_fit_1,x_best_fit_2, y_best_fit_2,slope1,intercept1,slope2,intercept2):
plt.subplot(1, 2, 1)
plt.title('Slope: ' + str(slope1) + ' / Intercept: ' + str(intercept1))
plt.plot(x1,y1)
... | true |
00d0e397477c3956325c7f538aa86621fc2eb476 | Python | acsr/rst2db | /abstrys/sphinx_ext/docbook_builder.py | UTF-8 | 3,235 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
#
# abstrys.sphinx_ext.docbook_builder
# ------------------------------
#
# A DocBook builder for Sphinx, using rst2db's docbook writer.
#
# by Eron Hennessey
from abstrys.docutils_ext.docbook_writer import DocBookWriter
from docutils.core import publish_from_doctree
from sphinx.builders.text i... | true |
0f8e58a20bbcf0fcb8867b1ea5c2df70b381a7a6 | Python | pvineet/birds | /download_images.py | UTF-8 | 4,046 | 2.515625 | 3 | [] | no_license | import os, csv
import urllib
num_lines = 0
def write_image_csv(csv_file, image_url, image_file):
with open(csv_file, 'a') as csvfile:
fieldnames = ['image_url', 'image_file']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
if not image_url == '':
urllib.urlretrieve(image_url,im... | true |
48fcb9762d0d4b171db4f6382628364effb88c4c | Python | devcre/Python_Review | /day05/MiniSudok.py | UTF-8 | 6,497 | 3.546875 | 4 | [] | no_license | # 미니 수독은 수독과 똑같은 요령으로 숫자를 채워넣는 퍼즐이나
# 가로 4칸, 세로 4칸의 정사각형 보드에 1부터 4까지 채워넣는 것만 다르다.
## 규칙 ##
# 퍼즐보드에 숫자를 채우는 규칙은 수독과 동일하게 같은 줄에 숫자가 겹치지 않아야 하고,
# 2x2 크기로 4등분 한 작은 격자 내부에도 숫자가 겹치지 않아야 한다.
## 개발 요구사항 ##
# 퍼즐을 표준 입출력 창에서 인터액티브하게 진행하도록 한다.
# 빈칸이 많을 수록 퍼즐 풀기가 어려워진다. 따라서 난이도를 다음 중에서
# 사용자가 선택하도록 한다.
# 하: 숫자를 10개 채워준다. 중: 숫자를... | true |
053a4325baf89ea2f908b96e6fe0bd220bcd6998 | Python | Bonen0209/Machine_Learning_Foundations | /HW1/8.py | UTF-8 | 1,530 | 2.8125 | 3 | [] | no_license | import argparse
import numpy as np
from concurrent.futures import ProcessPoolExecutor, as_completed
from helper import load_data, plot_hist
from perceptron_learning_algorithm import Perceptron_Learning_Algorithm
def main():
parser = argparse.ArgumentParser(description='Problem 8')
parser.add_argument('--train_... | true |
8cafa0363f8f5c9e7425d1e31d9722f5897222b4 | Python | thiagofb84jp/python-exercises | /pythonCourseUdemu/algoritmosExercicios/basicos/exercicio26.py | UTF-8 | 318 | 4.03125 | 4 | [] | no_license | '''
26. Write a Python program to create a histogram from a
given list of integers
'''
def histogram(items):
for number in items:
output = ''
times = number
while (times > 0):
output += '*'
times -= 1
print(output)
histogram([2, 3, 6, 5, 10, 100])
| true |
8688a4e2f18118b9371bfa2ee8ce21dadddb975f | Python | FilipeAPrado/Python | /Paradigmas de linguagem em python/AulaDeClasses/account.py | UTF-8 | 637 | 3.734375 | 4 | [] | no_license | class Account:
def __init__(self, num):
self.num = num
self.balance = 0.0
def checkBalance(self):
return self.balance
def credit(self, value):
self.balance += value
def debit(self, value):
self.balance -= value
def transfer(self, account, value):
s... | true |
568cd943de8a598b0391b5a2988d72544ceecd81 | Python | StefGalanis/Mixed-Search | /part2.py | UTF-8 | 5,843 | 3.09375 | 3 | [] | no_license | #Stefanos Galanis 2032
import sys
import time
import heapq
import numpy as np
def exportGridAsFile(grid,lenghtX,lengthY,minX,minY):
print(grid.shape)
exportedFile = open('gridFile.tsv','w')
header = '{}\t{}\n'.format(grid.shape[0],grid.shape[1])
exportedFile.write(header)
subHeader = '{}\t{}\t{}\t... | true |
56cb213ffca915d0aa1a064dc4dbcb8085be2b25 | Python | msporkin/FASTLIFI | /Dated/Search.py | UTF-8 | 6,071 | 2.890625 | 3 | [] | no_license | #ECEN 404 - Michael Sporkin
#Imports custom libraries and threading
from CameraLibrary import *
from MotorLibrary import *
import threading
#initialize search variables
ledLit = False
offsetAngles = np.array([0,0,0])
global targetFound
targetFound = False
global sweeping
sweeping = True
statPi = StatPi() #initialize... | true |
29a28ab6c78b87cd56bfce477cf31400e9445c89 | Python | elOXXO/Tarea_03 | /Rendimientodeautos.py | UTF-8 | 2,859 | 4.03125 | 4 | [] | no_license | #Encoding: UTF-8
#Autor: Alberto López Reyes
'''Descripción: Este programa calcula e imprime el rendimiento de un auto en km/l, mi/l, y la cantidad de litros necesarios
al ser otorgado los km recorridos, los litros usados, y los km a recorrer.'''
#Se declaran las constantes universales, porque nunca deberían camb... | true |
86c8431473e7b9bf443f5adf4682e9e07ec4650e | Python | jvSanches/PI-7 | /Python_sender/GCode_parser.py | UTF-8 | 1,187 | 3.484375 | 3 | [] | no_license | """
Interpretador de Gcode simplificado
"""
import re
last_x = 2048
last_y = 2048
last_z = 1
# Quebra um programa em uma lista de strings
def refine(prog):
refined_prog = []
prog = prog.split("\n")
for line in prog:
no_comments = re.sub(r'\([^()]*\)', '', line).upper()
refined_prog.append(... | true |
125882b86b5673235daed8200ef6913cba23b320 | Python | GucciGerm/holbertonschool-higher_level_programming | /0x0F-python-object_relational_mapping/5-filter_cities.py | UTF-8 | 753 | 3.125 | 3 | [] | no_license | #!/usr/bin/python3
"""
This script will take the name of a state as an argument
and we will list all the cities within that state with database hbtn_0e_4_usa
4 arguments passed:
- A MySQL username
- A MySQL password
- A database name
- A state name
"""
import MySQLdb
from sys import argv
if __name__ == "__main__":
... | true |
a691cc2da5f167e3f00ea37deab52820a6950182 | Python | edbeeching/AA_LCS_Project | /code_production/runtime_comparisons.py | UTF-8 | 1,289 | 3.140625 | 3 | [] | no_license | from __future__ import print_function
import random
import string
import time
import lcs_branch_and_bound
import lcs_recursive
def generate_random_list(length):
words = [None]*length
for i in range(length):
words[i] = (random.choice(string.ascii_uppercase))
return words
if __name__ == '__mai... | true |
7966be684ab2d44bde1f3829a16e65ddfb25a102 | Python | bassem-debug/behave-training-ci | /features/steps/search_steps.py | UTF-8 | 683 | 2.609375 | 3 | [] | no_license | import time
from behave import then,given,when
from numpy.testing import assert_equal
from selenium import webdriver
from selenium.webdriver import ActionChains
@given(u'the user navigates to the PyPi Home page')
def step_impl(context):
context.browser.get("https://qavbox.github.io/demo/dragndrop/")
assert ... | true |
6a19e801df9115814b7bbaf2cc2e53e7dc316276 | Python | JensPfeifle/adventofcode-2018 | /day11_chronalcharge.py | UTF-8 | 3,972 | 2.796875 | 3 | [] | no_license | import numpy as np
from numba import jit
from typing import Dict
def powerlevels(serial_number):
grid = np.zeros([300, 300], dtype=int)
for i in range(grid.shape[0]):
for j in range(grid.shape[1]):
rack_id = i + 10
power = rack_id * j
power = power + serial_number
... | true |
4eaa54e568ad94dc39eef6acbe2945d78879034a | Python | yfhd/python_practice | /python2/tuples.py | UTF-8 | 165 | 3.078125 | 3 | [] | no_license | #!/usr/bin/python
tup = ('physics', 'chemistry', 1997, 2000)
print tup
del tup
print "After deleting tup: "
try:
print tup
except Exception as e:
print e
| true |
f8636209b2307cc73fb9a154efc945af2b7a302a | Python | HoChangSUNG/sparta_algorithm | /week_1/05_find_max_plus_or_multiple.py | UTF-8 | 322 | 3.5 | 4 | [] | no_license | input = [1, 3, 5, 6, 1, 2, 4]
def find_max_plus_or_multiply(array):
multiply_sum = 0
for number in array :
if number<=1 or multiply_sum <= 1 :
multiply_sum+=number
else :
multiply_sum*=number
return multiply_sum
result = find_max_plus_or_multiply(input)
print(result... | true |
b0480f028394d501eb5e8d003632c464bf5a810b | Python | lebm/coursera-interactive-python-1 | /rspls/rspls.py | UTF-8 | 1,356 | 4.09375 | 4 | [] | no_license | import random
# dicts to simplify name_to_number and number_to_name
name_number = {"rock": 0, "Spock": 1, "paper": 2, "lizard": 3, "scissors": 4}
number_name = {0: "rock", 1: "Spock", 2: "paper", 3: "lizard", 4: "scissors"}
def name_to_number(name):
""" Maps name to its number
Well, I am not sure if we ... | true |
3d927274b8aae20174f8578545f03c7488ecfaa7 | Python | ahmedhamza47/Projects_for_Beginner | /password generator pro.py | UTF-8 | 808 | 3.484375 | 3 | [] | no_license | import random as rd
import secrets
import string
def password_gen(pass_length):
pass_source = string.ascii_letters + string.digits + string.punctuation
password = secrets.choice(string.ascii_lowercase)
password += secrets.choice(string.ascii_uppercase)
password += secrets.choice(string.digits)
pas... | true |
704fa10010d4628067e9a875369d5556b67b3149 | Python | meethu/LeetCode | /solutions/0141.linked-list-cycle/linked-list-cycle.py | UTF-8 | 1,006 | 3.78125 | 4 | [] | no_license | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def hascycle(self, head):
"""
:type head: ListNode
:rtype: bool
"""
fast = slow = head
while fast and... | true |
bbc2a31f9f19f120bdeed806448f63262a4cae1e | Python | wasweisic/CryptoPredicted | /predictors/eval.py | UTF-8 | 4,737 | 2.734375 | 3 | [
"MIT"
] | permissive |
# evaluation function to determine accuracy
# many techniques were tried, including RMSE and similar; this one uses DTW algorithm.
# however this file should no longer be used, because it may no longer be compatible with the API.
# you can however refactor it if you wish to make it compatible again with our new da... | true |
17f97364d07b37219c50789650d14ffe11d23bee | Python | axeloh/hackerrank | /coin_change_problem.py | UTF-8 | 1,148 | 4.15625 | 4 | [] | no_license | """
Coin Change Problem from https://www.youtube.com/watch?v=HWW-jA6YjHk
"""
def num_coins(cents, coins):
num_coins = 0
# O(k)
for coin in coins:
num_coins += cents // coin
cents = cents % coin
if cents != 0:
return -1
return num_coins
def num_coins2(cents, coins):
# ... | true |
57ebcd327ef932c7b79a38dc2086f70de3d26010 | Python | jonathanmarmor/jam | /jam/soxsynth.py | UTF-8 | 1,539 | 3.375 | 3 | [] | no_license | """A simple synthesizer for rhythmic unison parts using the sox utility.
install dependencies:
brew install sox
"""
import os
TEST_MUSIC = [
(0.16, ['Ab2', 'Ab4', 'B4', 'Eb4']),
(0.48, ['B2', 'B4', 'Eb4', 'Gb4']),
(0.16, ['B2', 'B4', 'Eb4', 'Gb4']),
(0.64, ['E2', 'E4', 'Ab4', 'B4']),
]
def p... | true |
745a68090329048226a7521b675f3f10d44708ff | Python | offwhite/gerty | /face_recogniser.py | UTF-8 | 1,032 | 2.703125 | 3 | [] | no_license | import numpy as np
import os
class Recogniser:
def __init__(self, cv2, db):
self.cv2 = cv2
self.db = db
self.detector = cv2.CascadeClassifier("haarcascade_frontalface_default.xml");
self.recognizer = self.cv2.face.LBPHFaceRecognizer_create()
self.recognizer.read('trainer/tra... | true |
7ccdaaf03dda02c77434c1101105c1aeb3d80eb3 | Python | gehenriquez/MCOC2020-P1-2 | /Entrega 5/Entrega5.py | UTF-8 | 10,882 | 2.5625 | 3 | [] | no_license | import numpy as np
from scipy.integrate import odeint
from datetime import datetime
from leer_eof import leer_eof
from time import perf_counter
import matplotlib.pyplot as plt
t0 = perf_counter()
# Datos
hr = 3600
km = 1000
Radio = 6371*km
Mt = 5.972e24
G = 6.67408e-11
omega = -7.2921150e-5
HG = 700 *... | true |
c3a8487bbecc417936016e18df339624909a1513 | Python | danxia0308/AIPractice | /tensorflow/tf_data.py | UTF-8 | 4,410 | 3.046875 | 3 | [] | no_license | '''
dataset = dataset.map(parse_function) //将dataset通过parse_function进行解析。
dataset = dataset.map(lambda filename, label:tuple(tf.py_func(_read_py_function, [filename,label], [tf.uint8,label.dtype]))) //使用tf.py_func来作用于非tf函数。
训练中使用dataset的顺序:
1. tf.data创建dataset。
2. dataset.map做预处理。
3. dataset.shuffle(buffer_size=1... | true |
a2e87dffe62e763daca2e4d7d633b895fb3f612f | Python | Andy-SKlee/Algorithm | /unit06.py | UTF-8 | 366 | 3.578125 | 4 | [] | no_license | def hanoi(n, from_bar, to_bar, aux_bar):
if n == 1:
print(from_bar, " -> ", to_bar)
return
hanoi(n - 1, from_bar, aux_bar, to_bar)
print(from_bar, " -> ", to_bar)
hanoi(n - 1, aux_bar, to_bar, from_bar)
print("n = 1")
hanoi(1, 1, 3, 2)
print("n = 2")
hanoi(2, 1, 3, 2)
print("n = 3")
hano... | true |
c10e51bd3576dc5cd023d278267237d4f0455c46 | Python | hjxu2016/somecode | /post_process/Train_Random.py | UTF-8 | 2,370 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 30 20:26:44 2017
@author: hjxu
"""
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import roc_curve, auc
import pickle
from sklearn import svm
HEATMAP_FEATURE_CSV_TRAIN =... | true |
836cac9ff703916e1d2111d438a1feace5ffa595 | Python | bibopBob/streamlit_basic_text_charts | /simple.py | UTF-8 | 2,228 | 3.9375 | 4 | [] | no_license | import streamlit as st
import numpy as np
import pandas as pd
st.title('My first app')
st.write('Here\'s our first attempt at using data to create a table:')
st.write(pd.DataFrame({
'first column':[1,2,3,4],
'second column':[10,20,30,40]
}))
"""
## Second title
This is a second title with different method
"""
df = ... | true |
c3d7035598ec023f8128a622a4157e7e31ff517b | Python | lccastro9/hkr-6 | /Point.py | UTF-8 | 533 | 3.375 | 3 | [] | no_license | class Point():
def __init__(self,x,y):
self.x=x
self.y=y
def move(self,x,y):
self.x1=x
self.y1=y
def reset(self):
self.x=0
self.y=0
def calculate_distance(self,otherPoint):
a=(otherPoint.x-self.x)**2 + (otherPoint.y-self.y)**2
dista... | true |
a6a875db61c83a8e4190bae5b0259ce6bef949bc | Python | sultann1997/Kase | /Kase parsing.py | UTF-8 | 4,384 | 2.65625 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import csv
from urllib.request import urlopen
from zipfile import ZipFile
from io import BytesIO
import pandas as pd
import os
import pickle
import smtplib, ssl
df_test = pd.DataFrame() #creating Empty DataFrame
#Preparing email to automatically send notifica... | true |
ebcf39d4fd3c76d9d5c180a3604cd8358d2ece5e | Python | corka149/pump_light | /src/pump_light/client.py | UTF-8 | 1,805 | 2.6875 | 3 | [] | no_license | """ Websocket and HTTP/S client for iot_server """
import logging
import pprint
import socket
import traceback
from aiohttp import ClientSession
from pump_light.infrastructure import config
from pump_light.model.exception import ExceptionSubmittal
_LOG = logging.getLogger(__name__)
class ExceptionReporter:
"""... | true |
8a0e4e161c178aaaf72d7682383566b37caad37f | Python | jamesdpearce/utils | /variable_importance.py | UTF-8 | 3,324 | 2.59375 | 3 | [] | no_license | import sys
import time
import numpy as np
from progress import ProgressBar
def gen_var_impact_scores(clf, X_train, y_train, X_test,
n_rounds=100, verbose=False, fit=True):
"""
Given classifier and training data, return variable importances on the
test data on a per-sample bas... | true |
8fde96116f053050407e69d6424ab218e2b49c70 | Python | xmaimiao/hogwarts_venv | /testing/test_calcu.py | UTF-8 | 1,228 | 2.578125 | 3 | [] | no_license | import pytest
import yaml
from decimal import *
from testing.usual import usual
class TestAdd:
@pytest.mark.parametrize("data", yaml.safe_load(open("./data_add.yaml")),
ids=['1.int', '2.float', '3.int+float', '4.before=0', '5.after=0', '6.be/af=0'])
def test_add(self, data, calcu... | true |
c40847b2270348c356dcadcf047ccdaac7b80aae | Python | rangertaha/celerity-challenge | /apps/demo/tests.py | UTF-8 | 963 | 3.234375 | 3 | [
"MIT"
] | permissive | # Third party imports
from django.test import TestCase
# Local imports
from .roman import RomanNumeral
class RomanNumeralTestCase(TestCase):
def setUp(self):
self.TEST_CASES = [
('', 0),
('VI', 6),
('IX', 9),
('XVIII', 18),
('XIX', 19),
... | true |
e89fc52fe9ec939f1ef4f7141b9944e036deda1c | Python | xuxu001/spider | /hehe/spiders/ceshi.py | UTF-8 | 1,671 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
import string
class CeshiSpider(scrapy.Spider):
name = 'ceshi'
allowed_domains = ['qiushibaike.com']
start_urls = ['https://www.qiushibaike.com/text/page/']
# header = {
# "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, ... | true |
bb98a51c0d1dca9683272ebaf2fdcf97bace0ede | Python | robmccoll/leap-projects | /drawing/drawing.py | UTF-8 | 4,802 | 2.640625 | 3 | [] | no_license | ################################################################################
# Copyright Rob and Mark McColl 2012
# This source code is available under the terms of the 3-part BSD Open Source
# license. http://opensource.org/licenses/BSD-3-Clause
#####################################################################... | true |
9bacba16954cc9423525c6eddb0a33c259a0ccf2 | Python | code-goblin-for-jack/gzEstate | /data_wash.py | UTF-8 | 5,977 | 3 | 3 | [] | no_license | #! /usr/bin/env python3
# -*- coding:utf-8 -*-
import numpy as np
import pandas as pd
import sqlite3
import logging
_DB_File = "./data/houses.db"
_Fields = [
"链家编号", "标题",
"总价", "首付", "税费",
"建筑年代", "配备电梯",
"梯户比例", "建筑结构", "建筑类型", "所在楼层",
"装修情况", "房屋朝向",
"行政区", "板块", "小区",
"建筑面积",... | true |
dfdaab107f4940dd02f9021a2ebff95ff6d1ef47 | Python | muhammadsyamsudin/Python_Telepot_DigiwareProjects | /Raspberry-Pi/Smarthome_with_RPi_and_Telegram_Bot.py | UTF-8 | 2,419 | 2.734375 | 3 | [] | no_license | import sys
import time
import random
import datetime
import telepot
import RPi.GPIO as GPIO
def on(pin):
GPIO.output(pin,GPIO.LOW)
return
def off(pin):
GPIO.output(pin,GPIO.HIGH)
return
# Perintah untuk menggunakan pin board GPIO Raspberry Pi
GPIO.setmode(GPIO.BOARD)
# Pengatu... | true |
138e00452252df2a4a1609c534904dfa662dbd17 | Python | ofloveandhate/advent_of_code_2020 | /2/solution.py | UTF-8 | 639 | 3.703125 | 4 | [
"MIT"
] | permissive |
def read_data():
with open ('input.txt') as f:
data = f.readlines()
return data
def part1():
data = read_data()
count = 0
for d in data:
span,letter,password = d.split()
lower,upper = span.split('-')
letter = letter[0]
occ = password.count(letter)
if int(lower) <= occ and occ <= int(upper):
co... | true |
e248d25c8afeff5a6ad480c4f39426dfdd2278da | Python | locqj/study | /python/python.py | UTF-8 | 3,041 | 3.328125 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
import json, calendar, time, support, package # json 要导入才能用json
# 循环
fruits = ['banana', 'apple', 'mango']
for index in range(len(fruits)):
print 'Current fruit :'+'asd', fruits[index]
print "Good bye!"
# 多重循环
test = ['a', 'b', 'c']
test1 = [1, 2, 3]
new_list = []
for t in test:
... | true |
fbb864eb24d3d3e9477086c26d6fc5837e74b658 | Python | gabriellaec/desoft-analise-exercicios | /backup/user_225/ch22_2020_03_02_19_54_10_487593.py | UTF-8 | 194 | 2.96875 | 3 | [] | no_license | fuma_há_quanto_tempo = int (input("Há quantos anos fuma: "))
número_de_cigarros = int (input ("Número de cigarros por dia: "))
print ((fuma_há_quanto_tempo*365*24*60)*(número_de_cigarros)) | true |
114f0e4f2a57c11f3f5201984857635351284b0c | Python | allanliebold/python_refresh | /data_structures_tutorial.py | UTF-8 | 715 | 4.46875 | 4 | [
"MIT"
] | permissive | from math import sqrt
s = 'hello'
s.upper()
# To see a list of methods available, press tab after the .
#Big O Notation - Describes how quickly runtime will grow relative to the size of the input
def sumToN(n):
''' Take an input of n and return the sum of the numbers from 0 to n'''
sum = 0
for x in range(n+1):... | true |
b914e87aa29ed684db1a141ceab0baee023cf90b | Python | mishik182/places | /place/management/commands/fill_tags_and_addr.py | UTF-8 | 999 | 2.53125 | 3 | [] | no_license | from django.core.management.base import BaseCommand, CommandError
from coolname import generate_slug
from faker import Faker
from place.models import Address
from tag.models import Tag
class Command(BaseCommand):
fake = Faker()
@classmethod
def delete_objects(cls, Model):
Model.objects.all().del... | true |
16a86ec1e736a57cd9cfcfef26787a4496f1656a | Python | ferhatelmas/algo | /codechef/practice/easy/dce03.py | UTF-8 | 181 | 3.234375 | 3 | [
"WTFPL"
] | permissive | catalans = [1]
for i in range(0, 1001):
catalans.append((2 * (2 * i + 1) * catalans[-1]) / (i + 2))
for _ in range(int(input())):
print(catalans[int(input()) - 1] % 10000)
| true |
44c5dea5d2795d74d769d3b9dea84f9ffb8296c1 | Python | kashyapvinay/leetcode-challenge | /python3/june/day_14_Cheapest Flights Within K Stops.py | UTF-8 | 1,033 | 2.984375 | 3 | [
"MIT"
] | permissive | class Solution:
def findCheapestPrice(self, n: int, flights: List[List[int]], src: int, dst: int, K: int) -> int:
graph = [ [] for _ in range(n)]
for flight in flights:
u = flight[0]
v = flight[1]
cost = flight[2]
graph[u].append((v, cost,))
... | true |
51b284e3ce119936cbe4047558afecb091f44d50 | Python | kinghotelwelco/Instagram-follow-tracker-manager | /main.py | UTF-8 | 4,039 | 2.796875 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
... | true |
6ae7353f4c67c04c5eb875affb3a8c8b3d076245 | Python | starrye/LeetCode | /all_topic/esay_topic/605. 种花问题.py | UTF-8 | 1,783 | 3.90625 | 4 | [] | no_license | #!/usr/local/bin/python3
# -*- coding:utf-8 -*-
"""
@author:
@file: 605. 种花问题.py
@time: 2020/5/10 14:59
@desc:
"""
from typing import List
"""
假设你有一个很长的花坛,一部分地块种植了花,另一部分却没有。可是,花卉不能种植在相邻的地块上,它们会争夺水源,两者都会死去。
给定一个花坛(表示为一个数组包含0和1,其中0表示没种植花,1表示种植了花),和一个数 n 。能否在不打破种植规则的情况下种入 n 朵花?能则返回True,不能则返回False。
示例 1:
输入: flowerbed ... | true |
c6db308777366aabc66beaad84e0f22aa0b23a50 | Python | hezy10/myproject | /PyCharm 2017.3.2/自动化测试/执行js.py | UTF-8 | 450 | 2.5625 | 3 | [] | no_license | from selenium import webdriver
import time
driver = webdriver.Chrome(executable_path=r'E:\chromdriver\chromedriver.exe')
ret = driver.get('https://www.baidu.com')
# new_str = "alert('ok')"
# driver.execute_script(new_str)
#
driver.find_element_by_name('wd').send_keys('图片')
driver.find_element_by_id('su').click()
time.... | true |
65f2750fe7f440138f5fdbaa2a8a784429b4dee3 | Python | dunhe001/mycodes | /学者信息采集与清理/get_item_in_data.py | UTF-8 | 12,277 | 3.34375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import re
import pandas as pd
def clean_n(d_list):
'''去除列表里面的\n 和空字符'''
return [x.strip() for x in d_list if x.strip() != '']
def clean_null_list(d_list):
'''去除里面的空列表'''
return [x for x in d_list if len(x) > 0]
def clean_blank(d_list):
'''去除\xa0'''
return [x.replace(r'... | true |
9a61022b6dfead01c8ba079bda89ffc15e0d2318 | Python | AlexBrin/HostsEditor | /hostseditor/log.py | UTF-8 | 430 | 2.8125 | 3 | [
"MIT"
] | permissive | import hostseditor.color as color
def error(text, separator=' + '):
print(color.RED + separator + "Error: " + color.NULL + text)
def info(text, separator=' + '):
print(color.BLUE + separator + color.NULL + text)
def warn(text, separator=' + '):
print(color.YELLOW + separator + "Error: " + color.NULL +... | true |
19dc27c6223d76e4721fa36c10250746bf0358af | Python | punitjha/CHEM_548_Project_2 | /feaux.py | UTF-8 | 163 | 2.671875 | 3 | [] | no_license | #!/usr/bin/python
import numpy as np
eigs1 = np.loadtxt('eigen1.txt')
eigs2 = np.loadtxt('eigen2.txt')
for i in range(len(eigs1)):
print(eigs2[i] - eigs1[0])
| true |
ed6e450eae82b7cdb58b42c578b3f7f95851f738 | Python | Soontrax/Programacion-Python | /Practica5/Ejercicio6.py | UTF-8 | 341 | 3.9375 | 4 | [] | no_license | a = input("Escribe un numero:")
b = input("Escribe un numero mayor que %d: \n" %a)
w = []
while b<=a:
b = input("Escribe un numero mayor que %d: \n" %a)
c = input("Escribe un numero entre" + str(a) + "y" + str(b) + ":")
while a<= c <=b:
w.append(c)
c = input("Escribe otro entre" + str(a) + "y" + str... | true |
ab99b3cc191d173b08bd9bf42e3e7280933943c2 | Python | dougtc1/algorithms1 | /Python/Laboratorio-3/Lab03Ejercicio1fail.py | UTF-8 | 1,726 | 4.125 | 4 | [] | no_license | #
# Lab03Ejercicio1.py
#
# Descripcion: Este programa permite al usuario escoger una opcion de un menu
# de tres opciones
# Autor: Douglas Torres
# Ultima modificacion: 29/04/2014
#
# Variables:
# seleccion : integer //
# resultado : float //
# largo : float //
# ancho : float //
# radio : stri... | true |
2f743498897bfc609265ed8fe1e1343ed1578aa5 | Python | vinodrajendran001/nlp | /syllables.py | UTF-8 | 178 | 2.5625 | 3 | [] | no_license | from nltk.corpus import cmudict
d = cmudict.dict()
def max_syl(word):
if word not in d: return None
return max([len([y for y in x if y[-1].isdigit()]) for x in d[word]])
| true |
bcaef77b95b8ce10204a25abaf302c69a57742a6 | Python | yodeng/sw-algorithms | /pythonic/array_questions/circular_counter.py | UTF-8 | 801 | 4 | 4 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# encoding: utf-8
"""
@author: swensun
@github:https://github.com/yunshuipiao
@software: python
@file: circular_counter.py
@desc: 约瑟夫环
@hint: 一般解法和动态规划
"""
# 简单方法:每次移除删除的元素并打印出来:O()
def circular_counter(n, m):
temp = [i for i in range(1, n + 1)]
i = 0
while len(temp) > 1:
... | true |
dc8dc23026fc3a8022a1e4fcfc7c446918c341b8 | Python | alexisdeveloper-oui/devoirDidi | /main.py | UTF-8 | 2,399 | 3.5625 | 4 | [] | no_license | from PIL import Image
import glob
i = 0
flag = False
list_of_pictures = glob.glob('pictures/*.jpg')
def resize(width, height) -> object:
"""
:param width: La largeur de la photo
:param height: La hauteur de la photo
:return: message de confirmation
"""
nouvelle_image = image.resize((width, ... | true |
d72e57279e399cdb8f14ce78702e57c1b5654321 | Python | kiba0510/holbertonschool-higher_level_programming | /0x07-python-test_driven_development/0-add_integer.py | UTF-8 | 519 | 3.703125 | 4 | [] | no_license | #!/usr/bin/python3
'''
Module defining function add_integer
'''
def add_integer(a, b=98):
"""
Function that sums 2 integers
a (int or float)
b (int or float)
"""
if not isinstance(a, int) and not isinstance(a, float):
raise TypeError("a must be an integer")
if not isinstance(b, in... | true |
ea29430eff02df01a81644622744a09806445d24 | Python | innovatorved/BasicPython | /Python Programs/13. series.py | UTF-8 | 194 | 3.875 | 4 | [] | no_license | #print the series from 1 to 10
def series(x):
i=0
while(i<=x):
print(i)
i=i+1
return
while(1):
a=int(input('Enter a number : '))
print(series(a))
| true |
71f3e3482762e8fdb4f8689a5a254100a9a832c7 | Python | degentech/magicbutton | /contracts/mockQPToken.py | UTF-8 | 3,786 | 2.578125 | 3 | [] | no_license | import smartpy as sp
class FA12_Error:
def make(s): return ("FA1.2_" + s)
NotAdmin = make("NotAdmin")
InsufficientBalance = make("InsufficientBalance")
UnsafeAllowanceChange = make("UnsafeAllowanceChange")
Paused = make("Paused"... | true |
0661f68e47a54f821e3e006b2cb8cb18a3d24843 | Python | QDylan/Learning- | /Leetcode/81. 搜索旋转排序数组 II.py | UTF-8 | 1,494 | 4.1875 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
@Time : 2020/6/30 22:31
@Author : QDY
@FileName: 81. 搜索旋转排序数组 II.py
假设按照升序排序的数组在预先未知的某个点上进行了旋转。
( 例如,数组 [0,0,1,2,2,5,6] 可能变为 [2,5,6,0,0,1,2] )。
编写一个函数来判断给定的目标值是否存在于数组中。若存在返回 true,否则返回 false。
示例 1:
输入: nums = [2,5,6,0,0,1,2], target = 0
输出: true
示例 2:
... | true |
c7f51414d0751d76c34136a6b3539fa558c31084 | Python | Saykon-k/pit | /4_semester/comp_grafic/labS/labS_pil/1_lab/solve/gistagram_roof.py | UTF-8 | 767 | 2.84375 | 3 | [] | no_license | from PIL import Image, ImageDraw
image = Image.open("../files/roof.JPG")
draw = ImageDraw.Draw(image)
width = image.size[0]
height = image.size[1]
pix = image.load()
green = 256*[0]
red = []
blue = []
for x in range(width):
for y in range(height):
a = pix[x, y][0]
b = pix[x, y][1]
c = pix... | true |
5a6462731d172fd92532d6569ecdb7c20ec5be10 | Python | johnrdowson/py-spectrum | /pyspectrum/attributes.py | UTF-8 | 1,831 | 2.578125 | 3 | [
"MIT"
] | permissive | from enum import IntEnum
def attr_name_to_id(attr_name: str) -> int:
"""
Attempts to lookup the attribute ID (hex) from the name. If no match is
found, the name is assumed to be a hexadecimal (as string), and is therefore
returned as an integer type. Otherwise, the lookup fails.
"""
try:
... | true |
6afefcc3ed76f7c30367f66a1c72e051c3452c86 | Python | ChenliangLi205/LeetCode | /Q103BinaryTreeZigzagLevelOrderTraversal.py | UTF-8 | 1,169 | 3.15625 | 3 | [
"MIT"
] | permissive | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def zigzagLevelOrder(self, root):
"""
:type root: TreeNode
:rtype: List[List[int]]
"""
if root is... | true |
60854e8ae17338375cf8e32eb1111dda7357dfc8 | Python | gear106/leetcode | /13. Roman to Integer.py | UTF-8 | 711 | 3.609375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 15 21:08:13 2018
@author: GEAR
"""
class Solution:
def romanToInt(self, s):
"""
:type s: str
:rtype: int
"""
lookup = {
'M':1000,
'D':500,
'C':100,
'L':50,
... | true |
b72e4dc55017bf543bf91250b7eeeef5a1b2271c | Python | Nikotiin/kuvat-api | /kuvat_api/api.py | UTF-8 | 2,830 | 3.078125 | 3 | [
"MIT"
] | permissive | """
Raw JSON API of kuvat.fi
"""
from requests import Session, RequestException
from .exceptions import ConnectionException, AuthenticationException
class Api:
"""
Api encapsulates HTTP client
"""
def __init__(self, base_url):
"""
:param base_url: URL of kuvat.fi site
"""
... | true |
7e08540020a3ccd76010b33bfaadb776585be3f8 | Python | eomjinyoung/bigdata3 | /bit-python01/src08/ex02/test03.py | UTF-8 | 1,011 | 4.1875 | 4 | [] | no_license | # 함수 - call by value 와 call by reference II
# - immutable 값을 넘기면 call by value 가 된다.
# - mutable 값을 넘기면 call by reference 가 된다.
print("1-----------------------")
# call by reference
def f1(a):
a[0] = 100;
l1 = [1, 2, 3]
f1(l1) # 리스트의 주소가 넘어간다.
print(l1)
# 만약 리스트를 call by value 식으로 다루고 싶다면
# 복사본을... | true |
67e134ab6aeae4895c7a7ab346e8307f09007cbe | Python | K1ngfreak/functions_tryout | /hello_world.py | UTF-8 | 160 | 3.390625 | 3 | [] | no_license | def helloWorld(y):
x = 0
for i in range(0,y):
x = x + 1
print(str(x) + '. ' + 'Hello World!')
g = int(input('aantal: '))
helloWorld(g) | true |
64995794b185789e3dbe22aa84809705d524aee1 | Python | pianowow/various | /pythonchallenge.com/3.py | UTF-8 | 695 | 3.046875 | 3 | [] | no_license | #-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: CHRISTOPHER_IRWIN
#
# Created: 22/01/2013
import string, re
f = open('3.txt').read()
f = f.replace('\n','')
upper = string.ascii_uppercase
lower = string.ascii_lowercase
... | true |
aead43fa5228064dabe57bca51e5f2ed4adfa6e1 | Python | teletype3/ex_pe_codAby | /codeabbey/11.py | UTF-8 | 247 | 2.765625 | 3 | [] | no_license | b = 0
with open('data.txt', 'r') as data:
for i in data.readlines():
a = i.split(' ')
r = str(int(a[0])*int(a[1])+int(a[2]))
for x in r:
b += int(x)
print(b, end=' ')
b = 0 | true |
96b7bd08623db6077605d6df48d963c37d546b7c | Python | KrisAsante/Unit-8-01 | /car_program.py | UTF-8 | 458 | 3.5 | 4 | [] | no_license | # Created by: Chris Asante
# Created on: 3-April-2019
# Created for: ICS3U
# Unit 8-01
# This main program will create a car object
from car import *
#create a vehicle
car1 = Car()
car2 = Car()
print(car1.current_state())
car1.accelerate(100)
print(car1.current_state())
car1.brake(50)
print(car1.curr... | true |
88f6510f88b44bbd1e3664a4f212c1cb5a3d2c1b | Python | johnboscor/codingpractice | /test-test.py | UTF-8 | 741 | 3.265625 | 3 | [] | no_license | A = [ [1, 3, 5], [2, 6, 9], [3, 6, 9]]
C = [ list(i) for i in zip(*A)]
print(C)
from math import log
print(log(8,2))
A = [1, 2, 3, 4, 5]
A = "cat"
B = {"A":1, "B":2}
print(''.join(sorted(A)))
print(B["A"])
A=15
binary = bin(256)[2:].zfill(32)
print(binary)
A = [1, 2, 3, 4, 5]
A = A[4:] + A[:3]
print(A)
file1 =... | true |
8bc25cd29262dc0aff509f3f2abb0480fe7c3150 | Python | hankerbit/learning-based-RRT | /2link_NN/old/kNN_control_fulltraj.py | UTF-8 | 1,317 | 2.546875 | 3 | [
"MIT"
] | permissive | import sys
import numpy
from sklearn.neighbors import KNeighborsRegressor
from sklearn.externals import joblib
from sklearn.metrics import mean_squared_error
from numpy.random import seed
seed(1)
if len(sys.argv) == 4:
num_data = str(sys.argv[1])
type_data = str(sys.argv[2])
rep_parameter = str(sys.argv[3... | true |
03771bbbe577f1aeaa3ec1e043b8ff2741a09d20 | Python | naoland/nemlog-55579 | /flow.py | UTF-8 | 2,504 | 3.265625 | 3 | [
"CC0-1.0"
] | permissive | """
ZEMの最終価格をZaif取引所のAPIから取得して、その結果によって異なるフローチャートを生成します。
出力形式はPNGやJPG、SVG、PDFなどを指定できます。
"""
import sys
from graphviz import Digraph
from zaifapi import ZaifPublicApi, ZaifFuturesPublicApi, ZaifLeverageTradeApi
FILENAME: str = "dist/flow.dot"
DEBUG: bool = True
THRESHOLD: float = 40.0
def last_price(pair: str = "xe... | true |
fa9687d1f66506d1da7820522dff82ab3371b17a | Python | pmarcol/Python-excercises | /Python - General/List/11-20/excercise11.py | UTF-8 | 434 | 4.125 | 4 | [] | no_license | """
Write a Python function that takes two lists and returns True if they have at least one common member.
"""
"""
SOLUTION:
"""
def haveCommon(list1, list2):
return bool( set(list1) & set(list2) )
myList1 = [1,2,3]
myList2 = [3,4,5]
myList3 = [5,6,7]
print(haveCommon(myList1, myList2)) # True
print(haveCommon... | true |
358d9857e04d6f9c50f7f8552121ca58202df64c | Python | SaideepGona/Thesis-Code---2016 | /Thesis_Sort.py | UTF-8 | 4,921 | 2.890625 | 3 | [] | no_license | import numpy as np
def initialize(input_matrix):
print(type(input_matrix))
def set_2_list(set_object):
new_list = []
for x in set_object:
new_list.append(x)
return new_list
def all_possible(input_matrix):
column_sets = []
... | true |