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 |
|---|---|---|---|---|---|---|---|---|
3b7cbae01426c210f04ffa70f113e3ce5ec566d0 | add init function and base functions | tlfvincent/pandas_summarize | pandas_summarize/__init__.py | pandas_summarize/__init__.py | from __future__ import division
from collections import Counter
import numpy as np
import pandas as pd
class DataFrameSummary(object):
# define global variables
TYPE_BOOL = 'bool'
TYPE_NUMERIC = 'numeric'
TYPE_DATE = 'date'
TYPE_CATEGORICAL = 'categorical'
TYPE_CONSTANT = 'constant'
TYPE_U... | mit | Python | |
0b6cb5e8bac9e6bdbd48daaf281a3a35e02e129b | bump version in __init__.py | 1flow/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow | oneflow/__init__.py | oneflow/__init__.py |
VERSION = '0.19.2.1'
|
VERSION = '0.19.2'
| agpl-3.0 | Python |
c42234d3e37636df6432f79b7c31d8f66793caa1 | add model for maintenance records | CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend | troposphere/models.py | troposphere/models.py | import collections
from django.db import models
from django.db.models import Q
from django.utils import timezone
#from core.models.user import AtmosphereUser as User
class MaintenanceRecord(models.Model):
"""
Maintenance can be activated through the database
"""
start_date = models.DateTimeField()
... | apache-2.0 | Python | |
340abbc2c0a55d5597323cfebd54e65175d3b418 | Bump version in __init__.py. | 1flow/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow | oneflow/__init__.py | oneflow/__init__.py |
VERSION = '0.15.3.6'
|
VERSION = '0.15.3.5'
| agpl-3.0 | Python |
20da0247f954d0c6d51d651dd2e89c524df49568 | Add group names view for grafana (#531) | yunity/yunity-core,yunity/foodsaving-backend,yunity/yunity-core,yunity/foodsaving-backend,yunity/foodsaving-backend | foodsaving/groups/migrations/0028_add_group_names_view_20180310_1034.py | foodsaving/groups/migrations/0028_add_group_names_view_20180310_1034.py | # Generated by Django 2.0.2 on 2018-03-10 10:34
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('groups', '0027_auto_20180309_0936'),
]
operations = [
migrations.RunSQL(
sql='create or replace view group_names as select id, name from... | agpl-3.0 | Python | |
2822aca94d8a20c99ba0b9150ed036d39d809888 | Implement rough Python regular expression based reflection checker #562 | bitshares/bitshares-2,bitsuperlab/cpp-play2,bigoc/openchain,cryptonomex/graphene,pmconrad/graphene,bitsuperlab/cpp-play2,abitmore/bitshares-2,pmconrad/graphene,bigoc/openchain,abitmore/bitshares-2,cryptonomex/graphene,oxarbitrage/bitshares-core,bitshares/bitshares-2,cryptonomex/graphene,peertracksinc/muse,bitshares/bit... | programs/build_helpers/check_reflect.py | programs/build_helpers/check_reflect.py | #!/usr/bin/env python3
import json
import os
import re
import xml.etree.ElementTree as etree
def process_node(path, node):
"""
if node.tag == "TestCase":
if node.attrib.get("result", "UNKNOWN") != "passed":
failset.add(node)
return
if node.tag in ["TestResult", "TestSuite"]:
... | mit | Python | |
2a5b4859f3e74f8b76a7d2b108b9bead4481065a | add helper functions for selectively skipping tests | caidongyun/pylearn2,daemonmaker/pylearn2,se4u/pylearn2,CIFASIS/pylearn2,lancezlin/pylearn2,lunyang/pylearn2,bartvm/pylearn2,pkainz/pylearn2,caidongyun/pylearn2,sandeepkbhat/pylearn2,shiquanwang/pylearn2,Refefer/pylearn2,JesseLivezey/plankton,kose-y/pylearn2,Refefer/pylearn2,lisa-lab/pylearn2,caidongyun/pylearn2,JesseLi... | pylearn2/testing/skip.py | pylearn2/testing/skip.py | """ Helper functions for determining which tests to skip. """
from nose.plugins.skip import SkipTest
import os
scipy_works = True
try:
import scipy
except ImportError:
# pyflakes gets mad if you set scipy to None here
scipy_works = False
def skip_if_no_data():
if 'PYLEARN2_DATA_PATH' not in os.environ... | bsd-3-clause | Python | |
655f2ac31df0055c06005311820848cceaea4122 | Test file added to estimate performance of program between systems. | thebongy/Snake | nonclass.py | nonclass.py | from os import system
from time import sleep
from msvcrt import getch
from threading import Thread
system('mode 50,30')
game_running = True
direction = 1
delay = 0.07
def clear():
system('cls')
def controller():
global game_running,direction,delay
while game_running:
key = ord(getch())
if key... | mit | Python | |
1acd4e84cc7f1ed801339e7d8aa75835072dbf07 | Create A.py | Pouf/CodingCompetition,Pouf/CodingCompetition | Google-Code-Jam/2016-B/A.py | Google-Code-Jam/2016-B/A.py | mit | Python | ||
0a4500fb8c8c15fd5ec1dc6a96045bc15e254d8a | Create ringthing.py | JohnTocher/ConcentricRingMaker | ringthing.py | ringthing.py | # Concentric segment plot utility
# Created by John Tocher, 09/05/2014
#
# Built for generating a template for a particular type of word-chart
import svgwrite
import math
import os
from svgwrite import cm, mm
# Put your paths here
output_path="/home/john/Temp"
output_file_name = "my_output_file.svg"
# basic draw... | cc0-1.0 | Python | |
7327f05b329e3cc092df6c5d8bd742ec4a68746f | test new class ParallelFinish | aewallin/opencamlib,aewallin/opencamlib,aewallin/opencamlib,aewallin/opencamlib,aewallin/opencamlib | pfinish_tst_1.py | pfinish_tst_1.py | import ocl as cam
import camvtk
import time
import vtk
import datetime
if __name__ == "__main__":
myscreen = camvtk.VTKScreen()
stl = camvtk.STLSurf("gnu_tux_mod.stl")
print "STL surface read"
myscreen.addActor(stl)
stl.SetWireframe()
stl.SetColor((0.5,0.5,0.5))
polydata = stl.src.... | lgpl-2.1 | Python | |
491eecdbb94b88d5d153b4cafdbda4ec09a4ac29 | Create data_quality_algos_and_functions.py | ebegoli/ErrorProne | data_quality_algos_and_functions.py | data_quality_algos_and_functions.py | # --------------------------------------------------------------------------
# print_data_quality_report - Prints a data quality report that includes:
# - Available columns
# - For each column:
# - Data type
# ... | apache-2.0 | Python | |
0e8b4ee83b37d38e50123d04f764b9346d7bf608 | Add main python script | bertrik/panopt | panopt.py | panopt.py | #!/usr/bin/env python
# Shows several JPG camera snapshots tiled into a bigger image.
#
# requires python2, ppython-sdl2 !
#
# Possible improvements:
# - write optional label ("CAM1") for each image (and use a clunky "camera" font)
# - read layout from a config file instead of hardcoding it
# - allow some tiles to be ... | mit | Python | |
1722c21b3d1fde3aeb60c4a86952c9756f4e65f6 | Create harvest_frf.py (#5) | axiom-data-science/thredds_iso_harvester | examples/harvest_frf.py | examples/harvest_frf.py | # Harvest all the .ncml files in the FRF folder
# on the USACE CHL THREDDS Server
#
# docker run -v $(pwd)/harvest_frf.py:/srv/harvest.py -v $(pwd)/iso:/srv/iso axiom/thredds_iso_harvester
from thredds_iso_harvester.harvest import ThreddsIsoHarvester
from thredds_crawler.crawl import Crawl
#skip = Crawl.SKIPS + ['.*... | mit | Python | |
a8a85a4bf0185a43b492ab8e81b558128db392aa | Add a script to slice traces bigger than 256MB | k21/buck,robbertvanginkel/buck,rmaz/buck,vschs007/buck,sdwilsh/buck,sdwilsh/buck,clonetwin26/buck,justinmuller/buck,justinmuller/buck,raviagarwal7/buck,SeleniumHQ/buck,robbertvanginkel/buck,k21/buck,k21/buck,SeleniumHQ/buck,kageiit/buck,darkforestzero/buck,robbertvanginkel/buck,SeleniumHQ/buck,LegNeato/buck,rmaz/buck,v... | scripts/slice_trace.py | scripts/slice_trace.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import codecs
import collections
import json
import math
import os
def parse_args():
description = """Slice JSON .trace file into smaller pieces."""... | apache-2.0 | Python | |
15e11fe853a173b18beec16c9de8111caef52fc1 | Create saveToMp3.py | shaharzeira/video_file_directory_to_mp3_python_linux | saveToMp3.py | saveToMp3.py | from parser import getFull, getFullFromMp4
from subprocess import call, Popen
import os
def save(mp4):
a=["ffmpeg -i","'"+getFull(mp4)+"'","-q:a 0 -map a", "'"+getFullFromMp4(mp4)+"'"]
printData(mp4, a)
os.system(" ".join(a))
def printData(mp4, a):
print "******************"
print getFull(mp4)
... | apache-2.0 | Python | |
5b7ca5f4d3b1c64b169ea2190ba9c8c037538dde | Add files via upload | prashantgo/Python-Scripts | approximator.py | approximator.py | import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Activation, Dropout
from keras.models import load_model
from keras.optimizers import RMSprop
from keras import regularizers
from keras.constraints import *
from keras.callbacks import *
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']=... | mit | Python | |
ec48338fd90bcabc7721524cfa43b8198cf8f478 | Add astro/oskar/jybeam2k.py: Convert image unit [Jy/beam] to [K] | liweitianux/atoolbox,liweitianux/atoolbox,liweitianux/atoolbox,liweitianux/atoolbox,liweitianux/atoolbox,liweitianux/atoolbox | astro/oskar/jybeam2k.py | astro/oskar/jybeam2k.py | #!/usr/bin/env python3
#
# Copyright (c) 2017 Weitian LI <weitian@aaronly.me>
# MIT license
#
"""
Convert the image (e.g., by WSClean) from units [Jy/beam] to [K]
by taking into account the telescope's beam size.
"""
import os
import sys
import argparse
import numpy as np
from astropy.io import fits
import astropy.... | mit | Python | |
8466a77dd1b63925938f7af9c0200807975a2d7b | Create clear.py | sudo-191/py_Block | plugins/clear.py | plugins/clear.py | import tkinter as tk
def main(window,textBox):
button=tk.Button(window,text="clear")
button.config(command=lambda: textBox.delete(1.0,'end'))
button.grid(row=1,column=0,sticky="n")
def privilage():
return ["window","textBox"]
| mit | Python | |
002e62db230d5e1dde739bba68c91d23f43b57fe | Add unit tests for torf.set_redundant_data | googlefonts/glyphsLib,googlei18n/glyphsLib | Lib/glyphs2ufo/torf_test.py | Lib/glyphs2ufo/torf_test.py | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 | Python | |
dd755efcbc9847f6c1576ca59759ab3540b814b8 | Add Day 20 | icydoge/AdventOfCodeSolutions | day20.py | day20.py | #Advent of Code December 20
#Written by icydoge - icydoge AT gmail dot com
#My input: 33100000
#Efficient get-all-factors courtesy of http://stackoverflow.com/a/6800214/5693062
def factors(n):
return set(reduce(list.__add__,
([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))
puzzl... | mit | Python | |
2268cc13d4af71f1fbff4af26631013664fc1d93 | Add a Python 3 compatibility helper | agdsn/pycroft,lukasjuhrich/pycroft,agdsn/pycroft,lukasjuhrich/pycroft,lukasjuhrich/pycroft,agdsn/pycroft,lukasjuhrich/pycroft,agdsn/pycroft,agdsn/pycroft | pycroft/_compat.py | pycroft/_compat.py | # Copyright (c) 2015 The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details.
import sys
import operator
PY2 = sys.version_info[0] == 2
if PY2:
chr = unichr
text_type = unicode
... | apache-2.0 | Python | |
8921f9a5d991cd6962d3d16f6e72d53d06a1e86f | Add an RGB LED for initial experimentation. | davidb24v/drwho | rgbLed.py | rgbLed.py | '''
Dr Who Box: RGB Effects LED
'''
from __future__ import print_function
import RPi.GPIO as GPIO
import time
from multiprocessing import Process
import math
# Define PINS
RED = 23
GREEN = 24
BLUE = 26
# Use numbering based on P1 header
GPIO.setmode(GPIO.BOARD)
GPIO.setup(RED, GPIO.OUT, GPIO.HIGH)
GPIO.setup(GREEN... | mit | Python | |
fe7e3ca713fa1351facd9821a29cae7838458baf | Add handle excel script in python | mzlogin/snippets,mzlogin/snippets,mzlogin/snippets,mzlogin/snippets,mzlogin/snippets,mzlogin/snippets,mzlogin/snippets,mzlogin/snippets | Python/handle_excel.py | Python/handle_excel.py | """
使用场景:
有三个巨大的 Excel 文件(合计约一百三十万行)存放在 src_new 下面,
这个脚本能读取这三个 Excel 文件,将所有数据按第 5 列的值分别存放到 dst_new 里的不同的文件里去,
dst 文件以数据第 5 列值命名
template_new.xlsx 是一个模板文件,只含表头
Python 3
"""
import openpyxl
import os
import shutil
base_path = '/Users/mazhuang/Downloads/excels/'
src_path = base_path + 'src_new/'
dst_path = base_path ... | mit | Python | |
d36e83e59e6ea879549c2fcd50bd15f617ffaf38 | add extra command and led count | jhogsett/linkit,jhogsett/linkit,jhogsett/linkit,jhogsett/linkit,jhogsett/linkit,jhogsett/linkit | python/demohsl4.py | python/demohsl4.py | #!/usr/bin/python
import serial
import time
import sys
s = None
def flush_input():
s.read(s.inWaiting())
def wait_for_ack():
while s.inWaiting() == 0:
pass
flush_input()
def command(cmd_text):
s.write((cmd_text + ':').encode())
wait_for_ack()
num_leds = 72
brightness =... | mit | Python | |
6eb6303ddc6c49b9c70ee501d3594a808acd7643 | Add new 'List' formatter. | stefanseefeld/synopsis,stefanseefeld/synopsis,stefanseefeld/synopsis,stefanseefeld/synopsis,stefanseefeld/synopsis,stefanseefeld/synopsis | Synopsis/Formatters/List.py | Synopsis/Formatters/List.py | #
# Copyright (C) 2006 Stefan Seefeld
# All rights reserved.
# Licensed to the public under the terms of the GNU LGPL (>= 2),
# see the file COPYING for details.
#
from Synopsis.Processor import Processor, Parameter
from Synopsis import AST
class Formatter(Processor, AST.Visitor):
"""Generate a high-level list of... | lgpl-2.1 | Python | |
f1f26b62b7d8e48c125c57221975878ce8fb948b | Add report | davidthewatson/github_issues_report | report.py | report.py | import markdown
import dominate
from github import Github
from clint import arguments
from dominate.tags import table, thead, tbody, tr, td, th, h1, a
from dominate.util import raw
def print_header():
h = thead()
with h:
r = tr()
r.add(th('NUMBER'))
r.add(th('TITLE'))
r.add(th... | mit | Python | |
6307fc6d95ea943bb8d53c9f72f68dafa56e0ebe | add 4.py | bm5w/pychal | 4.py | 4.py | """Solution for python challenge #4:
http://www.pythonchallenge.com/pc/def/linkedlist.php"""
import urllib
def main(num=12345):
out = urllib.urlopen(("http://www.pythonchallenge.com/pc/def/"
"linkedlist.php?nothing={}").format(num))
import pdb; pdb.set_trace()
| mit | Python | |
70fa99f52436ac860de01eab311215ed1a7e24c4 | Add functionality: photo or 404 | DictGet/ecce-homo,DictGet/ecce-homo | app.py | app.py | import os
from flask import Flask, abort, send_file
app = Flask(__name__)
@app.route("/<path:filename>/")
def get_image(filename):
if not os.path.isfile(filename):
abort(404)
return send_file(filename)
if __name__ == "__main__":
app.run()
| mit | Python | |
82ad53025ee9ed35f3788df2f91d5eba43005db2 | Add app skeleton. | charlieRode/calendar_app,charlieRode/calendar_app,charlieRode/calendar_app | app.py | app.py | # -*- coding: utf-8 -*-
import os
import logging
import psycopg2
from contextlib import closing
from pyramid.config import Configurator
from pyramid.session import SignedCookieSessionFactory
from pyramid.view import view_config
from waitress import serve
TABLE1_SCHEMA = """
CREATE TABLE IF NOT EXISTS days (
date D... | mit | Python | |
7b96e370eb918dae6ae51d79ad2288369a88e691 | add manish's magic thingy | Charcoal-SE/Blaze,Charcoal-SE/Blaze,Charcoal-SE/Blaze | fsk.py | fsk.py | #requires https://pypi.python.org/pypi/websocket-client/
import json,os,sys,getpass
from ChatExchange.SEChatWrapper import *
from flask import Flask
app = Flask(__name__)
if("ChatExchangeU" in os.environ):
username=os.environ["ChatExchangeU"]
else:
print "Username: "
username=raw_input()
if("ChatExchangeP" in os... | mit | Python | |
45b3a5924047a841bb01ed079104533c8cc5c0ce | Add a module that can be called from other scripts | azbshiri/tas | run.py | run.py | #!/usr/bin/env python3
from tas import make_schedule
from tabulate import tabulate
import os
import csv
if __name__ == '__main__':
table = make_schedule()
tabular = tabulate(list(table), tablefmt="plain")
print(tabular)
| mit | Python | |
a21a1d103fcce95fd2203430c3474c6f51e35351 | Bump dev version. | pombreda/python-astm,tinoshot/python-astm,Iskander1b/python-astm,tectronics/python-astm,LogicalKnight/python-astm,andrexmd/python-astm,briankip/python-astm,MarcosHaenisch/python-astm,mhaulo/python-astm,kxepal/python-astm,kxepal/python-astm,123412345/python-astm,Alwnikrotikz/python-astm,eddiep1101/python-astm,AlanZatara... | astm/version.py | astm/version.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Alexander Shorin
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
__version__ = '0.6.0'
__version_info__ = (0, 6, 0, 'dev', 0)
| # -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Alexander Shorin
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
__version__ = '0.5.0'
__version_info__ = (0, 5, 0, '', 0)
| bsd-3-clause | Python |
76249837cb266516432a0cf36d0016624490a6e6 | Increase precision of power test. | enjin/contracts | solidity/python/PowerTest.py | solidity/python/PowerTest.py | from sys import argv
from decimal import Decimal
from random import randrange
from Formula import calculateBestPrecision
from Formula import power
from decimal import getcontext
getcontext().prec = 80 # 78 digits for a maximum of 2^256-1, and 2 more digits for after the decimal point
def powerTest(baseN,baseD,... | from sys import argv
from decimal import Decimal
from random import randrange
from Formula import calculateBestPrecision
from Formula import power
def powerTest(baseN,baseD,expN,expD):
precision = calculateBestPrecision(baseN,baseD,expN,expD)
fixed = Decimal(power(baseN,baseD,expN,expD,precision))/(1<<pr... | apache-2.0 | Python |
e108396fb28036942a37eb08d1a7d3ba44d74084 | Implement the MLR method | jhumphry/regressions | regressions/mlr.py | regressions/mlr.py | # regressions.mlr
"""A package which implements Multiple Linear Regression."""
import random
from . import *
class MLR:
"""Multiple Linear Regression"""
def __init__(self, X, Y):
if X.shape[0] != Y.shape[0]:
raise ParameterError('X and Y data must have the same number of '
... | isc | Python | |
b533fd3eefa690f4361a79fb886842a53834cedd | Add spider. | nblock/feeds,nblock/feeds,Lukas0907/feeds,Lukas0907/feeds | feeds/spiders/atv_at.py | feeds/spiders/atv_at.py | #!/usr/bin/python3
import datetime
import json
from scrapy.spiders import Spider
import pytz
import scrapy
from feeds.loaders import FeedEntryItemLoader
from feeds.loaders import FeedItemLoader
class AtvAtSpider(Spider):
name = 'atv.at'
allowed_domains = ['atv.at']
start_urls = ['http://atv.at/mediathe... | agpl-3.0 | Python | |
f6b22c3c7ff33d074b18cb7344263db65bb0f40f | Add exercise Stock Exchange Losses | AntoineAugusti/katas,AntoineAugusti/katas,AntoineAugusti/katas | codingame/medium/stock_exchange_losses.py | codingame/medium/stock_exchange_losses.py | def maxLoss(lst):
up = lst[0]
down = lst[0]
mini = down - up
for i, val in enumerate(lst[:-1]):
# We are decreasing
if (lst[i+1] < val):
if val > up:
up = val
down = val
if lst[i+1] < down:
down = lst[i+1]
if (down - up) < mini:
mini = down - up
return mini
# Number of values
n = int(r... | mit | Python | |
b60afabe40a5f0b038b7a1193f7fa04e2e2bd333 | Add utils.py (including the implementation of power method) | tsurubee/banpei | banpei/utils.py | banpei/utils.py | import numpy as np
def power_method(A, iter_num=1):
"""
Calculate the first singular vector/value of a target matrix based on the power method.
Parameters
----------
A : numpy array
Target matrix
iter_num : int
Number of iterations
Returns
-------
u : numpy ... | mit | Python | |
51d7e5856e9aa68bfdf2317e95b0b470881a4b6a | Complete Problem 1 | 2Cubed/ProjectEuler | euler/p001.py | euler/p001.py | """Solution to Project Euler Problem 1
https://projecteuler.net/problem=1
"""
NUMBERS = 3, 5
MAXIMUM = 1000
def compute(*numbers, maximum=MAXIMUM):
"""Compute the sum of the multiples of `numbers` below `maximum`."""
if not numbers:
numbers = NUMBERS
multiples = tuple(set(range(0, maximum, numb... | mit | Python | |
4615832313ccb909e3f148c8a9fd4d8243907010 | Create admin.py | OWASP/django-DefectDojo,rackerlabs/django-DefectDojo,OWASP/django-DefectDojo,rackerlabs/django-DefectDojo,rackerlabs/django-DefectDojo,OWASP/django-DefectDojo,OWASP/django-DefectDojo,OWASP/django-DefectDojo,rackerlabs/django-DefectDojo | dojo/admin.py | dojo/admin.py | from auditlog.models import LogEntry
from django.contrib import admin
admin.site.unregister(LogEntry)
| bsd-3-clause | Python | |
840e5216586e2c6d67844d9ceab631cd4dce3945 | Create number_sanitize.py | spencervillars/AutoSchema,spencervillars/AutoSchema | number_sanitize.py | number_sanitize.py | import scipy.stats as stats
import numpy as np
def check_sequential(array):
'''
Input: list of numbers
Output: True if the numbers do not correspond to a normal distribution with p < 0.05
False otherwise
'''
zval, pval = stats.normaltest(array)
if pval < 0.05:
return True
else:
return False
def pdf(input,... | mit | Python | |
6548a8baf6a915a17144256e1870b329c2860e10 | Create drivers.py | ariegg/webiopi-drivers,ariegg/webiopi-drivers | chips/digital/simulation/drivers.py | chips/digital/simulation/drivers.py | # This code has to be added to the corresponding __init__.py
DRIVERS["simulateddigital"] = ["DIGITAL"]
| apache-2.0 | Python | |
5352dc94b68d8a49ae73f798be68fa86ef17b0c2 | Create nginx init | hatchery/Genepool2,hatchery/genepool | genes/nginx/__init__.py | genes/nginx/__init__.py | #!/usr/bin/env python
def main():
from .main import main as install
install()
| mit | Python | |
cd4879f4793924563bc27f251bd6a7af15c8ba3a | Test program for QMessageBox formatting | rzzzwilson/morse_trainer,rzzzwilson/morse_trainer | tests/test_msgbox.py | tests/test_msgbox.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Test code for controlling QMessageBox format.
"""
import sys
from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import (QApplication, QLabel, QWidget, QMessageBox,
QSpinBox, QLineEdit, QPushButton,
QHBoxLayout, ... | mit | Python | |
9f04505c7ad2724bb45f2215580ac5fa60bafbcd | Add simple test | cleverhans-lab/cleverhans,cleverhans-lab/cleverhans,cleverhans-lab/cleverhans | tests/test_sample.py | tests/test_sample.py | def inc(x):
return x + 1
def test_answer():
assert inc(4) == 5
test_answer() | mit | Python | |
0c9dfa7f71cee8fe41aa6cdeb234a4c8ab89ea07 | Add Python version of commhistory-tool converter | laenion/Firefox-OS-Data-Exporter | convert_ffos_sms_data_to_commhistory-tool_json.py | convert_ffos_sms_data_to_commhistory-tool_json.py | #!/usr/bin/python
from json import loads
from time import strftime, gmtime
from datetime import datetime, time
json_file = open('sms.txt')
commtool = open('import.json', 'w')
isfirst = True
commtool.write('[\n')
def escape(s):
s = repr(s)
s = s.replace('\\', '\\\\')
s = s.replace("\\\\x", "\\x")
s = s.replace('... | mpl-2.0 | Python | |
ebb5c8608b9efacafaed12f689ccf39219479ed7 | Add default_auto_field to database backend (#449) | jazzband/django-constance,jezdez/django-constance,jazzband/django-constance,jezdez/django-constance,jazzband/django-constance | constance/backends/database/apps.py | constance/backends/database/apps.py | from django.apps import AppConfig
class ConstanceConfig(AppConfig):
name = 'constance.backends.database'
default_auto_field = 'django.db.models.AutoField'
| bsd-3-clause | Python | |
377f26d3e48f20530532b496e3c0827db8c1e812 | add contrib script to remove trailing whitespace from files | Bitcoin-com/BUcash,ftrader-bitcoinunlimited/hardfork_prototype_1_mvf-bu,BitcoinUnlimited/BitcoinUnlimited,Bitcoin-com/BUcash,BitcoinUnlimited/BitcoinUnlimited,Bitcoin-com/BUcash,BitcoinUnlimited/BitcoinUnlimited,Justaphf/BitcoinUnlimited,Justaphf/BitcoinUnlimited,Justaphf/BitcoinUnlimited,BitcoinUnlimited/BitcoinUnlimi... | contrib/devtools/remove_trailing_space.py | contrib/devtools/remove_trailing_space.py | #!/usr/bin/env python
'''
This tool removes trailing whitespace from files passed on command line.
Usage: remove_trailing_space.py [filepath ...]
Limitations:
- makes no backups of modified files
- modifies in place
- does not care what files you pass to it
- assumes it can keep the entire stripped file in memory
A... | mit | Python | |
a821dfa6d6fce4d317fde1bcba2a4c32dcb24738 | add avTranscoder python file | tuttleofx/sconsProject | autoconf/avTranscoder.py | autoconf/avTranscoder.py | from _external import *
from ffmpeg import ffmpeg
avTranscoder = LibWithHeaderChecker(
'AvTranscoder',
'AvTranscoder/common.hpp',
'c++',
dependencies=[ffmpeg]
)
| mit | Python | |
6864bfc0e30ac0c31cf9d42d08c7b0dc9559393d | add tutorial.py | okdshin/Yender,okdshin/Yender | tutorial/tutorial.py | tutorial/tutorial.py | import os, random, time
import yender
import numpy as np
import collections
block_set = collections.OrderedDict()
block_set["."] = yender.Block(indicator=".", name="air", movable=True)
block_set["#"] = yender.Block(indicator="#", name="stone", color=(127, 127, 127), movable=False)
block_set["R"] = yender.Block(indicat... | mit | Python | |
bebfb1198e4ac6a1b27ac314e7fd298fdab76dc6 | Add get-osx-wallpaper script. | bamos/python-scripts,bamos/python-scripts | python3/get-osx-wallpaper.py | python3/get-osx-wallpaper.py | #!/usr/bin/env python3
#
# This is a Python script that outputs the path of the current
# OSX wallpaper.
# This is helpful when the desktop wallpaper is randomized
# across a large collection of pictures and you want to
# delete the current wallpaper.
#
# 2015.03.25
# Brandon Amos <http://github.com/bamos>
#
# --- Warn... | mit | Python | |
572653c740e5cabaf721d8031f6a1545ea1c2bea | change import statement | jeroyang/retools | retools/__init__.py | retools/__init__.py | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from .retools import *
__author__ = 'Chia-Jung, Yang'
__email__ = 'jeroyang@gmail.com'
__version__ = '0.1.0'
| # -*- coding: utf-8 -*-
__author__ = 'Chia-Jung, Yang'
__email__ = 'jeroyang@gmail.com'
__version__ = '0.1.0'
| bsd-3-clause | Python |
de3f6f11286308a4b41b687c8417021951af9ce7 | Create bowmanLaughs.py | AlexEaton1105/computerScience | bowmanLaughs.py | bowmanLaughs.py | import time
laughCounter = 0
while 0 < 1:
laughYes = input("Has bowman laughed in the last 10 seconds? ")
if laughYes == "yes":
laughCounter = laughCounter + 1
print("Bowman laughed once.\n Bowman has laughed",laughCounter,"times.")
| mit | Python | |
ed2536b9e802aa4c12655e2348edaeed07a8aba1 | add predictor client | tttor/csipb-jamu-prj,tttor/csipb-jamu-prj,tttor/csipb-jamu-prj,tttor/csipb-jamu-prj,tttor/csipb-jamu-prj,tttor/csipb-jamu-prj,tttor/csipb-jamu-prj,tttor/csipb-jamu-prj,tttor/csipb-jamu-prj | drugtarget-pred/predictor_client.py | drugtarget-pred/predictor_client.py | #!/usr/bin/python
import psycopg2
import random
import numpy as np
import sys
import time
import os
import socket
conn = psycopg2.connect(database="ijah", user="ijah", password="123", host= "127.0.0.1", port = "5432")
cur = conn.cursor()
if __name__ == "__main__":
#init Variables
start = time.time()
sy... | mit | Python | |
23259e84da44a220f6f699d5bff3ad78b74d426a | read rgb values from gifs | Ibuprofen/zooplankton,zooplanktonproject/rpi | gif_parsers/read_rgb.py | gif_parsers/read_rgb.py | import json
from PIL import Image
from os import listdir
from os.path import isfile, join
mypath = "../data/gifs"
onlyfiles = [ f for f in listdir(mypath) if isfile(join(mypath,f)) ]
with open('../config/nodes.json') as data_file:
nodes = json.load(data_file)
for filename in onlyfiles:
if filename.endswith(".... | mit | Python | |
35fe7969f8a930170711a70500d465d17aa273f8 | Paste of the humidity py | ornicar/zen-catacomb,ornicar/zen-catacomb | rasp/humidity.py | rasp/humidity.py | import RPi.GPIO as GPIO
import time
def bin2dec(string_num):
return str(int(string_num, 2))
data = []
GPIO.setmode(GPIO.BCM)
GPIO.setup(4,GPIO.OUT)
GPIO.output(4,GPIO.HIGH)
time.sleep(0.025)
GPIO.output(4,GPIO.LOW)
time.sleep(0.02)
GPIO.setup(4, GPIO.IN, pull_up_down=GPIO.PUD_UP)
for i in range(0,500):
da... | apache-2.0 | Python | |
24447c27d3c7ee25589ee473ee78be18075ce0a1 | Add configuration file related utility functions. | racker/python-raxcli | raxcli/config.py | raxcli/config.py | # Copyright 2013 Rackspace
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the... | apache-2.0 | Python | |
ecf8999c0708731e3b56f20166d664c9b902f319 | add experimental module | ekzhu/datasketch,chubbymaggie/datasketch,ekzhu/datasketch | datasketch/experimental/__init__.py | datasketch/experimental/__init__.py | """
WARNING:
datasketch.experimental is dedicated to new modules that are to be merged into
the stable interface of datasketch. So their interfaces may change in future
versions.
To add a new class or function, register it here in this file. For example:
from new_module import NewModuleClass
"""
| mit | Python | |
f0ff4ff083f333732c71affdef8cc8fab2d184fd | Add hashing plugin | Cyanogenoid/smartbot,tomleese/smartbot,Muzer/smartbot,thomasleese/smartbot-old | plugins/hashing.py | plugins/hashing.py | import hashlib
class Plugin:
def __call__(self, bot):
bot.on_respond(r"(md5|sha|sha1|sha256|sha512) (.*)$", self.on_respond)
bot.on_help("hashing", self.on_help)
def on_respond(self, bot, msg, reply):
hash = hashlib.new(msg["match"].group(1))
hash.update(bytes(msg["match"].grou... | mit | Python | |
354990659f023d96dd3723720944101a140cfdf6 | Create happy.py | luisgustavoneves/happy,luisgustavoneves/happy | happy.py | happy.py | # -*- coding: utf-8
LANG = 'english'
wordlist = open('labMTwords-%s.csv' % LANG,'r').read().split('\n')
scores = open('labMTscores-%s.csv' % LANG,'r').read().split('\n')
import nltk
from nltk.tokenize import RegexpTokenizer
TOKENIZER = RegexpTokenizer('(?u)\W+|\$[\d\.]+|\S+')
SPECIAL_CHARS = ['.', ',', '!', '?']
def... | mit | Python | |
b0bedcbd293d21e5a08ecd1acbc11b3fe8c5b7e9 | Add lower index to tags | TomBaxter/osf.io,brianjgeiger/osf.io,adlius/osf.io,mfraezz/osf.io,HalcyonChimera/osf.io,sloria/osf.io,adlius/osf.io,baylee-d/osf.io,cwisecarver/osf.io,CenterForOpenScience/osf.io,chennan47/osf.io,caneruguz/osf.io,crcresearch/osf.io,chrisseto/osf.io,CenterForOpenScience/osf.io,chrisseto/osf.io,brianjgeiger/osf.io,icerev... | osf/migrations/0002_add_lower_index_to_tags.py | osf/migrations/0002_add_lower_index_to_tags.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2017-03-30 14:55
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('osf', '0001_initial'),
]
operations = [
migrations.RunSQL(
[
... | apache-2.0 | Python | |
11ed985e95991ab60b0dd0c0407219d569e14e4a | test branch | goddoe/AwsomeNN | test33.py | test33.py | test!!:
| mit | Python | |
9f58e46b18775bfa0f4bf23bf6b25a1e2488c6ae | Revert "removing migration script now that it's done" | jiffyclub/ipythonblocks.org,jiffyclub/ipythonblocks.org | scripts/migrate.py | scripts/migrate.py | """Script for migrating ipythonblocks grid data from SQLite to Postgres"""
import json
import os
from pathlib import Path
import sqlalchemy as sa
from sqlalchemy.orm import sessionmaker
# The module in the ipythonblocks.org application code that contains
# table definitions
from app import models
# SQLite DB related... | mit | Python | |
bc4a2a553460f90d66ca5d0991e34e11c3668c68 | Add form tests | kuzmich/django-spillway,bkg/django-spillway,barseghyanartur/django-spillway | tests/test_forms.py | tests/test_forms.py | from django.test import SimpleTestCase
from django.contrib.gis import geos
from spillway import forms
class GeometryQueryFormTestCase(SimpleTestCase):
def test_data(self):
form = forms.GeometryQueryForm({'srs': 3857})
self.assertTrue(form.is_valid())
self.assertEqual(form.cleaned_data['sr... | bsd-3-clause | Python | |
ea8b0193845d794b9612b0e78dffa772c15fbca3 | Add test for flexget utils (json) | JorisDeRieck/Flexget,antivirtel/Flexget,poulpito/Flexget,antivirtel/Flexget,tobinjt/Flexget,crawln45/Flexget,oxc/Flexget,drwyrm/Flexget,Pretagonist/Flexget,jawilson/Flexget,Danfocus/Flexget,sean797/Flexget,LynxyssCZ/Flexget,tarzasai/Flexget,tarzasai/Flexget,dsemi/Flexget,ianstalk/Flexget,OmgOhnoes/Flexget,LynxyssCZ/Fle... | tests/test_utils.py | tests/test_utils.py | from datetime import datetime
from flexget.utils import json
class TestJson(object):
def test_dt_encode(self):
date_str = '2016-03-11T17:12:17Z'
dt = datetime.strptime(date_str, '%Y-%m-%dT%H:%M:%SZ')
encoded_dt = json.dumps(dt, encode_datetime=True)
assert encoded_dt == '"%s"' % d... | mit | Python | |
b2d3cb99e03e3c0575d5512ba6dd67a1b02fae81 | Test utilities | Diwahars/pycon,njl/pycon,PyCon/pycon,njl/pycon,Diwahars/pycon,njl/pycon,Diwahars/pycon,PyCon/pycon,Diwahars/pycon,PyCon/pycon,PyCon/pycon,njl/pycon | pycon/tests/base.py | pycon/tests/base.py | from urlparse import parse_qs, urlparse
from django.conf import settings
from django.contrib.auth import login
from django.core.urlresolvers import reverse_lazy
from django.http import HttpRequest
from django.utils.encoding import force_text
class ViewTestMixin(object):
login_url = reverse_lazy('account_login')
... | bsd-3-clause | Python | |
bb48256e9091583897d9826cf5fa9d7116bd8486 | Add imagecodecs/__init__.py | cgohlke/imagecodecs,cgohlke/imagecodecs,cgohlke/imagecodecs | imagecodecs/__init__.py | imagecodecs/__init__.py | # -*- coding: utf-8 -*-
# imagecodecs/__init__.py
try:
from ._imagecodecs import __doc__
from ._imagecodecs import __version__
from ._imagecodecs import *
except ImportError as error:
import warnings
warnings.warn(
str(error) +
'\n\nThe _imagecodecs Cython extension module could not... | bsd-3-clause | Python | |
12a146f0726894a59f4cf1ba6bd22d35184e0398 | Create travis.py | ingwarsw/travis | travis.py | travis.py | #!/usr/bin/env python
import os, os.path, sys, tarfile, platform, urllib, xml.dom.minidom, subprocess
# https://github.com/Prototik/HoloEverywhere-Addon-Roboguice/blob/0d343e0ddd0607b0c9319eb21fdc50d451019f42/.travis.py
def main():
mvn_fetch()
mvn_test()
if os.environ["TRAVIS_SECURE_ENV_VARS"] == "true" && os... | apache-2.0 | Python | |
ef5ac053fc034cf674f848024ebc8d516f284a76 | Introduce new tests for multishop | shoopio/shoop,shoopio/shoop,shoopio/shoop | shuup_tests/admin/test_shop_provider.py | shuup_tests/admin/test_shop_provider.py | # This file is part of Shuup.
#
# Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
import pytest
from django.core.exceptions import ObjectDoesNotExist, PermissionDenied
from... | agpl-3.0 | Python | |
7966b02184c909540249bca37bec9349bdc919ca | add include no-depends example | lrq3000/tqdm | examples/include_no_requirements.py | examples/include_no_requirements.py | # How to import tqdm without enforcing it as a dependency
try:
from tqdm import tqdm
except:
def tqdm(*args, **kwargs):
if args:
return args[0]
return kwargs.get('iterable', None)
| mit | Python | |
f17ab1f86d326d62a8f02b05b533251126167678 | add converter for mnist data | jasonwbw/EffictiveRBM | rbm/autoencoder/converter.py | rbm/autoencoder/converter.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import numpy as np
import struct
import matplotlib.pyplot as plt
class Converter(object):
def __init__(self):
self.train_images = self.read_images('train-images.idx3-ubyte')
self.test_images = self.read_images('t10k-images.idx3-ubyte')
self.train_labels = self.re... | mit | Python | |
ae19d2e0bf1c7f808cd102a78bde25548bcb88b8 | Add a command to run the built in werkzeug server | robhudson/warehouse,mattrobenolt/warehouse,techtonik/warehouse,robhudson/warehouse,mattrobenolt/warehouse,mattrobenolt/warehouse,techtonik/warehouse | warehouse/cli.py | warehouse/cli.py | # Copyright 2013 Donald Stufft
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | # Copyright 2013 Donald Stufft
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | apache-2.0 | Python |
b46b8c65f81224f04fac94ff1fb1a15f41dc1347 | Add support for Twitch.tv | foauth/foauth.org,foauth/foauth.org,foauth/foauth.org | services/twitch.py | services/twitch.py | from werkzeug.urls import url_decode
import foauth.providers
class Twitch(foauth.providers.OAuth2):
# General info about the provider
provider_url = 'http://twitch.tv/'
docs_url = 'https://github.com/justintv/twitch-api'
category = 'Videos'
# URLs to interact with the API
authorize_url = 'htt... | bsd-3-clause | Python | |
38d0bd2ff06d272646011ccef03af2ed8ca3a1fb | Bump version to 2.3.5pbs.24 | pbs/django-cms,pbs/django-cms,pbs/django-cms,pbs/django-cms | cms/__init__.py | cms/__init__.py | # -*- coding: utf-8 -*-
__version__ = '2.3.5pbs.24'
default_app_config = 'cms.apps.CMSConfig'
| # -*- coding: utf-8 -*-
__version__ = '2.3.5pbs.23'
default_app_config = 'cms.apps.CMSConfig'
| bsd-3-clause | Python |
73c676d3ab2c4c668209dc04537561c7a2e3cd49 | Add sync field to Author model | rebearteta/social-ideation,joausaga/social-ideation,rebearteta/social-ideation,rebearteta/social-ideation,rebearteta/social-ideation,joausaga/social-ideation,joausaga/social-ideation,joausaga/social-ideation | ideascale/migrations/0011_author_sync.py | ideascale/migrations/0011_author_sync.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('ideascale', '0010_auto_20150513_1146'),
]
operations = [
migrations.AddField(
model_name='author',
n... | mit | Python | |
a357b4c85cc3c5481e994d425b3d17155579ec8a | Add migration | mitodl/micromasters,mitodl/micromasters,mitodl/micromasters,mitodl/micromasters | ecommerce/migrations/0010_coupon.py | ecommerce/migrations/0010_coupon.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-22 21:37
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('courses', '0019_courserun_... | bsd-3-clause | Python | |
3e10473f4126a7224cf3340d993cec68cca24385 | add station list getting code benchmark | JShadowMan/trainquery,JShadowMan/trainquery,JShadowMan/TraQuery,JShadowMan/TraQuery,JShadowMan/trainquery,JShadowMan/TraQuery | benchmark.py | benchmark.py | # -*- coding: UTF-8 -*-
from TraQuery import TraQuery
import time, random, threading
print 'Import Module Time In %.9f' % time.clock()
TraQuery.TraStationList.code('北京')
print 'Initialize Station List Takes %.9f sec\n' % time.clock()
stationLists = TraQuery.TraStationList.stationNames()
time.clock()
# 1... | mit | Python | |
be895d9bab2e28cdbccc809eeafb5026ee3b33f4 | Add {max,min}roundcardinality migration | dionyziz/rupture,esarafianou/rupture,esarafianou/rupture,dionyziz/rupture,dionyziz/rupture,dimkarakostas/rupture,dionyziz/rupture,dionyziz/rupture,esarafianou/rupture,dimriou/rupture,dimriou/rupture,dimkarakostas/rupture,dimkarakostas/rupture,esarafianou/rupture,dimriou/rupture,dimkarakostas/rupture,dimkarakostas/ruptu... | backend/breach/migrations/0010_auto_20160318_0018.py | backend/breach/migrations/0010_auto_20160318_0018.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-03-18 00:18
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('breach', '0009_victim_method'),
]
operations = [
migrations.RemoveField(
... | mit | Python | |
b5459119c825213717274aac933833557d726cb5 | Tweak getset_item | OmgOhnoes/Flexget,oxc/Flexget,tvcsantos/Flexget,LynxyssCZ/Flexget,X-dark/Flexget,asm0dey/Flexget,sean797/Flexget,lildadou/Flexget,OmgOhnoes/Flexget,qk4l/Flexget,jawilson/Flexget,LynxyssCZ/Flexget,antivirtel/Flexget,lildadou/Flexget,X-dark/Flexget,crawln45/Flexget,tobinjt/Flexget,qvazzler/Flexget,ZefQ/Flexget,Danfocus/F... | flexget/ui/plugins/config/config.py | flexget/ui/plugins/config/config.py | from __future__ import unicode_literals, division, absolute_import
import logging
from flask import request, Module, jsonify, json
from flexget.ui.webui import manager, register_plugin
config = Module(__name__)
log = logging.getLogger('ui.config')
@config.route('/', methods=['GET', 'POST'])
def root():
if re... | from __future__ import unicode_literals, division, absolute_import
import logging
from flask import request, Module, jsonify, json
from flexget.ui.webui import manager, register_plugin
config = Module(__name__)
log = logging.getLogger('ui.config')
@config.route('/', methods=['GET', 'POST'])
def root():
if re... | mit | Python |
6c0589f9b72e0e29d69d346c1db31445f40684f5 | Add a tags topping | mcdevs/Burger,Pokechu22/Burger | burger/toppings/tags.py | burger/toppings/tags.py | from .topping import Topping
try:
import json
except ImportError:
import simplejson as json
class TagsTopping(Topping):
"""Provides a list of all block and item tags"""
PROVIDES = [
"tags"
]
DEPENDS = []
@staticmethod
def act(aggregate, classloader, verbose=False):
ta... | mit | Python | |
828c93c363525ebed649ccd572ed6a5286dcdf53 | Create register.py | Dockerlover/docker-discover,Dockerlover/docker-discover | register.py | register.py | from docker import Client
import etcd
import time
import os
POLL_TIMEOUT=60
ETCD_HOST = os.environ["ETCD_HOST"]
HOST_IP = os.environ["HOST_IP"]
DOCKER_HOST = os.environ["DOCKER_HOST"]
def get_images():
c = Client(base_url=DOCKER_HOST)
images = c.images()
return images
def get_containers():
c = Client(base_... | apache-2.0 | Python | |
5de947b8624bec24234a35bcd980b8392b80ef0c | Add missing migration | pitpalme/volunteer_planner,pitpalme/volunteer_planner,volunteer-planner/volunteer_planner,alper/volunteer_planner,flindenberg/volunteer_planner,volunteer-planner/volunteer_planner,christophmeissner/volunteer_planner,alper/volunteer_planner,flindenberg/volunteer_planner,coders4help/volunteer_planner,pitpalme/volunteer_p... | blueprint/migrations/0003_auto_20151006_1341.py | blueprint/migrations/0003_auto_20151006_1341.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('blueprint', '0002_needblueprint_slots'),
]
operations = [
migrations.AlterModelOptions(
name='blueprintcreator',... | agpl-3.0 | Python | |
bcf7569f69182a7206778a94500d0ed013daeadb | add remove by name test | google-code-export/los-cocos,google-code-export/los-cocos | test/test_remove_add_by_name.py | test/test_remove_add_by_name.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
from cocos.layer import *
if __name__ == "__main__":
director.init( resizable=True )
main_scene ... | bsd-3-clause | Python | |
ae7b5c2fc7fc862207efbc0af6f350ef65755d4a | add FluentSender | yosisa/pyfluent,yosisa/pyfluent | pyfluent/client.py | pyfluent/client.py | # -*- coding: utf-8 -*-
import time
import socket
from collections import deque
import msgpack
class FluentSender(object):
def __init__(self, tag, host='localhost', port=24224, timeout=1,
capacity=None):
self.default_tag = tag
self.host = host
self.port = port
se... | apache-2.0 | Python | |
e87a00dca134332d5f261dff5411578600f3ef1e | add (very) basic frontend tests | CollectQT/qapc,CollectQT/qapc | test/test_frontend.py | test/test_frontend.py | # builtin
import os
import sys
############################################################
# setup
############################################################
# http://flask.pocoo.org/docs/0.11/testing/
base_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')
sys.path.append(base_dir)
from main ... | agpl-3.0 | Python | |
263756a848ad7f8aad60a6a5efd468ad6e116fd3 | add ingest_forced.py script to ingest forced source catalogs into db tables | DarkEnergyScienceCollaboration/Twinkles,DarkEnergyScienceCollaboration/Twinkles,LSSTDESC/Twinkles,LSSTDESC/Twinkles | bin/ingest_forced.py | bin/ingest_forced.py | #!/usr/bin/env python
"""
Ingest into a MySQL database the forced source catalogs from a Level 2
analysis.
"""
import os
import argparse
import desc.twinkles
import desc.twinkles.db_table_access as db_table_access
description = """Ingest forced source catalogs into ForcedSource
database tables."""
parser = argparse.A... | mit | Python | |
375502b4fc158f63297a817ec111797fbc0e9ee7 | Create __init__.py in chardet.cli | ddboline/chardet,barak066/chardet,chardet/chardet,memnonila/chardet,memnonila/chardet,chardet/chardet,ddboline/chardet,barak066/chardet,asdfsx/chardet,asdfsx/chardet | chardet/cli/__init__.py | chardet/cli/__init__.py | lgpl-2.1 | Python | ||
10b9d534d3345cdcea100e2658405a54164e77ad | Create ballistic.py | SirJanzelot/ballistic_arma3 | ballistic.py | ballistic.py | # Ballistischer Rechner für ArmA:3, tested with Python 3.5.1
# Muzzle velocities by SMPCrafter and SirJanzelot
# todo: check(vel_veh), drag, Crosswind, MRSI
import math, sys, numpy as np
class CooError(Exception):
pass
class RngError(Exception):
pass
g= 9.80665
Temp= 273.15 + 20
shell_mass= [0,0,0,0]
drag_coeff... | mit | Python | |
089bdf2404ab66bc1c2973f97e3f676990a131c1 | Add irccloud.py | TotallyNotRobots/znc-modules | python/irccloud.py | python/irccloud.py | import znc
__version__ = "0.1.0"
__author__ = "linuxdaemon"
class irccloud(znc.Module):
description = "IRCCloud login"
module_types = [znc.CModInfo.GlobalModule]
def OnSendToClient(self, line, client):
if client.GetUser():
return znc.CONTINUE
parts = str(line).split()
... | mit | Python | |
9205b25995c2bed3d0dbc64304dd1d1f0071ed22 | Add java_grpc_library rule that uses bazel's native proto_library. | bazelbuild/bazel,akira-baruah/bazel,werkt/bazel,snnn/bazel,damienmg/bazel,bazelbuild/bazel,akira-baruah/bazel,ButterflyNetwork/bazel,aehlig/bazel,dslomov/bazel,bazelbuild/bazel,ButterflyNetwork/bazel,spxtr/bazel,cushon/bazel,spxtr/bazel,variac/bazel,cushon/bazel,dropbox/bazel,damienmg/bazel,bazelbuild/bazel,dslomov/baz... | third_party/grpc/build_defs.bzl | third_party/grpc/build_defs.bzl | """BUILD rules to generate gRPC service interfaces.
You need to load the rules in your BUILD file for use, like:
load("//third_party/grpc:build_defs.bzl", "java_grpc_library")
"""
def _path_ignoring_repository(f):
if (len(f.owner.workspace_root) == 0):
return f.short_path
return f.path[len(f.owner.workspace_roo... | apache-2.0 | Python | |
c7fe8e2a186d094d49c7c9218ba63bd8a7cdd024 | Update script for problem 15 on pe | yuriyshapovalov/Prototypes,yuriyshapovalov/Prototypes,yuriyshapovalov/Prototypes | ProjectEuler/prob15.py | ProjectEuler/prob15.py | # projecteuler.net/problem=15
def main():
answer = LatticePaths(20)
print(answer)
def LatticePaths(x):
x += 1 # each item represent not cell but line (for close lattice n+1)
arr = [[0 for i in range(0, x)] for i in range(0, x)]
arr[0][0] = 1
for i in range(0, x):
arr[0][i] = 1
... | apache-2.0 | Python | |
2f3d43e416e3f5c378160d40d9f60cec84be45f0 | Create bomb_baby.py | hirenvasani/foobar | bomb_baby.py | bomb_baby.py | ''''
Challenge 3.3
Bomb, Baby!
===========
You're so close to destroying the LAMBCHOP doomsday device you can taste it! But in order to do so, you need to deploy special self-replicating bombs designed for you by the brightest scientists on Bunny Planet. There are two types: Mach bombs (M) and Facula bombs (F). The bo... | mit | Python | |
af88fb482eebdcfb660df8cd31198eb9a3f12645 | add bootstrap.py | motmot/flytrax,motmot/flytrax | bootstrap.py | bootstrap.py | ##############################################################################
#
# Copyright (c) 2006 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SO... | bsd-3-clause | Python | |
b588d426ec500db82995fa830298757f7a1afd52 | Add little script to test 2 uvfits files for equality | HERA-Team/pyuvdata,HERA-Team/pyuvdata,HERA-Team/pyuvdata,HERA-Team/pyuvdata | scripts/test_uvfits_equal.py | scripts/test_uvfits_equal.py | #! /usr/bin/env python
import argparse
import os.path as op
from uvdata.uv import UVData
parser = argparse.ArgumentParser()
parser.add_argument('uvfits1',
help='name of first uvfits file.')
parser.add_argument('uvfits2',
help='name of second uvfits file to compare to first.')
... | bsd-2-clause | Python | |
da247152e4c93a97fe3e72d731496035d23ff40a | add demo script for raster download | gena/qgis-earthengine-plugin,gena/qgis-earthengine-plugin | examples/download_by_canvas.py | examples/download_by_canvas.py | import json
import ee
from ee_plugin import Map
from ee_plugin.contrib import palettes
dem = ee.Image('JAXA/ALOS/AW3D30/V2_2').select('AVE_DSM')
Map.addLayer(dem, { 'min': 0, 'max': 3000 }, 'DEM', True)
# MANUAL STEP: use "Create layer from extent" tool and activate the resulting layer
# get first feature geometry f... | mit | Python | |
be4d43fb941331289052c109e8aca5d280bfd5d0 | add utils | razeh/mecode,alexvalentine/mecode,travisbusbee/mecode,jminardi/mecode | mecode/utils.py | mecode/utils.py | import numpy as np
def profile_surface(g, kp, x_start, x_stop, x_step, y_start, y_stop, y_step):
"""
Parameters
----------
start : tuple of len 2
The upper left corner of the rectangle to profile
Notes
-----
Any previously set software homes with be cleared.
"""
g.clear_... | mit | Python | |
095edef4b00ab16530b48952abe61f3bff84df78 | Add BME280 sensor. | dmkent/sensor-feed | sensor_feed/sensor_bme280.py | sensor_feed/sensor_bme280.py | """
Adafruit BME280 temp/press/hum
"""
from datetime import datetime
import logging
from threading import Event, Thread
import time
import Adafruit_BME280
from sensor_feed.sensor_multi import MultiSensorDevice, ChildSensor
LOGGER = logging.getLogger(__name__)
class BME280Sensor(MultiSensorDevice):
"""Adafruit... | mit | Python | |
0572bfea1ee1668c94295e3152f6766490373515 | Fix format | elviswf/chainer,muupan/chainer,chainer/chainer,tigerneil/chainer,okuta/chainer,chainer/chainer,hvy/chainer,jnishi/chainer,ysekky/chainer,cupy/cupy,niboshi/chainer,anaruse/chainer,okuta/chainer,tereka114/chainer,AlpacaDB/chainer,hidenori-t/chainer,cupy/cupy,t-abe/chainer,pfnet/chainer,hvy/chainer,keisuke-umezawa/chainer... | examples/sentiment/download.py | examples/sentiment/download.py | #!/usr/bin/env python
import urllib, zipfile, os, os.path
urllib.urlretrieve('http://nlp.stanford.edu/sentiment/trainDevTestTrees_PTB.zip', 'trainDevTestTrees_PTB.zip')
zf = zipfile.ZipFile('trainDevTestTrees_PTB.zip')
for name in zf.namelist():
(dirname, filename) = os.path.split(name)
if not filename == '':
... | #!/usr/bin/env python
import urllib, zipfile, os, os.path
urllib.urlretrieve('http://nlp.stanford.edu/sentiment/trainDevTestTrees_PTB.zip', 'trainDevTestTrees_PTB.zip')
zf = zipfile.ZipFile('trainDevTestTrees_PTB.zip')
for name in zf.namelist():
(dirname, filename) = os.path.split(name)
if not filename == '':
z... | mit | Python |
1f544e236d76b6a13d15577a0a6719ae2a21a9ec | Create identifier.py | henrik645/rpp | identifier.py | identifier.py | class Identifier:
def __init__(self, id):
self.id = id
def eval(self, env):
if self.id in env:
return env[self.id]
else:
error("Referencing " + self.id + " before assignment")
def __repr__(self):
return "Identifier: {0}".format(self.i... | mit | Python | |
3fcaa8d45c91b8aa03f7bdbdd94beace328a765c | Add a test for Vector2.convert | ppb/ppb-vector,ppb/ppb-vector | tests/test_convert.py | tests/test_convert.py | import pytest # type: ignore
from ppb_vector import Vector2
from utils import *
@pytest.mark.parametrize('vector_like', UNIT_VECTOR_LIKES) # type: ignore
def test_convert_subclass(vector_like):
class V(Vector2): pass
# test_binop_vectorlike already checks the output value is correct
assert isinstance(V.... | artistic-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.