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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
cba6deea732a28b7e1b81c5119667392defee308 | Python | sc2ad/Azul | /Center.py | UTF-8 | 2,264 | 3.75 | 4 | [] | no_license | import pygame
from Tile import Tile
class Center():
width = 200
tileBuffer = 25
def __init__(self):
self.startingPlayer = 0
self.startingTaken = False
self.tiles = []
self.loc = [0,0]
self.tileWidth = (self.width - self.tileBuffer) / (self.tileBuffer)
self.re... | true |
809934b3184ed1bd9d92f05df1dbc5ef1a24cb2a | Python | philip-shen/google_drive_upload_concurrency | /test/GDrive_threadpool.py | UTF-8 | 8,314 | 2.71875 | 3 | [
"MIT"
] | permissive | #2019/01/06 Intial code
####################################################
import time,os,sys
from queue import Queue
from threading import Thread
from functools import partial
from concurrent import futures
from pydrive.drive import GoogleDrive
strabspath=os.path.abspath(__file__)
strdirname=os.path.dirname(strabsp... | true |
21f9f21388dd6963def250bf151596c3c3041746 | Python | team-vigir/flexbe_behavior_engine | /flexbe_states/src/flexbe_states/wait_state.py | UTF-8 | 749 | 3 | 3 | [] | permissive | #!/usr/bin/env python
import rospy
from flexbe_core import EventState
class WaitState(EventState):
'''
Implements a state that can be used to wait on timed process.
-- wait_time float Amount of time to wait in seconds.
<= done Indicates that the wait time has elapsed.
'''
def __init__(... | true |
dc381800480a5025cab966ab4ca5f4545762f6d4 | Python | pingguosanjiantao/Elements-of-Programming-Interviews | /13-Hash Tables/code/13.13-Test the collatz conjecture.py | UTF-8 | 633 | 2.953125 | 3 | [] | no_license | def testCollatzConjecture(n):
verifiedNumber = []
for i in range(3, n + 1, 2):
sequence = []
testI = i
while testI >= i:
if testI in sequence:
return False
sequence += [testI]
if testI % 2 != 0:
if testI in verifiedNumbe... | true |
1de8995b9981ec9ec166fa4c68a99b1661ad62b9 | Python | gwangwoo/DeepLearning | /7장_텐서플로우로 인공지능 구현을 위한 기초/ex7-2.py | UTF-8 | 1,487 | 3.59375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 25 16:45:35 2019
@author: byebye
"""
# [실습 7-2] 연결 가중치 행렬 W와 바이어스 b 값을 경사 하강법으로 찾는 프로그램을 작성해보자
# 예측 값을 구할 식은 H = tf.matmul(W,x) + b
import tensorflow as tf
import numpy as np
x = np.float32(np.random.rand(2,100)) # 2행 100열의 텐서 생성
# 학습 레이블(목표값)은 아래식으로 정의(W =... | true |
c132994b8829da4e03d2055846525d5532b715f6 | Python | jansenmarc/WavesGatewayFramework | /tests/serializer/test_mapping_entry_serializer.py | UTF-8 | 605 | 2.703125 | 3 | [
"MIT"
] | permissive | import unittest
from waves_gateway.model import MappingEntry
from waves_gateway.serializer import MappingEntrySerializer
class MappingEntrySerializerSpec(unittest.TestCase):
def setUp(self):
self._serializer = MappingEntrySerializer()
def test_serialize(self):
entry = MappingEntry(coin_addre... | true |
92fda438b6514cd2ba87410c4286038a190792c3 | Python | sweavo/code-advent-2020 | /day8_1.py | UTF-8 | 1,814 | 3.765625 | 4 | [] | no_license | EXAMPLE_PROGRAM=[
"nop +0",
"acc +1",
"jmp +4",
"acc +3",
"jmp -3",
"acc -99",
"acc +1",
"jmp -4",
"acc +6" ]
EXAMPLE_FIXED=[
"nop +0",
"acc +1",
"jmp +4",
"acc +3",
"jmp -3",
"acc -99",
"acc +1",
"nop -4",
"acc +6" ]
def parse_instruction( inst... | true |
da028e1e758862f50312e5563c1f6156bf86a524 | Python | snip/ffvv-heva | /python/heva.py | UTF-8 | 1,222 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Sun Oct 11 10:08:18 2015
@author: Thierry D.
"""
import random, hashlib, datetime, base64, requests
def get_nonce(length=8):
"""génération d'une chaîne hexadécimale aléatoire"""
return ''.join(random.choice('0123456789abcdef') for n in range(length))
def wsse_header(us... | true |
9a517af34d8f5cfb83e36e0578b77277b2556dc0 | Python | lospheris/steganographer | /tests/test.py | UTF-8 | 3,772 | 2.921875 | 3 | [
"MIT"
] | permissive | import sys
import os
sys.path.append("..")
from steganographer import *
from Crypto.Hash import SHA256
from message import CryptoHelper
# These are the values that should be expected based on explicit test cases.
pt_message = "The quick brown fox jumped over the lazy dog."
output_file_name = "text_message_output.txt"
... | true |
13ab9911e6247073c3d8499a0cd77bcb453c7228 | Python | Always-prog/Neural-sounds-files | /work/0.0.3/main.py | UTF-8 | 1,769 | 2.59375 | 3 | [] | no_license | from sourcelib.sounds import split_sound
from sourcelib.sounds import tratment_sound
from matplotlib import pyplot as plt
from train.sourcelib.net import Network
from train.sourcelib.normalize_list import resize_list
import torch
import librosa.display
import numpy as np
from collections import Counter
from config impo... | true |
560bd534a0cdd7b50bdc75d1c1e8bf39c075cbbc | Python | SixMJ/Page-Myanmar | /3_looping/1_example/13_break_while.py | UTF-8 | 121 | 3.65625 | 4 | [] | no_license | i = 0
# 1 = true
while 1:
print(i , " " , end="")
i = i + 1
if i == 10:
break
print("came out of while loop") | true |
6179b87749c09fb52332b5b7f006c749bf907335 | Python | skhan1020/Backtesting-using-AI-in-Algorithmic-Trading | /webapp/backtest_webapp.py | UTF-8 | 4,474 | 2.90625 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
plt.switch_backend('Agg')
import io
import base64
import sys
from tradingstrategy_webapp import MovingAverageCrossStrategy as cs
from tradingstrategy_webapp import MarketOnClosePortfolio as pf
from models import ArimaModel as am
from models import LSTMModel as lm
de... | true |
512cdb0e5785e83b28b1e018dd286f8e874f22de | Python | HarryU/AdventOfCode | /2016/day1/testDirectionFinder.py | UTF-8 | 5,268 | 3.109375 | 3 | [] | no_license | import unittest
class TestDirectionFinding(unittest.TestCase):
def setUp(self):
pass
def test_StartDirectionIsNorth(self):
directions = DirectionFind()
dir = directions.getCurrentDirection()
self.assertEqual('N', dir)
def test_DirectionIsEastAfterRightTurn(self):
... | true |
1e901ce5954c90459b5a5b744d63475864df9d86 | Python | ZetianZheng/Transposition-and-Substitution-cipher | /src/arb_map.py | UTF-8 | 2,035 | 3.015625 | 3 | [] | no_license | """execute analysis and substitution"""
from cryptanalysis import CryptAnalysis
from utils import arbitary_mapping_sub
from utils import read_file_from
MOSTALPHA = ['e', 't', 'a', 'o', 'i', 'n', 's', 'h', 'r', 'd', 'l',
'c', 'u', 'm', 'w', 'f', 'g', 'y', 'p', 'b', 'v', 'k',
'j', 'x'... | true |
2f74f7d2f96c66c85078eae3271bff5c17708c5a | Python | tortoise/orm-benchmarks | /benchmarks/django/simple/test_b.py | UTF-8 | 537 | 2.703125 | 3 | [] | no_license | try:
import django # noqa
django.setup() # noqa
finally:
pass
import os
import time
from random import choice
from django.db import transaction
from simple.models import Journal
LEVEL_CHOICE = [10, 20, 30, 40, 50]
count = int(os.environ.get("ITERATIONS", "1000"))
start = now = time.time()
with trans... | true |
72cc6d4f49f91f403db1faae5e74c8de43a562bd | Python | ianw3214/bananana-server | /shop.py | UTF-8 | 1,495 | 2.53125 | 3 | [] | no_license | import database
import players
# Shop items are hard coded for now
# TODO: eventually will want to read from a file
def buy(command):
item = command["item"]
# Handle the hairs
if item == 0 or item == 1:
wardrobe = database.getPlayerWardrobeData(command["name"])
if item not in wardrobe["hair... | true |
7f6bc04e42b808bb78bb2a1a04260dc54b9b332c | Python | NelsonGomesNeto/Competitive-Programming | /Algorithms and Data Structures/Sparse Table/testCases/test.py | UTF-8 | 764 | 3.328125 | 3 | [] | no_license | import os, time
from random import randint
from filecmp import cmp
os.system("g++ ./../sparseTable.cpp -o test -std=c++17 -O2 -w")
os.system("g++ naive.cpp -o test2 -O2 -w")
f = open("in", "w")
arraySize = int(input())
a = []
for i in range(arraySize):
a += [randint(-1000, 1000)]
print(arraySize, file=f)
print(*a,... | true |
b63782b3f6fb6fc407c29500d8147b971e24ec6c | Python | fangyuan-ksgk/Conditional-Particle-Filter | /condpf/condpf_class.py | UTF-8 | 3,949 | 2.828125 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
import torch
tod = torch.distributions
class CondPF(torch.nn.Module):
def __init__(self, model, param):
super().__init__()
self.mu = model.mu
self.sigma = model.sigma
self.llg = model.likelihood_logscale
self.l = param[0]
... | true |
99759dfc29a82077c00898b8fd7ae966e53b966f | Python | neha2114/CometBot | /main.py | UTF-8 | 8,963 | 3.015625 | 3 | [] | no_license | import discord
import os
from keep_alive import keep_alive
client = discord.Client()
class_dict = {}
attendees_dict = {}
event_dict = {}
@client.event
async def on_ready():
print("We have logged in as {0.user}".format(client))
@client.event
async def on_message(message):
if message.author == client.user:
... | true |
248fbac0d79064d4c9e8bab27f64313a92f4e1dd | Python | oussema1996/test | /Extractor.py | UTF-8 | 6,200 | 2.9375 | 3 | [] | no_license | import json
import logging
import numpy as np
import os
import pandas as pd
DATA_DIR = os.path.relpath("input")
DESCRIPTION_DIR = os.path.relpath("input\input_description")
CSV_Extention = [".csv", ".CSV"]
Excel_Extention = [".xls", ".XLS", ".xlsx", ".XLSX", ".xlsm", ".XLSM"]
Json_Extention = [".json", ".JSON"]
clas... | true |
0e53c1d71258e24bc8ed6dd10811434efe04074c | Python | oceanpad/python-tutorial | /code/basic/helloWorld.py | UTF-8 | 142 | 3.546875 | 4 | [] | no_license | print('hell world', "my first", "python code")
print(111 + 123)
print("please input your name")
name = input()
print(name + " is a good boy")
| true |
caee41d96f2fcc8c7f6da275749a35a9b30cea5e | Python | Yifke/UCSD-Project | /IdeakerLab/auto-images/brighter.py | UTF-8 | 485 | 2.5625 | 3 | [] | no_license | import cv2
import matplotlib.pyplot as plt
if __name__ == "__main__":
mylist = range(1,190)
for ind in mylist:
mImage = cv2.imread('../Images/zstack1/zstack1z%03d.tif'% (ind))
hsvImg = cv2.cvtColor(mImage,cv2.COLOR_BGR2HSV)
# decreasing the V channel by a factor from the original
... | true |
57b221a967c56d86dcd5b1c0bb50cb653195e9db | Python | 2XL/hwPython | /refresh/0_beginner/multi_process.py | UTF-8 | 13,923 | 2.6875 | 3 | [] | no_license | """
PROCESS VS THREADS
P
side steps GIL
less needed for sync
can be paused and terminated
more resilient
T
higher memory footprint
expensive context switches
Pickling
is the process whereby a Python object hierarchy is converted into a byte stream.
"unpickling" is the inverse operatio... | true |
facfd1e3265caf7efd8adaea1cbcab3e9af5126f | Python | fCherkasskiy/Karels-Adventure | /Python/MapBuilder/counter.py | UTF-8 | 73 | 2.609375 | 3 | [] | no_license | file = open("titanic.txt", "r").read().split()
print file
print len(file) | true |
9b1677ca06d9b57e78e6639e4510ed44d4fb04bd | Python | dudrill/Python_generation_basics | /11_Lists/11_6_6_article_amount.py | UTF-8 | 193 | 3.703125 | 4 | [] | no_license | s = input()
counter = 0
l = s.split(' ')
counter += l.count('a')
counter += l.count('an')
counter += l.count('the')
print('Общее количество артиклей: ' + str(counter)) | true |
e5fcb19f48d75cbd2da3285ecd9734bc9a2b75f9 | Python | msarvestani/shrewdriver | /ShrewDriver/devices/camera_reader.py | UTF-8 | 6,677 | 2.703125 | 3 | [] | no_license | # camera_reader.py: CameraReader
# Authors: Theo Walker, Matthew McCann (@mkm4884)
# Max Planck Florida Institute for Neuroscience
# Last Modified 07/09/2016
# Description: Class utilizing OpenCV to read a video stream from a webcam.
# Passing keyword arguments allows for selection of options used for different
# in... | true |
6e6648cd97e46a9cf7f78e66ed86140454f146b4 | Python | lirixiang123/algorithm | /src/剑指offer/64-maxInWindows.py | UTF-8 | 1,052 | 4 | 4 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time : 2020/7/18 14:04
# @Author : lirixiang
# @Email : 565539277@qq.com
# @File : 64-maxInWindows.py
"""
给定一个数组和滑动窗口的大小,找出所有滑动窗口里数值的最大值。例如,如
果输入数组{2,3,4,2,6,2,5,1}及滑动窗口的大小3,那么一共存在6个滑动窗口,他
们的最大值分别为{4,4,6,6,6,5}; 针对数组{2,3,4,2,6,2,5,1}的滑动窗口有以下
6个: {[2,3,4],2,6,2,5,1}... | true |
e560ee6970a7548f25e64010d9dcce9cfa75ef28 | Python | jdrouet/docker-desktop-network-bug | /main.py | UTF-8 | 275 | 2.875 | 3 | [] | no_license | import csv
import urllib.request
filename = "image.jpg"
try:
with open('dataset.csv') as f:
reader = csv.reader(f)
for (url,) in reader:
print(url)
urllib.request.urlretrieve(url, filename)
except Exception as err:
print(err)
| true |
94e890d7aefdf58d77d020a59844bb7a8c85c5a6 | Python | pierricklyons/pythonProtoForImgToASCII | /bmpToASCII.py | UTF-8 | 1,262 | 3.734375 | 4 | [] | no_license | from PIL import Image
imagePath = 'testImage.png'
ASCIICharacters = ["@", "#", "S", "%", "?", "*", "+", ";", ":", ",", " "]
newWidth = 100
# Resize image maintaining aspect ratio ------> 2 = approx aspect ratiop of unicode character
def resizeImage(image, newWidth = 100):
width, height = image.size
aspectRat... | true |
b273ec06655a8bbb800b7c3b0215e533f859dbbc | Python | TheKinshu/100-Days-Python | /Day3/love-cal.py | UTF-8 | 800 | 4.1875 | 4 | [] | no_license | # 🚨 Don't change the code below 👇
print("Welcome to the Love Calculator!")
name1 = input("What is your name? \n")
name2 = input("What is their name? \n")
# 🚨 Don't change the code above 👆
#Write your code below this line 👇
name1 = name1.lower()
name2 = name2.lower()
score1 = 0
score2 = 0
true = 'true'
love = '... | true |
f4f3269899e61a4b317e59c305e7675318377b9b | Python | krispharper/AdventOfCode | /2016/22/1.py | UTF-8 | 619 | 3.375 | 3 | [] | no_license | with open('input.txt') as f:
data = [tuple(map(int, line.strip().split(' '))) for line in f]
count = 0
for d1 in data:
for d2 in data:
if d1 == d2:
continue
if d1[2] and d1[2] <= d2[3]:
count += 1
print(count)
for y in range(28):
for x in range(32... | true |
05ee8a458511dd324daeb1e342a921ab034d8906 | Python | JuliaKrava/test | /homework_5/task_1.2.py | UTF-8 | 505 | 3.8125 | 4 | [] | no_license |
class Flat:
def __init__(self, storona1=0, storona2=0 ):
self.storona1 = storona1
self.storona2 = storona2
self.S = storona1*storona2
self.P = 2*(storona1+storona2)
a=Flat(5,10)
print(a.P, a.S, sep='\n')
import math
class Karta:
def __init__(self, X=0, Y=0, X1=0, Y1=0):
... | true |
ae207267472d5e6ee44e7644f7ef25a2e297e30a | Python | willdunk/Pineapple-Data-Analysis | /descriptive_statistics.py | UTF-8 | 1,262 | 3.015625 | 3 | [] | no_license | #! /usr/bin/env python3
import sys
def average(data):
return float(sum(data)) / len(data)
def median(data):
length = len(data)
if length % 2 == 0:
lower = length / 2 - 1
upper = length / 2 + 1
return average(data[lower:upper])
else:
return data[length // 2]
def main():
requests = 0
devices = []
... | true |
1b2d193977755aae3d740730973e3e0c3c4fa45f | Python | weijia/ufs | /trunk/prodRoot/localLibs/collection/syncSrcCollectionBase.py | UTF-8 | 2,175 | 2.703125 | 3 | [] | no_license | import localLibSys
from localLibs.logSys.logSys import *
class objInColInterface(object):
def getIdInCol(self):
pass
def getTimestamp(self):
pass
class syncSrcCollectionBase(object):
#############################################
# The following methods are for synchronizable collectio... | true |
aff94d70ea698448566159408ca53c91e9b43dda | Python | onRightSide/level_2 | /funcs.py | UTF-8 | 1,320 | 2.796875 | 3 | [] | no_license | import json
from configs import CLIENT_PRESENCE, SERVER_APPROVAL, CLOSE, \
SERVER_HELLO, SERVER_MOOD, SERVER_STANDART_ANSWER
# Common
def pars_mes(mes):
return json.loads(mes.decode("utf-8"))
def get_mes(s):
return pars_mes(s.recv(1024))
def send_prepared_mes(s, mes):
s.send(json.dumps(mes).enco... | true |
16240aee0b89290fef2998fac8dfa837e325d8cc | Python | paulobazooka/intro-python-ifsp | /2018-03-20/exercicio.py | UTF-8 | 1,112 | 3.609375 | 4 | [] | no_license | # Paulo Sérgio do Nascimento
# 20 03 2018
#
# Verifique quantas vzs a palavra analfabeto aparece dentro do arquivo fornecido pelo professor
# Conte também quantas letras e quantas palavras existem nesse arquivo
try:
#arquivo = input("Digite o caminho do arquivo a ser lido: ")
arquivo = open('analfa.txt')
excep... | true |
b562ba048833769df8d82e74ccaca618cd6794b0 | Python | gilberto-009199/MyPython | /knn/python/algoritmo.py | UTF-8 | 5,407 | 3.296875 | 3 | [] | no_license | import math;
# Verifica se o arquivo existe
# copia de https://www.delftstack.com/pt/howto/python/how-to-check-if-a-file-exists-in-python/
def isExist(filePath):
try:
with open(filePath, 'r') as f:
return True
except FileNotFoundError as e:
return False
except IOError as e:
... | true |
179ae5d8371c561a579c82fe2a57d36d58d3ab57 | Python | am2512/baxter_final_project | /scripts/relayObjPose.py | UTF-8 | 2,658 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
from ar_track_alvar_msgs.msg import (AlvarMarkers, AlvarMarker)
from geometry_msgs.msg import (Point, Pose, PoseStamped, Quaternion)
from std_srvs.srv import Trigger
class poseHandler():
def __init__(self):
# Publishers and Subscribers
rospy.Subscriber('ar_... | true |
31a535a8dfe79f99dab26013269a8dae6de70aab | Python | JzHuai0108/vio_common | /python/play_images_in_rosbag.py | UTF-8 | 3,473 | 2.828125 | 3 | [] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Display images in a rosbag on a specific image topic,
and optionally save image messages and their timestamps.
"""
from __future__ import print_function
import argparse
import os
import rosbag
import rospy
from cv_bridge import CvBridge
import cv2
def print_image_in... | true |
fd8c40d08e21d09744c6234797677d01b147fa8c | Python | CarregamentoSmartphonesAutonomo/Sistema-Embarcado | /Raspberry-Face-Recognition/cadastro.py | UTF-8 | 3,498 | 3.0625 | 3 | [] | no_license | import os
import sys
# Import OpenCV2 for image processing
import cv2
# Import for GPIO
import RPi.GPIO as gpio
import time
# For each person, one face id and a name
face_id = input('Enter your ID: ')
name = input("Enter your name: ")
# Configuring GPIO
gpio.setmode(gpio.BOARD)
gpio.setup(11, gpio.OUT)
gpio.setup(1... | true |
1d9c3d5557e4045015439cbace9dad5870b6489d | Python | rena-96/catrs | /unbenannt1.py | UTF-8 | 1,243 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon May 3 12:32:41 2021
@author: R.Sechi
This code is to compute the infinitesimal generator
"""
import numpy as np
from scipy.linalg import logm
from scipy.optimize import fmin
from cmdtools.estimation.newton_generator import Newton_N
import matplotlib.pyplot as plt
def logm_i... | true |
899d1789ac231aa1d3f4e87fa0ff27decc06c5cf | Python | semin-lev/symfony_translation_generator | /yaml_config.py | UTF-8 | 2,688 | 3.28125 | 3 | [] | no_license | __author__ = 'levsemin'
import yaml
class YamlRepresentation:
def __init__(self, filename):
self.__filename = filename
self.__dict = None
@property
def dict(self):
"""
:rtype: dict
"""
if self.__dict is None:
with open(self.__filename) as f:
... | true |
e4a4803a003dc8f9e945d0e66a2590d7d5082c73 | Python | keivanipchihagh/Competitions | /Quera/مسابقه/وسط صندلی عقب.py | UTF-8 | 221 | 3.734375 | 4 | [
"Apache-2.0"
] | permissive | seatNames = []
for i in range(4):
temp = [i for i in input().split(' ')]
if (temp[1] == 'L'):
seatNames.insert(0, temp[0])
elif (temp[1] == 'R'):
seatNames.append(temp[0])
print(seatNames[1])
| true |
ed424f65e1a4db040b1d8a506934b3243e495d57 | Python | vrutberg/advent-of-code | /2016/1/tests.py | UTF-8 | 5,490 | 3.140625 | 3 | [] | no_license | #!/usr/local/bin/python3
import unittest
from lib import *
class DirectionTest(unittest.TestCase):
def test_next(self):
self.assertEqual(Direction.north.next(), Direction.east)
self.assertEqual(Direction.east.next(), Direction.south)
self.assertEqual(Direction.south.next(), Direction.west... | true |
5686737ac85965024c66b55759e3a28e0343a979 | Python | twhetzel/item-catalog | /lotsofevents-users.py | UTF-8 | 7,867 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from database_setup import City, Base, Event, User
from datetime import datetime, date
engine = create_engine('sqlite:///androidevents.db')
# Bind the engine to the metadata of the Base class so... | true |
3ef4b73d610d9b75c4c2862631830139618c0461 | Python | KAJdev/Telescope | /Cogs/Summarize.py | UTF-8 | 2,631 | 2.65625 | 3 | [] | no_license | import discord
import config
import aiohttp
import os
from discord.ext import commands, tasks
class Summarize(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(aliases=['s', 'sum', 'short', 'check', 'shorten'])
async def summarize(self, ctx, *, args:str=None):
if a... | true |
ced189169732ce5abaa08d3b32e7f55dca6f7975 | Python | TaranjeetSingh121/Revered-PrintOut | /Merged.py | UTF-8 | 2,750 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 20 13:35:36 2018
@author: Dhillonsher
"""
from tkinter import *
import datetime
import os
import time
import glob
import psutil
window = Tk()
window.title("Printing Thing")
window.geometry("475x403")
window.configure(bg='snow')
def Clear():
try:
... | true |
ade7e6e365eed05f69562d8d3ec59edc085d620d | Python | mgoar/mtt-phd-filter | /gaussiandensity.py | UTF-8 | 2,376 | 2.546875 | 3 | [
"MIT"
] | permissive | import numpy as np
from scipy.spatial import distance
from scipy.stats import multivariate_normal
from dataclasses import dataclass
from collections import namedtuple
import motionmodel
import measmodel
GaussState = namedtuple('GaussState', ['x', 'P'])
@dataclass
class gaussiandensity:
"""Gaussian density class"... | true |
aaecd89636d021e00793972c8cd5d55b6bbca211 | Python | PatrikPat/Assignment_1 | /Game.py | UTF-8 | 4,020 | 3.703125 | 4 | [] | no_license | from Board import *
import random as random
class Game:
def __init__(self, field):
self.board = Board(field)
def move(self, player):
"""Calls the possible moves for the player ('R' or 'B') and choses a random
move.
"""
moves = self.board.possible_moves(player)
... | true |
18971645dae67ee12e5ca705ecf1d96db85d7bb3 | Python | BradleyScrim/table-validator | /src/table_validator/validators.py | UTF-8 | 1,295 | 2.859375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""Validator classes for ``table_validator``."""
from typing import TextIO, Union
from .api import parse_tsv, validate
__all__ = [
'TemplateValidator',
]
class TemplateValidator:
""" Class validating a file based on a template"""
def __init__(self, template):
print("wer... | true |
cdc8f5e37707a80a86b66fc829e2a0c5fe98ce9e | Python | Code-Institute-Submissions/i-comic | /checkout/test_forms.py | UTF-8 | 998 | 2.5625 | 3 | [] | no_license | from django.test import TestCase
from .forms import OrderForm, PaymentForm
class TestCheckoutForms(TestCase):
def test_order_form(self):
form = OrderForm({'full_name':'Test name','phone_number':'0', 'street_address1':'abc',
'street_address2':'def', 'postcode':'ghi123', 'town_or_ci... | true |
761406a1c8d77b9cc763ef96c8169c07606f18ad | Python | akshaynalwaya/CSC-591-Foundations-of-Software-Science | /w6/dom.py | UTF-8 | 1,309 | 2.578125 | 3 | [] | no_license | import re, sys, random, math
from num import Num
from sym import Sym
from rows import Rows, rows
from test import O
def another(r, rows):
val = max(0, math.floor(0.5 + random.random()*len(rows)) - 1)
if not r == val:
return rows[val]
return another(r, rows)
def dom(t, row1, row2):
s1 = 0
s2... | true |
d8763a058c8a69ce4f382893018565ee14666527 | Python | xl86305955/Adversarial_Active_Learing | /knn/nn_attack_white_box.py | UTF-8 | 2,939 | 3 | 3 | [
"MIT"
] | permissive | import time
import numpy as np
def find_adv_direction(y_train, y_pts, train, pts, mapping):
'''
This function finds the adversarail perturbation direction for each test point in pts.
Args:
train: the training set of the nn classifier
y_train: the label of train
p... | true |
3f64612a127086328b5527fe2015e0def8b87472 | Python | drimyus/GoogleCloudAPI | /storage_utils.py | UTF-8 | 1,507 | 2.515625 | 3 | [] | no_license | import json
import os
from googleapiclient import discovery
from oauth2client.client import GoogleCredentials
from google.cloud import storage
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = '../static/service_account_key.json'
os.environ['GOOGLE_PRODUCT'] = 'ocr engine'
BUCKET_NAME = 'bill_files_test'
class GoogleS... | true |
c28d4c1b00b9f81716ff4b166f5c4f5e283c4bd9 | Python | VeronikaDan/Python-Classwork | /03.py | UTF-8 | 234 | 3.15625 | 3 | [] | no_license | f = open('text1.txt', 'r', encoding = 'utf-8')
i = 1
a = f.readlines()
for line in a:
print("длина строки " + str(i) + " - " + str(len(line)))
i += 1
a3 = a[3::3]
for line in a3:
print(line)
f.close()
| true |
fd8d9811c8ab8601412b23c8cce064a03bb92513 | Python | joshnic3/AlgoTradingPlatform | /library/strategy/bread_crumbs.py | UTF-8 | 3,935 | 2.625 | 3 | [] | no_license | import datetime
from collections import namedtuple
from library.bootstrap import Constants
TIMESTAMP = 3
TYPE = 2
DATA = 4
def format_value_str(value_float):
return '{:,.2f}'.format(value_float)
def group_bread_crumbs_by_run_time(bread_crumbs, replace_blanks=False):
# Group by run, this is based off run t... | true |
8976d12147adf2a0071e7bb7e353d00d7fe4ce4b | Python | R-Gaurav/col786 | /Assignment6/nipy_glm.py | UTF-8 | 2,909 | 2.71875 | 3 | [] | no_license | #
# This script used nipy to perform the GLM analysis of the pre-processed
# Neuroimaging data.
#
# Links: https://nipype.readthedocs.io/en/latest/users/examples/fmri_nipy_glm.html#preprocessing-pipeline-nodes
#
import nipy as nip
import numpy as np
import pickle
from nipy.modalities.fmri.glm import GeneralLinearMod... | true |
d90d24d2c5c018c8267096ba765e5409873881c4 | Python | devoh747/Adafruit_CircuitPython_BLE | /adafruit_ble/device_information_service.py | UTF-8 | 4,090 | 2.546875 | 3 | [
"MIT"
] | permissive | # The MIT License (MIT)
#
# Copyright (c) 2019 Dan Halbert for Adafruit Industries
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the righ... | true |
61f98dd38b518b9df4e97dfd1702177ace6d3249 | Python | aggarwalpiush/demo_heroku_hosting | /server.py | UTF-8 | 919 | 2.96875 | 3 | [] | no_license | #! usr/bin/env python
# *-- coding : utf-8 --*
import re
from nltk.tokenize import TweetTokenizer
from flask import Flask, request, jsonify
app = Flask(__name__)
def apply_tweettokenizer(inputtext):
tt = TweetTokenizer()
return tt.tokenize(inputtext)
def remove_num(str):
string_no_numbers = re.sub("\... | true |
3784615674dca7d0705aac9de718c81dd7308d6b | Python | FireSoul512/Raspberry-socket | /server.py | UTF-8 | 1,544 | 3.015625 | 3 | [] | no_license | import socket
from socket import gethostbyname, create_connection, error
import time
from servo import SERVO
from peso import PESO
def comprobarConexionUno():
ciclo = True
while ciclo:
try:
gethostbyname("google.com")
conexion = create_connection(("google.com", 80), 1)
... | true |
1a2933745bf01108e50fb83737fcf86bb6cd0934 | Python | vkuzmenkova/contests | /route256/go_task1.py | UTF-8 | 195 | 2.9375 | 3 | [] | no_license | if __name__ == "__main__":
input_arr = list(map(int, input().split()))
n = input_arr[0]
L = input_arr[1]
if L % n == 0:
print(L // n)
else:
print(L // n + 1)
| true |
6c13bf61d91169420834ab4f5bd7070d7440c536 | Python | EasyStock/TreaderAnalysis | /src/StockFilter/AdvanceFilter/StockAdvanceFilter_2BRule.py | UTF-8 | 2,746 | 2.546875 | 3 | [] | no_license | '''
Created on Jun 10, 2019
@author: mac
'''
import pandas as pd
from StockDataItem.StockItemDef import stock_Days, stock_ClosePrice, stock_Date, stock_Name,\
stock_LowerPrice, stock_ZhangDieFu, stock_HighPrice,\
stock_ClosePrice_Yesterday, stock_Volumn_Ratio, stock_RSI_6, stock_OpenPrice
from StockFilter.Adv... | true |
9703819f9722fd24a6f004e6faf230bd84786f27 | Python | vshn/crmngr | /crmngr/puppetfile.py | UTF-8 | 15,026 | 2.6875 | 3 | [
"BSD-3-Clause"
] | permissive | """ crmngr puppetmodule module """
# stdlib
from collections import namedtuple
import hashlib
import logging
from datetime import datetime
# crmngr
from crmngr import cprint
from crmngr.forgeapi import ForgeApi
from crmngr.forgeapi import ForgeError
from crmngr.git import GitError
from crmngr.git import Repository
L... | true |
7bbeab24047393cb12209abb9dd6d9ca8f0bfc34 | Python | Arinze95/CS303E | /Documents/CS303E/CS303E-master/Exercise8.5.py | UTF-8 | 120 | 3.78125 | 4 | [] | no_license | s1 = input("Enter a string: ")
s2 = input("Enter another string: ")
def count(s1, s2):
return (s1.count(s2))
| true |
cea12e14481891be2f7147ded6ece6e998b15117 | Python | KShih/workspaceLeetcode | /python/Google_SumOfLeaves.py | UTF-8 | 449 | 3.359375 | 3 | [] | no_license | def sumOfLeaves(self, root: TreeNode) -> int:
def add_leaves(root, val):
if not root.left and not root.right:
return root.val
if root.left:
val += add_leaves(root.left, val)
print(val)
if root.right:
val += add_leaves(root.right, val)
... | true |
5052bf0aa8b9453597a6e3852250105b3e799cd9 | Python | BharatKanzariya/python_basic | /reversearray.py | UTF-8 | 551 | 4.21875 | 4 | [] | no_license | '''
***** CODE FOR FIXED SIZE ARRAY ******
from array import *
a1 = array('i',[4,8,9,5,6])
print(a1)
a2 = array('i',[])
for i in range(4,-1,-1):
x = a1[i]
a2.append(x)
print(a2)
'''
# ********* CODE FOR VARIABLE AYYAY *******
from array import *
n = int(input('Enter length of array:... | true |
558347a4fca9ebeb2eab055269efd6ac18f44112 | Python | sreeramsutraye/Small_Games_in_Python | /rock_paper_scissors.py | UTF-8 | 1,974 | 4.125 | 4 | [] | no_license | import random
lst = ['xx','Rock','Paper','Scissors']
python_choice_list = [1,2,3]
def displayOptions():
print("""
Select anyone by number
1. Rock
2. Papers
3. Scissors """)
def RPSGame2P(p1,p2):
if p1 == p2:
print("Its a Tie")
return
if p1 == '... | true |
55a63b45b0b8a3133b5b718f9b861e3c364e9e13 | Python | crazybber/pythontrip | /Modules/modules_BuiltIn.py | UTF-8 | 1,445 | 3.3125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding utf-8 -*-
__Author__ ='eamon'
'Modules Built-In'
from datetime import datetime
now = datetime.now()
print(now)
print(type(now))
dt=datetime(2015,10,5,20,1,20)
print(dt)
print(dt.timestamp())
t=1444046480.0
print(datetime.fromtimestamp(t))
print(datetime.utcfromtimestamp(t)... | true |
4d4c30528cfc5ca54e83ae63c894c9642dfb12e2 | Python | imaskm/coriolis-python-problems | /prog27.py | UTF-8 | 217 | 2.9375 | 3 | [] | no_license | l_words = ['asdsaf','dasdasda','dasdas']
l_length = []
for i in l_words:
l_length.append(len(i))
print l_length
l_length = []
print(map( lambda x : len(x), l_words ))
print [ len(x) for x in l_words ]
| true |
a53eb3b9457c659e79f97f3e96e8ab00c830dd40 | Python | 44cat/shiyanlou-002 | /datashow.py | UTF-8 | 698 | 2.734375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import seaborn as sns
def main():
tips = sns.load_dataset("tips")
sns.set()
plt.subplot(2,3,1)
sns.barplot(x="day",y="total_bill",hue="sex",data=tips)
plt.subplot(2,3,2)
sns.pointplot(x="day",y="tip",data=tips)
plt.subplot(2,3,3)
sns.lvplot(x... | true |
9d10827894c40fec8c9a65c02a2b1dd5934a8dbb | Python | krnets/codewars-practice | /7kyu/Time Degrees/index.py | UTF-8 | 2,449 | 3.75 | 4 | [] | no_license | # 7kyu - Time Degrees
""" Time, time, time.
Your task is to write a function that will return the degrees on a analog clock from a digital time
that is passed in as parameter. The digital time is type string and will be in the format 00:00.
You also need to return the degrees on the analog clock in type string and... | true |
69121e2d1bb1525897214c1033e371dd1be2424e | Python | cemalihsan/CNN--Convolutional-Neural-Network--Projects | /Image Classification/classification.py | UTF-8 | 2,505 | 3.21875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import cv2 as cv
from tensorflow.keras import datasets, layers, models
(training_images, training_labels), (testing_images, testing_labels) = datasets.cifar10.load_data()
training_images, testing_images = training_images / 255, testing_images / 255 # normalizing imag... | true |
7338dff8b362155c66113abd53c0bdd1e707cc76 | Python | LiXiaoRan/dataHandle | /pycode/pageRankCompute.py | UTF-8 | 957 | 3.046875 | 3 | [] | no_license | import csv
import networkx as nx
def compute_pg(FILE_NAME):
_CSV = ".csv"
FILE_PATH = "../resultDataset/"
FILE_OUT_PATH = FILE_PATH + FILE_NAME + "_pg" + _CSV
graph = nx.DiGraph()
csvFile = open(FILE_PATH + FILE_NAME + _CSV, "r")
csvoutFile = open(FILE_OUT_PATH, "w", newline='')
reader ... | true |
30607cf72735b1aca0af7a974f8bda388241f508 | Python | PythonCHB/PythonIntroClass | /week-02/code/slicing.py | UTF-8 | 108 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
"""
examples of slicing
"""
def remove_every_other(string):
return string[::2]
| true |
556d526ecd8fad18a93ff8f85fe788090b12f594 | Python | gzgdouru/python_study | /fluentpython/chapter14/demo11.py | UTF-8 | 939 | 3.5 | 4 | [] | no_license | '''
合并多个可迭代对象的生成器函数
'''
import itertools
if __name__ == "__main__":
print(list(itertools.chain("ABC", range(2))))
print(list(itertools.chain(enumerate("ABC"))))
print(list(itertools.chain.from_iterable(enumerate("ABC"))))
print("-" * 80)
print(list(zip("ABC", range(5))))
print(list(zip("ABC", ... | true |
4c1cd7d3adce356bb705a6b97c4ac93cf5241740 | Python | belfinwe/Python-playground | /list_dict_etc/set_pg.py | UTF-8 | 981 | 4.125 | 4 | [] | no_license | import random
def testing_set(list_in: list) -> set:
"""
Returns a set of the provided list
"""
a = {i for i in list_in}
return a
def random_item(list_in: list) -> str:
"""
Provides a pseudo random item for the given list
"""
j = random.randint(0, len(list_in) - 1)
return lis... | true |
d0c9a09e3e0d5c672d89e67f78dc017648b410e7 | Python | noFrostoo/KitchenHelper | /client/kitchenhelper_client/VoiceInterpreter.py | UTF-8 | 1,261 | 2.765625 | 3 | [] | no_license | import speech_recognition as sr
from kitchenhelper_client.Singleton import Singleton
class VoiceInterpreter(metaclass=Singleton):
def __init__(self):
self.r = sr.Recognizer()
def listenAndRecognize(self):
with sr.Microphone() as source:
# adjasting for ambient nose takes aboust sec... | true |
b32098cfe9d3c0e96782aa974155a62ccea5042e | Python | LimSeongHwan/algorithms | /2104/BJ_2146.py | UTF-8 | 1,475 | 2.828125 | 3 | [] | no_license | from collections import deque
def bfs(i, j):
q = deque()
q.append((i, j))
start_idx = deque()
area[i][j] = 2
visited = [[0] * area_num for _ in range(area_num)]
while q:
y, x = q.popleft()
for i in range(4):
ny = dy[i] + y
nx = dx[i] + x
if ... | true |
fbff07a079babee71c29226d397e19d23955e3cf | Python | cmotek/python_crashcourse | /chapterfive/checkusernames.py | UTF-8 | 547 | 3.15625 | 3 | [
"Apache-2.0"
] | permissive | current_users = ['FrodoBaggins', 'Skeebo', 'Notenoughicecream77', 'Vegeta', 'SizzleJones']
lowercase_users = ['frodoBaggins', 'skeebo', 'notenoughicecream77', 'vegeta', 'sizzleJones']
new_users = ['Tesla', 'FrazzleJones', 'BilboBaggins', 'SizzleJones', 'skeebo']
for user in new_users:
if user in lowercase_users:
pr... | true |
302c1cf4d9b0a18b286cbdabba0f769ba251bb23 | Python | monicadabas/Data_Structures | /Trie.py | UTF-8 | 2,790 | 3.6875 | 4 | [] | no_license | # Trie with a node as array of 26 nodes, each for a small alphabet
class TrieNode:
def __init__(self):
self.children = [None]*26 # we can also keep this as a dictionary with key as letter and value as a trie node
self.isEnd = False
class Trie:
def __init__(self):
self.root = TrieNode... | true |
6ef57b8c9ad2f21061a3ea101af591ccce994369 | Python | amann00/Python4Ever | /39_oops_7_abcMetaClass_&_Abstract_Method.py | UTF-8 | 1,270 | 4.34375 | 4 | [] | no_license | """
Here the Parent Class 'Shape' is created using 'ABC MetaClass Module' which is directing or ordering
all the Child Classes to execute the printarea() function in there respective statements. Now from here all
the Child Classes like 'Rectangle' and 'Square' must have to execute printarea() statement defined by
P... | true |
ad30df70cc6662487ec5c4ff73e5931d9d892c88 | Python | Hironobu-Kawaguchi/atcoder | /atcoder/abc136_c.py | UTF-8 | 279 | 3.0625 | 3 | [] | no_license | # https://atcoder.jp/contests/abc136/tasks/abc136_c
N = int(input())
H = list(map(int, input().split()))[::-1]
ans = 'Yes'
for i in range(1, N):
if H[i] == H[i-1] + 1:
H[i] -= 1
elif H[i] > H[i-1] + 1:
ans = 'No'
break
print(ans)
| true |
64aa5f15e7d10100ef0e62aa38a7a8e6cfde447f | Python | xsouffront/Unit4-Lesson-3 | /lesson3/guccigang.py | UTF-8 | 100 | 3.125 | 3 | [] | no_license | for t in range(0,51):
a=10000*2.718**(0.09*t)
print('After'+ str(t)+'years, I will have $' str(a)) | true |
c218a6920bbcd571d49fe8b47baffa25eef2ff3a | Python | LKbaba/lk | /ex21+.py | UTF-8 | 378 | 4.15625 | 4 | [] | no_license | def add(a, b):
print "I know you want to add two of your age together, right?"
print "Just wait a minute.\n"
return a + b
your_age = raw_input("How old are you? >\n")
your_mother_age = raw_input("And how old is your mother? >\n")
#do not know how to deal with it, something is wrong.
result = add(your_age... | true |
1edde8eede073fb60ec046bcd7dc15ae61bb80ed | Python | 216software/csvfun | /test_version5.py | UTF-8 | 1,063 | 2.828125 | 3 | [] | no_license | # vim: set expandtab ts=4 sw=4 filetype=python fileencoding=utf8:
import csv
import tempfile
import unittest
import version5
class TestHouseDetector(unittest.TestCase):
def setUp(self):
self.bogus_out_csv_thingy = csv.DictWriter(
tempfile.TemporaryFile(mode="w"),
["street addres... | true |
572da3193de7995725e457fed05d24062a3058e8 | Python | emanuelbust/agentlDel-Rho | /grapher.py | UTF-8 | 4,527 | 3.84375 | 4 | [] | no_license | import matplotlib.pyplot as plt
import sys
##########################################################################################
# Name: parse
#
# Assumptions: None
#
# Purpose: parse takes a text file and separates all of the entries in the line.
# An entry is a string of text in between two delimiters, the ... | true |
107c464919d7b9dc0adf3019c06177f97568f895 | Python | arzamastsevya/SDET-03 | /test14.py | UTF-8 | 1,604 | 2.75 | 3 | [] | no_license | import unittest
import json
from urllib import request
from urllib.parse import quote
from config import test_config
# {server_name}/{API_ver}/regions?page=1
# проверяет что города в выдаче на разных
# страницах не дублируются
class TestCase(unittest.TestCase):
API_name = "regions"
query_param =... | true |
0e49deb178746cc1574dd9d2d29c49158a056d6d | Python | jayschauer/TCPD | /datasets/global_co2/get_global_co2.py | UTF-8 | 4,958 | 2.546875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"CC-BY-3.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Collect the global_co2 dataset
See the README file for more information.
Author: G.J.J. van den Burg
License: This file is part of TCPD, see the top-level LICENSE file.
Copyright: 2019, The Alan Turing Institute
"""
import argparse
import clevercsv
import hashlib
... | true |
fa0cc214231925e7f81247d555fdc2c05e478b95 | Python | julia0922/CRC_Test_Project | /common/operation_excel.py | UTF-8 | 9,450 | 2.671875 | 3 | [] | no_license | import os
import pandas as pd
import openpyxl
from common.operation_file import OperationFile
class OperationExcel(object):
def __init__(self,excelpath=None):
if excelpath==None:
self.path=None
else:
self.path=excelpath # 文件名称
if os.path.isfile(self.path) == Fa... | true |
0c81a7ff835aa60501893c4928569da287a6c62e | Python | eejwa/Array_Utilities | /Ep_dist_Trace_Remover.py | UTF-8 | 1,394 | 3.171875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
## Thsi will ask for an epicentral distance, then more/less
## from this information, it will move the traces which meet the criteria of the above
##E.g. dist 85, below would move all traces which have a distance of less than 85 to a new directory.
import obspy
import os
import shutil
from glob... | true |
9cc3b0d65fc7a4e887f99a0beddc3e57f64efdb1 | Python | marios42/algo_trading | /entryTest.py | UTF-8 | 6,798 | 2.9375 | 3 | [] | no_license | # entryTest.py
#
# Purpose: To test how well good the entry condition
# Entry will be tested against the following
# TEST SUCCESS CRITERIA
# Fixed Stop Loss and Target > 50% trades successful
# Fixed Life Exit > 50% trades profitable
# compare to random entry... | true |
a3af1221e3ba2782bad6f962e11ddfad89275e4e | Python | puffer612/pytestDemo | /common/mysql_operate.py | UTF-8 | 1,652 | 2.734375 | 3 | [] | no_license | # coding = utf-8
import pymysql
import os
from common.logger import logger
from common.read_data import data
BASE_PATH = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
data_file_path = os.path.join(BASE_PATH,"config","setting.ini")
data = data.load_ini(data_file_path)["mysql"]
DB_CONF={
"host": data[... | true |
58abef93667fe63c4908a37494dbb33ada69a0cd | Python | JakeStratton/NewsClusters | /clusters.py | UTF-8 | 2,602 | 2.890625 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import itertools
import scipy.stats as scs
from scipy.spatial.distance import pdist, squareform
from sklearn.cluster import KMeans, AgglomerativeClustering
from sklearn.metrics import silhouette_score, silhouette_samples
import matplotlib
from IPyt... | true |
99d86e6ae4560f03960c4dced58839be36cf7a66 | Python | geoking1907/random-passwords | /randomPasswords.py | UTF-8 | 202 | 3.59375 | 4 | [] | no_license | import random
chars = "abcdefghijklmnopqrstuvwxyz"
chars += chars.upper()
chars += "1234567890"
length = int(input("Length: "))
password = "".join(random.sample(chars, length))
print(password) | true |
0c579386f1bc45c52315c031a4cec91f1c18f99b | Python | hpfn/wttd-2017-exerc | /modulo_2/Codewars/dev-junior/test_thue_morse.py | UTF-8 | 666 | 2.84375 | 3 | [] | no_license | # coding=utf-8
from unittest import TestCase
from thue_morse import thue_morse
class ThueMorseTest(TestCase):
def test_thuemorse(self):
self.assertEqual(thue_morse(1), '0')
def test_thuemorse_1(self):
self.assertEqual(thue_morse(2), '01')
def test_thuemorse_2(self):
self.assertEq... | true |
c949f88ded4bcd8a1342ca5e4f9a49e20748d926 | Python | neohann/Random-Count-Generator-with-Python | /Random+Count+Generator+with+Python.py | UTF-8 | 942 | 3.234375 | 3 | [] | no_license |
# coding: utf-8
# In[6]:
import random
import datetime
import numpy as np
import Queue
import threading
class Q1:
def __init__(self):
self.lst = []
self.freq = {}
self.q = Queue.Queue()
self.output = []
def generater(self):
for num in np.random.choice(np.arange(1, 6), 100, p = [0.5, 0.25, 0... | true |
452e375028a76e875f12f16597156f349b482703 | Python | Falitokiniaina/ADproject | /bin/dataStructures.py | UTF-8 | 695 | 2.78125 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | class Tree(object):
def __init__(self, head={}, body={}, type=""):
self.head = head
self.body = body
self.type = type
def __repr__(self):
return "%r" % (self.__dict__)
class Predicate(object):
def __init__(self, name="", terms=[], isNegated=""):
self.n... | true |
21e145d68d39cf8761abe749b0050bea640e7649 | Python | ttp55/LearnPy | /测试/test19.py | UTF-8 | 241 | 3.390625 | 3 | [] | no_license | # @Time : 2019/5/22 9:36
# @Author : WZG
# --coding:utf-8--
day = int(input('输入一个1到11的数字:'))
def mounkey(a):
if a == 2:
n = 4
else:
n = (mounkey(a - 1) + 1) * 2
return n
print(mounkey(day))
| true |
6bd1d67cf51791e511d56bce810abcee0b9ffab5 | Python | vibheshkaul/AudioClassiy_OpenL3 | /AudioNetwork.py | UTF-8 | 4,534 | 2.578125 | 3 | [] | no_license | import torch
import torch.nn as nn
import torchaudio.transforms as T
import random
class AudioNetwork(nn.Module):
def __init__(self):
super().__init__()
filt_size = (3, 3)
pool_size = (2, 2)
num_classes=50
# Create melspectrograms
self.mel_spectrogram = T.MelSpectr... | true |
46da9fcca415ae288cd70fe25d39fc865f4a75a7 | Python | petersonb/sentinal | /api/service/commandservice.py | UTF-8 | 1,127 | 2.734375 | 3 | [] | no_license | """
Wrapper for commands to be sent to remote machine.
Remote machine must posess the public key for this machine.
Author: PetersonB
"""
import subprocess as subp
import simplelog as logger
import sys
USERNAME = "brett"
MACHINE = "localhost"
def _command(cmd):
"""
All commands will run through this funcito... | true |