blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
9c3beaa8164053ed4975b03ebac4a4fac2448181 | garciadiego/Project | /character-segmentation.py | UTF-8 | 1,651 | 2.546875 | 3 | [] | no_license | import sys
import numpy as np
import cv2
import pickle
from matplotlib import pyplot as plt
#image File
im = cv2.imread('/home/diegogarcia/Desktop/QlearningHD/segmen/data/equ.jpg')
im3 = im.copy()
#image file is scan for symbols and saved on an array
gray = cv2.cvtColor(im,cv2.COLOR_BGR2GRAY)
blur = cv2.GaussianBlur(... | true |
7da41adc67aa1ce195ddeac6226689eec045f82a | ericssy/MP3 | /word_cnt_juice.py | UTF-8 | 279 | 2.890625 | 3 | [] | no_license | import sys
file_name = sys.argv[1]
f = open(file_name, 'r')
lines = f.readlines()
for line in lines:
line = line.strip()
l = eval(line)
key = l[0]
value = l[1]
value_list = [int(i) for i in value]
list_sum = sum(value_list)
print(key, list_sum)
| true |
cd741bc78f7bd4c63d36c9c25c09ac90a7eb1d95 | ach4l/songrecommender | /pok.py | UTF-8 | 2,170 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 13 09:53:06 2017
@author: Fitec
"""
import urllib
import bs4
import collections
import pandas as pd
req = urllib.request.Request('http://pokemondb.net/pokedex/national', headers = {'User-Agent' : 'Mozilla/5.0'})
html = urllib.request.urlopen(req).read()
page = bs4.Beau... | true |
6100f34a95ca38372ec386c17b6e8dc2743729db | josiahls/Machine-Learning-Robot-Chef | /src/computer_vision/util.py | UTF-8 | 3,860 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python
import os
from pathlib import Path
from typing import List
import warnings
import numpy as np
import skimage
def get_absolute_data_path(data_workspace: str = 'data', parent_up_limit=2, sub_folder_name: str = None):
"""
Gets the absolute path for the 'data' directory.
***Note that th... | true |
ad8d1fcd02de58f6934b44397fd866427637bb0d | bgbutler/PythonScripts | /Exercises/webScrape1.py | UTF-8 | 587 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
from urllib.request import urlopen
from urllib.error import HTTPError
from bs4 import BeautifulSoup as bs
def getTitle(url):
try:
html = urlopen(url)
except HTTPError as e:
return None
... | true |
5181e33791466e68ef4be677192a393c9f9cded3 | mohantyk/raspberry | /01_blink.py | UTF-8 | 807 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 14 08:55:04 2018
@author: kaniska
"""
import RPi.GPIO as GPIO
import time
ledPin = 11
def setup():
GPIO.setmode(GPIO.BOARD)
GPIO.setup(ledPin, GPIO.OUT)
GPIO.output(ledPin, GPIO.LOW)
print('Usig pin {0} to toggle led'.format(ledPi... | true |
8da619a93e9c9f85e7c877da199a8dc9a9620fc9 | nkorobkov/competitive-programming | /codeforces/1148/B.py | UTF-8 | 581 | 2.765625 | 3 | [] | no_license | n, m, ta, tb, k = list(map(int, input().split()))
a = list(map(lambda x: int(x) + ta, input().split()))
b = list(map(int, input().split()))
a.sort()
b.sort()
i = 0
bless = []
for bb in b:
while i < len(a) and bb >= a[i]:
i += 1
bless.append(i)
#print(bless)
ans = -1
for j in range(len(b)):
# ... | true |
4c4f9dec8e466256901cc7acd94886a00971fae7 | NateBeatty/De-Anza-Physics | /lab3_soln.py | UTF-8 | 1,656 | 3.71875 | 4 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
# Load data file here
data = np.loadtxt("LED_data.txt")
# define x and y data by separating columns of data
# here, n = length of column x
x = data[:,0]
y = data[:,1]
n = len(x)
#define sum function
def sum_func(array):
asum = 0
for i in arra... | true |
7bd858b01ad18fe554972e7928f71e5cfee269ed | dwax1324/baekjoon | /code/1952 달팽이2.py | UTF-8 | 811 | 2.921875 | 3 | [] | no_license | import sys
# 구현
# 달팽이
sys.setrecursionlimit(10**8)
a, b = map(int, input().split())
ff = [[0, 1], [1, 0], [0, -1], [-1, 0]]
arr = [[0 for i in range(120)] for i in range(120)]
direct = 0
def turn():
global direct
direct += 1
direct %= 4
return direct
def dfs(y, x):
global direct
global cn... | true |
961428bcdc5cb9c328748c1952c6e30bcc512b91 | YangZhouCSS/reviews_sentiment | /reviews_sentiment.py | UTF-8 | 3,472 | 2.875 | 3 | [] | no_license | import nltk
from nltk.corpus import stopwords
from nltk import word_tokenize
from nltk import WordNetLemmatizer
import string
import random
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.naive_bayes import MultinomialNB
from sklearn.m... | true |
cda3df8eca4c0e9c0a121946f2aed7fc8df0e267 | giove91/hanabi | /game/ai/extremehanabi/train.py | UTF-8 | 8,928 | 2.546875 | 3 | [] | no_license | import sys, os, copy, random, math
from collections import namedtuple, Counter
import argparse
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../')))
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd im... | true |
236a58a9061fdd2e329e70f38f3f09138ce63e33 | wyl-lib/personalPyhton | /python语言学习/百度访问100次时间.py | UTF-8 | 626 | 3.1875 | 3 | [] | no_license | import time
import requests
def getHtml(url):
try:
r = requests.get(url)
r.raise_for_status()
r.encoding = r.apparent.encoding
return url.text
except:
return("The requests get url found unkonw-mistakes.")
def main():
url = "https://baidu.com"
... | true |
0cf485e4d8a80bce95d7c8077a96558efe69a836 | je-lv/vt_scripts | /1st_submissions_timeline/plot_submissions_timeline.py | UTF-8 | 2,177 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import requests as req
from datetime import datetime
OK = '\033[92m' #verde
ERR = '\033[91m' #rojo
INFO = '\033[94m' #azul
ENDC = '\033[0m' #end color
BOLD = '\033[1m... | true |
8e3ba74203e4581903c4475735c29849a927582a | shamathakur77/PlaygroundPy | /GissaNummer.py | UTF-8 | 13,574 | 2.796875 | 3 | [] | no_license | {
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"IPython -- An enhanced Interactive Python\n",
"=========================================\n",
"\n",
"IPython offers a fully compatible... | true |
371eb4bf1a5339e7612b1fd2c68572245c6da949 | wwu2020/gym-dql-tutorial | /appendix.py | UTF-8 | 3,885 | 3.234375 | 3 | [
"MIT"
] | permissive | """
Deep-RL in gym using Keras - appendix
Additional methods to tinker with. Currently includes a training loop that evaluates
model performance (in terms of reward) during training. The training loop also has a
"""
def averagePerformanceProgress(model, games = 10, timesteps=timesteps, scenario = 'CartPole-v0',
... | true |
ac75d70bf5c7f239553f302e516fa631263792d2 | Katarzyna-Bak/Coding-exercises | /Get Nth Even Number.py | UTF-8 | 378 | 4.28125 | 4 | [] | no_license | """
Return the Nth Even Number
Example(Input --> Output)
1 --> 0 (the first even number is 0)
3 --> 4 (the 3rd even number is 4 (0, 2, 4))
100 --> 198
1298734 --> 2597466
The input will not be 0.
"""
def nth_even(n):
return (n-1)*2
print("Tests:")
print(nth_even(1))
print(nth_even(2))
print(nt... | true |
fc379d9585083a91c4e5377cbbd4278a62dc6af0 | volkovz/incrementt | /login.py | UTF-8 | 4,109 | 2.9375 | 3 | [] | no_license | from keycode import UP, DOWN, LEFT, RIGHT, ENTER, SPACE
from threading import Thread
from blessed import Terminal
import tkinter
import accumulator
import math
import random
import time
import sys
class Theme:
frame_bg_1 = '#000000'
color1 = '#FFFFFF' # White
color2 = '#000000' # Black
color3 = '#FFDE00' # Yell... | true |
b5d96bb2fc33334cdaf8cc67b5b668812d5c88c6 | artium59/tf.keras_CNN | /MobileNet_v2.py | UTF-8 | 2,998 | 2.859375 | 3 | [] | no_license | """
https://arxiv.org/abs/1801.04381
"""
from tensorflow.python.keras import Input, Model, layers
def convolution_block(inputs, filters, kernel_size, stride):
"""
# INPUT
input: Tensor
# OUTPUT
Tensor
"""
x = layers.Conv2D(filters=filters, kernel_size=kernel_size,
... | true |
817e83c4cbb0e9a0a6eecd1720f85a3bcdd51dc5 | mathncode/py_algo | /programmers_level2/prog-level2-6.py | UTF-8 | 1,101 | 3.328125 | 3 | [] | no_license | # https://programmers.co.kr/learn/courses/30/lessons/68645
# 삼각 달팽이
def solution(n):
arr = [[0]*n for _ in range(n)]
dx = [1, 0, -1] # d, D
dy = [0, 1, -1] # r, D
t = ['d', 'r', 'D'] # 수를 채우는 방향은 아래, 오른, 대각의 반복
# n번 아래, n-1번 오른, n-2번 대각, n-3번 아래... 맞춰서 리스트에 t, r, D 해당 회수 만큼 담기
c = 0
m = []... | true |
503285bc1c2959e4af43f2b2af358b48ebb82570 | RyuChaeHyun/Web_Crawling | /week4/week4_5.py | UTF-8 | 901 | 3.234375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import openpyxl
wb = openpyxl.Workbook()
sheet = wb.active
sheet.append(["제목","채널명", "재생수", "좋아요수"])
raw = requests.get("https://tv.naver.com/r/")
html = BeautifulSoup(raw.text, 'html.parser')
#print(html)
# 1-3위 컨테이너: div.inner
# 제목 : dt.title
# 채널명 : dd.chn
# 재생수 : sp... | true |
97a0c1f095019a7965cf5f15f8f4a0ecb7bf48e6 | Riksi/Deep_Learning_Projects | /Oxford-NLP/classifiers.py | UTF-8 | 5,199 | 2.765625 | 3 | [] | no_license | import math
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
class TextClassifier():
def __init__(self,
embed_dim,
hid_dims,
num_classes,
nonlin=tf.tanh,
optimizer=tf.train.AdamOptimizer(5e-4)):
s... | true |
a3f9f12f8d6d46745996f1bcbdb752e19396705e | UltracoldAtomsLab/labhardware | /drivers/agilentmultimeter.py | UTF-8 | 1,494 | 2.65625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import visa
from re import match
class AgilentMultimeter:
def __init__(self, gpib):
''' Initialize device '''
self.device = visa.instrument("GPIB::%d" %(gpib))
if (not self.__TestConnection()):
print "No multimeter on this GPIB channel..."
return None
... | true |
6b32d68bd7a85380f0bbcc0fa07f43d029b372bb | caron14/2D-FEM | /mod_make_B.py | UTF-8 | 1,859 | 3.125 | 3 | [] | no_license | ###========================================================###
### ###
### Create "Strain-Displacement Matrix(B)" ###
### ###
###========================================================###
##-- ... | true |
4f8855221cc5f0355515a674a978ff696be17e90 | vxda7/end-to-end | /pre_learning/circle_round.py | UTF-8 | 231 | 3.453125 | 3 | [] | no_license | import math
PI = math.pi
get = input().split(', ')
result = []
for i in get:
result.append(int(i))
first = True
for i in result:
if not first:
print(",",end=" ")
first = False
print(f"{i*2*PI:0.2f}",end="") | true |
60bfbd9ed094145985794c1bb3372f9a1f593165 | aniketchanana/python-exercise-files | /programmes/zip.py | UTF-8 | 556 | 3.078125 | 3 | [] | no_license | midterms = [80,91,78]
finals = [98,89,53]
students = ['a','b','c']
final_grades = {pair[0]:max(pair[1],pair[2]) for pair in zip(students,midterms,finals)}
# or
grades=dict(
zip(
students,
map(
lambda pair:max(pair),
zip(midterms,finals)
)
)
)
def interleav... | true |
1ba23c5333161df14fec62704100cd311675acd8 | bennybermuda/reinforcement | /cart.py | UTF-8 | 1,870 | 2.96875 | 3 | [] | no_license | import gym
import numpy as np
from gym import wrappers
env = gym.make('CartPole-v1')
bestLength = 0
episode_lengths = []
best_weights = np.zeros(4)
def run_episodes(count, weights, observation, done):
while not done:
#env.render()
#commented out because when training, it'll take astronomical tim... | true |
55953ad2a62d527c70e261e57206f07da8977967 | BarracudaPff/code-golf-data-python | /python/python_spacy_nlp_server/spacynlpserver/server_spacy.py | UTF-8 | 1,229 | 2.640625 | 3 | [
"MIT"
] | permissive | """Coreference resolution server example.
A simple server serving the coreference system.
This file is copied and modified from an example
program from https://github.com/huggingface/neuralcoref
"""
unicode_ = str
class AllResource(object):
def __init__(self):
self.nlp = spacy.load("en")
print("Server loaded")
s... | true |
e438f24a6eac98bcdf579b669d5a7ec71c0147a1 | dawinye/ML_py | /chapter1.py | UTF-8 | 4,165 | 3.453125 | 3 | [] | no_license | import numpy as np
from scipy import sparse
# Create a vector as a row
vector_row = np.array([1, 2, 3])
# Create a vector as a column
vector_column = np.array([[1],
[2],
[3]])
# Create a matrix
matrix = np.array([[1, 2],
[1, 2],
[1, 2]])
# Create a matrix
matrix = np.array([[0, 0],
[0, 1],
[3, 0]])
# Create com... | true |
fa3ba3414a68d1dfab3699e69692976a895ae618 | Luckymaster/HARD-SPOJ | /FIBONOMIAL.py | UTF-8 | 677 | 2.921875 | 3 | [] | no_license | import sys
def fib(n, m):
if n == 0:
return (0, 1)
else:
a, b = fib(n // 2, m)
if b>= m:
b %= m
c = a * (2*b - a)
if c >= m or c < 0:
c %= m
d = (b * b + a * a)
if d >= m:
d %= m
if n & 1:
return (d, ... | true |
3cd71e0087fd3ccccda5f2ef5f3a0b2056666e25 | 7131HDMC/alphabet-rangoli | /los.py | UTF-8 | 1,328 | 3.015625 | 3 | [] | no_license | def print_rangoli(size):
string= ''
column = ((size-1) * 4)+1
line = 1 + (size-1) * 2
#
alphabet = 'abcdefghijklmnopqrstuvwxyz'
alphabet = alphabet[:size]
los(size, alphabet)
def los(n, alphabet):
m = n-1
v = 1
los = ''
#
for row in range(-m, m+1):
#
... | true |
79d7c04bd770893c9701e127c7a196ce904ab4a9 | HideakiImamura/DirichletProcess_UsingCRP | /collapsed_gibbs.py | UTF-8 | 3,563 | 2.515625 | 3 | [] | no_license | import numpy as np
import mydist as dist
import scipy.special as sp
import time
def sample(i, K, xs, zs, mu0, rho0, a0, b0, alpha):
n = len(xs)
d = len(xs[0])
print("n_kis calculation start")
start = time.time()
n_kis = [np.sum([int(zs[j] == k)+1 for j in range(n) if j != i]) for k in range(K)]
... | true |
abf1181ebf53729abb3f6e3f49b9145b6c7224e3 | jinaur/codeup | /1919.py | UTF-8 | 98 | 3.03125 | 3 | [] | no_license | n = input()
n = n[::-1]
def my_func(n) :
n = int(n)
print(n)
return
r = my_func(n)
| true |
538122168eb587a6a32825c21021de30bdbf38ca | AmyShackles/algo-practice | /LeetCode/Easy/Python3/tests/test_increasingdecreasingstring.py | UTF-8 | 1,139 | 3.296875 | 3 | [] | no_license | import unittest
from Python3.increasingdecreasingstring import Solution
class TestsortString(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_1(self):
# For sanity checking:
# Input: s = "aaaabbbbcccc"
# Output: "abccbaabccba"
... | true |
164693dabfa31c4b14690ff691c685aabe69f8ce | hotbaby/dueros-bot-sdk | /dueros/tests/directive/display/template/BodyTemplate1Test.py | UTF-8 | 1,049 | 2.578125 | 3 | [
"MIT"
] | permissive | # encoding: utf8
import unittest
from dueros.directive.Display.template.BodyTemplate1 import BodyTemplate1
class BodyTemplate1Test(unittest.TestCase):
'''
bodyTemplate测试
'''
def setUp(self):
self.template = BodyTemplate1()
self.template.set_plain_text_content('test')
self.tem... | true |
6d0c50c667f6bd5bc29501125ccba4b490866f90 | kkyyhh96/get_library_seat | /person.py | UTF-8 | 3,165 | 2.90625 | 3 | [] | no_license | # coding:utf-8
# version:python3.5.1
# 作者 康雨豪
# code_version:3.0
import re
import requests
from PIL import Image
import varification_decode
class person(object):
def __init__(self, username, password, seat, date, start_time, end_time):
self.username = username # 用户名
self.password = password # ... | true |
4a9b796a61cbdad1e0790ac0e348c30a65b451bc | ulzii-coder/CIS205 | /fileinput.py | UTF-8 | 861 | 3.3125 | 3 | [
"Unlicense"
] | permissive | from sys import argv
def countNum(filename):
#notFoundFile exception
try:
#open the file
file = open(filename)
#parts = line.split(",")
#counter for total number of eights
firstWord = file.readline()
#get file and return them as string
for line in file:
l... | true |
58c6f70333f6ed256e583c6392c3fa4295884a97 | FritzZuhl/pppFiler | /get_completed_dirs.py | UTF-8 | 265 | 2.53125 | 3 | [] | no_license |
path = 'logs/directories_uploaded_Date_2019-05-22_Time_H11-M48.log'
def words_in_text(path):
with open(path) as handle:
for line in handle:
words = line.split()
if words[0] == 'Completed':
yield words[-1:]
| true |
aba778a847fc1a280aed5e93dc5ddce03c79ba43 | konicaRu/studying_tkinter | /Round_robin_REZERV1.py | UTF-8 | 25,389 | 2.84375 | 3 | [] | no_license | from tkinter import *
import random
import time
# КОЛИЧЕСТВА ЗАДАЧ ДОЛЖНО ХВАТАТЬ НА ВСЕХ ПРОИЗВОДИТЕЛЕЙ
root = Tk()
root.title('Round robin') # надпись на верху
root.geometry('850x500+300+200') # ширина=500, высота=400, x=300, y=200 размер окна
root.resizable(True, False) # размер окна может быть изменён только ... | true |
7f3622a72e662d3ae52fcaf13b30232c1ece8078 | little-alexandra/nlp_study_group | /1_zn/zn_问答系统&文本纠错_0404/~~~~~~古诗文本相似度.py | UTF-8 | 10,588 | 3.40625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # Python相似度计算
# https://blog.csdn.net/Yellow_python/article/details/81069692
# In[1]:
from warnings import filterwarnings
filterwarnings('ignore') # 不打印警告
import numpy as np
from pandas import DataFrame
# # 语料
poem1 = '''《将进酒》——李白
君不见黄河之水天上来,奔流到海不复回。君不... | true |
50dd5fbeb1cbe207c40fed694cc35b8234f6558e | sohansonu/Type-em-All | /main.py | UTF-8 | 9,719 | 2.84375 | 3 | [] | no_license | import pygame
import time
import threading
import random
from playsound import playsound
pygame.init()
win=pygame.display.set_mode((1200,700))
pygame.display.set_caption("Type em All")
def Text(st,x,y,bg=(0,0,0),size=64,color=(255,255,255)):
font = pygame.font.Font('SEASRN__.ttf', size)
... | true |
4f2fe13cf49d22410ac24d314e001d5d0b8c4a6f | betessier/E6 | /python/python feuille 2/exo 4 feuille 2 - Copie.py | UTF-8 | 475 | 4.0625 | 4 | [] | no_license | a = input ("saisit un nombre")
b = input ("saisit un deuxieme nombre")
c = input ("saisit un dernier nombre")
if a == b :
print (a,"est un doublon de ",b )
if a ==c :
print (a,"est un doublon de ",c )
if b == c :
print (b,"est un doublon de ",c )
if a > b and a > c:
print ( a,"est la p... | true |
1d0791555de0489e59e97aa7e5f70d39742c1742 | mohanksriram/face-detector-app | /services/camera_source.py | UTF-8 | 869 | 2.84375 | 3 | [
"MIT"
] | permissive | import cv2
from enum import Enum
"""
Setup a camera source with address to easily access frames
"""
class ECameraMode(Enum):
SINGLE_FRAME = 0
CONTINUOUS = 1
class CameraSource(object):
def __init__(self, address):
self.address = address
self.is_running = False
self.mode = ECamer... | true |
cbfa9c599991e83135e02a3de1e3de0dcbfadece | snipsco-forks/snips-skill-hue | /snipshue/snipshue.py | UTF-8 | 5,508 | 2.984375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # -*-: coding utf-8 -*-
""" Philips Hue skill for Snips. """
import requests
import json
import time
from hue_setup import HueSetup
from color_utils import colors
class SnipsHue:
""" Philips Hue skill for Snips. """
colormap = colors
def __init__(self, hostname=None, username=None, locale=None):
... | true |
b0d7b446cc56845f0a69442233ae64251e87326c | jpgallagher1/Risk-Premiums | /Momentum/Momentum.py | UTF-8 | 12,063 | 3.265625 | 3 | [] | no_license | """
John Gallagher
X433.3-007
Alex Iliev
Final Project
Sections:
1. Proposal
2. Background
3. Code Outline
4. Code
---
1. Class Final Project Proposal:
This project will extend some of my existing knowledge in quantitative finance
into a new programming language.
Create a simple trading algorithm, that takes i... | true |
852057792d08e839aab527297e8c658150b3c2fa | novayo/LeetCode | /0698_Partition_to_K_Equal_Sum_Subsets/try_2.py | UTF-8 | 954 | 3 | 3 | [] | no_license | class Solution:
def canPartitionKSubsets(self, nums: List[int], k: int) -> bool:
_sum = sum(nums)
if _sum % k != 0:
return False
target = _sum // k
nums.sort()
if nums[-1] > target:
return False
while len(nums) > 0 and nums[-1] == targ... | true |
ad31341dd7d3f7ba196845e3d463dd99fda7c184 | MitchellGulledge/middle_mile_metrics | /meraki_icmp_prober.py | UTF-8 | 15,993 | 2.53125 | 3 | [] | no_license | import requests
import json
import meraki
from numpy import mean
import numpy
import matplotlib.pyplot as plt
import arrow
from operator import add
# Author Mitchell Gulledge
# creating class to create all Meraki config
class MerakiConfig:
# Defining your API key as a variable in source code is not recommended
... | true |
fb3eee41e041f2e67caa5d634b5cece464ca4bc2 | brianspiering/coding-challenges | /test_fizzbuzz.py | UTF-8 | 1,140 | 3.765625 | 4 | [] | no_license | from fizzbuzz import fizz_buzz
import unittest
class TestFizzBuzz(unittest.TestCase):
test_cases_fizz = [(3,'Fizz'), (6, 'Fizz')]
test_cases_buzz = [(5,'Buzz'), (10, 'Buzz')]
test_cases_fizzbuzz = [(15,'FizzBuzz'), (30, 'FizzBuzz')]
test_cases_strings = test_cases_fizz + test_cases_buzz + test_ca... | true |
a257ac0363301af719bc7230fb8901a3018666fa | as174/Netology-Advanced-Python | /Diploma/final.py | UTF-8 | 5,362 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import vk_requests
import datetime
import time
import pymongo
ACCESS_TOKEN = ''
api = vk_requests.create_api(service_token = ACCESS_TOKEN,
api_version='5.101')
def find_user_id():
user = input ('Введите id или имя пользователя')
try:
user_id = i... | true |
336fc2b5fe7b1c8828f0251479c996934884ffd4 | cthurber/WhatTrack | /universe/Departure.py | UTF-8 | 1,550 | 3.234375 | 3 | [] | no_license | from uuid import uuid4
from bs4 import BeautifulSoup as Soup
class Departure(object):
# TODO Define each attribute in docstring
"""
Definition of a departure listing on the departure board
All getter methods require a Soup object to operate
Here, we'll scrape the information from the s... | true |
20a24f49b43805b5ba86501be8cfc287f88a956e | Northshoot/dOPE | /dope/parsers/parseWeatherData.py | UTF-8 | 2,435 | 2.828125 | 3 | [] | no_license | # Parse NOAA weather data file. The Different column numbers are referenced
# below:
# Field# Name Units
# ---------------------------------------------
# 1 WBANNO XXXXX
# 2 UTC_DATE YYYYMMDD
# 3 UTC_TIME H... | true |
790caebd9059d6f537b9a9dae2e72cc90ddc6e2a | Emanuele-M/Progetto-Intelligenza-Artificiale | /main.py | UTF-8 | 1,127 | 2.515625 | 3 | [] | no_license |
from graphScore import *
import pandas as pd
data = pd.read_csv(r'C:\Users\kamae\Documents\simulationsachs2.dat', sep=",")
data = data[['Plcg', 'PIP3', 'PIP2', 'PKC', 'PKA', 'Raf', 'Jnk', 'P38', 'Mek', 'Erk', 'Akt']]
goalNodes = []
for i in data.columns:
data2 = data.dropna()
vals = data2[i].unique()
... | true |
74f6ab3a2ccfd455040a4d0eabbe2564ce71e480 | dranzzer/gw2-waypoint | /removetitlebar.py | UTF-8 | 712 | 3.046875 | 3 | [] | no_license | from tkinter import *
root= Tk()
root.title("hi")
root.geometry("500x300")
#remove title bar
root.overrideredirect(True)
#create fake title bar
title_bar = Frame(root,bg="green",relief="raised",bd=1)
title_bar.pack(expand=1,fill=X)
title_label = Label(title_bar,text="Test App",bg="green",fg="black")
title_label.pac... | true |
e43323f2fc639986efa64b15a5dedebdadb217c6 | ParkJuwon/python-study | /data_science_from_scratch/study/chap4_2.py | UTF-8 | 428 | 3.703125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
def make_matrix(num_rows, num_cols, entry_fn):
"""(i,j) 번째 원소가 entry_fn(i,j)인
num_rows x num_cols list 반환"""
return [[entry_fn(i, j)
for j in range(num_cols)]
for i in range(num_rows)]
def is_diagonal(i, j):
"""대각선의 원소는1, 나머지 원소는 0"""
return 1 if i == j else 0
iden... | true |
fefae8aa16fb6231c9b4e530665a4b65289819e6 | michael24peters/pv-finder_experimental | /tests/test_jagg.py | UTF-8 | 513 | 2.75 | 3 | [] | no_license | from model.jagged import concatenate
import awkward
import numpy as np
def test_concat():
ja1 = awkward.JaggedArray.fromiter([[1, 2, 3], [4, 5]])
ja2 = awkward.JaggedArray.fromiter([[7, 8], [9, 10, 11], [12]])
ja12 = concatenate([ja1, ja2])
ja_known = awkward.JaggedArray.fromiter(
[[1, 2, 3],... | true |
900357f0683008cbbace9140985b16d7aa93cfe9 | ZhuJiahui/MicroblogDataStreamCompress | /KLDistance.py | UTF-8 | 741 | 3.453125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''
Created on 2014年1月14日
@author: ZhuJiahui506
'''
import numpy as np
def KL_distance(a, b):
'''
Compute the Kullback-Leibler Divergence of two vectors.
:param a: vector1
:param b: vector2
'''
if len(a) == len(b):
for i in range(len(a)):
if a[i] < ... | true |
d63035a44e64bc89718bb4a5dbef10c80cedcfc5 | leventarican/docker | /python-server/server.py | UTF-8 | 904 | 2.734375 | 3 | [] | no_license | from http.server import BaseHTTPRequestHandler, HTTPServer
import os, datetime
class TheServer(BaseHTTPRequestHandler):
def do_GET(self):
load = os.getloadavg();
html = """<!DOCTYPE html>
<html>
<head>
<title>a python server</title>
<meta charset="utf-8" />
</head>
<body>
<code>a python... | true |
798d474958591d33756382d767d63856787935fb | Kwoo4357/problem-solving | /boj/divide_conquer/15712.py | UTF-8 | 312 | 3.09375 | 3 | [] | no_license | #등비수열
def geometric(r, n, m):
T = 1
an = r % m
total = 0
while n:
total = (an * total + T) % m if n & 1 else total
T = ((an + 1) * T) % m
an = an ** 2 % m
n //= 2
return total
a, r, n, mod = map(int, input().split())
print(a*geometric(r, n, mod)%mod) | true |
62db8c8b9881f96f1d2439baf87e8cc667a5dde5 | zhanghanyuan/ProjectEuler | /45.py | UTF-8 | 291 | 3.25 | 3 | [] | no_license | def isDigit(a,b,c):
w = int((b ** 2 - 4 * a * c) ** 0.5)
if w * w == (b ** 2 - 4 * a * c):
if (-b+w) % (2*a) == 0:
return True
return False
i = 286
while True:
t = i * (i+1) / 2
if isDigit(3,-1,-2*t) == True and isDigit(2,-1,-t) == True:
print t
break
i += 1
| true |
a080bc35dde8188cc6321f5dbd08e5d4a9860890 | eugenezakh/balhard_4_tasks | /tests/set_tasks/test_intersection_update.py | UTF-8 | 238 | 2.546875 | 3 | [] | no_license | from tasks.set_tasks.intersection_update import intersection_update
def test_intersection_update(new_set):
result = intersection_update(new_set, {2, 5, 7, 8, 9, 17})
assert result is new_set
assert result == {2, 5, 7, 8, 9}
| true |
b33cd2658fb30e1868c6980a2cc5c47dff002892 | Club-de-Software-EPN/tournaments | /faang/Parentheses.py | UTF-8 | 1,422 | 3.875 | 4 | [] | no_license | from typing import List
# lessons:
# - Learn the data structures already integrated in
# the programming language. In python a list can be
# stack, queue and linked list simple (no circular)
def solve(string):
if string == "":
return True
# stack = FILO = First input, Last output
stack = []
... | true |
2e76df454f2b777a11a2da4726b2e3b431952b94 | yuzumei/leetcode | /406.py | UTF-8 | 625 | 3.0625 | 3 | [] | no_license | people = [[6,0],[5,0],[4,0],[3,2],[2,2],[1,4]]
sortpeople=sorted(people,key=lambda x:x[0],reverse=True)
import collections
indeg=collections.defaultdict(list)
memo=collections.defaultdict(int)
stack=[]
for item in sortpeople:
memo[item[0]]=0
if item[1]==0:
stack.append(item)
else:
indeg[item... | true |
8919a324d1d7fa168fbf8c95e4116723dec79628 | dorajam/hierarchical-recommenders | /src/split_datasets.py | UTF-8 | 1,468 | 2.53125 | 3 | [] | no_license | import os
import shutil
import argparse
from utils import *
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("k", help="Number of split datasets, default=1", default=1, type=int)
parser.add_argument("-c", "--clean", help="Clean directory", default=True, type=bool)
a... | true |
0d8bff391e3638407bc35a0f1f9c07e3622b0b77 | z991/python_mianshi_self | /14装饰器/3.被装饰的函数带参数.py | UTF-8 | 749 | 3.078125 | 3 | [] | no_license | import time
def my_logging(func):
def wrapper(*args, **kwargs):
print('logging - {} is running'.format(func.__name__))
func(*args, **kwargs)
return wrapper
def timeer(func):
def wrapper(*args, **kwargs):
time_start = time.time()
res = func(*args, **kwargs)
time.slee... | true |
d6de709d71e9bf5a12d94be4d36ae32c9112b9ed | pertekli/Calculator-in-python | /CALCULATOR.py | UTF-8 | 741 | 4.21875 | 4 | [] | no_license |
user = input("enter your number: ")
op = input("select any operator\n1.for addition\n2.for subtraction\n"
"3.for multiply\n4.for divide\n5.for exponantial\n6.for floor division\n7.for modulus: ")
user2 = input("now enter your second number: ")
if op == "1":
print("your answer is",int(user)+int(user2))
elif op == "... | true |
5342b468ba8ed73ff8c28d16805a260d1f9b829b | Blaxzter/UM_ARS_G8 | /05_Kalman_Filter/src/kalman/KalmanFilter.py | UTF-8 | 1,579 | 2.78125 | 3 | [] | no_license | import numpy as np
import simulator.Constants as Const
from simulator.MathUtils import covariance_matrix
class KalmanFilter:
def __init__(self, d_t, theta):
self.A = np.identity(3)
self.B = np.array([d_t * np.cos(theta), 0,
d_t * -np.sin(theta), 0,
... | true |
4f801271fc862ec0951a2640f4f529a4ea8f0c72 | TareqMonwer/python_algoritms | /sorting/bubble/HackerRank/30-soring.py | UTF-8 | 579 | 3.90625 | 4 | [] | no_license | n = int(input().strip())
a = list(map(int, input().strip().split(' ')))
def asc_bubble(a):
data = {"swap": 0, "first": None, "last": None}
n = len(a)
for i in range(0, n):
for j in range(0, n-i-1):
if a[j] > a[j + 1]:
data["swap"] += 1
a[j], a[j + 1] =... | true |
1142082c23c8422d98e8d3dff3517f6321826c5d | Abusagit/practise | /Stepik/algorithms_toolbox/quicksort_practise.py | UTF-8 | 1,017 | 2.84375 | 3 | [] | no_license | import random
import bisect
from sortings import quickSort as q
def q_s(a, right=False):
if len(a) < 2:
return a
else:
pivot = random.randint(0, len(a) - 1)
eq = [i for i in a if i[0 + right] == a[pivot][0 + right]]
less = [i for i in a if i[0 + right] < a[pivot][0 +... | true |
cfe6281a6d928d8ab8a8601d68f83855efd656c8 | Archanciel/explore | /tkinter_explore/tk_message_widget.py | UTF-8 | 454 | 3 | 3 | [] | no_license | from tkinter import *
import time
root = Tk()
root.geometry("500x200")
w = Label(root, text ='GeeksForGeeks', font = "50")
w.grid(row=1, column=1)
msg = Message( root, aspect=400)
msg.grid(row=2, column=0, columnspan=2, padx=2)
msgText = 'coucou'
msg.configure(text=msgText)
root.update()
... | true |
06617b46ff362d79a5af1034ae92ad58ac86bf5f | USNA-MANET/ROS-Files | /demoServer.py~ | UTF-8 | 1,175 | 3.03125 | 3 | [] | no_license | #!/usr/bin/python
import socket
#make sockets for Michelangelo, Leonardo, & Donatello
sD = socket.socket()
sL = socket.socket()
sM = socket.socket()
#Allow reuse
sD.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,1)
sL.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,1)
sM.setsockopt(socket.SOL_SOCKET, socket.SO_... | true |
9cb005f0eb338c05317101204fe77a6994ffdc75 | JurajKubrican/fei_biom | /iris/iris_5.py | UTF-8 | 4,160 | 2.578125 | 3 | [] | no_license | from __future__ import print_function
import os.path
from matplotlib import pyplot as plt
import numpy as np
import os
import cv2
glob_mean = 0.0300300629155
glob_var = 0.000251910542739
def load_images(path):
file_dir = os.listdir(path)
images = []
for image in (file_dir):
# print(image.split('... | true |
91f76dd9ee9636c9fe80c1e9e8a19361a2e6483b | zhaochaoyue1/Beyond | /student/python-student/pachong/__getMethod__.py | UTF-8 | 251 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/local/bin/python3
# 第二个get方法实例
import requests #先导入爬虫的库,不然调用不了爬虫的函数
response = requests.get("http://httpbin.org/get") #get方法
print( response.status_code ) #状态码
print( response.text ) | true |
cab6b173eaf4f96060c7633a276d440b271a7ae7 | jp-security/advent-of-code | /2019/day_2/day_2_part_2.py | UTF-8 | 1,697 | 3.515625 | 4 | [] | no_license | # Take in a list of integers. The op code is a chunk of 4 integers
# The value can be either 1, 2 or 99. 99 means halt operation
# Op Code 1 adds together from position 1 and 2 to position 3
# Op code 2 is the same as 1 except with multiplication
def opCodeReader(op_codes, starting_location):
first_number = op_c... | true |
5d7c414127a4d9678c96baa140f88485681d8ff1 | DEADSEC-SECURITY/CODEX | /utils/colors.py | UTF-8 | 495 | 2.59375 | 3 | [
"MIT"
] | permissive | #-----------Welcome to DeAdSeC Python Codex----------#
#-------Made By DeAdSeC-------#
#---Version 1.0.0---#
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
W = '\033[0m' # white (normal)
R = '\033[31m' # red
G = '\033[32m' # green
O = '\033[33m' # orange
B = '\033[34m' # blue
P = '\033[35m' # purple
C = '\033[36m' # c... | true |
f23aab913b77cae96e354e4285358191358a7b95 | kalyan-dev/Python_Projects_01 | /demo/oop/doctor.py | UTF-8 | 1,940 | 3.09375 | 3 | [] | no_license | from abc import ABC,abstractmethod
class Doctor:
def __init__(self, name, specialization, phone_no):
self.name = name
self.specialization = specialization
self.phone_no = phone_no
def print(self):
return self.name + "[" + self.specialization + ", Ph-" + str(self.ph... | true |
f6036b46e1b8a549ba64a5d94434282d927c703d | MrHamdulay/csc3-capstone | /examples/data/Assignment_3/zwnsip007/question2.py | UTF-8 | 154 | 3.328125 | 3 | [] | no_license | height=eval(input("Enter the height of the triangle:"'\n'))
for i in range(1,2*height+1,2):
q=("{:^"+str(2*height-1)+"}")
print(q.format("*"*i))
| true |
9db36a61f68bfa124630b8aeac6e16d715991377 | lengfc09/Financial_Models | /NLP/Codes/code-nltk-collections-bag-of-words.py | UTF-8 | 1,440 | 4 | 4 | [] | no_license | # This file shows simple examples how to calculate bag-of-words.
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
from nltk.stem import WordNetLemmatizer
from collections import Counter
text = '''The cat is in the box.
The cat likes the box.
The box is over the cat.'''
# Sim... | true |
3e428977ef2db454ed85b48ad6a8679d8a2b0986 | katpawan/MachineLearning | /DemoIris.py | UTF-8 | 1,232 | 3.34375 | 3 | [] | no_license | import numpy as np
from sklearn.datasets import load_iris
from sklearn import tree
iris = load_iris()
# metadata imported
print(iris.feature_names) # this gives names of features
print(iris.target_names) # this gives names of flowers
# *****
# print(iris.data[0]) # iris.data is the data set
# print(iris.target[0]) ... | true |
c2231749f9fdbe047c1a34f533bd8441b1008915 | ahnjongin/BOJ | /1427.py | UTF-8 | 125 | 3.328125 | 3 | [] | no_license | a=int(input())
list=[]
for i in str(a):
list.append(int(i))
list.sort(reverse=True)
for i in list:
print(i,end='')
| true |
a5a34cd36bf534ddd34c1500c539e6cccafa52c3 | s81320/LearningFromImages | /bainbridge_2k/code/myModels/myModels.py | UTF-8 | 8,235 | 3.015625 | 3 | [] | no_license | import torch.nn as nn
import torch.nn.functional as F
class MyNeuralNetwork1(nn.Module):
'''original model taken from homework, for fashion MNIST.
Number of classes reduced from 10 to 2,
number of channels increased from 1 (b/w) to 3 (colour images).'''
def __init__(self):
super(MyNeuralNetwor... | true |
9f964fcc2afc4db99dd4f198ed57e37ef7ce9090 | RaihanSabique/CNMA | /verificationalgorithm.py | UTF-8 | 3,259 | 3.046875 | 3 | [] | no_license | from fuzzywuzzy import fuzz
import fuzzy
import numpy as np
context_char=[['J', 'Z'], ['W', 'O', 'U'], ['E', 'I'] ]
def name_matching(name1, name2):
soundex_list=[]
name1_l = name1.split()
name2_l = name2.split()
fuzz_matrix=get_fuzzy_matrix(name1_l,name2_l)
print(fuzz_matrix)
print(fuzz_matri... | true |
f5e26ff351bb4c67bcd1ded99df951b197355810 | nilesh-hegde/Leetcode | /Rotate List.py | UTF-8 | 2,448 | 3.859375 | 4 | [] | no_license | '''
Given a linked list, rotate the list to the right by k places, where k is non-negative.
Example 1:
Input: 1->2->3->4->5->NULL, k = 2
Output: 4->5->1->2->3->NULL
Explanation:
rotate 1 steps to the right: 5->1->2->3->4->NULL
rotate 2 steps to the right: 4->5->1->2->3->NULL
Example 2:
Input: 0->1->2->NULL, k = 4
Ou... | true |
6750fe13e7776c3724c0b127a404105115a0d2a1 | OKoop/NURHandinKoop2 | /Problem7/Handin27.py | UTF-8 | 756 | 2.921875 | 3 | [] | no_license | import matplotlib
matplotlib.use('Agg')
import h5py
import functions27 as f7
import numpy as np
#Read in the file
filename = 'colliding.hdf5'
f = h5py.File(filename, 'r')
#Get the coorinates from the file
coords = np.asarray(f['PartType4']['Coordinates'])[:,0:2]
#As found in the file:
mass = 0.0125
#Initialize the q... | true |
b5fcf0a8e4b333be6bb8debe09b4f7da8b975639 | jianhuachentw/pyPhotoBooth_mouse | /py_imgproc.py | UTF-8 | 4,153 | 3.234375 | 3 | [
"MIT"
] | permissive | from wand.image import Image
from wand.display import display
def img_h_flip(source_path, output_path):
with Image(filename=source_path) as img:
print(img.size)
img.flop()
#display(img)
img.save(filename=output_path)
def img_v_flip(source_path, output_path):
with Image(filename=source_p... | true |
82b64da8237f993874376db4c40bbfff42baeb43 | hannahthehowell/CalculusModule | /deriv.py | UTF-8 | 7,811 | 2.953125 | 3 | [] | no_license | from var import var
from const import const
from pwr import pwr
from prod import prod
from plus import plus
from quot import quot
from ln import ln
from absv import absv
import math
def deriv(expr):
if isinstance(expr, const):
return const_deriv(expr)
elif isinstance(expr, pwr):
return pwr_der... | true |
df214ddf5412dfc0510f6906cf2afcc23b8ea221 | assassint2017/Classic-machine-learning-algorithm | /python_code/sklearn_code/GBDT/GBDT_R.py | UTF-8 | 615 | 3.203125 | 3 | [] | no_license | """
使用梯度提升树来完成回归
"""
import sklearn.model_selection as ms
from sklearn import datasets
from sklearn import ensemble
# 获取数据集
boston = datasets.load_boston()
data = boston.data
label = boston.target
train_data, test_data, train_label, test_label = ms.train_test_split(data, label, test_size=0.3, random_state=3)
# 构建模... | true |
585031d67471cb9e07e822249bf20321cf6339e7 | missingdays/nerdy.school | /challenges/hackerrank/algorithms/basic/sherlock_beast/python/sherlock_beast.py | UTF-8 | 461 | 2.9375 | 3 | [] | no_license | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 missingdays <missingdays@missingdays>
#
# Distributed under terms of the MIT license.
"""
Sherlock and the beast solution
"""
for i in range(int(input())):
N = int(input())
S = ""
while N % 3 != 0 and N > 0:
S =... | true |
b87f231cac193f7fc3e88576b64724237346bb37 | daniel-reich/ubiquitous-fiesta | /GC7JWFhDdhyTsptZ8_3.py | UTF-8 | 633 | 3.25 | 3 | [] | no_license |
def sexy_primes(n, limit):
primes = []
for i in range(1, limit):
no_prime = False
for p in primes:
if p != 1 and i % p == 0:
no_prime = True
break
if no_prime:
continue
else:
primes.append(i)
matches = []
additions = 6 * (n -1) + 1
for i in range(0... | true |
04e2fb8a4e9c457c5c382e934858128aa4925c10 | cdslug/ClassmateMemory | /Scripts/IndexList.py | UTF-8 | 3,281 | 2.859375 | 3 | [] | no_license | import os
import sys
import shutil
import UtilFunc
def indexList(inputFilePath, inputCompleteFilePath, errorFilePath, yearbookReferenceFilePath, outputFilePath):
names = []
#list of dictionaries
yearbookNames = UtilFunc.parseDataFromFile(yearbookReferenceFilePath)
#list of dicitonaries
namesOutput = []
wi... | true |
179ebc42159e81537d35b1de0e427e656de70034 | sharadbhat/Competitive-Coding | /LeetCode/Longest_Continuous_Increasing_Subsequence.py | UTF-8 | 450 | 3.171875 | 3 | [] | no_license | # Leetcode
# https://leetcode.com/problems/longest-continuous-increasing-subsequence/
class Solution:
def findLengthOfLCIS(self, nums: List[int]) -> int:
left = 0
right = 0
max_len = 1
while right < len(nums) - 1:
right += 1
if nums[right] > nums[right - 1]... | true |
05ad30a60d13170ce016ca4ce302c180a2854fdf | sam-caldwell/packer-automation | /scripts/manifest/lib/download_file.py | UTF-8 | 801 | 3.125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""
# scripts/manifest/lib/download_file.py
# (c) 2020 Sam Caldwell. See LICENSE.txt.
#
# download a binary file over http/https from a given url
#
"""
from urllib.request import urlopen
from shutil import copyfileobj
from os.path import exists
from .error import fatal
def download_file(downlo... | true |
e43ce053d8a4fe64e426ac98fd6bd53bfe1c8641 | Saseungwon/machine-learning-deep-learning | /day9/ex-word2vec-2.py | UTF-8 | 290 | 2.8125 | 3 | [] | no_license | from gensim.models.word2vec import Word2Vec
model = Word2Vec.load('first_embedding_model')
# 단어를 벡터로 변환
print(model.wv['princess'])
# 두 단어의 유사성 비교
print(model.wv.similarity('princess', 'queen'))
# 유사한 단어
print(model.wv.most_similar('princess'))
| true |
83895f81275b1104ae977df2532715cffe48cbfe | Sunuba/PythonChainOfResponsibility | /pattern_classes/Distributers.py | UTF-8 | 1,232 | 3.53125 | 4 | [
"MIT"
] | permissive | from ChainOfResponsibilityPattern.pattern_classes import AbstractClasses
class Give1(AbstractClasses.CashHandler):
def give(self, money):
if money.get1() > 0:
print("Give " + str(money.get1()) + " 1 in cash. ")
self.next(money)
class Give5(AbstractClasses.CashHandler):
def give... | true |
98ed1b8baa934e7fce43475ff633f758f5cbc4e7 | vikramdara/alma | /updatedDemo/app/routes.py | UTF-8 | 11,410 | 2.625 | 3 | [
"MIT"
] | permissive | """ Specifies routing for the application"""
from flask import render_template, request, jsonify, url_for, flash, redirect, Flask
from app import app, bcrypt, db
from app import database as db_helper
from app import forms as forms
@app.route("/delete/<int:task_id>", methods=['POST'])
def delete(task_id):
""" rec... | true |
3d1caf2ed824d261762223eab0cc6841f49dda55 | allasko/Steganography | /Stega.py | UTF-8 | 2,760 | 3.125 | 3 | [] | no_license | from PIL import Image
import numpy as np
def steganography(filePath, photoPath):
# EOF stamp
eof = '11111111111111111111111111111111'
# Importing txt file
file = open(filePath, "r")
txt = file.read()
file.close()
txt = txt + eof
# Getting an image
image = Image.open(phot... | true |
237e3f52e2a717e030ec65f5fa03f7945dc604e0 | AnniePawl/Tweet-Gen | /class_files/Code/histogram_list.py | UTF-8 | 1,139 | 4.0625 | 4 | [] | no_license |
def get_words(sample_text):
""" reads file, strips leading and trailer characters, returns list of stings"""
words = []
with open("sample_text.txt") as f: # closes file when done
sample_text = f.read().strip().split(" ")
return sample_text # this is a list of words
# Above function can a... | true |
f0f94307ff6bb7b15f26982d8b2f8c2b67c3a75b | MaDITIY/log_calls | /utils/__init__.py | UTF-8 | 1,875 | 2.609375 | 3 | [] | no_license | import json
import pickle
import os
import yaml
import uuid
from datetime import datetime
from functools import wraps
def log_calls(format='JSON'):
if format in ('JSON', 'YAML'):
file_ext = format.lower()
else:
raise ValueError
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
... | true |
3b16d853569cb3e4f5968806959161bfda9fbc26 | EJChavez/challenges | /Exercises/Translator.py | UTF-8 | 378 | 2.921875 | 3 | [] | no_license | from translate import Translator
translator = Translator(to_lang='ja')
translation = translator.translate('This is a pen')
print(translation)
try:
with open(r'C:\Users\Ethan\Desktop\translate.txt', mode='r+') as my_file:
text = my_file.read()
print(translator.translate(text))
except FileNo... | true |
da701d1cd8b8ce22de2ae9c93fd6167659b560af | KMouris/R_factor | /RenameFiles.py | UTF-8 | 1,181 | 3.25 | 3 | [] | no_license | import glob
import os
import shutil
from os import listdir
from os.path import isfile, join
#----FUNCTIONS----#
#--Function 1--#
###Function receives the base name of the file and removes the prefix and reorganizes it to the format "YYYYMMDD_HH"
def ChangeName(name):
save_name=name[10:18] + "_" + name[19:]
re... | true |
1531060d89a40254e7e2b09e3da84c2e53b37e7f | sangeethagopi/python3 | /q1.py | UTF-8 | 88 | 3.28125 | 3 | [] | no_license | gc=input()
counts=0
for ac in gc:
if ac.isspace()==True:
counts+=1
print(counts)
| true |
0753dcf1859d083c6e2f63cb0993c5ad2635373f | SEOKWOOPARK/pythonCrawling | /src/syntaxFile/moduleChapter/theaterModule.py | UTF-8 | 309 | 3.78125 | 4 | [] | no_license | def price(people):
print("{0}명 가격은 {1}원 이다.".format(people, people * 10000))
# 일반 가격
def price_morning(people):
print("{0}명 가격은 {1}원 이다.".format(people, people * 6000))
def price_soldier(people):
print("{0}명 가격은 {1}원 이다.".format(people, people * 4000))
| true |