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 |
|---|---|---|---|---|---|---|---|---|---|---|
3925adeaa272693cb30a1b8943e5f077d4d6340f | Vitalii36/PythonScrapy-JsonAJAX | /ScrapyAJAX/spiders/SCajax.py | UTF-8 | 806 | 2.640625 | 3 | [] | no_license | import json
import scrapy
from ScrapyAJAX.items import ScrapyajaxItem
from scrapy.spiders import CrawlSpider, Rule
class SpidyQuotesSpider(scrapy.Spider):
name = 'spidyquotes'
quotes_base_url = 'http://spidyquotes.herokuapp.com/api/quotes?page=%s'
start_urls = [quotes_base_url % 2]
download_delay = 1.... | true |
7f72dc29eab5602f5bb9fa517bb959435d15f89e | kandithws/sdqi_rails_central_app | /scripts/test_toll_fee_create.py | UTF-8 | 1,391 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python2
from sys import argv
import json
import requests
from time import gmtime, strftime, sleep
class TollBooth:
def __init__(self, config):
# Read config as json format
data = None
with open(config, 'r') as f:
data = json.loads(f.read())
self.config = d... | true |
744fd8b2ebe84e1a874b88f6a9a51ddcc5f6e1ef | mrshaikh4u/Problem-solving | /LeetCode_Aug2020/Day_2.py | UTF-8 | 537 | 3.21875 | 3 | [] | no_license | class Solution:
def detectCapitalUse(self, word: str) -> bool:
cnt = 0
if not word or len(word)==0:
return False
for c in word:
if c.isupper():
cnt+=1
if cnt == len(word) or cnt==0:
return True
if cnt==1 and word[0].isupper(... | true |
f192abae62161a9dd0788bcc2b555c5967021422 | VamsiSaiTumu/Python-Task | /functions-assignment7.py | UTF-8 | 2,311 | 4.71875 | 5 | [] | no_license | print("calculator with functions")
#simple function
def add():
print(f"addition of {x} and {y} is:",x+y)
#function with agrument and without return type
def sub(a,b):
print(f"sustraction of {a} and {b}is:",a-b)
#function without agrument with return type
def mul():
c= x*y
return c
#functi... | true |
ff9dc2c8d77b02d2da6fa373b92ee3eae97fd0d7 | HicksMatthew/fetchLandsatSentinelFromGoogleCloud | /fels/fels.py | UTF-8 | 9,351 | 2.515625 | 3 | [
"MIT"
] | permissive | """TODO module documentation"""
from __future__ import absolute_import, division, print_function
import argparse
import datetime
import os
import json
import pkg_resources
from fels.utils import *
from fels.landsat import *
from fels.sentinel2 import *
import geopandas
import json
import shapely as shp
def convert_wk... | true |
887e6b7a6426c4c604e4ab09915ac61ff0947de7 | mattrobinson412/python_syntax | /words.py | UTF-8 | 702 | 4.21875 | 4 | [] | no_license |
# Step 1-2
words = ['holiness', 'theology', 'sanctification', 'salvation']
def print_upper_words(list):
new_list = [x.upper() for x in words]
print(new_list)
print(print_upper_words(words))
# Step 3
def print_e_words(words):
for word in words:
if word[0] == 'e':
print(word)
... | true |
877cfb25bcb6078750f6753fdb5a4927450cd59e | MetuDeveloper/Python | /OkanBlog/blog.py | UTF-8 | 9,194 | 2.546875 | 3 | [] | no_license | from flask import Flask,render_template,flash,redirect,url_for,session,logging,request
from flask_mysqldb import MySQL
from wtforms import Form,StringField,TextAreaField,PasswordField,validators
from passlib.hash import sha256_crypt
from functools import wraps
#Kullanıcı Giriş Decorator'ı
def login_required(f):... | true |
2a9fc5e5c74a5c32ef47cb1d951fe02ccb2965b3 | linshow/the-flask-web | /get_latlng.py | UTF-8 | 679 | 2.765625 | 3 | [] | no_license | import pymysql
import googlemaps
def get_latlng(address):
latitude=[]
longitude=[]
new_latlng=[]
global new_address
gmaps = googlemaps.Client()
geocode_result = gmaps.geocode(address)
if geocode_result:
latitude = geocode_result[0]['geometry']['location']['lat']
... | true |
72fa29b6d9b37f9ed8d77cca43d683035389a93e | bkaganyildiz/anadolusigortaapi | /anadolucore/utils.py | UTF-8 | 8,957 | 2.890625 | 3 | [] | no_license | import inspect, random, time
from enum import IntEnum
class ChoiceEnum(IntEnum):
@classmethod
def choices(cls):
# get all members of the class
members = inspect.getmembers(cls, lambda m: not(inspect.isroutine(m)))
# filter down to just properties
props = [m for m in members if ... | true |
0dfe66a918831aa455522ea138ec9941150186f9 | SocialIcon/PasswordCreator | /pass.py | UTF-8 | 1,604 | 2.734375 | 3 | [] | no_license | import time
#colors
red='\033[91m'
b='\033[21m'
gren='\033[92m'
yellow='\033[93m'
cyan='\033[96m'
blue='\033[94m'
print (red+b+"soci-concept.blogspot.com")
print (" ")
length=int(input(cyan+b+"Enter the number of characters: "+b+cyan))
print (" ")
name=input(cyan+b+"Name your wordlist wit (.txt) extension: "+b+cyan)... | true |
c73f277bf014cf2d5240e70bf9ff6d8c3dc8974c | gwk-01/computationalphysics_N2015301020131 | /exercise6/thetaandomega.py | UTF-8 | 965 | 2.8125 | 3 | [] | no_license |
import matplotlib.pyplot as plt
from math import*
from pylab import *
q = 0.5
l=g=9.8
D = 2/3
dt = 0.04
o = [0.2] #θ
o1 =[0.201] #θ1
w = [0.0] #ω
w1 =[0.0] #ω1
t = [0.0]
do = [0.001] #dθ
FD = 1.2
i = 0
y=[-6.874]
kong=[0]
slope = [0]
while (t[i]<500) :
w.append(w[i] + (-sin(o[i])-q*w[i]+FD*sin(D*t[i... | true |
e1c89c61f292c802b00c8bc76a11347951b3fff7 | valdot00/hola_python | /8 clases objetos y funciones/43_funciones_lambda.py | UTF-8 | 192 | 3.671875 | 4 | [] | no_license | #43 funciones lambda
resultado = lambda numero : numero + 30
print(resultado(20))
print("---")
resultado2 = lambda numero1,numero2 : numero1 + numero2
print(resultado2(8,2))
print("---") | true |
fe2b78a6ab8f94d81438f1ca306affe5599aacd6 | taguacil/PeakBlock-AI | /diagnosis/diagnosis_algorithms/naive_bayes.py | UTF-8 | 3,352 | 2.90625 | 3 | [
"MIT"
] | permissive | """
=============================================================================
Title : Main peakblock script
Project : PeakBlock
File : run.py
-----------------------------------------------------------------------------
Description:
This file contains the main routines for a naive bayesian inferen... | true |
28253ba7cc2cd327f83d4b8c4d1e6fbf857db48d | junqili259/ChewsForYou | /cloud_proj/api.py | UTF-8 | 1,229 | 2.609375 | 3 | [] | no_license | import requests
import json
import os
# yelp api business search endpoint
def business_search(address):
api_key = os.environ.get('api_key')
headers = {'Authorization': 'Bearer %s' % api_key}
url = 'https://api.yelp.com/v3/businesses/search'
params = {'term': 'restaurants', 'radius': 1609, 'location': a... | true |
a2dc1bee4499e4593b6be6b9982d46c3593c7876 | varunchandan2/python | /boxVolume.py | UTF-8 | 530 | 4.25 | 4 | [] | no_license |
#Accept length from the user and store as a integer
length = input("Enter length of the box: ")
length = int(length)
#Accept width from the user and store as a integer
width = input("Enter width of the box: ")
width = int(width)
#Accept height from the user and store as a integer
height = input("Enter height of the bo... | true |
6492b4081a71ab5c434119606c0467c383e9b556 | srikanth3006/Python | /Algorithms/Backtracking/N_Queen_Problem.py | UTF-8 | 953 | 3.6875 | 4 | [] | no_license | # N-Queen problem
def is_safe(board, row, col):
# Checking for the left side of the row
for i in range(col):
if board[row][i] == 1:
return False
# Check for the upper diagonal on left side
for i,j in zip(range(row, -1, -1), range(col, -1, -1)):
if board[i][j] == 1:
... | true |
481474c4e77b7cb5edc112d6a1a9e5865759e498 | SuperiorOS/android_system_media | /camera/docs/metadata_model_test.py | UTF-8 | 4,292 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | import unittest
from unittest import TestCase
from metadata_model import *
class TestInnerNamespace(TestCase):
def test_combine_children_by_name(self):
#
# Set up
#
kind = Kind("some_root_kind", parent=None)
ins_outer = InnerNamespace("static", parent=kind)
kind._namespaces = [ins_outer]
... | true |
74696e948eec4711333b8c881641bd41459fc677 | AlexClowes/advent_of_code | /2017/16/billion_dances.py | UTF-8 | 952 | 3.21875 | 3 | [] | no_license | from itertools import count
def try_int(x):
try:
return int(x)
except ValueError:
return x
def main():
programs = list("abcdefghijklmnop")
def spin(n):
nonlocal programs
programs = programs[-n:] + programs[:-n]
def exchange(i, j):
programs[i], programs[j... | true |
ff849d50143f27fc5a209fda49b75f3acc2b29c1 | viverbungag/Codewars | /Jaden Casing Strings.py | UTF-8 | 179 | 3.4375 | 3 | [] | no_license | def to_jaden_case(string):
return " ".join([x.capitalize() for x in string.split(" ")])
quote = "How can mirrors be real if our eyes aren't real"
print (to_jaden_case(quote)) | true |
a331de64b114bf5ffacca650b52689ccfa6e171f | sunsunyoung2jjang/test | /m_recommend.py | UTF-8 | 647 | 2.5625 | 3 | [] | no_license | import pymysql
def m_recommend():
result_arr=[]
# db연동
stock_db = pymysql.connect(
user='root',
passwd='root',
host='localhost',#localhost
db='stock',
charset='utf8'
)
cursor = stock_db.cursor(pymysql.cursors.DictCursor)
sql="SELECT name,pre_price,tom_pri... | true |
ce1db846c9438a8347232b1a7380148a70c62230 | awssreejith/SimpleServiceWithJWT | /app/LoginService.py | UTF-8 | 6,237 | 2.921875 | 3 | [] | no_license | from flask import Flask
from flask import request ##This is a good addon for authentication
from flask import jsonify
import jwt
import datetime
import functools
##Our local B of users and passwords
userDB = [{"user" : "Isser_Harel", "password" : "mossad_1"},
{"user" : "Meir_Amit", "password" : "mos... | true |
aa5bbb7a83741f42263211a45298d2b7447d1b8b | petershen0307/OnlineJudge | /sphereOnlineJudge/_2PrimeGenerator.py | UTF-8 | 1,892 | 3.5625 | 4 | [] | no_license | import math
def is_prime_number(number):
assert 0 < number
if 1 == number:
return False
root_int = math.floor(math.sqrt(number))
for i in range(2, root_int + 1):
if number % i == 0:
return False
return True
def enhance_prime_detect(number, prime_numbers):
if len(p... | true |
333e0c4c034019504ac449de7cef0786a02e95e9 | rootmos/config | /bin/playlist.py | UTF-8 | 4,696 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python3
import argparse
import itertools
import logging
import random
import re
import subprocess
import os
class Entry:
def __init__(self, fn, prefix=None):
self.fn = fn
self.prefix = prefix
self._duration = None
def __str__(self):
if self.prefix is not None:
... | true |
41c7ad1a978c1f7d0e11f9d424d69ad0e9e4bb87 | neuralchecker/pythautomata | /pythautomata/tests/test_pdfa_last_token_queries.py | UTF-8 | 858 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | from unittest import TestCase
from pythautomata.automata_definitions.weighted_tomitas_grammars import WeightedTomitasGrammars
from pythautomata.base_types.sequence import Sequence
from pythautomata.base_types.symbol import SymbolStr
class TestPDFALastTokenQueries(TestCase):
def test_1(self):
pdfa = Weig... | true |
4021bfd032d71595f26fb87d07705fc5c94478be | mdrago98/super-conductor-criticical-temp | /utils/model_fitting.py | UTF-8 | 2,175 | 3.328125 | 3 | [] | no_license | from pandas import DataFrame
from typing import Callable
from sklearn.linear_model import LinearRegression
def simple_regression_analysis(x_train: DataFrame, y_train: DataFrame, x_test: DataFrame, y_test: DataFrame,
sort_criteria: Callable, linear_model: Callable = LinearRegression,
... | true |
8b32e91fc86b3f0b1d83fae5ce3398c670e296b4 | IkeAlmighty/rts-game | /entities.py | UTF-8 | 9,857 | 2.84375 | 3 | [] | no_license | import pygame, preloading, math, random, pygame.time, datastructures
from datastructures import PriorityQueue
from pygame.sprite import Sprite
from pygame import Surface, Rect
import gamemapping
all_entities = []
outdated_entities = []
screen = None
def add_entity(entity):
if entity not in all_entities:
... | true |
6f5da002dfc67baeba92b7563cdc0b733b93283e | corinnelhh/homework_Qs | /factorial/factorial.py | UTF-8 | 431 | 3.859375 | 4 | [] | no_license | # recursive approaches cannot handle larger inputs and will run into maximum
# recursion depth errors; iterative approaches are best for calculating
# the factorial for larger numbers
def factorial(x):
y = 1
for i in range(1, (x + 1)):
y *= i
return y
if __name__ == '__main__':
import math
... | true |
3b4e7112f332f9a0746accc9c6e2d8945aec7759 | goyal-aman/codeforces | /In Search of an Easy Problem.py | UTF-8 | 73 | 2.703125 | 3 | [] | no_license | input()
s = any(map(int, input().split()))
print('HARD' if s else 'EASY') | true |
a1ff5424f54e4b278848185ab06fb52aa731cba6 | tanush-garg/turtlegraphics | /rectangle.py | UTF-8 | 125 | 3.875 | 4 | [] | no_license | import turtle
rectangle = turtle.Turtle()
for i in range(4):
rectangle.forward(110)
rectangle.left(90)
turtle.done() | true |
a5deea31cadfebfe6041fb334a6df6647d2d15b0 | yucanagy/opencv_learn | /Core Operations/arithmetic_on_images.py | UTF-8 | 2,273 | 2.6875 | 3 | [] | no_license | import cv2
import numpy as np
from matplotlib import pyplot as plt
# image addition
img1 = cv2.imread('../images/5.jpg')
img2 = cv2.imread('../images/11.jpg')
img = img2 + [np.uint8(0), np.uint8(0), np.uint8(0)]
cv2.imshow('img', img)
# image blending 修改透明度叠加
dst1 = cv2.addWeighted(img1, 0.1, img2, 0.9, 0)
dst2 = cv... | true |
854f31a8134b709d3c36de6cd7445f4c181fc18f | paulovictor1997/Python | /Repetição/desafio48.py | UTF-8 | 398 | 3.890625 | 4 | [] | no_license | print('MÚLTIPLOS DE 3 ENTRE 1 E 500 !')
soma = 0 #soma será o acumulador, pois não recebeu nenhum valor !
cont = 0 #será o contador
for n in range(1,501,2):
if (n % 3 )== 0:
soma = soma + n
cont = cont + 1 #a cada vez que ele achar um número divisor de três com o resto de 0, ele somará com +1
print('Os m... | true |
80875b8051810660affe731cf3cdcbbb8783d8bd | CarlosWillian/python | /exercicios/ex 011 a 020/ex017.py | UTF-8 | 376 | 3.59375 | 4 | [
"MIT"
] | permissive | #a = float(input('Digite o valor do cateto a: '))
#b = float(input('Digite o valor do cateto b: '))
#print('O valor da hipotenusa h vale {}'.format(((a**2)+(b**2))**(1/2)))
import math
a = float(input('Digite o valor do cateto a: '))
b = float(input('Digite o valor do cateto b: '))
print('O valor da hipotenusa h vale ... | true |
8d835be60c203350b8d8483f4713c02e21d5a6e8 | 20ChaituR/LSHacks | /src/generateProb/AlgebraGenerator.py | UTF-8 | 3,166 | 3.453125 | 3 | [] | no_license | import random
import math
def generateQuad():
[a, b, c] = [random.randint(1, 3), random.randint(1, 20), random.randint(1, 20)]
temp = []
temp.append(str(a) + "x^2 + " + str(b) + "x + " + str(c) + " = 0")
if (math.pow(b,2) - 4*a*c < 0):
temp.append("none")
answer1 = (-b + math.sqrt(math.pow(... | true |
fccdc4a8a4bfb9e27104e27e8dd76dda1c99ea5a | jaymzcd/pyacollab | /activecollab/library.py | UTF-8 | 3,699 | 2.828125 | 3 | [] | no_license | import urllib
import re
from xml.dom.minidom import parse
from activecollab.settings import API_KEY, AC_URL
from activecollab.constants import *
from activecollab.exceptions import ACCommandException
class ACRequest(object):
""" Makes a request to your Active Collab site and executes
commands with a given ... | true |
776ee3b81f3bf89cdd75911c3e210f8eeb8883e3 | faizanzafar40/Driving-Assistance-App | /LDmodule.py | UTF-8 | 8,171 | 2.984375 | 3 | [] | no_license | import numpy as np
import cv2
from matplotlib import pyplot as plt
ANCHOR_THRESH = 14
SCAN_INTERVAL = 5
HORIZONTAL = 0
VERTICAL = 90
EDGE = 255
def getSobelX(image):
sobelx = cv2.Sobel(image, cv2.CV_64F, 1, 0, ksize=3)
return sobelx
def getSobelY(image):
sobely = cv2.Sobel(image, cv2.CV_64F, 0, 1, ksize=... | true |
7db33dab4a817c242e458e148eef23e9240feb98 | richardqlin/flask_project | /flask_project.py | UTF-8 | 1,272 | 2.609375 | 3 | [] | no_license | from flask import Flask
import os
app =Flask(__name__)
from flask import Flask, request, render_template
import urllib2, json
app = Flask(__name__)
@app.route('/')
def location():
return render_template('location.html')
@app.route('/weather', methods=['POST',"GET"])
def weather():
if request.method=='POS... | true |
86a507baa4b592d53b6bdc307c5e06f57d5a9648 | ymli1997/deeplearning-notes | /opencv-learning/python/misc/06-skin-beauty.py | UTF-8 | 966 | 3.015625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
'''
美肤-磨皮算法
Dest =(Src * (100 - Opacity) + (Src + 2 * GuassBlur(EPFFilter(Src) - Src + 128) - 256) * Opacity) /100 ;
'''
import cv2
import numpy as np
def beauty_face(img):
dst = np.zeros_like(img)
#int value1 = 3, value2 = 1; 磨皮程度与细节程度的确定
v1 = 3
v2 = 1
dx = v1 * 5 # 双边滤波参数之... | true |
82e6fa9c605bdf8f00a3cc157c834b3943ffa99f | rjurney/Agile_Data_Code_2 | /ch02/groupby.py | UTF-8 | 677 | 3.390625 | 3 | [
"MIT"
] | permissive | csv_lines = sc.textFile("data/example.csv")
# Turn the CSV lines into objects
def csv_to_record(line):
parts = line.split(",")
record = {
"name": parts[0],
"company": parts[1],
"title": parts[2]
}
return record
# Apply the function to every record
records = csv_lines.map(csv_to_record)
# Inspect ... | true |
3ec508c6688273af0a4e97c491b6b06c0622c180 | ultrafunkamsterdam/googletranslate | /googletranslate/__init__.py | UTF-8 | 11,072 | 2.765625 | 3 | [] | no_license | """
████████╗██████╗ █████╗ ███╗ ██╗███████╗██╗ █████╗ ████████╗███████╗
╚══██╔══╝██╔══██╗██╔══██╗████╗ ██║██╔════╝██║ ██╔══██╗╚══██╔══╝██╔════╝
██║ ██████╔╝███████║██╔██╗ ██║███████╗██║ ███████║ ██║ █████╗
██║ ██╔══██╗██╔══██║██║╚██╗██║╚════██║██║ ██╔══██║ ██║ ██╔══╝
██║... | true |
3f30bee1f6aefe55affca01759f2db2c5b9d534f | NagiReddyPadala/python_programs | /Python_Scripting/Pycharm_projects/Test_Scripts/FirstTest.py | UTF-8 | 1,218 | 2.640625 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import unittest
import HtmlTestRunner
#import time
class GoogleSearch(unittest.TestCase):
@classmethod
def setUpClass(cls):
print("Test started")
cls.driver = webdriver.Chrome("E:\Promethean\Python_Scripting\Pycharm_... | true |
6bdba9bf2a982a00cfe32b0da69326d12a1cedf4 | juvelop17/problem_solving | /BOJ/!14500_2.py | UTF-8 | 1,557 | 2.8125 | 3 | [] | no_license | import sys
import time
ptime = time.time_ns()
sys.stdin = open('input.txt', 'r')
#####################################################
di = [-1,1,0,0]
dj = [0,0,-1,1]
N, M = map(int,input().split())
mp = [list(map(int,input().split())) for _ in range(N)]
visited = [[0 for _ in range(M)] for _ in range(N)]
max_re... | true |
d4e4ce9a708905c66eb12b304b0369b80ca37289 | IanPaulDaniels/Python_CrashCourseBook | /c10 - Files and Exceptions/1003_guest.py | UTF-8 | 157 | 3.234375 | 3 | [] | no_license | filename = 'Chapter10/guests.txt'
guest_name = input('Please enter your name: ')
with open(filename, 'w') as file_object:
file_object.write(guest_name) | true |
4dac387659b9016a7c5ab634afa37a402c316798 | micahlagrange/GroceryQuest | /levels.py | UTF-8 | 8,188 | 2.9375 | 3 | [] | no_license | __author__ = "multivoxmuse"
import random
import os
import logging
import pygame
import characters
import items
import entities
import constants as con
def parse_pos(pos):
tile = con.GAME_CONSTANTS["TILE"]
x, y = pos
ox, oy = con.DISPLAY["VIEWFRAME_OFFSET"]
# Adjust for tile size
x = x * tile
... | true |
9868eba46869576598827562ccc256bfd7a73db4 | burakbudanur/dnsbox | /python/dnsstats.py | UTF-8 | 7,007 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""Produces plots of statistics of a run.
Figures are saved in a seperate directory within the run directory, and by
default they are shown.
"""
import argparse
from pathlib import Path
from sys import argv
import numpy as np
from matplotlib import pyplot as plt
import dns
def main():
p... | true |
ea5c45a9a0bbf01a4f55d6e7e8c134feaa4dc0c7 | 123123123nhc/IBI-group-project-group-2- | /Code/Task 1.py | UTF-8 | 371 | 3.109375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 23 20:20:34 2020
@author: DM
"""
def CG_content_calculator(seq):
counterCG = 0
for i in range(0,len(seq)):
if seq[i] == 'C' or seq[i] == 'G':
counterCG = counterCG + 1
CG_content = counterCG/len(seq)
print ('%.2f%%' % (CG_conte... | true |
02d0603b6db00a42b7282d8e3deda89742809ab8 | cat4er/geeklearning | /algopython/Lesson5/task1.py | UTF-8 | 2,505 | 4.03125 | 4 | [] | no_license | # Пользователь вводит данные о количестве предприятий, их наименования и прибыль за 4 квартала
# (т.е. 4 числа) для каждого предприятия. Программа должна определить среднюю прибыль
# (за год для всех предприятий) и отдельно вывести наименования предприятий, чья прибыль выше среднего и ниже среднего.
from collections ... | true |
f0ec28a7934bd8c2ffb469be63b2e09c6c70f2d3 | crflynn/stochastic | /stochastic/processes/noise/fractional_gaussian_noise.py | UTF-8 | 6,129 | 3.15625 | 3 | [
"MIT"
] | permissive | """Fractional Gaussian noise."""
from functools import lru_cache
import numpy as np
from stochastic.processes.base import BaseTimeProcess
from stochastic.utils.validation import check_positive_integer
def _fgn_autocovariance(hurst, n):
"""Autocovariance function for fGn."""
ns_2h = np.arange(n + 1) ** (2 * ... | true |
a5304b35e095e37534ad255f0981573a7ce9f966 | Hansung-Lee/SSAFY | /algorithm/ssafy_190320/예제2_진수변환.py | UTF-8 | 433 | 2.90625 | 3 | [] | no_license | msg = input()
li = []
for m in msg:
temp = ''
try:
n = int(m)
except:
n = ord(m)-55
for i in range(4):
temp += str(n%2)
n //= 2
li.extend(list(map(int, temp[::-1])))
result = []
for i in range(0,len(li),7):
temp = li[i:i+7]
temp_result = 0
for j in ra... | true |
07184d12e32e293ae9609a10335ffbbb53bacc16 | perfect-python/perfect-python | /part2/chapter08/typing_anystr.py | UTF-8 | 218 | 2.828125 | 3 | [] | no_license | from typing import AnyStr
def concat(a: AnyStr, b: AnyStr) -> AnyStr:
return a + b
if __name__ == '__main__':
concat(b'abc', b'def')
concat('abc', 'def')
concat('abc', b'def')
concat(123, 456)
| true |
830a399fecaa89bfe9cf4ee13c086b5250638584 | AdrianViverosL/CodeSignal_Exercises | /arrayChange.py | UTF-8 | 402 | 3.171875 | 3 | [] | no_license | def arrayChange(inputArray):
print(len(inputArray))
moves = 0
for i in range(len(inputArray)-1):
if(inputArray[i]>=inputArray[i+1]):
#inputArray[i+1]+=(inputArray[i] - inputArray[i+1])+1
m = (inputArray[i] - inputArray[i+1])+1
inputArray[i+1]+=m
m... | true |
4308ed7c58e2aa9a3779d609723063ab1e17e2e8 | Sumit05Tanwar/Password-Generator | /Project1.py | UTF-8 | 584 | 3.90625 | 4 | [] | no_license | import string
import random
if __name__ =="__main__":
# Lower Alphabet
s1 = string.ascii_lowercase
# Upper Alphabet
s2 = string.ascii_uppercase
# Number
s3 = string.digits
#Puctuation
s4 = string.punctuation
# Taking lenght of password
lenght_letter = int(input("Lenght of pass... | true |
18a2235178a9ba8b2aaf18579be4742ae73ba434 | aguytech/graphm | /benchmarks.py | UTF-8 | 6,679 | 2.59375 | 3 | [] | no_license | import datetime
import graphm
MatrixBinary = graphm.MatrixBinary
MatrixBoolean = graphm.MatrixBoolean
Factor = graphm.Factor
"""
binary closures
level = 4
for n in range(20,320,20):
m = MatrixBinary(random=(n,n), level=level)
t1 = datetime.datetime.now()
closure = m.closure_matrix(full=True)
t2 = datetime.datetim... | true |
b6d9ce40b8758af2fcf2963c11ff230dc451cd52 | jlong5795/Sprint-Challenge--Algorithms | /recursive_count_th/count_th.py | UTF-8 | 888 | 4.28125 | 4 | [] | no_license | '''
Your function should take in a single parameter (a string `word`)
Your function should return a count of how many occurences of ***"th"*** occur within `word`. Case matters.
Your function must utilize recursion. It cannot contain any loops.
'''
def count_th(word):
count = 0
# we can only evaluate if ... | true |
6fdca2c1a8e1767be7afdc2747144a700afe37e1 | NeoIsALie/ht-poker-remaster | /evaluator/validator.py | UTF-8 | 1,736 | 3.453125 | 3 | [] | no_license | import re
from textwrap import wrap
class Validator:
def __init__(self):
self.LENGTH_MAP = {
'texas-holdem': [5, 2, 4],
'omaha5': [5, 5, 10],
'five-card-draw': [5, 5, 10]
}
def validate_hands(self, game_type, hands):
for i in hands:
if l... | true |
9f76d791a7e6c83b9284207d0216f08d1f0a4fa5 | smith-megan/pythonintro | /roll_dice.py | UTF-8 | 238 | 3.828125 | 4 | [] | no_license | import random
roll=random.randint(1,6)
# print("the computer rolled a "+str(roll))
guess=int(input('guess the dice roll:\n'))
if guess == roll:
print("correct! They rolled a "+str(roll))
else:
print("wrong, they rolled a "+str(roll)) | true |
eb12307dc45c951e19c8962b9761d5b924a56d3a | Deepakgarg2309/All_Program_helper | /Python/rockPaperScissor.py | UTF-8 | 2,791 | 4.09375 | 4 | [
"MIT"
] | permissive | '''
This is a Rock Sicssor Paper Game on Command Line in Python
This is a single player Game (i.e. one player at time the opponent is computer whose choice is totally random )
'''
import random
score=0
compScore=0
Turns=0
draw=0
while True:
try:
print(
"""
Your Option are(type number which... | true |
e6a2007957b6b1f8ae658306e1ef93a1f9909e03 | denji/assert-nginx | /assert_nginx/asserts.py | UTF-8 | 1,091 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive |
def assert_http2(_file, stmt):
"assert ssl with http2, return True if it's a SSL server."
if stmt['directive'] == 'listen':
port = int(stmt['args'][0].split(':')[-1])
if port == 443:
assert 'http2' in stmt['args'], \
"HTTP/2 everywhere : %s #%i" % (_file, stmt['line'... | true |
8d4b94dbf92e0878f853b0e1d6d14ee14e450669 | mistotebe/dotfiles | /common/bin/git-update | UTF-8 | 1,655 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
import pygit2
def get_checkout_for_branch(repo, branch):
for name in repo.list_worktrees():
worktree = repo.lookup_worktree(name)
subrepo = pygit2.repository.Repository(worktree.path)
if branch.name == subrepo.head.name:
return worktree.path
... | true |
2807980fd0e41d18df9c30e348831d3bf3137607 | wellqin/USTC | /leetcode/editor/cn/[698]划分为k个相等的子集.py | UTF-8 | 2,389 | 3.671875 | 4 | [] | no_license | #给定一个整数数组 nums 和一个正整数 k,找出是否有可能把这个数组分成 k 个非空子集,其总和都相等。
#
# 示例 1:
#
#
#输入: nums = [4, 3, 2, 3, 5, 2, 1], k = 4
#输出: True
#说明: 有可能将其分成 4 个子集(5),(1,4),(2,3),(2,3)等于总和。
#
#
#
# 注意:
#
#
# 1 <= k <= len(nums) <= 16
# 0 < nums[i] < 10000
#
# Related Topics 递归 动态规划
"""
总体思路就是不停的去凑够这个平均值,凑够一个减1,只要平均值为整数,凑到最后一个的时候所有未使... | true |
25ee126048dd111bb0157c0f735494582e9532ed | sky-bro/the-cryptopals-crypto-challenges | /Set 2: Block crypto/Challenge 015: PKCS#7 padding validation/sol-02-15.py | UTF-8 | 576 | 3.25 | 3 | [] | no_license | import sys
def has_valid_padding(s): # s in bytes
if not s:
return False
pad_len = s[-1]
if pad_len > len(s):
return False
for i in range(len(s) - pad_len, len(s)):
if s[i] != pad_len:
return False
return True
def strip_padding(s):
return s[:-s[-1]]
de... | true |
e4621f06299243aebfd5c43095eb7ccf2d9e63ef | choi-jun-yong/swcontest | /mecab.py | UTF-8 | 1,628 | 2.546875 | 3 | [] | no_license | import pandas as pd
from collections import Counter
import re
from PyKomoran import *
from konlpy.tag import *
from konlpy.tag import Mecab
import pandas as pd
import os
#f = open('C:\\Users\\Desktop\\텍스트데이터.txt', "r")
#lines = f.read()
list_company = pd.read_excel('C:\\Users\\User\\Desktop\\기업명.xlsx', index_col =... | true |
faa07c923665e86fc8db5529c3f5adb549b03deb | arnabs542/Data-Structures-And-Algorithms | /Dynamic Programming/Distinct Subsequences.py | UTF-8 | 1,907 | 4.09375 | 4 | [] | no_license | """
Distinct Subsequences
Problem Description
Given two sequences A and B, count number of unique ways in sequence A, to form a subsequence that is identical to the sequence B.
Subsequence : A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the chara... | true |
61eb92ef7e2d93e6f4fcda2affc33c3c65135bb3 | Python3pkg/GenIce | /genice/molecules/tip3p.py | UTF-8 | 319 | 2.515625 | 3 | [] | no_license | import math
import numpy as np
oh = 0.09572
hangle = 104.52 * math.pi / 180 / 2
mass=18
ohz = oh * math.cos(hangle)
ohy = oh * math.sin(hangle)
oz = -ohz*2/mass
sites = np.array([[0, 0,oz],
[0, ohy,ohz+oz],
[0,-ohy,ohz+oz]]) # nm, OHHM
labels = ["OW","HW1","HW2"]
name = "SOL"
| true |
7b6206adc9f85cb2bd16c974b303139ad9fd4ed1 | Light-Reflection/uninas | /uninas/training/metrics/accuracy.py | UTF-8 | 2,734 | 2.734375 | 3 | [
"MIT"
] | permissive | """
metrics to measure an individual network's performance during training
to be used by lightning models to extend tqdm dictionaries
"""
import torch
from uninas.networks.abstract import AbstractNetwork
from uninas.training.metrics.abstract import AbstractMetric
from uninas.utils.args import Argument, Namespace
from... | true |
fe9f3d454a9603510a851fad453491ca732b18bd | Kanhaiya54/gradient_descent_from_scratch | /gradient_descent.py | UTF-8 | 1,148 | 3.4375 | 3 | [] | no_license | import numpy as np
import pandas as pd
def gradient_descent(x,y):
m_curr = b_curr = 0
iterations = 1000
n=len(x)
lr = 0.08
for i in range(iterations):
y_predicted = m_curr*x+b_curr
cost_function = (1/n)*sum([val**2 for val in (y-y_predicted)])
md = -(2/n... | true |
c3e85fb0622f5def54beabd0a73c47caf08c6a17 | davidiwu/tf2.0 | /application/mnist_advanced.py | UTF-8 | 3,721 | 3.21875 | 3 | [] | no_license | import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import Dense, Conv2D, Flatten
from tensorflow.keras import Model
def print_data_shape_type(name, data):
if isinstance(data, list):
for index, item in enumerate(data):
print(f'{name} {index} shape: {item.shape}, type is :{... | true |
40f1c7dcc2a9a8b28332ccf394b98aac066c073a | lablup/backend.ai-kernel-runner | /src/ai/backend/kernel/python/drawing/color.py | UTF-8 | 1,548 | 2.921875 | 3 | [
"MIT"
] | permissive | import enum
import struct
rgba = struct.Struct('BBBB')
class Color:
def __init__(self, red, green, blue, alpha=255):
self.red = red
self.green = green
self.blue = blue
self.alpha = alpha
@staticmethod
def from_hex(value):
value = value.replace('#', '')
r ... | true |
cca3dacc6d747d0763f3fe3d515daff4d07b5f92 | wucy/pythonhomework | /chap10/10-3.py | UTF-8 | 204 | 3.515625 | 4 | [] | no_license | #!/usr/bin/env python
def acc_sum(num_list):
ret = []
prev = 0
for i in range(len(num_list)):
prev += num_list[i]
ret.append(prev)
return ret
print(acc_sum([1, 2, 3]))
| true |
9f6cb85fa8bac3387e94ef061751ddc1d5911372 | martinsutherland1/gym_booking_system_project | /tests/member_test.py | UTF-8 | 327 | 2.96875 | 3 | [] | no_license | import unittest
from models.member import Member
class TestMember(unittest.TestCase):
def setUp(self):
self.member = Member("Martin Sutherland", 30)
def test_member_has_name(self):
self.assertEqual("Martin Sutherland", self.member.name)
def test_member_has_age(self):
self.ass... | true |
7a2ac0d2d67d10c49b5f02bd18ed1718c43b68e9 | ankitapasad/speech | /speech/loader.py | UTF-8 | 5,395 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import numpy as np
import random
import scipy.signal
import torch
import torch.autograd as autograd
import torch.utils.data as tud
from speech.utils import wave
class Preprocessor():
END = "<... | true |
587e840d4b46f493cdfb55cb277deca638209249 | cgregurich/PythonFoodApp | /foodapp/sqlite_demo.py | UTF-8 | 989 | 2.703125 | 3 | [] | no_license | from fooditem import FoodItem
import sqlite3
conn = sqlite3.connect('fooditem.db')
#oats = FoodItem('oats', 40, 'g', 150, 27, 3, 5, 4, 1)
c = conn.cursor()
c.execute("""CREATE TABLE fooditems (
name text,
ss integer,
unit text,
cal integer,
carb integer,
... | true |
976802b676ba2bed4ad749bc8a215acd521cffb1 | Chirag-07/Sudoku-Game | /sudoku_game.py | UTF-8 | 10,964 | 2.734375 | 3 | [] | no_license | import pygame
pygame.font.init()
class Grid:
# s_board = [
# [3,0,6,5,0,8,4,0,0],
# [5,2,0,0,0,0,0,0,0],
# [0,8,7,0,0,0,0,3,1],
# [0,0,3,0,1,0,0,8,0],
# [9,0,0,8,6,3,0,0,5],
# [0,5,0,0,9,0,6,0,0],
# [1,3,0,0,0,0,2,5,0],
# [0,0,0,0,0,0,0,7,4],
# ... | true |
a844eb0b9f7d08a7fc79f524d9d4148787a08ad3 | kannanmavila/ctci-6th-edition | /2_8_ll_loop_detection.py | UTF-8 | 1,340 | 4 | 4 | [] | no_license | """Q: Given a circular linked list, implement an algorithm that returns
the node at the beginning of the loop."""
from util import test
class Node(object):
"""A node in a linked list."""
def __init__(self, value, next=None):
self.value = value
self.next = next
def loop_node(linked_list):
"""Return the node ... | true |
2ef96ea3fcbeede48a5c624b28dd32609a789ad8 | gbfansheng/StockStatistic | /paotaidixi.py | UTF-8 | 3,996 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import pandas as pd
import pickle
import datetime
import stock
import zhangting
import copy
import xlwt
def dapao():
fengban_dict = zhangting.get_fengban_dict()
now = datetime.datetime.now().date()
df_list = []
fengban_list = []
fengban_acc_list = []
total_code_list = ... | true |
0403426ead3237e3390e6cd95cacf5891b19fbcf | aferreira44/hacking-math-python | /01-introduction-programming/turtle/cross.py | UTF-8 | 224 | 3.5625 | 4 | [] | no_license | from turtle import Turtle, exitonclick
tur = Turtle()
tur.speed("fast")
def cross():
for i in range(4):
tur.fd(100)
tur.lt(90)
tur.fd(100)
tur.rt(90)
tur.fd(100)
tur.rt(90)
cross()
exitonclick() | true |
3c56b4e9fc65c7e32bd0f61f96445d59296954c1 | afshinrahimi/textylon | /textylon/util/test.py | UTF-8 | 1,416 | 2.78125 | 3 | [] | no_license | from scipy import *
from scipy.sparse import *
from scipy.sparse import vstack
a = 'salam hale shoma'
b = ['b', 'b', 'c']
with open('/home/af/asdf.txt', 'w') as f:
f.write(' '.join(a) + '\n')
f.write(' '.join(b) + '\n')
row = array([0, 2, 2, 0, 1, 2, 2])
col = array([0, 0, 1, 2, 2, 2, 3])
data = array([1, 2, ... | true |
b35a9fbc218378d2da581134abeb47923925dbf9 | webxiimao/weimeispider | /downloadspider.py | UTF-8 | 2,004 | 2.671875 | 3 | [] | no_license | # -*- coding:utf8 -*-
# write by xiimao
import requests
import os
from queue import Queue
from dbqueue import create_connect
from threading import Thread
from multiprocessing import Process
from Download import request
class Spider():
'''
先写多线程
'''
def __init__(self):
# 连接数据库
self.db =... | true |
81b251bcaeb95d440e3f198396753e32b29d6430 | yuanwyuan/wyy-python | /Fibonacci/fibo_generator.py | UTF-8 | 712 | 4.28125 | 4 | [] | no_license | #-*- coding:utf-8 -*-
'''
用生成器实现斐波那契前n项数列
'''
def fib_generator(n):
num1,num2=0,1
try: #异常值检测
while n>0:
yield num1
num1,num2=num2,num1+num2
except StopIteration:
pass
while True:
terms=input("请输入项数:")
if not terms.isdigit(): #判断输入是否符合要求
... | true |
69feb2e249de91aca0a27f46d41989ca477f9b1b | Tasty-Programmer/Python_2021_start | /Jeju_Coding_Base_Code_Festival_Python/Jeju_Coding_Q8.py | UTF-8 | 466 | 3.828125 | 4 | [] | no_license | #문제 8 : 딕셔너리 키 이름 중복
'''
딕셔너리를 다음과 같이 만들었다.
출력값을 입력 하시오. (출력값은 공백을 넣지 않습니다.)
d = {'height': 180, 'weight' : 78 , 'weight' : 84 ,' temparture' : 36 ,'eyesight' : 1}
print(d['weight'])
'''
d = {'height': 180, 'weight' : 78 , 'weight' : 84 ,' temparture' : 36 ,'eyesight' : 1}
print(d['weight'])
# 딕셔너리는 중복되면 마지막에 쓰인 값을... | true |
84f8ff2970536c9807cf9d370487181974c867f3 | mforbes/nbdiff | /nbdiff/merge.py | UTF-8 | 6,964 | 3.078125 | 3 | [
"MIT"
] | permissive | from . import diff
from . import comparable
from .notebook_diff import (
diff_result_to_cell,
)
import IPython.nbformat.current as nbformat
import itertools as it
import copy
def merge(local, base, remote, check_modified=False):
"""Generate unmerged series of changes (including conflicts).
By diffing the... | true |
87fd86938c50cf20b5c04a62765d1506d524e97a | vbhatt-cs/inference-based-messaging | /signaling-games/algs/model_agents/model_s.py | UTF-8 | 9,750 | 2.625 | 3 | [
"MIT"
] | permissive | import numpy as np
from ... import utils
from ..base import BaseAlg
class ModelS(BaseAlg):
"""
The receiver learns a model of the sender and uses it to predict the state given the
message
"""
def __init__(
self,
n_state,
n_mess,
n_act,
n_runs,
alph... | true |
19e225a1ae56fa88586c5a64884b5074497c3cc3 | ritikjain51/PythonProg | /maximum from 3 number.py | UTF-8 | 311 | 4.125 | 4 | [
"MIT"
] | permissive | a=int(input("enter the value of a:"))
b=int(input("enter the value of b:"))
c=int(input("enter the value of c:"))
if(a>b):
if(a>c):
print("a is greater than b and c");
if(b>a):
if(b>c):
print("b is greater than a and c");
if(c>a):
if(c>b):
print("c is greater than b and c");
| true |
aa7d09f15a1691b5d494535e8f7151864405741e | felipeonf/Exercises_Python | /curso_py/ex072.py | UTF-8 | 617 | 3.9375 | 4 | [] | no_license | def fatorial(num,show = True):
fat = 1
if show != True:
for contador in range(num, 0, -1):
fat *= contador
if contador > 1:
print(f'{contador} X',end=' ')
else:
print(f'{contador}',end=' ')
print(f'= {fat}')
else:
... | true |
e6812dba5cb452cf6c445d0745f38bb4078170d7 | UnforeseenOcean/SMETANA | /SMATINY.py | UTF-8 | 1,899 | 3.6875 | 4 | [] | no_license | import sys
import re
# from Jay Cambell's Ruby implementation: https://esolangs.org/wiki/User:JayCampbell/smatiny.rb
def interpret(program_text):
program_lines = program_text.splitlines()
memory = {}
out_str = '' # for print, we both print to the screen and return a string (for testing)
#parse source... | true |
1b82ff6476b5f4d7b0cc80ee2f9d70f28ea65ae4 | JuanCRdrums/ClienteServidor | /client.py | UTF-8 | 324 | 2.671875 | 3 | [] | no_license | import zmq
import json
ctx = zmq.Context()
s = ctx.socket(zmq.REQ)
s.connect("tcp://localhost:5555")
d = {"operacion": "suma", "op1": 100, "op2": 455}
s.send_json(d)
m = s.recv_string()
print("Recibi: {}".format(m))
"""
Tarea:
Hacer un servidor de archivos. Debe soportar subir y descargar archivos de cualquier
tipo
... | true |
d3b83d844df8275e0e2960b622ecdcc590e033f7 | karancoder/Gender-Classification | /gender_classifier/code/new_main.py | UTF-8 | 2,983 | 3.109375 | 3 | [] | no_license | import cv
import cv2
import time
from PIL import Image
import numpy as np
import csv
import logistic
import classifier
import facedetection as f
import mouthdetection as m
WIDTH, HEIGHT = 28, 10 # all mouth images will be resized to the same size
dim = WIDTH * HEIGHT # dimension of feature vector
"""
given an area to... | true |
9aaaa03f39d1082c5b7ec2dbd10f9113d453da03 | kevinsshah/Leetcode | /Arrays/53. Maximum Subarray.py | UTF-8 | 760 | 3.609375 | 4 | [] | no_license | # Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest
# sum and return its sum.
#
# Example:
#
# Input: [-2,1,-3,4,-1,2,1,-5,4],
# Output: 6
# Explanation: [4,-1,2,1] has the largest sum = 6.
# Follow up:
#
# If you have figured out the O(n) solution, try cod... | true |
c9f0e62349f5b4baabcf65b2e2bf5e965741f527 | carl12/InterviewAlgorithmProblems | /pancakeSort.py | UTF-8 | 1,143 | 4.375 | 4 | [] | no_license | '''
Given an array of integers arr:
Write a function flip(arr, k) that reverses the order of the first k
elements in the array arr.
Write a function pancakeSort(arr) that sorts and returns the input array.
You are allowed to use only the function flip you wrote in the first step
in order to make... | true |
42d9cbc217487f1599b47c20538075fe6135e69a | 16kozlowskim/Online-Matching-Algos | /Adwords/benchmark.py | UTF-8 | 2,580 | 2.515625 | 3 | [] | no_license | from scipy.stats import norm
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import pandas as pd
import math
import random as rand
from networkx.algorithms import bipartite
from itertools import groupby
import cvxpy
from adversarial import MSVV
def generate_random_graph(static_set_size, strea... | true |
c1bb46145376605e8017528f3c5fd2c001e8f60c | aadityasahagupta010/Face_Recognition_opencv2 | /test.py | UTF-8 | 19 | 2.59375 | 3 | [] | no_license | a=15
print(a%10)
| true |
4a2744412aea49a7ccc8e50379e069e70f4f6e7a | ufcolemanlab/tracking_VOR_redux2 | /video/batch_vet_1.py | UTF-8 | 10,232 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
File to process video files with previously selected ROIs
Notes:
1) Maybe implement slider
mouse needs to be away from walls for mouse selection
mouse ideally in motion at pause
2) Maybe a "vet mode" that allows you to see tracking for 100 frames each video
... | true |
f59276294cf9d9f8cf294bdf49e3f939367cfb64 | davenquinn/Attitude | /attitude/geom/__init__.py | UTF-8 | 1,578 | 3.09375 | 3 | [
"MIT"
] | permissive | import numpy as N
from .util import dot
from .conics import conic
from .util import angle, vector
from .transform import rotate_2D
def aligned_covariance(fit, type='noise'):
"""
Covariance rescaled so that eigenvectors sum to 1
and rotated into data coordinates from PCA space
"""
cov = fit._covaria... | true |
739277d7f6e5722946744aecdba8340cd1d1a49d | thestrawberryqueen/python | /2_intermediate/chapter10/practice/random_grid.py | UTF-8 | 897 | 4.46875 | 4 | [
"MIT"
] | permissive | """
Random Grid
Create a 2D list with 4 rows and a randomly
determined number of columns. The column
number should be a random EVEN number between
2 and 16 (inclusive).
All the even column numbers (including 0) should
be filled with asterisks (*). The odd numbered
columns should be filled with underscores (_).
Displ... | true |
34da03a612de7441e146c93aac65a1b535343cf9 | silentz/cv_crop_disease | /src/dataset.py | UTF-8 | 2,122 | 2.671875 | 3 | [] | no_license | import numpy as np
import os
import cv2
import pandas as pd
from torch.utils.data import Dataset
from tqdm import tqdm
def load_image(path):
image = cv2.imread(path)
if image is None or len(image.shape) < 2 or image.shape[2] != 3:
image = np.zeros((100, 100, 3))
return image
class ZindiDataset(D... | true |
2b14aea69e94ae2d2f24bfbc5250cf5bd31e36e0 | aidsfintech/Algorithm-and-Query | /PSrecords_python/PSpool/skm/210424migrant/03movealgorithm2.py | UTF-8 | 2,200 | 3.0625 | 3 | [] | no_license | # 이동 알고리즘 2 (easy)
# tcp 1 ; 좌표의 중복을 놓침 -> 딕셔너리 val 을 리스트로 구현
# tcp 2 ; 사람번호를 고려하지 않은 좌표중복해결로 미완; key val 관계에 사람번호 추가
import sys
def move(lenAxis,cur,t,d,f):
# print('#in move', lenAxis,cur,t,d,f)
t *=f
# t %= 2*(lenAxis-1)
# 벽에 부딪히고 다시 돌아오는 패턴이 아니라서 주기가 없다
# integration version of 'd 0~1' and 'd ... | true |
1a6534b9f44172152f63d3db6542cfe99d9907c6 | dolaameng/webdnn | /src/graph_transpiler/webdnn/graph/traverse.py | UTF-8 | 2,937 | 2.640625 | 3 | [
"Zlib",
"MIT"
] | permissive | from typing import Type, List, Set, Iterable, Union, Tuple
from webdnn.graph.attribute import Attribute
from webdnn.graph.graph import Graph
from webdnn.graph.node import Node
from webdnn.graph.operator import Operator
from webdnn.graph.variable import Variable
Query = Union[Type[Attribute], Type[Node]]
def check_m... | true |
01639b886059d907afb5a4cefac4ad2bc21121ad | sriison/python | /dict.py | UTF-8 | 271 | 3.296875 | 3 | [] | no_license | mydist = {'key1':"value1","key2":"value2"}
print(mydist['key1'])
dist = {'k1':100,"k2":200,"k3":300}
print(dist.items())
print(dist.keys())
print(dist.values())
d = {"k1":100,"k":["a","b","c"],"k2":{"n1":7,"n2":14,"n3":21}}
print(d['k'][2].upper())
print(d['k2']["n1"]+7) | true |
6f8ec2b1468353e3233b40b899e7cde5d3555234 | VirtualSpaceman/AudioProject | /project.py | UTF-8 | 10,838 | 2.609375 | 3 | [] | no_license | import numpy as np
import scipy
import matplotlib.pyplot as plt
from scipy.io import wavfile
from scipy.fftpack import dct
from python_speech_features import sigproc
import bob.learn.em as em
from bob.bio.gmm.algorithm import GMM
from sklearn.preprocessing import scale
from sklearn.cluster import KMeans
people = 4
aud... | true |
c90c7b9c8a3a095b581f81c9ae58c9ca35691769 | postazure/Python-Practice | /Ch16pygame.py | UTF-8 | 549 | 2.609375 | 3 | [] | no_license | import pygame, sys, random
from pygameRunning import running
from pygame.color import THECOLORS
pygame.init()
screen = pygame.display.set_mode([640,480])
screen.fill([255,255,255])
for i in range (100):
width = random.randint(0,250)
height = random.randint(0,250)
top = random.randint(0,400)
left = rand... | true |
fff0d999037046fb49110d7eb8ab1f88b752bf16 | mrfernandesv/pynet-tools | /bruteflinuxpass.py | UTF-8 | 1,092 | 2.9375 | 3 | [] | no_license | #!/usr/bin/python
import socket
import sys
import crypt
def help():
print "--------------------------------------------------------"
print "--------------------------------------------------------"
print "-------------PYNET-TOOLS - bruteflinuxpass.py-----------"
print "----------------------------... | true |