commit
stringlengths
40
40
subject
stringlengths
4
1.73k
repos
stringlengths
5
127k
old_file
stringlengths
2
751
new_file
stringlengths
2
751
new_contents
stringlengths
1
8.98k
old_contents
stringlengths
0
6.59k
license
stringclasses
13 values
lang
stringclasses
23 values
23c09555221b3f7500a4c658452c9c0cb223799c
Add evaluation using random forest
glrs/StackedDAE,glrs/StackedDAE
Train_SDAE/tools/evaluate_model.py
Train_SDAE/tools/evaluate_model.py
import numpy as np # import pandas as pd # import sys from scipy.special import expit from sklearn import ensemble def get_activations(exp_data, w, b): exp_data = np.transpose(exp_data) prod = exp_data.dot(w) prod_with_bias = prod + b return( expit(prod_with_bias) ) # Order of *args: first all the wei...
apache-2.0
Python
009df3372804fa946b7e1bd4c0827e887b964b38
Convert blogger to simple xml
progrn/csb
convert.py
convert.py
from bs4 import BeautifulSoup import io import markdown2 import time import codecs file = io.open("Import/blog-03-03-2013.xml") file_contents = file.read(-1) #lxml xpath doesn't seem to understand blogger export soup = BeautifulSoup(file_contents) entries = soup("entry") count = 0 def formatTime(timefield): tim...
mit
Python
8348ce87a68592e7108c43687ebfdf12684a1914
Add elementTypes.py file
mhogg/bonemapy
elementTypes.py
elementTypes.py
class elementC3D10(): def __init__(self): self.name = 'C3D10' self.desc = 'Quadratic tetrahedral element' self.numNodes = 10 self.numIntPnts = 4 self.N = array(self.numNodes) self.setIpcs() def setIpcs(self): alpha = 0.177083333...
mit
Python
e789fb7246e7b926841f2d2912896fd0a0d14518
Create login_portal.py
Humoud/Kuniv-Portal-Login
login_portal.py
login_portal.py
from splinter import Browser print 'Starting...' browser = Browser('firefox') # using firefox browser.visit("http://portal.ku.edu.kw/sisapp/faces/login.jspx") browser.fill('username','xxxxx') # enter student ID browser.fill('password','yyyyy') # enter password browser.find_by_id('loginBtn').click() ...
mit
Python
82acd4827b2f3f426a6b97f474c54886758cfab7
add code to update fields
kadrlica/obztak
obztak/scratch/update-fields.py
obztak/scratch/update-fields.py
#!/usr/bin/env python """ Update survey fields """ __author__ = "Alex Drlica-Wagner" import copy import fitsio import numpy as np import pylab as plt import skymap from obztak.utils import fileio import obztak.delve from obztak.delve import DelveFieldArray import argparse parser = argparse.ArgumentParser(descriptio...
mit
Python
7d5dcaa0a72dbdd78e192f082bbdf261de1d8963
Delete occurrences of an element if it occurs more than n times
SelvorWhim/competitive,SelvorWhim/competitive,SelvorWhim/competitive,SelvorWhim/competitive
Codewars/DeleteOccurrencesOfElementOverNTimes.py
Codewars/DeleteOccurrencesOfElementOverNTimes.py
# implemented with list comprehension with side-effects and a global variable # there's a simpler way to do it with list appends that's probably no less efficient, since Python arrays are dynamic, but I wanted to try this out instead from collections import Counter c = Counter() # for use in list comprehensions with...
unlicense
Python
895570ad25b1475c1e9ce85a78f22f268dce8dec
Add visualization script
AquaBSD/libbuhlmann,AquaBSD/libbuhlmann,AquaBSD/libbuhlmann
tools/visoutput.py
tools/visoutput.py
#!/usr/bin/env python """ An animated image """ import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import Slider, Button import sys d_arr = [] t_arr = [] hs =[] width = 0.35 maxpressure = 0.0 for line in sys.stdin: toks = line.split(" ") t_arr.append(toks[0]) d_arr.append((float(toks...
isc
Python
1c4adbe07892d95ca6254dcc2e48e11eb2141fa7
Create pixelconversor.py
ornitorrincco/graphics,ornitorrincco/graphics,ornitorrincco/graphics
Art-2D/pixelconversor.py
Art-2D/pixelconversor.py
//This program rake a image an convert it in 2D pixel art.
bsd-2-clause
Python
096c8165ec2beacbc4897285b8fed439765d3e01
Add test on update document title
AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core,AleksNeStu/ggrc-core
test/integration/ggrc/models/test_document.py
test/integration/ggrc/models/test_document.py
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Integration tests for Document""" from ggrc.models import all_models from integration.ggrc import TestCase from integration.ggrc.api_helper import Api from integration.ggrc.models import factories clas...
apache-2.0
Python
41752bfcbc0a1afdf7a0f3caa52285af08d131dd
Create get_var.py
ecoh70/Essential
get_var.py
get_var.py
import parse_expr variables = {} def getVar(key): if key[0] == '%': return variables[key[1:]] elif key[-1] in ('+', '-', '/', '*'): return parse_expr(key) else: return key
bsd-3-clause
Python
e42142498f2ef2b3e78d1becb024441500902a79
add corruptor
olcf/pcircle,olcf/pcircle,olcf/pcircle,olcf/pcircle,olcf/pcircle
test/corrupt.py
test/corrupt.py
#!/usr/bin/env python from __future__ import print_function import os import sys import random if len(sys.argv) != 3 and not sys.argv[2]: print(''' Usage: corrupt.py filename magic_string magic_string is what you want to write to the file it can not be empty and will be randomly placed \n\n''') ...
apache-2.0
Python
d2f18cc0992d4d7217583cd2601bc90afaa93a04
add grain that detects SSDs
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
salt/grains/ssds.py
salt/grains/ssds.py
# -*- coding: utf-8 -*- ''' Detect SSDs ''' import os import salt.utils import logging log = logging.getLogger(__name__) def ssds(): ''' Return list of disk devices that are SSD (non-rotational) ''' SSDs = [] for subdir, dirs, files in os.walk('/sys/block'): for dir in dirs: ...
apache-2.0
Python
936c2327d6be9da48dfbef47c17167510e9c2262
Create bzip2.py
vadimkantorov/wigwam
wigs/bzip2.py
wigs/bzip2.py
class bzip2(Wig): tarball_uri = 'http://www.bzip.org/1.0.6/bzip2-$RELEASE_VERSION$.tar.gz' last_release_version = 'v1.0.6'
mit
Python
c2ca8328835d544440fd3b87813e2768ece58685
Add new package: audacious (#16121)
LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack
var/spack/repos/builtin/packages/audacious/package.py
var/spack/repos/builtin/packages/audacious/package.py
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Audacious(AutotoolsPackage): """A lightweight and versatile audio player.""" homepage...
lgpl-2.1
Python
4287d2290c581b907b08efabc1e6bccea4019ac6
add new package (#15743)
LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack
var/spack/repos/builtin/packages/py-pyface/package.py
var/spack/repos/builtin/packages/py-pyface/package.py
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) class PyPyface(PythonPackage): """The pyface project contains a toolkit-independent GUI abstraction layer, which ...
lgpl-2.1
Python
be0033ac91c28f3e45eff34c84b7da59d7fcefe2
add py-ranger package (#3258)
iulian787/spack,mfherbst/spack,EmreAtes/spack,lgarren/spack,LLNL/spack,matthiasdiener/spack,skosukhin/spack,skosukhin/spack,matthiasdiener/spack,matthiasdiener/spack,lgarren/spack,TheTimmy/spack,tmerrick1/spack,iulian787/spack,LLNL/spack,lgarren/spack,krafczyk/spack,matthiasdiener/spack,mfherbst/spack,krafczyk/spack,mf...
var/spack/repos/builtin/packages/py-ranger/package.py
var/spack/repos/builtin/packages/py-ranger/package.py
############################################################################## # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
lgpl-2.1
Python
7e4a62aa483fbadc7089144191e48948f419903b
add setup.py
cloudbearings/vitess,mapbased/vitess,mapbased/vitess,AndyDiamondstein/vitess,kuipertan/vitess,enisoc/vitess,mapbased/vitess,cloudbearings/vitess,fengshao0907/vitess,erzel/vitess,atyenoria/vitess,anusornc/vitess,apmichaud/vitess-apm,AndyDiamondstein/vitess,dumbunny/vitess,anusornc/vitess,guokeno0/vitess,dumbunny/vitess,...
py/setup.py
py/setup.py
#!/usr/bin/env python # vim: set fileencoding=utf8 shiftwidth=4 tabstop=4 textwidth=80 foldmethod=marker : # Copyright (c) 2010, Kou Man Tong. All rights reserved. # For licensing, see LICENSE file included in the package. from distutils.core import setup setup(name = "vtdb", packages=["vtdb", "net"], platforms =...
apache-2.0
Python
a8f1529f6c077c0d70ccb326da6e63f3dd78ec76
move kernel sanitization to separate script
rice-solar-physics/hot_plasma_single_nanoflares,rice-solar-physics/hot_plasma_single_nanoflares,rice-solar-physics/hot_plasma_single_nanoflares
sanitize_kernels.py
sanitize_kernels.py
import glob import nbformat #sanitize kernelspec notebooks = glob.glob("notebooks/*.ipynb") old_envs = {} for nb in notebooks: tmp = nbformat.read(nb,4) old_envs[nb] = tmp['metadata']['kernelspec']['name'] tmp['metadata']['kernelspec']['name'] = 'python2' nbformat.write(tmp,nb) #revert kernelspec #for...
bsd-2-clause
Python
9b4f18dbf63a76bd2c0723677fb0d0215831324a
Create __init__.py
gappleto97/Senior-Project
ext/__init__.py
ext/__init__.py
mit
Python
52e282b8c51c71db61cb0163df02caf2dce63b45
add pretty function repr extension
minrk/ipython_extensions,minrk/ipython_extensions,danielballan/ipython_extensions,NunoEdgarGub1/ipython_extensions,NunoEdgarGub1/ipython_extensions,minrk/ipython_extensions,danielballan/ipython_extensions,dekstop/ipython_extensions,dekstop/ipython_extensions,danielballan/ipython_extensions,dekstop/ipython_extensions,Nu...
extensions/pretty_func_repr.py
extensions/pretty_func_repr.py
""" Trigger pinfo (??) to compute text reprs of functions, etc. Requested by @katyhuff """ import types from IPython import get_ipython def pinfo_function(obj, p, cycle): """Call the same code as `foo?` to compute reprs of functions Parameters ---------- obj: The object being formatted...
bsd-3-clause
Python
48ee097349b4315b9f3c726b734aa20e878b2288
Add binary-numbers-small resource
uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged
csunplugged/resources/views/binary_cards_small.py
csunplugged/resources/views/binary_cards_small.py
"""Module for generating Binary Cards (Small) resource.""" import os.path from PIL import Image, ImageDraw, ImageFont from utils.retrieve_query_parameter import retrieve_query_parameter def resource_image(request, resource): """Create a image for Binary Cards (Small) resource. Args: request: HTTP re...
mit
Python
864bf2bb3bdb731d0725cc33891145f2a7da17d3
Add initialization functions for database connection
leaffan/pynhldb
db/common.py
db/common.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from contextlib import contextmanager from sqlalchemy import create_engine from sqlalchemy.orm.session import sessionmaker from sqlalchemy.schema import MetaData from sqlalchemy.ext.declarative import declarative_base from utils import get_connection_string_fr...
mit
Python
ba0e1d90f5f33ed63c56c2788873624731a7a0b5
add file
zlvb/regx
regxtest.py
regxtest.py
''' ((abc){4}) [1-5]{5} 5+ 5* 5? ''' EQUL = 1 COUNT = 2 ANY = 3 TREE = 4 class Node def __init__(self, ntype, parent = None): self.type = ntype self.c = None self.children = [] self.parent = parent class RegX: def __init__(self, regstr): self.curnode...
mit
Python
11380e7db081960757cbde2c4d2e69b695648782
Add routine to calculate density.
lauralwatkins/genhernquist
density.py
density.py
#!/usr/bin/env python # ----------------------------------------------------------------------------- # GENHERNQUIST.DENSITY # Laura L Watkins [lauralwatkins@gmail.com] # ----------------------------------------------------------------------------- def density(r, norm, rs, alpha, beta, gamma): """ Densit...
bsd-2-clause
Python
3fb3662e58e35ccb283074c1078e1c9e7aaf88ed
Add live test for session
jgillick/LendingClub,carlosnasillo/LendingClub,jgillick/LendingClub,carlosnasillo/LendingClub
LendingClub/tests/live_session_test.py
LendingClub/tests/live_session_test.py
#!/usr/bin/env python import sys import unittest import getpass from logger import TestLogger sys.path.insert(0, '.') sys.path.insert(0, '../') sys.path.insert(0, '../../') from LendingClub import session class LiveTestSession(unittest.TestCase): http = None session = None logger = None def setUp(...
mit
Python
9e4858e652fba57f767a9c6d921853a6487301bd
Add a test for the version string parsing code
twisted/epsilon
epsilon/test/test_version.py
epsilon/test/test_version.py
""" Tests for turning simple version strings into twisted.python.versions.Version objects. """ from epsilon import asTwistedVersion from twisted.trial.unittest import SynchronousTestCase class AsTwistedVersionTests(SynchronousTestCase): def test_simple(self): """ A simple version string can be tu...
mit
Python
dff8d43edd0e831605f1b1c3b2d261fcf05dca9a
Add wordpress guid replace script
greyia/misc
script/wordpress/guid.py
script/wordpress/guid.py
import MySQLdb import urlparse poe = "https://wordpress.wordpress" db = MySQLdb.connect(db="wordpress",user="",passwd="") c = db.cursor() sql = "SELECT ID,guid from wp_posts;" c.execute(sql) records = c.fetchall() for record in records: o = urlparse.urlparse(record[1]) url = poe + o.path if o.query: u...
mit
Python
c48ec87b3e1c672864fc8c5bfe1aa551c01846ee
add basic tcp server
mrtazz/admiral,mrtazz/admiral
Server.py
Server.py
""" File: Server.py Author: Daniel Schauenberg <schauend@informatik.uni-freiburg.de> Description: class for implementing a search engine web server """ import socket from operator import itemgetter class Webserver: """ class for implementing a web server, serving the inverted index search engine to the out...
mit
Python
94403aedd21947c30b5d8159fcd42288050afc3a
Create 6kyu_personalized_brand_list.py
Orange9000/Codewars,Orange9000/Codewars
Solutions/6kyu/6kyu_personalized_brand_list.py
Solutions/6kyu/6kyu_personalized_brand_list.py
from collections import OrderedDict def sorted_brands(history): poplr=OrderedDict() for i in history: try: poplr[i['brand']]+=1 except: poplr[i['brand']]=1 return sorted(poplr.keys(), key=lambda x: poplr[x], reverse=1)
mit
Python
48cac034e7b402e2d4b3cb52d2cae51b44928e0b
add Faster R-CNN
yuyu2172/chainercv,yuyu2172/chainercv,pfnet/chainercv,chainer/chainercv,chainer/chainercv
examples/faster_rcnn/eval.py
examples/faster_rcnn/eval.py
from __future__ import division import argparse import sys import time import chainer from chainer import iterators from chainercv.datasets import voc_detection_label_names from chainercv.datasets import VOCDetectionDataset from chainercv.evaluations import eval_detection_voc from chainercv.links import FasterRCNNVG...
mit
Python
874e2c35bb0aea38a1161d96b8af484a69336ea6
Add htpasswd.py to the contrib tree as it may be useful more generally than just for the Testing branch
rbaumg/trac,rbaumg/trac,rbaumg/trac,rbaumg/trac
contrib/htpasswd.py
contrib/htpasswd.py
#!/usr/bin/python """Replacement for htpasswd""" import os import random try: import crypt except ImportError: import fcrypt as crypt from optparse import OptionParser def salt(): """Returns a string of 2 randome letters""" # FIXME: Additional characters may be legal here. letters = 'abcdefghijkl...
bsd-3-clause
Python
88eb8887bd71702fbf0c5095d8c2d637876de4b8
Add the upload_file_test
seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase
examples/upload_file_test.py
examples/upload_file_test.py
from seleniumbase import BaseCase class FileUploadButtonTests(BaseCase): """ The main purpose of this is to test the self.choose_file() method. """ def test_file_upload_button(self): self.open("https://www.w3schools.com/jsref/tryit.asp" "?filename=tryjsref_fileupload_get") ...
mit
Python
a98ba6efa109383ecc1dfeb07691dc0a4a4e2a5b
Update migrations
hobarrera/django-afip,hobarrera/django-afip
django_afip/migrations/0002_auto_20150909_1837.py
django_afip/migrations/0002_auto_20150909_1837.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('afip', '0001_initial'), ] operations = [ migrations.AlterField( model_name='tax', name='amount', ...
isc
Python
9668580633a1a8baaa59030e5a52d2478222cbd2
Add cost tracking file to openstack
opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor
nodeconductor/openstack/cost_tracking.py
nodeconductor/openstack/cost_tracking.py
from . import models from nodeconductor.cost_tracking import CostTrackingBackend class OpenStackCostTrackingBackend(CostTrackingBackend): @classmethod def get_monthly_cost_estimate(cls, resource): backend = resource.get_backend() return backend.get_monthly_cost_estimate()
mit
Python
2dfa68eb458cfc7d6166ede8a222b1d11b9577a0
Create grabscreen.py
Sentdex/pygta5
grabscreen.py
grabscreen.py
# Done by Frannecklp import cv2 import numpy as np import win32gui, win32ui, win32con, win32api def grab_screen(region=None): hwin = win32gui.GetDesktopWindow() if region: left,top,x2,y2 = region width = x2 - left + 1 height = y2 - top + 1 else: width = win32a...
mit
Python
0486e02bbaefea63a2dff9983be51623a184dc66
test python interpreter
google-code-export/los-cocos,google-code-export/los-cocos
test/test_interpreter_layer.py
test/test_interpreter_layer.py
# This code is so you can run the samples without installing the package import sys import os sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) # import cocos from cocos.director import director import pyglet if __name__ == "__main__": director.init() interpreter_layer = cocos.layer....
bsd-3-clause
Python
76baf574ba5a4ff9e835412e27fd2ebc634a9992
add Cython register test
jck/pymtl,Glyfina-Fernando/pymtl,tj93/pymtl,tj93/pymtl,12yujim/pymtl,cornell-brg/pymtl,jjffryan/pymtl,12yujim/pymtl,tj93/pymtl,12yujim/pymtl,Glyfina-Fernando/pymtl,cfelton/pymtl,jjffryan/pymtl,cfelton/pymtl,jjffryan/pymtl,jck/pymtl,cornell-brg/pymtl,jck/pymtl,Glyfina-Fernando/pymtl,cfelton/pymtl,cornell-brg/pymtl
new_pymtl/translation_tools/verilator_sim_test.py
new_pymtl/translation_tools/verilator_sim_test.py
from verilator_sim import get_verilated from new_pmlib.regs import Reg from new_pymtl import SimulationTool def test_reg(): model = Reg(16) print "BEGIN" vmodel = get_verilated( model ) print "END" vmodel.elaborate() sim = SimulationTool( vmodel ) sim.reset() assert vmodel.out == 0 vmodel...
bsd-3-clause
Python
214aa96b5e816ad6386fc20fed684152ac8181d1
add migration for ip to generic ip field change
byteweaver/django-newsletters
newsletters/migrations/0003_auto_20150701_1840.py
newsletters/migrations/0003_auto_20150701_1840.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('newsletters', '0002_auto_20150630_0009'), ] operations = [ migrations.AlterField( model_name='subscription', ...
bsd-3-clause
Python
f90a9e585b5de36b3abc11cf454cde75a44a1a6b
Include Overlay Utils
MarvinTeichmann/KittiSeg
evaluation/overlay_utils.py
evaluation/overlay_utils.py
#!/usr/bin/env python """Utility functions for segmentation tasks.""" from PIL import Image import scipy.ndimage import numpy as np def replace_colors(segmentation, color_changes): """ Replace the values in segmentation to the values defined in color_changes. Parameters ---------- segmentation ...
mit
Python
c37452e7cd4401bd7cbb8e855af65c26d730187c
add web_utl for crawler
PegasusWang/wechannel,PegasusWang/wechannel,PegasusWang/wechannel,PegasusWang/wechannel
crawler/web_util.py
crawler/web_util.py
#!/usr/bin/env python # -*- coding:utf-8 -*- """ chrome有个功能,对于请求可以直接右键copy as curl,然后在命令行里边用curl 模拟发送请求。现在需要把此curl字符串处理成requests库可以传入的参数格式, http://stackoverflow.com/questions/23118249/whats-the-difference-between-request-payload-vs-form-data-as-seen-in-chrome """ import re from functools import wraps import traceback...
mit
Python
a12dd320df30404df8c8ec196e21067376cc1e2c
Add tests of table and column pickling
mhvk/astropy,astropy/astropy,astropy/astropy,larrybradley/astropy,funbaker/astropy,joergdietrich/astropy,joergdietrich/astropy,dhomeier/astropy,larrybradley/astropy,pllim/astropy,MSeifert04/astropy,pllim/astropy,dhomeier/astropy,StuartLittlefair/astropy,tbabej/astropy,lpsinger/astropy,saimn/astropy,tbabej/astropy,dhome...
astropy/table/tests/test_pickle.py
astropy/table/tests/test_pickle.py
import cPickle as pickle import numpy as np import pytest from ...table import Table, Column, MaskedColumn @pytest.fixture(params=[0, 1, -1]) def protocol(request): """ Fixture to run all the tests for protocols 0 and 1, and -1 (most advanced). """ return request.param def test_pickle_column(proto...
bsd-3-clause
Python
fb5f6b5db2e2701692dd0a35dfad36d7b6dd4f2d
Create example file
josuemontano/blender_wrapper
example.py
example.py
from blender_wrapper.api import Scene from blender_wrapper.api import Camera from blender_wrapper.api import SunLamp from blender_wrapper.api import ORIGIN def main(): scene = Scene(1500, 1000, filepath="~/Desktop/") scene.setup() camera = Camera((1, 0, 1), (90, 0, 0), view_align=True) camera.add_to_...
mit
Python
62032986f4e57c85f842c16fdb916b0a19bdbd0e
Create _webui.py
flipchan/LayerProx,flipchan/LayerProx,flipchan/LayerProx,flipchan/LayerProx
marionette_tg/plugins/_webui.py
marionette_tg/plugins/_webui.py
import flask import gnupg, base64 #https://gist.github.com/dustismo/6203329 / apt-get install libleveldb1 libleveldb-dev && pip install plyvel #import plyvel #leveldb, very fast, you can even run the database in ram if you want #import MySQLdb #if you want mysql from os import urandom from base64 import b64decode impor...
apache-2.0
Python
68e16ca50bec3802184e098548aa2c2584c352b2
Add main example code
nparley/signal_decorator
signal_decorator.py
signal_decorator.py
#!/usr/bin/python __author__ = 'Neil Parley' from functools import wraps import signal import sys def catch_sig(f): """ Adds the signal handling as a decorator, define the signals and functions that handle them. Then wrap the functions with your decorator. :param f: Function :return: Function wra...
mit
Python
950bdd0f528fc61175c39dc2ade6abb9d46d767a
Change plan on book
phildini/logtacts,phildini/logtacts,phildini/logtacts,phildini/logtacts,phildini/logtacts
contacts/migrations/0027_auto_20170106_0627.py
contacts/migrations/0027_auto_20170106_0627.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.11 on 2017-01-06 06:27 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('contacts', '0026_auto_20161231_2045'), ] operations = [ migrations.AlterFie...
mit
Python
97c87237de87c91d66a92c1cacc362a7b831b8ef
add script to install python modules with pip
nateGeorge/IDmyDog,nateGeorge/IDmyDog,nateGeorge/IDmyDog
install_py_modules.py
install_py_modules.py
# this will install most necessary packages for this project # that you may not already have on your system import pip def install(package): pip.main(['install', package]) # Example if __name__ == '__main__': # for scraping akc.org for a list of breed names and pics install('Scrapy') # for calculatin...
mit
Python
98e822a78722e735b31817e74cc5e310fcb43c9a
add missed migration (HomeBanner verbose texts)
brasilcomvc/brasilcomvc,brasilcomvc/brasilcomvc,brasilcomvc/brasilcomvc
brasilcomvc/portal/migrations/0005_homebanner_verbose.py
brasilcomvc/portal/migrations/0005_homebanner_verbose.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('portal', '0004_homebanner_image_upload_to'), ] operations = [ migrations.AlterModelOptions( name='homebanner', ...
apache-2.0
Python
35310a8fa136b5b6e094401a8289f5eabeb28cbc
Create batterylevel.py
MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab
home/hairygael/batterylevel.py
home/hairygael/batterylevel.py
def batterylevel(): power_now = subprocess.call ("WMIC PATH Win32_Battery Get EstimatedChargeRemaining", "r".readline()) ANSWER = float(power_now) * 100 , "%" i01.mouth.speak(str(ANSWER))
apache-2.0
Python
c7851b61268848cf1b02d9e5c845a846ded4c2a7
Update __init__.py
r0h4n/node-agent,Tendrl/node_agent,r0h4n/node-agent,Tendrl/node-agent,Tendrl/node-agent,Tendrl/node-agent,r0h4n/node-agent,Tendrl/node_agent
tendrl/node_agent/objects/cluster_message/__init__.py
tendrl/node_agent/objects/cluster_message/__init__.py
from tendrl.commons import etcdobj from tendrl.commons.message import Message as message from tendrl.commons import objects class ClusterMessage(objects.BaseObject, message): internal = True def __init__(self, **cluster_message): self._defs = {} message.__init__(self, **cluster_message) ...
from tendrl.commons import etcdobj from tendrl.commons.message import Message as message from tendrl.commons import objects class ClusterMessage(objects.BaseObject, message): internal = True def __init__(self, **cluster_message): self._defs = {} message.__init__(self, **cluster_message) ...
lgpl-2.1
Python
7fddacd1a751c095f70693bb703bb9959a706ae1
Add an example with end to end data
therve/nabu,therve/nabu
example.py
example.py
""" Example script for getting events over a Zaqar queue. To run: $ export IDENTITY_API_VERSION=3 $ source ~/devstack/openrc $ python example.py """ import json import os import uuid import requests import websocket from keystoneauth1.identity import v3 from keystoneauth1 import session client_id = str(uuid.uuid4(...
apache-2.0
Python
e1907624a143d0733cd89e5458d104ed0a4fee43
Add simple tasks
zkan/fabric-workshop,zkan/fabric-workshop
fabfile.py
fabfile.py
# Simple Tasks def hello(): print 'Hello ThaiPy!' def hi(name='Kan'): print 'Hi ' + name
mit
Python
50769229ce8ef4e84f345184b0aebf036bc0e179
add fabfile
cydev/web,cydev/web
fabfile.py
fabfile.py
from fabric.api import local, put, run, cd, sudo def status(): run("systemctl status web") def restart(): sudo("systemctl restart web") def deploy(): local('tar -czf cydev_web.tgz web static/') put("cydev_web.tgz", "~/cydev.ru") with cd("~/cydev.ru"): run("tar -xvf cydev_web.tgz") resta...
bsd-3-clause
Python
2af8c695c1463c080ce8c4bff7e3d81662a49c81
implement generic decorator and register function
hephs/dispatk
dispatk.py
dispatk.py
""" This function is inspired by singledispatch of Python 3.4+ (PEP 443), but the dispatch happens on the key extracted fro the arguments values. from dispatk import dispatk @dispatk(lambda n: int(n)) def fib(n): return fib(n-1) + fib(n-2) @fib.register(0) def _(n): return 0 @fib.register(1, 2) def _(n): ...
mit
Python
e823c55f62c8aa1d72ec3bf2b58288b3dd413561
Create radix_sort.py
TheAlgorithms/Python
sorts/radix_sort.py
sorts/radix_sort.py
def radixsort(lst): RADIX = 10 maxLength = False tmp , placement = -1, 1 while not maxLength: maxLength = True # declare and initialize buckets buckets = [list() for _ in range( RADIX )] # split lst between lists for i in lst: tmp = i / placement buckets[tmp % RADIX].append(...
mit
Python
2b810eb1900ca96c7fb2d8b63b70b7b0df8b9ed5
Create find_digits.py
costincaraivan/hackerrank,costincaraivan/hackerrank
algorithms/implementation/python3/find_digits.py
algorithms/implementation/python3/find_digits.py
#!/bin/python3 import sys t = int(input().strip()) for a0 in range(t): n = int(input().strip()) count = 0 digits = str(n) for digit in digits: if int(digit) != 0: if n % int(digit) == 0: count += 1 print(count)
mit
Python
c723865ae8013020f6f0a28cd41592c3dc900968
add a second test for process_dc_env.
devopscenter/dcUtils,devopscenter/dcUtils
tests/process_dc_env_test_2.py
tests/process_dc_env_test_2.py
#!/usr/bin/env python import sys import os import argparse # There is a PEP8 warning about this next line not being at the top of the file. # The better answer is to append the $dcUTILS/scripts directory to the sys.path # but I wanted to illustrate it here...so your mileage may vary how you want from process_dc_env imp...
apache-2.0
Python
51aefefc3cdcd131678e921a29b5acd5b9601b81
add a unit-tests that essentially import the the python python file in src/dynamic_graph/
stack-of-tasks/sot-core,stack-of-tasks/sot-core,stack-of-tasks/sot-core
tests/python/python_imports.py
tests/python/python_imports.py
#!/usr/bin/env python import unittest class PythonImportTest(unittest.TestCase): def test_math_small_entities(self): try: import dynamic_graph.sot.core.math_small_entities except ImportError as ie: self.fail(str(ie)) def test_feature_position_relative(self): ...
bsd-2-clause
Python
606118fa4c7b203d986f37d061777beb843b278b
add consistency checker
eoss-cloud/madxxx_catalog_api,eoss-cloud/madxxx_catalog_api
catalog/model/check_consistency.py
catalog/model/check_consistency.py
from toolz.curried import operator from api.eoss_api import Api from dateutil.parser import parse import datetime import requests, grequests import time import logging import click from utilities import chunks logger = logging.getLogger() def append_data(file, data): with open(file, "a") as myfile: fo...
mit
Python
f8067853546a9c25716aef6bc9f255591cb65626
Add migration to change the project results report URL
akvo/akvo-rsr,akvo/akvo-rsr,akvo/akvo-rsr,akvo/akvo-rsr
akvo/rsr/migrations/0125_auto_20180315_0829.py
akvo/rsr/migrations/0125_auto_20180315_0829.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations ORIGINAL_URL = '/en/reports/project_results/{project}?format={format}&download=true' NEW_URL = ORIGINAL_URL + '&p_StartDate={start_date}&p_EndDate={end_date}' REPORT_ID = 1 def add_start_end_dates_report_url(apps, schem...
agpl-3.0
Python
2aa0990746b71086b4c31ee81ac8874436c63e32
Add a few tests (close #4)
liviu-/crosslink-ml-hn
tests/test_crosslinking_bot.py
tests/test_crosslinking_bot.py
from datetime import datetime from datetime import date, timedelta import pytest from crosslinking_bot import crosslinking_bot as cb class TestParseDate: def test_return_today(self): today = datetime.today().date() assert 'today' == cb.parse_date(today) def test_return_1_day_ago(self): ...
mit
Python
3a178c100cbf64b8ab60954a9b9ea5a01640f842
Integrate LLVM at llvm/llvm-project@852d84e36ed7
paolodedios/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,yongtang/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow,tensorflow/tensorflow,paolodedios/tensorflow,karllessard/tensorflow,tensorflow/tensorflo...
third_party/llvm/workspace.bzl
third_party/llvm/workspace.bzl
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "852d84e36ed7a3db0ff4719f44a12b6bc09d35f3" LLVM_SHA256 = "3def20f54714c474910e5297b62639121116254e9e484ccee04eee6815b5d58c" tf_http_archive( ...
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "0128f8016770655fe7a40d3657f00853e6badb93" LLVM_SHA256 = "f90705c878399b7dccca9cf9b28d695a4c6f8a0e12f2701f7762265470fa6c22" tf_http_archive( ...
apache-2.0
Python
52f49543dd7bf01a2a24db435d8461b7c8921789
Integrate LLVM at llvm/llvm-project@9a764ffeb6f0
karllessard/tensorflow,Intel-tensorflow/tensorflow,yongtang/tensorflow,tensorflow/tensorflow,Intel-tensorflow/tensorflow,yongtang/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,yongtang/tensorflow,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/ten...
third_party/llvm/workspace.bzl
third_party/llvm/workspace.bzl
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "9a764ffeb6f06a87c7ad482ae39f8a38b3160c5e" LLVM_SHA256 = "8f000d6541d64876de8ded39bc140176c90b74c3961b9ca755b1fed44423c56b" tf_http_archive( ...
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "72136d8ba266eea6ce30fbc0e521c7b01a13b378" LLVM_SHA256 = "54d179116e7a79eb1fdf7819aad62b4d76bc0e15e8567871cae9b675f7dec5c1" tf_http_archive( ...
apache-2.0
Python
45254d35def51a5e8936fe649f8c3fc089cd4a6d
add `schemas.py`
kokimoribe/todo-api
todo/schemas.py
todo/schemas.py
"""Request/Response Schemas are defined here""" # pylint: disable=invalid-name from marshmallow import Schema, fields from marshmallow_enum import EnumField from todo.enums import Status class TaskSchema(Schema): """Schema for api.portal.models.Panel""" id = fields.Int(required=True) title = fields.Str(...
mit
Python
4f9660704445e6da62fc4e893d93fc84288303d4
Integrate LLVM at llvm/llvm-project@aec908f9b248
Intel-tensorflow/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow,paolodedios/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tens...
third_party/llvm/workspace.bzl
third_party/llvm/workspace.bzl
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "aec908f9b248b27cb44217081c54e2c00604dff7" LLVM_SHA256 = "c88b75b4d60b960c7da65b7bacfdf8c5cf4c7846ab85a334f1ff18a8b50f2d98" tf_http_archive( ...
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "5dcd6afa20881490b38f3d88c4e59b0b4ff33551" LLVM_SHA256 = "86f64f78ba3b6c7e8400fe7f5559b3dd110b9a4fd9bfe9e5ea8a4d27301580e0" tf_http_archive( ...
apache-2.0
Python
735dee2da41bf8df8519d516bd9b231ff440f5f9
Create globals.system module for Python & system related settings
AntumDeluge/desktop_recorder,AntumDeluge/desktop_recorder
source/globals/system.py
source/globals/system.py
# -*- coding: utf-8 -*- ## \package globals.system # MIT licensing # See: LICENSE.txt import sys PY_VER_MAJ = sys.version_info[0] PY_VER_MIN = sys.version_info[1] PY_VER_REL = sys.version_info[2] PY_VER_STRING = u'{}.{}.{}'.format(PY_VER_MAJ, PY_VER_MIN, PY_VER_REL)
mit
Python
b83b09f937f91a870165d88730a36faaee8a5261
add a parser of metadata
suyuan1203/pyrets
retsmeta.py
retsmeta.py
# -*- coding: utf-8 -*- from xml.etree import ElementTree class MetaParser(object): def GetResources(self): pass def GetRetsClass(self, resource): pass def GetTables(self, resource, rets_class): pass def GetLookUp(self, resource, rets_class): pass c...
mit
Python
bbb445b691f7370059c7bf9c94e2e9c6f4155273
update to latest
babelsberg/babelsberg-r,topazproject/topaz,babelsberg/babelsberg-r,topazproject/topaz,topazproject/topaz,babelsberg/babelsberg-r,babelsberg/babelsberg-r,topazproject/topaz,babelsberg/babelsberg-r
tasks/base.py
tasks/base.py
import os from invoke import run class BaseTest(object): def download_mspec(self): if not os.path.isdir("../mspec"): run("cd .. && git clone --depth=100 --quiet https://github.com/ruby/mspec") def download_rubyspec(self): if not os.path.isdir("../rubyspec"): run("cd ....
import os from invoke import run class BaseTest(object): def download_mspec(self): if not os.path.isdir("../mspec"): run("cd .. && git clone --depth=100 --quiet https://github.com/ruby/mspec") run("cd ../mspec && git checkout v1.6.0") def download_rubyspec(self): if n...
bsd-3-clause
Python
50843d6a2c93be4e05a0a2da338e4b0e0d99d294
Add tls proxy helper
jxaas/python-client
jujuxaas/tls_proxy.py
jujuxaas/tls_proxy.py
import copy import select import socket import ssl import sys import threading import logging logger = logging.getLogger(__name__) class TlsProxyConnection(object): def __init__(self, server, inbound_socket, inbound_address, outbound_address): self.server = server self.inbound_socket = inbound_socket se...
apache-2.0
Python
420c14d38fdddc3ed5d646a99c355b707be011fc
Add tests for ansible module
open-craft/opencraft,open-craft/opencraft,open-craft/opencraft,omarkhan/opencraft,omarkhan/opencraft,brousch/opencraft,brousch/opencraft,open-craft/opencraft,open-craft/opencraft,omarkhan/opencraft,omarkhan/opencraft,brousch/opencraft
instance/tests/test_ansible.py
instance/tests/test_ansible.py
# -*- coding: utf-8 -*- # # OpenCraft -- tools to aid developing and hosting free software projects # Copyright (C) 2015 OpenCraft <xavier@opencraft.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Soft...
agpl-3.0
Python
7d7fd5b167528654b9fed5b0c971c2b8110d93ea
Create wrapper_exploit.py
liorvh/pythonpentest,funkandwagnalls/pythonpentest,liorvh/pythonpentest,funkandwagnalls/pythonpentest,liorvh/pythonpentest,funkandwagnalls/pythonpentest
wrapper_exploit.py
wrapper_exploit.py
# Author: Chris Duffy # Date: May 2015 # Purpose: An sample exploit for testing UDP services import sys, socket, strut, subprocess program_name = 'C:\exploit_writing\vulnerable.exe' fill ="A"*#### eip = struct.pack('<I',0x########) offset = "\x90"*## available_shellcode_space = ### shell =() #Code to insert # NOPs to f...
bsd-3-clause
Python
ef24797a12e8a8919ddb11c7b6763154c5c3aad1
transform DR script to observe exceptions
fkuhn/dgd2cmdi
transform_DR.py
transform_DR.py
__author__ = 'kuhn' __author__ = 'kuhn' from batchxslt import processor from batchxslt import cmdiresource import codecs import os dgd_corpus = "/home/kuhn/Data/IDS/svn_rev1233/dgd2_data/metadata/corpora/extern" dgd_events = "/home/kuhn/Data/IDS/svn_rev1233/dgd2_data/metadata/events/extern" dgd_speakers = "/home/kuhn...
bsd-3-clause
Python
60b5228818c92f4d13b0a054956a5f834c7f7549
Implement remove.py
cryptonomex/graphene,oxarbitrage/bitshares-core,abitmore/bitshares-2,peertracksinc/muse,oxarbitrage/bitshares-core,bigoc/openchain,bitsuperlab/cpp-play2,cryptonomex/graphene,oxarbitrage/bitshares-core,peertracksinc/muse,bitsuperlab/cpp-play2,bitshares/bitshares-2,oxarbitrage/bitshares-core,bigoc/openchain,bitsuperlab/c...
programs/genesis_util/remove.py
programs/genesis_util/remove.py
#!/usr/bin/env python3 import argparse import json import sys def dump_json(obj, out, pretty): if pretty: json.dump(obj, out, indent=2, sort_keys=True) else: json.dump(obj, out, separators=(",", ":"), sort_keys=True) return def main(): parser = argparse.ArgumentParser(description="Rem...
mit
Python
6e43f611420068f0829fc64c1963ee51931b0099
change name of data.py
1orwell/yrs2013,1orwell/yrs2013
node-interactions.py
node-interactions.py
import operator from os import listdir from os.path import isfile, join import sys def get_dict_of_all_contacts(): datapath = 'flu-data/moteFiles' datafiles = [f for f in listdir(datapath) if isfile(join(datapath,f)) ] dict_of_all_contacts = dict() for datafile in datafiles: node_contacts = dic...
mit
Python
4b9925a429692175ad1e0a89859a67117cbba9fe
Create pirates_of_the_caribbean.py
CSavvy/python
extras/pirates_of_the_caribbean.py
extras/pirates_of_the_caribbean.py
#This makes the coding of the song easier def note(n): if n == 1:return 880 elif n == 2:return 987.77 elif n == 3:return 1046.5 elif n == 4:return 1174.66 elif n == 5:return 1318.51 elif n == 6:return 1396.91 elif n == 7:return 1567.98 elif n == 8:return 1760.00 elif n == 9:return 93...
mit
Python
f8afd9d77a61f2baae15fec841817b0f97e573f9
add redone twitterminal.py script
raehik/scripts,raehik/scripts
twitterminal.py
twitterminal.py
#!/usr/bin/env python3 # # Tweet from the shell. # # Requires the following pip packages: # * simplejson # * twitter (NOT python-twitter, aka Python Twitter Tools) # import sys, os, argparse, subprocess, logging # twitter requires a json module # simplejson is updated more and may be faster # see: http://stackove...
mit
Python
0c6becaa179aba9408def1b3cce61d5ec1509942
Load the simul module and run a simulation
cphyc/MHD_simulation,cphyc/MHD_simulation
python/main.py
python/main.py
from simul import * if __name__ == '__main__': # create a new simulation s = Simulation(Re=5) # initial conditions psi(0) = 0, Omega(0) = 0 s.psi.initial("null") s.omega.initial("null") # T_n(t=0) = sin(pi*k*dz) & T_0(t=0) = 1-k*dz s.T.initial(lambda n, k: T_0(n,k,s)) # main loop over...
apache-2.0
Python
90169095a9e1adbc23e1efa35ea0e1a9a09259de
Solve Code Fights sortByHeight problem
HKuz/Test_Code
Problems/sortByHeight.py
Problems/sortByHeight.py
#!/usr/local/bin/python # Code Fights Arcade Mode def sortByHeight(a): trees = [i for i, t in enumerate(a) if t == -1] humans = sorted([h for h in a if h != -1]) for tree in trees: humans.insert(tree, -1) return humans def main(): a = [-1, 150, 190, 170, -1, -1, 160, 180] new = sort...
mit
Python
5820a2b6130ea7be9eb86341aa6b3b69861a9a36
Create example.py
david-shu/lxml-mate
example.py
example.py
from lxmlmate import ObjectifiedElementProxy print("#To create a brand new xml:") p = ObjectifiedElementProxy( rootag='Person' ) p.name = 'peter' p.age = 13 print( p ) print(''' ##<Person> ## <name>peter</name> ## <age>13</age> ##</Person> ''') print('===================') print( p.name ) print(''' ##<n...
mit
Python
1a97d686ed5afd9a97083bc09f6c4bfb4ef124fc
Add quick helpers to get a client
ryansb/zaqar-webscraper-demo
helpers.py
helpers.py
from zaqarclient.queues import client import os conf = { 'auth_opts': { 'backend': 'keystone', 'options': { 'os_username': os.environ.get('OS_USERNAME'), 'os_password': os.environ.get('OS_PASSWORD'), 'os_project_name': os.environ.get('OS_PROJECT_NAME', 'admin'),...
mit
Python
7aee3720617aa3442245e2d0bf3de7393e4acb01
Add lc0133_clone_graph.py
bowen0701/algorithms_data_structures
lc0133_clone_graph.py
lc0133_clone_graph.py
"""Leetcode 133. Clone Graph Medium URL: https://leetcode.com/problems/clone-graph/ Given a reference of a node in a connected undirected graph, return a deep copy (clone) of the graph. Each node in the graph contains a val (int) and a list (List[Node]) of its neighbors. Example: Input: {"$id":"1","neighbors":[{"$i...
bsd-2-clause
Python
ef63c538aff066230030aaf02981933b652830e4
Create module_posti.py
rnyberg/pyfibot,rnyberg/pyfibot
pyfibot/modules/module_posti.py
pyfibot/modules/module_posti.py
# -*- encoding: utf-8 -*- """ Get package tracking information from the Finnish postal service """ from __future__ import unicode_literals, print_function, division from bs4 import BeautifulSoup import requests from datetime import datetime, timedelta lang = 'en' def command_posti(bot, user, channel, args): """...
bsd-3-clause
Python
fbfdc979b5fbb7534a625db390b92856714dcfe1
add basic tests for model_utils
jklenzing/pysat,rstoneback/pysat
pysat/tests/test_model_utils.py
pysat/tests/test_model_utils.py
import numpy as np import sys from nose.tools import assert_raises, raises import pandas as pds import pysat from pysat import model_utils as mu class TestBasics(): def setup(self): """Runs before every method to create a clean testing setup.""" self.testInst = pysat.Instrument(platform='pysat',...
bsd-3-clause
Python
6cd8b4c733de5a4ed39e3d3ba3d06e78b04dbb4b
read a value from a file that is in ConfigObj format - no section check
matplo/rootutils,matplo/rootutils
python/2.7/read_config_value.py
python/2.7/read_config_value.py
#!/usr/bin/env python from configobj import ConfigObj import argparse import os import sys def read_config(fname, skey): config = ConfigObj(fname, raise_errors=True) return config[skey] def main(): parser = argparse.ArgumentParser(description='read a value from a ConfigObj file', prog=os.path.basename(__file__)) ...
mit
Python
837d1f26ad339fbe4338ef69c947f83042daba9f
add prelim script for looking at incident data
garnertb/fire-risk,garnertb/fire-risk,FireCARES/fire-risk,FireCARES/fire-risk
Scripts/fire_incident.py
Scripts/fire_incident.py
#Weinschenk #12-14 from __future__ import division import numpy as np import pandas as pd from pylab import * from matplotlib import rcParams rcParams.update({'figure.autolayout': True}) incident = pd.read_csv('../Data/arlington_incidents.csv', header=0) total_incidents = len(incident['incident_class_code']) total_fi...
mit
Python
ab00f54344e4aa39503a59551e87db2ed4be9c3d
Create print_rectangle.py
set0s/learn-programming
python3/print_rectangle.py
python3/print_rectangle.py
while 1: m, n = input().split()# m:height, n:width if m == "0" and n == "0": breaku for i in range(int(m)): print("#" * int(n)) print()
mit
Python
989a94c81f74a17707e66f126960b6bb45e9b4d5
Add index to cover testgroup_details (previous runs)
dropbox/changes,bowlofstew/changes,dropbox/changes,dropbox/changes,bowlofstew/changes,bowlofstew/changes,wfxiang08/changes,bowlofstew/changes,wfxiang08/changes,wfxiang08/changes,wfxiang08/changes,dropbox/changes
migrations/versions/3042d0ca43bf_index_job_project_id.py
migrations/versions/3042d0ca43bf_index_job_project_id.py
"""Index Job(project_id, status, date_created) where patch_id IS NULL Revision ID: 3042d0ca43bf Revises: 3a3366fb7822 Create Date: 2014-01-03 15:24:39.947813 """ # revision identifiers, used by Alembic. revision = '3042d0ca43bf' down_revision = '3a3366fb7822' from alembic import op def upgrade(): op.execute('...
apache-2.0
Python
b96f39b3527cef7fd9766315fbdf7b87b6315ec8
add watch file which generated by scratch
rli9/slam,rli9/slam,rli9/slam,rli9/slam
src/car_control_manual/scratch/watch_file.py
src/car_control_manual/scratch/watch_file.py
from __future__ import print_function """Watch File generated by Scratch 1. save Scratch file *.sb2 into the same directory or specify with path 2. change name *.sb2 to *.zip 3. unzip *.zip file and read json data from project.json """ import sys, time, logging, os, zipfile import watchdog from watchdog....
mit
Python
46b3c0c024dd0d8dbb80911d04848571b3176be7
add yaml config reader
cure76/misc
config.py
config.py
# -*- coding: utf-8 -*- import (os, sys, yaml) class Settings(dict): ''' base settings class ''' def __init__( self, data = None ): super( Settings, self ).__init__() if data: self.__update( data, {} ) def __update( self, data, did ): dataid = id(data) did[ dat...
bsd-3-clause
Python
8b9fe74976d77df32d73792f74ef4ddea1eb525f
Add Config.get() to skip KeyErrors
royrapoport/destalinator,TheConnMan/destalinator,royrapoport/destalinator,underarmour/destalinator,randsleadershipslack/destalinator,randsleadershipslack/destalinator,TheConnMan/destalinator
config.py
config.py
#! /usr/bin/env python import os import warnings import yaml class Config(object): config_fname = "configuration.yaml" def __init__(self, config_fname=None): config_fname = config_fname or self.config_fname fo = open(config_fname, "r") blob = fo.read() fo.close() self...
#! /usr/bin/env python import os import warnings import yaml class Config(object): config_fname = "configuration.yaml" def __init__(self, config_fname=None): config_fname = config_fname or self.config_fname fo = open(config_fname, "r") blob = fo.read() fo.close() self...
apache-2.0
Python
7dde102dd51db08f9021234fa3d8f11ab165b210
add custom_preprocess.py
JasonWayne/avazu-nn
src/custom_preprocess.py
src/custom_preprocess.py
import unittest import csv from datetime import datetime, timedelta def load_raw_data_and_split_by_dt(path, output_dir): base_datetime = datetime.strptime('141021', '%y%m%d') output_file_dict = {(base_datetime + timedelta(days=x)).strftime('%y%m%d'): open( output_dir + '/' + (base_datetime + timedelta...
mit
Python
1f5134b36846cf0e5e936888a4fe51a2012e0d78
Create alternate_disjoint_set.py (#2302)
TheAlgorithms/Python
data_structures/disjoint_set/alternate_disjoint_set.py
data_structures/disjoint_set/alternate_disjoint_set.py
""" Implements a disjoint set using Lists and some added heuristics for efficiency Union by Rank Heuristic and Path Compression """ class DisjointSet: def __init__(self, set_counts: list) -> None: """ Initialize with a list of the number of items in each set and with rank = 1 for each set ...
mit
Python
4c53ffbd9b23238b3402752f33fcabb2724921f4
Add dunder init for lowlevel.
python-astrodynamics/astrodynamics,python-astrodynamics/astrodynamics
astrodynamics/lowlevel/__init__.py
astrodynamics/lowlevel/__init__.py
# coding: utf-8 from __future__ import absolute_import, division, print_function
mit
Python
ae79ca36e3cfca362414f2293a4c6d295c6db38b
Create addroundkey.py
deekshadangwal/PyRTL,UCSBarchlab/PyRTL,nvandervoort/PyRTL,nvandervoort/PyRTL,deekshadangwal/PyRTL,UCSBarchlab/PyRTL
research/aes/addroundkey.py
research/aes/addroundkey.py
import sys sys.path.append("../..") import pyrtl from pyrtl import * import keyexpansion from keyexpansion import * """ AddRoundKey round of AES. Input: 128-bit state array. Output: 128-bit state array. """ def addroundkey_initial(state, expanded_key): input_wire_1 = pyrtl.WireVector(bitwidth=128, name='input_wi...
bsd-3-clause
Python
94f922c77ee89a5b54b99e135a5045f450badb0e
add new script to dump nice looking release notes like. Borrowed from antlr.
parrt/intellij-plugin-v4,antlr/intellij-plugin-v4,antlr/intellij-plugin-v4,parrt/intellij-plugin-v4
scripts/github_release_notes.py
scripts/github_release_notes.py
# Get github issues / PR for a release # Exec with "python github_release_notes.py YOUR_GITHUB_API_ACCESS_TOKEN 1.19" import sys from collections import Counter from github import Github TOKEN=sys.argv[1] MILESTONE=sys.argv[2] g = Github(login_or_token=TOKEN) # Then play with your Github objects: org = g.get_organiz...
bsd-3-clause
Python
fe08ce77958c637539b24817ffca45587fa31a7e
Implement shared API
platformio/platformio-core,platformio/platformio-core
platformio/shared.py
platformio/shared.py
# Copyright (c) 2014-present PlatformIO <contact@platformio.org> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
apache-2.0
Python
42297354f575e2c82346cf033202c5dfad5ddd99
Add python class for writing out xyz files of trajectory coordinates
westpa/westpa
lib/examples/nacl_amb/utils.py
lib/examples/nacl_amb/utils.py
#!/usr/bin/env python import numpy class TrajWriter(object): ''' A class for writing out trajectory traces as an xyz file, for subsequent visualization. ''' def __init__(self, trace, w, filename='trace.xyz'): self.trace = trace self.w = w self.filename = filename sel...
mit
Python
d5125205801b9771115a052162ee700f64601557
Create frequency.py
nlpub/russe-evaluation,nlpub/russe-evaluation,nlpub/russe-evaluation
frequency.py
frequency.py
import sys import csv csv.field_size_limit(sys.maxsize) from pymystem3 import Mystem import time import cProfile from collections import defaultdict class CsvHandler: INPUTFILE = 'wiki_noxml_full.txt' OUTPUTFILE = 'my_frequency_list.csv' def __init__(self): self.file_name = self.INPUTFILE ...
mit
Python
0c719d59b6155ed50692810fab57814370fde1bb
Create fcp_xml2csv.py
Kevo89/OpenPeelTools
fcp_xml2csv.py
fcp_xml2csv.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################ # FoodCheckPeel XML2CSV Converter # # This script converts the FoodCheckPeel XML # file to the Comma Separated Values file type # so it's easier to import to common spreadsheet # applications. # Based on the script posted h...
mit
Python
88bd6466940d21d52c0d5235ace10b6a97d69d46
Create emailtoHIBP.py
SudhanshuC/Maltego-Transforms,cmlh/Maltego-Transforms
emailtoHIBP.py
emailtoHIBP.py
#!/usr/bin/python #EmailtoHIBP.py #Author: Sudhanshu Chauhan - @Sudhanshu_C #This Script will retrieve the Domain(s) at which the specified account has been compromised #It uses the API provided by https://haveibeenpwned.com/ #Special Thanks to Troy Hunt - http://www.troyhunt.com/ #For MaltegoTransform librar...
mit
Python
450557e0bfb902de862e5fe42868d3fbf7165600
Add lc0983_minimum_cost_for_tickets.py from Hotel Schulz Berlin
bowen0701/algorithms_data_structures
lc0983_minimum_cost_for_tickets.py
lc0983_minimum_cost_for_tickets.py
"""Leetcode 983. Minimum Cost For Tickets Medium URL: https://leetcode.com/problems/minimum-cost-for-tickets/ In a country popular for train travel, you have planned some train travelling one year in advance. The days of the year that you will travel is given as an array days. Each day is an integer from 1 to 365....
bsd-2-clause
Python