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 |
|---|---|---|---|---|---|---|---|---|---|---|
8e064df7ee738b53d31ff277df86157726fba92b | mzfr/Competitive-coding | /uncategorized/twoSums.py | UTF-8 | 427 | 2.859375 | 3 | [] | no_license | """https://leetcode.com/problems/two-sum/
This code will only run on the leetcode portal and might cause issues locally
because lot of weird reasons.
"""
class Solution:
def twoSum(self, nums, target):
hashmap = {}
for ind, num in enumerate(nums):
n = target - num
if n not... | true |
214a086f690e048e6917fc026a0656d82623dbc9 | vsfh/Graph-Markov-Network | /Python Scripts/utils.py | UTF-8 | 19,369 | 2.59375 | 3 | [
"MIT"
] | permissive | import torch
from torch.autograd import Variable
import torch.utils.data as utils
# import torch.utils.data as utils
# import torch.nn.functional as F
# import torch
# import torch.nn as nn
# from torch.nn.parameter import Parameter
import math
import numpy as np
import copy
import time
def PrepareDataset(speed_mat... | true |
89347cc2c601ce2eaa616343dd315286a4c7364a | WilliamGusmanov/ATM_ | /atm/Bank.py | UTF-8 | 258 | 3.125 | 3 | [] | no_license | class Bank:
bankAccounts = []
bankName = ""
def __init__(self, name):
self.bankName = name
'''add a new bank account to bankAccounts'''
def addNewBankAccount(self, user_account):
self.bankAccounts.append(user_account)
| true |
58c0006f4052fb18bd73740248db3c0ee936010b | masterfabela/practicas-pyton | /Tutoriales Phyton/PildorasInformaticas/bucleFor.py | UTF-8 | 792 | 3.640625 | 4 | [
"MIT"
] | permissive | def primerFor():
for i in ["primavera","verano","otoño","invierno"]:
print(i)
def terminarSinSaltoDeLinea():
for i in ["Pildoras", "Informaticas", 33]:
# end indica como termina de imprimir lo que mandas
print("Hola", end=" ")
def comprobarEmail():
email = input("Introduce direccio... | true |
6a570caa0f55938fbb2c4764269248c8c8849dbf | KyawThuHtun/OpenCV-with-Python | /coding-exercises-avairds/week2-image-operation/part2-intermediate/image-bitwise.py | UTF-8 | 513 | 2.984375 | 3 | [
"MIT"
] | permissive | import numpy as np
import cv2 as cv
rectangle = np.zeros((200, 200), dtype="uint8")
cv.rectangle(rectangle, (25, 25), (175, 175), 255, -1)
circle = np.zeros((200, 200), dtype="uint8")
cv.circle(circle, (100, 100), 100, 255, -1)
AND = cv.bitwise_and(rectangle,circle)
cv.imshow("AND", AND)
OR = cv.bitwise_or(rectangl... | true |
94a675590db716abfaa50f633d17b5b619ee6138 | dexterka/coursera_files | /3_Using_Python_to_access_web_data/week2_regular_expressions/regexp_testing.py | UTF-8 | 1,728 | 3.546875 | 4 | [] | no_license | import re # regular expression library
from os import path
file_name = input('Enter the name of the file: ')
file_path = path.abspath(path.join('..', '..', 'sample_files', file_name))
file_read = open(file_path, 'r')
for line in file_read:
line = line.rstrip()
if re.search('From:', line): # finds t... | true |
ce14a9ab84b960f3cfddd5c6c72e1d402b810e13 | projeto-exercicios/Exercicios-Python-de-correccao-automatica | /03_Implementacao/DataBase/true_or_false_question_while_cicles_plus_mst_freq_num/question/version_1/program.py | UTF-8 | 1,355 | 2.9375 | 3 | [] | no_license | import random
from random import randint
from random import seed
seed(1918616)
o = []
for e in range(19824):
o.append(randint(0,357))
g = 0
def while_1():
while g < 5:
print(g + 1)
def while_2():
while g < 5:
if g == 4:
g = 0
print(g)
g += 1
def while_3():
... | true |
fdfd7df8054fa8cc3caa2f853a4905c1d283857d | nadarevd/Pokemon-on-Python | /Moves/Ho-Oh.py | UTF-8 | 1,011 | 2.59375 | 3 | [] | no_license | from pygame import *
screen = display.set_mode((1024,768))
running = True
clock = time.Clock()
posx = -100
posy = 200
posx1 = 600
posy1 = 95
frame = 0
HoOh = []
HoOh1 = []
battle = image.load("battle.png").convert()
battle = transform.scale(battle,(1024,768))
select = ""
for i in range(0,83):
HoOh.append(image.loa... | true |
6d9a5eba628a7ace0be81791f0251b0b5a060739 | HANDSOMEJACKANDY/bfe-investor-selector-backend | /code/backend/sector_and_region/sector_and_region.py | UTF-8 | 1,547 | 3.265625 | 3 | [] | no_license | from anytree import Node, RenderTree
class TreeNavigator:
def __init__(self, file_name):
with open(file_name) as f:
# create tree
self.name2node = {}
root = Node("root")
self.name2node["root"] = root
with open(file_name, "r") as f:
... | true |
effb0db964361e7616cc7de590b5f32d3c2a5b1c | Rulisetiawati/tasty-recipes-corpus | /dataCleaner.py | UTF-8 | 494 | 2.515625 | 3 | [] | no_license | import pandas as pd
import json
with open("recipies_docs_new.json", "r") as f:
file = json.load(f)
df = pd.DataFrame(file['docs'][:1600])
df["ingredients"] = df['ingredients'].apply(lambda x : " ".join(x))
df["preparation"] = df['preparation'].apply(lambda x : " ".join(x))
df['document_url'] = df['title']
del df... | true |
75e99fbdab869a5fb46bef5fea71843dafc9efc1 | wpower12/CIS5524-FinalProject | /data_processing/co_clustering.py | UTF-8 | 2,519 | 2.90625 | 3 | [] | no_license | # Numpy ops to get the co-clustering.
# This is ignoring the weights in the data for now,
# But can easily change it to not do that?
import pickle
import networkx as nx
from networkx.algorithms import bipartite as bp
import numpy as np
GRAPH_FN = "50_new_weighted_SMALL_first2k_nxg"
graph = pickle.load(open("data/{}... | true |
f8f3bc14f1b58305f24260d7af4c0b393e5b51bb | paramsingh/cp | /src/long/oct15/wdtbam.py | UTF-8 | 489 | 3.125 | 3 | [
"MIT"
] | permissive | # Author: Param Singh <paramsingh258@gmail.com>
# Who dares to be a millionaire: https://www.codechef.com/OCT15/problems/WDTBAM
t = int(raw_input())
for _ in range(t):
n = int(raw_input())
correct = raw_input()
chef = raw_input()
winnings = map(int, raw_input().split())
ca = 0
wa = 0
for c,... | true |
9f91f05676d52ad5ca50168f4899efab5396d9fd | Rounds-Chen/Math-Modeling | /source/AR.py | UTF-8 | 1,026 | 2.921875 | 3 | [] | no_license | """
Autoregressive model for forecasting time series
ref:https://blog.csdn.net/htuhxf/article/details/105382451
"""
import warnings
from statsmodels.tsa.ar_model import AR
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from sklearn.metrics import mean_squared_error as MSE
warnings.filterwarnin... | true |
f9e5830f99128abf1aca652441a53ee9aec8de13 | joelviel/tkinter-sudoku | /oosudoku.py | UTF-8 | 6,247 | 3.921875 | 4 | [] | no_license |
def list_diff(lst1, lst2):
"""Return lst1 - lst2.
list_diff(list<X>, list<X>) -> list<X>
The result is the list of entries in lst1 that are not in lst2.
"""
diff = []
for e in lst1:
if not e in lst2:
diff.append(e)
return diff
def list_intersection(lst1, lst2):
""... | true |
52751f3d819decbe3f8ec5db949c2abd6c5af9e4 | j0k/algopractice | /nn/nn4.py | UTF-8 | 4,461 | 2.78125 | 3 | [] | no_license | # take attention on
# https://stackoverflow.com/questions/35032685/numpy-valueerror-shapes-not-aligned
#
# especially:
# def feedforward(self, a):
# """Return the output of the network if ``a`` is input."""
# for b, w in zip(self.biases, self.weights):
# a = sigmoid(np.dot(w, a)+b)
# r... | true |
ed841d3e9b2ffb12e96f62f90b054ddb8b8fec30 | beaudoi1/snResearch | /plot.py | UTF-8 | 6,489 | 2.609375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import operator
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
import math
colors = {'92a': 'black', '11by': 'blue', '11ek': 'brown', '11fe': 'green', '11iv': 'magenta', '12cg': 'orange', '13dy': 'purple', '14j': 'black'}
markers = {'92a': '+', '11b... | true |
c4196dd6c88c0500e5312e6886a6bca7017bee12 | wang0759/pythonLab4 | /calculateDistanceBetweenPoints.py | UTF-8 | 660 | 3.84375 | 4 | [] | no_license | '''
Write a function calculateDistanceBetweenPoints that calculates the distance
between 2 points with coordinates (x,y) and (x1,y1),
the function receives 4 paramaters: x, y, x1 and y1, all integers.
The function returns the distance between the two points.
The function must be properly tested using a main program tha... | true |
316253c25e596c8832f831afdbe7baf9dfebfa76 | tonyrein/MythTV_to_MythVideo | /mythcontent/service.py | UTF-8 | 12,801 | 2.640625 | 3 | [] | no_license | import os
from nonpublic.settings import ORPHANS
from mythcontent.dto import OrphanDto, ProgInfo, TvRecordingDto
from mythcontent.utils import stat_remote_host
from mythcontent.dao import MythApi, TvRecordingApi
from mythcontent.models import Orphan
class OrphanService(object):
__instance = None
d... | true |
00326ec91e965a5f7731cb67d418aa531453e5c2 | youxi0011983/python3 | /python/web_tools/requestseg.py | UTF-8 | 1,120 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: UTF-8 -*-
import time
import requests
import re
###请求头
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) ' 'Chrome/51.0.2704.63 Safari/537.36',
}
http_switch = False
if http_swit... | true |
221e0e7dfcfe6fd97a3b7009aa2935be809f77f2 | IronE-G-G/algorithm | /leetcode/101-200题/159lengthOfLongestSubstringTwoDistinct.py | UTF-8 | 2,257 | 3.65625 | 4 | [] | no_license | """
159 至多包含两个不同字符的最长子串
给定一个字符串 s ,找出 至多 包含两个不同字符的最长子串 t 。
示例 1:
输入: "eceba"
输出: 3
解释: t 是 "ece",长度为3。
示例 2:
输入: "ccaabbb"
输出: 5
解释: t 是 "aabbb",长度为5。
类似的双指针滑动窗口题目:
3 无重复字符的最长子串
76 最小覆盖子串
340 至多包含k个不同字符的最长子串
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/longest-substring-with-at-most-two-distinct-characters
... | true |
453beabb328b95f1cfcef718e5c96e0cdee73270 | gchlebus/HpBandSter | /hpbandster/optimizers/config_generators/kde.py | UTF-8 | 4,789 | 2.546875 | 3 | [
"BSD-3-Clause"
] | permissive | import ConfigSpace
import numpy as np
import scipy.stats as sps
import statsmodels.api as sm
from hpbandster.config_generators.base import base_config_generator
class KernelDensityEstimator(base_config_generator):
def __init__(self, configspace, top_n_percent=10, update_after_n_points=50,
min_points_in_model... | true |
023d0431bcd1c37f1e030499bd8b51bd7a0ef514 | Nathan-Laney/Python_Projects | /whiletrue.py | UTF-8 | 317 | 2.984375 | 3 | [
"MIT"
] | permissive | # !/usr/bin/env python3
# -*- coding: utf-8 -*-
# authors: Syed Marwan Jamal / Pierre Bouillon
"""`whiletrue.py` never ending
loop which prints blank lines till the program is stopped
"""
if __name__ == '__main__':
try:
while True:
print('\n')
except KeyboardInterrupt:
print('Endi... | true |
6125ea56fb7ecc1ea1163f975b8af90ce254be5f | Aasthaengg/IBMdataset | /Python_codes/p03209/s218294969.py | UTF-8 | 444 | 3.03125 | 3 | [] | no_license | N, X = map(int, input().split())
An = [1]
Pn = [1]
for i in range(N):
An.append(2*An[i]+3)
Pn.append(2*Pn[i]+1)
ans = 0
#print(An, Pn)
def f(x, i):
global ans
if x == An[i]:
ans += Pn[i]
print(ans)
elif An[i]//2 + 1 < x < An[i]:
ans += Pn[i-1] + 1
f(x-(An[i]//2 + 1), i-1)
elif An[i]//2... | true |
219e4defb73c7ce445d06609e5a837fcd648dc04 | rowedonalde/set | /test/test_set_hand.py | UTF-8 | 2,811 | 3.140625 | 3 | [] | no_license | import unittest
from setgame import SetCard, SetHand, SetColor, SetShading, SetShape
class TestSetGameHand(unittest.TestCase):
def test_create_hand_holds_onto_cards(self):
card1 = SetCard(
count=1,
color=SetColor.green,
shading=SetShading.solid,
shape=SetSh... | true |
282fc49852eda60052371f2c3cc221f6847b9ab7 | PacktPublishing/Intelligent-Projects-Using-Python | /Chapter07/test.py | UTF-8 | 1,957 | 2.96875 | 3 | [
"MIT"
] | permissive | # LSTM for sequence classification in the IMDB dataset
import numpy
from keras.datasets import imdb
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import LSTM, Convolution1D, Flatten, Dropout
from keras.layers.embeddings import Embedding
from keras.preprocessing import sequence
fro... | true |
8363a1ed80f63153dc64b5fa10b0821d6e32f569 | ZhangXinNan/LearnPractice | /python/basic/test_global.py | UTF-8 | 357 | 3.234375 | 3 | [] | no_license |
Money = 2000
def AddMoney():
global Money
Money += 1
print(Money)
AddMoney()
print(Money)
'''
#comment global Money
Traceback (most recent call last):
File "test_global.py", line 10, in <module>
AddMoney()
File "test_global.py", line 7, in AddMoney
Money += 1
UnboundLocalError: local variable 'Mon... | true |
2c227bca083c0856e0fe6fb53a12ca9edab04c71 | ArtemZaitsev1994/kivymess | /client.py | UTF-8 | 3,455 | 2.515625 | 3 | [] | no_license | import aiohttp
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.core.window import Window
from kivy.uix.textinput import TextInput
from kivy.lang import Builder
from ... | true |
af3e93f7b96fd24271e8e32704b22adaa4100b7a | Daishijun/InterviewAlgorithmCoding | /InterviewQuestion/quickPower.py | UTF-8 | 813 | 3.71875 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/7/18 20:08
# @Author : Daishijun
# @Site :
# @File : quickPower.py
# @Software : PyCharm
'''快速幂'''
'''这里并没有考虑指数项为负数的情况, 指数项为负的时候,需要最后取倒数
而且也并没有考虑指数项为分数的情况。
'''
def quickp(a, n):
res = 1
while n:
if n&1:
res = r... | true |
53167f4db98cc5e4b59b388cb2b53b10bddbe0a0 | rockingrohit9639/pythonBasics | /ageTeller.py | UTF-8 | 1,200 | 4.46875 | 4 | [] | no_license | def particular_age(years):
year = int(input("Enter year : "))
return year - years
if __name__ == '__main__':
while True:
_input = int(input("Enter your age or year of birth : "))
if _input >0 and _input < 100:
print(f"After {100 - _input} years you will be hundred.")
... | true |
31ef7f6e781643edfaab7d82f8c06676e15b04b0 | kjsr7/python_basics | /tuple_and_list.py | UTF-8 | 141 | 3.5625 | 4 | [] | no_license | #!/usr/bin/python
l = [1,3,2]
print(l)
print(l[0])
l.sort()
l.remove(1)
print("after removing 1")
print(l)
t = (1,3,2)
print(t)
t.remove(1)
| true |
b2b135ff7e184620e4c14c19cd3dac34d4cbf78a | emulbreh/rdp | /rdp/tests/test_parser.py | UTF-8 | 11,070 | 2.859375 | 3 | [
"MIT"
] | permissive | import unittest
from operator import itemgetter
from rdp import (GrammarBuilder, Grammar, flatten, drop, epsilon, repeat, Terminal,
Regexp, Parser, LeftRecursion, ParseError, Optional, Lookahead, ignore, keep)
from rdp.formatter import GrammarFormatter
from rdp import builtins
from rdp.utils import product, uncurr... | true |
c45a2f9936d8d62225a49f902c049184ab4d16c1 | ang2536/Turtle-designs | /turtle designs/functions.py | UTF-8 | 107 | 3.203125 | 3 | [] | no_license | #my function
def square(t):
for times in range(4):
t.forward(100)
t.left(90)
| true |
2221794321406c11cc486f2a7d4925f350bf90af | parkjihwanjay/session5 | /class/class.py | UTF-8 | 1,112 | 3.859375 | 4 | [] | no_license | class FourCal:
def __init__(self, name, age, university):
self.name = name
self.age = age
self.university = university
def add(self, num1, num2):
return num1+num2
def sub(self, num1, num2):
return num1-num2
def mul(self, num1, num2):
return num1*num2
... | true |
f2708b1c10edc5cded6f964ff11c10b52460e37a | xyzQvQ/bilibili_meter | /add_web_user.py | UTF-8 | 1,687 | 2.671875 | 3 | [
"MIT"
] | permissive | import sys
from bilibili_meter.web_server.model import WebUser
def new_web_user(name, password):
us = WebUser.findAll(where='`name`=?', args=(name, ))
if len(us) != 0:
return 'ERROR:USER ALREADY EXIST'
WebUser.new(name, password)
def set_password(name, password):
us = WebUser.findAll(where='... | true |
b892514926fe7d60e1ad1df91783a4322ef7fe01 | erdcpatel/code_snippets | /Decorators/time_it.py | UTF-8 | 579 | 3.609375 | 4 | [] | no_license | import time
def time_it(func):
def wrapper(*args, **kwargs):
start = time.time()
result = func(*args, **kwargs)
end = time.time()
print(func.__name__ + " took " + str((end-start)*1000) + " mil secs")
return result
return wrapper
@time_it
def cal_queb(numbers):
result = []
for num in numbers:
result.ap... | true |
2f7ee6b91827e9b90fe52f2e4a3c9496da154aec | pjohar1/Audio-Analysis | /main.py | UTF-8 | 1,390 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 14 17:26:25 2020
@author: punar
"""
import os
#import numpy as np
import pandas as pd
import worker
from multiprocessing import Pool
import time
#from datetime import datetime, timedelta
#from random import seed
# Auxilliary Functions to record ex... | true |
3b157f0cd5e8e2b7f2327bf08235b483c89609bd | N3CROM4NC3R/python_crash_course_exercises | /dictionarys/favorite_numbers2.py | UTF-8 | 286 | 3.15625 | 3 | [] | no_license | favoriteNumbers={
"santiago":[8,11],
"libardo" :[5,2],
"carlos" :[1,9],
"edsel" :[2,4],
"angel" :[0,19]
}
for name,numbers in favoriteNumbers.items():
print("The person "+name+" Have the followers numbers:")
for number in numbers:
print(number) | true |
3827b95311826950d707cc19871412e3f96abb70 | yxw027/MGViz | /auxiliary/getSqliteDrawing/getSqliteDrawing.py | UTF-8 | 2,180 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
import os
import sys
import argparse
import sqlite3 as sqlite
import json
def main( arguments ):
parser = argparse.ArgumentParser(
description="Writes out the geojson from a user's file in a mmgis.sqlite3",
formatter_class=argparse.RawDescriptionHelpFormatter )
parser.a... | true |
81a221e58833434229fa8cf39642f92114e7679a | Franklyn-S/listas-FUP | /Lista 5 FUP - Matrizes/Códigos Python/1.20.py | UTF-8 | 1,674 | 4.25 | 4 | [] | no_license | '''1.20. Uma matriz M contém na 1ª coluna a matrícula do aluno no curso; na 2ª coluna, o
sexo (0 para feminino e 1 para masculino); na 3ª, o código do curso, e na 4ª, o CR
(Coeficiente de Rendimento). Suponha que o CR é um número inteiro. Faça um
programa que leia os dados de 10 alunos e armazene esses dados na matriz ... | true |
f2caef67021f163ae19745143ece39a611b3576e | mdcavallaro/myProjects | /drill_121_basicGUI.py | UTF-8 | 1,944 | 3.296875 | 3 | [] | no_license | # Python Ver: 3.7.3
# Author: Michael Cavallaro
# Purpose: Script will need to use Python 3 and Tkinter module.
# Your script will need to re-create an exact copy of a GUI from
# the supplied image at the bottom of the page.
from tkinter import *
import tkinter as tk #allows tk to be used to refere... | true |
02b35e6271db84d671ab461ccb4ede4b307b7a35 | yusumcheung1103/sign-lang-vgg-model | /train_cnn.py | UTF-8 | 2,640 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 20 14:03:07 2019
@author: stevencheung
"""
import os, shutil
base_dir = './mydata'
train_dir = os.path.join(base_dir, 'training_set')
val_dir = os.path.join(base_dir, 'test_set')
from keras.layers import Dropout
from keras import layers
... | true |
7bdc00983ee236c741092a727dd3c77770542638 | yuki67/Figure | /Gallery2D/Flower.py | UTF-8 | 347 | 3.296875 | 3 | [] | no_license | from Figure2D import point_2d, Circle, Circloid
class Flower(Circloid):
""" 花を真上から見たのに似てる """
def __init__(self, circle, n=128, k=8):
def f(i, j):
return i < j and (i + j) % (self.n // k) == 0
super().__init__(circle, n, f)
figure = Flower(Circle(point_2d(0.5, 0.5), 0.5), 256, 8)... | true |
8927a3846ff12bfc0597a3c65b93fe688eb7bf5d | sudarshan-baliga/image-processing--basics | /_14histogramEqualization.py | UTF-8 | 492 | 2.90625 | 3 | [] | no_license | # it is uniformaly distrubuting the histogram to increase the cotrast
# https://en.wikipedia.org/wiki/Histogram_equalization
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread("selfie.jpg",0)
equ = cv2.equalizeHist(img)
# cv2.imshow("img", equ)
plt.subplot(121),plt.imshow(img, cmap = "... | true |
3cc20ed9eb13cf34e607fbb15349644e04939332 | sdcc-umn/end2end | /dataloader.py | UTF-8 | 1,983 | 2.65625 | 3 | [] | no_license | import numpy as np
import h5py
from random import shuffle
class DataGenerator():
def __init__(self, config):
self.config = config
self.datapath = config.datapath
self.dataset_file = h5py.File(config.datapath, 'r')
self.img_shape = self.dataset_file["train_img"][0].shape
sel... | true |
51b1288f9d11e24e29f7276ba7fe9d1b795a0099 | Samuel-Ati/python_projects | /problem2.py | UTF-8 | 909 | 3.953125 | 4 | [] | no_license | #1
month = int(input('month'))
day = int(input("day"))
if month == 3 or 6 and day == 20:
print('True')
else:
print("False")
#2
current_balance = 500
time_in_years = 1
annual_rate = 20/100
annual_interest = (current_balance*time_in_years*annual_rate)
print(annual_interest)
new_current_balance = annual_inte... | true |
f15f79b3003548a8483965a609576277cd9f104c | Willempie/Artificial_Intelligence_Cube | /objects/cube/cube.py | UTF-8 | 3,884 | 3.65625 | 4 | [
"Apache-2.0"
] | permissive | from b_cube import BCube
from helper import Helper
class Cube(BCube):
def __init__(self):
BCube.__init__(self)
#Generate all vars
self._front = None
self._back = None
self._top = None
self._bottom = None
self._left = None
self._right = None
def... | true |
529da8a79e5ef77af27f9b9bfdcb8ed76b6270a1 | saintsjd/saintsjd.github.io | /malawi/files/offline_browserhtml.html | UTF-8 | 4,634 | 2.828125 | 3 | [] | no_license | #!/usr/bin/python
"""
Use wget to download and create a copy of a website browseable offline
Created by: Jon Saints <saintsjd@gmail.com>
Version: 0.1
Date: May 29, 2006
USAGE:
offline_browser OPTIONS websiteurl
"""
import os
import sys
import tarfile
from time import gmtime
import gzip
from urlparse import urlp... | true |
552456a4eae12b0b2a00dfbdc653fe6c1691f67c | xyanteos/Skrypty-RaspberryPI | /SKRYPTmqtt.py.save | UTF-8 | 4,188 | 2.90625 | 3 | [] | no_license | #!/usr/bin/python3
#Importowanie potrzebnych bibliotek, pika - komunikacja miedzy Rasp a brokerem, subprocess - umozliwia pobranie danych wyjściowych innego skryptu
import pika #,sys
import subprocess
import time
###Tutaj jest sposob na pobranie zmiennych podczas wywolania kodu
#sensor_args = { '11': Adafruit_DHT.DH... | true |
ccf1357f0f37ca70ac5edcdb4c2f59e4673e5a44 | krishnanunni-pr/Pyrhon-Django | /Django/Functional programming/Lambda function Reduce.py | UTF-8 | 337 | 3.25 | 3 | [] | no_license | # Reduce funtion
from functools import reduce
lst=[1,2,3,4,5,6,7]
# total=reduce(lambda num1,num2:num1+num2,lst)
# print(total)
# highest
# highest=reduce(lambda num1,num2:num1 if num1>num2 else num2,lst)
# print(highest)
# another method
result=list(map(lambda num:num-1 if num<5 else num+1 if num>5 else num,ls... | true |
6a6d175ab2f4bf485b0b1ae5e17874411e6b7963 | neurotechuoft/VitReous | /Code/Muse/src/muse_server.py | UTF-8 | 1,889 | 2.609375 | 3 | [
"MIT"
] | permissive | from collections import deque
from liblo import *
import sys, time
# Data class to hold the values of the 4 electrodes
# Queue used for quick realtime drawing
# member functions for file storage need to be added here so that it is directly stored to file
class Data:
# Default Queue length
def __init__(self, bi... | true |
c870e50cccfea09c7a8512b7e0fe9dc762be62cb | nityamthakur/Infix-Postfix | /infix-postfix.py | UTF-8 | 598 | 3.28125 | 3 | [] | no_license | operators=['+', '-', '*', '/', '(', ')', '^']
priority={'+':1, '-':1, '*':2, '/':2, '^':3}
stack=[]
postfix=''
infix=input('Enter infix expression: ')
for i in infix:
if i not in operators:
postfix+=i
elif i=='(':
stack.append('(')
elif i==')':
while stack and stack[-1]!= '(':
... | true |
bd453e328d3ba1eb2d360a55bd302738e199e664 | josephinemagu/busfare | /dateformats.py | UTF-8 | 813 | 3.546875 | 4 | [] | no_license | from datetime import date
from datetime import datetime
import locale
today = date.today()
# dd/mm/YY
d1 = today.strftime("%d/%m/%Y")
print("d1 =", d1)
# Textual month, day and year
d2 = today.strftime("%B %d, %Y")
print("d2 =", d2)
# mm/dd/y
d3 = today.strftime("%m/%d/%y")
print("d3 =", d3)
# Month abbreviation, ... | true |
7305cd341ab727168603b950e39b0a855e86d1cb | nanqianbeiquan/keras | /handwritten/digit_predict_use_keras.py | UTF-8 | 497 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import cv2
import os
from digit_train_use_cnn import Model
if __name__ == '__main__':
model = Model()
model.load_model(file_path = 'handwritten.train.model.h5')
image_path = 'E:\pest1\mnist\sj'
dir_item = os.listdir(image_path)
for impa in dir_item:
im_path = os.pa... | true |
216f6e024a3e586f539892b4c0f20f42259ed2fb | wangyongst/QiangGouPython | /cn/localhost01/spider/csdn_downloader.py | UTF-8 | 4,570 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from selenium.common import exceptions
from selenium import webdriver
from selenium.webdriver import ActionChains
import time
import re
import os
import requests
import sys
from cn.localhost01.util.str_util import print_msg
reload(sys)
sys.setdefaultencoding('utf8') # 对于py2,将ascii改为utf8
clas... | true |
46a57b7429bfa95fed9b004173c0cc7b34df941c | miaviles/Data-Structures-Algorithms-Python | /Hashtables/minimumWindowSubstring.py | UTF-8 | 6,464 | 4.25 | 4 | [] | no_license | """
Minimum Window Substring
Given a string corpus and a string target, find the minimum window (contiguous substring)
which contain all the characters that are found in target.
The time complexity of the solution should be in order of O(n).
NOTE: substring and sub-sequence are different things
Example 1:
Input: c... | true |
d7d7ab3b3212dc32ba43ef309590de8caa49d317 | amshrbo/keras-io | /examples/generative/conditional_gan.py | UTF-8 | 12,556 | 3.34375 | 3 | [
"Apache-2.0"
] | permissive | """
Title: Conditional GAN
Author: [Sayak Paul](https://twitter.com/RisingSayak)
Date created: 2021/07/13
Last modified: 2021/07/15
Description: Training a GAN conditioned on class labels to generate handwritten digits.
"""
"""
Generative Adversarial Networks (GANs) let us generate novel image data, video data,
or audi... | true |
30407de587ffaecc18f43e36108584baaf490502 | nflondo/myprog | /python/pygame/text.py | UTF-8 | 762 | 3.078125 | 3 | [] | no_license | #!/usr/bin/python
# Drawing Text
import pygame, sys
from pygame.locals import *
def main():
pygame.init()
screen = pygame.display.set_mode((400,300))
screen.fill((0, 0, 0))
pygame.display.update()
fonts = pygame.font.get_fonts()
font = fonts.pop()
while fonts:
t... | true |
3d4cb4c9557b7d5a4a620574371dbcf21b1df551 | 085astatine/makefilemaker | /makefilemaker/compiler_setting.py | UTF-8 | 1,247 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from collections import namedtuple, OrderedDict
CompilerOption = namedtuple('CompilerOption',
('notlink', 'output', 'include_path', 'library', 'library_path'))
"""コンパイラのオプション
コンパイルのみ実行 出力名設定 ライブラリ関連のみ
notlink
output
include_path
libraly
libraly_path
"""
GCCCompilerOption = CompilerOptio... | true |
94a076205a6b90ccf39a6713633a04155e18312f | mouday/SomeCodeForPython | /test_from_myself/Python17个常用内置模块总结/13.re模块举例.py | UTF-8 | 1,129 | 3.390625 | 3 | [] | no_license | import re
# 例子1:匹配网址
ip = '12.23.84.dsfa.23s.3234~lsjfw+23sfaf192.168.32.43_w342d~@#9436'
ret=re.findall("[0-9]{1,3}",ip)
print(ret)
# ['12', '23', '84', '23', '323', '4', '23', '192', '168', '32', '43', '342', '943', '6']
ret=re.findall("[0-9]{1,3}\.[0-9]{1,3}",ip)
print(ret)
# ['12.23', '192.168', '32.43']
ret=re... | true |
9b86748467c506930c7d0fa03bef84e47358408d | gschen/sctu-ds-2020 | /1906101019-贾佳/Day0225课后作业/test2.py | UTF-8 | 214 | 3.75 | 4 | [] | no_license | def grades(x):
if 90<=x<=100:
return "A"
if 80<=x<90:
return "B"
if 60<=x<80:
return "C"
if x<60:
return "D"
x = float(input("输入您的分数:"))
print(grades(x))
| true |
59043f8ef5df54515414d521e8acc89ac879225c | mikeludemann/helperFunctions_Python | /src/List/minimum.py | UTF-8 | 114 | 3.125 | 3 | [
"MIT"
] | permissive | def minimum( list ):
min = list[ 0 ]
for i in list:
if i < min:
min = i
return min | true |
f7d7549d50f9d825302f6e3976241ac737a7ea2e | sasucg/Licenta- | /FrameandRadiobuttons.py | UTF-8 | 1,199 | 3.140625 | 3 | [] | no_license | from tkinter import *
from PIL import ImageTk, Image
root = Tk()
root.title("Frames and Radio Buttons")
root.iconbitmap('C:/Users/lenovo/PycharmProjects/LicentaSasu/Icon.ico')
frame = LabelFrame(root, text="This is my first frame", padx=5, pady=5) #padding inside frame
frame.pack() #padding outside frame
# r = IntVa... | true |
5aec1ec1fbc3efb00a051e5f475fce09dd3d4898 | dudaMeneses/nlp-python | /tokenizer.py | UTF-8 | 256 | 3.1875 | 3 | [
"Apache-2.0"
] | permissive | import nltk
nltk.download('punkt')
text = "Mary had a little lamb. Her fleece was white as snow"
from nltk.tokenize import word_tokenize, sent_tokenize
sents = sent_tokenize(text)
print(sents)
words = [word_tokenize(sent) for sent in sents]
print(words) | true |
79c0b4ab0b6838461a13b3517d8a80de4b271b4b | KonstantinAlxVlasenko/san_report_automation | /san_analysis/isl/isl_statistics_notes.py | UTF-8 | 10,501 | 2.59375 | 3 | [] | no_license | """Module to add notes to isl_statistics_df DataFrame"""
import re
import numpy as np
import pandas as pd
import utilities.dataframe_operations as dfop
def add_notes(isl_statistics_df, isl_aggregated_modified_df, isl_group_columns, pattern_dct):
"""Function to add notes to isl_statistics_df DataFrame"""
i... | true |
b9d42f07d7003fbf1e01fa83c38412ce5fbf3c8d | zc2214/Computer-Practicum-1 | /reaction sim.py | UTF-8 | 1,474 | 3.046875 | 3 | [] | no_license | import matplotlib.pyplot as plt
#def rate constant k and initial concentration
k1f = 100
k1r = 10
k2 = 50
A = 1
B = 1
C = 0
D = 0
#set rate order
oa = 1
ob = 1
#def time slot
time = 0
time_slot = 1e-3
#Crate lists
A_list = [A]
B_list = [B]
C_list = [C]
D_list = [D]
time_list = [time]
#Begin comput... | true |
cd3a74bad81003d440e9891b1314deb99a313753 | IvanMadera/Git_beginner | /cadena.py | UTF-8 | 112 | 4.25 | 4 | [] | no_license | name = input("What's your name? ")
age = input("And your age? ")
print(f"El nombre es: {name} y su edad: {age}") | true |
34c17b23d764da9194ef5e1384d180914b2e40ce | HotsauceLee/Leetcode | /Categories/No_Fucking_Clue/R__146.LRU_Cache.py | UTF-8 | 6,600 | 3.6875 | 4 | [] | no_license | #================ deque ===================
# Time: Get: O(n), Set: O(n)
# Space: O(n)
from collections import deque
class LRUCache1(object):
def __init__(self, capacity):
"""
:type capacity: int
"""
self.cap = capacity
self.d = {}
self.idx = deque()
# O(n)... | true |
1ec178898a4ebc732ec6d927410a74e9a3b8b0d0 | ncu-dart/Hypernym-and-Hyponym-Detection-Based-on-Auxiliary-Sentences-and-the-BERT-Model | /code/evaluate/eval_task1_2_Q.py | UTF-8 | 37,404 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
from argparse import ArgumentParser
import torch
import numpy as np
import pandas as pd
from sklearn import metrics
import math
from scipy.stats import spearmanr
import torch.nn as nn
from pytorch_pretrained_bert import BertTokenizer
from pytorch_pretrained_bert import BertForSeq... | true |
6b4e2fbf4578e01d70287add757a7db1d08cdb5c | Subhamp7/Machine_Learning | /Regression/3.Logistic_Regression/Gender_Classification/Gender_Logistic_Regression.py | UTF-8 | 2,270 | 3.296875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 15 21:42:00 2020
@author: subham
"""
#loading the libraries
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.preprocessing import LabelEncoder,OneHotEncoder
from sklearn.model_selection import train_test_split
from sklearn.linear_mode... | true |
7b3a2d00e8b5c0faf56a1dd3034bee7f481f5814 | DanaJoffe/Evolutionary-Algorithms | /ex1/part_a.py | UTF-8 | 4,187 | 3.03125 | 3 | [] | no_license | from statistics import mean
from GeneticAlgoAPI.chromosome import ListChromosomeBase, IntChromosome
from GeneticAlgoAPI.crossover_strategy import SinglePointCrossover, UniformCrossover
from GeneticAlgoAPI.early_convergence_avoidance import KeepAvgFarFromBest
from GeneticAlgoAPI.fitness_function import MistakesBasedFit... | true |
1c3b4f05b60dbb152e5d6ad640f52458be6b485b | nathan-gilbert/pyconcile | /lexical_research_tools/specificity/phase_1/pronoun_profiler.py | UTF-8 | 24,411 | 2.6875 | 3 | [] | no_license | #!/usr/bin/python
# File Name : pronoun_profiler.py
# Purpose : Gather statistics on how pronouns are used in the wild.
# Creation Date : 05-01-2013
# Last Modified : Mon 13 May 2013 01:45:22 PM MDT
# Created By : Nathan Gilbert
#
import sys
import numpy
import nltk
from collections import defaultdict
#import matplotli... | true |
3a53cf4790593a3b274d06670b5ecbd0d109db0a | irhadSaric/Instrukcije | /h2.py | UTF-8 | 170 | 3.390625 | 3 | [] | no_license | a = input()
nalazise = False
while a:
if int(a) == 2:
nalazise = True
a = input()
if nalazise:
print("Nalazi se")
else:
print("Ne nalazi se")
| true |
c81f98912ffcc93e746f38e5bf85b100a8674a88 | shenqixiaojiang/deepLeaning_platfrom | /Keras/define_loss_weight.py | UTF-8 | 1,852 | 2.828125 | 3 | [] | no_license | import keras
import itertools
import numpy as np
from keras import backend as K
from keras.models import Model
from keras.layers import Input, Dense, Activation
#from ipdb import set_trace as bp
class WeightedCategoricalCrossEntropy(object):
def __init__(self, weights):
nb_cl = len(weights)
self.weights ... | true |
91441d54bc662c92c26190699cb6fbf06f89fe77 | phanikiran99/phanikiran | /parseStateData.py | UTF-8 | 918 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | import pandas as pd
#import numpy as np
import requests
from helper import dict
# -*- coding: utf-8 -*-
api = 'https://api.covid19india.org/states_daily.json'
resp = requests.get(api)
stateDf = pd.DataFrame(resp.json()['states_daily'])
state_ut = list(set(stateDf.columns) - set(['status','tt','date']))
dict = dict
... | true |
fb6850122e107104b9321fbcbc141d0533fdae59 | siddharthsircar/PythonFramework-API | /src/utils.py | UTF-8 | 1,682 | 3.109375 | 3 | [] | no_license | import json
from jsonschema import validate
from datetime import datetime
def assert_valid_schema(data, schema_file):
""" Checks whether the given data matches the schema """
schema = load_json_file(schema_file)
return validate(data, schema)
def load_json_file(filename):
""" Loads the given schema... | true |
ce99c7f557b9da1ff4338a67fdf868ee6a41c453 | EdmundoSanchezM/Cryptography | /Practica1Affine_Vigenere/example/views.py | UTF-8 | 1,841 | 2.515625 | 3 | [] | no_license | from django.shortcuts import render, redirect
from django.contrib import messages
from example.Vigenere import encrypt, decrypt
from example.Affine import Encrypt, Decrypt
def MainPage(request):
return render(request, 'example/index.html')
def VigenerePage(request):
return render(request, 'example/Vigenere.ht... | true |
df41463f5ef34839c923e526e6258e2ea8eaecdb | Linlinllll/apkutils | /apkutils/intersection.py | UTF-8 | 6,028 | 2.875 | 3 | [
"MIT"
] | permissive | import re
class APK_Intersection:
def __init__(self, apks):
self.apks = apks
permission_pattern1 = r'uses-permission\s+?.*?:name="([^"]+?)"'
permission_pattern2 = r'android:permission="([^"]+?)"'
self.perm1_matcher = re.compile(permission_pattern1)
self.perm2_matcher = re... | true |
16c6387dac580a6ec07d142ceb8b79c16524024c | lumbduck/euler-py | /archive/p005.py | UTF-8 | 912 | 3.78125 | 4 | [] | no_license | """
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
"""
from functools import reduce
from operator import mul
from collections import defaultdict
def factor(n):... | true |
759ca757603e509cebe6caca2f506b48f51c2252 | Wenyi-hub/Codesaving | /Python和GUI设计Tkinter菜单编程/ch2_4.py | UTF-8 | 170 | 2.890625 | 3 | [] | no_license | from tkinter import *
root = Tk()
root.title("ch2_4")
label=Label(root,text="I like thinter", fg="green", bg="#f0f0f0", height=3, width=15)
label.pack()
root.mainloop() | true |
6a73aee0531da36d076a31a2a21f02b11ae3e945 | dgallegos01/Python-Course | /Arithmetic Operations/ArithmaticOperations.py | UTF-8 | 508 | 4.15625 | 4 | [] | no_license | # Looking at the math side of Python
print(10 + 3) # add
print(10 - 3) # subtract
print(10 * 3) # multiply
print(10 / 3) # divide
print(10 // 3) # also divide but outputs an integer
print(10 % 3) # modular or mod, returns the remainder of the division
print(10 ** 3) # exponent
# augmented assignment operater:
x = 10
x ... | true |
1437c42f14ad1f280d0b48c6267f97eff3712d95 | EvanHarvill/python | /chatbot.py | UTF-8 | 1,688 | 3.984375 | 4 | [] | no_license | from random import seed
from random import radiant
seed(1)
for i in range(10):
value = radiant(0, 10)
print(value)
print("What is your first name?")
n = input("What is your first name?: ")
print(n)
print("What is your last name?")
v = input("What is your last name?: ")
print(v)
print("Hi there, "+str(n)+" "+str(v)+",... | true |
8b309ffa5f8eac29dd4b699f169c56480b78dd49 | Sarthak-Singhania/Work | /Class 11/TVshop.py | UTF-8 | 3,568 | 3.421875 | 3 | [] | no_license | from time import sleep
from os import system
system("color 1e")
system("title TV Sales Billing")
print("Welcome to TV shop")
sleep(2)
system("cls")
tvcnt=int(input("How many TV(s) do you want \n(1) Single TV \n(2) Multiple TV(s) (Get a discount) \nEnter your option:"))
if tvcnt==1:
system("cls")
tvclr=int(input... | true |
53afc1edc915c7afea027648ea7fe59a7908f029 | Wang-Yann/LeetCodeMe | /python/_0501_1000/0962_maximum-width-ramp.py | UTF-8 | 2,047 | 3.203125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : Rock Wayne
# @Created : 2020-06-19 08:00:00
# @Last Modified : 2020-06-19 08:00:00
# @Mail : lostlorder@gmail.com
# @Version : alpha-1.0
"""
# 给定一个整数数组 A,坡是元组 (i, j),其中 i < j 且 A[i] <= A[j]。这样的坡的宽度为 j - i。
#
# 找出 A 中的坡的最大宽度,如果不存在... | true |
a2cb2f7386d7b7bcfb6db6cd5485cf0550646e43 | sprockwell/rpi_beers | /thermometer.py | UTF-8 | 909 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python
import os
import glob
import time
os.system('modprobe w1-gpio')
os.system('modprobe w1-therm')
base_dir = '/sys/bus/w1/devices/'
device_folder = glob.glob(base_dir + '28*')[0]
device_file = device_folder + '/w1_slave'
def __init__(self):
self.hello = "hey duuude"
def read_temp_raw():
f = ope... | true |
24950ae093034b3b61f2a904e4f94b6e87f0bbe1 | simoneje/pythonlabb4-final | /pythonlabb4-master/print.py | UTF-8 | 945 | 2.5625 | 3 | [] | no_license | import sqlite3
from flask import Flask, escape, request, jsonify, render_template
import requests
import json
app = Flask(__name__)
@app.route('/')
def databaspost():
try:
conn = sqlite3.connect('data.db')
c = conn.cursor()
c.execute("SELECT regnfall FROM weather")
r =... | true |
9d8355e5ec7ad2523704162069b2903563477055 | LeonCrashCode/DRSparsing | /Tree_gmb/get_card_dict.py | UTF-8 | 6,063 | 2.953125 | 3 | [] | no_license | import os
import sys
import re
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--input", required=True)
args = parser.parse_args()
v_p = re.compile("^[XESTPKB][0-9]+$")
d_p = re.compile("^DRS-[0-9]+\($")
pb = re.compile("^P[0-9]+\($")
kb = re.compile("^K[0-9]+\($")
def correct(tree):
# Her... | true |
b68af625dc6b840ce431ad0b667de870e5740bc6 | aparij/lifelines | /lifelines/tests/test_suite.py | UTF-8 | 24,424 | 2.65625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | """
python -m lifelines.tests.test_suit
"""
from __future__ import print_function
import unittest
import numpy as np
import numpy.testing as npt
from collections import Counter
import matplotlib.pyplot as plt
import pandas as pd
from ..estimation import KaplanMeierFitter, NelsonAalenFitter, AalenAdditiveFitter, med... | true |
17dd34b330e21a6a434ac141d8241aa0e9082303 | snspam/sn_spam | /app/tests/test_runner.py | UTF-8 | 2,838 | 2.703125 | 3 | [
"MIT"
] | permissive | """
Tests the runner module.
"""
import unittest
import mock
import pandas as pd
from context import runner
from context import independent
from context import relational
from context import analysis
class RunnerTestCase(unittest.TestCase):
def setUp(self):
mock_independent_obj = mock.Mock(independent.Ind... | true |
80d9e82b4d7c0602b70b4514e684a4d5ac4467da | Bjarne-gif/eurojackpot_stuff | /gewinnzahlen/getvaluesfromtxtfiles.py | UTF-8 | 2,866 | 3.265625 | 3 | [] | no_license | import os.path
import ast
for x in range(2011, 2021):
print(x)
yearofnumbers = str(x)
filename = yearofnumbers+".txt"
if os.path.isfile(filename):
with open(filename, 'r') as f:
lines = f.readlines()
lines = [x.strip() for x in lines]
counter = 0
... | true |
fc88434b9c8f6f359bbcf04f51067cb8ac9efebc | RedAron/compiladorDefinitivo | /proyecto/static/lexer/Lexer.py | UTF-8 | 945 | 2.953125 | 3 | [] | no_license | import re
class Lexer:
#Funcion para validar
def validar(self,codigo,tokens, Errores):
invalidos = []
codigo = codigo.strip().split('\n')
error = False
for i in range(len(codigo)):
linea = codigo[i]
pos = 0
palabra = ""
while pos < len(linea):
m = None
for token, tipo in tokens:
if ... | true |
26340f6cc1c41546914abe6da081080f6e37ccf1 | Always2KSpiner/Python-Automation-Menu | /client_ansible_menu.py | UTF-8 | 5,000 | 2.59375 | 3 | [] | no_license | import cv2
import time
import numpy as np
import webbrowser
import os
from os import listdir
from os.path import isfile, join
import socket as sk
import pyttsx3 as ts # Import Text to Speech
def speak(msg):
spkr=ts.init() #intialize TTS to a var\n",
spkr.say(msg) #Give text to be Spoken\n",
spkr.runAndWait() #RUn th... | true |
79273130d434669d1f52c232f596e5c58ffb344e | ramity/apexcv | /python/frame.py | UTF-8 | 3,232 | 2.84375 | 3 | [
"Unlicense"
] | permissive | import os
import numpy as np
class Frame:
path = ""
frameNumber = 1
image
cols = 0
rows = 0
# default configured opencv settings
simpleBlurAmount = 25
thresholdType = cv2.THRESH_BINARY
bilateralKernelSize = 9
bilateralSigmaSpace = 9
countourRetrivalMode = cv2.RETR_LIST
... | true |
a9eb3ef2dcb13baf454c4e3ce8ea8c864946d97c | williamjohngardner/football_scraper | /main.py | UTF-8 | 359 | 2.65625 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
hostname = "http://www.nfl.com/player/drewbrees/2504775/careerstats"
content = requests.get(hostname)
souper = BeautifulSoup(content.text, "html.parser")
elements = souper.find(class_="data-table1") #class is a reserved word in Python, the _class is a hack
for stats in... | true |
ce1be8031a450b20050d0bf45a17287ec03064d7 | niewei1264/AnomallyDetectionProject | /OldCode/TraficModelling_PTuning.py | UTF-8 | 8,829 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 8 19:14:52 2018
@author: maiha
"""
from __future__ import division
import pickle
import numpy as np
import time
from FJDA_Learning import Units, ModelParameters, learn, recall
np.set_printoptions(threshold=np.NaN)
"""
By: Fariba
I am trying to find the best parameters f... | true |
ec310e114297e9a289cfd52a234486119981d148 | yuta-komura/amateras | /lib/indicator.py | UTF-8 | 855 | 3.296875 | 3 | [
"MIT"
] | permissive | import pandas as pd
def add_rsi(df: pd.DataFrame, value: int) -> pd.DataFrame:
Price_diff_df = df["Price"].diff()
up = Price_diff_df.copy()
down = Price_diff_df.copy()
up[up < 0] = 0
down[down > 0] = 0
up_sum = up.rolling(value).sum()
down_sum = down.abs().rolling(value).sum()
df["r... | true |
37243b7a63876280d434e974a860304aac79e11f | GSS-Cogs/family-trade | /datasets/ONS-BOP-individual-country-data/main.py | UTF-8 | 2,655 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.13.8
# kernelspec:
# display_name: Python 3.9.12 64-bit
# language: python
# name: python3
# ---
# ### Individual ... | true |
0cedf1765a23f41817ea364e1eb092887e85f9bd | Lucidreline/stack-blog-back-end | /Routes.py | UTF-8 | 2,386 | 2.890625 | 3 | [] | no_license | from Blog import Blog, BlogSchema
from flask import jsonify, request
from application import db, application
@application.route('/blogs') # returns all blogs
def show_blogs():
blogsToReturn = Blog.query.all() # grabs all blogs from database
# turns blogs into dictionary (objects)
blogs_schema = BlogSche... | true |
2730aa6b47f60540bbda30702af7aee496616edf | tomerfiliba/ctor | /ctor/lib.py | UTF-8 | 224 | 3.03125 | 3 | [
"MIT"
] | permissive | class Namespace(object):
def __getattr__(self, name):
obj = Namespace()
setattr(self, name, obj)
return obj
def __bool__(self):
return bool(self.__dict__)
__nonzero__ = __bool__
| true |
4b50ecf6e64e6647ae9ec973be0c7058d9df07f8 | 929241493/PARL-Sample | /eight_puzzle/TestCase.py | UTF-8 | 650 | 2.890625 | 3 | [] | no_license | #coding:UTF-8
import numpy as np
def testCase():
'''
创建一些测试数据
'''
#棋盘的初始状态作为特征
x=[]
x.append(np.array([[1,2,3],[4,0,5]]))
x.append(np.array([[4,1,2],[5,0,3]]))
x.append(np.array([[1,3,2],[5,4,0]]))
x.append(np.array([[1,2,4],[5,0,3]]))
x.append(np.array([[3,5,4],[2,0,1]]))
x.... | true |
3493108b439d7366d1c80d81273bb65aa62eef6e | lcxstar/Hello-World | /2.pandas基础学习/2.3 生成DataFrame并保存.py | UTF-8 | 308 | 3.515625 | 4 | [] | no_license | import pandas as pd
# 创建一个DataFrame对象
df = pd.DataFrame({'ID': [1, 2, 3], 'name': ['jack', 'marry', 'des']})
# 默认索引为0,1,2……,使用set_index可以指定某列为索引
df = df.set_index('ID')
# 将DataFrame存储至excel文件中,参数为文件路径
df.to_excel('df.xlsx')
| true |