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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
40ba500165d51f5a4a42bd3211868cf89e57d901 | Python | voyagerdva/EXERCISES_PYTHON | /EXERCISES_STRINGS_101/Exercise_7_Replace_POOR_and_NOT_to_GOOD/test.py | UTF-8 | 226 | 2.859375 | 3 | [] | no_license | import pytest
import calculate
def test_Calculate():
original_string = 'The lyrics is not that poor!'
result = calculate.replaceToGOOD1(original_string)
ethalon = "The lyrics is GOOD!"
assert result == ethalon | true |
cd830317ee726ec9814d0bcb8077f0a82400ef37 | Python | patrickbald/hadoop-map-reduce | /inlinksMap.py | UTF-8 | 261 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
import io
def main():
stream = io.TextIOWrapper(sys.stdin.buffer, encoding = 'iso-8859-1')
for line in stream:
host, link = line.split()[0], line.split()[1]
print(f"{link} {host}")
if __name__ == '__main__':
main()
| true |
a37768e480496bd969d3fad9002ffc8de3d91843 | Python | jonggyup/Grouping-Applications-Using-Geometrical-Information-of-Applications-on-Tabletop-Systems | /tracefiles/user_4_backup/exp1/test.py | UTF-8 | 3,165 | 3.03125 | 3 | [] | no_license | from __future__ import division
import collections
import random
import numpy as np
from sklearn import svm
from sklearn.metrics import f1_score
def number_of_chars(s):
return len(s)
def unique_chars(s):
s2 = ''.join(set(s))
return len(s2)
def weighted_unique_chars(s):
return unique_chars(s)/number_... | true |
65dacd67441098caca7de997f0329d70633ced6f | Python | AlexVlasev/AlexVlasev.github.io | /build.py | UTF-8 | 3,917 | 2.625 | 3 | [] | no_license | import json
def element(head, attributes, content=""):
config = " ".join(f'{key}="{value}"' for key, value in attributes.items() if key != "head")
return f'<{head} {config}>{content}</{head}>'
sr_only = element("span", {"class": "sr-only"}, "(current)")
dropdown_config = {
"class": "nav-link dro... | true |
b942fe891463983c9fc05f85b4d00cd77bb489e4 | Python | anand-sonawane/30DaysOfCode-Hackerrank | /Python/9:Recursion.py | UTF-8 | 163 | 3.25 | 3 | [] | no_license | N=int(input())
def factorial(fact_n):
if(fact_n==1):
return 1
else:
return fact_n * factorial(fact_n-1)
ans = factorial(N)
print(ans)
| true |
08743e0bd8e5b16a42d4ee965cc1c84f29f8a06e | Python | ricardopineda93/Playing-with-API-Calls | /python_repos.py | UTF-8 | 3,806 | 3.578125 | 4 | [] | no_license | import requests
import pygal
from pygal.style import LightColorizedStyle as LCS, LightenStyle as LS
# Making an API call and storing the responses
url = 'https://api.github.com/search/repositories?q=language=python&sort=stars'
r = requests.get(url)
print('Status Code: ', r.status_code) #status_code letsus know if the ... | true |
68fae6dbf3b6d6ab646d865e257a581fe84fe729 | Python | rudyard2021/math-calculator | /main.py | UTF-8 | 300 | 2.625 | 3 | [] | no_license | from source.function import Function
if __name__ == "__main__":
function = Function()
err = function.start("raiz(25;-4+2*(-5+8))+summa(x;x;1;5)")
if err is not None:
print("Incompleto => {}".format(err))
else:
value = function.f()
print("{}".format(value))
| true |
8fbb2541eeba6d6cce2b8737279eb1bb7d02c8b3 | Python | julienbgr/email_utilize | /email_utilize.py | UTF-8 | 1,983 | 2.625 | 3 | [] | no_license | import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import email.mime.application
import pandas as pd
import time
class Empfänger:
def __init__(self, Nachname, Vorname, Email, Anrede):
self.nachname = Nachname
self.vorname = Vorname
self.email ... | true |
f2d3c2522343c3edae324fd68fec6bbb4dfdf0e7 | Python | mdietterle/aulas | /listas/listas1.py | UTF-8 | 315 | 3.5625 | 4 | [
"Apache-2.0"
] | permissive | lista=["pão","leite","queijo", "café","presunto"]
print(lista)
for compras in range(0,len(lista)):
print(lista[compras])
item = input("Digite o item que você esqueceu de colocar na lista: ")
lista.append(item)
print(lista)
print("----------------------------")
for compras in lista:
print(compras)
| true |
3d8101c01b57f28430864f3000785250364b0a57 | Python | truongquang1993/truongvanquang-Fundamentals-c4e26 | /LAB1/Homework/Exercise1.py | UTF-8 | 1,391 | 2.90625 | 3 | [] | no_license | from urllib.request import urlopen
from bs4 import BeautifulSoup
from collections import OrderedDict
import pyexcel
from youtube_dl import YoutubeDL
## part 1:
# 1. Tạo một kết nôi Create conection
url = "https://www.apple.com/itunes/charts/songs/"
conn = urlopen(url)
# 2. Download page
raw_data = conn.read()
page_c... | true |
49ac1a64c03b0c35efeb59f31834032818ff6fdb | Python | CodeChangeTheWorld/bigdata | /Kafka/data-producer.py | UTF-8 | 2,974 | 2.71875 | 3 | [] | no_license | from googlefinance import getQuotes
from kafka import KafkaProducer
from kafka.errors import KafkaTimeoutError
import argparse #used to parse argument
import atexit #clean up when exit
import datetime
import logging
import json
import random
import schedule
import time
# - default kafka topic to write to
topic_name ... | true |
3991a9f17aad98681ba9d4a6ebcbb710807fc3d9 | Python | julianosk/ordenaacoes | /controllers/consts.py | UTF-8 | 5,168 | 2.8125 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: latin-1 -*-
"""
TODO:
- Reordenar sem reload - FEITO
- Refiltrar sem reload
- http://code.google.com/appengine/docs/python/config/cron.html - FEITO
- http://code.google.com/appengine/docs/python/backends/overview.html
- http://tablesorter.com/docs/example-ajax.html
"""
stockattrs = ['p... | true |
44e444bd1270327a904f571d77aeffb9b7d34c5e | Python | Aasthaengg/IBMdataset | /Python_codes/p03608/s731153919.py | UTF-8 | 824 | 2.953125 | 3 | [] | no_license |
from itertools import permutations
def submit():
n, m, _ = map(int, input().split())
rlist = list(map(int, input().split()))
rlist = [r - 1 for r in rlist]
# warshall floyd
dp = [[float('inf') for _ in range(n)] for _ in range(n)]
for i in range(n):
dp[i][i] = 0
for _ in range(m)... | true |
c5c56f984990d0a74b29930f0500404faa0c5250 | Python | ginseng27/robotSoccerDreadnoughts | /00/scripts/networking/client.py | UTF-8 | 793 | 3.046875 | 3 | [] | no_license | import socket
import sys
class Client:
def __init__(self,host,port):
self.host = host
self.port = port
self.size = 1024
self.open_socket()
def open_socket(self):
try:
self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.server.con... | true |
0d9dcb87073a15f54098f15582e0f4ae2d53af18 | Python | SharanyaMarathe/Advance-Python | /last_name_sort.py | UTF-8 | 528 | 3.328125 | 3 | [] | no_license | def match_name():
li=list()
lastname=list()
for line in file1:
if len(line.split()) > 2:
li.append(line.split()[2])
else:
li.append(line.split()[1])
li.sort()
for item in li:
print("{}---------->{}".format(item.sp... | true |
d2f3bf369a28a19b987c6b0b81dc95ee62a08679 | Python | 14-Mini/keyloggerforwindows | /keylogger.py | UTF-8 | 604 | 3 | 3 | [] | no_license | import datetime
from pynput.keyboard import Key, Listener
keys = []
def on_press(key):
global keys
keys.append(key)
date = datetime.datetime.now()
print(f"{date} {key} pressed.")
write_file(keys)
def write_file(keys):
date = datetime.datetime.now()
with open("keys.txt"... | true |
7b295f8bd2612abdf6a4b26daebf23fc1ad1df35 | Python | tretyakovr/Lesson-04 | /Task-04.py | UTF-8 | 910 | 3.6875 | 4 | [] | no_license | # Третьяков Роман Викторович
# Факультет Geek University Python-разработки. Основы языка Python
# Урок 4. Задание 4:
# Представлен список чисел. Определить элементы списка, не имеющие повторений. Сформировать
# итоговый массив чисел, соответствующих требованию. Элементы вывести в порядке их следования
# в исходном спис... | true |
e533a0b364986e4fd6348d4fb75167f430dcd704 | Python | bohdaholas/Lacalut | /create_new_poetry_db.py | UTF-8 | 557 | 2.546875 | 3 | [
"MIT"
] | permissive | import json
import re
import requests
poetry_page = "http://ukrlit.org/tvory/poeziia_poemy_virshi/virshi"
page = requests.get(f"{poetry_page}")
poem_name_link_pattern = re.compile(r'<li><a href="(\S+?)" title="\S+?">(.+?)</a>.+?</li>')
matches = re.findall(poem_name_link_pattern, requests.get(poetry_page).text)
poem... | true |
f6636525de76200875930b7344b42ddf95aa8422 | Python | isolde18/Class | /test_scores.py | UTF-8 | 331 | 3.375 | 3 | [] | no_license | #CTI
#20.02.2018
#Silvia
score1 = float (input ("Enter the first score "))
score2 = float ( input ("Enter the second score "))
score3 = float ( input ("Enter the third score "))
average_score= (score1 + score2 + score3)/3
print("The average of the three scores is " , average_score)
... | true |
3738330daaab0d66102ef998b5f62f27a0239a08 | Python | nrw505/adventofcode-2019 | /day18/part2.py | UTF-8 | 4,337 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
import math
import re
import operator
from collections import deque
from grid import Grid
infile = open(sys.argv[1])
grid = Grid()
starts = (None, None, None, None)
start = None
keys = {}
doors = {}
def adjacent(pos):
return [
x
for x in [
(pos[0] ... | true |
bd3f0ba50979561e3e16ccca054d2eee39937699 | Python | ryohare/threatsims-june-ctf-2020 | /networking/in_net.py | UTF-8 | 721 | 3.078125 | 3 | [] | no_license | import socket,struct
import ipaddress
def addressInNetwork(ip,net):
"Is an address in a network"
ipaddr = struct.unpack('L',socket.inet_aton(ip))[0]
netaddr,bits = net.split('/')
netmask = struct.unpack('L',socket.inet_aton(netaddr))[0] & ((2L<<int(bits)-1) - 1)
return ipaddr & netmask == netmask
with... | true |
7f45354a1912c74bef2996ce57df55556aee7922 | Python | bx-lr/android_static_dynamic_apk_test | /stats.py | UTF-8 | 2,718 | 2.515625 | 3 | [] | no_license | #!/usr/bin/python
import os
import sys
import sqlite3 as lite
def showformat(recs, sept = ('-' * 40)):
print len(recs), 'records'
print sept
for rec in recs:
maxkey = max(len(key) for key in recs)
for key in rec:
print '%-*s => %s' % (maxkey, key, rec[key])
print sept
def makedicts(cursor, query, params=(... | true |
41055df919ec471401a6deab0cc01efd1ae2adea | Python | DomChey/FoML | /AML_Project/preprocessing.py | UTF-8 | 3,844 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 17 12:52:25 2018
@author: Manuel
"""
import numpy as np
from skimage import io, color
import os
from tqdm import tqdm
from imgCrop import cutIntoPieces, createPieces
from accessory import Orientations
from compatibility import compatibility, slices
np.random.seed(100)
d... | true |
8132c0034b21abf5bd67c19ec8b72f5a8e372730 | Python | Aasthaengg/IBMdataset | /Python_codes/p03471/s217393978.py | UTF-8 | 271 | 3.296875 | 3 | [] | no_license | #ABC_085_C_Otoshidama.py
N,Y = list(map(int, input().split()))
x=-1
y=-1
z=-1
for a in range(N+1): #number of 10000yen
for b in range(N+1-a): #number of 5000yen
c=N-a-b #number of 1000yen
sum=10000*a + 5000*b + 1000*c
if sum == Y:
x=a
y=b
z=c
print(x,y,z) | true |
2846d7f1e2427ddc73c46290427876027f4671a5 | Python | Jiacli/NLP-QA | /code/siyu/ask.py | UTF-8 | 2,030 | 3.109375 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import os
import re
import string
import generateQuestion
# gloabl control variables
verbose = True
os.environ['STANFORD_PARSER'] = '/Users/sirrie/Desktop/11611/project/jars'
os.environ['STANFORD_MODELS'] = '/Users/sirrie/Desktop/11611/project/jars'
# main routine
def main(args):
... | true |
844c6eb7cb3295704307fe45dba56ffe8e777aed | Python | yoshd/LanguageProcessing100 | /LanguageProcessing100/chapter3/knock20.py | UTF-8 | 441 | 2.9375 | 3 | [] | no_license | import json
if __name__ == "__main__":
output_texts = []
with open("jawiki-country.json") as file:
line = file.readline()
while line:
wiki_json = json.loads(line)
if wiki_json["title"] == "イギリス":
output_texts.append(wiki_json["text"])
line ... | true |
415a953e7988f7607e245f952f1af24008db5cfc | Python | Cecilia520/algorithmic-learning-leetcode | /cecilia-python/tree-graph/graph/IsGraphBipartite.py | UTF-8 | 2,869 | 4.15625 | 4 | [] | no_license | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@File : IsGraphBipartite.py
@Contact : 70904372cecilia@gmail.com
@License : (C)Copyright 2019-2020
@Modify Time @Author @Version @Desciption
------------ ------- -------- -----------
2020/3/9 22:03 cecilia 1.0 是否是二分图
... | true |
2a5051564d2334ae425a70b1b79b2744ac708ad3 | Python | UMD-ENEE408I/ENEE408I_Spring_2021_Team_4 | /pose-recognition/svm_train.py | UTF-8 | 1,140 | 2.59375 | 3 | [] | no_license | import cv2
import argparse
import pickle
from sklearn.preprocessing import LabelEncoder
from sklearn import svm
ap = argparse.ArgumentParser()
ap.add_argument("-f", "--features", required=True,
help="path to serialized db of sample pose features")
ap.add_argument("-c", "--classifier", required=True,
help="path to ou... | true |
930dea042d5a37847c16e13b9a706522ea933b6b | Python | DigDug101/FontMatching | /CNNTrain.py | UTF-8 | 5,516 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 5 21:33:37 2019
@author: Sathya Bhat
"""
import numpy as np
from tensorflow.keras.applications import VGG16
import matplotlib.pyplot as plt
from tensorflow.keras.preprocessing import image
#import os, shutil
from tensorflow.keras.preprocessing.image impo... | true |
33a468d27415a7a28742e5b1a7fd6dbe067057a9 | Python | karthikg92/gnn-robust-image-classification | /baselines/GNN/img2graph.py | UTF-8 | 7,807 | 3.140625 | 3 | [] | no_license | import numpy as np
from scipy import sparse
###############################################################################
# From an image to a graph
def _make_edges(n_x, n_y):
"""
Returns a list of edges and edge weights for a 2D image.
Parameters
----------
n_x : int
... | true |
1aab6437150ef83551e8dd53bfad3b992d8798ec | Python | ramitdour/openCV_test | /opencvTest19.py | UTF-8 | 988 | 2.8125 | 3 | [] | no_license | #https://www.youtube.com/watch?v=aDY4aBLFOIg&list=PLS1QulWo1RIa7D1O6skqDQ-JZ1GGHKK-K&index=21
import cv2 as cv
import numpy as np
from matplotlib import pyplot as plt
#img = cv.imread('opencv-logo.png',-1)
img = cv.imread('data/sudoku.png',0)
#Laplacian Gradient
lap = cv.Laplacian(img , cv.CV_64F ,ksize = 3)
lap = ... | true |
4a5997eab530fe170fd54fe156ea2bc83759c9f8 | Python | aak-1/Journey-with-Python | /Loops.py | UTF-8 | 192 | 3.796875 | 4 | [] | no_license | if __name__ == '__main__':
n = int(input())
for i in range (n):
print(i**2)
"""
Read an integer . For all non-negative integers , print square. See the sample for details.
""" | true |
d69d177a74dcbb26846afe0588a29b4585750cfe | Python | 15013412747/test_my | /qietu.py | UTF-8 | 4,543 | 2.59375 | 3 | [] | no_license | import cv2
import math
import os
# noinspection PyUnresolvedReferences
import numpy as np
from PIL import Image
from pathlib import Path
Image.MAX_IMAGE_PIXELS = None
IMAGES_FORMAT = ['.png'] # 图片格式
# src = input('请输入图片文件路径:')
# print(src)
#
# #list = os.listdir(src)
# dstpath = input('请输入图片输出目录(不输入路径则表示使用源图片所在目录):'... | true |
3b194d22a127fe8e38959eac316ed15922260e57 | Python | Jarantym/portfolio | /randomPassw_1.1.py | UTF-8 | 557 | 3.5625 | 4 | [] | no_license | ## list of the randomly generated passwords
from random import randint
def main() :
for j in range(10): ## strings and characters mixing
for i in range(4) :
a= str(randomCharacter("bcdfghjk1mnpqrstvwxz"))
b= str(randomCharacter("aei0uy"))
print(a+b,end='')
... | true |
be4f0e4adcaf0b720a670728ed0f2a1b301a0f4d | Python | Zjhao666/CompQA | /src/kangqi/task/compQA/model/module/seq_helper.py | UTF-8 | 8,222 | 2.609375 | 3 | [] | no_license | """
Author: Kangqi Luo
Goal: Define the sequence-related operations.
"""
import tensorflow as tf
from kangqi.util.tf.cosine_sim import cosine_sim
from kangqi.util.tf.ntn import NeuralTensorNetwork
from kangqi.util.LogUtil import LogInfo
def get_merge_function(merge_config, dim_hidden, reuse):
"""
Judge whet... | true |
4f849e6dbb7b8a041d4fe3296651b8efccd2264f | Python | razzlepdx/practice-algorithms | /hackerrank/30_days_08.py | UTF-8 | 780 | 3.84375 | 4 | [] | no_license | # Enter your code here. Read input from STDIN. Print output to STDOUT
# create phone book dictionary with known number of inputs
num_entries = int(raw_input())
phone_book = {}
while num_entries:
name, number = raw_input().rstrip().split(" ")
phone_book[name] = number
num_entries -= 1
def get_phone_number... | true |
8f0fd8cf68057a4533a08a4922060bc717b1ab74 | Python | Jaime885/cti110 | /M2HW1_DistanceTraveled_JaimeRodriguezmiller.py | UTF-8 | 611 | 4.15625 | 4 | [] | no_license | #CTI-110
#M2HW1-Distance Traveled
#Jaime Rodriguezmiller
#September 9, 2017
#Value to the speed variable.
speed = 70
#Value to the time variable.
time1 = 6
time2 = 10
time3 = 15
#Get the distance traveled.
distanceAfter6 = speed * time1
distanceAfter10 = speed * time2
distanceAfter15 = speed * time3
... | true |
043be90767bc0510435f136994eaf69b3d38df1a | Python | bradyborkowski/LPTHW | /ex17.0.py | UTF-8 | 2,406 | 3.96875 | 4 | [] | no_license | # imports the argv module from the sys package
from sys import argv
# imports the exists module from the os.path package
from os.path import exists
# assigns variables to arguments passed to the script
script, from_file, to_file = argv
# prints an fstring
print(f"Copying from {from_file} to {to_file}")
# One line ver... | true |
8d854483b13e4a41d38f1553a4a843e9d12dc264 | Python | igrekus/adf3114 | /domain.py | UTF-8 | 2,160 | 2.515625 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
import serial
from time import sleep
from PyQt5.QtCore import QObject, pyqtSignal
from arduino.arduinospi import ArduinoSpi
from arduino.arduinospimock import ArduinoSpiMock
mock_enabled = False
class Domain(QObject):
def __init__(self, parent=None):
super().__init__(parent)
... | true |
dc01146e0c737d86166a0c8055cd1afbf626b888 | Python | scan3ls/holbertonschool-higher_level_programming | /0x04-python-more_data_structures/8-simple_delete.py | UTF-8 | 130 | 2.84375 | 3 | [] | no_license | #!/usr/bin/python3
def simple_delete(a_dictionary, key=""):
d = a_dictionary
if key in d:
del d[key]
return d
| true |
094369778867f3536fb99a2aa70bf842ce47fe75 | Python | caobaoli/python-primer | /example/primer_5_exception.py | UTF-8 | 1,168 | 3.4375 | 3 | [] | no_license | # 5.1 异常处理概述
# 5.2 异常处理格式
'''
try:
程序
except Exception as 异常名称:
异常处理部分
'''
# URLError与HTTPError
'''
两者都是异常处理的类, HTTPError是URLError的子类,HTTPError有异常状态码与异常原因,URLError没有异常状态码,所以
在处理时,不能使用URLError代替HTTPError。如果要代替,必须要判断是否有状态码属性
'''
# try:
# for i in range(0, 9):
# if(i == 4):
# ... | true |
3b7d081b46c577a46137db47354745d6748da490 | Python | il-giza/Pilgrim | /PilgrimTask/PilgrimCross.py | UTF-8 | 6,643 | 3.71875 | 4 | [] | no_license | class PilgrimCross():
"""Класс Перекресток.
Будем двигаться по перекресткам.
Переменные класса отвечают за параметры города:
min_x, max_x = 1, 5 - Размер города с запада на восток
min_y, max_y = 1, 5 - Размер города с севера на юг
finish_cross = (5,5) - Конечная точ... | true |
5686009968a24bc9478e4510f517b1b43004bd1b | Python | AidanFray/Cryptopals_Crypto_Challenges | /Set2/Challenge16/Challenge16.py | UTF-8 | 2,048 | 3.21875 | 3 | [] | no_license | import sys ; sys.path += ['.', '../..']
from SharedCode import Function
import base64
# Random key and IV are created on every execution
key = Function.Encryption.AES.randomKeyBase64()
iv = Function.Encryption.AES.randomKeyBase64()
def encrypt(key, data):
return Function.Encryption.AES.CBC.Encrypt(iv, key, data)
... | true |
8f5c06b3e862cae78edfc5d98e5a12b730cc316c | Python | upple/BOJ | /src/10000/10826.py3.py | UTF-8 | 108 | 3.21875 | 3 | [
"MIT"
] | permissive | n=int(input())
a=0
b=1
if n==0:
b=0
for i in range(1, n):
tmp=b
b=a+b
a=tmp
print(b)
| true |
bc79ea060d1ab5800b31b5ea26906f362f798214 | Python | lyp741/RaspberryPi-Home | /project/ip.py | UTF-8 | 2,262 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys, os, urllib2, json
import re, urllib
import sys
import threading
import time
from static import Redis_conn as rds
reload(sys)
sys.setdefaultencoding('utf8')
class Get_public_ip:
def getip(self):
try:
myip = self.visit("http://1212.ip138.com/... | true |
ae74cf0ae91b484d98285791828dc30a4805af3e | Python | MattJDavidson/python-adventofcode | /tests/test_05.py | UTF-8 | 2,868 | 3.03125 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | import pytest
from advent.problem_05 import (forbidden_patterns,
has_letter_hop,
nice_string,
nicer_string,
num_vowels,
non_overlapping_pair,
... | true |
92971ec03453c9834228561799bd08ecf81c8525 | Python | ftn8205/python-course | /41-7.py | UTF-8 | 624 | 3.46875 | 3 | [] | no_license | """
同一個進程下多個線程數據是共享的
為什麼同一個進程下還會使用隊列??
因為隊列是 管道 + 鎖 組成
所以用隊列也是為了保證數據安全
"""
import queue
#1 隊列q 先進先出
# q = queue.Queue(3)
# q.put(1)
# q.get()
# q.get_nowait()
# q.get(timeout=3)
# q.full()
# q.empty()
#2 Last in first out queue
# q = queue.LifoQueue(3)
# q.put(1)
# q.put(2)
# q.put(3)
# print(q.get())
#3 優先... | true |
8433ee0517820eae41d5db0ed08b97396468e1e5 | Python | elimisteve/tent-python-xiaoping | /example_app.py | UTF-8 | 2,405 | 2.984375 | 3 | [
"MIT"
] | permissive | import datetime
import config
from xiaoping.tentapp import TentApp
from xiaoping.posts import AppPost, Post
###############################################################################
# About
###############################################################################
# This app lets you create a status pos... | true |
516c55f041ce412ddcb985ee03425d68e08698f1 | Python | aureldent/lumapps-sdk | /lumapps/helpers/community.py | UTF-8 | 7,714 | 2.734375 | 3 | [
"MIT"
] | permissive | import logging
from lumapps.helpers.exceptions import BadRequestException
from lumapps.helpers.user import User
class Community(object):
""" Lumapps community object
Args:
api: the ApiClient instance to use for requests
customer: the customer id of the community, used for autori... | true |
836a3ea6d3ae977fa588c098338c04679d064472 | Python | pybites/challenges | /52/henryy07/pomodoro.py | UTF-8 | 3,466 | 3.703125 | 4 | [] | no_license | """
Very simple pomodoro application, you can choose pomodoro duration, break length and how many times you want to repeat
process, to start application you need to install speech dispatcher, you can use command:
sudo apt install speech-dispatcher
Enjoy!
"""
import argparse
from datetime import datetime, timedelta
imp... | true |
1396c60c4bf671df7385eec5805cc13af519ee18 | Python | Hedgehogues/HoChiMinh | /hochiminh/dev/font_to_image.py | UTF-8 | 5,351 | 2.59375 | 3 | [] | no_license | import cv2
from PIL import Image, ImageDraw, ImageFont
import numpy as np
from copy import deepcopy
from os import listdir
from os.path import isfile, join
from multiprocessing import Process
from numpy.random import randint, choice
class DatasetGenerator:
def __init__(self, in_path, out_path):
self.fo... | true |
21da772b3c69837b1806520fada8b8978bd19b4f | Python | matbra/dist_comp | /python/faktor_packages/src/faktor/dsp/common/sound.py | UTF-8 | 513 | 2.828125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri May 18 22:47:01 2012
@author: Matti
"""
import pygame
import numpy
def sound(x, fs):
pygame.mixer.init(frequency=fs, size=-16, channels=1, buffer=4096)
sound = pygame.sndarray.make_sound(numpy.int16(x))
pygame.mixer.Sound(sound)
sound.play()
... | true |
33944487695e755cd398a04abe0a4f1f5f6a3235 | Python | aotong/auto_dict2 | /auto_dict/views.py | UTF-8 | 1,331 | 2.765625 | 3 | [] | no_license | from django.shortcuts import render
from urllib.request import urlopen
from .models import Word, Translation
def make_url(word):
url = "http://www.dictionaryapi.com/api/v1/references/collegiate/xml/"
url += word + "?key=e2595b47-f120-4361-8aa7-bb3a7eb3c5f6"
return url
def index(request):
if reques... | true |
cb9b256aac26a47abc81e20fd5e402f20746c4af | Python | Pixelus/Programming-Problems-From-Programming-Books | /Python-crash-course/Chapter8/cities.py | UTF-8 | 216 | 3.015625 | 3 | [] | no_license | def describe_city(name, country="Iceland"):
print(name.title() + " is in " + country.title() + ".")
describe_city("Paris", country="France")
describe_city("Reykjavik")
describe_city("London", country="England")
| true |
7f356da57a47efc300ba0f2161a8229a046fe9ca | Python | kirixh/ConsoleWars | /Creators/MineCreator.py | UTF-8 | 608 | 3.0625 | 3 | [] | no_license | from __future__ import annotations
from Buildings.Mine import Mine
from Creators.BuildingCreator import BuildingCreator
class MineCreator(BuildingCreator):
"""
Класс, создающий шахту и добавляющий ее на карту.
"""
def create(self, game_map, symb, *coords):
game_map.map[coords[0]][coords[1]] = ... | true |
cc7cab51d6ad322f5bc8c6a862a180921e367db6 | Python | jonodrew/matchex | /munkres_test.py | UTF-8 | 379 | 3.296875 | 3 | [
"MIT"
] | permissive | from munkres import Munkres, print_matrix
matrix = [[5, 9, 1],
[10, 3, 2],
[8, 7, 4]]
m = Munkres()
indexes = m.compute(matrix)
print_matrix(matrix, msg='Lowest cost through this matrix:')
total = 0
for row, column in indexes:
value = matrix[row][column]
total += value
print '(%d, %d) ->... | true |
a01f42b9ee61ab089a6b5b7d85167ce37f656804 | Python | samsun076/100-days-of-Python | /scripts/16-18-List-comp_and-generators/01-listcom-gen.py | UTF-8 | 2,612 | 3.984375 | 4 | [] | no_license |
# examples from list comp's and generators
# https://github.com/talkpython/100daysofcode-with-python-course/blob/master/days/16-18-listcomprehensions-generators/list-comprehensions-generators.ipynb\\
from collections import Counter
import calendar
import itertools
import random
import re
import string
import reque... | true |
21872ca998933d3fa3c118467ea8470b076695a2 | Python | WolfAuto/NEA-Code | /Pro Maths/test_dates.py | UTF-8 | 12,183 | 3.125 | 3 | [] | no_license | import sqlite3 as sql # python modules used
import datetime as dt
import tkinter as tk
import pandas as pd
from tkinter import messagebox
from tkinter import ttk
with sql.connect("updatedfile.db", detect_types=sql.PARSE_DECLTYPES) as db: # connection made to db file with data type detection
cursor = db.curso... | true |
7da00e1b9c70960834d85f3fe43e859a3d0568d0 | Python | wenh81/OFDMSim | /GenerateBits.py | UTF-8 | 1,054 | 2.78125 | 3 | [] | no_license | """
@ OFDM仿真
@ 信号产生文件
@ DD
"""
import GlobalParameter
import numpy as np
# #
# @ func: def GetBitsNeed() -> int:
# @ 得到OFDM一个符号所拥有的比特数(信息量)
# @ para void
# @ return OFDMBitsNeed
# #
def getBitsNeed() -> int:
ofdmBitsNeed = GlobalParameter.OFDMCarrierCount * GlobalParameter.SymbolPerCarrier \
*... | true |
73ced682948dbd7de62a3e71f10f1e6fe5af87b5 | Python | Valdoos/freecodecamp | /Data Analysis with Python Projects/Mean-Variance-Standard Deviation Calculator/mean_var_std.py | UTF-8 | 654 | 3.234375 | 3 | [] | no_license | import numpy as np
def calculate(list):
if len(list) != 9:
raise ValueError("List must contain nine numbers.")
arr = np.array([list[0:3],list[3:6],list[6:9]])
mean = [[*arr.mean(0)],[*arr.mean(1)],arr.mean()]
variance = [[*arr.var(0)],[*arr.var(1)],arr.var()]
std = [[*arr.std(0)],[*arr.st... | true |
6c3458dc592043615c15f5f8174e87fbfaa670af | Python | AI-Inspire/Code-for-Workshops-Spring-2018-PL | /NLP Example 1.py | UTF-8 | 1,919 | 4.0625 | 4 | [] | no_license | from nltk.tokenize import sent_tokenize, word_tokenize
from nltk import pos_tag #importing necessary libraries which will be called in code to perform NLP tasks
from nltk.stem import PorterStemmer
from nltk.corpus import stopwords
#TASK 1
text = "Hi! How are you today? I am awesome! How about you?"
print(word_t... | true |
9ac59768d021ef5fa3e94b49e71bee134febcd55 | Python | hiroto-kazama/cs-362_week_09 | /fizzbuzz.py | UTF-8 | 345 | 3.859375 | 4 | [] | no_license | def fizzBuzz():
i = 1
s = ""
while i < 101:
if i%3 == 0 and i%5 == 0:
s += "FizzBuzz "
elif i%3 == 0:
s += "Fizz "
elif i%5 == 0:
s += "Buzz "
elif i%3 != 0 and i%5 != 0:
s += str(i)
s += " "
i += 1
retu... | true |
c73c4abf41d0a8a99cf8032dfe66c26cd04a7cb3 | Python | tskpcp/pythondome | /pandasDome/dropping_entries_from_an_axis.py | UTF-8 | 605 | 3.609375 | 4 | [] | no_license | import numpy as np
from pandas import Series,DataFrame
def droppingEntriesFromAnAxis():
print('Series根据索引删除元素')
obj=Series(np.arange(5),index=['a','b','c','d','e'])
new_obj=obj.drop('c')
print(obj)
print(new_obj)
print(obj.drop(['d','c']))
print('DataFrame删除元素,可指定索引或列')
data=DataFrame(np... | true |
e8c66bcc992450b61db549f9a53983781123b431 | Python | Yuehchang/Python-practice-files | /Machine_learning/data_preprocessing.py | UTF-8 | 8,383 | 3.5625 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 19 14:16:22 2017
@author: changyueh
"""
"""
Data Preprocessing page 100
"""
import pandas as pd
from io import StringIO
csv_data = '''A,B,C,D
1.0,2.0,3.0,4.0
5.0,6.0,,8.0
10.0,11.0,12.0,'''
df = pd.read_csv(StringIO(csv_data))
df.isnull().sum() #mi... | true |
150c1eafec1e1659846bd8304fa0899c2d6d501b | Python | MichaelKim0407/selfhacked-util | /selfhacked/common/sql/middlewares.py | UTF-8 | 1,554 | 2.5625 | 3 | [] | no_license | import logging
from django.db import connection
from selfhacked.util.func import timed
db_logger = logging.getLogger('django.db.debugging')
class SqlQueryCountMiddleWare(object):
class Cursor(object):
TIMED_METHOD = ['callproc', 'execute', 'executemany']
def __init__(self, cursor, queries: list... | true |
3419b31bea6abd76c31ce36715b13069a46ff8f5 | Python | rhyun9584/BOJ | /python/2493.py | UTF-8 | 362 | 2.71875 | 3 | [] | no_license | import sys
input = sys.stdin.readline
N = int(input())
tops = list(map(int, input().split()))
stack = []
result = []
for i in range(N):
while stack and stack[-1][0] < tops[i]:
stack.pop()
if stack == []:
result.append(0)
else:
result.append(stack[-1][1])
stack.append((tops[i]... | true |
7065cfd5026bc0384bd2a2f561b89c5581a4ca5a | Python | jaggerwang/jw-pylib | /pylib/form/validator.py | UTF-8 | 2,303 | 2.828125 | 3 | [
"MIT"
] | permissive | from wtforms import ValidationError
from wtforms.validators import Regexp
from ..string import display_width
def DisplayWidth(min_width=None, max_width=None, length_counter=display_width):
def _validate(form, field):
if field.data is None:
return
width = length_counter(field.data)
... | true |
16e20cc30ea7c62312db3a90ca2c3321beb89c42 | Python | Jerllina/NILM_TEST | /REDD_LoadClassification/LoadClassification_kNNTest.py | UTF-8 | 1,612 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 13 13:10:16 2019
@author: Jelina
"""
import pandas as pd
import matplotlib.pyplot as plt
#load data
load_information=pd.read_csv('REDD_demo_load_information.csv')
# manually specify column names
load_information.columns = ['0','P', 'Load']
load_informati... | true |
d9c2efe98f9de6465b078bac59684a2379e33f95 | Python | goodnewsj62/python-for-everyone-exercise | /Exercises/exercise_10.py | UTF-8 | 1,882 | 3.59375 | 4 | [] | no_license | # 1.
message_count = dict()
with open(r'./files/mbox-short.txt', 'rt') as file:
for line in file:
if line.startswith("From"):
line = line.strip().split()
if len(line) > 3:
message_count[line[1]] = message_count.get(line[1], 0) + 1
list_ = list()
for key,value in mess... | true |
0e22a8be5fecf4fa7b1989521c471ace8b53016c | Python | johnbukaixin/python-demo | /database1/Connect.py | UTF-8 | 654 | 2.6875 | 3 | [] | no_license | import pymysql
def con():
# 1. 创建数据库连接对象
con = pymysql.connect(host='localhost', port=3306,
database='hrs', charset='utf8',
user='root', password='123456')
return con
def con_by_param(host, port, user, password, database, charset):
if database is N... | true |
609ccd57cedf754fa7b57bbc544bd41728c8d70f | Python | DeanHe/Practice | /LeetCodePython/SplitArrayLargestSum.py | UTF-8 | 1,442 | 3.96875 | 4 | [] | no_license | """
Given an array nums which consists of non-negative integers and an integer m, you can split the array into m non-empty continuous subarrays.
Write an algorithm to minimize the largest sum among these m subarrays.
Example 1:
Input: nums = [7,2,5,10,8], m = 2
Output: 18
Explanation:
There are four ways to split ... | true |
d5830512c69a4acde1c60409d2479a981023e72d | Python | mhvis/pretix | /src/tests/base/test_urls.py | UTF-8 | 1,279 | 2.59375 | 3 | [
"Apache-2.0",
"BSD-3-Clause"
] | permissive | from importlib import import_module
from django.conf import settings
from django.test import TestCase
class URLTestCase(TestCase):
"""
This test case tests for a name string on all URLs. Unnamed
URLs will cause a TypeError in the metrics middleware.
"""
pattern_attrs = ['urlpatterns', 'url_patte... | true |
3bc69f4602b2ede5815c7eb0f49e6e9af4a1bdbc | Python | Jananicolodi/Python_ReactNative | /Python_Base/Python_Base/aula_6/trabalho_2.py | UTF-8 | 2,357 | 3.25 | 3 | [] | no_license | # 2. Depois de escolhido o site, realize 10 testes ou mais dentro desse site
# utilizando a linguagem Python juntamente com o Selenium e o Unittest. Os
# seguintes elementos web devem ser testados ao longo dos 10 testes,
# devendo-se utilizar xpath ao menos em 4 desses para busca dos elementos.
# ● Imagens: <img />
# ●... | true |
eb51203148b276dc6d5c28b7b4917f138432385c | Python | NurKevser/python-assignments | /count_letter.py | UTF-8 | 144 | 2.765625 | 3 | [] | no_license | def count_letter(sentence):
dicto = {}
for i in sentence:
dicto[i]=sentence.count(i)
return dicto
count_letter('hippo runs to us !')
| true |
ffb5bb1288c449646103f389303b4a33779caf92 | Python | husenzhang/reinvent_the_wheel | /fix_392_plates.py | UTF-8 | 922 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python
import csv
from collections import defaultdict
import sys
"""reverse rows labels on a 392 plate
each A to P. Pseudocodes"""
def process(rows):
labels, values = list(zip(*rows))
rev_labels = reversed(labels)
return list(zip(rev_labels, values))
if __name__ == '__main__':
filin ... | true |
fa1ca53e7e791c33bfa2d82ea0f9a4d163c7a1f3 | Python | ilyankou/gcb-visualizations | /ilyas experiments/mds/mds.py | UTF-8 | 992 | 2.703125 | 3 | [] | no_license | import csv
from numpy import genfromtxt
from collections import OrderedDict
from sklearn import manifold
from sklearn.metrics import euclidean_distances
# Choose columns to be used in PCA:
COLUMNS = OrderedDict([
('total', 4),
('given', 5),
('yellow', 6),
('purple', 7),
('orange', 8),
('blue', ... | true |
db49417e14db7d18cacbd1941e0576cdecb47e05 | Python | mlaizure/holbertonschool-higher_level_programming | /0x0C-python-almost_a_circle/models/rectangle.py | UTF-8 | 3,444 | 3.78125 | 4 | [] | no_license | #!/usr/bin/python3
"""Module with Rectangle class that inerits from Base class"""
from models.base import Base
class Rectangle(Base):
"""Private attributes width, height, x, and y, can calculate area,
stringify, update, dictionarify, and display itself"""
def __init__(self, width, height, x=0, y=0, id=Non... | true |
0c0cd9f443e21f8414cf635415cc576ddf141305 | Python | colci/python | /domashka7/domashka3.py | UTF-8 | 1,354 | 4.25 | 4 | [] | no_license | class Cell:
def __init__(self,cell):
self.cell = int(cell)
def __add__(self, other):
return self.cell + other.cell
def __sub__(self, other):
if (self.cell > other.cell):
return self.cell - other.cell
else:
return "Ошибка! Разность количества ячеек д... | true |
c676a6f61b9555b654fa40c6a372123d1aa13b55 | Python | mamemilk/acrc | /プログラミングコンテストチャレンジブック_秋葉,他/src/2-2-1_02_aoj__TLE__.py | UTF-8 | 842 | 2.984375 | 3 | [] | no_license | # https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_A&lang=jp
#
# 以下のように分割すると時間超過.
# 1 :
# 2 :
# 3 : 1 + 2, 3
# 4 : 1 + 3, 2 + 2, 4
# 5 : 1 + 4, 2 + 3, 5
# ....
#
#
# 二項に分けた時の初項はコインの最大値まででOKとしてもだめ.
val, m = map(int, input().split())
coins = list(map(int, input().split()))
max_coin = max(coins)
... | true |
d9cbf1961b6053d94c48bbb81ffbd906cdf039b4 | Python | mrzacarias/MoonBunny | /parse.py | UTF-8 | 2,530 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
keywords = ["MUSIC_FILE", "TITLE", "BPM", "DIFFICULTIES", "ARTIST"]
class InvalidKeyword(Exception):
pass
LEVEL_DIR = "./levels"
def level_list():
for f in os.listdir(LEVEL_DIR): f
level_list = [f for f in os.listdir(LEVEL_DIR) if os.path.isd... | true |
4d60b80a33ac63f458516210bf0c21e4a01c5c2d | Python | ultraman-agul/python_demos | /函数/w8_4.py | UTF-8 | 986 | 3.734375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# @Author : agul
# @Date : 2020/11/11 10:53
# Software : PyCharm
# version: Python 3.7
# @File : w8_4.py
# description :编写与字符串对象的find方法功能相似的函数find(srcString, substring, start, end),
# 作用是在srcString串的下标start到下标end之间的片段中寻找subString串的所有出现。
# 如果有多处出现,各下标位置用西文逗号','隔开。如果一次都没有出现,则输出"none... | true |
bc99a7599f485e168bce114e6d38776df5cd09b2 | Python | SalmaMeniawy/Dusty-phillips-Python3-OOP | /case_study_4/interface.py | UTF-8 | 2,076 | 3.375 | 3 | [] | no_license | import auth
class Editor:
def __init__(self):
self.username = None
self.menu_map = {
"login": self.login ,
"test":self.test ,
"change":self.change ,
"quite" : self.quite
}
def login(self):
logged_in = False
while not logg... | true |
12a5ca46deb0b0c16b8ede2fadda244e8a090898 | Python | labist/plottr | /test/scripts/h5py_concurrent_rw_swmr.py | UTF-8 | 3,216 | 2.984375 | 3 | [
"MIT"
] | permissive | """This is a test script for swmr data write/read.
While this complies with the HDF5 instructions, it causes issues on some Windows machines.
Also, it does seem to cause issues with network drives (this is documented by HDF5).
"""
from multiprocessing import Process
import time
from datetime import datetime
from pathl... | true |
cdf3502f342390e6cd084c0df66f6f7f10160ec4 | Python | AlexMeinke/certified-certain-uncertainty | /utils/adversarial.py | UTF-8 | 10,271 | 2.875 | 3 | [] | no_license | import torch
import torch.nn.functional as F
import torch.utils.data as data_utils
def gen_adv_noise(model, device, seed, epsilon=0.1, restarts=1, perturb=False,
steps=40, step_size=0.01, norm='inf'):
'''
Runs an adversarial noise attack in l_inf norm
Maximizes the confidence in... | true |
5b9745509d0e1bd0be426fd6b888201109d9ac97 | Python | JudgementH/scanner | /graphic/edge.py | UTF-8 | 1,800 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2020/10/14 13:11
'利用canny算法提取边缘'
__author__ = 'Judgement'
import cv2
from graphic import transform
def getOutline(img_src):
# 输入图像路径,返回透视后轮廓的图形数组
img = cv2.imread(img_src)
gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
# 去噪
blur = cv2.... | true |
5fbeb7cc4543d39a130d07a68a52acca08b4e45b | Python | tamuraryo0126/programing | /at/ABC/ABC_028_B.py | UTF-8 | 211 | 3.265625 | 3 | [] | no_license | in_string=input()
st_list=list(in_string)
st_dict={"A":0,"B":0,"C":0,"D":0,"E":0,"F":0}
for st in st_list:
st_dict[st]+=1
print(st_dict["A"],st_dict["B"],st_dict["C"],st_dict["D"],st_dict["E"],st_dict["F"]) | true |
5cb8d929e0d754bfca9a531dfedea219f3466270 | Python | visor517/GeekBrains_python | /lesson4/task2.py | UTF-8 | 369 | 3.9375 | 4 | [] | no_license | # 2. Представлен список чисел. Необходимо вывести элементы исходного списка, значения которых больше предыдущего элемента.
my_list = [300, 2, 12, 44, 1, 1, 4, 10, 7, 1, 78, 123, 55, 77]
print([my_list[i] for i in range(1,len(my_list)) if my_list[i] > my_list[i-1]]) | true |
21e36af89bade6c76c0366ac9f9399db9997bdba | Python | werble7/exercitando-python | /lucro_prejuizo.py | UTF-8 | 353 | 3.765625 | 4 | [] | no_license | valorcompra = float(input("Digite o valor de compra: "))
valorvenda = float(input("Digite o valor de venda: "))
balanco = valorvenda - valorcompra
if balanco > 0:
print("Você teve um lucro de ", balanco)
elif balanco < 0:
print("Você teve um prejuízo de ", balanco)
else:
print("Os valores são iguais... | true |
ba0fab4c26be1d0328a4b0aeba23a3bce807eb46 | Python | adsehgal/Verilog_Projects | /8x8_Led_Matrix_Cycler/case_create.py | UTF-8 | 1,221 | 2.59375 | 3 | [] | no_license | def one_hot(num, a):
if num == 0:
return "XXXXXXX" + str(a)
elif num == 1:
return "XXXXXX" + str(a) + "X"
elif num == 2:
return "XXXXX" + str(a) + "XX"
elif num == 3:
return "XXXX" + str(a) + "XXX"
elif num == 4:
return "XXX" + str(a) + "XXXX"
elif num == ... | true |
f8ecd993688ad451e4065381cd6a89e6c654d52b | Python | cody33231/learnpython | /py_lianxi/2-5-b.py | UTF-8 | 54 | 3.078125 | 3 | [] | no_license | for c in range(1,11):
print "loop c is %d" %(c)
| true |
871a389fd4a817fd600ff41bd39883977fd4b462 | Python | CMPUT466F16T08/otto_classify | /ensemble/get_probs.py | UTF-8 | 9,112 | 2.90625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import sklearn
import time
import csv
import cPickle as pickle
from math import log
#from sklearn.model_selection import cross_val_score
from sklearn.preprocessing import LabelEncoder
from sklearn.cross_validation import train_test_split
from sklearn.ensemble import RandomForestCl... | true |
adf65314f96d3d1d24be5ce507e7192710c1fa96 | Python | xstian/pyimageresearch | /Chapter 1/1.4/bitwise.py | UTF-8 | 799 | 3.890625 | 4 | [] | no_license | # NOTE: AND, OR, XOR, NOT
# cv2.bitwise_and()
# cv2.bitwise_or()
# cv2.bitwise_xor()
# cv2.bitwise_not()
import numpy as np
import cv2
# draw a rectangle
rectangle = np.zeros((300, 300), dtype='uint8')
cv2.rectangle(rectangle, (25, 25), (275, 275), 255, -1)
cv2.imshow('Rectangle', rectangle)
# draw circle
circle = n... | true |
af7a018393db3b7abc30cae2db6668a19de85bb3 | Python | thatch/arlib | /arlib/__init__.py | UTF-8 | 19,877 | 2.703125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import tarfile
import zipfile
import io
import os
import shutil
import collections
import bisect
import abc
import fnmatch
import sys
import decoutils
if sys.version_info[0] == 2: #pragma no cover
import __builtin__ as builtins
else: #pragma no cover
import builtins
__version__ =... | true |
bdf07ed01648c9ca3d60a2e99ed23be0e2b7c677 | Python | pwilso/Wire_Detector | /Wire_Detector_Refurbished.py | UTF-8 | 6,452 | 2.875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 31 17:34:00 2017
@author: Paige
"""
from scipy import ndimage
import matplotlib.pyplot as plt
import numpy as np
### Functions #################################################################
def filter_pic(picture, sigma, threshold, scale, tilt):
pic = ndimage.im... | true |
04bda87b7c83a8c8d1dc90832c6935557b19876d | Python | prem168/GUVI | /productofarrayexceptcurrentnumber.py | UTF-8 | 153 | 3.140625 | 3 | [] | no_license | x=int(input())
a=list(map(int,input().split()))
f=1
for i in range(0,x):
f=f*a[i]
for i in range(0,x-1):
print(f//a[i],end=" ")
print(f//a[x-1])
| true |
3092dfd52ba763841622d99ccb677cee50a61687 | Python | Aurelienpautrot/Webscraping_project | /scrapy/spider1.py | UTF-8 | 1,051 | 2.859375 | 3 | [] | no_license | import scrapy
from scrapy import Selector
from urllib import request
import pandas as pd
#choose the number of pages to scrape
nb_page = 101
#define the item link
class Link(scrapy.Item):
link = scrapy.Field()
class LinkListsSpider(scrapy.Spider):
name = 'spider1'
page_number = 2
start_urls = ['https... | true |
1ecd7634ad263228e8313142172f9aaa96a7406a | Python | kamyu104/LeetCode-Solutions | /Python/score-of-parentheses.py | UTF-8 | 789 | 3.65625 | 4 | [
"MIT"
] | permissive | # Time: O(n)
# Space: O(1)
class Solution(object):
def scoreOfParentheses(self, S):
"""
:type S: str
:rtype: int
"""
result, depth = 0, 0
for i in xrange(len(S)):
if S[i] == '(':
depth += 1
else:
depth -= 1
... | true |
298e1b65a59a44a8b33d5d51275e6fca041cd467 | Python | petrov-anna/flask_app_prak | /users.py | UTF-8 | 398 | 2.78125 | 3 | [] | no_license | from passw import enc_password
# работа с пользователем
class Users:
users = []
def get_users(self):
return self.users
def set_users(self, login, password, date=None):
self.users.append({'login': login, 'password': enc_password(password), 'registration date': date})
return list(f... | true |
5e519eced0ecafc616024ba968a4db8d7a7c4fb4 | Python | cdong5/Dog-Walking-Excerciser | /GUI.py | UTF-8 | 2,255 | 3.90625 | 4 | [] | no_license | # Created by Calvin Dong - 12/30/2018
# Learning tkinter and random Library
from random import *
from tkinter import *
def exercise():
# Reads a txt file named exercises
# Places each line of text into a list
# Uses the list to generate exercises
exerciselist = []
file = open('exercises.txt', 'r')... | true |
a1ddad55f653124b94d8cdf5728546f902419dbb | Python | n0tch/my_uri_problems | /URI_2160.py | UTF-8 | 201 | 3.640625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
'''
Escreva a sua solução aqui
Code your solution here
Escriba su solución aquí
'''
nome = input()
if len(nome) <= 80:
print("YES")
else:
print("NO") | true |