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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
09cc7ceb217f14538db204560cbe039839aa967a | Python | enkiprobo/tugasAIAgkt2015 | /Tugas 1/Pengumpulan/1301154553 RANESTARI SASTRIANI/SA/tubesSA.py | UTF-8 | 786 | 3.5625 | 4 | [] | no_license | import random
# definisi fungsi
def fungsi(a, b):
return ((4 - (2.1 * (a ** 2)) + ((a ** 4) / 3)) * (a ** 2)) + (a * b) + ((-4 + (4 * (b ** 2))) * (b ** 2))
def probabilitas(a, b, c):
return 2.71828183 ** ((a-b)/c)
# deklarasi variabel
temp = 10000
alpha = 0.999
r = random.uniform(0,1)
x1 = random.unifo... | true |
e01e3a527e9e42b65cd0be5f1d8a3106a7f19f9b | Python | po3rin/python_playground | /practical-recommender-systems/util/metric_calculator.py | UTF-8 | 2,211 | 3.015625 | 3 | [] | no_license | import numpy as np
from sklearn.metrics import mean_squared_error
from util.models import Metrics
from typing import Dict, List
class MetricCalculator:
def calc(
self,
true_rating: List[float],
pred_rating: List[float],
true_user2items: Dict[int, List[int]],
pred_user2items... | true |
9d9710be397361882655aa60786092b0d7602173 | Python | sguttikon/sim-environment | /src/old_code_feb_12/pf_net/display.py | UTF-8 | 4,140 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
import cv2
import numpy as np
import matplotlib.cm as cm
import matplotlib.pyplot as plt
from matplotlib.patches import Wedge
class Render(object):
def __init__(self, fig_shape=(7, 7)):
self.fig = plt.figure(figsize=fig_shape)
self.plt_ax = self.fig.add_subplot(111)
... | true |
7877ca63ef935218c5b23d0e40accdf9e47263b6 | Python | Harshsa28/algs | /merge_sort.py | UTF-8 | 787 | 3.703125 | 4 | [] | no_license | import math #for floor
def merge_sort(lst):
if len(lst) < 2: #if len is 1, return the list
return lst
mid = math.floor(len(lst)/2)
lst1 = merge_sort(lst[0:mid]) #simple divide n conquer
lst2 = merge_sort(lst[mid:len(lst)]) #simple divide n conquer
return merge(lst1, lst2) #merge the 2 smaller sorted ... | true |
64bcacb358f43ff39b5f2ec8d1633538e6e46146 | Python | hmcka/1511 | /shape-calculations/circle.py | UTF-8 | 611 | 4.5 | 4 | [] | no_license | #This program provides functions that allow you to find the area and circumference of a circle.
#programmed by Hethur Aluma | 2/19/20
import math
def calc_circle_area():
"""Calculates the area of a circle"""
radius = float(input("What is the radius of your circle? "))
circle_area = math.pi * radius
p... | true |
0787f62c2d4309448dc5b50cec0773417245a0fa | Python | michaelprummer/datascience | /clustering/data_preprocessing/remove_duplicates_cluster.py | UTF-8 | 1,441 | 2.703125 | 3 | [] | no_license | import codecs, os
if __name__ == '__main__':
input_path = "data/"
output_path = "out/"
files_in_folder = os.listdir(input_path + "/")
if not os.path.exists(input_path):
os.makedirs(input_path)
if not os.path.exists(output_path):
os.makedirs(output_path)
print("{0} Files foun... | true |
2a6b70c3b1b05ea59843406bbb96ef4c3ae9c1cd | Python | adobrich/Pongy | /pongy/pongy.py | UTF-8 | 5,666 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
import pyglet
from enum import Enum
import entity
class Game(pyglet.window.Window):
"""Initialise and run the Pongy game."""
def __init__(self, *args, **kwargs):
super(Game, self).__init__(*args, **kwargs)
self.table = entity.Table(self.width, self.height)
self.... | true |
1ce41e4a6c7dc41c38e652e0230b0f7cb86dfe61 | Python | cherylchoon/DojoAssignments | /pycode/Python_Fundamentals/new.py | UTF-8 | 100 | 2.9375 | 3 | [] | no_license | my_name = "Cheryl"
print my_name
my_name = "Choon"
print my_name
print 5+5
print my_name + str(5+5)
| true |
2856c182b426aae39b4f79765910183e48768d0f | Python | abhaysinh/Data-Camp | /Data Science for Everyone Track/19-Introduction to Shell/05- Creating new tools/03-How can I save commands to re-run later.py | UTF-8 | 1,132 | 3.71875 | 4 | [] | no_license | '''
How can I save commands to re-run later?
You have been using the shell interactively so far. But since the commands you type in are just text, you can store them in files for the shell to run over and over again. To start exploring this powerful capability, put the following command in a file called headers.sh:
h... | true |
88175b290d15104f587489c27774cffb2894b278 | Python | biswaspiyalCSERUET/ML_Pattern | /Perceptron/MultiClass-KERSEL/kesler.py | UTF-8 | 3,820 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 18 12:56:26 2018
@author: yeaseen
"""
import numpy as np
def split(s, delim=[" ", '\n']):
words = []
word = []
for c in s:
if c not in delim:
word.append(c)
else:
if word:
words.a... | true |
855feacb21f328da839cd9cb16357de024774b35 | Python | BadoinoMatteo/ES_PYTHON_quarta | /PHYTON/thread/es4.py | UTF-8 | 1,057 | 2.796875 | 3 | [] | no_license | import threading
import logging
import random
totalebiglietti=100
def cassa(tID):
s1.acquire()
print("cassa 1")
numeroBiglietti=[0,1,2,3,4,5,6,7,8,9,10]
biglietti=(int)(random.choice(numeroBiglietti))
global totalebiglietti
print(totalebiglietti)
if totalebiglietti==0: #bi... | true |
b0294ac9e94ca69d1c7fe79be9695f18bab82de4 | Python | joshbenner/mudsling | /src/mudsling/utils/locks.py | UTF-8 | 4,637 | 3.265625 | 3 | [] | no_license | """
Implements a generic pyparsing lock parser grammar.
Syntax for a lock: [NOT] func1(args) [AND|OR] [NOT] func2() [...]
Lock syntax involves functions, operators, and parentheses.
* Functions take the form of: <funcName>([<arg1>[, ...]])
* Binary (two-side) operators: and, or
* Unary (one-side) operators: not
* Par... | true |
ae1f58e7fc6b4f507ae4b3fdd10c63f23f0968ec | Python | FanciestW/AdventOfCode2020 | /Day_11/main.py | UTF-8 | 3,238 | 3.234375 | 3 | [] | no_license | import os
from typing import List, Tuple
import itertools
import copy
import numpy as np
def read_file(file_name: str) -> List[List[str]]:
try:
data = list()
read_file = open(file_name, 'r')
while True:
line = read_file.readline().strip()
if not line:
... | true |
40773a05b155e7507118b5d0d55989d93227666b | Python | WEICHENGIT/Sentiment-Analysis-PRIM | /sentiment_discovery/model/serialize.py | UTF-8 | 1,047 | 2.828125 | 3 | [] | no_license | import torch
def save(model, savepath, save_dict=None, keep_vars=True):
"""save model weights and other metadata"""
if save_dict is not None:
#if save_dict is provided save that instead of model state_dict
torch.save(state_dict_cpu_copy(save_dict), savepath)
else:
torch.save(state_dict_cpu_copy(model.state_di... | true |
eb27fe649c41c39f52e7614d3ea31e8d738e330e | Python | wavefly1972/Python-learning | /SVM_SklearnExample.py | UTF-8 | 467 | 3.171875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 13 09:57:15 2017
@author: 100419
"""
from sklearn import svm
x=[[2,0],[1,1],[2,3]]
y=[0,0,1] #Class label
clf=svm.SVC(kernel='linear') #分类器
clf.fit(x,y) #带入预测值
print(clf)
##get support vectors
print(clf.support_vectors_)
#a=clf.support_vectors_
#print... | true |
f7ef29e5032183a0b62d3b6d2695f970dceeab21 | Python | jayelm/nldissect-fork | /script/save_cub_np.py | UTF-8 | 1,525 | 2.921875 | 3 | [] | no_license | """
For each class, load images and save as numpy arrays.
"""
import numpy as np
import os
from PIL import Image
from tqdm import tqdm
import multiprocessing as mp
def npify(args):
img_dir, bird_class = args
bird_imgs_np = {}
class_dir = os.path.join(img_dir, bird_class)
bird_imgs = sorted([x for x i... | true |
da2d5a7182194073c902be437f049efa5e61004f | Python | calvin-and-smit/ds-interview-qs | /python/max_profit.py | UTF-8 | 933 | 4.3125 | 4 | [] | no_license | '''
Sell, sell, sell!
Suppose we are given an array of n integers which represent the value of some stock over time.
Assuming you are allowed to buy the stock exactly once and sell the stock once, what is the maximum
profit you can make? Can you write an algorithm that takes in an array of values and returns the ma... | true |
97b182504612c03ba9efdb5666cee96e4e39b13a | Python | Coolbust/SidGotBots-TwitterApiTest | /WebScrapeExample2SCSBOA.py | UTF-8 | 1,470 | 2.625 | 3 | [] | no_license | import requests
import tweepy
from bs4 import BeautifulSoup
r= requests.get("https://www.scsboa.org/field-recaps/)")
c = r.content
parse = BeautifulSoup(c, "html.parser")
x = 10
i = 0
while i < x:
object = "table_55_row_" + str(i)
id = "id" + str(i)
pdfs = parse.find("tr",{"id":object})
... | true |
8e478bad7a9f62e7a2374582a83d9af9f6532722 | Python | rook88/poincare | /walkthroughLabels.py | UTF-8 | 7,057 | 2.8125 | 3 | [] | no_license | import numpy as np
import cv2
import poincare
import random
import copy
import imageio
theta = 1.5 - np.sqrt(5) * 0.5
class gonClass():
def __init__(self, p, q, r, path):
self.path = path
label = "-".join([str(d) for d in reversed(path)])
self.label = label
if label == "":
... | true |
e9d20098c201eda09bf8530a9d486075e22dbb9e | Python | gadhiar/SmartMirror | /bin/hand_recognition.py | UTF-8 | 7,068 | 3.40625 | 3 | [] | no_license | from tkinter import *
from math import sqrt
import cv2
import time
from threading import *
from datetime import datetime
# ML Classifier to define hands
hand_cascade = cv2.CascadeClassifier('insert path of Gest.xml here')
# set array if tuples that hold x and y values of the location of the hand and time
p... | true |
f9dd8b218ee6d2810c99a2f5051ce117e10b1ca7 | Python | forgi86/gym-control | /examples/example_experiment_design.py | UTF-8 | 2,356 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 14 10:06:01 2019
@author: marco
"""
import gym
import gym_control # contains the first order system environment
import matplotlib.pyplot as plt
import numpy as np
OBS = []
REW = []
ACT = []
I = []
if __name__ == '__main__':
env_arx = gym.mak... | true |
38966986f2cb04c1e287c0d38ddb635ed933d5e7 | Python | AndrewSLowe/DS-Unit-3-Sprint-2-SQL-and-Databases | /module1-introduction-to-sql/buddymove.py | UTF-8 | 793 | 3.03125 | 3 | [
"MIT"
] | permissive | import pandas as pd
import sqlite3
import os
# remove the sqlite3 file if it already exists
os.system("rm buddymove_holidayiq.sqlite3")
# Create dataframe from csv. Open connection to sqlite3, save output sqlite3
infile = "buddymove_holidayiq.csv"
df = pd.read_csv(infile)
conn = sqlite3.connect("buddymove_holidayiq.... | true |
df65f0f1c7fb8a98be9326e5c876b444b7d143fb | Python | listenzcc/learning_tensorflow | /Regression_solution_example.py | UTF-8 | 2,591 | 3.453125 | 3 | [] | no_license | # %%
import tensorflow as tf
import numpy as np
# %%
# Ground truth session
# Parameters, ground-truth of W and b
W_true = np.array([1, 2, 3, 4, 5, 6]).reshape(3, 2).astype(np.float32)
b_true = np.array([7, 8, 9]).reshape(3, 1).astype(np.float32)
# y = W * x + b
def linear_forward(x, W=None, b=None, forward=False, ... | true |
16eef158495c1e6f86016f5703c00f504010be3d | Python | jakeelwes/mjpeg-wishes | /mjpegviewer.py | UTF-8 | 4,165 | 2.578125 | 3 | [] | no_license | import time
import sys
import os
import httplib
import base64
import StringIO
import Image
import pygame
from pygame.locals import *
import getopt
class mjpegviewer:
path = 'stream/'
filename = 'snap'
extension = 'jpg'
number = 0
request = '/axis-cgi/mjpg/video.cgi'
nowindow = F... | true |
822c05509a4ca0f196f906527998e84c053b976e | Python | groove-x/pura | /tests/test_keyboard_key.py | UTF-8 | 352 | 2.609375 | 3 | [
"MIT"
] | permissive | from pura import KeyboardKey
def test_key():
a = KeyboardKey('a')
a2 = KeyboardKey('a')
a_alt = KeyboardKey('a', alt_modifier=True)
b = KeyboardKey('b')
assert a == a2
assert a == 'a'
assert not a != 'a' # pylint: disable=unneeded-not
assert str(a) == 'a'
assert a != a_alt
... | true |
895b831cf08ecdca6eb3936b7cf975d3b5dc7641 | Python | sangnv3007/tailieuhoctapTLU | /Năm 2/Lập trình khoa học dữ liệu/Python/TH/TH buoi 2/VD2.py | UTF-8 | 414 | 3.5 | 4 | [] | no_license | a=int(input("Nhap a:"))
b=int(input("Nhap b:"))
temp1 = a;
temp2 = b;
while (temp1 != temp2):
if (temp1 > temp2):
temp1 -= temp2;
else:
temp2 -= temp1;
uscln = temp1;
bscnn =(a*b)/uscln;
#tính USCLN của a và b
print("Ước số chung lớn nhất của", a, "và", b, "là:", uscln);
#tính BSCNN của a và b
p... | true |
89a0f8c57303ac2d965f68678b1638e622a17013 | Python | oliveross/MachineLearning | /DeepLearning/SingleLayerNetwork.py | UTF-8 | 2,600 | 3.953125 | 4 | [] | no_license | from numpy import exp, array, random, dot
class NeuralNetwork():
def __init__(self):
# seed the random number generator, so it generates the same numbers
# every time the program is ran
random.seed(1)
# we model a single neuron, with 3 input connections and 1 output connection
... | true |
8de5fa60b343ff799a8ad9478c10a71ddc9b2e04 | Python | bjkim777/project | /euler/problem20.py | UTF-8 | 122 | 3.765625 | 4 | [] | no_license | sum=1
for a in range(1,100):
sum*=a
sum2=0
for index in range(len(str(sum))):
sum2+=int(str(sum)[index])
print(sum2)
| true |
8065e5e7c46c866312927b047c6da08e012cd6ac | Python | Jedi18/ScanPartitionPython | /compareVaryingChunk.py | UTF-8 | 3,880 | 2.609375 | 3 | [] | no_license | import csv
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import numpy as np
from os import listdir
import os
def readCsv():
labelToCol = {
'seq' : 'red',
'par' : 'green',
'old' : 'blue'
}
chunkFolders = ['int_default_chunk_size', 'int_chunk_size_by_24', 'int... | true |
716ef3d9d4f7b00d31c25bf1b2ca39fb9c6e1bf8 | Python | kezhengzhu/buildcg | /functions.py | UTF-8 | 14,039 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python
import re
import os
import copy
import math
import numpy as np
def checkerr(cond, message):
if not (cond):
raise Exception(message)
return
def atype_calc(sig, epsi, lr, la):
'''
Takes in sigma (nm), epsilon (kJ/mol), lr, la
returns C, A or V(c6), W(c12)
'''
c_... | true |
f792da43c8a84c478b256d83723d50200e9b9373 | Python | jtemplon/cbb_data_parsing | /SeasonSim/multiseasonsim.py | UTF-8 | 1,410 | 3.328125 | 3 | [] | no_license | from seasonsim import seasonsim, standingscounter, seasonreset
class SeasonStats():
tied_seasons = 0
two_team_tie = 0
three_team_tie = 0
multi_team_tie = 0
most_wins = {}
def multiseasonsim(team_dict, bool):
season_counter = 1
balanced = bool
seasonstats = SeasonStats()
#while sea... | true |
53f1ba359d907d79b7923a2f054f0483c8521fce | Python | Mercurius-0227/Baekjoon | /find_rest.py | UTF-8 | 425 | 3.109375 | 3 | [] | no_license | #1978
#소수 찾기
#2020.07.17 완성!
import sys
input=sys.stdin.readline
N=int(input())
list_A=input().split()
list_A=list(map(int,list_A))
count=0
i=0
j=0
mark=1
for i in range(N):
for j in range(2,list_A[i]):
rest=list_A[i]%j
if list_A[i]==1:
mark=1
if rest==0:
mark=1
... | true |
7dab3b954b7359b0cd4491c1c5b24f8ed2758617 | Python | MatthewTsan/Leetcode | /python/q287/q287.py | UTF-8 | 274 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | from typing import List
class Solution:
def findDuplicate(self, nums: List[int]) -> int:
busket = [False for item in nums]
for item in nums:
if busket[item]:
return item
else:
busket[item] = True
| true |
61ac7d6832302d5b178b70772648ed8b36f49d15 | Python | Fapfood/nlp | /lab9/task2.py | UTF-8 | 1,322 | 3.046875 | 3 | [] | no_license | import numpy as np
from matplotlib import pyplot as plt
def histogram(data):
word, frequency = zip(*data)
indices = np.arange(len(data))
plt.bar(indices, frequency, color='r')
plt.xticks(indices, word, rotation='vertical')
plt.tight_layout()
plt.show()
with open('tmp_dict', encoding='utf8') ... | true |
188a710860c4fca33ef38562ea8a31b3203918c0 | Python | basfl/advance_python | /mongodb/db_util/db_crud.py | UTF-8 | 2,158 | 2.90625 | 3 | [] | no_license | from pymongo import MongoClient
class CRUD:
"""
find only one record
from the collection
"""
@staticmethod
def find_one(collection_name):
print(f'{collection_name.find_one()}')
"""
post only one record
to the collection
"""
@staticmethod
def post_one(collection_... | true |
a2a0d06a35f9b9d0b8b08b3418efeeeddc521cce | Python | peacock0803sz/pyconjpbot | /pyconjpbot/plugins/plusplus.py | UTF-8 | 5,783 | 2.953125 | 3 | [
"MIT"
] | permissive | import random
from slackbot.bot import respond_to, listen_to
from slackbot import settings
import slacker
from .plusplus_model import Plusplus
from ..botmessage import botsend, botwebapi
PLUS_MESSAGE = (
'leveled up!',
'レベルが上がりました!',
'やったね',
'(☝՞ਊ ՞)☝ウェーイ',
)
MINUS_MESSAGE = (
'leveled down... | true |
300a2fcbc48aae6404bae6f3cde9b84fd370b744 | Python | wfjo852/wh2-webhook-public | /wh2_script/wh_rocket_chat/api/channel.py | UTF-8 | 2,036 | 2.578125 | 3 | [] | no_license | #-*- coding:utf-8 -*-
from wh2_script.wh_rocket_chat.api import wh_rocket_chat_request, wh_rocket_chat_api
def list():
return wh_rocket_chat_request.get(wh_rocket_chat_api.channel_list)
def create(channel_name):
#data 추가
payload = {'name': channel_name}
return wh_rocket_chat_request.post_payload(wh... | true |
0300ef414fd961910bc9c1628798ada3b879f5a6 | Python | joneslabND/ICB_Fall2017 | /Tutorials/Tutorial08/Exercise08_1_Pseudo.py | UTF-8 | 794 | 3.21875 | 3 | [] | no_license | #Exercise 8, Python question 1
#10/13/17, MMD
#Open files to read and write
vcffile = open("Cflorida.vcf","r")
outfile = open("CfloridaCounts.txt","w")
#assign regex to variable name, or compile to variable name
#loop over file
for :#look at old code to see how you looped over a file
#strip end of line
if : ... | true |
6223fc10e771616f0bf54cf9507b7b0783598156 | Python | tstl87/PythonInterviewQuestions | /sort/KthLargestElement/Solution.py | UTF-8 | 402 | 3.53125 | 4 | [] | no_license | import heapq
class Solution():
def findKthLargest1(self, nums, k):
nums = sorted(nums)
return nums[-k]
def findKthLargest2(self, nums, k):
return heapq.nlargest(k,nums)[-1]
print('[3,2,3,1,2,4,5,5,6] and k = 4')
print( Solution().findKthLargest2([3,2,3,1,2,4,5,5,6],4) )
print('')
print... | true |
3019b93210677b6b8c7887c94e9a3f4515ccc4db | Python | BingoZ/python_scripts | /word_similarity/similarity.py | UTF-8 | 1,936 | 3.421875 | 3 | [] | no_license | #!/usr/bin/env python
def longest_substring(one,two):
lone = len(one)
ltwo = len(two)
max_len = min(lone,ltwo)
longest = ''
for i in reversed(xrange(max_len)):
for j in reversed(xrange(i,lone+1-i)):
chunk = one[i:i+j]
if len(chunk) < len(longest):
continue
if chunk in two:
if... | true |
1651768e425c14ec40d012e824e49700ac154db1 | Python | GetTuh/KODI-plugin-Torrentz2-qbittorrent-remote | /resources/lib/site_parsing.py | UTF-8 | 1,168 | 2.828125 | 3 | [
"MIT"
] | permissive | import re
from bs4 import BeautifulSoup
import conn
import time
def link_to_magnet(site):
raw_html = conn.simple_get(site)
soup = BeautifulSoup(raw_html, 'html.parser')
all_links = soup.findAll("div", {"class": "downlinks"})
all_links = all_links[0].findAll("a")
adblock=0
for siteLink in all_lin... | true |
e7d72e98839a15d41a75c3e0250a5fb91054a40b | Python | maxyonghuawei/Unet_seg | /mask_binary.py | UTF-8 | 2,374 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 10 22:14:02 2019
Turn the grey level Images to binary Images and save in the files
@author: Kumawife
"""
from __future__ import print_function
#import numpy as np
from PIL import Image
import os
#mask = np.ones([256,256,3])
#
#mask = mask[:,:,0]
#pri... | true |
62c9967126c2cd809bce9b026d99b766ee20b2a7 | Python | seequest/Learning | /ExtraHop/find_longest_word.py | UTF-8 | 19,611 | 3.890625 | 4 | [] | no_license | #!/usr/bin/env python36
""" ExtraHop Programming Problem--
Written by David Noble <david@thenobles.us>.
This module was developed and tested under Python 3.6 on macOS Sierra. Please ask for Python 2.7 code or code that
will run under Python 2.7 or Python 3.6, if you would prefer it. I mention this because I see that... | true |
c1f7e0d258322ac5b1c97e61b3586cf5805714f6 | Python | LHB6540/Python_programming_from_entry_to_practice_code_demo | /part1_4th_list_control/practice4_8_4_9.py | UTF-8 | 389 | 4.5625 | 5 | [] | no_license | # 将同一个数字乘三次称为立方。例如,在Python中,2的立方用2**3表示。
# 请创建一个列表,其中包含前10个整数(即1~10)的立方,再使用一个for循环将这些立方数都打印出来
# 使用列表解析生成一个列表,其中包含前10个整数的立方
numbers = [value ** 3 for value in range(1, 11)]
for i in numbers:
print(i)
| true |
41461624fec1d2c51042ee1e81126ef6b18d2d9a | Python | robbymeals/topicmod | /lib/python_lib/topicmod/corpora/altlaw.py | UTF-8 | 4,537 | 2.5625 | 3 | [] | no_license | #!/usr/bin/python
__author__ = "Sean Gerrish (sgerrish@cs.princeton.edu)"
__copyright__ = "GNU Public License"
import datetime
import lexicon
import os
import re
import sys
import time
from nlp import tokenizer
from util.pdf_wrapper import PdfOpen, Clean
from xml.parsers import expat
YEAR_RE = re.compile("(1[89]\d\... | true |
e655ffa94b4ce98610d7935ea1ce92d841de8562 | Python | dyjwb001/autoimplant_vnet | /AutoImplant_downsampling/datasets/dataAugmentation.py | UTF-8 | 3,490 | 2.703125 | 3 | [] | no_license | import numpy as np
import scipy
from scipy.ndimage import interpolation
def translateit(image, offset, isseg=False):
order = 0 if isseg == True else 5
return scipy.ndimage.interpolation.shift(image, (int(offset[0]), int(offset[1]), 0), order=order, mode='nearest')
def scaleit(image, factor, isseg=False):
... | true |
abd7e138a8496b91491528913c414f27b50ade32 | Python | jaymekirchner/mybookmgr | /SqliteHelper.py | UTF-8 | 6,105 | 3.6875 | 4 | [] | no_license | import sqlite3
class SqliteHelper:
"""Creates connection to database and facilitates sqlite queries to create and modify the user's data.
METHODS:
__init__(self, name = None)
Accepts a database name to initialize the database connection and cursor, and call the open() method
... | true |
c890846fcf46863f4bd4bf521b42a613626677bd | Python | RemcoHalman/PythonTodoAction | /src/utils/writer.py | UTF-8 | 994 | 2.984375 | 3 | [] | no_license | import json
from .colors import BackgroundColors
class Writer():
def put(data, filename):
try:
jsondata = json.dumps(data,
indent=4,
skipkeys=False,
sort_keys=True)
fd = open(file... | true |
44200ee2ace0afcc53a3c27af8c2b8c31b178515 | Python | johannbrehmer/manifold-flow | /manifold_flow/transforms/standard.py | UTF-8 | 2,179 | 2.9375 | 3 | [
"MIT"
] | permissive | """Implementations of some standard transforms."""
import torch
from manifold_flow import transforms
class IdentityTransform(transforms.Transform):
"""Transform that leaves input unchanged."""
def forward(self, inputs, context=None, full_jacobian=False):
batch_size = inputs.shape[0]
if full_... | true |
517faa0b3de1c68c0db59628ef27339d57079b0a | Python | zhuli19901106/hackerrank | /Practice/Algorithms/Sorting/insertionsort1(AC).py | UTF-8 | 355 | 2.859375 | 3 | [] | no_license | import re
def main():
n = int(raw_input())
a = [int(val) for val in re.split(' ', raw_input())]
key = a[n - 1]
i = n - 1
while True:
if i == 0 or a[i - 1] <= key:
a[i] = key
print(' '.join([str(val) for val in a]))
break
else:
a[i] = a[i - 1]
i -= 1
print(' '.join([str(val) for val in a]))
... | true |
631cbba81289f8ea79e44776cc21f6318decc581 | Python | atashi/LLL | /algorithm/328.odd-even-linked-list.py | UTF-8 | 1,740 | 3.484375 | 3 | [] | no_license | #
# @lc app=leetcode id=328 lang=python
#
# [328] Odd Even Linked List
#
# https://leetcode.com/problems/odd-even-linked-list/description/
#
# algorithms
# Medium (48.41%)
# Total Accepted: 137.7K
# Total Submissions: 284.3K
# Testcase Example: '[1,2,3,4,5]'
#
# Given a singly linked list, group all odd nodes toget... | true |
5359bccdf0a7b9c943e7c48aa8aefa3a274afcbc | Python | kmollee/2014_fall_cp | /4/practice_scripts/flashcards.py | UTF-8 | 702 | 3.78125 | 4 | [] | no_license | # sys is a module. It lets us access command line arguments, which are
# stored in sys.argv.
import sys
if len(sys.argv) < 2:
print "Please supply a flash card file."
exit(1)
flashcard_filename = sys.argv[1]
with open(flashcard_filename, 'r') as f:
for line in f.readlines():
# line format is:
... | true |
fa1376606b86dfec2185c70f1a29b32a9abebdb3 | Python | RoshaniPatel10994/ITCS1140---Python- | /final exam/exam example.py | UTF-8 | 1,609 | 4.15625 | 4 | [] | no_license |
# For loop
def LoadLists():
sales = [0]*12
one_sale = float()
for index in range (0, len(sales)):
one_sale = float(input("Enter monthly sales: "))
sales[index]=one_sale
return sales
#Determine Total
def DetermineTotal(sales):
one_sale = float()
total = float()
... | true |
973cbd13835591797898446c503195069525be86 | Python | OlgaUlrich/prework | /PY-Training/13.py | UTF-8 | 344 | 3.6875 | 4 | [] | no_license | def prime_number(n):
if n<=0:
return "Input positive number, please"
elif n == 1:
return []
elif n == 2:
return [2]
else:
primeNum = [2, 3]
for i in range(3, n+1):
if i % 2 != 0 and i % 3 != 0:
primeNum.append(i)
return primeNum... | true |
80169d5cf53103156489d0220924149e2a14dd4d | Python | elllot/Algorithms | /Strings/longestCommonSubsequence.py | UTF-8 | 491 | 3.375 | 3 | [] | no_license | def lcs(word1, word2):
row = [0 for _ in range(len(word1) + 1)]
for r in range(1, len(word2)+1):
prev = 0
for c in range(1, len(row)):
val = prev + 1
if word2[r-1] != word1[c-1]:
val = max(row[c-1], row[c])
row[c], prev = val, row[c]
retur... | true |
b28023b698c2cdb87ebcf25329d503e1c3672958 | Python | nishant5254/Loop-Structure | /Alphabet2.py | UTF-8 | 237 | 3.796875 | 4 | [] | no_license | Number_rows=int(input("Enter the no of rows you want to print: "))
Number=65
for i in range(0,Number_rows):
for j in range(0,i+1):
ch=chr(Number)
print(ch,end=" ")
Number=Number+1
Number=65
print("\n")
| true |
afe2539f9603a6843c7292e59e4e13106e70890a | Python | buihoang95/dialogue-act-project | /src/convertToCRFData.py | UTF-8 | 1,057 | 2.625 | 3 | [] | no_license | import codecs
import os
import csv
import re
dialogueList = []
file = open('data/normallizedCRF/' + "CRFdata" + '.csv','wb')
def convertDataToNormalizeData(fileName):
overallData=[]
with open('data/normallized/' + fileName + '.csv', 'rb') as csvfile:
spamreader = csv.reader(csvfile, delimiter=',', quot... | true |
ac39f7558d25cda02c7e82646a853610b6e0d2fb | Python | npinto/craigslistParser | /gmail.py | UTF-8 | 2,336 | 2.703125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email import Encoders
import os
# modified from
# http://kutuma.blogspot.com/2007/08/sending-emails-via-gmail-with-python.html
class Gmail... | true |
6e842c09073784a1a2fb13e02ee2ce6e4c5d5e48 | Python | KushalkumarUmesh/Internal-Initiative | /GoalSheet/empDash_Goalsheet_OnlineExam/realapp/modules/bcsdata/bcscheckclaims.py | UTF-8 | 9,909 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | """
Overall Approach is as follows: Re-write the entire BCS-CHeck program. DO it in this order:
0) Creat main loop and view-file
a) Create Holiday Table - Done
b) Write methods for:
-IsHoliday?
-Hours booked by Emp on a day, on a project : Total billable hours
-Is the emp on leave today? Is the leave approv... | true |
ecb19ef29d81b9d52502d24eff26bf36e82243df | Python | Ray980625/python200818 | /turtle5.py | UTF-8 | 120 | 3.9375 | 4 | [] | no_license | import turtle
a = turtle.Turtle()
b = int(input('邊數:'))
for i in range(b):
a.forward(100)
a.left(360/b) | true |
c11bd21069ace24167a3d9e341c9e0c818166b6f | Python | Elliotcomputerguy/LearningPython | /ListMethods.py | UTF-8 | 4,862 | 4.46875 | 4 | [] | no_license | #!/usr/bin/env python
# Methods are just like functions, except they are attached to a non-module value with a period.
# A function is not a method just because it is in a module. It can some times get confusing.
# Appending list elements via the method append() is the easiest solution rather than concatenating.
# ==... | true |
6186d1b4608c02daf821f260c746d331d11be57e | Python | wattaihei/ProgrammingContest | /Codeforces/ECR84/probA.py | UTF-8 | 204 | 2.75 | 3 | [] | no_license | import sys
input = sys.stdin.readline
Q = int(input())
Query = [list(map(int, input().split())) for _ in range(Q)]
for n, k in Query:
ok = k**2 <= n and (n-k)%2 == 0
print("YES" if ok else "NO") | true |
18e4d911d7500fc1807d7f39796530bf88a2f257 | Python | AnimState/AnimX_2018 | /repivot.py | UTF-8 | 2,484 | 2.890625 | 3 | [] | no_license | """
Copyright (c) 2018 Mike Malinowski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute... | true |
7f27b0263fab50ba716c24013ce1ce5d95f4b73a | Python | openjason/refer | /listmysqldatabases.py | UTF-8 | 5,432 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
import json
import pymysql
class Mysql(object):
# mysql 端口号,注意:必须是int类型
def __init__(self, host, user, passwd, port, db_name):
self.host = host
self.user = user
self.passwd = passwd
self.port = port
self.db_name = db_name
def ... | true |
12446d8dbf64982ed30939ac150028c1ebc1ee8e | Python | soko48653a/MSE_Python | /ex010.py | UTF-8 | 188 | 3.484375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
#예제 10번 : 5/3의 결과를 화면에 출력하세요.
print(5/3) # print(A) -> A를 출력 ( 숫자 또는 연산으로 구성)
| true |
f2b59c0312f88057f785a4efb009f5f04c28abe4 | Python | Safankov/NureQ_bot | /controller.py | UTF-8 | 17,202 | 2.59375 | 3 | [] | no_license | import math
import json
import random
from router import command_handler, response_handler, callback_handler, \
default_callback_handler, default_command_handler, default_response_handler
NEW_QUEUE_COMMAND_RESPONSE_TEXT \
= "Введите имя новой очереди в ответ на это сообщение"
DEFAULT_QUEUES_PAGE_SIZE = 3
cl... | true |
5c800ea4b15493913e6d8830957b90bbdaf588fd | Python | avirtualcoder/learning_code | /homework/100_1.py | UTF-8 | 423 | 4.28125 | 4 | [] | no_license | #猜数字游戏
import random
guess=1
number=random.randint(0,100)
while True:
numberGuess = eval(input('输入一个0和100间的整数: '))
print(numberGuess,end=' ')
if numberGuess!=number:
print('第{}次猜测,猜错了,结果偏{}'.format(guess,'大' if numberGuess>number else "小"))
guess+=1
else:
print('弟%d次,猜测猜对了!!!'... | true |
b9d6c34c8be9db7d9e4ff49b07ebe245abca2319 | Python | huangpd/nongAnServer | /naxy_api/apps/base/utils.py | UTF-8 | 6,733 | 2.71875 | 3 | [] | no_license | # coding=utf-8
import calendar
import json
import urllib
import urllib2
import re
from datetime import datetime, date
from decimal import *
from django.db import connection
class utils:
"""
工具类
"""
def __init__(self):
pass
@staticmethod
def md5(str):
""... | true |
fe127caf9f0aefd238d8cc65676b28dc8f0eaa50 | Python | aws-samples/connected-drink-dispenser-workshop | /deploy/lambda_functions/cog_pre_signup/lambda.py | UTF-8 | 1,391 | 2.578125 | 3 | [
"MIT-0"
] | permissive | """
Cognito UserPool Pre-SignUp Trigger
Executed after sign up step and before completion of sign up
"""
import os
import json
import logging
import boto3
__copyright__ = (
"Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved."
)
__license__ = "MIT-0"
logger = logging.getLogger()
logger.setLe... | true |
694764d9a0c126ab3bf47299d4d3afb7dc7bc3ed | Python | IanC13/NBA-Win-Loss-Predictor | /genetic_algorithm.py | UTF-8 | 5,288 | 3.28125 | 3 | [] | no_license | import random
from determine_record import *
west = teams('west')
east = teams('east')
def individual(N,min,max):
x = []
for i in range(N):
x.append( random.randint(min,max) / 100 )
return x
'''randomly generates a number between min, max and appends them into a list. does it N times '''
... | true |
cfecafbc4debfa95055f61502c2165b2bc902798 | Python | z-x-z/rl | /src/rl_algorithms/A3C/test_a3c.py | UTF-8 | 1,138 | 2.640625 | 3 | [] | no_license | '''
Description :
Author : CagedBird
Date : 2021-08-13 15:19:51
FilePath : /rl/src/rl_algorithms/A3C/test_a3c.py
'''
import gym
from src.rl_algorithms.A3C.simple_a3c import SimpleA3C
import torch.multiprocessing as mp
import matplotlib.pyplot as plt
def test_a3c(a3c: SimpleA3C):
a3c.run()
... | true |
76c314c0b28c84d2bd6bcd796eff6fc67fb703bf | Python | abingham/project_euler | /python/src/euler/exercises/ex0028.py | UTF-8 | 821 | 4.125 | 4 | [] | no_license | """Starting with the number 1 and moving to the right in a clockwise direction
a 5 by 5 spiral is formed as follows:
21 22 23 24 25
20 7 8 9 10
19 6 1 2 11
18 5 4 3 12
17 16 15 14 13
It can be verified that the sum of the numbers on the diagonals is 101.
What is the sum of the numbers on the diagonals in a ... | true |
03a7ae07840ad4076055c33f3a07cc616fd07dee | Python | ivoryspren/basic_data_structures | /single_linked_list_recursive.py | UTF-8 | 1,760 | 3.6875 | 4 | [] | no_license | class Node(object):
def __init__(self, d, n = None):
self.data = d
self.next_node = n
def get_next (self):
return self.next_node
def set_next (self, n):
self.next_node = n
def get_data (self):
return self.data
def set_data (self, d):
self.data = d
clas... | true |
634a840fc0f135742444a7666d582195ab8aad6b | Python | sathiyapriya1997/github | /Base.py | UTF-8 | 513 | 2.609375 | 3 | [] | no_license | from selenium import webdriver
class Base:
def Launch_Browser(self):
self.driver = webdriver.Chrome(executable_path=r"C:\Users\Sathiyapriya\Documents\webdrivers\chromedriver.exe")
self.driver.maximize_window()
self.driver.implicitly_wait(10)
return self.driver
def load_url(self,... | true |
eea844323e5b2adde86e958fa76d422f155296b8 | Python | viaacode/event-handler-deletes | /tests/services/pika_mock.py | UTF-8 | 743 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
class Channel:
"""Mocks a pika Channel"""
def __init__(self):
self.queues = {}
def basic_publish(self, *args, **kwargs):
"""Puts a message on the in-memory list"""
self.queues[kwargs["routing_key"]].append(kwargs["body"])
def q... | true |
8e01af4e0e9f4e137c6738b35799c89bf65d3a49 | Python | snehalmore/Video_Frame_Interpolation | /utils.py | UTF-8 | 7,650 | 2.890625 | 3 | [] | no_license | import skvideo.io
import numpy as np
import tensorflow as tf
from PIL import Image, ImageOps
import matplotlib.pyplot as plt
import os
def generate_dataset_from_video(video_path):
"""
Convert the video frame into the desired format for training and testing
:param video_path: String, path of the video
... | true |
2009c3ca969d8f5a51993d823ec0d26751e2e0f4 | Python | hsson428/demo | /firstproject/aedlocation/aedlocation_repository.py | UTF-8 | 1,427 | 2.796875 | 3 | [] | no_license | class AedlocationRepository:
def __init__(self):
self.connection_info = { 'host': 'localhost', 'db': 'demodb', 'user': 'root', 'password': 'PASSWORD', 'charset': 'utf8' }
def select_aedlocation_by_name(self, name_key):
import pymysql
conn = pymysql.connect(**self.connection_info)
... | true |
00cd8eeebb67b566354a5251995a0f7eaeed59b6 | Python | neszwil/Scraping_with_Django | /ilosc/author_finder.py | UTF-8 | 670 | 2.75 | 3 | [] | no_license | from ilosc.adress_maker import adress_maker
import requests
from bs4 import BeautifulSoup
import requests
list_of_author = []
def author_finder(adress_urls):
"""
Function that finds authors for each article on the blog
:param adress_urls:
:return list_of_author:
"""
for adress in adress_url... | true |
6775ae05b1ce2ad9dd10dd88412cb8ed80efe95f | Python | aman9875/cs771 | /assignment1/convex.py | UTF-8 | 1,720 | 3.15625 | 3 | [] | no_license | import numpy as np
num_seen_classes = 40
num_unseen_classes = 10
num_features = 4096
num_test_examples = 6180
# function to calculate the unseen class whose mean is at minimum distance from the mean of a given test sample.
def calc_min_mean(mean_unseen,x_i):
distance = np.sum((mean_unseen - x_i)**2 , axis = 1)... | true |
3a5880b61a0c70a3a5caca880d5c53b41215b294 | Python | D3tenney/zip_it | /db/db_setup.py | UTF-8 | 1,179 | 2.5625 | 3 | [
"MIT"
] | permissive | import sqlite3
sql_con = sqlite3.connect('./zipcode_db.sqlite')
ZIP_FILENAME = './zip_data/uszips.csv'
TABLE_NAME = 'zipcode'
CREATE_TABLE = f"""
CREATE TABLE {TABLE_NAME} (
zip TEXT PRIMARY KEY,
lat TEXT,
lng TEXT,
city TEXT,
... | true |
5f147afd56bd872742934a7aef54113860e4b5ac | Python | Ezi4Zy/leetcode | /652.寻找重复的子树.py | UTF-8 | 889 | 3.046875 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=652 lang=python
#
# [652] 寻找重复的子树
#
# @lc code=start
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution(object):
def findDup... | true |
a571ca3a59192de780aafa906928acf74e288359 | Python | nbvc1003/AI | /ch06/softMax1.py | UTF-8 | 263 | 3.109375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def softmax(x):
e_x = np.exp(x-np.max(x))
return e_x / e_x.sum()
x = np.array([1.0,1.0,2.0])
y = softmax(x)
ration = y
labels = y
plt.pie(ration, labels= labels, shadow=True, startangle=90)
plt.show()
| true |
f55dc596a671b7e0de6e99d22584ed490c2d2b65 | Python | amrithrajvb/EmployeeDjango | /company/forms.py | UTF-8 | 3,155 | 2.640625 | 3 | [] | no_license | from django import forms
from django.forms import ModelForm
from company.models import Employee
import re
class EmployeeAddForm(ModelForm):
class Meta:
model=Employee
fields="__all__"
widgets={
"emp_name":forms.TextInput(attrs={"class":"form-control"}),
"department":f... | true |
a39c10762443348880b8d23e0e0104acaba25d03 | Python | beauthi/contests | /BattleDev/112020_0/test.py | UTF-8 | 1,275 | 3.265625 | 3 | [] | no_license | mem = dict()
def get_all_children_string(s):
"""
gets all 2-partitions of the string s
"""
children = set()
for bitmask in range(2**len(s)-1):
taken, left = [], []
b = 1
for i in range(len(s)):
if (b & bitmask) == 0:
left += [s[i]]
... | true |
913ebf555914b4b1fbc5c41f33a8b2588afc00d4 | Python | StevenAWillis/login_registration | /apps/login_regist_app/models.py | UTF-8 | 2,706 | 2.6875 | 3 | [] | no_license | from __future__ import unicode_literals
from django.db import models
class UserManager(models.Manager):
def registration_validator(self, postData):
errors = {}
email_match = User.objects.filter(email = postData['email'])
if len(postData['email']) == 0:
errors["... | true |
641a8520843624adbf0ec2d3eb5b005efaad6a6c | Python | DANIL00FIONOV/work1 | /test_sportsman.py | UTF-8 | 533 | 3.140625 | 3 | [] | no_license | import pytest
from Sportsman import Sportsman
@pytest.mark.parametrize('answer',[7,6,12,23])
def test_run(answer):
assert Sportsman.run(60) == answer
@pytest.mark.parametrize('answer',[5,3,10,6])
def test_jump(answer):
assert Sportsman.jump("from the spot") == answer
@pytest.mark.parametrize('answer',[8,9... | true |
941b00cf28387e0d15723f51c3e160dec5ba90c0 | Python | rtoal/uva-problems | /195.py | UTF-8 | 935 | 3.390625 | 3 | [] | no_license | import sys
# String to array of ints that can be arranged and sorted according to the
# weird rules of the problem. Interleaves upper and lower ASCII letters.
def encoded(s):
return [c*2 if c<92 else c*2-63 for c in bytes(s, 'utf-8')]
# Encoded array back to string
def decoded(a):
return ''.join(chr(b//2 if b... | true |
a34bc3c7603dff5706166e8d54d0458638730def | Python | byrgazov/foolscap | /src/foolscap/slicers/decimal_slicer.py | UTF-8 | 1,345 | 2.609375 | 3 | [
"MIT"
] | permissive | # -*- test-case-name: foolscap.test.test_banana -*-
import decimal
from twisted.internet.defer import Deferred
from foolscap.tokens import BananaError, STRING, SVOCAB
from foolscap.slicer import BaseSlicer, LeafUnslicer
from foolscap.constraint import Any
class DecimalSlicer(BaseSlicer):
opentype = (b'decimal',)... | true |
27df9a371bc3caa459aa40ab7169047357a92b04 | Python | MaxGabrielima/Python-Codes | /Desafios/desafio015.py | UTF-8 | 189 | 3.703125 | 4 | [
"MIT"
] | permissive | km = float(input('Quantos km foram rodados? '))
dias = float(input('Por quantos dias o carro esteve alugado? '))
print('O valor total a pagar é de {} R$'.format((dias * 60) + (km * 0.15))) | true |
0c0fc2beb016a549f428b98b6c3eec73910709bf | Python | bfishbaum/euler | /.prob60F2.py | UTF-8 | 1,012 | 3.203125 | 3 | [] | no_license | import prime as pi
import permutations as pr
import math
import time
def confirmList(x):
x = x[:]
if(x == []): return False
if(len(x) == 1): return pi.isPrime(x[0])
b = x[-1]
for a in x[:-1]:
p1 = (a * 10 ** (int(math.log(b,10))+1) + b)
p2 = (b * 10 ** (int(math.log(a,10))+1) + a)
if(not pi.isPrime(p1) or ... | true |
2a3e198467beaa7e28281814c188425e4714831f | Python | danilorribeiro/training | /python/guppe/loop_for.py | UTF-8 | 920 | 4.34375 | 4 | [] | no_license | """
iteráveis:
- String
nome = 'Geek University'
- Lista
lista = [1, 3, 5, 7, 9]
- Range
numeros = range [1,10]
"""
nome = 'Geek University'
lista = [1, 3, 5, 7, 9]
"""
range = range(1, 10)
for letra in nome:
print(letra)
for numero in lista:
print (numero)
for numero... | true |
2f01325ec7e327cab80d9596301a188f735fad78 | Python | Yang-YiFan/shiftresnet-cifar | /models/depthwiseresnet.py | UTF-8 | 3,113 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | """PyTorch implementation of DepthwiseResNet
ShiftResNet modifications written by Bichen Wu and Alvin Wan.
Reference:
[1] Bichen Wu, Alvin Wan, Xiangyu Yue, Peter Jin, Sicheng Zhao, Noah Golmant,
Amir Gholaminejad, Joseph Gonzalez, Kurt Keutzer
Shift: A Zero FLOP, Zero Parameter Alternative to Spatial Convolu... | true |
5fad779f7be3fafc4f72639932121c165098a314 | Python | davidgaribaldi/GuitarNeck | /Guitar Neck.py | UTF-8 | 692 | 3.015625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 6 13:07:28 2019
@author: DavidGaribaldi
"""
fretboard = {}
fretboard['E'] = ['E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E']
fretboard['A'] = ['A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A']
fretboard['D'] = ['D', 'D... | true |
1f2a9e73d6e4864bf087c1346fe6fcd1e0aa1791 | Python | ballaneypranav/rosalind | /archive/perm.py | UTF-8 | 625 | 3.578125 | 4 | [] | no_license | from copy import copy
# n = int(input())
n = 7
def factorial(n):
if n == 1:
return 1
return n * factorial(n-1)
print(factorial(n))
numbers = [x+1 for x in range(n)]
def generate_permutations(numbers):
if len(numbers) == 1:
return [numbers]
permutations = []
for number in n... | true |
4fa3823207d11fe6f53d306452ec4f7722724cd7 | Python | Zhenye-Na/leetcode | /interview/amazon/shopping-patterns.py | UTF-8 | 1,800 | 3.53125 | 4 | [
"MIT"
] | permissive | # Shopping Patterns
# https://aonecode.com/amazon-online-assessment-shopping-patterns
from collections import defaultdict
class ShoppingPatterns:
def __init__(self):
self.neighbors = defaultdict(list)
def getMinScore(self, products_nodes, products_edges, products_from, products_to):
... | true |
2b8fceddbcbeea7e7394c1740fc42740324e4a52 | Python | RahulanT/Python_Stock_Analysis | /maincode/scipy_test.py | UTF-8 | 685 | 3.375 | 3 | [] | no_license | from scipy.signal import argrelextrema
import matplotlib.pyplot as plt
import numpy as np
# Generate random data.
data_x = np.arange(start = 0, stop = 25, step = 1, dtype='int')
data_y = np.random.random(25)*6
# Find peaks(max).
peak_indexes = argrelextrema(data_y, np.greater)
peak_indexes = peak_indexes[0... | true |
1a16644af849fe54031479496d6101b79bfd87e3 | Python | log2timeline/dftimewolf | /dftimewolf/lib/exporters/gce_disk_export_base.py | UTF-8 | 5,877 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""Base class to Export Compute disk images to Google Cloud Storage."""
from typing import List, Optional
from googleapiclient.errors import HttpError
from libcloudforensics.providers.gcp.internal import project as gcp_project
from libcloudforensics.providers.gcp.internal.compute import GoogleCo... | true |
6b44138caab94ca20c827a7d9add8dd88a6d5456 | Python | umbonoce/SignatureVerificationNN | /main_hmm.py | UTF-8 | 23,341 | 2.578125 | 3 | [] | no_license | import os
import numpy as np
import math
import csv
import pandas as pd
import matplotlib.pyplot as plt
import sklearn
from hmmlearn import hmm
import warnings
import random
from scipy.interpolate import interp1d
from scipy.optimize import brentq
from sklearn.metrics import roc_curve
from sklearn.neighbors import KNeig... | true |
5f672686e75121ff9b1e3062a464d495e63e34da | Python | Gundas3073/PDF-Downloaders | /FIS.py | UTF-8 | 1,307 | 2.703125 | 3 | [] | no_license | import urllib2
def main():
global count
count = 0
global n
for n in range(0000,6000):
global test
test = n
getName("http://www.freeinfosociety.com/media.php?id=" + str(n),"</h1>","</a>/", 30)
download_file("http://www.freeinfosociety.com/media/pdf/" + str(n) + ".pdf")
print str(count)
def d... | true |
ef1d6939dd10926cccc9dd4dbfa4a999108d8599 | Python | jonrh/lambda-lovelace | /sandbox/Python Xinqi/18jul2016/RecommenderTextual.py | UTF-8 | 5,089 | 2.78125 | 3 | [
"ISC"
] | permissive | # -*- coding: utf-8 -*-
from sklearn.feature_extraction.text import CountVectorizer
from collections import Counter
import tweepy
import time
import string
class RecommenderTextual:
#TO-DO:
#-set language to users own twitter language
#-currently misses end hashtags
#-Does not search for hashtags... | true |