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 |
|---|---|---|---|---|---|---|---|---|---|---|
7f121724190424a69d08dcddb7c8b303dcf5c82c | spring-cloud/spring-cloud-dataflow-samples | /dataflow-website/recipes/polyglot/polyglot-python-task/util/task_args.py | UTF-8 | 1,587 | 2.609375 | 3 | [] | no_license | import sys
from collections import defaultdict
def get_cmd_arg(name):
"""Extracts argument value by name. (@author: Chris Schaefer)
Assumes the exec (default) spring-cloud-deployer-k8s argument passing mode.
Args:
name: argument name.
Returns:
value of the requested argument.
"""... | true |
faa8efe039939236a4a22dd6b9b45194af26e020 | Dannhz/Arduino-Whatsapp | /Python_Code/WhatsIno.py | UTF-8 | 6,651 | 2.71875 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
import serial
import time
#------------------------VARIÁVEIS GLOBAIS-------------------------------------
#identificação de elementos da página (Para eventuais atualizaçõe... | true |
c4bec2833ec8da4c17d63e21e8dfac684f67bb63 | omerdurmus61/Python | /ikinci dereceden denklem programı.py | UTF-8 | 522 | 3.765625 | 4 | [] | no_license |
a = int(input("a değerini giriniz:"))
b = int(input("b değerini giriniz:"))
c = int(input("c değerini giriniz:"))
delta = b**2 - 4*a*c
if delta > 0:
print("iki farklı Reel kök var")
kok1=b+(delta**(1/2))/2*a
kok2=b-(delta**(1/2))/2*a
print(f"kök1= {kok1:1.2} kök2={kok2:1.2}")
elif delta == 0:
pr... | true |
a6b6d5b660b98273ec98cd034bf12479bfa2e881 | efancher/rack_python2 | /lab06/lab06_decorators.py | UTF-8 | 1,629 | 3.953125 | 4 | [] | no_license | #!/usr/bin/env python
#!*-* coding:utf-8 *-*
"""
:mod:`lab06_decorators` -- Python Decorators
=============================================
LAB06 Learning Objective: Familiarization with function decorators
Decorators are called with an argument of the underlying function. The decorator replaces
the called functio... | true |
b6dde6ef5f78249e508f9a10f3a6686be74ec036 | joeljhanster/40.317-Financial-Systems-Design | /Design_Project/scratch.py | UTF-8 | 59 | 3.09375 | 3 | [] | no_license |
x = [1, 4, 5]
y = ' '.join([str(i) for i in x])
print(y) | true |
2cfba2f9b2198098659bca4c51adeceb61793ec8 | cyll99/pygame | /main.py | UTF-8 | 1,030 | 3.515625 | 4 | [] | no_license | # class Dog(object):
# dogs = []
#
# def __init__(self, name):
# self.name = name
# self.dogs.append(self)
#
# def __str__(self):
# return str(self.name)
#
# @classmethod
# def num_dogs(cls):
# return len(cls.dogs)
#
# @classmethod
# def show_dogs(cls):
# ... | true |
3edfbcc3a3ed6648eb8762454ee489e0f9495d22 | VaruTudor/Gomoku | /gui.py | UTF-8 | 2,983 | 3.3125 | 3 | [] | no_license | from controller import Game
from domain import Board
from computerAlgorithms import AlgorithmSimple
from errors import WrongCoordinates, OutsideBoard, Overwrite
import tkinter
class GUI:
def __init__(self, game):
self.window = tkinter.Tk()
self.window.geometry('510x600')
self.window.title(... | true |
ed5b4ae8aa67bd3813d1dcc08679137c5375b225 | trilamsr/LeetCode | /0005_LongestPalindromicSubstring/LongestPalindromicSubstring.py | UTF-8 | 5,278 | 3.75 | 4 | [] | no_license | # Top-down recursive-----------------------------
class Solution:
def __init__(self):
# dp[i][j] = 1 for True, 2 for False, 0 for unvisited
# without this it can't differentiate between false and unvisited, so end up doing repeated work and time out at longer string
self.dp = []
de... | true |
c20fd57fe51d00b63a1a424f5924b38142002b46 | renzopachecoj/kotlin-syntax-analyzer | /analizador_lexico.py | UTF-8 | 3,025 | 2.671875 | 3 | [] | no_license | errors = []
reservados = {
'val': 'VAL',
'var': 'VAR',
'true': 'TRUE',
'false': 'FALSE',
'for': 'FOR',
'while': 'WHILE',
'if': 'IF',
'else': 'ELSE',
'in': 'IN',
'until': 'UNTIL',
'step': 'STEP',
'downTo': 'DOWNTO',
'f': 'F'
}
funciones = {
'withIndex': 'WITHINDE... | true |
a5f02f9ea55467092ff2fb1ce5c026b9004021cc | ngost/Repeat_Image_Detector | /root/feature_entropy.py | UTF-8 | 3,461 | 2.828125 | 3 | [] | no_license | from matplotlib import pyplot as plt
import numpy as np
import cv2
import math
from scipy.stats import norm
def get_entropy(pixel_size, nphist):
hist = nphist[0].tolist()
print(hist)
pdf_list = []
w_count = {}
for lst in hist:
try:
w_count[lst] += 1
except:
... | true |
a8ec4f764045f59f933461507a2090c61a66ab65 | nm4archana/apache-spark | /filterMinTemperature.py | UTF-8 | 1,183 | 3.21875 | 3 | [] | no_license | from pyspark import SparkContext,SparkConf
import collections
"""
@author: Archana Masilamani
Description:
Spark script to find the minimum and maximum temperature from the given data
"""
conf = SparkConf().setMaster("local").setAppName("Minimum Temperature")
sc = SparkContext(conf = conf)
rdd = sc.textFile("Data/1... | true |
98dc2bb3e80642de8f26f2ff63a2a7f3d2b4dca5 | masizhou/GCRNN_PyTorch | /data/ data_pre_processing/temperature/merge_temperature_data.py | UTF-8 | 1,754 | 3.1875 | 3 | [] | no_license | import sys
sys.path.append("..")
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def read_table_file(filename): # 读取.txt文件
f = pd.read_table(filename, sep=" ", index_col=False) # index_col=False则不会让第一列为index
return f
def read_csv_file(filename): # 读取.csv文件
f = pd.read_csv(filenam... | true |
0b5b1ae0292645ad329da2ca80ac302b77a6da57 | patalv/progcomp2018_2 | /aceptados/uva11264.py | UTF-8 | 473 | 3.15625 | 3 | [] | no_license | #!/usr/bin/env python
import sys
lista=[]
for line in sys.stdin:
li=[]
for var in line.split():
var=int(var)
li.append(var)
if len(li) == 1:
li=int(li[0])
lista.append(li)
aux=list(lista)
#print lista
monedas=list()
for i in lista:
if type(i) is list:
i.sort()
suma=0
cont=0
for j in range(len(i)-1):... | true |
2c531e0d75f2b0af307009545484617f36047615 | ratsirarar/Miscellaneous | /algo/find-s.py | UTF-8 | 1,071 | 3.265625 | 3 | [] | no_license | # Find-S algo
# example of training set:
# variables : Sky - Air Temp - Humidity - Wind - Water - Forecast - EnjoySport
# Task: to predict EnjoySport for an arbitrary day
# We assume hypothesis h satisfies instance x as positive if h(x) = 1 => EnjoySport = 1
# TRAINING_SET = np.array([[1, 1, 1, 1, 1, 1, 1],
# ... | true |
a8e35e963c1df218fa1e33062a46ecbd7d097157 | regin0-cpu/python_Notes | /生成器表达式.py | UTF-8 | 278 | 3.140625 | 3 | [] | no_license | # def fun01(list1):
# i = 0
# while i < len(list1):
# if type(list1[i]) == str:
# yield list1[i]
# i += 1
list2 = [1,2,'3',True,'a']
# for j in fun01(list2):
# print(j)30
re = (i for i in list2 if type(i) == str)
for j in re:
print(j) | true |
e17d7e1509875420f01f1fffa899c926ab0b9de0 | riven314/RNN_BinaryAddition | /macro_util.py | UTF-8 | 9,277 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 7 15:03:24 2019
Functions: wrap up data_util, model_util, metrics_util for macro training (input hyper-parameters)
Hyperparameter Description:
filename -- str, data path
batch_size -- int, minibatch size
n_mb -- int, number... | true |
de1d20acd98efbd4282ce66028ef49a55be9af1d | ppratik0703/code_new | /custom_sql_hook.py | UTF-8 | 942 | 2.546875 | 3 | [] | no_license | import pyodbc
from airflow.hooks.base_hook import BaseHook
from airflow.exceptions import AirflowException
class CustomSQLHook(BaseHook):
def __init__(self,
driver,
server,
username,
password,
database):
self.cn... | true |
3fa7a129fb8c090b3fa961a27c538aa785a35106 | bielabades/Bootcamp-dados-Itau | /Listas/Classes e Objetos/11.py | UTF-8 | 1,290 | 4.40625 | 4 | [] | no_license | # Crie uma classe Fração cujos atributos são numerador (número de cima) e denominador (número de baixo).
# Implemente os métodos de adição, subtração, multiplicação, divisão que retornam objetos do tipo Fração.
# Implemente também o método _ repr _.
# Implemente métodos para comparação: igualdade (==) e desigualdades ... | true |
06ae43ad24340134764aa2dfa6cf35126239df16 | JoaoPedroMaFi/Python | /python/venv/Lib/site-packages/mxm/midifile/examples/mxm_midifile_type_1_8ch_8trk_random.py | UTF-8 | 2,098 | 2.703125 | 3 | [] | no_license | """
8 midi channels in 8 tracks.
"""
from mxm.midifile import MidiOutFile
from mxm.midifile import exampledir
from mxm.midifile import constants as c
QUARTER = 480
BAR = QUARTER*4
SIXTENTH = int(BAR/16)
NOTE = 0x3C # middle C
GRAND_PIANO = 0
# generate random notes over in 8 tracks over 4 bars. Very simple 12 tone a... | true |
79b6b5b8f37788735faeb4a79c04a623d11a5f6c | renzobautista/coffee | /analytics.py | UTF-8 | 3,853 | 3.203125 | 3 | [] | no_license | import matplotlib.pyplot as plt
def analyze(ecosystem, snapshots):
basic_analytics(ecosystem, snapshots)
plot_total_extraction_over_time(ecosystem, snapshots)
plot_diffusion_vs_initial_and_final_mass_ratios(ecosystem, snapshots)
plot_diffusion_vs_mass_ratio_difference(ecosystem, snapshots)
plot_ini... | true |
b5ed8f5fba1af59ddb2b098b15712a19b0650fee | simonmarty/emory | /cs334-ml/hw1_solution/q3d.py | UTF-8 | 1,950 | 2.921875 | 3 | [] | no_license | import argparse
import numpy as np
import pandas as pd
import seaborn as sns
import knn
def main():
"""
Main file to run from the command line.
"""
# set up the program to take in arguments from the command line
parser = argparse.ArgumentParser()
parser.add_argument("--xTrain",
... | true |
4876e7bd8d31aa3bcb433e87e7a8c42d9d0bbe69 | jnoss/svg-pad-shrink | /svg_pad_shrink.py | UTF-8 | 4,588 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python
from lxml import etree
import re
import argparse
class SVG_Pad_Shrink:
MIL_TO_PT = 0.01388729089
start_re = 'm ([0-9\.]*,[0-9\.]*) .*'
points_re = 'm [0-9\.]*,[0-9\.]* ([\-0-9\.]*,[\-0-9\.]*) ([\-0-9\.]*,[\-0-9\.]*) ([\-0-9\.]*,[\-0-9\.]*) z.*'
def __init__(self, infile, outfile... | true |
5ca019960abfbd6aabfef9ed5a16189287273813 | pietra/random-forests | /cross_validation.py | UTF-8 | 5,336 | 2.96875 | 3 | [] | no_license | import math
import statistics
import pandas as pd
from anytree import Node
from util import remove_repeated_values_of_list
from decision_tree import decision_tree, classify_instances
from ensemble import create_bootstraps
FOLDS_NUMBER = 5
def cross_validation(dataset, number_of_trees, attributes, attributes_types,... | true |
8fada9592d3b4fdfb38584a4e3b2113e1433ca87 | Zixi-Sam-Tang/Wave-2 | /WhatColourIsThatSquare.py | UTF-8 | 270 | 3.296875 | 3 | [] | no_license | pos = input()
if (pos[0] == "a" or pos[0] == "c" or pos[0] == "e" or pos[0] == "g") and int(pos[1]) % 2 == 0:
print("White")
elif (pos[0] == "b" or pos[0] == "d" or pos[0] == "f" or pos[0] == "h") and int(pos[1]) % 2 == 1:
print("White")
else:
print("Black") | true |
9e4805d100b323ebdea4a3f1ceaa6e0ea0c157bb | SachinPitale/Python3 | /Python-2021/17.Functions/12.newstructure.py | UTF-8 | 263 | 3.21875 | 3 | [] | no_license | import datetime
import os
import time
import sys
def addition(a,b):
result=a+b
print(f"The addition of {a} + {b} is : {result}")
return None
def main():
x = 5
y = 7
addition(x,y)
return None
if __name__ == "__main__":
main()
| true |
2da40ab9242a196c8d255995dae45c0d1d441381 | SAE-HUN/Algorithms | /Greedy/1071.py | UTF-8 | 473 | 2.890625 | 3 | [] | no_license | n = int(input())
arr = sorted([*map(int, input().split())])
i = 0
while i<n-1:
if arr[i]+1==arr[i+1]:
j = i+2
while j<n and arr[i+1]==arr[j]:
j += 1
if j==n:
k = i-1
while k>-1 and arr[k]==arr[i]:
k -= 1
a, b = arr[i], arr[i+1... | true |
16c6fdacfe07abd6b5011be0143140f4677efefc | pengzhihang/python_script | /src/testOsModules.py | UTF-8 | 2,369 | 3.65625 | 4 | [] | no_license | #coding:utf-8
'''
Created on 2017年11月20日
@author: Moxian
'''
import os,sys
'''
os.pardir #获取当前目录的父目录字符串名:('..')
os.makedirs('dirname1/dirname2') #可生成多层递归目录
os.removedirs('dirname1') #若目录为空,则删除,并递归到上一级目录,如若也为空,则删除,依此类推
os.mkdir('dirname') #生成单级目录;相当于shell中mkdir dirname
os.rmdir('dirname') #... | true |
a860cc6924ea7a4e4d9b6b1231bd1cbaa86ce380 | Binodsubedi/laboo | /lab3/factorial.py | UTF-8 | 398 | 3.609375 | 4 | [] | no_license | import math
num1 = int(input('Enter the first number:'))
num2 = int(input('Enter the second number:'))
def factorial():
div = num1/num2
whdiv = math.floor(div)
if div == whdiv:
print('The remainder is 0')
else:
mulval = div - whdiv
value = mulval * num2
intvalue = math.fl... | true |
6a5ea442babb2f81fa1cdf0206a3b3ca12c20a97 | krist7599555/2110101 | /59_3_Q2.py | UTF-8 | 1,277 | 2.78125 | 3 | [] | no_license | # 59_3_Q2_2_p
def A():
m, p, q = [int(input()) for _ in range(3)]
for i in range(m + 1):
for j in range(p):
if i + j > q:
print('P3', i, j)
break
else:
print('P4', i, j)
def B():
m, p = [int(input()) for _ in range(2)]
i, c = 0, 0
while i <= m:
j = i
while j <= p:
print(i, j)
c += 1
... | true |
1afb764d1297c301c5c222835a092b9eef56c747 | MridulGangwar/Leetcode-Solutions | /Python/Easy/1266. Minimum Time Visiting All Points.py | UTF-8 | 393 | 2.59375 | 3 | [] | no_license | class Solution(object):
def minTimeToVisitAllPoints(self, points):
"""
:type points: List[List[int]]
:rtype: int
"""
time=0
for i in range(1,len(points)):
dx = abs(points[i][0] - points[i-1][0])
dy = abs(points[i][1] - points[i-1][1])
... | true |
fbe8cf895bf7e90e58ee42de8064e19655e57d67 | minhntm/algorithm-in-python | /datastructures/list/challenge3_find_two_number_with_sum.py | UTF-8 | 634 | 4.15625 | 4 | [
"MIT"
] | permissive | """
Problem Statement:
- In this problem, you have to implement the find_sum(lst,k) function
which will take a number k as input and return two numbers that add up to k
Input:
- A list and a number k
Output:
- A list with two integers a and b that add up to k
Sample Input:
- lst = [1,21,3,14,5,60,7,6]
- k = 81
Sa... | true |
0560787757c57817760652cd2a0dc3e2fcf471f8 | rafaelperazzo/programacao-web | /moodledata/vpl_data/324/usersdata/304/90483/submittedfiles/divisores.py | UTF-8 | 477 | 3.0625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import math
n = int(input('n: '))
i = int(input('n: '))
j = int(input('n: '))
'''multi = 0
multj = 0
cont = 0
while cont < n:
if multi < multj and:
print(multi)
multi += i
elif multj < multi:
print(multj)
multj += j
else:
print(multj)
m... | true |
04b91484a2492444a5c4b0de2eff69fac87f4d94 | preyasgarg/Fun-and-learn-with-opencv | /drawonimage.py | UTF-8 | 935 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Mar 17 00:01:41 2018
@author: dpr
"""
import cv2
import numpy as np
import matplotlib.pyplot as mpl
def main():
img= cv2.imread("F:/temp/download.jpg", cv2.IMREAD_COLOR)
imgpath = "F:/temp2/4.jpg"
cv2.line(img, (5,5), (100,100), (134,156,56), 10)
... | true |
6c29802b772993493deff94579e06a297c438eb0 | SavaTudor/StudentsLabsGrades | /business/serviceCatalog.py | UTF-8 | 8,738 | 2.90625 | 3 | [] | no_license | from domeniu.entitateCatalog import Note
from sortari.sort import insertionSort, combSort
class ServiceNote(object):
def __init__(self, valid, repo, repoLab, repoStud):
self.__repoL = repoLab
self.__repoS = repoStud
self.__repo = repo
self.__valid = valid
def asign_lab(self, i... | true |
b415dbb4cc70fb326ce5902e5481f8aa7bbb54d7 | THammarback/game | /main.py | UTF-8 | 1,620 | 3.328125 | 3 | [] | no_license | import pygame
import time
from Polygon import Polygon
from Renderer import Renderer
def main():
title = "Game!"
target_fps = 60
pygame.init()
size = (720,480)
renderer = Renderer(size)
polygons = []
current_polygon = Polygon()
prev_time = time.time()
RUN = True
while RUN: ... | true |
f66298bed87d5f845e9cd7d1d388bcc5d5e7492a | ar1ndamg/algo_practice | /5.landing_problem.py | UTF-8 | 3,598 | 4.28125 | 4 | [] | no_license | """
There is only one runway in the airport. So only one plane can
use the runway at a single time. Our task is to schedule the timings
of the flights, each flight require k minutes of the runway. To do that the steps required are:
1. Find the insertion point i where a[i]>=t+k>=a[i-1] (t is the timing o... | true |
1a89276019a88ec3ece2cedb95d24abd50dbfe9d | randradas/coding-interview | /data-structures/hash_table.py | UTF-8 | 561 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python3
import os
def get_files(path):
files = []
# r=root, d=directories, f = files
for r, d, f in os.walk(path):
for file in f:
if '.txt' in file:
files.append(os.path.join(r, file))
return files
def main():
files = get_files("/home/robertoa... | true |
3781742d0394a5f789b15adc679dfff84d761caa | homeah/myPython | /easygui_test.py | UTF-8 | 682 | 2.75 | 3 | [] | no_license | import easygui as g
msg = '请填写以下信息(带*是必填项)'
title = '账号中心'
fieldNames =['*用户名','固定电话','手机号码','QQ号']
fieldValues = g.multenterbox(msg,title,fieldNames)
while True:
if fieldValues == None:
break
errmsg = ''
for i in range(len(fieldNames)):
option = fieldNames[i].strip()... | true |
42953700702ae9b5dfe0481700c484f3fc14d0d8 | wwl2268/ant-learn-leetcode | /old_backup/257. 二叉树的所有路径.py | UTF-8 | 1,052 | 3.953125 | 4 | [] | no_license | # Definition for a binary tree node.
from typing import List
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def binaryTreePaths(self, root: TreeNode) -> List[str]:
if not root:
return []
result_list =... | true |
1ddc66b6351702b286b853863b80890edcaa45d9 | LingChenBill/python_first_introduce | /ffawp/ch02/11_pandas_concat_rows_from_multiple_files.py | UTF-8 | 770 | 2.8125 | 3 | [] | no_license | # Date:2020/5/23
# Author:Lingchen
# Mark: 运用pandas来连接多个文件(csv)的数据行至一个文件中
import pandas as pd
import glob
import os
import sys
input_path = sys.argv[1]
output_file = sys.argv[2]
all_files = glob.glob(os.path.join(input_path, 'sales_*'))
all_data_frames = []
for file in all_files:
data_frame = pd.read_csv(file, i... | true |
f1d167e86b45b9be9ed0f5c44c6d4588d6ce25f3 | josh199483/my_web | /app/main/views.py | UTF-8 | 1,075 | 2.78125 | 3 | [] | no_license | """
建立時間: 2018
作者: Tony
說明:
多語言機制
"""
from flask import session, request, session
from .. import babel
from . import main
from ..models.mongodb import Basic
@main.before_request
def version():
# session['logo'] = Basic.getBasicData('logo')['value']
session['version'] = 1.03
# 每次收到request之後執行
# 在每個res... | true |
bbd308147b7bb7cabcef05cd98c19c4e7849c3de | PragadeeshRaj/Calculator | /main.py | UTF-8 | 1,122 | 3.828125 | 4 | [] | no_license | #basic menu; prompts reader to select a math calculator
print("")
print("Select Operation.")
print("")
print("1.Add")
print("2.Subtract")
print("3.Multiply")
print("4.Divide")
print("5.Exponent")
print("6.Square Root")
print("7.Sine")
print("8.Cosine")
print("9.Tangent")
print("")
choice = input("Select Operation: ")
... | true |
56ad1c713181964f6d379856f471b9376ee929ea | bigdatachobo/Study | /OpenCV/text_book/opencv_practice_answer/05-cv-05-01-sharpening-unsharpmask-color.py | UTF-8 | 516 | 2.609375 | 3 | [] | no_license | import sys
import numpy as np
import cv2
src = cv2.imread('images/lenna.bmp')
if src is None:
print('Image load failed!')
sys.exit()
src_ycrcb = cv2.cvtColor(src, cv2.COLOR_BGR2YCrCb)
src_f = src_ycrcb[:, :, 0].astype(np.float32)
blr = cv2.GaussianBlur(src_f, (0, 0), 2.0)
src_ycrcb[:, :, 0] = ... | true |
b48af568177e298717d3aeb9a108d222f4512444 | rovan123/ComputerVision | /FaceRecognition.py | UTF-8 | 2,315 | 2.65625 | 3 | [] | no_license | import cv2
import numpy as np
import time
#from Face_Recognition.recognizer.DatasetCollector import collect
pTime = 0
cTime = 0
facedetect = cv2.CascadeClassifier(cv2.data.haarcascades + "haarcascade_frontalface_default.xml")
video = cv2.VideoCapture(0)
recognizer = cv2.face.LBPHFaceRecognizer_create()
recognizer.rea... | true |
106b78369eb7cbdc00bc09752018768c00154721 | AmelinAndrey/pandasplotly4 | /km94/amelin/main.py | UTF-8 | 1,069 | 2.625 | 3 | [] | no_license | import os
os.environ["GOOGLE_APPLICATION_CREDENTIALS"]="keys.json"
import pandas as pd
from bq_helper import BigQueryHelper
import plotly.graph_objs as go
from plotly.offline import plot
bq_assistant = BigQueryHelper('bigquery-public-data', 'census_bureau_international')
QUERY = """
SELECT country_code,coun... | true |
fde0597fc7d0840ba55e8b6deaae0e639ad11ab5 | alesiong/dpass-pc-backend | /app/api/session.py | UTF-8 | 1,609 | 2.59375 | 3 | [
"MIT"
] | permissive | import base64
import binascii
from multiprocessing import Queue
from flask import Blueprint, current_app, request, jsonify
from app import SessionKey
from app.utils.cipher import encrypt_and_authenticate
from app.utils.decorators import session_verify
from app.utils.error_respond import authentication_failure
from ap... | true |
cc9e84dd5d9b20473c8fe83fba65f144e77351d8 | Tigge/platinumshrimp | /plugins/packagetracker/provider_dhl.py | UTF-8 | 2,355 | 2.5625 | 3 | [
"MIT"
] | permissive | import requests
import datetime
import dateutil
import dateutil.parser
import logging
from plugins.packagetracker.provider import Package
__author__ = "tigge"
class DHLPackage(Package):
API_URL = "https://api-eu.dhl.com/track/shipments?trackingNumber="
apikey = None
@classmethod
def get_type(cls):... | true |
a5d883bb309a8b6c16261464cde4b7991469b14a | demirkirans/PlaDat-BLG411E | /AWS_Services/matchPlacements.py | UTF-8 | 3,228 | 2.671875 | 3 | [
"MIT"
] | permissive | import json
import urllib3
import boto3
import time
from boto3.dynamodb.conditions import Key,Attr
from botocore.exceptions import ClientError
def matching(student_skills, job_skills):
counter = 0
for s_skill in student_skills:
for j_skill in job_skills:
if s_skill in j_skill:
counter += 1
return (counte... | true |
ffc27f7aad0c026d5e9c3b391bf08c3b0d1cdf85 | MilesHewitt/ONS-Data-Challenge-Loneliness | /set-up-files/Preparing_Loneliness_Index.py | UTF-8 | 627 | 2.609375 | 3 | [
"MIT",
"OGL-UK-3.0"
] | permissive | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import matplotlib as mpl
%matplotlib inline
#Read and manipulate data to be used for next code
lonely = pd.read_csv('msoa_loneliness.csv')
lonely['msoa11nm'] = lonely['msoa11nm'].str[:-4]
#Count and sum loneliness data to get average loneliness fo... | true |
c5ba0ef93503d670f5dc225db3541ef2cc89105e | videetparekh/model-zoo-models | /audio_recognition_gtc/tf_flags.py | UTF-8 | 4,395 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | import argparse
parser = argparse.ArgumentParser()
parser.add_argument(
'--data_url',
type=str,
# pylint: disable=line-too-long
default='https://storage.googleapis.com/download.tensorflow.org/data/speech_commands_v0.02.tar.gz',
# pylint: enable=line-too-long
help='Location of speech training data archive o... | true |
c9abfd09639a743298b5a0bcad3c2df2cc4876ab | ExemploDev/Calculadora-Simples | /calc.py | UTF-8 | 1,114 | 3.96875 | 4 | [] | no_license | print('Calculadora - Started')
print()
n1 = int(input('Digite um número inteiro: '))
n2 = int(input('Digite outro número inteiro: '))
while True:
print("""Escolha uma daz opções abaixo:\n
1 - Somar
2 - Subtrair
3 - Multiplicar
4 - Divisão
5 - Adicionar outro número
S - Sair do progra... | true |
9fb58df793086d45217baa793bf9358cc68f2eb7 | sree1026/Face-recognition | /Face_tracking.py | UTF-8 | 8,387 | 2.734375 | 3 | [] | no_license | import cv2
import dlib
import pickle
import numpy as np
import os
# Loading the encodings calculated from dlib_encode.py file
data = pickle.loads(open('encodings', 'rb').read())
train_image_encodings = data
# Load all the models we need: a detector to find the faces, a shape predictor
# to find face landmarks so we ... | true |
89ed86eed86d3a90d32fff9ad98ce2ab98bdfaf0 | ZKai0801/BioinfoStuff | /subsample_maf.py | UTF-8 | 2,277 | 3.03125 | 3 | [] | no_license | __doc__ = """simulate panel-sized data by sub-sampling WGS/WES data
Required file:
MAF file for WGS/WES data
BED file for a targeted panel
"""
__author__ = "Kai"
__date__ = "11/07/2019"
from collections import defaultdict
import pandas as pd
import argparse
import os
def read_bed(bed):
"""
read BED ... | true |
b9937f31cc03745fbc4512750065c21dd75e60b7 | LittleFee/python-learning-note | /day10/03-string-method.py | UTF-8 | 3,102 | 4.21875 | 4 | [] | no_license | # 字符串方法
# center
# 方法center通过在两边添加填充字符(默认为空格)让字符串居中。
print('*'*39)
print('*'*39)
print('I love fengyunxia'.center(39))
print('I love fengyunxia'.center(39,'*'))
print('*'*39)
print('*'*39)
# find
# 方法find在字符串中查找子串。如果找到,就返回子串的第一个字符的索引,否则返回-1。
str='I love fengyunxia very very much'
print(str.find('v'))
print(str.find('... | true |
d3d010914fcb0ddf277d694135522bc3274f60c1 | kornitsky101/richardkornitsky | /ECE 597ED Determining Viability of Interconnected Solar Home Systems/Energy Profiles.py | UTF-8 | 2,010 | 2.640625 | 3 | [] | no_license | #ECE587ED: Final Project, By: Richard Kornitky, Cassius Peter, Ryan McAuliffe
#############################################
##### Section Written by Cassius Peter ######
#############################################
import pandas as pd
#from shapely.geometry import Point, Polygon
#import geopandas
import matplotlib.... | true |
45e1d04095ca2d3812c804003f2a5e60c30df7e7 | CodingDojoDallas/python_jan_2017 | /Cody_Williams/flask/great_number_game/server.py | UTF-8 | 1,306 | 3.28125 | 3 | [] | no_license | from flask import Flask, request, render_template, redirect, session
import random
app = Flask(__name__)
app.secret_key = 'somethingverysecret'
@app.route('/')
def home():
#check if num is not in session
if 'num' not in session:
#generate a random number
random_num = int(random.random() * 100)
#save the random... | true |
9863c7a3920db90f8c5b26bbdf5e66a86de38944 | Jiliochi/Pythonbasic | /exercícios1/5!.py | UTF-8 | 276 | 3.21875 | 3 | [] | no_license | def iq_test(numbers):
odd = []; even = []
for m in numbers.split():
odd.append(m) if int(m) % 2 != 0 else even.append(m)
return numbers.split().index(even[0]) + 1 if len(odd) > 1 else numbers.split().index(odd[0])
print(iq_test("20 4 7 8 10"))
| true |
f98e82464d16ba95cddb22de472343856465e987 | kazu-bot/python_movie | /requestsLibTute.py | UTF-8 | 555 | 3.1875 | 3 | [] | no_license | #サードパーティライブラリーの「requests」を使用する。
#xml,jsonの書き方をやってきたが、これを使用することにより簡略化が可能
import requests
payload = {'key1':'value1','key2':'value2'}
#urllibTuteと見比べるとgetもこんなに簡単
r = requests.get('http://httpbin.org/get',params=payload, timeout=1)
#postの際もこのような書き方でOK
#put,postも同じ書き方すればOK
#r = requests.post('http://httpbin.org/post',da... | true |
6e1eeea692586aaded3a0c0ef69ab21769264318 | melissab06/webprogramming | /updown/views.py | UTF-8 | 2,085 | 2.5625 | 3 | [
"MIT"
] | permissive | from django.shortcuts import render, redirect
from django.conf import settings
import os
from django.http import HttpResponse
from django.utils.encoding import force_text
import re
from urllib.parse import urlparse
# Create your views here.
def index(request):
dirList = os.listdir(settings.MEDIA_ROOT)
context... | true |
0a9b2d4db4505f5cd5ccb801eac365bf2a238789 | JCSleiman/Simulacion | /Tarea1.py | UTF-8 | 1,885 | 3.28125 | 3 | [] | no_license | import numpy as np
import random
n = 100
a = 20.00
b = 30.00
muestra = np.random.uniform(low=a, high=30.0001, size=100)
suma = 0
for number in muestra:
suma+=number
media = suma/muestra.size
print(muestra)
def func(media):
muestra = np.random.uniform(low=0, high=10.0001, size=100)
foo = x / 50
for num ... | true |
a3748055a60c81d658b6b816dc898717debd6775 | Vietnows/FlaskApi | /server.py | UTF-8 | 2,490 | 2.921875 | 3 | [] | no_license | import flask
from flask import request, jsonify
import DataProcess
app = flask.Flask(__name__)
app.config["DEBUG"] = True
@app.route('/', methods=['GET'])
def home():
return '''Home'''
#Extrai o Json inteiro
@app.route('/audience', methods=['GET'])
def fetch_All_programs():
return jsonify(dict_final)
'''
... | true |
221492383f0c5e95ba6b7d8ad0e44e086a8c08f5 | GabeCordo/py-acyclic-network | /pyacyclicnet/core/bitstream/basic.py | UTF-8 | 3,316 | 3.359375 | 3 | [
"MIT"
] | permissive | """
INTERFACE FOR PARSING RAW BASIC SERVER BITSTREAMS
- DO NOT MODIFY THIS FILE -
*** used for bitstream transfers with minimal (one-
two elements of data on-top of the standard
request, can be used by any node class: O(n) ***
"""
###############################
# core imports
##############... | true |
fe54dcad2682dd7213dc141d6f2279e9ddbfdcd7 | mafumaru/webstorm-flask | /framework/module/wordbase/mkvTomp4.py | UTF-8 | 820 | 2.578125 | 3 | [] | no_license | import os
from moviepy.video.io.VideoFileClip import VideoFileClip
def mkv_to_mp4(name):
work_dir = "D:\BaiduYunDownload"
file_path = ""
parent_path = ""
double_loop_flag = False
for parent, dirnames, filenames in os.walk(work_dir, followlinks=True):
for filename in filenames:
... | true |
2e8ba363fc321ed8d43ab0de65ef1cdeff2f0da1 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_118/922.py | UTF-8 | 2,284 | 3.21875 | 3 | [] | no_license | import math
import itertools
def game():
f = open("C-large-1.in", "r")
output = open("C-large-1.out", "w")
first = f.readline()
T = int(first)
case = 1
while case < T+1:
line = f.readline().split(" ")
beg, end = int(line[0]), int(line[1])
res = "Case #" + s... | true |
ba858b6251453a976a3bac5fe74e2593e07a151a | alalai012/PoEWAL | /PoEW/성열/PoEW_ato.py | UTF-8 | 2,577 | 3.359375 | 3 | [] | no_license | import hashlib
import time, random, os, sys
import threading
collision_threshold = 10
# 주어진 time frame 동안 연산을 수행함
# difficulty level 이상으로 제일 어려운 문제를 푼다.
# 이때, 난이도 3을 풀면, 난이도 4를 풀어야하고, 난이도 5를 풀어야 한다.
# ex) level=3 이면 3자리 이상의 '0'을 가진 결과를 제출함.
def proof_of_elapsed_work(time_frame, challenge, difficulty_level):
proof... | true |
8fc959089a8674314ea97e96045f1252af255a96 | adenot/quati-project | /codigo-fonte/modulo de controle e alertas/src/Common/Database.py | UTF-8 | 2,599 | 2.9375 | 3 | [] | no_license |
from pysqlite2 import dbapi2 as sqlite
from Common.Functions import *
'''
@package Common
@namespace Database
Database layer class. Abtracts the database access.
'''
class Database:
def __init__(self):
self.connection = sqlite.connect('quati.db')
self.cursor = self.connection.cursor()
... | true |
1d0b1f41dd05deae174762104efdb4f9663bd253 | jbd0101/mission-python-uclouvain-bac1 | /intro/test.py | UTF-8 | 286 | 3.296875 | 3 | [] | no_license | a = ["bonjour","manger","appeler","aarlon"]
b = ["mourir","dire","arnaquer",'boir']
def sortL(array):
c=[]
while array:
minimum = ""
for e in array:
if(e<minimum or minimum==""):
minimum = e
c.append(minimum)
array.remove(minimum)
print(c)
sortL(a)
| true |
1dda8c758a8446ab9eafc3f21c8db6f69e466a7f | kantel/nodebox-pyobjc | /examples/Extended Application/matplotlib/examples/pyplots/pyplot_scales.py | UTF-8 | 2,092 | 3.09375 | 3 | [
"MIT"
] | permissive | """
=============
Pyplot Scales
=============
"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import NullFormatter # useful for `logit` scale
# nodebox section
if __name__ == '__builtin__':
# were in nodebox
import os
import tempfile
W = 800
inset = 20
size(W, 6... | true |
c4453bd5bcca12e7e8f777669343d7c42cae9d06 | mbhushan/mongodb | /mongoPython/mongo_dbObj.py | UTF-8 | 778 | 3.140625 | 3 | [] | no_license | """ An example of how to get a Python handle to a MongoDB database """
import sys
from pymongo import Connection
from pymongo.errors import ConnectionFailure
def main():
""" connect to mongo db """
try:
c = Connection("localhost", port=27017)
except ConnectionFailure, e:
sys.stderr.write... | true |
4c3d8d42e21daa6b74825b182defa4b9491f9478 | radish2951/python_machine_learning_test | /test.py | UTF-8 | 1,562 | 2.84375 | 3 | [] | no_license | from sklearn import linear_model
import pandas as pd
import numpy as np
colors = pd.read_csv("colors.csv", sep=",")
#colors.head()
colors["rr"] = colors["r"] ** 2
colors["gg"] = colors["g"] ** 2
colors["bb"] = colors["b"] ** 2
colors["rg"] = colors["r"] * colors["g"]
colors["gb"] = colors["g"] * colors["b"]
colors["b... | true |
1a2afbcd96c5cddcc7929ca2d24e609eeb4f6f60 | SeekrLabs/Seekr | /messenger_users/models.py | UTF-8 | 3,673 | 2.5625 | 3 | [] | permissive | from django.db import models
from django.contrib.auth.models import User
from profiles.models import Profile
from postings.models import Posting
from datetime import date, timedelta
import numpy as np
import logging
logger = logging.getLogger('app')
class MessengerUser(models.Model):
id = models.CharField(max_len... | true |
1aa231c17461a0c121831d60da6e31b51d9cfb46 | guofeng201507/PLP_Group9_CA_Lyrics_Pro | /service/audio_process.py | UTF-8 | 1,194 | 2.96875 | 3 | [] | no_license | import subprocess
import uuid
import requests
import speech_recognition as sr
audio_path = 'static/audio/'
def get_audio_content(media_url):
file_name = audio_path + str(uuid.uuid4()) + '.oga'
response = requests.get(media_url)
byte_content = response.content
print("Byte content: " + str(byte_content... | true |
e8b251b12d65d45fdff71def6eb27eaf847ef9ba | daavera/METODOS | /Laboratorios/Ejercicio_2/DanielAvila_EJ2/pca_room.py | UTF-8 | 2,169 | 3.125 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
plt.style.use('ggplot')
datos = pd.read_csv('room-temperature.csv', sep=',')
datos = datos.ix[:,1:]
#Temperatura en cada esquina
f1, ax = plt.subplots(2,2, figsize=(6,6))
ax[0,0].plot(datos['FrontLeft'])
ax[0,0].set_title('Front Left')
ax[0,1].pl... | true |
ce2ac242968969f024af59a7a5bb3db860c1b735 | liuuu/python-algorithm | /5.first_last_in_list.py | UTF-8 | 2,190 | 3.9375 | 4 | [] | no_license | import time
class Solution:
def firstLastInList(self, nums, target):
first = self.binarySearch2(nums, 0, len(nums) - 1, target, True)
last = self.binarySearch2(nums, 0, len(nums)-1, target, False)
return [first, last]
def binarySearch(self, nums, low, high, target, isFirst):
index = None
whil... | true |
3aa29d411b550134c367600348e7975e78d7cd2b | junneyang/pyutilities | /002.iterator.py | UTF-8 | 833 | 3.65625 | 4 | [] | no_license | #!/usr/bin/env python
#-*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
# Name: 002.iterator.py
# Purpose: 如何实现可迭代类?定义类,并且实现该类的next、__iter__方法即可.
#
# Author: yangjun03
#
# Created: 02/12/2014
# Copyright: (c) yangjun03 2014
# Licence:... | true |
a3b0530f3be4564542587b9353edef68199432bd | vikbehal/Explore | /EfficientCoding/code-1-smallestmissinginteger.py | UTF-8 | 434 | 3.703125 | 4 | [
"MIT"
] | permissive | def smallMissingNumber(arr, size):
map = {}
for i in arr:
if i in map:
map[i] += 1
else:
map[i] = 1
print(map)
index = 1
while True:
if index in map:
index += 1
else:
return index
arr = [-5, 2, 0, -... | true |
528dc67a7493f858a4f5d1c9ec6383e25f550f42 | TabishSarfraz/melbournecodingclub | /gameprogramming/comms/gameClient.py | UTF-8 | 1,099 | 2.78125 | 3 | [] | no_license | import socketio
sio = socketio.Client()
tank = {'id':'', 'team':'', 'x':-1, 'y':-1, 'bulletX':-1, 'bulletY':-1}
@sio.event
def connect():
print('connection established')
@sio.on('message')
def my_message(data):
if(data['sender']!=sio.sid):
print('\n',data['sender']+": ", data['echo'])
tank['id... | true |
585af9d5e4bd66aeaf1287a51f358969ddc64c39 | exmakhina/xm_color | /conversions_computations.py | UTF-8 | 8,376 | 2.765625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 vi:noet
import numpy as np
import sympy
import cv2
from xm_color import conversions
def do_yuv():
"""
Color analog TV: perform YUV <-> RGB computations.
The luma and chroma components in YUV are calculated from gamma corrected RGB.
References:
- https://en.wikipedia.... | true |
a37864c5678076458e26c7626e6eac42798b8341 | Ayala075/Ejercicios-de-tipos-de-datos-simples | /Ejercicios de Tipos de Datos Simples/Ejercicio7.py | UTF-8 | 542 | 4.3125 | 4 | [] | no_license | # Escribir un programa que pida al usuario su peso (en kg) y estatura (en metros), calcule el índice de masa corporal y lo almacene en una variable,
# y muestre por pantalla la frase Tu índice de masa corporal es <imc> donde <imc> es el índice de masa corporal calculado redondeado con dos decimales.
peso = input("... | true |
4c11c54f417309f1dcc186c934c9b964e1f8efeb | mustafaemre06/tools | /build/UtilityFile.py | UTF-8 | 6,801 | 3.0625 | 3 | [] | no_license | #------------------------------------------------------------------------------
#
# UtilityFile.py
#
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# The UtilityFile static class provides methods for handli... | true |
558f8aa0039fdc0b4732ef02c57cd7a6a362c5e5 | braayim/through-python | /moderate/smallest_distance.py | UTF-8 | 1,249 | 3.9375 | 4 | [] | no_license | """
Measures the smallest distance between two arrays
"""
import unittest
def smallest_difference(arr1, arr2):
# sort arrays
sorted1 = sorted(arr1)
sorted2 = sorted(arr2)
smallest_diff = abs(sorted1[0]-sorted2[0])
a_index, b_index = 0, 0
while True:
diff = sorted1[a_index] - sorted2[... | true |
5ea0cc212691b3e3f829faf0c3aba467137d9620 | goanpeca/spyder-remote | /spyder-remote-server/spyder_remote_server/utils.py | UTF-8 | 3,791 | 2.515625 | 3 | [
"MIT"
] | permissive | # Copyright (c) Semi-ATE
# Distributed under the terms of the MIT License
"""
Spyder remote server utilities.
"""
import json
import os
import pwd
import socket
import subprocess
import sys
from contextlib import closing
# Constants
WIN = os.name == "nt"
def is_base_conda():
"""Check if current env is base envi... | true |
3017dd9308d483de56167181fc260b68ac493b3e | kingbo2008/teb_scripts_programs | /zzz.scripts/best_frist_tc_clusters.py | UTF-8 | 2,205 | 2.546875 | 3 | [] | no_license | import sys, os
import tanimoto_tversky_cal_axon_lib as tccalc
# writen by Trent Balius in 2016
def main():
if (len(sys.argv) != 4): # if no input
print "ERORR"
print "syntexs: python best_frist_tc_clusters.py smiles1 outputprefix threshold"
return
smilesfile1 = sys.argv[1]
outfileprefix = sys.... | true |
4376bc0489f4a7e5b73f37c56ab84401a325b660 | KevinChen1994/leetcode-algorithm | /top100/114.py | UTF-8 | 1,912 | 3.84375 | 4 | [] | no_license | #-*- coding:utf-8 -*-
# author:chenmeng
# datetime:2020/3/29 22:26
# software: PyCharm
'''
solution1: 流程:1、将右子树放到左子树最右边的节点;2、将左子树放到右子树的位置;3、root变成右子树
solution2: 其实题目要求可以理解为是将二叉树改为按照前序遍历的顺序在右子树排列。那么就可以考虑使用前序遍历,如果使用递归的话,
左子树的值赋值到右子树,就会丢失掉右子树的数据,这里可以使用栈来存储右子树的数据。利用栈实现二叉树的前序遍历。
'''
# Definition for a binary tree node.
clas... | true |
98a7710e6cd945667d637b96cb6d4cb7a79a3582 | MrMelk/IN1900 | /oblig9/F2.py | UTF-8 | 410 | 3.640625 | 4 | [] | no_license | import numpy as np
class F():
def __init__(self, a = 1.0, w = 0.1):
self.a = a
self.w = w
def value(self, x):
pass
a = self.a
w = self.w
return np.exp(-a * x) * np.sin(w * x)
#f = lambda x, a, w: np.exp(-a * x) * np.sin(w * x)
f = F()
print(f.value(np.pi))
f.a... | true |
7f3ea9a0535a895f7ee661e64aebee428bf955e5 | chiragvartak/cse-515-project | /test/test_vector_set.py | UTF-8 | 1,490 | 2.6875 | 3 | [] | no_license | import utils
import constants
from database import Database
from vector_set import VectorSet
from pprint import pprint
from word import Word
def print_a_vector_set():
database = Database(constants.RESULTS_DIRECTORY_PATH, filenames_ending_with="_wordified.csv")
database.applymap(Word.parse)
print(database.g... | true |
da07ab000dc2440679db4306d5542592e765ba00 | jtallar/unsupervised-learning | /oja.py | UTF-8 | 1,794 | 3.03125 | 3 | [] | no_license | import json
import numpy as np
import perceptron as p
import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
# accumulation function for oja algorithm
def accum_function(data: np.ndarray, w: np.ndarray, e: float) -> np.ndarray:
# out for this neuron
y = np.d... | true |
24e122e5bd465f163afe7b56b94d4285a1ea1aea | swHackathon11/human_detection | /mosaicer.py | UTF-8 | 1,320 | 2.796875 | 3 | [] | no_license | import sys
import os
import requests
from PIL import Image
API_URL = 'https://dapi.kakao.com/v2/vision/face/detect'
MYAPP_KEY = 'cf2e6be05d472f52d98fe597730f279a'
class mosaicer:
def __init__(self):
self.headers = {'Authorization': 'KakaoAK {}'.format(MYAPP_KEY)}
def detect_face(self,filepath):
... | true |
e4f002e244b7e4da577a951f0e55a198bf38e6f7 | rakh7/TBBT-Corpus | /getEpisodeTranscripts.py | UTF-8 | 5,378 | 3.140625 | 3 | [] | no_license | import json
import requests
from lxml import html
class conversation:
def __init__(self, speaker, words):
self.speaker = speaker
self.addresse = []
self.topic = None
self.words = words
def addAddresse(self, p_list):
self.addresse = p_list
def __str__(self):
... | true |
d8b36f796c085a3188ddf382b5a983342f0cfaf5 | Eboreg/apk-calculator | /apk.py | UTF-8 | 1,836 | 2.828125 | 3 | [
"Unlicense"
] | permissive | # -*- coding: utf8 -*-
import requests
from xml.etree import ElementTree
def process(xmldata):
articles = ElementTree.fromstring(xmldata)
data = []
for article in articles:
if article.tag != 'artikel':
continue
entry = {}
use_entry = True
try:
for fi... | true |
2206afe35168bb387e1c307b0d543762fbaefa76 | lujiely/IQIYI_VID_FACE_2019 | /models/losses.py | UTF-8 | 593 | 2.6875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# @Time : 2019/4/21 13:59
# @Author : LegenDong
# @User : legendong
# @File : losses.py
# @Software: PyCharm
import torch
import torch.nn as nn
__all__ = ['FocalLoss', ]
class FocalLoss(nn.Module):
def __init__(self, gamma=0, eps=1e-7):
super(FocalLoss, self).__init__()
... | true |
cdcf2bb8f490986cd72db29f5fecf1d4717af6f1 | cysectsolution/Twitter-Sentiment-Analysis-web-app | /training.py | UTF-8 | 1,239 | 2.921875 | 3 | [
"MIT"
] | permissive | import json
import tweepy
from tweepy import Stream
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener
#consumer key, consumer secret, access token, access secret.
consumer_secret='en4k3oJ8i9xfYcBxiZHrsM3js6LZDDm0Y1q8J4pfLfAN1JLYrh'
consumer_key='616IPvDx3znDMQ3gFDlUM3Gjf'
access_token_key=... | true |
b9933996c3442467be2e1106d50804d1a886ae57 | Srivatsa-M-Hegde/VisionImageProcessing | /PA1/pa1_code.py | UTF-8 | 9,245 | 2.8125 | 3 | [] | no_license |
# coding: utf-8
# In[ ]:
#code to highlight the vertical edges
import cv2
import numpy as np
try:
output_x = np.zeros((512,512))
img = cv2.imread('lena_gray.jpg',0)
#img = np.array([[50,50,50,100,100,100,100],[50,50,50,100,100,100,100],[50,50,50,100,100,100,100],[50,50,50,100,100,100,100],[50,50,50,100,... | true |
dbdba87e046d0a9148c7ffcffc5a1c03e306de36 | gwynethbradbury/ouss_ball | /eisitirio/database/affiliation.py | UTF-8 | 1,109 | 2.703125 | 3 | [] | no_license | # coding: utf-8
"""Database model for representing a users affiliation to their college."""
from __future__ import unicode_literals
from eisitirio.database import db
#DB = db.DB
from eisitirio.app import eisitiriodb as DB
class Affiliation(DB.Model):
"""Model for representing a users affiliation to their college... | true |
92a812f050376099ca78b85cc8c3fe2ea2fd8fe1 | Andrey1222/Percent | /percent.py | UTF-8 | 290 | 2.890625 | 3 | [] | no_license | import numpy as np
import requests
import json
per = []
n = 0
res = requests.get("https://covid19-api.org/api/status")
items = res.json()
length = len(items)
while n < length:
per.append(items[n]["cases"])
n += 1
print(per)
print("90 перцентиль:", np.percentile(per, 90)) | true |
56bd162701470b11254c1624d2c1ceaef1ccb468 | hotswwkyo/SevenPytest | /sevenautotest/utils/SocketTransfer/BaseSocketClient.py | UTF-8 | 1,242 | 2.59375 | 3 | [] | no_license | import socket
from sevenautotest.utils.SocketTransfer.Common.Handler import TCPServerHandler
class BaseSocketClient(object):
def __init__(self, ip_addr, ip_port):
self.host = ip_addr
self.port = ip_port
self.packet_number = 0
self.packet_header_size = 4
self.recv_default_... | true |
b108157662e1e22e428a105750ba5abbab511e63 | Salihbayraktar/Patika-Python | /CodeWars/6-Kyu/Catalog.py | UTF-8 | 581 | 2.90625 | 3 | [] | no_license | import re
def catalog(s, article):
sList = re.findall("<prod>(.*?)</prod>", s)
resultList = []
for i in range(len(sList)):
currentName = re.findall("<name>(.*?)</name>", sList[i])[0]
if article in currentName:
prx = re.findall("<prx>(.*?)</prx>", sList[i])[0]
qty = ... | true |
220f5d1bd8a5fe9ea002b7aed6651d14720bb71a | aes/numberlike | /numberlike/test/iso_test.py | UTF-8 | 1,857 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from numberlike.iso import iso3166
from numberlike.test.common import raises, StringRoundTrip, Constructor
class TestIso3166(StringRoundTrip, Constructor):
_m = {
2: ('AW', 'AWW', "Kittens, People's Reposts of"),
34: ('FB', 'FRB', "Frobnia, I AM FROBNIA"),
456: (... | true |
d12e24ce1f5f03d459fad4f923f983e321d459fd | xdjzhh/ML | /functional_cnn.py | UTF-8 | 2,514 | 2.578125 | 3 | [] | no_license | from keras.layers import Conv2D, BatchNormalization, Input, Flatten
from keras.datasets import mnist
from keras.utils import to_categorical
from keras.layers import Activation, Dense, Concatenate, Add
from keras.models import Model
import keras.backend as K
from keras.utils.vis_utils import plot_model
(X_train, Y_tra... | true |
fea9e0185eb42e0b3a6d12f22a741cec437341b6 | joedougherty/sentential | /sentential/Expression.py | UTF-8 | 5,166 | 3.4375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
try:
from string import lowercase
except:
from string import ascii_lowercase as lowercase
from copy import deepcopy
from operator import not_
"""
Provides models and tools for converting a nested list AST
into a tree model (given by Expression) and vice versa.
"""
class Term:
""... | true |