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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a55b0c1e1d008574adfa0bb1dde1ecd83e4ba4e4 | Python | zeus911/aws_manage | /list_ec2.py | UTF-8 | 1,542 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
import subprocess
import session
import parse_ec2
def list_instances():
ec2_config = parse_ec2.get_config('ec2.json')
s = session.create_session(ec2_config['region'])
ec2 = s.resource('ec2')
instances = ec2.instances.all()
instances_list = []
# No., Name, Instance-id,... | true |
694ef56a81aa284deed576d81c7540659c52e540 | Python | Shirleybini/Python-Projects | /Birthday Wisher/main.py | UTF-8 | 912 | 2.890625 | 3 | [] | no_license |
import smtplib
import random
import datetime as dt
import pandas as pd
my_email = "youremailid@email.com"
password = "your password"
now = dt.datetime.now()
today = (now.month,now.day)
birthdays = pd.read_csv("birthdays.csv")
birthday_dict = {(data_row['month'],data_row['day']):data_row for (index, data_row) in... | true |
cf9aa3be71cde26348cf48f4faaee8228fde10bd | Python | Fengyongming0311/TANUKI | /Appium/LinBaO_Android/src/ReleasePage/Case07_GoodsDetail.py | UTF-8 | 2,875 | 2.5625 | 3 | [] | no_license | __author__ = 'TANUKI'
# coding:utf-8
import time,sys
sys.path.append("..")
class GoodsDetail:
def GoodsDetail(driver):
try:
driver.implicitly_wait(10)
#print ("开始执行用例7....进入商品详情")
time.sleep(3)
Homepage_all_handles = driver.window_handles
needhand... | true |
c3efc5ca1f6283b69c2390ae3c2ddd7b5df67623 | Python | Aasthaengg/IBMdataset | /Python_codes/p03826/s028473248.py | UTF-8 | 750 | 4 | 4 | [] | no_license | '''
問題:
二つの長方形があります。
一つ目の長方形は、縦の辺の長さが A、横の辺の長さが B です。
二つ目の長方形は、縦の辺の長さが C、横の辺の長さが D です。
この二つの長方形のうち、面積の大きい方の面積を出力してください。 なお、二つの長方形の面積が等しい時は、その面積を出力してください。
'''
'''
制約:
入力は全て整数である
1 ≦ A ≦ 10000
1 ≦ B ≦ 10000
1 ≦ C ≦ 10000
1 ≦ D ≦ 10000
'''
# 標準入力から A, B, C, D の値を取得する
a, b, c, d = map... | true |
c643ccee915862483399b80591b38bed0cd7e0a6 | Python | erjan/coding_exercises | /tictactoe.py | UTF-8 | 5,342 | 4.25 | 4 | [
"Apache-2.0"
] | permissive | '''
Tic-tac-toe is played by two players A and B on a 3 x 3 grid.
Here are the rules of Tic-Tac-Toe:
Players take turns placing characters into empty squares (" ").
The first player A always places "X" characters, while the second player B always places "O" characters.
"X" and "O" characters are always pl... | true |
55e86eedbf7c85aaf247d5e014703390adc2e96d | Python | sonex02/djangoOwn | /user/models.py | UTF-8 | 496 | 2.59375 | 3 | [] | no_license | from django.contrib.auth.models import AbstractUser
from django.db import models
class User(AbstractUser):
# 设置性别在页面显示为汉字
sex_choices = (
(0, u'男'),
(1, u'女'),
)
nickname = models.CharField(max_length=30,verbose_name='昵称')
age = models.IntegerField(default=0,verbose_name='年龄')
... | true |
4a8a9c45f23bf39810f077acd62b80c60dea65db | Python | sandeepkompella/University-of-Washington | /Quiz - Regression.py | UTF-8 | 1,942 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat May 2 21:34:07 2020
@author: sandeepkompella
98102
"""
import pandas as pd
import numpy as np
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error, r2_score
from sklearn.model_selection import train_test_spl... | true |
fe0eea20ed853476b32ec735c5fa2abbc127444b | Python | acislab/pragma-cloud-spark | /first_try.py | UTF-8 | 2,973 | 2.90625 | 3 | [
"MIT"
] | permissive |
# coding: utf-8
# ### Giving Keras a try, this code is based on the example from the lead Keras developer [here](https://blog.keras.io/building-powerful-image-classification-models-using-very-little-data.html)
# In[1]:
import sys
# Limit to CPU
import os
#os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # see issu... | true |
431b86ba9ddf4a11c82f0bcf3ee57431502e309d | Python | Sriramnat100/Discord_Bot | /bot.py | UTF-8 | 3,837 | 2.921875 | 3 | [] | no_license | import os
import json
import discord
import requests
import random
from discord.ext import commands
from discord.ext.commands import Bot
import ast
import json
import youtube_dl
client = commands.Bot(command_prefix = "$")
def get_quote():
#Getting quote from the API
response = requests.get("https://api.kanye.rest/... | true |
3195b5b458481e88e510025b25ddc31291d3c03f | Python | BruceYaphets/ball_in_box | /ball_in_box/ballinbox.py | UTF-8 | 2,238 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import random
import math
import matplotlib.pyplot as plt
from .validate import validate
__all__ = ['ball_in_box']
def ball_in_box(num_of_circle, blockers):
circles=[]
#初始化球的坐标和半径
for tmp in range(num_of_circle):
circles.append([0,0... | true |
0cee94d51c260b652ab9cc527d8f254fc20f1323 | Python | devona/codewars | /uniq.py | UTF-8 | 448 | 4.03125 | 4 | [] | no_license | '''
Implement a function which behaves like the uniq command in UNIX.
It takes as input a sequence and returns a sequence in which all duplicate elements following each other have been reduced to one instance.
Example:
['a','a','b','b','c','a','b','c'] --> ['a','b','c','a','b','c']
'''
def uniq(seq):
i = 0
... | true |
469fb3a61300b78184f53655d1456641b0c15868 | Python | hed-standard/hed-specification | /tests/test_summarize_testdata.py | UTF-8 | 2,860 | 2.703125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"CC-BY-4.0",
"LicenseRef-scancode-public-domain"
] | permissive | import os
import json
import unittest
class MyTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
test_dir = os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(__file__)),
'json_tests'))
cls.test_files = [os.path... | true |
2c8855b1f554f5832a2445b73089804b66486c4c | Python | linliqun/shujusuan | /test_1.py | UTF-8 | 492 | 3.234375 | 3 | [] | no_license | #设有n个整数,将他们连接成一排,组成一个最大的多位整数
#如:n=3时,3个整数13,312,343,连接成最大的整数位34331213
#如:n=4,4个整数7,13,4,246连接成最大整数位7424613
#code为
n=int(input())
str=input().split()
max_s=''
def find(num):
global max_s
if len(num)<=0:
return
a=num[0]
for b in num:
if a+b<b+a:
a=b
max_s+=a
num.remov... | true |
6c48a36b0c6736e9dfce8a468175f1072af46c7e | Python | zabcdefghijklmnopqrstuvwxy/AI-Study | /1.numpy/topic45/topic45.py | UTF-8 | 585 | 3.84375 | 4 | [] | no_license | #numpy.argmax(a, axis=None, out=None)
#返回沿轴axis最大值的索引。
#Parameters:
#a : array_like
#数组
#axis : int, 可选
#默认情况下,索引的是平铺的数组,否则沿指定的轴。
#out : array, 可选
#如果提供,结果以合适的形状和类型被插入到此数组中。
#Returns:
#index_array : ndarray of ints
#索引数组。它具有与a.shape相同的形状,其中axis被移除。
import numpy as np
arr=np.random.random(10)
print(f"rando... | true |
74b11b230e856498c91059a4a18228f8e917b81c | Python | SSyangguang/railroad-detection | /railroadDetectionLine.py | UTF-8 | 6,866 | 3.296875 | 3 | [
"MIT"
] | permissive | # 使用线性拟合对铁轨区域进行绘制
# 输入为视频预处理过程中求得的背景图,处理完成后会分别保存绘制了铁轨区域的原图和只有铁轨区域的图像
import numpy as np
import cv2
# 定义边缘检测中需要用到的参数
blurKernel = 21 # Gaussian blur kernel size
cannyLowThreshold = 10 # Canny edge detection low threshold
cannyHighThreshold = 130 # Canny edge detection high threshold
# 定义hough变换参数
rho = 1 # rho... | true |
5d517ace3832098a813e9b910b1c1c70d3c9809e | Python | immzz/leetcode_solutions | /balanced binary tree.py | UTF-8 | 618 | 3.40625 | 3 | [] | no_license | # 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 isBalanced(self, root):
"""
:type root: TreeNode
:rtype: bool
"""
return self... | true |
f2443989bfa65edce94d65f953d2b579265351bb | Python | jmanuel1/dice | /dice.py | UTF-8 | 4,663 | 3.546875 | 4 | [
"MIT"
] | permissive | import cmd
import random
import logging
from collections import namedtuple
class DiceRollInterface(cmd.Cmd):
intro = "Roll simulated dice like a pro. Type 'help' for help."
def do_stats(self, _):
"""Do stat rolls (4d6-drop 1 six times)."""
d = Die()
for _ in range(6):
prin... | true |
a8397f856fb106ca38110dd81b9db1583285aa7e | Python | miyagipipi/studying | /Tree/验证前序遍历序列二叉搜索树 255.py | UTF-8 | 1,591 | 3.859375 | 4 | [] | no_license | '''
给定一个整数数组,你需要验证它是否是一个二叉搜索树正确的先序遍历序列。
你可以假定该序列中的数都是不相同的
'''
class Solution:
def verifyPreorder(self, preorder: List[int]) -> bool:
stack = []
new_min = float('-inf') # 初始化下限值
for i in range(len(preorder)):
if preorder[i] < new_min: return False
while stack and pre... | true |
a73d69642c84e46eadff0441b96ef991b39cdcdb | Python | Rejeected/Vacancy | /script/pentagon.py | UTF-8 | 503 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python3
data = open('baza.txt').read().splitlines()
#data = ['_+=+_ssssss_+=+_']
file = open('prof_data.txt', 'w')
file.write('var dict_prof_names = {\n')
count_lines = 0
for line in data:
if line[:5] == '_+=+_' and line[-5:] == '_+=+_':
if count_lines != 0:
file.write("],\n")
... | true |
bd1a1fe6e4c7d7af55e3e88bef3047439023c8a6 | Python | Demons-wx/leetcode_py | /leetcode/q20_valid_parenttheses.py | UTF-8 | 888 | 4 | 4 | [] | no_license | # -*- coding: utf-8 -*-
__author__ = "wangxuan"
# Given a string containing just the characters '(', ')', '{', '}', '[' and ']',
# determine if the input string is valid.
#
#
# The brackets must close in the correct order, "()" and "()[]{}" are all valid
# but "(]" and "([)]" are not.
#
# Time: O(n)
class Solutio... | true |
2f55e7ceca5eb7c87c0b12dd2f916dc04d9ecaa7 | Python | PavelGordeyev/mastermind | /mastermind.py | UTF-8 | 3,360 | 4.09375 | 4 | [] | no_license | #####################################################################
## CS325 Analysis of Algoirthms
## Program name: HW6 - Portfolio Assignment (Option 1) - Mastermind
##
## Author: Pavel Gordeyev
## Date: 8/9/20
## Description: Text-based version of the mastermind game. User will
## have 8 turns to guess the co... | true |
0a5fda59438f0e993073bacaec2f6bd47508767a | Python | gdassori/fresh_onions | /pastebin/proxies_rotator.py | UTF-8 | 3,160 | 2.703125 | 3 | [] | no_license | __author__ = 'guido'
from bs4 import BeautifulSoup
import requests
import random
import time
class DoYourOwnProxyRotator():
def __init__(self, logger):
self.logger = logger
@property
def proxies(self):
self.logger.error('wtf I said do your own')
raise NotImplementedError()
@p... | true |
c4f9dd6fee46912749c3095e0585e52a8c1122cd | Python | shnehna/object_study | /object/异常.py | UTF-8 | 373 | 3.390625 | 3 | [] | no_license | try:
num = int(input('请输入一个整数'))
result = 8 / num
print(result)
except ZeroDivisionError:
print("除0错误")
except ValueError:
print("输入错误")
except Exception as e:
print("未知错误 %s" % e)
else:
print("没有异常 结果为 %s" % result)
finally:
print("无论是否有异常都会有执行")
print("另一个")
| true |
bed40ada834fe80e6219e6eee963fd19263c1287 | Python | New-generation-hsc/PPractice | /week4/vggnet.py | UTF-8 | 4,536 | 2.53125 | 3 | [] | no_license | from __future__ import print_function
import paddle.v2
import paddle.fluid as fluid
import random
import shutil
import numpy as np
from datetime import datetime
from PIL import Image
import os
import sys
FIXED_IMAGE_SIZE = (32, 32)
params_dirname = "image_classification.inference.model"
def input_program():
# ... | true |
71c34fca099dd7ad4aa5040083ae22eafab3feee | Python | mudsahni/MIT6.006 | /DocumentDistance/document_distance.py | UTF-8 | 1,643 | 3.625 | 4 | [] | no_license | import sys
import os
import math
import string
def read_file(filename):
try:
f = open(filename, 'r')
return f.read()
except IOError:
print(f"Error opening input file: {filename}.")
sys.exit()
translation_table = str.maketrans(string.punctuation + string.ascii_uppercase,
... | true |
43cfd5328e5a391bc490c1812ef18b30198e3578 | Python | GeniusV/alphacoders-wallpaper-downloader | /downloader_2.py | UTF-8 | 4,172 | 2.78125 | 3 | [] | no_license | import os
import re
import sqlite3
import urllib.request
import shutil
from lxml import etree
from tqdm import tqdm
maxNumber = 999
first = None
count = 0
# open the file to store the result
# the result will be stored at /Users/GeniusV/Desktop/result.txt
def insert(tablename, address):
try:
sql = '''i... | true |
b9a5192e6d4a29deebf196b927e6ba372a1a63ae | Python | tongni1975/gtfspy | /gtfspy/routing/util.py | UTF-8 | 517 | 3.609375 | 4 | [
"MIT",
"ODbL-1.0",
"CC-BY-4.0"
] | permissive | import time
def timeit(method):
"""
A Python decorator for printing out the execution time for a function.
Adapted from:
www.andreas-jung.com/contents/a-python-decorator-for-measuring-the-execution-time-of-methods
"""
def timed(*args, **kw):
time_start = time.time()
result = me... | true |
43e6ebd62209d0ba29e73e9574e432ad576962c9 | Python | adriansr/challenges | /codejam/2019/QR/A. Foregone Solution/solve.py | UTF-8 | 407 | 3.390625 | 3 | [] | no_license |
def solve(target):
a = ''.join([x if x != '4' else '3' for x in target])
b = ''.join(['0' if x != '4' else '1' for x in target])
while len(b) > 0 and b[0] == '0':
b = b[1:]
if len(b) == 0:
b = '0'
return a, b
T = int(raw_input())
for case_num in range(1, T+1):
target = raw_in... | true |
ad666308f2bfa5b0c13c2489019d8511e2e65000 | Python | Aasthaengg/IBMdataset | /Python_codes/p02534/s467288787.py | UTF-8 | 118 | 2.765625 | 3 | [] | no_license | N = int(input())
ACL_str = []
for i in range(N):
ACL_str.append('ACL')
mojiretu = ''.join(ACL_str)
print(mojiretu) | true |
bb4f329f096fc13e426ea8340b9ed788e093fc9d | Python | saranyab9064/optimal_routing | /optimal_routing.py | UTF-8 | 19,219 | 2.515625 | 3 | [] | no_license | #!/usr/bin/python3
from ryu.base import app_manager
from ryu.controller import mac_to_port
from ryu.controller import ofp_event
from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_3
from ryu.lib.mac import haddr_to_bin
f... | true |
05e4739e03668252b4dd32f415993fc49d6808a5 | Python | coding-2/GuessingGame | /Main.py | UTF-8 | 400 | 2.859375 | 3 | [] | no_license | from Graphics import Graphics
graphics = Graphics()
answer = ["zealous", "history", "moist", "flag", "geyser", "squish", "quotation", "", "oblique", "ink", "dogs", "pancake", "fox", "dragon", "turtle", "stripes"]
def function():
graphics.startup()
#The Graphics go here#
def guessedBefore(let... | true |
14ddd9002b6cedde726beced947236cf255660ce | Python | idcmp/pyd | /pyd/tools/toolbox.py | UTF-8 | 2,954 | 3.15625 | 3 | [] | no_license | """
SDK ontop of the API
"""
from datetime import date
from pyd.api import diaryreader as reader
from pyd.api import diarywriter as writer
from pyd.api import diarymodel as model
from pyd.api import naming
from pyd.api import carryforward as cf
from pyd.api.diarymodel import MAXIMUM_HOLIDAY_WEEKS
def find_todos... | true |
d637a6ce0277854e816eac6ecd064f17bde5f5df | Python | heikeadel/slot_filling_system | /modul_output.py | UTF-8 | 856 | 2.5625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
#####################################
### CIS SLOT FILLING SYSTEM ####
### 2014-2015 ####
### Author: Heike Adel ####
#####################################
from __future__ import unicode_literals
import codecs, sys
reload(sys)
sys.setdefaulte... | true |
365e70fc0fae5ef38ec818652b0b5fcd3fd81dbe | Python | ganlubbq/communication-simulation | /wireless channel/rayleigh channel.py | UTF-8 | 2,344 | 3.046875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import simulation.multipath
# reference: http://matplotlib.org/users/mathtext.html
t = [0]*10000
a0 = [0j]*len(t)
a1 = [0j]*len(t)
#模擬的時間為0~250ms
for i in range(len(t)):
t[i] = i/len(t)*0.25
#先來看看這個模型的振幅
for j in range(3):
if j==0:
fd = 10
w... | true |
a27288de4d58bb1f2a3c6a7876b2ca48abd3a01c | Python | arianafm/Python | /Intermedio/Clase1/EjemploRaise2.py | UTF-8 | 310 | 3.828125 | 4 | [] | no_license | #Raise: invoca excepciones de Python.
while True:
mejorCurso = input("Ingresa cuál es el mejor curso de Proteco:")
mejorCursoConMinusculas = mejorCurso.lower()
if mejorCursoConMinusculas != "python am sala a":
raise ValueError
else:
print("Felicidades, Python AM sala A es el mejor curso.")
break | true |
8f0629eb3dfd32f5b366d258252361f29226c8b2 | Python | BodleyAlton/scrape-cricinfo | /app/genalgo.py | UTF-8 | 5,309 | 2.6875 | 3 | [] | no_license | import random
from app.dtModel import model_dt
#--------Calculat fitness of player----
def plfitness(p):
fitness=0
#calculate fitnes of player and append to player.
ptype=p[1] # player Type
print("ptype"+str(ptype))
stats=p[2] # Player Statistics(based on player type)
bowStl=p[3][0]
batStyl=p[3]... | true |
3b60ba16a66455272178c5fc7135bda179d4fd86 | Python | jchristman/adventofcode | /06/win.py | UTF-8 | 2,879 | 3.921875 | 4 | [
"MIT"
] | permissive | # ----------------------------------------------------------------------------------------------------------------------
# Advent of Code - Day 6
#
# The Python One-Liner challenge:
#
# Rules:
#
# - Reading input into a variable from another file or with an assignment is acceptable and does not count against
# ... | true |
2612ac5d77226a4a1259f8f36ea8aeb9b666459f | Python | gullabi/long-audio-aligner | /utils/segment.py | UTF-8 | 10,899 | 2.84375 | 3 | [] | no_license | import os
import subprocess
import logging
from math import floor
from utils.beam import Beam
class Segmenter(object):
def __init__(self, alignment, silence = 0.099, t_min = 2, t_max = 10):
# TODO assert alignment object has target_speaker and punctuation
self.alignment = alignment
self.si... | true |
0d7492bee0695692470693fc6ebcf11a324f9978 | Python | Jkwnlee/python | /pymatgen_practice/v1_dielectic.py | UTF-8 | 3,517 | 2.75 | 3 | [] | no_license | #bin/python3
import pymatgen as pmg
import pandas as pd
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
# need to check how to treat tensor of dielectric:
# Hashin, Z., & Shtrikman, S. Physical Review, 130(1), 129–133. (1963).
# Conductivity of Polycrystals.
# doi:10.1103/physrev.130.... | true |
77061bf51b7f503221c420f0a34e621a34509aac | Python | aristotlepenguin/endless-war | /ew/cmd/item/itemutils.py | UTF-8 | 9,729 | 3.140625 | 3 | [] | no_license | import sys
from ew.backend import core as bknd_core
from ew.backend import item as bknd_item
from ew.backend.item import EwItem
from ew.static import cfg as ewcfg
from ew.utils import core as ewutils
from ew.utils.combat import EwUser
from ew.static.weapons import weapon_list
"""
Drop item into current district.
"... | true |
544224a2a1ac775182c89fb1dc4fea67eca83290 | Python | Shuaiyicao/leetcode-python | /149.py | UTF-8 | 1,356 | 3.21875 | 3 | [] | no_license | # Definition for a point
# class Point:
# def __init__(self, a=0, b=0):
# self.x = a
# self.y = b
class Solution:
# @param points, a list of Points
# @return an integer
def gao(self, a, b):
if a.x == b.x:
return 1<<30
return (1.0 * b.y - a.y) / (b.x - a.x)
... | true |
ec9709d75b748e96208f8e739e393a29d4e4b31a | Python | gilsonaureliano/Python-aulas | /python_aulas/desaf104_def_notas_dicionario.py | UTF-8 | 863 | 3.40625 | 3 | [
"MIT"
] | permissive | def notas(*n, sit=False):
"""
'Dicionario de notas'
:param n: 'Notas dos alunos'
:param sit: 'Situação final"
:return: 'Total, maior, menor, situação(op)'
"""
global men, med
dic = {}
dic['total'] = len(n)
mai = 0
total = 0
for c, v in enumerate(n):
if n[c] > mai:... | true |
31f6ba18e1b7fd7deccc0fd547c8d6d330ae81dc | Python | N0tH3r0/Python-Estrutura-Sequencial | /Ex 08.py | UTF-8 | 337 | 4.5625 | 5 | [] | no_license | #Make a Program that asks how much you earn per hour and the number of hours worked in the month. Calculate and show your total salary in that month.
fhour = float(input("Put here your rate per hour: "))
fmonth = float(input("Put number of hours worked in the month: "))
res = fhour * fmonth
print("Your salary in a mont... | true |
a6fe065223066146f257e74019c57740685572e5 | Python | ariane-lozachmeur/phylogenetictree | /benchmark.py | UTF-8 | 1,497 | 2.734375 | 3 | [] | no_license | from ete3 import Tree
import pandas as pd
from Bio import Phylo
# File to benchmark our methods with MUSCLE and MAFFT using the Robinson Foulds metric.
# It create a benchmark_results.csv file in the "results" repository and prints all of the tree that can then be saved for further analysis.
prots = ['LRRD1','TRAF6',... | true |
aa1be29d6d69b36711e0c0223345852d1d1772b7 | Python | ben-kolber/openCV_on_raspi | /plan_path.py | UTF-8 | 3,954 | 2.8125 | 3 | [] | no_license | import numpy as np
import cv2
import matplotlib.pyplot as plt
import face_recognition
from PIL import Image
import sys
import random
from matplotlib.pyplot import figure
def show(string, image):
cv2.imshow(string, image)
cv2.waitKey()
img = cv2.imread(
"/Users/benjaminkolber/Desktop/Personal Programming ... | true |
4549c92416a7bf97f82537f87bf96633b77700a6 | Python | jaredrokowski/school_code | /Python/heatmap.py | UTF-8 | 1,087 | 2.515625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def heatMapForDATA( DATA, rowlabels, collabels, fignum, userowlabels=True, usecollabels=False ) :
## Need corners of quads for color map
X = [ [] for i in range(0,len(collabels)+1) ]
Y = [ [] for j in range(0,len(collabels)+1) ]
for j in range(0,len(collabels)+1)... | true |
ad94471530a1e6860273ee679f70fb161857c975 | Python | briandleahy/optimal-equiareal-map | /optimalmap.py | UTF-8 | 8,136 | 3.546875 | 4 | [] | no_license | # TODO
# The problem here is that the metric diverges like 1/sin(2theta) at the
# poles (so a 1/x singularity), which is _not integrable_. So while
# you don't get infinities, you do get something which diverges as you
# add more points. This is why you get weirdness with the maps as the degree
# goes higher.
# The sol... | true |
cc2478fd0c1788ce14a5b7ef7b1b071ecd5f4fcc | Python | mushahiroyuki/beginning-python | /Chapter09/0916-generator-comprehension.py | UTF-8 | 975 | 3.515625 | 4 | [] | no_license | #@@range_begin(list1) # ←この行は無視してください。本文に引用するためのものです。
#ファイル名 Chapter09/0916-generator-comprehension.py
#@@range_end(list1) # ←この行は無視してください。本文に引用するためのものです。
#@@range_begin(list2) # ←この行は無視してください。本文に引用するためのものです。
g = ((i + 2) ** 2 for i in range(2, 27))
print(next(g)) #← 16
print(next(g)) #← 25
print(next(g)) #← 36
prin... | true |
3018fb23d501984e292a2207d490310ccc005974 | Python | MoriMorou/GB_Python | /Methods of collecting and processing data from the Internet/Lesson_6_Selenium For Python. Parsim dynamic and private data/selenium_example.py | UTF-8 | 1,678 | 2.65625 | 3 | [] | no_license | from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://mail.ru")
# печать всего html кода страницы
print(driver.page_source)
# выполнение скрипта по заголовку страницы
assert "Mail" in driver.title
driver.close()
# cartridges = []
#
#
# for item in range(1, 10):
# elem = driver.find_elem... | true |
efa8116e5f20bd5f77d0e57edc3b4441ca34156a | Python | yesmider/TradingViewer | /bad.py | UTF-8 | 722 | 3.234375 | 3 | [] | no_license | from random import *
import os
your_lucky_number = []
your_lucky_number.append(randint(1,50000))
run_time = 0
bad_luck_checker = 1
item_num = 0
total = 0
while item_num < 10:
if randint(1,50000) in your_lucky_number:
print('got in '+str(run_time))
total += run_time
run_time = 0
your_... | true |
58a713308555a9e588a06ed87bed6d13e54b2b57 | Python | osamudio/python-scripts | /fibonacci_2.py | UTF-8 | 303 | 4.03125 | 4 | [] | no_license | def fib(n: int) -> None:
"""
prints the Fibonacci sequence of the first n numbers
"""
a, b = 0, 1
for _ in range(n):
print(a, end=' ')
a, b = b, a+b
print()
return
if __name__ == "__main__":
n = int(input("please, enter a number: "))
fib(n)
| true |
f355d42dd52cdd4438a45986285fe1905e4e8c64 | Python | jhgdike/leetCode | /leetcode_python/901-1000/999.py | UTF-8 | 1,589 | 3.109375 | 3 | [] | no_license | class Solution(object):
def numRookCaptures(self, board):
"""
:type board: List[List[str]]
:rtype: int
"""
res = 0
m, n = self.find_r(board)
for i in range(m - 1, -1, -1):
if board[i][n] == 'B':
break
if board[i][n] == '... | true |
0b988079500d6536abbe012425ef622e2a027329 | Python | stanislavmarochok/TensorflowImageClassification | /main.py | UTF-8 | 17,237 | 2.625 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import cv2
import sklearn
import sklearn.preprocessing as ppc
import random
import pickle
import json
import os
import time
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activa... | true |
e75fdf5eef06abc353ed1d26a358619cec7d9c07 | Python | henneyhong/Python_git | /python문제풀이/prac0528.py | UTF-8 | 339 | 2.515625 | 3 | [] | no_license | import os
import random
from datetime import datetime
import time
for num_a in range(1, 11):
value = num_a*100000
value = str(value)
print(value)
timestamp = time.mktime(datetime.today().timetuple())
s = str(timestamp)
print(s)
with open("log\count_log.txt",'w', encoding="utf8")as f:
f.write(value)
f.... | true |
92ea3931796b15bad2418a93484b0994f52ea6d2 | Python | gilperopiola/autocursor-py | /autocursor.py | UTF-8 | 1,254 | 3.046875 | 3 | [] | no_license | import pyautogui
import time
import random
size = pyautogui.size()
width = size[0]
height = size[1]
random_nuance_min = 0.0025
random_nuance_max = 0.479
random_nuance = random.uniform(random_nuance_min, random_nuance_max)
# move to following and click and go to middle of screen
pyautogui.moveTo(1085, 255, duration =... | true |
f5fc2ff0969a299b577e096cc909de2fa80a6a0b | Python | Darlley/Python | /Curso em Video/ex034.py | UTF-8 | 170 | 3.65625 | 4 | [] | no_license | s = float(input('Qual o salário do funcionario? R$'))
if s <= 1250:
a = s + (s * 15 / 100)
else:
a = s + (s * 10 / 100)
print('O salário passa a ser de R$', a)
| true |
5917b61cf19f38afe845bf18da2165d035c8f8bf | Python | Giulianos/rl-stairs | /Training.py | UTF-8 | 2,511 | 3.078125 | 3 | [] | no_license | import MapLoader
import numpy as np
from World import World, Action
from Tile import Tile
from Policy import GreedyPolicy
from Option import Option, PrimitiveOption
from QLearning import learn_episodic
from State import State
def training_base(name, options, map_file):
print('Learning {}...'.format(name))
tra... | true |
30d65933f5fa30c3214c4a7b4f0e3e0631e5911e | Python | DragonDodo/cipher | /grids2.py | UTF-8 | 1,559 | 3.46875 | 3 | [] | no_license | # playfair grid generator from crib
class Grid:
def __init__(self):
self.positions = {}
self.letters = {}
def getPositionOf(self, letter):
if letter in self.positions:
return self.positions[letter]
else:
return None # raise?
def getLetterAt... | true |
9391d8bc0ae92744352d49c836afdc1c186c7860 | Python | yunnuoyang/joinx-flask-day01 | /com/joinx/04/SocketClient.py | UTF-8 | 274 | 3.125 | 3 | [] | no_license | import socket # 导入 socket 模块
s = socket.socket() # 创建 socket 对象
host = socket.gethostname() # 获取本地主机名
port = 12345 # 设置端口号
s.connect((host, port))
letter=s.recv(1024)
print(letter.decode()) #将bytes数据解密出来
s.close()
| true |
91e73376cf7f3641fd0319d4652484e1a5cf82d6 | Python | haru-256/cgan.tf | /dcgan.py | UTF-8 | 14,648 | 3 | 3 | [] | no_license | Import tensorflow as tf
import numpy as np
class DCGAN(object):
"""DCGAN
Parameters
----------------------
path: Path object
Filewriterを作る場所を示すpath
"""
def __init__(self,
n_hidden=100,
bottom_width=4,
ch=128,
num_dat... | true |
f11545190f11de3907b739117fc277c2da314491 | Python | unimonkiez/socket-project | /common/response.py | UTF-8 | 668 | 2.90625 | 3 | [] | no_license | from enum import Enum as _Enum
class ResponseTypes(_Enum):
accept = 1
reject = 2
class Response:
def __init__(self, resType: ResponseTypes, data: dict):
self.type = resType
self.data = data
def toDict(self):
return {
"type": self.type.value,
... | true |
1c425c4f7a802345981aab3af2a9e00939b1fb00 | Python | cianoflynn/codingchallenges | /codewars.com/Persistent Bugger.py | UTF-8 | 896 | 4.15625 | 4 | [] | no_license | # DATE: 12/03/19
# URL: https://www.codewars.com/kata/persistent-bugger/python
'''
Write a function, persistence, that takes in a positive parameter num and returns its multiplicative persistence, which is the number of times you must multiply the digits in num until you reach a single digit.
For example:
persisten... | true |
bbc42965bf6182bf05ad5db883e154766c1977ec | Python | shrutikamokashi/AmazonOA-4 | /AmazonOA/splitarray1.py | UTF-8 | 359 | 3.3125 | 3 | [] | no_license |
import math
def permutationsequence(n,k):
nums = [i for i in range(1,n+1)]
ans = ''
k -= 1
for i in range(1,n+1):
n -= 1
index,k = divmod(k, math.factorial(n))
ans += str(nums[index])
nums.remove(nums[index])
return ans
n= 3
k=3
prin... | true |
3843b8bbdb35458a9baf38cfc7587e728e5d3211 | Python | santoshdkolur/face_blur | /face_blur_selectedFaces.py | UTF-8 | 2,877 | 3.109375 | 3 | [] | no_license | import cv2
import face_recognition as fr
from time import sleep
import numpy as np
import progressbar
def main():
#Purpose : To blur out faces in a video stream to maintain privacy. This fucntion can be applied over any other project.
#Author : Santosh D Kolur
count=0 #count frame number
copy_floc... | true |
1f8e563092977abdb0def33e9909316905e5a8b1 | Python | dragino/aws-iot-core-lorawan | /transform_binary_payload/src-payload-decoders/python/tabs_objectlocator.py | UTF-8 | 5,628 | 2.609375 | 3 | [
"MIT-0"
] | permissive | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
#
# 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 ... | true |
862dfc25fa9018249cd6b1e72a9167f2875ee6ec | Python | bbrady5/SeniorDesignProject | /tcp_client_1.py | UTF-8 | 1,013 | 2.96875 | 3 | [] | no_license | # TCP Client Example
#
# This example shows how to send and receive TCP traffic with the WiFi shield.
import network, usocket
# AP info
SSID='Villanova Senior Design' # Network SSID
KEY='merakipassword' # Network key
# Init wlan module and connect to network
print("Trying to connect... (may take a while)... | true |
2de57c77248c6ec47b8dee300786e8f0d7fd367d | Python | kluangkhflemingc/geom73 | /CountEverything.py | UTF-8 | 3,611 | 3.171875 | 3 | [] | no_license | # File: CountEverything.py
# Date: January 28 2021
# Authors: Kristine Luangkhot & Jennifer Debono
# Script to inventory data in a user specified folder
# Inventory to include:
# Count and report the total number of files and type - Excel files and shapefiles only
# Count and report the total number of rows or feature... | true |
004c445b430a8e451cd57d1f904ba3c298aefa8e | Python | mjohnston89/AdventOfCode | /2016/Day 03/c2.py | UTF-8 | 855 | 3.6875 | 4 | [] | no_license | print('Advent of Code - Day 3, Challenge 2')
from itertools import islice
def isValid(sides):
return max(sides) < (sum(sides) - max(sides))
validCount = 0
# Open source file and parse each triangle
with open('input.txt') as file:
while True:
temps = [[],[],[]]
# read 3 lines of input
lineBlock = lis... | true |
a994e1715a365f16f4049d16010a33bb9936fe1d | Python | xiangbaloud/okgo_py | /fibo.py | UTF-8 | 168 | 3.40625 | 3 | [] | no_license | #!/usr/bin/python
def fib(n):
list_a = [0, 1]
for i in range(n):
x = list_a[-1] + list_a[-2]
list_a.append(x)
return list_a
print(fib(17))
| true |
72b208196631a7a0917a32c770877251d3f4d1c3 | Python | arohan-agate/Python-Data-Analysis-Projects | /Python for Data Visualization: Matplotlib & Seaborn/Mini Challenge 3.py | UTF-8 | 310 | 3.359375 | 3 | [] | no_license | values = [20, 20, 20, 20, 20]
colors = ['g', 'r', 'y', 'b', 'm']
labels = ['AAPL', 'GOOG', 'T', 'TSLA', 'AMZN']
explode = [0, 0.2, 0, 0, 0.2]
# Use matplotlib to plot a pie chart
plt.figure(figsize = (10, 10))
plt.pie(values, colors = colors, labels = labels, explode = explode)
plt.title('STOCK PORTFOLIO')
| true |
0db751a566ca53bd133371ad21511b8cd62ee130 | Python | prakash959946/basic_python | /Gateway_problems/08_postive_or_Negative.py | UTF-8 | 293 | 4.34375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Positive or Negative
"""
num = float(input("Enter any numeric value: "))
if (num < 0):
print('{0} is a Negative number'.format(num))
elif (num > 0):
print('{0} is a positive number'.format(num))
else:
print("You have entered Zero")
| true |
e641de2d4dbe041e8817d02291d2c6a861f2c76e | Python | biocore/microsetta-public-api | /microsetta_public_api/models/_taxonomy.py | UTF-8 | 18,829 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | from collections import namedtuple, OrderedDict, Counter
from typing import Iterable, Dict, Optional, List
from abc import abstractmethod
import skbio
import biom
import numpy as np
import pandas as pd
import scipy.sparse as ss
from bp import parse_newick
from microsetta_public_api.exceptions import (DisjointError, U... | true |
305aea8c305b2873300541d5ca05be04daa9ac17 | Python | Shailendre/simplilearn-python-training | /section1 - basic python/lesson6.4.py | UTF-8 | 615 | 3.828125 | 4 | [] | no_license | # exception handling
# equal to try and catch
# syntax similar to java try and catch
"""
try {}
catch ( <exception class1> e1 ) {}
catch ( <exceptiom class2> e2) {}
"""
'''
try:
print ("6" + 5)
except Exception as e:
# raise => java 'throw e'
# raise
print (str(e)) # str(excetion): => e.ge... | true |
eb285a36ffe1449a632f4cce1fba3cde05390755 | Python | barry800414/master_thesis | /errorAnalysis/ErrorAnalysis.py | UTF-8 | 10,770 | 2.859375 | 3 | [] | no_license |
import sys
import math
import pickle
from sklearn.naive_bayes import MultinomialNB
from sklearn.linear_model import LogisticRegression
from sklearn.svm import LinearSVC
from sklearn.metrics import confusion_matrix, accuracy_score
from misc import *
# print Coefficients in classifier
# clf: classifier
# volc: volc ->... | true |
e1dabbf959497c3f4cf0ced808b4d1c185a8c238 | Python | Toha-K-M/Basic-problems-vault | /Math Problems/OOP/Sorting objects according to attributes.py | UTF-8 | 308 | 3.375 | 3 | [] | no_license | class v:
def __init__(self,name,weight):
self.name = name
self.weight = weight
a = v('a',20)
b = v('b',10)
c = v('c',15)
li = [a,b,c]
sorted_list = sorted(li, key=lambda v:v.weight) # sorting object weight attribute nie
for i in sorted_list:
print(i.name, "=", i.weight) | true |
f8a4fdb9ea39bef76ec5fada1d1241b5d0aa23f5 | Python | aoyono/sicpy | /Chapter1/themes/sqrt_newton.py | UTF-8 | 2,977 | 3.484375 | 3 | [
"MIT"
] | permissive | from operator import add, lt, sub, truediv
from Chapter1.themes.compound_procedures import square
from Chapter1.themes.lisp_conditionals import lisp_abs
def sqrt_iter(guess, x):
"""/!\ RecursionError rqised when using lisp_if"""
if is_good_enough(guess, x):
return guess
return sqrt_iter(improve(g... | true |
20c31f946a65b3f44902adc1dc2a6226f0e5cf79 | Python | owenstudy/octopusforcastbtc | /ordermanage.py | UTF-8 | 3,055 | 2.765625 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
import time,traceback
import btc38.btc38client
import bterapi.bterclient
import wex.btcwexclient
'''统一订单的管理到一个文件中'''
class OrderManage:
#market, 支持这两个参数 bter, btc38
def __init__(self,market):
self.market=market
#初始化两个市场的接口模块
if market=='bter':
self... | true |
f8ac3946f092f0f85eb488ceb40c0a2dcec9fed8 | Python | crowdhackathon-agrifood/autoGrow | /BackEnd-AutoGrow/BackEnd/AutoGrowClient/TCP.py | UTF-8 | 2,644 | 2.578125 | 3 | [] | no_license | import time, socket, select
import Cmd, ClientProcess
Host = ""
Port = 8888
AliveSendEvery = 2 # Send alive every x seconds
LastAliveSent = -AliveSendEvery # Make sure it fires immediatelly
########################################################################
## Init Socket
SocketConnected = False
Socket = s... | true |
3aeb88dfe40281c34101d5b080df3bd33ab99f54 | Python | eirikhoe/advent-of-code | /2019/14/sol.py | UTF-8 | 4,470 | 3.3125 | 3 | [] | no_license | from pathlib import Path
import re
from math import ceil
import copy
data_folder = Path(__file__).parent.resolve()
file = data_folder / "input.txt"
find_ingredients = re.compile(r"(\d+ \w+)+")
class Ingredient:
def __init__(self, name, quantity):
self.name = name
self.quantity = int(quantity)
cl... | true |
4ead09ea8770c14dc9b9c6119514fd469f4b47d0 | Python | sparsh0008/EboxPython | /StudentDetails/Student.py | UTF-8 | 751 | 2.828125 | 3 | [] | no_license | class Student:
def __init__(self,__id,__username,__password,__name,__address,__city,__pincode,__contact_number,__email):
self.__id = __id
self.__username = __username
self.__password = __password
self.__name = __name
self.__address = __address
self.__city = __city
... | true |
0de5bf6cc4d6a6201f7cb8e5b74749cf4b3264b3 | Python | MATA62N/RascalC | /python/convert_xi_to_multipoles.py | UTF-8 | 1,869 | 3.125 | 3 | [] | no_license | ### Script to convert a measured 2PCF in xi(r,mu) format to Legendre multipoles, i.e. xi_ell(r).
### This computes all even multipoles up to a specified maximum ell, approximating the integral by a sum.
### The output form is a text file with the first column specifying the r-bin, the second giving xi_0(r), the third w... | true |
b0d5a3fe511e26d128e4ddc2bd97b05b27a4c565 | Python | duonghanbk/Python | /function/3. function can return something.py | UTF-8 | 107 | 2.75 | 3 | [] | no_license | def add(num1, num2):
print "Tong cua %d va %d la:" % (num1, num2)
return num1 + num2
print add(2,5)
| true |
ac06daadf58665b99082a98b6f8583e22f740880 | Python | techtronics/marble | /scrape/azlyrics_scrape.py | UTF-8 | 805 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
import string, urllib2, httplib
from bs4 import BeautifulSoup
from urlparse import urljoin
ROOT_URL = "http://www.azlyrics.com/"
index_urls = []
for letter in string.lowercase:
index_urls.append(urljoin(ROOT_URL, letter + ".html"))
index_urls.append(urljoin(ROOT_URL, "19.html"))
for inde... | true |
06fad78c8f4824646a24888a1d06461060726faf | Python | dupl10/dupl | /UnivRanking.py | UTF-8 | 436 | 2.65625 | 3 | [] | no_license | #!/usr/bin/python3
import requests, bs4
url="http://www.zuihaodaxue.cn/BCSR/huaxue2017.html"
res=requests.get(url)
res.encoding=res.apparent_encoding
soup=bs4.BeautifulSoup(res.text,'html.parser')
#print soup.tbody('tr')
s=''
for elem in soup.tbody('tr')[:-1]:
for i in elem.descendants:
if type(i) == bs4.e... | true |
113381cc355fe032eb4e9b323073858a1a613d0f | Python | zhenglinj/FangjiaViewer | /FangjiaScrapy/FangjiaScrapy/spiders/LianjiaBankuai.py | UTF-8 | 1,330 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from scrapy.http import Request
from ..items import Zone
class LianjiabankuaiSpider(scrapy.Spider):
name = 'LianjiaBankuai'
allowed_domains = ['lianjia.com']
root_url = "https://hz.lianjia.com"
start_urls = ['https://hz.lianjia.com/ershoufang/']
def parse(se... | true |
a8a6d084a784d3226d718d06f039234e377b20fe | Python | ttlmtang123/HttpInterfaceTesting | /lib/handleurl.py | UTF-8 | 10,121 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
## 时间: 2015-02-13
## 跟新内容:
## 增加URL请求时间计算
## 时间: 2015-04-01
## 跟新内容:
## 将指定的测试文件名写入配置文件中,同时增加一个获取当前路径的类
##
import urllib.request
import urllib.parse
import urllib.error
from pathlib import Path
import json
import io
import sys
import traceback
import os
import os.path
import time
import ... | true |
5cf15557b156455e545ca57a8716ba1bc6010b3c | Python | masheransari/Python-Practice_1 | /Task5/Data.py | UTF-8 | 395 | 3.71875 | 4 | [] | no_license | import random
class Data:
def __init__(self, data1, data2):
self.data1 = data1
self.data2 = data2
self.data1 = random.randint(0, 10)
def getdataFromUser(self):
self.data2 = int(input("Enter any number: "))
def showdata(self):
printData = "The value of data1 = " + ... | true |
616ea96b6cb6e1f64bf20f3b43e7d0532d6bdb9b | Python | Jinmin-Goh/BOJ_PS | /Solved/11284/11284.py | UTF-8 | 1,061 | 3.140625 | 3 | [] | no_license | # Problem No.: 11284
# Solver: Jinmin Goh
# Date: 20220811
# URL: https://www.acmicpc.net/problem/11284
import sys
def main():
s = input()
first_list = ['ㄱ', 'ㄲ', 'ㄴ', 'ㄷ', 'ㄸ', 'ㄹ', 'ㅁ', 'ㅂ', 'ㅃ', 'ㅅ', 'ㅆ', 'ㅇ', 'ㅈ', 'ㅉ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ']
middle_list = ['ㅏ', 'ㅐ', 'ㅑ', 'ㅒ', '... | true |
a46caa0c49d039319dae72c0778da6a9b7c48410 | Python | PacktPublishing/Python-Real-World-Machine-Learning | /Module 1/Chapter 6/bag_of_words.py | UTF-8 | 1,220 | 3.109375 | 3 | [
"MIT"
] | permissive | import numpy as np
from nltk.corpus import brown
from chunking import splitter
if __name__=='__main__':
# Read the data from the Brown corpus
data = ' '.join(brown.words()[:10000])
# Number of words in each chunk
num_words = 2000
chunks = []
counter = 0
text_chunks = splitter(data, num_... | true |
f60f140de6584795be839044bce0f79ec943a8e3 | Python | kieran-walker-0/iris | /iris.py | UTF-8 | 7,581 | 2.53125 | 3 | [] | no_license | # Internet Vulnerability Scanner and Reporting Tool
import shodan, datetime, nested_lookup
print("""
Welcome to IRIS! In order to use this program, you need a Shodan API key.
You can get one by signing up to the Shodan service here: https://account.shodan.io/register
""")
api_key = raw_input("Please input a v... | true |
02f00c0711e8b95dd8e6008d30b2a5bc89374b24 | Python | EunJooJung/Python | /Python01/com/test03/meter03_gugu.py | UTF-8 | 755 | 4.03125 | 4 | [] | no_license | #-*- coding:utf-8 -*-
# 1. for문을 사용하여 구구단 전체를 출력하는 gugu()함수를 만들자.
# 2. while문을 사용하여 입력된 숫자의 단만을 출력하는 gugudan(x)를 만들자.
# 3. main 만들어서 위의 두 함수를 호출하자.
def gugu():
for i in range(2,10):
for j in range(2,10):
print('%d * %d =' %(i, j) ,i*j)
def gugudan():
x = input('x 입력 :')
for... | true |
3a3921f4abeb7a2f6c432f8be59346fd5c0a514e | Python | avivorly/Encrypt | /build/lib/Encrypt_Lab/Sim.py | UTF-8 | 12,763 | 2.78125 | 3 | [] | no_license | # import from evey possible location
try:
from Encrypt_Lab.Input import Input
except:
from Input import Input
from PyQt5.QtWidgets import QPushButton
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QLabel, QVBoxLayout, QGridLayout, QWidget, QScrollArea
import numpy as np
# text labels
md5 = {
'top ... | true |
ae0a636a424ef083b2ec91281bafe39069e1f600 | Python | vyadzmak/Cent.Api | /models/app_models/dynamic_table_models/dynamic_table_model.py | UTF-8 | 453 | 3.203125 | 3 | [] | no_license | class DynamicTableHeader():
def __init__(self,text,align,value):
self.text =text
self.align = align
self.value = value
pass
class DynamicTable():
def __init__(self):
self.headers =[]
self.items =[]
pass
def init_header_element(self, text,align,value... | true |
ebce387e9c8bcfe2285f309991719870a80b7900 | Python | Mhmdbakhtiari/rivals-workshop-assistant | /tests/test_sprite_generation.py | UTF-8 | 4,477 | 2.578125 | 3 | [
"MIT"
] | permissive | import pytest
from PIL import Image, ImageDraw
import rivals_workshop_assistant.asset_handling.sprite_generation as src
from tests.testing_helpers import make_canvas, assert_images_equal
def show_delta(img1, img2):
diff = Image.new("RGB", img1.size, (255, 255, 255))
for x1 in range(img1.size[0]):
for... | true |
59776ba3e2cc86d0d0e3ec9f3996513be7d642ca | Python | L4SS3h/SenseHatDemo | /writetext.py | UTF-8 | 179 | 2.8125 | 3 | [] | no_license | from sense_hat import SenseHat
import time
s = SenseHat()
red = (255, 0, 0)
green = (0, 255, 0)
blue = (0, 0, 255)
while True:
s.show_message("Hello World!", text_colour=red)
| true |
6011fdd1099311a731b5bffe909f0d6981e86d8a | Python | bssrdf/pyleet | /S/SolvingQuestionsWithBrainpower.py | UTF-8 | 2,260 | 4 | 4 | [] | no_license | '''
-Medium-
*DP*
You are given a 0-indexed 2D integer array questions where questions[i] = [pointsi, brainpoweri].
The array describes the questions of an exam, where you have to process the questions in order (i.e., starting from question 0) and make a decision whether to solve or skip each question. Solving qu... | true |
245baad54f8589635bdcfe7863fe8b9ab1a1abc2 | Python | bgoonz/UsefulResourceRepo2.0 | /MY_REPOS/DATA_STRUC_PYTHON_NOTES/WEEKS/wk17/CodeSignal-Solutions/08_-_matrixElementsSum.py | UTF-8 | 334 | 3.296875 | 3 | [
"MIT",
"Python-2.0"
] | permissive | def matrixElementsSum(matrix):
if len(matrix) > 1:
for row in range(1, len(matrix)):
for room in range(len(matrix[row])):
if matrix[row - 1][room] == 0:
matrix[row][room] = 0
sum = 0
for row in matrix:
for room in row:
sum += room
... | true |
1263fd998edd5de272f1c70bf76901f31733fb47 | Python | MTGTsunami/LeetPython | /src/leetcode/binary_search/300. Longest Increasing Subsequence.py | UTF-8 | 755 | 3.78125 | 4 | [] | no_license | """
Given an unsorted array of integers, find the length of longest increasing subsequence.
Example:
Input: [10,9,2,5,3,7,101,18]
Output: 4
Explanation: The longest increasing subsequence is [2,3,7,101], therefore the length is 4.
Note:
There may be more than one LIS combination, it is only necessary for you to retu... | true |
40ee05b90727726c7faf937f50d15fddec59b78d | Python | BetaS/gotham-v2 | /util/crypt_util.py | UTF-8 | 1,200 | 2.734375 | 3 | [] | no_license | #encoding: utf-8
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
from Crypto.Hash import SHA512
from Crypto import Random
import os
def generateKey():
random_generator = Random.new().read
privatekey = RSA.generate(1024, random_generator)
publickey = privatekey.publickey()
f ... | true |
34a87259677e427e749bf86ec53dc7c96f2a63d5 | Python | aoeuidht/homework | /leetcode/297.serialize_and_deserialize_binary_tree.py | UTF-8 | 1,773 | 3.375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from oj_helper import *
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string.
:type root: TreeNode
:rtype: str
"""
if not root:
return ''
cands = [root]
node_list... | true |