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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
7b30e4ac647403c15967b502d1a8b5cc4fb217e7 | Python | MaclaineSabino/ADS_IFPI-Exercicios | /Exercicios_Python/Ex04/Ex04Q14.py | UTF-8 | 172 | 3.296875 | 3 | [] | no_license | from random import randint
lista=[]
maior=0
for i in range(0,100):
lista.append(randint(1,100000))
for i in lista:
if(i>maior):
maior=i
print(maior)
| true |
76a88d5b380969c84050251c9c13ccd4c4537bd3 | Python | maihan040/Python_Random_Scripts | /binaryExpression.py | UTF-8 | 1,158 | 4.53125 | 5 | [] | no_license | # binaryExpression.py
#
# purpose: to evaluate an arithmetic expression as given by a binary tree
#
# Example:
# *
#
# / \
#
# + +
#
# / \ / \
#
# 3 2 4 5
#
#
# equals: [(3 + 2) * (4 + 5)]
#class definition
class bstNode:
def _... | true |
96b020b5a1b53481bd6caad9ce2569a497918241 | Python | pranavjoy/pythonForPenTesting | /Day3/classwork/server.py | UTF-8 | 1,160 | 2.9375 | 3 | [] | no_license | import os
import socket
def download(conn, command):
conn.send(command.encode())
grab, path = command.split("*")
f = open('/root/Desktop/' + path, 'wb')
while True:
bits = conn.recv(1024)
if bits.endswith('DONE'.encode()):
f.write(bits[:-4]) # Write those last received bit... | true |
abf9915deeb1868161b46f77bb9ec4496a31652d | Python | FranckNdame/leetcode | /problems/448. Find All Numbers Disappeared in an Array/solution.py | UTF-8 | 345 | 3.140625 | 3 | [] | no_license | class Solution:
def findDisappearedNumbers(self, nums: List[int]) -> List[int]:
result = []
for i in range(len(nums)):
index = abs(nums[i]) - 1
nums[index] = -1 * abs(nums[index])
for j in range(len(nums)):
if nums[j] > 0:
result.append(j+... | true |
1fe54ba660f90a092047dc270dd9b6b62151583a | Python | keioni/ink_mock1 | /ink/sys/config.py | UTF-8 | 3,500 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
'''INK system configuration module.
This module is used to customizing INK system settings.
When you want to access any settings, you must use
the instance -- already created when imported timing --
of this class 'CONF' on this module.
For example:
from ink.sys.config import CONF
CONF... | true |
1275c06e57ac22e5d426996de7895268fa188a97 | Python | rafaelwitter/UFSC | /POO/Aula_5.0.py | UTF-8 | 1,901 | 4.375 | 4 | [] | no_license | ####################
# Estudando funções#
####################
####################
#Entendendo funções#
####################
def soma(x,y):
'''
Insira um numero x e y, para que seja feita a soma dos mesmos
'''
return(x+y)
def multi(z,w):
'''
Recebe dois numeros inteiros e multiplic... | true |
2c84132be5ee9dcd181e76ea57ec202d8669b12f | Python | Ron-Chang/MyNotebook | /Coding/Python/Ron/Trials_and_Materials/(*)num_fun.py | UTF-8 | 900 | 3.734375 | 4 | [] | no_license | """
Test.describe('Basic Tests')
Test.assert_equals(seven(times(five())), 35)
Test.assert_equals(four(plus(nine())), 13)
Test.assert_equals(eight(minus(three())), 5)
Test.assert_equals(six(divided_by(two())), 3)
seven(times(five())); // must return 35
four(plus(nine())); // must return 13
eight(minus(three())); // mus... | true |
e03ba7e0b90db0ff62dfb96574bc25d199d885eb | Python | cpappas18/Health-Records-System | /tests/test_health_records_system.py | UTF-8 | 5,698 | 2.65625 | 3 | [] | no_license | import mock
import builtins
from unittest import TestCase
from src.health_records_system import *
class TestHealthRecordsSystem(TestCase):
def setUp(self):
self.system = HealthRecordsSystem()
def tearDown(self):
HealthRecordsSystem._reset()
def test_get_instance(self):
instance ... | true |
c419ce5e2e91ee13d398af2e5c64e348ed213ced | Python | sanoyo/analysys | /substract.py | UTF-8 | 1,623 | 3.21875 | 3 | [] | no_license | # https://algorithm.joho.info/programming/python/opencv-background-subtraction-py/
# -*- coding: utf-8 -*-
import cv2
import numpy as np
def main():
i = 0 # カウント変数
th = 50 # 差分画像の閾値
cap = cv2.VideoCapture("sample.MOV")
# 最初のフレームを背景画像に設定
# bg = cv2.imread('test.png')
# bg = cv2.cvtColor... | true |
2c39a33db65c6a3580c6f79c6d463a87b919371f | Python | SirGuiL/Python | /Mundo 2/Python_Exercicios/ex056.py | UTF-8 | 868 | 3.828125 | 4 | [] | no_license | nomes = []
idades = []
sexo = []
soma = 0
maisvelho = 0
menos20 = 0
for c in range(0, 4):
nomes += [input('Digite o nome da {}ª pessoa: '.format(c + 1))]
idades += [int(input('Digite a idade da {}ª pessoa: '.format(c + 1)))]
sexo += [input('Digite o sexo da {}ª pessoa: '.format(c + 1))]
print('')
for ... | true |
95c5a3e5fb6db7afa32a0a7d09b75708491b29cf | Python | JoelBender/bacpypes | /tests/test_constructed_data/test_array_of.py | UTF-8 | 9,505 | 3 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test Array
----------
"""
import unittest
from bacpypes.debugging import bacpypes_debugging, ModuleLogger
from bacpypes.primitivedata import TagList, Integer, Time
from bacpypes.constructeddata import ArrayOf
from bacpypes.basetypes import TimeStamp
from .helpers i... | true |
08527c0199ce36b46e9d54b4cd123eb4c7fadb48 | Python | IsThatYou/Competitive-Programming | /ACM/2018Fall/Homer_Simpson.py | UTF-8 | 642 | 2.734375 | 3 | [] | no_license | #https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=655&problem=1406
from sys import stdin
for line in stdin:
m,n,t = [int(x) for x in line.split()]
if m >n:
temp = n
n =m
m = temp
if t%m == 0:
print(int(t/m))
else:
residual = t%m
ans = t//m
n... | true |
57aad26199deccdd4beeeb9a946cfb29188021f0 | Python | Camiko0/Arbol_PosOrden-Aritmetica | /inicio.py | UTF-8 | 1,266 | 3.171875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from pila import *
from arbol_expresiones import *
class Inicio:
""" INSTANCIAS """
def __init__(self):
self.arbol = Arbol()
self.pila = Pila()
""" AGREGAR ELEMENTOS A LA COLA """
def abrir_archivo(self):
#Abrir .txt con expresiones aritmet... | true |
826c6ea72df53638f549a415ca5fb51361fbe4bc | Python | pcw1993/stu_Machine_learning | /机器学习/14.聚类-means.py | UTF-8 | 1,640 | 3 | 3 | [] | no_license | # -*- coding:utf-8 -*-
# author: pcw
# datetime: 2018/12/7 10:47 AM
# software: PyCharm
import pandas as pd
from sklearn.decomposition import PCA
from sklearn.cluster import KMeans
from sklearn.metrics import silhouette_score
import matplotlib.pyplot as plt
# with open('./data/1.txt', 'r') as f:
# cont = f.read(... | true |
dd4b2cdc3aadebcc48306170fbff22d5010069f3 | Python | facelessuser/Rummage | /rummage/lib/gui/dialogs/file_ext_dialog.py | UTF-8 | 2,800 | 2.578125 | 3 | [
"MIT"
] | permissive | """
File Ext Dialog.
Licensed under MIT
Copyright (c) 2013 - 2018 Isaac Muse <isaacmuse@gmail.com>
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 limitatio... | true |
945d578c6f688ca2cf48de07731e0c84f1686938 | Python | thankew/BTVN_Python | /pythonProject2/BTVN_Buoi17/eg.py | UTF-8 | 241 | 2.8125 | 3 | [] | no_license | en_dict = {
"Laptop": "Máy tính xách tay",
"Vietnamese": "Người Việt, tiếng Việt",
"Snake": "Con rắn",
"Happy": "Hạnh phúc",
"Sad": "Buồn bã"}
while True:
print(next(en_dict))
show_dict(en_dict) | true |
2f39b9d719ea09ba74b24719b46f9376603362a3 | Python | pobrien11/PyAniLib | /pyani/core/mngr/ui/core.py | UTF-8 | 36,645 | 2.59375 | 3 | [] | no_license | import os
import logging
import pyani.core.ui
import pyani.core.mngr.tools
import pyani.core.appvars
import collections
# set the environment variable to use a specific wrapper
# it can be set to pyqt, pyqt5, pyside or pyside2 (not implemented yet)
# you do not need to use QtPy to set this variable
os.environ['QT_API'... | true |
f3840f4e5d685c1708500f223c0ef3d32d5bc7c2 | Python | caseycas/CodeNLPReplication | /lexer/utilities.py | UTF-8 | 37,637 | 2.515625 | 3 | [
"MIT"
] | permissive | '''
Created on Oct 12, 2015
@author: Naji Dmeiri
@author: Bogdan Vasilescu
@author: Casey Casalnuovo
'''
from pygments.token import *
from collections import OrderedDict
import Android
import Api
import csv
#import jsbeautifier
#from sets import Set
import re
#Check for TREE_TEXTS before NATURAL_LANGUAGE_EXTS
TREE_TE... | true |
baded4193b221c504106fedd12c7efcbd75883da | Python | qxjl1010/classification_task | /SVM.py | UTF-8 | 1,482 | 3.15625 | 3 | [] | no_license | from sklearn import svm
import pandas as pd
import numpy as np
import random
# using SVM
# for details, visit:
# https://scikit-learn.org/stable/modules/svm.html#regression
# since the dataset has more than 280k class_0 and only 492 class_1
# we need to extract the same number of class_0 as class_1
def get_0(raw_a... | true |
30aea9a04f83716ae7ffee23c29a05924fd865cc | Python | kunwarmahen/CarND-Advanced-Lane-Lines | /camera.py | UTF-8 | 1,389 | 2.6875 | 3 | [] | no_license | import glob
import numpy as np
import cv2
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
class Camera:
def __init__(self):
self.mtx = None;
self.dist = None;
def calibirateCamera(self):
# Read in all the calibration images
images = glob.glob('camera_cal/calibration*.jp... | true |
2c8f153a35a293403a65e174ec2874e599a177e6 | Python | yuma3496/Capstone_Project_3 | /task_manager.py | UTF-8 | 16,390 | 3.078125 | 3 | [] | no_license | from datetime import date
from datetime import datetime as dt
# Helper functions
def read_txt_file(filename):
with open(filename, 'r') as file:
read_lines = file.readlines()
file.close()
return read_lines
def write_txt_file_with_line_number(line_no, values):
lines = read_txt_file('tasks.t... | true |
5252aaf5a8f241014f454261679ea471482c5356 | Python | DKU-STUDY/Algorithm | /codility_training/lessons.lesson08.Leader.Dominator/sangmandu.py | UTF-8 | 417 | 3.3125 | 3 | [] | no_license | # you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
pass
B = {}
C = set(A)
for i in C:
B[i] = 0
for i in A:
B[i] += 1
for k, v in B.items():
if (v > len(A) // 2)... | true |
b3f4bf866cbd4f1281104ef59689610e6afe576e | Python | Alexzsh/oj | /jianzhi/005替换空格/replaceBlank.py | UTF-8 | 130 | 2.578125 | 3 | [] | no_license | def replaceBlank(strList):
return strList.replace(' ','%20')
if __name__ == '__main__':
print(replaceBlank('a b c d')) | true |
2bbb529a7a917d27f367835cdda2e503deecc38b | Python | ms0695861/password | /pwd.py | UTF-8 | 305 | 3.59375 | 4 | [] | no_license | #Password retry
password = '123456a?'
i = 3 # The max times u can enter pwd.
while i > 0:
i = i - 1
pwd = input('Please enter your password: ')
if pwd == password:
print('login sucess!')
break
elif i == 0:
print('login failed')
else:
print('WRONG!! You have ', i, 'times chances')
| true |
abb8bac380c5eb5889272f15133e949c50f2f7ba | Python | jercas/offer66-leetcode-newcode | /toTheMoon/leetcode_014_LongestCommonPrefix.py | UTF-8 | 3,267 | 4.09375 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Wed May 15 15:30:41 2019
@author: jercas
"""
"""
leetcode-14: 最长公共前缀 EASY
'字符串'
编写一个函数来查找字符串数组中的最长公共前缀。
如果不存在公共前缀,返回空字符串 ""。
"""
"""
Thinking:
0.Python特性-字符串排序解法:Python中字符串按照ascII码排序,如sorted(['abb','aba','abac']) -> ['aba','abac','abb'] -> min:aba, max:abb;
在此基础上,只... | true |
8ac4321fce76a79dde959688c641dff1b52aeff3 | Python | bhargavpanth/Spark-Experiments | /movie_similarity.py | UTF-8 | 3,867 | 2.875 | 3 | [] | no_license | import sys
from pyspark.sql import SparkSession
from pyspark.sql.types import StructType, StructField, StringType, IntegerType, LongType
from pyspark.sql import functions as func
spark = SparkSession.builder.appName('movie_similarities').master('local[*]').getOrCreate()
def movie_name_schema():
return StructType... | true |
62f6a2bcfee69fe6b88ced202b0feeae37e9d7e5 | Python | rahlin1004/sc-projects | /Assignment3/breakout.py | UTF-8 | 1,144 | 3.109375 | 3 | [
"MIT"
] | permissive | """
Name: Sarah
stanCode Breakout Project
Adapted from Eric Roberts's Breakout by
Sonja Johnson-Yu, Kylie Jue, Nick Bowman,
and Jerry Liao
YOUR DESCRIPTION HERE
"""
from campy.gui.events.timer import pause
from breakoutgraphics import BreakoutGraphics
FRAME_RATE = 1000 / 120 # 120 frames per second.
NUM_LIVES = 3
... | true |
eebbdfff16f0dff6423dea44169e46dda8d8097b | Python | Beheroth/Smallworld | /gamestate.py | UTF-8 | 3,032 | 3.359375 | 3 | [] | no_license | from random import randint
#from race import Race, Power
from map import Map
from abc import ABC, abstractmethod
from civilisation import Civilisation, Race, Power
class Strategy(ABC):
@abstractmethod
def pickciv(self, gamestate) -> int:
pass
class User(Strategy):
def __init__(self, player):
... | true |
73a8dcc4279dec7805adc7d13d55cf7a54d47cf9 | Python | reevesba/computational-intelligence | /projects/project3/src/max_func/individual.py | UTF-8 | 2,994 | 3.46875 | 3 | [] | no_license | ''' Function Maximization Individual
Author: Bradley Reeves, Sam Shissler
Date: 05/11/2021
'''
from numpy import random
from max_func.mf_fitness import MaxFuncFitness
from typing import List, TypeVar
# Custom types
Individual = TypeVar("Individual")
class Individual:
def __init__(self: Indiv... | true |
2b8473f61517cc557a6479cc06f111cef4658c8b | Python | CastleWhite/LeetCodeProblems | /1574.py | UTF-8 | 442 | 3.09375 | 3 | [] | no_license | class Solution:
def findLengthOfShortestSubarray(self, arr: List[int]) -> int:
b = []
n = len(arr)
for i in range(1, n):
if arr[i] < arr[i-1]:
b.append(i)
if not b: return 0
res = b[-1]
j = n-1
for i in range(b[0]-1, -1, -1):
... | true |
ea636949ffe170b7616498aa901ea87c483ffc4d | Python | VINCENT101132/vincent1 | /20210710/homework/1.py | UTF-8 | 376 | 3.734375 | 4 | [] | no_license | """
Topic:輸入分子及分母,確認是否等於 350/450:
Show:Please input numerator"
Input1:70
show:Please input Denominator:
Input2:90
Output:True
Input1:6
Input2:9
Output:False
"""
numerator=int(input('please input numerator'))
denominator=int(input("please input denominator"))
if(numerator/denominator)==(350/450):
print('True')
... | true |
1982a83703059c0173dc6dfe6e53439242f9e4a5 | Python | stanyu2013/Team-Zero---Data-Science-Futures-Hackathon | /gdeltDates.py | UTF-8 | 998 | 2.84375 | 3 | [] | no_license |
import csv
import gdelt
import json
import re
# Version 2 queries
gd2 = gdelt.gdelt(version=2)
datepat=re.compile("201[5-7]-[0-9-]+$")
with open('extracted_dates.csv', 'rb') as csvfile:
reader = csv.reader(csvfile, delimiter=",")
for row in reader:
name=row[0]
date=row[1]
if datepat.... | true |
2671d0a659ec945ee58532ae67c8640ec5901bf9 | Python | juanpabloalfonzo/PHY224 | /Radius of the Earth/GravRadius.py | UTF-8 | 2,572 | 3.515625 | 4 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
def radius(floor, slope, intercept): #Define the curve fit with parameters needed to construct a linear trend
return slope*floor + intercept
def chi(y_i,y_x,sigmai): #Where y_i are dependent variables, y_x is the line ... | true |
b0b7a5823a725a14dea03f02f6061d19003203d5 | Python | 478855960/Plants_V.S._Zombies | /entity/bullet.py | UTF-8 | 608 | 3.34375 | 3 | [] | no_license | import pygame
class Bullet(object):
def __init__(self, screen, image, peaX, peaY, type):
self.screen = screen
self.image = pygame.image.load(image)
# x,y
self.x = peaX
self.y = peaY
self.width = self.image.get_rect()[2]
self.height = self.image.get_rect()[3]
... | true |
15257f0d612c2790921c31992dd72e54a80baaef | Python | FarbrorGao/point_cloud_compression_test | /draco_test/compare.py | UTF-8 | 1,291 | 3.5 | 4 | [] | no_license | import csv
def compare(input, output):
input.sort()
output.sort()
# print(input)
# print(output)
print("# of input:", len(input))
print("# of output:", len(output))
if(len(input) != len(output)):
print('The lengths of input and output are not equal')
exit(0)
diff = []
count = 0
for i in range(0, len(inpu... | true |
4d99d1cea7bdd19b628d98f358898b3f0ace32dd | Python | Jaafoub/Backtest-Framework | /asset_variables.py | UTF-8 | 759 | 3.1875 | 3 | [] | no_license | import pandas as pd
import numpy as np
from yahoo_data import *
def compute_daily_return( df ):
ret = df / df.shift( 1 ) -1
return( ret )
def compute_daily_return_yahoo( ticker, start_date, end_date ):
data = yahoo_stock_data_ticker( ticker, start_date, end_date )
close = data['Close']
return( com... | true |
17721abd6ab291a2938cdbaf9c682bc5bbe596d2 | Python | shubhamgupta16/Python_Programs | /51_greatest.py | UTF-8 | 373 | 3.953125 | 4 | [] | no_license | # find greatest number between three number
def greatest(a,b,c):
if a > b and a > c:
return a
elif b > a and b > c:
return b
else:
return c
num1 = int(input("enter first number: "))
num2 = int(input("enter second number: "))
num3 = int(input("enter third number: "))
prin... | true |
3679568b5cb8b482e4fa5ec290735d921e7bb05c | Python | SorianoJuan/ProgConcurrente-UNC | /src/test_t_invariantes.py | UTF-8 | 1,147 | 2.953125 | 3 | [] | no_license | import re
def checkTInvariant(f, inv):
exp = re.compile('(?<=Transicion disparada: ).+')
aux = list()
for line in f:
transition = exp.search(line).group(0)
if(transition in inv):
aux.append(inv[transition])
inv_size = len(inv)
list_size = len(aux)
status = True
... | true |
894dee8cf8f77dd810b4a4528a424ed3f291cfc9 | Python | Winnerabalogu/py_demo | /derrick_toutorial/file.py | UTF-8 | 533 | 3.296875 | 3 | [] | no_license | # import sys
#find the index of a value
# print(name.find("weda"))
# print(name.replace("weda", "weather"))
#create / open a file
# text_file = open("test.txt", "wb")
# text_file.write(bytes("ill get ther soon\n" 'UTF-8'))
# text_in_file = text_file.read()
# print(text_in_file)
name = ('david coldshot\n''ayo ogunbiyi... | true |
f98a3dd1a67185c6174dcfa4ad072a3eb2338e1c | Python | devm1023/GeekTalentDB | /src/nuts_to_geojson.py | UTF-8 | 2,270 | 2.734375 | 3 | [] | no_license | '''
Converts NUTS data to GeoJSON for insights
'''
import json
import csv
import shapely.geometry as geo
import conf
from nuts import NutsRegions
countries = [
'AT', 'BE', 'BG', 'CH', 'CY', 'CZ', 'DE', 'DK', 'EE', 'EL', 'ES', 'FI', 'FR', 'HR',
'HU', 'IE', 'IS', 'IT', 'LI', 'LT', 'LU', 'LV', 'ME', 'MK', 'MT',... | true |
925f259058956b0f7a86eff86d2737a0c312377d | Python | RollingBear/pyQT | /darw/drawingText.py | UTF-8 | 929 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# 2019/3/12 0012 上午 10:35
__author__ = 'RollingBear'
import sys
from PyQt5.QtWidgets import QWidget, QApplication
from PyQt5.QtGui import QPainter, QColor, QFont
from PyQt5.QtCore import Qt
class Example(QWidget):
def __init__(self):
super().__init__()
self.ini... | true |
f5b5fcb38a402fdbcff3b18d6dc7d979884f5cb6 | Python | tousifeshan/WebScrapping | /search_process_names_in_shouldiremoveitdotcom.py | UTF-8 | 3,854 | 2.6875 | 3 | [] | no_license | __author__ = 'tousif'
import requests
import json
from time import sleep
import urllib
from lxml import html
import csv
import unicodedata
inputfile=open('process_list.csv', 'rt')
# Output Files
outputfile=open('complete_process_list_with_number_of_results.csv','wt')
oneresultfile= open('process_list_with_one_resul... | true |
d6f6fc462eb274b4c2ef2dd23f19185c4b1a853f | Python | chdoig/Smashfast | /smashfast.py | UTF-8 | 3,810 | 3.546875 | 4 | [] | no_license | from sys import exit
from random import randint
class Scene(object):
def enter(self):
print "This scene is not yet configured. Subclass it and implement enter()."
exit(1)
class Engine(object):
def __init__(self, scene_map):
self.scene_map = scene_map
def play(self):
curr... | true |
6024720ad09639256d375f4ac02072ffadbca39d | Python | yipenglai/Chinese-Word-Representation | /eval.py | UTF-8 | 2,528 | 3.171875 | 3 | [] | no_license | """Evaluate learned word representation on word similarity task"""
import sys
import os
import logging
import argparse
import numpy as np
import pandas as pd
from fasttext import load_model
from scipy.stats import spearmanr
from tqdm import tqdm
from convert_subchar import convert_graphical as graphical
from convert_su... | true |
6eb75a005124fbda42e0ffab2fba61aca8aac1d4 | Python | washingtoncandeia/PyCrashCourse | /09_Classes/fvm9.13.py | UTF-8 | 770 | 4.15625 | 4 | [] | no_license | ##-------------------------------
# Cap.9 - Classes
# Python Crash Course
# Autor: Washington Candeia
# Faça você mesmo, p.251
# 9.13 - Reescrevendo o programa com OrderedDict
##-------------------------------
from collections import OrderedDict
glossario = OrderedDict()
glossario['instanciar'] = 'atribuir comportam... | true |
e9126d4fdef8e3ccdd79d74c283407b1dcf0fa09 | Python | ahmed789-dev/capstone-project | /backend/test_app.py | UTF-8 | 5,804 | 2.609375 | 3 | [] | no_license | import os
import unittest
import json
from flask_sqlalchemy import SQLAlchemy
from app import create_app
from models import setup_db, Movies, Actors
class CapstonProjectTestCase(unittest.TestCase):
def setUp(self):
# Define test variables and initialize app.
self.app = create_app()
self.cli... | true |
7b393b1f5808424f965e1fd65e943a9ecd1707a6 | Python | diana-md/Data-Analytics-Bootcamp-Projects | /10.WebScraping/scrape_mars.py | UTF-8 | 2,840 | 2.5625 | 3 | [] | no_license | import pandas as pd
import requests
from bs4 import BeautifulSoup as bs
from splinter import Browser
import flask
def scrape():
scrape_dict = {}
# Open Browser
executable_path = {'executable_path': '/usr/local/bin/chromedriver'}
browser = Browser(
'chrome', **executable_path, headless=False)
... | true |
117d4b44f04c7adf3e5ce3f22324adf7a967a378 | Python | fastso/learning-python | /atcoder/contest/solved/abc153_e.py | UTF-8 | 342 | 2.703125 | 3 | [] | no_license | h, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
a = [_[0] for _ in ab]
inf = float('inf')
dp = [inf] * (h + max(a) + 1)
for i in range(1, len(dp)):
for x, y in ab:
if i - x > 0:
dp[i] = min(dp[i], dp[i - x] + y)
else:
dp[i] = min(dp... | true |
92f8b44e102a6adc1889c05892804f657ca4fe25 | Python | alon-albalak/TLiDB | /dataset_preprocessing/DailyDialog/generate_instance_ids.py | UTF-8 | 3,549 | 2.515625 | 3 | [
"MIT"
] | permissive | import json
TASK_TYPE_MAP={
"emotion_recognition": "utt_level_classification",
"dialogue_act_classification": "utt_level_classification",
"topic_classification": "dial_level_classification",
"causal_emotion_span_extraction": "span_extraction",
"causal_emotion_entailment": "causal_emotion_entailment... | true |
ce23d0ce1f278a6e08bbf5216d09739b04ba3069 | Python | CaimeiWang/python100 | /001.py | UTF-8 | 271 | 3.671875 | 4 | [] | no_license | #encoding:'utf-8'
#有四个数字:1、2、3、4,能组成多少个互不相同且无重复数字的三位数?各是多少?
for i in range(1,5):
for j in range(1,5):
for k in range(1,5):
if(i!=j and i!=k):
print(i,j,k)
| true |
8421df571a6b2c972bd1854e3710755c9c112b77 | Python | berquist/sgr_analysis | /sgr_analysis/analysis.py | UTF-8 | 33,133 | 2.546875 | 3 | [
"BSD-3-Clause"
] | permissive | """analysis.py: Where most of the analysis for the 'droplet' snapshots
is.
"""
import pickle
import csv
from copy import deepcopy
from functools import partial
import numpy as np
import scipy.stats as sps
from sgr_analysis.analysis_utils import filter_snapshots, get_single_snapshot_results, mangle_dict_keys, pprint... | true |
47800d8e5051709fc38e048e747450d7f29557c9 | Python | svrswetha/Python | /hello.py | UTF-8 | 238 | 2.6875 | 3 | [] | no_license | from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__=="__main__":
print "i am running as an independent program"
app.run()
else:
print "i am running as an imported module"
| true |
a06320efdf9a561ae5449ceb3e1f9d39556d1c8f | Python | jagatheeswari21/Python-programming | /Beginner/max among 10 num.py | UTF-8 | 87 | 2.6875 | 3 | [] | no_license | input=raw_input().split()
if len(input)==10:
input=map(int,input)
print max(input)
| true |
57756c6ce2aad037eabce9a9d52bc976506b9183 | Python | alexandraback/datacollection | /solutions_5708921029263360_0/Python/Spelvin/c.py | UTF-8 | 1,565 | 2.90625 | 3 | [] | no_license | def outfitlistmaker(j,p,s):
output = []
for x in range(1,j+1):
for y in range(1,p+1):
for z in range(1,s+1):
output.append([x,y,z])
return output
def countmatrix(c,d):
outputx = []
for x in range(c):
outputy = []
for y in range(d):
outputy.append(0)
outputx.append(outputy)
retur... | true |
bdb730ab8238953a55a8143c03edc3ed197405b4 | Python | yevfurman/Rosalind | /LCSM.py | UTF-8 | 818 | 2.90625 | 3 | [] | no_license | def long_substr(data):
substr = ''
if len(data) > 1 and len(data[0]) > 0:
for i in range(len(data[0])):
for j in range(len(data[0])-i+1):
if j > len(substr) and is_substr(data[0][i:i+j], data):
substr = data[0][i:i+j]
return substr
def is_substr(find,... | true |
582d8b3013b80dbd43c44be17be78b8c9c247d62 | Python | steve98654/ProjectEuler | /392.py | UTF-8 | 329 | 2.703125 | 3 | [] | no_license | import cvxpy as cp
import numpy as np
# Problem data.
n = 10
# Construct the problem.
x = cp.Variable(n)
obj = cp.Minimize(cp.sum_entries([(x[i] - x[i-1])*cp.sqrt(1-x[i]**2) for i in range(1,n)]))
consts = [x[0] == -1, x[-1]==1]
consts = [x[i] > x[i-1] for i in range(1,n)]
prob = cp.Problem(objective, constraints)
... | true |
c0e6fa0cffcf483fd750b2927e729ca6a6abb199 | Python | Anusha2605/terraform-aws-tech-test | /instance_status.py | UTF-8 | 1,217 | 2.78125 | 3 | [] | no_license | import boto3
import datetime
import time
from datetime import datetime as dt
from pprint import pprint
def lambda_handler(event, context):
# Connect to EC2 and DynamoDB client
client = boto3.client("ec2")
dynamodb = boto3.resource('dynamodb')
#Get EC2 instance statuses
status = client.describe_insta... | true |
246be67dbbc743ebf770ee337705d65f1409507b | Python | chris4540/DT2119 | /lab3/lab1_proto.py | UTF-8 | 8,746 | 3.421875 | 3 | [] | no_license | """
DT2119, Lab 1 Feature Extraction
See also:
https://haythamfayek.com/2016/04/21/speech-processing-for-machine-learning.html
"""
import numpy as np
import scipy
import scipy.signal
from scipy import fftpack
from lab1_tools import trfbank
from lab1_tools import lifter
# Function given by the exercise ---------------... | true |
f5e00a7cda5d3a8c9ae3aa9ed14deb50e848596a | Python | NAVEEN-LUCIFER/Letsupgrade-python | /ass-1.1.py | UTF-8 | 1,436 | 3.453125 | 3 | [] | no_license | print("------------------------------------LIST------------------------------------------------------")
a=["cricket","bike","food"]
print("MAIN LIST",a)
a.append("LOVE")
print("APPEND",a)
a.extend(["GOOD","BAD"])
print("EXTEND",a)
a.insert(2,"Friendship")
print("INSERT",a)
a.pop(1)
print("POP",a)
a.reverse()... | true |
be7f821102c7d2a9674ca403b4694477a356fe62 | Python | museRhee/basicPython | /ageCheck.py | UTF-8 | 188 | 4.34375 | 4 | [] | no_license | '''
input age and print if age is 20 and over.
'''
#input age
age = int(input("How old are U? "))
#print result
if (age>=20):
print("U are an adult")
else:
print("U are a baby")
| true |
82027dcda722dd797a7983f2735d78ea88daf087 | Python | mrcgndr/weathercrawler | /utils/visualize.py | UTF-8 | 1,125 | 2.859375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from .weatherfilestack import WeatherFileStack
def plotTemperature(wstack: WeatherFileStack, unit: str, feelslike: bool):
assert unit in ["celsius", "fahrenheit"], "Unknown degree unit. Choose 'celsius' or 'fahrenheit'"
time = [f.current.obs_d... | true |
e4ac538229157df6ecedb37089b68eb108fcfc71 | Python | jsevamo/RayTracerTest | /Main.py | UTF-8 | 10,431 | 3.015625 | 3 | [
"MIT"
] | permissive | # /*******************************************************
# * 2020 Juan Sebastián Vargas Molano j.sevamo@gmail.com
# *******************************************************/
# https://github.com/Keeeweee/Raytracing-In-One-Weekend-in-Python Add randomInUnitSphere method
# TODO: CHECK HOW Hit_Records ARE BEING HANDLED... | true |
c60d4c6dbb93e68fc1849bb2d8728b046b5698c4 | Python | EmersonDantas/SI-UFPB-IP-P1 | /Exercícios-Lista4-Comando condicional-IP-Python/Lista4-Lvr-Pag84-E4.10.py | UTF-8 | 632 | 3.375 | 3 | [] | no_license | # EMERSON DANTAS S.I IP-P1
consumo = float(input('Digite o consumo de energia em kWh:'))
tipo = str.lower(input('Digite o tipo de instalação conforme a tabela abaixo:\nR para Residências;\nI para indústrias\nC para comércios.\n'))
if tipo == 'r':
if consumo > 500:
preco = 0.65
else:
preco = 0.40... | true |
111a1c75c7040c19b7ff62949b2b332a52f700e4 | Python | sunxianfeng/LeetCode-and-python | /problem-solving-with-algorithms-and-data-structure-using-python 中文版/递归/汉诺塔问题.py | UTF-8 | 761 | 3.75 | 4 | [] | no_license | # -*- coding:utf-8 -*-
'''
汉诺塔问题
下面是关于将塔经由中间杆,从起始杆移到目标杆的抽象概述:
1、 把圆盘数减一层数的小塔经过目标杆移动到中间杆
2、 把剩下的圆盘移动到目标杆
3、 把圆盘数减一层数的小塔从中间杆,经过起始杆移动到目标杆
'''
def moveTower(height,fromPole, toPole, withPole):
if height >= 1:
moveTower(height-1,fromPole,withPole,toPole)
moveDisk(fromPole,toPole)
moveTower(heig... | true |
118fe91e57c78db316a3cfb5e1ba622c8382404b | Python | 18786683795/IntelligentSystem | /bpnn_x1x2.py | UTF-8 | 7,891 | 3 | 3 | [] | no_license | #__author__ = 'cuihe'
# coding:utf-8
import math
import random
import BPNN
random.seed(0)
# calculate a random number where: a <= rand < b
def rand(a, b):
return (b-a)*random.random() + a
# Make a matrix I*J filled by fill, default=0.0
def makeMatrix(I, J, fill=0.0):
m = []
for i in range(I):
... | true |
17a681ffc262d5bc5bfa32b5dd29d3cfc803d0cd | Python | natha1601/FaceRecognitionwithFacialLandmarkPython | /fix uji.py | UTF-8 | 1,929 | 2.828125 | 3 | [] | no_license | import pandas as pd
import numpy as np
wine = pd.read_csv('trainingdataxx.csv', names = ["1", "2", "3", "4", "5", "6","7","8", "9",
"10","11", "12", "13","14","15","16","17","18",
"name"])
x_train = wine.drop('name'... | true |
a2cf0100e97e854b1d8aa86b89b0747920a46628 | Python | JannisK89/AdventOfCode2020 | /Day6/part1.py | UTF-8 | 477 | 3.0625 | 3 | [] | no_license |
# https://adventofcode.com/2020/day/6
def countDifferentAnswers(inputFile):
with open(inputFile, 'r') as file:
lines = file.readlines()
group, total = '', 0
for answer in lines:
if answer.strip() != '':
group += answer.strip()
else:
... | true |
414c856b007709f6b3ebcf0990cc508547b13275 | Python | PaulaSena/Python | /script-python/b.py | UTF-8 | 413 | 3.609375 | 4 | [] | no_license | nome=input('Qual é seu nome? ')
idade=input('Qual é a sua idade? ')
peso=input('Qual é a seu peso? ')
print("Seu nome é "+nome," sua idade é de "+idade, " seu peso é de "+peso)
verific=input("Correto? ")
if verific=='sim':
print('Bem Vinda: '+nome)
elif verific=='não':
print('Informe seus dados novamen... | true |
08830c0a725ed97f15a58d1f55f54f678144eb74 | Python | RevathiRathi/Revat | /power.py | UTF-8 | 45 | 2.546875 | 3 | [] | no_license | n,k=map(int,input().split())
s=n**k
print(s)
| true |
b1961c5d69099673ac8616ccbf786d047ebec10e | Python | amnamoh/MiniNN_Modified- | /Modified_MiniNN.py | UTF-8 | 9,817 | 3.359375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[19]:
import numpy
import numpy as np
import numpy.random
numpy.set_printoptions(precision=3, floatmode="fixed")
class MiniNN:
"""
Naming convention: Any self variable starting with a capitalized letter and ending with s is a list of 1-D or 2-D numpy arrays, each elem... | true |
ad3c4fcc9e0b6de04d0a848e12e99112e70cbb14 | Python | karandeepSJ/Robust-Oblivious-Transfer | /NetworkNode.py | UTF-8 | 922 | 2.71875 | 3 | [] | no_license | import random
from TransmissionBlock import TransmissionBlock
from Reconstructor import Reconstructor
class NetworkNode:
def __init__(self, p, g):
self.p, self.g = p, g
def generate_private_key(self):
self.priv_key = random.randint(0, self.p-1)
def generate_public_key(self):
self.... | true |
1760e40f30b68d03c3df0dd26f00f18c5653f407 | Python | claudio1624/Grafico | /Grafico_4en1.py | UTF-8 | 686 | 3.46875 | 3 | [] | no_license | #! /usr/bin/python
# -*- coding: iso-8859-15 -*-
from pylab import *
import matplotlib.pyplot as plt
# import matplotlib import *
import numpy as np
#definimos el periodo de la grafica
periodo = 2
#definimos el array dimensional
x = np.linspace(0, 10, 1000)
#defimos la funcion
y = np.sin(2*np.pi*x/periodo)
... | true |
fc904877d10b45dc4b1b69a94f4eb1ae7bc3257f | Python | eliasssantana/API_activities | /app.py | UTF-8 | 4,636 | 2.890625 | 3 | [] | no_license | from flask import Flask, json,request
from flask_restful import Resource, Api
from flask_httpauth import HTTPBasicAuth
from werkzeug.wrappers import response
from models import People, Activities, Users
auth = HTTPBasicAuth() # crio um objeto do método verificador
app = Flask(__name__) # crio uma instância da classe F... | true |
5ff4bedab0794413fa1302183bda364c8ec41ad7 | Python | JamesGardner1/tictactoe | /main.py | UTF-8 | 3,425 | 3.859375 | 4 | [] | no_license | # This is a basic Tic Tac Toe game where the player plays against the computer
import random
def main():
display_ui()
player_turn()
check_victory()
player_victory()
# Starts new game
gameStillOn = True
playerWins = False
computerWins = False
def newGame():
global gameStillOn
if not gameStil... | true |
a56ba7e8cf84ca3455c222fd7a4a4457f9c83a8a | Python | muratortak/bizmeme-ng | /linkfarmer.py | UTF-8 | 1,440 | 2.5625 | 3 | [] | no_license | import time
from random import shuffle, sample
from re import search, findall
from data import Post
from utils.chandata import ChanBoards
from utils.operations import getThreadIdsFromCatalog, getThread, getCommentsFromThreadAsList, removeHTMLFromComment
import db
boards = ['pol',
'vg',
'v',
... | true |
b146c413568e930eb905a7d918aae392094f2714 | Python | BITMystery/leetcode-journey | /46. Permutations.py | UTF-8 | 593 | 2.96875 | 3 | [] | no_license | class Solution(object):
def backtrack(self, nums, start, path, res):
if len(path) == len(nums):
res.append(path) # leaf
return
for i in xrange(start, len(nums)):
nums[i], nums[start] = nums[start], nums[i]
self.backtrack(nums, start + 1, path + [nums[s... | true |
e1ea7d9eb623406536e5dab73e5d56ea7e26248c | Python | KimSeonBin/algo_practice | /acmicpc/16196.py | UTF-8 | 1,677 | 2.71875 | 3 | [] | no_license | def sol():
st = input()
n = [st[0:6], st[6:14], st[14:17], st[17:18]]
locate = []
check = False
for i in range(0, int(input())):
if n[0] == input():
check = True
if check is False:
return 'I'
if n[2] == '000':
return 'I'
ndate = [n[1][0:4], n[1][4:6... | true |
2997264ddff2839271079968a19d547de8570b3d | Python | jplhanna/TBD | /tree/management/commands/add_movie_data.py | UTF-8 | 2,640 | 3.125 | 3 | [] | no_license | from django.core.management.base import BaseCommand, CommandError
from tree.models import Movie
from parser import MovieParser
#So rather than calling the parser we call manage with a specific function line which will call this. The function should include the location of the file being added
#Parser could be called t... | true |
b6bdf65c38ea60e5d0d5250869af20d4ee1c532d | Python | BeTripTeam/BeTrip_Places_Evaluation | /evluation/PhotoEvaluation.py | UTF-8 | 1,183 | 3.078125 | 3 | [] | no_license | from Images_Beauty.ImageAnalytics import ImageAnalytics
from numpy import array
class PhotoEvaluator:
def __init__(self):
self.images_analyzer = ImageAnalytics()
def evaluate_photos(self, photos):
"""
Gives a mark to photo list according to
- number of photos
-... | true |
cc9b31488e88decee4ce3ed12088e9a23b81688a | Python | JrdnVan/csesoc-personal-projects-competition | /scripts/remove_event.py | UTF-8 | 1,539 | 2.59375 | 3 | [] | no_license | import boto3
from boto3.dynamodb.conditions import Key, Attr
from decouple import Config, RepositoryEnv
DOTENV_PATH = ".env"
env = Config(RepositoryEnv(DOTENV_PATH))
# Call user/event table from AWS
session = boto3.Session(
aws_access_key_id=env.get('AWS_ACCESS_KEY_ID'),
aws_secret_access_key=env.get('AWS_S... | true |
02f15e0217bc56df630c38d4d7edbe3feae39e80 | Python | MinaxiG/Codewars | /Strip_comments.py | UTF-8 | 654 | 3.5 | 4 | [] | no_license | # Question Link: https://www.codewars.com/kata/51c8e37cee245da6b40000bd
def solution(string,markers):
'''Split the string based on newlines'''
diff = string.split('\n')
res = [] #Final result variable
'''If each line contains any markers, append only the initial part of the line else app... | true |
1472faa191e2a6edbb4365e2848230ab89e33404 | Python | jorcuad/weatherStation | /scpdaemon.py | UTF-8 | 7,026 | 2.546875 | 3 | [] | no_license | # !/usr/bin/env python
''' YapDi Example - Demonstrate basic YapDi functionality.
Author - Kasun Herath <kasunh01@gmail.com>
USAGE - python basic.py start|stop|restart
python basic.py start would execute count() in daemon mode
if there is no instance already running.
count() prints a counting number to syslog. ... | true |
4ce798dd960ab82b75a85320331fbf2e20b5f03b | Python | AlexeyBazanov/algorithms | /sprint_3/bracket_generator.py | UTF-8 | 438 | 3.546875 | 4 | [] | no_license | import sys
def generate_brackets(n, counter_open, counter_close, sequence):
if counter_open + counter_close == n * 2:
print(sequence)
if counter_open < n:
generate_brackets(n, counter_open + 1, counter_close, sequence + "(")
if counter_open > counter_close:
generate_brackets(n, cou... | true |
d3f01d431dbf7c57cb50375aa270b962a8c6b17f | Python | heynemann/tornado-geopy | /tests/geocoders/test_google_v3.py | UTF-8 | 3,800 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# tornado-geopy geocoding library.
# https://github.com/heynemann/tornado-geopy
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2013 Bernardo Heynemann heynemann@gmail.com
import sys
from tornado.testing import AsyncTes... | true |
02a214368dec899cecf036f8326675525f8cf0e6 | Python | Walleve/conftracker | /models.py | UTF-8 | 11,817 | 2.625 | 3 | [] | no_license | import sqlite3
import hashlib
import datetime
from sys import platform
if 'linux' in platform:
db = '/var/www/conftracker/db_files/conftracker.db'
else:
db = 'db_files/conftracker.db'
class Schema:
def __init__(self):
self.conn = sqlite3.connect(db)
self.create_conf_table()
self.c... | true |
a6b46d604b87cb3bc4a6d6024f2d2522eb22dce8 | Python | geekquad/Feature-Scaling | /featurescalling.py | UTF-8 | 472 | 2.921875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: geekquad
"""
import numpy as np
def featurescale(input_list, new_min, new_max):
old_min = np.min(input_list)
old_max = np.max(input_list)
old_range = (old_max - old_min)
new_range = (new_max - new_min)
new_list = []
... | true |
8fb1a43e29714d1a8eb4f50d72802c22a6661c08 | Python | liuchengyuan123/ZJU-Homework-on-cifar10 | /test.py | UTF-8 | 2,909 | 2.734375 | 3 | [] | no_license | from os import read
import torch
import torch.nn as nn
from torch.utils.data import DataLoader, Dataset
import argparse
import numpy as np
import pickle
from tqdm import tqdm
import matplotlib.pyplot as plt
# from Model.Resnet import ResNet50
from Model.ResNetWithDropOut import ResNet50WithDropout
def read_data(path... | true |
e118a8df2b1616409ea6e1ac345578e6ddeed621 | Python | 219Winter2019adjz/Project1 | /sandbox/problem6.py | UTF-8 | 3,760 | 2.796875 | 3 | [] | no_license | ########################################################################################################################
# Fetching 20NewsGroups dataset
from sklearn.datasets import fetch_20newsgroups
# Refer to the offcial document of scikit-learn for detailed usages:
# http://scikit-learn.org/stable/modules/generated... | true |
9a119cf9c0d367ff55599af1aa5a7a9c6b7ff8c2 | Python | sankalpsagar/Placement-Practise | /python/username.py | UTF-8 | 419 | 3.09375 | 3 | [] | no_license | Userdict = {}
username_stream = ["a", "a", "a1", "a1", "b", "b", "b", "a21", "a21", "a12"]
assigned = []
for users in username_stream:
# print(users)
if users in Userdict:
Userdict[users]+=1
# print(Userdict[users])
string = users + str(Userdict[users]-1)
# print(string)
assigned.append(string)
Userdi... | true |
3d9ebdb309e2abb255f600f9949e5c315353ce82 | Python | den01-python-programming-exercises/exercise-4-16-payment-card-MrSullivanStCadocs | /src/payment_card.py | UTF-8 | 865 | 3.734375 | 4 | [] | no_license | class PaymentCard:
def __init__(self, opening_balance):
self.opening_balance = opening_balance
def __str__(self):
return str("The card has a balance of " + str(self.opening_balance) + " pounds")
def eat_affordably(self):
if(self.opening_balance - 2.6 >= 0):
self.opening_balance = float(self.o... | true |
eb5ebd81b8e5e0e855b820be7d99c743a5598c27 | Python | linhhv1996/Python | /MergeSort.py | UTF-8 | 478 | 3.5625 | 4 | [] | no_license | def Merge(L,R):
Result = []
i,j = 0,0
while i < len(L) and j < len(R):
if (L[i] < R[j]):
Result.append(L[i])
i += 1
else:
Result.append(R[j])
j += 1
Result += L[i:]
Result += R[j:]
return Result
def MergeSort(A):
if (len(A) <= ... | true |
72ef2bcc5540820fdf06256152d02d70857e8d99 | Python | Manal-Almodala/EE511project2 | /waiting1.py | UTF-8 | 566 | 3.125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import random
from scipy.stats import chisquare
import math
X=[]
for i in range(1, 1001):
X.append((-1/5)*np.log(1-random.random()))
print(X)
data, m, n = plt.hist(X, bins=np.arange(0,3.1,0.1), histtype='bar', edgecolor='r')
plt.xlabel('Xi')
plt.ylabel... | true |
ea2469c792b54c02ed9cf32f63cb64a6f606f3dd | Python | skkoobb/DataMining | /DataMining.py | UTF-8 | 1,723 | 2.78125 | 3 | [] | no_license | __author__ = 'Daniel'
import sys, getopt
from glob import glob
from os import path
import numpy as np
import imagetools
import pywt
from sklearn import svm
def LoadDataFromFolder(folder = '.', ftype = '*.dat'):
filelist = glob(path.join(folder,ftype))
firstpattern = np.loadtxt(filelist[1],dtype=np.float32)
... | true |
9e1a94a545b821ad5814f0e67bceb91ce0736bca | Python | steezkelly/TkInter | /eventcap.py | UTF-8 | 734 | 3.421875 | 3 | [] | no_license | from tkinter import *
import random
root = Tk()
def key(event):
print ("pressed", repr(event.char))
def callback(event):
frame.focus_set()
print ("clicked at", event.x, event.y)
def a_pressed(event):
print("You are love")
def r_pressed(event):
rnum = random.randint(0, 9)
rm = ["I love you", "You ... | true |
b99ec6be8e95c096d0b683206c4561ee3b53ded5 | Python | haoyingl/PythonLearning | /euler2.py | UTF-8 | 659 | 2.9375 | 3 | [] | no_license | #-*- coding:utf-8 -*-
#########################################################################
# File Name: test.py
# Author: Liang Haoying
# mail: Haoying.Liang@nokia-sbell.com
# Created Time: Tue 09 Jan 2018 02:02:20 PM CST
#########################################################################
#!usr/bin/env pytho... | true |
289ecec306dcf2ba6f2781b1c89d035e10edca5c | Python | 4ND4/visage_augmentor | /run.py | UTF-8 | 966 | 2.640625 | 3 | [] | no_license | # obtain MAX DS size
# get MIN DS size
# create augmented images for MIN DS
import os
import Augmentor
image_path = os.path.expanduser('~/Documents/images/dataset/visage_v1.1b/12/')
output_directory = os.path.expanduser('~/Documents/images/dataset/augmented/')
probability = 1
p = Augmentor.Pipeline(
source_di... | true |
61e4bef7be95bdb34a0bd9c5cee14adb6f5d12b5 | Python | ClemenceK/deep4deep | /deep4deep/text_processing.py | UTF-8 | 3,063 | 2.984375 | 3 | [] | no_license | import numpy
import string
import regex
import re
import unidecode
from nltk.corpus import stopwords
from nltk import word_tokenize
from nltk.stem import WordNetLemmatizer, PorterStemmer
#from deep4deep.utils import simple_time_tracker
def remove_numbers(text):
"""
removes numbers from text
text: string... | true |
eeec02d07a013c1f32ecbcc0a5662dbec566c753 | Python | Takuma-Ikeda/other-LeetCode | /src/medium/test_max_increase_to_keep_city_skyline.py | UTF-8 | 676 | 3.15625 | 3 | [] | no_license | import unittest
from answer.max_increase_to_keep_city_skyline import Solution
class TestSolution(unittest.TestCase):
def setUp(self):
self.grid = [
[[3, 0, 8, 4], [2, 4, 5, 7], [9, 2, 6, 3], [0, 3, 1, 0]],
[[0, 0, 0], [0 ,0 ,0], [0, 0, 0]],
]
self.answers = [
... | true |
7bba95e82394cdccf2734e622509bc6c8a3370ed | Python | zlz2013/zlz | /spider_project/spider/day03/05_biji_spider.py | UTF-8 | 1,648 | 2.734375 | 3 | [] | no_license | import requests
from lxml import etree
import time,random
from model_tool.useragents import ua_list
class BijiSpider(object):
def __init__(self):
# 定义常用变量,url,headers及计数等
self.url='http://code.tarena.com.cn/AIDCode/aid1904/15-spider/'
self.auth=('tarenacode','code_2013')
def get_html(s... | true |
cdf2416b8cb2e4e093109ab8a28a195fb92aa987 | Python | TomiyamaSatoshi/FaceAuthApp | /face_learn.py | UTF-8 | 4,327 | 2.6875 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
import sys
import cv2
import os
import configparser
import numpy as np
from PIL import Image
# 引数を取得
args = sys.argv
id = args[1]
# 設定ファイル読み込み
inifile = configparser.ConfigParser()
inifile.read('./config.ini', 'UTF-8')
# 学習画像データ枚数取得変数初期化
sample_cnt = 0
# 学習画像データ保存領域パス情報
learnPath = inifile.g... | true |