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 |
|---|---|---|---|---|---|---|---|---|---|---|
db3e1eb07eeb9f231c81fa18a178803e629a81dc | Gargeebhase/Blind-Search-Engine | /Search.py | UTF-8 | 958 | 2.53125 | 3 | [] | no_license | import numpy as np
import csv
from cryptography.fernet import Fernet
import hashlib
import random
import array
ipp = input("Enter the search ")
nonce = random.randint(1,100000)
nonce = str(nonce)
l = [ord(a) ^ ord(b) for a,b in zip(nonce, ipp)]
print(l)
l = ''.join(str(e) for e in l)
print(l)
hash_object = hashlib.md... | true |
8dfc506f48e5438108f0b6cbe50c56ecd2f1b4b0 | baju0218/SnakeLocomotion | /render.py | UTF-8 | 6,421 | 2.53125 | 3 | [] | no_license | import glfw
from OpenGL.GL import*
from OpenGL.GLU import*
import simulation as sim
import numpy as np
import time
# Window
window = None
# Window
window = None
def createWindow(width = 1080, height = 1080, title = "Snake Locomotion"):
global window
glfw.init()
window = glfw.create_window(width, hei... | true |
e75661421c3d629af26540d40fa6382f3f040e09 | ibm-watson-iot/functions | /iotfunctions/automation.py | UTF-8 | 10,963 | 2.78125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | # *****************************************************************************
# © Copyright IBM Corp. 2018, 2022 All Rights Reserved.
#
# This program and the accompanying materials
# are made available under the terms of the Apache V2.0 license
# which accompanies this distribution, and is available at
# http://www... | true |
6e1c559c14be20f8a7dc4aa2c8644a6d85f2f851 | princeton-vl/Rel3D_Render | /renderer/plain.py | UTF-8 | 7,277 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | '''The plain implementation of bounding box render.
'''
import numpy as np
import trimesh
import config
from pathlib import Path
from constant import BLENDER_TO_UNITY
from common import extract_obj_transforms, extract_obj_paths, extract_extrinsics_from_camera
def render_bbox(description_data, camera_data, result_data... | true |
b3c09d8821ab2a3013fef15d5ec1b6f85edcb7f4 | ManoMambane/Python-PostgresSQL | /A Full Python Refresher/16_arguments_and_parameters/code.py | UTF-8 | 494 | 4.625 | 5 | [] | no_license | #function with parameters
def add(x, y):
result = x + y
print(result)
add(5, 3)
#fuction without parameters
def say_hello(name):
print(f"Hello, {name}")
say_hello("Bob")
#named or keyword arguments
def say_hello(name, surname):
print(f"Hello, {name} {surname}")
say_hello(name="Bob", surname="Smith"... | true |
950444a378a7913eae27da8b6a0ff9d263d7beb0 | theo1201/machine-learning | /Aquastat-Introduction/1-Aquastat-Introduction.py | UTF-8 | 3,800 | 3.09375 | 3 | [] | no_license | import matplotlib as mpl
from matplotlib import pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
import os, sys
import warnings
warnings.filterwarnings('ignore')
sns.set_context("poster", font_scale=1.3)
data = pd.read_csv('aquastat.csv.gzip', compression='gzip')
# print(data.head())
# Resear... | true |
0d3e84dcb954fe3645aeaa040ace4193040044c2 | paulbrodersen/hola | /hola/edgeoverlaps.py | UTF-8 | 15,353 | 3.0625 | 3 | [] | no_license | ######################################################################
#
# HOLA == Human-like Orthogonal Layout Algorithm
# This file is part of HOLA.
#
# Copyright (C) 2014-2015 Steve Kieffer
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public Licens... | true |
0740c1c5aa390a6ff2f231fe679171c4747a000b | castorini/serverless-bert-reranking | /rerank/evaluation/asnq/direct_eval.py | UTF-8 | 7,306 | 2.578125 | 3 | [] | no_license | import os
import argparse
from collections import defaultdict
import numpy as np
import subprocess
MaxMRRRank = 10
def dd_list_wrapper():
return defaultdict(list)
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("--split", required=False, default="dev", type=str,
... | true |
bba7edb7023f91d21a8e6e0504dc2b43baf9728d | tansey/tensorflow-wavenet | /plot_results.py | UTF-8 | 870 | 2.75 | 3 | [
"MIT"
] | permissive | import matplotlib
matplotlib.use('Agg')
import matplotlib.pylab as plt
import numpy as np
import seaborn as sns
sizes = [256, 512, 1024, 2048]
softmax = [ 2.5780, 3.2630, 3.9440, 4.7100 ]
unsmoothed = [ 2.4750, 3.1990, 4.0300, 4.6710 ]
smoothed = [ 2.4820, 3.2970, 3.8730, 4.6240]
with sns.axes_style('white'):
plt... | true |
b41ac6f55da0e50c48377b66f84954c0780cb3b4 | OJ13/Python | /Udemy/python&MySql/excecoes.py | UTF-8 | 111 | 3.359375 | 3 | [] | no_license | a = 2
b = 0
try:
print(1 / 2)
print(a / b)
except:
print("Não é permitida divisão por 0") | true |
267bb7031e85c8eacd428e8b523650972c56f1f0 | jimgoo/zipline-tensorboard | /tensorboard.py | UTF-8 | 3,651 | 3.0625 | 3 | [
"MIT"
] | permissive | import datetime
import tensorflow as tf
class TensorBoard(object):
"""
TensorBoard is a visualization tool provided with TensorFlow.
This class can be used to record attributes from a running
Zipline algorithm.
If you have installed TensorFlow with pip, you should be able
to launch TensorBoar... | true |
d9cbb72e14af354f649e133a127a154187af4c28 | feup-infolab/army-ant | /scripts/trec/xml_topics_to_csv.py | UTF-8 | 633 | 2.8125 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
#
# xml_topics_to_csv.py
# José Devezas <joseluisdevezas@gmail.com>
# 2019-01-03
import sys
from lxml import etree
if len(sys.argv) < 3:
print("%s INPUT_XML OUTPUT_TXT" % sys.argv[0])
sys.exit(1)
in_filename = sys.argv[1]
out_filename = sys.argv[2]
print("==> Reading from %s" % in_file... | true |
d4d14cd8acd706deb9eea8197f3974e7ce41204a | sersavn/practice-hackerrank | /Python/Basic_data_types/Tuples.py | UTF-8 | 796 | 3.671875 | 4 | [] | no_license | #Task
#Given an integer,n ,and n space-separated integers as input, create a tuple, t, of those integers.
#Then compute and print the result of hash(t).
#Note: hash() is one of the functions in the __builtins__ module, so it need not be imported.
#Input Format
#The first line contains an integer, n, denoting the n... | true |
8ff2a380f3e7a948e04fec52cd1be17f1127d22b | clarinet758/aoj | /vol/vol.0-3/vol_00/a093.py | UTF-8 | 305 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
k=0
while 1:
a,b=map(int,raw_input().split())
if a==0:
break
if k:
print
f=0
k=1
for i in range(a,b+1):
if i%400==0 or (i%4==0 and i%100!=0):
f=1
print i
if f==0:
print "NA"
| true |
71d4eaa3ad60091222646c0f47ef0a201db797ba | taymourmansi/pongGame | /paddles.py | UTF-8 | 568 | 3.390625 | 3 | [] | no_license | from turtle import Turtle
PADDLE_WIDTH = 5
PADDLE_LEN = 1
UP = 90
DOWN = 270
class Paddles(Turtle,):
def __init__(self):
super().__init__()
def createPaddle(self,location):
self.location = location
self.shape("square")
self.shapesize(PADDLE_WIDTH,PADDLE_LEN)
self.goto(... | true |
2fddab2a6d0f8a2d19a4e323cf04373916b6405f | wjy199708/Visualization_KITTI_Waymo | /ToBev/visiable_LIDAR.py | UTF-8 | 4,973 | 2.59375 | 3 | [
"MIT"
] | permissive | import numpy as np
import mayavi
import mayavi.mlab as mlab
import argparse
from glob import glob
import os
import time
# from tvtk.tools import visual
def parse_args():
parse = argparse.ArgumentParser()
parse.add_argument('--index',
type=int,
help='the index file... | true |
b9c7153b2703c68f9ce3c873b6b1f32e9b45c769 | viviann-montenegro/learning-notes | /Python/python-exercicios/ex-40.py | UTF-8 | 459 | 3.9375 | 4 | [
"MIT"
] | permissive | """
Uma empresa contrata um encanador a R$ 30,00 por dia. Faça um programa que solicite o número de dias trabalhados
pelo encanador e imprima a quantia líquida que deverá ser paga, sabendo-se que são descontados 8% para o
imposto de renda.
"""
s = int(input('Foram quantos dias que o encanador trabalhou? '))
d = 30 * s... | true |
bb712510168a9718dcf264959448acb5eacf39be | MaxMenenberg/SerpinskiTriangle | /serpinskiTriangleAnnimated.py | UTF-8 | 2,309 | 3.203125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import time
# Update a matplotlib plot in dynamically
# Source: # https://stackoverflow.com/questions/10944621/dynamically-updating-plot-in-matplotlib
def UpdatePlot(axis, points, fig, x, y, n, N):
points.set_xdata(x)
points.set_ydata(y)
#Need both of thes... | true |
64fd10919dae618d672d854a9b5eb02d783647db | martarek/temporalcoherence | /nnet.py | UTF-8 | 8,740 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | from mlpython.learners.generic import Learner
import numpy as np
import theano as T
from theano.tensor.nnet import conv
from theano.tensor.signal import downsample
class NeuralNetwork(Learner):
def __init__(self,
lr=0.001,
dc=0,
sizes=[10,10,10,10],
... | true |
708773881180ebc80ccb373be2b4b0c7f36787c4 | sathishjayapal/sathishscripts | /utilityscripts/Speedtest.py | UTF-8 | 413 | 2.796875 | 3 | [] | no_license | # Internet Speed tester
# pip install speedtest-cli
import speedtest as st
# Set Best Server
server = st.Speedtest()
server.get_best_server()
# Test Download Speed
down = server.download()
down = down / 1000000
print(f"Download Speed: {down} Mb/s")
# Test Upload Speed
up = server.upload()
up = up / 1000000
print(f"Up... | true |
114b026a7b0fafcc478965b347f0d12e8f69a4cf | yuanrouyu/learnPython | /28—31/car_add.py | UTF-8 | 320 | 3.703125 | 4 | [] | no_license | class Car(object):
def __init__(self,w,d):
self.wheels=w
self.doors=d
self.color=""
self.shape=""
def paint(self,c,h):
self.color=c
self.shape=h
mycar=Car(4,2)
mycar.paint("red","round")
print(mycar.wheels)
print(mycar.doors)
print(mycar.color)
print(mycar.shape)
| true |
1fcfd2391aeb84d3c3c98fd4219174c566da2784 | sondrt/FYS-STK4155 | /Project2/Python/2D_ising.py | UTF-8 | 2,879 | 2.671875 | 3 | [] | no_license | import pickle
import os
import glob
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import sklearn.model_selection as skms
import sklearn.linear_model as skl
import sklearn.metrics as skm
import tqdm
import copy
import time
from IPython.display import display
#matplotlib in... | true |
e4b4ca07d30813f0884cb62c2f099b286b97aed6 | gbdsantos/recognition-faces-and-objects | /align-faces.py | UTF-8 | 956 | 2.6875 | 3 | [
"MIT"
] | permissive | import dlib
import cv2
import numpy as np
def imprimePoints(image, facialPoints):
for p in facialPoints.parts():
cv2.circle(image, (p.x, p.y), 2, (0, 255, 0), 2)
detectorFace = dlib.get_frontal_face_detector()
detectorPoints = dlib.shape_predictor("assets/shape_predictor_5_face_landmarks.dat")
image = cv2.... | true |
4025a2802226c68e8ec50b0bb6f0166b11d02563 | joabsilva/tcc-sdn-iot-onos | /Código embarcado na aplicação IoT/tcc.py | UTF-8 | 3,635 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#Autor: Joab de Araújo
#Código para uso em aplicação IoT no Trabalho de Conclusão de Curso - TCC
#Título: APLICAÇÃO DE REDES DEFINIDAS POR SOFTWARE EM INTERNET DAS COISAS
#Data: 25/03/2018
import RPi.GPIO as GPIO
import time
import paramiko
from scp import SCPClient
#Inicia a sessao SSH
ssh =... | true |
24e1e3500279b81fb89c8139cc9f4b3fe2f6669e | gilbutITbook/006936 | /Unit 28/practice_n_gram_word.py | UTF-8 | 187 | 3.359375 | 3 | [] | no_license | n = int(input())
text = input()
words = text.split()
if (len(words) < n):
print('wrong')
else:
n_gram = zip(*[words[i:] for i in range(n)])
for i in n_gram:
print(i)
| true |
284ad1b352bfe9643522bde7c06b873b8e873524 | mstop4/heckinsnek | /src/snektest.py | UTF-8 | 560 | 3.0625 | 3 | [
"MIT"
] | permissive | # program SnekTest.py
# human M.S.T.O.P
# when April 2017
# hello
# this is SnekTest
# pls proceeding to do a test
import heckinsnek
# doing a greet
print("doing a greet: ")
heckinsnek.hi()
print()
# try to boop
print("boop?: ")
if (heckinsnek.can_boop()):
print("doing a boop: ")
heckinsnek.doing_a_boop... | true |
4921883b64f00d2612ef8e384f3671b90b9a40b8 | YuehWu1994/Movie-Retrieval-System-based-on-video-ranking | /python video load balancing/utils.py | UTF-8 | 720 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
from numpy.random import normal as norm
from scipy.stats import uniform
from scipy.stats import expon
class utils:
def gaussianSample(lower, upper):
dis = upper-lower
ans = int(norm((lower+upper)/2, dis/6))
if ans >= upper: a... | true |
91d73b84cf2f6b6c3fecc4a30061b5443a73c367 | TrungBui59/healtheye | /database-functions/GetRecent/__init__.py | UTF-8 | 473 | 2.53125 | 3 | [
"MIT"
] | permissive | import logging
import azure.functions as func
import json
def make_message(message={"status": "ok"}, status=200):
return func.HttpResponse(
json.dumps(message),
status_code=200,
mimetype="application/json"
)
def main(req: func.HttpRequest, doc:func.DocumentList) -> func.Htt... | true |
c66773d2b5ea899e3fbfaddb06dfa7a87d7fa91a | 907597029/back_up | /keras_t/keras_test1.py | UTF-8 | 2,576 | 3.59375 | 4 | [] | no_license | import numpy as np
import scipy as sp
import pandas as pd
import matplotlib.pyplot as plt
import tensorflow as tf
import keras
import sklearn
'''
了解前向传播和反向传导
这个例子是用np来实现感知机 用于和后面keras作对比
1.生成100个点, 用一条随机生成的线划为两部分
2.用感知机来画一条线来预测
'''
plt.rcParams['font.sans-serif']=['SimHei']#用来正常显示中文标签
plt.rcParams['axes.unicode_minus'... | true |
7ffc4a87a3b08df8bc63fbfc1bc1e44d7c82a2a6 | t-walker-21/cs7641 | /hw3/dataset1/dimRed/randomProj.py | UTF-8 | 1,056 | 2.984375 | 3 | [] | no_license | from sklearn import random_projection
import numpy as np
from sklearn.preprocessing import StandardScaler
import matplotlib.pyplot as plt
fin = open("../data1.txt","r")
X = []
y = []
for l in fin:
X.append(l.split(",")[:-2])
y.append(int(l.split(",")[-2]))
X = np.array(X,dtype=np.float32)
scaler = StandardS... | true |
cc6bfa54df6ad92252e19278711099438871a1d4 | dready10/AOC20 | /day 18.py | UTF-8 | 3,698 | 3.9375 | 4 | [] | no_license | def compute(operand1, operator, operand2):
if operator == '*':
return int(operand1) * int(operand2)
if operator == '+':
return int(operand1) + int(operand2)
return 0
def evaluate(expression, low_precedence_operators):
# format the expression for tokenizing convenience
expression = ... | true |
923db73eaab161ffc5513fd04c68f3f9e2e48115 | mabynke/neuraltracker | /tools/tf_tracker.py | UTF-8 | 4,208 | 2.78125 | 3 | [] | no_license | import os
import sys
#import tensorflow.contrib.keras as keras
#Input = keras.layers.Input
#TimeDistributed = keras.layers.TimeDistributed
#Conv2D = keras.layers.Conv2D
#MaxPooling2D = keras.layers.MaxPooling2D
#Flatten = keras.layers.Flatten
#Dense = keras.layers.Dense
#Model = keras.models.Model
from keras.layers im... | true |
a7611118cb9691b0b081ebd3c07a9edf52b0abea | Lyceion/DiscordUserEmbed | /UserEmbed.py | UTF-8 | 1,222 | 2.515625 | 3 | [
"MIT"
] | permissive | # ____ #
####################-=|NOTE|=-######################
#U SHOULD INPUT YOUR E-MAIL AND PASSWORD TO LINE-22#
#THIS IS FOR NORMAL DISCORD USERS... #
#Programmed By Cylops. (Lyceion) #
####################################################
#L... | true |
9c24067d876ae7fed1cee22d0d42d761a3ff8018 | edensit/--ChatClient | /socks/sock_handling.py | UTF-8 | 2,126 | 2.671875 | 3 | [] | no_license | import socket
import thread
import struct
import Queue
class SendTypeEnum:
TYPE_LOGIN = 1
TYPE_REGISTER = 2
TYPE_MSG = 3
TYPE_COMMAND = 4
TYPE_POKE = 5
class ReceiveTypeEnum:
TYPE_MSG = 1
TYPE_USER_LIST = 2
TYPE_POKE = 3
TYPE_CONNECTION_ERROR = 4
class BaseError(Exception):
... | true |
d148c006a75ba2bd082aaef582721050ecacc59e | chenlei65368/algorithm004-05 | /Week 2/id_140/LeetCode_104_140.py | UTF-8 | 650 | 3.453125 | 3 | [] | permissive | #
# @lc app=leetcode.cn id=104 lang=python3
#
# [104] 二叉树的最大深度
#
# @lc code=start
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def maxDepth(self, root):
maxlevel = 0
if root i... | true |
b16031b85598dbc173e0aa22c87a594c02247e8b | MaksymMinko/PythonLessons | /HomeWork1/Task16.py | UTF-8 | 224 | 3.828125 | 4 | [] | no_license | year = int(input('Enter the year: '))
a = year % 100
b = year % 400
c = year % 4
if (a == 0 and b == 0) or (a != 0 and c == 0):
print('We have 29 days in February')
else:
print('We have 28 days in February')
| true |
1863e83e967568cb3b5241232975019f88d56f6a | ContinuumIO/enaml | /enaml/core/traits_tracer.py | UTF-8 | 4,655 | 2.75 | 3 | [
"BSD-3-Clause"
] | permissive | #------------------------------------------------------------------------------
# Copyright (c) 2013, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-------------------------------------------------... | true |
e688db04f7034d6bdaaa526322d8933f49d6cb90 | nehcuh/multi-factor-gm-wind-joinquant | /市场分析工具/MC期货投资策略分析工具/分析工具1.py | UTF-8 | 1,833 | 2.75 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from scipy.interpolate import griddata
# 基本输入数据
DATA_FILE_PATH = 'data\\Report_2019-01-31_18-31-21.csv'
BACKTEST_TARGET_LIST = ['Custom Criteria', 'Net Profit', 'Total Trades', '% Pr... | true |
36b3d6a93ead9f314fdf2f33a5bf39664598a4d6 | samahDD/CS115b---Intro-To-Computer-Science | /date.py | UTF-8 | 8,720 | 3.84375 | 4 | [] | no_license | '''
Created on ___________4/17/17____________
@author: _________Bhavin Soni______________
Pledge: ___I pledge my honor that I have abided by the Stevens Honor System____________________
CS115 - Hw 11 - Date class
'''
DAYS_IN_MONTH = (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
DAYS_IN_WEEK = ( 'Sunday','Mo... | true |
b39d0499e2c087bf221ac6f5d1787dc9740a6dc0 | cicilili/Homework_of_2017sessdsa_after_deadline | /Homework_3/3.2.py | UTF-8 | 530 | 3.078125 | 3 | [] | no_license | '''
做计时实验,验证Dict的get item和set item都是O(1)的
'''
from timeit import *
# 验证get_item内置函数
for x in range(1000,10001,1000):
d={i:i for i in range(x)}
t=Timer('d[999]','from __main__ import d')
print('字典get_item,容量为%d,时间为%fs'%(x,t.timeit(1000)))
# 验证set_item内置函数
for x in range(1000,10001,1000):
d={i:i for i in... | true |
439a17177cbad7ed8ade0944586be273de47bc4b | 817772616/Immofind | /crawler/nestoria.py | UTF-8 | 913 | 2.671875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup as bs
RESULTS = []
def fetch_nestoria():
res = requests.get('https://www.nestoria.de/immobilien/mieten/potsdam?bedrooms=1,2&sort=newest').text
html = bs(res, 'html.parser')
for e in html.find_all('li', {'class': 'rating__new'}):
url = 'https://www.n... | true |
b56c3e8512dd8db40f3c8b15edf5becf969c550a | Konlll/Python_homework_2021_09_15 | /feladat05.py | UTF-8 | 259 | 3.578125 | 4 | [] | no_license | fuel_level = int(input("Add meg mennyi üzemanyag van a tankodban: "))
fuel_consumption = int(input("Add meg az autód fogyasztását (l/100 km): "))
distance = (fuel_level/fuel_consumption)*100
print(f"Ennyi km-t tudsz megtenni az autóddal: {distance:.0f}") | true |
ad85c589bf1a704434087f6f0a22352dbd325f35 | carlosCeron/UnivalleMicroservicios | /estudiantes/models.py | UTF-8 | 1,264 | 2.578125 | 3 | [] | no_license | from datetime import datetime
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import create_engine
db = SQLAlchemy()
def init_app(app):
db.app = app
db.init_app(app)
return db
def create_tables(app):
engine = create_engine(app.config['SQLALCHEMY_DATABASE_URI'])
db.metadata.create_all(e... | true |
82a5e9837352fb4dd2b83f6d14f9304c0003241c | wanqiangliu/python | /remeber_me.py | UTF-8 | 769 | 3.53125 | 4 | [] | no_license | import json
def get_stored_username():
file_name = 'username.json'
try:
with open(file_name) as file_object:
username = json.load(file_object)
except FileNotFoundError as e:
return None
else:
return username
def get_new_username():
username = input("Please input your name: ")
file_name = 'username.json... | true |
7185845d85b71980fe00e02ab395396999b99c69 | pratheeknagaraj/bio_solutions | /2015/bio-2015-1-1.py | UTF-8 | 1,077 | 4 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
bio-2015-1-1.py: Sample solution for question 1 on
the 2015 British Informatics Olympiad Round One exam
Block Palindromes
"""
__author__ = "Pratheek Nagaraj"
__date__ = "12 January 2016"
"""
The approach here is recursive and we take advantage of
python's lists in order to make the rev... | true |
93afb31db2ee40b3550f33e8d3dd7984a2df3136 | rafaelhenrique/cool_editor | /cool_editor/core/tests/test_utils.py | UTF-8 | 182 | 3.3125 | 3 | [] | no_license | import re
def count_words(word, sentence):
"""Count the number of occurrences of a word in the sentence"""
match = re.compile(word)
return len(match.findall(sentence))
| true |
8eee0ee58bcaf22f904692741a82f31f97ff9df9 | l327253678/JavascriptExample | /模拟登录空中网.py | UTF-8 | 4,477 | 2.828125 | 3 | [
"MIT"
] | permissive | import requests
import re
import PyV8
from chaojiying import chaojiying
'''
通过输入账号和假密码进行抓包,发现password字段进行过加密,采用主流的搜索方法全局搜索,和通过该字段的id或class属性名搜索,最后找到密码是通过js字段
进行加密,通过断点逐步逐步调试,发现最后的加密函数就是下面这段js,找到js加密函数就简单了,通过断点查找到对应的值,发现str为输入的密码,pwd为一段
长字符串,同样是通过搜索,发现只需要下面这个url变量的网页进行请求,返回值便包含这个dc值,通过pyv8调用js生成最后的加密参数。
由于该网站还有验证码,所以随... | true |
b15e0cd98c6db252f93ba81fb5b98ef29eb5baf0 | maxiv-science/20180278-analysis | /101_129/3_prepare_pynx.py | UTF-8 | 1,000 | 2.671875 | 3 | [] | no_license | """
Does not consider the q-space pixel sizes, just shifts the COM
to the center and pads to make the third dimension as long as
the other two.
"""
import h5py
import numpy as np
from scipy.ndimage.interpolation import map_coordinates
data = np.load('assembled.npz')['W'][4:46-4]
# pad to equal side, it gets weird ot... | true |
9323cb40594be902e614fbd58999fb4d60de1c15 | borro0/Remote-BatterlylessSensorTestbed | /print_continuously.py | UTF-8 | 88 | 3.296875 | 3 | [
"MIT"
] | permissive | import time
i = 0
while True:
print(f"hello world {i}")
i += 1
time.sleep(1) | true |
c626b0357db97c423b1777559650e92969fbb16b | pmdung2711/Student-Attendance-System-Raspberry-Pi | /firebase.py | UTF-8 | 1,130 | 2.84375 | 3 | [] | no_license |
import pyrebase
import time
import datetime
now = datetime.datetime.now()
date = now.strftime("%Y-%m-%d")
def push_data():
#setup API
config = {
"apiKey": "AIzaSyCNKnnz2QJjr8TERzUvCZsEbU53gV1lPUQ",
"authDomain": "case-study-70877.firebaseapp.com/",
"databaseURL": "https://case-study-... | true |
a25a3467af2095fe9f5b25655503abe8612a41b4 | imsanjoykb/Python-Programming-Problem-Solving | /Exercise-20-Element-Search.py | UTF-8 | 1,766 | 4.75 | 5 | [
"MIT"
] | permissive | '''
Exercise 20: Element Search
Write a function that takes an ordered list of numbers (a list
where the elements are in order from smallest to largest) and
another number. The function decides whether or not the given
number is inside the list and returns (then prints) an
appropriate boolean......-----------------
E... | true |
cf677c84332ab0235295a57a6dcba81433e828a2 | Aasthaengg/IBMdataset | /Python_codes/p02381/s248068707.py | UTF-8 | 257 | 2.828125 | 3 | [] | no_license | while(True):
n=int(input())
if(n==0):
break
val=list(map(int, input().split()))
sum=0
for i in val:
sum+=i
mean=sum/n
disp=0
for i in val:
disp+=(i-mean)**2
disp=disp/n
print(disp**0.5)
| true |
6af34ea27b2ef8a2f1e9a01282caeb98c09233d9 | bhavesh-20/competitive-codes | /They_are_everywhere.py | UTF-8 | 452 | 2.796875 | 3 | [] | no_license | #https://codeforces.com/contest/701/problem/C
n=int(input())
s=input()
se=set()
d=dict()
k=0
for i in s:
if i not in se:
se.add(i)
k+=1
d[i]=0
queue=[]
mi=100000000000
cnt=0
for i in range(n):
if d[s[i]]==0:
cnt+=1
d[s[i]]+=1
queue.append(i)
while cnt==k:
temp... | true |
fb27bd1564d3da4d0c5cf5240a902ec6474fd4d0 | vsesha/Kafka_sample | /producer.py | UTF-8 | 504 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python3
from time import sleep
from json import dumps
from kafka import KafkaProducer
class Producer():
def run(self):
producer = KafkaProducer(bootstrap_servers=['localhost:9092'],
value_serializer=lambda x:dumps(x).encode('utf-8'),
acks = 'all',
retries = 0)
fo... | true |
0da62902b2b32e2891bbc0e10f8e2a80773e1a01 | RubelBiswasCS/hate_detector | /analysis/roc.py | UTF-8 | 1,213 | 3.03125 | 3 | [] | no_license | import matplotlib.pyplot as plt
from sklearn.metrics import roc_curve, auc
import time
class ROC:
def __init__(self):
self.fpr = None
self.tpr = None
self.thresholds = None
self.predicted = None
self.ground_truth = None
def calculate(self, predicted, ground_truth):
... | true |
8b4e0c2e585b5111fce08e46414deb4e49081787 | harithaasheesh/mypythonrepo | /data_collection/sets/union_intersectn_dif.py | UTF-8 | 137 | 3.46875 | 3 | [] | no_license | a={1,2,3,4,5,6,7}
b={3,4,5,6,7,8,9,0}
print(a.union(b))
print(a.intersection(b))
print(a.difference(b)) #a-b
print(b.difference(a)) #b-a | true |
8ef2e7d4ddb6addbe5701d01f4a35c31a69cd644 | vivekvkt/programing_coding_test | /data_structure_python/searching/binary_search.py | UTF-8 | 429 | 3.515625 | 4 | [
"MIT"
] | permissive | def binarySearch(arr, l, r, skey):
if l<=r:
mid = l+(r-1)//2
if (arr[mid]==skey):
return mid
elif arr[mid]>skey:
return binarySearch(arr,l, mid-1,skey)
else:
return binarySearch(arr, mid+1, r, skey)
else:
... | true |
5b8e2d91ebdc3e0a086b1855990551a2314adced | dbbudd/Python-Experiments | /AI/BOOK - Problem Solving with Algorithms and Data Structures - EXAMPLES/Source/chap5/listing_5_7.py | UTF-8 | 221 | 3.09375 | 3 | [] | no_license | def insertRight(self,newNode):
if self.right == None:
self.right = BinaryTree(newNode)
else:
t = BinaryTree(newNode)
t.right = self.right
self.right = t
| true |
dc562b8268029723c6e0ffe7cf57d4dd3ddcc9cc | anaurochdm/rpg_random | /process_rolls.py | UTF-8 | 3,146 | 2.984375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from collections import Counter
from statistics import mean, mode
ROLLS_FILE = "rolls_so_far.txt"
USERS = ["macabreengel", "Saros", "Fyrefly", "ButtyMcButtox", "TheKwarg"]
DICE_ROLL_PREFIX = "Details:"
MIN_DIE = 1
MAX_DIE = 10
SUCCE... | true |
0cd550d640a39c15913ff8c6b26e6c6318df393b | Albert-learner/Algorithm | /Programmers/LEVEL2/RemoveWithPair.py | UTF-8 | 1,104 | 4.0625 | 4 | [] | no_license | # 33. 짝지어 제거하기
# 자료구조 stack을 사용해야한다는 것까지는 갔으나...
def solution(s):
answer = 0
stack = []
for ch in s:
if len(stack) == 0:
stack.append(ch)
elif stack[-1] == ch:
stack.pop()
else:
stack.append(ch)
if len(stack) == 0:
answer = 1
els... | true |
3f542c9b28b69dae7b474dab5bdad886f8ee3a2d | Manish-kd/Personal-Assistant | /Mak2-0.py | UTF-8 | 4,041 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python3
# Requires PyAudio and PySpeech.
import speech_recognition as sr
from time import ctime
import time
import os
import webbrowser
from gtts import gTTS
def speak(audioString):
print(audioString)
tts = gTTS(text=audioString, lang='en')
tts.save("audio.mp3")
os.syste... | true |
cdc4feb2799634d37d02f370b6b7ea4e27a26b47 | romainjayles/astar | /Astar.py | UTF-8 | 4,341 | 3.65625 | 4 | [] | no_license | #! /usr/bin/python
# -*- coding:utf-8 -*-
class Astar:
""" Main class implemented the A* algorithm """
def __init__(self, start_node, end_node, heuristic_function, generate_sucessors_function):
"""
Initialisation of the Astar algorithm :
start_node the node S0
end_nod... | true |
40f19ce8c3962b9e469ba52ca8ef0175172ec0f2 | mlkm/utils | /python/include-tree.py | UTF-8 | 566 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
import sys
import re
visited = set()
depth = 0
def trackIncludes(fileName):
global visited, depth
source = open(fileName).read()
includes = re.findall('^ *#include *"(.*?)" *$', source, re.MULTILINE)
for i in includes:
if i not in visited:
visited.add(i)
print depth*' ' ... | true |
c8c12be768b4ada0aed0595dc6d45d626677944f | gpompe/basic_normalizer | /tests/testnormalization.py | UTF-8 | 2,945 | 3.0625 | 3 | [
"MIT"
] | permissive | import unittest
from unittest.mock import patch, mock_open
from textwrap import dedent
import normalizer as norm
class TestNormalization(unittest.TestCase):
def setUp(self):
norm.loadData()
def test_replacesubstitutes(self):
"""should replace subsitutes"""
self.assertEqual(norm.norma... | true |
2663732d78aed397f21e36bdbd07415a26868e34 | phyupyarko/python-exercises | /ex21.py | UTF-8 | 615 | 4.46875 | 4 | [
"MIT"
] | permissive | def add(a,b):
print(f"ADDING {a} + {b}")
return a+b
def subtract(a,b):
print(f"SUBTRACTING {a} - {b}")
return a - b
def multiply(a,b):
print (f"MULTIPLYING {a} * {b}")
return a * b
def divide(a,b):
print(f"DIVIDING {a} / {b}")
return a/b
print("Let's do some math with just functions!")
a... | true |
a994b0b186250c4bf54e70a1c4574eaae0d4d1e4 | sandeepyadav10011995/Data-Structures | /Arrays/19. Minimum Item In A Rotated Sorted Array.py | UTF-8 | 882 | 4.03125 | 4 | [] | no_license | """
Given a rotated sorted array, find the minimum element.
A "rotated" array is an array that has had each item shifted to the left or right by k units (where k is a positive integer) while maintaining positional integrity of every element in the original array.
Example 1:
Input: [4, 5, 6, 7, 1, 2]
Output: 1
Exampl... | true |
248a7d3b3c7c0e9cfb4ae3e1718e4c384f84a7e5 | Pactortester/QDS_company | /utils/readconfig.py | UTF-8 | 923 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | # coding=utf-8
import configparser
import codecs
class ReadConfig:
"""
专门读取配置文件的,.ini文件格式
"""
def __init__(self, filename):
# configpath = os.path.join(prjDir,filename)
configpath = filename
# print(configpath)
fd = open(configpath)
data = fd.read()
# r... | true |
2f38512a66ec612b04fd3c25101a84fb92628c13 | hadjigagny93/x-ray-images-covid-detection | /src/infrastructure/data_preparation.py | UTF-8 | 1,858 | 2.796875 | 3 | [] | no_license | import numpy as np
import src.settings.base as sg
import cv2
from tensorflow.keras.utils import to_categorical
from sklearn.preprocessing import LabelBinarizer
import os
from imutils import paths
class DataPreparation():
"""
Process date feature.
Methods
-------
do_preprocessing
"""
max_... | true |
0b67a32b8d7b41e377cdb638163acbeb53a0b663 | KyleThao008/CSE | /Object Notes v2 - Kyle Thao.py | UTF-8 | 1,363 | 3.75 | 4 | [] | no_license | import random
class Burger(object):
def __init__(self, patty, cheese, vegetables, toppings, eat):
self.bun = True
self.patty = patty
self.cheese = cheese
self.vegetables = vegetables
self.toppings = toppings
self.eat = eat
def order(self):
if self.chees... | true |
1559119902d92f916af353b04a100ad2302bdc4e | ackerman15/BASTS | /Tree-LSTM_pretrain/1.constructDataPair.py | UTF-8 | 6,809 | 2.734375 | 3 | [] | no_license | """
Construct sentence pairs and vocab of tree-lstm pre-training model
"""
from utils import Node
from collections import Counter
import json
import random
import numpy as np
import pickle
from tqdm import tqdm
def build_tree(data_name, data_type):
path = data_name + '/' + data_type + '/split_' + data_type + '_a... | true |
1f931ee5194d7799c31d31b88618d43beae8fb85 | katsuya0719/pynergyplus | /VRFCurveMaker/CellParser.py | UTF-8 | 3,248 | 3.109375 | 3 | [] | no_license | __author__ = 'claytonmiller'
import re
from xlrd import open_workbook
import csv
def GetData(sheetind):
"""
Pulls Data out of a spreadsheet
:param sheetind:
:return:
"""
sheet = book.sheet_by_index(sheetind)
# Retrieve Combination % from First Column
CombPerList = []
for row in s... | true |
148a3f3ce06a7b5951d1334d847d9fea781e7c6e | oubiwann/peloid | /python/peloid/app/mud/parser.py | UTF-8 | 5,891 | 2.765625 | 3 | [
"MIT"
] | permissive | from twisted.python import log
from peloid import const
commandError = {"error": "Command not found."}
shellError = """
The command you entered did not make sense; please try again.
To see a list of available commands, please type 'help' or '?'
"""
class CommandParser(object):
"""
CommandParser subclasses... | true |
2d14cbfe26ac6fe49e74779f1752f65ab21112f6 | creuter23/fs-tech-artist | /Staff/mclavan/old/mecScripts/myDev/podcasts/cri_funtions2.py | UTF-8 | 1,816 | 3.546875 | 4 | [] | no_license | '''
Functions
Arguments and Return Statements
functions2.py
Description:
- This script covers how to take advantage of functions by using
arguments and return statements.
How to Run:
import functions2
reload( functions2 )
'''
'''
Functions
Arguments
'''
def createSphere():
cmds.sphere()
# To use
# createSp... | true |
61239855eaef06fe63f0fbad442d1ab50fb405cd | dj-on-github/RNGBook_Code | /xor_iterate.py | UTF-8 | 5,937 | 2.765625 | 3 | [] | no_license | from fractions import Fraction
from mpmath import *
def xor_iterate(n):
next_prob=dict()
one_third = Fraction('1/3')
p_input = {0:0, 1:one_third, 2:one_third, 3:one_third}
p_pool = p_input
print("Iteration P(00) P(01) P(10) P(11)")
for i in range(n):
prob00 = p_input[0]*p_pool... | true |
4ac9edcc3151f022cdc1e1824cfa36717688f38c | gudrunvaldis/thesis | /plots.py | UTF-8 | 2,492 | 3.09375 | 3 | [] | no_license | import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import scipy.stats as stats
import sys
# # load numpy arrays
a = np.loadtxt('lstm_smallbuckets_forecToday_20x4.txt')
print "min: ", np.amin(a)
print "max: ", np.amax(a)
print "std dev: ", np.std(a)
print "mean: ", np.mean(a... | true |
7b87c09f31ff0ad3f3f99fafeab98b55167ad7b0 | mirimadahmed/Project-Euler-Problem-6-Solution | /main.py | UTF-8 | 101 | 3 | 3 | [] | no_license | num2 = sum([i*i for i in range(1,101)])
num = sum(range(1,101))
num = num * num
print num - num2
| true |
3afa0b06dbfcef534cfa76ceeb56ecd57b835c15 | jjunsheng/learningpython2 | /exercise9.py | UTF-8 | 1,556 | 3.71875 | 4 | [] | no_license | # 1
marks = {}
marks["John"] = [76, 65, 43]
marks["Mary"] = [68, 56, 74]
marks["Peter"] = [46, 55, 48]
# 2
marks["Ada"] = [56, 45, 65]
# 3
print(marks)
marks["Mary"][2] = 87
print(marks)
print()
# 4
del marks["Peter"]
print(marks)
print()
# 6
def showMarks(marks, name):
if not marks[name]:
print("{0} n... | true |
01d4eed2028d7ead90a0d013d9a5b13961a30424 | reks93/Python | /day29_Infinitenumber.py | UTF-8 | 436 | 4 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Sep 26 22:31:17 2020
@author: rekha
"""
#Question29:check if a given number is infinite or not
import math
def isinfinite(num):
if(math.isinf(num)):
print("The number {} is infinite:" .format(num))
else:
print("The number {} is not infin... | true |
56857777319706d3f70b690bb7f0ecc6650a8f65 | vishalbelsare/Causing | /svg.py | UTF-8 | 1,027 | 2.671875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # -*- coding: utf-8 -*-
"""Create svg graphics.
requires python3-cssselect
"""
from svglib.svglib import SvgRenderer
from lxml import etree
def fromstring(xml_string, replacements=None, **kwargs):
"""create svg graphics from string"""
if replacements:
for (key, value) in replacements.items():
... | true |
d6ac9dd569e309c5f30079d77045283ba1de522c | maria-zdr/softuni | /Python Fundamentals/Lists Exercise/09. Insertion Sort Using List.py | UTF-8 | 350 | 3.171875 | 3 | [] | no_license | list_numbers = list(map(int, input().split(' ')))
list_result = [list_numbers.pop(0)]
while list_numbers:
current = list_numbers.pop(0)
position = 0
for i in range(0, len(list_result)):
if list_result[i] <= current:
position = i + 1
list_result.insert(position, current)
print(' '... | true |
8ea2f045bc7fd1107ead35bb9ba47f0cdf301360 | xilen0x/ejercicios-python | /working_with_csv.py | UTF-8 | 473 | 3.546875 | 4 | [] | no_license | #creación de un archivo csv y guardado de datos en él
import csv
doc_csv = open('archivo.csv', 'w')
data = csv.writer(doc_csv)
lista = [
["carlos@hotmail.com",78451232],
["claudia@gmail.com",32215487],
["cristian@latinmail.com",65653298]
]
for e in lista:
data.writerow(e)
doc_csv.close()
#lectura de... | true |
5aa81836f3943a9362a15b47b010b7d2c1d78a73 | AndrewTruett/histogrammer | /Roll.py | UTF-8 | 1,265 | 3.734375 | 4 | [
"MIT"
] | permissive | import random
class Roll:
"""This class represents a single roll instance, created from typing a roll command"""
def __init__(self, num_dice, dice, author, created_at):
self.author = author
self.created_at = created_at
self._rolls = []
# make sure values are reasonable
... | true |
11ee9b060ebf1de1d11180c8aead78075cc17349 | aaaasule/zndhjqr | /flask_script/load_model.py | UTF-8 | 795 | 2.578125 | 3 | [] | no_license | import requests
import json
# 通过向nlu服务器发送parse请求(用于向指定模型发送语句请求意图识别置信度)的方式将模型上载到nlu模型服务器内存
def load_model():
# 请求的数据,需指定项目名和模型名
ml_loaddata = {
"q": "load",
"project": "nlu_p1",
"model": "model1"
}
m2_loaddata = {
"q": "load",
"project": "nlu_p2",
"model"... | true |
36d8e008aa2080805d7ec419ae4207a26824588e | Wertys1337/NSC | /nsc.py | UTF-8 | 1,826 | 3.328125 | 3 | [] | no_license | import sys
def block_restart():
print('\nперезапустить программу? (если нет, программа закроетеся)')
ans = input('[д/н] >')
if ans == 'д':
print(' ')
elif ans == 'н':
sys.exit()
else:
print('пожалуйста ответьте - да (д) или нет (н) ')
block_restart()
... | true |
a50920ba19bef922b684021561eb4c817ef4ac37 | fredy1221/PythonMiniProjects | /Email scraping marketing tool.py | UTF-8 | 3,155 | 2.71875 | 3 | [] | no_license | import google
import re
import tkinter as tk
import os
import shutil
import glob
import xlwt
from xlwt import Workbook
wb = Workbook()
HEIGHT = 600
WIDTH = 800
def get_results(num_page,search_string,excel_file):
ws = wb.add_sheet(excel_file)
label_log['text']="getting emails"
try:
num_page = ... | true |
3a3a83a28abad37d047c6229931e6dc693fb5e2a | Kunal627/qcexamples | /example3.py | UTF-8 | 1,404 | 3.21875 | 3 | [] | no_license | #Generate a 8 bit random number from 3 qubits
# to produce a 2**x bit random integer, we need x cubits to represent x states
import qiskit
import sys, time
logging.getLogger('qiskit.transpiler').setLevel(logging.DEBUG)
# create a 3 qubit circuit,
circuit = QuantumCircuit(3,3)
# apply hadamard gate on all three qub... | true |
5cb496fef8b0d1996e68e6c69a27d3aa927489ae | ulule/pybbm | /pybb/fields.py | UTF-8 | 5,267 | 2.71875 | 3 | [] | permissive | import os
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import filesizeformat
from django.db.models import FileField
from django.forms import forms
from django.core.exceptions import SuspiciousOperation
from django.utils._os import safe_join
from django.utils.encoding impo... | true |
819e489c13de6e166ee78c7ff4fed4c765c98cc8 | lirongzhao/python_project_01 | /python_class/api_lesson_04.py | UTF-8 | 2,699 | 4.03125 | 4 | [] | no_license | # python函数
"""
函数:有一段代码,重复使用到,把这段代码进行一个封装 -- 函数 -- 调用这个函数
作用:提高代码复用率
格式:
define定义
def 函数名():
函数体(真正实现具体功能的代码)
注意:函数定义完之后没有被调用 不会被调用的
如何调用
函数里面可能会变化的内容,不建议写在函数里面 --参数化
定义参数的类型:
1.必备参数:定义了就必须传入的参数,不传或少传会报错
注意必备参数放在默认参数前面
2.默认参数:如果有些参数有一些大概率情况-- 值==默认值 ===可以不传的 --使用默认值;传入的话,替换默认值
3.不定长的参数: 是个元组
*args等到前面必备参数和默认参数都... | true |
0e0982e7ee7e27447bc912a60fb77ac3c3448018 | emreozb/HackerRank_Exercises | /maximumToys.py | UTF-8 | 197 | 3.3125 | 3 | [] | no_license | prices = [1,12,5,111,200,1000,10]
k = 50
counter = 0
sum_toys = 0
prices.sort()
for p in prices:
sum_toys += p
if sum_toys < k:
counter += 1
else:
break
print(counter)
| true |
96804868fe00ce80b26c69fda619f5d51911802e | Hugomguima/FEUP | /1st_Year/1st_Semestre/Fpro/RE's/RE09/sparse_dot_product.py | UTF-8 | 313 | 3.09375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 28 11:50:35 2018
@author: Hugo
"""
def sparse_dot_product(dict1,dict2):
inner = 0
for key in dict1:
if key in dict2:
inner += dict1[key] * dict2[key]
return inner
#print(sparse_dot_product({0: 1, 1: 1},{2: 1, 3: 1})) | true |
c73fcc04368aef31d1a3d044bc8113500a6ea76d | ywfan617/python- | /pintia/第6章-6 求指定层的元素个数.py | UTF-8 | 325 | 3.359375 | 3 | [] | no_license | def f(array,aspect,level):
length=0
if aspect==level:
length+=len(array)
else:
for i in array:
if type(i)==list:
length+=f(i,aspect,level+1)
return length
if __name__ == '__main__':
array=[1,2,[3,4,[5,6],7],[8,9,[1,2,3,4,5]]]
res=f(array,3,1)
print... | true |
57d47b9358d77cadf12d01af71030cb99f622d3f | anonymous-authors-2018/DisCoRL | /srl_zoo/models/vae.py | UTF-8 | 1,905 | 2.796875 | 3 | [
"MIT"
] | permissive | from __future__ import print_function, division, absolute_import
from .models import *
class DenseVAE(BaseModelVAE):
"""
Dense VAE network
:param input_dim: (int)
:param state_dim: (int)
"""
def __init__(self, input_dim, state_dim=3):
super(DenseVAE, self).__init__()
self.in... | true |
b61c3e0d3d7727acc6753e5aa208d03cbf7ef255 | jake94a/paper-alpaca | /query_alpaca.py | UTF-8 | 1,406 | 2.734375 | 3 | [] | no_license | import alpaca_trade_api as tradeapi
API = tradeapi.REST()
def submit_order(symbol, qty, buy_or_sell):
# check if symbol is owned before trying to sell it
# if qty is too great (ie: too expensive), reduce it to a specified amt
if buy_or_sell.lower() not in ["purchase", "buy", "sell", "sale"]:
pri... | true |
2223f38aa810acd068c482a082d6b91f19824cef | Kawser-nerd/CLCDSA | /Source Codes/CodeJamData/13/11/10.py | UTF-8 | 411 | 3.453125 | 3 | [] | no_license |
def comp(x, r):
return 2 * x * x + (3 + 2 * r) * x + 2 * r + 1
def solve():
R, T = map(int, input().split())
l = 0
r = T + 1
while l + 1 < r:
m = (l + r) // 2
if comp(m - 1, R) <= T:
l = m
else:
r = m
return l
T =... | true |
1270ed11fa7f529e9f500a681f7837eb45882afb | Terradue/dcs-testsuite | /src/main/app-resources/test008/nodes/run2 | UTF-8 | 938 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | #!/opt/anaconda/bin/python
import sys
import os
import os.path
import atexit
# import the ciop functions (e.g. copy, log)
import cioppy
ciop = cioppy.Cioppy()
# define the exit codes
SUCCESS = 0
ERR_NOINPUT = 1
# add a trap to exit gracefully
def clean_exit(exit_code):
log_level = 'INFO'
if exit_code != SUC... | true |
5327fe6691e40e030657ac00f2ed8fffcfb69b6f | Eliminate2810/Eliminate2810.github.io | /code/python_scipy/Experiment_1/6.分段函数.py | UTF-8 | 876 | 3.484375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
#x(n),x(n+3),x(-n-3)
plt.rcParams['font.sans-serif']=['SimHei'] #加上这一句就能在图表中显示中文
plt.rcParams['axes.unicode_minus']=False #用来正常显示负号
#变量
top = 20; bot = -20
x1=-2;x2=0;x3=4;x4=8
n = np.arange(bot, top)
x=np.arange(bot, top)
y = np.arange(bot, top)
# y函数
y[:] = 0
for i... | true |
75baa9b03b71b6f2c77a868592d5b8b6bd51b357 | adam-weiler/GA-Authorization-Django-Blog | /blog/forms.py | UTF-8 | 1,774 | 2.65625 | 3 | [] | no_license | from datetime import date
from django.forms import CharField, DateInput, Form, ModelForm, PasswordInput
from blog.models import Article, Comment
class ArticleForm(ModelForm):
class Meta:
model = Article
# fields = ['title', 'body', 'draft', 'published_date', 'author']
fields = ['title', 'b... | true |
a260ac9bb813c28bcc5962e153b99d82657255c7 | JingkaiTang/github-play | /eye/seem_government.py | UTF-8 | 278 | 2.828125 | 3 | [] | no_license |
#! /usr/bin/env python
def person_or_public_place(str_arg):
call_high_person_of_other_way(str_arg)
print('point_and_long_company')
def call_high_person_of_other_way(str_arg):
print(str_arg)
if __name__ == '__main__':
person_or_public_place('company_or_eye')
| true |
c26dcecfebea37b61c774b2a54c82a9bf15c2668 | andrewzwicky/puzzles | /CodeEval/challenge_30.py | UTF-8 | 380 | 2.875 | 3 | [
"MIT"
] | permissive | import sys
def challenge(input_string):
set1, set2 = list(map(set, [list(map(int, i.split(','))) for i in input_string.strip().split(';')]))
inter = set1.intersection(set2)
return ','.join(list(map(str, inter)))
if __name__ == "__main__":
with open(sys.argv[1], 'r') as test_cases:
... | true |
e9bbac8440944a604eb55584129a3f815457e964 | AaronBangs/PyCheckers | /py_checkers/ai_api/bot.py | UTF-8 | 3,252 | 4.15625 | 4 | [] | no_license | #JMJ
#Agent.py
#An interface to work with the class competition.
#Programmed by Ben Campbell
"""
Board Conventions:
Ben and I discovered while trying to get our bots to play each other that we need a standard convention for numbering the board. We've decided on the following conventions:
1. The columns are numbered ... | true |