text stringlengths 0 1.05M | meta dict |
|---|---|
#!/bin/python
#coding:utf-8
import os;
import sys;
import common
import math
import random
import numpy as np
import scipy.sparse as sp
import logging,Logger
#active function list
#1. linear ( not active )
#2. sgmoid
#3. tanh
#4. rel
def logit(A):
l = A[ A >= 0.0 ]
A[A >= 0.0] = 1 / (1... | {
"repo_name": "rustle1314/Representation-based-Multilabel-Learning",
"path": "active.py",
"copies": "2",
"size": "5868",
"license": "mit",
"hash": -9185334831406659000,
"line_mean": 29.722513089,
"line_max": 93,
"alpha_frac": 0.5025562372,
"autogenerated": false,
"ratio": 3.307779030439684,
"co... |
#!/bin/python
#coding:utf-8
import os
import sys
path = os.path.split(os.path.realpath(__file__))[0]
sys.path.append(path)
from learnrate import *
from common import *
from active import *
from threshold import *
import numpy as np
import scipy.sparse as sp
import scipy.sparse.linalg as splinalg
imp... | {
"repo_name": "rustle1314/latent_factor_multi_label",
"path": "latent_factor.py",
"copies": "2",
"size": "21255",
"license": "mit",
"hash": -2035898363218648000,
"line_mean": 34.5434782609,
"line_max": 120,
"alpha_frac": 0.4539167255,
"autogenerated": false,
"ratio": 3.510901883052527,
"config_... |
#!bin/python
# -*- coding: utf-8 -*-
import os
import unittest
from datetime import datetime
from config import basedir
from blog import app, db
from blog.models import Article, Comment, Category
class TestCase(unittest.TestCase):
def setUp(self):
app.config['TESTING']=True
app.config['SQLALCHEMY... | {
"repo_name": "pulmro/pulmro-blog",
"path": "db_test.py",
"copies": "1",
"size": "2469",
"license": "apache-2.0",
"hash": 7669540650090105000,
"line_mean": 33.2777777778,
"line_max": 100,
"alpha_frac": 0.5958654236,
"autogenerated": false,
"ratio": 3.445530726256983,
"config_test": true,
"has... |
#!/bin/python
#-*-coding:utf-8-*-
import Pbit.pbit_processing
import sys
class Pbit_ASCII():
"""
class to convert between binary and ascii
"""
def __init__(self):
self.processing = Pbit.pbit_processing.Pbit_Processing()
def convert_ascii(self,Decimal_list,return_types="List"):
"""... | {
"repo_name": "KotatuBot/Pbit",
"path": "Pbit/pbit_ascii.py",
"copies": "1",
"size": "2065",
"license": "mit",
"hash": -1166558587405959700,
"line_mean": 23.2941176471,
"line_max": 64,
"alpha_frac": 0.4905569007,
"autogenerated": false,
"ratio": 4.412393162393163,
"config_test": false,
"has_n... |
#!/bin/python
#coding:utf-8
import random
import copy
from random import choice
import roomai
from roomai.games.common import AbstractEnv
from roomai.games.bang import BangActionChance
from roomai.games.bang import BangAction
from roomai.games.bang import BangActionType
from roomai.games.bang import OtherActio... | {
"repo_name": "roomai/RoomAI",
"path": "roomai/games/bang/BangEnv.py",
"copies": "1",
"size": "16220",
"license": "mit",
"hash": 128307210435660370,
"line_mean": 53.7220338983,
"line_max": 187,
"alpha_frac": 0.5866683187,
"autogenerated": false,
"ratio": 3.9670680756942738,
"config_test": false... |
#!/bin/python
#coding:utf-8
import re
import roomai.games.common
class TexasHoldemAction(roomai.games.common.AbstractAction):
'''
The TexasHoldemAction. The action consists of two parts, namely option and price.\n
The option is one of "Fold","Check","Call","Raise","AllIn", and the price is the chips used... | {
"repo_name": "roomai/RoomAI",
"path": "roomai/games/texasholdem/TexasHoldemAction.py",
"copies": "1",
"size": "2955",
"license": "mit",
"hash": -2089682629556794000,
"line_mean": 36.2025316456,
"line_max": 280,
"alpha_frac": 0.5961211296,
"autogenerated": false,
"ratio": 3.3704128440366974,
"c... |
#!/bin/python
#coding:utf-8
import roomai.common
import copy
import logging
import random
import sys
from functools import cmp_to_key
from roomai.fivecardstud.FiveCardStudUtils import FiveCardStudPokerCard
from roomai.fivecardstud.FiveCardStudInfo import FiveCardStudPublicState
from roomai.fivecardstud.FiveCardStu... | {
"repo_name": "DMRookie/RoomAI",
"path": "roomai/fivecardstud/FiveCardStudEnv.py",
"copies": "1",
"size": "32695",
"license": "mit",
"hash": -1818153567152072000,
"line_mean": 36.2805017104,
"line_max": 175,
"alpha_frac": 0.5280623949,
"autogenerated": false,
"ratio": 3.6039462081128746,
"confi... |
#!/bin/python
#coding:utf-8
import roomai.common
import copy
class TexasHoldemPublicState(roomai.common.AbstractPublicState):
'''
The public state of TexasHoldem
'''
def __init__(self):
self.__stage__ = None
self.__num_players__ = None
self.__dealer_id__ ... | {
"repo_name": "DMRookie/RoomAI",
"path": "roomai/texas/TexasHoldemInfo.py",
"copies": "1",
"size": "10169",
"license": "mit",
"hash": 6450830070126680000,
"line_mean": 42.8362068966,
"line_max": 280,
"alpha_frac": 0.5804897237,
"autogenerated": false,
"ratio": 3.541971438523163,
"config_test": ... |
#!/bin/python
#coding:utf-8
import roomai.common
class TexasHoldemAction(roomai.common.AbstractAction):
'''
The TexasHoldemAction. The action consists of two parts, namely option and price.\n
The option is ["Fold","Check","Call","Raise","AllIn"], and the price is the chips used by this action.\n
The Te... | {
"repo_name": "DMRookie/RoomAI",
"path": "roomai/texas/TexasHoldemAction.py",
"copies": "1",
"size": "2308",
"license": "mit",
"hash": 5462259566887011000,
"line_mean": 31.7428571429,
"line_max": 150,
"alpha_frac": 0.5833333333,
"autogenerated": false,
"ratio": 3.542503863987635,
"config_test":... |
#!/bin/python
#coding:utf-8
import roomai.common
class FiveCardStudAction(roomai.common.AbstractAction):
'''
The FiveCardStudAction. The action consists of two parts, namely option and price.\n
The option is ["Fold","Check","Call","Raise","Bet", "Showhand"], and the price is the chips used by this action.... | {
"repo_name": "DMRookie/RoomAI",
"path": "roomai/fivecardstud/FiveCardStudAction.py",
"copies": "1",
"size": "2936",
"license": "mit",
"hash": 4272659811487957000,
"line_mean": 35.9113924051,
"line_max": 121,
"alpha_frac": 0.5847050754,
"autogenerated": false,
"ratio": 3.287485907553551,
"confi... |
#!/bin/python
#coding:utf-8
import roomai.games.common
from roomai.games.texasholdem.TexasHoldemUtil import AllPokerCardsDict
from roomai.games.texasholdem.TexasHoldemUtil import PokerCard
class TexasHoldemActionChance(roomai.games.common.AbstractActionChance):
'''
The TexasHoldemActionChance is the action use... | {
"repo_name": "roomai/RoomAI",
"path": "roomai/games/texasholdem/TexasHoldemActionChance.py",
"copies": "1",
"size": "2187",
"license": "mit",
"hash": -3802475241969036000,
"line_mean": 34.8524590164,
"line_max": 143,
"alpha_frac": 0.6570644719,
"autogenerated": false,
"ratio": 3.4332810047095763... |
#!/bin/python
#coding:utf-8
import roomai.games.common
class TexasHoldemStatePublic(roomai.games.common.AbstractStatePublic):
'''
The public state of TexasHoldem
'''
def __init__(self):
super(TexasHoldemStatePublic, self).__init__()
self.__stage__ = None
self.__pub... | {
"repo_name": "roomai/RoomAI",
"path": "roomai/games/texasholdem/TexasHoldemStatePublic.py",
"copies": "1",
"size": "8028",
"license": "mit",
"hash": 2090322343516987100,
"line_mean": 44.3615819209,
"line_max": 265,
"alpha_frac": 0.5789735924,
"autogenerated": false,
"ratio": 3.677508016491067,
... |
#!/bin/python
# -*- coding: utf-8 -*-
import struct
import sys
import binascii
import pdb
reload(sys)
sys.setdefaultencoding('utf-8')
# 搜狗的scel词库就是保存的文本的unicode编码,每两个字节一个字符(中文汉字或者英文字母)
# 找出其每部分的偏移位置即可
# 主要两部分
# 1.全局拼音表,貌似是所有的拼音组合,字典序
# 格式为(index,len,pinyin)的列表
# index: 两个字节的整数 代表这个拼音的索引
# len: 两个字节的整... | {
"repo_name": "Danceiny/HackGirlfriend",
"path": "Libraries/scel2txt.py",
"copies": "1",
"size": "5334",
"license": "apache-2.0",
"hash": -6509408768921469000,
"line_mean": 21.8655913978,
"line_max": 72,
"alpha_frac": 0.5265757291,
"autogenerated": false,
"ratio": 1.9630655586334256,
"config_te... |
#!/bin/python
# -*- coding: utf-8 -*
import sys
from db_transport import DbTransport
from external_db_transport import ZonaGratisBrDbTransport
import logging
import json
import os
from math import cos, sin, pi
from random import uniform
import time
class BulkManager(object):
def __init__(self):
self.serve... | {
"repo_name": "gerasdf/wefree",
"path": "wefree/bulk_manager.py",
"copies": "1",
"size": "2576",
"license": "mit",
"hash": 7639749068629504000,
"line_mean": 35.2676056338,
"line_max": 92,
"alpha_frac": 0.5435120435,
"autogenerated": false,
"ratio": 3.6929698708751793,
"config_test": false,
"h... |
#!bin/python
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
from flask import Flask, Response, jsonify, request, redirect, url_for
import json
from billing import *
from werkzeug.contrib.fixers import LighttpdCGIRootFix, HeaderRewriterFix
from icomera_auth import auth_client
from vidima... | {
"repo_name": "rdl-telecom/billing",
"path": "app.py",
"copies": "1",
"size": "14488",
"license": "unlicense",
"hash": 2009269776633847600,
"line_mean": 32.0022779043,
"line_max": 148,
"alpha_frac": 0.5775814467,
"autogenerated": false,
"ratio": 3.4073377234242708,
"config_test": false,
"has_... |
#!/bin/python
#coding=utf-8
import time, threading, os, urllib2, sys
import json
from PIL import Image
from pymouse import PyMouse
reload(sys)
sys.setdefaultencoding("utf-8")
last_pr = None;
cmds = None;
def findInList(aid):
global last_pr
for(key, val) in last_pr:
if val["aid"] == aid:
return True
return Fa... | {
"repo_name": "a710128/BilibiliHelper",
"path": "bilibili.py",
"copies": "1",
"size": "2824",
"license": "mit",
"hash": 7813273442827308000,
"line_mean": 22.3333333333,
"line_max": 123,
"alpha_frac": 0.6175,
"autogenerated": false,
"ratio": 2.5225225225225225,
"config_test": false,
"has_no_ke... |
#! /bin/python
# -*- coding: UTF-8 -*-
import urllib2, json, datetime, time
import dateutil.parser
global latitude
global longitude
api=json.loads(urllib2.urlopen("http://freegeoip.net/json/").read().decode("UTF-8"))
latitude=str(api['latitude'])
longitude=str(api["longitude"])
def getsunrise(lat="", lng="", formatt... | {
"repo_name": "ioangogo/Suntimes",
"path": "suntimes.py",
"copies": "1",
"size": "1345",
"license": "bsd-3-clause",
"hash": -1005461752309309700,
"line_mean": 28.2391304348,
"line_max": 121,
"alpha_frac": 0.6572490706,
"autogenerated": false,
"ratio": 3.0089485458612977,
"config_test": false,
... |
#/bin/python
# -*- coding: utf-8 -*-
#==============================================
# A2SV(Auto Scanning to SSL Vulnerability |
# by HaHwul(www.hahwul.com) |
# https://github.com/hahwul/a2sv |
#==============================================
import os
import sys
import argparse
impor... | {
"repo_name": "Yukinoshita47/Yuki-Chan-The-Auto-Pentest",
"path": "Module/a2sv/a2sv.py",
"copies": "1",
"size": "18163",
"license": "mit",
"hash": 4390386752190834700,
"line_mean": 40.6285046729,
"line_max": 267,
"alpha_frac": 0.5666498288,
"autogenerated": false,
"ratio": 3.183881343817012,
"c... |
#!bin/python
# -*- coding: utf-8 -*-
"""
Based on the algorithm described in:
Fischer, K. F. & Marqusee, S. A rapid test for identification of autonomous
folding units in proteins. Journal of molecular biology 302, 701–12 (2000).
"""
from __future__ import division
import argparse
import os
import sys
from Bio.PDB im... | {
"repo_name": "naderm/wet-lab-tools",
"path": "raft.py",
"copies": "1",
"size": "2650",
"license": "bsd-2-clause",
"hash": 643598827884543100,
"line_mean": 28.4222222222,
"line_max": 76,
"alpha_frac": 0.6087613293,
"autogenerated": false,
"ratio": 3.364675984752224,
"config_test": false,
"has... |
#!/bin/python
# -*- coding: utf-8 -*-
#breadth first search, can find shortest path
#Sample:
#my graph has 8 vertices
# a - s d - f
# | | / | / |
# z x - c - v
#trap:
#001
# obj initilization involves sibilings..cannot initilize all object at the same time
# have to use str/name to represent the obj and later t... | {
"repo_name": "dramaticlly/Python4Interview",
"path": "breadthfirsts.py",
"copies": "1",
"size": "3013",
"license": "mit",
"hash": -559536838968212200,
"line_mean": 27.1401869159,
"line_max": 108,
"alpha_frac": 0.6071072733,
"autogenerated": false,
"ratio": 3.172813487881981,
"config_test": fal... |
# Copyright 2010 Dirk Holtwick, holtwick.it
#
# 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.0
#
# Unless required by applicable law or agreed... | {
"repo_name": "22rostislav/xhtml2pdf",
"path": "demo/wsgi/pisawsgidemo.py",
"copies": "1",
"size": "2254",
"license": "apache-2.0",
"hash": 7964651913970437000,
"line_mean": 30.7464788732,
"line_max": 74,
"alpha_frac": 0.6934338953,
"autogenerated": false,
"ratio": 3.589171974522293,
"config_te... |
'''
Copyright (C) 2013 onwards University of Deusto
All rights reserved.
This software is licensed as described in the file COPYING, which
you should have received as part of this distribution.
This software consists of contributions made by many individuals,
listed below:
@author: Aitor Gómez Goiri <a... | {
"repo_name": "gomezgoiri/reusingWebActuatorsFromSemanticSpace",
"path": "files/remove_unused_prefixes.py",
"copies": "1",
"size": "3128",
"license": "apache-2.0",
"hash": 4717491286450119000,
"line_mean": 34.5454545455,
"line_max": 147,
"alpha_frac": 0.5647585545,
"autogenerated": false,
"ratio"... |
#Copyright (c) 2015-2017 Uwe Köckemann <uwe.kockemann@oru.se>
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify... | {
"repo_name": "Ewulution/SpiderPlan",
"path": "src/main/python/ExecuteServer.py",
"copies": "1",
"size": "2665",
"license": "mit",
"hash": 61605617923762650,
"line_mean": 25.1176470588,
"line_max": 79,
"alpha_frac": 0.6978228228,
"autogenerated": false,
"ratio": 3.11943793911007,
"config_test":... |
#Copyright (c) 2015 Uwe Köckemann <uwe.kockemann@oru.se>
#Permission is hereby granted, free of charge, to any person obtaining
#a copy of this software and associated documentation files (the
#"Software"), to deal in the Software without restriction, including
#without limitation the rights to use, copy, modify, mer... | {
"repo_name": "Ewulution/SpiderPlan",
"path": "ROS/src/spiderplan_proxy/src/ROSMessageConversion.py",
"copies": "1",
"size": "9118",
"license": "mit",
"hash": -8649322185716872000,
"line_mean": 33.5340909091,
"line_max": 187,
"alpha_frac": 0.6236700669,
"autogenerated": false,
"ratio": 2.87965887... |
'''
Created on 2014年4月19日
@author: i
'''
import os
import time
import subprocess as sub
import log4py.log4py as log4py
logger = log4py.Logger().get_instance()
class blutooth_mouse:
mouse_addr = "00:1F:20:D4:D8:59"
def __init__(self):
logger.info("starte all......")
#self.hidd_server()
... | {
"repo_name": "icesx/ubuntu-autobluetoothmouse-py",
"path": "src/bluetoothMouseAutoCon.py",
"copies": "1",
"size": "1751",
"license": "apache-2.0",
"hash": 2536656365995880000,
"line_mean": 30.7272727273,
"line_max": 83,
"alpha_frac": 0.5478510029,
"autogenerated": false,
"ratio": 3.4623015873015... |
"""
Created on Sun Aug 10 19:17:03 2014
@author: imad
- Wrapper for ffmpeg cli. Simply takes a video file and encodes it to mp4 as per default settings. Parameters can be changed.
- Dependencies: ffmpeg (incl. x264, libaac/libfdk_aac support), mediainfo-cli
"""
import os
import platform
import sys
import argparse
im... | {
"repo_name": "imdn/scripts",
"path": "ffmpy.py",
"copies": "1",
"size": "21195",
"license": "unlicense",
"hash": 5036772103776800000,
"line_mean": 41.2714570858,
"line_max": 197,
"alpha_frac": 0.5751251299,
"autogenerated": false,
"ratio": 3.4469401041666665,
"config_test": false,
"has_no_ke... |
#!/bin/python
# -*- coding: utf-8 -*-
def proba_lemm_pos(name_file):
file_in = open(name_file, "r").readlines()
# Conversion to sentences
sentences = []
phrase = []
for line in file_in:
if line != "\n":
spl = line.split("\t")
if len(spl) >= 4:
# POS, LABEL, LEMM, CHUNK, word
# it PRP it chunk O
... | {
"repo_name": "PAJEAN/uncertaintyDetection",
"path": "pattern_cue_pos.py",
"copies": "1",
"size": "10169",
"license": "mit",
"hash": -7479755871264034000,
"line_mean": 28.98820059,
"line_max": 138,
"alpha_frac": 0.5731851269,
"autogenerated": false,
"ratio": 2.321534596939941,
"config_test": fa... |
#!/bin/python
# -*- coding: UTF-8 -*-
# ******************************************************
# DESC :
# AUTHOR : Alex Stocks
# VERSION : 1.0
# LICENCE : LGPL V3
# EMAIL : alexstocks@foxmail.com
# MOD : 2016-04-11 20:15
# FILE : template.py
# ******************************************************
import ... | {
"repo_name": "levy5307/Exocet",
"path": "redis_cluster/script/template.py",
"copies": "2",
"size": "7004",
"license": "apache-2.0",
"hash": -432176852924263300,
"line_mean": 35.4791666667,
"line_max": 99,
"alpha_frac": 0.5438320959,
"autogenerated": false,
"ratio": 3.2157943067033976,
"config_... |
#!/bin/python
# -*- coding: utf-8 -*-
"""Dynamically import function"""
import os
from utils.exceptions import ResourceNotFound
def import_func(path):
"""
Import an attribute, function or class from a module.
:attr path: A path descriptor in the form of
'pkg.module.submodule:attribute'... | {
"repo_name": "shridarpatil/RestApiz",
"path": "utils/import_from.py",
"copies": "1",
"size": "1125",
"license": "mit",
"hash": 1548260059914031900,
"line_mean": 27.8461538462,
"line_max": 77,
"alpha_frac": 0.5751111111,
"autogenerated": false,
"ratio": 3.865979381443299,
"config_test": false,
... |
#!/bin/python
# -*- coding: utf-8 -*-
# newDetectEnglish module
# v0.0.1
# module heavily borrowed from http://inventwithpython.com/hacking (BSD Licensed)
import os
CHARSET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz \t\n'
def loadDictionary():
englishWords = []
try:
with open('dictionary.txt', 'r') ... | {
"repo_name": "theRoda/uniciph",
"path": "newDetectEnglish.py",
"copies": "1",
"size": "1304",
"license": "mit",
"hash": 5292170540201926000,
"line_mean": 25.612244898,
"line_max": 81,
"alpha_frac": 0.7400306748,
"autogenerated": false,
"ratio": 3.3435897435897437,
"config_test": false,
"has_... |
#!/bin/python
# -*- coding: utf-8 -*-
###############################################################################
# Exports the relation between ImagenParam and ImagenName files - V1.0 #
# Copyright 2014 Benito Palacios (aka pleonex) #
# ... | {
"repo_name": "pleonex/Ninokuni",
"path": "Programs/scripts/ImagenReferences.py",
"copies": "1",
"size": "3685",
"license": "apache-2.0",
"hash": 8637447565113001000,
"line_mean": 37.3854166667,
"line_max": 97,
"alpha_frac": 0.5267299864,
"autogenerated": false,
"ratio": 3.7989690721649483,
"co... |
#!/bin/python
# -*- coding: utf-8 -*-
from abst_wrapper import Wrapper
import os
import sys
import time
import datetime
import csv
import requests
SERVICE = 'rakuten'
API_ITEM_BASE="https://app.rakuten.co.jp/services/api/IchibaItem/Search/20140222"
API_GENRE_BASE="https://app.rakuten.co.jp/services/api/IchibaGenre/... | {
"repo_name": "AkihikoITOH/capybara",
"path": "build/lib/capybara/rakuten_wrapper.py",
"copies": "2",
"size": "3599",
"license": "mit",
"hash": -7063444015123748000,
"line_mean": 35.7244897959,
"line_max": 120,
"alpha_frac": 0.4995832176,
"autogenerated": false,
"ratio": 3.9592959295929595,
"co... |
#!/bin/python
# -*- coding: utf-8 -*-
from abst_wrapper import Wrapper
import os
import sys
import time
import datetime
import csv
from amazon.api import AmazonAPI
SERVICE = 'amazon'
# Wrapper class for "Amazon Product Advertising API"
class AmazonWrapper(Wrapper):
def __init__(self):
Wrapper.__init__(... | {
"repo_name": "AkihikoITOH/capybara",
"path": "capybara/amazon_wrapper.py",
"copies": "2",
"size": "1555",
"license": "mit",
"hash": 2459797497880972300,
"line_mean": 30.7346938776,
"line_max": 147,
"alpha_frac": 0.6192926045,
"autogenerated": false,
"ratio": 3.746987951807229,
"config_test": f... |
#!bin/python
# -*- coding: utf-8 -*-
from billing import get_active_sessions, start_session, stop_session, end_session
#from pprint import pprint
import datetime
import time
import signal
from threading import Thread
#import sched
def shutdown(signum, frame):
import sys
sys.exit(0)
if __name__ == '__main__... | {
"repo_name": "rdl-telecom/billing",
"path": "scheduler.py",
"copies": "1",
"size": "1163",
"license": "unlicense",
"hash": -7901255725036692000,
"line_mean": 32.2285714286,
"line_max": 120,
"alpha_frac": 0.6276870163,
"autogenerated": false,
"ratio": 4.26007326007326,
"config_test": false,
"... |
#!bin/python
#coding: utf-8
from db import *
import datetime
import json
import requests
from settings import report_url, report_username, report_password
import sys
date_fmt = '%Y-%m-%d %H:%M:%S'
ids = '(74430,75894,76055,76577,77028,77526,77944,78005,79203,79515,79693,80909,81625,82089,82358,82442,82534,83903,8423... | {
"repo_name": "rdl-telecom/billing",
"path": "vidimax_report.py",
"copies": "1",
"size": "4171",
"license": "unlicense",
"hash": 573619515353933000,
"line_mean": 36.2410714286,
"line_max": 189,
"alpha_frac": 0.6140014385,
"autogenerated": false,
"ratio": 3.005043227665706,
"config_test": false,... |
#!/bin/python
# -*- coding: utf-8 -*-
from django.http import HttpResponse,HttpResponseBadRequest
from django.views.decorators.csrf import csrf_exempt
from wechat_sdk import WechatBasic
from wechat_sdk.messages import TextMessage, ImageMessage, VideoMessage, LinkMessage, EventMessage
from wechat_sdk.exceptions import... | {
"repo_name": "AaronWo/will-server",
"path": "will/wechat_view.py",
"copies": "1",
"size": "2650",
"license": "apache-2.0",
"hash": 1647903219660051500,
"line_mean": 29.8139534884,
"line_max": 98,
"alpha_frac": 0.6803773585,
"autogenerated": false,
"ratio": 4.0458015267175576,
"config_test": fa... |
#!bin/python
# -*- coding: utf-8 -*-
from flask import Flask, jsonify, request, Response
import urllib2
import StringIO
import csv
import datetime
import json
weather_observed = "http://www.aemet.es/es/eltiempo/observacion/ultimosdatos_{}_datos-horarios.csv?k=cle&l={}&datos=det&w=0&f=temperatura&x=h6"
def get_data(r... | {
"repo_name": "sergg75/dataModels",
"path": "Weather/WeatherObserved/harvest/weather_observed.py",
"copies": "1",
"size": "2409",
"license": "mit",
"hash": 3862332951680473000,
"line_mean": 26.3863636364,
"line_max": 143,
"alpha_frac": 0.5948526359,
"autogenerated": false,
"ratio": 3.638972809667... |
#!bin/python
# -*- coding: utf-8 -*-
from flask import Flask, jsonify, request, Response
import urllib2
import xml.dom.minidom
import datetime
import json
import copy
from dateutil import parser
import csv
import StringIO
import re
from meteoalarm import get_weather_alarms
from ipma import get_weather_forecasted_pt
fr... | {
"repo_name": "sergg75/dataModels",
"path": "Weather/WeatherForecast/harvest/aemet.py",
"copies": "1",
"size": "8482",
"license": "mit",
"hash": 6320738311407355000,
"line_mean": 31.6192307692,
"line_max": 114,
"alpha_frac": 0.6575875486,
"autogenerated": false,
"ratio": 3.6243589743589744,
"co... |
#!/bin/python
# coding: utf-8
from flask import Flask, render_template
import irmcli
from threading import Timer
app = Flask(__name__)
@app.route("/")
def index():
return render_template("index.html")
"""
API
"""
@app.route("/zentou")
def zentou():
irmcli.playIR("./data/zentou.json")
@app.route("/shoutou"... | {
"repo_name": "kato-tomohiro/lightcontrol",
"path": "app.py",
"copies": "1",
"size": "1250",
"license": "mit",
"hash": 1189352763335167500,
"line_mean": 17.3823529412,
"line_max": 44,
"alpha_frac": 0.6144,
"autogenerated": false,
"ratio": 2.6041666666666665,
"config_test": false,
"has_no_keyw... |
#!../bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
import csv
import datetime
import json
from flask import Flask, jsonify, request, Response
import urllib2
import StringIO
import sys
import ngsi_helper
try:
xrange # Python 2
except NameError:
xrange = range # Python 3
... | {
"repo_name": "Fiware/dataModels",
"path": "specs/Environment/AirQualityObserved/harvest/madrid_air_quality.py",
"copies": "1",
"size": "8750",
"license": "mit",
"hash": -4834798908262890000,
"line_mean": 27.5016286645,
"line_max": 96,
"alpha_frac": 0.5124571429,
"autogenerated": false,
"ratio": ... |
#!../bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import os
import xml.dom.minidom
import json
import re
import hashlib
import urllib2
import contextlib
DEFAULT_SOURCE_FOLDER = 'INECO'
BEACH_FOLDER = '20170510_playas/playas'
MUSEUM_FOLDER = '20170510_museos/museos'
TOURIST_INFO_... | {
"repo_name": "Fiware/dataModels",
"path": "specs/PointOfInterest/import_pois_tourspain.py",
"copies": "1",
"size": "7882",
"license": "mit",
"hash": -3869850694908675000,
"line_mean": 30.1541501976,
"line_max": 105,
"alpha_frac": 0.506470439,
"autogenerated": false,
"ratio": 4.258238789843328,
... |
#!../bin/python
# -*- coding: utf-8 -*-
from __future__ import with_statement
import csv
import datetime
import json
import urllib2
import StringIO
import logging
import logging.handlers
import re
from pytz import timezone
import contextlib
pollutant_descriptions = {
'NO2': 'Nitrogen Dioxide',
'CO': 'Carbon Monox... | {
"repo_name": "sergg75/dataModels",
"path": "Environment/AirQualityObserved/harvest/malaga_airqualityobserved_import.py",
"copies": "1",
"size": "6795",
"license": "mit",
"hash": -8161601086687655000,
"line_mean": 25.0344827586,
"line_max": 117,
"alpha_frac": 0.6281089036,
"autogenerated": false,
... |
#!bin/python
# -*- coding: utf-8 -*-
from __future__ import with_statement
import urllib2
import StringIO
import csv
import datetime
import json
import logging
import logging.handlers
from pytz import timezone
import contextlib
import re
# List of known weather stations
station_data = { }
# Orion service that will s... | {
"repo_name": "sergg75/dataModels",
"path": "Weather/WeatherObserved/harvest/portugal_weather_observed_harvest.py",
"copies": "1",
"size": "6680",
"license": "mit",
"hash": -8233182776979161000,
"line_mean": 28.1746724891,
"line_max": 97,
"alpha_frac": 0.6176646707,
"autogenerated": false,
"ratio... |
#!bin/python
# -*- coding: utf-8 -*-
from __future__ import with_statement
import urllib2
import xml.dom.minidom
import datetime
import json
import copy
from dateutil import parser
import csv
import StringIO
import re
from pytz import timezone
import logging
import logging.handlers
import contextlib
country = 'Spain'... | {
"repo_name": "sergg75/dataModels",
"path": "Weather/WeatherForecast/harvest/spain_weather_forecast_harvest.py",
"copies": "1",
"size": "14176",
"license": "mit",
"hash": 8592226218531719000,
"line_mean": 30.360619469,
"line_max": 106,
"alpha_frac": 0.6330864198,
"autogenerated": false,
"ratio": ... |
#!bin/python
# -*- coding: utf-8 -*-
from nltk.twitter import Query, Streamer, Twitter, TweetViewer, TweetWriter, credsfromfile
from settings import *
import nltk
import sys
import re
import unicodedata
nb_tweets = 150
cons = ['refuse', 'stole', 'weak', 'monster', 'racist', 'leak,''bad', 'fascist', 'loose', 'lost', 's... | {
"repo_name": "zozoh94/PolReview",
"path": "twitter.py",
"copies": "1",
"size": "3039",
"license": "mit",
"hash": 4147051906192441000,
"line_mean": 42.3857142857,
"line_max": 157,
"alpha_frac": 0.5400065854,
"autogenerated": false,
"ratio": 3.137396694214876,
"config_test": false,
"has_no_key... |
#!/bin/python
#coding:utf-8
from roomai.games.common import AbstractAction
from roomai.games.bang import AllPlayingCardsDict
from roomai.games.bang import PlayingCardNames
from roomai.games.bang import CharacterCardNames
from roomai.games.bang import ADeckOfCards
import roomai
AllBangActionsDict = dict()
class Bang... | {
"repo_name": "roomai/RoomAI",
"path": "roomai/games/bang/BangAction.py",
"copies": "1",
"size": "13685",
"license": "mit",
"hash": 4256005422433259500,
"line_mean": 48.0836363636,
"line_max": 226,
"alpha_frac": 0.6524412832,
"autogenerated": false,
"ratio": 3.198341232227488,
"config_test": fa... |
#!/bin/python
# -*- coding: utf-8 -*-
from settings import *
from os.path import join
from datetime import datetime
from ctrls.Reader import Reader
import matplotlib.pyplot as plt
class SimpleDrawer():
'''畫出近 n 天收盤價圖'''
def _getFigTitle(self, stock_number):
t = datetime.now()
return ('%s, Upd... | {
"repo_name": "yaojenkuo/stockflow",
"path": "ctrls/SimpleDrawer.py",
"copies": "2",
"size": "1157",
"license": "mit",
"hash": -7466466075657163000,
"line_mean": 27.55,
"line_max": 73,
"alpha_frac": 0.5626643295,
"autogenerated": false,
"ratio": 3.2140845070422537,
"config_test": false,
"has_... |
#!bin/python
# -*- coding: utf-8 -*-
from settings import *
import nltk
import sys
import textract
import re
import unicodedata
class Opinion:
def __init__(self, name):
self.name = name
self.total = 0
self.fore = 0
self.against = 0
self.no_opinions = 0
self.ratio_f... | {
"repo_name": "zozoh94/PolReview",
"path": "pol_review.py",
"copies": "1",
"size": "4477",
"license": "mit",
"hash": 4142617592389748700,
"line_mean": 35.0967741935,
"line_max": 101,
"alpha_frac": 0.5294906166,
"autogenerated": false,
"ratio": 4.072793448589627,
"config_test": false,
"has_no_... |
#!/bin/python
# coding:utf-8
from tensorflow.examples.tutorials.mnist import input_data
import tensorflow as tf
import datetime
import time
import socket
import os
tf.app.flags.DEFINE_string("ps_hosts", "", "Comma-separated list of hostname:port pairs")
tf.app.flags.DEFINE_string("worker_hosts", "", "Comma-separated ... | {
"repo_name": "xiechengsheng/distribute-ML-demo",
"path": "mnist_dist_cnn.py",
"copies": "1",
"size": "8543",
"license": "apache-2.0",
"hash": 8127599016774322000,
"line_mean": 35.8961038961,
"line_max": 134,
"alpha_frac": 0.5479291329,
"autogenerated": false,
"ratio": 3.3929140127388533,
"conf... |
"""
Generate familiar key and show its information.
Copyright 2015 Benito Palacios (aka pleonex)
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.0
Unl... | {
"repo_name": "pleonex/Ninokuni",
"path": "Programs/scripts/familiarkey.py",
"copies": "1",
"size": "11356",
"license": "apache-2.0",
"hash": -9013164532270116000,
"line_mean": 31.1142857143,
"line_max": 79,
"alpha_frac": 0.5862989324,
"autogenerated": false,
"ratio": 3.358231251867344,
"config... |
#!/bin/python
# -*- coding: utf-8 -*-
"""Generate Rest like apis."""
# import json
import time
from flask import jsonify
from flask import request
import logging as log
import pymysql
from utils.echo import echo
from utils.exceptions import InvalidUsage
from utils.generate_token import generate_token
from utils.upd... | {
"repo_name": "shridarpatil/RestApiz",
"path": "RestApiz/RestApiz.py",
"copies": "1",
"size": "11812",
"license": "mit",
"hash": -5622116547292515000,
"line_mean": 29.2871794872,
"line_max": 77,
"alpha_frac": 0.5321706739,
"autogenerated": false,
"ratio": 4.253510983075261,
"config_test": false... |
#!/bin/python
# coding: utf-8
import argparse
import datetime
import lglass_sql.nic
import lglass.nic
import lglass.dn42
db_cls = lglass_sql.nic.NicDatabase
def sync(src, dst, dn42=False, delete=False, initial=False, filter_source=None):
last_update = dst.manifest.last_modified_datetime
for obj in src.find... | {
"repo_name": "fritz0705/lglass",
"path": "contrib/sync-databases.py",
"copies": "1",
"size": "2968",
"license": "mit",
"hash": 4677838804324870000,
"line_mean": 34.3333333333,
"line_max": 87,
"alpha_frac": 0.6034366577,
"autogenerated": false,
"ratio": 3.623931623931624,
"config_test": false,
... |
#!/bin/python
# coding: utf-8
import argparse
import sys
import signal
import traceback
import datetime
import lglass.object
import lglass_sql.nic
def objects(lines):
obj = []
for line in lines:
if isinstance(line, bytes):
line = line.decode("iso-8859-15")
if not line.strip() and... | {
"repo_name": "fritz0705/lglass",
"path": "contrib/grs-import/grs-import-sqlid.py",
"copies": "1",
"size": "2771",
"license": "mit",
"hash": -3918661890334527500,
"line_mean": 25.9029126214,
"line_max": 72,
"alpha_frac": 0.5925658607,
"autogenerated": false,
"ratio": 3.806318681318681,
"config_... |
#!../bin/python
# -*- coding: utf-8 -*-
import backends.exceptions as e
import os
import codecs
def initialize_backend():
"""
This method is called when the Flask application starts.
Here you can do any initialization that may be required,
such as connecting to a remote database or making sure a file... | {
"repo_name": "DaKnOb/TorPaste",
"path": "backends/filesystem.py",
"copies": "1",
"size": "8580",
"license": "mit",
"hash": -5879662649111498000,
"line_mean": 31.5,
"line_max": 78,
"alpha_frac": 0.5805361305,
"autogenerated": false,
"ratio": 4.115107913669065,
"config_test": false,
"has_no_ke... |
#!/bin/python
# -*- coding: utf-8 -*-
import bit_encrypter
import bootstrappable_keygen
import bootstrappable_decryption
import dimension_modulus_reduction
import homomorphic_arithmetic
class HomomorphicEncryptionScheme(object):
def __init__(self, short_dimension, long_dimension, multiplicative_depth, short_odd_m... | {
"repo_name": "UMComp4140ATeam/Raymond",
"path": "src/homomorphic_encryption_scheme.py",
"copies": "1",
"size": "1965",
"license": "mit",
"hash": 6501050543628873000,
"line_mean": 53.6111111111,
"line_max": 194,
"alpha_frac": 0.7282442748,
"autogenerated": false,
"ratio": 3.7005649717514126,
"c... |
#!/bin/python
# -*- coding: utf-8 -*-
import bit_encrypter
import somewhat_homomorphic_keygen
import bootstrappable_decryption
import dimension_modulus_reduction
import homomorphic_arithmetic
import logging
class SomewhatHomomorphicEncryptionScheme(object):
def __init__(self, dimension, multiplicative_depth, odd_... | {
"repo_name": "UMComp4140ATeam/Raymond",
"path": "src/somewhat_homomorphic_scheme.py",
"copies": "1",
"size": "1777",
"license": "mit",
"hash": -546682206215127550,
"line_mean": 51.2941176471,
"line_max": 272,
"alpha_frac": 0.7225661227,
"autogenerated": false,
"ratio": 3.5826612903225805,
"con... |
#!/bin/python
# -*- coding: utf-8 -*-
import ciphertext
import math
import numpy
class DimensionModulusReduction(object):
def __init__(self, short_dimension, long_dimension, short_modulus, long_modulus):
self.__short_dimension = short_dimension
self.__long_dimension = long_dimension
self._... | {
"repo_name": "UMComp4140ATeam/Raymond",
"path": "src/dimension_modulus_reduction.py",
"copies": "1",
"size": "2150",
"license": "mit",
"hash": 1109808689941051100,
"line_mean": 45.7608695652,
"line_max": 233,
"alpha_frac": 0.616744186,
"autogenerated": false,
"ratio": 3.8392857142857144,
"conf... |
#!/bin/python
# coding: utf8
import codecs
import re
import sys
import requests
import os
import glob
import argparse
from terminaltables import SingleTable
from bs4 import BeautifulSoup
def TableParser(soupObj, offset):
tables=soupObj.findAll('table')
names = []
for table in tables:
rows= table.... | {
"repo_name": "imdn/scripts",
"path": "anime_episode.py",
"copies": "1",
"size": "4344",
"license": "unlicense",
"hash": 5001205221815018000,
"line_mean": 31.4179104478,
"line_max": 154,
"alpha_frac": 0.5299263352,
"autogenerated": false,
"ratio": 3.6907391673746814,
"config_test": false,
"ha... |
#!/bin/python
# -*- coding: utf-8 -*-
import comparators.pixel_comparator
import comparators.chained_image_comparator
import comparators.avg_pixel_comparator
import image_iterator
import sys
# Not really sets, since they may contain "duplicate" images(ie ones that when compared return True)
'''
Input:
image_sets:... | {
"repo_name": "Comp4710AprioriTextIllustrator/TextIllustrator",
"path": "image_subsets/image_subsets.py",
"copies": "1",
"size": "3476",
"license": "mit",
"hash": 1460868057792874500,
"line_mean": 32.4326923077,
"line_max": 142,
"alpha_frac": 0.6386651323,
"autogenerated": false,
"ratio": 3.84513... |
#!/bin/python
# -*- coding: utf-8 -*-
import constraints as c
from api_key import key
import requests
def __prepare_session():
"""
Prepare the headers of the session
"""
session = requests.Session()
session.verify = False
session.headers.update(
{'Authorization': 'Token token={}'... | {
"repo_name": "CIRCL/PyACDC",
"path": "pyacdc/api.py",
"copies": "1",
"size": "1039",
"license": "bsd-2-clause",
"hash": 345278504231053600,
"line_mean": 23.1627906977,
"line_max": 79,
"alpha_frac": 0.6092396535,
"autogenerated": false,
"ratio": 3.4983164983164983,
"config_test": false,
"has_... |
#!/bin/python
# -*- coding: utf-8 -*-
import csv
from settings import *
from os.path import join
class Reader():
'''To Read file'''
def __init__(self, number):
self.path = join(TSEC_DATA_PATH, number + '.csv')
try:
csvfile = open(self.path, 'rb')
self.csvreader = csv.re... | {
"repo_name": "yaojenkuo/stockflow",
"path": "ctrls/Reader.py",
"copies": "2",
"size": "1036",
"license": "mit",
"hash": 346074808611324800,
"line_mean": 27.8055555556,
"line_max": 90,
"alpha_frac": 0.4391891892,
"autogenerated": false,
"ratio": 4.446351931330472,
"config_test": false,
"has_n... |
#!../bin/python
# -*- coding: utf-8 -*-
import csv
import datetime
import json
from flask import Flask, jsonify, request, Response
import urllib2
import StringIO
import sys
import ngsi_helper
app = Flask(__name__)
AMBIENT_TYPE_NAME = 'AmbientObserved'
pollutant_dict = {
'01': 'SO2',
'06': 'CO',
'07': 'NO'... | {
"repo_name": "sergg75/dataModels",
"path": "Environment/AirQualityObserved/harvest/madrid_air_quality.py",
"copies": "1",
"size": "7623",
"license": "mit",
"hash": 3359599289052617700,
"line_mean": 25.2862068966,
"line_max": 100,
"alpha_frac": 0.5706414797,
"autogenerated": false,
"ratio": 3.268... |
#!../bin/python
# -*- coding: utf-8 -*-
import csv
import datetime
import json
import urllib2
import StringIO
import logging
import logging.handlers
import re
from pytz import timezone
import contextlib
pollutant_descriptions = {
'NO2': 'Nitrogen Dioxide',
'CO': 'Carbon Monoxide'
}
# Bootstrap data about dis... | {
"repo_name": "Fiware/dataModels",
"path": "specs/Environment/AirQualityObserved/harvest/malaga_airqualityobserved_import.py",
"copies": "1",
"size": "7336",
"license": "mit",
"hash": 2649283099192217000,
"line_mean": 26.1703703704,
"line_max": 87,
"alpha_frac": 0.5778353326,
"autogenerated": false... |
#!/bin/python
# -*- coding: utf-8 -*-
import csv
import json
import requests
from ctrls import *
from settings import *
from os import listdir
from datetime import date
class Tester():
'''To Test models'''
def __init__(self, numbers, Model):
# check the number from Database, remove error numbers
... | {
"repo_name": "yaojenkuo/stockflow",
"path": "ctrls/Tester.py",
"copies": "2",
"size": "4829",
"license": "mit",
"hash": -6783436185384083000,
"line_mean": 35.288,
"line_max": 133,
"alpha_frac": 0.4939360529,
"autogenerated": false,
"ratio": 3.3247800586510263,
"config_test": false,
"has_no_k... |
#!/bin/python
# -*- coding: utf-8 -*-
import csv
import numpy as np
from settings import *
import math
from datetime import datetime, date, timedelta
class Trader():
'''模擬交易情形的過程,買賣最小單位為張(1000 股)'''
def __init__(self, model_infos, stock_number, noLog):
# 基本資料
self.model_infos = model_infos # ... | {
"repo_name": "yaojenkuo/stockflow",
"path": "ctrls/Trader.py",
"copies": "2",
"size": "16314",
"license": "mit",
"hash": 5012549881456744000,
"line_mean": 36.8054187192,
"line_max": 117,
"alpha_frac": 0.5521240553,
"autogenerated": false,
"ratio": 3.023640661938534,
"config_test": false,
"ha... |
#!/bin/python
# -*- coding=utf-8 -*-
import getpass
import simplejson as json
import couchdb
import uuid
import requests
# Load the config file.
conf = json.loads(open('traveler/config.json').read())
# Check if there is an admin
s = couchdb.Server(conf['db_url'])
try:
s['_config']
admin_party = True
except... | {
"repo_name": "mwsmith2/traveler-db",
"path": "scripts/setup_security.py",
"copies": "1",
"size": "2166",
"license": "mit",
"hash": 5196830571593175000,
"line_mean": 27.88,
"line_max": 78,
"alpha_frac": 0.6361957525,
"autogenerated": false,
"ratio": 3.311926605504587,
"config_test": false,
"h... |
#!/bin/python
# -*- coding: utf-8 -*-
import HTMLParser
import urlparse
import logging
import re
class MyParser(HTMLParser.HTMLParser):
"""Class to parse HTML content.
Attributes:
links: List to store all links of the content.
scheme: Request scheme of the url.
host: Host of the ur... | {
"repo_name": "fivezh/Keepgoing",
"path": "py_spider/webpage_parse.py",
"copies": "1",
"size": "2862",
"license": "mit",
"hash": 1063108987480307000,
"line_mean": 28.2040816327,
"line_max": 84,
"alpha_frac": 0.5258560447,
"autogenerated": false,
"ratio": 3.986072423398329,
"config_test": false,... |
#!/bin/python
# -*- coding: utf-8 -*-
#import ImFEATbox
#from PIL import Image
import Image
import numpy as np
import ImFEATbox
from ImFEATbox.__helperCommands import rgb2grayscale
import csv
import matplotlib.pyplot as plt
#print(ImFEATbox.getFeatureNames())
# load test image
with open('testimg.csv', 'r') as csvfil... | {
"repo_name": "annikaliebgott/ImFEATbox",
"path": "features_python/testing.py",
"copies": "1",
"size": "2966",
"license": "apache-2.0",
"hash": -6798186259086477000,
"line_mean": 28.9595959596,
"line_max": 115,
"alpha_frac": 0.6530681052,
"autogenerated": false,
"ratio": 2.954183266932271,
"con... |
#!bin/python
# -*- coding: utf-8 -*-
import importlib
import time
from datetime import datetime
from os import getenv
import sys
import logic
from subprocess import check_output
from flask import Flask
from flask import Response
from flask import redirect
from flask import render_template
from flask import request
a... | {
"repo_name": "DaKnOb/TorPaste",
"path": "torpaste.py",
"copies": "1",
"size": "8322",
"license": "mit",
"hash": 4890806924507422000,
"line_mean": 26.375,
"line_max": 79,
"alpha_frac": 0.5621244893,
"autogenerated": false,
"ratio": 3.8942442676649507,
"config_test": true,
"has_no_keywords": f... |
#!/bin/python
# -*- coding: utf-8 -*-
import json
from pandocfilters import Str, Space
import pandocfilters
def get_metadata_field(json_lst, field):
'''
Take a JSON list and a field name (str) and return a
the field value.
'''
try:
x = json_lst[0]['unMeta'].get(field, {})
return w... | {
"repo_name": "riceissa/ssg-riceissa.com",
"path": "barebones_ssg/metadata.py",
"copies": "1",
"size": "3887",
"license": "bsd-2-clause",
"hash": 7321353239321001000,
"line_mean": 30.8606557377,
"line_max": 80,
"alpha_frac": 0.6184718292,
"autogenerated": false,
"ratio": 3.5924214417744915,
"co... |
#!/bin/python
#coding:utf-8
import logging
import random
from functools import cmp_to_key
import roomai
import roomai.games.common
from roomai.games.texasholdem import *
class TexasHoldemEnv(roomai.games.common.AbstractEnv):
'''
The TexasHoldem game environment
'''
params=dict()#@override
def ... | {
"repo_name": "roomai/RoomAI",
"path": "roomai/games/texasholdem/TexasHoldemEnv.py",
"copies": "1",
"size": "31389",
"license": "mit",
"hash": -1502621645967792400,
"line_mean": 40.464993395,
"line_max": 179,
"alpha_frac": 0.5274777788,
"autogenerated": false,
"ratio": 3.5905971173644473,
"conf... |
#!/bin/python
# -*- coding: utf-8 -*-
import math
import sys
from PIL import Image
class AvgPixelsComparator(object):
# Want to be able to tighten or loosen the comparison constraints
def __init__(self, num_kernels_horizontal=2, num_kernels_vertical=2, avg_comparator=lambda x, y: x[0] == y[0] and x[1] == y[... | {
"repo_name": "Comp4710AprioriTextIllustrator/TextIllustrator",
"path": "image_subsets/comparators/avg_pixel_comparator.py",
"copies": "1",
"size": "4757",
"license": "mit",
"hash": -7781942161357811000,
"line_mean": 52.4606741573,
"line_max": 295,
"alpha_frac": 0.630229136,
"autogenerated": false,... |
#!/bin/python
# -*- coding: utf-8 -*-
import math, sys
import pattern_cue_pos as pcp
def check_uncertainty_sentence(phrase):
uncertainty = 0
for mot in phrase:
spl = mot.split("\t")
if spl[len(spl)-1][:-1] != "O":
uncertainty = 1
return uncertainty
def number_cue_sentence(phrase):
uncertainty = 0
for mot... | {
"repo_name": "PAJEAN/uncertaintyDetection",
"path": "binomial_law.py",
"copies": "1",
"size": "9829",
"license": "mit",
"hash": -1181657505565427200,
"line_mean": 27.9029411765,
"line_max": 193,
"alpha_frac": 0.6091380889,
"autogenerated": false,
"ratio": 2.5880958651567028,
"config_test": fal... |
#!/bin/python
# -*- coding: utf-8
import MySQLdb
import sys
import getpass
def dbinit(host="localhost", user="root", passwd="root", db="userservice"):
return MySQLdb.connect(host, user, passwd, db, charset='utf8')
def list(cursor):
sql = """SELECT name FROM userservice.user;"""
cursor.execute(sql)
... | {
"repo_name": "xX1swa1Xx/userservice",
"path": "start.py",
"copies": "1",
"size": "5671",
"license": "mit",
"hash": 8889025060221929000,
"line_mean": 29.1578947368,
"line_max": 173,
"alpha_frac": 0.5565251115,
"autogenerated": false,
"ratio": 2.965497412305923,
"config_test": false,
"has_no_k... |
#!/bin/python
# -*- coding: utf-8 -*-
import numpy as np
from settings import *
from datetime import datetime
from ctrls.Reader import Reader
import matplotlib.pyplot as plt
from matplotlib.finance import candlestick_ohlc
class CandleDrawer():
'''畫出近 n 天 K 線圖+Ma20布林通道+高低通道+量'''
def _getBooleanBand(self, seri... | {
"repo_name": "Asoul/stockflow",
"path": "ctrls/CandleDrawer.py",
"copies": "2",
"size": "3513",
"license": "mit",
"hash": -2273683261105506300,
"line_mean": 33.202020202,
"line_max": 114,
"alpha_frac": 0.5373707533,
"autogenerated": false,
"ratio": 3.014247551202137,
"config_test": false,
"h... |
#!/bin/python
# -*- coding: utf-8 -*-
import numpy as np
class exampleModel():
def __init__(self):
# 紀錄序列
self.price_series = []
# 紀錄狀態
self.haveStock = 0.0
self.buyPrice = 0.0
# Simple Moving Average
self.price_ma = [0.0 for x in xrange(121)] # the ... | {
"repo_name": "yaojenkuo/stockflow",
"path": "models/exampleModel.py",
"copies": "2",
"size": "2888",
"license": "mit",
"hash": -68926175410120610,
"line_mean": 29.8902439024,
"line_max": 91,
"alpha_frac": 0.471563981,
"autogenerated": false,
"ratio": 2.7462039045553146,
"config_test": false,
... |
#! /bin/python
# -*- coding: utf-8 -*-
import os, json, time, hashlib
class Cache(object):
def __init__(self, cache_path=None, cache_name=None, cache_extension="cache", expired=3600):
extension = cache_extension.lstrip(".") or "cache"
self.extension = "." + extension
self.expired = expire... | {
"repo_name": "voidabhi/python-scripts",
"path": "cache.py",
"copies": "1",
"size": "4620",
"license": "mit",
"hash": -4846796779934213000,
"line_mean": 27,
"line_max": 121,
"alpha_frac": 0.5344155844,
"autogenerated": false,
"ratio": 3.9588688946015425,
"config_test": false,
"has_no_keywords... |
import os, json, time, hashlib
__package__ = "Jue-php-sdk/request"
__author__ = "homeway"
__version__ = "2015.10.07"
__copyright__ = "Copyright(c) 2015"
__link__ = "https://github.com/JueTech/Jue-python-sdk"
class memory(object):
def __init__(self, cache_path=None, cache_name=None, cache_e... | {
"repo_name": "JueTech/Jue-python-sdk",
"path": "jue/memory.py",
"copies": "1",
"size": "4795",
"license": "mit",
"hash": -4985696329405057000,
"line_mean": 27.0409356725,
"line_max": 121,
"alpha_frac": 0.5338894682,
"autogenerated": false,
"ratio": 3.885737439222042,
"config_test": false,
"h... |
#!/bin/python
# -*- coding: utf-8 -*-
import os
from glob import glob
import ImFEATbox
import itertools
from subprocess import Popen, PIPE, STDOUT
featureWhiteList = []
#featureWhiteList.append("harris")
# TODO:
# SVD: not solvable?
featureFolderList = ["GlobalFeatures", "LocalFeatures"]
testedFeatures = 0
passedF... | {
"repo_name": "annikaliebgott/ImFEATbox",
"path": "features_python/autotest_generator.py",
"copies": "1",
"size": "12630",
"license": "apache-2.0",
"hash": -8434881729352275000,
"line_mean": 34.7790368272,
"line_max": 124,
"alpha_frac": 0.5421219319,
"autogenerated": false,
"ratio": 3.63767281105... |
#!/bin/python
# -*- coding: utf-8 -*-
import os
import csv
import math
import numpy as np
from settings import *
from scipy.stats import norm
from datetime import datetime
import matplotlib.pyplot as plt
from os.path import isfile, join, isdir
HEADERS = [
"Description",
"ROI",
"ROI Per Trade",
"Weekl... | {
"repo_name": "Asoul/stockflow",
"path": "ctrls/TraderRecorder.py",
"copies": "2",
"size": "6655",
"license": "mit",
"hash": 4086957102458000000,
"line_mean": 32.693989071,
"line_max": 120,
"alpha_frac": 0.5730738037,
"autogenerated": false,
"ratio": 2.9357142857142855,
"config_test": false,
... |
#!/bin/python
# -*- coding: utf-8 -*-
import os
import csv
import numpy as np
from settings import *
from datetime import datetime
import matplotlib.pyplot as plt
from os.path import isfile, join, isdir
from scipy.stats.mstats import gmean
from scipy.stats import norm
HEADERS = [
"Description",
"Model Versio... | {
"repo_name": "yaojenkuo/stockflow",
"path": "ctrls/BenchYearRecorder.py",
"copies": "2",
"size": "3321",
"license": "mit",
"hash": -6681830370170440000,
"line_mean": 32.6734693878,
"line_max": 99,
"alpha_frac": 0.5468323734,
"autogenerated": false,
"ratio": 3.5396995708154506,
"config_test": f... |
#!../../bin/python
# coding: utf-8
import os
import json
import time
import smart_http
import smart_geo
import smart_dbapi
DEBUG = True
CODEPATH = os.path.dirname(os.path.abspath(__file__))
_conn = None
## 不固定屬性名稱讀取
#
# @param dict 字典
# @param keys 接受的鍵值,排前面的優先採用
#
def get_attr(dict, keys):
for k in keys:
v = di... | {
"repo_name": "virus-warnning/twag",
"path": "commons/corp_utils.py",
"copies": "2",
"size": "4253",
"license": "apache-2.0",
"hash": -8318268949667565000,
"line_mean": 21.7784810127,
"line_max": 111,
"alpha_frac": 0.5959988886,
"autogenerated": false,
"ratio": 1.8657335406946605,
"config_test"... |
#!../bin/python
# coding: utf-8
import os
import os.path
import sys
from string import Template
# 簡易寫檔
def write_file(filename, content):
f = open(filename, 'w')
f.write(content)
f.close()
# 簡易讀檔
def read_file(filename):
f = open(filename, 'r')
c = f.read()
f.close()
return c
# 重建暫存目錄
if os.path.isdir('build... | {
"repo_name": "OsmHackTW/gdtile",
"path": "run-server.py",
"copies": "1",
"size": "1040",
"license": "apache-2.0",
"hash": 3034418060663037400,
"line_mean": 18.48,
"line_max": 67,
"alpha_frac": 0.6570841889,
"autogenerated": false,
"ratio": 2.1692650334075725,
"config_test": false,
"has_no_ke... |
#!../../../bin/python
# coding: utf-8
import os
import re
import sys
import geojson
commons_path = os.path.realpath('../../commons')
sys.path.insert(1, commons_path)
import smart_dbapi
DEBUG = False
sql = 'SELECT * FROM unluckylabor WHERE lat>20 ORDER BY id'
if DEBUG:
sql = sql + ' LIMIT 10'
con = smart_dbapi.co... | {
"repo_name": "virus-warnning/twag",
"path": "categories/unluckylabor/convjson.py",
"copies": "2",
"size": "1328",
"license": "apache-2.0",
"hash": -8859774944025458000,
"line_mean": 19.2857142857,
"line_max": 72,
"alpha_frac": 0.6228482003,
"autogenerated": false,
"ratio": 2.319419237749546,
"... |
#!../../../bin/python
# coding: utf-8
import os
import re
import sys
commons_path = os.path.realpath('../../commons')
sys.path.insert(1, commons_path)
import smart_dbapi
import smart_geo
import smart_http
# 篩選可定位的凶宅
ROW_LIMIT = 100
sql = u"SELECT id,area,address FROM unluckyhouse WHERE state=1 AND INSTR(address,'X'... | {
"repo_name": "virus-warnning/taiwan-anthropogeography-data",
"path": "categories/unluckyhouse/geocoding.py",
"copies": "2",
"size": "1076",
"license": "apache-2.0",
"hash": 5426487234989968000,
"line_mean": 24.4102564103,
"line_max": 138,
"alpha_frac": 0.6535353535,
"autogenerated": false,
"rati... |
#!/bin/python
#coding:utf-8
import os
import roomai.common
import copy
import itertools
'''
class Utils:
gen_allactions = False
@classmethod
def lookup_action(cls, masterCards, slaveCards):
masterCards.sort()
slaveCards.sort()
key_int = (masterCards + slaveCards)
key_... | {
"repo_name": "DMRookie/RoomAI",
"path": "roomai/doudizhu/DouDiZhuPokerUtils.py",
"copies": "1",
"size": "4512",
"license": "mit",
"hash": 1097586439245301000,
"line_mean": 33.4427480916,
"line_max": 107,
"alpha_frac": 0.5294769504,
"autogenerated": false,
"ratio": 4.043010752688172,
"config_te... |
#!/bin/python
# -*- coding: utf-8 -*-
import psycopg2
from itertools import combinations
import os
import time
import sys
# db credentials
dbHost = "localhost"
dbName = "myDBName"
dbUser = "myUser"
dbPass = "myPassword"
con = None
start_time = time.time()
try:
con = psycopg2.connect(host=dbHost, database=dbNam... | {
"repo_name": "ElenorFrisbee/MSC",
"path": "regmodR/startup_scripts/crossvalidate.py",
"copies": "1",
"size": "3138",
"license": "mit",
"hash": -7189647626724511000,
"line_mean": 37.7530864198,
"line_max": 391,
"alpha_frac": 0.557680051,
"autogenerated": false,
"ratio": 3.2996845425867507,
"con... |
#!/bin/python
# -*- coding: utf-8 -*-
import psycopg2
import sys
import os
# define queries
QUERIES = {}
# delete not land surface data
QUERIES['delete_not_land_surface_data'] = ("""
DELETE FROM tambora_temperature_monthly WHERE event_id in (SELECT event_id FROM tambora_temperature_monthly AS AA
LEFT JOIN... | {
"repo_name": "ElenorFrisbee/MSC",
"path": "regmodR/startup_scripts/checkTambora.py",
"copies": "1",
"size": "1859",
"license": "mit",
"hash": -6768493806814459000,
"line_mean": 27.1818181818,
"line_max": 124,
"alpha_frac": 0.6417428725,
"autogenerated": false,
"ratio": 3.113902847571189,
"conf... |
#!/bin/python
# -*- coding: utf-8 -*-
import psycopg2
import sys
import os
# get command line arguments
dbHost = sys.argv[1]
dbName = sys.argv[2]
dbUser = sys.argv[3]
dbPass = sys.argv[4]
con = None
try:
con = psycopg2.connect(host=dbHost, database=dbName, user=dbUser, password=dbPass)
cur = con.cursor()
... | {
"repo_name": "ElenorFrisbee/MSC",
"path": "regmodR/startup_scripts/fastMake.py",
"copies": "1",
"size": "1838",
"license": "mit",
"hash": -6249193976464780000,
"line_mean": 35.0588235294,
"line_max": 212,
"alpha_frac": 0.5761697497,
"autogenerated": false,
"ratio": 3.1526586620926245,
"config_... |
#!/bin/python
# -*- coding: utf-8 -*-
import psycopg2
import sys
import os
# define data tables (left here for easy interchangeability)
TABLES = {}
# get data from tambora master table for monthly selection
TABLES['tambora_temperature_monthly'] = ("""
CREATE TABLE tambora_temperature_monthly AS(
... | {
"repo_name": "ElenorFrisbee/MSC",
"path": "regmodR/startup_scripts/createTables.py",
"copies": "1",
"size": "5314",
"license": "mit",
"hash": 7933600613199291000,
"line_mean": 30.449704142,
"line_max": 104,
"alpha_frac": 0.5890101618,
"autogenerated": false,
"ratio": 3.817528735632184,
"config... |
#!/bin/python
# coding: utf-8
import psycopg2.pool
import psycopg2.extensions
import logging
import lglass.whois.server
import lglass_sql.nic
import lipam.sql
class LoggingCursor(psycopg2.extensions.cursor):
def execute(self, sql, args=None):
logger = logging.getLogger('sql_debug')
logger.info(... | {
"repo_name": "fritz0705/lglass",
"path": "contrib/whoisd/whoisd-sql.py",
"copies": "1",
"size": "1118",
"license": "mit",
"hash": 5649821730213786000,
"line_mean": 25.619047619,
"line_max": 71,
"alpha_frac": 0.6404293381,
"autogenerated": false,
"ratio": 3.450617283950617,
"config_test": false... |
#!/bin/python
#coding:utf-8
import random
import copy
import itertools
from roomai.doudizhu.DouDiZhuPokerInfo import *
from roomai.doudizhu.DouDiZhuPokerAction import *
class DouDiZhuPokerEnv(roomai.common.AbstractEnv):
'''
The DouDiZhuPoker game environment
'''
def __init__(self):
super(D... | {
"repo_name": "DMRookie/RoomAI",
"path": "roomai/doudizhu/DouDiZhuPokerEnv.py",
"copies": "1",
"size": "25732",
"license": "mit",
"hash": 6073455931741736000,
"line_mean": 40.3033707865,
"line_max": 169,
"alpha_frac": 0.5372299083,
"autogenerated": false,
"ratio": 4.009348706762231,
"config_tes... |
#!/bin/python
#coding:utf-8
import random
import copy
import roomai.common
import roomai
import logging
from roomai.common import Info
from roomai.texas.TexasHoldemUtil import *
from roomai.texas.TexasHoldemAction import *
from roomai.texas.TexasHoldemInfo import *
from functools import cmp_to_key... | {
"repo_name": "DMRookie/RoomAI",
"path": "roomai/texas/TexasHoldemEnv.py",
"copies": "1",
"size": "30448",
"license": "mit",
"hash": -8938911143793492000,
"line_mean": 38.1362467866,
"line_max": 171,
"alpha_frac": 0.5114950079,
"autogenerated": false,
"ratio": 3.638623326959847,
"config_test": ... |
#!/bin/python
# coding=utf8
import roomai.games.common
from roomai.games.common import AbstractStatePerson
from roomai.games.common import AbstractStatePrivate
from roomai.games.common import AbstractStatePublic
from roomai.games.common import Info
class AbstractEnv(object):
'''
The abstract class of game ... | {
"repo_name": "roomai/RoomAI",
"path": "roomai/games/common/AbstractEnv.py",
"copies": "1",
"size": "6368",
"license": "mit",
"hash": -6277238011320851000,
"line_mean": 38.5527950311,
"line_max": 201,
"alpha_frac": 0.6314384422,
"autogenerated": false,
"ratio": 4.358658453114305,
"config_test":... |
#!/bin/python
#coding=utf8
import roomai.games.common
from roomai import FrozenDict
logger = roomai.get_logger()
class AbstractStatePerson(object):
'''
The abstract class of the person state. The information in the person state is public to the corresponding player and hidden from other players
'''
... | {
"repo_name": "roomai/RoomAI",
"path": "roomai/games/common/AbstractStatePerson.py",
"copies": "1",
"size": "1109",
"license": "mit",
"hash": 7249009867647160000,
"line_mean": 36,
"line_max": 201,
"alpha_frac": 0.6717763751,
"autogenerated": false,
"ratio": 4.018115942028985,
"config_test": fal... |
#!/bin/python
#coding=utf8
import roomai.games.common
logger = roomai.get_logger()
class AbstractActionChance(object):
'''
The abstract class of an chance action. The chance action is used by the chance player.
'''
def __init__(self, key):
if not isinstance(key,str):
raise TypeE... | {
"repo_name": "roomai/RoomAI",
"path": "roomai/games/common/AbstractActionChance.py",
"copies": "1",
"size": "1762",
"license": "mit",
"hash": 3367250104015757000,
"line_mean": 36.4893617021,
"line_max": 157,
"alpha_frac": 0.6248581158,
"autogenerated": false,
"ratio": 4.438287153652393,
"confi... |
#!/bin/python
#coding=utf8
import roomai.games.common
logger = roomai.get_logger()
######################################################################### Basic Concepts #####################################################
class AbstractStatePublic(object):
'''
The abstract class of the public state. The ... | {
"repo_name": "roomai/RoomAI",
"path": "roomai/games/common/AbstractStatePublic.py",
"copies": "1",
"size": "2445",
"license": "mit",
"hash": -1736034543810388200,
"line_mean": 41.9122807018,
"line_max": 220,
"alpha_frac": 0.5517382413,
"autogenerated": false,
"ratio": 4.267015706806283,
"confi... |
#!/bin/python
# coding=utf8
import roomai.games.common
logger = roomai.get_logger()
class AbstractAction(object):
'''
The abstract class of an action.
'''
def __init__(self, key):
if not isinstance(key,str):
raise TypeError("The key for Action is an str, not %s"%(type(str)))
... | {
"repo_name": "roomai/RoomAI",
"path": "roomai/games/common/AbstractAction.py",
"copies": "1",
"size": "1664",
"license": "mit",
"hash": 3135462114714509300,
"line_mean": 32.3,
"line_max": 150,
"alpha_frac": 0.609375,
"autogenerated": false,
"ratio": 4.425531914893617,
"config_test": false,
"... |
#!/bin/python
#coding=utf8
import roomai
from roomai.games.common import AbstractStatePerson
from roomai.games.common import AbstractStatePublic
class Info(object):
'''
The class of information sent by env to a player. The Info class contains the public state history and the corresponding person state hist... | {
"repo_name": "roomai/RoomAI",
"path": "roomai/games/common/Info.py",
"copies": "1",
"size": "1740",
"license": "mit",
"hash": -1909611053208272400,
"line_mean": 44.8157894737,
"line_max": 169,
"alpha_frac": 0.7005747126,
"autogenerated": false,
"ratio": 3.9545454545454546,
"config_test": false... |
#!/bin/python
#coding=utf8
import roomai
import roomai.common
logger = roomai.get_logger()
######################################################################### Basic Concepts #####################################################
class AbstractPublicState(object):
'''
The abstract class of the public stat... | {
"repo_name": "DMRookie/RoomAI",
"path": "roomai/common/common.py",
"copies": "1",
"size": "16036",
"license": "mit",
"hash": -545007333417848000,
"line_mean": 36.1203703704,
"line_max": 201,
"alpha_frac": 0.5944125717,
"autogenerated": false,
"ratio": 3.9448954489544894,
"config_test": false,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.