text stringlengths 0 1.05M | meta dict |
|---|---|
#!/bin/python
#coding:utf-8
import roomai
class Stage:
firstStage = 1
secondStage = 2
thirdStage = 3
fourthStage = 4
AllCardsPattern = dict()
#0 1 2 3 4 5 6
#name, isStraight, isPair, isSameSuit, [SizeOfPair1, SizeOfPair2,..](des... | {
"repo_name": "roomai/RoomAI",
"path": "roomai/games/texasholdem/TexasHoldemUtil.py",
"copies": "1",
"size": "6187",
"license": "mit",
"hash": 4911995612393510000,
"line_mean": 33.7584269663,
"line_max": 200,
"alpha_frac": 0.5695813803,
"autogenerated": false,
"ratio": 3.0388015717092336,
"conf... |
#!/bin/python
# coding: utf-8
import sys
from optparse import OptionParser
# external APIs
from lib.yatedo.yatedoAPI import YatedoAPI
from lib.piplAPI.piplAPI import PiplAPI
from lib.emailFormatAPI.emailFormatAPI import EmailFormatAPI
from lib.haveibeenpwnedAPI.haveibeenpwnedAPI import haveibeenpwnedAPI
VERBOSE_MODE... | {
"repo_name": "PaulSec/recon-scan",
"path": "recon-scan.py",
"copies": "1",
"size": "1790",
"license": "mit",
"hash": 7695483052614341000,
"line_mean": 30.4035087719,
"line_max": 113,
"alpha_frac": 0.6659217877,
"autogenerated": false,
"ratio": 3.5445544554455446,
"config_test": false,
"has_n... |
#!/bin/python
# -*- coding: utf-8 -*-
import sys
import csv
from ctrls import *
from settings import *
from os import listdir
from os.path import isfile, join
class BenchMark():
'''To Run BenchMark on specific numbers for specific years'''
def __init__(self, numbers, Model):
# check the number from D... | {
"repo_name": "Asoul/stockflow",
"path": "ctrls/BenchMark.py",
"copies": "2",
"size": "3948",
"license": "mit",
"hash": -3000668569113023500,
"line_mean": 34.3211009174,
"line_max": 112,
"alpha_frac": 0.5207792208,
"autogenerated": false,
"ratio": 3.8615847542627884,
"config_test": false,
"ha... |
#!/bin/python
# -*- coding: utf-8 -*-
import sys
import os
import getopt
import codecs
import commands
import xml.etree.ElementTree as ET
#############################################
#
# 支持的基本类型(C++类型、PROTO类型、DB字段类型、默认值)
#
#############################################
scalar_types = {
# 整数-有符号
"int8" : ("in... | {
"repo_name": "david-pp/tinyworld",
"path": "tools/tinyobj.py",
"copies": "2",
"size": "17363",
"license": "mit",
"hash": -5361280376111607000,
"line_mean": 33.451417004,
"line_max": 120,
"alpha_frac": 0.5168928844,
"autogenerated": false,
"ratio": 3.522144039735099,
"config_test": false,
"ha... |
#!/bin/python
# coding:utf-8
import sys
import os
import subprocess
import socket
import fcntl
import struct
from optparse import OptionParser
# childutils这个模块是supervisor的一个模型,可以方便我们处理event消息
from supervisor import childutils
__doc__ = "\033[32m%s,捕获PROCESS_STATE_FATAL事件类型,当异常退出时触发报警\033[0m" % sys.argv[0]
def writ... | {
"repo_name": "HYmian/hadoop",
"path": "hadoop-conf/tool/listener.py",
"copies": "1",
"size": "2225",
"license": "apache-2.0",
"hash": 2462878676173269000,
"line_mean": 23.3703703704,
"line_max": 80,
"alpha_frac": 0.598073999,
"autogenerated": false,
"ratio": 2.8470418470418473,
"config_test": ... |
#!/bin/python
# -*- coding: utf-8 -*-
#import sys
#reload(sys)
#sys.setdefaultencoding('utf8')
import newticket
options = {}
options["reporter"] = "chenyang"
options["owner"] = "chenyang"
options["type"] = "task"
options["description"] = ""
# zhaojinpeng主要负责审查流程是否正确
options["cc"] = "masol, chenyang, zhaojinpeng"
#... | {
"repo_name": "sp-chenyang/xxutils",
"path": "jishujingli_buzhou.py",
"copies": "2",
"size": "1143",
"license": "mit",
"hash": 4348608840572613000,
"line_mean": 17.5208333333,
"line_max": 47,
"alpha_frac": 0.6220472441,
"autogenerated": false,
"ratio": 1.6493506493506493,
"config_test": false,
... |
#!/bin/python
# -*- coding: utf-8 -*-
import sys, os
import numpy as np
from sklearn import svm
from sklearn.ensemble import RandomForestClassifier
import binomial_law as binomial_law
import formatage_sentences as formatage_sentences
# File handling.
def read_file_8col_round(file_in, decimal):
dico = {}
for ligne i... | {
"repo_name": "PAJEAN/uncertaintyDetection",
"path": "MUD.py",
"copies": "1",
"size": "28056",
"license": "mit",
"hash": -3002507103609869000,
"line_mean": 29.9558498896,
"line_max": 618,
"alpha_frac": 0.5817228838,
"autogenerated": false,
"ratio": 2.4351827732916558,
"config_test": false,
"h... |
#!/bin/python
# -*- coding: UTF-8 -*-
import sys,os,string;
from csv import DictReader
def transliterate(name):
"""
Автор: LarsKort
Дата: 16/07/2011; 1:05 GMT-4;
Не претендую на "хорошесть" словарика. В моем случае и такой пойдет,
вы всегда сможете добавить свои символы и даже слова. Только
это нужн... | {
"repo_name": "Aminuxer/Voipswitch-Additions",
"path": "Data-Manage/CSV-Tariffs-Prepare.py",
"copies": "1",
"size": "3179",
"license": "bsd-2-clause",
"hash": 6963065463104388000,
"line_mean": 41.7076923077,
"line_max": 186,
"alpha_frac": 0.4625360231,
"autogenerated": false,
"ratio": 2.238709677... |
#!/bin/python
# -*- coding: utf-8 -*-
import threading
import Queue
import logging
import time
import re
import webpage_urlopen
import webpage_parse
import webpage_save
import url_record
class ThreadCrawl(threading.Thread):
""" Thread to crawl webpage.
Attributes:
url_queque: The queue stored reques... | {
"repo_name": "fivezh/Keepgoing",
"path": "py_spider/crawl_thread.py",
"copies": "1",
"size": "3155",
"license": "mit",
"hash": -1577939576612746800,
"line_mean": 33.6703296703,
"line_max": 99,
"alpha_frac": 0.5505546751,
"autogenerated": false,
"ratio": 4.124183006535947,
"config_test": false,... |
#!/bin/python
# -*- coding: utf8 -*-
import time
import logging
import unittest
from ots2 import *
ENDPOINT = 'http://127.0.0.1:8800'
ACCESSID = 'OTSMultiUser177_accessid'
ACCESSKEY = 'OTSMultiUser177_accesskey'
INSTANCENAME = 'TestInstance177'
def main():
ots_client = OTSClient(ENDPOINT, ACCESSID, ACCESSKEY, ... | {
"repo_name": "GiterLab/goots",
"path": "doc/ots_python_sdk_2.0.2/ots2/example/interfaces.py",
"copies": "2",
"size": "11590",
"license": "mit",
"hash": 2161453506124722400,
"line_mean": 42.4204081633,
"line_max": 132,
"alpha_frac": 0.6166572664,
"autogenerated": false,
"ratio": 2.933002481389578... |
#!/bin/python
# -*- coding: utf8 -*-
import time
import logging
import unittest
from ots2 import *
ENDPOINT = 'your_instance_address'
ACCESSID = 'your_accessid'
ACCESSKEY = 'your_accesskey'
INSTANCENAME = 'your_instance_name'
def main():
ots_client = OTSClient(ENDPOINT, ACCESSID, ACCESSKEY, INSTANCENAME)
... | {
"repo_name": "wanghq/goots",
"path": "doc/ots-python-sdk-2.0.7/ots2/example/interfaces.py",
"copies": "4",
"size": "11774",
"license": "mit",
"hash": 8874900600708764000,
"line_mean": 42.3927125506,
"line_max": 132,
"alpha_frac": 0.6175592461,
"autogenerated": false,
"ratio": 2.8889487870619948,... |
#!//bin/python
# -*- coding: utf-8 -*-
import types
import urllib2
import json
import datetime
import time
import DataAPI
import pandas as pd
import tushare as ts
benchmarkMap = {"SH":"000001", "SH50":"000016", "SH180":"000010", "ZZ500":"000905", "SZ":"399001", "ZXB":"399101", "HS300":"399300", "FUND_SH":"000... | {
"repo_name": "51quantech/iquant",
"path": "src/main/resources/python/Util.py",
"copies": "1",
"size": "8448",
"license": "apache-2.0",
"hash": -7338920298630889000,
"line_mean": 33.3414634146,
"line_max": 162,
"alpha_frac": 0.5706676136,
"autogenerated": false,
"ratio": 3.4216281895504252,
"co... |
#!/bin/python
# -*- coding: utf-8 -*-
import unittest
from src import homomorphic_encryption_scheme
def add_then_mult(arithmetic, ciphertexts, evaluation_key):
output_c1 = arithmetic.homomorphic_add(ciphertexts[0:4])
output_c2 = arithmetic.homomorphic_add(ciphertexts[4:])
final_output = arithmetic.homomo... | {
"repo_name": "UMComp4140ATeam/Raymond",
"path": "experiments/bootstrappable_experiment.py",
"copies": "1",
"size": "4468",
"license": "mit",
"hash": 8601592331604455000,
"line_mean": 39.6272727273,
"line_max": 199,
"alpha_frac": 0.6692032229,
"autogenerated": false,
"ratio": 3.6622950819672133,
... |
#!/bin/python
# -*- coding: utf-8 -*-
import urllib2
import re
import logging
def webpage_urlopen(url, crawl_timeout):
"""
webpage_urlopen - Function to get content from specific url.
Args:
url: The source url to be request.
crawl_timeout: The request timeout value.
Retur... | {
"repo_name": "fivezh/Keepgoing",
"path": "py_spider/webpage_urlopen.py",
"copies": "1",
"size": "2074",
"license": "mit",
"hash": -7421316575652513000,
"line_mean": 34.7586206897,
"line_max": 91,
"alpha_frac": 0.5641272903,
"autogenerated": false,
"ratio": 3.833641404805915,
"config_test": fal... |
#!/bin/python
# -*- coding: utf-8 -*-
"""
lychee upload v1.3
(C) 2014-2015 Roman Sirokov
Imports images from a location on hard drive to the Lychee installation on a remote server via SSH.
Based on lycheesync by Gustave Paté
https://github.com/GustavePate/lycheesync
"""
import argparse
import os
import sys
import ... | {
"repo_name": "r0x0r/lycheeupload",
"path": "lycheeupload.py",
"copies": "1",
"size": "8089",
"license": "apache-2.0",
"hash": -8282463396323137000,
"line_mean": 33.7124463519,
"line_max": 119,
"alpha_frac": 0.6173343225,
"autogenerated": false,
"ratio": 4.078668683812405,
"config_test": false,... |
#! /bin/python
# -*- coding: utf-8 -*-
"""
Module docstring
"""
from __future__ import unicode_literals, print_function
import unittest
import io
import os.path
import tempfile
from pyutils.texttempfile import TextTempFile
UNICODE_SNOWMAN = "\u2603"
UNICODE_PILE_OF_POO = "\u1F4A9"
class TestTextTempFile(unittest... | {
"repo_name": "alex-marty/utils",
"path": "pyutils/test/test_texttempfile.py",
"copies": "1",
"size": "3698",
"license": "mit",
"hash": 2317989896741122000,
"line_mean": 37.9263157895,
"line_max": 79,
"alpha_frac": 0.5681449432,
"autogenerated": false,
"ratio": 3.6078048780487806,
"config_test"... |
#!/bin/python
# coding: utf-8
class FlaskServerExporter:
name = "Flask Server"
def __init__(self, appname):
self._apis = []
self._appname = appname
def addapi(self, api):
self._apis.append(api)
def export(self):
files = []
files.append(self._makemain())
... | {
"repo_name": "Smarties89/Jockle",
"path": "exportplugins/flaskserver.py",
"copies": "1",
"size": "1846",
"license": "mit",
"hash": 7041268572071722000,
"line_mean": 19.7415730337,
"line_max": 78,
"alpha_frac": 0.5687973998,
"autogenerated": false,
"ratio": 3.806185567010309,
"config_test": fal... |
from __future__ import division, unicode_literals, print_function
import sys
from astropy.io.ascii import read as asciiread
class WebTable(object):
"""
"""
def __init__(self, tableFileName, uncertainty_str = None):
"""
"""
#open file
self.table = asciiread(tableFileName)
... | {
"repo_name": "natl/mrtonline",
"path": "webtable.py",
"copies": "1",
"size": "7539",
"license": "mit",
"hash": 1464166351408734700,
"line_mean": 40.8833333333,
"line_max": 80,
"alpha_frac": 0.5097493036,
"autogenerated": false,
"ratio": 4.103973870440936,
"config_test": false,
"has_no_keywor... |
#!bin/python
# -*- coding: utf-8 -*-
"""
Harmonises data from the city of Barcelona corresponding to
the bicycle hiring stations
"""
from __future__ import print_function
import contextlib
import json
from datetime import datetime
from pytz import timezone
import re
try: # Python 3
from urllib.req... | {
"repo_name": "Fiware/dataModels",
"path": "specs/Transportation/Bike/BikeHireDockingStation/harvest/bicycle_hire_station_barcelona_harvest.py",
"copies": "1",
"size": "4293",
"license": "mit",
"hash": 3959751597225621500,
"line_mean": 24.1052631579,
"line_max": 78,
"alpha_frac": 0.5697647333,
"aut... |
from __future__ import division, unicode_literals, print_function
from webtable import WebTable
import sys
import os
import shutil
cssDir = r'resources/css'
fontDir = r'resources/fonts'
jsDir = r'resources/js'
helpStrings = ['-h', '--help']
usage = '''Usage: mrtonline.py FILENAME OUTPUT_DIR [-e ERROR_PREFIX] [-r]\n
-... | {
"repo_name": "natl/mrtonline",
"path": "mrtonline.py",
"copies": "1",
"size": "3739",
"license": "mit",
"hash": 3884499812065812000,
"line_mean": 29.1532258065,
"line_max": 79,
"alpha_frac": 0.6282428457,
"autogenerated": false,
"ratio": 3.6585127201565557,
"config_test": false,
"has_no_keyw... |
#!/bin/python
# -*- coding: utf-8 -*-
"""
parse_unicorn_method_files.py
Parsing function for reading the METHOD section of GE Healthcare Life Sciences Unicorn 5.31 binary files. This can be useful in case it is difficult to restore the method files in the correct manner.
Created by Shane O'Connor 2016.
Copyright (c... | {
"repo_name": "Kortemme-Lab/klab",
"path": "klab/instruments/fplc/parse_unicorn_method_files.py",
"copies": "1",
"size": "2558",
"license": "mit",
"hash": 6651970560077259000,
"line_mean": 33.1066666667,
"line_max": 199,
"alpha_frac": 0.5860046912,
"autogenerated": false,
"ratio": 3.1309669522643... |
#!../bin/python
# -*- coding: utf-8 -*-
'''
Peforms a data harvesting of air quality official data from the city of Barcelona.
Data source is Catalonia's Government (http://dtes.gencat.cat/)
Copyright (c) 2016 Telefónica Investigación y Desarrollo S.A.U.
LICENSE: MIT
'''
from __future__ import wi... | {
"repo_name": "sergg75/dataModels",
"path": "Environment/AirQualityObserved/harvest/barcelona_airquality_harvest.py",
"copies": "1",
"size": "9506",
"license": "mit",
"hash": 3060802391058887000,
"line_mean": 30.2631578947,
"line_max": 127,
"alpha_frac": 0.6197390572,
"autogenerated": false,
"rat... |
#!/bin/python
# coding: utf-8
"""
Python API to retrieve Caller ID from phone number using OpenCNAM api.
"""
import requests
from bs4 import BeautifulSoup
import json
import phonenumbers
from flask import Markup
from config import OPEN_CNAM_KEY, OPEN_CNAM_SECRET
class OpenCNAMAPI(object):
"""
OpenCNAMAP... | {
"repo_name": "shiny-fortnight/reverse_search",
"path": "modules/OpenCNAMAPI.py",
"copies": "1",
"size": "1838",
"license": "apache-2.0",
"hash": -8410313618679996000,
"line_mean": 29.6333333333,
"line_max": 133,
"alpha_frac": 0.5979325354,
"autogenerated": false,
"ratio": 3.6833667334669338,
"... |
#!/bin/python
# coding: utf-8
"""
Python API to retrieve Caller ID from phone number using OpenCNAM api.
"""
import requests
from bs4 import BeautifulSoup
import json
import phonenumbers
class OpenCNAMAPI(object):
"""
OpenCNAMAPI Main Handler
"""
_instance = None
_verbose = False
def ... | {
"repo_name": "shiny-fortnight/auto_id",
"path": "OpenCNAMAPI.py",
"copies": "1",
"size": "1598",
"license": "apache-2.0",
"hash": -447218251182167500,
"line_mean": 28.0545454545,
"line_max": 160,
"alpha_frac": 0.6113892365,
"autogenerated": false,
"ratio": 3.5198237885462555,
"config_test": fa... |
#!/bin/python
# coding: utf-8
"""
Python util to retrieve Facebook profile from an email address.
Using this code, you can the full name + profile picture from any account using the email address.
"""
import requests
from bs4 import BeautifulSoup
import re
class FacebookResetPasswordAPI(object):
"""
Fa... | {
"repo_name": "shiny-fortnight/reverse_search",
"path": "modules/FacebookResetPasswordAPI.py",
"copies": "2",
"size": "2821",
"license": "apache-2.0",
"hash": 92537694847853540,
"line_mean": 31.4252873563,
"line_max": 134,
"alpha_frac": 0.5515774548,
"autogenerated": false,
"ratio": 3.73148148148... |
#!/bin/python
# -*- coding: utf-8 -*-
#
# This file implements a class that applies changes to the annotation of the TiGer corpus.
# Note that the conversion only works with version 2.1 of the TiGer corpus, release August 2007.
#
# author: Wolfgang Seeker
# 19/12/2012
#
import bs4
import fileinput
class TigerXMLForm... | {
"repo_name": "rsling/cow",
"path": "src/malt/malteval/tiger2dep/apply-corrections.py",
"copies": "1",
"size": "14007",
"license": "bsd-2-clause",
"hash": 2253266586255215400,
"line_mean": 46.9691780822,
"line_max": 217,
"alpha_frac": 0.5126722353,
"autogenerated": false,
"ratio": 3.6467065868263... |
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
"""
from contenttype import contenttype
from storage import Storage, StorageList, Settings, Messages
from validators import IS_NOT_IN_DB, IS_NOT_EMPTY, I... | {
"repo_name": "stryder199/RyarkAssignments",
"path": "Assignment2/web2py/gluon/tools.py",
"copies": "1",
"size": "155764",
"license": "mit",
"hash": 5742763250706051000,
"line_mean": 38.8883482714,
"line_max": 113,
"alpha_frac": 0.5308286896,
"autogenerated": false,
"ratio": 4.414453733881253,
... |
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
"""
import base64
import cPickle
import datetime
import thread
import logging
import sys
import glob
import os
import re
import time
import smtplib
impor... | {
"repo_name": "SEA000/uw-empathica",
"path": "empathica/gluon/tools.py",
"copies": "1",
"size": "167713",
"license": "mit",
"hash": -3630704621806758400,
"line_mean": 38.8462817771,
"line_max": 132,
"alpha_frac": 0.5328507629,
"autogenerated": false,
"ratio": 4.420945803458457,
"config_test": f... |
#!/bin/python
# -*- coding: utf-8 -*-
"""
This is a python implementation to simplify the use of the JSON API.
It allows an access to all the functions of the Redis API, via the network.
The parameters are as consistent as possible with the Redis API.
"""
try:
import simplejson as json
except:
import json
... | {
"repo_name": "CIRCL/bgpranking-redis-api",
"path": "example/api_web/client/bgpranking_web/api.py",
"copies": "1",
"size": "3982",
"license": "bsd-2-clause",
"hash": -4780323372788450000,
"line_mean": 33.3275862069,
"line_max": 75,
"alpha_frac": 0.6388749372,
"autogenerated": false,
"ratio": 3.46... |
#!/bin/python
# coding: utf-8
"""
This should be run on the repository server to make the index file
which contains information about all snippets and docstrings.
"""
import logging
from os import remove, listdir
from os.path import join as join_path
import imp
import json
log = logging.getLogger()
# TODO... | {
"repo_name": "Smarties89/ses",
"path": "makeindex.py",
"copies": "1",
"size": "1359",
"license": "mit",
"hash": -307298660087636400,
"line_mean": 22.8421052632,
"line_max": 75,
"alpha_frac": 0.5879323032,
"autogenerated": false,
"ratio": 4.056716417910447,
"config_test": false,
"has_no_keywo... |
#!/bin/python
# -*- coding: utf-8 -*-
"""
Unit tests for gluon.html
"""
import sys
import os
import unittest
def fix_sys_path():
"""
logic to have always the correct sys.path
'', web2py/gluon, web2py/site-packages, web2py/ ...
"""
def add_path_first(path):
sys.path = [path] + [p for... | {
"repo_name": "maoxuxiang/termite_mallet_project",
"path": "web2py/gluon/tests/test_html.py",
"copies": "9",
"size": "10525",
"license": "bsd-3-clause",
"hash": 7999995493456622000,
"line_mean": 35.8006993007,
"line_max": 176,
"alpha_frac": 0.4266033254,
"autogenerated": false,
"ratio": 3.1511976... |
#!/bin/python
# -*- coding: utf-8 -*-
"""
Unit tests for gluon.html
"""
import unittest
from fix_path import fix_sys_path
fix_sys_path(__file__)
from html import *
from html import verifyURL
from html import truncate_string
from storage import Storage
from html import XML_pickle, XML_unpickle
from html import T... | {
"repo_name": "frankyrumple/ope",
"path": "admin_app/gluon/tests/test_html.py",
"copies": "7",
"size": "38915",
"license": "mit",
"hash": 2299834361770451000,
"line_mean": 54.485021398,
"line_max": 766,
"alpha_frac": 0.5119938295,
"autogenerated": false,
"ratio": 3.278681615105791,
"config_test... |
import math
r=100
a=math.sqrt(r*r+r*r)/2
a=math.sqrt(a*a+math.pow(r-a,2))/2
i=16
while i<100000000000:
i*=2
a=math.sqrt(a*a+math.pow(r-math.sqrt(r*r-a*a),2))/2
print("Mon calcul de Pi :", ((a/2)*i)/r)
print("Math.pi :", math.pi)
#('Mon calcul de Pi :', 3.141592653589793)
#('Math.pi :', 3.141592653589793)
| {
"repo_name": "Oros42/Pi",
"path": "pi.py",
"copies": "1",
"size": "1330",
"license": "unlicense",
"hash": -2351479997886575000,
"line_mean": 30.8780487805,
"line_max": 74,
"alpha_frac": 0.7046671767,
"autogenerated": false,
"ratio": 2.1819699499165277,
"config_test": false,
"has_no_keywords"... |
# PySnake
# A simple snake game using pygame lib
# Author : José Gonçalves
import pygame, sys, time, random
from pygame.locals import *
pygame.init()
#Game settings :
fpsClock = pygame.time.Clock()
playSurface = pygame.display.set_mode((640, 480))
pygame.display.set_caption('PySnake')
## Define some colors :
redC... | {
"repo_name": "Tosta-Mixta/PythonSnake",
"path": "PySnake.py",
"copies": "1",
"size": "4295",
"license": "apache-2.0",
"hash": -2272770010291604000,
"line_mean": 31.5303030303,
"line_max": 98,
"alpha_frac": 0.6289308176,
"autogenerated": false,
"ratio": 3.5217391304347827,
"config_test": false,... |
#!/bin/python
# -*- coding: utf-8 -*-
"""
Reconstructs temperature fields based on selected indexfields regression data from db
TODO: Work in progress! Implement try and excepts, substitute hardcoded dimensions (81,161)
Created on Mon May 11 23:00:15 2015
@author: Manuel Beck
"""
"""
# # # # # # # #... | {
"repo_name": "ElenorFrisbee/MSC",
"path": "regmod/pcaPython/main.py",
"copies": "1",
"size": "7341",
"license": "mit",
"hash": 7052675972273210000,
"line_mean": 30.2425531915,
"line_max": 189,
"alpha_frac": 0.6520909958,
"autogenerated": false,
"ratio": 2.8278120184899844,
"config_test": false... |
#!/bin/python
# coding: utf-8
# This script synchronizes a database from a GRS export by adding and updating
# the objects from the export, and comparing the occuring objects and
# subsequently deleting of the objects, which don't occur in the export but in
# the database.
import sys
import signal
import traceback
im... | {
"repo_name": "fritz0705/lglass",
"path": "contrib/grs-import/grs-import.py",
"copies": "1",
"size": "2629",
"license": "mit",
"hash": -4621674581523829000,
"line_mean": 26.3854166667,
"line_max": 78,
"alpha_frac": 0.5869151769,
"autogenerated": false,
"ratio": 3.9063893016344724,
"config_test"... |
#!../bin/python
# coding: utf-8
#
# 台灣 OSM 圖資自動更新程式,會自動檢查更新,有更新時下載,並且匯入到 PostGIS
#
# 系統需求:
# * wget
# * osm2pgsql 並且內含 PBF 圖資格式支援
#
# 測試環境:
# * Ubuntu 14.04.1 LTS
# * OS X Yosemite 10.10.3
import os
import sys
import hashlib
from os.path import expanduser
RETRY_LIMIT = 3
HOME = expanduser("~")
# PostgreSQL 參數... | {
"repo_name": "OsmHackTW/integrality_check",
"path": "update_osm.py",
"copies": "1",
"size": "2681",
"license": "apache-2.0",
"hash": -107656346664380720,
"line_mean": 23.9204545455,
"line_max": 83,
"alpha_frac": 0.5877792978,
"autogenerated": false,
"ratio": 1.8600508905852418,
"config_test": ... |
import os
import sys
import json
import time
from datetime import datetime
commons_path = os.path.realpath('../../commons')
sys.path.insert(1, commons_path)
import corp_utils
import smart_dbapi
from print_progress import print_progress
ABORT_IF_ERROR = False
BEGIN = 4151
END = 4441
script_begin = datetime.now()
... | {
"repo_name": "virus-warnning/taiwan-anthropogeography-data",
"path": "categories/unluckylabor/improve.py",
"copies": "2",
"size": "2110",
"license": "apache-2.0",
"hash": 3626425189713740300,
"line_mean": 22.4871794872,
"line_max": 93,
"alpha_frac": 0.6413755459,
"autogenerated": false,
"ratio":... |
#!/bin/python
# -*- coding: utf-8 -*-
###############################################################################
# Update the content of distribution and tweet files - V1.0 #
# Copyright 2015 Benito Palacios (aka pleonex) #
# ... | {
"repo_name": "pleonex/Ninokuni",
"path": "Programs/scripts/DlcUpdater.py",
"copies": "1",
"size": "5878",
"license": "apache-2.0",
"hash": -7824960601225505000,
"line_mean": 30.9456521739,
"line_max": 105,
"alpha_frac": 0.557332426,
"autogenerated": false,
"ratio": 3.635126777983921,
"config_t... |
#!/bin/python
# -*- coding: utf-8 -*-
"""Validate roles."""
from .exceptions import InvalidUsage
from .get_user_roles import user_roles
from .get_route_access_roles import route_roles
from .get_user import user
def validate_roles(cursor, connection, token, endpoint):
"""
Validate Roles.
:param cursor: d... | {
"repo_name": "shridarpatil/RestApiz",
"path": "utils/validate_roles.py",
"copies": "1",
"size": "1205",
"license": "mit",
"hash": 9156687801034343000,
"line_mean": 35.5151515152,
"line_max": 79,
"alpha_frac": 0.5933609959,
"autogenerated": false,
"ratio": 4.288256227758007,
"config_test": fals... |
#!/bin/python
# -*- coding: utf-8 -*-
#Otto Mättas
#See skript leiab sisendfaili põhjal URLide lähtekoodist määratud stringid.
#Vers. tabel
# v0.1 Esimesed baaselemendid
# v1.0 Valmistoode
# v1.1 Optimaalsuse tõstmiseks toodud väljundfaili avamine tsüklist välja
import sys
import urllib2
#Skript kontrollib argumenti... | {
"repo_name": "ottomattas/ITK",
"path": "kodutoo3.py",
"copies": "1",
"size": "1889",
"license": "mit",
"hash": 4644950478081896000,
"line_mean": 30.1166666667,
"line_max": 110,
"alpha_frac": 0.7021960364,
"autogenerated": false,
"ratio": 2.3135068153655514,
"config_test": false,
"has_no_keyw... |
#!/bin/python
# -*- coding: utf-8 -*-
#Otto Mättas
#Skript, mis leiab sisendfailist inimeste nimed, ning annab tulemuse, milleks on nimest tuletatud EIKga seotud spetsiifiline info, väljundfailis.
#Vers. tabel
# v0.1 Ülesande defineerimine
# v0.1.1 Kondikava ülespanek
# v0.1.2 Sisendfailist saame vähendatud listi
# v0... | {
"repo_name": "ottomattas/ITK",
"path": "kontrolltoo2.py",
"copies": "1",
"size": "3015",
"license": "mit",
"hash": 97789033070133000,
"line_mean": 39.8356164384,
"line_max": 145,
"alpha_frac": 0.6011405569,
"autogenerated": false,
"ratio": 2.6310679611650487,
"config_test": false,
"has_no_ke... |
#!/bin/python
# -*- coding: utf-8 -*-
"""set_system_to_display_clock.py - Sample script to read the current date and time from the NEC large-screen display's
internal RTC (real-time clock), via the internal serial link from the Raspberry Pi Compute Module, and set the
operating system's date.
This could be used for... | {
"repo_name": "NECDisplaySolutions/necpdsdk",
"path": "examples/set_system_to_display_clock.py",
"copies": "1",
"size": "1599",
"license": "mit",
"hash": 4345691963401183700,
"line_mean": 33.0212765957,
"line_max": 120,
"alpha_frac": 0.655409631,
"autogenerated": false,
"ratio": 3.506578947368421... |
#!/bin/python
# coding: utf-8
# Standard libraries
import logging
from sys import argv
from urlparse import urljoin
from zipfile import ZipFile
from flask import render_template, Flask, request, redirect, Response, make_response
from fest.decorators import requireformdata
import requests
from statuscodes import statu... | {
"repo_name": "Smarties89/Jockle",
"path": "jockle.py",
"copies": "1",
"size": "8737",
"license": "mit",
"hash": 8399082184079046000,
"line_mean": 28.819112628,
"line_max": 152,
"alpha_frac": 0.6051276182,
"autogenerated": false,
"ratio": 3.9004464285714286,
"config_test": false,
"has_no_keyw... |
#!/bin/python
# coding: utf-8
# Standard libraries
import logging
import shelve
from uuid import uuid1
from json import loads, dumps
from os.path import isfile
# Third party libraries
# My libraries
log = logging.getLogger("jockle")
class RouteDatabaseShelve:
def __init__(self, fn):
self.fn = fn
... | {
"repo_name": "Smarties89/Jockle",
"path": "dbs.py",
"copies": "1",
"size": "3850",
"license": "mit",
"hash": -8153815196714178000,
"line_mean": 23.8387096774,
"line_max": 91,
"alpha_frac": 0.48,
"autogenerated": false,
"ratio": 3.838484546360917,
"config_test": false,
"has_no_keywords": fals... |
#!./bin/python
# -*- coding: utf-8 -*-
# vim: ts=4 sw=4 sts=4 ff=unix ft=python expandtab
# 絡み方が悪質
from __future__ import print_function
import codecs
import copy
import hashlib
import inspect
import json
import math
import os
import pickle
import random
import re
import sys
import time
import datetime
import traceb... | {
"repo_name": "tinbotu/sub",
"path": "sun.py",
"copies": "1",
"size": "55506",
"license": "mit",
"hash": -4209820787990016500,
"line_mean": 34.1791143424,
"line_max": 255,
"alpha_frac": 0.5475143727,
"autogenerated": false,
"ratio": 2.7157508036124294,
"config_test": false,
"has_no_keywords":... |
import os
import socket
import sys
import time
# Global configuration.
CONNECT_RETRY_SECONDS = 30.0 # How long to wait (in seconds) before attempting to connect to a closed console.
CONSOLE_PORT = 6571 # TCP port to connect to for accessing the console. Default is 6571.
# Read hostname and interval environment v... | {
"repo_name": "tdicola/YunLuCIStatistics",
"path": "CollectdYunConsole.py",
"copies": "1",
"size": "1898",
"license": "mit",
"hash": -6302988966063321000,
"line_mean": 34.1481481481,
"line_max": 110,
"alpha_frac": 0.7402528978,
"autogenerated": false,
"ratio": 3.4259927797833933,
"config_test":... |
#!/bin/python
#-*- conding:utf-8 -*-
import MySQLdb
import argparse
def getColumns(db, tablename):
lines = db.execute("desc %s"%(tablename))
results = db.fetchall()
columns = {}
for row in results:
if row[1][:3].lower() == 'int':
f = int
elif row[1][:7].lower() == 'varchar'... | {
"repo_name": "YabinFan/cbio_database",
"path": "addMAF.py",
"copies": "1",
"size": "3297",
"license": "apache-2.0",
"hash": 6557528291192534000,
"line_mean": 31.3333333333,
"line_max": 109,
"alpha_frac": 0.5456475584,
"autogenerated": false,
"ratio": 3.9963636363636366,
"config_test": false,
... |
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form ... | {
"repo_name": "dafyddcrosby/plugin.audio.bigupradio",
"path": "default.py",
"copies": "1",
"size": "1944",
"license": "bsd-2-clause",
"hash": -2647653346655935000,
"line_mean": 39.5,
"line_max": 83,
"alpha_frac": 0.7458847737,
"autogenerated": false,
"ratio": 3.8957915831663326,
"config_test": ... |
"""Examples of using AI Platform's online prediction service."""
import argparse
import json
# [START import_libraries]
import googleapiclient.discovery
# [END import_libraries]
# [START predict_json]
# Create the AI Platform service object.
# To authenticate set the environment variable
# GOOGLE_APPLICATION_CREDEN... | {
"repo_name": "GoogleCloudPlatform/python-docs-samples",
"path": "ml_engine/online_prediction/predict.py",
"copies": "1",
"size": "3170",
"license": "apache-2.0",
"hash": 2632488187064535600,
"line_mean": 28.6261682243,
"line_max": 78,
"alpha_frac": 0.6394321767,
"autogenerated": false,
"ratio": ... |
"""Examples of using the Cloud ML Engine's online prediction service."""
import argparse
import base64
import json
# [START import_libraries]
import googleapiclient.discovery
# [END import_libraries]
import six
# [START predict_json]
def predict_json(project, model, instances, version=None):
"""Send json data t... | {
"repo_name": "pongem/python-bot-project",
"path": "ml_engine/online_prediction/predict.py",
"copies": "1",
"size": "6607",
"license": "apache-2.0",
"hash": -494200727625288060,
"line_mean": 32.3686868687,
"line_max": 78,
"alpha_frac": 0.6217647949,
"autogenerated": false,
"ratio": 4.346710526315... |
# [START containeranalysis_create_note]
def create_note(note_id, project_id):
"""Creates and returns a new vulnerability note."""
# note_id = 'my-note'
# project_id = 'my-gcp-project'
from grafeas.grafeas_v1 import Version
from google.cloud.devtools import containeranalysis_v1
client = conta... | {
"repo_name": "googleapis/python-containeranalysis",
"path": "samples/snippets/samples.py",
"copies": "1",
"size": "14366",
"license": "apache-2.0",
"hash": 4385908736751717400,
"line_mean": 37.5147453083,
"line_max": 122,
"alpha_frac": 0.6849505778,
"autogenerated": false,
"ratio": 3.90911564625... |
import os, sys, time
ignore = ['download rate', 'disk block buffers']
keys = ['upload rate', 'download rate', 'downloading torrents', \
'seeding torrents', 'peers', 'connecting peers', 'disk block buffers']
axes = ['x1y2', 'x1y2', 'x1y1', 'x1y1', 'x1y1', 'x1y1', 'x1y1']
out = open('session_stats.gnuplot', 'wb')
p... | {
"repo_name": "chongyc/libtorrent",
"path": "parse_session_stats.py",
"copies": "1",
"size": "1224",
"license": "bsd-3-clause",
"hash": 6464522169606135000,
"line_mean": 31.2105263158,
"line_max": 109,
"alpha_frac": 0.6511437908,
"autogenerated": false,
"ratio": 2.7945205479452055,
"config_test... |
import os, sys, time
lines = open(sys.argv[1], 'rb').readlines()
if len(sys.argv) < 2:
print "usage: parse_disk_log.py logfile [seconds]"
sys.exit(1)
keys = ['write', 'read', 'hash', 'move', 'release', 'idle']
throughput_keys = ['write', 'read']
# logfile format:
# <time(ms)> <state>
# example:
# 34523 idle
# 34... | {
"repo_name": "chongyc/libtorrent",
"path": "parse_disk_log.py",
"copies": "1",
"size": "2488",
"license": "bsd-3-clause",
"hash": 7787510998468690000,
"line_mean": 25.1894736842,
"line_max": 101,
"alpha_frac": 0.6374598071,
"autogenerated": false,
"ratio": 2.658119658119658,
"config_test": fal... |
import os, sys, time
lines = open(sys.argv[1], 'rb').readlines()
#keys = ['send_buffer_utilization']
keys = ['send_buffer_size', 'used_send_buffer', 'protocol_buffer']
#keys = ['send_buffer_alloc', 'send_buffer', 'allocate_buffer_alloc', 'allocate_buffer', 'protocol_buffer']
#keys = ['send_buffer_alloc', 'send_buffe... | {
"repo_name": "chongyc/libtorrent",
"path": "parse_buffer_log.py",
"copies": "1",
"size": "2989",
"license": "bsd-3-clause",
"hash": 5432622739788076000,
"line_mean": 32.2111111111,
"line_max": 129,
"alpha_frac": 0.5791234527,
"autogenerated": false,
"ratio": 3.2738225629791895,
"config_test": ... |
import pylab
import numpy
import numpy as np
import scipy.interpolate as si
wav, flx = np.loadtxt('KPNO2010.txt', unpack=True, comments="#")
wav = 10. * wav # convert from nm to Angstroms)
binSize = 3000 # number of pixels of iodine per bin
smoothFactor = 0.0 # 0 forces spline through all points.
argMaxValues = [np.... | {
"repo_name": "jbwhit/CaliCompari",
"path": "FTS/KPNO2010.py",
"copies": "1",
"size": "2932",
"license": "mit",
"hash": -2325339668112899000,
"line_mean": 46.3064516129,
"line_max": 78,
"alpha_frac": 0.7251023192,
"autogenerated": false,
"ratio": 3.571254567600487,
"config_test": false,
"has_... |
#!/bin/python
# Create a bijection between base32 nmers and LANGUAGE.
from string import ascii_lowercase
from itertools import product
from scipy.spatial.distance import pdist, squareform
import editdistance
import numpy as np
import pdb
import sys
import re
import gzip
NMER_SIZE = 3
# --- loading and prep --- #
def... | {
"repo_name": "corcra/leekspeak",
"path": "map_fns.py",
"copies": "1",
"size": "11176",
"license": "mit",
"hash": 5110154115840113000,
"line_mean": 33.600619195,
"line_max": 96,
"alpha_frac": 0.6114889048,
"autogenerated": false,
"ratio": 3.670279146141215,
"config_test": false,
"has_no_keywo... |
#/bin/python
# Default is set up for a wordpress admin form
import mechanize
import logging
import time
from optparse import OptionParser
from urllib2 import HTTPError
form_username = 'log'
form_password = 'pwd'
form_submit = 'wp-submit'
def brute_server(server, user, password_list):
br = mechanize.Browser()
br... | {
"repo_name": "ahhh/SPSE",
"path": "mechanize_webform_brute.py",
"copies": "2",
"size": "2773",
"license": "mit",
"hash": 5015948376888823000,
"line_mean": 28.8172043011,
"line_max": 75,
"alpha_frac": 0.6188243779,
"autogenerated": false,
"ratio": 3.672847682119205,
"config_test": false,
"has... |
#!/bin/python
def calculate_bid(player,pos,first_moves,second_moves):
remaining = remaining_amount(player, first_moves, second_moves)
amortized_bid = remaining / steps_remaining(player, pos)
if(amortized_bid < 1):
amortized_bid = 1
default_bid = 14
last_first_bid = 0
... | {
"repo_name": "HiccupinGminor/bidding-game",
"path": "nicebotbot.py",
"copies": "1",
"size": "3085",
"license": "mit",
"hash": 6588547881805571000,
"line_mean": 27.0454545455,
"line_max": 77,
"alpha_frac": 0.5481361426,
"autogenerated": false,
"ratio": 3.7530413625304138,
"config_test": false,
... |
#!/bin/python
def getch():
try:from termios import tcgetattr,tcsetattr,TCSANOW
except ImportError:
from msvcrt import getch
return lambda:ord(getch())
from sys import stdin,stdout
from os import isatty
def getch():
stdout.flush()
fd=stdin.fileno()
if isatty(fd):
oldset=tcgetattr(fd)
newset=oldset[:... | {
"repo_name": "serprex/Befunge",
"path": "funge.py",
"copies": "1",
"size": "20986",
"license": "unlicense",
"hash": -6277964041616457000,
"line_mean": 22.929304447,
"line_max": 168,
"alpha_frac": 0.5628990756,
"autogenerated": false,
"ratio": 2.3137816979051817,
"config_test": false,
"has_no... |
#!/bin/python
#def handle_digit(digit,retstr)
'''
program like this, one important thing python can do is enumerate every possibilities with tuple
and use iteration to simplified this. this is the key to master the python
'''
#use dictionary
romans = [('M',1000),('CM',900),('D',500),('CD',400),('C',100),('XC',90),('L'... | {
"repo_name": "dramaticlly/Python4Interview",
"path": "romanNumber.py",
"copies": "1",
"size": "2618",
"license": "mit",
"hash": 1925082326398675700,
"line_mean": 27.7692307692,
"line_max": 137,
"alpha_frac": 0.5213903743,
"autogenerated": false,
"ratio": 3.1965811965811968,
"config_test": fals... |
#!/bin/python
# Draws a 'fractal' tiling, inspired by /u/graaahh
# http://www.reddit.com/r/CasualMath/comments/230d5s/i_made_this_interesting_pattern_is_it_a_fractal/
import math
import turtle
import collections
State = collections.namedtuple("State", ["pos","heading"])
stateStack = []
maxDepth = 6
diagLen = 20;
horiz... | {
"repo_name": "kernalphage/doodles",
"path": "fractal.py",
"copies": "1",
"size": "1860",
"license": "unlicense",
"hash": -4992824152007852000,
"line_mean": 26.776119403,
"line_max": 101,
"alpha_frac": 0.6037634409,
"autogenerated": false,
"ratio": 3.195876288659794,
"config_test": false,
"ha... |
#!/bin/python
#encoding:utf-8
from pymongo import MongoClient
import datetime
mongopath = "localhost"
nowDate = datetime.datetime.now().strftime("%Y-%m-%d") # 当前日期
startDate = (datetime.datetime.now() + datetime.timedelta(days=-180)).strftime("%Y-%m-%d")
endDate = nowDate
def clientMongo():
client = MongoClient(... | {
"repo_name": "sincerefly/getEastmoneyReport",
"path": "sina_guping/statistics-6/sta-2.1.py",
"copies": "1",
"size": "1372",
"license": "mit",
"hash": 6126283559598171000,
"line_mean": 19.4,
"line_max": 90,
"alpha_frac": 0.5467571644,
"autogenerated": false,
"ratio": 3.5454545454545454,
"config... |
#!/bin/python
# *-* encoding=utf-8 *-*
'''
Image Priting Program Based on Haftoning
'''
import numpy, scipy
from scipy import ndimage
from scipy import misc
import matplotlib.pyplot as plt
import random
def gaussian_noise_gen(mean, var):
def f(val):
return val + random.gauss(mean, var)
return f
def ... | {
"repo_name": "zhouzhaoze/dip",
"path": "project4/Proj05-01/main.py",
"copies": "1",
"size": "1620",
"license": "apache-2.0",
"hash": -4520345032790790700,
"line_mean": 21.8169014085,
"line_max": 78,
"alpha_frac": 0.5320987654,
"autogenerated": false,
"ratio": 2.9944547134935307,
"config_test":... |
#!/bin/python
# *-* encoding=utf-8 *-*
'''
Image Priting Program Based on Haftoning
'''
import numpy, scipy
from scipy import ndimage
from scipy import misc
import matplotlib.pyplot as plt
def compute_historgram(img):
hstg = {}
for i in range(img.shape[0]):
for j in range(img.shape[1]):
c ... | {
"repo_name": "zhouzhaoze/dip",
"path": "project2/Proj03-02/main.py",
"copies": "1",
"size": "1166",
"license": "apache-2.0",
"hash": -3124366369043673000,
"line_mean": 19.4561403509,
"line_max": 48,
"alpha_frac": 0.5626072041,
"autogenerated": false,
"ratio": 2.6804597701149424,
"config_test":... |
#!/bin/python
# *-* encoding=utf-8 *-*
'''
Image Priting Program Based on Haftoning
'''
import numpy, scipy
from scipy import ndimage
from scipy import misc
import matplotlib.pyplot as plt
ht_map = {
0: numpy.array([[0,0,0],
[0,0,0],
[0,0,0]]),
1: nu... | {
"repo_name": "zhouzhaoze/dip",
"path": "project2/Proj02-01/Proj02-01.py",
"copies": "1",
"size": "2611",
"license": "apache-2.0",
"hash": -8653572716176615000,
"line_mean": 23.8666666667,
"line_max": 96,
"alpha_frac": 0.3933358866,
"autogenerated": false,
"ratio": 3.0080645161290325,
"config_t... |
#!/bin/python
# *-* encoding=utf-8 *-*
'''
Image Priting Program Based on Haftoning
'''
import numpy, scipy
from scipy import ndimage
from scipy import misc
import scipy.fftpack as fftpack
import matplotlib.pyplot as plt
'''
def DFT_matrix(N):
i, j = numpy.meshgrid(numpy.arange(N), numpy.arange(N))
omega = nu... | {
"repo_name": "zhouzhaoze/dip",
"path": "project3/Proj04-01/DFT.py",
"copies": "1",
"size": "2339",
"license": "apache-2.0",
"hash": -1090067963673108600,
"line_mean": 22.8673469388,
"line_max": 61,
"alpha_frac": 0.5925609235,
"autogenerated": false,
"ratio": 2.5618838992332966,
"config_test": ... |
#!/bin/python
# *-* encoding=utf-8 *-*
import numpy, scipy
from scipy import ndimage
from scipy import misc
import matplotlib.pyplot as plt
def spatial_filtering(img, mask):
M, N = img.shape
M1, N1 = mask.shape
M1, N1 = M1/2, N1/2
print M+M1*2
print N+N1*2
from_img = numpy.zeros((M+M1*2)*(N+... | {
"repo_name": "zhouzhaoze/dip",
"path": "project4/Proj05-02/spatial_filtering.py",
"copies": "1",
"size": "1245",
"license": "apache-2.0",
"hash": 3736225840747875000,
"line_mean": 25.4893617021,
"line_max": 81,
"alpha_frac": 0.5542168675,
"autogenerated": false,
"ratio": 2.5883575883575882,
"c... |
#!/bin/python
# *-* encoding=utf-8 *-*
import sys
import math
import numpy, scipy
from scipy import ndimage
from scipy import misc
import matplotlib.pyplot as plt
import random
import colorsys
sys.path.append('../../project2/Proj03-02')
from histogram_equalization import histogram_equalization
import math
def hsv2... | {
"repo_name": "zhouzhaoze/dip",
"path": "project5/Proj06-03/main.py",
"copies": "1",
"size": "2743",
"license": "apache-2.0",
"hash": -45291753233665870,
"line_mean": 22.852173913,
"line_max": 80,
"alpha_frac": 0.5027342326,
"autogenerated": false,
"ratio": 2.561157796451914,
"config_test": fal... |
#!/bin/python
# *-* encoding=utf-8 *-*
import sys
import numpy, scipy
from scipy import ndimage
from scipy import misc
import scipy.fftpack as fftpack
import matplotlib.pyplot as plt
sys.path.append('../Proj04-01')
from DFT import DFT_2D, IDFT_2D
def en_padding(img):
M, N = img.shape
P, Q = 2 * M, 2 * N
... | {
"repo_name": "zhouzhaoze/dip",
"path": "project3/Proj04-03/main.py",
"copies": "1",
"size": "2201",
"license": "apache-2.0",
"hash": 4391054918688001500,
"line_mean": 26.8607594937,
"line_max": 109,
"alpha_frac": 0.5642889596,
"autogenerated": false,
"ratio": 2.5863689776733256,
"config_test":... |
#!/bin/python
#encoding=utf-8
import sys
import os
import time
import urllib
from threading import Thread,Lock
import shutil
from contextlib import closing
from __builtin__ import True
printLocker = Lock()
class AxelPython(Thread,urllib.FancyURLopener):
def __init__(self,threadname,url,filename,ranges):
... | {
"repo_name": "51reboot/homework-arch-4",
"path": "3/lihongyuan/downloadfilesThreadings.py",
"copies": "1",
"size": "3575",
"license": "apache-2.0",
"hash": -4543056839291969000,
"line_mean": 28.7916666667,
"line_max": 95,
"alpha_frac": 0.5765034965,
"autogenerated": false,
"ratio": 3.83583690987... |
#!/bin/python
# Example to invoke admin get features command.
#
import sys, struct, ctypes, unvme
from unvme import *
# Main
try:
pci = sys.argv[1]
except:
print('Usage: python %s PCINAME\n' % sys.argv[0])
sys.exit(1)
features = [ '',
'1) Arbitration:',
'2) Power Management:',... | {
"repo_name": "MicronSSD/unvme",
"path": "test/python/unvme_get_features.py",
"copies": "1",
"size": "2141",
"license": "bsd-3-clause",
"hash": -8277120932828706000,
"line_mean": 31.4393939394,
"line_max": 103,
"alpha_frac": 0.5207846801,
"autogenerated": false,
"ratio": 2.8508655126498,
"confi... |
#!/bin/python
# Example to open a device and print its namespace info.
#
# This program shows 2 ways to invoke Python UNVMe interfaces:
# 1) To use direct functions, specify device with /NSID, e.g. 01:00.0/1
# 2) To use Unvme class, specify device without slash, e.g. 01:00.0
#
import sys, unvme
from unvme import *... | {
"repo_name": "MicronSSD/unvme",
"path": "test/python/unvme_info.py",
"copies": "1",
"size": "1850",
"license": "bsd-3-clause",
"hash": 628631416258830000,
"line_mean": 33.2592592593,
"line_max": 82,
"alpha_frac": 0.5540540541,
"autogenerated": false,
"ratio": 2.9838709677419355,
"config_test":... |
"""
DOXYTAG parses doxygen.tag files.
"""
import xml.dom.minidom
import sys
import os
import re
__mpname__ = 'Doxytag'
__version__ = '0.1'
__date__ = '2013-07-09'
__description__ = 'Doxygen tags parser'
__long_description__ = __doc__
__license__ = 'BSD'
__author__ ... | {
"repo_name": "zpole/IICV",
"path": "docsrc/doxytag.py",
"copies": "50",
"size": "2079",
"license": "bsd-2-clause",
"hash": -2233342937327160600,
"line_mean": 29.1304347826,
"line_max": 70,
"alpha_frac": 0.4728234728,
"autogenerated": false,
"ratio": 3.9078947368421053,
"config_test": false,
... |
#!/bin/python
# for generating a javascript file that associates gl.TEXTUREX with index X in an array
# imports
import sys
# input variable defaults
max_n = 32 # check against gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)
filename = "TextureEnumArray.js"
# non-input defaults and globals
outfile = None
entry_k... | {
"repo_name": "ionaic/webgl-arch",
"path": "genTexEnumArray.py",
"copies": "1",
"size": "1355",
"license": "mit",
"hash": -246606232882299500,
"line_mean": 29.1111111111,
"line_max": 100,
"alpha_frac": 0.6811808118,
"autogenerated": false,
"ratio": 3.321078431372549,
"config_test": false,
"ha... |
#!bin/python
from app import db
from app.models import Control, Level, Itype, Tlp, Source, Likelihood, Status, Destination
controls = ["Inbound", "Outbound"]
levels = ["None", "Low", "Medium", "High"]
tlps = ["White", "Green", "Amber", "Red"]
types = [["ipv4","^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$"],
["domain"... | {
"repo_name": "team-miv/miv-tracker",
"path": "db_populate.py",
"copies": "3",
"size": "1572",
"license": "mit",
"hash": 62769497889070616,
"line_mean": 23.9523809524,
"line_max": 122,
"alpha_frac": 0.5413486005,
"autogenerated": false,
"ratio": 2.62876254180602,
"config_test": false,
"has_no... |
#!/bin/python
from argparse import ArgumentParser
from inspect import getmembers, isclass, isfunction, ismethod
from os import getcwd
# noinspection PyProtectedMember
from pydoc import ErrorDuringImport, safeimport
from sys import path
MODULE_FORMAT = "# *module* %s"
CLASS_FORMAT = "## *class* %s"
FUNCTION_FORMAT = "#... | {
"repo_name": "alexbahnisch/pyplus",
"path": "scripts/pydoc2markdown.py",
"copies": "1",
"size": "4042",
"license": "mit",
"hash": 388556420202680000,
"line_mean": 28.9407407407,
"line_max": 107,
"alpha_frac": 0.595002474,
"autogenerated": false,
"ratio": 4.107723577235772,
"config_test": false... |
#!/bin/python
from befh.clients.zmq import ZmqClient
from befh.clients.csv import FileClient
from befh.clients.mysql import MysqlClient
from befh.clients.sqlite import SqliteClient
from befh.market_data import L2Depth, Trade, Snapshot
from datetime import datetime
from threading import Lock
class ExchangeGateway:
... | {
"repo_name": "Aurora-Team/BitcoinExchangeFH",
"path": "befh/exchanges/gateway.py",
"copies": "1",
"size": "8989",
"license": "apache-2.0",
"hash": 5045329762315283000,
"line_mean": 43.945,
"line_max": 137,
"alpha_frac": 0.4618978752,
"autogenerated": false,
"ratio": 4.817256162915327,
"config_... |
#!bin/python
from cam import cam
from flask import Flask, jsonify, request, abort, make_response
import json
application = Flask(__name__)
@application.errorhandler(400)
def bad_request_400(error):
#error(400,'error 400')
return make_response(jsonify( { 'error': True, 'error_type': 'Bad request', 'error_no': 400} ... | {
"repo_name": "msemple1111/average_alpr",
"path": "webserver.py",
"copies": "1",
"size": "1236",
"license": "mit",
"hash": -1882868696833626600,
"line_mean": 33.3333333333,
"line_max": 112,
"alpha_frac": 0.6812297735,
"autogenerated": false,
"ratio": 3.161125319693095,
"config_test": false,
"... |
#!/bin/python
from _collections import defaultdict
def findunique(choices):
'''
in the arrary, every element except 1 has exactly 1 duplicate, how to find the unique one
also: analyze performance
'''
dic = defaultdict(int)
for choice in choices: #O(N)
dic[choice]+=1
for item in dic.items(): #O(N)
if... | {
"repo_name": "dramaticlly/Python4Interview",
"path": "onlyunique.py",
"copies": "1",
"size": "1624",
"license": "mit",
"hash": 5395777204600661000,
"line_mean": 22.5507246377,
"line_max": 90,
"alpha_frac": 0.6366995074,
"autogenerated": false,
"ratio": 2.4531722054380665,
"config_test": false,... |
#!/bin/python
from containerFlow import ContainerConnect
import logging
log = logging.getLogger("RMDocker.NetflowAnalyze")
class NetflowAnalyze:
def __init__(self):
self.count = 0
self.containerToNet={}
self.file = open("network.log","w")
def close(self):
self.file.close()... | {
"repo_name": "yncxcw/PreemptYARN-2.7.1",
"path": "PyDockerMonitor/netFlowAnalyze.py",
"copies": "1",
"size": "3256",
"license": "apache-2.0",
"hash": 7965711064460650000,
"line_mean": 30.3076923077,
"line_max": 72,
"alpha_frac": 0.4972358722,
"autogenerated": false,
"ratio": 3.980440097799511,
... |
#!/bin/python
from Crypto.Util.asn1 import DerSequence
from Crypto.Cipher import AES
from Crypto.PublicKey import RSA
from Crypto.Hash import HMAC
from Crypto.Random import _UserFriendlyRNG as Random
from Crypto.Cipher import PKCS1_OAEP
from Crypto.PublicKey import RSA
from M2Crypto import X509 as m2x509
from OpenSSL i... | {
"repo_name": "vsaw/miniSSL",
"path": "minissl/keyutils.py",
"copies": "1",
"size": "4926",
"license": "mit",
"hash": -4883062515329864000,
"line_mean": 21.7004608295,
"line_max": 89,
"alpha_frac": 0.7298010556,
"autogenerated": false,
"ratio": 3.4160887656033285,
"config_test": false,
"has_n... |
#!/bin/python
from datetime import datetime
import copy
class MarketDataBase:
"""
Abstract class of a market data
"""
class Side:
NONE = 0
BUY = 1
SELL = 2
class Depth(object):
def __init__(self, price=0.0, count=0, volume=0.0):
"""
Construc... | {
"repo_name": "Aurora-Team/BitcoinExchangeFH",
"path": "befh/market_data.py",
"copies": "1",
"size": "8229",
"license": "apache-2.0",
"hash": -8902172931427129000,
"line_mean": 30.1704545455,
"line_max": 110,
"alpha_frac": 0.4756349496,
"autogenerated": false,
"ratio": 3.536312849162011,
"confi... |
#!/bin/python
from datetime import timedelta
from sqlalchemy import asc
import Monstr.Core.Utils as Utils
import Monstr.Core.DB as DB
import Monstr.Core.BaseModule as BaseModule
class StatusTimeline(BaseModule.BaseModule):
name = 'StatusTimeline'
config = {}
def __init__(self):
super(StatusTime... | {
"repo_name": "tier-one-monitoring/monstr",
"path": "Monstr/Modules/StatusTimeline/StatusTimeline.py",
"copies": "1",
"size": "2137",
"license": "apache-2.0",
"hash": -7746627794232593000,
"line_mean": 36.4912280702,
"line_max": 249,
"alpha_frac": 0.5311183903,
"autogenerated": false,
"ratio": 4.... |
#!/bin/python
from datetime import timedelta
from sqlalchemy import desc
import Monstr.Core.Utils as Utils
import Monstr.Core.DB as DB
import Monstr.Core.BaseModule as BaseModule
class MonstrJournal(BaseModule.BaseModule):
name = 'MonstrJournal'
config = {}
def __init__(self):
super(MonstrJour... | {
"repo_name": "tier-one-monitoring/monstr",
"path": "Monstr/Modules/MonstrJournal/MonstrJournal.py",
"copies": "1",
"size": "1854",
"license": "apache-2.0",
"hash": -4257199008002796000,
"line_mean": 30.9655172414,
"line_max": 144,
"alpha_frac": 0.4978425027,
"autogenerated": false,
"ratio": 4.5,... |
#!/bin/python
from deap import base
from deap import tools
from copy import deepcopy
import random
from . .import parameterOperations
from .import Creator
getPromoterFromMap = lambda x: [x[z] for z in list(x.keys())]
def constructPhenotype(stratSettings, chrconf, Individue):
Settings = {}
GeneSize = 2
... | {
"repo_name": "Gab0/gekkoJaponicus",
"path": "promoterz/representation/chromosome.py",
"copies": "1",
"size": "4685",
"license": "mit",
"hash": 3061813048164940000,
"line_mean": 31.3103448276,
"line_max": 85,
"alpha_frac": 0.6185699039,
"autogenerated": false,
"ratio": 3.17842605156038,
"config... |
#!/bin/python
from deap import base, tools
from copy import deepcopy
import random
import promoterz.supplement.age
import promoterz.supplement.PRoFIGA
import promoterz.supplement.phenotypicDivergence
import itertools
# population as last positional argument, to blend with toolbox;
def immigrateHoF(HallOfFame, popu... | {
"repo_name": "Gab0/gekkoJaponicus",
"path": "promoterz/evolutionHooks.py",
"copies": "1",
"size": "5063",
"license": "mit",
"hash": 8226455470791448000,
"line_mean": 31.0443037975,
"line_max": 83,
"alpha_frac": 0.6989926921,
"autogenerated": false,
"ratio": 3.7811799850634804,
"config_test": f... |
#!/bin/python
from deap import tools
from copy import deepcopy
import random
from deap import algorithms
from ... import statistics
from ... import evolutionHooks
from ... import validation
from ... import supplement
def checkPopulation(population, message):
if not (len(population)):
print(message)
def... | {
"repo_name": "Gab0/gekkoJaponicus",
"path": "promoterz/sequence/locale/standard_loop.py",
"copies": "1",
"size": "6163",
"license": "mit",
"hash": 7761542834503224000,
"line_mean": 34.6242774566,
"line_max": 88,
"alpha_frac": 0.647736492,
"autogenerated": false,
"ratio": 4.08958195089582,
"con... |
#!/bin/python
from deap import tools
from . import evolutionHooks
from . import statistics
class Locale():
def __init__(self, World, name, position, loop):
self.World = World
self.name = name
self.EPOCH = 0
self.position = position
self.EvolutionStatistics = []
se... | {
"repo_name": "Gab0/gekkoJaponicus",
"path": "promoterz/locale.py",
"copies": "1",
"size": "1484",
"license": "mit",
"hash": 3069870321851437000,
"line_mean": 33.511627907,
"line_max": 84,
"alpha_frac": 0.6529649596,
"autogenerated": false,
"ratio": 4.133704735376044,
"config_test": false,
"h... |
#!/bin/python
from flask import Flask, jsonify, abort
from influxdb import InfluxDBClient
import json
from elasticsearch import Elasticsearch
app = Flask(__name__)
app.config.update(dict(
# DATABASE=os.path.join(app.root_path, 'flaskr.db'),
#SERVER_NAME = "livinglab2.powerprojects.se:8080"
SERVER_NAME =... | {
"repo_name": "Anton04/SolarDataRESTfulAPI",
"path": "influxDBSolarREST.py",
"copies": "1",
"size": "3637",
"license": "mit",
"hash": -8786154159321617000,
"line_mean": 20.5207100592,
"line_max": 85,
"alpha_frac": 0.5897717899,
"autogenerated": false,
"ratio": 3.4214487300094074,
"config_test":... |
#!/bin/python
from flask import Flask, jsonify, abort,request,Response
import InfluxDBInterface
import json
import IoTtoolkit
#from elasticsearch import Elasticsearch
from ElasticsearchInterface import ESinterface
import os, sys
import time
import pandas as pd
app = Flask(__name__)
app.config.update(dict(
# DATAB... | {
"repo_name": "Anton04/SolarDataRESTfulAPI",
"path": "SolarDataRESTapi.py",
"copies": "1",
"size": "16625",
"license": "mit",
"hash": 2958998395444360700,
"line_mean": 29.6169429098,
"line_max": 233,
"alpha_frac": 0.5438195489,
"autogenerated": false,
"ratio": 3.909005407947331,
"config_test": ... |
#!/bin/python
from flask import Flask, jsonify
import argparse
import time
app = Flask(__name__)
def last_log(file_path):
global header
global nelements
logline=list()
with open(file_path,'r') as fobj: #only care about the most recent value
for content in fobj:
#print content[:3]... | {
"repo_name": "danielporto/websensor",
"path": "appsensorServer.py",
"copies": "1",
"size": "3446",
"license": "apache-2.0",
"hash": -5429261136846138000,
"line_mean": 30.6146788991,
"line_max": 92,
"alpha_frac": 0.5800928613,
"autogenerated": false,
"ratio": 3.867564534231201,
"config_test": f... |
#!/bin/python
from __future__ import division
'''
This file provides an active learning environment for the demo interface.
Needs the file 'Topic.xlsx' as input.
Description of functionality
---
data model:
COMMENT KASPAR: I interpreted 'score' as the class of the noun phrase, i.e. 0 or 1.
datapoint = { str... | {
"repo_name": "ControCurator/controcurator",
"path": "python_code/endpoints.py",
"copies": "1",
"size": "9142",
"license": "mit",
"hash": -6319353579602595000,
"line_mean": 27.65830721,
"line_max": 148,
"alpha_frac": 0.6215270182,
"autogenerated": false,
"ratio": 3.74672131147541,
"config_test"... |
#!/bin/python
from __future__ import print_function, division
from pda.channel import Channel, DD
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from matplotlib.ticker import MultipleLocator
import numpy as np
import os
import datetime
import setupPlottingForL... | {
"repo_name": "JackKelly/pda",
"path": "scripts/plot_activity_histogram.py",
"copies": "1",
"size": "5464",
"license": "apache-2.0",
"hash": -377716045732882560,
"line_mean": 33.3647798742,
"line_max": 85,
"alpha_frac": 0.6131039531,
"autogenerated": false,
"ratio": 2.9695652173913043,
"config_... |
#!/bin/python
from __future__ import print_function, division
from pda.channel import Channel
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator, FuncFormatter
import os
import pda.setupPlottingForLaTeX as spfl
BAR_COLOR = 'gray'
DATA_DIR = '/data/mine/vadeec/merged/house1'
FIGURE_PATH = os.pat... | {
"repo_name": "JackKelly/pda",
"path": "scripts/on_durations.py",
"copies": "1",
"size": "2291",
"license": "apache-2.0",
"hash": 6691191512490697000,
"line_mean": 28.7532467532,
"line_max": 85,
"alpha_frac": 0.5739851593,
"autogenerated": false,
"ratio": 3.0505992010652463,
"config_test": fals... |
#!/bin/python
from __future__ import print_function, division
from pda.channel import Channel
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
import numpy as np
import os, datetime
import setupPlottingForLaTeX as spfl
NORMALISED_BAR_COLOR = 'gray'
UNNORMALISED_LINE_COLOR = 'k'
DATA_DIR = '/d... | {
"repo_name": "JackKelly/pda",
"path": "scripts/power_histograms.py",
"copies": "1",
"size": "4258",
"license": "apache-2.0",
"hash": 7387251452392760000,
"line_mean": 32.7936507937,
"line_max": 87,
"alpha_frac": 0.603100047,
"autogenerated": false,
"ratio": 3.0113154172560113,
"config_test": f... |
#!/bin/python
from __future__ import print_function, division
from pda.channel import Channel
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from matplotlib import animation
import numpy as np
import datetime
BIN_SIZE = 'H' # H (hourly) or T (minutely)
c = Channel('/data/mine/vadeec/jack-merged', ... | {
"repo_name": "JackKelly/pda",
"path": "scripts/animate_activity_histogram.py",
"copies": "1",
"size": "1779",
"license": "apache-2.0",
"hash": -5587513883675526000,
"line_mean": 28.65,
"line_max": 98,
"alpha_frac": 0.6852164137,
"autogenerated": false,
"ratio": 2.969949916527546,
"config_test"... |
#!/bin/python
from __future__ import print_function, division
import argparse
import hashlib
import os
import os.path
import sqlite3
import shogi
import json
# *_truth: true if it's confirmed by human
# state: {"empty", "up", "down"}
# type: {"empty", "FU", ..., "OU"}
#
# corners, config: JSON
#
# corners: 4 2D points... | {
"repo_name": "xanxys/shogi_recognizer",
"path": "manage_dataset.py",
"copies": "1",
"size": "4575",
"license": "mit",
"hash": 4273315214964175400,
"line_mean": 34.7421875,
"line_max": 95,
"alpha_frac": 0.5873224044,
"autogenerated": false,
"ratio": 3.9748045178105995,
"config_test": true,
"h... |
#!/bin/python
from __future__ import print_function, division
import cairo
import cv
import cv2
import argparse
import preprocess
import numpy as np
import math
class RecognizedBoard(object):
def __init__(self):
pass
def getPrecision(self):
"""
Return probability [0, 1] of result bein... | {
"repo_name": "xanxys/shogi_recognizer",
"path": "analyze.py",
"copies": "1",
"size": "4014",
"license": "mit",
"hash": -337171182511892030,
"line_mean": 26.875,
"line_max": 83,
"alpha_frac": 0.5874439462,
"autogenerated": false,
"ratio": 3.9008746355685133,
"config_test": false,
"has_no_keyw... |
#!/bin/python
from __future__ import print_function
import json
import tweepy
from secrets import *
test_json = "{\"business_id\": \"09FOOD-0323\", \"violations\": [{\"city\": \"Evanston\", \"code\": \"(36) FLOORS, WALLS AND CEILINGS: Floors; constructed, drained, clean, good repair, coving installation; dustless clea... | {
"repo_name": "technivore/evanston-violations",
"path": "tweet.py",
"copies": "1",
"size": "2308",
"license": "mit",
"hash": 4138015533370642400,
"line_mean": 35.6349206349,
"line_max": 740,
"alpha_frac": 0.6226169844,
"autogenerated": false,
"ratio": 3.1966759002770084,
"config_test": false,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.