blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
8c798cccfc5946a2adfb127223b20ade5488cea0 | JardelBrandon/Algoritmos_e_Programacao | /Atividades/Roteiro 9 - Matrizes/Programas/Roteiro 9 Questão 4.py | UTF-8 | 1,056 | 4.4375 | 4 | [] | no_license | #4. Escreva um programa que leia e some todos os valores de uma matriz 3 x 3.
soma = 0
matriz = []
for linha in range(3):
matriz.append([])
for coluna in range(3):
elemento = float(input("Digite os elementos da matriz (3x3) : "))
matriz[linha].append(elemento)
soma += elemento
print(m... | true |
b6f9a6bb6a65b9845a0aecd2d00730682661218f | jagrusy/SupervisedLearning | /SVM.py | UTF-8 | 2,574 | 2.625 | 3 | [] | no_license | import pandas as pd
import pylab as pl
import numpy as np
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
from sklearn import svm
from sklearn.metrics import classification_report, confusion_matrix, f1_score, jaccard_similarity_score
import itertools
from sklearn.model_selection imp... | true |
751a1dc186e56db32a33ede78c4750a0208bc188 | kav04/guvi | /fact.py | UTF-8 | 89 | 3.4375 | 3 | [] | no_license | number=int(input())
fact=1
for i in range(1,number+1):
fact = fact * i
print(fact)
| true |
cdfa4744fb202f2f93ecba7bac0f8856dda0bc4a | lanzhang76/terminal_comic_bot | /markyrun.py | UTF-8 | 1,318 | 3.28125 | 3 | [] | no_license | import marky
# ▌
# ▛▚▀▖▝▀▖▙▀▖▌▗▘▌ ▌
# ▌▐ ▌▞▀▌▌ ▛▚ ▚▄▌
# ▘▝ ▘▝▀▘▘ ▘ ▘▗▄▘
# a Markov Chain comic bot
# by Lan Zhang
context = {}
selections = {
'Bill Maher': [0, 4, 8, 13, 15, 17, 91, 94, 102, 104],
'Sarah Silverman': [84],
'Aziz Ansari': [23],
'Jerry Seinfeld': [47],
'Louis C.K.': [82, ... | true |
7d49d4cf6258319a57eaa9c1396d5fbae0f82ebe | djstull/COMS127 | /functionpractice.py | UTF-8 | 596 | 4.0625 | 4 | [] | no_license | #This program is just a simple way for me to practice functions.
def nicememe():
meme = input("What's the best meme on the planet?")
if meme in ["we are number one"]:
print("HA HA HA, Now look at this net, that I just found, when I say go, be ready throw.")
print("GO")
whothrown = ("Do y... | true |
2ba88a7783a620c585f637f620082e156bd0ff4c | hyq-python/ele | /get_cookie.py | UTF-8 | 3,500 | 2.53125 | 3 | [] | no_license | import requests,time,re
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
import selenium.webdriver.support.ui as ui
import random
class getCookie():
def __init__(self,driver):
self.driver=driver
def get_phone(self):
timestamp=time.time()
u... | true |
e3be4af43d682a43a64887a64be931e166878741 | gedankenstuecke/Twirssi2RSS | /twitter_rss.py | UTF-8 | 4,474 | 2.609375 | 3 | [
"WTFPL"
] | permissive | #!/usr/bin/python
import re
import datetime
import urllib
from operator import itemgetter
import PyRSS2Gen # download at http://www.dalkescientific.com/Python/PyRSS2Gen.html
import pickle
from glob import glob
# This script reads the logfile written by twirssi, fetches all the links posted at the curren... | true |
1fb361734c341f75b6aeb0b7e69f44c7a4848ed3 | Club-de-Software-EPN/tournaments | /devsu/2021/final/05.py | UTF-8 | 2,146 | 2.890625 | 3 | [] | no_license | import math
import copy
def tree(indexes, source, target, offset, sum = [0], level = 0, memo = {}):
len_source = len(source)
len_target = len(target)
if len_source == len_target:
if source == target:
sum[0] += 1
return 1
else:
return 0
eli... | true |
5f7e6398a77625b4ffb05d39142092c7f0a84241 | mauriciomenon/RawCountsBIASscale | /indicador_v0.py | UTF-8 | 2,372 | 2.921875 | 3 | [] | no_license | import tkinter as tk
app = tk.Tk()
# Limites amperimetro
l_lim_inf = tk.Label(app, text="Limite inferior", anchor=tk.W)
l_lim_sup = tk.Label(app, text="Limite superior", anchor=tk.W)
ptr_e_lim_inf = tk.StringVar()
ptr_e_lim_sup = tk.StringVar()
ptr_e_lim_inf.set("4")
ptr_e_lim_sup.set("20")
e_lim_inf = tk.Entry(ap... | true |
a069cd8b9d670fcc3cdf2f326278f78d46b58d00 | moinabyssinia/modeling-global-storm-surges | /wp2/merra_scripts/03_model_fitting/concatValidationFiles.py | UTF-8 | 851 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 26 09:21:26 2020
Concatenate MERRA validation csv files
@author: Michael Tadesse
"""
import pandas as pd
import os
dir_in = "G:\\04_merra\\04_merra_model_validation\\lrreg"
dir_out = "G:\\04_merra\\04_merra_model_validation"
#cd to csv folders
os.chdir(dir_in)
tgName... | true |
62e19e45196b7038f5e41660cc6d3d6038b9b11a | songye38/Computing-Form-and-Shape | /Session2/src/session2_example12.py | UTF-8 | 909 | 3.09375 | 3 | [] | no_license | #session2 - 9
#a third "blip" strategy : modifying a curve after creation
import rhinoscriptsyntax as rs
import random
def blipCurve(y):
x1 = random.uniform(0,10)
z1 = random.uniform(0,10)
x2 = random.uniform(10,20)
z2 = random.uniform(10,100) # this is on purpose this is blip
x3 = random.unifo... | true |
d5cf5feb61c825a945c8677b4fe6f24519abc239 | matthewlevy97/Trapline | /src/util/config.py | UTF-8 | 518 | 2.734375 | 3 | [] | no_license | from typing import Any
import json
class Config():
config_file_path = 'etc/config.json'
@staticmethod
def set_config_path(path: str) -> None:
if path:
Config.config_file_path = path
@staticmethod
def get(key: str) -> Any:
with open(Config.config_file_path, 'r') as f:
... | true |
d0e48ff11a3d278548ecd33269f5a4d9a013d49b | luishmcmoreno/project-euler | /0015.py | UTF-8 | 151 | 3.40625 | 3 | [] | no_license | import math
limit = 20
x = (limit * 2)
y = limit
a = math.factorial(x)
b = math.factorial(y)
c = math.factorial(x - y)
div = a // (b * c)
print div | true |
ab9577cdbfb1e6b4307781f5313feee5c335f6e1 | ARiccGitHub/musclehub_project | /SQL_lib.py | UTF-8 | 1,708 | 3.015625 | 3 | [] | no_license | '''
This Library was created by Codecademy exclusively for this project.
It converts the data.csv project to *.db (SQL database file) and them to the sql_tables.db file
It also includes the function sql_query(), use to convert SQL tables to dataframes
'''
import os
import sqlite3
import pandas as pd
# Clear example.... | true |
9819dac8380a74c96b7547d458522ee331955f89 | ankit-vaghela30/Microsoft-Malware-classification | /src/preprocess/BytePreProcessing.py | UTF-8 | 10,051 | 2.796875 | 3 | [
"MIT"
] | permissive | from pyspark import SparkContext, SparkConf
from pyspark.mllib.regression import LabeledPoint
from pyspark.mllib.classification import LogisticRegressionWithSGD
from pyspark.mllib.tree import DecisionTree
from sys import argv
import numpy as np
import re
import urllib.request
import csv
from nltk.util import ngrams
imp... | true |
dda8156470d5fef940ed140c520e02912bcbc75a | shankar7791/MI-10-DevOps | /Personel/Sandesh/Assessment/1mar/prog1.py | UTF-8 | 53 | 3.21875 | 3 | [] | no_license | i=1
while(i<5):
print(*range(5,i-1,-1))
i +=1 | true |
8cdd31d4978fa2d1c381c6d2fd4fc26fea9820db | studio3104/leetcodeAnswers | /30-Day-LeetCoding-Challenge/June/day24.py | UTF-8 | 1,023 | 3.5625 | 4 | [] | no_license | from typing import Dict
import pytest
memo: Dict[int, int] = {0: 1, 1: 1, 2: 2}
def memo_num_trees(n: int) -> None:
if n in memo:
return None
memo[n] = 0
for i in range(1, n + 1):
memo[n] += memo[len(range(1, i))] * memo[len(range(i, n))]
class Solution:
def numTrees(self, n: int)... | true |
87ebdc65d529a5c828245e66af135feed92f9b48 | Pavithralakshmi/corekata | /1to10.py | UTF-8 | 280 | 3.640625 | 4 | [] | no_license | print("check the input is between the range")
y=0
while y==0:
num=int(input("enter your value"))
for i in range(1):
if num<10:
print(num," yes,this range is in between 1 to 10 ")
else:
print( num," no,this is not in range")
y=int(input("0 to continue"))
| true |
0375e08541c730e813d5e8cd981db0d40af07253 | AgustinMassieri/InformaticaGeneral | /Prácticas/Práctica 4/4.8 COMPLETAR.py | UTF-8 | 174 | 3.453125 | 3 | [] | no_license | def factorial (num):
def main():
num=("Ingrese un número entero:"))
while not num>=0:
print("No se puede calcular el factorial de un número negativo.") | true |
1239f65ea5bb5e5772d64e5ea7a9e029aeae5b36 | hsharrison/python-cryptsy | /cryptsy/order.py | UTF-8 | 1,795 | 2.625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | # Copyright (c) 2014 Henry S. Harrison
from decimal import Decimal
from datetime import datetime
from cryptsy.common import DATETIME_FORMAT
def parse_order_list(orders, type_=None, market_id=None):
if not type_ and not market_id:
return [Order(**order) for order in orders]
else:
order_list =... | true |
14bf2172ddbe6a6b95770ac39c79919053162024 | Xoozi/tchomework | /ch03/session5/21.py | UTF-8 | 666 | 3.40625 | 3 | [] | no_license | #仅当盒子的长度和腰围的和不超过108英寸时, 美国的邮局才接受国内投递
#(a)盒子有正方形侧面, 因而其尺寸为h*h*w, 腰围为2h+2w, 什么尺寸能给出最大体积
# 108 = 2*h+2*w + h=> w = (108-3h)/2 = 54 - 1.5h
#对v求到得到-4.5*h**2 + 108*h, 求临界点得到0和24, 0在定义域外, 所以在h=24时有最大体积
#(b)作图
def v(h):
return h*h*(54 - 1.5*h)
def vd(h):
return 108*h - 4.5*h**2
def vdd(h):
return 108 - 9*h
x ... | true |
40647f19b7e1a8810aaebf7abdbbec499fa8ae28 | Ben8t/upside_down | /main.py | UTF-8 | 809 | 3.0625 | 3 | [] | no_license | """main.py"""
import argparse
import numpy
import cv2
import io
from src.utils import flip_image_tiles
if __name__ == "__main__":
arg_parser = argparse.ArgumentParser(description="Upside Down images.")
arg_parser.add_argument("original_image", help="Original image file path.")
arg_parser.add_argument("dest... | true |
f6e877d72756d8ee6d2f5080134e616faf8c166c | writecrow/text_processing | /metadata_processing/Purdue Scripts/registrar_data_modify_2.0.py | UTF-8 | 7,317 | 2.953125 | 3 | [
"MIT"
] | permissive | # Purpose: combine two tabs in a registrar-data file, and then add the selected instructor info (the output file of instructor_info.py)
# To run this script in Anaconda: python registrar_data_modify.py --input_file1=summer2017_registrar.xlsx --input_file2=instructor_selected_info.csv --output_file=modified_registrar_d... | true |
fea5090bf706895dc30ddba898395f1c5e2bf975 | ashdaily/python-tutorials | /save_to_csv.py | UTF-8 | 142 | 2.890625 | 3 | [] | no_license | with open("example.csv", "w") as csv_file: # open a file and make it equals to csv_file
csv_file.write("bla bla bla")
csv_file.close() | true |
f28f6976df0e14547e27609bea0fed102244023b | mcadapis/ordbogen-terminal | /commandparser.py | UTF-8 | 735 | 3.078125 | 3 | [] | no_license | import re
class Command(object):
EXIT = 1
LIST_DICTS = 2
SET_DICT = 3
LOOKUP = 4
DETAILS = 5
HELP = 6
def parse(txt):
if txt == ".exit":
return Command.EXIT, None
elif txt == ".dicts":
return Command.LIST_DICTS, None
elif txt in (".?", ".help"):
return Com... | true |
d289ddaaecd08c3f636cd034896f3e8675bde8ab | katherinesalazar/python-exercises | /control_structures_exercises.py | UTF-8 | 9,634 | 4.28125 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
# 1
# Conditional Basics
# prompt the user for a day of the week, print out whether the day is Monday or not
# prompt the user for a day of the week, print out whether the day is a weekday or a weekend
# create variables and make up values for
# the number of hours... | true |
e7b77926bc17d276b4443d405ad07e801b08ee01 | KyaWither/Python-Adventure-Game | /Game1.py | UTF-8 | 32,358 | 3.40625 | 3 | [] | no_license | import random
import sys
try: color = sys.stdout.shell
except AttributeError:
raise RuntimeError("Use IDLE")
class warrior:
name = ""
level = 1
maxHealth = 10
health = 10
strength = 2
experience = 0
maxExperience = 30
numberOfPotions = 0
energy = 10
totalEnergy = 10
equ... | true |
8ee18137b2ec99872355602c5a245b4b3472d90a | pbehnke/ninjadog | /tests/test_cli.py | UTF-8 | 911 | 2.515625 | 3 | [
"MIT"
] | permissive | def test_cli_string_argument():
from ninjadog.cli import main
assert main(('string', "h1 hello, world")) == '<h1>hello, world</h1>'
def test_cli_file_argument():
from ninjadog.cli import main
from ninjadog.utils import jsonify
from tempfile import NamedTemporaryFile
context = jsonify({'title'... | true |
987e476aabf781313778fcfab5372f64dd8bc59c | danmachinez/curso_em_videoPython | /ex036.py | UTF-8 | 360 | 3.390625 | 3 | [] | no_license | valorDaCasa = float(input('Qual o valor da casa? R$ '))
salario = float(input('Qual o salário do comprador? R$ '))
anosPagamento = int(input('Em quantos anos vai financiar? '))
maxPossivel = salario * 0.3
prestacoes = valorDaCasa / (anosPagamento * 12)
if prestacoes <= maxPossivel:
print('Empréstimo CONCEDIDO!')
... | true |
fa84f837639bf3db537223062be773df197a2863 | Loliloltrop/YouTube | /Tutorial 3/comments_and_data_types.py | UTF-8 | 246 | 3.9375 | 4 | [] | no_license | # This a comment The python intepreter doesn't read this
# str int float boolean
name = input("What is your name: ")
age = int(input("What is your age: "))
print("Hello " + name + ". You are " + str(age))
print("Hello" , name , "you are", age) | true |
dfb5be48b4883bbcf13a1fb8dc398c579d2e4a48 | Abhilash-Bu/Stock-Price-Reminder | /Share_market.py | UTF-8 | 3,342 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | #! /usr/bin/python
import openpyxl
import requests
from datetime import datetime
from bs4 import BeautifulSoup
import pywhatkit
import time
from twilio.rest import Client
ExcelPath = r'C:\Users\Janardhan\Desktop\stock_analysis\Share_list.xlsx'
wb_obj = openpyxl.load_workbook(ExcelPath)
sheet_obj = wb_ob... | true |
cafd2c96bc14ea06c3beaefb7df18a72b004164f | JhaPrashant1108/leetcode | /leetCode463/463_Island_Perimetre.py | UTF-8 | 744 | 3.46875 | 3 | [] | no_license | class Solution:
def dfs(self, grid, x, y):
if(x < 0 or x >= len(grid) or y < 0 or y >= len(grid[0]) or grid[x][y] == 0):
return 1
return 0
def islandPerimeter(self, grid):
val = 0
for i in range(len(grid)):
for j in range(len(grid[i])):
if... | true |
5b150702408d5c3ac97146ec1c0d7b543b860164 | ttvi-cse/research | /python/basic/control-flow/counters.py | UTF-8 | 1,448 | 4.0625 | 4 | [] | no_license | # Containers: tuple, list and dictionary. Others are included in Collections module
# counter is a subclass of dict. unordered collection
# syntax: class collections.Counter([iterable-or-mapping])
from collections import Counter
print Counter(['B','B','A','B','C','A','B','B','A','C'])
print Counter({'A':3, 'B':5, 'C... | true |
3f929d923219a6ef692e7e39265c3d808d4c561c | 201411096/study_flask | /ex/ex_00_testModule/module_05_sample_structure/controller/error/__init__.py | UTF-8 | 730 | 2.578125 | 3 | [] | no_license | from flask import Blueprint, render_template, abort
blueprint_errorHandler = Blueprint('blueprint_errorHandler', __name__, template_folder='/templates')
@blueprint_errorHandler.route('/test/route/errorHandler')
def test_errorHandler():
return render_template('error/test_errorHandlerRouting.html')
@blueprint_erro... | true |
a93ec83542a698ab7917e1ae7cbf307a892c1efc | zhankq/pythonlearn | /fenkpython/03/t2.py | UTF-8 | 69 | 3.15625 | 3 | [] | no_license | list1 = list(range(10))
print(list1)
list2 = list1[1:4]
print(list2)
| true |
0d8add2fc0d4c4bcb50b83b480eefa3fa3c0f4de | onlyyoufor/SimpleTransformers | /Classfication/preprocess.py | UTF-8 | 823 | 2.9375 | 3 | [] | no_license | # -*- encoding: utf-8 -*-
'''
@File : preprocess.py
@Time : 2021/03/19 16:05:54
@Author : ShareJing
@Email : yymmjing@gmail.com
@Desc : 预处理数据集
'''
import pandas as pd
def load_chinese_spam_message_data(path):
"""加载中文垃圾信息数据"""
data = []
with open(path, "r", encoding="utf-8") as f:
... | true |
8291ed8bdf13d7467d7940543e9e59b3041e3a89 | shims80/DI_Bootcamp | /WEEK5/Day 5/Mini Projecet/code.py | UTF-8 | 1,757 | 4.5625 | 5 | [] | no_license | # Mini-Project #1: Rock, Paper, Scissors
import random
import math
def play():
user = input(
"what's your choise? 'r' for rock, 'p' for paper, 's' for scissors\n")
user = user.lower()
computer = random.choice(['r', 'p', 's'])
if user == computer:
return (0, user, computer)
# r >... | true |
87502bdbf9c278b7a719b251e47fdfc4e4e14d74 | pacellyjcax/ProgrammingChallenge | /URI/1304 - Velocidade Média.py | UTF-8 | 723 | 2.640625 | 3 | [] | no_license | import datetime
def dist(l1,l2,v):
d1 = datetime.datetime(day=13, month=2, year=2015, hour=l1[0], minute=l1[1],second=l1[2])
d2 = datetime.datetime(day=13, month=2, year=2015, hour=l2[0], minute=l2[1],second=l2[2])
diff = d2-d1
return ((v/60.0)/60.0)*diff.seconds
ti = []
v = 0
d = 0
tf = []
while 1:
... | true |
c7614425d125e873cf305451be0301d401a52e4e | SheridanLloyd/MCValidation | /compare_waveforms.py | UTF-8 | 3,196 | 2.5625 | 3 | [] | no_license | from ctapipe.calib import CameraCalibrator
import matplotlib.pyplot as plt
from tqdm import tqdm
from ctapipe.io import event_source
import argparse
import numpy as np
parser = argparse.ArgumentParser(description='Run LightEmission and simtel')
parser.add_argument('--mcfile', help='Path to mc data file')
parser.add_a... | true |
38225361260a9655893c65a1ed73428d7ff8093d | Joan-ita/Microverse | /Grading marks.py | UTF-8 | 1,295 | 3.0625 | 3 | [] | no_license | 'use strict';
const fs = require('fs');
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', function(inputStdin) {
inputString += inputStdin;
});
process.stdin.on('end', function() {
inputString = inputString.split('... | true |
30f6756632e53915cc23c15dbd8a7afb992812d9 | abehickey/RetirementAgeCalculator | /tests/step_defs/test_retirement_steps.py | UTF-8 | 1,040 | 2.828125 | 3 | [] | no_license | import pytest
from pytest_bdd import scenarios, given, when, then
from retire_calc import get_age
EXTRA_TYPES = {
'Number': int,
}
CONVERTERS = {
'birth_year': int,
'age_years': int,
'age_months': int,
}
scenarios('../features/retirement.feature', example_converters=CONVERTERS)
@given('retiremen... | true |
ccca372847368d0a9f5e03967734b51a12b4155b | ms-lilibeth/findPath_geneticAlgorithm | /graph.py | UTF-8 | 1,231 | 3.390625 | 3 | [] | no_license | import random
from collections import defaultdict
class Graph:
def __init__(self, filename):
self._container = defaultdict(lambda : None)
self._destination = None
# self._start == 1
self._create_from_file(filename)
random.seed()
pass
def get_node_list(self):
... | true |
eb07115ae9e2bd6e80dc0ef2ea888e6a4047163f | himnsuk/Python-Practice | /HackerRank/library_fine.py | UTF-8 | 448 | 2.859375 | 3 | [] | no_license | from datetime import date
import sys
d1,m1,y1 = raw_input().strip().split(' ')
d1,m1,y1 = [int(d1),int(m1),int(y1)]
d2,m2,y2 = raw_input().strip().split(' ')
d2,m2,y2 = [int(d2),int(m2),int(y2)]
if (y1 - y2) <= 0 and (m1 - m2) <= 0 and (d1 - d2) <= 0:
print 0
elif (y1 - y2) == 0 and (m1 - m2) == 0:
print abs(d1... | true |
79ea64c0b2e87bd2594a1166c73bce1914d836c8 | ksheng-/neural-network | /test.py | UTF-8 | 289 | 2.59375 | 3 | [] | no_license | import nn
model = nn.prompt('Model file: ', 'model')
x, y = nn.prompt('Testing data file: ', 'data')
outfile = input('Results file: ')
print('Testing neural network...')
metrics = model.test(x, y)
nn.save_metrics(metrics, outfile)
print('Done. Results saved to \'{}\'.'.format(outfile))
| true |
c098b1d1bd4bd94efbf5aa0214322455e64abb10 | himaghna/phosphine-ligands | /_look_at_spread_of_virtual_screen_data.py | UTF-8 | 7,003 | 2.765625 | 3 | [] | no_license | from argparse import ArgumentParser
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
import yaml
plt.rcParams['svg.fonttype'] = 'none'
def embed_in_pca_space(X, pca_obj, scaler=None):
dimensions_returne... | true |
165c70c015739289d8aba2fd45f362d14621297b | davidwang8088/KDD-cup-2017 | /code/z5n0w/plot_tt_day.py | UTF-8 | 889 | 2.671875 | 3 | [] | no_license | from matplotlib import pyplot
from os import remove, getcwd
import platform
import numpy
import pandas
from multiprocessing import Pool
if platform.system() == "Windows":
dataset_path = str(getcwd()) + "\\training\\"
else:
dataset_path = "./training/"
def main():
file = dataset_path + "... | true |
2107b33a1d5acf0431fb0fc931538e70a26ef9c3 | apexx77/p_euler | /Project Euler Projects/file.38.py | UTF-8 | 523 | 3.265625 | 3 | [] | no_license | def is_9_pandigital(n) :
arr = []
while n//10 != 0 :
if arr.count(n%10) == 0 :
arr.append(n%10)
else :
return 0
n = n//10
if arr.count(n) == 0 :
arr.append(n)
else :
return 0
if arr.count(0) == 0 and len(arr) == 9 :
... | true |
f119117e7c2cb0dd55a797da0d49e7dfef9822b6 | msurendra29/python-hackerrank | /Mandragora_Forest _algorithm.py | UTF-8 | 527 | 3 | 3 | [] | no_license | import sys
import math
S = 1
P = 0
t = int(input())
for i in range(t):
n = int(input())
H = [int(health) for health in input().split(' ')]
H = H[:n]
H.sort()
flag = True
eat_no_mandragoras = 0
new_P = 0
for i in range(n):
total_hp = sum(map(int,H[eat_no_mandragoras:])) ... | true |
6c03a782ae000bfe6014a118026764e031baf222 | Ilyosbekdev/goodonyou_webscraping | /goodonyou.py | UTF-8 | 4,342 | 2.546875 | 3 | [] | no_license | import selenium
from selenium import webdriver
from selenium.webdriver import Chrome
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import Select
from selenium.webdriver... | true |
3204438bee4dc9bc3bd77df38e022d334d687a16 | bhzhangyuanlin/AlgorithmLearn | /AVLTree.py | UTF-8 | 3,371 | 3.875 | 4 | [] | no_license | class AVLNode:
def __init__(self, val):
self.value = val
self.l_child = None
self.r_child = None
self.parent = None
self.balance_factor = 0
class AVLTree:
def __init__(self):
self.root = None
def insert(self, node, val):
if self.root:
if... | true |
239654bf1e212f5c2e291ff8e5069239295772e2 | itminha123/jumptopython | /03.Data_Science/1_Collection/open_api/op_api_02_01.py | UTF-8 | 2,016 | 2.609375 | 3 | [] | no_license | import urllib.request
import datetime
import json
access_key = "UREVmQGGPyZcH9gz8eKshT%2Ffyo6paHADoJ4G2P1LuuJMY%2FqoBjGdMJ2icmwgclLU1cVM8YLzAz4qrpeKmfEKEg%3D%3D"
def get_request_url(url):
req = urllib.request.Request(url)
try:
response = urllib.request.urlopen(req)
if response.getcode() == 2... | true |
80c7ff010327f159e409a9288e754ed9f88e0197 | ufkapano/planegeometry | /planegeometry/structures/tests/test_planarmaps.py | UTF-8 | 8,657 | 3.078125 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python3
import unittest
from fractions import Fraction
from planegeometry.structures.points import Point
from planegeometry.structures.segments import Segment
from planegeometry.structures.triangles import Triangle
from planegeometry.structures.rectangles import Rectangle
from planegeometry.structures.p... | true |
5fe187feb8774e1541be016ed1dfb833087a6f58 | jackdewinter/pymarkdown | /pymarkdown/inline/emphasis_helper.py | UTF-8 | 19,696 | 3 | 3 | [
"MIT"
] | permissive | """
Emphasis helper
"""
import logging
from typing import List, Optional, Tuple, cast
from pymarkdown.general.constants import Constants
from pymarkdown.general.parser_helper import ParserHelper
from pymarkdown.general.parser_logger import ParserLogger
from pymarkdown.tokens.emphasis_markdown_token import EmphasisMark... | true |
0df6376333080dcc703dd4ec06f85c32fd7bc0b4 | Karagul/deep-forecast | /src/neuralnets/models/lstm.py | UTF-8 | 1,584 | 2.734375 | 3 | [] | no_license | import warnings
warnings.filterwarnings("ignore")
from collections import OrderedDict
from keras.layers import Dense, Reshape, LSTM, Input, Dropout
from src.neuralnets.forecast_model.forecast_models import RecurrentModel
from src.neuralnets.forecast_model.forecast_model_wrapper import ForecastRegressor
def lstm(nu... | true |
9ee46a3fb181c1d2b2b0cd45d980b726e1b3094a | abaldeg/EjerciciosPython | /tp 4 ej 10.py | UTF-8 | 89 | 3.4375 | 3 | [] | no_license | cant=0
while cant < 1000:
if cant%2 !=0:
print (cant)
cant=cant+1
| true |
d59e1af96be5a111118f3588f92c86a86420b23a | sumiie24/Sumex-Plaza | /Files/order.py | UTF-8 | 3,446 | 3.234375 | 3 | [] | no_license | import os
from Tkinter import *
from tkMessageBox import *
root=Tk()
root.title("Order Finalize")
root.geometry('1366x768')
#===============Functions=============================================
'''def order():
if men.check() + women.check() + indian.check() + chinese.check() + english.check() + th... | true |
68df75ed82814912812874f42b773968aa79df04 | DKhang1902/Flappy-Bird-game | /main.py | UTF-8 | 4,984 | 2.71875 | 3 | [] | no_license | import pygame, random
screen = pygame.display.set_mode((288, 512))
pygame.display.set_caption("Flappy Bird")
run = True
floor_movement = 0
gravity = 0.08
bird_movement = 0
clock = pygame.time.Clock()
FPS = 120
active = True
list_of_pipes = []
pygame.mixer.pre_init(44100, -16, 1, 256)
pygame.init()
SPAWNPIPE = pygame... | true |
8d4d5021b1589e8a414c9e7398e079bdb6e091b0 | asowers1/search_rec_4 | /Spider.py | UTF-8 | 3,050 | 2.984375 | 3 | [] | no_license | __author__ = 'andrew'
import HTMLGetter
import SoupMachine
from collections import defaultdict
import nltk
import nltk.data
import re
from nltk.stem import *
import Database
import time
import random
class Spider():
html = None
soupMachine = None
mlStriper = None
htmlGetter = None
databa... | true |
16b75ba51b7c594426b141686deaa859bc01f702 | rpryzant/code-doodles | /daily_programmer/key_function/key.py | UTF-8 | 708 | 3.078125 | 3 | [] | no_license | from collections import OrderedDict
from collections import defaultdict
def key(elements, key, applyfn):
d = defaultdict(list)
for i, k in enumerate(key):
d[k].append(elements[i])
return (map(applyfn, d.values()), d.keys())
def key_sum(e, k):
return key(map(int, e.split()), map(int, k.split(... | true |
1714cc78f04d035503511c5d478d9cb43897585e | David-Bustos/login-register | /app/models.py | UTF-8 | 1,413 | 2.578125 | 3 | [] | no_license | from django.db import models
from datetime import datetime
import bcrypt
import re
class UserManager(models.Manager):
def register_validator(self, postData):
errors = {}
today=datetime.now().strftime('%Y-%m-%d')
if User.objects.filter(email=postData['email']):
errors['email'] ... | true |
41a498e5ecbfb1730cff9fec90a129bb3e8beaf7 | 1withforce/Cellular-II | /display.py | UTF-8 | 4,432 | 3.296875 | 3 | [] | no_license | import pygame, sys, threading, environment
from pygame.locals import *
import pygame.gfxdraw
import random
#set color constants
redColor = pygame.Color(255,0,0)
greenColor = pygame.Color(0,255,0)
blueColor = pygame.Color(0,0,255)
whiteColor = pygame.Color(255,255,255)
# i'm pretty sure we don't need this
#mousex, mou... | true |
4435866a36b294ea2435d3f34bc939b771ff680c | mdobson/detroit-property-data-lookup | /zillow/zillow_functions.py | UTF-8 | 14,237 | 2.859375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# Zillow scraper functions, these are sourced at the top of zillow_runfile.py
import re as re
import numpy as np
import time
#import zipcode
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriv... | true |
d2d8b5b371d7b513c51e64cebb18fd571c78fee0 | arundaniel-kennedy/Cryptographic-Algorithms | /CNS-dany/miller.py | UTF-8 | 751 | 3.9375 | 4 | [] | no_license | def miller(a):
ch=[]
b=[]
w=0
y=1
flag=0
#make number to be even
if(a%2==0):
return "not prime"
else:
a-=1
#find the factors of the number
for i in range(2,int(a/2)+1):
while(a%i==0):
a=a/i
ch.append(i)
#join 2 together and others together
for i in ch:
if(i==2):
... | true |
56c0b1711e5018801b8f8f23474fb7dfbdd914ab | daniel-reich/turbo-robot | /F9r7cuye3EbNRBtjx_10.py | UTF-8 | 789 | 3.953125 | 4 | [] | no_license | """
The function is given a string with some square brackets in it. You need to
build the outcome string using the rule: `k[substring]` is replaced by the
`substring` inside the square brackets being repeated exactly `k` times.
### Examples
string_builder("3[a]2[bc]") ➞ "aaabcbc"
string_builder("3[a2[... | true |
cbd3911d1b57adadc26f4f550a8d031f9dffc095 | jorginazario/newsstocks_analytics | /tempworking.py | UTF-8 | 3,549 | 2.703125 | 3 | [] | no_license | #Tweepy
import tweepy
import sys
import jsonpickle
import os
import matplotlib.pyplot as plt
import numpy as np
# Replace the API_KEY and API_SECRET with your application's key and secret.
API_KEY = 'rF1UhAhVJsmie822K1bXN5lvd'
API_SECRET = 'UykH43jgHn5SWYHTprLyfrQPWKl7V2ODu2MhJVTqIJosjbLn5a'
auth = tweepy.AppAuthHan... | true |
d3668356aec61558c6cd9d6f751e59b97812e4dc | Yohager/PatternReconginition_StatisticLearning | /CNN/conv/CNN_class.py | UTF-8 | 3,399 | 2.9375 | 3 | [] | no_license | # --*-- coding:utf-8 --*--
#author:yohager
'''
this file is the different layers for cnn
conv_layer
pooling_layer
full_connected_layer
'''
import numpy as np
class input_layer:
def __init__(self,data_size,batch_size):
#假设输入的数据为所有的数据:784 * 6w,则通过batch_size控制每一次传入的数据量:784 * batch_size
self.output_si... | true |
97a39000b37af7748103cc56fa870a5755bf4d5f | galabing/petra | /haugen_metric.py | UTF-8 | 4,178 | 2.984375 | 3 | [] | no_license | #!/usr/local/bin/python3
""" Extracts certain metric from certain date.
"""
import argparse
import logging
import utils
from os import path
def distance(ym1, ym2):
y1, m1 = ym1.split('-')
y2, m2 = ym2.split('-')
y1, m1 = int(y1), int(m1)
y2, m2 = int(y2), int(m2)
return (y1 - y2) * 12 + m1 - m2
def main()... | true |
b4b46aac8351568cf0906fe2e8bb4f79a576aa55 | ck5354/haojie_python | /python_knowledge/Python基础/list用法/map-指定序列映射.py | UTF-8 | 199 | 3.734375 | 4 | [] | no_license | # map() 函数语法:
# map(function, iterable, ...) function -- 函数 iterable -- 一个或多个序列
def squ(x):
return x**2
map(squ,[1, 2, 3, 4, 5])
a = [2,3,4]
a.append(1)
print(a)
| true |
d7259686af9c06645797467cf6d2ffe2649b3108 | HamletXiaoyu/Navie-Bayes-python | /bayes.py | UTF-8 | 3,521 | 3.609375 | 4 | [] | no_license | #coding=utf-8
# Example of Naive Bayes implemented from Scratch in Python
import csv
import random
import math
#load data from file
def load_csv(filename):
lines = csv.reader(open(filename, "rb"))
dataset = list(lines)
for i in range(len(dataset)):
dataset[i] = [float(x) for x in dataset[i]]
re... | true |
0a2f0902bdb7b61a5c72fea34f153bf5fe6fe0aa | HITOfficial/College | /WDI/lekcja 8 25.11.2020/zad26.py | UTF-8 | 1,826 | 3.96875 | 4 | [] | no_license | # Do budowy liczby naturalnej reprezentowanej w systemie dwójkowym możemy użyć A cyfr
# 1 oraz B cyfr 0, gdzie A, B > 0. Proszę napisać funkcję, która dla zadanych parametrów A i B zwraca ilość
# wszystkich możliwych do zbudowania liczb, takich że pierwsza cyfra w systemie dwójkowym (najstarszy
# bit) jest równa 1, ... | true |
2f8ffc68570bed614dc4d551b51d7498dd40746a | luisfeliperd/API_Tainacan | /crossover/script/functions.py | UTF-8 | 2,383 | 3.15625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed May 6 21:18:41 2020
@author: luisr
"""
import requests
import time
from sqlalchemy import create_engine
#Acesso ao banco de dados. Substituir o usuário e a senha.
mysqlEngine = create_engine('mysql+pymysql://user:password@localhost:3306/tainacan_api')
dbConnection = mysqlEng... | true |
95aefa7a606923e083868aaf54d5bc4202fe0943 | TakanoriYagi/Proseed_dmm_online | /Tech_Python/Python_kisokouza/Python基礎講座①/kiso_1.py | UTF-8 | 72 | 2.796875 | 3 | [] | no_license | x = 12
# print(*)は、*を表示するという関数です。
print(x) | true |
4c554d3c7a7198f641f03888cc3aeb02f7b78a92 | Azumait/grammar1-1 | /back_python_3_dataprocess1/1_python_matplotlib1/3.py | UTF-8 | 2,695 | 4.34375 | 4 | [] | no_license | # 이제 다시 파이썬으로 돌아와서,
# 배열과 집합, 파일 읽고 쓰기를 (다시) 공부해보도록 하겠습니다.
# 1. 파이썬 리스트(배열), 셋(집합) 다루는 법
# 중복요소를 제거
arr1 = ['LTE', 'LTE', '5G', '5G', 'WCDMA', '5G', 'WCDMA', 'LTE']
arr2 = [1, 1, 2, 2, 3, 2, 3, 3]
set1 = set(arr1)
set2 = set(arr2)
arr1 = list(set1)
arr2 = list(set2)
print(arr1)
print(arr2)
# 요소의 추가 : arr는 arr.appe... | true |
1de60615270d121541ec23415bcb34ae6df291d9 | sangeethadhanasekar/new_python | /program_to_find_sum_of_digits.py | UTF-8 | 157 | 3.703125 | 4 | [] | no_license | print("***program to find the sum of digits of a number***")
a=input("enter a number:")
sum=0
for i in a:
x=int(i)
sum=sum+x
print(sum)
| true |
576e6d2d8e681f52316b6a68bd668f58ffb5ebb0 | MarioMiranda98/Curso-Python | /POO/Polimorfismo.py | UTF-8 | 464 | 2.828125 | 3 | [] | no_license | class Coche() :
def desplazamiento(self) :
print ("Me desplazo utilizando 4 ruedas")
class Moto() :
def desplazamiento(self) :
print ("Me desplazo utilizando 2 ruedas")
class Camion() :
def desplazamiento(self) :
print ("Me desplazo utilizando 6 ruedas")
def desplazamientoVehiculo... | true |
ec18b416940f3f48371a03992db2562604936a89 | SCUMakerlab/Intel-Edison-Code | /omnibot-v2.py | UTF-8 | 1,445 | 3.40625 | 3 | [] | no_license | import time, math, mraa
from PWMShield import PWMShield
pwmShield = PWMShield(6)
def main():
enabled = True
print("Ready to go!")
while(enabled):
input = raw_input('')
if(input == 'w'): #If input is w arrow key
setDirection(0,.5) #Tell robot to move forward
if... | true |
dbe7eb76644b6cfc506a4752ded5cd117cf819e2 | h668-rubrik/rubrik-plugin-for-nagios | /check_rubrik_cluster_storage.py | UTF-8 | 3,358 | 2.625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
check_rubrik_cluster_storage.py
This script gets the current used storage in the Rubrik cluster,
and returns a warning if the usage is over 50%, and a critical
alert if the usage is above 70%.
Requires the following non-core Python modules:
- nagiosplugin
- rubrik_cdm
These are ... | true |
cf99697559b49e4e6e1afc248286d22259159c8e | sku899/COVID-19-Data-Visualisation | /NHS_data_analysis.py | UTF-8 | 3,724 | 2.90625 | 3 | [] | no_license | ##import required packages
from pandas import read_csv
from pandas import to_datetime
import pandas as pd
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
import numpy as np
from matplotlib import rc
##define functions
def load_data(file_path, file_name):
load_fil... | true |
6afcf4d88b23f729763c010b34f6634cceac73d8 | KrzysztofGoc/SpaceDefender | /stars.py | UTF-8 | 649 | 3.1875 | 3 | [] | no_license | from pygame.sprite import Sprite
import pygame
from random import randint
class Star(Sprite):
def __init__(self, image_number, screen):
super(Star, self).__init__()
if image_number == 0:
self.image = pygame.image.load('images/star1.png')
elif image_number == 1:
self... | true |
c29ebbe2b6c83a08192837a8a9514c770013659c | kmrgaurav11235/PythonProBootcamp | /section_01_beginners/lesson_02_data_types/03_data_type_assignment.py | UTF-8 | 460 | 4.46875 | 4 | [] | no_license | # Write a program that adds the digits in a 2 digit number. e.g. if the input was 35, then the output should be 3 + 5 = 8
# 🚨 Don't change the code below 👇
two_digit_number = input("Type a two digit number: ")
# 🚨 Don't change the code above 👆
####################################
#Write your code below this line �... | true |
7e4752706bcfcab0f7caec886d8d850ab5159373 | minhdat1602/ml_2021_group22 | /mask_detector_video.py | UTF-8 | 4,858 | 2.515625 | 3 | [] | no_license |
# import thư viện
import os
import numpy as np
import imutils
import cv2
from tensorflow.keras.models import load_model
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
from tensorflow.keras.preprocessing.image import img_to_array
from joblib import load
from tensorflow.keras.utils import to_cat... | true |
fcad9e4c2a6e51a5388615b901d7f792aa5f0f3f | zeroquejunior/stuff | /classes-test/teste1/physical_person.py | UTF-8 | 282 | 2.875 | 3 | [] | no_license | from person import Person
class PhysycalPerson(Person):
last_name: str
def __init__(self, name: str, national_id: str, last_name: str):
self.last_name = last_name
super().__init__(name, national_id)
def peida(self):
print("Peido verdadeiro")
| true |
827cb99f117da1a58fffb35e6af905fec3449d01 | leodenault/mhw_optimizer | /header_handlers/decoration_handler.py | UTF-8 | 477 | 2.78125 | 3 | [
"MIT"
] | permissive | from combination.scored_combination import ScoredCombination
from header_handlers.header_handler import HeaderHandler
class DecorationHandler(HeaderHandler):
def __init__(self, level):
self.level = level
def generate_output(self, combination: ScoredCombination):
return str(
combin... | true |
9cb96d1ccf16ad08fd183770c3d48e32f296e19a | poonam5248/MachineLearning | /Day12___28-June-2019/2.MatplotLib.py | UTF-8 | 858 | 2.5625 | 3 | [] | no_license | Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import matplotlib.pyplot as plt
>>> plt.plot(x,y)
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
plt.plot(x,y)
NameError: na... | true |
69416a83ef63408e5c441d88eb56b9d0f8c89e9c | samidarko/datascience-capstone | /counter_aggregator.py | UTF-8 | 1,094 | 3.09375 | 3 | [] | no_license | import sys
from collections import Counter
from datetime import datetime
from glob import glob
def counter_aggregator(output_file, input_files):
files = glob(input_files)
words_count = Counter()
for file in files:
total_lines = len(open(file).readlines())
with open(file) as input_file:
... | true |
77c66a143ba05c0baed290d552a9aa8a3ea31a86 | EpicureanHeron/DataAnalyticsBootcampSpring2018 | /Week 2 - VBA/Practices/Python/Rock_Paper_Scissors.py | UTF-8 | 2,162 | 4 | 4 | [] | no_license | # Incorporate the random library
import random
# Print Title
print("Let's Play Rock Paper Scissors!")
# Specify the three options
options = ["r", "p", "s"]
keep_playing = True
# Run Conditionals
while(keep_playing == True):
# Computer Selection
computer_choice = random.choice(options)
# User Selection
... | true |
364eb6507166a14f8eb3c5d2d317b8f66360d1bd | powder-river/duke-code | /duke_id/duke_id.py | UTF-8 | 558 | 3.875 | 4 | [] | no_license | import re
# 3. Duke Unique IDs can be 7 digits numbers.
# Or for the case of service accounts, they can be 10 digit numbers starting with a "1".
# Write a regular expression that can be used to match against a valid Duke Unique ID.
user_id = str(input("Please enter Duke ID Number: \n"))
check_id = re.match(r... | true |
941a7a982e323b4344ec3bc6601d675e74ada410 | Aasthaengg/IBMdataset | /Python_codes/p03328/s402804440.py | UTF-8 | 168 | 3.234375 | 3 | [] | no_license | def Gauss_sum(n):
return n*(n+1)//2
a,b=map(int,input().split())
for i in range(999):
if Gauss_sum(i+1)-a == Gauss_sum(i+2)-b:
print(Gauss_sum(i+1)-a)
break | true |
8d6f523b7deead58e6a2458e168d176794d0ca8e | ChrisFloresM/Coding-Python | /Python_Crash_Course/Chapter_8_Functions/T-shirt.py | UTF-8 | 696 | 4.34375 | 4 | [] | no_license | #Christian Flores 12/02/2021
#Ejercicio 1 y 2: T-Shirt and Large Shirt
def make_shirt(size = "Large", text_to_print = "I Love Python"):
"""Print a size and a message for a shirt"""
print(f"\nYour T-shirt will be size {size} and it will say '{text_to_print}' on it!")
make_shirt(32, "Hello World!")
make_shirt(t... | true |
3ac5baa4111f77df8bc6b57c08dbc5e0747162db | sidv1905/Python-programs | /Codechef/coinsandtriangle.py | UTF-8 | 186 | 2.921875 | 3 | [] | no_license | T=int(input())
while T>0:
N=int(input())
count=0
for i in range(N,0,-1):
N=N-1
count+=1
if N==1:
break
print(count)
T=T-1
| true |
f12e61a4ea7004ce7dfbd7983571da8d9630d6d7 | wiktoriamroczko/CeneoScraper | /app/models.py | UTF-8 | 5,665 | 2.796875 | 3 | [] | no_license | #import bibliotek
import requests
from bs4 import BeautifulSoup
import textwrap
import json
from app import app
from app.utils import extract_element, remove_whitespaces
# from utils import extract_element, remove_whitespaces
class Product:
def __init__(self, product_id = None, name = None, opinions = []):
... | true |
4903ea47e81d2b04bc6f310adf03affbf70bdeee | juliangarcia/pyevodyn | /PyEvoDyn/pyevodyn/tests/simulate_fixation_probability_test.py | UTF-8 | 1,706 | 2.671875 | 3 | [
"BSD-2-Clause-Views"
] | permissive | '''
Created on Oct 5, 2012
@author: garcia
'''
import unittest
from pyevodyn import games, numerical
from pyevodyn.simulation import MoranProcess
class Test(unittest.TestCase):
def test_hardcoded_fixations(self):
game = games.two_times_two(a=3.0, b=0.5, c=0.5, d=2.0)
intensity_of_selection = 1.0
... | true |
a718ffe857739c423acddbdfc4bdfe1dbda04139 | VladPerervenko/gama | /gama/utilities/preprocessing.py | UTF-8 | 6,029 | 3.3125 | 3 | [
"Apache-2.0"
] | permissive | import logging
from typing import Optional, Iterator
import category_encoders as ce
import numpy as np
import pandas as pd
from sklearn.impute import SimpleImputer
from sklearn.pipeline import Pipeline
log = logging.getLogger(__name__)
def find_categorical_columns(
df: pd.DataFrame,
min_f: Optional[i... | true |
a079ba8260ee916263ab4e0d719248f93892ef32 | afangg/Shopper-Helper | /process_image/barcode_reader.py | UTF-8 | 13,675 | 3.21875 | 3 | [] | no_license | import cv2 as cv
import numpy as np
from math import pi, log
BARCODE_CONVERSION = {3211: 0,2221: 1, 2122: 2, 1411: 3, 1132: 4, 1231: 5, 1114: 6, 1312: 7, 1213: 8, 3112: 9}
def get_image(src):
"""Read in the image file from its location in memory and return image object.
Parameters:
src (string): filepath to im... | true |
82d90de998383a1b16affa899c3432b92350b3e9 | shenhaiyu0923/resful | /z_python-stu1/first/廖雪峰/装饰器.py | UTF-8 | 425 | 3.390625 | 3 | [] | no_license | import functools
def log(text=None):
def decorator(func):
@functools.wraps(func)
def wrapper(*args, **kw):
if not text is None:
print(text)
print('begin call')
result=func(*args, **kw)
print('end call')
return result
... | true |
0fd5392e87fb3eff63df503e0dc1881e613f04f6 | Alberto920811/Face-Recognition | /images_to_csv.py | UTF-8 | 1,271 | 2.671875 | 3 | [] | no_license | import os
import csv
import numpy as np
import cv2.cv2 as cv2
import csv
import pandas as pd
#Utilizar este comando
#C:\Users\xcad\Desktop\FaceEmotionID\FaceEmotion_ID\dataimages>
# dir /s /b > print.txt
with open('dataimages/print.txt', 'r') as in_file:
stripped = (line.split() for line in in_file)
... | true |
a93b339fd768a58a7083555c3afb4f251fc4a75c | HoraN1/OpenCV_Practice | /mouse_brush.py | UTF-8 | 5,505 | 3.328125 | 3 | [] | no_license | import cv2
import numpy as np
import math
def nothing(x):
pass
class Paint(object):
"""
A painting tool using mouse
"""
def __init__(self):
"""
Initial some parameters.
"""
self.press = False # true if mouse is pressed
self.mode = 1 # default mode is dr... | true |
af444741d3125a660fd183e8a5a191335a4a91c4 | nedbat/adventofcode2019 | /day11.py | UTF-8 | 2,310 | 3.609375 | 4 | [] | no_license | # https://adventofcode.com/2019/day/11
import itertools
import attr
from intcode import IntCode, program_from_file
@attr.s(auto_attribs=True)
class Direction:
dx: int = 1
dy: int = 0
def left(self):
return self.__class__(self.dy, -self.dx)
def right(self):
return self.__class__(-se... | true |
3c803ad7f208ce1e27302efe7fd3055779506130 | zxg-com/Selenium_ddt | /utils/assertion.py | UTF-8 | 1,431 | 2.921875 | 3 | [] | no_license | #coding:utf-8
"""
在这里添加各种自定义的断言,断言失败抛出AssertionError就OK。
"""
from utils.log import logger
import asserts
def assertHTTPCode(response, code_list=None):
res_code = response.status_code
if not code_list:
code_list = [200]
if res_code not in code_list:
logger.error('响应code不在列表中!') ... | true |
2484f4ee4a2535338b3f520e0f28d61e3ae6703a | gcaussy/littlecn | /cnPackages/ThreadMoteurs.py | UTF-8 | 5,973 | 2.609375 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding:Utf-8 -*-
from tkinter import *
from threading import Thread
import time
#try:
# from cnPackages.PanelMoteurs import *
# from cnPackages.DataParam import DataParam
# from cnPackages.PanelDisplayXYZ import PanelDisplayXYZ
#except:
try:
from PanelDisplayXYZ import PanelDisplayXYZ
except... | true |