commit
stringlengths
40
40
old_file
stringlengths
4
150
new_file
stringlengths
4
150
old_contents
stringlengths
0
3.26k
new_contents
stringlengths
1
4.43k
subject
stringlengths
15
501
message
stringlengths
15
4.06k
lang
stringclasses
4 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
diff
stringlengths
0
4.35k
f384a5d77cae62b6487d039e4e8dd51ef9cdc258
skyfield/tests/test_data_iers.py
skyfield/tests/test_data_iers.py
from numpy import array, inf from skyfield.data.iers import _build_timescale_arrays def test_build_timescale_arrays(): mjd = array([42046.00, 42047.00, 42048.00, 42049.00]) dut1 = array([-0.2942581, -0.2971424, 0.6999438, 0.6970539]) delta_t, leap_dates, leap_offsets = _build_timescale_arrays(mjd, dut1) ...
Add explicit test for finals2000A.all converter
Add explicit test for finals2000A.all converter
Python
mit
skyfielders/python-skyfield,skyfielders/python-skyfield
--- +++ @@ -0,0 +1,16 @@ +from numpy import array, inf +from skyfield.data.iers import _build_timescale_arrays + +def test_build_timescale_arrays(): + mjd = array([42046.00, 42047.00, 42048.00, 42049.00]) + dut1 = array([-0.2942581, -0.2971424, 0.6999438, 0.6970539]) + delta_t, leap_dates, leap_offsets = _bu...
87cfabdc68d42f1a269741a38780ed6c38e53cb1
examples/debug/shape_shifter.py
examples/debug/shape_shifter.py
# Import analysis/plotting modules import analysis.event import plotting.image import numpy as np # Set new random seed np.random.seed() # Specify the facility state = {} state['Facility'] = 'Dummy' def shape_shifter(): if(np.random.random() < 0.5): return np.random.rand(8,8) else: return np...
Add a source with changing shape for debuging
Add a source with changing shape for debuging
Python
bsd-2-clause
FXIhub/hummingbird,FXIhub/hummingbird
--- +++ @@ -0,0 +1,49 @@ +# Import analysis/plotting modules +import analysis.event +import plotting.image +import numpy as np + +# Set new random seed +np.random.seed() + +# Specify the facility +state = {} +state['Facility'] = 'Dummy' + + +def shape_shifter(): + if(np.random.random() < 0.5): + return np.r...
98d27c8366a39dceaecf558535ec8312e0c03e92
bluebottle/cms/migrations/0064_auto_20171220_1145.py
bluebottle/cms/migrations/0064_auto_20171220_1145.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.8 on 2017-12-20 10:45 from __future__ import unicode_literals from django.db import migrations from bluebottle.cms.models import Stat as RealStat def migrate_stats_title(apps, schema_editor): Stat = apps.get_model('cms', 'Stat') for stat in Stat.objects.fi...
Fix incorrect migration that left out stat titles on result pages.
Fix incorrect migration that left out stat titles on result pages. This should fix all stats on all tenants except for manual input. BB-11474 #resolve
Python
bsd-3-clause
onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle
--- +++ @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.8 on 2017-12-20 10:45 +from __future__ import unicode_literals + +from django.db import migrations + +from bluebottle.cms.models import Stat as RealStat + + +def migrate_stats_title(apps, schema_editor): + Stat = apps.get_model('cms', 'S...
df885b68ae5b97fe12c34d32b3187ab6326ae04a
gmetad-python/gmetad_element.py
gmetad-python/gmetad_element.py
#/******************************************************************************* #* Portions Copyright (C) 2008 Novell, Inc. All rights reserved. #* #* Redistribution and use in source and binary forms, with or without #* modification, are permitted provided that the following conditions are met: #* #* - Redistributi...
Split the element class from the data store so that it can be imported independently as needed
Split the element class from the data store so that it can be imported independently as needed git-svn-id: 27e0aca8c7a52a9ae65dfba2e16879604119af8c@1336 93a4e39c-3214-0410-bb16-828d8e3bcd0f
Python
bsd-3-clause
fastly/ganglia,fastly/ganglia,fastly/ganglia,fastly/ganglia,fastly/ganglia
--- +++ @@ -0,0 +1,68 @@ +#/******************************************************************************* +#* Portions Copyright (C) 2008 Novell, Inc. All rights reserved. +#* +#* Redistribution and use in source and binary forms, with or without +#* modification, are permitted provided that the following condition...
8930434e0e4a079c855ed4beb7d2304ebab78b45
tests/test_content_type_resolvers.py
tests/test_content_type_resolvers.py
import pytest from odinweb import content_type_resolvers from odinweb.testing import MockRequest @pytest.mark.parametrize('resolver, args, http_request, expected', ( # Accepts Header (content_type_resolvers.accepts_header, (), MockRequest(headers={'accepts': 'application/json'}), 'application/json'), (co...
Complete test coverage for content_type_resolvers
Complete test coverage for content_type_resolvers
Python
bsd-3-clause
python-odin/odinweb,python-odin/odinweb
--- +++ @@ -0,0 +1,22 @@ +import pytest + +from odinweb import content_type_resolvers +from odinweb.testing import MockRequest + + +@pytest.mark.parametrize('resolver, args, http_request, expected', ( + # Accepts Header + (content_type_resolvers.accepts_header, (), MockRequest(headers={'accepts': 'application/j...
5a5b9a84d7ef42d5e5ae08ebbcf66719dce10e85
bin/update/deploy-dev.py
bin/update/deploy-dev.py
""" Deployment for Bedrock on www-dev.allizom.org. Requires commander (https://github.com/oremj/commander) which is installed on the systems that need it. """ import os import sys # these files are symlinked as 'update.py' in the project root. ROOT = os.path.dirname(os.path.abspath(__file__)) sys.path.append(ROOT) sy...
Add chief deploy script for www-dev.
Add chief deploy script for www-dev.
Python
mpl-2.0
malena/bedrock,craigcook/bedrock,l-hedgehog/bedrock,schalkneethling/bedrock,Sancus/bedrock,analytics-pros/mozilla-bedrock,ckprice/bedrock,sgarrity/bedrock,mkmelin/bedrock,ericawright/bedrock,mermi/bedrock,pmclanahan/bedrock,mahinthjoe/bedrock,flodolo/bedrock,ericawright/bedrock,TheJJ100100/bedrock,chirilo/bedrock,hoost...
--- +++ @@ -0,0 +1,15 @@ +""" +Deployment for Bedrock on www-dev.allizom.org. + +Requires commander (https://github.com/oremj/commander) which is installed on +the systems that need it. +""" +import os +import sys + +# these files are symlinked as 'update.py' in the project root. +ROOT = os.path.dirname(os.path.abspa...
1f38e1fbba7e83d35903587245c8f8e09cec9965
tool/zeroconf_ssh.py
tool/zeroconf_ssh.py
#!/usr/bin/python import socket import time from zeroconf import * def main(): print "Register SSH service ..." service_type = "_ssh._tcp.local." info = ServiceInfo(service_type, "RPi3." + service_type, socket.inet_aton("127.0.0.1"), 22, 0, 0, "", None) zc = Zero...
Add script to broadcast local ip via mdns, for easy to find the pi address without monitor
Add script to broadcast local ip via mdns, for easy to find the pi address without monitor
Python
apache-2.0
TimonLio/rex-pi,TimonLio/rex-pi
--- +++ @@ -0,0 +1,31 @@ +#!/usr/bin/python + +import socket +import time + +from zeroconf import * + +def main(): + print "Register SSH service ..." + + service_type = "_ssh._tcp.local." + info = ServiceInfo(service_type, + "RPi3." + service_type, + socket.inet_aton("127.0.0.1"), 22, +...
f83d04e389fdac327f8347f30bd2532cb26532ee
mongonaut/sites.py
mongonaut/sites.py
#from django.core.paginator import Paginate try: import floppyforms as forms except ImportError: from django import forms # TODO add default widgets class BaseMongoAdmin(object): search_fields = [] #This shows up on the DocumentListView of the Posts list_actions = [] #...
#from django.core.paginator import Paginate try: import floppyforms as forms except ImportError: from django import forms # TODO add default widgets class BaseMongoAdmin(object): search_fields = [] #This shows up on the DocumentListView of the Posts list_actions = [] #...
Add staff and user permission to views
Add staff and user permission to views
Python
mit
pydanny/django-mongonaut,lchsk/django-mongonaut,jazzband/django-mongonaut,pydanny/django-mongonaut,pydanny/django-mongonaut,jazzband/django-mongonaut,lchsk/django-mongonaut,lchsk/django-mongonaut,jazzband/django-mongonaut
--- +++ @@ -31,6 +31,21 @@ formfield_overrides = {} readonly_fields = () ordering = None + + def has_permission(self, request): + """ + Returns True if the given HttpRequest has permission to view + *at least one* page in the mongonaut site. + """ + return requ...
8d1bfe6b62d65c709c2feb91cc09b94d1c95f600
examples/lvm_cachepool.py
examples/lvm_cachepool.py
import os import blivet from blivet.size import Size from blivet.util import set_up_logging, create_sparse_tempfile set_up_logging() b = blivet.Blivet() # create an instance of Blivet (don't add system devices) # create a disk image file on which to create new devices disk1_file = create_sparse_tempfile("disk1", ...
Add LVM cache pool example
examples: Add LVM cache pool example
Python
lgpl-2.1
vojtechtrefny/blivet,vojtechtrefny/blivet,rvykydal/blivet,rvykydal/blivet
--- +++ @@ -0,0 +1,59 @@ +import os + +import blivet +from blivet.size import Size +from blivet.util import set_up_logging, create_sparse_tempfile + + +set_up_logging() +b = blivet.Blivet() # create an instance of Blivet (don't add system devices) + +# create a disk image file on which to create new devices +disk1_...
3fd0269492c83b4fbb05e88e27c2c9b42b4868fd
comics/comics/geekandpoke.py
comics/comics/geekandpoke.py
from comics.aggregator.crawler import BaseComicCrawler from comics.meta.base import BaseComicMeta class ComicMeta(BaseComicMeta): name = 'Geek and Poke' language = 'en' url = 'http://www.geekandpoke.com/' start_date = '2006-08-22' history_capable_days = 32 schedule = 'Mo,Tu,We,Th,Fr,Sa,Su' ...
Add crawler for 'Geek and Poke'
Add crawler for 'Geek and Poke'
Python
agpl-3.0
datagutten/comics,datagutten/comics,klette/comics,jodal/comics,jodal/comics,jodal/comics,klette/comics,jodal/comics,datagutten/comics,klette/comics,datagutten/comics
--- +++ @@ -0,0 +1,21 @@ +from comics.aggregator.crawler import BaseComicCrawler +from comics.meta.base import BaseComicMeta + +class ComicMeta(BaseComicMeta): + name = 'Geek and Poke' + language = 'en' + url = 'http://www.geekandpoke.com/' + start_date = '2006-08-22' + history_capable_days = 32 + s...
936a01efe745e8596a23142895a385d47611ff15
tests/providers/test_bank.py
tests/providers/test_bank.py
# coding=utf-8 import re import unittest from faker import Faker class TestNoNO(unittest.TestCase): """ Tests the street address in no_NO locale """ def setUp(self): self.factory = Faker('no_NO') def test_bban(self): bban = self.factory.bban() assert re.match("\d{11}", bban)
Add a unit test for the no_NO bban
Add a unit test for the no_NO bban
Python
mit
joke2k/faker,joke2k/faker,danhuss/faker
--- +++ @@ -0,0 +1,16 @@ +# coding=utf-8 + +import re +import unittest + +from faker import Faker + +class TestNoNO(unittest.TestCase): + """ Tests the street address in no_NO locale """ + + def setUp(self): + self.factory = Faker('no_NO') + + def test_bban(self): + bban = self.factory.bban() +...
bfda3309085919bd849e7478e1335a9da5dfc792
notebooks_preprocess.py
notebooks_preprocess.py
#!/usr/bin/env python import json import re from pathlib import Path def format_script_for_cell(path): """Read and format a .py file to be inserted into the json for a cell.""" header = '\n# Cell content replaced by load magic replacement.\n' with open(path) as f: return header + f.read() def f...
Add notebook pre processing script to replace load magics.
Add notebook pre processing script to replace load magics.
Python
mit
julienchastang/unidata-python-workshop,Unidata/unidata-python-workshop,julienchastang/unidata-python-workshop
--- +++ @@ -0,0 +1,68 @@ +#!/usr/bin/env python + +import json +import re +from pathlib import Path + + +def format_script_for_cell(path): + """Read and format a .py file to be inserted into the json for a cell.""" + header = '\n# Cell content replaced by load magic replacement.\n' + with open(path) as f: + ...
3577db65eceabd6c5ceb9858f45faee65ce0bbdf
zforce.py
zforce.py
import zipfile def bf_extract(zfile, password): zip = zipfile.ZipFile(zfile) try: zip.setpassword(password) zip.extractall() except: pass finally: zip.close() if __name__ == "__main__": bf_extract("spmv.zip", "ok")
Add function to extract zip file with passowrd
Add function to extract zip file with passowrd
Python
apache-2.0
alexst07/ZipBruteforce
--- +++ @@ -0,0 +1,14 @@ +import zipfile + +def bf_extract(zfile, password): + zip = zipfile.ZipFile(zfile) + try: + zip.setpassword(password) + zip.extractall() + except: + pass + finally: + zip.close() + +if __name__ == "__main__": + bf_extract("spmv.zip", "ok")
d65502a67a3ae356f7af3c40f68139ca90b66ed0
py/sp_test.py
py/sp_test.py
#!/usr/bin/python "Test spiffs filesystem with a range of parameters" import spiffs class SpiffsInstr(spiffs.SpiffsCharsBack): "Keeps count of issued reads / writes / erases" def __init__(self, *args, **kwargs): self.reset_counters() supe = super(SpiffsInstr, self) self.super_read = ...
Test script for parameter detemination.
Test script for parameter detemination. see https://github.com/pellepl/spiffs/issues/169
Python
mit
pellepl/spiffs,pellepl/spiffs
--- +++ @@ -0,0 +1,70 @@ +#!/usr/bin/python + +"Test spiffs filesystem with a range of parameters" + +import spiffs + +class SpiffsInstr(spiffs.SpiffsCharsBack): + "Keeps count of issued reads / writes / erases" + def __init__(self, *args, **kwargs): + self.reset_counters() + supe = super(SpiffsIn...
a513c18975fb5711b0fb2cefbf4496379747daa9
cyrasterize/run_test.py
cyrasterize/run_test.py
import numpy as np from cyrasterize import CyRasterizer from numpy.testing import assert_allclose def test_basic_random(): c = CyRasterizer(width=100, height=100) points = np.array([[-1, -1, 0], [1, -1, 0], [1, 1, 0], [-1, 1, 0]]) trilist = np.array([[0, 1, 2], [2, 3, 0]]) colours = np.random.uniform...
Add CyRasterize test to script
Add CyRasterize test to script Duplicates nose test I had added to the cyrasterize package
Python
bsd-3-clause
menpo/conda-recipes,menpo/conda-recipes
--- +++ @@ -0,0 +1,20 @@ +import numpy as np +from cyrasterize import CyRasterizer +from numpy.testing import assert_allclose + + +def test_basic_random(): + c = CyRasterizer(width=100, height=100) + + points = np.array([[-1, -1, 0], [1, -1, 0], [1, 1, 0], [-1, 1, 0]]) + trilist = np.array([[0, 1, 2], [2, 3,...
e87ba8f0a36c2d6ed9b058efd6fd91ed680af82c
twilio/contrib/jwt/__init__.py
twilio/contrib/jwt/__init__.py
""" JSON Web Token implementation Minimum implementation based on this spec: http://self-issued.info/docs/draft-jones-json-web-token-01.html """ import base64 import hashlib import hmac try: import json except ImportError: import simplejson as json __all__ = ['encode', 'decode', 'DecodeError'] class Dec...
Add jwt library in contrib
Add jwt library in contrib
Python
mit
supermanheng21/twilio-python,YeelerG/twilio-python,Rosy-S/twilio-python,Stackdriver/twilio-python,twilio/twilio-python,cinemapub/bright-response,clearcare/twilio-python,Stackdriver/twilio-python,johannakate/twilio-python,RobSpectre/twilio-python,Mobii/twilio-python,tysonholub/twilio-python,cinemapub/bright-response,bco...
--- +++ @@ -0,0 +1,72 @@ +""" JSON Web Token implementation + +Minimum implementation based on this spec: +http://self-issued.info/docs/draft-jones-json-web-token-01.html +""" +import base64 +import hashlib +import hmac + +try: + import json +except ImportError: + import simplejson as json + +__all__ = ['en...
6e047e9a4e07c379bcb0c47d13fa91dec796858a
twitter-utils/search2stream.py
twitter-utils/search2stream.py
""" Convert GET search (v1.1 or higher) from searchtweets.py to 'stream' format as expected by twitter-streamer. This means it will enumerate each item in the incoming JSON object's 'statuses' list, and output each on a separate line. """ import sys import simplejson as json for line in sys.stdin: try: o ...
Convert search results to stream filter API format.
Convert search results to stream filter API format.
Python
mit
inactivist/twitter-utils
--- +++ @@ -0,0 +1,17 @@ +""" +Convert GET search (v1.1 or higher) from searchtweets.py to 'stream' format +as expected by twitter-streamer. This means it will enumerate each item in +the incoming JSON object's 'statuses' list, and output each on a separate +line. +""" +import sys +import simplejson as json + +for l...
4866c643c0cb8f041dbdfa9db0611279ca4ef98d
plane_fit.py
plane_fit.py
from scipy.optimize import least_squares as lsq import numpy as np def myplane(p, x, y, z): return(p[0] + p[1] * x + p[2] * y - z) def plane_fit(x, y, z, robust=False): """ Fits a plane to data without any given uncertainties or weighting. Arguments: ---------- x, y: float x and y co...
Add a plane fitting roufit
Add a plane fitting roufit
Python
mit
low-sky/py-low-sky
--- +++ @@ -0,0 +1,40 @@ +from scipy.optimize import least_squares as lsq +import numpy as np + +def myplane(p, x, y, z): + return(p[0] + p[1] * x + p[2] * y - z) + + +def plane_fit(x, y, z, robust=False): + """ + + Fits a plane to data without any given uncertainties or weighting. + + Arguments: + ---...
bf694c664649d225006b764af467fe106f59742e
tests/test_token.py
tests/test_token.py
import kindred def test_token_str(): t = kindred.Token(word="hat",lemma="hat",partofspeech="NN",startPos=0,endPos=3) assert str(t) == "hat" def test_token_repr(): t = kindred.Token(word="hat",lemma="hat",partofspeech="NN",startPos=0,endPos=3) assert t.__repr__() == "hat"
Add token test for string functions
Add token test for string functions
Python
mit
jakelever/kindred,jakelever/kindred
--- +++ @@ -0,0 +1,11 @@ +import kindred + +def test_token_str(): + t = kindred.Token(word="hat",lemma="hat",partofspeech="NN",startPos=0,endPos=3) + + assert str(t) == "hat" + +def test_token_repr(): + t = kindred.Token(word="hat",lemma="hat",partofspeech="NN",startPos=0,endPos=3) + + assert t.__repr__() == "hat"
109595a93089a80d4b762e91c2eecad58025d69d
utils/tweet_text.py
utils/tweet_text.py
#!/usr/bin/env python """ Given a JSON file, return just the text of the tweet. Example usage: utils/tweet_text.py tweets.jsonl > tweets.txt """ from __future__ import print_function import json import fileinput for line in fileinput.input(): tweet = json.loads(line) if 'full_text' in tweet: print(t...
Add util for extracting just the tweet text.
Add util for extracting just the tweet text.
Python
mit
hugovk/twarc,remagio/twarc,DocNow/twarc,edsu/twarc,remagio/twarc
--- +++ @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +""" +Given a JSON file, return just the text of the tweet. +Example usage: +utils/tweet_text.py tweets.jsonl > tweets.txt +""" + +from __future__ import print_function +import json +import fileinput + +for line in fileinput.input(): + tweet = json.loads(line) + + ...
ff44e924a4f01bd39d4b26a39519bf55dd5e7560
ann.py
ann.py
class ANN: def __init__(self): pass def train(self): pass def predict(self): pass def update_weights(self): pass class Layer: def __init__(self): pass
Add top down design of ANN and Layer
Add top down design of ANN and Layer
Python
apache-2.0
Razvy000/ANN_Course
--- +++ @@ -0,0 +1,21 @@ + + +class ANN: + + def __init__(self): + pass + + def train(self): + pass + + def predict(self): + pass + + def update_weights(self): + pass + + +class Layer: + + def __init__(self): + pass
37de8d954b9e870590f5bfb9fff3e4ce4e41acca
mkt/extensions/migrations/0006_auto_20150914_0745.py
mkt/extensions/migrations/0006_auto_20150914_0745.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('extensions', '0005_auto_20150902_0755'), ] operations = [ migrations.AlterField( model_name='extension', ...
Add missing migration following status choices changes
Add missing migration following status choices changes
Python
bsd-3-clause
diox/zamboni,washort/zamboni,elysium001/zamboni,diox/zamboni,ddurst/zamboni,elysium001/zamboni,diox/zamboni,ddurst/zamboni,elysium001/zamboni,elysium001/zamboni,washort/zamboni,mozilla/zamboni,mozilla/zamboni,ingenioustechie/zamboni,jasonthomas/zamboni,diox/zamboni,mozilla/zamboni,ingenioustechie/zamboni,jasonthomas/za...
--- +++ @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('extensions', '0005_auto_20150902_0755'), + ] + + operations = [ + migrations.AlterField( + ...
9e178a56d84a634a32b0f05d5a3c7436c565418f
script2.py
script2.py
from suds.client import Client url = 'http://legislatie.just.ro/apiws/FreeWebService.svc?wsdl' print("==== create client") client = Client(url) print(client) print("==== get token") token = client.service.GetToken() print(token) print("==== do search") search_model = client.factory.create('SearchModel') search_mode...
Add example for searching in titles
Add example for searching in titles
Python
mit
govro/legislatie-just-python-soap-client,govro/legislatie-just-python-soap-client
--- +++ @@ -0,0 +1,23 @@ +from suds.client import Client + +url = 'http://legislatie.just.ro/apiws/FreeWebService.svc?wsdl' + +print("==== create client") +client = Client(url) +print(client) + +print("==== get token") +token = client.service.GetToken() +print(token) + +print("==== do search") +search_model = client....
c80f8e1c1d53f1a19b654f17361d40720b5a90fe
app/core/netutils.py
app/core/netutils.py
import logging import re import socket from subprocess import Popen, PIPE logger = logging.getLogger(__name__) def get_mac_address(host): """ Returns MAC address for a hostname. """ mac_pattern = '(([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})' try: host = socket.gethostbyname(host) except socket.erro...
Add utility to get mac address from host.
Add utility to get mac address from host.
Python
mit
supersaiyanmode/HomePiServer,supersaiyanmode/HomePiServer,supersaiyanmode/HomePiServer
--- +++ @@ -0,0 +1,24 @@ +import logging +import re +import socket +from subprocess import Popen, PIPE + + +logger = logging.getLogger(__name__) + + +def get_mac_address(host): + """ Returns MAC address for a hostname. """ + mac_pattern = '(([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})' + try: + host = socket.g...
b7d95fd7ae0515b15c14e6f01f3c22645953afe7
example/add_comments.py
example/add_comments.py
import bugsy bz = bugsy.Bugsy("username", "password", "https://bugzilla-dev.allizom.org/rest") bug = bugsy.Bug() bug.summary = "I love cheese" bug.add_comment('I do love sausages too') bz.put(bug) bug.add_comment('I do love eggs too')
Add example for adding comments that runs against a real server
Add example for adding comments that runs against a real server
Python
apache-2.0
AutomatedTester/Bugsy,indygreg/Bugsy,parkouss/Bugsy
--- +++ @@ -0,0 +1,8 @@ +import bugsy +bz = bugsy.Bugsy("username", "password", "https://bugzilla-dev.allizom.org/rest") +bug = bugsy.Bug() +bug.summary = "I love cheese" +bug.add_comment('I do love sausages too') +bz.put(bug) + +bug.add_comment('I do love eggs too')
4a1577d1a31d30fa006d4030114c9e2790056127
nagios-plugins/check_ip_pool.py
nagios-plugins/check_ip_pool.py
#!/usr/bin/env python """ Check for remaining IP addresses """ # pylint: disable=import-error from neutronclient.v2_0 import client from ipaddress import ip_network import sys import argparse NAGIOS_OK = 0 NAGIOS_WARNING = 1 NAGIOS_CRITICAL = 2 NAGIOS_UNKNOWN = 3 def main(): """ Main script body """ ...
Add nagios check for remaining IP addresses
Add nagios check for remaining IP addresses Check currently assumes a single external network and checks for routers with allocated IP's and floating IP's allocated Change-Id: I6835de8b036ed5247994ebd904f63147dfef3d67
Python
apache-2.0
openstack/osops-tools-monitoring,openstack/osops-tools-monitoring,openstack/osops-tools-monitoring
--- +++ @@ -0,0 +1,81 @@ +#!/usr/bin/env python +""" +Check for remaining IP addresses +""" +# pylint: disable=import-error + +from neutronclient.v2_0 import client +from ipaddress import ip_network +import sys +import argparse + +NAGIOS_OK = 0 +NAGIOS_WARNING = 1 +NAGIOS_CRITICAL = 2 +NAGIOS_UNKNOWN = 3 + +def main(...
43d1f8f1d5ef6a7452d6bad7e10d5be1f688c0b9
app/knn_prediction.py
app/knn_prediction.py
#!/usr/bin/env python from sklearn.neighbors import KNeighborsClassifier from sklearn.metrics import accuracy_score, classification_report, confusion_matrix import validate_dataset as validate # Make predictions using K-Nearest Neighbors knn = KNeighborsClassifier() # load train data from validate knn.fit(validate.X_...
Add predication from K-Nearest Neighbors
Add predication from K-Nearest Neighbors
Python
mit
lucasb/iris-machine-learning
--- +++ @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +from sklearn.neighbors import KNeighborsClassifier +from sklearn.metrics import accuracy_score, classification_report, confusion_matrix +import validate_dataset as validate + +# Make predictions using K-Nearest Neighbors +knn = KNeighborsClassifier() +# load train da...
a121281532dc3c9da6534684da0eae0ab57b000b
nose2/tests/unit/test_config.py
nose2/tests/unit/test_config.py
from nose2 import config from nose2.compat import unittest class TestConfigSession(unittest.TestCase): def test_can_create_session(self): config.Session() class TestConfig(unittest.TestCase): def setUp(self): self.conf = config.Config([('a', ' 1 '), ('b', ' x\n y ')]) def test_as_int(...
from nose2 import config from nose2.compat import unittest class TestConfigSession(unittest.TestCase): def test_can_create_session(self): config.Session() class TestConfig(unittest.TestCase): def setUp(self): self.conf = config.Config([ ('a', ' 1 '), ('b', ' x\n y '), ('c',...
Add test for as_bool bug
Add test for as_bool bug
Python
bsd-2-clause
little-dude/nose2,ojengwa/nose2,ezigman/nose2,ptthiem/nose2,ptthiem/nose2,ezigman/nose2,little-dude/nose2,leth/nose2,ojengwa/nose2,leth/nose2
--- +++ @@ -9,7 +9,8 @@ class TestConfig(unittest.TestCase): def setUp(self): - self.conf = config.Config([('a', ' 1 '), ('b', ' x\n y ')]) + self.conf = config.Config([ + ('a', ' 1 '), ('b', ' x\n y '), ('c', '0')]) def test_as_int(self): self.assertEqual(self...
d45f71966ffa298245e3577126a5bf299ba1e36a
submissions/faeludire/Day_5/count_vowels.py
submissions/faeludire/Day_5/count_vowels.py
#Day 5: Count Vowels #This program counts the number of vowels in the entered string. #For added complexity, it reports a sum of each vowel found in a long text. inputString = raw_input("Enter the string to be evaluated:") lowerCaseString = str.lower(inputString) convertedListString = list(lowerCaseString) aNum = co...
Update submission for Day 5
Update submission for Day 5
Python
mit
ConsonanceNg/100_Days_of_code_submissions,ConsonanceNg/100_Days_of_code_submissions,ConsonanceNg/100_Days_of_code_submissions,ConsonanceNg/100_Days_of_code_submissions,ConsonanceNg/100_Days_of_code_submissions,ConsonanceNg/100_Days_of_code_submissions,ConsonanceNg/100_Days_of_code_submissions,ConsonanceNg/100_Days_of_c...
--- +++ @@ -0,0 +1,23 @@ +#Day 5: Count Vowels + +#This program counts the number of vowels in the entered string. +#For added complexity, it reports a sum of each vowel found in a long text. + +inputString = raw_input("Enter the string to be evaluated:") + +lowerCaseString = str.lower(inputString) +convertedListStri...
6a3eda2781f1ea4ed7106313fdc5b7c40786304c
tests/integration/mci/test_backwards_navigation_after_submission.py
tests/integration/mci/test_backwards_navigation_after_submission.py
from .test_happy_path import TestHappyPath class TestbackwardsNavigationAfterSubmission(TestHappyPath): def test_backwards_navigation(self): self.test_happy_path() resp = self.client.get('/submission', follow_redirects=False) self.assertEquals(resp.status_code, 302) self.assertReg...
Add test for navigating backwards, after submission - failing
Add test for navigating backwards, after submission - failing
Python
mit
ONSdigital/eq-survey-runner,ONSdigital/eq-survey-runner,ONSdigital/eq-survey-runner,ONSdigital/eq-survey-runner
--- +++ @@ -0,0 +1,18 @@ +from .test_happy_path import TestHappyPath + +class TestbackwardsNavigationAfterSubmission(TestHappyPath): + + def test_backwards_navigation(self): + self.test_happy_path() + + resp = self.client.get('/submission', follow_redirects=False) + self.assertEquals(resp.stat...
1b2f9c992982a288d0e7e20b0a1eb96b2fd8a12c
channels.py
channels.py
from django.utils import simplejson from google.appengine.api import channel, memcache class Channel(): token = None address = None cached = True message = {} def __init__(self, address): self.address = address self.token = memcache.get("token_%s" % self.address) if self.token is None: self.to...
Split functionality of the Channel API into a separate file and refactored it a bit. Not functional.
Split functionality of the Channel API into a separate file and refactored it a bit. Not functional.
Python
mit
2cloud/AppEngine,2cloud/AppEngine
--- +++ @@ -0,0 +1,32 @@ +from django.utils import simplejson +from google.appengine.api import channel, memcache + +class Channel(): + token = None + address = None + cached = True + message = {} + + def __init__(self, address): + self.address = address + self.token = memcache.get("token_%s" % self.address)...
292468de015338bde2e7ddbe22a518391ee767c4
application/config.py
application/config.py
import os class Config(object): """ This class configures the parameters to be used in a production enviroment""" CSRF_ENABLED = True SECRET_KEY = os.environ["SECRET_KEY"] SQLALCHEMY_DATABASE_URI = os.environ["SQLALCHEMY_DATABASE_URI"] class Test(object): """ This class configures the parameters t...
Fix SQLACHEMY_DATABASE_URI for the tests database
[Bug] Fix SQLACHEMY_DATABASE_URI for the tests database
Python
mit
CharlesJonah/bucket_list_api,CharlesJonah/bucket_list_api
--- +++ @@ -0,0 +1,15 @@ +import os + +class Config(object): + """ This class configures the parameters to be used in a production enviroment""" + CSRF_ENABLED = True + SECRET_KEY = os.environ["SECRET_KEY"] + SQLALCHEMY_DATABASE_URI = os.environ["SQLALCHEMY_DATABASE_URI"] + +class Test(object): + """ T...
1984bf841dd45b6f49d9981aaa61b10205db2dd4
scripts/objectsize_recovery.py
scripts/objectsize_recovery.py
#!/usr/bin/env python # Copyright (c) 2011 Stanford University # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND ...
Add script to generate recovery time versus object size data
Add script to generate recovery time versus object size data
Python
isc
mrdiegoa/ramcloud,DavidLi2010/ramcloud,Frank-Wu/RamCloud,Frank-Wu/RamCloud,rstutsman/RAMCloud,matrix207/RAMCloud,jblomer/ramcloud,anirajk/RAMCloud,jcarreira/ramcloud,QingkaiLu/RAMCloud,Frank-Wu/RamCloud,y-higuchi/ramcloud,behnamm/cs244b_project,matrix207/RAMCloud,y-higuchi/ramcloud,jcarreira/ramcloud,IMCG/RamCloud,jcar...
--- +++ @@ -0,0 +1,49 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Stanford University +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# T...
de179fafa95082b266ea0ca561b835058dc902de
bot/bot_optimized.py
bot/bot_optimized.py
import praw import time r = praw.Reddit('Comment parser example by u/_Daimon_') multi_reddits = r.get_subreddit('gif+pics') base = multi_reddits.get_comments(limit=1).next() print "Base=", base.fullname time.sleep(4) while True: mrc = multi_reddits.get_comments(limit=40, params={"before": base.fullname}) ...
Add optimized bot. Reduce the number of queries
bot: Add optimized bot. Reduce the number of queries Signed-off-by: Valentin Ilie <2677a908e9239f6354e2990b8c11cc5ac25eaf8a@gmail.com>
Python
unlicense
vilie/rp,vilie/rp
--- +++ @@ -0,0 +1,20 @@ +import praw +import time + +r = praw.Reddit('Comment parser example by u/_Daimon_') +multi_reddits = r.get_subreddit('gif+pics') + +base = multi_reddits.get_comments(limit=1).next() + +print "Base=", base.fullname + +time.sleep(4) + + +while True: + mrc = multi_reddits.get_comments(limit=...
29536938fa6f780875b808e68dc2afbf8dabf615
tests/make_cal.py
tests/make_cal.py
#!/usr/bin/env python from __future__ import print_function import argparse import datetime import os import sys os.environ['TZ'] = 'UTC' def crprint(s): ''' Print using DOS line endings (to match Arduino code) :param s: :return: ''' sys.stdout.write(s) sys.stdout.write('\r\n') parse...
Print a basic calendar for the start of each month from the epoch
Print a basic calendar for the start of each month from the epoch
Python
lgpl-2.1
stevemarple/RTCx,stevemarple/RTCx
--- +++ @@ -0,0 +1,55 @@ +#!/usr/bin/env python + +from __future__ import print_function + +import argparse +import datetime +import os +import sys + + + +os.environ['TZ'] = 'UTC' + + +def crprint(s): + ''' + Print using DOS line endings (to match Arduino code) + :param s: + :return: + ''' + sys.std...
9d269683fbfaaf2afc9b0ce171f8a11242144eb2
tests/test_vat.py
tests/test_vat.py
import unittest from decimal import Decimal as D from oscar_vat_moss import vat class AddressTest(unittest.TestCase): ADDRESSES = ( # Submission dictionary # Expected rate ({'line4': 'Vienna', 'country': 'AT', 'postcode': 1010}, D('0.20')), ({'line4': 'Berl...
Add unit tests for vat.py
Add unit tests for vat.py
Python
bsd-3-clause
fghaas/django-oscar-vat_moss,arbrandes/django-oscar-vat_moss,hastexo/django-oscar-vat_moss,fghaas/django-oscar-vat_moss,arbrandes/django-oscar-vat_moss,hastexo/django-oscar-vat_moss
--- +++ @@ -0,0 +1,45 @@ +import unittest +from decimal import Decimal as D +from oscar_vat_moss import vat + + +class AddressTest(unittest.TestCase): + ADDRESSES = ( + # Submission dictionary # Expected rate + ({'line4': 'Vienna', + 'country': 'AT', + 'postcode': 1010}, ...
207642657e353003507243bdf863b1e27b7a04cd
benchmark/paddle/image/plotlog.py
benchmark/paddle/image/plotlog.py
#coding=utf-8 import sys import argparse import matplotlib.pyplot as plt def parse_args(): parser = argparse.ArgumentParser('Parse Log') parser.add_argument( '--file_path', '-f', type=str, help='the path of the log file') parser.add_argument( '--sample_rate', '-s', type=fl...
Add script to plot learning curve
Add script to plot learning curve
Python
apache-2.0
reyoung/Paddle,QiJune/Paddle,lcy-seso/Paddle,Canpio/Paddle,jacquesqiao/Paddle,pkuyym/Paddle,putcn/Paddle,Canpio/Paddle,Canpio/Paddle,baidu/Paddle,luotao1/Paddle,tensor-tang/Paddle,reyoung/Paddle,pkuyym/Paddle,lcy-seso/Paddle,jacquesqiao/Paddle,PaddlePaddle/Paddle,reyoung/Paddle,Canpio/Paddle,lcy-seso/Paddle,lcy-seso/Pa...
--- +++ @@ -0,0 +1,87 @@ +#coding=utf-8 + +import sys +import argparse +import matplotlib.pyplot as plt + + +def parse_args(): + parser = argparse.ArgumentParser('Parse Log') + parser.add_argument( + '--file_path', '-f', type=str, help='the path of the log file') + parser.add_argument( + '--sam...
982fc34e7b4b78f49ef8b8c5c1842f410f394dc9
steps/app-switch-demo.py
steps/app-switch-demo.py
from behave import given, when, then from appium import webdriver import os import time from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.support import expected_conditions as EC imp...
Add implementation of the behave feature in steps
Add implementation of the behave feature in steps
Python
mit
avidas/reliability-demo
--- +++ @@ -0,0 +1,60 @@ +from behave import given, when, then +from appium import webdriver +import os +import time + +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.common.by import By +from selenium.common.exceptions import NoSuchElementException +from selenium.webdriver.support i...
4790b1afa5d0125948bb8fdbed6f5838d470a570
test/client/local_recognizer_test.py
test/client/local_recognizer_test.py
import unittest import os from speech_recognition import WavFile from mycroft.client.speech.listener import RecognizerLoop __author__ = 'seanfitz' DATA_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "data") class LocalRecognizerTest(unittest.TestCase): def setUp(self): self.recognizer ...
import unittest import os from speech_recognition import WavFile from mycroft.client.speech.listener import RecognizerLoop __author__ = 'seanfitz' DATA_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "data") class LocalRecognizerTest(unittest.TestCase): def setUp(self): rl = RecognizerL...
Fix init of local recognizer
Fix init of local recognizer
Python
apache-2.0
MycroftAI/mycroft-core,forslund/mycroft-core,aatchison/mycroft-core,Dark5ide/mycroft-core,linuxipho/mycroft-core,forslund/mycroft-core,linuxipho/mycroft-core,MycroftAI/mycroft-core,aatchison/mycroft-core,Dark5ide/mycroft-core
--- +++ @@ -12,7 +12,9 @@ class LocalRecognizerTest(unittest.TestCase): def setUp(self): - self.recognizer = RecognizerLoop.create_mycroft_recognizer(16000, + rl = RecognizerLoop() + self.recognizer = RecognizerLoop.create_mycroft_recognizer(rl, + ...
cd3a5bc00444266d417e09bba54230024c810888
examples/routes.py
examples/routes.py
import build.eve_nerd as eve_nerd def print_route(v): print((" %s to %s " % (v.points[0].entity.system.name, v.points[-1].entity.system.name)).center(80, "-")) t = int(v.cost) print("Estimated travel time: %d:%02d:%02d" % (t / 3600, (t % 3600) / 60, t % 60)) for x in range(len(v.points)): r = ...
Add an example (with wrong import path).
Add an example (with wrong import path).
Python
mit
StephenSwat/new-eden-route-derivation,StephenSwat/new-eden-route-derivation
--- +++ @@ -0,0 +1,48 @@ +import build.eve_nerd as eve_nerd + +def print_route(v): + print((" %s to %s " % (v.points[0].entity.system.name, v.points[-1].entity.system.name)).center(80, "-")) + t = int(v.cost) + print("Estimated travel time: %d:%02d:%02d" % (t / 3600, (t % 3600) / 60, t % 60)) + + for x in...
17fc6d0c117799345bb8ddbbea732fa6c4ff309d
test/backend/test_job.py
test/backend/test_job.py
import unittest import modloop import saliweb.test import saliweb.backend import os class JobTests(saliweb.test.TestCase): """Check custom ModLoop Job class""" def test_run_sanity_check(self): """Test sanity checking in run method""" j = self.make_test_job(modloop.Job, 'RUNNING') d = s...
Test ModLoop's custom Job class.
Test ModLoop's custom Job class.
Python
lgpl-2.1
salilab/modloop,salilab/modloop
--- +++ @@ -0,0 +1,57 @@ +import unittest +import modloop +import saliweb.test +import saliweb.backend +import os + +class JobTests(saliweb.test.TestCase): + """Check custom ModLoop Job class""" + + def test_run_sanity_check(self): + """Test sanity checking in run method""" + j = self.make_test_jo...
1038f39191ae5dad0d91f7b8a89411c51ad028d0
ncclient/devices/junos.py
ncclient/devices/junos.py
""" Handler for Cisco CSR device specific information. Note that for proper import, the classname has to be: "<Devicename>DeviceHandler" ...where <Devicename> is something like "Default", "Nexus", etc. All device-specific handlers derive from the DefaultDeviceHandler, which implements the generic information ne...
Implement extra Juniper operations in devices module
Implement extra Juniper operations in devices module
Python
apache-2.0
sebastianw/ncclient,lightlu/ncclient,aitorhh/ncclient,OpenClovis/ncclient,katharh/ncclient,nnakamot/ncclient,ncclient/ncclient,earies/ncclient,vnitinv/ncclient,einarnn/ncclient,kroustou/ncclient,nwautomator/ncclient,cmoberg/ncclient,GIC-de/ncclient,leopoul/ncclient,joysboy/ncclient
--- +++ @@ -0,0 +1,39 @@ +""" +Handler for Cisco CSR device specific information. + +Note that for proper import, the classname has to be: + + "<Devicename>DeviceHandler" + +...where <Devicename> is something like "Default", "Nexus", etc. + +All device-specific handlers derive from the DefaultDeviceHandler, which ...
f4026b34f97c4e42a2229d47e778fbe09b351eb1
tools/tabulate_events.py
tools/tabulate_events.py
#!/usr/bin/env python # note: must be invoked from the top-level sts directory import time import argparse import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), "..")) from sts.replay_event import * from sts.dataplane_traces.trace import Trace from sts.input_traces.log_parser import parse fro...
Add simple tool for tabulating classes of event types for readability
Add simple tool for tabulating classes of event types for readability
Python
apache-2.0
jmiserez/sts,jmiserez/sts,ucb-sts/sts,ucb-sts/sts
--- +++ @@ -0,0 +1,76 @@ +#!/usr/bin/env python + +# note: must be invoked from the top-level sts directory + +import time +import argparse +import os +import sys + +sys.path.append(os.path.join(os.path.dirname(__file__), "..")) + +from sts.replay_event import * +from sts.dataplane_traces.trace import Trace +from sts...
95db13e4d0342d44e6a8375779b543f6d631fd8d
shinken/modules/dummy_poller.py
shinken/modules/dummy_poller.py
#!/usr/bin/python #Copyright (C) 2009 Gabes Jean, naparuba@gmail.com # #This file is part of Shinken. # #Shinken is free software: you can redistribute it and/or modify #it under the terms of the GNU Affero General Public License as published by #the Free Software Foundation, either version 3 of the License, or #(at yo...
Add : dummy poller module example.
Add : dummy poller module example.
Python
agpl-3.0
Simage/shinken,ddurieux/alignak,dfranco/shinken,gst/alignak,Simage/shinken,rednach/krill,geektophe/shinken,Simage/shinken,mohierf/shinken,Simage/shinken,kaji-project/shinken,kaji-project/shinken,tal-nino/shinken,Aimage/shinken,Aimage/shinken,geektophe/shinken,tal-nino/shinken,staute/shinken_deb,peeyush-tm/shinken,Kerkh...
--- +++ @@ -0,0 +1,58 @@ +#!/usr/bin/python +#Copyright (C) 2009 Gabes Jean, naparuba@gmail.com +# +#This file is part of Shinken. +# +#Shinken is free software: you can redistribute it and/or modify +#it under the terms of the GNU Affero General Public License as published by +#the Free Software Foundation, either v...
780c2ed7df2a94de5f5ec89cc4b970cf44c04f06
tests/admin_log.py
tests/admin_log.py
from wolis.test_case import WolisTestCase class AdminLogTest(WolisTestCase): def test_admin_log(self): self.login('morpheus', 'morpheus') self.acp_login('morpheus', 'morpheus') start_url = '/adm/index.php' self.get_with_sid(start_url) self.assert_successish() ...
Test for admin log viewing
Test for admin log viewing
Python
bsd-2-clause
p/wolis-phpbb,p/wolis-phpbb
--- +++ @@ -0,0 +1,27 @@ +from wolis.test_case import WolisTestCase + +class AdminLogTest(WolisTestCase): + def test_admin_log(self): + self.login('morpheus', 'morpheus') + self.acp_login('morpheus', 'morpheus') + + start_url = '/adm/index.php' + self.get_with_sid(start_url) + ...
092abd7035168c18c2e49bfbcb5a36b778015a2d
traits/tests/test_abc.py
traits/tests/test_abc.py
""" Test the ABC functionality. """ import unittest try: import abc from ..api import ABCHasTraits, ABCMetaHasTraits, HasTraits, Int, Float class AbstractFoo(ABCHasTraits): x = Int(10) y = Float(20.0) @abc.abstractmethod def foo(self): raise NotImplementedErr...
Add some tests for ABCHasTraits.
TST: Add some tests for ABCHasTraits.
Python
bsd-3-clause
burnpanck/traits,burnpanck/traits
--- +++ @@ -0,0 +1,81 @@ +""" Test the ABC functionality. +""" + +import unittest + +try: + import abc + + from ..api import ABCHasTraits, ABCMetaHasTraits, HasTraits, Int, Float + + class AbstractFoo(ABCHasTraits): + x = Int(10) + y = Float(20.0) + + @abc.abstractmethod + def foo...
3fd9bfaea8b11a12fd7bdece9c1877c1a5a6afa6
tests/test_text.py
tests/test_text.py
# -*- coding: utf-8 -*- from vdm.text import normalize, tokenize, url_slug def test_normalize(): #Mixed case and str to unicode assert normalize('BroWn') == normalize(u'Brown') #Trailing spaces assert normalize(' Brown ') == normalize('Brown') #removed accents assert normalize(u'Èasy') == no...
Add basic tests for text.
Add basic tests for text.
Python
mit
Brown-University-Library/vivo-data-management,Brown-University-Library/vivo-data-management
--- +++ @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +from vdm.text import normalize, tokenize, url_slug + + +def test_normalize(): + #Mixed case and str to unicode + assert normalize('BroWn') == normalize(u'Brown') + #Trailing spaces + assert normalize(' Brown ') == normalize('Brown') + #removed accent...
69d3cb59c19410d4ac6b619c06fd9d1a9bba9154
changes/api/project_coverage_index.py
changes/api/project_coverage_index.py
from __future__ import absolute_import, division, unicode_literals from flask.ext.restful import reqparse from changes.api.base import APIView from changes.constants import Result, Status from changes.models import Build, Job, FileCoverage, Project, Source SORT_CHOICES = ( 'lines_covered', 'lines_uncovered',...
Add project coverage index endpoint
Add project coverage index endpoint
Python
apache-2.0
wfxiang08/changes,bowlofstew/changes,wfxiang08/changes,bowlofstew/changes,dropbox/changes,dropbox/changes,dropbox/changes,wfxiang08/changes,bowlofstew/changes,bowlofstew/changes,wfxiang08/changes,dropbox/changes
--- +++ @@ -0,0 +1,64 @@ +from __future__ import absolute_import, division, unicode_literals + +from flask.ext.restful import reqparse + +from changes.api.base import APIView +from changes.constants import Result, Status +from changes.models import Build, Job, FileCoverage, Project, Source + +SORT_CHOICES = ( + 'l...
4a41fb3a3b6a689e3cc3c83d711331ad743824de
py/longest-univalue-path.py
py/longest-univalue-path.py
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def dfs(self, cur): """ return longest univalue path, longest univalue path to children from self""" if c...
Add py solution for 687. Longest Univalue Path
Add py solution for 687. Longest Univalue Path 687. Longest Univalue Path: https://leetcode.com/problems/longest-univalue-path/
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,31 @@ +# Definition for a binary tree node. +# class TreeNode(object): +# def __init__(self, x): +# self.val = x +# self.left = None +# self.right = None + +class Solution(object): + def dfs(self, cur): + """ return longest univalue path, longest univalue path ...
5b531877f30a323de3171422916c29f20921a18a
pylearn2/costs/tests/test_lp_norm_cost.py
pylearn2/costs/tests/test_lp_norm_cost.py
""" Test LpNorm cost """ import numpy import theano from theano import tensor as T from nose.tools import raises def test_shared_variables(): ''' LpNorm should handle shared variables. ''' assert False def test_symbolic_expressions_of_shared_variables(): ''' LpNorm should handle symbolic exp...
Add unit test for LpNorm
Add unit test for LpNorm
Python
bsd-3-clause
woozzu/pylearn2,Refefer/pylearn2,ddboline/pylearn2,nouiz/pylearn2,w1kke/pylearn2,pkainz/pylearn2,fulmicoton/pylearn2,mkraemer67/pylearn2,pkainz/pylearn2,se4u/pylearn2,cosmoharrigan/pylearn2,skearnes/pylearn2,msingh172/pylearn2,JesseLivezey/pylearn2,pombredanne/pylearn2,ddboline/pylearn2,fulmicoton/pylearn2,pombredanne/...
--- +++ @@ -0,0 +1,35 @@ +""" +Test LpNorm cost +""" +import numpy +import theano +from theano import tensor as T +from nose.tools import raises + + +def test_shared_variables(): + ''' + LpNorm should handle shared variables. + ''' + assert False + + +def test_symbolic_expressions_of_shared_variables(): +...
1206fe0a6f57bc925dc01db03c604b7b786384aa
misc/migrate_miro_vhs.py
misc/migrate_miro_vhs.py
#!/usr/bin/env python # -*- encoding: utf-8 import boto3 def get_existing_records(dynamodb_client): """ Generates existing Miro records from the SourceData table. """ paginator = dynamodb_client.get_paginator('scan') for page in paginator.paginate(TableName='SourceData'): for item in page...
Add the initial draft of the migration script
Add the initial draft of the migration script
Python
mit
wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api
--- +++ @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# -*- encoding: utf-8 + +import boto3 + + +def get_existing_records(dynamodb_client): + """ + Generates existing Miro records from the SourceData table. + """ + paginator = dynamodb_client.get_paginator('scan') + for page in paginator.paginate(TableName=...
a3cad465c43cc88ac382e0bf44166d49420ae02e
dash/plotly_graph.py
dash/plotly_graph.py
import datetime import time import random from dash.react import Dash from dash_html_components import Div from dash_core_components import Dropdown, PlotlyGraph dash = Dash(__name__) graph_json = { 'figure': { 'layout': { 'barmode': 'stack' } } } graph_data = [ [{ 'x...
Add plotly graph example with animals
Add plotly graph example with animals
Python
mit
plotly/dash,plotly/dash,plotly/dash,plotly/dash,plotly/dash
--- +++ @@ -0,0 +1,88 @@ +import datetime +import time +import random + +from dash.react import Dash +from dash_html_components import Div +from dash_core_components import Dropdown, PlotlyGraph + +dash = Dash(__name__) + +graph_json = { + 'figure': { + 'layout': { + 'barmode': 'stack' + }...
32301da235d40ae3eca7dcbdd7c8438d3c35f775
app/task.py
app/task.py
from mongoengine import Document, DateTimeField, EmailField, IntField, \ ReferenceField, StringField import datetime, enum class Priority(enum.IntEnum): LOW = 0, MIDDLE = 1, HIGH = 2 """ This defines the basic model for a Task as we want it to be stored in the MongoDB. """ class Task(Document): ...
Add a basic model for a Task
Add a basic model for a Task
Python
mit
Zillolo/lazy-todo
--- +++ @@ -0,0 +1,25 @@ +from mongoengine import Document, DateTimeField, EmailField, IntField, \ + ReferenceField, StringField +import datetime, enum + +class Priority(enum.IntEnum): + LOW = 0, + MIDDLE = 1, + HIGH = 2 + +""" +This defines the basic model for a Task as we want it to be stored in the + ...
29a4c1e0d905b92e4c35d594183e73be31e5c89e
tesla/models.py
tesla/models.py
""" Tesla car model """ import uuid import json from random import choice __OFF__ = 'off' __ON__ = 'on' __COLOR__ = ['black', 'white', 'red', 'brown', 'gold', 'pink'] JSONEncoder_old = json.JSONEncoder.default def JSONEncoder_new(self, obj): if isinstance(obj, uuid.UUID): return str(obj) return JSONEncoder_o...
Add a basic vehicle model and garage
Add a basic vehicle model and garage
Python
mit
headforwards/tesla-simulator-server,headforwards/tesla-simulator-server
--- +++ @@ -0,0 +1,61 @@ +""" +Tesla car model +""" +import uuid +import json +from random import choice + +__OFF__ = 'off' +__ON__ = 'on' +__COLOR__ = ['black', 'white', 'red', 'brown', 'gold', 'pink'] +JSONEncoder_old = json.JSONEncoder.default + + +def JSONEncoder_new(self, obj): + if isinstance(obj, uuid.UUID)...
0ce38e6dd892083e74113852424d1825f5dbf8bd
tools/integrate-redis-stats.py
tools/integrate-redis-stats.py
#!usr/bin/env python import os import sys import datetime import redis from itertools import izip, izip_longest # Workaround current bug in docutils: # http://permalink.gmane.org/gmane.text.docutils.devel/6324 import docutils.utils root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path = [root] ...
Add a script that processes stats from Redis
Add a script that processes stats from Redis
Python
bsd-3-clause
pydotorg/pypi,pydotorg/pypi,pydotorg/pypi,pydotorg/pypi
--- +++ @@ -0,0 +1,62 @@ +#!usr/bin/env python +import os +import sys +import datetime +import redis + +from itertools import izip, izip_longest + +# Workaround current bug in docutils: +# http://permalink.gmane.org/gmane.text.docutils.devel/6324 +import docutils.utils + +root = os.path.dirname(os.path.dirname(os.pat...
f1932b77306e2c1138ec99b312f2db80d0078079
misc/python/nisttest.py
misc/python/nisttest.py
#!/usr/bin/python import sys, re, os, botan from os.path import join; class TestResult(Exception): def __init__(self, r): self.result = r def __str__(self): return repr(self.result).replace('botan._botan.verify_result.', '') def throw_unless_ok(r): if r != botan.verify_result.verified: ...
Add an implementation of the NIST X.509 tests in Python
Add an implementation of the NIST X.509 tests in Python
Python
bsd-2-clause
randombit/botan,webmaster128/botan,webmaster128/botan,webmaster128/botan,Rohde-Schwarz-Cybersecurity/botan,randombit/botan,Rohde-Schwarz-Cybersecurity/botan,Rohde-Schwarz-Cybersecurity/botan,webmaster128/botan,randombit/botan,Rohde-Schwarz-Cybersecurity/botan,webmaster128/botan,randombit/botan,randombit/botan,Rohde-Sch...
--- +++ @@ -0,0 +1,45 @@ +#!/usr/bin/python + +import sys, re, os, botan +from os.path import join; + +class TestResult(Exception): + def __init__(self, r): + self.result = r + def __str__(self): + return repr(self.result).replace('botan._botan.verify_result.', '') + +def throw_unless_ok(r): + ...
b3657c48b3958f57a1d71e296570566d7924d7ca
recipes/omas/run_test.py
recipes/omas/run_test.py
import omas, os os.environ['USER'] = 'TEST_CONDA_USER' omas.test_omas_suite()
import omas, os if 'USER' not in os.environ: os.environ['USER'] = 'TEST_CONDA_USER' if 'HOME' not in os.environ: os.environ['HOME'] = '/tmp' omas.test_omas_suite()
Make test more robust to missing USER and HOME
omas: Make test more robust to missing USER and HOME
Python
bsd-3-clause
Cashalow/staged-recipes,kwilcox/staged-recipes,patricksnape/staged-recipes,guillochon/staged-recipes,birdsarah/staged-recipes,basnijholt/staged-recipes,mariusvniekerk/staged-recipes,mcs07/staged-recipes,Juanlu001/staged-recipes,petrushy/staged-recipes,ocefpaf/staged-recipes,ceholden/staged-recipes,Juanlu001/staged-reci...
--- +++ @@ -1,3 +1,6 @@ import omas, os -os.environ['USER'] = 'TEST_CONDA_USER' +if 'USER' not in os.environ: + os.environ['USER'] = 'TEST_CONDA_USER' +if 'HOME' not in os.environ: + os.environ['HOME'] = '/tmp' omas.test_omas_suite()
b1adfe977ae272546d5bb10f2a4472cc3ae17667
examples/glyphs/data_tables_server.py
examples/glyphs/data_tables_server.py
from __future__ import print_function from bokeh.objects import ColumnDataSource from bokeh.widgetobjects import TableColumn, HandsonTable, PivotTable, HBox from bokeh.session import PlotServerSession from bokeh.sampledata.autompg import autompg source = ColumnDataSource(autompg) fields = zip(autompg.columns, map(st...
Add simple example showing HandsonTable and PivotTable
Add simple example showing HandsonTable and PivotTable
Python
bsd-3-clause
PythonCharmers/bokeh,evidation-health/bokeh,maxalbert/bokeh,ChinaQuants/bokeh,rothnic/bokeh,percyfal/bokeh,CrazyGuo/bokeh,lukebarnard1/bokeh,timothydmorton/bokeh,aiguofer/bokeh,deeplook/bokeh,timsnyder/bokeh,draperjames/bokeh,paultcochrane/bokeh,muku42/bokeh,tacaswell/bokeh,xguse/bokeh,mindriot101/bokeh,bokeh/bokeh,ala...
--- +++ @@ -0,0 +1,29 @@ +from __future__ import print_function + +from bokeh.objects import ColumnDataSource +from bokeh.widgetobjects import TableColumn, HandsonTable, PivotTable, HBox +from bokeh.session import PlotServerSession +from bokeh.sampledata.autompg import autompg + +source = ColumnDataSource(autompg) + ...
0e40eeb87504c896917fcbd9cc718c9953fed94f
finding-geodesic-basins-with-scipy.py
finding-geodesic-basins-with-scipy.py
# IPython log file from skimage import graph image = np.array([[1, 1, 2, 2], [2, 1, 1, 3], [3, 2, 1, 2], [2, 2, 2, 1]]) mcp = graph.MCP_Geometric(image) destinations = [[0, 0], [3, 3]] costs, traceback = mcp.find_costs(destinations) type(traceback) print(traceback) graph. mcp.traceback get_ipython().run_line_magic('p...
Add raw history from geodesic basins
Add raw history from geodesic basins
Python
bsd-3-clause
jni/useful-histories
--- +++ @@ -0,0 +1,53 @@ +# IPython log file + + +from skimage import graph +image = np.array([[1, 1, 2, 2], [2, 1, 1, 3], [3, 2, 1, 2], [2, 2, 2, 1]]) +mcp = graph.MCP_Geometric(image) +destinations = [[0, 0], [3, 3]] +costs, traceback = mcp.find_costs(destinations) +type(traceback) +print(traceback) +graph. +mcp.tr...
faf4d4d4a80456caf39fbc547763f80bee50acee
webkit/tools/layout_tests/test_types/fuzzy_image_diff.py
webkit/tools/layout_tests/test_types/fuzzy_image_diff.py
# Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Compares the image output of a test to the expected image output using fuzzy matching. """ import errno import logging import os import shutil i...
Fix build: missed a file
Fix build: missed a file TBR=tony Review URL: http://codereview.chromium.org/13209 git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@6449 0039d316-1c4b-4281-b951-d872f2087c98
Python
bsd-3-clause
junmin-zhu/chromium-rivertrail,jaruba/chromium.src,rogerwang/chromium,ChromiumWebApps/chromium,dednal/chromium.src,pozdnyakov/chromium-crosswalk,hgl888/chromium-crosswalk-efl,dushu1203/chromium.src,robclark/chromium,mogoweb/chromium-crosswalk,dushu1203/chromium.src,anirudhSK/chromium,jaruba/chromium.src,krieger-od/nwjs...
--- +++ @@ -0,0 +1,48 @@ +# Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Compares the image output of a test to the expected image output using +fuzzy matching. +""" + +import errno +imp...
09bc3c0714a01795ae832e860dda89c715c934df
lms/djangoapps/courseware/migrations/0009_auto_20190703_1955.py
lms/djangoapps/courseware/migrations/0009_auto_20190703_1955.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.22 on 2019-07-03 19:55 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('courseware', '0008_move_idde_to_edx_when'), ] ope...
Add CSM drop FK migration
Add CSM drop FK migration
Python
agpl-3.0
cpennington/edx-platform,cpennington/edx-platform,edx-solutions/edx-platform,appsembler/edx-platform,msegado/edx-platform,EDUlib/edx-platform,eduNEXT/edx-platform,edx/edx-platform,stvstnfrd/edx-platform,mitocw/edx-platform,angelapper/edx-platform,ESOedX/edx-platform,appsembler/edx-platform,arbrandes/edx-platform,mitocw...
--- +++ @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.22 on 2019-07-03 19:55 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('courseware', '0008_...
4bec379b3cfea87f17b0d5fa5d80148afe87a470
examples/plot_pca.py
examples/plot_pca.py
""" ========================================= PCA 2d projection of of Iris dataset ========================================= The Iris dataset represents 3 kind of Iris flowers (Setosa, Versicolour and Virginica) with 4 attributes: sepal length, sepal width, petal length and petal width. Principal Component Analysis (...
""" ========================================= PCA 2d projection of of Iris dataset ========================================= The Iris dataset represents 3 kind of Iris flowers (Setosa, Versicolour and Virginica) with 4 attributes: sepal length, sepal width, petal length and petal width. Principal Component Analysis (...
Remove non-necessary lines from PCA example
MISC: Remove non-necessary lines from PCA example
Python
bsd-3-clause
mikebenfield/scikit-learn,liyu1990/sklearn,YinongLong/scikit-learn,Titan-C/scikit-learn,xwolf12/scikit-learn,massmutual/scikit-learn,siutanwong/scikit-learn,tmhm/scikit-learn,Aasmi/scikit-learn,icdishb/scikit-learn,yunfeilu/scikit-learn,quheng/scikit-learn,vibhorag/scikit-learn,kaichogami/scikit-learn,cybernet14/scikit...
--- +++ @@ -31,10 +31,8 @@ print pca.explained_variance_ pl.figure() -pl.hold('on') for c, i, target_name in zip("rgb", [0, 1, 2], target_names): pl.scatter(X_r[y==i,0], X_r[y==i,1], c=c, label=target_name) -pl.hold('off') pl.legend() pl.title('PCA of IRIS dataset')
d85d1edc769a1d80f8cb4b99824a9277beff4c4c
python/sliding_window.py
python/sliding_window.py
''' This script showing you how to use a sliding window ''' from itertools import islice def sliding_window(a, n, step): ''' a - sequence n - width of the window step - window step ''' z = (islice(a, i, None, step) for i in range(n)) return zip(*z) ##Example sliding_window(range(10), 2...
Add a script to do the sliding window efficiently
Add a script to do the sliding window efficiently
Python
bsd-3-clause
qingkaikong/useful_script,qingkaikong/useful_script,qingkaikong/useful_script,qingkaikong/useful_script,qingkaikong/useful_script
--- +++ @@ -0,0 +1,17 @@ +''' +This script showing you how to use a sliding window +''' + +from itertools import islice +def sliding_window(a, n, step): + ''' + a - sequence + n - width of the window + step - window step + ''' + z = (islice(a, i, None, step) for i in range(n)) + return zip(*z) + ...
5e8db67d31ca24508839bfc702b2fbd8a9a2efe6
autoroller.py
autoroller.py
from random import randint from itertools import chain def roll_against(table): '''Return a randomly chosen entry (a dict value) from a roll table. table must be a dict of the same format as those created by load_table.''' # Get the range of rolls that the table caters for. permitted = list(chain(*t...
Add function to roll against a loaded roll table
Add function to roll against a loaded roll table As referenced in 1f0decf & 6500a93, add function to 'roll against' a table generated by table_loader.load_table and return the description of the event associated with the roll.
Python
mit
whonut/Random-Table-Roller,whonut/Random-Table-Roller,whonut/Random-Table-Roller
--- +++ @@ -0,0 +1,23 @@ +from random import randint +from itertools import chain + + +def roll_against(table): + '''Return a randomly chosen entry (a dict value) from a roll table. + + table must be a dict of the same format as those created by load_table.''' + + # Get the range of rolls that the table cate...
ee5a0017277b49e3a4a27a2d571c10f86563023c
examples/plotPtcls.py
examples/plotPtcls.py
import numpy as np from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt def get_data(i): return np.load('ptcls' + str(i) + '.npy') def in_range(lx, position): return position[0] < lx and position[0] > -lx and position[1] < lx and position[1] > -lx and position[2] < lx and position[2] > -lx ...
Add a few utility functions for plotting particle distributions.
Add a few utility functions for plotting particle distributions.
Python
mit
Tech-XCorp/ultracold-ions,hosseinsadeghi/ultracold-ions,Tech-XCorp/ultracold-ions,hosseinsadeghi/ultracold-ions
--- +++ @@ -0,0 +1,41 @@ +import numpy as np +from mpl_toolkits.mplot3d import Axes3D +import matplotlib.pyplot as plt + +def get_data(i): + return np.load('ptcls' + str(i) + '.npy') + +def in_range(lx, position): + return position[0] < lx and position[0] > -lx and position[1] < lx and position[1] > -lx and pos...
5033f95757c414bb223e09ee9c2c9b535c89df3e
tests/unit/catalogue/test_models.py
tests/unit/catalogue/test_models.py
import pytest from django.core.exceptions import ValidationError from oscar.apps.catalogue import models def test_product_attributes_can_contain_underscores(): attr = models.ProductAttribute(name="A", code="a_b") attr.full_clean() def test_product_attributes_cant_contain_hyphens(): attr = models.Produc...
Add tests to verify hyphens are not allowed in attribute codes
Add tests to verify hyphens are not allowed in attribute codes
Python
bsd-3-clause
binarydud/django-oscar,okfish/django-oscar,solarissmoke/django-oscar,lijoantony/django-oscar,WillisXChen/django-oscar,MatthewWilkes/django-oscar,bnprk/django-oscar,jmt4/django-oscar,Bogh/django-oscar,bnprk/django-oscar,vovanbo/django-oscar,itbabu/django-oscar,spartonia/django-oscar,rocopartners/django-oscar,john-parton...
--- +++ @@ -0,0 +1,15 @@ +import pytest +from django.core.exceptions import ValidationError + +from oscar.apps.catalogue import models + + +def test_product_attributes_can_contain_underscores(): + attr = models.ProductAttribute(name="A", code="a_b") + attr.full_clean() + + +def test_product_attributes_cant_cont...
506175af6040ff159ca32836c71792d00649e9f6
build-js.py
build-js.py
#! /usr/bin/env python3 # -*- coding: utf-8 -*- import os import subprocess options = ["--compress", "--mangle", "--screw-ie8", "--output"] outputFile = "codetriangle.min.js" outputPath = os.path.join(os.getcwd(), "build", "js", outputFile) exceptions = ["lib/prism.js"] finalCommand = ["uglifyjs"] os.chdir("js") # ...
Add Python-based JS build script
Add Python-based JS build script Still needs to be ported to JS
Python
mit
le717/CodeTriangle.me,le717/CodeTriangle,le717/CodeTriangle,le717/CodeTriangle.me,le717/CodeTriangle.me
--- +++ @@ -0,0 +1,35 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- +import os +import subprocess + + +options = ["--compress", "--mangle", "--screw-ie8", "--output"] +outputFile = "codetriangle.min.js" +outputPath = os.path.join(os.getcwd(), "build", "js", outputFile) +exceptions = ["lib/prism.js"] +finalComm...
b47f49bcb53b707bf9ef1b981b9851ea08805237
autocorr_spectra.py
autocorr_spectra.py
# -*- coding: utf-8 -*- """Module to compute the autocorrelation of quantities along spectra""" import _autocorr_spectra_priv def autocorr_spectra(slist, spos, pixsz, nbins=100): """ Find the autocorrelation function from a list of spectra Spectra are assumed to be along the same axis. slist - list of...
Add module for computing autocorrelation of spectra
Add module for computing autocorrelation of spectra
Python
mit
sbird/vw_spectra
--- +++ @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +"""Module to compute the autocorrelation of quantities along spectra""" +import _autocorr_spectra_priv + + +def autocorr_spectra(slist, spos, pixsz, nbins=100): + """ + Find the autocorrelation function from a list of spectra + Spectra are assumed to be alon...
2d96cd4629ae0ab026c14508634deeab521996cd
tests/test_api_2stepinit.py
tests/test_api_2stepinit.py
# -*- coding: utf-8 -*- import json import binascii from .base import MyTestCase from privacyidea.lib.tokens.HMAC import HmacOtp class TwoStepInitTestCase(MyTestCase): """ test the 2stepinit process. Here we enroll an HOTP token. One part of the secret key is generated by privacyIDEA and the sec...
Test an enrollment and succesful auth.
Test an enrollment and succesful auth. Working on #627
Python
agpl-3.0
privacyidea/privacyidea,privacyidea/privacyidea,privacyidea/privacyidea,wheldom01/privacyidea,jh23453/privacyidea,privacyidea/privacyidea,wheldom01/privacyidea,privacyidea/privacyidea,jh23453/privacyidea,jh23453/privacyidea,wheldom01/privacyidea,jh23453/privacyidea,jh23453/privacyidea,wheldom01/privacyidea,privacyidea/...
--- +++ @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +import json +import binascii +from .base import MyTestCase +from privacyidea.lib.tokens.HMAC import HmacOtp + + +class TwoStepInitTestCase(MyTestCase): + """ + test the 2stepinit process. + + Here we enroll an HOTP token. One part of the secret key is ge...
9fd7b4477cc8420af1b8d120cd4386e8a0cb82d1
tests/test_plugin_scroll.py
tests/test_plugin_scroll.py
#!/usr/bin/env python import app_config app_config.DATABASE_NAME = 'carebot_test.db' app_config.DEFAULT_CONFIG_PATH = 'tests/config_test.yml' try: import unittest2 as unittest except ImportError: import unittest import datetime from plugins.npr.scrolldepth import NPRScrollDepth from util.config import Confi...
Add simple test to scroll plugin
Add simple test to scroll plugin
Python
mit
thecarebot/carebot,thecarebot/carebot,thecarebot/carebot
--- +++ @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +import app_config +app_config.DATABASE_NAME = 'carebot_test.db' +app_config.DEFAULT_CONFIG_PATH = 'tests/config_test.yml' + +try: + import unittest2 as unittest +except ImportError: + import unittest + +import datetime + +from plugins.npr.scrolldepth import NPR...
1536633a8515db4667ed9ca60fd33d07d42e1bed
dbaas/workflow/steps/mysql/region_migration/revoke_nfs_access.py
dbaas/workflow/steps/mysql/region_migration/revoke_nfs_access.py
# -*- coding: utf-8 -*- import logging from util import full_stack from dbaas_nfsaas.provider import NfsaasProvider from workflow.steps.util.base import BaseStep from workflow.exceptions.error_codes import DBAAS_0020 LOG = logging.getLogger(__name__) class RevokeNFSAccess(BaseStep): def __unicode__(self): ...
Add step to revoke nfs access
Add step to revoke nfs access
Python
bsd-3-clause
globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service
--- +++ @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +import logging +from util import full_stack +from dbaas_nfsaas.provider import NfsaasProvider +from workflow.steps.util.base import BaseStep +from workflow.exceptions.error_codes import DBAAS_0020 + +LOG = logging.getLogger(__name__) + + +class RevokeNFSAccess(BaseSt...
7c7f673eeb731baf186db66a26147b67b8762eae
examples/rpc_with_subhanlers.py
examples/rpc_with_subhanlers.py
import asyncio import aiozmq import aiozmq.rpc class Handler(aiozmq.rpc.AttrHandler): def __init__(self, ident): self.ident = ident self.subhandler = SubHandler(self.ident, 'subident') @aiozmq.rpc.method def a(self): return (self.ident, 'a') class SubHandler(aiozmq.rpc.AttrHand...
Add example for subhandlers of AttrHandler
Add example for subhandlers of AttrHandler
Python
bsd-2-clause
MetaMemoryT/aiozmq,aio-libs/aiozmq,claws/aiozmq,asteven/aiozmq
--- +++ @@ -0,0 +1,54 @@ +import asyncio +import aiozmq +import aiozmq.rpc + + +class Handler(aiozmq.rpc.AttrHandler): + + def __init__(self, ident): + self.ident = ident + self.subhandler = SubHandler(self.ident, 'subident') + + @aiozmq.rpc.method + def a(self): + return (self.ident, 'a...
2dd10b10878de50911b6420226f90cb1eae2db5d
merge_docstrings.py
merge_docstrings.py
#!/usr/bin/env python import lxml.etree as etree import subprocess, optparse, sys def main(): p = optparse.OptionParser(usage="""%prog FILE1.xml FILE2.xml FILE3.xml Output changes between FILE2.xml and FILE3.xml applied to FILE1.xml """) options, args = p.parse_args() if len(args) != 3: p.error("...
Add docstring 3-way merge tool
Add docstring 3-way merge tool
Python
bsd-3-clause
pv/pydocweb,pv/pydocweb
--- +++ @@ -0,0 +1,70 @@ +#!/usr/bin/env python +import lxml.etree as etree +import subprocess, optparse, sys + +def main(): + p = optparse.OptionParser(usage="""%prog FILE1.xml FILE2.xml FILE3.xml + +Output changes between FILE2.xml and FILE3.xml applied to FILE1.xml +""") + options, args = p.parse_args() + + ...
0db1d34f3dceb015474f8a22a2cc52e6fdd92b76
bluebottle/deeds/migrations/0011_auto_20211209_1640.py
bluebottle/deeds/migrations/0011_auto_20211209_1640.py
# Generated by Django 2.2.24 on 2021-12-09 15:40 from django.db import migrations def fix_participant_dates(apps, schema_editor): EffortContribution = apps.get_model('activities', 'EffortContribution') EffortContribution.objects.update(end=None) class Migration(migrations.Migration): dependencies = [ ...
Remove end date from deed contributions
Remove end date from deed contributions
Python
bsd-3-clause
onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle
--- +++ @@ -0,0 +1,22 @@ +# Generated by Django 2.2.24 on 2021-12-09 15:40 + +from django.db import migrations + + +def fix_participant_dates(apps, schema_editor): + EffortContribution = apps.get_model('activities', 'EffortContribution') + EffortContribution.objects.update(end=None) + + +class Migration(migrati...
6e3d49bf270d240290c8c4b11b7242f8b11d3de3
simplemooc/courses/migrations/0002_auto_20160504_2321.py
simplemooc/courses/migrations/0002_auto_20160504_2321.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('courses', '0001_initial'), ] operations = [ migrations.AlterField( model_name='lesson', name='name',...
Create migration file to change of verbose_name of Lessons models
Create migration file to change of verbose_name of Lessons models
Python
mit
mazulo/simplemooc,mazulo/simplemooc
--- +++ @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('courses', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + mod...
982a57cc37d611519a40eed1afd6e713dae096fc
beer_search_v2/management/commands/batch_announce.py
beer_search_v2/management/commands/batch_announce.py
from beer_search_v2.models import ProductType from django.core.management.base import BaseCommand class Command(BaseCommand): def handle(self, *args, **options): """ Prints out a markdown-formatted list of products that can be posted as a whole """ product_types = ProductType.objec...
Make a batch announcement script for generating gists
Make a batch announcement script for generating gists
Python
mit
Ernir/bjorleitin,Ernir/bjorleitin,Ernir/bjorleitin,Ernir/bjorleitin
--- +++ @@ -0,0 +1,18 @@ +from beer_search_v2.models import ProductType +from django.core.management.base import BaseCommand + + +class Command(BaseCommand): + def handle(self, *args, **options): + """ + Prints out a markdown-formatted list of products that can be posted as a whole + """ + ...
8f75f1d02d44b0bc216b93ef163ac2f4e877e9ce
test/main.py
test/main.py
#! /usr/bin/env python # # Copyright (c) 2011 Red Hat, Inc. # # This software is licensed to you under the GNU Lesser General Public # License as published by the Free Software Foundation; either version # 2 of the License (LGPLv2) or (at your option) any later version. # There is NO WARRANTY for this software, express...
Add for debugging w/o running as root.
Add for debugging w/o running as root.
Python
lgpl-2.1
jortel/gofer,credativ/gofer,credativ/gofer,kgiusti/gofer,kgiusti/gofer,jortel/gofer,splice/gofer,splice/gofer,splice/gofer
--- +++ @@ -0,0 +1,63 @@ +#! /usr/bin/env python +# +# Copyright (c) 2011 Red Hat, Inc. +# +# This software is licensed to you under the GNU Lesser General Public +# License as published by the Free Software Foundation; either version +# 2 of the License (LGPLv2) or (at your option) any later version. +# There is NO ...
11602e6729a9549aa334f776a9920e79ff2bab1a
pinax/teams/hooks.py
pinax/teams/hooks.py
from django.db.models import Q from django.core.urlresolvers import reverse class TeamDefaultHookset(object): def build_team_url(self, url_name, team_slug): return reverse(url_name, args=[team_slug]) def get_autocomplete_result(self, user): return {"pk": user.pk, "email": user.email, "name"...
from django.db.models import Q from django.core.urlresolvers import reverse class TeamDefaultHookset(object): def build_team_url(self, url_name, team_slug): return reverse(url_name, args=[team_slug]) def get_autocomplete_result(self, user): return {"pk": user.pk, "email": user.email, "name"...
Fix bug left over from the namespacing
Fix bug left over from the namespacing
Python
mit
rizumu/pinax-teams,jacobwegner/pinax-teams,pinax/pinax-teams,miurahr/pinax-teams,pinax/pinax-teams
--- +++ @@ -23,7 +23,7 @@ class HookProxy(object): def __getattr__(self, attr): - from teams.conf import settings + from pinax.teams.conf import settings return getattr(settings.TEAMS_HOOKSET, attr)
27d29f2f30be7dd899fae08b09d181a22be8d56a
python/ctci_queue_using_two_stacks.py
python/ctci_queue_using_two_stacks.py
class MyQueue(object): def __init__(self): self.stack_1 = [] self.stack_2 = [] def peek(self): self.migrate_stacks_if_necessary() return self.stack_2[-1] def pop(self): self.migrate_stacks_if_necessary() return self.stack_2.pop() def put(self, value): ...
Solve queue using two stacks
Solve queue using two stacks
Python
mit
rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank
--- +++ @@ -0,0 +1,37 @@ +class MyQueue(object): + + def __init__(self): + self.stack_1 = [] + self.stack_2 = [] + + def peek(self): + self.migrate_stacks_if_necessary() + return self.stack_2[-1] + + def pop(self): + self.migrate_stacks_if_necessary() + return self.s...
534dece8a904868aafe17f521535468c386700aa
tests/sentry/web/frontend/test_organization_member_settings.py
tests/sentry/web/frontend/test_organization_member_settings.py
from __future__ import absolute_import from django.core.urlresolvers import reverse from sentry.models import OrganizationMember, OrganizationMemberType from sentry.testutils import TestCase class OrganizationMemberSettingsTest(TestCase): def test_renders_with_context(self): organization = self.create_o...
Add test for member settings display
Add test for member settings display
Python
bsd-3-clause
BuildingLink/sentry,zenefits/sentry,kevinastone/sentry,drcapulet/sentry,wujuguang/sentry,camilonova/sentry,llonchj/sentry,fotinakis/sentry,kevinastone/sentry,JackDanger/sentry,BuildingLink/sentry,mvaled/sentry,drcapulet/sentry,Kryz/sentry,jean/sentry,hongliang5623/sentry,ngonzalvez/sentry,JackDanger/sentry,mvaled/sentr...
--- +++ @@ -0,0 +1,36 @@ +from __future__ import absolute_import + +from django.core.urlresolvers import reverse + +from sentry.models import OrganizationMember, OrganizationMemberType +from sentry.testutils import TestCase + + +class OrganizationMemberSettingsTest(TestCase): + def test_renders_with_context(self):...
398bdd0b004f8f29bfd405a690102d7d3283fb76
ipa-fun-bootstrap.py
ipa-fun-bootstrap.py
#! /bin/bash ############################################################################## # Author: Tomas Babej <tbabej@redhat.com> # # Builds the FreeIPA rpms from sources. # Removes everything from the $DIST_DIR and moves newly built RPMs there # # Usage: $0 # Returns: 0 on success, 1 on failure ##################...
Add initial version of bootstrap tool
Add initial version of bootstrap tool
Python
mit
pspacek/labtool,pvoborni/labtool,pspacek/labtool,tomaskrizek/labtool,pvoborni/labtool,tomaskrizek/labtool
--- +++ @@ -0,0 +1,61 @@ +#! /bin/bash + +############################################################################## +# Author: Tomas Babej <tbabej@redhat.com> +# +# Builds the FreeIPA rpms from sources. +# Removes everything from the $DIST_DIR and moves newly built RPMs there +# +# Usage: $0 +# Returns: 0 on suc...
d3b24e3808f3149a80148c26aec6a4077581e4e8
avg_daily_vol.py
avg_daily_vol.py
#!/usr/bin/env python """ Compute average daily trade volume of Indian securities. Notes ----- Assumes that the trade data for a specific firm XXX is stored in a file named XXX-trades.csv. """ import glob import pandas import re file_name_list = glob.glob('*-trades.csv') avg_daily_vol_dict = {} for file_name in fi...
Add script for computing average daily volume.
Add script for computing average daily volume. --HG-- branch : cython
Python
bsd-3-clause
lebedov/nseindia_lob
--- +++ @@ -0,0 +1,32 @@ +#!/usr/bin/env python + +""" +Compute average daily trade volume of Indian securities. + +Notes +----- +Assumes that the trade data for a specific firm XXX is stored in a file +named XXX-trades.csv. + +""" + +import glob +import pandas +import re + +file_name_list = glob.glob('*-trades.csv')...
8a7a27dd356ecb1f067be0270e82b37195605499
scripts/simulate_whipple_benchmark.py
scripts/simulate_whipple_benchmark.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np import scipy from dtk.bicycle import benchmark_state_space_vs_speed, benchmark_matrices def simulate(v, x0, dt, n, u=None): _, A, B = benchmark_state_space_vs_speed(*benchmark_matrices(), [v]) A = np.squeeze(A) B = np.squeeze(B) M = np....
Add Python script to simulate Whipple model
Add Python script to simulate Whipple model
Python
bsd-2-clause
oliverlee/phobos,oliverlee/phobos,oliverlee/phobos,oliverlee/phobos
--- +++ @@ -0,0 +1,54 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +import numpy as np +import scipy +from dtk.bicycle import benchmark_state_space_vs_speed, benchmark_matrices + + +def simulate(v, x0, dt, n, u=None): + _, A, B = benchmark_state_space_vs_speed(*benchmark_matrices(), [v]) + A = np.squeeze(...
57cd7d021485394fe8c17389bf9bdbf052af9f54
bin/subdivide-new-cache.py
bin/subdivide-new-cache.py
#!/usr/bin/env python import re from boundaries import * script_directory = os.path.dirname(os.path.abspath(__file__)) cache_directory = os.path.realpath(os.path.join(script_directory, '..', 'data', ...
Add a script to migrate the element cache to the new structure
Add a script to migrate the element cache to the new structure
Python
agpl-3.0
opencorato/mapit,opencorato/mapit,chris48s/mapit,Code4SA/mapit,New-Bamboo/mapit,Code4SA/mapit,chris48s/mapit,New-Bamboo/mapit,Sinar/mapit,Code4SA/mapit,chris48s/mapit,Sinar/mapit,opencorato/mapit
--- +++ @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +import re +from boundaries import * + +script_directory = os.path.dirname(os.path.abspath(__file__)) + +cache_directory = os.path.realpath(os.path.join(script_directory, + '..', + ...
908c52c3d0f6f0a25cfd4868673a8058ad862400
bin/update/deploy-product-details.py
bin/update/deploy-product-details.py
""" Deployment for Bedrock in production. Requires commander (https://github.com/oremj/commander) which is installed on the systems that need it. """ import os import sys sys.path.append(os.path.dirname(os.path.abspath(__file__))) from commander.deploy import task, hostgroups import commander_settings as settings ...
Add product-details chief deployment script.
Add product-details chief deployment script. After this merges we'll only need to symlink the old p-d deployment script to this one, like the rest of the chief scripts are.
Python
mpl-2.0
dudepare/bedrock,ericawright/bedrock,rishiloyola/bedrock,chirilo/bedrock,marcoscaceres/bedrock,petabyte/bedrock,dudepare/bedrock,bensternthal/bedrock,jacshfr/mozilla-bedrock,sylvestre/bedrock,Sancus/bedrock,pmclanahan/bedrock,mkmelin/bedrock,davehunt/bedrock,mermi/bedrock,Sancus/bedrock,malena/bedrock,mermi/bedrock,eri...
--- +++ @@ -0,0 +1,34 @@ +""" +Deployment for Bedrock in production. + +Requires commander (https://github.com/oremj/commander) which is installed on +the systems that need it. +""" + +import os +import sys + +sys.path.append(os.path.dirname(os.path.abspath(__file__))) + +from commander.deploy import task, hostgroups...
feb4f46959ff5e2226d968e8a9de849f3883d967
scripts/make_bridge_vm.py
scripts/make_bridge_vm.py
# Setup tapuser for SSH from the CI nodes useradd tapuser mkdir -p /home/tapuser/.ssh chown -R tapuser:tapuser /home/tapuser chmod 700 /home/tapuser/.ssh cat project-config-third-party/nodepool/scripts/vm-bridge-key.pub > authorized_keys chmod 600 /home/tapuser/.ssh/authorized_keys # Install bridge utils apt-get insta...
Add script for setting up the bridge VM
Add script for setting up the bridge VM
Python
apache-2.0
CiscoSystems/project-config-third-party,CiscoSystems/project-config-third-party
--- +++ @@ -0,0 +1,34 @@ +# Setup tapuser for SSH from the CI nodes +useradd tapuser +mkdir -p /home/tapuser/.ssh +chown -R tapuser:tapuser /home/tapuser +chmod 700 /home/tapuser/.ssh +cat project-config-third-party/nodepool/scripts/vm-bridge-key.pub > authorized_keys +chmod 600 /home/tapuser/.ssh/authorized_keys + +...
59626e34c7938fddeec140522dd2a592ba4f42ef
examples/simplex3_plot.py
examples/simplex3_plot.py
""" Project and visualize a simplex grid on the 3-simplex. """ from __future__ import division import dit import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D def simplex3_vertices(): """ Returns the vertices of the standard 3-simplex. Each column is a vertex. """ ...
Add an example which plots a simplex_grid in 3D.
Add an example which plots a simplex_grid in 3D.
Python
bsd-3-clause
chebee7i/dit,chebee7i/dit,chebee7i/dit,chebee7i/dit
--- +++ @@ -0,0 +1,66 @@ +""" +Project and visualize a simplex grid on the 3-simplex. + +""" +from __future__ import division + +import dit +import numpy as np + +import matplotlib.pyplot as plt +from mpl_toolkits.mplot3d import Axes3D + +def simplex3_vertices(): + """ + Returns the vertices of the standard 3-s...
1c55fdc21062a7090a76fc7316c93d6ed4647d53
tests/rules_tests/grammarManipulation_tests/RemoveTest.py
tests/rules_tests/grammarManipulation_tests/RemoveTest.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """ from unittest import main, TestCase from grammpy import Rule as _R, Grammar from rules_tests.grammar import * class RemoveTest(TestCase): def __init__(self, *args): super().__init__(*args) ...
Add file for rule remove tests
Add file for rule remove tests
Python
mit
PatrikValkovic/grammpy
--- +++ @@ -0,0 +1,29 @@ +#!/usr/bin/env python +""" +:Author Patrik Valkovic +:Created 23.06.2017 16:39 +:Licence GNUv3 +Part of grammpy + +""" + +from unittest import main, TestCase + +from grammpy import Rule as _R, Grammar +from rules_tests.grammar import * + + +class RemoveTest(TestCase): + def __init__(self,...
f22d1e7d39a282f12f92140b552c3d6751135ae1
simples3/gae.py
simples3/gae.py
"""Compatibility layer for Google App Engine Use as you would normally do with :mod:`simples3`, only instead of :class:`simples3.S3Bucket`, use :class:`simples3.gae.AppEngineS3Bucket`. """ import urllib2 from StringIO import StringIO from urllib import addinfourl from google.appengine.api import urlfetch from simples...
Add Google App Engine helper module
Add Google App Engine helper module
Python
bsd-2-clause
sirkamran32/simples3,leo23/simples3,lericson/simples3
--- +++ @@ -0,0 +1,49 @@ +"""Compatibility layer for Google App Engine + +Use as you would normally do with :mod:`simples3`, only instead of +:class:`simples3.S3Bucket`, use :class:`simples3.gae.AppEngineS3Bucket`. +""" + +import urllib2 +from StringIO import StringIO +from urllib import addinfourl +from google.appen...
370d0604cf3abebc56f0a39efcf3cc5c3d908808
nex_profile.py
nex_profile.py
import cProfile as prof import os.path as opath from nex.nex import run_file from nex.utils import get_default_font_paths from nex.box_writer import write_to_dvi_file dir_path = opath.dirname(opath.realpath(__file__)) font_search_paths = get_default_font_paths() + [ dir_path, opath.join(dir_path, 'fonts'),...
Add little script used for profiling
Add little script used for profiling
Python
mit
eddiejessup/nex
--- +++ @@ -0,0 +1,22 @@ +import cProfile as prof +import os.path as opath + +from nex.nex import run_file +from nex.utils import get_default_font_paths +from nex.box_writer import write_to_dvi_file + + +dir_path = opath.dirname(opath.realpath(__file__)) + + +font_search_paths = get_default_font_paths() + [ + dir_...
2ed5e9386678cbf03626dce943eab54b5f082cfd
storage/mongo_storage.py
storage/mongo_storage.py
# 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/ ''' Storage module to interact with MongoDB. Provides a MongoStorage helper class with the following functions: setup:...
Add storage module for mongo DB
Add storage module for mongo DB
Python
mpl-2.0
mitre/multiscanner,MITRECND/multiscanner,jmlong1027/multiscanner,mitre/multiscanner,mitre/multiscanner,jmlong1027/multiscanner,awest1339/multiscanner,MITRECND/multiscanner,awest1339/multiscanner,jmlong1027/multiscanner,awest1339/multiscanner,awest1339/multiscanner,jmlong1027/multiscanner
--- +++ @@ -0,0 +1,74 @@ +# 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/ +''' +Storage module to interact with MongoDB. +Provides a MongoStorage helper class with th...
9c5e65b844ef8ac0b6a864a6edb83a827506809c
tests/test_signatures.py
tests/test_signatures.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # (c) Camille Scott, 2019 # File : test_signatures.py # License: MIT # Author : Camille Scott <camille.scott.w@gmail.com> # Date : 16.10.2019 import pytest from boink.signatures import SourmashSignature from .utils import * import screed def test_sourmash_signature...
Test that sourmash signature processor results match sourmash library
Test that sourmash signature processor results match sourmash library
Python
mit
camillescott/boink,camillescott/boink,camillescott/boink,camillescott/boink
--- +++ @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# (c) Camille Scott, 2019 +# File : test_signatures.py +# License: MIT +# Author : Camille Scott <camille.scott.w@gmail.com> +# Date : 16.10.2019 + +import pytest + +from boink.signatures import SourmashSignature + +from .utils import * +i...
1ff5402c960ac23a9339eaac17cd8e002118be9e
bluebottle/payments/tests/test_adapters.py
bluebottle/payments/tests/test_adapters.py
from django.test.utils import override_settings from moneyed import Money from bluebottle.payments.adapters import BasePaymentAdapter from bluebottle.test.factory_models.payments import OrderPaymentFactory, PaymentFactory from bluebottle.test.utils import BluebottleTestCase @override_settings(MERCHANT_ACCOUNTS = [{ ...
Add tests for payment adapter credentials
Add tests for payment adapter credentials
Python
bsd-3-clause
onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle
--- +++ @@ -0,0 +1,41 @@ +from django.test.utils import override_settings +from moneyed import Money + +from bluebottle.payments.adapters import BasePaymentAdapter +from bluebottle.test.factory_models.payments import OrderPaymentFactory, PaymentFactory +from bluebottle.test.utils import BluebottleTestCase + + +@overr...
5db2b7ce0573048077054a29857c4e46d44ca0b8
migrations/versions/280_switch_g7_framework_to_open.py
migrations/versions/280_switch_g7_framework_to_open.py
"""Add audit_events type, object and created_at indexes Revision ID: 280_switch_g7_framework_to_open Revises: 270_add_audit_events_indexes Create Date: 2015-09-01 13:45:44.886576 """ # revision identifiers, used by Alembic. revision = '280_switch_g7_framework_to_open' down_revision = '270_add_audit_events_indexes' ...
Switch on G-Cloud 7 - status change to open
Switch on G-Cloud 7 - status change to open
Python
mit
alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api
--- +++ @@ -0,0 +1,22 @@ +"""Add audit_events type, object and created_at indexes + +Revision ID: 280_switch_g7_framework_to_open +Revises: 270_add_audit_events_indexes +Create Date: 2015-09-01 13:45:44.886576 + +""" + +# revision identifiers, used by Alembic. +revision = '280_switch_g7_framework_to_open' +down_revis...
14bd96b2ce7e7b67d7fa9b583b44eb04630557b1
leetcode/RemoveElement.py
leetcode/RemoveElement.py
# Remove Element https://oj.leetcode.com/problems/remove-element/ # Given an array and a value, remove all instances of that value in place and return the new length. # The order of elements can be changed. It doesn't matter what you leave beyond the new length. #Arrays # Xilin SUN # Jan 8 2015 # Don't forget to ret...
Add Remove Element from LeetCode
Add Remove Element from LeetCode
Python
mit
aenon/OnlineJudge,aenon/OnlineJudge
--- +++ @@ -0,0 +1,25 @@ +# Remove Element https://oj.leetcode.com/problems/remove-element/ +# Given an array and a value, remove all instances of that value in place and return the new length. +# The order of elements can be changed. It doesn't matter what you leave beyond the new length. + +#Arrays + +# Xilin SUN +...
214c7fdcad89135738c7caa60d7c57170a9c74db
workshopvenues/venues/migrations/0004_auto__add_field_address_country.py
workshopvenues/venues/migrations/0004_auto__add_field_address_country.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): # Adding field 'Address.country' db.add_column(u'venues_address', 'country', self.gf('...
Add country field to Address
Add country field to Address
Python
bsd-3-clause
andreagrandi/workshopvenues
--- +++ @@ -0,0 +1,46 @@ +# -*- 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): + # Adding field 'Address.country' + db.add_column(u'venues_address', 'co...
bcf2b57a3aca1953ce1bde7d2850f8475c561590
saleor/account/migrations/0040_permissions_to_groups.py
saleor/account/migrations/0040_permissions_to_groups.py
from collections import namedtuple from django.db import migrations def add_users_to_groups_based_on_users_permissions(apps, schema_editor): """Add every user to group with "user_permissions" if exists, else create new one. For every user, iff group with exact scope of permissions exists, add user to it, ...
Add user permissions to groups migration
Add user permissions to groups migration
Python
bsd-3-clause
mociepka/saleor,mociepka/saleor,mociepka/saleor
--- +++ @@ -0,0 +1,76 @@ +from collections import namedtuple + +from django.db import migrations + + +def add_users_to_groups_based_on_users_permissions(apps, schema_editor): + """Add every user to group with "user_permissions" if exists, else create new one. + + For every user, iff group with exact scope of pe...
785a2f2f12dc72e624d76dd918533db1256c5885
mltils/sklearn/bagging.py
mltils/sklearn/bagging.py
import random import numpy as np from sklearn.base import BaseEstimator, clone from tqdm import tqdm class BaggedModel(BaseEstimator): def __init__(self, estimator, n_models, random_state, verbose=True): self.estimator = estimator self.n_models = n_models self.random_state = random_state...
Add class implementing a bagged estimator
Add class implementing a bagged estimator
Python
mit
rladeira/mltils
--- +++ @@ -0,0 +1,34 @@ + + +import random +import numpy as np +from sklearn.base import BaseEstimator, clone +from tqdm import tqdm + + +class BaggedModel(BaseEstimator): + def __init__(self, estimator, n_models, random_state, verbose=True): + self.estimator = estimator + self.n_models = n_models +...
ca791d66b85baae91d6decd5f5a201a2b7512efb
wafer/schedule/migrations/0002_auto_20140909_1403.py
wafer/schedule/migrations/0002_auto_20140909_1403.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('schedule', '0001_initial'), ] operations = [ migrations.AlterModelOptions( name='slot', options={'or...
Update migration to latest schedule work
Update migration to latest schedule work
Python
isc
CarlFK/wafer,CTPUG/wafer,CarlFK/wafer,CTPUG/wafer,CarlFK/wafer,CTPUG/wafer,CarlFK/wafer,CTPUG/wafer
--- +++ @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('schedule', '0001_initial'), + ] + + operations = [ + migrations.AlterModelOptions( + ...
09d6b1e3766ff8e35d55c4aa3e7574c292d0be34
tests/utils/test_get_storage_class.py
tests/utils/test_get_storage_class.py
import pytest from storages import FileSystemStorage from storages.utils import get_storage_class def test_get_filesystem_storage(): """ get_storage_class returns the class for a storage backend name/path. """ assert get_storage_class("storages.FileSystemStorage") is FileSystemStorage def test_get_...
Test the get_storage_class utility function
Test the get_storage_class utility function
Python
bsd-2-clause
dstufft/storages
--- +++ @@ -0,0 +1,36 @@ +import pytest + +from storages import FileSystemStorage +from storages.utils import get_storage_class + + +def test_get_filesystem_storage(): + """ + get_storage_class returns the class for a storage backend name/path. + """ + assert get_storage_class("storages.FileSystemStorage"...