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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
505ef3599b51ce6c35c58e9c8a7c129673fa387e | Python | AndreeaNenciuCrasi/Programming-Basics-Exercises | /Fourth SI week/add_function| twins.py | UTF-8 | 1,037 | 4.28125 | 4 | [] | no_license | # Create a function add(n)/Add(n) which returns a function that always adds n to any number
# Note for Java: the return type and methods have not been provided to make it a bit more challenging.
# add_one = add(1)
# add_one(3) # 4
# add_three = add(3)
# add_three(3) # 6
def add(n):
return lambda x: x + n
# ... | true |
d99edda36b1379dbc8200005b1c7d565b14dfff4 | Python | ShreyKumar/Course-Management-system | /old/studet_test.py | UTF-8 | 10,198 | 3.578125 | 4 | [] | no_license | # Assignment 1 - Unit Tests for Student
#
# CSC148 Fall 2014, University of Toronto
# Instructor: David Liu
# ---------------------------------------------
# STUDENT INFORMATION
#
# List your group members below, one per line, in format
# Shreyansh Kumar, kumarsh6
# Yun-Yee Megan Yow, yowmegan
# -----------------------... | true |
d511916dcd83f564f67cc367d69439d439b391b1 | Python | wuyuehao/covid19bot | /serving.py | UTF-8 | 1,693 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | import hickle as hkl
from flask import Flask, jsonify, request
import pandas as pd
import traceback
from scipy import spatial
from sentence_transformers import SentenceTransformer
def cosine_smilarity(v1, v2):
cosine_similarity = 1 - spatial.distance.cosine(v1, v2)
return cosine_similarity
def create_app(con... | true |
1be0908bd1e0997848d46a6a69755838bd27303a | Python | CanDIG/omop_service | /data_tables/management/commands/import_concept.py | UTF-8 | 528 | 2.5625 | 3 | [] | no_license | from django.core.management.base import BaseCommand
from ._utils import import_concept
class Command(BaseCommand):
""" run: python manage.py import_concept CONCEPT.csv """
help = "Imports concepts from csv obtained from the Athena server."
def add_arguments(self, parser):
parser.add_argument("fil... | true |
a85f3ef0bb0afa49df61fb4a3db2d69d345b0192 | Python | cweatherly19/Robo_stuff | /Dev_rec.py | UTF-8 | 2,873 | 3.25 | 3 | [] | no_license | Reckoning_list = [] #defining a list to use later
Inverse_list = []
apple = microsoft = quit = False #set all variables to not read until called
print "Input your list using the [W, A, S, D, Q, E, Z, X] keys, then hit '1':"
try: #if running on apple
import sys, tty, termios #imports for no return command
fd = ... | true |
850d7e610d3a22f6e2cc14867a83da2231b94f51 | Python | gsudarshan1990/Training_Projects | /Selenium_With_Unittest/selenium_unittest_example10_8_6_2020.py | UTF-8 | 1,317 | 3.34375 | 3 | [] | no_license | """
This is an example of multiple tests in the unittest using the selenium
"""
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import unittest
class MultipleUnitTest(unittest.TestCase):
"""
This tests the multiple tests using the unittest case
"""
def setUp(self):... | true |
ea39ac00b7bde4b19e8c27bd7b0ce19cf32f42f2 | Python | saschagottfried/OpenShift-ToDoPyramid | /wsgi/todopyramid/todopyramid/layouts.py | UTF-8 | 2,796 | 2.78125 | 3 | [
"MIT"
] | permissive | from pyramid.renderers import get_renderer
from pyramid.decorator import reify
#ToDoPyramid currently highlights navbar item 'todos' for multiple routes
#Original version implemented navbar highlighting by setting a section variable
menu_items = [
{'route': 'home', 'title': 'Home', 'routes': ... | true |
b0a525190c78263a2e89daea4149ae0b4549866c | Python | python-like-r/python-like-r | /src/utility/FormulaParser.py | UTF-8 | 2,355 | 3.09375 | 3 | [
"Apache-2.0"
] | permissive | from src.utility.validate_descriptor import ValidFormula, ValidPredictors
def formula(attr):
def decorator(cls):
setattr(cls, attr, ValidFormula())
return cls
return decorator
def predictors(attr):
def decorator(cls):
setattr(cls, attr, ValidPredictors())
return cls
r... | true |
e1908752b3fea028bff1e062eacd9c9c8cbd1dc2 | Python | Aasthaengg/IBMdataset | /Python_codes/p03260/s208980433.py | UTF-8 | 400 | 3.546875 | 4 | [] | no_license | A, B = map(int,input().split())
count=0 #初期化
for C in range(1,4):
if A*B*C %2 ==1:
count=count+1#Cに順番に1、2、3と代入していく中で、A×B×C が奇数になるたんびにcountに1加算していく
if count>0: #A×B×Cが奇数になるようなCが少なくとも1つ存在していたらYesと表示したい
print("Yes")
else:
print("No") | true |
7736b4506c8c135c03980e3c0a34a31a5a2c7ec6 | Python | Nolwac/challenge_solutions | /proth_prime.py | UTF-8 | 1,488 | 4.625 | 5 | [] | no_license | import math
def is_prime(proth):
"""
This function takes a proth number and uses Proth theorem to determine if the proth number is a prime
Proth theorem states that: given a proth number, p if a^((p-1)/2) = -1 mod p,
then p is a prime number, specially known as proth prime.
It is important to note that proth... | true |
819a48b78e5608df165d62acf77edf69494a9eed | Python | stevenshan/Veracity | /Chrome Client Extension/newspaper/source.py | UTF-8 | 15,466 | 2.671875 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Source objects abstract online news source websites & domains.
www.cnn.com would be its own source.
"""
__title__ = 'newspaper'
__author__ = 'Lucas Ou-Yang'
__license__ = 'MIT'
__copyright__ = 'Copyright 2014, Lucas Ou-Yang'
import logging
from urllib.parse import urljoin, urlsplit, urlunsp... | true |
643310be8abaeddd439fa1cb8242d26e895b525f | Python | antimatterhorn/smartSampler | /point.py | UTF-8 | 1,598 | 2.78125 | 3 | [] | no_license | from vectorMath import *
import numpy as np
import kernel
class point:
def __init__(self,id,position,state):
self.id = id
self.position = position
self.state = state
self.elements = len(state)
self.neighbors = []
self.weight = 0.0
self.radius = 0.0
se... | true |
2392a47acc3bb936b8f7abb90b5cbe6f71da89c2 | Python | gunnerbai/decompose_demo | /demo5.py | UTF-8 | 33,256 | 2.765625 | 3 | [] | no_license | import random
import math
import os
import numpy as np
import cv2
import matplotlib
import matplotlib.pyplot as plt
from skimage.morphology import skeletonize
from skimage import img_as_ubyte
#key: row and column of the neighbouring pixels, value: the amount to be added to the central pixel -> h,wpl.,
delta = {(0,0)... | true |
181c685c208afff49e24dc4cab556e2807ff80a3 | Python | adhaka/profanity | /extractPhrases.py | UTF-8 | 1,474 | 2.796875 | 3 | [] | no_license |
filename = 'newah'
f = open(filename)
raw = f.read()
f.close()
import re, nltk, random, string, time
import numpy as np
highlights = ['hindu', 'muslim', 'jain', 'christian', 'muslims']
tokens = nltk.wordpunct_tokenize(raw)
words = [w.lower() for w in tokens]
keySentences = []
sentences = nltk.sent_tokenize(raw)
for... | true |
2e062f4c756edcf034210c22feec8a81bf68eeb3 | Python | xukangjune/HuaweiCodeCraft2019 | /findPath.py | UTF-8 | 2,890 | 2.984375 | 3 | [] | no_license | from HeapDict import heapdict
def Initialization(CROSS_DICT):
"""distTo用来存储与各个节点的距离,初始值为正无穷大。path用来到达各个节点的路径"""
crossWeight = heapdict()
path = {}
total_vertices = 0
for key in CROSS_DICT.keys():
crossWeight[key] = float("inf")
path[key] = []
total_vertices += 1
return c... | true |
cf454c5a43b00907474b6635392c0a7f50072ca1 | Python | e-caste/peracotta | /InputFileNotFoundError.py | UTF-8 | 280 | 2.921875 | 3 | [
"MIT"
] | permissive | class InputFileNotFoundError(FileNotFoundError):
def __init__(self, path):
from os.path import basename
self.path = path
super().__init__(f"Cannot open file {basename(path)}\nMake sure to execute 'sudo ./generate_files.sh' first!")
def get_path(self):
return self.path
| true |
f3b62b547a065631714a4fad533222aacba16ea0 | Python | ieee820/ML-epitopes-prediction | /testNeuraNetworks.py | UTF-8 | 4,643 | 2.65625 | 3 | [] | no_license | from keras import Sequential
import numpy as np
import unittest
from keras.layers import Conv1D, MaxPooling1D, Reshape
from keras.activations import sigmoid, linear, relu
from keras.optimizers import sgd, rmsprop, adadelta, adagrad, adam, adamax, nadam, SGD
from keras.losses import mean_squared_error
from neural_net im... | true |
c17bbb91a592e6c970e64605f306cfc1204b5e4a | Python | Swetha1803/Image-Cryptography-using-Rubic-Cube-Principle | /Encrypt.py | UTF-8 | 2,467 | 2.671875 | 3 | [] | no_license | from PIL import Image
from random import randint
import numpy
import sys
from helper import *
im = Image.open(r"C:\Users\MashaAllah\Desktop\Image-cryptography\input\pic1.png");
pix = im.load()
#Obtaining the RGB matrices
r = []
g = []
b = []
for i in range(im.size[0]):
r.append([])
g.append([])
b.append([... | true |
87901a24e4783626c4ad324f84b9e3706ecd2f48 | Python | anajikadam17/NLP_Spam_Prediction | /bin/preprocessor.py | UTF-8 | 658 | 3.078125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Sep 20 20:57:13 2020
@author: Anaji
"""
import pandas as pd
class PreprocessData:
"""
Module for preprocessing data
"""
def preprocess(self,df):
"""
Preprocess dataframe
Input:
df = dataframe
Output:
df... | true |
4f99707e8349b0db2a4d37ea58f22c01661ef0dd | Python | flxsosa/CodingProblems | /problem_3.py | UTF-8 | 1,410 | 4.21875 | 4 | [] | no_license | '''
Given the root to a binary tree, implement serialize(root), which serializes the tree into a string,
and deserialize(s), which deserializes the string back into the tree.
For example, given the following Node class
class Node:
def __init__(self, val, left=None, right=None):
self.val = val
self... | true |
cd5c9ca47d5ddc97f0c6f47e80ecbba12776270a | Python | cegepmatane/projet-bd-2018-scientifique-transmission-differee | /src/Bouee/ConnexionBluetoothRaspberry.py | UTF-8 | 655 | 2.578125 | 3 | [] | no_license | from bluetooth import *
import donneeDAO
while True:
HOST = ''
PORT = 3
socket=BluetoothSocket( RFCOMM )
socket.bind((HOST, PORT))
socket.listen(1)
connexion, addresse = socket.accept()
data = ""
data = donneeDAO.recupererValeurDifferee()
print ('Connecte a : ', addr... | true |
42e16a890efc421d149aacfb8e15432a179a66fa | Python | YangtaoGe518/2020-programming-tutorial-session | /algorithms/18-11-2020/question_3.py | UTF-8 | 823 | 3.90625 | 4 | [] | no_license | def maxArea(height):
l, r = 0, len(height) - 1
ans = 0
while l < r:
area = min(height[l], height[r]) * (r - l)
ans = max(ans, area)
if height[l] <= height[r]:
l += 1
else:
r -= 1
return ans
height = [1,8,6,2,5,4,8,3,7]
print(maxArea(height))
#... | true |
d355162936aa8d5ac029cc73128100b5b50a2679 | Python | Hiestaa/ShaderComp | /shaderComp/core/Shader.py | UTF-8 | 811 | 2.640625 | 3 | [] | no_license | from Node import *
##
# @authors Romain GUYOT de la HARDROUYERE
# @authors Matthieu BOURNAT
# @authors Antoine CHESNEAU
# @package shaderComp.core.Shader
# @brief Subclass of Node
# @version 1.0
# @date 2014-01-13
# @details All shader plugins have to inherit from this class
##
# @authors Romain GUYOT de la HARDROUYE... | true |
339eecac9bd49ad2ec1588221f97bbd896b9f358 | Python | AuburnFord/kattis | /Python/safe.py | UTF-8 | 1,038 | 2.90625 | 3 | [] | no_license | from collections import deque
def update(pos, temp):
row = pos // 3
col = pos % 3
string = list(int(x) for x in temp)
for x in range(3):
string[x+row*3] = ((string[x+row*3])-48+1)%4
string[col+x*3] = ((string[col+x*3])-48+1)%4
string[col+row*3] = ((string[col+row*3])-48+3)%4
string = list(str(x) for x in str... | true |
7316f8e88c4fb8af055c8f41a26920db987eb6fe | Python | mishabuch/omscs-ml-cs7641 | /Boosting.py | UTF-8 | 5,406 | 2.953125 | 3 | [] | no_license | from sklearn import tree
from sklearn.ensemble import AdaBoostClassifier
from sklearn.metrics import accuracy_score, classification_report
from sklearn.model_selection import RepeatedStratifiedKFold, cross_val_score, GridSearchCV
import plots
import numpy as np
class Boosting:
def __init__(self):
# Initi... | true |
5450eb2078c213ae475480ef0c26698db16d2588 | Python | jxhangithub/leetcode | /solutions/python3/331.py | UTF-8 | 394 | 2.75 | 3 | [
"MIT"
] | permissive | class Solution:
def isValidSerialization(self, preorder: str) -> bool:
stack = []
for c in preorder.split(','):
stack.append(c)
while stack[-2:] == ['#', '#']:
stack.pop()
stack.pop()
if not stack: return False
s... | true |
c121a9a715d01fdfcff03ce03e934c649bbe31d6 | Python | jfvalenzuelas/IFRS | /tools.py | UTF-8 | 3,200 | 2.734375 | 3 | [] | no_license | import spacy
import pandas as pd
import clean_utils
global file
global xl
global df1
global df2
global df3
global df4
global df5
global df6
file = '/var/www/html/scrapper/IFRS/utils.xlsx'
xl = pd.ExcelFile(file)
df1 = xl.parse('ActivosCorrientes')
df2 = xl.parse('ActivosNoCorrientes')
df3 = xl.parse('PasivosCorrient... | true |
7e0fb873f4c06f1749a6dc813045c3b2c2564cbd | Python | chrisying/event-coref | /extract_subevent_features.py | UTF-8 | 9,788 | 2.875 | 3 | [] | no_license | '''
Extracts a set of feature vectors for every single doc class (ex: 1_*ecb.xml). Requires the Text-KB graph to be generated first. This differs from extract_features.py in that the matrices are generated for each class (so they are much smaller in dimension) and assumes that we know the document class (aka we know th... | true |
d7c7a497aa7eec5689791c44efbd868af035c685 | Python | sudeshnt/find-shortest-distance | /test_shortest_route.py | UTF-8 | 2,357 | 2.875 | 3 | [] | no_license | import unittest
import math
from unittest import mock
from shortest_route import ShortestRoute
from utils.utils import Utils
from routes.routes import Routes
class TestShortestRoute(unittest.TestCase):
@mock.patch.object(Utils, 'get_file_name', return_value='routes')
def setUp(self, mock_get_file_name):
sel... | true |
d062618cb35a8f64fe499f6bea3bc586f98615fc | Python | ryu022304/atcoder | /AtCoder_Beginner_Contest/011-020/018/c_菱型カウント.py | UTF-8 | 745 | 2.75 | 3 | [] | no_license | r,c,k = map(int,input().split())
s_list = [list(input()) for _ in range(r)]
tmp_list = [[0 for _ in range(c+1)] for _ in range(r)]
for i in range(r):
for j in range(c):
if s_list[i][j]=='x':
for kk in range(k):
if i-kk >= 0:
tmp_list[i-kk][max(0,j-k+kk+1)] +=... | true |
c59d605268066a40e14bae56da824c1da44e85ac | Python | Seancheey/CMPSC442-Homework4 | /unit_test.py | UTF-8 | 1,038 | 2.84375 | 3 | [] | no_license | from qxs20 import *
import time
def timeit(func):
def wrapper(self):
t1 = time.time()
func(self)
print "time:", time.time() - t1, "\n"
return wrapper
@timeit
def test(path):
print(path)
b = read_board(path)
Sudoku(b).infer_with_guessing()
def stat(board):
print("so... | true |
3abe86ba0c6573df1c47b8dcf97713ee2ecec812 | Python | lampinen/symmetry_analyses | /visualizing.py | UTF-8 | 537 | 2.53125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plot
y_data = np.loadtxt("symmetric_data.csv", delimiter=",")
y_data_asymm = np.loadtxt("asymmetric_data.csv", delimiter=",")
y_data_asymm2 = np.loadtxt("asymmetric_data_2.csv", delimiter=",")
plot.figure()
plot.imshow(y_data)
plot.colorbar()
plot.savefig('plots/symme... | true |
02910a6845a53de348b8edab73d9e5ee5ca2be25 | Python | beidou9313/deeptest | /第一期/北京-Windy/sample10.py | UTF-8 | 541 | 3.46875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import math
def sushu():
'''判断101-200之间有多少个素数,并将其输出'''
count = 0
for i in range(100, 201):
for j in range(2, int(math.sqrt(i)-1)):
if i % j == 0 and i % 2 != 0 and i % 5 != 0 :
print('%d' % i, end=' ')
coun... | true |
413b9acf631d4330a1ab834857c618eb7bf218d4 | Python | gscheck/FlappyBird | /TextBox.py | UTF-8 | 1,160 | 3.140625 | 3 | [] | no_license | import pygame
from pygame.locals import *
class TextBox(pygame.sprite.Sprite):
def __init__(self, bkgrnd, xpos, ypos):
pygame.sprite.Sprite.__init__(self)
super().__init__()
self.initFont()
self.initImage()
self.initGroup()
self.setText(['a','b'])
self.rect.t... | true |
3958f125ebc4b31d7aa2085e240d385864c349f5 | Python | Sachitbansal/Tkinter_Projects | /Using_canvas.py | UTF-8 | 633 | 3.171875 | 3 | [] | no_license | from tkinter import *
root = Tk()
root.geometry("600x600")
canvas = Canvas(root, width=600, height=600)
canvas.pack()
# line = canvas.create_line(100, 250, 360, 25)
# canvas.itemconfig(line, fill='red', width=10)
# line2 = canvas.create_line(25, 50, 150, 150, 250, 140, 20, 50,fill='green', width=5)
# text... | true |
89f083fa7fa7fb0dea0f020a13e28828f21ba03a | Python | niteesh2268/coding-prepation | /leetcode/Problems/20--Valid-Parentheses-Easy.py | UTF-8 | 715 | 3.203125 | 3 | [] | no_license | class Solution:
def isValid(self, s: str) -> bool:
openBrackets = ['(', '{', '[']
closeBrackets = [')', '}', ']']
container = ""
for ch in s:
if ch in openBrackets:
container += ch
elif ch in closeBrackets:
if len(container) == ... | true |
40a99d8f18ef81eb7fa1825e9c146d73746d7ea2 | Python | patildeepika221/python1 | /add.py | UTF-8 | 223 | 3.359375 | 3 | [] | no_license | import math
num1=input("enter base : ")
num2=input("enter length : ")
num3=input("enter height : ")
p=(int(num1)+int(num2)+int(num3))/2
area=math.sqrt(int(p)*int(p-num1)*int(p-num2)*int(p-num3))
print('area is %0.2i'%area)
| true |
f2d723d062a798a75152bab9300cc1e9cc6739a6 | Python | NickWue/CrowdfundingSolarPanels | /crowdsolar/calculator/Excel.py | UTF-8 | 691 | 2.96875 | 3 | [] | no_license | """
INT
"""
costpm = 333.33 # cost per module in €
n = 18 #nummer of modules
cfi = 1000 #costs for instalation
np = 230 #norminal power
sh = 1600 # Sunny Hours / Year
flh = 0.5 #Proportion of full load hours
pp = 0.3 # Power Price per kWh
"""
calculation
"""
cost = n * costpm +cfi #costs
av = sh * np *n * flh /1000 ... | true |
0e1c24acda2f44a5b269348545890607dee8cf49 | Python | celiacailloux/submodules | /file_manage_pickle.py | UTF-8 | 603 | 2.75 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu May 14 09:32:17 2020
@author: ceshuca
More on python pickles https://wiki.python.org/moin/UsingPickle
"""
import pickle
from datetime import date
def save_as_pickle(pkl_data, pkl_name):
pkl_filename = str(date.today())+ '_' + pkl_name + '.pickle'
... | true |
64cfda10c8b7cdc4d94513e7696832259e050ae6 | Python | sdksfo/leetcode | /hard_410. Split Array Largest Sum.py | UTF-8 | 752 | 3.703125 | 4 | [] | no_license | """
Pick a number from num_max to num_sum and check using binary search whats the least number that can split 'm' ways.
"""
class Solution(object):
def numSplits(self, nums, expected):
total, splits = 0, 0
for num in nums:
total += num
if total > expected:
to... | true |
6331fcac5e77eb005975165ca68c954146a5b110 | Python | PrintRonald/PYTHON_GRUPAL | /funciones22_10_21.py | UTF-8 | 5,817 | 3.953125 | 4 | [] | no_license |
"""
Control de Bodega
Nuestro programa deberá tener las siguientes funciones:
- Crear una bodega virtual con los productos iniciales.
- Almacenar nuevos productos.
- Actualizar el stock de productos en la bodega virtual.
- Mostrar y retornar las unidades disponibles por producto.
- Mostrar y retornar las unidades dis... | true |
ac150ab3c8dc57299f3b45a740069443f2935f3e | Python | patpetrus/web-scraping-challenge | /mars_scraper.py | UTF-8 | 979 | 2.921875 | 3 | [] | no_license | from splinter import Browser
from bs4 import BeautifulSoup
from webdriver_manager.chrome import ChromeDriverManager
from time import sleep
def init_browser():
# @NOTE: Replace the path with your actual path to the chromedriver
executable_path = {'executable_path': ChromeDriverManager().install()}
return Br... | true |
f0b5093d30eaa821a1c01d4a8276c09f67b48992 | Python | jimherd/robot_head | /md21_test.py | UTF-8 | 364 | 2.828125 | 3 | [] | no_license | #!/usr/bin/python
from md21 import MD21
import time
#=====================================================
# MD21_test : exercise MD21 class
#
md21 = MD21(0x61, debug=True)
print 'MD21 test started'
md21.set_servo(1, 10, 0)
time.sleep(3)
md21.set_servo(1, 80, 0)
time.sleep(3)
md21.set_servo(0, 45, 0)
print 'Volta... | true |
8fca6231bb83899abaf3c8882402f59943ca1639 | Python | hifi-archive/stack-tester | /libs/utils.py | UTF-8 | 1,259 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | import os
import sys
import subprocess
import re
import json
from termcolor import colored
def passed(message, prefix=""):
print("{}{} : {}".format(prefix, colored('PASS', 'green'), message))
def failed(message, prefix=""):
print("{}{} : {}".format(prefix, colored('FAIL!', 'red'), message))
def check_bin... | true |
cf989708ced7c2652d8975933559d7de535bd66d | Python | uname/bleproxy | /PC/BleProxyDesk/form/ProgressDialog.py | UTF-8 | 1,066 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | #-*- coding: utf-8 -*-
import text
import config
from PyQt4 import QtGui, QtCore
class ProgressDialog(QtGui.QProgressDialog):
def __init__(self, parent, waitTime=config.BLE_CONNECT_TIMEOUT, title="Please wait", max=100):
QtGui.QProgressDialog.__init__(self, title, "Hide", 0, max, parent)
self.... | true |
8ce1bb9d2e23b2321fd68ce3e15e27b5d90dd3f6 | Python | pedrito404/kepler_dia | /DIA (copy)/routines/Python/refphot.py | UTF-8 | 5,128 | 2.640625 | 3 | [
"MIT"
] | permissive | #this program will do the photometry on the reference frame to get stars
#for the subtraction and to get stars for later
#if you use this code, please cite Oelkers & Stassun 2018
#import the relevant libraries for basic tools
import numpy
import scipy
from scipy import stats
import scipy.ndimage as ndimage
import as... | true |
a87a4bac303154a3d2904b83885269b5f559f8c6 | Python | Rudra-Patil/Programming-Exercises | /LeetCode/src/700 - Search in a Binary Search Tree.py | UTF-8 | 507 | 3.453125 | 3 | [] | no_license | """
Topics: | Tree |
"""
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def searchBST(self, root, val):
"""
Time: O(log(n))
Space: O(1)
"""
c... | true |
2f80e0ee918f5505b783ee4ac4c477b35ee59019 | Python | vrdmr/Computational-Investing-pt-1 | /CompInvesting1/HWs/HW1/portfoliostats.py | UTF-8 | 4,721 | 2.859375 | 3 | [] | no_license | '''
Created on September, 13, 2013
@author: Varad Meru
@contact: varad.meru@gmail.com
@summary: Homework 1 - Portfolio Management
'''
# QSTK Imports
import QSTK.qstkutil.qsdateutil as du
import QSTK.qstkutil.tsutil as tsu
import QSTK.qstkutil.DataAccess as da
# Third Party Imports
import datetime as dt
import matpl... | true |
4bfd41e50aff2fa41aa80800b83aa52d80fe0645 | Python | kannan275/python-for-trading-basic | /Section-5/2 D plotting.py | UTF-8 | 5,226 | 4 | 4 | [] | no_license |
# coding: utf-8
# # Notebook Instructions
# <i>You can run the notebook document sequentially (one cell a time) by pressing <b> shift + enter</b>. While a cell is running, a [*] will display on the left. When it has been run, a number will display indicating the order in which it was run in the notebook [8].</i>
#
#... | true |
1d068cf8daa48a45f561c676b6d56f5fee451ae9 | Python | gauravmm/DotMatrix-Printer-Imager | /generate.py | UTF-8 | 3,659 | 3.015625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
from PIL import Image
imgHorizontalPixelDensityModes = [(1, 'K'), (2, 'L'), (2, 'Y'), (4, 'Z')]
imgHorizontalPixelDensity = 2
imgWidth = 816
imgHeightScale = 1080.0/1920*17.5/7*7/8 # Aspect ratio correction.
print(imgHeightScale)
def brightenFuncLinear(bfac):
return lambda v: 255 - int((1.0-bfac... | true |
9eec1c256f4832a2d25fe0b3366dec0cb55195de | Python | epfl-dlab/eigenthemes | /utils.py | UTF-8 | 10,604 | 2.578125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | import os
import sys
import re
import numpy as np
import random
import csv
import pickle
random_seed = 7
np.random.seed(random_seed)
random.seed(random_seed)
import itertools
from collections import Counter
import gensim
from gensim.models import Word2Vec
from gensim.utils import simple_preprocess
from gensim.models.k... | true |
24ac41c1a6ecd2757835a97b8a586dc5a814182e | Python | lschlessinger1/MS-project | /src/datasets/concrete.py | UTF-8 | 2,604 | 3.03125 | 3 | [
"MIT"
] | permissive | import os
from typing import Optional, Tuple
import numpy as np
import toml
from src.datasets.dataset import Dataset, _download_raw_dataset, _parse_args
RAW_DATA_DIRNAME = Dataset.data_dirname() / 'raw' / 'concrete'
METADATA_FILENAME = RAW_DATA_DIRNAME / 'metadata.toml'
PROCESSED_DATA_DIRNAME = Dataset.data_dirname... | true |
4d182e5dfd014be90ddef28fb8d9b9d6eb2ad3c5 | Python | varj92/python | /app_mongodb.py | UTF-8 | 1,317 | 3.1875 | 3 | [] | no_license | from pymongo import MongoClient
MONGO_URI = 'mongodb://localhost'
#Conectar A MongoDB
client = MongoClient(MONGO_URI)
db = client['test'] # crear base de datos
collection = db['productos'] # crear colección
## crear documento en una colección
#collection.insert_one({"name": "Ford Mustang","price":750000})
product... | true |
733b15488404a912e986cd9ac2534777c71bad38 | Python | ishine/gender-tracker | /activelearning/backend/ml/author_prediction_dataset.py | UTF-8 | 7,948 | 2.953125 | 3 | [] | no_license | from torch.utils.data import Dataset, DataLoader, Subset
from torch.utils.data.sampler import WeightedRandomSampler
from backend.ml.helpers import find_true_author_index
from backend.ml.author_prediction_feature_extraction import *
def parse_article(article_dict, cue_verbs, poly=None):
"""
Creates feature ve... | true |
145297125662279b7a08c349827b8cda05f34c81 | Python | lcpdeb/capstone | /GetBoundary.py | UTF-8 | 548 | 3.109375 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
from numpy import *
def GetBoundary(map_size):
boundary=mat([[0,0]])
for i1 in range(1,map_size+2):
boundary=vstack((boundary,[0,i1]))
for i2 in range(1,map_size+2):
boundary=vstack((boundary,[i2,0]))
for i3 in range(1,map_size+2):
boundar... | true |
4495a9bc2e7aaef8c38e41555a9ebab5e607514d | Python | astronaut0131/operating-system-three-easy-piece | /Ch15 Address Translation/Q5_solver.py | UTF-8 | 914 | 2.671875 | 3 | [] | no_license | import os
import matplotlib.pyplot as plt
for seed in range(1):
valid_rate = []
limit_list = []
result = os.popen('python relocation.py -s {}'.format(seed)).read().split('\n')
result = [item for item in result if item]
limit_range = [int(item.split('ARG address space size ')[1].replace('k','')) for ... | true |
d177266f4c3bed2d1701d70fb74a2b65bc152840 | Python | vmtenorio/X-Serv-15.4-Django-calc | /calc/views.py | UTF-8 | 782 | 3.09375 | 3 | [
"Apache-2.0"
] | permissive | from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def suma(request,op1,op2):
return HttpResponse("<h1>Suma!</h1><p>" + op1 + " + " + op2 + " = " + str(int(op1) + int(op2)) + "</p>")
def resta(request,op1,op2):
return HttpResponse("<h1>Resta!</h1><p>" + op1 + " ... | true |
6edd2fc8a20a514dc3889456780a6b45a2ceee7f | Python | AndrewLin-Umich/Project-Euler | /ex50.py | UTF-8 | 504 | 3.375 | 3 | [] | no_license | def is_prime(x):
for i in xrange(2, int(x**0.5)+1):
if x % i == 0 :
return False
return True
primes = []
for i in xrange(2,8000):
if is_prime(i):
primes.append(i)
l={}
for i in xrange(len(primes)-3):
for j in xrange(i+1,len(primes)-2):
s = sum(primes[i:j])
if s<1000000:
... | true |
3493479542317b4da552e60532e8f83df8edba29 | Python | prem168/GUVI | /oddinrange.py | UTF-8 | 180 | 3.328125 | 3 | [] | no_license | a,b=input().split(" ")
a=int(a)
b=int(b)
if(a%2==0):
m=a+1
else:
m=a+2
for i in range(m,b,2):
if(b-i==1 or b-i==2):
print(i)
break
print(i,end=" ")
| true |
c7e5e0d9a290479525440f45afacba9cac164c06 | Python | kvas-it/cli-mock | /tests/test_pytest_plugin.py | UTF-8 | 1,345 | 2.6875 | 3 | [
"MIT"
] | permissive | import subprocess
import pytest
@pytest.fixture()
def pc(popen_controller, testlog):
popen_controller.set_replay_log(testlog.strpath)
return popen_controller
def test_popen(pc):
proc = subprocess.Popen(['foo'], stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
... | true |
4ca755dbe0b2c6e867a77ea71dddb9fb376e12bd | Python | Teddy-Sannan/ICS3U-Unit5-03-Python | /level_to_percentage.py | UTF-8 | 1,594 | 4 | 4 | [] | no_license | #!/usr/bin/env python3
# Created by: Teddy Sannan
# Created on: November 2019
# This program takes the users level
# and prints its percentage
def percentage(level):
# This function processes the user input
# process
percentage = None
if level == "4+" or level == "A+":
percentage = 97
e... | true |
e955b598aae5f985cc4941d410a53bdb9dc41939 | Python | bogdanmironov/Diploma | /Data4/NLayerSearch.py | UTF-8 | 6,690 | 2.53125 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import h5py
import matplotlib.pyplot as plt
import pickle
import json
from tensorflow.keras.layers import Dropout, Dense, Flatten
from tensorflow.keras.callbacks import EarlyStopping, TensorBoard
from tensorflow.keras.losses import BinaryCrossentropy
import os
from sklearn.met... | true |
ec4f1b0ab7e47c2b08600bef4e69d3d5b1d5b2f2 | Python | DaianaMicena/fiap-exercicios-python | /Exercicios_Python/exercicio7.1.py | UTF-8 | 228 | 3.640625 | 4 | [] | no_license | maior = 0
#entrada
n = int(input("Informe o numero"))
#processamento
while n != maior: # maior = 50
if n > maior: # n = 0
maior = n
n = int(input("Informe o numero"))
print(f"O maior numero informado é {0}")
| true |
57a90a1fcdc436be74109b73910fd40a4fa4023c | Python | FiveCrows/SIRsims | /PopulaceGraphModel/findIsolatedPeople.py | UTF-8 | 2,615 | 2.640625 | 3 | [] | no_license | """
This script is written to check who has no edges in the graph
"""
#from ModelToolkit2 import *
from ge_modelingToolkit2 import *
import copy
#These values scale the weight that goes onto edges by the environment type involved
default_env_scalars = {"school": 0.3, "workplace": 0.3, "household": 1} # base case
#As... | true |
a69277b86289d6d94fe27c18ef133a0c2ea916e0 | Python | Braxton22/MyDictionaries | /dictionary start file.py | UTF-8 | 1,712 | 3.84375 | 4 | [] | no_license | phonebook = {"Chris": "555-1111", "Katie": "555-2222", "Joanne": "555-3333"}
"""
print(phonebook)
print(len(phonebook))
"""
"""
CREATING A DICTIONARY WITH DICT
mydictionary = dict(m=8, n=9)
print(mydictionary)
"""
"""
CALLING AN ITEM IN THE DICTIONARY
phonebook = {"Chris": "555-1111", "Katie": "55... | true |
4f559cca5010eae175693e3503e6d13962d224f2 | Python | google-research/federated | /gans/experiments/emnist/classifier/measure_misclassification_of_users.py | UTF-8 | 6,228 | 2.765625 | 3 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | # Copyright 2019, Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | true |
33935c1bc2071fb64f4b182f69413281cf2e663d | Python | ys0232/almm_predict | /src/deep_cross.py | UTF-8 | 12,365 | 2.625 | 3 | [] | no_license | import numpy as np
import pandas as pd
import keras.backend as K
from keras import layers
from keras.layers import Dense
import matplotlib.pyplot as plt
from keras.layers import Input, Embedding, Reshape, Add
from keras.layers import Flatten, concatenate, Lambda
from keras.models import Model
from sklearn.preprocessing... | true |
81f9239929077ed81da7859a3e0e79d725ea3bfc | Python | smarthun0106/ksbot | /source/loop_tools.py | UTF-8 | 2,090 | 2.78125 | 3 | [] | no_license | import pandas as pd
import requests
import time
def make_code(x):
x = str(x)
return '0'* (6-len(x)) + x
def crawling_firm_info():
url = "http://kind.krx.co.kr"
path = "/corpgeneral/corpList.do"
parameters = {
"method" : "download",
"searchType" : "13"
}
page = requests.get(... | true |
c5e2a8eec77d1b58855c6e975ef053b97fe6cdad | Python | bukun/TorCMS | /torcms_postgis/scripts/py4postgis.py | UTF-8 | 2,198 | 2.828125 | 3 | [
"MIT"
] | permissive | '''
使用psycopg2连接。
'''
from cfg import PostGIS_CFG
import psycopg2
class PGINFO():
def __init__(self):
self.conn = psycopg2.connect(
database=PostGIS_CFG['db'],
user=PostGIS_CFG['user'],
password=PostGIS_CFG['pass'],
host=PostGIS_CFG['host'], port="5432"
... | true |
2387ffc42b231088ee78de946d0279cd47a3f622 | Python | Uncannly/uncannly | /data/parse/primary/frequency_list.py | UTF-8 | 464 | 2.796875 | 3 | [
"MIT"
] | permissive | from data.parse.primary.open_helper import open_primary_data_file
def parse():
word_frequencies = {}
frequency_list = open_primary_data_file('unlemmatized_frequency_list')
for line in frequency_list:
line_split_by_spaces = line.strip().split(' ')
frequency = line_split_by_spaces[0]
... | true |
c523091c0bda3197b71da6adb350ad9872e84f0f | Python | syrusakbary/snapshottest | /examples/pytest/test_demo.py | UTF-8 | 2,382 | 3.09375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from collections import defaultdict
from snapshottest.file import FileSnapshot
def api_client_get(url):
return {
"url": url,
}
def test_me_endpoint(snapshot):
"""Testing the API for /me"""
my_api_response = api_client_get("/me")
snapshot.assert_match(my_api_respo... | true |
599d1a977d7917e34e420371ac886e53df2f1135 | Python | rheehot/For_Coding_Test | /파이썬 알고리즘 문제풀이/섹션 7/Sol_4. 동전바꿔주기.py | UTF-8 | 424 | 3.140625 | 3 | [] | no_license | t = int(input())
k = int(input())
arr = []
ans = 0
for _ in range(k):
a, b = map(int, input().split())
arr.append([a, b])
def dfs(start, sum):
global ans
if sum > t:
return
elif sum == t:
ans += 1
return
for i in range(start, k):
if arr[i][1] > 0:
... | true |
9b91e35806bc1b8d7aa2f6e6fd9acceb99ebf831 | Python | theodormoroianu/SecondYearCourses | /IA/Project1/read_input.py | UTF-8 | 816 | 3.09375 | 3 | [] | no_license | from os import listdir
from os.path import isfile, join
from typing import List, Tuple
import state
def ReadFolder(folder: str) -> List[str]:
"""
Reads an input folder, and returns the files from within.
@param folder: folder to read.
@return: list with all the files.
"""
onlyfiles... | true |
59306bc1c34216e16ea0846b8c0c9a510365f59f | Python | kalostoyanov/Hangman | /main.py | UTF-8 | 1,601 | 4.25 | 4 | [] | no_license | def generate_word():
global word
global blank_word
import random
with open("words.txt") as words_file:
lines = words_file.read().splitlines()
word = random.choice(lines)
blank_word = "_" * len(word)
def user_input():
global letter
letter = input("Please enter a letter: ").lower... | true |
41545b9f8b376b9d044af42010a2abf1c46a0cb4 | Python | hadilou/Road-Distress | /scripts/classificationPre.py | UTF-8 | 1,115 | 2.578125 | 3 | [] | no_license | """
@authors Kayode H. ADJE
kaadje@ttu.ee
Toghrul Aghakishiyev
toagha@ttu.ee
"""
from gaps_dataset import gaps
import numpy as np
#Dataset Folder path
dataset_dir = '../Dataset'
#load training dataset info file
train_info = gaps.get_dataset_info(version=2,
patchs... | true |
eb11f69569ec54d7f8f25eef3b1d7e099ba8041a | Python | YZYT/EA | /utils.py | UTF-8 | 1,122 | 2.640625 | 3 | [] | no_license | import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import seaborn as sns
from scipy import stats, integrate
from matplotlib.pyplot import MultipleLocator
def plot(ax, path, x, y, label):
data = pd.read_csv(path)
data_x = data[x]
data1_y = data[y]
if y == 'te... | true |
2b5140942bbb53c63c63a91f290e5c993cff5c4f | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_200/4340.py | UTF-8 | 1,137 | 3.125 | 3 | [] | no_license | output=open("Output.txt","w")
t=input()
for testcases in range(t):
n=input()
if(not n%10):
n-=1
s=str(n)
if(len(s)>1 and s[0]=='1' and '0' in s):
print "Hello"
res=""
for i in range(1,len(s)):
res+='9'
n=int(res)
elif("10" in s):
print "Hello2"
temp=0
for i in range(len(s)):
if(s[i]=='1'):
... | true |
25dfb9f1ab95fef87b906657a70958f55adfb54a | Python | lucas-cavalcanti-ads/projetos-fiap | /1ANO/PYTHON/ListaExercicios/Lista09/L09-EX01.py | UTF-8 | 173 | 3 | 3 | [] | no_license | def gerarNumeros():
# lista = []
# for i in range(1,28):
# lista.append(i)
return list(range(28))
listaNumeros = gerarNumeros()
print (listaNumeros)
| true |
d20f02d50a4e16aa639f6f6f34614288273ab86b | Python | rjegankumar/instacart_prediction_model | /create_sample.py | UTF-8 | 1,058 | 2.765625 | 3 | [
"MIT"
] | permissive | # importing modules/ libraries
import pandas as pd
import random
import numpy as np
# create a sample of prior orders
orders_df = pd.read_csv("Data/orders.csv")
s = round(3214874 * 0.01)
i = sorted(random.sample(list(orders_df[orders_df["eval_set"]=="prior"].index), s))
orders_df.loc[i,:].to_csv("Data/orders_prior_sam... | true |
f7e44f64ec73cdd24015a8b4ec3ea221e33ccd83 | Python | scieloorg/packtools | /packtools/webapp/custom_filters.py | UTF-8 | 1,145 | 2.546875 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | permissive | # coding:utf-8
import os
import re
from distutils import util
from flask import Markup
dict_status = {"ok": "success"}
label_status_translation = {
"ok": "success",
"error": "important",
"in-progress": "info",
}
def asbool(s):
""" Return the boolean value ``True`` if the case-lowered value of strin... | true |
34e0b492d4f3e582d7ecc299d785e0acd6e99112 | Python | wangyongqingi/wyq_machine_learning | /Perceptron.py | UTF-8 | 2,745 | 2.90625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue May 22 16:57:31 2018
@author: wyq
"""
import numpy as np
class Learning_rate_Error(ValueError):
pass
class Prediction_Label_Error(TypeError):
pass
class Train_data_Error(TypeError):
pass
class My_classifier_x_Error(TypeError):
pass
class My_Y_Error(T... | true |
ae94e02addb3d9ecc3c7646838fbed93594c9b21 | Python | ClarisseU/passwordLocker | /credentials.py | UTF-8 | 1,446 | 3.3125 | 3 | [
"MIT"
] | permissive | class Credentials:
'''
This class is going to hold information about the credentials
'''
cred_list = []
def __init__(self,socialMed,username,password,email):
'''
will hold the properties for our objects
'''
self.socialMed = socialMed
self.username = userna... | true |
d33f835340a9631a988e8fcad9da13b0cd9727a2 | Python | teliduxing004/PythonUtilities | /python_utilities/os_util/archive.py | UTF-8 | 1,631 | 3.34375 | 3 | [] | no_license | # coding=utf-8
""" Module Docstring.
Author: Ian Davis
Last Updated: 9/17/2015
"""
import os
import tarfile
import path
class Archive(object):
""" Class implementation that manages creating and editing a tarball archive.
:param archive_path: The path to the archive.
:type archive_file: TarFile
:ty... | true |
649d4b0dfdd94be2d73d85777766d8cc8ba7605c | Python | mbecker8600/randomized_optimization | /903205922/code/python/Neural Network optimization.py | UTF-8 | 2,436 | 2.609375 | 3 | [] | no_license |
# coding: utf-8
# In[38]:
import pandas as pd
import numpy as np
from sklearn import preprocessing
from sklearn.multiclass import OneVsRestClassifier
from IPython.core.interactiveshell import InteractiveShell
from IPython.display import display, HTML
from sklearn.model_selection import GridSearchCV
InteractiveShell.... | true |
e18c70971bac8b4777555a168f27d243c9134d96 | Python | StudyGroupPKU/TESTs | /hoabin/h180228_forcb.py | UTF-8 | 98 | 3.0625 | 3 | [] | no_license | for k in range (1, 10):
if k==2:
continue
if k==7:
break
print (k)
| true |
500ff9b90ba080cce63e122641a714fd89fc6ad1 | Python | RAvontuur/connect-four | /test_environment.py | UTF-8 | 4,767 | 2.703125 | 3 | [] | no_license | from environment import ConnectFourEnvironment
# test X wins (vertical)
env = ConnectFourEnvironment()
assert(env.terminated == False)
assert(env.get_player() == 1)
env.move(0)
assert(env.get_player() == -1)
env.move(6)
assert(env.get_player() == 1)
env.move(0)
assert(env.get_player() == -1)
env.move(6)
assert(env.ge... | true |
0c022e2e69d8fe7a56dd59cfe5d01a311a36903d | Python | Frallmeister/mandelbrot | /main.py | UTF-8 | 1,598 | 3.15625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import time
def get_stability(c, max_iterations=100):
"""
Calculate z_{n+1} = z_{n}**2 + c and return the number of iterations until abs(z) > 2
"""
z = 0
for i in range(max_iterations):
z = z**2 + c
if abs(z) > 2:
retu... | true |
3593dfc7a9cb0ee9d079d0cdc7b4832f372f99c4 | Python | aldamatrack/testing | /Python/RPS/RPS.py | UTF-8 | 252 | 3.4375 | 3 | [] | no_license |
def game(a,b):
if ((a == "piedra" and b == "tijera") or (a == "papel" and b == "piedra")
or (a == "tijera" and b == "papel")):
print ("Player one win")
elif a == b:
print("draw")
else:
print("Player two win")
| true |
f1d9dbfdf5d5393e42f53c734ef1e2d876225c39 | Python | anirekhj/ETL-OLAP-Queries | /main.py | UTF-8 | 6,019 | 2.875 | 3 | [] | no_license | import csv
def wrapper_function(lst, header):
for item in lst:
print(tabify(1) +item + tabify(6) + str(sum(list(map(int, [(i[4] if i[header] == item else 0) for i in records])))))
def wrapper_function_2a(lst_1, lst_2, header_1, header_2):
for item_1 in lst_1:
for item_2 in lst_2:
print(tabify(1)+ite... | true |
dd0aed1fd9fb47e93aa1227758a49b04b9232908 | Python | weal1312/image | /image.py | UTF-8 | 1,462 | 2.96875 | 3 | [] | no_license | import argparse
import os
from PIL import Image
class IMG:
def __init__(self, source_path, dest_dir):
self.img = Image.open(source_path)
self.width, self.height = self.img.size
self.dest_dir = dest_dir
self.filename = os.path.basename(source_path)
def crop(self):
dest_height = self.width / 3 * 4
margin... | true |
c9b265d80f8eb4bd8abb27b6ad51e13588918bf8 | Python | SandervanNoort/mconvert | /mconvert/newtools/get_output_handler.py | UTF-8 | 478 | 2.75 | 3 | [] | no_license | import logging
from .LogFormatter import LogFormatter
def get_output_handler(level="INFO"):
"""Print info message, and higher level message including debug level"""
# create console handler and set level to info
handler = logging.StreamHandler()
handler.setLevel(getattr(logging, level.upper()))
fo... | true |
618912c938f45a50a1ddc972a0199dc119d1e8ce | Python | BhavathariniAG/project-2 | /main.py | UTF-8 | 290 | 3.515625 | 4 | [] | no_license | import time
def prime_number(number):
for i in range(number+1):
for j in range(2,i):
if i%j==0:
break
else:
print(i,"prime number")
time.sleep(5.0)
break
prime_number(25)
| true |
2c2a6d046b330f71f4cf234645dd8d4bd972b520 | Python | alfrednfwong/Udacity_data_wrangling_OSM_case_study | /audit_bilingual_street_names.py | UTF-8 | 10,621 | 2.859375 | 3 | [] | no_license | # Audit street names of both Chinese and English in an OSM file.
# The target area is Hong Kong, with a little bit of Shenzhen, PRC
#
# Hong Kong is a bilingual jurisdiction with both Chinese and English
# as the official languanges. According to the OSM guidelines, names
# of places in Hong Kong should be recorded in ... | true |
e83b8b42b3e2f78b59419f158eda5091116321c4 | Python | rdbo/flask-url-shortener | /app.py | UTF-8 | 1,908 | 2.625 | 3 | [] | no_license | import uuid
from flask import Flask, url_for, redirect, render_template, request
from flask_sqlalchemy import SQLAlchemy
app = Flask("test")
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///test.db"
db = SQLAlchemy(app)
class URLBase(db.Model):
token = db.Column(db.String(32), primary_key=True, unique=True, nul... | true |
7cb1949f9f143265eb0208ac9434c838c6f13505 | Python | Ethan-Steidl/ZOotr | /generate_edges.py | UTF-8 | 2,297 | 3.40625 | 3 | [] | no_license | '''
Generate an edges file from the filenames in data_names.py
The file is saved as edges.txt
'''
import graph
from data_names import files
import json
from entrance import Door
import re
def a():
print('yolo')
'''
Generates the original edges.txt file
'''
def make_edges():
g = {} ... | true |
81e4d4230065243f4b3eb3a7fceec9f7e9baa7cf | Python | db3124/bigdata_maestro | /Python/Py_projects/chap05/code06_가위바위보.py | UTF-8 | 1,118 | 3.828125 | 4 | [] | no_license | '''
[가위바위보 프로그램]
실행 예:
가위바위보: 가위
컴퓨터: 보, 사용자: 가위
이겼습니다...^^
'''
import random
user = input('가위바위보: ')
kbb = ['가위', '바위', '보']
computer = kbb[random.randrange(0, 3)]
if user == '가위' and computer == '보':
print('컴퓨터: {0:s}, 사용자: {1:s}'.format(computer, user))
print('이겼습니다.')
elif user ==... | true |
313141643e526be5231f2d3f7cf15f12cdf556e3 | Python | Remi-Guijarro/CoolSchool | /interface.py | UTF-8 | 5,175 | 3.109375 | 3 | [
"MIT"
] | permissive | from colorama import init, Fore, Back, Style
from os import system, name
import utils
import time
import parser
from math import *
from sys import exit
PROBA_CHOICE_MSG="\n Veuillez saisir votre preference pour chaques sujets et chapitres : \n \t -Notez que si vous assignez 0 sur un sujet ou un chapitre, aucune quest... | true |
8e7fb02fe77f9650c88bae226809cbe4e1803bbd | Python | mingbocui/Human-Motion-Prediction | /.ipynb_checkpoints/loss-checkpoint.py | UTF-8 | 1,870 | 3.140625 | 3 | [
"MIT"
] | permissive | import math
import torch
class PredictionLoss(torch.nn.Module):
"""2D Gaussian with a flat background.
p(x) = 0.2 * N(x|mu, 3.0) + 0.8 * N(x|mu, sigma)
"""
def __init__(self, size_average=True, reduce=True, background_rate=0.2):
super(PredictionLoss, self).__init__()
self.size_avera... | true |
ea3f0e12a0fd1d7a838ffb0d1652990df739b381 | Python | danyrubiano/Redes | /Lab1/prueba1.py | UTF-8 | 1,051 | 2.875 | 3 | [] | no_license | import numpy as np
from numpy import sin, linspace, pi
from scipy.io.wavfile import read,write
from scipy import fft, arange, ifft
import matplotlib.pyplot as plt
rate,info=read("beacon.wav")
print(rate) ## Frrecuencia de muestreo
print(info)
dimension = info[0].size
print(dimension) #data: datos del audio (arre... | true |
2913138c96d211c903a74d216fdbc4211afb1920 | Python | blue-mica/testowy_one | /Zadania domowe/test.py | UTF-8 | 387 | 4.46875 | 4 | [] | no_license |
#oryginal dodawal 2 liczby; dodalem 3
# Store input numbers
print('We are going to add 3 numbers, so please:')
num1 = input('Enter first number: ')
num2 = input('Enter second number: ')
num3 = input('Enter third number: ')
# Add three numbers
sum = float(num1) + float(num2) + float(num3)
# Display the sum
print('Th... | true |