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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
1d137652a12700d9a18e7ea640fa494dcd94a7c4 | Python | Bikashacharaya/Jspider_Python | /Square Pattern/pat_2.py | UTF-8 | 284 | 4 | 4 | [] | no_license | '''
0 0 0 0 *
0 0 0 * 0
0 0 * 0 0
0 * 0 0 0
* 0 0 0 0
'''
n = int(input("Enter any input: "))
for row in range(1, n+1):
for col in range(1, n+1):
if row+col == n+1:
print("*", end=" ")
else:
print("0", end=" ")
print()
| true |
105236c28e2b1d74bb3dda1637aba83cee5ce29a | Python | 1996lixingyu1996/gcnn_keras | /kgcnn/layers/sparse/casting.py | UTF-8 | 3,404 | 2.875 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
class CastRaggedToDisjointSparseAdjacency(tf.keras.layers.Layer):
"""
Layer to cast RaggedTensor graph representation to a signle Sparse tensor in disjoint representation.
This includes edge indices and adjacency matrix entries. The Sparse tensor is simply the adjacency... | true |
a93675d5bda99cd3c1a7baea7164cea8ed559517 | Python | matthewsklar/EvolutionSimulator | /Creature.py | UTF-8 | 9,602 | 3.125 | 3 | [] | no_license | import math
import random
import NeuralNetwork
import Utils
vision = Utils.tile_width * 2
class Creature(object):
"""
The creature object
Arguments:
tag: A string for the tag used for Tkinter identification and grouping
x: An integer for the x position between 0 and Utils.board_width
... | true |
2ed13b06154af8451c36cdc8aa0c6feb4392671b | Python | sgmac/vimrc | /install.py | UTF-8 | 887 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
"""
vim configuration
"""
import os
import sys
home = os.getenv("HOME")
config_path = os.path.join(home, '.config')
target = os.path.join(home, '.config/vim/vimrc')
# nvim
try:
os.symlink(os.path.join(os.getcwd(), "nvim"), config_path + "/nvim")
os.symlink(os.path.join(os.getcwd(), "co... | true |
87e3e4a461995e586b865f85127b5fa541f79513 | Python | Madokami/cs498-project | /analysis_utils.py | UTF-8 | 9,078 | 3.296875 | 3 | [] | no_license | import numpy as np
# Simulate trading by using MACD and RSI signals to buy and sell an equity that has higher votality. When the stock is sold,
# always buy the baseline equity with lower votality to make sure the money is being used.
# Parameters:
# ticker: arraylike structure with price of the equity per day
# basel... | true |
8d56cdad405bfb395e00aad5f7f315637a0c11fa | Python | lbzwoaini/CSEM | /preprocess/ori_code_generator.py | UTF-8 | 1,607 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Feb 15 11:02:50 2020
@author: bzli
"""
import pickle
import shutil
import os
original_path = "E:/program_embedding_literature/OJ_CLONE_217_ORIGIN/"
dest_train_path = "E:/program_embedding_literature/OJ_CLONE_217_FILTERED/"
dest_test_path = "E:/program_embedding_literature/OJ... | true |
56b79eaebad337e7e38ecc6e52e3802acc3ebdfb | Python | ammielauren/Fake-Jeopardy | /timer.py | UTF-8 | 227 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 2 22:39:57 2019
@author: maya
"""
import time
sec = 30
while sec != -1:
print (sec)
time.sleep(1)
sec -= 1
#canvas.create_text(text=f'{sec})
| true |
18e772b8e24e4135637cf97303d2369045f31290 | Python | jackd/tf_nearest_neighbour | /scripts/test_nn_distance.py | UTF-8 | 2,411 | 2.6875 | 3 | [] | no_license | #!/usr/bin/python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import unittest
import numpy as np
import tensorflow as tf
from tf_nearest_neighbour import nn_distance
def simple_nn(xyz1, xyz2):
def is_valid_shape(shape):
return len... | true |
d81afa619bc0f19ff199de110fea41742a6ec6f8 | Python | Aasthaengg/IBMdataset | /Python_codes/p03111/s360964920.py | UTF-8 | 615 | 2.546875 | 3 | [] | no_license | n,a,b,c, = map(int,input().split())
l = list(int(input()) for i in range(n))
ans = 10 ** 6
for i in range(4 ** n):
m = i
j = 0
x,xp,y,yp,z,zp = 0,0,0,0,0,0
while m > 0:
p = m % 4
if p == 1:
x += l[j]
xp += 1
elif p == 2:
y += l[j]
y... | true |
ad640beadb56fc98440dabd7d32456efb13b9a57 | Python | intip/merit-market | /core/models.py | UTF-8 | 2,511 | 2.75 | 3 | [
"MIT"
] | permissive | from datetime import timedelta
from datetime import datetime
from django.db import models
from django.conf import settings
def week_range(date=None):
"""
Gently get from
https://bradmontgomery.net/blog/2013/03/07/calculate-week-range-date/
"""
if not date:
date = datetime.now()
year, ... | true |
b6587fbee8fe4d2f7bc06d17d0270e06a5d718e6 | Python | ojjang1/learnPython | /matplotlib/matplotlib_01_basic.py | UTF-8 | 4,359 | 3.84375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 22 11:38:28 2020
@author: USER
"""
# Matplotlib 기본 사용
'''
Matplotlib 라이브러리를 이용해서 그래프를 그리는 일반적인 방법.
Matplotlib 는 방대한 라이브러리
이중 pyplot 를 알아보자.
'''
# Pyplot 소개
'''
matplotlib.pyplot 은
Matplotlib을 MATLAB 과 비슷하게 동작하도록 하는 명령어 스타일의 함수의 모음.
각각 pyplot 함수를 사용해서 그림 (figure)에 변화를 ... | true |
5ed2d77fd92a7134e2d7d65d6898bc1b39a50832 | Python | snauman817/flask-todo | /flask_todo/item.py | UTF-8 | 244 | 2.890625 | 3 | [] | no_license | import datetime
class Item(object):
def __init__(self, task, datetime_created=datetime.datetime.now(), is_completed=False):
self.task = task
self.datetime_created = datetime_created
self.is_completed = is_completed | true |
e5e6c5129f2dd95f94f7ae75a2339e948e88baa4 | Python | w40141/atcoder | /abc_202/b.py | UTF-8 | 206 | 3.421875 | 3 | [] | no_license | string = input()
def tern_str(s):
if '6' == s:
return '9'
elif '9' == s:
return '6'
else:
return s
ans = ''
for s in string:
ans += tern_str(s)
print(ans[::-1])
| true |
1a70b919f9fef949de2de2f58a23c9aa474052ef | Python | hypothesis/h-matchers | /src/h_matchers/matcher/collection/_mixin/contains.py | UTF-8 | 3,383 | 3.109375 | 3 | [
"BSD-2-Clause"
] | permissive | """A mixin for AnyCollection which lets you check for specific items."""
from types import GeneratorType
from h_matchers.decorator import fluent_entrypoint
from h_matchers.exception import NoMatch
from h_matchers.matcher.collection.containment import (
AnyIterableWithItems,
AnyIterableWithItemsInOrder,
Any... | true |
bdd5c882bb19de558103e689d3c7269a950626a4 | Python | lnevesp/text-classification | /preprocessing.py | UTF-8 | 6,726 | 3 | 3 | [] | no_license | #import required packages
#basics
import pandas as pd
import numpy as np
#misc
import gc
import time
import warnings
#viz
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import seaborn as sns
import pyLDAvis.gensim
#nlp
import string
import re #for regex
from nltk.tokenize.toktok import Tokt... | true |
4bc866ffbca283d537e48525ab71988de1f467fd | Python | cumtping/PythonBasic | /100practice/04which_day_of_year.py | UTF-8 | 1,168 | 3.78125 | 4 | [] | no_license | #!/usr/bin/python
# -*- coding: UTF-8 -*-
# http://www.runoob.com/python/python-100-examples.html
import sys
#reload(sys)
#sys.setdefaultencoding('utf-8')
year = int(input('year:'))
month = int(input('month:'))
day = int(input('day:'))
print ('your input: ', year, "年", month, "月", day, "日")
is_leap_year = ((year % 4... | true |
6b18e3cd589cb335e8392a839f0a014fa71a7d3e | Python | adubredu/pub_keyboard_input | /keyboard.py | UTF-8 | 296 | 2.625 | 3 | [] | no_license | import rospy
from std_msgs.msg import String
if __name__ == "__main__":
rospy.init_node("keyboard_pub_node")
pub = rospy.Publisher("/keyboard_input", String, queue_size=1)
while not rospy.is_shutdown():
value = raw_input("Input: ")
msg = String()
msg.data = value
pub.publish(msg)
| true |
87bb6639c69ef6d2e424940c622e33bfea78b8c5 | Python | dex4/FP | /Domain/grade.py | UTF-8 | 1,297 | 3.453125 | 3 | [] | no_license | import unittest
import datetime
class Grade:
def __init__(self, studentID, assignmentID, grd, inDate):
self._sID = studentID
self._aID = assignmentID
self._grade = float(grd)
self._date = inDate
def __eq__(self, g):
if(self._sID == g._sID and self._aID == g._aID and self... | true |
e1cd38abba766f5576753f982ae51aac10a9b5ed | Python | shreyasubbu/pumped | /linear_regression.py | UTF-8 | 3,176 | 2.828125 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn import linear_model
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib.patches as mpatches
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import PolynomialFeatures... | true |
5f11abf697dc1af7f311b2bdaf01488886f61c94 | Python | thanhan1181999/NER-address | /1. data csv/process_caugiay_data.py | UTF-8 | 11,786 | 3.578125 | 4 | [] | no_license | # chương trình này sẽ xử lý dữ liệu dữ liệu cầu giấy
# đầu tiên sẽ lowercase, và bỏ dấu ,
# bước 1: xử lý name.default để lưu thành NER.txt
# chỉ lấy những tên không phải là ghép của số nhà và tên đường
# bước 2 và 3: xử lý number,street,ward,district,province,country
# bước 3: xử lý số nhà
# 1. nếu số nhà kh... | true |
fc844ff804daa966fcb4483766a9524804286651 | Python | frolenkov-nikita/django-braintree | /django_braintree/forms.py | UTF-8 | 5,508 | 2.515625 | 3 | [
"MIT"
] | permissive | import logging
from datetime import datetime
from django import forms
from django_common.helper import md5_hash
from braintree import Customer, CreditCard
from django_braintree.models import UserVault
class UserCCDetailsForm(forms.Form):
__MONTH_CHOICES = (
(1, 'January'),
(2, 'February'),
... | true |
7cd231e9c41e3d7968bc5116192d85f7919c8285 | Python | theproxy/awesome.skating.ai | /exercises/ImageSegmentation/utils.py | UTF-8 | 4,152 | 2.59375 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
from matplotlib import pyplot as plt
from IPython.display import clear_output
import random
from pathlib import Path
import os
# normalize image to [0,1]
def normalize(input_image, input_mask):
input_image = tf.cast(input_image, tf.float32) / 255.0
# segmentation mask {1,2,3} -> {0,1,2... | true |
0ffa23185bb8c6b75448c33504c8f565c1f77e5c | Python | lydavid/CSC401_A1 | /submission/a1_classify.py | UTF-8 | 11,818 | 3.046875 | 3 | [] | no_license | from sklearn.model_selection import train_test_split
from sklearn.feature_selection import SelectKBest
from sklearn.feature_selection import f_classif # chi2
import numpy as np
import argparse
import sys
import os
from sklearn.svm import SVC
from sklearn.metrics import confusion_matrix
from sklearn.ensemble import Ran... | true |
56a5aacf9b9564dd9b0105a83e0361ec65a6930b | Python | sachins0023/DSA-Python | /palindrome.py | UTF-8 | 478 | 3.71875 | 4 | [] | no_license | # import time
# start = time.process_time()
# print(time.process_time() - start)
import time
start = time.process_time()
def palindrome(newstring):
if newstring == '' or len(newstring)==1:
return True
if newstring[0].lower()==newstring[-1].lower():
return palindrome(newstring[1:-1])
else... | true |
2d2413f64137594ae2b2c464e9343e34ba4def01 | Python | murphytalk/finance | /src/finance/common/dao/random.py | UTF-8 | 7,435 | 2.546875 | 3 | [] | no_license | import random
from json import dumps
from finance.common.dao import ImplDao
from finance.common.dao.db import get_sql_scripts
from finance.common.dao.utils import DAY1, FUNDS_NUM, STOCK_NUM, URL, gen_allocation, gen_date, gen_dates, gen_expense_ratio, gen_price, gen_symbol
from finance.common.utils import get_va... | true |
a95f91e9c5bc21aab39f87d2e691a3e8c7edc841 | Python | Anushadsilva/python_practice | /List/csvread.py | UTF-8 | 316 | 3.265625 | 3 | [] | no_license | from csv import reader
if __name__ == '__main__':
with open('prog.csv', 'r') as read_obj:
# pass the file object to reader() to get the reader object
csv_reader = reader(read_obj)
# Pass reader object to list() to get a list of lists
for row in csv_reader:
print(row) | true |
ec368836f38a375fdc44beb2cb33647398efc07b | Python | vendanner/sklearn-tf-source | /4_训练模型/equations.py | UTF-8 | 954 | 3.515625 | 4 | [] | no_license |
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
if __name__ == "__main__":
"""
线性回归正态方程求解
"""
# 随机生成100个0-1之间的数字
X = 2 * np.random.rand(100,1)
# y = 4 + 3 * X 但加入噪声(0-1)
y = 4 + 3 * X +np.random.rand(100,1)
# 常量权重为1
X_b = np.c_[n... | true |
39f43d211580cfef9dd6e6ab5a9794261126b891 | Python | Aasthaengg/IBMdataset | /Python_codes/p02972/s066956254.py | UTF-8 | 256 | 2.65625 | 3 | [] | no_license | n =int(input())
A = list(map(int,input().split()))
B = [0]*n
for i in range(n)[::-1]:
tmp = 0
j = i+1
while j<=n:
tmp += B[j-1]
j += i+1
if tmp%2 != A[i]:
B[i] = 1
print(sum(B))
print(*[i+1 for i in range(n) if B[i]]) | true |
8ae3b833baacbce0547b95de3b01bec024b71ea3 | Python | sheridanfew/pythonpolarisation | /BasicElements/Position.py | UTF-8 | 447 | 3.25 | 3 | [] | no_license | from numpy import matrix, sqrt
from Rotation import Rotation
import numpy as np
class Position(matrix):
""" inherit matrix and call it a position
"""
pass
def rotate(self, rot):
if isinstance(rot, Rotation):
print self
print rot
return (self*rot)
raise TypeError('positions myust be rotated by r... | true |
fb6ae6fbdca7cbd2a53aa98e1b80a6b51b8df1ca | Python | Chestermozhao/scraper_Taiwan_stock | /輸入台股代碼存進mongo資料庫.py | UTF-8 | 3,320 | 2.828125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup as bs
import re
import time
import random
from pymongo import MongoClient
from pprint import pprint
from pymongo import ReturnDocument
from bson.objectid import ObjectId
from pymongo import ASCENDING, DESCENDING
class MongoDBManage:
def __init__(self):
self.c... | true |
04d71869319061aa64fc5f652fb17efa6428ff64 | Python | cerebroai/AskIt | /interactive_bot.py | UTF-8 | 2,560 | 2.71875 | 3 | [
"MIT"
] | permissive | # Copyright (c) polakowo
# Licensed under the MIT license.
import configparser
import argparse
import logging
from model import download_model_folder, load_model
from decoder import generate_response
# Enable logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.I... | true |
80bc842179681a0d4a438bf27f02012f570ae701 | Python | lshlsh135/LeeSangHoon | /크롤링/telegram_bot.py | UTF-8 | 802 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 14 15:28:21 2017
@author: SH-NoteBook
"""
import telegram
my_token = '413222030:AAG-Yz8eDMfJ-XNCw9UceSVZ7RXNM8EDlvE'
bot = telegram.Bot(token = my_token) #bot을 선언합니다.
updates = bot.getUpdates() #업데이트 내역을 받아옵니다.
for u in updates : # 내역중 메세지를 출력합니다.
print(u.mess... | true |
00f46166f19bdbc0e3d627e03a75af9d1ee91967 | Python | korteelko/scripts | /cparser_lite.py | UTF-8 | 8,260 | 3.34375 | 3 | [] | no_license | """
Модуль парсинга и генерации С файлов
"""
import re
def cpp_comment_remover(text):
"""
Убрать комментарии из C/C++ файлов
:param text: С/С++ исходники
:return: Исходники без комментариев
:TODO Replace to separated file
"""
def replacer(match):
s = match.group(0)
if s.st... | true |
4878291c1f2419906ff16803e128fb4473ab38fc | Python | samutamm/RI | /Featurer.py | UTF-8 | 3,836 | 2.75 | 3 | [] | no_license |
import numpy as np
import pandas as pd
from TextRepresenter import PorterStemmer
from Weighter import WeighterVector
from IRModel import BM25Model
from RandomWalk import whole_graph, PageRank2
def idf(N, num_documents):
return np.log(N / (num_documents + 1))
class Featurer:
def __init__(self, index, models... | true |
14ac35d9b4a86841ad54f5d96d98da509d8b9c27 | Python | dorado-lmz/testrepository | /test/listtests.py | UTF-8 | 327 | 2.5625 | 3 | [] | no_license | __author__ = 'lmz'
import unittest
class ListTest(unittest.TestCase):
def runTest(self):
print "sfsdf"
def suite():
suite = unittest.TestSuite()
testcase = ListTest()
suite.addTest(testcase)
return suite
if __name__ == '__main__':
suite = suite()
runner = unittest.TextTestRunner()
runner.run(sui... | true |
cc62ed7d70f672fe781435e2a7877aea39e8167f | Python | cindy-cho/University-Lectures | /컴퓨팅 사고력/final 대비/튜플.py | UTF-8 | 142 | 3.359375 | 3 | [] | no_license | '''튜플'''
D = {3: '사과', 4: '배', 1: '오렌지', 2:'바나나'}
L = list(D.items())
print(L)
print(type(L))
L = sorted(L)
print(L) | true |
f23a67078a82ab85bb2d07fc8869bddcf8825431 | Python | sanscore/selenium-chrome-screenshot | /test/test_chrome_screen.py | UTF-8 | 660 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | import sys
from chrome_screen.webdriver import ChromeScreenshot
# TODO: Create REAL TESTS
# * Find some method that should create perfect rendering, canvas? svg? ??
# * Create some Test Cards using 'perfect rendering' method.
# * Screenshot page
# * Use Wand\Image Magick to check for correctness
# * Com... | true |
9a92b05ae7d1032c3e7edb4e46b09326737fb382 | Python | Delictum/selenium_and_python | /module2_useful_methods/lesson2_step6_execute_script.py | UTF-8 | 1,246 | 3 | 3 | [] | no_license | """
The task: https://stepik.org/lesson/228249/step/6?unit=200781
"""
from selenium import webdriver
import time
from math import log as ln, sin
tested_link = "http://suninjuly.github.io/execute_script.html"
try:
browser = webdriver.Chrome()
browser.get(tested_link)
input_value_x = browser.find_element_... | true |
2d8d957f3a0e6c9fe7817c319c1e8301d28f3153 | Python | schoothubber/qtl_project | /qtl/common/from_trait_to_genelist.py | UTF-8 | 19,170 | 3.21875 | 3 | [] | no_license | ###############################################################################
#################################WOUTERS#######################################
###################################CODE########################################
###############################################################################
... | true |
565135a9c702f5580d3de6f840eaff466072af25 | Python | JoosikHan/Effective-Python-temp | /files/BetterWay17_IterateDefensively.py | UTF-8 | 6,878 | 3.796875 | 4 | [] | no_license | import os
# 66쪽. 인수를 순회할 때는 방어적으로 하자.
# 2016/09/02일 작성.
#####################################################################################################
# 어떤 상황에서 리스트, 제너레이터를 써야 할까? 제너레이터의 한계나 문제점은 없을까? 알아보자.
# 가정상황은 한 시의 도시들의 인구수를 담은 데이터 파일이 있고 그것을 로드해서 정규화한다고 생각하자.
# 그 파일이 있는 디렉토리로 이동한다. 이 설정은 내 노트... | true |
93fd96c39a0db3930c2c3dad96f251f71c7547b3 | Python | Alexeuijinjung/Webpage | /FirstPythonGame-p5/Main.py | UTF-8 | 4,050 | 3.15625 | 3 | [] | no_license | import pygame
import Projectile
pygame.init()
screen = pygame.display.set_mode((800, 600))
pygame.font.init()
myfont = pygame.font.SysFont('Comic Sans MS', 30)
done = False
player1 = pygame.image.load("smallCharacter.png")
player1x = 100
player1y = 100
player1dir = "right"
player1HitBox = player1.get_rect()
p1Bullet... | true |
0eaebfd3afc41350221d6157454c5c986fa8f32f | Python | jamesfry/brownfield-land-collection | /bin/convert.py | UTF-8 | 1,741 | 3 | 3 | [
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | #!/usr/bin/env python3
#
# convert XLS or CSV file into a CSV file encoded in UTF-8
#
import sys
from io import StringIO
from cchardet import UniversalDetector
import csv
import pandas as pd
import logging
def detect_encoding(path):
detector = UniversalDetector()
detector.reset()
with open(path, "rb") ... | true |
8c0f0edfabd027ac3d48d9c97799b000669829ae | Python | jaykwok/City-Related-Report-Distance | /outputbeta.py | UTF-8 | 3,462 | 2.71875 | 3 | [] | no_license | from pandas import Series,DataFrame
from sklearn import linear_model
import pandas as pd
import tkinter as tk
import numpy as np
import matplotlib.pyplot as plt
from tkinter import filedialog
#设置基本参数
K=1
#设置基本变量
I=[]
D=[]
Cii=[]
Cjj=[]
R2=[]
X=[]#回归模型的x坐标
#输入count文件
print('select count file in csv format\n')
root =... | true |
35242087ad2467dff512546df381e01cb2b6ed66 | Python | JangJur/Python-Practice | /5-13(Strange Math1).py | UTF-8 | 65 | 3.0625 | 3 | [] | no_license | i = 0
while i < 100:
if(i % 12):
print(i)
i += 8 | true |
e2b58644482f3930460f4344ebcd5bef89894ae4 | Python | compatibleone/accords-platform | /tools/codegen/OCCI/Collection.py | UTF-8 | 2,146 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | '''
Created on 28 Mar 2013
@author: Jonathan Custance
'''
import Cardinality
import Scope
class MultiplicityException(Exception):
'''
Exception for multiplicty parsing
'''
def __init__(self, msg):
'''
Constructor
@param msg: Exception message
'''
self.msg =... | true |
eb58ba4ae13a06f5e82c6efe0bef393f3142e1f8 | Python | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/phone-number/e641368a4ef74bfbbba39dca866e0c3b.py | UTF-8 | 621 | 3.59375 | 4 | [] | no_license | class Phone(object):
def __init__(self, number):
self._number = number
@property
def number(self):
number = self._number
if len(number) == 11:
if number[0] == '1':
number = number[1:]
else:
number = '0' * 10
if len(num... | true |
a5e1a7c6e240fc0262ff97543c7fa28522fe82b4 | Python | jbesemer/TeensyGenerators | /Tools/recentchanges.py | UTF-8 | 3,059 | 2.953125 | 3 | [] | no_license | #! env python
import os, os.path, re
import datetime
import math
SFlag = True # sort output
NFlag = False # just list names
CutOffDate = datetime.datetime.now() - datetime.timedelta( days=2 )
def StripMicrosec( timestamp ): return timestamp .replace( microsecond=0 ) # http://stackoverflow.com/questions/7999935/pyth... | true |
e235927c839e44bb4c939e737e9305969d8c9381 | Python | Louis-sf/BIS-398-498-LiuShufan | /Assignment3/Assignment3-Exersice 5.15.py | UTF-8 | 2,640 | 4.03125 | 4 | [] | no_license | #5.15 (Tuples Representing Invoices) When you purchase products or
#services from a company, you typically receive an invoice listing what you
#purchased and the total amount of money due. Use tuples to represent
#hardware store invoices that consist of four pieces of data—a part ID
#string, a part description stri... | true |
2b3d69e9ffe589c6429f0d07eaa8f87310503506 | Python | ngowi/Anagram_checker | /anagram2.py | UTF-8 | 641 | 4.15625 | 4 | [] | no_license | # Anagram checker
# Author: Michael Jordan
# Email:michael53161@gmail.com
def character_count(string):
characters = {} # declaring empy dictionary
for ch in string:
if ch in characters:
characters[ch] = character[ch]+1
else:
characters[ch] = 1
return characters
d... | true |
101938d14b9e875961f0d8ac47beac38611d3552 | Python | olinkaz93/Algorithms | /Interview_Examples/Leetcode/628_MaximumProduct.py | UTF-8 | 1,722 | 4.15625 | 4 | [] | no_license | """
628. Maximum Product of Three Numbers
Easy
Given an integer array nums, find three numbers whose product is maximum and return the maximum product.
Example 1:
Input: nums = [1,2,3]
Output: 6
Example 2:
Input: nums = [1,2,3,4]
Output: 24
Example 3:
Input: nums = [-1,-2,-3]
Output: -6
Constraints:
3 <= nums.... | true |
1e251e0db354e0f332764f0f6c277651a1d0a66d | Python | xdjzhh/algorithm | /01背包变种.py | UTF-8 | 1,398 | 3.4375 | 3 | [] | no_license |
def getMaxGain(n, x, y):
mx = max(x) # 获取最大值,作为差的边界
dp = [[0] * (mx+1) for _ in range(n+1)] # 初始化dp
for i in range(1, n+1):
for j in range(mx+1):
tmp1, tmp2 = 0, 0
if j - x[i-1] >= 0: # 这张卡牌给小a
tmp1 = dp[i-1][j-x[i-1]] + y[i-1]
if j + x[i ... | true |
ad0de2d138bfb2b8f8bcbc9a043b7f732ddc2a8d | Python | skaws2003/DeepMaple | /MapleGrab/MapleGrab/debug/debug_old_class_to_new_class.py | UTF-8 | 455 | 2.515625 | 3 | [
"MIT"
] | permissive | import os
path = './Arrow/'
dir = 'up_'
full = 0
empty = 0
for i in range(500):
try:
os.rename(path+"full_"+dir+str(i)+'.bmp', path+"full_"+dir+str(full)+'.bmp')
full+=1
print(str(i))
except FileNotFoundError:
try:
os.rename(path+"empty_"+dir+str(i)+'.bmp', path+"e... | true |
143adb767ab6cee554bc5de3094d47d08640e084 | Python | gabrielqueiroz1/exercicios_uri | /bhaskara-uri.py | UTF-8 | 499 | 3.140625 | 3 | [] | no_license | from math import sqrt
A, B, C = [int(i) for i in input().split()]
r1 = r2 = 0
try:
form = (B ** 2) - (4 * A * C)
r1 = (- B + (sqrt(form))) / (2 * A)
r2 = (- B - (sqrt(form))) / (2 * A)
if r1 != 0 and r2 != 0 or r1 < 0 and r2 < 0:
print("R1 = {:.5f}".format(r1))
print("R2 = {:.5f}".forma... | true |
fad3eac2178a5a1360caa19e9642df7af4759027 | Python | WilPermenter/MSUHack2020-AllFiles | /security/python files/talking.py | UTF-8 | 561 | 2.984375 | 3 | [
"MIT"
] | permissive | import serial
from email_command import read_mail
#double check the tty
#1 on 2 off
def get_input():
return read_mail()
def command1(ser):
ser.write(str.encode('0'))
def command2(ser):
ser.write(str.encode('1'))
def command3(ser):
ser.write(str.encode('2'))
def send_command(seri):
ser =... | true |
5c7f654636c6b4cfa4c1ba48fd7f73f5e4510cce | Python | rory-linehan/keras-yolo3 | /gen_anchors.py | UTF-8 | 3,441 | 2.84375 | 3 | [
"MIT"
] | permissive | import random
import numpy as np
import json
from .voc import parse_voc_annotation
def IOU(ann, centroids):
w, h = ann
similarities = []
for centroid in centroids:
c_w, c_h = centroid
if c_w >= w and c_h >= h:
similarity = w * h / (c_w * c_h)
elif c_w >= w and c_h <= ... | true |
c8cc7e2d016732271c9134c84240f57cdfea4f09 | Python | sidd5sci/python-basics | /graph in python/graph.py | UTF-8 | 353 | 3.28125 | 3 | [] | no_license | import math
import time
class vertex:
def __init__(self,_vertex):
self.data = _vertex
self.neighbour = list()
def add_neighbour(self,_vertex):
self.neighbour.append(_vertex)
def remove_neighbour(self,_vertex):
i = 0
for v not in self.neighbour:
i+=1
... | true |
d59be45cc6c6a105fba1d2ca5d37140258aab6fa | Python | 307guojiawei/Linuxer | /src/core/StartupAnalyse.py | UTF-8 | 1,193 | 2.8125 | 3 | [
"MIT"
] | permissive | # 本文件用于分析系统启动过程,生成启动过程svg,获取启动时间,获取所有系统服务并设置是否可以自启动等功能
import os
def getStartupInfo():
res = dict()
res['boot_time'] = getBootTime()
res['critical_chain'] = getCriticalChain()
return res
def getStartupSVG():
res = dict()
res["svg"] = getSvg()
return res
def getBootTime():
with os.po... | true |
ec1c312f2502bc63e51b8ae88891a8e1080e94ab | Python | n-fink/arcgis-python-serverless-example | /Exercise1/update.py | UTF-8 | 1,271 | 2.703125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
""" A python script that updates a feature service in an ArcGIS portal
"""
__author__ = "Nick Fink"
__contact__ = "nicholas.fink@nltgis.com"
__copyright__ = "Copyright 2021 New Light Technologies, Inc."
__date__ = "2021/01/26"
__license__ = "MIT"
import pandas
from arcgis import GIS
import os
im... | true |
acccabeb84dd57d063700d3806c8f40c3fd5be5a | Python | JoshuaW1990/leetcode-session1 | /leetcode113.py | UTF-8 | 1,598 | 3.859375 | 4 | [] | no_license | """
DFS with stack: top down
"""
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def pathSum(self, root, sum):
"""
:type root: TreeNode
:type sum... | true |
dae1a0aa8a65961a77f8f6c32d3c6b8169f5cc53 | Python | enshuoh/UMichTWSE101 | /Material/PP01/lab.py | UTF-8 | 521 | 3.25 | 3 | [] | no_license | class Dog():
def bark(self):
print('dog bark')
class Dog1(Dog):
def bark(self):
print('dog1 barkd')
class Dog1(Dog):
def bark(self):
print('dog1 bark')
class Husky(Dog1, Dog):
pass
# def bark(self):
# super(Husky, self).bark()
# print('husky woof')
# def ... | true |
d26ac3341047d7d2e1b18ebb3d13424ab0118efb | Python | ChristopherSClosser/python-data-structures | /src/test_stack.py | UTF-8 | 1,563 | 3.859375 | 4 | [
"MIT"
] | permissive | """"Test for stack module."""
from stack import Stack
from linked_list import LinkedList
import pytest
def test_stack_init_has_properties():
"""Test to see if init gives stack instance properties."""
s = Stack()
assert s.length == 0
def test_stack_is_subclass_of_linked_list():
"""Test to see if sta... | true |
23572ad9d030a7dcafd36544397e54441693a042 | Python | drkspace/CodingandProgrammingFBLA | /src/employee.py | UTF-8 | 18,549 | 3.171875 | 3 | [] | no_license | #(c)Daniel Robert Kramer,2017. All Rights Reseved
from fec_global_variables import *
from fec_helper_methods import *
import ttk
class _employee(object):
def addEmployee(self):
#Create a new frame for the modules to be put into and to be deleted later on
frame = Frame(window)
frame.grid(row=0, column=0, stick... | true |
ea769a30ad105813bfa5a16eaadbdb18e868bd87 | Python | oceantechsun/Supervised_Learning | /adaboost.py | UTF-8 | 7,590 | 3.015625 | 3 | [] | no_license | # Load libraries
from sklearn.ensemble import AdaBoostClassifier, RandomForestClassifier
from sklearn import datasets
# Import train_test_split function
from sklearn.model_selection import train_test_split
#Import scikit-learn metrics module for accuracy calculation
from sklearn import metrics
import pandas as pd
impor... | true |
a21758ffbaccf92afa60b4678f95e08b6177fc42 | Python | alfonso-torres/data_types-operators | /data_types&Operators.py | UTF-8 | 993 | 4.71875 | 5 | [] | no_license | # Let's see the data types in action
a = 24 # Int
b = 16 # Int
c = 5.5 # float
# Let's check the boolean values
print(a > b)
print(a < b)
# Let's look at some built in methods for boolean
greetings = "Hello World!"
# isalpha() helps us find if the variable holding letters without spaces and special characters
print(... | true |
f01d1d876ef6a0d86bad3d0ecec11792b95e0d96 | Python | austinbean/ops | /hipaa_request.py | UTF-8 | 2,870 | 2.578125 | 3 | [] | no_license | # hipaa request
# TODO - don't use this one. ndc_selen.py actually works.
import csv
import pickle
import requests # for python3 requires pip3 install requests the first time
import urllib
from lxml import etree
import numpy as np
import time
import json # https://www.w3schools.com/python/python_json.asp
# read... | true |
8bb42595e8e6ed8c749f0e5f91c7c7599ef0859c | Python | sebrig/mipssim | /mipssim/mipssim.py | UTF-8 | 2,685 | 2.796875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
#
# Copyright (c) 2011-2014, Julien-Charles Lévesque <levesque.jc@gmail.com>
# and contributors.
#
# Distributed under the terms of the MIT license. See the COPYING file at
# the top-level directory of this project and at
# https://bitbucket.org/ulaval-gif-3000/mipssim/raw/tip/COPYING
'''
'... | true |
73adde52109a5aa16ebfc5ef6b2ac3458e38e734 | Python | nickmcadden/Kaggle | /NCAA/2016-17/code/cumulative_aggs.py | UTF-8 | 4,494 | 2.578125 | 3 | [] | no_license | import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
from string import replace
# Input data files are available in the "../input/" directory.
# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory
data_dir... | true |
b171cce9650116d4ff1034dc54005fe88effee85 | Python | bh0085/programming | /Python/python-musicbrainz2-0.7.0/test/test_wsxml_artist.py | UTF-8 | 4,192 | 2.515625 | 3 | [
"BSD-2-Clause"
] | permissive | """Tests for parsing artists using MbXmlParser."""
import unittest
from musicbrainz2.wsxml import MbXmlParser, ParseError
from musicbrainz2.model import NS_MMD_1
import StringIO
import os.path
VALID_DATA_DIR = os.path.join('test-data', 'valid')
INVALID_DATA_DIR = os.path.join('test-data', 'invalid')
VALID_ARTIST_DIR ... | true |
e04d774e1d53d2276f191036cdbfb63206e0df8d | Python | zanariah8/Starting_Out_with_Python | /chapter_06/q04.py | UTF-8 | 671 | 4.4375 | 4 | [] | no_license | # this program displays the numbers of names
# that are stored in names.txt file
def main():
try:
# initialize an accumulator
total = 0.0
# open the file
infile = open("names.txt", "r")
# read the lines and count the number of names in the file
... | true |
2e5bbf95a99a1ce75f14830977f6e567de6349ce | Python | sohumd96/CTCI | /Chapter1/Problem4/permPalindrome.py | UTF-8 | 295 | 2.921875 | 3 | [] | no_license | def pal_perm(s):
s = s.replace(" ", "")
map = {}
for c in s:
if c in map:
map[c]+=1
else:
map[c] = 1
count = 0
for c in map:
if map[c]%2 == 1:
count +=1
if count > 1:
return False
return True | true |
436908ce5d7831c9e3bcc0beb8f6fd46ad66c060 | Python | gjq91459/mycourse | /Additional Topics/Profiling/src/myprogram.py | UTF-8 | 748 | 3.140625 | 3 | [] | no_license | import random, time
count = 0
n = 100
def f1():
global count
for i in xrange(n):
sleepy()
count = count + i
def f2():
global count
for i in xrange(2 * n):
sleepy()
count = count + i
def f3():
global count
for i in xrange(3 * n):
sleep... | true |
c294b456bb4b133d014d2d8e76a8a172d99bfbb2 | Python | tomerzd4444/spotifyLyricsGenerator | /main.py | UTF-8 | 2,120 | 2.609375 | 3 | [] | no_license | import spotipy
from Song import Song
from spotipy.oauth2 import SpotifyOAuth
from dotenv import load_dotenv
import os
import lyricsgenius
import time
from tkinter import *
import tkinter.font as tkFont
from requests.exceptions import ConnectionError
root = Tk()
var = StringVar()
fontStyle = tkFont.Font(size... | true |
51351ecb11dd8e2d25625b243cdf01fcc6f20fa5 | Python | abner-lucas/tp-cruzi-db | /env/Lib/site-packages/Bio/pairwise2.py | UTF-8 | 52,617 | 3.71875 | 4 | [
"MIT"
] | permissive | # Copyright 2002 by Jeffrey Chang.
# Copyright 2016, 2019, 2020 by Markus Piotrowski.
# All rights reserved.
#
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
# Please see the LICENSE file that should have been included ... | true |
6f72ee3e2b0cb4c81b544ab6eea258d0ae0978fe | Python | hubba368/PythonSocket | /pclient.py | UTF-8 | 2,305 | 3.296875 | 3 | [] | no_license | import select
import sys
import socket
import string
import threading
win = False
score = 0
#This method checks the signal sent from server after user has inputted their guess.
def CheckAnswer(answer):
guess = answer
if guess == "Far\r\n":
print("Your guess is too far."... | true |
9fd4d9bba529bc63de6273813e3f66519f51744b | Python | xxyy1/efficient-decision-tree-notes | /tgboost.simple/tests/test_pool.py | UTF-8 | 214 | 2.546875 | 3 | [] | no_license | import numpy as np
from multiprocessing import Pool
features = np.random.random((10,5))
def func(feature):
return feature[0]
pool = Pool()
rst = pool.map(func,features)
pool.close()
print rst
print features | true |
f828a69460375e2c5c574ebdc8fe99e6078ca59d | Python | cagrisayir/OpenCv-Basics | /argparse/simple_example.py | UTF-8 | 335 | 3.46875 | 3 | [] | no_license | # import the necessary packages
import argparse
# construct the argument parse and parse the argument
ap = argparse.ArgumentParser()
ap.add_argument("-n", "--name", required=True, help="name of the user")
args = vars(ap.parse_args())
# display a friendly message to the user
print(f"Hi there {args['name']}, it's nice ... | true |
3e603ba8fdd6a4dd494ae3ba4d5c5a7fdd48cb94 | Python | sumba254/Daniel-Sumba-cohort-14-BootCamp-week-1 | /fizz_buzz.py | UTF-8 | 203 | 3.6875 | 4 | [] | no_license | def fizz_buzz(number):
if (number % 5 == 0 and number % 3 == 0):
print "FizzBuzz"
elif (number % 5 == 0):
print "Buzz"
elif (number % 3 == 0):
print "Fizz"
else:
print (number)
fizz_buzz(8)
| true |
985fd4d921b3845cd2cc2210c0bffd23c9a0f649 | Python | ds-gurukandhamoorthi/intro-python-exs | /Element.py | UTF-8 | 1,292 | 3.234375 | 3 | [] | no_license | import sys
import csv
import pandas as pd
import re
class Element:
def __init__(self, element, number, symbol, weight):
self._element = element
self._number = number
self._symbol = symbol
self._weight = weight
def __str__(self):
return self._element + '(' + self._symbol ... | true |
8abfa85407965a6e86e4e0207906df85b3f514fd | Python | ahathe/some-a-small-project | /MyPython/Dict/FBNQ.py | UTF-8 | 351 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python
def run(num):
a = 1
b = 1
c = num / 2
d = num % c
if d == 1:
c = c + d
while c > 0:
print a
print b
a = a + b
b = a + b
c -= 1
if c == 1:
print a
break
else:
while c > 0:
print a
print b
a = a + b
b = a + b
c -= 1
get1 = int(raw_input("get ... | true |
a4ff230ba15d5da9618b9ed2ad962406cdcbb985 | Python | VEymeric/Python | /TP2/TrouveFigure.py | UTF-8 | 7,064 | 3.234375 | 3 | [] | no_license |
def VerifPartie2(jeu):
"""
:param jeu: Carte
:return: liste classique en fonction de Suite Couleur Quint flush et quint flush royale
"""
liste = MetTabloSuite(jeu)
essaiCouleur = identifierCouleur(jeu) #Verifie si on a une couleur
essaieSuite = identifieSuite(liste) #Verififie si ... | true |
e94390e0dbabba92d1af00f1c02e9ac6b2295709 | Python | Darthfett/A-Priori-Physics-System | /src/debug.py | UTF-8 | 1,224 | 3.28125 | 3 | [] | no_license | """
The Debug module provides some basic information on managing the debugging
state of the game.
globals:
Debug An object used to determining debugging state.
Returns a truthy value in a boolean context.
"""
_DebugMode = False
class _Debug:
"""
Repre... | true |
7f109ba232a8533320a9b4bb67e1d42406e0bd19 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_117/1377.py | UTF-8 | 2,953 | 3.109375 | 3 | [] | no_license | #!/usr/bin/python
import fileinput, math
class Case(object):
casenum = 0
board = None
finalboard = None
solution = ""
def __init__(self, casenum, board):
self.casenum = casenum
self.finalboard = board
self.board = []
for i in self.finalboard:
... | true |
e893e3c98c1a654b6f511225e8ee5f1e22359135 | Python | odessitka/MyDaftSearches | /HelperClasses.py | UTF-8 | 3,173 | 2.859375 | 3 | [] | no_license | import googlemaps
dart_stations = ["Grand Canal Dock Train Station","Lansdowne Road Train Station", "Sandymount Train Station",
"Sydney Parade Train Station", "Blackrock Train Station","Booterstown Train Station",
"Seapoint Train Station", "Salthill And Monkstown Train Station","Dun Lao... | true |
f703bb3ce7274bf9cbb02ee2b71fb7e4f85c538f | Python | eualissonsantana/formatador-topdata | /main.py | UTF-8 | 642 | 2.75 | 3 | [] | no_license | import pandas as pd
import xlrd
data = pd.read_excel(r"C:\Users\aliss\PycharmProjects\formatador-topdata\funcionarios-malu.xlsx")
arquivo = open("importacao-topdata.txt", "w")
def name_limited(nome):
new_name = ''
cont = 0
while(cont < 12):
if(nome[cont] == ' '):
cont = 12
else... | true |
071ce1a44c48c1c169bff5fdd4b6dcda3394b525 | Python | fysoft2006/aredis | /aredis/utils.py | UTF-8 | 514 | 2.796875 | 3 | [
"MIT"
] | permissive | import asyncio
def b(x):
return x.encode('latin-1') if not isinstance(x, bytes) else x
def iteritems(x):
return iter(x.items())
def iterkeys(x):
return iter(x.keys())
def itervalues(x):
return iter(x.values())
async def exec_with_timeout(coroutine, timeout):
if timeout:
return awai... | true |
4675a0fb4e2738e9cd8f6a0d97ad12e3ea8d6b6c | Python | hkamra/Python | /python-masterclass-udemy/ProgramFlow/timesTable.py | UTF-8 | 261 | 3.96875 | 4 | [] | no_license |
for i in range(1, 21):
for j in range(1, 11):
if j == 10:
print("{0} x {1} {3:>2} {2:>3}".format(i, j, i * j, "="))
else:
print("{0} x {1:>2} {3:>2} {2:>3}".format(i, j, i * j, "="))
print("------------------")
| true |
c9b1ed675ffab53fb82298dc01e9757b3453591f | Python | YeskendirK/CtCI-6th | /Chapter 4. Trees and Graphs/check_balanced.py | UTF-8 | 769 | 3.359375 | 3 | [] | no_license | def get_height(root):
if root is None:
return -1
return max(get_height(root.left), get_height(root.right)) + 1
def check_balanced(root):
if root is None:
return True
diff = get_height(root.lef) - get_height(root.right)
if abs(diff) > 1:
return False
else:
check_... | true |
168d55f942f08af4b19b62d631f3167777ad16a5 | Python | goncalocarito/leetcode | /9.py | UTF-8 | 1,646 | 3.765625 | 4 | [] | no_license | # Description: https://leetcode.com/problems/palindrome-number/description/
# Code
import unittest
class Solution:
# space complexity 0(n)
# time complexity 0(n)
# faster
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
x = str(x)
return x ... | true |
b878cafafa4db8ee02b55d500075b2a87ec8513a | Python | MihirDharmadhikari/ses_nav_stack | /scripts/rrt_st_path_atamn.py | UTF-8 | 9,302 | 2.75 | 3 | [] | no_license |
#!/usr/bin/env python
import matplotlib.pyplot as plt
import random
import math
import copy
import time
# import rospy
from shapely.geometry import Polygon
from shapely.geometry import Point,LineString
from descartes import PolygonPatch
#show_animation = False
THR = 0.8
class RRT():
"""
Class for RRT Pla... | true |
bc2ce8e5cd545f91164b62a9b7bf193e5a2857e1 | Python | ndearaujo/python-functions | /Program_4-13.py | UTF-8 | 391 | 3.703125 | 4 | [] | no_license | tax_factor = 0.0065
print('Enter the property lot number')
print('or enter 0 to end.')
lot = int(input('Lot number: '))
while lot !=0:
value = float(input('Enter the property values: '))
tax = value * tax_factor
print('Property tax: $', format(tax, ',.2f'), sep='')
print('Enter the next lot number ... | true |
28d2002ffd4b3dcadcdb89a10bc98d2666bf9dc4 | Python | codizard/Coding-problems | /ctci/Recursion and Dynamic Programming/towers_of_hanoi.py | UTF-8 | 128 | 3.234375 | 3 | [] | no_license | def towers_of_hanoi(n):
if n == 1:
return 1
return towers_of_hanoi(n-1) + 1 + towers_of_hanoi(n-1)
print towers_of_hanoi(4) | true |
db732cce6f854a642a6c55a8818aea2038d6edb0 | Python | My-selforever/Movies | /Movies!!!/main.py | UTF-8 | 440 | 2.65625 | 3 | [] | no_license | import csv
from flask import Flask, jsonify, request
app = Flask(__name__)
f = open('Movies.csv',encoding="utf-8")
r = csv.reader(f)
data = list(r)
allMovies = []
allMovies = data[1:]
Liked = []
Disliked = []
Unwatched = []
@app.route('/get-all-movies')
def getMov():
return jsonify(... | true |
9e92dc76b98a8df0691e350269a8c318c4503b4c | Python | DennisBaerXY/Programming-Projekt-HS | /utils.py | UTF-8 | 276 | 2.859375 | 3 | [] | no_license | from random import randint
def random_chiffren_key_generator(keyLength):
key = ""
for i in range(keyLength):
random = randint(65, 90)
zeichen = chr(random)
key = key + zeichen
return key
def random_shifts():
return randint(1, 25)
| true |
1058b436494ef92252111ef18425eb1a3dfc19f5 | Python | manisero/SemViii | /WEDT/algorithm/imagebasedwebsiterecognizer.py | UTF-8 | 2,028 | 3.015625 | 3 | [
"WTFPL"
] | permissive | """
Image-based social media website recognizer.
@author: Jakub Turek
@contact: jkbturek(at)gmail(dot)com
@date: 03-05-2013
@version: 1.0
"""
class ImageBasedWebsiteRecognizer:
def is_image_based_website(self, html, tree_builder, tree_browser, configuration_provider):
"""
@typ... | true |
b6bf1e705fcffe3fa695fd653eadd20572e8ff7b | Python | asimos-bot/cracken | /kasiski.py | UTF-8 | 4,140 | 3.125 | 3 | [] | no_license | #return a list
#[n_repetitions_of_given_substring, space_between ]
#it ignores the first find, returning None if the substring doesn't repeat or if space between repetitions change
def repetitions(text, substring, start=0):
result = [-1]
idx = 0
last_idx=-1
start_idx = start
while( True ):
... | true |
e132b70eae683d39d920379dfc7ec9edcb4e671f | Python | AhmadSaad7/dutymanage | /db_connect.py | UTF-8 | 545 | 2.671875 | 3 | [] | no_license | import sqlite3
conn = sqlite3.connect('user.db')
c = conn.cursor()
# c.execute("""CREATE TABLE user(
# name text,
# email text,
# password text
# )""")
#c.execute("INSERT INTO user VALUES ('saad', 'ahmad.saad2636@gmail.com', 'madwalker')")
#conn.commit()
#c.execute("INSER... | true |
05760522504770dd2c776f3b84cd998a6ef7f906 | Python | aihill/paccar | /hmm_fit_example.py | UTF-8 | 505 | 2.59375 | 3 | [
"MIT"
] | permissive | import numpy as np
from hmmlearn import hmm
np.random.seed(42)
X1 = [[0.0,23.0,101.5, 0], [0.0,22.0,101.5, 0], [0.0,23,101.7, 0]]
X2 = [[0.0,24.68,102.0, 0], [0.0,24.5,103.5, 0.2], [0.0,25.5,103.2, 0.5], [0.0,26.5,103.2, 1]]
X = np.concatenate([X1, X2])
lengths = [len(X1), len(X2)]
num_states = 3
# HMM model with Ga... | true |
f88710dce433536ead3430179a7cbf785a1ce538 | Python | dchapp/blind75 | /python/43_multiply_strings.py | UTF-8 | 634 | 3.859375 | 4 | [
"MIT"
] | permissive |
def single_digit_times_single_digit(lhs, rhs):
return int(lhs) * int(rhs)
def multi_digit_times_single_digit(lhs, rhs):
product = 0
exponent = 0
for digit_idx in range(len(lhs)-1, -1, -1):
product += 10**exponent * single_digit_times_single_digit(lhs[digit_idx], rhs)
exponent += 1
... | true |
08020cfdb59055b2dc1f62cd3b22e7f084c24b53 | Python | rohanbaisantry/simple-speech-to-text | /speech_to_text.py | UTF-8 | 5,427 | 3.15625 | 3 | [] | no_license |
"""
Accepts a .mp3 or a .wav file and performs speech to text using google's speech recognition api and get's the transcription.
REQUIREMENTS:
____________
> Python3
https://www.python.org/downloads/
> Speech Recognition python module [ google could speech to text ]
pip install google
pip install --up... | true |
9383b0fa40af267c131ed1ac601ae78027f9c23e | Python | Toz3wm/Facenet | /test.py | UTF-8 | 8,674 | 2.515625 | 3 | [] | no_license | from __future__ import print_function
import cPickle as pickle
import sys
import os
import time
import numpy as np
import theano
import theano.tensor as T
import lasagne
from random import shuffle
from PIL import Image
def load_database(data_dir = 'aligned_64'):
persons = os.listdir(data_dir)
persons.rem... | true |