text stringlengths 0 1.05M | meta dict |
|---|---|
"""
productporter.weixin.view
~~~~~~~~~~~~~~~~~
weixin backend blueprint
:copyright: (c) 2014 by the ProductPorter Team.
:license: BSD, see LICENSE for more details.
"""
import hashlib, time
import xml.etree.ElementTree as ET
from flask import Blueprint, request, current_app, redirect, url_for
f... | {
"repo_name": "kamidox/weixin_producthunt",
"path": "productporter/weixin/views.py",
"copies": "1",
"size": "8386",
"license": "bsd-2-clause",
"hash": -1779524433552893700,
"line_mean": 32.0157480315,
"line_max": 77,
"alpha_frac": 0.6106606249,
"autogenerated": false,
"ratio": 3.4368852459016392,... |
from optparse import OptionParser
import redis
from command import CommandParser
def main():
opts = cmd_opt_parse()
conn = redis.StrictRedis(opts.host, opts.port)
with open(opts.input) as f:
parser = CommandParser(f)
for cmd_detail, _ in parser:
cmd = cmd_detail[0].lower()... | {
"repo_name": "chosen0ne/redis-aof-modifier",
"path": "aof_redo.py",
"copies": "1",
"size": "1200",
"license": "apache-2.0",
"hash": -2380346142192883000,
"line_mean": 21.641509434,
"line_max": 71,
"alpha_frac": 0.555,
"autogenerated": false,
"ratio": 3.5714285714285716,
"config_test": false,
... |
#!/bin/env python
# -*- coding: utf-8 -*-
""" Script to ensure that events mentioning bills in their
titles are correctly linked to those bills.
"""
from pmg.models import Event, Bill, db
from pmg.search import Search
from sqlalchemy.orm import subqueryload
Search.reindex_changes = False
def fixbills():
fixed =... | {
"repo_name": "Code4SA/pmg-cms-2",
"path": "bin/link-hansard-bills.py",
"copies": "1",
"size": "1421",
"license": "apache-2.0",
"hash": 6095907676732733000,
"line_mean": 26.862745098,
"line_max": 117,
"alpha_frac": 0.5221674877,
"autogenerated": false,
"ratio": 3.6157760814249365,
"config_test"... |
#!/bin/env python
# -*- coding: utf-8 -*-
'''Sort sequences in different ways.'''
def reverse(l):
"""Reverse the order of elements in a list."""
new_list = []
for i in range(1, len(l) + 1):
new_list.append(l[-i])
return new_list
def sort(l):
"""Sort the items in a list in ascending orde... | {
"repo_name": "FullStackEmbedded/fse2016-python",
"path": "unit_tests/sort_utils/sort_sequences.py",
"copies": "1",
"size": "1455",
"license": "mit",
"hash": -6482945175452303000,
"line_mean": 25.4545454545,
"line_max": 76,
"alpha_frac": 0.5429553265,
"autogenerated": false,
"ratio": 3.2119205298... |
# The MIT License (MIT)
#
# Copyright (c) 2015 Alex Headley <aheadley@waysaboutstuff.com>
#
# 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 ... | {
"repo_name": "aheadley/python-nepugia",
"path": "nepugia/scripts/dump-item-locations.py",
"copies": "1",
"size": "5707",
"license": "mit",
"hash": 7448196356265476000,
"line_mean": 48.1982758621,
"line_max": 144,
"alpha_frac": 0.6013667426,
"autogenerated": false,
"ratio": 3.5141625615763545,
... |
#!/bin/env python
# -*- coding: utf-8 -*-
"""
This class is menat to read step configurations
for the different parameters related to the satelite.
the syntax of the step parameters should be like this
[Parameter Name]
Start Value = float / int
Step = float / int
End Value = float / int
...
...
...
This configuratio... | {
"repo_name": "pouyana/satgen",
"path": "config_step.py",
"copies": "1",
"size": "3573",
"license": "mit",
"hash": 3629714585306144300,
"line_mean": 28.2868852459,
"line_max": 88,
"alpha_frac": 0.5706689057,
"autogenerated": false,
"ratio": 4.125866050808314,
"config_test": true,
"has_no_keyw... |
#!/bin/env python
# -*- coding: utf-8 -*-
"""
This setup is loosely following the instructions adapted from
https://hynek.me/articles/sharing-your-labor-of-love-pypi-quick-and-dirty/
"""
import os
import re
from setuptools import setup
def read(fname):
"""
Utility function to read the README file.
Used f... | {
"repo_name": "Sisky/sdk",
"path": "bindings/python/setup.py",
"copies": "6",
"size": "3647",
"license": "bsd-2-clause",
"hash": -864611293662145200,
"line_mean": 32.1545454545,
"line_max": 83,
"alpha_frac": 0.5980257746,
"autogenerated": false,
"ratio": 3.7100712105798577,
"config_test": false... |
from optparse import OptionParser
from command import CommandParser
from utils import (fetch_cmd_patterns, match_and_filter_cmds, format_cmd_buf,
write_array)
def main():
opts = cmd_opt_parse()
multi_cmd_patterns, key_patterns = fetch_cmd_patterns(opts.pattern,
... | {
"repo_name": "chosen0ne/redis-aof-modifier",
"path": "aof_fetch.py",
"copies": "1",
"size": "3518",
"license": "apache-2.0",
"hash": 8771448102938889000,
"line_mean": 32.8269230769,
"line_max": 78,
"alpha_frac": 0.5591245026,
"autogenerated": false,
"ratio": 3.984144960362401,
"config_test": f... |
#!/bin/env python
# coding=utf-8
# подключение модуля PARCA
from parca import *
# алфавит
ALPH_A = u"аеёиоуыэюяi"
ALPH_B = u"бвгджзйклмнпрстфхцчшщьъ"
ALPH_S = " ,:!.?-;"
ALPHABET = ALPH_A+ALPH_B+ALPH_S
# создаем матрицу весов
matrix = dict()
for a in ALPHABET:
for b in ALPHABET:
if a==b:
# то... | {
"repo_name": "victor-yacovlev/parca",
"path": "test/native_language.py",
"copies": "1",
"size": "2065",
"license": "mit",
"hash": 6326922801346270000,
"line_mean": 25.5161290323,
"line_max": 49,
"alpha_frac": 0.5912408759,
"autogenerated": false,
"ratio": 2.037174721189591,
"config_test": fals... |
#!/bin/env python
# coding=utf-8
# подключение модуля PARCA
from parca import *
# последовательности в примере приведены
# из базы данных PREFAB-P:
# S1 - это 1e29A, S2 - 1ctj
S1 = "ELTESTRTIPLDEAGGTTTLTARQFTNGQKIFVDTCT" + \
"QCHLQGKTKTNNNVSLGLADLAGAEPRRDNVLALVEF" + \
"LKNPKSYDGEDDYSELHPNISRPDIYPEMRNYTEDDI... | {
"repo_name": "victor-yacovlev/parca",
"path": "test/simple_example.py",
"copies": "1",
"size": "1382",
"license": "mit",
"hash": 6474440641451692,
"line_mean": 25.7441860465,
"line_max": 48,
"alpha_frac": 0.6765217391,
"autogenerated": false,
"ratio": 1.9557823129251701,
"config_test": false,
... |
#!/bin/env python
# -*- coding: utf-8 -*-
#之前没写注释是因为是在Linux下做的,切不出想要的输入法(压根就没倒腾),我要Wine个Bing输入法
#导入模块
import re
#从文件读取信息,以列表形式返回
def read_file(filename):
l = []
with open(filename,'r') as fp:
for line in fp.readlines():
l.append(line.strip())
return l
#生成对应的正则匹配规则
def gen_pattern(l)... | {
"repo_name": "haiyangd/python-show-me-the-code-",
"path": "Jimmy66/0012/0012.py",
"copies": "34",
"size": "1374",
"license": "mit",
"hash": -7031893379869511000,
"line_mean": 21.1428571429,
"line_max": 101,
"alpha_frac": 0.6462365591,
"autogenerated": false,
"ratio": 1.5630252100840336,
"confi... |
#!/bin/env python
# -*- coding: utf-8 -*-
#使用Python3语法,实现一个将不引入第三方库实现XML-->JSON 思路的例子
#来自于:http://blog.csdn.net/laoyaotask/article/details/41384719
#使用 $python3 xml2json 执行该脚本,我也准备开始逐渐尝试用Python3的语法来写Python程序了,以前不知道命令行可以分别跑Python2和Python3
#默认还是建议设置为使用Python2,因为很多库和开源程序都是基于Python2的规范编写的
from xml.etree import ElementTr... | {
"repo_name": "ZSeaPeng/python",
"path": "Jimmy66/0017/xml2json.py",
"copies": "34",
"size": "1318",
"license": "mit",
"hash": 464404643623405900,
"line_mean": 31,
"line_max": 89,
"alpha_frac": 0.7540322581,
"autogenerated": false,
"ratio": 1.9113680154142583,
"config_test": false,
"has_no_ke... |
#!/bin/env python
# -*- coding: utf-8 -*-
#导入模块
import simplejson as json
import xlwt
#从文件(JSON形式)中读取数据返回列表
def read_file(filename):
with open(filename,'r') as fp:
content = fp.read()
l = json.JSONDecoder().decode(content)
return l
#生成对应的xls文件
def gen_xls(l,filename):
fp = xlwt.Workbook()... | {
"repo_name": "snailwalker/python",
"path": "Jimmy66/0016/0016.py",
"copies": "32",
"size": "1055",
"license": "mit",
"hash": -5571940602609890000,
"line_mean": 22.8529411765,
"line_max": 119,
"alpha_frac": 0.6411837238,
"autogenerated": false,
"ratio": 2.0024691358024693,
"config_test": false,... |
#!/bin/env python
# -*- coding: utf-8 -*-
#导入模块
import simplejson as json
import xlwt
#从文件(JSON形式)中读取数据返回字典
def read_file(filename):
with open(filename,'r') as fp:
content = fp.read()
#simplejson这个模块还没细看,怎么解码还是需要了解下
d = json.JSONDecoder().decode(content)
return d
#生成对应的xls文件
def gen_xls(... | {
"repo_name": "sravaniaitha/python",
"path": "Jimmy66/0014/0014.py",
"copies": "34",
"size": "1557",
"license": "mit",
"hash": 2827507443576658000,
"line_mean": 25.7948717949,
"line_max": 98,
"alpha_frac": 0.6507177033,
"autogenerated": false,
"ratio": 1.5761689291101055,
"config_test": false,
... |
#!/bin/env python
# -*- coding: utf-8 -*-
#导入模块
import urllib2
import re
import os
import glob
#设定抓取页数
page_amount = 2
#抓取首页的html代码
def get_page(url):
req = urllib2.Request(url)
req.add_header('User-Agent','Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.1... | {
"repo_name": "zhakui/python",
"path": "Jimmy66/0013/girls_pictures.py",
"copies": "34",
"size": "2288",
"license": "mit",
"hash": 3805811636852681000,
"line_mean": 24.7368421053,
"line_max": 168,
"alpha_frac": 0.6666666667,
"autogenerated": false,
"ratio": 2.0248447204968945,
"config_test": fa... |
#!/bin/env python
# -*- coding: utf-8 -*-
#导入模块
import xlrd
import xml.etree.ElementTree as ET
from xml.dom import minidom
def read_xls(filename):
data = xlrd.open_workbook(filename)
table = data.sheet_by_index(0) #通过索引获取xls文件第0个sheet
nrows = table.nrows
l = []
for i in range(nrows):
... | {
"repo_name": "snailwalker/python",
"path": "Jimmy66/0019/0019.py",
"copies": "34",
"size": "1069",
"license": "mit",
"hash": -7283806228920338000,
"line_mean": 21.6428571429,
"line_max": 62,
"alpha_frac": 0.6361724501,
"autogenerated": false,
"ratio": 2.6416666666666666,
"config_test": false,
... |
#!/bin/env python
# -*- coding: utf-8 -*-
#要填json坑,前面写的代码,json部分是网上找的,还没有完全理解,尤其是相关的字符串编码没有实践
#抽空了解下从xls文件读取数据的库
#xls -> json -> xml 是我的思路,当然也可以尝试下直接xls -> xml
#主要还是比较看重json的应用。有时候感觉看了别人的代码,不自己用另一种方式实现,(即使变得复杂啰嗦)还是别人的代码
#导入模块
import xlrd
#这个是系统自带的,如果安装lxml遇到问题可以使用这个
import xml.etree.ElementTree as ET
from xml.dom im... | {
"repo_name": "xchaoinfo/python",
"path": "Jimmy66/0017/0017.py",
"copies": "34",
"size": "1660",
"license": "mit",
"hash": -3488253812957303000,
"line_mean": 24.0612244898,
"line_max": 85,
"alpha_frac": 0.6490228013,
"autogenerated": false,
"ratio": 1.8691019786910197,
"config_test": false,
... |
#!/bin/env python
#coding:utf-8
'''
这是一个IP工具包,包含一些用于IP计算工具。
可以方便地实现IP地址的各种转换要求。
'''
import socket,struct
'''
@ip_start IP起始地址
@ip_end IP结束地址
@return ['192.168.1.1', '192.168.1.2'] 包含在IP起始地址和结束地址之间的所有IP地址的列表
'''
def ip_list(ip_start, ip_end):
res = []
ip_start_n = 0
ip_end_n = 0
try:
ip_st... | {
"repo_name": "KSStudyGroup/iputils",
"path": "iputils.py",
"copies": "1",
"size": "3065",
"license": "apache-2.0",
"hash": -3582697743140179000,
"line_mean": 22.9224137931,
"line_max": 84,
"alpha_frac": 0.5545945946,
"autogenerated": false,
"ratio": 2.3617021276595747,
"config_test": false,
... |
#!/bin/env python
# coding:utf-8
# 配置日志信息
import logging
def init(fname = 'log.log'):
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(name)-40s %(levelname)-8s %(message)s',
datefmt='%m-%d %H:%M',
filename=fname,
... | {
"repo_name": "xtuyaowu/jtyd_python_spider",
"path": "dispatch/jd_seckill/class_logger.py",
"copies": "1",
"size": "1074",
"license": "mit",
"hash": 8582165108460070000,
"line_mean": 34.5714285714,
"line_max": 93,
"alpha_frac": 0.6495983936,
"autogenerated": false,
"ratio": 3.410958904109589,
"... |
#!/bin/env python
# -*- coding: utf-8 -*-
"""
需要单独安装的库tqdm, fake_useragent, requests
在html.txt文件中,每个链接一行,运行本程序,下载或者保存相关archive.org网页到/html文件夹下
运行日志保存到down_archive.log, 未下载的文件保存到bad_html.log
https://web.archive.org/web/20060512133352if_/http://www.para2000.org:80/base/overlib.js 要求每一行都是真实地址,
特别是js文件,jpg文件
"""
__author... | {
"repo_name": "xinyu3ru/rublog",
"path": "download_archive.py",
"copies": "1",
"size": "6718",
"license": "apache-2.0",
"hash": -9059486066270897000,
"line_mean": 35.0225988701,
"line_max": 113,
"alpha_frac": 0.4960790464,
"autogenerated": false,
"ratio": 3.3019161056447435,
"config_test": fals... |
#!/bin/env python
# -*- coding: utf-8 -*-
"""
需要单独安装的库tqdm, fake_useragent, requests
在wechat.txt文件中,每个链接一行(需用保存的页面链接需手动搜集,调试中使用的是sogou朋友圈搜索结果
注意,腾.讯的链接是有实效的),
运行本程序,下载或者保存相关公众号网页到/wechat文件夹下
运行日志保存到down_wechat.log, 未下载的文件保存到bad_wechat.log
要求每一行都是真实地址
"""
__author__ = 'rublog'
import logging
import requests
import os
... | {
"repo_name": "xinyu3ru/rublog",
"path": "download_wechat.py",
"copies": "1",
"size": "7063",
"license": "apache-2.0",
"hash": 394432089773153700,
"line_mean": 34.8870967742,
"line_max": 126,
"alpha_frac": 0.5173033708,
"autogenerated": false,
"ratio": 3.1003251277287505,
"config_test": false,
... |
#!/bin/env python
# -*- coding: utf-8 -*-
"""
需要单独安装的库tqdm, requests
跟踪 https://www.appcgn.com/high-mark-hd-movies 电影更新来下载电影,网页更新很慢,2个月一两部的样子
网页有密码,需要提供密码访问真实页面
根据提供的链接类型,调用aria2或者本机的迅雷下载(建议先设置迅雷静默下载)
"""
__author__ = 'rublog'
import logging
import requests
import os
import re
import json
import base64
from tqdm impo... | {
"repo_name": "xinyu3ru/rublog",
"path": "download_movie/download_movie.py",
"copies": "1",
"size": "4743",
"license": "apache-2.0",
"hash": 7238353410475528000,
"line_mean": 30.2323943662,
"line_max": 113,
"alpha_frac": 0.582638106,
"autogenerated": false,
"ratio": 2.923533289386948,
"config_t... |
#!/bin/env python
# -*- coding: utf-8 -*-
'''URL query string manipulation template tags for django template engine'''
import os
from setuptools import setup
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-query-transfo... | {
"repo_name": "ITrex/django-query-transform",
"path": "setup.py",
"copies": "1",
"size": "1074",
"license": "mit",
"hash": 7324080238973188000,
"line_mean": 28.8333333333,
"line_max": 79,
"alpha_frac": 0.6331471136,
"autogenerated": false,
"ratio": 3.891304347826087,
"config_test": false,
"ha... |
#!/bin/env python
# -*- coding: utf-8 -*-
'''Use all utilities in the other modules in this package.'''
import file_diagnostics as diagnostics
import sort_sequences
from print_file_contents import (choose_file, print_file, print_upper_case,
file_backwards)
def print_file_diagnostics... | {
"repo_name": "FullStackEmbedded/fse2016-python",
"path": "unit_tests/sort_utils/use_modules.py",
"copies": "1",
"size": "1843",
"license": "mit",
"hash": 218148605976347300,
"line_mean": 33.1296296296,
"line_max": 75,
"alpha_frac": 0.6190992946,
"autogenerated": false,
"ratio": 3.997830802603037... |
import logging
ENDLINE = '\r\n'
logger = logging.getLogger('root')
logger.setLevel(logging.INFO)
class CommandParser(object):
def __init__(self, f):
self._f = f
self._lineno = 0
self._cmd_buf = None
def __iter__(self):
while True:
cmd = self._parse()
... | {
"repo_name": "chosen0ne/redis-aof-modifier",
"path": "command.py",
"copies": "1",
"size": "2790",
"license": "apache-2.0",
"hash": 5604920981886181000,
"line_mean": 25.5714285714,
"line_max": 77,
"alpha_frac": 0.4949820789,
"autogenerated": false,
"ratio": 3.801089918256131,
"config_test": fal... |
#! /bin/env python
# -*- coding: utf-8 -*-
# Use when Calisphere Object URLs for a collection change, to generate
# a redirect file mapping 'old' (on SOLR-PROD) to 'new' (on SOLR-TEST) URLs.
#
# This script takes a Collection ID and a 'match' field in SOLR (i.e. best
# field to use for matching SOLR-PROD record to cor... | {
"repo_name": "ucldc/harvester",
"path": "scripts/external-redirect-get-solr_prod-id.py",
"copies": "1",
"size": "4313",
"license": "bsd-3-clause",
"hash": 7547076333822371000,
"line_mean": 45.8695652174,
"line_max": 122,
"alpha_frac": 0.7094155844,
"autogenerated": false,
"ratio": 3.85,
"confi... |
#!/bin/env python
# -*- coding: utf-8 -*-
"""
Voronoi analysis based on Delauney tetrahedra.
USAGE:
$ python ./voronoi.py [options] POSCAR
INPUT: (these files must be in the working directory)
- POSCAR (for the cell information)
"""
from __future__ import print_function
import os,optparse
from atom_system im... | {
"repo_name": "ryokbys/nap",
"path": "nappy/vasp/voronoi.py",
"copies": "1",
"size": "1200",
"license": "mit",
"hash": 8140016855213249000,
"line_mean": 24,
"line_max": 72,
"alpha_frac": 0.5741666667,
"autogenerated": false,
"ratio": 3.3994334277620397,
"config_test": false,
"has_no_keywords"... |
#! /bin/env python
# -*- coding: utf-8 -*-
# We've had a couple of cases where the pre-prodution index has had a
# collection deleted for re-harvesting but the re-harvest has not been
# successful and we want to publish a new image.
# This script will take the documents from one solr index and push them to
# another s... | {
"repo_name": "mredar/harvester",
"path": "scripts/sync_solr_documents.py",
"copies": "3",
"size": "5945",
"license": "bsd-3-clause",
"hash": -7218018755169129000,
"line_mean": 41.1560283688,
"line_max": 78,
"alpha_frac": 0.6598250336,
"autogenerated": false,
"ratio": 3.7908163265306123,
"confi... |
"""
| This file is part of the web2py Web Framework
| Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
| License: BSD
| Thanks to ga2arch for help with IS_IN_DB and IS_NOT_IN_DB on GAE
Validators
-----------
"""
import os
import re
import math
import datetime
import time
import cgi
import uuid
import hashli... | {
"repo_name": "willimoa/pydal",
"path": "pydal/validators.py",
"copies": "1",
"size": "158796",
"license": "bsd-3-clause",
"hash": 7906814975472248000,
"line_mean": 27.829157589,
"line_max": 264,
"alpha_frac": 0.5261507264,
"autogenerated": false,
"ratio": 3.564972385613578,
"config_test": fals... |
import json
import urllib
__author__ = "Michal Cab <xcabmi00@stud.fit.vutbr.cz>"
class FreebaseEntity:
def __init__(self, _freebase_id, _name, _alias, _description, _image, _wikipedia_url):
self.freebase_id = _freebase_id
self.name = _name
self.alias = _alias
self.description = _description
sel... | {
"repo_name": "MichalCab/freebase",
"path": "src/data_model.py",
"copies": "1",
"size": "8932",
"license": "apache-2.0",
"hash": -1067558822241412500,
"line_mean": 68.78125,
"line_max": 731,
"alpha_frac": 0.6328929691,
"autogenerated": false,
"ratio": 2.8132283464566927,
"config_test": false,
... |
#!/bin/env python
# -*- coding: utf-8 -*-
""" run a batch of PDF generation
keeps an amazon simple DB with an inventory of EAD files and last
modified dates, this persists between runs
check_url is a recursive modifier function (with side effects) that is
a web crawler that adds all the new EAD to an array `files_to_... | {
"repo_name": "tingletech/pdfu",
"path": "run_nightly_batch.py",
"copies": "1",
"size": "18622",
"license": "bsd-3-clause",
"hash": -3862591913853195300,
"line_mean": 35.0077369439,
"line_max": 162,
"alpha_frac": 0.6419209282,
"autogenerated": false,
"ratio": 3.8462809917355374,
"config_test": ... |
#!/bin/env python
# -*- coding: utf-8 -*-
#SBATCH -J fitpot-GA # job name
#SBATCH -A HatD2 # project name
#SBATCH -N 32 # number of nodes
#SBATCH -n 512 # number of tasks
#SBATCH -o out.%j # stdout filename (%j is jobid)
#SBATCH -e err.%j # stdout filename (%j is jobid)
#SBATCH... | {
"repo_name": "ryokbys/nap",
"path": "fitpot/util/helios/batch-fitpot-helios.py",
"copies": "1",
"size": "3401",
"license": "mit",
"hash": 5425452626236829000,
"line_mean": 31.7019230769,
"line_max": 82,
"alpha_frac": 0.5477800647,
"autogenerated": false,
"ratio": 3.058453237410072,
"config_tes... |
#!/bin/env python
# -*- coding: utf-8 -*-
# simple parser of NEXUS annotated trees
import sys
import os
import re
def label_clades(node):
clade_dict = {}
def _label_clades_main(node):
label_list = []
for cnode in node.children:
label_list += _label_clades_main(cnode)
label_l... | {
"repo_name": "murawaki/comp-typology",
"path": "scripts/glottolog/newick_tree.py",
"copies": "1",
"size": "5068",
"license": "bsd-3-clause",
"hash": 5874690186436106000,
"line_mean": 31.6967741935,
"line_max": 100,
"alpha_frac": 0.4449486977,
"autogenerated": false,
"ratio": 3.9409020217729394,
... |
#!/bin/env python
# -*- coding: utf-8 -*-
# simple parser of NEXUS annotated trees
import sys
import os
import re
from nexus import NexusReader
def label_clades(node):
clade_dict = {}
def _label_clades_main(node):
if hasattr(node, "left"):
label_list = _label_clades_main(node.left) + _labe... | {
"repo_name": "murawaki/lexwave",
"path": "parse_tree.py",
"copies": "1",
"size": "4293",
"license": "bsd-2-clause",
"hash": -4042324514668662000,
"line_mean": 31.0373134328,
"line_max": 100,
"alpha_frac": 0.4602841836,
"autogenerated": false,
"ratio": 3.916970802919708,
"config_test": false,
... |
#!/bin/env python
# -*- coding: utf-8 -*-
"""The setup script for ``django_mysqlpool``."""
# These imports make 2 act like 3, making it easier on us to switch to PyPy or
# some other VM if we need to for performance reasons.
from __future__ import (absolute_import, print_function, unicode_literals,
... | {
"repo_name": "smartfile/django-mysqlpool",
"path": "setup.py",
"copies": "1",
"size": "2457",
"license": "mit",
"hash": -8048298926491281000,
"line_mean": 30.9090909091,
"line_max": 98,
"alpha_frac": 0.6096866097,
"autogenerated": false,
"ratio": 3.9693053311793216,
"config_test": false,
"ha... |
"""从某网站下载了一批文档,但是文件是用数字串命名的文档(很多图书馆都这样吧),
也有文档列表,所以写了一个脚本来重命名批文件
"""
__author__ = 'rublog'
import os
#1.txt文档要求每个文档一行,保存的时候必须为ANSI格式,前面是列表文档名含后缀(就是网站上文件名,一串数字
#或者字母什么的),空一格,然后是文档的真名(不带后缀)
#get_list这个从1.txt文本文件中一行一行的读取文件,去掉换行符,然后调用doc_rename
#函数
def get_list():
#尝试不同的编码来自知乎 十五
#https://www.zhihu.com/question/3... | {
"repo_name": "xinyu3ru/rename_files_in_txt_list_with_python_and_bat",
"path": "python/rename_document.py",
"copies": "1",
"size": "2225",
"license": "apache-2.0",
"hash": -1648904371633108000,
"line_mean": 30.0181818182,
"line_max": 77,
"alpha_frac": 0.5636363636,
"autogenerated": false,
"ratio"... |
#!/bin/env python
#coding:utf8
'''将nginx的log分析出访问topn个,将内容展示为html,用flask展示。
本文件作为模块import到flask_test.py中'''
n=7 #定义top前多少
src_file="www_access_20140823.log"
dst_file='top%d_access_def.log' % n
web_file_default="top10.html_default"
site_title='访问量TOP%d' % n
def topn(src_file,dst_file,n=10):
'''取得topn数据,并写入到文件'''... | {
"repo_name": "51reboot/actual_09_homework",
"path": "03/zhouyang/ngin_log_v3.py",
"copies": "1",
"size": "1832",
"license": "mit",
"hash": -3192008296061820400,
"line_mean": 29.3148148148,
"line_max": 184,
"alpha_frac": 0.6094132029,
"autogenerated": false,
"ratio": 2.219810040705563,
"config_... |
#!/bin/env python
#coding:utf8
'''将nginx的log分析出访问topn个,生成一个新文件和html文件'''
n=7 #定义top前多少
src_file="www_access_20140823.log"
dst_file='top%d_access_def.log' % n
web_file_default="top10.html_default"
web_file="top%d_access_def.html"% n
site_title='访问量TOP%d' % n
def topn(src_file,dst_file,n=10):
'''取得topn数据,并写入到文件'... | {
"repo_name": "51reboot/actual_09_homework",
"path": "03/zhouyang/nginx_log_v2.py",
"copies": "1",
"size": "1812",
"license": "mit",
"hash": 636888671934776600,
"line_mean": 28.25,
"line_max": 184,
"alpha_frac": 0.6092796093,
"autogenerated": false,
"ratio": 2.237704918032787,
"config_test": fa... |
#!/bin/env python
# coding: utf-8
# vim:et:sta:sw=2:sts=2:ts=2:tw=0:
from __future__ import division, print_function, absolute_import
from setuptools import setup
import os
import codecs
import re
MODULE_NAME = 'pyreadpartitions'
def read(*paths):
"""Build a file path from *paths* and return the contents."""
w... | {
"repo_name": "florentcigolotti/pyreadpartitions",
"path": "setup.py",
"copies": "1",
"size": "2613",
"license": "mit",
"hash": -5003215491452455000,
"line_mean": 34.3108108108,
"line_max": 128,
"alpha_frac": 0.6398775354,
"autogenerated": false,
"ratio": 3.270337922403004,
"config_test": false... |
#!/bin/env python
# coding:utf-8
# vim:ts=4:enc=utf-8
"""
Simple batch file processing module
Format of batch file:
- A # is a comment delimiter, ignore everything on the line.
- Anything else is command to run - no line continuations!
You can basically just use a list of commands understood
by ... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/496897_Running_Batch_Commands/recipe-496897.py",
"copies": "1",
"size": "4414",
"license": "mit",
"hash": -8838700831117358000,
"line_mean": 27.8496732026,
"line_max": 64,
"alpha_frac": 0.5006796556,
"autogenerated": false,
"ratio": 3.6419... |
__author__ = 'Ken Zheng'
import logging
import hashlib
import time
import xml.etree.ElementTree as ET
from models import operatorDB
FILTER_WORD_LIST=[u"大纪元",]
#接入和消息推送都需要做校验
def verification(request):
signature = request.args.get('signature')
timestamp = request.args.get('timestamp')
nonce = request.args... | {
"repo_name": "catsky/rebang",
"path": "1/chartnet/view/weixin.py",
"copies": "1",
"size": "4326",
"license": "mit",
"hash": 806661669537904100,
"line_mean": 23.6829268293,
"line_max": 87,
"alpha_frac": 0.623270751,
"autogenerated": false,
"ratio": 2.6790205162144276,
"config_test": false,
"h... |
#!/bin/env python
# -*- coding: utf-8 -*-
'''Write some example functions.'''
def my_function():
"""This is a docstring!"""
pass
def reverse(l):
"""Reverse the order of elements in a list."""
new_list = []
for i in range(1, len(l) + 1):
new_list.append(l[-i])
return new_list
def so... | {
"repo_name": "FullStackEmbedded/fse2016-python",
"path": "unit_tests/sort_functions_with_assertion_tests.py",
"copies": "1",
"size": "1509",
"license": "mit",
"hash": 6459314915107339000,
"line_mean": 24.5762711864,
"line_max": 77,
"alpha_frac": 0.5434062293,
"autogenerated": false,
"ratio": 3.2... |
#!/bin/env python
# -*- coding: utf-8 -*- vim: set ts=4 et sw=4 fdm=indent :
import os, sys
try:
import simplejson
except ImportError:
sys.stderr.write('Unable to load simplejson python module.')
sys.exit(1)
class MCollectiveActionNoEnv(Exception):
pass
class MCollectiveActionFileError(Exception):
... | {
"repo_name": "jessereynolds/marionette-collective",
"path": "ext/action_helpers/python/romke/mcollectiveah.py",
"copies": "17",
"size": "2312",
"license": "apache-2.0",
"hash": 1445652157667345000,
"line_mean": 32.5072463768,
"line_max": 110,
"alpha_frac": 0.6085640138,
"autogenerated": false,
"... |
#! /bin/env python
""" Command line for 'service.py'
"""
import argparse
import logging
import sys
from .linux_service import LinuxService, LinuxServiceException, DEFAULT_ROOT_USER
from .process_logs import RE_DEFAULT_LOG_NAME_FILTER
###############################################################################
# ... | {
"repo_name": "gluent/gluent-eng",
"path": "gluent_eng/command_line_service.py",
"copies": "1",
"size": "3353",
"license": "apache-2.0",
"hash": 7326443875080861000,
"line_mean": 29.2072072072,
"line_max": 126,
"alpha_frac": 0.5663584849,
"autogenerated": false,
"ratio": 4.201754385964913,
"con... |
#!/bin/env python
"""Command Line Interface module
"""
import argparse, sys, os, logging, inspect, types
__version__ = 1, 0, 0
# Used in leu of more specific object insteald of None
_marker = object()
class CLIInterfaceMixin(object):
"""This class is a Mix-in class for exposing a command-line interface to a
pyt... | {
"repo_name": "andrewegel/python-cliinterface",
"path": "cliinterface/__init__.py",
"copies": "1",
"size": "11855",
"license": "apache-2.0",
"hash": -7736190320123363000,
"line_mean": 41.4910394265,
"line_max": 125,
"alpha_frac": 0.6151834669,
"autogenerated": false,
"ratio": 4.220363118547525,
... |
#!/bin/env python
"""Convert RTG coverage statistics into a BED file of callable regions.
Provides a supplement to VCF files indicating callable regions where
a no-call indicates reference.
Defaults to requiring more than 4 reads of coverage to be callable.
"""
import sys
import gzip
def main(cov_file):
min_cov ... | {
"repo_name": "biocyberman/bcbio-nextgen",
"path": "scripts/utils/rtg_to_callable.py",
"copies": "6",
"size": "1330",
"license": "mit",
"hash": -4411021803702102000,
"line_mean": 39.303030303,
"line_max": 98,
"alpha_frac": 0.5187969925,
"autogenerated": false,
"ratio": 3.8439306358381504,
"conf... |
"""Utility to convert ReST markup to XML for xml2rfc
Command-line utility that takes a single ReST file
and converts it into XML suitable for processing
by xml2rfc.
"""
try:
import locale
locale.setlocale(locale.LC_ALL, '')
except:
pass
import docutils
import os
import os.path
import re
import sys
import time... | {
"repo_name": "scrosby/fedone",
"path": "spec/rst2rfc.py",
"copies": "1",
"size": "19900",
"license": "apache-2.0",
"hash": 166660285617360960,
"line_mean": 23.0048250905,
"line_max": 105,
"alpha_frac": 0.6374371859,
"autogenerated": false,
"ratio": 3.4900035075412137,
"config_test": false,
"... |
"""An LL(1) lexer. This lexer is very tolerant of errors and can resync."""
import logging
import re
import utils
class Token(object):
"""A token action."""
state_regex = None
def __init__(self, state_regex, regex, actions, next_state, flags=re.I):
"""Constructor.
Args:
state_regex: If this ... | {
"repo_name": "google/objectfilter",
"path": "objectfilter/lexer.py",
"copies": "1",
"size": "14047",
"license": "apache-2.0",
"hash": -5163163059993322000,
"line_mean": 27.9628865979,
"line_max": 80,
"alpha_frac": 0.625471631,
"autogenerated": false,
"ratio": 3.8140103176758076,
"config_test":... |
"""Classes to perform filtering of objects based on their data members.
Given a list of objects and a textual filter expression, these classes allow
you to determine which objects match the filter. The system has two main
pieces: A parser for the supported grammar and a filter implementation.
Given any complying use... | {
"repo_name": "google/objectfilter",
"path": "objectfilter/objectfilter.py",
"copies": "1",
"size": "28873",
"license": "apache-2.0",
"hash": 4571493441872354300,
"line_mean": 31.9600456621,
"line_max": 80,
"alpha_frac": 0.6631454993,
"autogenerated": false,
"ratio": 3.9325796785616998,
"config... |
from setuptools import setup
import binplist
setup(name="binplist",
version=binplist.__version__,
description="A binary plist parser",
author="Jordi Sanchez",
author_email=binplist.__feedback_email__,
url="http://code.google.com/p/binplist",
license="Apache Software License",
... | {
"repo_name": "JD86/binplist",
"path": "setup.py",
"copies": "3",
"size": "1065",
"license": "apache-2.0",
"hash": 3339581418639728600,
"line_mean": 32.28125,
"line_max": 74,
"alpha_frac": 0.7051643192,
"autogenerated": false,
"ratio": 4.080459770114943,
"config_test": false,
"has_no_keywords... |
import argparse
import logging
import plistlib
import sys
from binplist import binplist
parser = argparse.ArgumentParser(description="A forensic plist parser.")
parser.add_argument(
"plist", default=None, action="store",
help="plist file to be parsed")
parser.add_argument(
"-V", "--version", action="version",... | {
"repo_name": "surkin/binplist",
"path": "scripts/plist.py",
"copies": "3",
"size": "3344",
"license": "apache-2.0",
"hash": -7710908878447347000,
"line_mean": 39.7804878049,
"line_max": 79,
"alpha_frac": 0.6363636364,
"autogenerated": false,
"ratio": 4.238276299112801,
"config_test": false,
... |
"""Tests for objectfilter.objectfilter."""
import logging
import unittest
from objectfilter import objectfilter
attr1 = "Backup"
attr2 = "Archive"
hash1 = "123abc"
hash2 = "456def"
filename = "yay.exe"
class DummyObject(object):
def __init__(self, key, value):
setattr(self, key, value)
class HashObject(... | {
"repo_name": "google/objectfilter",
"path": "tests/objectfilter_test.py",
"copies": "1",
"size": "21043",
"license": "apache-2.0",
"hash": 6998947709844769000,
"line_mean": 33.7260726073,
"line_max": 79,
"alpha_frac": 0.6179727225,
"autogenerated": false,
"ratio": 3.7697957721246866,
"config_t... |
'''
This script triggers taskcluster tasks to scrape symbols out of Apple
system updates and upload them to crash-stats.mozilla.com.
'''
from __future__ import print_function
import datetime
import json
import os
import taskcluster
import requests.packages.urllib3
requests.packages.urllib3.disable_warnings()
def l... | {
"repo_name": "luser/breakpad-mac-update-symbols",
"path": "run-taskcluster.py",
"copies": "1",
"size": "3038",
"license": "mit",
"hash": -2738066892143450600,
"line_mean": 28.4951456311,
"line_max": 82,
"alpha_frac": 0.6579986833,
"autogenerated": false,
"ratio": 3.4839449541284404,
"config_te... |
"""
Utility to download files with common extensions from the Internet
"""
import argparse
import os
from urllib.request import urlopen
def download(url):
print('GET: {}'.format(url))
resp = urlopen(url)
return resp.read()
def zerofill(tstr, n):
l = len(tstr)
for _ in range(n - l):
ts... | {
"repo_name": "simonorono/pyutils",
"path": "ptd.py",
"copies": "1",
"size": "2205",
"license": "apache-2.0",
"hash": 998991345828494300,
"line_mean": 28.7702702703,
"line_max": 74,
"alpha_frac": 0.6155242851,
"autogenerated": false,
"ratio": 3.811418685121107,
"config_test": false,
"has_no_k... |
import re
old_pattern = re.compile(r'%\w')
new_pattern = re.compile(r'\{(\w+(\.\w+|\[\w+\])?)\}')
__formaters = {}
def format(text, *a, **kw):
f = __formaters.get(text)
if f is None:
f = formater(text)
__formaters[text] = f
return f(*a, **kw)
#return formater(text)(*a, **kw)
def f... | {
"repo_name": "open-falcon/dashboard",
"path": "rrd/utils/format.py",
"copies": "1",
"size": "2549",
"license": "apache-2.0",
"hash": 8859998501984580000,
"line_mean": 29.7108433735,
"line_max": 74,
"alpha_frac": 0.5213809337,
"autogenerated": false,
"ratio": 3.2103274559193955,
"config_test": ... |
from nmigen import *
from nmigen_cfu import InstructionBase, InstructionTestBase, Cfu, CfuTestBase
import unittest
# See proj_example for further example instructions
class TemplateInstruction(InstructionBase):
"""Template instruction
"""
def elab(self, m):
with m.If(self.start):
m.d.... | {
"repo_name": "google/CFU-Playground",
"path": "proj/tail_rom/cfu.py",
"copies": "2",
"size": "1719",
"license": "apache-2.0",
"hash": 3426023190231998000,
"line_mean": 25.4461538462,
"line_max": 77,
"alpha_frac": 0.6323443863,
"autogenerated": false,
"ratio": 3.7863436123348015,
"config_test":... |
from nmigen import *
from nmigen_cfu import InstructionBase, InstructionTestBase, Cfu, CfuTestBase
import unittest
class FibInstruction(InstructionBase):
"""Sample fibonacci instrucion
This implementation uses a state machine."""
def elab(self, m):
s1 = Signal(32)
s2 = Signal(32)
... | {
"repo_name": "google/CFU-Playground",
"path": "proj/example_cfu/cfu.py",
"copies": "1",
"size": "6247",
"license": "apache-2.0",
"hash": 6727180612264144000,
"line_mean": 27.1396396396,
"line_max": 78,
"alpha_frac": 0.5159276453,
"autogenerated": false,
"ratio": 3.5373725934314835,
"config_tes... |
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
train_df = pd.read_csv("./GiveMeSomeCredit/cs-training.csv", index_col=0)
train_df.MonthlyIncome.fillna(train_df.MonthlyIncome.median(), inplace=True)
train_df.NumberOfDependents.fillna(train_df.NumberOfDependents.median(),
... | {
"repo_name": "sql-machine-learning/sqlflow",
"path": "doc/tutorial/scripts/give_me_some_credit.py",
"copies": "1",
"size": "1088",
"license": "apache-2.0",
"hash": -4946891298227219000,
"line_mean": 44.3333333333,
"line_max": 76,
"alpha_frac": 0.7251838235,
"autogenerated": false,
"ratio": 3.476... |
# Delayer temporarily moved out of the sequencing module to break a circular dependency
from nmigen import Signal
from nmigen_cfu import SimpleElaboratable
class Delayer(SimpleElaboratable):
"""Delays an input Signal via a shift register.
Parameters
----------
cycles: int
Number of cycles ... | {
"repo_name": "google/CFU-Playground",
"path": "proj/mnv2_first/gateware/delay.py",
"copies": "1",
"size": "1484",
"license": "apache-2.0",
"hash": -5276206017950769000,
"line_mean": 28.68,
"line_max": 87,
"alpha_frac": 0.6664420485,
"autogenerated": false,
"ratio": 4.054644808743169,
"config_t... |
# Depth of an EBRAM in 32 bit words
EBRAM_DEPTH_WORDS = 512
# Output channel parameters
OUTPUT_CHANNEL_PARAM_DEPTH = EBRAM_DEPTH_WORDS
# Output FIFO depth
OUTPUT_QUEUE_DEPTH = EBRAM_DEPTH_WORDS
# This is the depth of each EBRAM that makes up the filter data memory
FILTER_DATA_MEM_DEPTH = EBRAM_DEPTH_WORDS
FILTER_DA... | {
"repo_name": "google/CFU-Playground",
"path": "proj/mnv2_first/gateware/config.py",
"copies": "1",
"size": "1069",
"license": "apache-2.0",
"hash": -354065045804388100,
"line_mean": 34.6666666667,
"line_max": 74,
"alpha_frac": 0.7614593078,
"autogenerated": false,
"ratio": 3.5397350993377485,
... |
from nmigen import Array, Signal, Mux, Cat
from nmigen_cfu import SimpleElaboratable, is_pysim_run
from util import DualPortMemory, SequentialMemoryReader
from .registerfile import Xetter
class StoreSetter(Xetter):
"""Stores in0 into a Store.
Parameters
----------
bits_width:
bits in each ... | {
"repo_name": "google/CFU-Playground",
"path": "proj/mnv2_first/gateware/store.py",
"copies": "1",
"size": "16155",
"license": "apache-2.0",
"hash": 2811233992497237500,
"line_mean": 32.4472049689,
"line_max": 95,
"alpha_frac": 0.5460229031,
"autogenerated": false,
"ratio": 3.644258966839612,
"... |
from nmigen import Cat, Signal, signed
from nmigen_cfu import all_words, SimpleElaboratable, tree_sum
from .delay import Delayer
from .post_process import PostProcessor
from .registerfile import Xetter
class Madd4Pipeline(SimpleElaboratable):
"""A 4-wide Multiply Add pipeline.
Pipeline takes 2 additional ... | {
"repo_name": "google/CFU-Playground",
"path": "proj/mnv2_first/gateware/macc.py",
"copies": "1",
"size": "4215",
"license": "apache-2.0",
"hash": 3180989491496051700,
"line_mean": 30.2222222222,
"line_max": 80,
"alpha_frac": 0.6042704626,
"autogenerated": false,
"ratio": 3.655680832610581,
"co... |
from nmigen import Mux, Signal, signed
from nmigen_cfu import SimpleElaboratable
from .delay import Delayer
from .registerfile import Xetter
INT32_MIN = 0x8000_0000
INT32_MAX = 0x7fff_ffff
class SRDHM(SimpleElaboratable):
"""Implements gemmlowp::SaturatingRoundingDoublingHighMul
The function calculated i... | {
"repo_name": "google/CFU-Playground",
"path": "proj/mnv2_first/gateware/post_process.py",
"copies": "1",
"size": "9145",
"license": "apache-2.0",
"hash": -5242496515175166000,
"line_mean": 32.7453874539,
"line_max": 81,
"alpha_frac": 0.6147621651,
"autogenerated": false,
"ratio": 3.7711340206185... |
from nmigen import Signal, Mux
from nmigen_cfu import SimpleElaboratable
from . import config
from .delay import Delayer
from .macc import Madd4Pipeline
from .post_process import PostProcessor
class UpCounter(SimpleElaboratable):
"""Counts pulses.
Parameters
----------
width: int
Number of... | {
"repo_name": "google/CFU-Playground",
"path": "proj/mnv2_first/gateware/sequencing.py",
"copies": "1",
"size": "6580",
"license": "apache-2.0",
"hash": -3979736292926790000,
"line_mean": 33.0932642487,
"line_max": 85,
"alpha_frac": 0.603343465,
"autogenerated": false,
"ratio": 3.7175141242937855... |
from nmigen import Signal
from .registerfile import Xetter
class OutputQueueGetter(Xetter):
"""A getter to read from a 32-bit wide FIFO.
Blocks until data is available.
Public Interface
----------------
r_data: Signal(32) in
The FIFO's r_data signal
r_rdy: Signal() in
The FIF... | {
"repo_name": "google/CFU-Playground",
"path": "proj/mnv2_first/gateware/output.py",
"copies": "1",
"size": "1798",
"license": "apache-2.0",
"hash": -2459460157457458000,
"line_mean": 29.4915254237,
"line_max": 74,
"alpha_frac": 0.5761957731,
"autogenerated": false,
"ratio": 3.639676113360324,
... |
from nmigen.sim import Settle
from nmigen_cfu import TestBase
from.post_process import PostProcessXetter, PostProcessor
class PostProcessorTestCase(TestBase):
def create_dut(self):
return PostProcessor()
def test(self):
DATA = [
# Test data generated from actual values captured... | {
"repo_name": "google/CFU-Playground",
"path": "proj/mnv2_first/gateware/test_post_process.py",
"copies": "1",
"size": "5984",
"license": "apache-2.0",
"hash": 6754039496507434000,
"line_mean": 43.3259259259,
"line_max": 93,
"alpha_frac": 0.5158756684,
"autogenerated": false,
"ratio": 3.282501371... |
from nmigen import Signal
from nmigen_cfu import InstructionBase, SimpleElaboratable, ValueBuffer
class Xetter(SimpleElaboratable):
"""Setter/Getter base class.
In many ways, this is a cut down version of an instruction. Like an instruction,
it has two inputs and one output. Processing is controlled w... | {
"repo_name": "google/CFU-Playground",
"path": "proj/mnv2_first/gateware/registerfile.py",
"copies": "1",
"size": "3941",
"license": "apache-2.0",
"hash": 6017642206696319000,
"line_mean": 30.7822580645,
"line_max": 90,
"alpha_frac": 0.6143110886,
"autogenerated": false,
"ratio": 3.82250242483026... |
from nmigen.sim import Delay
from nmigen_cfu import TestBase
from .delay import Delayer
from .sequencing import Delayer, GateCalculator, Sequencer, UpCounter
class UpCounterTest(TestBase):
def create_dut(self):
return UpCounter(5)
def test(self):
DATA = [
# count all the way a... | {
"repo_name": "google/CFU-Playground",
"path": "proj/mnv2_first/gateware/test_sequencing.py",
"copies": "1",
"size": "6394",
"license": "apache-2.0",
"hash": -6747633834249937000,
"line_mean": 33.192513369,
"line_max": 104,
"alpha_frac": 0.4568345324,
"autogenerated": false,
"ratio": 3.3112377006... |
from nmigen.sim import Delay
from nmigen_cfu import TestBase
from .output import OutputQueueGetter
class OutputQueueGetterTest(TestBase):
def create_dut(self):
return OutputQueueGetter()
def test(self):
DATA = [
# FIFO ready first
((0, 0, 0), (0, 0, 0)),
... | {
"repo_name": "google/CFU-Playground",
"path": "proj/mnv2_first/gateware/test_output.py",
"copies": "1",
"size": "2095",
"license": "apache-2.0",
"hash": 1106749570969045800,
"line_mean": 32.253968254,
"line_max": 82,
"alpha_frac": 0.5178997613,
"autogenerated": false,
"ratio": 3.468543046357616,... |
# chrome_tests.py
''' Runs various chrome tests through purify_test.py
'''
import glob
import logging
import optparse
import os
import stat
import sys
import google.logging_utils
import google.path_utils
import google.platform_utils
import common
class TestNotFound(Exception): pass
class ChromeTests:
def __... | {
"repo_name": "kuiche/chromium",
"path": "tools/purify/chrome_tests.py",
"copies": "2",
"size": "16355",
"license": "bsd-3-clause",
"hash": 510734312617906370,
"line_mean": 39.4826732673,
"line_max": 83,
"alpha_frac": 0.6093549373,
"autogenerated": false,
"ratio": 3.7606346286502643,
"config_te... |
# logging_utils.py
''' Utility functions and objects for logging.
'''
import logging
import sys
class StdoutStderrHandler(logging.Handler):
''' Subclass of logging.Handler which outputs to either stdout or stderr
based on a threshold level.
'''
def __init__(self, threshold=logging.WARNING, err=sys.stderr, ... | {
"repo_name": "meego-tablet-ux/meego-app-browser",
"path": "tools/python/google/logging_utils.py",
"copies": "6",
"size": "2700",
"license": "bsd-3-clause",
"hash": 2169463610086163700,
"line_mean": 30.3953488372,
"line_max": 80,
"alpha_frac": 0.6881481481,
"autogenerated": false,
"ratio": 3.9881... |
# purify_coverage.py
import logging
import optparse
import os
import re
import sys
import google.path_utils
# local modules
import common
import purify_analyze
import purify_message
class PurifyCoverage(common.Rational):
def __init__(self):
common.Rational.__init__(self)
script_dir = google.path_utils.S... | {
"repo_name": "amyvmiwei/chromium",
"path": "tools/purify/purify_coverage.py",
"copies": "2",
"size": "2670",
"license": "bsd-3-clause",
"hash": 2936587671774530000,
"line_mean": 29.6896551724,
"line_max": 80,
"alpha_frac": 0.6299625468,
"autogenerated": false,
"ratio": 3.7765205091937766,
"con... |
# purify_inuse.py
import logging
import optparse
import os
import re
import sys
import google.path_utils
# local modules
import common
import purify_analyze
import purify_message
class PurifyInUse(common.Rational):
def __init__(self):
common.Rational.__init__(self)
script_dir = google.path_utils.ScriptD... | {
"repo_name": "kuiche/chromium",
"path": "tools/purify/purify_inuse.py",
"copies": "2",
"size": "2971",
"license": "bsd-3-clause",
"hash": 5878616602249430000,
"line_mean": 31.2934782609,
"line_max": 80,
"alpha_frac": 0.6273981824,
"autogenerated": false,
"ratio": 3.727728983688833,
"config_tes... |
# purify_test.py
'''Runs an exe through Purify and verifies that Purify was
able to successfully instrument and run it. The original purpose was
to be able to identify when a change to our code breaks our ability to Purify
the app. This can happen with seemingly innocuous changes to code due to bugs
in Purify, and ... | {
"repo_name": "kuiche/chromium",
"path": "tools/purify/purify_test.py",
"copies": "2",
"size": "9763",
"license": "bsd-3-clause",
"hash": -4418785626306861600,
"line_mean": 37.8964143426,
"line_max": 83,
"alpha_frac": 0.6124142169,
"autogenerated": false,
"ratio": 3.7899844720496896,
"config_te... |
# quantify_test.py
'''Runs an app through Quantify and verifies that Quantify was able to
successfully instrument and run it. The original purpose was to allow people
to run Quantify in a consistent manner without having to worry about broken
PATHs, corrupt instrumentation, or other per-machine flakiness that Quanti... | {
"repo_name": "kuiche/chromium",
"path": "tools/purify/quantify_test.py",
"copies": "2",
"size": "2059",
"license": "bsd-3-clause",
"hash": -6272762395673703000,
"line_mean": 32.7540983607,
"line_max": 79,
"alpha_frac": 0.6784847013,
"autogenerated": false,
"ratio": 3.6899641577060933,
"config_... |
# test_runner
import optparse
import os
import re
import subprocess
import sys
import google.logging_utils
import google.path_utils
import common
def GetAllTests(exe):
cmd = [exe, "--gtest_list_tests"]
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
line = p.stdout.readline().rstrip()
test = line
test... | {
"repo_name": "amyvmiwei/chromium",
"path": "tools/purify/test_runner.py",
"copies": "2",
"size": "1034",
"license": "bsd-3-clause",
"hash": 8093582749127070000,
"line_mean": 19.2745098039,
"line_max": 72,
"alpha_frac": 0.6595744681,
"autogenerated": false,
"ratio": 3.3462783171521036,
"config_... |
import os
import zipfile
from failure_finder import FailureFinder
TEST_BUILDER_OUTPUT = """090723 10:38:22 test_shell_thread.py:289
ERROR chrome/fast/forms/textarea-metrics.html failed:
Text diff mismatch
090723 10:38:21 test_shell_thread.py:289
ERROR chrome/fast/dom... | {
"repo_name": "rwatson/chromium-capsicum",
"path": "webkit/tools/layout_tests/layout_package/failure_finder_test.py",
"copies": "1",
"size": "12423",
"license": "bsd-3-clause",
"hash": -8644580407013286000,
"line_mean": 34.3931623932,
"line_max": 80,
"alpha_frac": 0.6845367464,
"autogenerated": fal... |
"""Module to setup and generate code coverage data
This module first sets up the environment for code coverage, instruments the
binaries, runs the tests and collects the code coverage data.
Usage:
coverage.py --upload=<upload_location>
--revision=<revision_number>
--src_root=<root_of_... | {
"repo_name": "gavinp/chromium",
"path": "tools/code_coverage/coverage.py",
"copies": "20",
"size": "14041",
"license": "bsd-3-clause",
"hash": -679459475867142000,
"line_mean": 37.3633879781,
"line_max": 80,
"alpha_frac": 0.5775229684,
"autogenerated": false,
"ratio": 4.307055214723927,
"confi... |
import pygame, sys,os,struct
from pygame.locals import *
pygame.init()
# mostly default values, low buffer to reduce latency
pygame.mixer.init(22050, -16, 1, 1024)
window = pygame.display.set_mode((480,575))
pygame.display.set_caption('bounce')
screen = pygame.display.get_surface()
(width,height) = screen.get... | {
"repo_name": "dzwarg/bounce",
"path": "game.py",
"copies": "1",
"size": "8241",
"license": "bsd-2-clause",
"hash": -789622250822741500,
"line_mean": 32.0963855422,
"line_max": 134,
"alpha_frac": 0.6296565951,
"autogenerated": false,
"ratio": 2.5745079662605437,
"config_test": false,
"has_no_... |
"Planetary, the game. Needs no more explanation"
import sys
from os import name
from subprocess import call
import ships
import game
import matter
import json
def line(header):
"Returns nicely formatted header with '=' line"
output = "="
output += header
output += "="*(69-len(header))
output += "\n... | {
"repo_name": "Spacecow-Gaming/Planetary",
"path": "Inactive/Prototype1/planetary.py",
"copies": "1",
"size": "6140",
"license": "bsd-2-clause",
"hash": 4192076389627771400,
"line_mean": 33.3016759777,
"line_max": 74,
"alpha_frac": 0.5099348534,
"autogenerated": false,
"ratio": 3.712212817412334,... |
"""
Example:
python extract_para.py --preModel PREMODEL --preDict PREDICT \
--usrModel USRMODEL --usrDict USRDICT -d DIM
Options:
-h, --help show this help message and exit
--preModel PREMODEL the name of pretrained embedding model
--preDict PREDICT the name of pr... | {
"repo_name": "alvations/Paddle",
"path": "demo/model_zoo/embedding/extract_para.py",
"copies": "2",
"size": "3822",
"license": "apache-2.0",
"hash": 1864987865973932500,
"line_mean": 32.8230088496,
"line_max": 89,
"alpha_frac": 0.6182626897,
"autogenerated": false,
"ratio": 3.9,
"config_test":... |
"""
Example:
python paraconvert.py --b2t -i INPUT -o OUTPUT -d DIM
python paraconvert.py --t2b -i INPUT -o OUTPUT
Options:
-h, --help show this help message and exit
--b2t convert parameter file of embedding model from binary to text
--t2b convert parameter file of embedding model from... | {
"repo_name": "qingqing01/Paddle",
"path": "demo/model_zoo/embedding/paraconvert.py",
"copies": "2",
"size": "5475",
"license": "apache-2.0",
"hash": -7823219681669735000,
"line_mean": 33.4339622642,
"line_max": 79,
"alpha_frac": 0.6082191781,
"autogenerated": false,
"ratio": 3.8020833333333335,
... |
"""
Example:
python preprocess.py -i INPUT [-d DICTSIZE] [-m]
Options:
-h, --help show this help message and exit
-i INPUT input original dataset path
-d DICTSIZE specified word count of dictionary
-m --mergeDict merge source and target dictionary
"""
import os
import sys
import strin... | {
"repo_name": "alvations/Paddle",
"path": "demo/seqToseq/preprocess.py",
"copies": "2",
"size": "8690",
"license": "apache-2.0",
"hash": -1903309149534415600,
"line_mean": 38.6803652968,
"line_max": 80,
"alpha_frac": 0.5714614499,
"autogenerated": false,
"ratio": 3.9232505643340856,
"config_tes... |
"""
Example:
python extract_para.py --preModel PREMODEL --preDict PREDICT \
--usrModel USRMODEL --usrDict USRDICT -d DIM
Options:
-h, --help show this help message and exit
--preModel PREMODEL the name of pretrained embedding model
--preDict PREDICT the name of p... | {
"repo_name": "zuowang/Paddle",
"path": "demo/model_zoo/embedding/extract_para.py",
"copies": "2",
"size": "3709",
"license": "apache-2.0",
"hash": -2307454963631023600,
"line_mean": 37.6354166667,
"line_max": 89,
"alpha_frac": 0.6370989485,
"autogenerated": false,
"ratio": 3.8515057113187954,
... |
"""
Example:
python paraconvert.py --b2t -i INPUT -o OUTPUT -d DIM
python paraconvert.py --t2b -i INPUT -o OUTPUT
Options:
-h, --help show this help message and exit
--b2t convert parameter file of embedding model from binary to text
--t2b convert parameter file of embedding model fro... | {
"repo_name": "comeonfox/Paddle",
"path": "demo/model_zoo/embedding/paraconvert.py",
"copies": "2",
"size": "5505",
"license": "apache-2.0",
"hash": -4093765724372827000,
"line_mean": 35.4569536424,
"line_max": 91,
"alpha_frac": 0.6049046322,
"autogenerated": false,
"ratio": 3.84427374301676,
"... |
"""
Example:
python extract_para.py --preModel PREMODEL --preDict PREDICT \
--usrModel USRMODEL --usrDict USRDICT -d DIM
Options:
-h, --help show this help message and exit
--preModel PREMODEL the name of pretrained embedding model
--preDict PREDICT the name of pr... | {
"repo_name": "lispc/Paddle",
"path": "v1_api_demo/model_zoo/embedding/extract_para.py",
"copies": "13",
"size": "3832",
"license": "apache-2.0",
"hash": 1198162942968540200,
"line_mean": 32.9115044248,
"line_max": 89,
"alpha_frac": 0.619519833,
"autogenerated": false,
"ratio": 3.910204081632653,... |
"""
Example:
python paraconvert.py --b2t -i INPUT -o OUTPUT -d DIM
python paraconvert.py --t2b -i INPUT -o OUTPUT
Options:
-h, --help show this help message and exit
--b2t convert parameter file of embedding model from binary to text
--t2b convert parameter file of embedding model from... | {
"repo_name": "zhouxiao-coder/Paddle",
"path": "demo/model_zoo/embedding/paraconvert.py",
"copies": "13",
"size": "5485",
"license": "apache-2.0",
"hash": 6873818581991599000,
"line_mean": 33.4968553459,
"line_max": 79,
"alpha_frac": 0.6091157703,
"autogenerated": false,
"ratio": 3.80902777777777... |
"""
Example:
python preprocess.py -i INPUT [-d DICTSIZE] [-m]
Options:
-h, --help show this help message and exit
-i INPUT input original dataset path
-d DICTSIZE specified word count of dictionary
-m --mergeDict merge source and target dictionary
"""
import os
import sys
import strin... | {
"repo_name": "livc/Paddle",
"path": "demo/seqToseq/preprocess.py",
"copies": "9",
"size": "8700",
"license": "apache-2.0",
"hash": -837348689084154600,
"line_mean": 38.7260273973,
"line_max": 80,
"alpha_frac": 0.5720689655,
"autogenerated": false,
"ratio": 3.927765237020316,
"config_test": tru... |
"""Copyright (c) 2016, William, Bundy
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, merge, publish, distribute,... | {
"repo_name": "WilliamBundy/rituals-game",
"path": "autogit.py",
"copies": "1",
"size": "3569",
"license": "mit",
"hash": 2512198340060003000,
"line_mean": 33.3173076923,
"line_max": 463,
"alpha_frac": 0.6197814514,
"autogenerated": false,
"ratio": 3.8920392584514723,
"config_test": false,
"h... |
"""Configuration for i3pystatus."""
import i3pystatus
import i3pystatus.updates.cower
import i3pystatus.updates.pacman
COLOR_DEFAULT = None
COLOR_DISABLED = '#afb8c5'
COLOR_INFORMATION = '#cc575d'
status = i3pystatus.Status(standalone=True, click_events=True)
status.register(
'clock',
color=COLOR_DEFAULT,
... | {
"repo_name": "rscholer/dotfiles",
"path": "src/i3pystatus/.config/i3pystatus.py",
"copies": "1",
"size": "2911",
"license": "mit",
"hash": 6451261716147577000,
"line_mean": 29.3229166667,
"line_max": 79,
"alpha_frac": 0.6709034696,
"autogenerated": false,
"ratio": 3.469606674612634,
"config_te... |
""" Get pull requests. """
import os
import time
import os.path
from github import Github
class PRChecker(object):
""" PR Checker. """
def __init__(self):
self.github = Github(os.getenv('GITHUB_API_TOKEN'), timeout=60)
self.repo = None
def check(self, filename, msg):
"""
... | {
"repo_name": "luotao1/Paddle",
"path": "tools/check_ut.py",
"copies": "2",
"size": "1806",
"license": "apache-2.0",
"hash": 2428049665946567700,
"line_mean": 31.25,
"line_max": 80,
"alpha_frac": 0.6079734219,
"autogenerated": false,
"ratio": 3.739130434782609,
"config_test": false,
"has_no_k... |
__copyright__ = """Copyright 2014 Adobe Systems Incorporated (http://www.adobe.com/). All Rights Reserved.
"""
__doc__ = """
stemHist. Wrapper for the Adobe auto-hinting C library. The AC C library
works on only one glyph at a time, expressed in the old 'bez' format, a
bezier-curve language much like PostScript Type 1... | {
"repo_name": "shannpersand/cooper-type",
"path": "_resources/FDK Adobe/Tools/SharedData/FDKScripts/StemHist.py",
"copies": "1",
"size": "28121",
"license": "cc0-1.0",
"hash": 3284589823317825000,
"line_mean": 28.9159574468,
"line_max": 154,
"alpha_frac": 0.6867109989,
"autogenerated": false,
"ra... |
__copyright__ = """Copyright 2016 Adobe Systems Incorporated (http://www.adobe.com/). All Rights Reserved.
"""
__usage__ = """
autohint AutoHinting program v1.49 April 27 2016
autohint -h
autohint -u
autohint -hfd
autohint -pfd
autohint [-g <glyph list>] [-gf <filename>] [-xg <glyph list>] [-xgf <filename>] [-cf path... | {
"repo_name": "shannpersand/cooper-type",
"path": "_resources/FDK Adobe/Tools/SharedData/FDKScripts/autohint.py",
"copies": "1",
"size": "46351",
"license": "cc0-1.0",
"hash": 5599303021947201000,
"line_mean": 32.857560263,
"line_max": 203,
"alpha_frac": 0.7172660784,
"autogenerated": false,
"rat... |
import httplib
import urllib
import re
import sys
from time import sleep
from datetime import datetime, timedelta
import urllib2
def minutes(minutes):
return (datetime.utcnow() - timedelta(seconds=60*minutes)).strftime("%Y-%m-%dT%H:%M:%Sz")
def dbnow():
return (datetime.utcnow()).strftime("%Y-%m-%dT%H:%M:%Sz")
def... | {
"repo_name": "bundgaard/toolbox",
"path": "solr_status.py",
"copies": "1",
"size": "3005",
"license": "artistic-2.0",
"hash": 3362292934994925600,
"line_mean": 25.592920354,
"line_max": 90,
"alpha_frac": 0.6672212978,
"autogenerated": false,
"ratio": 2.8136704119850187,
"config_test": false,
... |
__doc__="""Tests Postscript XObjects.
Nothing visiblke in Acrobat, but the resulting files
contain graphics and tray commands if exported to
a Postscript device in Acrobat 4.0"""
__version__='''$Id$'''
from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
setOutDir(__name__)
impo... | {
"repo_name": "makinacorpus/reportlab-ecomobile",
"path": "tests/test_pdfbase_postscript.py",
"copies": "1",
"size": "3180",
"license": "bsd-3-clause",
"hash": -5037039060970285000,
"line_mean": 41.4,
"line_max": 113,
"alpha_frac": 0.6842767296,
"autogenerated": false,
"ratio": 3.6095346197502836... |
__doc__="""Tests Postscript XObjects.
Nothing visiblke in Acrobat, but the resulting files
contain graphics and tray commands if exported to
a Postscript device in Acrobat 4.0"""
__version__='''$Id: test_pdfbase_postscript.py 3288 2008-09-15 11:03:17Z rgbecker $'''
from reportlab.lib.testutils import setOutDir,makeSui... | {
"repo_name": "jhurt/ReportLab",
"path": "tests/test_pdfbase_postscript.py",
"copies": "5",
"size": "3244",
"license": "bsd-3-clause",
"hash": 4794591678892553000,
"line_mean": 42.2533333333,
"line_max": 113,
"alpha_frac": 0.686189889,
"autogenerated": false,
"ratio": 3.5766262403528115,
"confi... |
__version__=''' $Id: gengraphguide.py 2385 2004-06-17 15:26:05Z rgbecker $ '''
__doc__ = """
This module contains the script for building the graphics guide.
"""
def run(pagesize=None, verbose=1, outDir=None):
import os
from reportlab.tools.docco.rl_doc_utils import setStory, getStory, RLDocTemplate, defaultPag... | {
"repo_name": "alexissmirnov/donomo",
"path": "donomo_archive/deps/reportlab/docs/graphguide/gengraphguide.py",
"copies": "2",
"size": "2060",
"license": "bsd-3-clause",
"hash": 8730871761175611000,
"line_mean": 33.9152542373,
"line_max": 121,
"alpha_frac": 0.6519417476,
"autogenerated": false,
"... |
__version__=''' $Id$ '''
__doc__ = """
This module contains the script for building the reference.
"""
def run(verbose=None, outDir=None):
import os, sys, shutil
if verbose is None: verbose=('-s' not in sys.argv)
cwd = os.getcwd()
docsDir=os.path.dirname(os.path.dirname(sys.argv[0]) or cwd)
topDir=o... | {
"repo_name": "makinacorpus/reportlab-ecomobile",
"path": "docs/reference/genreference.py",
"copies": "1",
"size": "1236",
"license": "bsd-3-clause",
"hash": -5561563373386903000,
"line_mean": 38.8709677419,
"line_max": 119,
"alpha_frac": 0.7095469256,
"autogenerated": false,
"ratio": 3.358695652... |
__version__=''' $Id: genreference.py 2385 2004-06-17 15:26:05Z rgbecker $ '''
__doc__ = """
This module contains the script for building the reference.
"""
def run(verbose=None, outDir=None):
import os, sys, shutil
from reportlab.tools.docco import yaml2pdf
from reportlab.lib.utils import _RL_DIR
if ver... | {
"repo_name": "alexissmirnov/donomo",
"path": "donomo_archive/deps/reportlab/docs/reference/genreference.py",
"copies": "2",
"size": "1163",
"license": "bsd-3-clause",
"hash": -5019532580895027000,
"line_mean": 39.1034482759,
"line_max": 119,
"alpha_frac": 0.7067927773,
"autogenerated": false,
"r... |
__version__=''' $Id: genreference.py 3376 2009-01-19 12:05:41Z jonas $ '''
__doc__ = """
This module contains the script for building the reference.
"""
def run(verbose=None, outDir=None):
import os, sys, shutil
if verbose is None: verbose=('-s' not in sys.argv)
cwd = os.getcwd()
docsDir=os.path.dirname... | {
"repo_name": "HM2MC/Webfront",
"path": "reportlab-2.5/docs/reference/genreference.py",
"copies": "5",
"size": "1286",
"license": "mit",
"hash": -3921275064793668600,
"line_mean": 40.4838709677,
"line_max": 119,
"alpha_frac": 0.7115085537,
"autogenerated": false,
"ratio": 3.3059125964010283,
"c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.