text stringlengths 0 1.05M | meta dict |
|---|---|
"""Simple example of operations and operators with ROOT histograms
"""
# =============================================================================
from __future__ import print_function
import ROOT,random
from ostap.histos import VE
h1 = ROOT.TH1F('h1','title',50,0,20)
h2 = ROOT.TH1F('h2','title',50,0,20)
h3 ... | {
"repo_name": "OstapHEP/ostap",
"path": "examples/histos/histos_ex002_operators.py",
"copies": "1",
"size": "3172",
"license": "bsd-3-clause",
"hash": 7487988189656264000,
"line_mean": 37.2168674699,
"line_max": 79,
"alpha_frac": 0.4429382093,
"autogenerated": false,
"ratio": 2.4103343465045595,
... |
"""Simple example of 1D-histogram local interpolation
"""
# =============================================================================
from __future__ import print_function
import ROOT,random
from ostap.histos import VE
h1 = ROOT.TH1F ( 'h1' , 'title' , 10 , 0 , 10 )
## 1) set values for histogram bins bins
... | {
"repo_name": "OstapHEP/ostap",
"path": "examples/histos/histos_ex003_interpolation.py",
"copies": "1",
"size": "1546",
"license": "bsd-3-clause",
"hash": -1271033243096995800,
"line_mean": 38.641025641,
"line_max": 86,
"alpha_frac": 0.4062095731,
"autogenerated": false,
"ratio": 4.18970189701897... |
"""Example of basic operations with VE objects and functions
"""
# =============================================================================
from __future__ import print_function
import math
from ostap.math.ve import VE
from ostap.math.math_ve import * ## get functions
a = VE ( 2 , 0.2**2 )
b ... | {
"repo_name": "OstapHEP/ostap",
"path": "examples/math/math_ex001_functions.py",
"copies": "1",
"size": "2482",
"license": "bsd-3-clause",
"hash": -4950961771628136000,
"line_mean": 36.0447761194,
"line_max": 82,
"alpha_frac": 0.3251410153,
"autogenerated": false,
"ratio": 2.872685185185185,
"c... |
#!/bin/env python
# -*- coding: utf-8 -*-
#
# Created on {% now "d-m-Y" %}
"""Multi proc/thread helpers"""
__all__ = [
'get_nb_workers',
'reconnect_db',
'reset_database_connection',
]
import logging
import psutil
logger = logging.getLogger('default')
def get_nb_workers(force_max=False):
"""Retrie... | {
"repo_name": "motiteux/django-template",
"path": "project_name/project_name/utils/multi.py",
"copies": "1",
"size": "1470",
"license": "mit",
"hash": -372419068089688100,
"line_mean": 20.6176470588,
"line_max": 76,
"alpha_frac": 0.6102040816,
"autogenerated": false,
"ratio": 3.712121212121212,
... |
"""
Created on Wed Jul 22 09:57:05 2015
@author: xhxiao
"""
from __future__ import print_function
import time
import epics
import numpy as np
import os
try:
# Python 2
import Tkinter
import tkMessageBox as mbox
except ImportError:
import tkinter as Tkinter
from tkinter import messagebox as mbox
#... | {
"repo_name": "tomography/scanscripts",
"path": "aps_02bm/macros_2bmb.py",
"copies": "1",
"size": "329991",
"license": "bsd-3-clause",
"hash": -8067191487987696000,
"line_mean": 54.1824414716,
"line_max": 272,
"alpha_frac": 0.5673639584,
"autogenerated": false,
"ratio": 3.0001636497531616,
"con... |
#!/bin/env python
# -*- coding: utf-8 -*-
"""
Create POSCAR files in which some atoms are shifted so that
two stacking fault (SF) planes are formed.
usage:
make-SF-POSCARs.py [options] POSCAR (DX DY)...
options:
-h, --help show this help message and exit
-p, --plane=<xyz>
SF plane to be... | {
"repo_name": "ryokbys/nap",
"path": "nappy/vasp/make_SF_POSCARs.py",
"copies": "1",
"size": "3060",
"license": "mit",
"hash": 2905637552220151000,
"line_mean": 25.1538461538,
"line_max": 81,
"alpha_frac": 0.5267973856,
"autogenerated": false,
"ratio": 3.1352459016393444,
"config_test": false,
... |
#!/bin/env python
# -*- coding: utf-8 -*-
def print_upper_triangular_matrix(matrix):
"""Prints a CVRP data dict matrix"""
# Print column header
# Assumes first row contains all needed headers
first = sorted(matrix.keys())[0]
print('\t',)
for i in matrix[first]:
print('{}\t'.format(i),)... | {
"repo_name": "RomuloOliveira/monte-carlo-cvrp",
"path": "project/util.py",
"copies": "1",
"size": "1528",
"license": "apache-2.0",
"hash": -3387769031147141600,
"line_mean": 24.0491803279,
"line_max": 93,
"alpha_frac": 0.5517015707,
"autogenerated": false,
"ratio": 3.8585858585858586,
"config_... |
from optparse import OptionParser
from command import CommandParser
from utils import (fetch_cmd_patterns, match_and_filter_cmds, write_array,
format_cmd_buf)
def main():
opts = cmd_opt_parse()
multi_cmd_patterns, _ = fetch_cmd_patterns(opts.pattern,
... | {
"repo_name": "chosen0ne/redis-aof-modifier",
"path": "aof_filter.py",
"copies": "1",
"size": "3001",
"license": "apache-2.0",
"hash": 7451665576713524000,
"line_mean": 32.7191011236,
"line_max": 78,
"alpha_frac": 0.5478173942,
"autogenerated": false,
"ratio": 4.001333333333333,
"config_test": ... |
#!/bin/env python
# coding: utf-8
from base64 import b64encode
from httplib import HTTPConnection
from urlparse import urlparse
import os
import select
import socket
import sys
def main():
def exit_with_mesg(message, status=-1, color=31):
sys.stderr.write("\x1b[%sm%s\x1b[0m\n" % (color, message))
... | {
"repo_name": "hirosuzuki/proxyconnect",
"path": "proxyconnect.py",
"copies": "1",
"size": "1754",
"license": "mit",
"hash": 6208852771941598000,
"line_mean": 25.5757575758,
"line_max": 77,
"alpha_frac": 0.5889395667,
"autogenerated": false,
"ratio": 3.5220883534136544,
"config_test": false,
... |
#!/bin/env python
# coding:utf-8
from dispatch.jd_seckill import class_logger
import queue
import time
import requests
import json
Min_alive = 10
Check_delay = 20 * 60
rk_username = "lengyue233"
rk_pwd = "Lengyue0331"
session_timeout = 5
max_retries = 5
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Ma... | {
"repo_name": "xtuyaowu/jtyd_python_spider",
"path": "dispatch/jd_seckill/proxy_pool.py",
"copies": "1",
"size": "2685",
"license": "mit",
"hash": -1360301892731376400,
"line_mean": 32.475,
"line_max": 141,
"alpha_frac": 0.5681733284,
"autogenerated": false,
"ratio": 3.4721141374837874,
"config... |
#!/bin/env python
# -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from django.utils.timezone import utc
import datetime
from cms.models import CMSPlugin
from . import settings
class PublishedNewsManager(models... | {
"repo_name": "ITrex/cmsplugin-newsplus",
"path": "cmsplugin_newsplus/models.py",
"copies": "1",
"size": "4237",
"license": "bsd-2-clause",
"hash": -647231554980832800,
"line_mean": 30.045112782,
"line_max": 79,
"alpha_frac": 0.5800435941,
"autogenerated": false,
"ratio": 3.9063386944181646,
"c... |
#!/bin/env python
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext
from django.contrib import admin
from cmsplugin_newsplus.models import News, NewsImage, Topic
class NewsImageInline(admin.TabularInline):
model = NewsImage
extra =... | {
"repo_name": "ITrex/cmsplugin-newsplus",
"path": "cmsplugin_newsplus/admin.py",
"copies": "1",
"size": "2091",
"license": "bsd-2-clause",
"hash": 3643520568174192600,
"line_mean": 30.2089552239,
"line_max": 69,
"alpha_frac": 0.6140602582,
"autogenerated": false,
"ratio": 4.165338645418327,
"co... |
#!/bin/env python
# -*- coding: utf-8 -*-
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from django.views import generic as generic_views
from django.shortcuts import get_object_or_404
from cmsplugin_newsplus import models
from cmsplugin_newsplus import settings
cl... | {
"repo_name": "ITrex/cmsplugin-newsplus",
"path": "cmsplugin_newsplus/views.py",
"copies": "1",
"size": "4644",
"license": "bsd-2-clause",
"hash": 1036480587946239000,
"line_mean": 28.3924050633,
"line_max": 79,
"alpha_frac": 0.6515934539,
"autogenerated": false,
"ratio": 3.8190789473684212,
"c... |
#/bin/env python
#-*- coding:utf-8 -*-
from fabric.api import *
from fabric.contrib.console import confirm
from config import service
src_dir="/Users/gmsjy/nagios/"
nagi_dir="/opt/nagios/nagios"
env.user='nagios'
env.hosts=['114.215.184.138:10022','115.29.188.140:10022','115.29.194.125:10022']
env.password='... | {
"repo_name": "gmsjy/fab_nagios",
"path": "fab_nagios.py",
"copies": "1",
"size": "1778",
"license": "mit",
"hash": -9136316652095539000,
"line_mean": 27.2222222222,
"line_max": 81,
"alpha_frac": 0.6316085489,
"autogenerated": false,
"ratio": 3.0497427101200687,
"config_test": false,
"has_no_... |
#!/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
from bs4 import BeautifulSoup
import requests
import logging
from .logger import handler
logger = logging.getLogger(__name__)
logger.addHandler(handler)
class Searcher:
def __init__(self):
self.sess... | {
"repo_name": "shrkw/jkk-notifier",
"path": "jkk/searcher.py",
"copies": "1",
"size": "2308",
"license": "mit",
"hash": 2160154012134166800,
"line_mean": 42.5471698113,
"line_max": 156,
"alpha_frac": 0.6152512998,
"autogenerated": false,
"ratio": 2.9742268041237114,
"config_test": false,
"has... |
from __future__ import division, print_function, absolute_import
from collections import namedtuple
import requests
from bs4 import BeautifulSoup
Author = namedtuple('Author', ['link', 'name', 'id'])
Tweet = namedtuple('Tweet', ['timestamp', 'link', 'date','text'])
Entry = namedtuple('Entry', ['author', 'tweet'])
cl... | {
"repo_name": "shrkw/tog-epub",
"path": "togepub/togetter.py",
"copies": "1",
"size": "2718",
"license": "mit",
"hash": 8134820579792999000,
"line_mean": 36.0410958904,
"line_max": 104,
"alpha_frac": 0.5369822485,
"autogenerated": false,
"ratio": 3.414141414141414,
"config_test": false,
"has_... |
#!/bin/env python
# coding:utf-8
from __future__ import division, print_function, absolute_import
import jinja2
import datetime
import shutil
import os
import zipfile
import glob
from . import togetter
class Publisher(object):
def __init__(self, togetters):
self.togetters = togetters
self.title ... | {
"repo_name": "shrkw/tog-epub",
"path": "togepub/publish.py",
"copies": "1",
"size": "6065",
"license": "mit",
"hash": -5134000161689285000,
"line_mean": 58.6966292135,
"line_max": 469,
"alpha_frac": 0.6749482402,
"autogenerated": false,
"ratio": 2.338468309859155,
"config_test": false,
"has_... |
#!/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import os
import sys
import re
import pymongo
from .mailer import send_search_result
from .mongo import get_collection
from .searcher import Searcher
import logging
from .logger import handler
logger = logging.... | {
"repo_name": "shrkw/jkk-notifier",
"path": "jkk/scr.py",
"copies": "1",
"size": "2061",
"license": "mit",
"hash": -359064664878191400,
"line_mean": 30.6229508197,
"line_max": 110,
"alpha_frac": 0.6303784344,
"autogenerated": false,
"ratio": 2.836764705882353,
"config_test": false,
"has_no_ke... |
#!/bin/env python
# coding: utf-8
from __future__ import print_function
import argparse
import re
import os
import unicodedata
import sys
import pandas as pd
def good_tag(tag, valid_tags):
"""Returns True if tag contains of the valid tags.
:param tag: string
:param valid_tags: list of valid tags
""... | {
"repo_name": "achabotl/tiddly2md",
"path": "tiddly2md.py",
"copies": "1",
"size": "3572",
"license": "mit",
"hash": 5257798855403364000,
"line_mean": 28.7666666667,
"line_max": 76,
"alpha_frac": 0.5033594625,
"autogenerated": false,
"ratio": 3.7403141361256544,
"config_test": false,
"has_no_... |
#!/bin/env python
# -*- coding: utf-8 -*-
#
from __future__ import print_function
import os
import sys
import crypt
def environnement_to_list(environnement_var, reference_size=None,
reference_var='AUTOCLEANFTP_USERS'):
res = [x.strip()
for x in os.environ.get(environnement_var, '').split(',')]
... | {
"repo_name": "thefab/docker-autoclean-vsftpd",
"path": "root/usr/local/bin/make_users_and_cron.py",
"copies": "1",
"size": "3817",
"license": "mit",
"hash": 8764257570194713000,
"line_mean": 37.5555555556,
"line_max": 82,
"alpha_frac": 0.5535761069,
"autogenerated": false,
"ratio": 3.32781168265... |
#!/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import re
import codecs
from collections import namedtuple
from distutils.spawn import find_executable
from subprocess import check_output
from pprint import pformat
if not hasattr(__builtins__, 'callable'):
def callable... | {
"repo_name": "redelinux-ime-usp/scripts",
"path": "jupiter/jupinfo-from-pdf.py",
"copies": "1",
"size": "4536",
"license": "bsd-2-clause",
"hash": 1662437790025218800,
"line_mean": 26.8098159509,
"line_max": 87,
"alpha_frac": 0.5465578111,
"autogenerated": false,
"ratio": 3.596825396825397,
"c... |
#!/bin/env python
# -*- coding: utf-8 -*-
from model_article import Articles, Articles2
filename = "delicious_article_dataset.dat"
# load url in bookmarks from dataset
url_to_id = {}
url_count = 10
total_url_count = 0
duplicated_url_count = 0
with open(filename, 'r') as f:
for row in f:
# url_count -= 1
... | {
"repo_name": "mayawang/capstone_fetchbot",
"path": "crawler/pagecrawler/pagecrawler/fix_article_id.py",
"copies": "1",
"size": "1792",
"license": "mit",
"hash": 4107266966231099400,
"line_mean": 27,
"line_max": 154,
"alpha_frac": 0.6032366071,
"autogenerated": false,
"ratio": 3.2,
"config_test... |
#!/bin/env python
# coding=utf-8
from myo.myo import MyoRaw
from myo.myo_raw import Pose
from sounds.generator import AudioFileManager
from menu import Branch, Leaf
from pydub.utils import get_player_name
from tempfile import NamedTemporaryFile
import os
import subprocess
import menu
class InputManager(object):
... | {
"repo_name": "monsieurh/myo-menu",
"path": "main.py",
"copies": "1",
"size": "3771",
"license": "mit",
"hash": 1946590882702276000,
"line_mean": 23.4935064935,
"line_max": 104,
"alpha_frac": 0.6486343145,
"autogenerated": false,
"ratio": 3.220324508966695,
"config_test": false,
"has_no_keywo... |
#!/bin/env python
# -*- coding: utf-8 -*-
from project import models
class BaseSolution(object):
"""Base abstract class for a CVRP solution"""
def __init__(self, cvrp_problem, vehicles):
"""Initialize class
Parameters:
cvrp_problem: CVRPData instance
vehicles: Vehicle... | {
"repo_name": "RomuloOliveira/monte-carlo-cvrp",
"path": "project/solvers/base.py",
"copies": "1",
"size": "2813",
"license": "apache-2.0",
"hash": 368593363040779800,
"line_mean": 27.7040816327,
"line_max": 115,
"alpha_frac": 0.57767508,
"autogenerated": false,
"ratio": 4.388455538221529,
"con... |
#!/bin/env/python
#coding: utf-8
from pygame import *
from PodSixNet.Connection import ConnectionListener, connection
from sklearn.svm import LinearSVC
from datetime import datetime
from time import sleep
import numpy as np
import random
import sys
u"""Encampment game with Pygame
Pygame, PodSixNet, scikit-learnを用いたネ... | {
"repo_name": "CORDEA/encampment-game",
"path": "game.py",
"copies": "1",
"size": "34279",
"license": "apache-2.0",
"hash": -8305534565823843000,
"line_mean": 33.7481789802,
"line_max": 139,
"alpha_frac": 0.4646482796,
"autogenerated": false,
"ratio": 3.5968332615252048,
"config_test": false,
... |
#!/bin/env python
# -*- coding: utf8 -*-
from Tkinter import *
import random
tk = Tk()
tk.title("Guess Game")
number = random.randint(0, 9)
count = 5
def confirm():
global number
global count
if count > 0:
entry = guessEntry.get()
if entry != "":
guess = int(entry)
... | {
"repo_name": "jamesliu96/teach",
"path": "python/guessgametk.py",
"copies": "1",
"size": "1302",
"license": "mit",
"hash": 3933958799642705000,
"line_mean": 22.25,
"line_max": 59,
"alpha_frac": 0.5798771121,
"autogenerated": false,
"ratio": 3.7413793103448274,
"config_test": false,
"has_no_k... |
#!/bin/env python
#coding: utf-8
from unittest import TestCase
from formalchemy2.fields import Field
from formalchemy2.renderers import BaseRenderer
from formalchemy2.exceptions import NoRendererError, NoValidatorError
class DummyRenderer(BaseRenderer):
"""A dummy renderer."""
def render(self, field):
... | {
"repo_name": "aconrad/FormAlchemy2",
"path": "tests/test_fields.py",
"copies": "1",
"size": "2990",
"license": "mit",
"hash": 4139813554520600600,
"line_mean": 31.5,
"line_max": 78,
"alpha_frac": 0.6193979933,
"autogenerated": false,
"ratio": 4.164345403899722,
"config_test": true,
"has_no_k... |
#!/bin/env python
# -*- coding: utf-8 -*-
import cPickle
import os
import gzip
import matplotlib.pyplot as plt
import mnist_loader
import pylab
import numpy as np
#### Libraries
# Standard library
import gzip
import pylab
# Third-party libraries
import numpy as np
weights=[]
biases=[]
outs=[]
"""
network.py
~~~~~~... | {
"repo_name": "ak4778/neural-network",
"path": "nnetwork.py",
"copies": "1",
"size": "20808",
"license": "bsd-3-clause",
"hash": 3157537277372624000,
"line_mean": 36.8214936248,
"line_max": 95,
"alpha_frac": 0.6016663456,
"autogenerated": false,
"ratio": 3.5719938069843455,
"config_test": true,... |
#!/bin/env python
#-*- coding: utf-8 -*-
import datetime
import subprocess
import time
from math import fabs
class Chance:
def __init__(self):
self.MatchesIds = []
def getMatches(self):
"""
Get tenis matches from https://live.chance.cz
@rtype: list
@return: List of Matches.
"""
self.__parseMatc... | {
"repo_name": "MichalCab/chance",
"path": "chance.py",
"copies": "1",
"size": "9368",
"license": "mit",
"hash": -6379581212075150000,
"line_mean": 24.5956284153,
"line_max": 131,
"alpha_frac": 0.6244662681,
"autogenerated": false,
"ratio": 2.9102205653929794,
"config_test": false,
"has_no_key... |
import fileinput
import os
import os.path
import sys
import gzip
import time
import urllib
import time
import json
__author__ = "Michal Cab <xcabmi00@stud.fit.vutbr.cz>"
global_gzip_filename = "freebase-rdf.gz"
def remove_language_tags(string):
return string.replace('@en', '')
def get_wikipedia_url(_wikipedia_ur... | {
"repo_name": "MichalCab/freebase",
"path": "createFreebaseId_wikiUrlList.py",
"copies": "1",
"size": "1698",
"license": "apache-2.0",
"hash": 3700644226055804000,
"line_mean": 24.696969697,
"line_max": 83,
"alpha_frac": 0.5860849057,
"autogenerated": false,
"ratio": 3.129151291512915,
"config_... |
#!/bin/env python
#-*- coding: utf-8 -*-
import fileinput
import urllib
import os
import os.path
import sys
import getopt
import json
import argparse
import gzip
import time
import urllib
from binary_search import *
#from fixed_data import FixedData
from load_file import *
__author__ = "Michal Cab <xcabmi00@stud.fit... | {
"repo_name": "MichalCab/freebase",
"path": "src/remove_redirections.py",
"copies": "1",
"size": "1778",
"license": "apache-2.0",
"hash": 3206893346287217700,
"line_mean": 30.1929824561,
"line_max": 124,
"alpha_frac": 0.6709786277,
"autogenerated": false,
"ratio": 3.2564102564102564,
"config_te... |
#!/bin/env python
# -*- coding: utf-8 -*-
import libkeepass
from os import environ
from optparse import OptionParser
import json
def getEntry(obj_root,entryPath, fieldName):
"""Return a specific field from the entry given by entryPath
@:param The path to the entry (sperated by /)
@:param fieldName The na... | {
"repo_name": "RudolfVonKrugstein/keepass-cli",
"path": "keepass_cli/keepass_cli.py",
"copies": "1",
"size": "5791",
"license": "mit",
"hash": 8122421245107343000,
"line_mean": 41.8962962963,
"line_max": 168,
"alpha_frac": 0.6349507857,
"autogenerated": false,
"ratio": 3.7555123216601816,
"conf... |
#!/bin/env python
#-*-coding:utf-8-*-
import MySQLdb
import string
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import ConfigParser
def get_item(data_dict,item):
try:
item_value = data_dict[item]
return item_value
except:
pass
def get_parameters(conn):
try:
curs=c... | {
"repo_name": "JK-Warriors/Heimdallr",
"path": "python/include/wl_oracle.py",
"copies": "1",
"size": "19185",
"license": "apache-2.0",
"hash": 6443603089634527000,
"line_mean": 25.6458333333,
"line_max": 199,
"alpha_frac": 0.4903831118,
"autogenerated": false,
"ratio": 3.9638429752066116,
"conf... |
#!/bin/env python
# -*- coding: utf-8 -*-
import oauth2 as oauth
import urllib2
import urllib
import json
import pprint
# See Assginment 6 instructions or README for how to get these credentials
access_token_key = ""
access_token_secret = ""
consumer_key = ""
consumer_secret = ""
_debug = 0
oauth_token = oauth.... | {
"repo_name": "kingmolnar/twitter-social-media-tracking",
"path": "public-stream/twitterstream_lookup_users.py",
"copies": "1",
"size": "2507",
"license": "cc0-1.0",
"hash": 6256784856158921000,
"line_mean": 30.7341772152,
"line_max": 204,
"alpha_frac": 0.6956521739,
"autogenerated": false,
"rati... |
#!/bin/env python
# -*- coding: utf-8 -*-
import oauth2 as oauth
import urllib2
import urllib
# See Assginment 6 instructions or README for how to get these credentials
access_token_key = ""
access_token_secret = ""
consumer_key = ""
consumer_secret = ""
_debug = 0
oauth_token = oauth.Token(key=access_token_key... | {
"repo_name": "kingmolnar/twitter-social-media-tracking",
"path": "public-stream/twitterstream2.py",
"copies": "1",
"size": "2554",
"license": "cc0-1.0",
"hash": -3585146504489908000,
"line_mean": 33.5135135135,
"line_max": 204,
"alpha_frac": 0.705559906,
"autogenerated": false,
"ratio": 2.952601... |
#!/bin/env python
# -*- coding: utf-8 -*-
import operator
import time
from project import models
from project.solvers.base import BaseSolution, BaseSolver
class ClarkeWrightSolution(BaseSolution):
"""Solution class for a Clarke and Wright Savings parallel algorithm"""
def __init__(self, cvrp_problem, vehic... | {
"repo_name": "RomuloOliveira/monte-carlo-cvrp",
"path": "project/solvers/clarke_wright.py",
"copies": "1",
"size": "5326",
"license": "apache-2.0",
"hash": -7745923301382594000,
"line_mean": 31.0843373494,
"line_max": 115,
"alpha_frac": 0.5732256853,
"autogenerated": false,
"ratio": 3.9775952203... |
#!/bin/env python
# -*- coding: utf-8 -*-
import operator
import time
import random
from project import models
from project.solvers.base import BaseSolver
from project.solvers.clarke_wright import ClarkeWrightSolution
class MonteCarloSavingsSolution(ClarkeWrightSolution):
"""Solution class for a Clarke and Wri... | {
"repo_name": "RomuloOliveira/monte-carlo-cvrp",
"path": "project/solvers/monte_carlo_savings.py",
"copies": "1",
"size": "5503",
"license": "apache-2.0",
"hash": -2055545734827768600,
"line_mean": 32.1506024096,
"line_max": 119,
"alpha_frac": 0.5933127385,
"autogenerated": false,
"ratio": 3.9963... |
#!/bin/env python
# -*- coding: utf-8 -*-
import os
import logging
import mongoengine
from flask import Flask
app = Flask(__name__)
# I didn't like this code in a function, but it's looks better
def setup_log():
"""Setups logging stuff
Add a file handler to default Flask Logger (http://stackoverflow.com/a/... | {
"repo_name": "RomuloOliveira/facebook-user-info",
"path": "project/__init__.py",
"copies": "1",
"size": "1537",
"license": "mit",
"hash": -1255008442839036700,
"line_mean": 29.137254902,
"line_max": 88,
"alpha_frac": 0.7065712427,
"autogenerated": false,
"ratio": 3.517162471395881,
"config_tes... |
#! /bin/env python
# -*- coding: utf-8 -*-
import os
import re
import random
def parse(lines, reg, dg):
new_lines = []
for line in lines:
new_lines += xor_match(line, reg, dg)
return new_lines
def xor_match(directive, reg, dg, iteration=2):
"""Too much iteration may cause jmp false immediat... | {
"repo_name": "reverland/scripts",
"path": "python/agwg.py",
"copies": "1",
"size": "3120",
"license": "mit",
"hash": 5085567517336285000,
"line_mean": 30.8163265306,
"line_max": 103,
"alpha_frac": 0.501603592,
"autogenerated": false,
"ratio": 3.370810810810811,
"config_test": false,
"has_no_... |
#!/bin/env python
# -*- coding:utf-8 -*-
import os
import sys
import time
import subprocess
import logging
import re
import MySQLdb
ROOT_FOLDER=r"D:\workspace\neon"
HISTORY_PATH_PREFIX=r"neon/"
os.chdir(ROOT_FOLDER)
def initlog():
logger = logging.getLogger()
#hdlr = logging.FileHandler(logfile)
hdlr = ... | {
"repo_name": "yaongli/neontool",
"path": "cvs_history/task/cvs_history_db.py",
"copies": "1",
"size": "7822",
"license": "mit",
"hash": 6523892073831939000,
"line_mean": 33.0130434783,
"line_max": 155,
"alpha_frac": 0.5516491946,
"autogenerated": false,
"ratio": 3.9188376753507015,
"config_tes... |
#!/bin/env/python
# coding: utf-8
import os
import time
import traceback
from multiprocessing import Process
from random import randrange
from FancyLogger import FancyLogger, TaskProgress
def pid(text):
return '[{}] : {}'.format(os.getpid(), text)
class WorkerClass(Process):
worker_names = ['RailwayDrill... | {
"repo_name": "peepall/FancyLogger",
"path": "examples/example2.py",
"copies": "1",
"size": "3618",
"license": "mit",
"hash": -2459782908948732400,
"line_mean": 33.7884615385,
"line_max": 120,
"alpha_frac": 0.5160309563,
"autogenerated": false,
"ratio": 4.976616231086657,
"config_test": false,
... |
#!/bin/env python
# -*- coding: utf-8 -*-
import os, sqlite3
root_dir = os.getcwd()
# db_file = os.path.join(os.path.dirname(__file__), 'test.db')
# if os.path.isfile(db_file):
# os.remove(db_file)
# # 初始数据:
# conn = sqlite3.connect(db_file)
# cursor = conn.cursor()
# cursor.execute('create table user( name va... | {
"repo_name": "starlightme/graduation_design",
"path": "database.py",
"copies": "1",
"size": "16411",
"license": "mit",
"hash": -8094137577780196000,
"line_mean": 43.9696132597,
"line_max": 400,
"alpha_frac": 0.5805024879,
"autogenerated": false,
"ratio": 3.2780910189287154,
"config_test": true... |
#!/bin/env python
#-*-coding:utf-8-*-
import pymssql
import string
import sys
import datetime
import time
reload(sys)
sys.setdefaultencoding('utf8')
import ConfigParser
def get_item(data_dict,item):
try:
item_value = data_dict[item]
return item_value
except:
pass
def get_variables(con... | {
"repo_name": "JK-Warriors/Heimdallr",
"path": "python/include/wl_sqlserver.py",
"copies": "1",
"size": "6425",
"license": "apache-2.0",
"hash": -5563692532671051000,
"line_mean": 25.1178861789,
"line_max": 196,
"alpha_frac": 0.5525291829,
"autogenerated": false,
"ratio": 3.6299435028248586,
"c... |
#!/bin/env python
# -*- coding: utf-8 -*-
import random
import time
from project.solvers import clarke_wright
class BinaryMCSCWSSolution(clarke_wright.ClarkeWrightSolution):
"""Solution class for a BinaryMCS-CWS algorithm"""
class BinaryMCSCWSSolver(clarke_wright.ClarkeWrightSolver):
"""BinaryMCS-CWS algori... | {
"repo_name": "RomuloOliveira/monte-carlo-cvrp",
"path": "project/solvers/binary_mcscws.py",
"copies": "1",
"size": "2482",
"license": "apache-2.0",
"hash": -3636629824667475000,
"line_mean": 29.6419753086,
"line_max": 88,
"alpha_frac": 0.5547945205,
"autogenerated": false,
"ratio": 4.14357262103... |
#!/bin/env python
# -*- coding: utf-8 -*-
import re
import math
from os import path
from project.models import CVRPData
class ParseException(Exception):
"""Exception raised when something unexpected occurs in a TSPLIB file parsing"""
def __init__(self, value):
self.value = value
def __str__(self... | {
"repo_name": "RomuloOliveira/monte-carlo-cvrp",
"path": "project/data_input.py",
"copies": "1",
"size": "8428",
"license": "apache-2.0",
"hash": -936490017798235900,
"line_mean": 26.1870967742,
"line_max": 120,
"alpha_frac": 0.5964641671,
"autogenerated": false,
"ratio": 3.7861635220125787,
"c... |
#!/bin/env python
# -*- coding: utf-8 -*-
import re
#返回英文单词列表
def list1(string):
words = re.findall(r'[a-zA-Z]+\b',string) #修改了正则表达式
return words
#从文件中读取数据
def file_read(filename):
with open(filename,'r') as fp:
article = fp.read()
return article
#计算出出现最多的单词
def most_word_number(word_list):
str_dict = {}... | {
"repo_name": "12wang3/python",
"path": "Jimmy66/0006/0006.py",
"copies": "34",
"size": "1206",
"license": "mit",
"hash": 8046268782651021000,
"line_mean": 22.825,
"line_max": 100,
"alpha_frac": 0.6207983193,
"autogenerated": false,
"ratio": 1.9468302658486707,
"config_test": false,
"has_no_k... |
#!/bin/env python
# -*- coding: utf-8 -*-
import requests
from project import app
from project.forms.person import PersonForm
from project.models.person import Persons
from flask import request, Response
def retrieve_person_info(facebook_id):
"""Retrieves a person info based on a facebook id
Information re... | {
"repo_name": "RomuloOliveira/facebook-user-info",
"path": "project/api/person.py",
"copies": "1",
"size": "3059",
"license": "mit",
"hash": 31223788808851830,
"line_mean": 25.1452991453,
"line_max": 82,
"alpha_frac": 0.5848316443,
"autogenerated": false,
"ratio": 4.150610583446404,
"config_tes... |
#!/bin/env python
#-*-coding:utf-8-*-
import string
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import ConfigParser
import logging
import logging.config
import smtplib
from email.mime.text import MIMEText
from email.message import Message
from email.header import Header
mail_host = "smtp.exmail.qq.com"
m... | {
"repo_name": "JK-Warriors/Heimdallr",
"path": "python/test/test_send_mail.py",
"copies": "1",
"size": "1669",
"license": "apache-2.0",
"hash": -267667184912766700,
"line_mean": 26.131147541,
"line_max": 78,
"alpha_frac": 0.5649546828,
"autogenerated": false,
"ratio": 3.232421875,
"config_test"... |
#!/bin/env python
#-*-coding:utf-8-*-
import string
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import ConfigParser
import logging
import logging.config
logging.config.fileConfig("etc/logger.ini")
logger = logging.getLogger("alert_main")
import smtplib
from email.mime.text import MIMEText
from email.messag... | {
"repo_name": "JK-Warriors/Heimdallr",
"path": "python/include/sendmail.py",
"copies": "1",
"size": "1543",
"license": "apache-2.0",
"hash": 8816726862367473000,
"line_mean": 27.8490566038,
"line_max": 73,
"alpha_frac": 0.6448659254,
"autogenerated": false,
"ratio": 3.045816733067729,
"config_t... |
#!/bin/env python
# -*- coding:utf-8 -*-
import subprocess
import os.path
try:
os.environ['VIRTUAL_ENV']
except KeyError:
print """############
## Attention
## Vous n'êtes pas dans le virtualenv,
## référez vous au fichier README.md pour plus d'informations
############"""
quit()
class PipManager:
de... | {
"repo_name": "feuloren/b3m-distrib-server",
"path": "update_virtualenv.py",
"copies": "1",
"size": "1561",
"license": "apache-2.0",
"hash": -5758810068167190000,
"line_mean": 28.8269230769,
"line_max": 90,
"alpha_frac": 0.5873629916,
"autogenerated": false,
"ratio": 3.5902777777777777,
"config... |
#! /bin/env python
# -*- coding: utf-8 -*-
import sys
import argparse
from harvester.couchdb_init import get_couchdb
from harvester.couchdb_sync_db_by_collection import delete_id_list
from harvester.post_processing.couchdb_runner import CouchDBCollectionFilter
def confirm_deletion(count, objChecksum, cid):
prompt... | {
"repo_name": "ucldc/harvester",
"path": "scripts/delete_couchdocs_by_obj_checksum.py",
"copies": "1",
"size": "3470",
"license": "bsd-3-clause",
"hash": 8173720680722310000,
"line_mean": 47.8591549296,
"line_max": 132,
"alpha_frac": 0.7212453157,
"autogenerated": false,
"ratio": 4.12976190476190... |
#! /bin/env python
# -*- coding: utf-8 -*-
import sys
import argparse
from harvester.couchdb_init import get_couchdb
from harvester.couchdb_sync_db_by_collection import delete_id_list
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='Delete all documents in given collection')
p... | {
"repo_name": "ucldc/harvester",
"path": "scripts/delete_couchdb_id_list.py",
"copies": "3",
"size": "2260",
"license": "bsd-3-clause",
"hash": -963414009621068500,
"line_mean": 50.3409090909,
"line_max": 77,
"alpha_frac": 0.7534307216,
"autogenerated": false,
"ratio": 4.183333333333334,
"confi... |
#!/bin/env python
# -*- coding: utf-8 -*-
# import sys
# import imp
# imp.reload(sys)
import numpy as np
import matplotlib
matplotlib.use("WXAgg")
# from matplotlib.backends import backend_wxagg
# from matplotlib.figure import Figure
import matplotlib.pyplot as plt
def autolabel(rects):
for rect i... | {
"repo_name": "starlightme/graduation_design",
"path": "figure.py",
"copies": "1",
"size": "3484",
"license": "mit",
"hash": 3043725063290766300,
"line_mean": 22.067114094,
"line_max": 167,
"alpha_frac": 0.5779976717,
"autogenerated": false,
"ratio": 2.491660623640319,
"config_test": false,
"... |
#!/bin/env python
# -*- coding: utf-8 -*-
import sys
import time
from datetime import datetime
from sensor import TemperatureSensor
#import mosquitto
from Adafruit_BMP085 import BMP085
import paho.mqtt.client as mqtt
import schedule
host = '127.0.0.1'
sensor_topic_base = 'sensors/dlrgwgt'
sensor_topic = '%s/%%s/te... | {
"repo_name": "toke/dlrgwgt-sensor",
"path": "sensor2mqtt.py",
"copies": "1",
"size": "3975",
"license": "mit",
"hash": -2936619058908163600,
"line_mean": 29.8139534884,
"line_max": 178,
"alpha_frac": 0.600754717,
"autogenerated": false,
"ratio": 3.159777424483307,
"config_test": false,
"has_... |
#!/bin/env python
# -*- coding: utf-8 -*-
import sys
import time
from project import data_input, util
from project.solvers import clarke_wright, monte_carlo_savings, binary_mcscws
def usage():
print("python {} <tspblib_file> <vehicles_number> [<lambda_p>]".format(sys.argv[0]))
def main():
if len(sys.argv) <... | {
"repo_name": "RomuloOliveira/monte-carlo-cvrp",
"path": "run.py",
"copies": "1",
"size": "2084",
"license": "apache-2.0",
"hash": 8177633986077558000,
"line_mean": 27.5479452055,
"line_max": 102,
"alpha_frac": 0.6266794626,
"autogenerated": false,
"ratio": 3.562393162393162,
"config_test": fal... |
#!/bin/env/python
# coding: utf-8
import time
from random import randrange
from FancyLogger import FancyLogger, TaskProgress
class App(object):
@classmethod
def example(cls):
# Different configurations for demo
# logger = FancyLogger(permanent_progressbar_slots=5)
# logger = Fancy... | {
"repo_name": "peepall/FancyLogger",
"path": "examples/example.py",
"copies": "1",
"size": "2754",
"license": "mit",
"hash": 3419349416054360000,
"line_mean": 33,
"line_max": 86,
"alpha_frac": 0.4767610748,
"autogenerated": false,
"ratio": 4.659898477157361,
"config_test": false,
"has_no_keyw... |
#!/bin/env python
#coding=utf-8
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
import tornado.gen
import tornado.httpclient
import tornado.concurrent
import tornado.ioloop
import time
def test(t, callback=None, **kwargs):
future = tornado.concurrent.Future()
return ... | {
"repo_name": "dongweiming/speakerdeck",
"path": "tornado/3_asynchronous_coroutine_sleep.py",
"copies": "1",
"size": "1177",
"license": "apache-2.0",
"hash": 1620950768356426000,
"line_mean": 27.975,
"line_max": 93,
"alpha_frac": 0.7187230371,
"autogenerated": false,
"ratio": 3.501510574018127,
... |
#!/bin/env python
# -*- coding : utf-8 -*-
import xlrd
#也可以以后尝试直接继承xlrd类
class excel(object):
"""a class for excel processing"""
#初始化,并解析Excel,生成对象
def __init__(self, filename):
super().__init__()
self.filename = filename + '.xls'
self.data = xlrd.open_workbook(self.filename)... | {
"repo_name": "starlightme/graduation_design",
"path": "Excel.py",
"copies": "1",
"size": "1220",
"license": "mit",
"hash": -4619103288000124000,
"line_mean": 27.7027027027,
"line_max": 85,
"alpha_frac": 0.5649717514,
"autogenerated": false,
"ratio": 2.447004608294931,
"config_test": false,
"... |
#!/bin/env python
# coding=utf-8
"""
Ingest data from the command-line.
' '.join(['{}_{}'.format(x, y) for x in range(138, 140+1) for y in range(-31, -33-1, -1)])
138_-31 138_-32 138_-33 139_-31 139_-32 139_-33 140_-31 140_-32 140_-33
for i in 138_-031 138_-032 138_-033 139_-031 139_-032 139_-033 140_-031 140_-032 ... | {
"repo_name": "omad/damootils",
"path": "scripts/oldwofs_prepare.py",
"copies": "1",
"size": "6160",
"license": "apache-2.0",
"hash": -8898929725711523000,
"line_mean": 35.0233918129,
"line_max": 109,
"alpha_frac": 0.4337662338,
"autogenerated": false,
"ratio": 4.190476190476191,
"config_test":... |
#!/bin/env python
# -*- coding: utf-8 -*-
level_1 = [
"+-------+------------+",
"| | |",
"+-----+ | -----+ |",
"| | | |",
"| | +------+ | |",
"| | | T | |",
"| +---- +---+ |",
"| | |",
"+ --- +------------... | {
"repo_name": "guigui528/labyrinthe",
"path": "labyrinthe.py",
"copies": "1",
"size": "1491",
"license": "apache-2.0",
"hash": 4583589289797485000,
"line_mean": 24.6896551724,
"line_max": 66,
"alpha_frac": 0.322147651,
"autogenerated": false,
"ratio": 2.974051896207585,
"config_test": false,
... |
#!/bin/env python
# -*- coding: utf-8 -*-
#
# Merge Glottolog tree and WALS languages
#
import sys
import os
import codecs
import re
from cPickle import load, dump
from argparse import ArgumentParser
from newick_tree import Node
sys.path.insert(1, os.path.join(sys.path[0], os.path.pardir))
from json_utils import load... | {
"repo_name": "murawaki/comp-typology",
"path": "scripts/glottolog/merge.py",
"copies": "1",
"size": "6255",
"license": "bsd-3-clause",
"hash": 8245372995277346000,
"line_mean": 36.4550898204,
"line_max": 166,
"alpha_frac": 0.5424460432,
"autogenerated": false,
"ratio": 3.701183431952663,
"conf... |
#! /bin/env python
# -*- coding: utf-8 -*-
"""
A little script to download images from 'http://girl-atlas.com/'
Written for fun by Reverland(lhtlyy@gmail.com)
Free to use and with no warranty, BSD License.
"""
from gevent import monkey
monkey.patch_all()
import requests
#import urllib
import os
#import urllib2
import... | {
"repo_name": "reverland/scripts",
"path": "python/girl-atlas.py",
"copies": "2",
"size": "3803",
"license": "mit",
"hash": -8383382006842841000,
"line_mean": 31.5042735043,
"line_max": 133,
"alpha_frac": 0.5905863792,
"autogenerated": false,
"ratio": 3.309834638816362,
"config_test": false,
... |
#! /bin/env python
# -*- coding: utf-8 -*-
'''
A python script to visualize your social network of renren.
Inspired by:
http://www.voidspace.org.uk/python/articles/urllib2.shtml
http://www.voidspace.org.uk/python/articles/cookielib.shtml
http://blog.csdn.net/lkkang/article/details/7362888
http://cos.na... | {
"repo_name": "reverland/scripts",
"path": "python/renren.py",
"copies": "1",
"size": "5442",
"license": "mit",
"hash": 6703794825855324000,
"line_mean": 31.7831325301,
"line_max": 189,
"alpha_frac": 0.6122748989,
"autogenerated": false,
"ratio": 3.350985221674877,
"config_test": false,
"has_... |
#! /bin/env python
# -*- coding: utf-8 -*-
'''
A script to download all photos of specific user in Renren.
all photos will be downloaded in current working directory, documented with album names.
will not download `手机相册` and `头像相册` now, Maybe I'll add `手机相册` later maybe not.
NOTICE: all albums with the same name will ... | {
"repo_name": "reverland/scripts",
"path": "python/getphotos.py",
"copies": "1",
"size": "2751",
"license": "mit",
"hash": 8769277635545944000,
"line_mean": 31.0823529412,
"line_max": 146,
"alpha_frac": 0.6255958929,
"autogenerated": false,
"ratio": 3.325609756097561,
"config_test": false,
"h... |
#! /bin/env python
# -*- coding: utf-8 -*-
"""
a script to download 评书 from www.5tps.com
changelog:
v0.1 initial, search api
v0.2 warning updates pingshu
v0.3 fix not right parser -郭德纲
v0.4 fix for search url change, search results turn page won't fix.
"""
__version__ = '0.4'
__author__ = 'Liu Yuyang... | {
"repo_name": "reverland/scripts",
"path": "python/5tps.py",
"copies": "1",
"size": "5630",
"license": "mit",
"hash": 4711325099645459000,
"line_mean": 29.7573964497,
"line_max": 101,
"alpha_frac": 0.4728741824,
"autogenerated": false,
"ratio": 2.99251583189407,
"config_test": false,
"has_no_... |
#!/bin/env/python
# coding: utf-8
class ProcessCommand(object):
"""
Defines a command to be dispatched from a working process to the logger process.
"""
def __init__(self):
super(ProcessCommand, self).__init__()
pass
class FlushCommand(ProcessCommand):
"""
Calls to flush the... | {
"repo_name": "peepall/FancyLogger",
"path": "FancyLogger/commands/__init__.py",
"copies": "1",
"size": "8794",
"license": "mit",
"hash": -6697843680578063000,
"line_mean": 43.4141414141,
"line_max": 119,
"alpha_frac": 0.5981350921,
"autogenerated": false,
"ratio": 5.124708624708624,
"config_te... |
#!/bin/env python
# coding: utf-8
"""
Dakara Online protocol generator, by Alejandro Santos
"""
from genpackets import *
from gendefs_js import *
BUILDERS = []
HANDLERS = []
DECODE_DISPATCH = []
ARGS_HANDLER = []
def write_packets_from(f, fph, base_name, namespace, P):
# Enum with IDs
if base_name != "Serv... | {
"repo_name": "horacioMartinez/dakara-client",
"path": "tools/protocol_generator/generator/gen_js.py",
"copies": "1",
"size": "13135",
"license": "mit",
"hash": 4932260081483926000,
"line_mean": 34.4070080863,
"line_max": 250,
"alpha_frac": 0.5295774648,
"autogenerated": false,
"ratio": 3.7625322... |
#!/bin/env python
#-*- coding: utf-8 -*-
"""
Demo script. Run:
python.exe demo.py
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import os
import re
logging.basicConfig()
from django.conf import settings, global_settings
from django.conf.urls import patterns,... | {
"repo_name": "Kondou-ger/django-easy-pjax",
"path": "demo.py",
"copies": "1",
"size": "2449",
"license": "bsd-3-clause",
"hash": -1238682496251151400,
"line_mean": 27.476744186,
"line_max": 85,
"alpha_frac": 0.6263781135,
"autogenerated": false,
"ratio": 3.716236722306525,
"config_test": false... |
#!/bin/env python
# -*- coding: utf-8 -*-
"""
Demo script. Run:
python.exe demo.py
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import os
import django
from django.conf import settings
from django.conf.urls import url
from django.core.wsgi import get_wsgi_ap... | {
"repo_name": "nigma/django-request-id",
"path": "demo.py",
"copies": "1",
"size": "3354",
"license": "mit",
"hash": -3154394855072641500,
"line_mean": 26.2682926829,
"line_max": 111,
"alpha_frac": 0.5351818724,
"autogenerated": false,
"ratio": 4.176836861768368,
"config_test": false,
"has_no... |
#!/bin/env python
# coding=utf-8
"""
Demo script. Run:
python.exe demo.py
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import os
logging.basicConfig(level=logging.DEBUG)
from django.conf import settings
from django.conf.urls import url
from django.core.wsgi... | {
"repo_name": "nigma/django-easy-pdf",
"path": "demo.py",
"copies": "1",
"size": "2085",
"license": "mit",
"hash": -5163785687794554000,
"line_mean": 23.8214285714,
"line_max": 82,
"alpha_frac": 0.5721822542,
"autogenerated": false,
"ratio": 3.8539741219963033,
"config_test": false,
"has_no_k... |
#!/bin/env python
#-*- coding: utf-8 -*-
"""
Demo script. Run:
python.exe demo.py
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import logging
logging.basicConfig()
from django.conf import settings
from django.conf.urls import patterns, url, include
from django.c... | {
"repo_name": "nigma/django-session-activity",
"path": "demo.py",
"copies": "2",
"size": "2366",
"license": "mit",
"hash": -5465039041425873000,
"line_mean": 27.5060240964,
"line_max": 82,
"alpha_frac": 0.6200338123,
"autogenerated": false,
"ratio": 3.976470588235294,
"config_test": false,
"h... |
#!/bin/env python
# -*- coding: utf-8 -*-
"""
Demo script. Run:
python.exe demo.py
Note: this demo requires Django 1.9 or higher
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import os
logging.basicConfig()
from django.conf import settings
from django.conf.... | {
"repo_name": "nigma/django-easy-pjax",
"path": "demo.py",
"copies": "1",
"size": "2717",
"license": "bsd-3-clause",
"hash": -96661094230478910,
"line_mean": 27.3020833333,
"line_max": 82,
"alpha_frac": 0.5903570114,
"autogenerated": false,
"ratio": 3.903735632183908,
"config_test": false,
"h... |
#!/bin/env/python
# -*- coding: utf-8 -*-
"""
===============================================================================
Extract Training Data
===============================================================================
author=hal112358
"""
from __future__ import print_function
import numpy as np
import zipfile... | {
"repo_name": "hal112358/clark_aerospace",
"path": "skynet/setup/extract_training_data.py",
"copies": "1",
"size": "1147",
"license": "mit",
"hash": -2376857383174180000,
"line_mean": 27,
"line_max": 79,
"alpha_frac": 0.5527462947,
"autogenerated": false,
"ratio": 3.151098901098901,
"config_tes... |
import re
TWO_BASE_PART = 2
THREE_BASE_PART = 3
def fetch_cmd_patterns(pattern, pattern_file, pattern_sep):
multi_cmd_patterns = []
key_patterns = []
if pattern:
patterns = _fetch_one_pattern(pattern, pattern_sep)
key_patterns.append(patterns[1])
multi_cmd_patterns.append(pattern... | {
"repo_name": "chosen0ne/redis-aof-modifier",
"path": "utils.py",
"copies": "1",
"size": "3560",
"license": "apache-2.0",
"hash": -6251909740602165000,
"line_mean": 25.3703703704,
"line_max": 78,
"alpha_frac": 0.5592696629,
"autogenerated": false,
"ratio": 3.3937082936129648,
"config_test": fal... |
#!/bin/env python
# -*- coding: utf-8 -*-
import httplib, urllib
# config parameters
'''
About ISP
0: 教育网出口(国内)
1: 电信网出口(国际,到教育网走教育网)
2: 联通网出口(国际,到教育网走教育网)
3: 电信网出口2(国际,到教育网免费地址走教育网)
4: 联通网出口2(国际,到教育网免费地址走教育网)
5: 电信网出口3(国际,到教育网走教育网,到联通走联通)
6: 联通网出口3(国际,到教育网走教育网,到电信走电信)
7: 教育网国际出口(国际,临时使用,解决近期国际访问问题)
About Time
动态: ... | {
"repo_name": "lhrkkk/yadr",
"path": "mybin/wlt.py",
"copies": "1",
"size": "1922",
"license": "bsd-2-clause",
"hash": 345183136213238340,
"line_mean": 23.4545454545,
"line_max": 123,
"alpha_frac": 0.5861214374,
"autogenerated": false,
"ratio": 2.077220077220077,
"config_test": false,
"has_no... |
#!/bin/env python
# -*- coding: utf8 -*-
import json
import urllib
import urllib2
import os
import argparse
import logging
import sys
from cgi import escape
from key import KEY
parser = argparse.ArgumentParser()
parser.add_argument('-s', '--separador',
help='Separador de campos. TAB por defecto.'... | {
"repo_name": "ralgozino/utils",
"path": "imgsearch.py",
"copies": "1",
"size": "8404",
"license": "mit",
"hash": -6701936094699014000,
"line_mean": 39.3653846154,
"line_max": 273,
"alpha_frac": 0.5314435445,
"autogenerated": false,
"ratio": 3.5531104528142192,
"config_test": false,
"has_no_k... |
#!/bin/env python
# -*- coding: utf-8 -*-
import logging
import logging.handlers
import logging.config
logging.config.fileConfig('logging.ini')
log = logging.getLogger(__name__)
import xml.etree.ElementTree as ET
from flask import Flask, request, render_template
from private_const import APP_SECRET_KEY, DOUBAN_A... | {
"repo_name": "mabotech/maboss.py",
"path": "maboss/webx/addons/mobility/app01.py",
"copies": "1",
"size": "1556",
"license": "mit",
"hash": 6370254302123659000,
"line_mean": 19.8985507246,
"line_max": 55,
"alpha_frac": 0.6386962552,
"autogenerated": false,
"ratio": 2.942857142857143,
"config_t... |
#!/bin/env python
# -*- coding: utf-8 -*-
import os
import logging
from pprint import pprint
import tornado.ioloop
import tornado.web
import tornado.escape
import tornado.options
from tornado.options import(define, options)
from jinja2 import Environment, FileSystemLoader
from sqlalchemy import create_engine
from ... | {
"repo_name": "ymkjp/pytalki",
"path": "app.py",
"copies": "1",
"size": "3566",
"license": "mit",
"hash": 5525349877851646000,
"line_mean": 31.7155963303,
"line_max": 119,
"alpha_frac": 0.6416152552,
"autogenerated": false,
"ratio": 3.880304678998912,
"config_test": false,
"has_no_keywords": ... |
#!/bin/env python
# -*- coding : utf-8 -*-
import requests,re
username = ''
password = ''
login_url = 'https://v2ex.com/signin'
home_url = 'https://www.v2ex.com'
mission_url = 'https://www.v2ex.com/mission/daily'
UA = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) ... | {
"repo_name": "starlightme/v2ex-daily-sgin-in",
"path": "v2ex.py",
"copies": "1",
"size": "1312",
"license": "apache-2.0",
"hash": -7328432618134521000,
"line_mean": 25.7755102041,
"line_max": 127,
"alpha_frac": 0.6021341463,
"autogenerated": false,
"ratio": 2.6083499005964215,
"config_test": f... |
#!/bin/env python
#-*- coding:utf-8 -*-
"""
"""
# import the logging library
from __future__ import unicode_literals
import logging
#from django.contrib.auth.models import User
from django.template.defaultfilters import slugify
from django.db.models.signals import pre_save
from django.dispatch import receiver
from dja... | {
"repo_name": "rangertaha/salt-manager",
"path": "salt-manager/webapp/apps/activity/models.py",
"copies": "5",
"size": "1718",
"license": "mit",
"hash": 515108214379966300,
"line_mean": 31.4150943396,
"line_max": 101,
"alpha_frac": 0.7159487776,
"autogenerated": false,
"ratio": 3.6631130063965887... |
#!/bin/env python
#-*- coding:utf-8 -*-
"""
"""
# import the logging library
import logging
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.core.urlresolvers import reverse_lazy
from d... | {
"repo_name": "rangertaha/salt-manager",
"path": "salt-manager/webapp/apps/graphs/views.py",
"copies": "6",
"size": "1835",
"license": "mit",
"hash": 1665920504411059000,
"line_mean": 25.9852941176,
"line_max": 105,
"alpha_frac": 0.6866485014,
"autogenerated": false,
"ratio": 3.946236559139785,
... |
# /**
# * @file bbb-api-py.py
# * @author alvayang <netyang@gmail.com>
# * @date Sat Oct 19 20:23:21 2013
# *
# * @brief Python Wrapper for BigBlueButton
# * Few Basic Functions
# *
# *
# */
'''
#How to Use it
BBBSALT = '7ae35909bf35d55ccaeeexe058141c8d'
BBBBASE = u'http://v.1in1.cn/bigblue... | {
"repo_name": "alvayang/bbb-api-py",
"path": "bbbapi/bbbapi.py",
"copies": "1",
"size": "5980",
"license": "mit",
"hash": -2731872268624476700,
"line_mean": 36.5189873418,
"line_max": 223,
"alpha_frac": 0.5742240216,
"autogenerated": false,
"ratio": 3.6502463054187193,
"config_test": false,
"... |
#! /bin/env python
# -*- coding: utf-8 -*-
'''
YAPMG -- Yet Another PhotoMosaic Generator written in Python
'''
import Image
import ImageOps
import os
import random
import ImageStat
import cPickle as p
__author__ = "Reverland (lhtlyy@gmail.com)"
def add_frame(image):
'''Add frame for image.'''
im = ImageO... | {
"repo_name": "reverland/scripts",
"path": "python/yapmg.py",
"copies": "1",
"size": "8447",
"license": "mit",
"hash": 7660564927936384000,
"line_mean": 33.1341463415,
"line_max": 142,
"alpha_frac": 0.5903298797,
"autogenerated": false,
"ratio": 3.2283737024221453,
"config_test": false,
"has_... |
"""
Script to turn image into css
"""
import Image
import sys
__author__ = "Reverland (lhtlyy@gmail.com)"
def getcss(im):
"""docstring for get"""
css = """position: absolute;
top: 30px;
left: 30px;
width: 0;
height: 0;
box-shadow:
"""
string = '%dpx %dpx 0px 1px rgb%s,\n'
... | {
"repo_name": "reverland/scripts",
"path": "python/image2css.py",
"copies": "1",
"size": "1154",
"license": "mit",
"hash": -4800436350872446000,
"line_mean": 20.3703703704,
"line_max": 61,
"alpha_frac": 0.506932409,
"autogenerated": false,
"ratio": 2.936386768447837,
"config_test": false,
"ha... |
"""
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)
Contains:
- wsgibase: the gluon wsgi application
"""
import gc
import cgi
import cStringIO
import Cookie
import os
import re
import copy
import sys
im... | {
"repo_name": "jefftc/changlab",
"path": "web2py/gluon/main.py",
"copies": "1",
"size": "32081",
"license": "mit",
"hash": -8256839057609678000,
"line_mean": 35.9596774194,
"line_max": 132,
"alpha_frac": 0.5197157196,
"autogenerated": false,
"ratio": 4.5941572390090215,
"config_test": false,
... |
"""
| 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)
gluon.rewrite parses incoming URLs and formats outgoing URLs for gluon.html.URL.
In addition, it rewrites both incoming and outgoing URLs based on... | {
"repo_name": "xiang12835/python_web",
"path": "py2_web2py/web2py/gluon/rewrite.py",
"copies": "1",
"size": "52912",
"license": "apache-2.0",
"hash": 894315893566142800,
"line_mean": 37.5375091042,
"line_max": 230,
"alpha_frac": 0.564484427,
"autogenerated": false,
"ratio": 4.02617562014914,
"c... |
"""
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)
gluon.rewrite parses incoming URLs and formats outgoing URLs for gluon.html.URL.
In addition, it rewrites both incoming and outgoing URLs based on the (... | {
"repo_name": "jyt109/termite-data-server",
"path": "web2py/gluon/rewrite.py",
"copies": "5",
"size": "52398",
"license": "bsd-3-clause",
"hash": 3571027880923218400,
"line_mean": 37.2746530314,
"line_max": 230,
"alpha_frac": 0.564563533,
"autogenerated": false,
"ratio": 4.016095654173373,
"con... |
"""
| 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)
gluon.rewrite parses incoming URLs and formats outgoing URLs for gluon.html.URL.
In addition, it rewrites both incoming and outgoing URLs based on... | {
"repo_name": "OpenTreeOfLife/germinator",
"path": "deploy/setup/web2py-patches/rewrite.py",
"copies": "1",
"size": "54068",
"license": "bsd-2-clause",
"hash": 6184141488503970000,
"line_mean": 37.8140703518,
"line_max": 230,
"alpha_frac": 0.5676185544,
"autogenerated": false,
"ratio": 4.01992565... |
"""
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)
gluon.rewrite parses incoming URLs and formats outgoing URLs for gluon.html.URL.
In addition, it rewrites both incoming and outgoing URLs based on the (... | {
"repo_name": "OpenTreeOfLife/opentree",
"path": "rewrite.py",
"copies": "1",
"size": "53585",
"license": "bsd-2-clause",
"hash": 6891826697497577000,
"line_mean": 37.5781137509,
"line_max": 230,
"alpha_frac": 0.567882803,
"autogenerated": false,
"ratio": 4.010553102312701,
"config_test": false... |
"""
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)
Thanks to ga2arch for help with IS_IN_DB and IS_NOT_IN_DB on GAE
"""
import os
import re
import datetime
import time
import cgi
import hmac
import urlli... | {
"repo_name": "stryder199/RyarkAssignments",
"path": "Assignment2/web2py/gluon/validators.py",
"copies": "1",
"size": "93561",
"license": "mit",
"hash": -7634568048272075000,
"line_mean": 31.5525400139,
"line_max": 258,
"alpha_frac": 0.5251293343,
"autogenerated": false,
"ratio": 3.72747918243754... |
"""
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)
Thanks to
* Niall Sweeny <niall.sweeny@fonjax.com> for MS SQL support
* Marcel Leuthi <mluethi@mlsystems.ch> for Oracle support
* Denes
*... | {
"repo_name": "marbdq/docdb",
"path": "dal.py",
"copies": "1",
"size": "271844",
"license": "mit",
"hash": 7239587441300486000,
"line_mean": 38.052434995,
"line_max": 207,
"alpha_frac": 0.5336921175,
"autogenerated": false,
"ratio": 4.040847875850997,
"config_test": false,
"has_no_keywords": ... |
"""
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)
Thanks to
* Niall Sweeny <niall.sweeny@fonjax.com> for MS SQL support
* Marcel Leuthi <mluethi@mlsystems.ch> for Oracle support
* Denes
* Chris Clark... | {
"repo_name": "tomholub/tooth",
"path": "tooth/web2py_dal.py",
"copies": "1",
"size": "362619",
"license": "bsd-3-clause",
"hash": -4232824928842405000,
"line_mean": 33.4040796964,
"line_max": 254,
"alpha_frac": 0.6567333758,
"autogenerated": false,
"ratio": 3.0801685254869318,
"config_test": f... |
"""
| 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)
The gluon wsgi application
---------------------------
"""
from __future__ import print_function
if False:
import import_all # DO NOT REMOVE ... | {
"repo_name": "xiang12835/python_web",
"path": "py2_web2py/web2py/gluon/main.py",
"copies": "1",
"size": "30134",
"license": "apache-2.0",
"hash": -4890312388960723000,
"line_mean": 36.9044025157,
"line_max": 117,
"alpha_frac": 0.5097896064,
"autogenerated": false,
"ratio": 4.733584668551681,
"... |
"""
| 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)
| Thanks to ga2arch for help with IS_IN_DB and IS_NOT_IN_DB on GAE
Validators
-----------
"""
import os
import re
import datetime
import time
impor... | {
"repo_name": "xiang12835/python_web",
"path": "py2_web2py/web2py/gluon/validators.py",
"copies": "1",
"size": "139260",
"license": "apache-2.0",
"hash": -2503429241142009000,
"line_mean": 35.6846680717,
"line_max": 261,
"alpha_frac": 0.5343650138,
"autogenerated": false,
"ratio": 3.6585397892966... |
"""
Turn images into acsii.
"""
__author__ = 'Reverland (lhtlyy@gmail.com)'
import Image
import ImageOps
import sys
filename = 'a.jpg'
def makeHTMLbox(body, fontsize, imagesize):
"""takes one long string of words and a width(px) then put them in an HTML box"""
boxStr = """<div style=\"font-size: %spx;lin... | {
"repo_name": "reverland/scripts",
"path": "python/i2a.py",
"copies": "1",
"size": "3489",
"license": "mit",
"hash": -616689830661173600,
"line_mean": 29.8660714286,
"line_max": 177,
"alpha_frac": 0.5426670524,
"autogenerated": false,
"ratio": 3.2923809523809524,
"config_test": false,
"has_no... |
#!/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
d = {}
for i in range(nrows):
... | {
"repo_name": "zhenglaizhang/python",
"path": "Jimmy66/0018/0018.py",
"copies": "34",
"size": "1313",
"license": "mit",
"hash": 6126334566947806000,
"line_mean": 23.2045454545,
"line_max": 93,
"alpha_frac": 0.6244131455,
"autogenerated": false,
"ratio": 2.080078125,
"config_test": false,
"has... |
#!/bin/env python
# -*- coding: utf-8 -*-
'''
Utilities to print file contents.
All functions have the call signature:
fun(filename, contents) -> filename, contents, continue
Whereas most functions don't use filename. This is simply a hack to give all
functions a unified API, which would normally be avoided by u... | {
"repo_name": "FullStackEmbedded/fse2016-python",
"path": "unit_tests/sort_utils/print_file_contents.py",
"copies": "1",
"size": "3240",
"license": "mit",
"hash": 1039020572465565300,
"line_mean": 28.1891891892,
"line_max": 77,
"alpha_frac": 0.5740740741,
"autogenerated": false,
"ratio": 4.246395... |
#!/bin/env python
# -*- coding: UTF-8 -*-
# OpenTag and CloseTag are NOT HARDENED against HTML injection!
# Do not use them for input that you cannot perfectly predict.
import re
inline_tags__ = set(["em", "strong", "sup", "sub"])
class OpenTag(object):
def __init__(self, tag, coalesce=False, attributes={}, self_c... | {
"repo_name": "HJLebbink/x86doc",
"path": "Python/htmltext.py",
"copies": "1",
"size": "4256",
"license": "mit",
"hash": -2230245147723445200,
"line_mean": 27.7567567568,
"line_max": 114,
"alpha_frac": 0.6195958647,
"autogenerated": false,
"ratio": 2.9596662030598053,
"config_test": false,
"h... |
# Process memory finder
# Copyright (c) 2009-2016, Mario Vilas
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# ... | {
"repo_name": "debasishm89/OpenXMolar",
"path": "ExtDepLibs/winappdbg/search.py",
"copies": "1",
"size": "23565",
"license": "bsd-3-clause",
"hash": -3666544962843863600,
"line_mean": 34.7045454545,
"line_max": 117,
"alpha_frac": 0.5562062381,
"autogenerated": false,
"ratio": 4.831863850727906,
... |
"""
productporter.product.views
~~~~~~~~~~~~~~~~~~~~~~~~~
product blueprint
:copyright: (c) 2014 by the ProductPorter Team.
:license: BSD, see LICENSE for more details.
"""
import datetime
import json
from flask import Blueprint, request, current_app, flash, redirect, \
url_for, jsonify, make_... | {
"repo_name": "kamidox/weixin_producthunt",
"path": "productporter/product/views.py",
"copies": "1",
"size": "9315",
"license": "bsd-2-clause",
"hash": 5976337440675028000,
"line_mean": 31.34375,
"line_max": 95,
"alpha_frac": 0.5982823403,
"autogenerated": false,
"ratio": 3.611865063978286,
"co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.