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 |
|---|---|---|---|---|---|---|---|---|---|---|
6d560c35a6088596b2cb0098923104f394f60d74 | ahilbers/renewable_test_PSMs | /scripts/main.py | UTF-8 | 4,899 | 3.046875 | 3 | [
"LicenseRef-scancode-proprietary-license",
"MIT"
] | permissive | import os
import warnings
import logging
import json
import psm
def run_model(config: dict, logger: logging.Logger = None):
'''Create and solve a power system model across a time period.
Parameters:
-----------
config: dictionary with model, run and save properties
logger: the logger to use i... | true |
b2c3ded520da77bfe1a89d4f15da590544bb79ed | eborche2/aoc2018 | /day8/Day8.py | UTF-8 | 2,566 | 2.796875 | 3 | [] | no_license | from string import ascii_lowercase
with open('file.in') as f:
content = f.readlines()
content = [x.strip() for x in content]
content = content[0].split()
content = [int(x) for x in content]
def getName(names):
row = 1
while True:
for each in ascii_lowercase:
check = ""
for x... | true |
eaf1c93d7bb6a5d2808a6550f6e60a06fe17cb92 | ruhman/Camada-Fisica | /Projeto5/enlaceTx.py | UTF-8 | 3,583 | 3.203125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#####################################################
# Camada Física da Computação
#Carareto
#17/02/2018
# Camada de Enlace
####################################################
# Importa pacote de tempo
import time
# Threads
import threading
# Class
class TX(object):
... | true |
f4e6f6c2c79e67876f00027f7abb0e9d46b217af | ItManHarry/Python | /PythonCSDN/code/chapter7/ExeSQLScript2.py | UTF-8 | 441 | 2.765625 | 3 | [] | no_license | #connect SQLite3
#1. 打开数据库连接
# SQLite是一个没有后台进程的数据库,磁盘上一个文件就可以对应SQLite数据库
import sqlite3
connection = sqlite3.connect('test.db')
#2. 使用数据库连接对象的executescript方法执行SQL脚本
with open('add_user.sql','r',1,'utf-8') as f:
sql = f.read()
connection.executescript(sql)
#3. 提交事务
connection.commit()
#4. 关闭连接
connection.close(... | true |
7f7c61909901f0c14b00936bc6fc1f1e367ff033 | zilunzhang/Cipher | /cipher/cipher_functions.py | UTF-8 | 14,174 | 4.3125 | 4 | [
"Apache-2.0"
] | permissive | # Functions for running an encryption or decryption algorithm
ENCRYPT = 'e'
DECRYPT = 'd'
# Write your functions after this comment. Do not change the statements above
# this comment. Do not use import, open, input or print statements in the
# code that you submit. Do not use break or continue statements.
def cl... | true |
3d569634516ea179e8366a2c0ba6978d41dfbc36 | Roman-Cernetchi/ICS3U-Unit6-01-Python | /array_list.py | UTF-8 | 596 | 4.1875 | 4 | [] | no_license | #!/usr/bin/env python3
# Created by: Roman Cernetchi
# Created on: January 2021
# This program prints 10 random integers and finds the average
import random
def main():
# input the number and decimal place
# list
random_list = []
# process
for loop_counter in range(0, 10):
# random num... | true |
5450d42e5b5ae20f5f50f5b352b86f1767debb79 | tsarthak/pygame-destination-1 | /src/pygame_commons/pgbase.py | UTF-8 | 984 | 3.21875 | 3 | [] | no_license | import os
import pygame as pg
import logging
# set colors for quick reference
# colors in pygame are RGB tuples
colors = {
'red': (255, 0, 0),
'green': (0, 255, 0),
'blue': (0, 0, 255),
'black': (0, 0, 0),
'white': (255, 255, 255)
}
def set_logo():
# Set a logo
game_logo_path = os.path.j... | true |
4fb9790230be3dc9c9756eee2a25eed6f8b353d5 | edt-yxz-zzd/python3_src | /nn_ns/Bijection/Bijection[20180108].py | UTF-8 | 19,272 | 2.984375 | 3 | [] | no_license |
from fractions import Fraction
from abc import ABCMeta, abstractmethod
class TypeVerifier(metaclass=ABCMeta):
# immutable and hashable
'''
def __str__(self):
return self.get_TypeName()
def __repr__(self):
return '<{!s}>'.format(self.get_TypeName())
'''
# () -> str
@abstra... | true |
63b2dbd2045b8ef38ffac9a6064dd3f0ce319e81 | Kracav4ik/kana | /detectors/__init__.py | UTF-8 | 699 | 2.953125 | 3 | [] | no_license | # encoding: utf-8
from utils import Vec2d
def normalize_vec(v, aabb):
x = aabb.x
y = aabb.y
w = aabb.w
h = aabb.h
return Vec2d((v.x - x)/w, (v.y - y)/h)
def denormalize_vec(v, aabb):
x = aabb.x
y = aabb.y
w = aabb.w
h = aabb.h
return Vec2d(v.x*w + x, v.y*h + y)
def normaliz... | true |
f30845f563fd4328e65967c0f8b844749eda8ba1 | ywang037/delta-ntu-slerp4 | /Face detection/face_det_webcam_dlib.py | UTF-8 | 3,227 | 2.84375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 29 15:15:01 2017
@author: wangyuan
"""
# import necessary APIs
import dlib
import cv2
from timeit import default_timer as timer
import math
import argparse
ap = argparse.ArgumentParser()
ap.add_argument('-r', '--resolution',
default='720p',
... | true |
df76d5f569f6c9f0342086eeaa5d9c67faeb046b | morgante/travelwatch | /old/sample_generator.py | UTF-8 | 549 | 2.765625 | 3 | [] | no_license | import random
import numpy as np
dat=[]
lindist=[]
for i in range(10):
for j in range(i):
lindist.append(i+1)
for i in range(100):
temp=[]
temp.append(i)
for i in range(10):
temp.append(random.randint(1,10))
su=float(np.sum(temp[1:]))
for n in range(1,len(temp)):
t... | true |
f2362b0074b536bb67242c212143f8d0dd54b223 | siyeopyoon/template_ffd | /scripts/vis/meshes.py | UTF-8 | 1,798 | 2.515625 | 3 | [] | no_license | def vis_mesh(model_id, edge_length_threshold, shuffle=False, wireframe=False):
import numpy as np
from mayavi import mlab
from shapenet.core.meshes import get_mesh_dataset
from shapenet.core import cat_desc_to_id
from util3d.mayavi_vis import vis_mesh
from template_ffd.inference.meshes import ge... | true |
0b871288c7bb9a0011c8bfe755874e29a58ab41f | fengyouliang/x-ray | /albu_classification.py | UTF-8 | 3,121 | 2.640625 | 3 | [] | no_license | from urllib.request import urlopen
import os
import os.path as osp
from pathlib import Path
import cv2
import numpy as np
from albumentations import (
CLAHE, RandomRotate90,
Transpose, ShiftScaleRotate, Blur, OpticalDistortion, GridDistortion, HueSaturationValue,
IAAAdditiveGaussianNoise, GaussNoise, Motion... | true |
b645d4793e43f310fc62c4ab91f912f650ddd13b | zoe-stockholm/ClockSimulation-Python | /analog_clock.py | UTF-8 | 5,593 | 3.234375 | 3 | [] | no_license | from graphics import *
import math
class Clock():
def __init__ (self, hour, minute, second):
self.hour=hour
self.minute=minute
self.second=second
self.line_hour = Line(Point(0,0), Point(0,0))
self.line_minute = Line(Point(0,0), Point(0,0))
self.line_second = Line(Poi... | true |
8b5203bc28234d75ec6e8bcbc70774c577a6a9fd | juliawiktoria/planar-flows | /utils/plot.py | UTF-8 | 5,055 | 2.828125 | 3 | [] | no_license | import torch
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats.kde import gaussian_kde
from target_distribution import TargetDistribution
def plot_density(density, xlim=4, ylim=4, ax=None, cmap="Blues"):
x = y = np.linspace(-xlim, xlim, 300)
X, Y = np.meshgrid(x, y)
shape = X.shape
X... | true |
a21bb14f33a74663bbf0e822df1600018575cb26 | Kamuish/Yee-algorithm-3D-field | /yee_testbench.py | UTF-8 | 9,432 | 2.671875 | 3 | [] | no_license | #############################################################
# Author:
#This script works as a testing environment for the class yee.
#We will study the effects of changes of different phisical
#conditions (different permitivities and placement/types of
#sources)
#
###################################################... | true |
16c86dfbdecba2511635747492c1c29fa1713e90 | snugfox/finfast | /finfast/analyze/indicators/trend.py | UTF-8 | 3,956 | 3.25 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import numba
import numpy as np
@numba.njit(fastmath=True)
def sma_host(x: np.ndarray, period: int) -> np.ndarray:
last_out = np.mean(x[:period])
out = np.empty_like(x)
out[: period - 1] = np.nan
out[period - 1] = last_out
for idx in range(period, out.shape[0]):
last_out += (x[idx] - x[id... | true |
d78a50e329249fcbb3563ebdf7ac8cec3bd03db6 | Manodhayan/RaspberryPi-Stuffs | /Opencv_tasks-Rpi/Edge Detection.py | UTF-8 | 545 | 2.765625 | 3 | [] | no_license | import cv2
from matplotlib import pyplot as plt,colors
img = cv2.imread('car.jpg')
matplot_imag=cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
cv2.imshow("Origninal Image",img)
print("Image Displayed")
#cv2.waitKey(0);
edges = cv2.Canny(img,100,200)
cv2.imshow("Edge Detected Image", edges)
cv2.waitKey(0);
cv2.DestroyAllWindow... | true |
d569de5f263d747c572458de9a10615b05c91498 | WebProject-STT/Algorithm | /prev/baekjoon/7주차/14888/14888_sb.py | UTF-8 | 1,197 | 3.109375 | 3 | [] | no_license | # 연산자 끼워넣기
import sys
def find_sum(cur, result) :
global max_sum, min_sum
if cur == n - 1:
max_sum = max(max_sum, result)
min_sum = min(min_sum, result)
return
for i in range(4) :
if operators[i] > 0 :
tmp = result
if i == 0 : # 덧셈
res... | true |
42d2a5c6f2f34af0eda4f9032729cb41a982a854 | Z9629/test | /2019520/socket/client_socket.py | UTF-8 | 614 | 3.078125 | 3 | [] | no_license | # import socket
# #创建实例,初始化
# client = socket.socket()
# #定义绑定IP和端口
# ip_port = ('127.0.0.1',8888)
# #连接主机
# client.connect(ip_port)
# #接受主机信息
# data = client.recv(1024)
#
# print(data.decode())
#
import socket
ip_port = ("127.0.0.1", 8888)
sk = socket.socket() #创建socket实例
sk.connect(ip_port) #链接服务端
while True:
... | true |
a817949017ac0638a069c9a81df2abf23084307d | aascode/ExercisePoseAnalysis | /evaluation.py | UTF-8 | 4,113 | 3.046875 | 3 | [] | no_license | import argparse
from pose_parser import parse_file
import pose
import numpy as np
import math
from scipy.signal import medfilt
parser = argparse.ArgumentParser()
parser.add_argument('--video', action='store',
dest='video',
help='Give video path')
parser.add_argument('--exercise', action... | true |
9dfd598192dd1dfe259a942295655453b6bbfce3 | rlsharpton/crash | /greeter.py | UTF-8 | 325 | 4.15625 | 4 | [] | no_license | def greet_user(message):
"""Display a simple greeting."""
print(f"hello {message}")
message = input("please enter a name: ")
greet_user(message)
def fav_book(title):
"""Prints user's favorite book."""
print(f"Your favorite book is {title}")
book = input("Please tell me your favorite book.")
fav_book(... | true |
a9db0de930c2f88538e2bb3ed83cacacb861f097 | NathanYee/GeneFinder | /gene_finder.py | UTF-8 | 7,016 | 3.640625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
gene_finder parses dna codons. Currently uses a single string as argument.
@author: Nathan Yee
"""
import random
from amino_acids import aa, codons, aa_table # you may find these useful
from load import load_seq
import time
def shuffle_string(s):
"""Shuffles the characters in the ... | true |
284a90906c8da8a7ae82cb6a0a5043f171e9c499 | sergueik/powershell_selenium | /python/beautifulsoup.py | UTF-8 | 2,567 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python3
from __future__ import print_function
import pprint
import time
import sys
from os import getenv, path, access, R_OK
import json, base64
import requests
from bs4 import BeautifulSoup as beautifulsoup
from requests.exceptions import InvalidSchema
# https://github.com/psf/requests/issues/2732
# ht... | true |
9b4ace9d4baa700d12c891d1743e70a871192a89 | shrutikabirje/Day1-Day-2-Python | /day3-p2.py | UTF-8 | 384 | 3.953125 | 4 | [] | no_license | From a list containing ints, strings and floats, make three lists to store them separately.
l=["shruu","adii",1,2,3.3,5,6.7,"yasu",8.8,"prad"]
a=[]
b=[]
c=[]
for i in l:
if(type(i))==int:
a.append(i)
if(type(i))==str:
b.append(i)
if(type(i))==float:
c.append(i)
print("list of integ... | true |
75d31484d5a593ff31581984868b9d8c8415f325 | Surendargovind/python | /Corona.py | UTF-8 | 2,829 | 3.234375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
def check(prompt):
while True:
value = input(prompt).upper()
if value == "YES" or value == "NO":
break
else:
print("Please enter either YES or NO")
continue
return value
def ag(prompt):
... | true |
f799b46f55cbe0abcd38157968bfc3814d01e1b7 | SeavantUUz/LC_learning | /atoi.py | UTF-8 | 787 | 3.0625 | 3 | [] | no_license | # coding: utf-8
__author__ = 'AprocySanae'
__date__ = '15/6/13'
def atoi(str):
size = len(str)
i = 0
while i < size and str[i] == ' ':
i += 1
if i == size:
return 0
if str[i] == '-':
sign = -1
i += 1
elif str[i] == '+':
sign = 1
i += 1
elif st... | true |
31074147e5d322e50041369d7cffce3ac3156bfa | Fantastic-pro/The-game | /Game.py | UTF-8 | 13,984 | 2.875 | 3 | [] | no_license | import Menu
bypass_pep8 = Menu
def main(): # Основная функция
import random
import pygame
import Menu
from Constants import WIDTH, HEIGHT, WHITE, BLACK, GREEN, \
BLUE, BOT_LEVEL
import Cut_of_sprites
pygame.init()
pygame.display.set_caption('DEhorses')
pygame.mixer.init()
... | true |
a62d14d8968b77dbc92ac1022d48186d24d8275d | chicory-gyj/JustDoDo | /py_test/10no_t/heap.py | UTF-8 | 242 | 3.140625 | 3 | [] | no_license | #!/usr/bin/python
from heapq import *
from random import shuffle
date=range(10)
#shuffle(date)
heap=[]
for n in date:
heappush(heap,n)
print heap
heappush(heap,0.5)
print heap
print heappop(heap)
print heap
print heappop(heap)
print heap
| true |
09e3679b3982d5f757a65bc89342f1f02b32ecf3 | hamzboy99/TICT-ICT-V1O | /practice exercise/Les 6/Practice_exercise 6.3.py | UTF-8 | 499 | 3.640625 | 4 | [] | no_license | invoer = "5-9-7-1-7-8-3-2-4-8-7-9"
lijst= invoer.split('-')
slijst= lijst.sort()
grootste_getal= max(lijst)
kleinste_getal= min(lijst)
aantal= len(lijst)
som=0
for getallen in lijst:
som= som + int(getallen)
gemiddelde= som / aantal
print('Gesorteerde list van ints: {}'.format(lijst))
print('Grootste getal: {} en ... | true |
0b37fe36044dec4671fbb5b75447988c846d61b4 | dimitar-daskalov/SoftUni-Courses | /python_advanced/labs_and_homeworks/01_lists_as_stacks_and_queues_exercise/09_key_revolver.py | UTF-8 | 977 | 3.25 | 3 | [] | no_license | from collections import deque
bullet_price = int(input())
gun_barrel_size = int(input())
bullets_stack = [int(bullet) for bullet in input().split()]
locks_queue = deque(int(bullet) for bullet in input().split())
intelligence_bounty = int(input())
is_succeeded = False
current_barrel_size = gun_barrel_size
while bull... | true |
10b60149d0238a5f4dee7c48a03e39fdef715030 | joke404/vscode | /变量的定义与使用.py | UTF-8 | 372 | 3.96875 | 4 | [] | no_license | #组成
#标识:表示对象所存储的内存地址,使用内置函数id(obj)来获取
#类型:表示的是对象的数据类型,使用内置函数type(obj)来获取
#值:表示对象所存储的具体数据,使用print(obj可以)可以将值进行打印输出
name='玛利亚'
print('标识',id(name))
print('类型',type(name))
print('值',name) | true |
165c7c7facf2d9f48978c410b6ae007d6496f491 | happinessbaby/Project_Euler | /power_sum.py | UTF-8 | 308 | 3.90625 | 4 | [] | no_license | #What is the sum of the digits of the number 21000?
def power_sum():
product = 1
for i in range(1, 1001):
product *= 2
return product
def add_digits():
string = str(power_sum())
digits = [int(char) for char in string]
return sum(digits)
print(add_digits())
| true |
5eec3862502d8bc32d9affcef8c0f591e027b55c | gdemmelmaier/gdemmelmaier.github.io | /StrategicGame/delete_opponent.py | UTF-8 | 4,341 | 3.6875 | 4 | [] | no_license | import sequence as s
# Description: Presents all valid deletes and asks the user to delete one
# their opponent's stones. Keeps asking until valid input is given.
def delete_opp_stone(player, board, position):
invalid_moves = []
valid_moves = []
if (player == "W "):
opp_player = "B "
fo... | true |
e3689f48553bd48172e0d63f2625376181c1c41b | balamosh/yandex_contests | /algorithm_training/1.0/02_lection/C/solution.py | UTF-8 | 364 | 3.046875 | 3 | [] | no_license | def FindClosest(seq, x):
closest = seq[0]
dist = abs(x - closest)
for i in range(len(seq) - 1):
new_dist = abs(x - seq[i + 1])
if new_dist < dist:
dist = new_dist
closest = seq[i + 1]
return closest
seq = []
N = int(input())
seq = list(map(int, input().split()))
... | true |
f27af54531a994042cd1e1e2b14e5e4559990e2e | Ashish1323/leetcodesolutions | /1768. Merge Strings Alternately/sol.py | UTF-8 | 564 | 3.5 | 4 | [
"Apache-2.0"
] | permissive | class Solution:
def mergeAlternately(self, word1: str, word2: str) -> str:
len1 = len(word1)
len2 = len(word2)
i = 0
j = 0
newStr = ""
while(len1 and len2):
newStr += word1[i]
newStr += word2[j]
i += 1
j += 1
... | true |
3a32b6ff79a269335d8b5deb564d5d9908387d08 | ulisseslimaa/SOLUTIONS-URI-ONLINE-JUDGE | /Solutions/1178_Preenchimento_de_Vetor_III.py | UTF-8 | 136 | 3.515625 | 4 | [] | no_license | x = float(input())
pos = 0
while(True):
print("N[{}] = {:.4f}".format(pos,x))
x /= 2
pos+=1
if pos == 100:
break | true |
0c2a1b1ba2d439a90c770b8ee0b0170965a34a5a | Max-Eremenko/selenium_project | /test_selenium_select_objects.py | UTF-8 | 4,833 | 3.140625 | 3 | [] | no_license | import unittest
from selenium import webdriver
class TestSelectDays(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Chrome(executable_path='D:\qa\chromedrive\chromedriver')
self.url = self.driver.get('https://www.seleniumeasy.com/test/basic-select-dropdown-demo.html')
def test_s... | true |
9865972b23f39be3537049fb18fc6cdfcdd65ec4 | x1417641995/python_tool | /working_hour_gen.py | UTF-8 | 3,072 | 3.171875 | 3 | [] | no_license | #!/usr/bin/python3
import csv
import time
import datetime
import random
import tkinter as tk
from tkinter.font import Font, nametofont
from screeninfo import get_monitors
time_range = 600
version = 'v0.2'
# new version center_win() without pyQt4!
def center_win (toplevel):
toplevel.attributes("-alpha", 0)
... | true |
fd87a61a8b76e1ac43b8f6569b1fc14695e7a8d9 | joey676/RLBotPack | /RLBotPack/BotimusPrime/source/maneuvers/dribbling/dribble.py | UTF-8 | 1,916 | 2.71875 | 3 | [
"MIT"
] | permissive | from maneuvers.kit import *
from maneuvers.dribbling.catch import Catch
from maneuvers.dribbling.carry import Carry
class Dribble(Maneuver):
def __init__(self, car: Car, info: GameInfo, target: vec3):
super().__init__(car)
self.target = target
self.info = info
#self... | true |
aa2bf2f2cabda051a4ece8aea4ed021b4e6215ac | digant0705/python-code | /day_12_trie.py | UTF-8 | 2,081 | 3.5625 | 4 | [] | no_license | words=["digant","ashita","digree","arushi","arshita","distance","arunabh","ashima","nikhil","shagun","shasha"]
# Implementing a dictionary using trie data structure
_notExist="_notExist"
class Trie:
def __init__(self):
self._trie={}
def insert(self,word):
# this will insert words in the tr... | true |
f0ba57d242c0e39584d922c80f310c0cbc7ab2ab | rvrn2hdp/informatorio2020 | /Desafios1/desafiocondicional3.py | UTF-8 | 286 | 3.203125 | 3 | [] | no_license | hectareas = float(input("Ingrese el tamaño en hectareas: "))
matorral = input("¿Hay matorrales? S-SI | N-NO: ")
compuesto = float(input("Nivel de compuesto en el suelo"))
porcentaje = compuesto * 100 / hectareas
if porcentaje >= 10:
print("Es factible usar fertilizantes.")
| true |
52fcf1b1ec79141ea8357bb674c0dcd27162b74c | afluriach/codeeval | /42-old.py | UTF-8 | 2,544 | 3.4375 | 3 | [] | no_license | import sys
ugly_primes = [2,3,5,7]
def is_ugly(n):
for prime in ugly_primes:
if n % prime == 0:
return True
#end
#end
return False
#end
def tokenize_expr(digits,ops):
#separate into numbers and operators
crnt_num = ord(digits[0]) - ord('0')
tokens = []
#for ea... | true |
70322b668c5b42a6fd9d2c30792080917124af8d | ziGFriedman/A_byte_of_Python | /For.py | UTF-8 | 455 | 4.1875 | 4 | [] | no_license | '''Цикл for'''
for i in range(1,5): #range(1,5,2) даст последовательность чисел от 1 до 5 не включительно, с шагом 2
print(i)
else: # else не обязателен
print('Цикл for закончен') #выполняется всегда один раз, после завершения цикла
print(list(range(1,5))) #list выводит весь диапазон чисел
| true |
850d6686973f7cb95901755045f71e522198e63d | atakanbozkurt/Information-Retrieval-Query-Processing | /src/main.py | UTF-8 | 3,965 | 3.109375 | 3 | [] | no_license | import os.path
import sys
from WeightFunctions import GetTfWeights, NormalizeDocLength
from DictionaryFunctions import BuildDictionary
from QueryProcessing import TokenizeQuery
from PostingsFunctions import GetAllPostings
from DAATFunctions import CosSim
def main():
if len(sys.argv) < 2:
print("Comma... | true |
2a455f5878aa826fbd81768a91d56a984cacf03c | arbaaz100/cold_water | /final_sports.py | UTF-8 | 2,725 | 3.078125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Nov 12 20:38:27 2016
@author: ASUS_PC
"""
#Import Necessary Modules
from bs4 import BeautifulSoup
import urllib
from re import findall
#Open the File which contains the websites
with open('C:/Users\ASUS-PC\Desktop\websites.txt') as w:
web = w.readlines()
#Create a ... | true |
36e6eff28adc08dc02beacb29c2022650dbf4e7a | oktxptxp/BackTest-system | /backtest.py | UTF-8 | 3,892 | 2.578125 | 3 | [] | no_license | import pandas as pd
from WindPy import *
# import time
w.start()
#判断交易当天是否停牌,输出截面未停牌股票list
def judge_suspended(date,susp_days):
un_suspend=susp_days.ix[date,:][susp_days.ix[date,:]==0].index
return un_suspend
#判断前一交易日是否涨停与跌停,返回截面前一交易日未涨停股票和未跌停股票
def judge_limit(date,close_price):
last_close=close_price.... | true |
a0e1d3e8a10df229262b93fa71afa3e7dd2e9eeb | JGay90/ProjectOne | /Project1/utils/web_playground.py | UTF-8 | 846 | 2.65625 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.chrome.webdriver import WebDriver
from time import sleep
from selenium.webdriver.remote.webelement import WebElement
driver: WebDriver = webdriver.Chrome("chromedriver.exe")
try:
driver.get(r"C:\Users\User\PycharmProjects\Project1\FrontEnd\login.html")
sle... | true |
f71b27316b2f55aa769457d77e32a7068c66d611 | mlingle/101-102-labs | /sisters.py | UTF-8 | 524 | 3.875 | 4 | [] | no_license | # Matthew Lingle
# CSCI 102 – Section B
# Week 6 - Lab B - Users
# References: None
# Time: 60 minutes
print("Enter the users separated by commas:")
users=input("USERS>")
users=users.split(",")
for i in range(len(users)):
users[i]=users[i].lower()
print("\nYou entered the following users:")
print(users)... | true |
75d9e4467d5f7b232369274c572d28394d6f702d | jishnujagadeeshpi/OpenGL-Graphics | /ellipse.py | UTF-8 | 2,283 | 3.5 | 4 | [] | no_license |
# Ellipse drawing algorithms
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import sys
import math
def init():
glClearColor(0.0,0.0,0.0,1.0)
gluOrtho2D(-500.0,500.0,-500.0,500.0)
def setpixel(x,y):
glBegin(GL_POINTS)
glVertex2f(x,y)
glEnd()
... | true |
42942d8fb0eb2b76ba55175d2cb51ce631d3c34f | NyangUk/Python | /day10/2490.py | UTF-8 | 141 | 3.03125 | 3 | [] | no_license | s =[]
a = ['D','A','B','C','E']
for i in range(3):
li = list(map(int,input().split()))
s.append(sum(li))
for i in s:
print(a[i])
| true |
a93b5820899d8b434693b359b0190e11c1591fc5 | challengeYY/pythonProject | /testing/test_calc.py | UTF-8 | 3,730 | 3.140625 | 3 | [] | no_license | import pytest
# import yaml
import allure
# from python_code.calc import Calculator
# with open("./datas/calc.yaml") as f:
# datas = yaml.safe_load(f)
# # 加法
# add_datas = datas['add']['datas']
# print(add_datas)
# add_myid = datas['add']['myid']
# print(add_myid)
# # 减法
# sub_datas =... | true |
be91d84f64e63ccc174a30a3b4d9610e748939e1 | mbuhot/mbuhot-euler-solutions | /python/problem-025.py | UTF-8 | 862 | 4.21875 | 4 | [
"MIT"
] | permissive | #! /usr/bin/env python3
import itertools
import math
description = """
Next
1000-digit Fibonacci number
Problem 25
The Fibonacci sequence is defined by the recurrence relation:
Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1.
Hence the first 12 terms will be:
F1 = 1
F2 = 1
F3 = 2
F4 = 3
F5 = 5
F6 = 8
F7 = 13
F8 = 21
F9 =... | true |
fa528fb786af117ccf470101ef20ec81c8695153 | NOAA-PMEL/PyFerret | /pyfermod/stats/stats_rvs.py | UTF-8 | 4,178 | 2.625 | 3 | [
"Unlicense"
] | permissive | """
Returns the array of random variates for a probability distribution
assigned to positions corresponding to defined values in an input array.
"""
from __future__ import print_function
import numpy
import scipy.stats
import pyferret
import pyferret.stats
def ferret_init(id):
"""
Initialization for the sta... | true |
8988421f6d9f25b5f694f929a86021de5b7a61ba | rachmoht/classes-melons | /melons.py | UTF-8 | 4,034 | 3.3125 | 3 | [] | no_license | """This file should have our melon-type classes in it."""
import datetime
current_month = datetime.datetime.now().strftime("%m")
class AbstractOrder(object):
def __init__(self):
"""When users attempt to instantiate from AbstractOrder,
give them an informational error message.
"""
... | true |
249908f45cd00b3f430fb8d5f05810ea26850799 | jiaoxingrong/DevOps | /Python/AWS/Dynamodb_list.py | UTF-8 | 1,011 | 2.546875 | 3 | [] | no_license | #!/bin/env python
#coding: utf-8
import boto3
region_contrast = {'ap-northeast-2': 'Asia Pacific (Seoul)', 'ap-south-1': 'Asia Pacific (Mumbai)', 'sa-east-1': 'South America (Sao Paulo)', 'eu-west-1': 'EU (Ireland)', 'eu-central-1': 'EU (Frankfurt)', 'ap-southeast-1': 'Asia Pacific (Singapore)', 'ap-southeast-2': 'Asi... | true |
e7501c159c632dbd31d98117f76135ed6940dd2a | MiX-PH/instagram-decoder | /decoder.py | UTF-8 | 4,963 | 2.59375 | 3 | [
"CC0-1.0"
] | permissive | import json
import re
import os
from datetime import datetime
print("-------------------------------------------\n")
print("JSON DECODER MADE BY -")
print(" __ __ ___ .--. ")
print(" | |/ `.' `. |__| ")
print(" | .-. .-. '.--. ")
print(" ... | true |
e6f96311c277eb11d6578ec57f12520037c09bd5 | Fisherbeach/H20_project0_johanari | /calculator.py | UTF-8 | 1,336 | 4.15625 | 4 | [] | no_license | #Exercise 1-3
def add(x,y):
return x+y
#Exercise 4.1
def factorial(x):
if type(x)==float:
raise Exception('Float is not valid')
elif x<0:
raise Exception('Factorial of negative not defined')
elif x==0:
return 1
else:
y=1
for i in range(1,x+1):
y*=... | true |
325f9ffeac659dee2fe69e240f75db8cc446d9a3 | aleespa/RandomPlots | /2020/0102.py | UTF-8 | 4,816 | 2.65625 | 3 | [] | no_license | import matplotlib.pylab as plt
import numpy as np
import pandas as pd
from math import cos, sin,log,tan,gamma,pi,exp,sqrt
p = plt.figure(figsize=(12,12),facecolor='black',dpi=400)
p = plt.axis('off')
p = plt.xlim(-1.2,1.2)
p = plt.ylim(-1.2,1.2)
colors = ['#cc0000','#cc0033','#999999','#660000']*500
for p in list(rang... | true |
1bd4022d54ab54afa170f10e57afe9e6a024c610 | dominiika/runningapp-flask-restful | /runningapp/resources/admin.py | UTF-8 | 4,138 | 2.609375 | 3 | [] | no_license | from flask_restful import Resource
from flask import request
from werkzeug.security import generate_password_hash
from flask_jwt_extended import jwt_required, get_jwt_claims
from runningapp.models.user import UserModel, UserProfileModel
from runningapp.schemas.user import UserSchema
user_schema = UserSchema()
class... | true |
f1401b4e3157c8ef127ef68044559067d344bac6 | mszczodrak/paper_experiments | /graphs/graph_counter_duty_cycle.py | UTF-8 | 6,776 | 2.53125 | 3 | [] | no_license | #!/usr/bin/python
# Create graph for rssi vs delivery ratio vs acks
# Author: Marcin K Szczodrak
# Updated: 5/01/2014
import sys
import os
import numpy as np
import json
import operator
from pylab import *
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
from matplotlib.mlab import bivariate_norma... | true |
ff3faaa9651c85ae94fa4991bf5392551810a9d4 | toothless93/emotiv_epoch | /main.py | UTF-8 | 3,834 | 2.6875 | 3 | [] | no_license | import tensorflow as tf
import pandas as pd
from subfunctions import visualization, model_handler, callbacks, data_handler, file_handler, preprocess
from tensorflow.keras.optimizers.schedules import PiecewiseConstantDecay
import gc
gc.enable()
if __name__ == '__main__':
# These folders contain the experimental re... | true |
3e2cbba9ff799b0bcec05d04eaadf2ddf630b270 | motoyama30/morise-asa-1 | /glian/chapter03/07.py | UTF-8 | 364 | 2.859375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
N = 8
x = np.random.randn(N, 1)
c = np.zeros((N, 1), dtype=complex)
for i in range(N):
c[i] = np.sum(x * np.exp(-1j * 2 * np.pi * i * np.arange(N) / N))
X = np.fft.fft(x)
print("error: {}".format(np.sum((c - X) ** 2)))
plt.plot(np.abs(c), label="c")
plt.plot(np... | true |
01021efcd7351f028313c3d713101c8ab7c2c8ce | ShoheiMitani/morphological_analysis_sandbox | /by_janome.py | UTF-8 | 1,653 | 2.609375 | 3 | [] | no_license | import csv
import numpy as np
import pandas as pd
from janome.tokenizer import Tokenizer
from janome.analyzer import Analyzer
from janome.charfilter import *
from janome.tokenfilter import *
from janome_extension import PartsOfSpeechFilter, OneCharTokenFilter, BlackListFilter
all_nouns = np.empty(0)
char_filters = [U... | true |
53f32533ecb819f319fd7b668975b60472576ca9 | tvrctkmytfln/Code-collection | /快代理/kuaidaili.py | UTF-8 | 3,326 | 2.984375 | 3 | [] | no_license | #!/usr/bin/python
# encoding:utf-8
#
# proxy_ip
# func :
# time : 2016.9.15
# author: @`13
#
import json
import urllib
# 快代理订单号:
orderNum = '977384347862623' # 订单号,从网页中获取
class proxy_ip:
"""简单封装'快代理'的API接口"""
def __init__(self):
"""基础信息"""
self.order = '977384347862623' # 订单号,从网页中获取
... | true |
205a874fb72953b50b35c2c99784e7d6b138c570 | gabivoicu/git_profile_api | /app.py | UTF-8 | 2,230 | 2.734375 | 3 | [] | no_license | import requests
from flask import Flask
from flask_restful import reqparse, Resource, Api
from get_bit_bucket_profile_data import GetBitBucketProfileData
from get_git_hub_profile_data import GetGitHubProfileData
from merge_git_profiles import MergeGitProfiles
app = Flask(__name__)
api = Api(app)
class GitProfile(Re... | true |
5b5f6b539af1196b1312d292e399ec89d1340eb5 | mzshieh/2019-nctu-annual | /H/submissions/wrong_answer/wa.py | UTF-8 | 137 | 2.71875 | 3 | [] | no_license | toks = input().split()
n, k = [int(x) for x in toks[:2]]
a = float(toks[-1])
for i in range(1,n):
print(*range(i+1,min(i+k+1,n+1)))
| true |
f510d481fda5eee068b96aa9efd5c3a68d432d73 | ritukhandelwal123/ppl | /python/arcircle.py | UTF-8 | 58 | 3.453125 | 3 | [] | no_license | r=float(input("Enter input:"))
area=3.14*r*r
print(area) | true |
ab9343bb36b96275a36468898565828a7176da00 | tfesenbecker/lapis | /lapis/connection.py | UTF-8 | 8,961 | 2.515625 | 3 | [
"MIT"
] | permissive | import random
from typing import Union, Optional
from usim import Scope, time
from lapis.monitoredpipe import MonitoredPipe
from lapis.cachealgorithm import (
CacheAlgorithm,
check_size,
check_relevance,
delete_oldest_few_used,
)
from lapis.storageelement import StorageElement, RemoteStorage
from lap... | true |
4035c297a462b47839f027e4e20db25d9dbf71f0 | smartshark/travisSHARK | /travisshark/__init__.py | UTF-8 | 684 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | import logging
import logging.config
import os
import json
def setup_logging(default_path=os.path.dirname(os.path.realpath(__file__)) + "/../loggerConfiguration.json",
default_level=logging.INFO):
"""
Setup logging configuration
:param default_path: path to the logger configuration
... | true |
4fa93686fa11ac250ebaed27dadfe1004b9b8f35 | nickmy9729/Smart-Bartender | /drinks.py | UTF-8 | 4,154 | 2.796875 | 3 | [
"MIT"
] | permissive |
drink_list = [{
'name': 'Vesper',
'ingredients': {
'gin': 60,
'vodka': 15.0,
'vermouth': 7.5
},
'steps': [
{ 'pour': ['gin', 'vodka', 'vermouth'] },
... | true |
02ec7c780b3ab8a24d6b1b7e5bc8c4ead1f2aad1 | sooyun429/Algorithm | /Python/DONE/191115_sw4676.py | UTF-8 | 287 | 2.671875 | 3 | [] | no_license | import sys
sys.stdin = open('sw4676.txt', 'r')
for tc in range(1, int(input())+1):
words = ['']+list(input())
L = len(words)
H = int(input())
hyphen = list(map(int, input().split()))
for h in hyphen:
words[h] += '-'
print('#%d %s' % (tc, ''.join(words))) | true |
9df9ca2c9d3cd80f4ee06ee40d8e2f9c68622fe9 | Akashdeep-Patra/problemSolving | /linkedlist/swap in pairs.py | UTF-8 | 1,673 | 4.03125 | 4 | [
"Apache-2.0"
] | permissive | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
import sys
sys.setrecursionlimit(10**7)
class Solution:
# @param A : head node of linked list
# @return the head node in the linked list
def swapPairs(self, root):
if(root==None or root.next==none... | true |
ac37deb375901f95f56626029b3a2455228f575f | nafanyabr/aiohttp-apsrv | /aptasks.py | UTF-8 | 1,356 | 2.71875 | 3 | [
"MIT"
] | permissive | import asyncio
import jsons
from jsons import JsonSerializable
from datetime import datetime
from typing import Dict, Union
class APTask(JsonSerializable):
def __init__(
self,
uid: int,
count: int,
delta: float,
start: float,
interval: float,
date_start=None... | true |
ae045b4e221038cf80d4e9688032de05f90842f2 | avcaliani/pyspark-app | /src/pipeline/play_store.py | UTF-8 | 2,519 | 2.640625 | 3 | [
"MIT"
] | permissive | from os import environ as env
from pyspark.sql import DataFrame, functions as f
from pyspark.sql.session import SparkSession
from util import log, file, mongo
TAG = 'Play Store'
MONGO_DB = env.get('MONGO_DB', 'admin')
MONGO_COLLECTION = 'play-store'
DATALAKE_PATH = env.get('DATALAKE_PATH', '/datalake')
class PlayS... | true |
3ee59fb84b13217f5cb5f1daea007bcf60a8d516 | Kusunoki-19/VoiceChanger | /DataStructures/NumpyRingBaffer.py | UTF-8 | 1,835 | 3.484375 | 3 | [] | no_license | import numpy as np
class NumpyRingBaffer():
front = 0
rear = 0
length = 1
q = np.zeros((1,1))
def __init__(self,length,firstRear,firstFront):
self.length = length
self.q = np.zeros((length,1))
self.front = firstFront
self.rear = firstRear
def printQ(self):
... | true |
0a33f192f25838be19b72e7afb9f1928ab8f85b0 | yeon4032/STUDY | /GIT_NOTE/03_python/chap03_DateStucutre/exams (1)/exam03.py | UTF-8 | 898 | 4.46875 | 4 | [] | no_license | '''
step04, 05 문제
문1) 중복 되지 않은 직위와 각 직위별 빈도수를 출력하시오.
<<출력 결과 >>
중복되지 않은 직위 : ['사장', '과장', '대리', '부장']
각 직위별 빈도수 : {'과장': 2, '부장': 1, '대리': 2, '사장': 1}
'''
position = ['과장', '부장', '대리', '사장', '대리', '과장'] #list
#문제1
#중복되지 않은 직위 : ['사장', '과장', '대리', '부장']
#list->set->list
re=list(set(position))
print('중복되지 않은 직... | true |
a95f8157c9cd60cd05a8ecd3ae39f48b061479cd | jcidras/Coursera | /Week2Assignment2.py | UTF-8 | 188 | 3.59375 | 4 | [] | no_license | # Week 2 Assignment 2
fHours = raw_input("Enter Hours")
fRate = raw_input("Enter Rate")
try:
fPay = (float(fHours) * float(fRate))
except:
print "Please enter numbers"
exit()
print fPay | true |
90cde8f289fc9e827006c6f716d7096326ff8301 | Wsoukkachang/Python | /swap_nodes.py | UTF-8 | 2,092 | 3.78125 | 4 | [
"MIT"
] | permissive | class Node:
"""LinkedListNode class to be used for this problem"""
def __init__(self, data):
self.data = data
self.next = None
"""
:param: head- head of input linked list
:param: `position_one` - indicates position (index) ONE
:param: `position_two` - indicates position (index) TWO
return: head... | true |
ca410738a99690918cb7043556d668c649924fb7 | neilforrest/mediapi | /library.py | UTF-8 | 912 | 2.921875 | 3 | [] | no_license | import os
class Library:
def getGroups ( self, path ):
raise NotImplementedError("Subclasses should implement this function!")
def getItems ( self, path ):
raise NotImplementedError("Subclasses should implement this function!")
class LibraryFilesystem ( Library ):
def __init__ ( self, pat... | true |
0dc079ce3af39a5c3e08fa32177d46675e01241d | apchenstu/surface_regression | /model.py | UTF-8 | 3,609 | 2.6875 | 3 | [] | no_license | import torch
torch.autograd.set_detect_anomaly(True)
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from CustomizedLinear import CustomizedLinear
class NoMap:
def __init__(self):
pass
def map_size(self):
return 6
def map(self, X):
return X
class FFM:
d... | true |
003818762640a5fede4dc1e71396399f45d9d6d6 | nsegen/geneticAlgorithm | /six-humpBackCamel.py | UTF-8 | 3,020 | 3.453125 | 3 | [] | no_license | from random import randint, random, uniform, choice
class Individual:
x1 = 0
x2 = 0
def __init__(self, x1, x2):
self._x1 = x1
self._x2 = x2
@property
def x1(self):
return self._x1
@x1.setter
def x1(self, value):
if -3 <= value <= 3:
self._x1 =... | true |
c9baf12e001596b4532abe216c8a317d34f546ba | RohitNagraj/PythonRansomware | /main.py | UTF-8 | 2,958 | 3.125 | 3 | [
"Apache-2.0"
] | permissive | import os
from os.path import expanduser
from cryptography.fernet import Fernet
class Ransomware:
def __init__(self):
self.key = None # Stores the key used for encryption, then sent to a server
self.cryptor = None # A fernet object to encrypt the files
self.file_ext_targets = ['txt'] #... | true |
ee766d82f37f7c5aa7d5335e4f08d43b8d50442b | brandonboyce3/MachineLearning | /Utilities/LDA.py | UTF-8 | 5,340 | 3.3125 | 3 | [] | no_license | ##########
###
### LDA.py
###
### Goal: Run Principal Component Analysis on an input dataset to reduce dimensionality to an input number of dims
###
### Terminology/algorithm obtained from: http://www.sci.utah.edu/~shireen/pdfs/tutorials/Elhabian_LDA09.pdf
###
### Updates:
### 08-29-2018: Initial creation
###
#####... | true |
a450219c22c2e20821c1a5ed7b7167d03b3a42f2 | AbhAgg/Python-Codes | /classes and objects.py | UTF-8 | 4,195 | 4.15625 | 4 | [] | no_license | '''
class Employee:
'Common base class for all employees'
empCount = 0
def __init__(self, name, salary):
self.name = name
self.salary = salary
Employee.empCount += 1
def displayCount(self):
print ("Total Employee %d" % Employee.empCount)
def displayE... | true |
ecc824e1d641c87954fec440b2ba403778622201 | etemizkol/SORTING | /emirhan_temizkol_sorting_project.py | UTF-8 | 4,185 | 3.375 | 3 | [] | no_license | # Emirhan Temizkol
# Problem
# Bir e-ticaret sitesindeki belirli bir ürünün yorumlarının ve değerlendirmelerinin bulunduğu veriseti bulunmakta
# 1. Amacımız ürünün son zamanlardaki beğeni trendine ağırlık vererek puanını hesaplamak.
# 2. Amacımız akla ve mantığa uygun şekilde bir puanlama sistemi oluşturarak en fay... | true |
7d619f3154b603c3b86a8914b2015bfbde2af39e | clintonbf/Small-Python-projects | /A2/test_generate_syllable.py | UTF-8 | 755 | 3.09375 | 3 | [] | no_license | from unittest import TestCase
import dungeonsanddragons
class TestGenerate_syllable(TestCase):
def test_generate_syllable_first_char_is_consonant(self):
my_syllable = dungeonsanddragons.generate_syllable()
self.assertIn(my_syllable[0], ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p',... | true |
cc224a32740c287edd17d10ef5e47097ff57f6fe | xiangcao/Leetcode | /python_leetcode_2020/Python_Leetcode_2020/605_can_place_flowers.py | UTF-8 | 1,035 | 3.75 | 4 | [] | no_license | """
Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they would compete for water and both would die.
Given a flowerbed (represented as an array containing 0 and 1, where 0 means empty and 1 means not empty), and a number ... | true |
017e2efeee8167159146cce070ff7bba805cb50e | george-oscar/among_us_tasks | /upload_data.py | UTF-8 | 1,330 | 2.875 | 3 | [
"MIT"
] | permissive | # -*- coding:utf-8 -*-
""" This is a task of upload data """
import sys
import pygame
from pygame.locals import QUIT, Rect, KEYDOWN, K_SPACE
WIDTH = 640
HEIGHT = 480
RED = (255, 0, 0)
YELLOW = (255, 255, 0)
pygame.init()
SURFACE = pygame.display.set_mode([WIDTH, HEIGHT])
FPSCLOCK = pygame.time.Clock()
def main():
... | true |
7952631de09e7e81a51b788a799148f42733b5df | WAIRlab/CRADI_x-ray_classification | /src/tuils/loss_function.py | UTF-8 | 3,059 | 2.828125 | 3 | [] | no_license | import torch.nn.functional as F
import torch.nn as nn
import numpy as np
import torch
class FocalLoss(nn.Module):
def __init__(self, gamma=2):
super().__init__()
self.gamma = gamma
def forward(self, input, target):
if not (target.size() == input.size()):
raise Value... | true |
98e04ae03452ebb2741f67c5dcd15be925da0d18 | dasgk/django_cms | /django_cms/app/utility/helps.py | UTF-8 | 1,746 | 2.796875 | 3 | [] | no_license | '''
判断用户是否登陆
'''
from django_cms.models import AdminUser
def is_login(request):
username = request.session.get("username")
password = request.session.get("password")
filters = {}
filters['username'] = username
filters['password'] = password
user = AdminUser.objects.filter(**filters).first(... | true |
37efec254538a40bb6ad442750fde0cd4698ca3e | nguyenduyhieukma/CTF-Writeups | /Isitdtu CTF Quals/2018/xor.py | UTF-8 | 569 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from flag import flag,key
assert len(key) == 10
if len(flag) % len(key) != 0:
n = len(key) - len(flag) % len(key)
for i in range(n):
flag += " "
m = []
for a in range(len(key)):
i = a
for b in range(len(flag)/len(key)):
if b % 2 != 0:
... | true |
0997b852742faa37a096aaaeca56b105885da2be | acl-org/acl-anthology | /bin/add_award.py | UTF-8 | 2,698 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 Matt Post <post@cs.jhu.edu>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | true |
3917487e1fe20f7a35a104ccad8ef5473787398a | vxda7/end-to-end | /test/isits.py | UTF-8 | 269 | 3.4375 | 3 | [] | no_license | def isit(get):
count=0
howlong=get+1
for i in range(1,howlong):
if get%i == 0:
count+=1
if count==2:
print("소수입니다.")
else:
print("소수가 아닙니다.")
get = int(input())
result = isit(get) | true |
342b273f8b6f091539f8d1ad401eebaaff3cd81f | kobeomseok95/codingTest | /dongbinbook/chapter16/36.py | UTF-8 | 466 | 3 | 3 | [] | no_license | # boj.kr/15483
from sys import stdin
READ = lambda : stdin.readline().strip()
a = READ()
b = READ()
n, m = len(a), len(b)
dp = [[0] * (m + 1) for _ in range(n + 1)]
for i in range(1, n+1):
dp[i][0] = i
for j in range(1, m+1):
dp[0][j] = j
for i in range(1, n+1):
for j in range(1, m+1):
if a[i-1] ... | true |
d7c6dbd936c5748c8150dbf33ec44aa1f028fe40 | nullism/pycnic | /examples/full-auth.py | UTF-8 | 3,218 | 2.828125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
from functools import wraps
from pycnic.core import WSGI, Handler
from pycnic.errors import HTTP_401, HTTP_400
# Import our SQLAlchemy stuff
from models import User, UserSession, Session, Base, engine
# Start the :memory: sqlite session
db = Session()
def get_user(request):
""" Lookup a use... | true |
28577416374f86aaf37d2609086f0e98ca2a2a43 | agatajan/Python_training | /DAY_12/exercises/tweeter.py | UTF-8 | 514 | 2.609375 | 3 | [] | no_license | import tweepy
import DAY_12.exercises.tweeter.keys as keys
auth = tweepy.OAuthHandler(keys.consumer_key, keys.consumer_secret)
auth.set_access_token(keys.access_token, keys.access_token_secret)
api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True)
tweets = api.user_timeline(screen_name="Tes... | true |
b55e4c02aa980fe0dfc4ab707af8056201d17f25 | sbobeica/python | /firs_class_function.py | UTF-8 | 1,788 | 4.75 | 5 | [] | no_license | # First class functions allow us to treat functions like any other object, so for example we can pass functions as an
# argument to another function, we can returns functions and we can assign functions to variables
def square(x):
return x * x
def cube(x):
return x * x * x
'''
1. f = square(x) - here the resu... | true |
8d2a7c8e364a21be5340241f83a5ec88f17a9f2c | DReichard/ImageClassifier | /utility_scripts/pgm_io.py | UTF-8 | 1,465 | 3.171875 | 3 | [] | no_license | import cv2
import numpy as np
from numpy import array, int32
def pgmread(filename):
""" This function reads Portable GrayMap (PGM) image files and returns
a numpy array. Image needs to have P2 or P5 header number.
Line1 : MagicNum
Line2 : Width Height
Line3 : Max Gray level
Lines starting with # are ig... | true |
3b1898e2dc752c51cec64695ee7c013f56e5ded4 | zhihao-lin/MakeNTU2019 | /test/camera_test.py | UTF-8 | 754 | 2.515625 | 3 | [
"MIT"
] | permissive | import cv2 as cv
# from imutils.video import VideoStream
def test1():
vs = VideoStream(src=0).start()
while True:
frame = vs.read()
cv.imshow('video', frame)
if cv.waitKey(1) == ord('q'):
break
cv.destroyAllWindows()
vs.stop()
def test2():
cam = cv.VideoCapt... | true |