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 |
|---|---|---|---|---|---|---|---|---|---|---|
f4b3c7ea2a6a53aef93c69f3dd3c407bba7f3631 | Fondamenti18/fondamenti-di-programmazione | /students/1803284/homework01/program01.py | UTF-8 | 1,330 | 3.921875 | 4 | [] | no_license | '''
Si definiscono divisori propri di un numero tutti i suoi divisori tranne l'uno e il numero stesso.
Scrivere una funzione modi(ls,k) che, presa una lista ls di interi ed un intero
non negativo k:
1) cancella dalla lista ls gli interi che non hanno esattamente k divisori propri
2) restituisce una seconda l... | true |
70b4a4582dd8bf6d5b50c822c322f3fcb6156d37 | kibitzing/FluentPython | /archive/To12-14/12-13/daeha_12-13.py | UTF-8 | 1,799 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" Tensorflow generator example
I'm refer below link:
https://gist.github.com/elgehelge/6c7cd65bd08b71b898fb54eb13ed6f98
"""
import tensorflow as tf
print('tensorflow version is {}'.format(tf.__version__))
def data_generator(start, end):
for x, y in zip(ra... | true |
8e6c90b6296a018c113e98eed684132870979b0d | elyex/elyexPythonPygameEjercicios | /Ejercicio8.py | UTF-8 | 433 | 2.890625 | 3 | [] | no_license | # Fuentes
import pygame
pygame.init()
pantalla=pygame.display.set_mode((480,300))
salir=False
reloj1=pygame.time.Clock()
fuente1=pygame.font.Font(None, 48)
texto1=fuente1.render("HolA @MAUEYX",0,(255,230,245))
while salir!=True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
salir=True
reloj... | true |
5e6c18ff67bdeaf57d24e8b1b2a83461dd486d0c | jesusble/project | /bb.py | UTF-8 | 170 | 3.65625 | 4 | [] | no_license | s=input()
b=0
a=0
for w in s:
if(w.isalpha()==True):
a=a+1
elif(w.isdigit()==True):
b=b+1
if(a>0 and b>0):
print("Yes")
else:
print("No")
| true |
b61ddd163e2b0dae5a2465b9c09be35a5082fc09 | omercelik-cs/tensorflow-image-augmentation | /image_aug.py | UTF-8 | 6,505 | 3.21875 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
from matplotlib import pyplot as plt
import math
# this function adds noise per channel with gaussian distribution
def add_gaussian_noise(img,mean,variance,scale):
# get dimensions and set the noise size
height, width, channel = img.shape[0],img.shape[1],img.shape[... | true |
50be37fc9e6de19ef1286030439e0334e727ce65 | ttungl/Coding-Interview-Challenge | /source-code/Median of Two Sorted Arrays 4.py | UTF-8 | 1,411 | 4.0625 | 4 | [
"MIT"
] | permissive | # 4. Median of Two Sorted Arrays
# ttungl@gmail.com
# There are two sorted arrays nums1 and nums2 of size m and n respectively.
# Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).
# Example 1:
# nums1 = [1, 3]
# nums2 = [2]
# The median is 2.0
# Example 2:
# nums1 = [1... | true |
d10fab77bf7808909dbb0719d219bef8a83a210e | PNapi90/PreAna | /zFitter.py | UTF-8 | 2,711 | 2.734375 | 3 | [] | no_license | from matplotlib.ticker import LinearLocator, FormatStrFormatter
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt
import scipy.optimize as opt
plt.close("all")
from matplotlib import rc
rc('text', usetex=True)
def gaussian_2d(xy_mesh, amp, xc, yc, ... | true |
b030cbd60c3db225b9532aa61e7fc70248e48d32 | mremreozan/JAVA-and-Python | /Python/Hackerrank/992 Text Wrap.py | UTF-8 | 401 | 3.09375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 8 23:23:38 2020
@author: Emre Ozan
"""
import textwrap
def wrap(string, max_width):
return '\n'.join(textwrap.wrap(string, max_width))
if __name__ == '__main__':
string, max_width = input(), int(input())
result = wrap(string, max_width)
print(result)
... | true |
a08cc2ab0d9f8649e7fc02c77039c16ca1e655aa | Andrey178/Stepik1 | /3.7.5.py | UTF-8 | 555 | 2.734375 | 3 | [] | no_license | dicClasses = {}
with open('D:\\Programming\\dataset_3380_5.txt') as inf:
for i in inf.readlines():
list = i.strip().split('\t')
for i in range(len(list)):
if list[i].isdigit():
list[i] = int(list[i])
if list[0] not in dicClasses:
dicClasses.setdefault(... | true |
7ce6f4b5b6ef0fd2c0343892e31a995e3420be34 | dhrunlauwers/plotly-experiment | /app.py | UTF-8 | 7,447 | 2.734375 | 3 | [] | no_license | import dash
import dash_html_components as html
import dash_core_components as dcc
import dash_bootstrap_components as dbc
import plotly.graph_objects as go
import plotly.express as px
from dash.dependencies import Output, Input
import numpy as np
import pandas as pd
from src.optimization import optimize_portfolio
#--... | true |
9d12249847699388d849e4d63e90ab695b1a7f93 | yoniblumenfeld/CasaBonita | /CaseBonita/Infrastructure/DB/MongoDB/Connector.py | UTF-8 | 1,903 | 2.84375 | 3 | [] | no_license | from datetime import datetime
import pymongo
from CaseBonita.Data.Database import MongoDB
class MongoConnector:
_connection = None
def __init__(self, db=MongoDB.RODO_DB):
self._db = db
@property
def connection(self):
"""
:rtype: pymongo.MongoClient:
"""
if sel... | true |
77e335ebf1a1a8b772f7b2e05db2f8bbf0e495b9 | zangguojun/Algorithm | /AcWing/4、双指针/最长连续不重复子序列.py | UTF-8 | 749 | 3.703125 | 4 | [
"MIT"
] | permissive | """
给定一个长度为n的整数序列,
请找出最长的不包含重复数字的连续区间,输出它的长度。
-----------
第一行包含整数n。
-----------
第二行包含n个整数(均在0~100000范围内),表示整数序列。
-----------
共一行,包含一个整数,表示最长的不包含重复数字的连续子序列的长度。
-----------
5
1 2 2 3 5
-----------
3
"""
n = int(input())
alist = list(map(int,input().split()))
setList = [0] * 100000
def findMax(q, n, s):
j = 0
res ... | true |
d01ed9c6ecc5dbbf0cc1326eb91e288961f81d72 | huangchunhui521/fuxiutang | /Other/case3.py | UTF-8 | 206 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @File:
# @Time :
# @Author :
# @Detail : 善行
a={"code":0}
b={"code":1,"body":22}
aa=set(a.items())
bb=set(b.items())
print(aa.issubset(b.items()))
print(aa.issubset(bb)) | true |
7467cb050fa74b2fe2a6ed9f50e30e3dd5fb4c8d | Remoterwls/ui-autotest | /testCase/test_B_membershipFunction/test_a_consumerManage.py | UTF-8 | 2,725 | 2.5625 | 3 | [] | no_license | import unittest
from selenium import webdriver
from pages.menbershipFunction_page.membership_page import MemberShipPage
from public.data_generate import DataGenerate
from pages.registerLogin_page.login_page import LoginPage
from public.ele_manage import EleManage
import time
class MemberShip(unittest.TestCase):
"... | true |
9156609b685c04e8ebdd14ed0f6a6bcbad61c9c0 | junbinding/algorithm-notes | /bfs.find-largest-value-in-each-tree-row.py | UTF-8 | 1,059 | 3.625 | 4 | [] | no_license | from typing import List
from collections import deque
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
"""
515. 在每个树行中找最大值
https://leetcode-cn.com/problems/f... | true |
aa955f8e8cd6e889279913b8bca0311fe9bd9923 | zorga/python | /divers/socks.py | UTF-8 | 406 | 2.96875 | 3 | [] | no_license | import sys
def main():
n = int(raw_input().strip())
c = map(int, raw_input().strip().split(' '))
shop = {}
count = 0
for sock in c:
if sock not in shop:
shop[sock] = 1
else:
if (shop[sock] % 2 != 0):
count = count + 1
shop[sock] ... | true |
5bb3c66243bc7e3d6f51580f96cdb7ac5801210c | Jason-Cooke/Recognizers-Text | /Python/libraries/recognizers-text/recognizers_text/extractor.py | UTF-8 | 1,046 | 3.015625 | 3 | [
"MIT"
] | permissive | from abc import ABC, abstractmethod
from typing import List
class ExtractResult:
def __init__(self):
self.start: int = None
self.length: int = None
self.text: str = None
self.type: str = None
self.data: object = None
@property
def end(self):
return self.sta... | true |
198a068ec9fc4993cbdc33d6ec715f75b9aa6038 | SeanSyue/PythonReferences | /python_system/files/open_write_flush_close.py | UTF-8 | 314 | 3.359375 | 3 | [
"MIT"
] | permissive | conf_writer = open('Output.txt', mode='a', encoding='utf-8')
conf_writer.write("something to write")
conf_writer.flush()
conf_writer.close()
# -- Alternative expression: --
with open('Output.txt', mode='a', encoding='utf-8') as conf_writer:
print("something to write", file=conf_writer, flush=True)
| true |
c3ba9c3940449840a5819c43ddd69d0a065b302a | KyraZYL/SpaceHub | /spacehub.py | UTF-8 | 26,553 | 2.796875 | 3 | [] | no_license | import pygame as pg
from pygame.locals import *
import math
import unicodedata
pg.init()
window = pg.display.set_mode((800,800)) # size of the screen
pg.display.set_caption("Space Hub - The simulation of the solar system")
pg.font.init()
sun_x = 400
sun_y = 400
sun_r = 50
planet_v = 0
# variables for planets
# M... | true |
ba98159b21dff5fbe688d96b073b72c008487d8d | BruceLHH/tedu_month2 | /moth1/day11/task.py | UTF-8 | 3,811 | 3.296875 | 3 | [] | no_license | """
"""
class Master:
def __init__(self,master,kongfu):
self.master = master
self.kongfu = kongfu
@property
def master(self):
return self.__master
@master.setter
def master(self,teacher):
self.__master = teacher
@property
def kongfu(self):
return sel... | true |
8caeb305f9c3b7556fd13ab2eb07b0ad6c858c49 | suyash248/ds_algo | /Tree/maximumWidth.py | UTF-8 | 1,682 | 3.765625 | 4 | [
"Apache-2.0"
] | permissive | from Tree.commons.commons import insert
from Tree.treeHeight import calculate_height
from Array import empty_1d_array
# Time Complexity: O(n)
# Space Complexity: O(n)
def maximum_width_using_level_order_traversal(root):
from queue import Queue
q = Queue()
q.put(root)
max_width = 0
while not q.empty... | true |
e01c3e6415712679e037d12c06b7a1d3d1834b1f | rubensan112/Varios | /NewTFG/data_treatment/8 - GS, VX, VY, FL.py | UTF-8 | 1,340 | 2.796875 | 3 | [] | no_license | import pandas as pd
import numpy as np
from datetime import datetime
import matplotlib.pyplot as plt
from numpy import cov
from scipy.stats import pearsonr, chisquare
from scipy.stats import spearmanr
from matplotlib import pyplot
import re
import researchpy as rp
from statsmodels.formula.api import ols
from numpy i... | true |
56838c6c452e26924d048758eb9078971cb8afa6 | zhengheng36/PythonTests | /180110_Python_BuiltInModule_2_Collections.py | UTF-8 | 1,586 | 3.484375 | 3 | [] | no_license | ## ref: https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/001431953239820157155d21c494e5786fce303f3018c86000
## a fixed tuple/ a class with only members not methods
from collections import namedtuple
Point = namedtuple('Point', ['x', 'y'])
p1 = Point(1, 3)
p2 = Point(-1, 5)
print('p... | true |
6cb559b5ef2483d3bd6256fb9a906aa6d69dbd77 | achmand/ari5123_assignment | /src/lucrum/algo/controller.py | UTF-8 | 1,905 | 2.890625 | 3 | [
"MIT"
] | permissive | """Base class inherited by trading strategies/algorithms."""
# Author: Dylan Vassallo <dylan.vassallo.18@um.edu.mt>
###### importing dependencies #############################################
from abc import ABC, abstractmethod
###### base trading algorithm class #######################################
class _Contro... | true |
c9a5345c1c268e889437756e310a8fe68d0df28b | cterrelljones/Founders_Square_Security | /face_detection_project/face.py | UTF-8 | 848 | 2.546875 | 3 | [] | no_license | import numpy as np
import cv2
import random
import time
import keyboard
face_cascade = cv2.CascadeClassifier('face_detection_project/cascades/data/haarcascade_frontalface_alt2.xml')
cap = cv2.VideoCapture(0)
rand = time.time()
while(True):
ret,frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGRA2GR... | true |
db74d44f00c4d140050a3207f87161d4c2fba073 | creare-com/podpac | /podpac/datalib/intake_catalog.py | UTF-8 | 7,275 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | from __future__ import division, unicode_literals, print_function, absolute_import
import logging
import datetime
import traitlets as tl
import numpy as np
# Helper utility for optional imports
from lazy_import import lazy_module
# Internal imports
import podpac
from podpac import Coordinates
from podpac.utils impo... | true |
5836a0ced582e33325b04fc82d0a56de1eae3aaa | srj737/sbailie-aoc-2020 | /day21.py | UTF-8 | 4,555 | 2.984375 | 3 | [] | no_license | import logging
import sys
import re
import ingest_file
logging.basicConfig(stream=sys.stdout, level=logging.INFO,
format='%(levelname)s: %(asctime)s.%(msecs)03d - %(message)s', datefmt='%m/%d/%Y %I:%M:%S')
class Menu:
def __init__(self, data_input):
allergens, ingredients = [], []
... | true |
1dfc5b50d7b72e0112904c884bdc31701760aac8 | shashank3959/one-shot-siamese | /model.py | UTF-8 | 3,918 | 3.09375 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
class SiameseNet(nn.Module):
"""
A Convolutional Siamese Network for One-Shot Learning [1].
Siamese networts learn image representations via a supervised metric-based
approach. Once tuned, their learned features can be leveraged for o... | true |
1452b19003f0676925d6f01021fc10453c12680d | jwds123/leetcode | /数学/回文对336.py | UTF-8 | 3,262 | 3.625 | 4 | [] | no_license | '''
给定一组唯一的单词, 找出所有不同 的索引对(i, j),
使得列表中的两个单词, words[i] + words[j] ,可拼接成回文串。
'''
class Solution(object):
def palindromePairs(self, words):
"""
:type words: List[str]
:rtype: List[List[int]]
"""
wmap={}
for i,word in enumerate(words):
wmap[word[::-1]]=i
... | true |
3f3b87ab380fd8d71854d12685f9fe4e3454e468 | bxnxiong/Lint-Code | /Binary Search/104 mergeKLists.py | UTF-8 | 1,245 | 3.796875 | 4 | [] | no_license | """
Definition of ListNode
class ListNode(object):
def __init__(self, val, next=None):
self.val = val
self.next = next
"""
class Solution:
"""
@param lists: a list of ListNode
@return: The head of one sorted list.
"""
def mergeKLists(self, lists):
# write your code here
... | true |
ec85a1686cbd0efeb8633f19f10f34a5740e2ff9 | Petivip/pythonGui | /app.py | UTF-8 | 1,122 | 3.03125 | 3 | [] | no_license | import tkinter as tk
import requests
def get_weather(city):
weather_key = '958258f9b352314c08308cb3d849fb35'
url = "http://api.openweathermap.org/data/2.5/weather"
params = {'APPID': weather_key, 'q': city, 'units': 'imperial'}
respo = requests.get(url, params=params)
label['text']=respo.json()['... | true |
baf74921183de132526c81396efb3fa9b69a0aeb | yangyraaron/data_mining | /classification/bayes_classifier.py | UTF-8 | 4,636 | 3.375 | 3 | [] | no_license | """
bayes classification module
"""
class BayesClassifier(object):
"""
classifier classifies only one file
"""
def __init__(self, training_file_paths, test_file_path, data_format):
"""
initialization
"""
self._training_file_paths = training_file_paths
self._test... | true |
3288f5f8e6039f953a7a739bc3d45cd564ad58e8 | RailanderJoseSantos/Python-Learnning | /ex027.py | UTF-8 | 248 | 3.75 | 4 | [] | no_license | nome = str(input('Informe seu nome completo:')).strip()
nome = nome.split() # divide em substrings
qttString = len(nome) -1 # passa quantas strings foram criadas
print('Primeiro nome: {}, último nome: {}'.format(nome[0], nome[qttString]))
| true |
1722a6743f2e00d5d8093d6bc78eb8b279318f85 | PuercoPop/EleccionesPeru | /Crawler/utils.py | UTF-8 | 1,071 | 2.65625 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import constants
def compose_url(place_type):
if place_type == 'region':
suffix = 'extras/provincias.php'
elif place_type == 'provincia':
suffix = 'extras/distritos.php'
elif place_type == 'distrito':
suffix = 'extras/locales.p... | true |
0e99559fac7fd8dcabc88f33a6c2357274871295 | RohitPingale/SIP-Assignmnet | /Filter_GUI.py | UTF-8 | 8,603 | 2.765625 | 3 | [] | no_license | import streamlit as st
import cv2
from PIL import Image
import time
from io import BytesIO
import numpy as np
class smoothingFilters():
def __init__(self,image,K = 3, P= None):
self.k = K
self.image = image
self.P = P
self.outputimage = None
def trimmedMean(self,array):
... | true |
e1ead8effa011079f2c6a1edb76cf39cd6a4f43a | nspll/nlp_final_project | /test1.py | UTF-8 | 2,525 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Dec 8 01:33:16 2018
@author: natch
"""
import re
import os.path
from collections import Counter
save_path = 'C:/Users/natch/Desktop/SNproject/documents-nsc'
all_files = os.listdir(save_path)
article_file = open ('article_list.txt','w',encoding='utf-8')
file = open ('all_a... | true |
a8777554c56a4236e268eeab177d44ecbc818978 | cloudcontrollers/bootstrap.cloudcontrollers.com | /crashplan/public/usr/local/sbin/crashplan_scripts/passwordsetup.py | UTF-8 | 3,358 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
#################################notes#################################
# cloudcontrol-passwordsetup.py r1 #
# this script runs at first boot of the server and generates unique #
# passwords for the system root user, MySQL root users, #
# othe... | true |
ae414f08950cfd2e307036ef07dc731f6b7a4a4c | lucatelli/gatc_furg | /galaxymakerlib.py | UTF-8 | 12,610 | 2.765625 | 3 | [] | no_license | # !/usr/bin/env python
# -*- coding: utf-8 -*-
##############################################################################
## This is a library of many functions to the code galaxymaker ##
## Created by Geferson Lucatelli ##
## lucatelli_asph_r2@virgophysics ##
## ##
## ... | true |
8f66ecda8084ada8acca15668059a3eb65643480 | benwei/Learnings | /pySamples/class_dp/factory_dp1.py | UTF-8 | 1,164 | 3.640625 | 4 | [] | no_license | from beutil import *
class Worker:
def __init__(self, name=None):
self.name = capfirst(name) if name else "The worker"
def getName(self):
return self.name
def attrib(self):
return "Worker"
def lookandfeel(self):
print "%s is a %s" % (self.name, self.attrib())
class De... | true |
36fa3c67e624753fa45389cb7d7cb4db1cdb4c38 | Morefine17/hw05_final | /yatube/about/tests/test_urls.py | UTF-8 | 1,013 | 2.546875 | 3 | [] | no_license | from django.test import Client, TestCase
class TestAboutUrls(TestCase):
def setUp(self):
self.guest_client = Client()
self.templates_url_names = {
'about/author.html': '/about/author/',
'about/tech.html': '/about/tech/'
}
def test_about_urls_exists_at_desire_lo... | true |
a834c345e5e7bae977adbeb8020f5014190706c8 | brewtastic/longanisa | /gui.py | UTF-8 | 580 | 3.09375 | 3 | [] | no_license | from Tkinter import *
root = Tk()
topframe = Frame(root)
topframe.pack()
bottomframe = Frame(root)
bottomframe.pack(side=BOTTOM)
button1 = Button(topframe, text="Button 1",bg="green", fg="red")
button2 = Button(topframe, text="Button 2", fg="blue")
button3 = Button(bottomframe, text="Button 3", fg="green")
button4... | true |
b594467ddaa1940530293a3f3a6d545d1f57e579 | lusineduryan/ACA_Python | /Sololearn/OOP/Inheritance.py | UTF-8 | 410 | 3.8125 | 4 | [] | no_license | class Animal:
def __init__(self,name, color):
self.name = name
self.color = color
class Cat(Animal):
def purr(self):
print("Purr...")
class Dog(Animal):
def bark(self):
print("Woof!")
rex = Dog("Rex", "black")
print(rex.color)
rex.bark()
class Wolf(Dog):
def bark(self... | true |
f8c71eeb8cc69a75584c7a1ec874954ba9c29772 | grv07/clat | /teacher/validators.py | UTF-8 | 583 | 3.0625 | 3 | [] | no_license | from django import forms
import re
def validate_password(value):
pattern = "^(?=.*?[a-zA-Z])(?=.*?[0-9])(?=.*?[@#&^%!*%$])[a-zA-Z0-9@#&^%!*%$]{8,20}$"
if not re.findall(pattern, str(value)):
raise forms.ValidationError(
"Password must contains a uppercase letters: A-Z,lowercase letters: a... | true |
1f15bf731d56fd0f2f819113be4907674396cfe2 | Tanapoowapat/python_class_2021 | /chapter_12_pygame_basic3/side_scroll_3.py | UTF-8 | 2,857 | 3.453125 | 3 | [] | no_license | import pygame
pygame.init()
# TODO : Step 1 create blank screen
WIDTH, HEIGHT = 640, 480
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption('Side Scroller')
def menu():
image = pygame.image.load("assets/menu.png")
image = pygame.transform.scale(image, (WIDTH, HEIGHT... | true |
38edd7f3cc574279450ff089f5bcd1f481cd9a8d | chenbaoshun/AutomationTesting | /Course0823/Week12/wait_stu.py | UTF-8 | 2,083 | 3.140625 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# @File : pop_windows.py
# @Author : Baoshun.Chin
# @Email : baoshunchin@qq.com
# @Time : 2020-11-22 10:19
# @Site :
# @version : V1.0
from time import sleep
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
import os
dri... | true |
e0a8d2151fea6fef991b769b16f69ef405bc7419 | maurice60/Bioinformatics.Algorithms | /Ch 2/Chapter2.py | UTF-8 | 10,618 | 2.640625 | 3 | [] | no_license | __author__ = 'maurice'
import sqlite3
from collections import Counter
from operator import itemgetter
import copy
def reverseComplement(text):
ans = []
cx = sqlite3.connect("../Bioinformatics.db")
px = cx.cursor()
for c in text:
px.execute("SELECT complement FROM complement WHERE base = ?", (c,... | true |
3378f38084a9b642c4a841f1a33adbe2c44bafea | mhirayama/python | /tutorial/logistic_regression01.py | UTF-8 | 1,074 | 3.0625 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sklearn.datasets import load_iris
iris = load_iris()
df = pd.DataFrame(iris.data, columns = iris.feature_names) #irisのデータセットをデータフレームに格納
df['target'] = iris.target #iris.targetをデータフォレームに追加
X = iris.data[50:, 2].reshape(-1, 1) #50行目以降をXに配列として格納
y = iris.target[50:] - 1 #50行目... | true |
ab2e08f59088fe13b503960b532f2aa2b321698f | cleancodenz/pythonbasics | /strings/format/test36.py | UTF-8 | 1,689 | 4.0625 | 4 | [] | no_license | #string concatenation, with + multiple strings are created
#using join to be more efficient
combined = "Welcome" + " to" + " my blog " + "dear " + "readers"
print(combined)
#two pairs of brackets, the inside one creates a tuple
#join is performed on a collection
#the first character is a delimiter
combined = '|'.join... | true |
cb7b2130668bc3e9c6e6a8b1f894a696e605f35b | diegogcc/py-pluralsight | /intermediate/beyond-basics/6-numeric_and_scalar/fraction.py | UTF-8 | 1,163 | 4 | 4 | [] | no_license | '''
Fraction can represent Rational numbers
'''
from fractions import Fraction
from decimal import Decimal
two_thirds = Fraction(2, 3) # Fraction(2, 3)
print(two_thirds) # 2/3
try:
print('Giving Fraction a zero denominator')
zero_denom = Fraction(4, 0)
except ZeroDivisionError:
print('Causes a ... | true |
59d894788e2243b47257168af5bc0e1cb7cb8df5 | Annish1234/My-python-files | /speechcam.py | UTF-8 | 979 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python3
# Requires PyAudio and PySpeech.
import speech_recognition as sr
import os
# Record Audio
r = sr.Recognizer()
with sr.Microphone() as source:
print("Say something!")
audio = r.listen(source)
# Speech recognition using Google Speech Recognition
try:
# for testing purposes, we're ... | true |
f7f471c5eb31d7a7caa8a936ce251cb5bdba17a3 | joebowen/rocket-motor-datalogger | /gimbal_main.py | UTF-8 | 555 | 2.96875 | 3 | [] | permissive | #!/usr/bin/python3
import time
from gimbal.libraries.gimbal import Gimbal
def main():
gimbal = Gimbal()
time.sleep(5)
while True:
gimbal.yaw_to_angle(angle=110)
time.sleep(3)
gimbal.yaw_to_angle(angle=70)
time.sleep(3)
gimbal.yaw_to_angle(angle=90)
time.s... | true |
ce012f93a57973b4e315e5bea81698c45570974b | speeeday/video_qoe_analysis | /trace_generation/drive_upload_wrapper.py | UTF-8 | 856 | 2.5625 | 3 | [] | no_license | from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
class Drive_Upload_Wrapper():
def __init__(self):
g_login = GoogleAuth(settings_file='metadata/pydrive_settings.yaml')
g_login.LocalWebserverAuth()
self.drive = GoogleDrive(g_login)
def upload_file(self, fpath):
with open(fp... | true |
35b0603e05dd1614db084f4ed9bfcd454c19f4a7 | falecomlara/CursoEmVideo | /ex004 - dissecando variável.py | UTF-8 | 459 | 4.5625 | 5 | [] | no_license | # Método de Strings
# https://docs.python.org/pt-br/3/library/stdtypes.html
v = input('Digite um valor: ')
print ('O tipo primitivo desse valor é ', type(v))
print ('Só tem espaços? ', v.isspace())
print ('É um número? ', v.isnumeric())
print ('É alfabético? ', v.isalpha())
print ('É alfanumérico? ', v.isalnum())
prin... | true |
b5940a2094156a75838b95cd13389fecef0b211b | QualiSystems/shellfoundry | /shellfoundry/utilities/template_versions.py | UTF-8 | 1,385 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
import requests
import shellfoundry.exceptions as exc
VERSIONS_URL = "https://api.github.com/repos/{}/{}/branches"
NAME_PLACEHOLDER = "name"
def is_version(vstr):
from distutils.version import StrictVersion
try:
StrictVersion(vstr)
return True
... | true |
08fc8f4c89b50784f1efc77416033d906a4fe881 | nickliqian/keep_learning | /KnowledgeMapping/SpiderExp/4-Function/openSSLExp/2.py | UTF-8 | 500 | 2.84375 | 3 | [
"MIT"
] | permissive | from OpenSSL.crypto import PKey
from OpenSSL.crypto import TYPE_RSA, FILETYPE_PEM
from OpenSSL.crypto import dump_privatekey, dump_publickey
"""
产生密钥对
利用PKey对象可以方便快速产生密钥对,然后dump_函数可以把PKey对象转成字节码方便写入文件,或者进行base64编码后进行网络传输。
"""
pk = PKey()
print(pk)
pk.generate_key(TYPE_RSA, 1024)
dpub = dump_publickey(FILETYPE_PEM, pk... | true |
5ebe90a14961b03367c326a702700bbd4e77dafa | whiz-kid/ML-Codes | /linear-regression/linear_regression_gd.py | UTF-8 | 1,286 | 3.109375 | 3 | [] | no_license | import numpy as np
# from numpy import *
def compute_error_for_given_points(b,m,points):
totalError=0
for i in range(len(points)):
x=points[i,0]
y=points[i,1]
totalError+=(y-(m*x+b))**2
return totalError/float(len(points))
def step_gradient(b_current,m_current,points,learning_rate):
#gradient descent
b_gr... | true |
0e82b499607ec544041108e746d6727da76e184c | Bilibotter/OneDayTwoCode | /567. 字符串的排列.py | UTF-8 | 783 | 2.875 | 3 | [] | no_license | """
执行结果:通过
执行用时:56 ms, 在所有 Python3 提交中击败了96.39%的用户
内存消耗:15.2 MB, 在所有 Python3 提交中击败了12.65%的用户
"""
class Solution:
def checkInclusion(self, s1: str, s2: str) -> bool:
if len(s2) < len(s1):
return False
zero = {chr(i): 0 for i in range(97, 123)}
match = zero.copy()
for c1... | true |
cb0ff92a37e7f4dfc4449fcb8591ad44c5f05fde | lffsantos/phone_bill | /phone_bill/core/serializers.py | UTF-8 | 3,730 | 2.5625 | 3 | [] | no_license | from rest_framework import serializers
from phone_bill.core.models import Call, CallBilling, PhoneBill
class CallSerializer(serializers.ModelSerializer):
class Meta:
model = Call
fields = '__all__'
def create(self, validated_data):
return Call.objects.create(**validated_data)
de... | true |
fe41b0e017ccd86f710702faca3660eca03df627 | XavierJiezou/python-vmgirls-crawl | /show-face-processing.py | UTF-8 | 742 | 2.859375 | 3 | [] | no_license | import os
import random
import matplotlib.pyplot as plt
class ShowFaceProcessing(object):
def __init__(self, root):
self.root = root
def show(self, imgs):
plt.figure(figsize=(10, 10))
for ind, img in enumerate(imgs):
plt.subplot(10, 10, ind+1)
plt.imshow(plt.im... | true |
c93b70d9b5ce43fd0d79c47ee733d9a36c99b8cd | rangerjo/python.casa | /examples/kap11-oo/rectangle5.py | UTF-8 | 1,923 | 4.5 | 4 | [] | no_license | #!/usr/bin/env python3
# Operator Overloading
class Rectangle():
# Konstruktor, initialisiert x und y mit Startposition
def __init__(self, width, height):
self.w = width
self.h = height
# Instanzmethoden
def area(self):
return self.w * self.h
def perimeter(sel... | true |
bd35791e35362672cb78597b56ed226865ea334e | Amaan118/Rock-Paper-Scissor | /1_Rock_Paper_Scissor.py | UTF-8 | 1,887 | 3.5 | 4 | [] | no_license | import random
import time
def result(u,c):
user = u.lower()
comp = c.lower()
if user == comp:
return 0
elif user=='r':
if comp =='p':
return -1
else:
return 1
elif user=='p':
if comp =='s':
return -1
else:
... | true |
7fff5d62cc7a444c1495033c945e894f90a8e6de | Sapkalaniket511/mini-project | /data analysis.py | UTF-8 | 19,248 | 2.640625 | 3 | [] | no_license | from tkinter import *
import pandas as pd
import matplotlib.pyplot as graph
import seaborn as born
import warnings
warnings.filterwarnings('ignore')
BowlerData = pd.read_csv('G:/cricket/Bowler_Data.csv')
Batsman_Data = pd.read_csv('G:/cricket/Batsman_Data.csv')
Ground_Averages = pd.read_csv('G:/cricket/Grou... | true |
de52200b033457f7e1b83a1e0c0503b4498dccb5 | zebakhalil/iiot_project | /graphPlot.py | UTF-8 | 942 | 2.75 | 3 | [] | no_license |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import style
style.use('ggplot')
fig = plt.gcf()
fig.set_size_inches(8, 5)
plt.figure(dpi=300)
# data to plot
n_groups = 3
means_frank = (42113, 48537, 50130)
means_guido = (13885, 20309, 21903)
# create plot
fig, ax = plt.subplots()
index = np.ara... | true |
9df1991b56d067104125cf201da73938bbf47698 | ZKLD/Paramiko_demo | /sftpdemo.py | UTF-8 | 9,157 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from stat import S_ISDIR
import os
from time import time
import paramiko
class FTP(object):
def __init__(self, ip, username, passwd):#, localpath, removepath, upfilename=None, downfilename=None):
self.ip = ip
self.username = username
self.passwd = passwd
# se... | true |
6851c4a43b350ef15a72e50a83072b0f6d32007a | mengyx-work/CS_algorithm_scripts | /algorithms/min_heap.py | UTF-8 | 2,883 | 3.921875 | 4 | [] | no_license | class min_heap(object):
def __init__(self, heap=None):
self.current_size = len(heap)
if heap is None:
self.heap = []
else:
self.heap = heap
def heapify(self):
for i in range(self.current_size-1, 0, -1):
self._float_up(i)
def insert(self, ... | true |
5bb2a0bc7b5e0cafd2612833d679f7e0de81004c | textext/texoutparse | /tests/test_warnings.py | UTF-8 | 2,346 | 2.796875 | 3 | [
"MIT"
] | permissive | """
Warning tests
The tests in this file should test warnings occurring in log files. These
should be genuine warning messages from LaTeX log files, possibly including
BLANK lines in the lines iterable.
"""
import pytest
import texoutparse
@pytest.fixture
def parser():
return texoutparse.LatexLogParser()
def ... | true |
1619819278964905cfe7e9a98d18d0f23739d703 | elciclon/pruebas-TDD | /myfactorial.py | UTF-8 | 164 | 3.53125 | 4 | [] | no_license | def factorial(numero):
factorial = 1
for i in range(1, numero + 1):
factorial = factorial * i
return factorial
def suma(a, b):
return a + b | true |
a4546f396f234ee3eebfa3b757a5760f400fde46 | vliok/ComfortablePotatoes | /jivs/utils/makeLeague.py | UTF-8 | 5,055 | 2.75 | 3 | [] | no_license | import sqlite3
import os
def newLeague(name, user, multipliers):
DIR=os.path.dirname(__file__)
DIR+='/'
db = sqlite3.connect(DIR+"../data/league.db")
c = db.cursor()
q = " SELECT name from sqlite_master WHERE type=\'table\'"
c.execute(q)
r = c.fetchall()
for x in r:
if name in x... | true |
229bd5780b9cecad67fa3afabc6e8a939729304e | yo16/cloud_alert | /cloud_alert_mod/status_reader/base.py | UTF-8 | 2,361 | 2.90625 | 3 | [] | no_license | # base.py
from abc import ABCMeta, abstractmethod
from typing import List, Dict, Union, Tuple
import requests
from bs4 import BeautifulSoup
CLOUD_INFOS = [
{'id': 0, 'name':'AWS', 'url':'https://status.aws.amazon.com/'},
{'id': 1, 'name':'GCP', 'url':'https://status.cloud.google.com/'},
]
CLOUD_STATUS = {'OK'... | true |
3f1d6031ad6a96b01a2223077af0237dc5f468de | Ulremberg/LabProgramacao | /CodigoEntreAmigas.py | UTF-8 | 1,395 | 3.03125 | 3 | [] | no_license | letras = {' ': 0, 'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10,
'k': 11, 'l': 12, 'm': 13, 'n': 14, 'o': 15, 'p': 16, 'q': 17, 'r': 18, 's': 19,
't': 20, 'u': 21, 'v': 22, 'w': 23, 'x': 24, 'y': 25, 'z': 26}
letter = list(letras.keys())
valor = list(letras.values()... | true |
8c8f8b929f5a52b66ebec32a06638f4e8d1050d0 | zie225/UBC_ComputerVision | /ComputerVision_course/Assignment 5/assignment5/classifiers.py | UTF-8 | 6,130 | 3.15625 | 3 | [] | no_license | from sklearn.neighbors import KNeighborsClassifier
import numpy as np
from sklearn.svm import SVC
from sklearn.svm import LinearSVC
from sklearn.multiclass import OneVsRestClassifier
from sklearn.metrics import confusion_matrix
import matplotlib.pyplot as plt
from sklearn.neighbors import KNeighborsClassifier
import it... | true |
5bab5e86474a31c9f44a7c4e9d4ac86794ff5895 | cocoaaa/Tenenbaum2000 | /src/utils/scheduler.py | UTF-8 | 765 | 3.078125 | 3 | [] | no_license | import numpy as np
from torch.utils.data import DataLoader
def n_iters_per_epoch(dl:DataLoader) -> int:
"""Given a dataloader
- batch_size,
- total num. of data in the dataset
Compute the total number of batch/iterations per epoch.
"""
n_iters = len(dl.dataset)//dl.batch_size
if not dl.drop... | true |
2cd40c0322f31dacfac31db69a96c14af3b4045e | Steven24K/Project-2-Game | /Euromast_the_game_V5.1.1/rotterdam_tower/globals.py | UTF-8 | 1,439 | 2.765625 | 3 | [] | no_license | import pygame, time
pygame.init()
# Globals
width = 1024
height = 600
size = width, height #defines the height and width of the game window
display = pygame.display.set_mode(size) #defines the screen
#image library, place all images here
logo = pygame.image.load("skyline.png")
rulesImg = pygame.image.load(... | true |
966eb82b7cd1c904eac03fa7a7b94037240c3d61 | ericcheng09/LeetCodeSolution_Python | /Scripts/1009.py | UTF-8 | 228 | 2.5625 | 3 | [] | no_license | class Solution(object):
def bitwiseComplement(self, N):
"""
:type N: int
:rtype: int
"""
binary_str = bin(N)[2:]
tmp = 2 ** len(binary_str) - 1
return tmp - N
| true |
8bb74c2ae4403df6c3c840a1b9ee74ac2f881672 | hualili/opencv | /IP110-Deep-Learning/2018S-moments.py | UTF-8 | 1,116 | 2.78125 | 3 | [] | no_license | #------------------------------------------#
# Program: moments.py; coded by: HL; #
# Date: March 2017; Version: 0x0.1; #
# Status: Debug; #
# Purpose: Demonstrate contours and moment #
# computation. #
#------------------------------------------#
# Py... | true |
09e9f5ebe305dda7be646d0e0512fcb72f82d5c6 | omega-coder/flowshop_scheduling_problem | /app.py | UTF-8 | 10,309 | 2.59375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import datetime
import json
import time
import numpy as np
import plotly
import plotly.figure_factory as ff
from flask import Flask, render_template, request
import re
from flowshop import Flowshop, RandomFlowshop
app = Flask(__name__)
def parse_problem_data(... | true |
cd57cbde2ce80c14991ae0466a00dbfdff327228 | yclei/co-co-eaa | /code/main.py | UTF-8 | 12,613 | 2.703125 | 3 | [] | no_license | # Imports
import csv
import functions
import gc
import os
from streamlit import caching
# The BPI2015 all and main are the same event logs. I needed to modify the name to BPI2015_main to analyze the main
# process in the iterative manner shown below.
logs = [
"BPI2015_all_1.xes",
"BPI2015_all_2.xes",
"BP... | true |
66d9cbf3120bd385e98aee75bf6bb9b71613fcf3 | dgavieira/Projeto-Fechadura-Biometrica | /User-Interface/tela08.py | UTF-8 | 6,295 | 2.78125 | 3 | [] | no_license | #Title: Biometric Lock User Interface
#Organization: Optima-UFAM
#Screen 8: Checkout Screen
#Description: Screen to check who is inside the lab and wants to leave.
#Especs: Touchscreen LCD 3,5" 480x320
#Autor: Leonardo Arcanjo
#Revison: Leonardo Arcanjo
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
try:
#for py... | true |
637203f29cc06359c4fcfe5adbfa07ce98b72fee | awsaavedra/coding-practice | /python/courses_in_python/edxCourseMIT6001/2week/end.py | UTF-8 | 66 | 2.578125 | 3 | [] | no_license | res = 0
end = 6
i = 0
while i < end:
i += 1
res += i
print res
| true |
d854513a9ad020be4ea56fcbbd6787ec1336a956 | uclaacm/cs32-interview-prep20 | /Workshop6_Trees + Hash Tables/Problem4_Intersection of Two Arrays_349.py | UTF-8 | 1,163 | 3.625 | 4 | [] | no_license | # UCLA ACM ICPC: Interview Track Leetcode Problem Solutions
# Disclaimer: This is not the only valid solution and we do not claim our solutions
# to be optimal in terms of runtime or memory usage, we are merely giving example
# solutions to questions for learning purposes only
# Intersection of ... | true |
d4d68bf2df80d7699807486efd9af99cdc30afcb | Basillica/github-interaction-tool | /app/views.py | UTF-8 | 5,728 | 2.796875 | 3 | [] | no_license | from app import app
from flask import render_template, url_for, jsonify
import requests
from bs4 import BeautifulSoup
from datetime import datetime, date
import json
import re
username = ''
@app.route('/', methods=['GET'])
def home():
# Landing page!
text = "Welcome! "
text += "Visit /active/<user> or /d... | true |
f69aa285371165223acb2b77da8378b3ebe70495 | ielab/field-based-retrieval | /py_ClueWebElastic/CLEF2016MentionChv.py | UTF-8 | 3,402 | 2.546875 | 3 | [] | no_license | # this file is to extract list of entity mention for every CLEF2016 that matched terms in CHV
# We use terms in file Concept_Terms_Flatfile from column: Term, CHV, UMLS
# The Ngrams Flat File
import re
from lxml import etree
import collections
queryFile = "/volumes/Data/Phd/Data/clef2016_eval/queries2016.xml"
concept... | true |
132c7c3a05e1a2d2f834fd79412ddfd058839ec1 | cavieres/Documents | /ADP/adp.latamautomation.chile.expert/expert/actions/ingreso_masivo_campos_action.py | UTF-8 | 7,435 | 2.828125 | 3 | [] | no_license | from expert.actions.ficha_colaborador_action import FichaColaboradorAction
from expert.actions.menu_action import MenuAction
from expert.pages.ficha_colaborador_page import FichaColaboradorPage
from expert.pages.ingreso_masivo_campos_page import IngresoMasivoCamposPage
from scriptize.report import report
class Ingres... | true |
1ffaae7d6494f26b0fc96851ad0027c90dd693df | HarryG18/PythonAdventures | /Programs/Persistence.py | UTF-8 | 886 | 3.453125 | 3 | [] | no_license | from functools import reduce
import operator as op
def additive_persistence(n):
count = 0
while n > 9:
n = sum(int(i) for i in str(n))
count+=1
return count
def multiplicative_persistence(n):
count = 0
while n > 9:
product = 1
for i in str(n):
product *=... | true |
830c9152d7952adbcf705210757c4ddbda9fb634 | ebehlmann/puzzling | /python/advent_of_code/2015/day_1/day_1.py | UTF-8 | 404 | 3.546875 | 4 | [] | no_license | import input
def traverse_building(floor, directions):
i = 0
entered_basement = False
while i < len(directions):
if directions[i] == '(':
floor += 1
elif directions[i] == ')':
floor -= 1
if entered_basement == False and floor < 0:
print("First entered basement at position " + str(i+1))
entered_bas... | true |
f52c340482bc2a0b54e8d582ff2686db23d0ce20 | LisaCee/Data-Structures | /lru_cache/lru_cache.py | UTF-8 | 3,263 | 3.859375 | 4 | [] | no_license | from doubly_linked_list import DoublyLinkedList, ListNode
import sys
sys.path.append('../doubly_linked_list')
class LRUCache:
"""
Our LRUCache class keeps track of the max number of nodes it
can hold, the current number of nodes it is holding, a doubly-
linked list that holds the key-value entries in ... | true |
671988b4961e1481dfe1567ff8f08c92ea53626d | maciejborkowski1/PythonEssential | /08_07_RANDOM_cards_excercise.py | UTF-8 | 683 | 3.734375 | 4 | [] | no_license | colors = ['Hearts','Diamonds','Clubs','Spades']
figures = ['Ace','King','Queen','Jack','10','9']
allCards = []
for colorsList in colors:
for figuresList in figures:
card = colorsList + ' ' + figuresList
allCards.append(card)
print(allCards)
import random
random.shuffle(allCards)
... | true |
7f2b97c023cc097ec24ec27c8e717b44e5be696d | kaspersky43/python_turtle_practice | /star_mountain.py | UTF-8 | 217 | 3.28125 | 3 | [] | no_license | h = int(input())
k = int((h-1)/2)
base = h + 2*k
for i in range(h):
for c in range(base):
if(c in range(h-i-1,h+i)):
print('*',end='')
else:
print(' ',end='')
print()
| true |
ff01e224f231b5640945ff00c91174bce3b1e577 | xionghhcs/Deep-Learning-Text-Classification | /model/dpcnn.py | UTF-8 | 6,053 | 2.546875 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import sys
from sklearn.metrics import f1_score, accuracy_score
try:
from basic_model import BasicModel
except:
from .basic_model import BasicModel
class DPCNN(BasicModel):
def __init__(self, matrix=None, maxlen=None, num_classes=2, lr=0.001, model_path='../tmp/... | true |
edf382c52bcd8b2fb2918625821532ac5d13b933 | xiaohoulover/Spark-Learning | /spark_streaming/AccumulatorsBroadcastCheckpoint.py | UTF-8 | 1,718 | 3.015625 | 3 | [] | no_license | from pyspark import SparkContext
from pyspark.streaming import StreamingContext
# 创建一个sc 和时间间隔为4s 的ssc
sc = SparkContext("spark://master:7077", "AccumulatorsBroadcastCheckpoint")
ssc = StreamingContext(sc, 4)
# 广播变量,用与筛选列表
def getWordBlacklist(sparkContext):
if ("wordBlacklist" not in globals()): # 全局变量是否包含
... | true |
15ab64bbf2e9af72672e2edbc0e8d9db11cb8503 | EndyLab/codon-tables | /src/codonUtils.py | UTF-8 | 27,715 | 2.875 | 3 | [] | no_license | # import necessary modules
import numpy as np
from scipy.special import comb
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import Bio.Data.CodonTable
import networkx as nx
from collections import deque
import random
from copy import copy
import pickle
import os
# define path to file directory... | true |
89e011e11ad313ca8d99dc3d0238c24f94de5c41 | ainabeari/ICS4U-Arielle | /Python-Arielle/AcidRain.py | UTF-8 | 750 | 3.59375 | 4 | [] | no_license | #Acid Rain
#Arielle
#Friday May 25, 2018
#Info
print ("ACID RAIN")
print ("Acid rain is a danger for ecosystems, they can kill the wildlife living in them.\n This program will determine if the pH level entered for water is safe for fish to live in. \n ")
#Input
pH = int(input("Enter pH: "))
print ("The pH you entered... | true |
f6a5567b41169b3fa973ea27860090e558702f95 | xanasa14/Jin | /main.py | UTF-8 | 1,158 | 2.765625 | 3 | [] | no_license | import speech_recognition as sr
from nameFinder2 import extract_names
from record import recordWav
from Search import searcher
import simpleaudio as sa
from speaker import speakerOut
#from punctuator import Punctuator
#file = '/Users/xaviernavarro/PycharmProjects/Speech2Text/assets/recorded3.wav'
#file = str(recordWav... | true |
d51d69411fe58452280b2c1a38cc55583c12c4b3 | felipesilvadv/felipesilvadv-iic2233-2017-1 | /Tareas/T01/T01_Funciones.py | UTF-8 | 4,022 | 3.484375 | 3 | [] | no_license | # Funciones
from os import getcwd,makedirs,chdir
import T01_Datos as D
def pedir_ubicacion(string_pedido):
error = True
error1 = True
while error:
lat = input("Que latitud tiene el {}?: ".format(string_pedido))
try:
lat = float(lat)
error = False
except Val... | true |
4d7d61554ead83377718fd8c857e869637256281 | EdwardBetts/PCBOT | /_plugins/web.py | UTF-8 | 1,691 | 2.90625 | 3 | [
"MIT"
] | permissive | """ Script for web commands
Commands:
!define
"""
import discord
import asyncio
import aiohttp
commands = {
"define": {
"usage": "!define <query ...>",
"desc": "Defines a word using Urban Dictionary."
}
}
@asyncio.coroutine
def on_command(client: discord.Client, message: discord.Message, a... | true |
1f484e30d038325f3355c697d3a95419200b93e7 | AlexSerodio/processamento-de-imagens | /trabalhos/04-perceptron/neural_net_perceptron.py | UTF-8 | 1,249 | 3.484375 | 3 | [] | no_license | # Author: Alex Serodio Gonçalves
inputs_t = [[1, 0, 0], [1, 0, 1], [1, 1, 0], [1, 1, 1]]
outputs_t = [0, 0, 1, 1]
inputs_c = [[0, 0, 0], [0, 1, 1], [0, 1, 0], [0, 0, 1]]
weights = [0, 0, 0]
def treinar(input, outputEsperado):
valor = funcaoAtivacao(somaPonderada(input))
print("Input:", input, "| Output esp... | true |
7ed85823b637b03502c934942a2bc70b4f8de1e2 | SJ-Hydra/temp.tools | /portscan.py | UTF-8 | 355 | 3.109375 | 3 | [] | no_license | #!/usr/bin/python3
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(6)
host = input("Please enter the IP") #IP
port = int(input("Please enter the port") #Port
def portScanner(port):
if s.connect_ex((host, port)):
print("The port is closed")
else:
print("The... | true |
fb2f6c1bb6cd2edb28b52e22eeead8a253afea76 | pg3io/check-ssl | /check_ssl.py | UTF-8 | 4,776 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
import os
import ssl
import json
import yaml
from time import sleep, time
import socket
from datetime import datetime, timedelta
from influxdb_client import InfluxDBClient
from influxdb_client.client.write_api import SYNCHRONOUS
try:
filesource = os.environ['LIST']
except KeyError:
print('M... | true |
2e363d1afb92ee0ef03f5d999b95df4223d83ca6 | johngathure/cache_middleware | /cache_middleware/middleware/test_cachemiddleware.py | UTF-8 | 1,689 | 2.609375 | 3 | [] | no_license | from mock import Mock
from django.test import TestCase
from django.core.cache import cache
from .cache import CacheMiddleware
class CacheMiddlewareTest(TestCase):
def setUp(self):
self.request = Mock()
self.response = Mock()
self.request.path = "/todos/view_todos/"
self.cache_da... | true |
cdf0da790833c12d584ff948ad0680ca972b5825 | rchughye/tripping-octo-wight | /PEuler026.py | UTF-8 | 1,584 | 3.765625 | 4 | [] | no_license | # Euler Problem #26: Reciprocal cycles
# http://projecteuler.net/problem=26
# Q: Find the value of d < 1000 for which 1/d contains the longest recurring cycle in its decimal fraction part.
# A: 983
# Iterate through d 1-999 and output d that provides the longest recurring cycle
# Do not need to consider any d for whic... | true |