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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
faf2bb5a8ed3d6f757e198c5c965097d1db49351 | Python | IzumiHoshi/My-Python-Code | /firstApp/www/grab_html.py | UTF-8 | 2,865 | 2.53125 | 3 | [] | no_license | import urllib2 as myurl
from bs4 import BeautifulSoup as BS
from bs4 import Tag
import os
from download_img import get_file_size
def grab_bs(soup=Tag):
oo = int(soup.find(class_='tucao-like-container').span.string)
xx = int(soup.find(class_='tucao-unlike-container').span.string)
# print('oo [%d] xx [%d]' ... | true |
973531aee3867871b3fdde527005f82f2d794b6b | Python | Rafaelbarr/100DaysOfCodeChallenge | /day024/002_forest_drawing.py | UTF-8 | 1,992 | 3.5 | 4 | [] | no_license | # -*- coding: utf-8 -*-
import pygame
import math
def draw_tree(screen, size, BROWN, GREEN):
pygame.draw.rect(screen, BROWN, [60, 400, 30, 45])
pygame.draw.polygon(screen, GREEN, [[150, 400], [75, 250], [0, 400]])
pygame.draw.polygon(screen, GREEN, [[140, 350], [75, 230], [10, 350]])
def run(... | true |
97ed1dd50ad380e842bdda73a0d0a4921354ceb3 | Python | umangSharmacs/InterviewBit-Python-Solutions | /Arrays/Rotate Matrix.py | UTF-8 | 1,552 | 3.609375 | 4 | [] | no_license | #https://www.interviewbit.com/problems/rotate-matrix/
#Alternate Solution based on observation
#If you take the transpose of the original matrix and then swap the
#first column with the last, second with last second, and so on,
#you get the 90 degrees rotated matrix.
class Solution:
def getNewPosition(self,i,j,... | true |
9f27e5842a2f2033627c2ca9bcaeedc056f463f9 | Python | pricingassistant/pa_string_distance | /test.py | UTF-8 | 4,881 | 3.078125 | 3 | [
"BSD-2-Clause"
] | permissive | from pa_string_distance import pa_string_distance
import timeit
import pytest
def string_compare(s1, s2):
return {
"ratio": 1 - pa_string_distance(s1, s2)
}
def test_string_compare():
# Change this for performance tests
for _ in range(10000):
assert 1 == string_compare("boite de trucs", "b... | true |
bcc6e7c23731a1d0439c3e984e5cf48ff63cb826 | Python | pferreira101/WeatherConditionsForSports | /Project/Firebase/firestoreWM.py | UTF-8 | 1,901 | 2.546875 | 3 | [] | no_license | import sys
sys.path.append("../")
from Sensorization import config
import requests
import firebase_admin
from firebase_admin import auth, credentials, firestore
import pprint
from datetime import datetime
import pytz
pp = pprint.PrettyPrinter(indent=4)
cred = credentials.Certificate(config.firestore_key)
# Initial... | true |
90856c6a0c1acb2e14b16848495029fd44932f54 | Python | Ostitter-Anondo/220-Lab-Homework | /Lab05_20301474.py | UTF-8 | 3,783 | 3.15625 | 3 | [] | no_license | # ____ ____ _____ ____ ____ ___
# / ___/ ___|| ____|___ \|___ \ / _ \
# | | \___ \| _| __) | __) | | | |
# | |___ ___) | |___ / __/ / __/| |_| |
# \____|____/|_____|_____|_____|\___/
#
# _ _ ___ __ ___
# | | /_\ | _ )___ / \| __|
# | |__ / _ \| _... | true |
1ae7d6be519bff1eb4eaf63342b8e776e0ec7f9d | Python | pulkit97/ANPR | /ANPR.py | UTF-8 | 3,012 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 18 17:49:50 2018
@author: pulkit
"""
#Importing the required libraries
from skimage.io import imread
import matplotlib.pyplot as plt
import Preprocess as prep
import CCA_plate as ccp
import matplotlib.patches as patches
from skimage.filters import threshold_... | true |
187e832a47a282fdea5ec4301ea2eb2286538df9 | Python | mcxxtyhd/python-test-Opencv | /book/circle.py | UTF-8 | 713 | 2.625 | 3 | [] | no_license | import cv2
import numpy as np
planets = cv2.imread("cheese.jpg")
gray_img = cv2.cvtColor(planets, cv2.COLOR_BGR2GRAY)
img = cv2.medianBlur(gray_img, 5)
# ret, after_binary = cv2.threshold(img, 127, 255, cv2.THRESH_BINARY)
cv2.imshow("img", img)
circles = cv2.HoughCircles(img, cv2.HOUGH_GRADIENT, 1, 120, param1=100, ... | true |
bc11db07e69ca00736b2f93b3011c9581aa7264c | Python | ECMora/SoundLab | /duetto/audio_signals/Synthesizer.py | UTF-8 | 1,802 | 2.8125 | 3 | [] | no_license | import numpy as np
from duetto.audio_signals import AudioSignal
class Synthesizer:
"""
Class that provides several methods for the
signal creation process.
"""
@staticmethod
def insertWhiteNoise(audio_signal=None, duration=1000,indexFrom=0):
"""
Insertion of a w... | true |
78578baa4d922678d14799c1a7d07737378983d2 | Python | TeresaCoimbra/Algoritmos_Avancados_Bioinformatica | /procura_de_padroes/4_Trie.py | UTF-8 | 5,519 | 4.3125 | 4 | [] | no_license | #######################################################################################
# Trie
#
# Tries are n-ary trees where each symbol will be associated with an edge of the tree.
# Each pattern will correspond to a leaf in the the tree.
# Here the trie is a dictionary containing... | true |
76ef3f780a49cf6eea05962100d2cc900c9f3c14 | Python | tliu57/Leetcode | /Easy/IntersectionOfTwoArraysII/test.py | UTF-8 | 364 | 3.1875 | 3 | [] | no_license | class Solution(object):
def intersect(self, nums1, nums2):
nums1.sort()
nums2.sort()
map = {}
for num in nums1:
if num not in map:
map[num] = 1
else:
map[num] += 1
out = []
for num in nums2:
if num in map and map[num] > 0:
out.append(num)
map[num] -= 1
return out
sol = Solution(... | true |
0a4a696cd4bf37dc4dc0a8bfff3c5c8a4401c148 | Python | roytravel/Cybersecurity | /02. Crawler/signCert.py | UTF-8 | 4,863 | 2.703125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import requests
import zipfile
import re
import pymysql
import time
from multiprocessing import *
address = ""
certPath = "C:/#Data/ServerInfo.txt"
downPath = "C:/#Cert/"
def getHTML(url): # 동작 효율성을 위하여 웹 서버에 저장된 공인인증서 정보를 html을 파싱하여 텍스트로 저장
result = requests.get(url)
source = result... | true |
33a7e32b9f5d9086d5a28f960deb44d0119f19a1 | Python | mahdisesmaeelian/Python-Basic | /assignment-19/1.py | UTF-8 | 248 | 4.03125 | 4 | [] | no_license | list = [ 1, 2, 3, 4 ,3, 2, 1]
shomarande = 0
for i in range (3):
if list[i] == list[-1]:
shomarande += 1
list.pop()
if shomarande == 3:
print('This list is symmetrical')
else:
print("This list isn't symmetrical") | true |
2d8bb1ec2911a6466621f1fc2244e77bc82634fd | Python | MrGomi/SimpleFlask | /sql_tests/sqlb2.py | UTF-8 | 432 | 3.296875 | 3 | [] | no_license | # Create a SQLite3 database and table
# import the sqlite3 library
import sqlite3
# create a new database it the database doesn't aleady exist
with sqlite3.connect("new.db") as conn:
# get the cursor object used to execute SQL commands
c = conn.cursor()
# create a table
c.execute("INSERT INTO popula... | true |
e761f0a50179cc001e4f30e0d86ada209218dd9a | Python | LeandroTeodoroRJ/RaspberryPiExemplos | /RaspberryPi3GPIO/main.py | UTF-8 | 2,265 | 3.53125 | 4 | [
"MIT"
] | permissive | #*******************************************************************
# RASPBBERRRY PI 3 - GPIO
#*******************************************************************
# -*- coding: utf-8 -*-
'''
Exemplo para manipulação das portas GPIO do Raspberry Pi3.
OBS:
1) As portas possuem tensão de saída de 3,3V@5... | true |
49c24482a4b7ba94428fc1168b5d186a6c863c9b | Python | leandroliptak/venus-webservice | /transit.py | UTF-8 | 435 | 2.71875 | 3 | [] | no_license | class Transit:
def __init__(self, planet, sign):
self.planet = planet
self.sign = sign
def set_type(self, type):
self.type = type
def set_enter_sign(self, sign):
self.enter_sign = sign
def set_aspect(self, aspect, planet, sign):
self.aspect = aspect
self.second_planet = planet
self.second_sign = si... | true |
a8ae63f6f940ce14532d3b5aff4e8ab76c27fc35 | Python | gistable/gistable | /all-gists/1222752/snippet.py | UTF-8 | 3,086 | 3.1875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python -O
import numpy as np
from numpy import array
A, C, G, T = 0, 1, 2, 3
int_to_char = {0:'A', 1:'C', 2:'G', 3:'T'}
#indel = -1
#scoring = array([[1,-1,-1,-1],
#[-1,1,-1,-1],
#[-1,-1,1,-1],
#[-1,-1,-1,1]])
indel = -5
scoring = array([[2,-4,-1,-4],
... | true |
40815c5368e1ffb2b47f458b4f649224379e831e | Python | GiordanoLaminetti/BOBB3E_NLP | /robot.py | UTF-8 | 3,214 | 2.8125 | 3 | [
"MIT"
] | permissive | import time
import ev3dev.ev3 as ev3
# set the motor pin
motor_left = ev3.LargeMotor("outC")
motor_right = ev3.LargeMotor("outB")
motor_a = ev3.MediumMotor("outA")
ir = ev3.InfraredSensor()
def straight(**kwargs):
print('straight', kwargs)
if 'distance' in kwargs.keys():
# convert meter in position
... | true |
fc1c465a89a0677e3bd686f9bcf765f6840ad186 | Python | devcon14/timeseries-lab | /fft_filters.py | UTF-8 | 1,310 | 3.15625 | 3 | [] | no_license | # https://ipython-books.github.io/101-analyzing-the-frequency-components-of-a-signal-with-a-fast-fourier-transform/
import datetime
import numpy as np
import scipy as sp
import scipy.fftpack
import pandas as pd
import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_csv("DATASET.CSV")
temp = df.Close
date = d... | true |
132fbe1a3a8e4c576977386773b46edc42f9c053 | Python | andyyu/coding-problems | /coin_change.py | UTF-8 | 1,797 | 3.921875 | 4 | [] | no_license | # Andy Yu
'''
You are given coins of different denominations and a total amount of money amount.
Write a function to compute the fewest number of coins that you need to make up that amount.
If that amount of money cannot be made up by any combination of the coins, return -1.
Example 1:
coins = [1, 2, 5], amount = 11... | true |
fc13a5c3d7712ca4c11ad87598f2d146ab7ba31a | Python | mann-WOO/SWEA | /5178_노드의합/sol1.py | UTF-8 | 833 | 3.484375 | 3 | [] | no_license | import sys
sys.stdin = open("input.txt")
T = int(input())
# 노드의 합으로 부모 노드 정하는 함수
def make_tree(node):
# 노드 번호가 N 이상인 경우 0 반환
if node > N:
return 0
# 노드 값이 0이 아닌 경우 그 값을 반환
elif tree[node]:
return tree[node]
# 노드 값이 0인 경우 자식 노드들 더해서 그 값을 반환
else:
tree[node] = make_tree... | true |
a3d7a4ca3d3368e7e1e0899e58bd4f59b40e2880 | Python | Evets90/CHILL | /Manage_upl.py | UTF-8 | 2,875 | 3.0625 | 3 | [] | no_license | import pandas as pd
def remove_inter_sidechains(file):
"""Take a .upl file and returns a Pandas Dataframe in which only distances between a side chain
and something else in the same residue are maintained.
"""
# read DataFrame
dt = pd.read_csv(file, sep=' ', header=None, names=['1_resn', '1_rest', ... | true |
f17dae9ab059882b120db526499ea1dad60391bd | Python | aminatakabba/python_challenges | /sals-shiping.py | UTF-8 | 964 | 4.03125 | 4 | [] | no_license | def ground_shiping(weight):
base_price = 20.0
if weight <= 2:
return 1.25*weight + base_price
elif weight <= 6:
return 3*weight + base_price
elif weight <= 10:
return 4*weight + base_price
else:
return 4.75*weight + base_price
print(ground_shiping(8.4))
premium_shiping = 125.0
def drone_shi... | true |
bbcbbc95a631a5ff5307e0b8fb2fef8b89648269 | Python | StafaH/jamm-bandit | /hello/management/commands/populatearms.py | UTF-8 | 2,224 | 2.515625 | 3 | [
"MIT"
] | permissive | from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from hello.models import Arm, DuelRecord, Counter
from itertools import combinations
import glob
import os
class Command(BaseCommand):
help = 'Creates an arm for every image in /static/images/'
#def add_argument... | true |
6509d7159e6a2cbd7d8c0686a64c53fe36e21000 | Python | masonwolfe/snakifyfinal | /Snakify Problems/2/9 CLock Face.py | UTF-8 | 110 | 2.75 | 3 | [] | no_license | H = int(input())
M = int(input())
S = int(input())
T = ((60 * M)+(3600 * H) + S)
F = T / 43200
print(F * 360)
| true |
1df6576f783ead2823b2610d5e28f587680587ed | Python | Eudasio-Rodrigues/Linguagem-de-programacao | /Avaliação 02/questao 10.py | UTF-8 | 423 | 3.96875 | 4 | [] | no_license | #Escreva um programa que gere automaticamente uma lista com 100 inteiros e faça o que se pede a seguir:
#Uma lista com os números pares
#uma lista com os números múltiplos de 5
lista = [x for x in range(1,101)]
lista_pares =[]
for i in lista:
if i % 2 == 0:
lista_pares.append(i)
print(f"{lista_pares}\n")... | true |
cbaf14efdb8527eeb34876add54253801ed95ba2 | Python | mketiku/python-tutorials | /src/interview/60minutes.py | UTF-8 | 1,055 | 3.625 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env/python 3 # runs the file as a script
"""
This is a quick recap of my python sssssss
"""
__author__= "Michael Ketiku"
__project__ = ":FUN"
b = [1 , 2, 3 ,4 ]
a = [ 1,2,3 ]
b is a
' This is a string'
True or False
# evaluates to true
"{} can be {}".format("Strings", " Interpolated")... | true |
5eecc9ba80813463767c9335d3eb031bf28f0790 | Python | bendardenne/zombies | /random_agent.py | UTF-8 | 973 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python3
"""
Dummy random Zombies agent.
Author: Cyrille Dejemeppe <cyrille.dejemeppe@uclouvain.be>
Copyright (C) 2014, Université catholique de Louvain
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Softw... | true |
bc3f432cc3704a80b8e64fbba741635b03795572 | Python | eneskemalergin/Essential_Algorithms | /One_Dimensional_lists.py | UTF-8 | 2,053 | 4.28125 | 4 | [] | no_license | # One Dimensional Arrays(Lists in Python):
''' In Python there is no specific data structures called arrays '''
''' We are using lists instead of arrays '''
''' Finding Items in List '''
def IndexOf(list, target):
for i in range(len(list)):
if list[i] == target:
retur... | true |
67969e57fb705845f315fba7afd8c2d58d7af288 | Python | fywest/python | /global.py | UTF-8 | 139 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python3
def change():
global a
a=90
print(a)
a=9
print("before a= ",a)
change()
print("after change() a= ",a)
| true |
88ce038e19508cd00d338c3494c19432181a790a | Python | plops/compare_python_plotting | /default_qt.py | UTF-8 | 896 | 3.015625 | 3 | [] | no_license | """
https://www.qt.io/qt-for-python
pyside2 is official interface
sudo pacman -S pyside2
"""
from PySide2 import QtCore, QtWidgets, QtGui
import random
import sys
class MyWidget(QtWidgets.QWidget):
def __init__(self):
QtWidgets.QWidget.__init__(self)
self.hello = ['a', 'b', 'c']
self.bu... | true |
9b7690ca5506e98076ba2b43f6de473acedffd1d | Python | asaforen/AWSAutomationCourse | /4students/labs/solutions/12 Error Handling and Exceptions/Ex12.py | UTF-8 | 448 | 3.0625 | 3 | [] | no_license | import mytimer
#import mymodules.mytimer2 as mytimer
mytimer.start_timer()
lines = 0
for row in open ("words"):
lines += 1
mytimer.end_timer()
a=5
try:
if a>5:
mytimer.start_timer()
mytimer.end_timer()
print ("Number of lines:",lines)
except SystemError:
print("with error")
#mytimer.s... | true |
e87bb867e1c4ca8652a2fd050b4d40a3eac1fff5 | Python | gaobinlong/DigitRecognizer | /src/digitRecognizer2.py | UTF-8 | 2,204 | 2.984375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# use knn algorithm
from numpy import *
import operator
import sys
import csv
def loadTrainData():
l = []
with open('../data/train.csv') as file:
lines = csv.reader(file)
for line in lines:
l.append(line) # 42001*785
l.remove(l[0])
l = array(l)
... | true |
5cb63f3a03465a1d95603cc14018ee75a2c9bde7 | Python | fakharmakhtar/vd-python-training | /catalogue/models.py | UTF-8 | 635 | 2.546875 | 3 | [] | no_license | from django.db import models
class Product(models.Model):
name = models.CharField(max_length=255)
description = models.TextField(blank=True)
price = models.PositiveIntegerField()
category = models.ForeignKey('Category', on_delete=models.CASCADE, null=True)
def __str__(self):
return self.n... | true |
770437b86299f1b5784f4d73a1268e9383d27f9f | Python | kvanst3/Backend | /turtle_crossing/car.py | UTF-8 | 1,016 | 3.75 | 4 | [] | no_license | from turtle import Turtle
import random
COLORS = ['red', 'blue', 'green', 'orange', 'purple', 'pink', 'brown']
class Car():
def __init__(self):
super().__init__()
self.cars = []
self.generation_chance = 50
def create_car(self):
if random.randint(1, self.generation_chance) == ... | true |
d1edd04c08e443acf8784473f0499cf49b4b28cd | Python | rjovelin/miRNA_CNVs | /merge_miranda_outputfiles.py | UTF-8 | 1,483 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Oct 30 15:48:36 2015
@author: RJovelin
"""
# use this script to merge the miranda outputfiles from split job results
import os
import sys
# usage python3 merge_miranda_predictions.py species domain [3UTR/5UTR/CDS] outputfile
# run this script in directory with miranda ou... | true |
88a9e0a81a850d0a7050912c5e5b134ef6ce826f | Python | xc918/Machine_Learning_Project | /Code/data_cleaning/MapReduce/map_sit.py | UTF-8 | 466 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python
# This is the third part of the MapReduce process. We add features whether two judges
# in the circut has been sitting together before and their dissent rate according to
# their previous records.
import sys
for line in sys.stdin:
line = line.strip()
info = line.split(',')
if inf... | true |
38197b7c8fa00dc872337731ac927b221179ea9c | Python | afeyrer/Birthday-quiz | /birthday.py | UTF-8 | 2,056 | 4.75 | 5 | [
"MIT"
] | permissive | """
birthday.py
Author: Abby Feyrer
Credit: Emma
Assignment:
Your program will ask the user the following questions, in this order:
1. Their name.
2. The name of the month they were born in (e.g. "September").
3. The year they were born in (e.g. "1962").
4. The day they were born on (e.g. "11").
If the user's birthd... | true |
69e8657d1f55a309c79b7cc8eca73a84a1ae5893 | Python | sagarverma/IIITD_DevanagariRecognition | /codes/unsup_ocr/dqn_learn.py | UTF-8 | 10,839 | 2.765625 | 3 | [] | no_license | """
This file is copied/apdated from https://github.com/berkeleydeeprlcourse/homework/tree/master/hw3
"""
import sys
import pickle
import numpy as np
from collections import namedtuple
from itertools import count
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.autograd... | true |
b2773717a2f0136aaf333d0fb4c0cf72cc2c5fde | Python | oisindoherty3/dublin-building-stock | /dublin_building_stock/spatial_operations.py | UTF-8 | 580 | 2.796875 | 3 | [
"MIT"
] | permissive | import geopandas as gpd
def get_geometries_within(left, right):
left_representative_point = (
left.geometry.representative_point().rename("geometry").to_frame()
)
return (
gpd.sjoin(left_representative_point, right, op="within")
.drop(columns=["geometry", "index_right"])
.... | true |
1eccb89c21839695c2e7fceeac48858578fdcc38 | Python | dungdinhanh/gan_training | /complete/bayes_sampling.py | UTF-8 | 3,370 | 3.078125 | 3 | [] | no_license | import numpy as np
from scipy.stats import multivariate_normal as mvn
from complete.util import *
from matplotlib import pyplot as plt
from sklearn.mixture import BayesianGaussianMixture
class SingleGauss:
means_ = None
count = None
@staticmethod
def get_mean():
if SingleGauss.means_ is None:
... | true |
899c27be105cc517090ae66796fb1ddf1ac79da9 | Python | EverettSussman/LanguageEncoder | /tests.py | UTF-8 | 563 | 3.125 | 3 | [] | no_license | from utils import *
def cipher_tests():
assert(cipher(0, 'a') == 'a')
assert(cipher(0, 'A') == 'A')
assert(cipher(3, 'D') == 'G')
assert(cipher(10, 'e') == 'o')
assert(cipher(4, 'z') == 'd')
assert(cipher(3, 'Z') == 'C')
def encode_tests():
assert(encode('hi', key=1) == 'ij')
assert(en... | true |
8555d8c8c71929a051f54df8ba93162a13c2e2fb | Python | jasonrbriggs/python-for-kids | /ch5/if-statement-1.py | UTF-8 | 51 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | age = 13
if age > 20:
print('You are too old!') | true |
6ead61368549d32096e38f07e5493c8179d5c6ba | Python | SemmiDev/Python-Basic | /dasar/7-OperasiKomparasi.py | UTF-8 | 557 | 3.859375 | 4 | [] | no_license | # komparasi
x = 5
y = 10
besarDari = x > y
besarSamaDari = x >= y
kecilDari = x < y
kecilSamaDari = x <= y
samaDengan = x == y
tidakSamaDengan = x != y
print(besarDari)
print(besarSamaDari)
print(kecilDari)
print(kecilSamaDari)
print(samaDengan)
print(tidakSamaDengan)
# is sebagai komparasi object identity
a = 5... | true |
d860e230b8864e39dc37f8bbee527cec7572b7cc | Python | vikasbaghel1001/Hactoberfest2021_projects | /Sunrise and sunset time/main.py | UTF-8 | 505 | 2.65625 | 3 | [] | no_license | import requests
from datetime import datetime
MY_LAT = 16.7028412
MY_LOG = 74.2405329
parameters = {
'lat': MY_LAT,
'lng': MY_LOG,
'formatted': 0
}
response = requests.get('https://api.sunrise-sunset.org/json', params=parameters)
response.raise_for_status()
data = response.json()
sunrise = data['results... | true |
443dd60b1073ffa6fdde231d7be3d0b2501f0ad3 | Python | pmichele/Computational-Photography | /utils.py | UTF-8 | 7,531 | 2.515625 | 3 | [] | no_license | import numpy as np
import scipy.sparse as sp
from scipy.sparse import linalg
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import colorspacious as cs
def plot(img, rescale = False):
plt.figure(1)
if(rescale):
plt.imshow(rescale(img), cmap='Greys_r')
else:
plt.imshow(clip... | true |
b0aaa95ade4fc072468b5f0da7daf542dc399fd3 | Python | etasycandy/Python | /Workshop2/Project_page62_63/project_09_page63.py | UTF-8 | 773 | 4.4375 | 4 | [] | no_license | """
Author: Trần Đình Hoàng
Date: 12/07/2021
Program: project_09_page_63.py
Problem:
9. Write a program that takes as input a number of kilometers and prints the corresponding number of nautical miles.
Use the following approximations:
- A kilometer represents 1/10,000 of the distance betw... | true |
7dcb50759abf126c015ac79d2980ff94170c02c0 | Python | MaxShepovalov/pyproject | /astro/main.py | UTF-8 | 1,658 | 3.3125 | 3 | [] | no_license | #change NONE to None
class fuel_cell:
def __init__(self):
self.typename = "Fuel Cell"
self.maxval = 10
self.output = 1
self.value = 0
self.placed = False
def fill(self,nval):
self.value += nval
if self.value > self.maxval:
self.value = self.maxval
def use(self, nval):
if self.value > 0:
self.v... | true |
664148c5c3a1a09fb933c8c52ff3bc3905a81408 | Python | amerus/python_basic_11_05_20 | /homework/lesson8/prob6.py | UTF-8 | 4,476 | 3.75 | 4 | [] | no_license | '''
Продолжить работу над вторым заданием. Реализуйте механизм валидации вводимых пользователем данных. Например, для
указания количества принтеров, отправленных на склад, нельзя использовать строковый тип данных.
Подсказка: постарайтесь по возможности реализовать в проекте «Склад оргтехники» максимум возможностей, изу... | true |
8b81de1fadcfd9d436df06b5ef14661c64346f09 | Python | blaze0004/Geeks | /datastructures/Graph/DFS_BFS/find-k-cores-graph.py | UTF-8 | 1,807 | 3.5 | 4 | [] | no_license |
from collections import defaultdict
class Graph:
def __init__(self, vertices):
self.V = vertices
self.graph = defaultdict(list)
def addEdge(self, src, dest):
self.graph[src].append(dest)
self.graph[dest].append(src)
def DFSUtil(self, v, visited, vDegree, k):
vi... | true |
ed3e4800b1d9a754762b8b1cfeb900327ed97f4d | Python | Cat9Yuko/python- | /Python42函数默认参数.py | UTF-8 | 118 | 2.796875 | 3 | [] | no_license |
def hello(name='world'):
print 'hello ' +name
hello()
hello('pyhton')
def func(a,b=5):
print func
| true |
66bd03277165cff744b2c0f7d1c9013433e1e903 | Python | HSubbu/Patient_Survival | /mainpage.py | UTF-8 | 3,273 | 2.953125 | 3 | [] | no_license | # mainpage.py
import streamlit as st
import pandas as pd
import seaborn as sns
import joblib
import numpy as np
import cv2
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings('ignore')
st.set_option('deprecation.showPyplotGlobalUse', False)
def app():
#personalise home page
#display thayer... | true |
3e696d9ee9353cdd84f37c10c706986147d9a5b5 | Python | sepuckett86/personal1millionwomentotech | /week-02/cool_int.py | UTF-8 | 138 | 3.28125 | 3 | [] | no_license | def to_eng(int):
if int == 5:
english = 'five'
else:
english = 'fourty-two'
print(english)
return english
| true |
d7b6c1696b96ede064e666f2732f2c4ccbde3728 | Python | bodowd/Pover-T | /Scripts/CV_A.py | UTF-8 | 4,386 | 2.640625 | 3 | [] | no_license | import sys
sys.path.append("/Users/Bing/Documents/DS/DrivenData/Pover-T/Scripts/") # need to add path to the parent folder where CV.py is
import pandas as pd
import numpy as np
from PoverTCV import *
from PoverTHelperTools import *
from NewFeatFuncs import *
from sklearn.model_selection import train_test_split, Stra... | true |
e6369bc427528022d51645910685b10ba67a478d | Python | clarktemple03/distemper-outbreak | /model_designer.py | UTF-8 | 1,229 | 3.078125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import curve_fit
t = np.array(list(range(0, 24 * 5))) # in hours
def iterative_exp(xs, a, b):
start = 0
result = [start]
for x in range(1, len(xs)):
result.append(result[-1]*a+b)
return [result[0], result[59], result[119]]
... | true |
46209a4816b323b6679aa570f342bf3a1d1ecfba | Python | adamsdm/TNM095 | /main.py | UTF-8 | 4,155 | 2.8125 | 3 | [] | no_license | import pygame
from random import randint
from bot import Bot
from food import Food
from Snake import Snake
RIGHT = 0
UP = 1
LEFT = 2
DOWN = 3
pygame.init()
myfont = pygame.font.SysFont("monospace", 20)
WHITE = (255,255,255)
GRAY = (100,100,100)
BLACK = (0,0,0)
GREEN = (0,255,0)
# Size of one bodypart (i.e one gridpo... | true |
ee1a3a71779051ef8c016ba17e16663bffebfaed | Python | frasten/exagord | /src/MainWindow.py | UTF-8 | 3,801 | 2.6875 | 3 | [] | no_license | import pygtk
pygtk.require('2.0')
import gtk
from HarmonicTablePanel import HarmonicTablePanel
class MainWindow:
width, height = 900, 500
def delete_event(self, widget, event, data=None):
print "delete event occurred"
return False
def __init__(self):
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.wi... | true |
3a27578d705f6c7a35aef980f9c9021763b1b3c4 | Python | jamesfulford/web-samples | /Python/Flask/app.py | UTF-8 | 1,315 | 2.625 | 3 | [] | no_license | # app.py
import os
from flask import Flask
from flask import request
from flask import jsonify
from route import FileRoute
app = Flask(__name__)
app.url_map.strict_slashes = False
DIRECTORY = os.path.join(os.path.dirname(__file__), "data")
def form_data_response(data, **kwargs):
"""
Utility function for... | true |
48be8379a6cb90839a106d9b2dd3007036206d84 | Python | sachinthepro/assignment2 | /9-wordoccurence.py | UTF-8 | 1,670 | 4.5 | 4 | [] | no_license | """Write a program to find the word(s) that occur maximum and minimum number of times in the given paragraph. Also, display those words next to their respective count.
Input:
"Comprehensions are a feature of Python which I would really miss if I ever have to leave it. Comprehensions are constructs that allow sequences ... | true |
fc6144e762211a57b9578cda2eeadc3e01c52eb0 | Python | brintha001/python-programming | /Beginner level/string k.py | UTF-8 | 111 | 3.234375 | 3 | [] | no_license | def play_44():
s=input('Enter string :')
k=int(input('Enter k :'))
c=s[k:]
c+=s[:k]
print(c)
play_44()
| true |
a0dc770a01e0acd2335568bd245cd5afe8eb6e32 | Python | zhaoxiaochu/mkflask | /06_heimaflask.py | UTF-8 | 1,464 | 2.859375 | 3 | [] | no_license | # #-*coding:utf-8-*-
# from flask import Flask
# from flask import render_template
#
# app = Flask(__name__)
# @app.route("/")
# def index():
# return "index"
# @app.route("/demo1")
# def demo1():
# my_int=10
# my_str ="abc"
# my_list =[1,6,5,4,8]
# my_dict= {
# "name":"laowang" ,
# ... | true |
b7a78dd4cab563953b3a138e4920409b1f0d30d2 | Python | sidhu1012/Stenography | /steno.py | UTF-8 | 1,292 | 3.546875 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
def encode(text):
print()
global sten_dict
l=[]
for i in text:
l.append(sten_dict[i])
s=''.join(l)
print(s)
# In[2]:
def decode(text):
print()
global eng_dict
l=[]
for i in text:
l.append(eng_dict[i])
s=''.... | true |
5d350e9397466c2d48060c48bfc628b7d24d255d | Python | rohan86/Python | /MachineL.py | UTF-8 | 1,233 | 2.84375 | 3 | [] | no_license | import pandas as pd
import os
import sys, csv, glob
import uuid
import datetime
import matplotlib.pyplot as plt
# read data from the source file
df = pd.read_csv("/Users/shona/Downloads/2008_out.csv")
#df = df.convert_objects(convert_numeric=True)
# Adding UUID and Time stamp to the sample dataset
df['uuid'] = [uu... | true |
e41f0ed8418c3c42ac8648a89bac86d16cc03d7c | Python | rockrunner/my_code | /android/windows_uiauto.py | UTF-8 | 2,780 | 2.84375 | 3 | [] | no_license | import uiautomation, time, subprocess, os
from pykeyboard import PyKeyboard
class PyUIAuto():
def calc_test(self):
# 或者直接使用Python运行一个计算器
# 启动之前先运行一条命令强制关闭所有计算器
os.system("taskkill /f /IM Calculator.exe")
# os.system("start /b calc.exe")
subprocess.Popen("calc.exe")
... | true |
d3b72eb287b75f3f4773a4de3e61bf555564b5c5 | Python | taylerablake/kaggle_airbnb | /code_keras.py | UTF-8 | 9,106 | 2.75 | 3 | [
"BSD-3-Clause"
] | permissive | """
Airbnb New User Bookings Comptetition
https://www.kaggle.com/c/airbnb-recruiting-new-user-bookings
Author: Sandro Vega Pons (sv.pons@gmail.com)
Classifier based on Keras code.
"""
import numpy as np
import pickle
from sklearn.preprocessing import LabelBinarizer, StandardScaler
from sklearn.metrics import log_lo... | true |
519fbd6252af5be7e72e75854ad3cba6d6ff4285 | Python | schneiderfelipe/PyPortfolioOpt | /pypfopt/efficient_frontier/efficient_cdar.py | UTF-8 | 9,591 | 2.84375 | 3 | [
"MIT"
] | permissive | """
The ``efficient_cdar`` submodule houses the EfficientCDaR class, which
generates portfolios along the mean-CDaR (conditional drawdown-at-risk) frontier.
"""
import warnings
import cvxpy as cp
import numpy as np
from .. import objective_functions
from .efficient_frontier import EfficientFrontier
class Efficient... | true |
1f444da4a9dac98bbf1ac2c7bc62763886a62813 | Python | andreiGolovkin/pygame_tools | /Geometry/line_line_intersection.py | UTF-8 | 868 | 3.109375 | 3 | [] | no_license | from pygame_tools.Geometry.Point import Point
def get_intersection(p11: Point, p12: Point, p21: Point, p22: Point):
intersection = {"is_intersects": False, "would_intersects": False, "intersection_point": None}
x1 = p11.x
y1 = p11.y
x2 = p12.x
y2 = p12.y
x3 = p21.x
y3 = p21.y
x4 = p2... | true |
ec0c58c321369c1eee59d07639f30a0a4e64130d | Python | EMBL-EBI-TSI/WesCli | /test/GetTest.py | UTF-8 | 1,474 | 2.6875 | 3 | [] | no_license | # encoding: utf-8
import unittest
from WesCli.Get import newFormatLine
class GetTest(unittest.TestCase):
def setUp(self):
self.maxDiff = None # Diff is 709 characters long. Set self.maxDiff to None to see it.
def test_formatLine(self):
'''
ZE4HDH/ ... | true |
7106384b027363e0a07279b88a4fdaa6ff334add | Python | cd-chicago-june-cohort/python-fundamentals-john | /compare.py | UTF-8 | 201 | 3.921875 | 4 | [] | no_license |
def compare_lists(list_one, list_two):
if list_one == list_two:
print "The lists are the same"
else:
print "The lists are not the same"
compare_lists([1,2,5,6,2], [1,5,5,6,2]) | true |
a7272c6bf108b426677ab1ce981207b381f98a2f | Python | paskma/framework-parlib | /experiments/proj_ftpclient/command_client.py | UTF-8 | 3,511 | 2.546875 | 3 | [] | no_license | from parlib.console import Console
from ftpclient.client import Client
from ftpclient.statemachine import StateException
from parlib.netimpl.network import Network
#from test.netimpl.testnetwork import TestNetwork as Network
#from test.server import Server
class CommandClient:
def __init__(self):
#server = Server(... | true |
ab5f968fc01284aff414f90e1a0cb20f82f6bd4a | Python | Berntyy/brewPi | /PID_tuning.py | UTF-8 | 685 | 2.671875 | 3 | [] | no_license | ################
## PID TUNING ##
################
import MCP3008 # For reading the temperature
import RPi.GPI as GPIO
import pid
# Define the variables for the PID class in pid.py
float Ki
# Define the agressive and conservative Tuning parameters
float aggKp = 10, aggKi = 0.1, aggKd = 1
float consKp = ... | true |
eb32238e29c7160db2d1c07039126c47b2e6cfc4 | Python | yuyashiraki/Aizu | /traveling_salesman_problem/traveling_salesman_problem.py | UTF-8 | 655 | 2.515625 | 3 | [] | no_license | import sys
MAXINT = 15001
line = sys.stdin.readline().split(" ")
N = int(line[0])
M = int(line[1])
d = [[MAXINT for i in range(N)] for j in range(N)]
dp = [[-1 for i in range(N)] for j in range(1 << N)]
def rec(S, v):
if dp[S][v] >= 0:
return dp[S][v]
if (S == ((1 << N) - 1)) and (v == 0):
dp[... | true |
22310384105f2db5b84acd84bcc6a26829e2a76d | Python | nhadfieldmenell/ai_2048 | /search.py | UTF-8 | 3,421 | 2.703125 | 3 | [] | no_license | #run line profiler with kernprof -lv run2048.py
#to debug: python -i search.py
# pdb.pm when the error is thrown
import board2048 as b2048
from board2048 import Board
import numpy as np
from heapq import heappop as pop, heappush as push
import time
import pdb
import gc
#twoSpot is true if the node was created... | true |
4fea0fa5f93a341c97f211175edcf50ac67dc255 | Python | Zaccheaus90/holbertonschool-web_back_end-1 | /0x08-user_authentication_service/auth.py | UTF-8 | 4,661 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python3
"""
Encrypt a string
"""
import bcrypt
from db import DB
from user import Base, User
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.exc import InvalidRequestError
from uuid import uuid4
def _hash_password(password: str = '') -> str:
"""
Hashed the password
... | true |
efbbcac2670bc6123c909ee80cf2d67154fc372c | Python | ThilinaRajapakse/simpletransformers | /tests/test_language_representation.py | UTF-8 | 1,518 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | import pytest
from simpletransformers.language_representation import RepresentationModel
@pytest.mark.parametrize(
"model_type, model_name",
[
("bert", "bert-base-uncased"),
("roberta", "roberta-base"),
("gpt2", "distilgpt2"),
],
)
@pytest.mark.parametrize("combine_strategy", ["me... | true |
f774c562e51cdaca97b5247b1931a485f89852d3 | Python | pol9111/DouYin | /douyin/downloaders/music.py | UTF-8 | 553 | 2.65625 | 3 | [
"MIT"
] | permissive | from douyin.structures import Music
from douyin.handlers import Handler
from douyin.downloaders import Downloader
class MusicDownloader(Downloader):
async def process_item(self, obj):
"""使用异步开始下载音乐
process item
:param obj: single obj
:return:
"""
i... | true |
65ef9735d034c1ea0c97a249b8ab82812397b451 | Python | ChangxingJiang/LeetCode | /0501-0600/0594/0594_Python_1.py | UTF-8 | 561 | 3.265625 | 3 | [] | no_license | from typing import List
class Solution:
def findLHS(self, nums: List[int]) -> int:
hashmap = {}
for n in nums:
if n not in hashmap:
hashmap[n] = 1
else:
hashmap[n] += 1
maximum = 0
for k in hashmap:
if k - 1 in has... | true |
b90e7c4da9bfebd9492d3c2af87ab3abb74feb60 | Python | emma-metodieva/SoftUni_Python_Fundamentals_202009 | /08. TEXT PROCESSING/08-02-01. Valid Usernames.py | UTF-8 | 573 | 3.859375 | 4 | [] | no_license | # 08-02. TEXT PROCESSING [Exercise]
# 01. Valid Usernames
usernames = input().split(', ')
for username in usernames:
is_valid = True
if 3 <= len(username) <= 16:
if len(username) == len(username.strip()):
for char in username:
if char.isalpha() or char.isdigit() or char in ... | true |
a269454cd2e18be2fc658cd51b24a47474b6d35f | Python | obbijuan/python | /Funciones/funcion.py | UTF-8 | 173 | 3.578125 | 4 | [] | no_license | # Las funciones se definen antes de ser ejecutadas
def say_something():
print('Hi!')
def what_is_this(color):
print (color)
say_something()
what_is_this('blue!')
| true |
89d43b8fb27553a3d0c57ffb3d49d638f16efefd | Python | Raghumk/TestRepository | /OS_sys.py | UTF-8 | 687 | 3.296875 | 3 | [] | no_license |
#OS_sys
import os, sys
ret = os.access('OS_sys.py', os.F_OK)
print(ret)
ret = os.access('OS_sys.py', os.R_OK)
print(ret)
#functions
#os.access(path, mode)
#os.chflags(path, flags) -- Set the flags of path to the numeric flags
#os.chmod(path, mode) -- Change the mode of path to the numeric mo... | true |
65864041b54528f7c68a478a60fe9b93d244ad02 | Python | tabosama3/flask-sample | /template-example/main.py | UTF-8 | 643 | 2.578125 | 3 | [] | no_license | from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
message = '表示したいメッセージ文です'
message_list = ['メッセージ文 AAA', 'メッセージ文 BBB']
message_dict = {'name': '山田 一郎', 'message' : 'こんにちは'}
return render_template('main.html',
message=message, ... | true |
ded4a863a5266affc688625346b2dbf44b0ed477 | Python | SokIL69/Data_collection_and_processing_methods_2 | /Lesson_1/lesson_1_hw_2.py | UTF-8 | 4,295 | 3.09375 | 3 | [] | no_license | # Методы сбора и обработки данных из сети Интернет
# Соковнин Игорь Леонидович
#
# Урок 1. Основы клиент-серверного взаимодействия. Парсинг API
# Задание 2. Изучить список открытых API (https://www.programmableweb.com/category/all/apis).
# Найти среди них любое, требующее авторизацию (любого типа).
# Выполнить запросы... | true |
8cc62b3daefd748379c57d4e81591bd78a3ed2d6 | Python | amiva/p1_201611088 | /week7/w7main2.py | UTF-8 | 345 | 3.265625 | 3 | [] | no_license | import turtle
wn=turtle.Screen()
t1=turtle.Turtle()
tracks=list()
def drawSquareAtSave(size,pos):
t1.penup()
t1.goto(pos)
t1.pendown()
for i in range(0,4):
tracks.append(t1.pos())
t1.fd(50)
t1.right(90)
print tracks
def lab7():
drawSquareAtSave(100,(0,0))
def main():
lab7()
if __name__=="__main__":
ma... | true |
44d482356c87e868314540f44561d08ffc16756f | Python | yacmeno/roles-classification | /get_matches_infos.py | UTF-8 | 1,549 | 2.765625 | 3 | [] | no_license | #!/usr/bin/python3
"""
script to extract the relevant features from each player's match
"""
import requests
import json
import glob
import os
# opendota api
url = 'https://api.opendota.com/api/matches/' # will append match id
# files paths
supports_files = './support_matches/*.txt'
cores_files = './core_matches/*.tx... | true |
d5da3c462d06dde761568c75a8c632416a3142a1 | Python | tanayz/SGbot | /code/dialog_system/state_tracker.py | UTF-8 | 3,491 | 2.578125 | 3 | [
"MIT"
] | permissive | import numpy as np
import dialog_config
class state_tracker():
def __init__(self):
self.dialog_act = dialog_config.DIALOG_ACT
self.information_slot_names = dialog_config.INFORMATION_SLOTS
self.request_slot_names = dialog_config.REQUEST_SLOTS
self.initialize()
def initialize(... | true |
34947b60661c13c44cde81a00c69dcdf0807162a | Python | pysprings/beginner-talk-abc | /plugin/app.py | UTF-8 | 1,900 | 3.390625 | 3 | [
"Unlicense"
] | permissive | '''
Mock up of a plugin-based application that uses `ABC.register()`. Each plugin
is expected to have both `match()` and `operate()` methods.
This simulates an enviroment where you have plugins to perform different
operations on data (e.g. add, subtract, etc).
'''
from framework.plugin_base import PluginBase
... | true |
b96b1ccb1471d221e2f3e883318809c0bdc88699 | Python | ernestyalumni/HrdwCCppCUDA | /Voltron/Voltron/DataStructures/queue_as_stacks.py | UTF-8 | 1,016 | 4.0625 | 4 | [
"MIT"
] | permissive | """
@brief
"""
class QueueAsTwoStacks(object):
"""
@ref https://betterprogramming.pub/how-to-implement-a-queue-using-two-stacks-80772242b88c
"""
def __init__(self):
self._stack1 = []
self._stack2 = []
def enqueue(self, item):
"""
@details O(1) Time.
... | true |
f971ea83d93fa0bde1a821ab65a95c8c47377d43 | Python | WoxEd/CSV-Reader | /model/covid_model.py | UTF-8 | 5,147 | 3.296875 | 3 | [] | no_license | import csv
import sqlite3
"""Limits the number of data saved in db. If it's false it will save all in db if True it will only every 1000"""
only_partial_data = False
"""every_number_data, every n number elements will be added"""
every_number_data = 100
"""The name of the file containing the data"""
file_name =... | true |
a6edcb4ada0ac2ccd653237a760f1ef77c4f2e4c | Python | kopals123/codekata | /p14.py | UTF-8 | 132 | 3.21875 | 3 | [] | no_license | n=int(input())
z=input()
b=['a', 'e', 'i','o','u']
c=[]
for i in z:
if(i not in b):
c.append(i)
print("".join(c[::-1]))
| true |
d370d3261ab46f62f9799f27b085bf9f17f9b948 | Python | borisnorm/codeChallenge | /practiceSet/redditList/general/general.py | UTF-8 | 687 | 3.21875 | 3 | [] | no_license | #Find most frequent integer in an array
from collections import defaultdict
def freq(array):
max = 0
#Make sure that this is zero
freqDict = defaultdict(0)
for i in range(len(array)):
freqDict[array[i]] += 1
for key in freqDict.keys():
if freqDict[keys] > max:
max = freqDict[keys]
return max
... | true |
3429a98b0795ee9c7f3665a4b2aa893e2e40d26b | Python | FortsAndMills/Lego-Reinforcement-Learning | /LegoRL/samplers/rolloutCollector.py | UTF-8 | 1,183 | 2.96875 | 3 | [] | no_license | from LegoRL.core.RLmodule import RLmodule
from LegoRL.buffers.storage import Storage
class RolloutCollector(RLmodule):
"""
Collects rollouts of given length from runner.
Based on: https://arxiv.org/abs/1312.5602
Args:
rollout_length - length of rollout to collect on each iteration... | true |
a38429bb5649e790adc7da5094c9111e0bb86ef0 | Python | kaci65/Nichola_Lacey_Python_By_Example_BOOK | /The_Basics/div.py | UTF-8 | 269 | 4.21875 | 4 | [] | no_license | #!/usr/bin/python3
"""How many times a number goes into another number"""
num1 = int(input("Please enter a number above 100: "))
num2 = int(input("Please enter a number below 10: "))
div = num1 // num2
print("{:d} goes into {:d}, {:d} times".format(num2, num1, div))
| true |
7b637485788200e7a389df47343a7e3c0d6e0989 | Python | saimahithanatakala/python-basics | /24.add_mul_tuple.py | UTF-8 | 92 | 2.8125 | 3 | [] | no_license | tup1=("c","c++","python","html")
tup2=("java","java script")
print(tup1+tup2)
print(tup1*2)
| true |
f64b94111b55b4935306f6b6f81d51e5f8de2f1b | Python | furas/python-examples | /flask/web camera in browser - canvas - take image and upload to server/app-1-take-image.py | UTF-8 | 1,151 | 2.625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
from flask import Flask, render_template_string
app = Flask(__name__)
@app.route('/')
def index():
return render_template_string('''
<video id="video" width="640" height="480" autoplay style="background-color: grey"></video>
<button id="snap">Take Photo</button>
<canvas id="canvas" width... | true |
f10ff2e733decece47c285c18af56adc1da64915 | Python | doraemon1293/Leetcode | /archive/340LongestSubstringwithAtMostKDistinctCharacters.py | WINDOWS-1252 | 647 | 3.0625 | 3 | [] | no_license | # coding=utf-8
'''
Created on 2017?6?6?
@author: Administrator
'''
class Solution(object):
def lengthOfLongestSubstringKDistinct(self, s, k):
"""
:type s: str
:type k: int
:rtype: int
"""
count = collections.Counter()
st = 0
ans = 0
for en ... | true |
86a9a395622105f5e63902359230c9abb8a7710e | Python | PacktPublishing/Learning-Python-for-Forensics | /Chapter 10/logger.pyw | UTF-8 | 3,571 | 2.75 | 3 | [] | no_license | import multiprocessing
import os
import sys
import time
import pythoncom
import pyHook
import win32con
import win32clipboard
import win32gui
import win32ui
import wmi
def take_screenshot():
# Gather the desktop information
desktop=win32gui.GetDesktopWindow()
left, top, right, bottom=win32gui.GetWindowR... | true |
c5f44ce3b9c7470851120217c1933ee2b5ac403e | Python | gigapay/schwifty | /scripts/get_bank_registry_se.py | UTF-8 | 1,220 | 2.6875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import json
import camelot
import pandas
# https://www.bankinfrastruktur.se/framtidens-betalningsinfrastruktur/iban-och-svenskt-nationellt-kontonummer
URL = "https://www.bankinfrastruktur.se/media/d1tlidv0/iban-id-och-bic-adress-fo-r-banker-2022-12-20.pdf"
def process():
registry = {}
... | true |
47ada64e4d223bbe8ab4f95620b5d0ea36ceb6e0 | Python | mbrzecki/ParserCombinators | /src/BasicParsers/Combinators.py | UTF-8 | 8,794 | 3.140625 | 3 | [
"MIT"
] | permissive | import src.Monads.Result as res
import src.BasicParsers.BasicParsers as bp
def and_then(*parsers, **kwargs):
"""
Applies parsers one by one. All parsers must be successful to return Success
"""
label = kwargs.get('label', None)
if label is None:
label = ''.join([p.label for p in parsers])
... | true |
bef4311277a51a089e788060104b594c77fa15f2 | Python | rzinurov/ggly | /ggly/img_utils.py | UTF-8 | 986 | 3.0625 | 3 | [
"MIT"
] | permissive | import cv2
import numpy as np
def rotate(image, angle):
image_center = tuple(np.array(image.shape[1::-1]) / 2)
rot_mat = cv2.getRotationMatrix2D(image_center, angle, 1.0)
result = cv2.warpAffine(image, rot_mat, image.shape[1::-1], flags=cv2.INTER_LINEAR)
return result
def resize_to_fit(image, width,... | true |
1b89019a71e455ef151ec4ace6362b51cf290df2 | Python | AntonyDamico/ajiley | /Mazo.py | UTF-8 | 1,759 | 4.0625 | 4 | [] | no_license | import random
from Carta import *
class Mazo:
# attr privado: Valores posibles en una baraja francesa
__valores = (1, 2, 3, 7, 10, 11, 12)
# attr privado: Pintas posibles en una baraja francesa
__pintas = ("palos", "espadas", "oro", "copa")
def __init__(self):
"""
Constructor de l... | true |