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 |
|---|---|---|---|---|---|---|---|---|
4f3854eaf8d6e4b0ad9a77e871a946916ab3fec6 | Migrate listings.syndication, FeedType.content_type should not be unique. | wtrevino/django-listings,wtrevino/django-listings | listings/syndication/migrations/0002_auto__del_unique_feedtype_content_type.py | listings/syndication/migrations/0002_auto__del_unique_feedtype_content_type.py | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'FeedType', fields ['content_type']
db.delete_unique('syndication_feedtype',... | mit | Python | |
7b1fb0eb7f063c00c89b57ceca64a01881a7d4d9 | add const_thrust helper | nesl/crazyflie_ros,whoenig/crazyflie_ros,marktsai0316/crazyflie_ros,robotpilot/crazyflie_ros,marktsai0316/crazyflie_ros,whoenig/crazyflie_ros,nesl/crazyflie_ros,robotpilot/crazyflie_ros | crazyflie_demo/scripts/const_thrust.py | crazyflie_demo/scripts/const_thrust.py | #!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist
if __name__ == '__main__':
rospy.init_node('crazyflie_demo_const_thrust', anonymous=True)
p = rospy.Publisher('cmd_vel', Twist)
twist = Twist()
r = rospy.Rate(50)
#for i in range(0, 100):
# p.publish(twist)
# r.sl... | mit | Python | |
50331d662d67d9f625f9f9198988522b38b2d1f0 | add task for midnight search index update, https://www.pivotaltracker.com/story/show/13730025 | ofer43211/unisubs,pculture/unisubs,ReachingOut/unisubs,pculture/unisubs,ofer43211/unisubs,wevoice/wesub,ujdhesa/unisubs,ofer43211/unisubs,wevoice/wesub,pculture/unisubs,eloquence/unisubs,norayr/unisubs,ReachingOut/unisubs,norayr/unisubs,eloquence/unisubs,pculture/unisubs,ujdhesa/unisubs,ofer43211/unisubs,wevoice/wesub,... | apps/search/tasks.py | apps/search/tasks.py | from utils.celery_search_index import LogEntry
from utils.celery_utils import task
from celery.schedules import crontab
from celery.decorators import periodic_task
from django.core.management import call_command
@periodic_task(run_every=crontab(minute=0, hour=0))
def update_search_index():
call_command('update_ind... | agpl-3.0 | Python | |
3c2438049da743b53cb7a536ddc2db1a05302a33 | Add grab.tools.logs to configure logging module | giserh/grab,SpaceAppsXploration/grab,subeax/grab,codevlabs/grab,DDShadoww/grab,istinspring/grab,liorvh/grab,SpaceAppsXploration/grab,kevinlondon/grab,maurobaraldi/grab,lorien/grab,subeax/grab,subeax/grab,shaunstanislaus/grab,lorien/grab,alihalabyah/grab,pombredanne/grab-1,raybuhr/grab,shaunstanislaus/grab,alihalabyah/g... | grab/tools/logs.py | grab/tools/logs.py | import logging
def default_logging(grab_log='/tmp/grab.log'):
"""
Customize logging output to display all log messages
except grab network logs.
Redirect grab network logs into file.
"""
logging.basicConfig(level=logging.DEBUG)
glog = logging.getLogger('grab')
glog.propagate = False
... | mit | Python | |
4662b430087404dbf011cf9ad97ee1e3188bfb9d | create wrapper for c_curve | lcdb/lcdb-workflows,lcdb/lcdb-workflows,lcdb/lcdb-workflows | wrappers/preseq/observed_complexity/wrapper.py | wrappers/preseq/observed_complexity/wrapper.py | __author__ = "Behram Radmanesh"
__copyright__ = "Copyright 2016, Behram Radmanesh"
__email__ = "behram.radmanesh@nih.gov"
__license__ = "MIT"
# import snakemake's ability to execute shell commands
from snakemake.shell import shell
# execute preseq c_curve
shell("preseq c_curve {snakemake.params} {snakemake.input[0]} ... | mit | Python | |
ec1b3be5545d5ae530d3dc7dd8d90e6fe4730926 | add unittest for heap | hubo1016/vlcp,hubo1016/vlcp,hubo1016/vlcp,hubo1016/vlcp | tests/testIndexedHeap.py | tests/testIndexedHeap.py | '''
Created on 2017/9/29
:author: hubo
'''
import unittest
from random import randrange, sample
from vlcp.utils.indexedheap import IndexedHeap
class Test(unittest.TestCase):
def testRandomSort(self):
data = [(randrange(0,10000), randrange(0,10000)) for _ in range(0,1000)]
data = list((v,k)
... | apache-2.0 | Python | |
5db58544133c66c5cbb4122c99a95a0ca6ddfa26 | Create RomeOculus.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | home/Alessandruino/RomeOculus.py | home/Alessandruino/RomeOculus.py | i01 = Runtime.createAndStart("i01","InMoov")
i01.startHead("/dev/tty.usbmodem1411")
#i01.startLeftArm("COM5")
#leftHand = i01.startLeftHand("COM5")
#i01.leftArm.bicep.setMinMax(5,80)
#i01.leftArm.bicep.moveTo(30)
oculus = Runtime.start("oculus","OculusDIY")
oculus.arduino.connect("/dev/tty.usbmodem14541")
def onOcul... | apache-2.0 | Python | |
c5fba0cc8acb482a0bc1c49ae5187ebc1232dba3 | Add tests for the different input variations. | asfaltboy/directions.py,jwass/directions.py,samtux/directions.py | tests/test_directions.py | tests/test_directions.py | import unittest
from shapely.geometry import LineString, Point
from directions.base import _parse_points
class DirectionsTest(unittest.TestCase):
def setUp(self):
self.p = [(1,2), (3,4), (5,6), (7,8)]
self.line = LineString(self.p)
def test_origin_dest(self):
result = _parse_points(s... | bsd-3-clause | Python | |
635682c9d206cd9ae6ea184f9361937b0a272b90 | Add monadic utilities MonadicDict and MonadicDictCursor. | genenetwork/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2 | wqflask/utility/monads.py | wqflask/utility/monads.py | """Monadic utilities
This module is a collection of monadic utilities for use in
GeneNetwork. It includes:
* MonadicDict - monadic version of the built-in dictionary
* MonadicDictCursor - monadic version of MySQLdb.cursors.DictCursor
that returns a MonadicDict instead of the built-in dictionary
"""
from collection... | agpl-3.0 | Python | |
d21e0721b614423e07e81809fb60dd936494bfff | Add validators test | johnwlockwood/txnats | tests/test_validators.py | tests/test_validators.py | import attr
from twisted.trial import unittest
import txnats
from txnats.validators import is_instance_of_nats_protocol
@attr.s
class Foo(object):
protocol = attr.ib(default=None,
validator=attr.validators.optional(
is_instance_of_nats_protocol
)
)
class IsNatsProtocolTest(unit... | mit | Python | |
45f26b56d177798efca4825f063372b505df6a76 | Add gameman test | strata8/savman | tests/gameman_test.py | tests/gameman_test.py | import pytest
from savman import gameman
@pytest.fixture
def dir1(tmpdir):
return tmpdir.mkdir('dir1')
@pytest.fixture
def dir2(tmpdir):
return tmpdir.mkdir('dir2')
@pytest.fixture
def customfile(tmpdir, dir1, dir2):
file = tmpdir.join('custom.txt')
custom = '''
---
name: My Game
directory: {}
includ... | mit | Python | |
1e3781bc3527f72053fdc4aad4f4887c567c457c | Add unicode test. | paul-xxx/micropython,ericsnowcurrently/micropython,MrSurly/micropython-esp32,praemdonck/micropython,Vogtinator/micropython,slzatz/micropython,warner83/micropython,Vogtinator/micropython,Peetz0r/micropython-esp32,cloudformdesign/micropython,ernesto-g/micropython,methoxid/micropystat,pramasoul/micropython,jlillest/microp... | tests/unicode/unicode.py | tests/unicode/unicode.py | # Test a UTF-8 encoded literal
s = "asdf©qwer"
for i in range(len(s)):
print("s[%d]: %s %X"%(i, s[i], ord(s[i])))
# Test all three forms of Unicode escape, and
# all blocks of UTF-8 byte patterns
s = "a\xA9\xFF\u0123\u0800\uFFEE\U0001F44C"
for i in range(-len(s), len(s)):
print("s[%d]: %s %X"%(i, s[i], ord... | mit | Python | |
40154d7de207df9689ac220cc8966735cb3ed5af | Test asyncio in python 3.6 | theia-log/theia,theia-log/theia | tests/test_asyncio.py | tests/test_asyncio.py | import asyncio
async def routine0(s,n):
print('CRT:',s,':',n)
async def routine(id, n):
print('TEST[%s] %d'%(id,n))
if not n:
return
n -= 1
await routine(id, n)
await routine0(id, n)
loop = asyncio.get_event_loop()
tasks = [
asyncio.ensure_future(routine('a',5)),
asyncio.ensure_future(routine('b'... | apache-2.0 | Python | |
c63651a5fba9dd67b345bfb95adef5d6206f5da3 | Add file lock | huangjunwen/tagcache | tagcache/lock.py | tagcache/lock.py | # -*- encoding: utf-8 -*-
import os
import fcntl
class FileLock(object):
def __init__(self, path):
self.path = path
self.fd = None
def acquire(self, write=False, block=True):
if self.fd is not None:
self.release()
try:
# open or create the file
... | mit | Python | |
3625646c34fed4c5081e73c175e257ee426a4c37 | Fix reproduce_state | ct-23/home-assistant,rohitranjan1991/home-assistant,philipbl/home-assistant,kennedyshead/home-assistant,GenericStudent/home-assistant,ct-23/home-assistant,fbradyirl/home-assistant,jamespcole/home-assistant,dmeulen/home-assistant,alanbowman/home-assistant,hexxter/home-assistant,deisi/home-assistant,molobrakos/home-assis... | homeassistant/helpers/state.py | homeassistant/helpers/state.py | """
homeassistant.helpers.state
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Helpers that help with state related things.
"""
import logging
from homeassistant.core import State
import homeassistant.util.dt as dt_util
from homeassistant.const import (
STATE_ON, STATE_OFF, SERVICE_TURN_ON, SERVICE_TURN_OFF,
SERVICE_MEDIA_PLAY,... | """
homeassistant.helpers.state
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Helpers that help with state related things.
"""
import logging
from homeassistant.core import State
import homeassistant.util.dt as dt_util
from homeassistant.const import (
STATE_ON, STATE_OFF, SERVICE_TURN_ON, SERVICE_TURN_OFF,
SERVICE_MEDIA_PLAY,... | apache-2.0 | Python |
dfe833e811ed7e2a3860555ef75fb9c64c76cc28 | Create test_fitting.py | ProjectPyRhO/PyRhO,ProjectPyRhO/PyRhO | tests/test_fitting.py | tests/test_fitting.py | import numpy as np
from pyrho import Parameters, fitModels
from pyrho.datasets import loadChR2
def test_fit_3_state_model():
init_params = Parameters()
init_params.add_many(
# Name Value Vary Min Max Expr
('g0', 1e5, True, 0.001, 1e6, None),
('phi_m',1e18, T... | bsd-3-clause | Python | |
1fe84191c0f67af445e0b140efe67e90ae1e4c6f | Use set instead of ordered dict. | Sportamore/blues,Sportamore/blues,5monkeys/blues,Sportamore/blues,5monkeys/blues,5monkeys/blues | blues/slack.py | blues/slack.py | """
Slack Blueprint
===============
**Fabric environment:**
.. code-block:: yaml
settings:
slack:
# Single config:
endpoint: https://hooks.slack.com/... # (Required)
channels: # (Required)
- "#deploy"
username: deploybot
icon_emo... | """
Slack Blueprint
===============
**Fabric environment:**
.. code-block:: yaml
settings:
slack:
# Single config:
endpoint: https://hooks.slack.com/... # (Required)
channels: # (Required)
- "#deploy"
username: deploybot
icon_emo... | mit | Python |
7963e426e2d1f58105d8712c0379114d93d32b07 | Add example with sklearn pipeline | lmcinnes/umap,lmcinnes/umap | examples/plot_feature_extraction_classification.py | examples/plot_feature_extraction_classification.py | """
UMAP as a Feature Extraction Technique for Classification
---------------------------------------------------------
The following script shows how UMAP can be used as a feature extraction
technique to improve the accuracy on a classification task. It also shows
how UMAP can be integrated in standard scikit-learn p... | bsd-3-clause | Python | |
dbaf32db0f9a5c00731e2682dd171e00914d29f0 | implement AQOUT mean drawdown standard error calculation | Timothy-W-Hilton/TimPyUtils | timutils/std_error.py | timutils/std_error.py | """module to implement standard error calculation, with optional
effective sample size adjustment of Wilks (1995)
REFERENCES
Wilks, D. (1995), Statistical Methods in the Atmospheric Sciences: An
Introduction, Academic Press, New York.
"""
import numpy as np
import pandas as pd
class MeanStdError(object):
"""cl... | mit | Python | |
a6bbcdd9a28b4ad3ebc5319ab849bd9116b2f0c6 | Create 7kyu_how_many_points.py | Orange9000/Codewars,Orange9000/Codewars | Solutions/7kyu/7kyu_how_many_points.py | Solutions/7kyu/7kyu_how_many_points.py | def get_los_angeles_points(results):
return sum(int(j.split(':')[0]) for i,j in results if __import__('re').fullmatch('Los\sAngeles\s[a-zA-Z]+$', i))
| mit | Python | |
7efa9d9e9c98fc15233cb9fea81ae13520c5e52d | Add example print queue manager | CON-In-A-Box/CIAB-SignIn,CON-In-A-Box/CIAB-SignIn,CON-In-A-Box/ConComSignIn,CON-In-A-Box/ConComSignIn,CON-In-A-Box/CIAB-SignIn,CON-In-A-Box/CIAB-SignIn,CON-In-A-Box/ConComSignIn,CON-In-A-Box/ConComSignIn | tools/queuemanager.py | tools/queuemanager.py | #!/usr/bin/env python3
"""
Manage the printing queue for local printers
"""
import argparse
import getpass
import time
import json
import requests
CLIENT = "ciab"
def connect(server, account, password):
''' Connect to a server '''
url = server+"/api/token"
param = {'grant_type':'password', 'username'... | apache-2.0 | Python | |
824623c9f836c1591d89f7292fc1f406a1af189a | add a stub test for job manipulation | sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint | test/jobstest.py | test/jobstest.py | #!/usr/bin/python2.4
#
# Copyright (c) 2004-2005 rpath, Inc.
#
import testsuite
testsuite.setup()
import rephelp
class ReleaseTest(rephelp.RepositoryHelper):
def testBasicAttributes(self):
client = self.getMintClient("testuser", "testpass")
projectId = client.newProject("Foo", "foo", "rpath.org")... | apache-2.0 | Python | |
af205246543fbb874ebf20b530fac04a3ba9808c | Add some notes to graph script | jay-tyler/data-structures,jonathanstallings/data-structures | graph.py | graph.py | from __future__ import unicode_literals
class Graph(object):
"""A class for a simple graph data structure."""
def __init__(self):
self.graph = {}
def __repr__(self): # Consider how we want to repr this.
return repr(self.graph)
def __len__(self):
return len(self.graph)
d... | mit | Python | |
5d554573031f2f7b60d963c587aa650a025f6c45 | Create tutorial3.py | tiggerntatie/ggame-tutorials | tutorial3.py | tutorial3.py | """
tutorial3.py
by E. Dennison
"""
from ggame import App, RectangleAsset, ImageAsset, SoundAsset, Sprite, Sound
from ggame import LineStyle, Color
SCREEN_WIDTH = 640
SCREEN_HEIGHT = 480
green = Color(0x00ff00, 1)
black = Color(0, 1)
noline = LineStyle(0, black)
bg_asset = RectangleAsset(SCREEN_WIDTH, SCREEN_HEIGHT, ... | mit | Python | |
bcaa60ce73134e80e11e7df709e7ba7dbc07d349 | Add tests for systemd module | justin8/portinus,justin8/portinus | tests/test_systemd.py | tests/test_systemd.py | #!/usr/bin/env python3
import unittest
from unittest import mock
from unittest.mock import MagicMock, patch
from portinus import systemd
class testSystemd(unittest.TestCase):
def setUp(self):
systemd.subprocess.check_output = MagicMock(return_value=True)
self.unit = systemd.Unit('foo')
def ... | mit | Python | |
0c3107739671398de1a206cfbb7673c25c543e60 | Update driver value in Seat model. | SRJ9/django-driver27,SRJ9/django-driver27,SRJ9/django-driver27 | driver27/migrations/0009_populate_driver_in_seats.py | driver27/migrations/0009_populate_driver_in_seats.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def populate_driver_in_seats(apps, schema_editor):
Seat = apps.get_model("driver27", "Seat")
for seat in Seat.objects.all():
driver = seat.contender.driver
seat.driver = driver
sea... | mit | Python | |
ba239762d34db9e13708d4e0828e2f8adba4e8bc | add sensapex accuracy test script | campagnola/acq4,acq4/acq4,pbmanis/acq4,acq4/acq4,campagnola/acq4,campagnola/acq4,acq4/acq4,pbmanis/acq4,campagnola/acq4,pbmanis/acq4,pbmanis/acq4,acq4/acq4 | acq4/drivers/sensapex/accuracy_test.py | acq4/drivers/sensapex/accuracy_test.py |
from __future__ import print_function
import os, sys, time
import numpy as np
import acq4.pyqtgraph as pg
from acq4.drivers.sensapex import SensapexDevice, UMP, UMPError
ump = UMP.get_ump()
devids = ump.list_devices()
devs = {i:SensapexDevice(i) for i in devids}
print("SDK version:", ump.sdk_version())
print("Found ... | mit | Python | |
3b4c811f0b45f5739ce7c0d64f31eb2c2c9a7f4b | add battery | EdisonAlgorithms/HackerRank,zeyuanxy/hacker-rank,EdisonAlgorithms/HackerRank,EdisonAlgorithms/HackerRank,zeyuanxy/hacker-rank,EdisonCodeKeeper/hacker-rank,EdisonCodeKeeper/hacker-rank,EdisonCodeKeeper/hacker-rank,EdisonAlgorithms/HackerRank,EdisonCodeKeeper/hacker-rank,zeyuanxy/hacker-rank,EdisonCodeKeeper/hacker-rank,... | ai/machine-learning/battery/battery.py | ai/machine-learning/battery/battery.py | from numpy import *
def loadData():
xArr, yArr = [], []
for i in open('trainingdata.txt'):
line = map(float, i.split(','))
if line[0] < 4:
xArr.append(line[:-1])
yArr.append(line[-1])
return xArr, yArr
def lineReg(xArr, yArr):
xMat = mat(xArr); yMat = mat(yArr).... | mit | Python | |
023e587e28e148be3a21d4cb34a702a68ef02a0b | test script to list root dirs of image files | yellcorp/floppy-recovery | testdir.py | testdir.py | #!/usr/local/bin/python
import sys
import disklib.mediageom
import disklib.validity
import msfat.dir
import msfat.volume
def main():
prog_errs = [ ]
for path in sys.argv[1:]:
print path
try:
validity = disklib.validity.read_validity_for_file(path)
with open(path, "rb") as stream:
geometry = diskli... | mit | Python | |
87b2d15f1953d75c1a55259370f36f5ea4d3fea9 | Create testing.py | joshgrib/course-scheduler,joshgrib/course-scheduler | testing.py | testing.py | '''
Maybe an easier format?
http://web.stevens.edu/scheduler/cor 2015F/sched_plus_crsemtg.txt
Got there by going back to the "core" part of the url then going to that text file (plus course meeting?)
'''
courses = {\
'BT 353A' : ["M","1300","1350"] , \
'BT 353A' : ["W","1100","1240"] , \
'BT 353B' : ["M","1500","1... | mit | Python | |
338f8d95df785b49eb0c00209535bfde675b6ce9 | Create release_jobs_from_hold.py | IGB-UIUC/Biocluster,IGB-UIUC/Biocluster,IGB-UIUC/Biocluster,IGB-UIUC/Biocluster | release_jobs_from_hold.py | release_jobs_from_hold.py | #!/usr/bin/env perl
use strict;
use Getopt::Long;
my $usage = "\t\t --usage $0 job_id=<PBS JOB ID> min=<Start of array> max=<End of array>\n";
my $command = "releasehold -a";
my $job_id;
my $min;
my $max;
$\= "\n";
if (! scalar(@ARGV) ) {
die $usage . scalar @ARGV;
}
GetOptions ("job_id=i" => \$job_... | apache-2.0 | Python | |
fb03cd60646e56a789e61471f5bb6772f7035d6e | add test for io | osoken/kisell | tests/test_io.py | tests/test_io.py | # -*- coding: utf-8 -*-
import os
import re
import unittest
from kisell.core import Origin, Pipe
from kisell import io
_license_file_path = os.path.join(
os.path.dirname(os.path.dirname(__file__)), 'LICENSE'
)
_license_file_content = None
with open(_license_file_path, 'r') as f:
_license_file_con... | mit | Python | |
f1e47cc7854b0cb98f384ec866571aeaab96edd7 | Add forgotten migration | hasanalom/ggrc-core,andrei-karalionak/ggrc-core,plamut/ggrc-core,edofic/ggrc-core,plamut/ggrc-core,selahssea/ggrc-core,prasannav7/ggrc-core,plamut/ggrc-core,kr41/ggrc-core,AleksNeStu/ggrc-core,j0gurt/ggrc-core,NejcZupec/ggrc-core,jmakov/ggrc-core,hyperNURb/ggrc-core,NejcZupec/ggrc-core,AleksNeStu/ggrc-core,edofic/ggrc-... | src/ggrc/migrations/versions/20130805234925_4752027f1c40_create_directive_met.py | src/ggrc/migrations/versions/20130805234925_4752027f1c40_create_directive_met.py | """Create Directive.meta_kind
Revision ID: 4752027f1c40
Revises: 3a5ff1d71b9f
Create Date: 2013-08-05 23:49:25.621647
"""
# revision identifiers, used by Alembic.
revision = '4752027f1c40'
down_revision = '3a5ff1d71b9f'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import select, table, column,... | apache-2.0 | Python | |
3c885004d579dacbe7a193576b21ee965a9d8e11 | add test file for images | coblo/isccbench | iscc_bench/elastic_search/generate_image_hashes.py | iscc_bench/elastic_search/generate_image_hashes.py | # -*- coding: utf-8 -*-
import time
from PIL import Image
import os
import dhash
from elasticsearch import Elasticsearch
from elasticsearch import helpers
from iscc_bench import DATA_DIR
from iscclib.image import ImageID
es = Elasticsearch()
IMAGE_DIR = os.path.join(DATA_DIR, 'images\src')
mapping_image = '''
{
"... | bsd-2-clause | Python | |
64fca89a9bb3bc0cd7725f4ad2ef0924c5c97859 | remove very large target coverage | shengqh/ngsperl,shengqh/ngsperl,shengqh/ngsperl,shengqh/ngsperl | lib/GATK4/fixCollectHsMetrics.py | lib/GATK4/fixCollectHsMetrics.py | import argparse
import sys
import logging
import os
import random
DEBUG=False
NotDEBUG=not DEBUG
parser = argparse.ArgumentParser(description="fixCollectHsMetrics",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-i', '--input', action='store'... | apache-2.0 | Python | |
ee928a52805ea8179277487e667947746985a2db | Create __init__.py | darwinex/DarwinexLabs | tools/dwx_zeromq_connector/v2.0.1/EXAMPLES/TEMPLATE/STRATEGIES/__init__.py | tools/dwx_zeromq_connector/v2.0.1/EXAMPLES/TEMPLATE/STRATEGIES/__init__.py | bsd-3-clause | Python | ||
8fe57fbbc5764d3e13c3513afcdb2c49d04b117e | Add a migration for php5-fpm pools to php7 | YunoHost/yunohost,YunoHost/yunohost,YunoHost/yunohost,YunoHost/moulinette-yunohost,YunoHost/moulinette-yunohost,YunoHost/moulinette-yunohost,YunoHost/yunohost,YunoHost/moulinette-yunohost,YunoHost/moulinette-yunohost | src/yunohost/data_migrations/0003_php5_to_php7_pools.py | src/yunohost/data_migrations/0003_php5_to_php7_pools.py | import os
import glob
from shutil import copy2
from moulinette.utils.log import getActionLogger
from yunohost.tools import Migration
from yunohost.service import _run_service_command
logger = getActionLogger('yunohost.migration')
PHP5_POOLS = "/etc/php5/fpm/pool.d"
PHP7_POOLS = "/etc/php/7.0/fpm/pool.d"
PHP5_SOCKE... | agpl-3.0 | Python | |
935c77777d9d15269d2579f001c3abd97f8635e7 | add - module for communicating with redis. | rfaulkner/Flickipedia,rfaulkner/Flickipedia,rfaulkner/Flickipedia,rfaulkner/Flickipedia,rfaulkner/Flickipedia | flickipedia/redisio.py | flickipedia/redisio.py | """
Module for handling redis IO
"""
import redis
from flickipedia.config import log
__author__ = 'Ryan Faulkner'
__date__ = "2014-04-01"
class DataIORedis(object):
""" Class implementing data IO for Redis. """
DEFAULT_HOST = 'localhost'
DEFAULT_PORT = 6379
DEFAULT_DB = 0
def __init__(self, **... | bsd-2-clause | Python | |
637165eef82d40abc240b1dc40edddabecbb6af3 | Create new package. (#6503) | mfherbst/spack,krafczyk/spack,krafczyk/spack,mfherbst/spack,tmerrick1/spack,krafczyk/spack,matthiasdiener/spack,EmreAtes/spack,LLNL/spack,matthiasdiener/spack,mfherbst/spack,EmreAtes/spack,EmreAtes/spack,EmreAtes/spack,mfherbst/spack,iulian787/spack,tmerrick1/spack,tmerrick1/spack,krafczyk/spack,tmerrick1/spack,iulian7... | var/spack/repos/builtin/packages/r-biocstyle/package.py | var/spack/repos/builtin/packages/r-biocstyle/package.py | ##############################################################################
# Copyright (c) 2013-2017, 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 | |
b577b1b54cf8ba2f1b9184bda270e0bcd9613ef5 | Create wordcount-mapper.py | hardikvasa/hadoop-mapreduce-examples-python | wordcount-mapper.py | wordcount-mapper.py | #!/usr/bin/env python
import sys
for line in sys.stdin: # Input is read from STDIN and the output of this file is written into STDOUT
line = line.strip() # remove leading and trailing whitespace
words = line.split() # split the line into words
for word in words:
print '%s\t%s' % (w... | mit | Python | |
79a0302ed3cebc0b93775824f6bfa5ce17bdb371 | Create j34all_possible.py | jovian34/j34all_possible | j34all_possible.py | j34all_possible.py | import itertools
class ListOps():
def __init__(self, length=9, total=100):
self.length = length
self.total = total
temp_list = []
temp_value = [0, 1, -1]
temp_value = tuple(temp_value)
temp_list.append(temp_value)
for i in range(2, self.length):
... | apache-2.0 | Python | |
be1b50a9780bc8d2114b8660687fd72bb9472949 | Implement new Lin similarity based query expansion in query_processing/wordnet_expansion.py | amkahn/question-answering,amkahn/question-answering | src/query_processing/wordnet_expansion.py | src/query_processing/wordnet_expansion.py | from nltk.corpus import wordnet as wn
from nltk.corpus import wordnet_ic
semcor_ic = wordnet_ic.ic('ic-semcor.dat')
from nltk.corpus import lin_thesaurus as thes
import heapq
# specifies number of top-scoring synonyms to use
NUMBER_SYNONYMS = 3
def expand_query(query):
# add weight of 1 for each original term
we... | mit | Python | |
1b810ec3fb2bdd241d831a3167d9ed8051fa29ca | Add to repo. | kraftur/mapIt | mapIt.py | mapIt.py | #!/usr/bin/python3
# mapIt.py - Launches a map in the browser using an address from the
# command line or clipboard.
import webbrowser
import sys
if len(sys.argv) > 1:
# Get address from command line.
address = ' '.join(sys.argv[1:])
else:
# Get address from clipboard.
address = pyperclip.paste()
we... | mit | Python | |
3559faeceff06aee82409ca22158223aff696b07 | Create MajorityElement_004.py | cc13ny/algo,Chasego/codi,Chasego/cod,Chasego/cod,cc13ny/algo,cc13ny/Allin,cc13ny/Allin,cc13ny/Allin,Chasego/codi,cc13ny/Allin,cc13ny/algo,Chasego/cod,Chasego/codirit,cc13ny/algo,cc13ny/algo,Chasego/codirit,Chasego/codi,Chasego/codirit,Chasego/cod,Chasego/codirit,Chasego/cod,Chasego/codirit,Chasego/codi,Chasego/codi,cc1... | leetcode/169-Majority-Element/MajorityElement_004.py | leetcode/169-Majority-Element/MajorityElement_004.py | class Solution(object):
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
num, cnt = nums[0], 1
for i in xrange(1, len(nums)):
if nums[i] == num:
cnt += 1
elif cnt == 0:
num = nums[i]
... | mit | Python | |
ba0d2ed9373df05eae280f8664214decddbd755c | add basic drawing tests for svg | tommy-u/enable,tommy-u/enable,tommy-u/enable,tommy-u/enable | kiva/tests/test_svg_drawing.py | kiva/tests/test_svg_drawing.py | import contextlib
import StringIO
import unittest
from xml.etree import ElementTree
from kiva.tests.drawing_tester import DrawingTester
from kiva.svg import GraphicsContext
class TestSVGDrawing(DrawingTester, unittest.TestCase):
def create_graphics_context(self, width, height):
return GraphicsContext((w... | bsd-3-clause | Python | |
911baa4f700c34b2c2c3de8239a0fee60c12f1e9 | Create db.py | haibo-yu/awesome-python-webapp,haibo-yu/awesome-python-webapp,haibo-yu/awesome-python-webapp | www/transwarp/db.py | www/transwarp/db.py | unlicense | Python | ||
c51d6fd5d12fd22391e792f8bb792a48b5bcda04 | Create yt-search-filter.py | mthomas128/Search-Index | yt-search-filter.py | yt-search-filter.py | """This program is designed to facilitate rapidly
finding a video and its link on YouTube. Instructions for use:
Install elementtree and gdata 2.0 APIs.
Run program through command prompt of choice and enter a query
to be searched on YouTube. Specific queries work best.
Then enter a second query to filter the results t... | mit | Python | |
fd1759b05c35d45bb6bf289f5267415e8c2a447e | Add missing superclass | sassoftware/rbuild,sassoftware/rbuild | rbuild/internal/rbuilder/rbuildercommand.py | rbuild/internal/rbuilder/rbuildercommand.py | #
# Copyright (c) 2008 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rpath.com/permanent/... | apache-2.0 | Python | |
5e005fab08da740a027dcc23ba1b53abc3efaec4 | add missing indices | ergo/ziggurat_foundations,ergo/ziggurat_foundations | ziggurat_foundations/migrations/versions/613e7c11dead_create_indices_on_resource_owners.py | ziggurat_foundations/migrations/versions/613e7c11dead_create_indices_on_resource_owners.py | """create indices on resource owners
Revision ID: 613e7c11dead
Revises: b5e6dd3449dd
Create Date: 2018-02-15 11:51:29.659352
"""
from __future__ import unicode_literals
# revision identifiers, used by Alembic.
revision = '613e7c11dead'
down_revision = 'b5e6dd3449dd'
from alembic import op
def upgrade():
op.cre... | bsd-3-clause | Python | |
88361e72624243b4e7fa45122e44a6843f21e2c6 | Add spider for Marriott hotels group | iandees/all-the-places,iandees/all-the-places,iandees/all-the-places | locations/spiders/marriott.py | locations/spiders/marriott.py | import json
import re
import scrapy
from scrapy.selector import Selector
from locations.items import GeojsonPointItem
class MarriottHotels(scrapy.Spider):
name = "marriott"
allowed_domains = ["marriott.com", "ritzcarlton.com"]
download_delay = 0.2
def start_requests(self):
start_urls = [
... | mit | Python | |
02900e9135b26de835692aacdb5f1f332f582fa9 | Create main_menu_ui.py | lakewik/storj-gui-client | main_menu_ui.py | main_menu_ui.py | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'main_menu.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):... | mit | Python | |
1b5a8307fd816c935f197993d1ead07cffc01892 | add simple consumer | fortime/pykafka,sontek/pykafka,appsoma/pykafka,vortec/pykafka,thedrow/samsa,benauthor/pykafka,jofusa/pykafka,appsoma/pykafka,sammerry/pykafka,aeroevan/pykafka,aeroevan/pykafka,fortime/pykafka,wikimedia/operations-debs-python-pykafka,jofusa/pykafka,thedrow/samsa,sontek/pykafka,tempbottle/pykafka,tempbottle/pykafka,benau... | samsa/rdsamsa/consumer.py | samsa/rdsamsa/consumer.py | from collections import namedtuple
from copy import copy
import logging
import rd_kafka
from samsa import abstract
logger = logging.getLogger(__name__)
Message = namedtuple("Message", ["topic", "payload", "key", "offset"])
# TODO ^^ namedtuple is just a placeholder thingy until we've fleshed out
# samsa.commo... | apache-2.0 | Python | |
46a652e13da604776d745d2f09e02e4f75dc3fd7 | test commit 1 | rooneygw/test | testfile.py | testfile.py | print("Hello")
| mit | Python | |
afaed1b9c6889312cc3e6fa992a03c500470e967 | add test for feature sequence | ginkgobioworks/edge,ginkgobioworks/edge,ginkgobioworks/edge,ginkgobioworks/edge | src/edge/tests/test_feature.py | src/edge/tests/test_feature.py | from django.test import TestCase
from edge.models import Fragment
class FeatureTests(TestCase):
def setUp(self):
self.root_sequence = "agttcgaggctga"
self.root = Fragment.create_with_sequence("Foo", self.root_sequence)
def test_sequence_positive_strand(self):
feature = self.root.anno... | mit | Python | |
bf34c1dbb37865e62e97e3463645c7df16a4ca08 | Add an interface for Markov Chains | iluxonchik/lyricist | markov_chain.py | markov_chain.py | from random import choice
class MarkovChain(object):
""" An interface for signle-word states Markov Chains """
def __init__(self, text=None):
self._states_map = {}
if text is not None:
self.add_text(text)
def add_text(self, text, separator=" "):
""" Adds text ... | mit | Python | |
055c1b0d140e2c5659c2767fd123fc69d0f83859 | Create clean_up_d3s.py | bearing/dosenet-raspberrypi,cllamb0/dosenet-raspberrypi,bearing/dosenet-raspberrypi,yarocoder/dosenet-raspberrypi,yarocoder/dosenet-raspberrypi,cllamb0/dosenet-raspberrypi,tybtab/dosenet-raspberrypi,tybtab/dosenet-raspberrypi | clean_up_d3s.py | clean_up_d3s.py | from globalvalues import RPI
if RPI:
import RPi.GPIO as GPIO
GPIO.cleanup()
| mit | Python | |
fb10273ee2007846fa760d36ebb6806b35407fa3 | add script/json/ts-urllib2.py | Zex/Starter,Zex/Starter,Zex/Starter | script/json/ts-urllib2.py | script/json/ts-urllib2.py | #!/usr/bin/env python
#
# ts-urllib2.py
#
# Author: Zex <top_zlynch@yahoo.com>
#
import urllib2
import json
from os import path, mkdir
from basic import *
if not path.isdir(RESPONSE_DIR):
mkdir(RESPONSE_DIR)
def case():
headers = {
#'Content-Type' : 'application/json'
#'Content-Type' : 'text/h... | mit | Python | |
65cc9fd3ada01790484469028875e580e8447c85 | Update migrations to current state (#65) | ArabellaTech/aa-stripe | aa_stripe/migrations/0021_auto_20190906_1623.py | aa_stripe/migrations/0021_auto_20190906_1623.py | # Generated by Django 2.1.11 on 2019-09-06 20:23
import django_extensions.db.fields.json
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('aa_stripe', '0020_stripecharge_statement_descriptor'),
]
operations = [
migrations.AlterField(
... | mit | Python | |
6f415dccb547cae95aeb9946e503cadd99f63bd6 | add backtest_files.py | joequant/sptrader,joequant/sptrader,joequant/sptrader,joequant/sptrader,joequant/sptrader | scripts/backtest_files.py | scripts/backtest_files.py | #!/usr/bin/python3
import json
import sys
from pprint import pprint
import requests
import re
import os
import shutil
location = os.path.dirname(os.path.realpath(__file__))
data_dir = os.path.join(location, "..", "data")
config_name = sys.argv[1]
items = sys.argv[2:]
config_file = os.path.join(data_dir, config_name ... | bsd-2-clause | Python | |
e1b36f6d875ca358993af03ae0fb95d3def87f29 | Create weather_cnn3d.py | prl900/DeepWeather | weather_cnn3d.py | weather_cnn3d.py | import numpy as np
import os.path
import sys
from keras.models import Sequential, load_model
from keras.layers import Convolution2D, MaxPooling2D, Convolution3D, MaxPooling3D
#from keras.layers.convolutional import Conv2D, Conv3D
#from keras.layers.pooling import MaxPooling2D, MaxPooling3D
from keras.layers.core import... | apache-2.0 | Python | |
7e1058821f165e60d76eee1b07a7b411f3439408 | Create uber.py | jasuka/pyBot,jasuka/pyBot | modules/uber.py | modules/uber.py | def uber(self):
self.send_chan("Moi")
| mit | Python | |
b8795def87635aa8192f5f8cf64afe1a22ec30f1 | Add findCsetsIntersection.py script to find intersecting changesets in our knownBrokenRanges. | MozillaSecurity/funfuzz,nth10sd/funfuzz,MozillaSecurity/funfuzz,MozillaSecurity/funfuzz,nth10sd/funfuzz,nth10sd/funfuzz | autobisect-js/findCsetsIntersection.py | autobisect-js/findCsetsIntersection.py | #!/usr/bin/env python
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import sys
from optparse import OptionParser
from ignoreAndEarliestWorkingLists impor... | mpl-2.0 | Python | |
e81f823a1542bf24caa081b299352e593e1a10c9 | Add a utility function | dseomn/cohydra | cohydra/util.py | cohydra/util.py | import os
def recursive_scandir(top_dir, dir_first=True):
"""Recursively scan a path.
Args:
top_dir: The path to scan.
dir_first: If true, yield a directory before its contents.
Otherwise, yield a directory's contents before the
directory itself.
Returns:
A generator of t... | apache-2.0 | Python | |
e29de047d770de70f3745ae410b62d0ddad4b0b4 | Add one test case for IOTOS-358 | ostroproject/meta-iotqa,ostroproject/meta-iotqa,wanghongjuan/meta-iotqa-1,ostroproject/meta-iotqa,daweiwu/meta-iotqa-1,ostroproject/meta-iotqa,daweiwu/meta-iotqa-1,ostroproject/meta-iotqa,wanghongjuan/meta-iotqa-1,wanghongjuan/meta-iotqa-1,daweiwu/meta-iotqa-1,daweiwu/meta-iotqa-1,wanghongjuan/meta-iotqa-1,wanghongjuan... | lib/oeqa/runtime/misc/appFW.py | lib/oeqa/runtime/misc/appFW.py | from oeqa.oetest import oeRuntimeTest
class AppFwTest(oeRuntimeTest):
""" App Framework testing """
def test_sqlite_integration(self):
""" test sqlite is integrated in image """
(status,output) = self.target.run("rpm -qa | grep sqlite")
self.assertEqual(status, 0, output)
| mit | Python | |
6b4507793f6c536a604ba0e81143453ff9a9eab2 | Add a rough-and-ready proximity | westpark/robotics | piwars/controllers/proximity.py | piwars/controllers/proximity.py | # -*- coding: utf-8 -*-
import os, sys
import collections
import itertools
import queue
import statistics
import threading
from ..core import config, exc, logging, utils
log = logging.logger(__package__)
from . import remote
from ..sensors import ultrasonic
#
# This controller is trying to have the robo... | mit | Python | |
1051ec35f33c3e7a3946af3cf8a11a86dc9265a0 | Create utility module | thelonious/g2x,gizmo-cda/g2x,gizmo-cda/g2x,thelonious/g2x,gizmo-cda/g2x,gizmo-cda/g2x | app_v2/utils.py | app_v2/utils.py | def map_range(x, in_min, in_max, out_min, out_max):
out_delta = out_max - out_min
in_delta = in_max - in_min
return (x - in_min) * out_delta / in_delta + out_min
| mit | Python | |
d3a3d4d5b380ea18b767515dfadfc0256d26e1eb | Add a snippet. | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | python/tkinter/python3/matplotlib_canvas_using_class_and_toolbar_and_keyboard_events.py | python/tkinter/python3/matplotlib_canvas_using_class_and_toolbar_and_keyboard_events.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Jérémie DECOCK (http://www.jdhp.org)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including witho... | mit | Python | |
c6d505ef6610ebb383e4f0a7a3d1b746f7fd5f75 | add group | conjurinc/api-python,conjurinc/api-python | conjur/group.py | conjur/group.py | #
# Copyright (C) 2014 Conjur Inc
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distri... | apache-2.0 | Python | |
d14c0127a2489c03a50f49751b8b735202873e29 | Add RFID Reader example. | riklaunim/pyusb-keyboard-alike | black_rfid_reader.py | black_rfid_reader.py | from keyboard_alike import reader
class RFIDReader(reader.Reader):
"""
This class supports common black RFID Readers for 125 kHz read only tokens
http://www.dx.com/p/intelligent-id-card-usb-reader-174455
"""
def extract_meaningful_data_from_chunk(self, raw_data):
# every good chunk is foll... | mit | Python | |
a14b5aad9f6f15cfd9bee32c689e023a5dc94f19 | Add very basic visualization tool in python until I find a go lib which can do the same | jacksontj/dnms,jacksontj/dnms | visualize.py | visualize.py | '''
Create a visual representation of the various DAGs defined
'''
import requests
import networkx as nx
import matplotlib.pyplot as plt
if __name__ == '__main__':
g = nx.DiGraph()
labels = {
'edges': {},
'nodes': {},
}
nodes = {}
for routeKey, routeMap in requests.get('http://l... | mit | Python | |
78c64d00df97edbec5f07213dc87ff30a7bb4ca9 | Create moveToObject.py | aaronfang/personal_scripts | af_scripts/misc/moveToObject.py | af_scripts/misc/moveToObject.py | # move to object
import pymel.core as pm
def move_to_object():
get_sel = pm.ls(sl=1,fl=1)
if len(get_sel) == 2:
src = get_sel[1]
target = get_sel[0]
src_oc_x = pm.objectCenter(src,x=1)
src_oc_y = pm.objectCenter(src,y=1)
src_oc_z = pm.objectCenter(src,z=1)
target_oc_x = pm.objectCenter(target,x=1)
tar... | mit | Python | |
a84935319ceb492af854c4af933794c2f014c269 | Create http.py | AlanOndra/Waya | src/site/cms/http.py | src/site/cms/http.py | # -*- coding: utf-8 -*-
from os.path import abspath, join
import pickle
from datetime import *
from http.cookies import *
from cms.fs import *
class Status:
OK = '200 OK'
Created = '201 Created'
Moved = '301 Moved Permanently'
Found = '302 Found'
Redirect = '307 Temporary R... | bsd-3-clause | Python | |
7c1a1ee17b83a39d7dfb37b595090ccb7bc23532 | create default group for ODIN users (if necessary) | crs4/ProMort,crs4/ProMort,lucalianas/ProMort,lucalianas/ProMort,crs4/ProMort,lucalianas/ProMort | promort/odin/migrations/0001_initial.py | promort/odin/migrations/0001_initial.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-01 08:00
from __future__ import unicode_literals
from django.db import migrations
from promort import settings as pms
import logging
logger = logging.getLogger('promort')
def create_odin_group(apps, schema_editor):
logger.info('Creating default gr... | mit | Python | |
62f1eec7e9c88a096855f3e4d513e2c34bca0b7c | remove old profile function | PnEcrins/GeoNature,PnEcrins/GeoNature,PnEcrins/GeoNature,PnEcrins/GeoNature | backend/geonature/migrations/versions/dde31e76ce45_remove_old_profile_function.py | backend/geonature/migrations/versions/dde31e76ce45_remove_old_profile_function.py | """remove old profile function
Revision ID: dde31e76ce45
Revises: 6f7d5549d49e
Create Date: 2022-01-06 10:23:55.290043
"""
import sqlalchemy as sa
from alembic import op
from geonature.utils.config import config
# revision identifiers, used by Alembic.
revision = 'dde31e76ce45'
down_revision = '6f7d5549d49e'
branc... | bsd-2-clause | Python | |
bf979d2c32d84c4011a7363489798056d3cc6a58 | add TestBEventsWithFile | TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl | tests/unit/Events/test_BEventsWithFile.py | tests/unit/Events/test_BEventsWithFile.py | from AlphaTwirl.Events import BEvents as Events
from AlphaTwirl.Events import Branch
import unittest
import ROOT
##____________________________________________________________________________||
inputPath = '/Users/sakuma/work/cms/c150130_RA1_data/c150130_01_PHYS14/20150331_SingleMu/TTJets/treeProducerSusyAlphaT/tree.r... | bsd-3-clause | Python | |
0782e8786272fcd6e3e1a41d31bea253865c468b | Add SolveTimer - print number of iterations and elapsed time to console while running ml.solve() - see docstring for usage | pastas/pastas | pastas/timer.py | pastas/timer.py | try:
from tqdm.auto import tqdm
except ModuleNotFoundError:
raise ModuleNotFoundError("SolveTimer requires 'tqdm' to be installed.")
class SolveTimer(tqdm):
"""Progress indicator for model optimization.
Usage
-----
Print timer and number of iterations in console while running
`ml.solve()... | mit | Python | |
a9a0afa66c94e08513cf4d19725b081cab39d4dc | Make new elk module script | hynok/BEES,cvdileo/graphite,xwa9860/FHR_MOOSE,arfc/moltres,jwpeterson/stork,cpgr/bilby,delcmo/multi_d_gray_rhea,pradchar/pradyawong,vityurkiv/Ox,Kane9806/GOPHER,jessecarterMOOSE/PRARIEDOG,arfc/moltres,gridley/moltres,gnilheb/Armadillo,tophmatthews/buck,yechuda/rimat,harrymccormack/lion,amitjn7042/bear,ragusa/badger_bur... | make_new_elk_module.py | make_new_elk_module.py | #!/usr/bin/env python
# This script is for creating a new herd animal. Just run this script
# from the "stork" directory supplying a new animal name and it should
# create a complete application template built with support for both
# MOOSE and ELK. Enjoy!
import os, sys, string, re, subprocess
from optparse import ... | lgpl-2.1 | Python | |
0d12fe35e0c7a31987d83737d22bfc9f54e72709 | Add Binary | feigaochn/leetcode | add-binary.py | add-binary.py | # author: Fei Gao
#
# Add Binary
#
# Given two binary strings, return their sum (also a binary string).
# For example,
# a = "11"
# b = "1"
# Return "100".
class Solution:
# @param a, a string
# @param b, a string
# @return a string
def addBinary(self, a, b):
ai = int(a, base=2)
bi = i... | mit | Python | |
dd30bed54205eb3639e8af0e2cf879e7cf319701 | add solution for Symmetric Tree | zhyu/leetcode,zhyu/leetcode | src/symmetricTree.py | src/symmetricTree.py | # Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param root, a tree node
# @return a boolean
def isSymmetric(self, root):
if not root:
return True
... | mit | Python | |
6ece957e5317a9f54499714f9a7cb9bca221d4e5 | Add a simple script that runs the pipeline for the single specified user | sunil07t/e-mission-server,sunil07t/e-mission-server,shankari/e-mission-server,shankari/e-mission-server,sunil07t/e-mission-server,sunil07t/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server | bin/debug/intake_single_user.py | bin/debug/intake_single_user.py | import json
import logging
import argparse
import numpy as np
import uuid
import emission.pipeline.intake_stage as epi
import emission.core.wrapper.user as ecwu
if __name__ == '__main__':
np.random.seed(61297777)
parser = argparse.ArgumentParser(prog="intake_single_user")
group = parser.add_mutually_excl... | bsd-3-clause | Python | |
4c5f750801cef0424fd93432b688fb74b079f4c5 | Add migration to backfill recipient counts | tsotetsi/textily-web,reyrodrigues/EU-SMS,pulilab/rapidpro,reyrodrigues/EU-SMS,pulilab/rapidpro,pulilab/rapidpro,pulilab/rapidpro,tsotetsi/textily-web,reyrodrigues/EU-SMS,tsotetsi/textily-web,ewheeler/rapidpro,ewheeler/rapidpro,tsotetsi/textily-web,tsotetsi/textily-web,ewheeler/rapidpro,pulilab/rapidpro,ewheeler/rapidpr... | temba/msgs/migrations/0037_backfill_recipient_counts.py | temba/msgs/migrations/0037_backfill_recipient_counts.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('msgs', '0036_auto_20151103_1014'),
]
def backfill_recipient_counts(apps, schema):
Broadcast = apps.get_model('msgs', 'Broadc... | agpl-3.0 | Python | |
b44f13bfa1ac8b3c1bd24e528fc7874a06df0121 | Add script that creates a filtered list of required packages | DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python | dev_tools/src/d1_dev/update-requirements-txt.py | dev_tools/src/d1_dev/update-requirements-txt.py | #!/usr/bin/env python
import shutil
import d1_dev.util
import os
import pip._internal.utils.misc
import re
REQUIREMENTS_FILENAME = 'requirements.txt'
# Modules in my dev environment that are not required by the stack
MODULE_FILTER_REGEX_LIST = {
'beautifulsoup',
'black',
'bs4',
'dataone.*',
'e... | apache-2.0 | Python | |
869e0d41a498698b3c785af7c86dc2bc831e0791 | Create three-words.py | Pouf/CodingCompetition,Pouf/CodingCompetition | CheckiO/three-words.py | CheckiO/three-words.py | def checkio(words):
return '111' in ''.join('1' if w.isalpha() else '0' for w in words.split())
| mit | Python | |
f7d95d4df21bc442261723298f9889bd093feb97 | add spaceapi module | guiniol/py3status,Spirotot/py3status,Andrwe/py3status,goto-bus-stop/py3status,docwalter/py3status,ultrabug/py3status,ultrabug/py3status,Shir0kamii/py3status,tobes/py3status,schober-ch/py3status,tobes/py3status,vvoland/py3status,guiniol/py3status,sethwoodworth/py3status,Andrwe/py3status,ultrabug/py3status,valdur55/py3st... | py3status/modules/spaceapi.py | py3status/modules/spaceapi.py | # -*- coding: utf-8 -*-
"""
This module shows if your favorite hackerspace is open or not
Last modified: 2015-02-01
Author: @timmszigat
License: WTFPL http://www.wtfpl.net/txt/copying/
"""
from time import time
import datetime
import json
import urllib.request
import codecs
class Py3status:
"""
Configuration... | bsd-3-clause | Python | |
651c44b51a26733dde22e82a80b0668302e5df52 | implement a base class for backends | alfredodeza/merfi | merfi/backends/base.py | merfi/backends/base.py | from merfi import base, util
from tambo import Transport
class BaseBackend(base.BaseCommand):
options = []
parser = None
def parse_args(self):
self.parser = Transport(self.argv, options=self.options)
self.parser.catch_help = self.help()
self.parser.parse_args()
self.path ... | mit | Python | |
7086ce47e4a2b6611596d177cc5adb166b382f48 | Create cryptography.py | CriticalD20/Cryptography,morganmeliment/Cryptography,voidJeff/Cryptography,VinzentM/Cryptography,VinzentM/Cryptography,phstearns/Cryptography,dina-hertog/Cryptography,kezarberger/Cryptography,sarahdunbar/Cryptography,TheBigBlueBlob/Cryptography,HHStudent/Cryptography,sawyerhanlon/Cryptography,HaginCodes/Cryptography,ad... | cryptography.py | cryptography.py | """
| mit | Python | |
2eb5ba178e3bed422a2cb7437362b30df717103e | remove dbcred file from staging interface | fedspendingtransparency/data-act-validator,fedspendingtransparency/data-act-broker-backend,chambers-brian/SIG_Digital-Strategy_SI_ODP_Backend,fedspendingtransparency/data-act-broker-backend,chambers-brian/SIG_Digital-Strategy_SI_ODP_Backend | dataactvalidator/interfaces/validatorStagingInterface.py | dataactvalidator/interfaces/validatorStagingInterface.py | from dataactcore.models.baseInterface import BaseInterface
from dataactcore.config import CONFIG_DB
class ValidatorStagingInterface(BaseInterface):
""" Manages all interaction with the staging database """
dbName = CONFIG_DB['staging_db_name']
Session = None
engine = None
session = None
def _... | from sqlalchemy.exc import ResourceClosedError
from dataactcore.models.baseInterface import BaseInterface
class ValidatorStagingInterface(BaseInterface):
""" Manages all interaction with the staging database """
dbName = "staging"
credFileName = "dbCred.json"
Session = None
engine = None
sessi... | cc0-1.0 | Python |
06b1113c74821b144a2e31e55020f2db2fcd44a2 | Add contacts example script. | xtuple/xtuple-python-rest-client-example | contacts.py | contacts.py | #!/usr/bin/python2.4
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Google Inc.
#
# 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 ... | apache-2.0 | Python | |
6f2529d1891b5c256394b9c8aa991b25a029b5f1 | Add a migration to load users and buckets | alphagov/backdrop,alphagov/backdrop,alphagov/backdrop | migrations/004_load_seed_file.py | migrations/004_load_seed_file.py | """
Load initial user and bucket data from seed files.
"""
import logging
import os
import subprocess
import sys
log = logging.getLogger(__name__)
def up(db):
names = db.collection_names()
if "users" in names:
log.info("users collection already created")
return
if "buckets" in names:
... | mit | Python | |
3dbe5ce617d882dc74a1b95e830634dc0d0f800c | Add examples from the ORM tutorial | uwydoc/the-practices,uwydoc/the-practices,uwydoc/the-practices,uwydoc/the-practices,uwydoc/the-practices,uwydoc/the-practices,uwydoc/the-practices | python/sqlalchemy/tutorial.py | python/sqlalchemy/tutorial.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Examples from the ORM tutorial
#
from __future__ import print_function, division
from sqlalchemy import Column, Integer, String, Sequence, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, backref
Base = decla... | mit | Python | |
b9da5732579dce0f25a413cbfe4936b8ac024aa5 | move gzip classes into gzip | kitsuyui/bamboo-crawler,kitsuyui/bamboo-crawler,kitsuyui/bamboo-crawler | bamboo_crawler/gzip/__init__.py | bamboo_crawler/gzip/__init__.py | import gzip
from ..interfaces.deserializer import Deserializer
from ..interfaces.serializer import Serializer
class GzipSerializer(Serializer[bytes, bytes]):
def serialize(self, value: bytes) -> bytes:
return gzip.compress(value)
class GzipDeserializer(Deserializer[bytes, bytes]):
def deserialize(s... | bsd-3-clause | Python | |
99282d42a3948b9ed45b02df657c344667ec0cf2 | Add a migration for directive_sections -> relationships | AleksNeStu/ggrc-core,jmakov/ggrc-core,hyperNURb/ggrc-core,josthkko/ggrc-core,hasanalom/ggrc-core,jmakov/ggrc-core,hasanalom/ggrc-core,edofic/ggrc-core,kr41/ggrc-core,kr41/ggrc-core,plamut/ggrc-core,j0gurt/ggrc-core,plamut/ggrc-core,prasannav7/ggrc-core,hyperNURb/ggrc-core,NejcZupec/ggrc-core,VinnieJohns/ggrc-core,selah... | src/ggrc/migrations/versions/20150521125008_324d461206_migrate_directive_sections_to_.py | src/ggrc/migrations/versions/20150521125008_324d461206_migrate_directive_sections_to_.py | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: anze@reciprocitylabs.com
# Maintained By: anze@reciprocitylabs.com
"""Migrate directive_sections to relationships
Revision ID: 324d461206
Revises:... | apache-2.0 | Python | |
5b9d9f531e3544f6d3dfe0a2e48dcaaebf132921 | Test case for RPC HTTP handler. | supersaiyanmode/HomePiServer,supersaiyanmode/HomePiServer,supersaiyanmode/HomePiServer | test/services/appmanager/test_http.py | test/services/appmanager/test_http.py | import time
import requests
from weavelib.messaging import Receiver
from weavelib.rpc import RPCServer, ServerAPI
from weavelib.services import BaseService
from weaveserver.core.services import ServiceManager
from weaveserver.services.appmanager import ApplicationService
AUTH = {
"auth1": {
"type": "SYS... | mit | Python | |
892c89c8ae953b84720cc4d617d772f1e777af82 | add @erfannoury's poisson disk sampling code | WangDequan/fast-bird-part-localization,yassersouri/fast-bird-part-localization | src/poisson_disk.py | src/poisson_disk.py | """
@author: Erfan Noury, https://github.com/erfannoury
"""
import numpy as np
from numpy.random import random as rnd
class PoissonDiskSampler(object):
def __init__(self, width, height, radius, k=20):
"""
This class is for sampling points in a 2-D region
such that no two points are closer ... | mit | Python | |
8ba5b29200520d853791943341d41798ff80a248 | Change meta option for Github | lozadaOmr/ansible-admin,lozadaOmr/ansible-admin,lozadaOmr/ansible-admin | src/repository/migrations/0003_auto_20170524_1503.py | src/repository/migrations/0003_auto_20170524_1503.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-05-24 15:03
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('repository', '0002_auto_20170522_2021'),
]
operations = [
migrations.AlterModelOpti... | bsd-3-clause | Python | |
811c1ed7324075970f0009d691866d1d47de43a2 | add a setup.py to make this a nice official package | google/mysql-tools,google/mysql-tools | setup.py | setup.py | #!/usr/bin/python2.4
#
# Copyright 2006 Google Inc. All Rights Reserved.
from distutils.core import setup
setup(name="google-mysql-tools",
description="Google MySQL Tools",
url="http://code.google.com/p/google-mysql-tools",
version="0.1",
packages=["gmt"],
scripts=["mypgrep.py", "compact... | apache-2.0 | Python | |
193aa3ff7ef4219fd29a0ea40a8c0d2e5467de75 | Add setup.py script | miguelsousa/MutatorMath,moyogo/mutatormath,LettError/MutatorMath,anthrotype/MutatorMath | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
setup(name = "MutatorMath",
version = "1.8",
description = "Python for piecewise linear interpolation in multiple dimensions with multiple, arbitrarily placed, masters.",
author = "Erik van Blokland",
author_email = "erik@letterror.com",
... | bsd-3-clause | Python | |
21a0948eb1d25e9126e2940cbc7d0496181d6a93 | Add Django version trove classifiers. | grzes/djangae,asendecka/djangae,grzes/djangae,kirberich/djangae,asendecka/djangae,kirberich/djangae,armirusco/djangae,grzes/djangae,armirusco/djangae,potatolondon/djangae,chargrizzle/djangae,potatolondon/djangae,armirusco/djangae,kirberich/djangae,asendecka/djangae,chargrizzle/djangae,chargrizzle/djangae | setup.py | setup.py | import os
from setuptools import setup, find_packages
NAME = 'djangae'
PACKAGES = find_packages()
DESCRIPTION = 'Django integration with Google App Engine'
URL = "https://github.com/potatolondon/djangae"
LONG_DESCRIPTION = open(os.path.join(os.path.dirname(__file__), 'README.md')).read()
AUTHOR = 'Potato London Ltd.'... | import os
from setuptools import setup, find_packages
NAME = 'djangae'
PACKAGES = find_packages()
DESCRIPTION = 'Django integration with Google App Engine'
URL = "https://github.com/potatolondon/djangae"
LONG_DESCRIPTION = open(os.path.join(os.path.dirname(__file__), 'README.md')).read()
AUTHOR = 'Potato London Ltd.'... | bsd-3-clause | Python |
f1ae87bd9df2c3d70db980ea5e721223b545da5f | Add setup.py | fubaz/djheroku,fubaz/djheroku | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
setup(name='Djheroku',
version='0.1',
description='Some helper functionality for binding Heroku configuration to Django',
author='Ferrix Hovi',
author_email='ferrix+git@ferrix.fi',
url='http://github.com/ferrix/djheroku/',
pack... | mit | Python | |
6f57426a6a3881816506868f8278e252e5b0e5cd | Add setup.py file. | DanielAndreasen/ObservationTools,iastro-pt/ObservationTools | setup.py | setup.py | try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': 'A set of tools to plan astronomical observations.',
'author': 'iastro-pt',
'url': 'https://github.com/iastro-pt/ObservationTools',
'download_url': 'https://github.com/iastro-pt/Obs... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.