repo_name stringclasses 400
values | branch_name stringclasses 4
values | file_content stringlengths 16 72.5k | language stringclasses 1
value | num_lines int64 1 1.66k | avg_line_length float64 6 85 | max_line_length int64 9 949 | path stringlengths 5 103 | alphanum_fraction float64 0.29 0.89 | alpha_fraction float64 0.27 0.89 |
|---|---|---|---|---|---|---|---|---|---|
DamienPond001/Udemy_API | refs/heads/master | # Make an array of translated impact forces: translated_force_b
translated_force_b = force_b - np.mean(force_b) + 0.55
# Take bootstrap replicates of Frog B's translated impact forces: bs_replicates
bs_replicates = draw_bs_reps(translated_force_b, np.mean, 10000)
# Compute fraction of replicates that are less than th... | Python | 31 | 33.870968 | 80 | /Datacamp/hypothesis_testing_with_one_dataset.py | 0.727778 | 0.697222 |
DamienPond001/Udemy_API | refs/heads/master | #Sometimes we may want multiple row indexes in a heirachical order
# Set the index to be the columns ['state', 'month']: sales
sales = sales.set_index(['state', 'month'])
# Sort the MultiIndex: sales
sales = sales.sort_index()
sales =
eggs salt spam
state month
CA 1 47 12.... | Python | 25 | 29.4 | 66 | /Datacamp/multi_indexing.py | 0.561265 | 0.480896 |
DamienPond001/Udemy_API | refs/heads/master |
for i in range(50):
# Generate bootstrap sample: bs_sample
bs_sample = np.random.choice(rainfall, size=len(rainfall))
# Compute and plot ECDF from bootstrap sample
x, y = ecdf(bs_sample)
_ = plt.plot(x=x, y=y, marker='.', linestyle='none',
color='gray', alpha=0.1)
# Compute and p... | Python | 71 | 25.535212 | 95 | /Datacamp/bootstrapping.py | 0.68435 | 0.664721 |
DamienPond001/Udemy_API | refs/heads/master | # Merge revenue with managers on 'city': merge_by_city
merge_by_city = pd.merge(revenue, managers, on='city')
# Print merge_by_city
print(merge_by_city)
# Merge revenue with managers on 'branch_id': merge_by_id
merge_by_id = pd.merge(revenue, managers, on='branch_id')
# Print merge_by_id
print(merge_by_id)
# Add 's... | Python | 41 | 30.853659 | 114 | /Datacamp/merging.py | 0.689655 | 0.68659 |
DamienPond001/Udemy_API | refs/heads/master | # Create a select query: stmt
stmt = select([census])
# Add a where clause to filter the results to only those for New York
stmt = stmt.where(census.columns.state == 'New York')
# Execute the query to retrieve all the data returned: results
results = connection.execute(stmt).fetchall()
# Loop over the results and pr... | Python | 58 | 31 | 82 | /Datacamp/sqlalchemy_more_statements.py | 0.726146 | 0.715364 |
DamienPond001/Udemy_API | refs/heads/master | # -*- coding: utf-8 -*-
"""
Created on Tue Aug 7 11:20:39 2018
@author: Damien
"""
| Python | 6 | 13.166667 | 35 | /API/Section7/code/models/__init__.py | 0.55814 | 0.418605 |
DamienPond001/Udemy_API | refs/heads/master | # Import create_engine
from sqlalchemy import create_engine
# Create an engine that connects to the census.sqlite file: engine
engine = create_engine('sqlite:///census.sqlite')
connection = engine.connect()
# Build select statement for census table: stmt
stmt = "SELECT * FROM census"
# Execute the statement and fet... | Python | 54 | 29.166666 | 138 | /Datacamp/sqlalchemy_statements.py | 0.761671 | 0.760442 |
DamienPond001/Udemy_API | refs/heads/master | # Seed random number generator
np.random.seed(42)
# Compute mean no-hitter time: tau
tau = np.mean(nohitter_times)
# Draw out of an exponential distribution with parameter tau: inter_nohitter_time
inter_nohitter_time = np.random.exponential(tau, 100000)
# Plot the PDF and label axes
_ = plt.hist(inter_nohitter_time,... | Python | 61 | 23.409836 | 81 | /Datacamp/parameter_optimisation.py | 0.71323 | 0.694426 |
DamienPond001/Udemy_API | refs/heads/master |
# Import numpy as np
import numpy as np
# Create array using np.linspace: x
x = np.linspace(0,5,100)
# Create array using np.cos: y
y = np.cos(x)
# Add circles at x and y
p.circle(x,y)
# Specify the name of the output file and show the result
output_file('numpy.html')
show(p)
#pandas
# Import pandas as pd
import... | Python | 51 | 20.627451 | 61 | /Datacamp/bokeh_numpy_pandas.py | 0.722826 | 0.71558 |
DamienPond001/Udemy_API | refs/heads/master | np.random.binomial(trails, probablity_of_success, size=number_of_reps)
np.random.poisson(average_rate, size=number_of_reps)
np.random.normal(mean, std, size=)
# Draw 100000 samples from Normal distribution with stds of interest: samples_std1, samples_std3, samples_std10
samples_std1 = np.random.normal(20,1,size=10000... | Python | 50 | 33.220001 | 111 | /Datacamp/EDA_distributions.py | 0.71345 | 0.665497 |
DamienPond001/Udemy_API | refs/heads/master | #If a df is indexed by date-time, we can perform resampling.
#Downsampling is when we go to a lower unit, lower unit being one with fewer units in a period (lowere frequency)
#Downsample from hours to days
#Upsampling is the opposite and will introduce Nana, unless otherwise catered for through filling methods
# Down... | Python | 36 | 38.083332 | 113 | /Datacamp/resampling.py | 0.764037 | 0.731343 |
DamienPond001/Udemy_API | refs/heads/master | #IF a table has an already defined relationship:
# Build a statement to join census and state_fact tables: stmt
stmt = select([census.columns.pop2000, state_fact.columns.abbreviation])
# Execute the statement and get the first result: result
result = connection.execute(stmt).first()
# Loop over the keys in the result... | Python | 46 | 35.304348 | 109 | /Datacamp/sqlalchemy_joins.py | 0.743559 | 0.736369 |
DamienPond001/Udemy_API | refs/heads/master | SELECT * FROM table
SELECT COUNT(*) FROM table
#counts number of rows
SELECT DISTINCT row FROM table
#selects unique entries in row
SELECT COUNT(row) FROM table
#counts non-null entries
SELECT COUNT(DISTINCT row) FROM table
#returns count of distinct entries
SELECT * FROM table
WHERE column_value = 'some_value' #... | Python | 85 | 20.952942 | 82 | /Datacamp/SQL.py | 0.725469 | 0.706166 |
DamienPond001/Udemy_API | refs/heads/master | kind='scatter' uses a scatter plot of the data points
kind='reg' uses a regression plot (default order 1)
kind='resid' uses a residual plot
kind='kde' uses a kernel density estimate of the joint distribution
kind='hex' uses a hexbin plot of the joint distribution
# Generate a joint plot of 'hp' and 'mpg'
sns.jointplot... | Python | 33 | 26.363636 | 67 | /Datacamp/seaborn_multivariate.py | 0.740577 | 0.738359 |
DamienPond001/Udemy_API | refs/heads/master | #indexing as:
df[['...', '....']]
#returns a DataFrame
p_counties = election.loc['Perry':'Potter', :]
# Slice the row labels 'Potter' to 'Perry' in reverse order: p_counties_rev
p_counties_rev = election.loc['Potter':'Perry':-1, :]
# Slice the columns from the starting column to 'Obama': left_columns
left_columns = e... | Python | 41 | 28.219513 | 89 | /Datacamp/indexing.py | 0.717627 | 0.716792 |
DamienPond001/Udemy_API | refs/heads/master | #Melting data is the process of turning columns of your data into rows of data.
airquality_melt = pd.melt(airquality_melt, id_vars=['Month', 'Day'])
#id_vars = columns not wishing to melt
#value_vars = columns wishing to melt (deafult to all not in id_vars)
#Pivoting data is the opposite of melting it.
airquality_piv... | Python | 32 | 42.28125 | 127 | /Datacamp/tidy_data.py | 0.739162 | 0.737717 |
DamienPond001/Udemy_API | refs/heads/master | # Construct arrays of data: dems, reps
dems = np.array([True] * 153 + [False] * 91)
reps = np.array([True] * 136 + [False] * 35)
def frac_yea_dems(dems, reps):
"""Compute fraction of Democrat yea votes."""
frac = np.sum(dems) / len(dems)
return frac
# Acquire permutation samples: perm_replicates
perm_repl... | Python | 41 | 31.219513 | 66 | /Datacamp/A_B_testing.py | 0.680303 | 0.656818 |
DamienPond001/Udemy_API | refs/heads/master | #EG:
id treatment gender response
0 1 A F 5
1 2 A M 3
2 3 B F 8
3 4 B M 9
df.pivot(index = "treatment", columns = "gender", values = "response")
#pivot
gender F M
treatment
A 5 3
B 8 9
#Not s... | Python | 15 | 23.266666 | 70 | /Datacamp/pivoting_tables.py | 0.451791 | 0.407714 |
DamienPond001/Udemy_API | refs/heads/master | # Import package
from urllib.request import urlretrieve
# Import pandas
import pandas as pd
# Assign url of file: url
url = 'https://s3.amazonaws.com/assets.datacamp.com/production/course_1606/datasets/winequality-red.csv'
# Save file locally
urlretrieve(url, 'winequality-red.csv')
# Read file into a DataFrame and ... | Python | 68 | 20.67647 | 104 | /Datacamp/web_import.py | 0.741344 | 0.735234 |
DamienPond001/Udemy_API | refs/heads/master |
# Read in the data file with header=None: df_headers
df_headers = pd.read_csv(data_file, header=None)
# Print the output of df_headers.head()
print(df_headers.head())
# Split on the comma to create a list: column_labels_list
column_labels_list = column_labels.split(",")
# Assign the new column labels to the DataFra... | Python | 45 | 40.066666 | 89 | /Datacamp/readin_and_cleaning.py | 0.723485 | 0.6921 |
DamienPond001/Udemy_API | refs/heads/master | import numpy as np
np.mean(data)
np.median(data)
np.var(versicolor_petal_length)
np.std(versicolor_petal_length)
#covariance matrix:
# returns a 2D array where entries [0,1] and [1,0] are the covariances.
# Entry [0,0] is the variance of the data in x, and entry [1,1] is the variance of the data in y
np.cov(versicol... | Python | 46 | 24.695652 | 96 | /Datacamp/EDA_boxplot_percentile.py | 0.72335 | 0.703046 |
DamienPond001/Udemy_API | refs/heads/master | from flask_restful import Resource, reqparse
from flask_jwt import jwt_required
import sqlite3
class Item(Resource):
parser = reqparse.RequestParser() #This prevents code duplication and now belongs to the Item class
parser.add_argument('price',
type = float,
... | Python | 132 | 27.121212 | 103 | /API/Section6/code/UseDB/item.py | 0.55433 | 0.540344 |
DamienPond001/Udemy_API | refs/heads/master | import sqlite3
connection = sqlite3.connect('data.db')
cursor = connection.cursor() #similar to a screen cursor, it allows us to selct and start thinigs. It executes the queries
create_table = "CREATE TABLE users (id int, username text, password text)"
cursor.execute(create_table)
user = (1, "damien", "bitches")... | Python | 30 | 25.066668 | 124 | /API/Section6/test.py | 0.695262 | 0.68758 |
DamienPond001/Udemy_API | refs/heads/master | # Import row from bokeh.layouts
from bokeh.layouts import row, column
# Create the first figure: p1
p1 = figure(x_axis_label='fertility (children per woman)', y_axis_label='female_literacy (% population)')
# Add a circle glyph to p1
p1.circle('fertility', 'female_literacy', source=source)
# Create the second figure:... | Python | 82 | 25.280487 | 105 | /Datacamp/bokeh_layouts.py | 0.735376 | 0.708914 |
vgrichina/ios-autocomplete | refs/heads/master | import os
import sqlite3
db_path = "Autocomplete/names.sqlite"
os.remove(db_path)
db = sqlite3.connect(db_path)
db.execute("pragma synchronous=off")
db.execute("pragma journal_mode=memory")
db.execute("pragma temp_store=memory")
db.execute("create table names (name text)")
db.execute("create table parts (part text ... | Python | 42 | 28.261906 | 82 | /gen_index.py | 0.634662 | 0.632221 |
zhouyichen/PGCN | refs/heads/master | import numpy as np
import pandas as pd
import os
from random import shuffle
def generate_proposals(start_gt, end_gt, label, n_frame, alpha=5, beta=2.5, n_to_generate=100):
duration = end_gt - start_gt
proposals = []
while n_to_generate:
iou = np.random.beta(alpha, beta)
not_success = Tru... | Python | 110 | 32.518181 | 102 | /generate_proposal.py | 0.505688 | 0.494854 |
EdgarOPG/Second-Partial-Proyect-Data-Mining | refs/heads/master | """
Author: Normando Ali Zubia Hernández
This file is created to explain the use of dimensionality reduction
with different tools in sklearn library.
Every function contained in this file belongs to a different tool.
"""
from sklearn import datasets
from sklearn.decomposition import PCA
from sklearn.ensemble import Ext... | Python | 218 | 27.688074 | 86 | /primera_iteracion.py | 0.649344 | 0.637032 |
EdgarOPG/Second-Partial-Proyect-Data-Mining | refs/heads/master | """
Author: Normando Ali Zubia Hernández
This file is created to explain the use of normalization
with different tools in sklearn library.
Every function contained in this file belongs to a different tool.
"""
from sklearn import preprocessing
import pandas as pd
import numpy
def z_score_normalization(data):
#... | Python | 77 | 24.38961 | 66 | /normalization.py | 0.615345 | 0.599488 |
EdgarOPG/Second-Partial-Proyect-Data-Mining | refs/heads/master | import pandas as pd
import matplotlib.pyplot as ptl
import math as mt
def open_file(fileName):
data = pd.read_csv(fileName)
return data
def show_data_info(data):
print("Number of instance:" + str(data.shape[0]))
print("Number of features:" + str(data.shape[1]))
print("-----------------------------... | Python | 36 | 23.5 | 55 | /clean.py | 0.582766 | 0.579365 |
EdgarOPG/Second-Partial-Proyect-Data-Mining | refs/heads/master | """
*This module was create for Data Mining subject in Universidad Autonóma de Chihuahua
*Professor: M.I.C Normando Ali Zubia Hernández
Module information:
The principal functions of this module are:
*Create violin graphs
*Create box-Graphs
*Create Histograms
Information contact:
email: azubiah@uach.mx
"""
import p... | Python | 168 | 22.797619 | 84 | /a.py | 0.644322 | 0.634067 |
isabellaleehs/Data_Visualization | refs/heads/master | # Create choropleth map
#
# Date: Dec 2017
import plotly as py
import pandas as pd
import pycountry
def get_data(filename):
'''
Loads data from file and cleans it.
Inputs:
filename: file directory
Returns: a cleaned dataframe
'''
df = pd.read_csv(filename)
# Reset header row
... | Python | 101 | 28.445545 | 117 | /Choropleth map/make_map.py | 0.570612 | 0.546402 |
chsoftworld/S-SEC-demo- | refs/heads/master | import requests
from lxml import etree
import pymysql
url = 'http://data.10jqka.com.cn/funds/ddzz/#refCountId=db_50741cd6_397,db_509381c1_860'
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1;WOW64; rv:6.0) '
'Gecko/20100101 Firefox/6.0',
}
html = requests.get(url,headers=headers).text
par... | Python | 63 | 29.063492 | 401 | /Stock SEC/demo.py | 0.566684 | 0.465999 |
chsoftworld/S-SEC-demo- | refs/heads/master | import tkinter as tk
from threading import Thread
from tkinter import messagebox
import pymysql as sql
import requests
import time
from lxml import etree
import json
from stack_detail import *
from gevent import monkey # monkey 插件
from queue import Queue
import os
class SSEC:
"""
界面可视化
"""
def ... | Python | 157 | 30.21656 | 345 | /Stock SEC/UI.py | 0.534472 | 0.470205 |
chsoftworld/S-SEC-demo- | refs/heads/master | # from lxml import etree
# import requests
# import numpy as np
# import matplotlib.dates as md
# import matplotlib.pyplot as mp
# from UI import *
# def details(num,name):
# """
# 获取并绘制数据
# :param num:
# :return:
# """
# print('start get')
#
# """
# 获取阶段
# """
# url = 'http:... | Python | 282 | 36.255318 | 301 | /Stock SEC/stack_detail.py | 0.576487 | 0.525464 |
chsoftworld/S-SEC-demo- | refs/heads/master | dic = {
'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
'Accept-Encoding':'gzip, deflate',
'Accept-Language':'zh-CN,zh;q=0.9',
'Cache-Control':'max-age=0',
'Connection':'keep-alive',
'Cookie':'Hm_lvt_85261bbccca7731cac0375109980ddf5=156... | Python | 15 | 53.466667 | 288 | /Stock SEC/dictset.py | 0.75 | 0.520833 |
okdshin/mutelang | refs/heads/master | import pretty_midi
from scipy.io import wavfile
def main(midi_filename, wav_filename):
midi = pretty_midi.PrettyMIDI(midi_filename)
audio = midi.fluidsynth()
wavfile.write(wav_filename, 44100, audio)
if __name__ == '__main__':
import fire
fire.Fire(main)
| Python | 13 | 20.461538 | 48 | /midi2wav.py | 0.681004 | 0.663082 |
okdshin/mutelang | refs/heads/master | import subprocess
class EOL(Exception):
pass
class Parser:
def __init__(self, filename, code):
self.filename = filename
self.cur = 0
self.code = code
self.look_ahead = code[0]
self.bpm = 120
self.velocity = 90
self.instrument = 'Cello'
self.no... | Python | 174 | 32.609196 | 100 | /mutec.py | 0.432969 | 0.426813 |
okdshin/mutelang | refs/heads/master | import sys
import math
import pretty_midi
class Note:
def __init__(self, base: str, accidental: str, octave_num: int):
self.base = base
self.accidental = accidental
self.octave_num = octave_num
def name(self):
return self.base + self.accidental + str(self.octave_num)
def ... | Python | 151 | 33.42384 | 78 | /chord_bass_seq.py | 0.471528 | 0.461331 |
okdshin/mutelang | refs/heads/master | import pretty_midi
def main(src_filename_list, dst_filename):
dst_midi = pretty_midi.PrettyMIDI()
for filename in src_filename_list:
src_midi = pretty_midi.PrettyMIDI(filename)
dst_midi.instruments.extend(src_midi.instruments)
dst_midi.write(dst_filename)
if __name__ == '__main__':
i... | Python | 14 | 24.071428 | 57 | /stack_midi.py | 0.672365 | 0.672365 |
okdshin/mutelang | refs/heads/master | import sys
import math
import pretty_midi
class Note:
def __init__(self, base: str, accidental: str, octave_num: int):
self.base = base
self.accidental = accidental
self.octave_num = octave_num
def name(self):
return self.base + self.accidental + str(self.octave_num)
def ... | Python | 141 | 32.212765 | 73 | /drum_seq.py | 0.485373 | 0.474482 |
KagenLH/forme-app | refs/heads/main | from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField
from wtforms.validators import Email, ValidationError, InputRequired, Length, EqualTo
from app.models import User
def user_exists(form, field):
# Checking if user exists
email = field.data
user = User.query.filter(User.email ==... | Python | 30 | 39.400002 | 149 | /app/forms/signup_form.py | 0.712871 | 0.706271 |
KagenLH/forme-app | refs/heads/main | """empty message
Revision ID: fa590b961f4f
Revises: ffdc0a98111c
Create Date: 2021-08-16 13:55:52.581549
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'fa590b961f4f'
down_revision = 'ffdc0a98111c'
branch_labels = None
depends_on = None
def upgrade():
# ... | Python | 37 | 27.243244 | 72 | /migrations/versions/20210816_135552_.py | 0.662201 | 0.635407 |
KagenLH/forme-app | refs/heads/main | from app.models import db, Form
def seed_forms():
test = Form(
title = "Test Form Render",
owner_id = 1,
description = "",
label_placement = "",
description_align = "",
title_align = "",
)
db.session.add(test)
db.session.commit()... | Python | 20 | 20.6 | 66 | /app/seeds/forms.py | 0.537037 | 0.534722 |
KagenLH/forme-app | refs/heads/main | """empty message
Revision ID: 94f5eda37179
Revises: b3e721c02f48
Create Date: 2021-08-20 17:15:46.455809
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '94f5eda37179'
down_revision = 'b3e721c02f48'
branch_labels = None
depends_on = None
def upgrade():
# ... | Python | 38 | 25.710526 | 65 | /migrations/versions/20210820_171546_.py | 0.611823 | 0.568473 |
KagenLH/forme-app | refs/heads/main | """empty message
Revision ID: d0c387e43ca4
Revises: 94f5eda37179
Create Date: 2021-08-21 11:33:10.206199
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd0c387e43ca4'
down_revision = '94f5eda37179'
branch_labels = None
depends_on = None
def upgrade():
# ... | Python | 30 | 25.166666 | 78 | /migrations/versions/20210821_113310_.py | 0.670064 | 0.606369 |
KagenLH/forme-app | refs/heads/main | """empty message
Revision ID: b05fdd14ae4f
Revises: 4563136888fd
Create Date: 2021-08-20 10:34:08.171553
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b05fdd14ae4f'
down_revision = '4563136888fd'
branch_labels = None
depends_on = None
def upgrade():
# ... | Python | 38 | 25.657894 | 65 | /migrations/versions/20210820_103408_.py | 0.613031 | 0.57157 |
KagenLH/forme-app | refs/heads/main | from app.models import db, User
# Adds a demo user, you can add other users here if you want
def seed_users():
demo = User(
username='Demo', email='demo@aa.io', password='password')
marnie = User(
username='marnie', email='marnie@aa.io', password='password')
bobbie = User(
username... | Python | 27 | 30.25926 | 66 | /app/seeds/users.py | 0.684834 | 0.684834 |
KagenLH/forme-app | refs/heads/main | """empty message
Revision ID: beeeac90e4ba
Revises: d25f4d1b7ea0
Create Date: 2021-08-20 10:00:09.924819
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'beeeac90e4ba'
down_revision = 'd25f4d1b7ea0'
branch_labels = None
depends_on = None
def upgrade():
# ... | Python | 32 | 22.9375 | 65 | /migrations/versions/20210820_100009_.py | 0.631854 | 0.601828 |
KagenLH/forme-app | refs/heads/main | """empty message
Revision ID: 4df12f583573
Revises: 2453c767d036
Create Date: 2021-08-21 16:10:57.556468
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '4df12f583573'
down_revision = '2453c767d036'
branch_labels = None
depends_on = None
def upgrade():
# ... | Python | 32 | 23.0625 | 65 | /migrations/versions/20210821_161057_.py | 0.625974 | 0.596104 |
KagenLH/forme-app | refs/heads/main | from .db import db
from .user import User
from .form import Form
from .field import Field
| Python | 4 | 21.5 | 24 | /app/models/__init__.py | 0.777778 | 0.777778 |
KagenLH/forme-app | refs/heads/main | """empty message
Revision ID: b8ec5632d693
Revises: beeeac90e4ba
Create Date: 2021-08-20 10:05:24.638509
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b8ec5632d693'
down_revision = 'beeeac90e4ba'
branch_labels = None
depends_on = None
def upgrade():
# ... | Python | 32 | 23.1875 | 65 | /migrations/versions/20210820_100524_.py | 0.635659 | 0.583979 |
KagenLH/forme-app | refs/heads/main | """empty message
Revision ID: 2453c767d036
Revises: d0c387e43ca4
Create Date: 2021-08-21 14:53:11.208418
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2453c767d036'
down_revision = 'd0c387e43ca4'
branch_labels = None
depends_on = None
def upgrade():
# ... | Python | 30 | 26.766666 | 99 | /migrations/versions/20210821_145311_.py | 0.671068 | 0.618247 |
KagenLH/forme-app | refs/heads/main | from .db import db
class Form(db.Model):
__tablename__ = 'forms'
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(50), nullable=False)
owner_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
description = db.Column(db.Text)
label_placement = db.Colu... | Python | 38 | 36.473682 | 192 | /app/models/form.py | 0.627107 | 0.621489 |
KagenLH/forme-app | refs/heads/main | from flask import Blueprint, jsonify, request, session
from flask_login import login_required, current_user
from app.models import Form, db, Field
form_routes = Blueprint("forms", __name__)
# get all forms --- remove this route?
@form_routes.route('/')
# @login_required
def get_forms():
forms = Form.query.all() ... | Python | 243 | 30.843622 | 80 | /app/api/form_routes.py | 0.549496 | 0.548204 |
KagenLH/forme-app | refs/heads/main | """empty message
Revision ID: b3e721c02f48
Revises: 9aec744a6b98
Create Date: 2021-08-20 13:35:16.871785
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b3e721c02f48'
down_revision = '9aec744a6b98'
branch_labels = None
depends_on = None
def upgrade():
# ... | Python | 32 | 22.875 | 65 | /migrations/versions/20210820_133516_.py | 0.636126 | 0.570681 |
KagenLH/forme-app | refs/heads/main | # from flask import Blueprint, jsonify, request
# from flask_login import login_required
# from app.models import Field, db
# field_routes = Blueprint('fields', __name__)
# @field_routes.route('/', methods=['POST'])
# def fields():
# if request.method == 'POST':
# # get fields data from request body
# ... | Python | 42 | 32.119049 | 69 | /app/api/field_routes.py | 0.557153 | 0.557153 |
KagenLH/forme-app | refs/heads/main | from .db import db
class Field(db.Model):
__tablename__ = 'fields'
id = db.Column(db.Integer, primary_key=True)
type = db.Column(db.String(255), nullable=False)
label = db.Column(db.String(55), nullable=False)
max_length = db.Column(db.Integer)
required = db.Column(db.Boolean, nullable=False)... | Python | 30 | 34.900002 | 86 | /app/models/field.py | 0.592386 | 0.581244 |
KagenLH/forme-app | refs/heads/main | from app.models import db, Field
from app.models import Form
def seed_fields():
form = Form(
title='To Test Fields',
owner_id=1
)
db.session.add(form)
testField = Field(
type="text",
label="Test Field",
required=False,
form=form, # creates the form_id ... | Python | 26 | 20.846153 | 67 | /app/seeds/fields.py | 0.612676 | 0.610915 |
NLeSC/cwltool-service | refs/heads/master | #!/usr/bin/env python
import os
import sys
import setuptools.command.egg_info as egg_info_cmd
import shutil
from setuptools import setup, find_packages
SETUP_DIR = os.path.dirname(__file__)
README = os.path.join(SETUP_DIR, 'README')
setup(name='cwltool_service',
version='2.0',
description='Common workfl... | Python | 34 | 30.382353 | 81 | /setup.py | 0.614808 | 0.611059 |
orianao/cssproj | refs/heads/master | from db import DatabaseController as DbC
def get_results():
all_results = DbC.get_admission_results(1)
return all_results
def calculate_results():
specializations = DbC.get_all_specializations()
candidates = DbC.get_all_candidates()
repartition = []
specs = {}
opt_arr = {}
for item in specializations:
spe... | Python | 70 | 34.542858 | 119 | /app/utils.py | 0.709807 | 0.702974 |
folmez/Handsfree-KGS | refs/heads/master | from pynput.mouse import Button, Controller
import cv2
import imageio
import matplotlib.pyplot as plt
import threading
import time
import queue
import os
import numpy as np
import src
frames = queue.Queue(maxsize=10)
class frameGrabber(threading.Thread):
def __init__(self):
# Constructor
threading... | Python | 244 | 37.307377 | 108 | /play_handsfree_GO.py | 0.587033 | 0.5758 |
folmez/Handsfree-KGS | refs/heads/master | import imageio
import pytest
import sys, os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import src
def test_get_digital_goban_state():
rgb_pix = imageio.imread('images/digital_goban.png')
# Process KGS goban grayscale and find the stones
assert src.get_digital_goban_... | Python | 12 | 31.833334 | 82 | /tests/test_screenshot_actions.py | 0.649746 | 0.616751 |
folmez/Handsfree-KGS | refs/heads/master | from pynput.mouse import Button, Controller
import src
import time
def get_goban_corners():
# Obtain mouse controller
mouse = Controller()
# Ask the user to define goban corners
print('Move cursor to upper-left (A19) corner of Goban and keep it there five seconds')
time.sleep(5)
(UL_x, UL_y) =... | Python | 57 | 28.807018 | 92 | /src/mouse_actions.py | 0.584461 | 0.55621 |
folmez/Handsfree-KGS | refs/heads/master | import imageio
def get_pyhsical_goban_state(rgb_pix):
pass
def picture_to_rgb(path):
return misc.imageio(path)
| Python | 7 | 16.285715 | 38 | /src/cam_actions.py | 0.719008 | 0.719008 |
folmez/Handsfree-KGS | refs/heads/master | import src
import time
UL_x, UL_y, goban_step = src.get_goban_corners()
prev_stone_set = set()
print("Started scanning the board for moves every 5 seconds...")
while True:
# wait between screenshots
time.sleep(5)
# get board screenshot
board_rgb_screenshot = src.KGS_goban_rgb_screenshot(UL_x, UL_y, go... | Python | 32 | 34.59375 | 79 | /make_goban_speak.py | 0.609306 | 0.597893 |
folmez/Handsfree-KGS | refs/heads/master | import pyscreeze
import numpy as np
import matplotlib.pyplot as plt
import src
def get_digital_goban_state(rgb_pix, plot_stuff=False):
# RGB of Black = [ 0, 0, 0]
# RGB of White = [255, 255, 255]
# RGB of Orange = [255, 160, 16]
# Use red scale to find out black stones, blue scale to find out whit... | Python | 72 | 35.541668 | 82 | /src/screenshot_actions.py | 0.582288 | 0.549981 |
folmez/Handsfree-KGS | refs/heads/master | import matplotlib.pyplot as plt
xy=[]
def onclick(event):
print(event.xdata, event.ydata)
xy.append((event.xdata, event.ydata))
fig = plt.figure()
plt.plot(range(10))
fig.canvas.mpl_connect('button_press_event', onclick)
plt.show()
print(xy)
| Python | 14 | 17.142857 | 53 | /temp/plot_save_coordinates_on_click.py | 0.704724 | 0.69685 |
folmez/Handsfree-KGS | refs/heads/master | import matplotlib.pyplot as plt
import imageio
import numpy as np
import src
IMG_PATH = 'images/empty_pyshical_goban1.png'
board_corners = []
def onclick(event):
print(event.xdata, event.ydata)
board_corners.append((event.xdata, event.ydata))
# Get RGB matrix of the picture with goban
rgb = imageio.imread(IM... | Python | 45 | 32.066666 | 83 | /auto_goban_detection.py | 0.659946 | 0.646505 |
folmez/Handsfree-KGS | refs/heads/master | import sys, os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from pynput.mouse import Button, Controller
import pytest
import imageio
import src
# Write a test of play_handsfree_GO.py using already existing frames
img_name = []
folder_name = 'images/sample_game_log/ex1/'
# empty b... | Python | 135 | 49.940742 | 85 | /tests/test_play_handsfree_GO.py | 0.637342 | 0.581213 |
folmez/Handsfree-KGS | refs/heads/master | from pynput.mouse import Button, Controller
import time
import sys
import os
import pytest
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import src
def test_str_to_integer_coordinates():
assert src.str_to_integer_coordinates('A19') == (1, 1)
assert src.str_to_integer_coord... | Python | 43 | 33.930233 | 82 | /tests/test_mouse_actions.py | 0.622503 | 0.575899 |
folmez/Handsfree-KGS | refs/heads/master | from setuptools import setup, find_packages
setup( name='Handsfree-KGS',
version='0.0',
description='Pay Handsfree Go on KGS',
author='Fatih Olmez',
author_email='folmez@gmail.com',
packages=find_packages())
| Python | 7 | 32.57143 | 46 | /setup.py | 0.608511 | 0.6 |
folmez/Handsfree-KGS | refs/heads/master | import matplotlib.pyplot as plt
import numpy as np
from scipy.signal import argrelmin
import imageio
import src
def play_next_move_on_digital_board(mouse, color, i, j, bxy, wxy, \
UL_x, UL_y, goban_step):
if color is not None:
print(f"New move: {color} playe... | Python | 399 | 38.42857 | 87 | /src/picture_actions.py | 0.57507 | 0.553458 |
folmez/Handsfree-KGS | refs/heads/master | from .mouse_actions import get_goban_corners, str_to_integer_coordinates
from .mouse_actions import int_coords_to_screen_coordinates, make_the_move
from .mouse_actions import int_coords_to_str
from .screenshot_actions import KGS_goban_rgb_screenshot, get_digital_goban_state
from .picture_actions import plot_goban_rgb, ... | Python | 13 | 67.384613 | 81 | /src/__init__.py | 0.817773 | 0.817773 |
folmez/Handsfree-KGS | refs/heads/master | import pytest
import imageio
import sys, os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import src
# stones - upper-left corner is (1,1), lower-left corner is (19,1)
IMG_PATH = ['images/pyshical_goban_pic1.png', 'images/pyshical_goban_pic2.png', \
'images/pyshical_gob... | Python | 84 | 47.940475 | 83 | /tests/test_picture_actions.py | 0.556069 | 0.48504 |
folmez/Handsfree-KGS | refs/heads/master | import matplotlib.pyplot as plt
import imageio
import numpy as np
import src
IMG_PATH = 'images/pyshical_goban_pic1.png'
#IMG_PATH = 'images/pyshical_goban_pic2.png'
#IMG_PATH = 'images/pyshical_goban_pic3.png'
UL_outer_x, UL_outer_y = 315, 24
UR_outer_x, UR_outer_y = 999, 40
BL_outer_x, BL_outer_y = 3, 585
BR_outer_x... | Python | 41 | 33.219513 | 82 | /temp/process_pyhsical_goban_pic.py | 0.649323 | 0.604419 |
hoichunlaw/EventDriven | refs/heads/master | import eikon as ek
import numpy as np
import pandas as pd
import os
import shutil
import zipfile
import datetime
import cufflinks as cf
import configparser as cp
import platform
import pickle
import nltk
nltk.download('stopwords')
from copy import deepcopy
import collections
from nltk.tokenize import TreebankWordToken... | Python | 400 | 35.645 | 162 | /News_Headlines_Prediction.py | 0.639241 | 0.631123 |
hoichunlaw/EventDriven | refs/heads/master | import eikon as ek
import numpy as np
import pandas as pd
import os
import zipfile
import datetime
import cufflinks as cf
import configparser as cp
ek.set_app_key('e4ae85e1e08b47ceaa1ee066af96cabe6e56562a')
dataRootPath = r"D:/Eikon_Data/"
dataRootPathNews = r"D:/Eikon_Data/News/"
dataRootPathMarketData = r"D:/Eikon_... | Python | 136 | 34.051472 | 134 | /Downloader.py | 0.632893 | 0.621565 |
hoichunlaw/EventDriven | refs/heads/master | import numpy as np
import pandas as pd
import os
import win32com.client as win32
import datetime
path = r"D:/python/EventDriven/result/"
date_format = "%Y-%m-%d"
def formatDate(date, fm=date_format):
return date.strftime(fm)
def moveDate(date, dayDelta=0, hourDelta=0):
if type(date) == str:
return da... | Python | 37 | 29.837837 | 134 | /Email.py | 0.667835 | 0.654689 |
teslaworksumn/munchi-pi-api | refs/heads/master | import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD) #pin numbering scheme uses board header pins
GPIO.setup(8,GPIO.OUT) #pin 8, GPIO15
while True:
'''test pin8 GPIO15'''
GPIO.output(8,1) #output high to pin 8
time.sleep(0.5) #delay 0.5 sec
GPIO.output(8,0) #output low to pin 8
time.sleep(0.5)
| Python | 12 | 24.833334 | 69 | /port_test.py | 0.714744 | 0.653846 |
teslaworksumn/munchi-pi-api | refs/heads/master | import time
import RPi.GPIO as GPIO
import Adafruit_ADS1x15
THERMISTORVALUE 100000
SERIESRESISTOR 100000 #series resistor to thermistor
BCOEFFICIENT 4072
thermistorR2Temp = {3.2575:0, 2.5348:5, 1.9876:10, 1.5699:15, 1.2488:20, 1.0000:25, 0.80594:30, 0.65355:35, 0.53312:40, 0.43735:45, 0.36074:50, 0.29911:55, 0.24925:... | Python | 36 | 39.083332 | 295 | /munchi_rasp_pi.py | 0.690922 | 0.474012 |
teslaworksumn/munchi-pi-api | refs/heads/master | import time
import RPi.GPIO as GPIO
import Adafruit_ADS1x15
GPIO.setmode(GPIO.BOARD) #pin numbering scheme uses board header pins
GPIO.setup(8,GPIO.OUT) #pin 8, GPIO15
adc = Adafruit_ADS1x15.ADS1015() #create an ADS1015 ADC (12-bit) instance.
# Choose a gain of 1 for reading voltages from 0 to 4.09V.
# Or pick a dif... | Python | 30 | 27.966667 | 109 | /adc_test.py | 0.662831 | 0.547756 |
romkof/CarND-Behavioral-Cloning-P3 | refs/heads/master | import os
import csv
import cv2
import numpy as np
import sklearn
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
data_path = 'record'
samples = []
with open( data_path + '/driving_log.csv') as csvfile:
reader = csv.reader(csvfile)
for line in reader:
samples.ap... | Python | 102 | 34.92157 | 91 | /model.py | 0.627012 | 0.597817 |
Jmbac0n/randomiser | refs/heads/master | # Simple script that generates a random
# combination of words from separate strings
colours = ['red','blue','green'.'yellow']
shapes = ['circle','square','triangle','star']
import random
x = random.randint(0, 2)
y = random.randint(0, 2)
combination = colours[x] + (" ") + shapes[y]
print(combination)
| Python | 13 | 22.615385 | 46 | /randomiser.py | 0.65625 | 0.64375 |
prateeksahu10/web-api | refs/heads/master | import requests
response=requests.get("https://api.forismatic.com/api/1.0/?method=getQuote&lang=en&format=text")
print(response.content)
| Python | 3 | 44.666668 | 96 | /assignment13.py | 0.79562 | 0.781022 |
Alfredjoy/Ecom_project | refs/heads/master | from django.urls import path, include
from store import views
urlpatterns = [
path('',views.store,name='store'),
path('cart',views.cart, name='cart'),
path('checkout',views.checkout, name='checkout')
]
| Python | 10 | 20.700001 | 52 | /store/urls.py | 0.677419 | 0.677419 |
jessehylton/Podrum | refs/heads/master | """
* ____ _
* | _ \ ___ __| |_ __ _ _ _ __ ___
* | |_) / _ \ / _` | '__| | | | '_ ` _ \
* | __/ (_) | (_| | | | |_| | | | | | |
* |_| \___/ \__,_|_| \__,_|_| |_| |_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public Lice... | Python | 29 | 29.206896 | 77 | /src/podrum/network/protocol/ServerToClientHandshakePacket.py | 0.584475 | 0.583333 |
jessehylton/Podrum | refs/heads/master | """
* ____ _
* | _ \ ___ __| |_ __ _ _ _ __ ___
* | |_) / _ \ / _` | '__| | | | '_ ` _ \
* | __/ (_) | (_| | | | |_| | | | | | |
* |_| \___/ \__,_|_| \__,_|_| |_| |_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public Lice... | Python | 91 | 23.32967 | 97 | /src/podrum/math/Facing.py | 0.500903 | 0.495483 |
jessehylton/Podrum | refs/heads/master | """
* ____ _
* | _ \ ___ __| |_ __ _ _ _ __ ___
* | |_) / _ \ / _` | '__| | | | '_ ` _ \
* | __/ (_) | (_| | | | |_| | | | | | |
* |_| \___/ \__,_|_| \__,_|_| |_| |_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public Lice... | Python | 25 | 30.719999 | 77 | /src/podrum/network/protocol/ClientToServerHandshakePacket.py | 0.586381 | 0.58512 |
jessehylton/Podrum | refs/heads/master | """
* ____ _
* | _ \ ___ __| |_ __ _ _ _ __ ___
* | |_) / _ \ / _` | '__| | | | '_ ` _ \
* | __/ (_) | (_| | | | |_| | | | | | |
* |_| \___/ \__,_|_| \__,_|_| |_| |_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Pub... | Python | 38 | 36.394737 | 101 | /src/podrum/Podrum.py | 0.540781 | 0.535298 |
jessehylton/Podrum | refs/heads/master | """
* ____ _
* | _ \ ___ __| |_ __ _ _ _ __ ___
* | |_) / _ \ / _` | '__| | | | '_ ` _ \
* | __/ (_) | (_| | | | |_| | | | | | |
* |_| \___/ \__,_|_| \__,_|_| |_| |_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public Lice... | Python | 37 | 39.945946 | 95 | /src/podrum/network/PacketPool.py | 0.683727 | 0.683071 |
jessehylton/Podrum | refs/heads/master | """
* ____ _
* | _ \ ___ __| |_ __ _ _ _ __ ___
* | |_) / _ \ / _` | '__| | | | '_ ` _ \
* | __/ (_) | (_| | | | |_| | | | | | |
* |_| \___/ \__,_|_| \__,_|_| |_| |_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU L... | Python | 102 | 31.637255 | 115 | /src/podrum/utils/Utils.py | 0.565635 | 0.547612 |
jessehylton/Podrum | refs/heads/master | """
* ____ _
* | _ \ ___ __| |_ __ _ _ _ __ ___
* | |_) / _ \ / _` | '__| | | | '_ ` _ \
* | __/ (_) | (_| | | | |_| | | | | | |
* |_| \___/ \__,_|_| \__,_|_| |_| |_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public Lice... | Python | 188 | 26.143618 | 77 | /src/podrum/utils/BinaryStream.py | 0.560847 | 0.552812 |
jessehylton/Podrum | refs/heads/master | """
* ____ _
* | _ \ ___ __| |_ __ _ _ _ __ ___
* | |_) / _ \ / _` | '__| | | | '_ ` _ \
* | __/ (_) | (_| | | | |_| | | | | | |
* |_| \___/ \__,_|_| \__,_|_| |_| |_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public Lice... | Python | 320 | 28.021875 | 95 | /src/podrum/utils/Binary.py | 0.553462 | 0.528481 |
jessehylton/Podrum | refs/heads/master | """
* ____ _
* | _ \ ___ __| |_ __ _ _ _ __ ___
* | |_) / _ \ / _` | '__| | | | '_ ` _ \
* | __/ (_) | (_| | | | |_| | | | | | |
* |_| \___/ \__,_|_| \__,_|_| |_| |_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of t... | Python | 34 | 27.382353 | 77 | /src/podrum/wizard/Parser.py | 0.449348 | 0.448345 |
jessehylton/Podrum | refs/heads/master | """
* ____ _
* | _ \ ___ __| |_ __ _ _ _ __ ___
* | |_) / _ \ / _` | '__| | | | '_ ` _ \
* | __/ (_) | (_| | | | |_| | | | | | |
* |_| \___/ \__,_|_| \__,_|_| |_| |_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public Lice... | Python | 60 | 30.433332 | 166 | /src/podrum/nbt/tag/NamedTag.py | 0.563627 | 0.557264 |
jessehylton/Podrum | refs/heads/master | """
* ____ _
* | _ \ ___ __| |_ __ _ _ _ __ ___
* | |_) / _ \ / _` | '__| | | | '_ ` _ \
* | __/ (_) | (_| | | | |_| | | | | | |
* |_| \___/ \__,_|_| \__,_|_| |_| |_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public Lice... | Python | 66 | 43.5 | 244 | /src/podrum/utils/UUID.py | 0.59176 | 0.558393 |
jessehylton/Podrum | refs/heads/master | """
* ____ _
* | _ \ ___ __| |_ __ _ _ _ __ ___
* | |_) / _ \ / _` | '__| | | | '_ ` _ \
* | __/ (_) | (_| | | | |_| | | | | | |
* |_| \___/ \__,_|_| \__,_|_| |_| |_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public Lice... | Python | 71 | 35.15493 | 77 | /src/podrum/network/protocol/ResourcePacksInfoPacket.py | 0.577328 | 0.57538 |
jessehylton/Podrum | refs/heads/master | """
* ____ _
* | _ \ ___ __| |_ __ _ _ _ __ ___
* | |_) / _ \ / _` | '__| | | | '_ ` _ \
* | __/ (_) | (_| | | | |_| | | | | | |
* |_| \___/ \__,_|_| \__,_|_| |_| |_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Pub... | Python | 91 | 35.923077 | 139 | /src/podrum/Server.py | 0.517531 | 0.508548 |
jessehylton/Podrum | refs/heads/master | """
* ____ _
* | _ \ ___ __| |_ __ _ _ _ __ ___
* | |_) / _ \ / _` | '__| | | | '_ ` _ \
* | __/ (_) | (_| | | | |_| | | | | | |
* |_| \___/ \__,_|_| \__,_|_| |_| |_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public Lice... | Python | 27 | 24.25926 | 77 | /src/podrum/resourcepacks/ResourcePack.py | 0.510264 | 0.504399 |
jessehylton/Podrum | refs/heads/master | """
* ____ _
* | _ \ ___ __| |_ __ _ _ _ __ ___
* | |_) / _ \ / _` | '__| | | | '_ ` _ \
* | __/ (_) | (_| | | | |_| | | | | | |
* |_| \___/ \__,_|_| \__,_|_| |_| |_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public Lice... | Python | 42 | 24.642857 | 77 | /src/podrum/Player.py | 0.532962 | 0.528319 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.