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
c8921cf12418762c17d0b858ea2e134f292b2838
fireplace/cards/wog/neutral_epic.py
fireplace/cards/wog/neutral_epic.py
from ..utils import * ## # Minions class OG_271: "Scaled Nightmare" events = OWN_TURN_BEGIN.on(Buff(SELF, "OG_271e")) class OG_271e: atk = lambda self, i: i * 2
from ..utils import * ## # Minions class OG_271: "Scaled Nightmare" events = OWN_TURN_BEGIN.on(Buff(SELF, "OG_271e")) class OG_271e: atk = lambda self, i: i * 2 class OG_272: "Twilight Summoner" deathrattle = Summon(CONTROLLER, "OG_272t") class OG_337: "Cyclopian Horror" play = Buff(SELF, "OG_337e") * Co...
Implement Twilight Summoner and Cyclopian Horror
Implement Twilight Summoner and Cyclopian Horror
Python
agpl-3.0
beheh/fireplace,NightKev/fireplace,jleclanche/fireplace
--- +++ @@ -10,3 +10,15 @@ class OG_271e: atk = lambda self, i: i * 2 + + +class OG_272: + "Twilight Summoner" + deathrattle = Summon(CONTROLLER, "OG_272t") + + +class OG_337: + "Cyclopian Horror" + play = Buff(SELF, "OG_337e") * Count(ENEMY_MINIONS) + +OG_337e = buff(health=1)
923d57d91b99fc3ac052d46de0314e7559b008a5
lessons/lesson-2.04/models_example.py
lessons/lesson-2.04/models_example.py
import arrow from betterapis import db class Track(db.Model, SimpleSerializing): id = db.Column(db.Integer, primary_key=True) name = db.Clumn(db.String) details = db.Column(db.String) def __init__(self, **kwargs): self.name = kwargs.get('name') self.details = kwargs.get('details') ...
import arrow from betterapis import db class Track(db.Model, SimpleSerializing): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String) details = db.Column(db.String) def __init__(self, **kwargs): self.name = kwargs.get('name') self.details = kwargs.get('details') ...
Fix typo in example model
Fix typo in example model
Python
mit
tylerdave/OpenAPI-Tutorial,tylerdave/OpenAPI-Tutorial
--- +++ @@ -3,7 +3,7 @@ class Track(db.Model, SimpleSerializing): id = db.Column(db.Integer, primary_key=True) - name = db.Clumn(db.String) + name = db.Column(db.String) details = db.Column(db.String) def __init__(self, **kwargs):
af3515c8354dd525c2889eda75bfbc5cb7e2ecbf
massa/errors.py
massa/errors.py
# -*- coding: utf-8 -*- from flask import jsonify def register_error_handlers(app): app.register_error_handler(EntityNotFoundError, entity_not_found_handler) app.register_error_handler(InvalidInputError, invalid_input_handler) def entity_not_found_handler(e): return jsonify({'message': e.message}), 404...
# -*- coding: utf-8 -*- from flask import jsonify def register_error_handlers(app): app.register_error_handler(EntityNotFoundError, entity_not_found_handler) app.register_error_handler(InvalidInputError, invalid_input_handler) def entity_not_found_handler(e): return jsonify(e.as_dict()), 404 def inva...
Add method to retrieve the DomainError as a dict.
Add method to retrieve the DomainError as a dict.
Python
mit
jaapverloop/massa
--- +++ @@ -9,17 +9,23 @@ def entity_not_found_handler(e): - return jsonify({'message': e.message}), 404 + return jsonify(e.as_dict()), 404 def invalid_input_handler(e): - return jsonify({'message': e.message, 'details': e.details}), 400 + return jsonify(e.as_dict()), 400 class DomainError(...
8c0dd17bb633f56cb1ad8450759622ad75a524bc
config-example.py
config-example.py
# Enables detailed tracebacks and an interactive Python console on errors. # Never use in production! #DEBUG = True # Address for development server to listen on #HOST = "0.0.0.0" # Port for development server to listen on #PORT = 5000 # Makes the server more performant at sending static files when the # server is b...
# Enables detailed tracebacks and an interactive Python console on errors. # Never use in production! #DEBUG = True # Address for development server to listen on #HOST = "127.0.0.1" # Port for development server to listen on #PORT = 5000 # Makes the server more performant at sending static files when the # server is...
Change default development server listen address back to 127.0.0.1
Change default development server listen address back to 127.0.0.1
Python
lgpl-2.1
minetest/master-server,minetest/master-server,minetest/master-server
--- +++ @@ -4,7 +4,7 @@ #DEBUG = True # Address for development server to listen on -#HOST = "0.0.0.0" +#HOST = "127.0.0.1" # Port for development server to listen on #PORT = 5000
04e64fea6e11a188a53d0b8d69ef97686868be1c
tests/py_ext_tests/test_png.py
tests/py_ext_tests/test_png.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import unittest import faint import os import py_ext_tests class TestPng(unittest.TestCase): def test_write_png(self): out_dir = py_ext_tests.make_test_dir(self) b1 = faint.Bitmap((5,7)) b1.set_pixel((0,0),(255,0,255)) ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import unittest import faint from faint import png import os import py_ext_tests class TestPng(unittest.TestCase): def test_write_png(self): out_dir = py_ext_tests.make_test_dir(self) b1 = faint.Bitmap((5,7)) b1.set_pixel((0,0...
Use the png module in test.
Use the png module in test.
Python
apache-2.0
lukas-ke/faint-graphics-editor,lukas-ke/faint-graphics-editor,lukas-ke/faint-graphics-editor,lukas-ke/faint-graphics-editor
--- +++ @@ -3,6 +3,7 @@ import unittest import faint +from faint import png import os import py_ext_tests @@ -15,7 +16,7 @@ b1.set_pixel((0,0),(255,0,255)) fn = os.path.join(out_dir, "b1.png") - faint.write_png(b1, fn, 0) + faint.write_png(b1, fn, png.RGB) b2, tEXt...
e9170de0c8d427e2545469c2d3add43bfae1cc54
tests/test_construct_policy.py
tests/test_construct_policy.py
"""Test IAM Policies for correctness.""" import json from foremast.iam.construct_policy import construct_policy ANSWER1 = { 'Version': '2012-10-17', 'Statement': [ { 'Effect': 'Allow', 'Action': [ 's3:GetObject', 's3:ListObject' ], ...
"""Test IAM Policies for correctness.""" import json from foremast.iam.construct_policy import construct_policy ANSWER1 = { 'Version': '2012-10-17', 'Statement': [ { 'Effect': 'Allow', 'Action': [ 's3:GetObject', 's3:ListObject' ], ...
Add TODO for more IAM Policy testing
chore: Add TODO for more IAM Policy testing See also: PSOBAT-1482
Python
apache-2.0
gogoair/foremast,gogoair/foremast
--- +++ @@ -31,6 +31,7 @@ assert json.loads(policy_json) == ANSWER1 + # TODO: Test other services besides S3 settings.update({'services': {'dynamodb': ['coreforrest', 'edgeforrest', 'attendantdevops']}}) policy_json = construct_policy(pipeline_sett...
e95bcb1a2688a9b5a0c09728cdd0082b643de943
pcbot/config.py
pcbot/config.py
import json from os.path import exists from os import mkdir class Config: config_path = "config/" def __init__(self, filename, data=None, load=True): self.filepath = "{}{}.json".format(self.config_path, filename) if not exists(self.config_path): mkdir(self.config_path) l...
import json from os.path import exists from os import mkdir class Config: config_path = "config/" def __init__(self, filename, data=None, load=True): self.filepath = "{}{}.json".format(self.config_path, filename) if not exists(self.config_path): mkdir(self.config_path) l...
Check if data is not None instead of if data is true
Check if data is not None instead of if data is true
Python
mit
pckv/pcbot,PcBoy111/PC-BOT-V2,PcBoy111/PCBOT
--- +++ @@ -17,7 +17,7 @@ if load: loaded_data = self.load() - if data and not loaded_data: + if data is not None and not loaded_data: self.data = data elif loaded_data: self.data = loaded_data
0e513331fd649ac71c2d9690c1cb72bf5954973c
__init__.py
__init__.py
# The version of Review Board. # # This is in the format of: # # (Major, Minor, Micro, alpha/beta/rc/final, Release Number, Released) # VERSION = (1, 0, 0, 'final', 0, True) def get_version_string(): version = '%s.%s' % (VERSION[0], VERSION[1]) if VERSION[2]: version += ".%s" % VERSION[2] if V...
# The version of Review Board. # # This is in the format of: # # (Major, Minor, Micro, alpha/beta/rc/final, Release Number, Released) # VERSION = (1, 1, 0, 'alpha', 1, False) def get_version_string(): version = '%s.%s' % (VERSION[0], VERSION[1]) if VERSION[2]: version += ".%s" % VERSION[2] if ...
Bump to Review Board 1.1alpha1.dev.
Bump to Review Board 1.1alpha1.dev.
Python
mit
1tush/reviewboard,1tush/reviewboard,Khan/reviewboard,bkochendorfer/reviewboard,beol/reviewboard,davidt/reviewboard,Khan/reviewboard,custode/reviewboard,sgallagher/reviewboard,bkochendorfer/reviewboard,beol/reviewboard,chazy/reviewboard,KnowNo/reviewboard,chipx86/reviewboard,beol/reviewboard,atagar/ReviewBoard,1tush/rev...
--- +++ @@ -4,7 +4,7 @@ # # (Major, Minor, Micro, alpha/beta/rc/final, Release Number, Released) # -VERSION = (1, 0, 0, 'final', 0, True) +VERSION = (1, 1, 0, 'alpha', 1, False) def get_version_string():
3f62c7b413f3ef6b1072437bcd1f08b1a9c6b6ea
armstrong/core/arm_layout/utils.py
armstrong/core/arm_layout/utils.py
from django.utils.safestring import mark_safe from django.template.loader import render_to_string from armstrong.utils.backends import GenericBackend template_finder = GenericBackend('ARMSTRONG_LAYOUT_TEMPLATE_FINDER', defaults='armstrong.core.arm_layout.utils.get_layout_template_name')\ .get_backend...
from django.utils.safestring import mark_safe from django.template.loader import render_to_string from armstrong.utils.backends import GenericBackend def get_layout_template_name(model, name): ret = [] for a in model.__class__.mro(): if not hasattr(a, "_meta"): continue ret.append...
Revert backend template finder code
Revert backend template finder code
Python
apache-2.0
armstrong/armstrong.core.arm_layout,armstrong/armstrong.core.arm_layout
--- +++ @@ -2,11 +2,6 @@ from django.template.loader import render_to_string from armstrong.utils.backends import GenericBackend - - -template_finder = GenericBackend('ARMSTRONG_LAYOUT_TEMPLATE_FINDER', - defaults='armstrong.core.arm_layout.utils.get_layout_template_name')\ - .get_backend def g...
4503e6671828497189736c86d408f6c0a8b47058
lambda_tweet.py
lambda_tweet.py
import boto3 import tweepy import json import base64 from tweet_s3_images import TweetS3Images with open('./config.json', 'r') as file: config = json.loads(file.read()) # Decrypt API keys client = boto3.client('kms') response = client.decrypt(CiphertextBlob=base64.b64decode(config['secrets'])) sec...
import boto3 import tweepy import json import base64 from tweet_s3_images import TweetS3Images with open('./config.json', 'r') as file: config = json.loads(file.read()) # Decrypt API keys client = boto3.client('kms') response = client.decrypt(CiphertextBlob=base64.b64decode(config['secrets'])) sec...
Update key name for S3
Update key name for S3
Python
mit
onema/lambda-tweet
--- +++ @@ -19,7 +19,8 @@ def lambda_handler(event, context): print('Received event: ' + json.dumps(event, indent=2)) - s3_info = event['Records'][0]['S3'] + print() + s3_info = event['Records'][0]['s3'] auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_access_token(ACCES...
8f099581930d0f55454751d8fbba05a3685c6144
mbuild/tests/test_xyz.py
mbuild/tests/test_xyz.py
import numpy as np import pytest import mbuild as mb from mbuild.tests.base_test import BaseTest class TestXYZ(BaseTest): def test_save(self, ethane): ethane.save(filename='ethane.xyz')
import numpy as np import pytest import mbuild as mb from mbuild.tests.base_test import BaseTest class TestXYZ(BaseTest): def test_save(self, ethane): ethane.save(filename='ethane.xyz') ethane.save(filename='ethane.pdb') ethane_in = mb.load('ethane.xyz', top='ethane.pdb') assert ...
Add sanity checks to tests
Add sanity checks to tests This should be cleaned up with an XYZ read that does not require reading in an extra file (mdtraj requires a file with topological information, in this case PDB file).
Python
mit
iModels/mbuild,iModels/mbuild
--- +++ @@ -9,3 +9,7 @@ def test_save(self, ethane): ethane.save(filename='ethane.xyz') + ethane.save(filename='ethane.pdb') + ethane_in = mb.load('ethane.xyz', top='ethane.pdb') + assert len(ethane_in.children) == 8 + assert set([child.name for child in ethane_in.children]...
7d20874c43637f1236442333f60a88ec653f53f2
resources/launchers/alfanousDesktop.py
resources/launchers/alfanousDesktop.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import alfanousDesktop.Gui alfanousDesktop.Gui.main()
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys # The paths should be generated by setup script sys.argv.extend( '-i', '/usr/share/alfanous-indexes/', '-l', '/usr/locale/', '-c', '/usr/share/alfanous-config/') from alfanousDesktop.Gui import * main()
Add resource paths to python launcher script (proxy)
Add resource paths to python launcher script (proxy)
Python
agpl-3.0
keelhaule/alfanous,muslih/alfanous,saifmahamood/alfanous,saifmahamood/alfanous,muslih/alfanous,muslih/alfanous,keelhaule/alfanous,saifmahamood/alfanous,saifmahamood/alfanous,keelhaule/alfanous,saifmahamood/alfanous,abougouffa/alfanous,keelhaule/alfanous,muslih/alfanous,muslih/alfanous,abougouffa/alfanous,keelhaule/alfa...
--- +++ @@ -1,6 +1,14 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -import alfanousDesktop.Gui +import sys -alfanousDesktop.Gui.main() +# The paths should be generated by setup script +sys.argv.extend( + '-i', '/usr/share/alfanous-indexes/', + '-l', '/usr/locale/', + '-c', '/usr/share/alfanous-config/') + +...
7537387aa80109877d6659cc54ec0ee7aa6496bd
robot/Cumulus/resources/locators_50.py
robot/Cumulus/resources/locators_50.py
from locators_51 import * import copy npsp_lex_locators = copy.deepcopy(npsp_lex_locators) # current version (Sravani's ) npsp_lex_locators['delete_icon']='//span[contains(text() ,"{}")]/following::span[. = "{}"]/following-sibling::a/child::span[@class = "deleteIcon"]' npsp_lex_locators['object']['field']= "//div[con...
from locators_51 import * import copy npsp_lex_locators = copy.deepcopy(npsp_lex_locators) npsp_lex_locators['delete_icon']='//span[contains(text() ,"{}")]/following::span[. = "{}"]/following-sibling::a/child::span[@class = "deleteIcon"]' npsp_lex_locators['object']['field']= "//div[contains(@class, 'uiInput')][.//lab...
Revert "changes in locator_50 file (current and old versions)"
Revert "changes in locator_50 file (current and old versions)" This reverts commit 819dfa4ed2033c1f82973edb09215b96d3c4b188.
Python
bsd-3-clause
SalesforceFoundation/Cumulus,SalesforceFoundation/Cumulus,SalesforceFoundation/Cumulus,SalesforceFoundation/Cumulus
--- +++ @@ -2,16 +2,7 @@ import copy npsp_lex_locators = copy.deepcopy(npsp_lex_locators) - -# current version (Sravani's ) npsp_lex_locators['delete_icon']='//span[contains(text() ,"{}")]/following::span[. = "{}"]/following-sibling::a/child::span[@class = "deleteIcon"]' npsp_lex_locators['object']['field']= "/...
c72b727d373ac620379fe0a2a0c1b85bb868962e
test_arrange_schedule.py
test_arrange_schedule.py
from arrange_schedule import * def test_crawler_cwb_img(system_setting): send_msg = {} send_msg['server_dir'] = system_setting['board_py_dir'] send_msg['user_id'] = 1 receive_msg = crawler_cwb_img(send_msg) assert receive_msg['result'] == 'success' if __name__ == "__main__": system_setting =...
from arrange_schedule import * def test_read_system_setting(): keys = ['board_py_dir','shutdown','max_db_log','min_db_activity'] system_setting = read_system_setting() for key in keys: assert key in system_setting return system_setting def test_crawler_cwb_img(system_setting): send_msg = ...
Add test case for read_system_setting()
Add test case for read_system_setting()
Python
apache-2.0
stvreumi/electronic-blackboard,Billy4195/electronic-blackboard,stvreumi/electronic-blackboard,Billy4195/electronic-blackboard,chenyang14/electronic-blackboard,chenyang14/electronic-blackboard,SWLBot/electronic-blackboard,SWLBot/electronic-blackboard,stvreumi/electronic-blackboard,stvreumi/electronic-blackboard,Billy419...
--- +++ @@ -1,5 +1,12 @@ from arrange_schedule import * + +def test_read_system_setting(): + keys = ['board_py_dir','shutdown','max_db_log','min_db_activity'] + system_setting = read_system_setting() + for key in keys: + assert key in system_setting + return system_setting def test_crawler_cw...
01a4a92f69219e081171aa1ad9c0215efec8f69d
flicks/settings/__init__.py
flicks/settings/__init__.py
from .base import * try: from .local import * except ImportError, exc: exc.args = tuple(['%s (did you rename settings/local.py-dist?)' % exc.args[0]]) raise exc import sys if sys.argv[1] == 'test': try: from .test import * except ImportError: pass
from .base import * try: from .local import * except ImportError, exc: exc.args = tuple(['%s (did you rename settings/local.py-dist?)' % exc.args[0]]) raise exc """ import sys if sys.argv[1] == 'test': try: from .test import * except ImportError: pass """
Remove test settings to see if it fixes jenkins.
Remove test settings to see if it fixes jenkins.
Python
bsd-3-clause
mozilla/firefox-flicks,mozilla/firefox-flicks,mozilla/firefox-flicks,mozilla/firefox-flicks
--- +++ @@ -5,10 +5,11 @@ exc.args = tuple(['%s (did you rename settings/local.py-dist?)' % exc.args[0]]) raise exc - +""" import sys if sys.argv[1] == 'test': try: from .test import * except ImportError: pass +"""
854ad9b06ab5da3c4ac0ae308d4d8d01a0739d42
openliveq/click_model.py
openliveq/click_model.py
from math import exp class ClickModel(object): ''' Simple Position-biased Model: P(C_r=1) = P(A_r=1|E_r=1)P(E_r=1), where C_r is click on the r-th document, A_r is being attracted by the r-th document, and E_r is examination of the r-th document. In this simple model, the e...
from math import exp class ClickModel(object): ''' Simple Position-biased Model: P(C_r=1) = P(A_r=1|E_r=1)P(E_r=1), where C_r is click on the r-th document, A_r is being attracted by the r-th document, and E_r is examination of the r-th document. In this simple model, the e...
Use topk in the click model
Use topk in the click model
Python
mit
mpkato/openliveq
--- +++ @@ -18,9 +18,10 @@ def estimate(cls, ctrs, sigma=10.0, topk=10): result = {} for ctr in ctrs: - eprob = cls._eprob(ctr.rank, sigma) - aprob = min([1.0, ctr.ctr / eprob]) - result[(ctr.query_id, ctr.question_id)] = aprob + if ctr.rank <= topk: ...
343baa4b8a0ed9d4db0727c514d9ff97b937c7ee
adLDAP.py
adLDAP.py
import ldap def checkCredentials(username, password): if password == "": return 'Empty Password' controller = 'devdc' domainA = 'dev' domainB = 'devlcdi' domain = domainA + '.' + domainB ldapServer = 'ldap://' + controller + '.' + domain ldapUsername = username + '@' + domain ldapPassword = password b...
import ldap validEditAccessGroups = ['Office Assistants', 'Domain Admins'] def checkCredentials(username, password): if password == "": return 'Empty Password' controller = 'devdc' domainA = 'dev' domainB = 'devlcdi' domain = domainA + '.' + domainB ldapServer = 'ldap://' + controller + '.' + domain ldap...
Add group fetching from AD
Add group fetching from AD
Python
mit
lcdi/Inventory,lcdi/Inventory,lcdi/Inventory,lcdi/Inventory
--- +++ @@ -1,4 +1,6 @@ import ldap + +validEditAccessGroups = ['Office Assistants', 'Domain Admins'] def checkCredentials(username, password): if password == "": @@ -15,7 +17,6 @@ base_dn = 'DC=' + domainA + ',DC=' + domainB ldap_filter = 'userPrincipalName=' + ldapUsername - attrs = ['memberOf'] #...
92108cdac6e9324ba9584359b6502e87ce7dcccb
owebunit/tests/simple.py
owebunit/tests/simple.py
import BaseHTTPServer import threading import time import owebunit class Handler(BaseHTTPServer.BaseHTTPRequestHandler): def do_GET(self): self.wfile.write("HTTP/1.0 200 OK\n") self.wfile.write("Content-Type: text/plain\n") self.wfile.write("\n") self.wfile.write("Response text") d...
import BaseHTTPServer import threading import time import owebunit import bottle app = bottle.Bottle() @app.route('/ok') def ok(): return 'ok' @app.route('/internal_server_error') def internal_error(): bottle.abort(500, 'internal server error') def run_server(): app.run(host='localhost', port=8041) cla...
Switch to using bottle in test suite
Switch to using bottle in test suite
Python
bsd-2-clause
p/webracer
--- +++ @@ -2,19 +2,20 @@ import threading import time import owebunit +import bottle -class Handler(BaseHTTPServer.BaseHTTPRequestHandler): - def do_GET(self): - self.wfile.write("HTTP/1.0 200 OK\n") - self.wfile.write("Content-Type: text/plain\n") - self.wfile.write("\n") - self....
2747b9a5fb480176df2a8910156c9e56dd9fcd1a
src/commit_id.py
src/commit_id.py
import subprocess as sp import sys def grab_output(*command): return sp.Popen(command, stdout=sp.PIPE).communicate()[0].strip() commit_id_size = 12 try: commit_id = grab_output('gat', 'rev-parse', '--short=%d' % commit_id_size, 'HEAD') commit_date = grab_output('git', 'show', '-s', '--format=%ci', 'HEAD'...
import subprocess as sp import sys def grab_output(*command): return sp.Popen(command, stdout=sp.PIPE).communicate()[0].strip() commit_id_size = 12 try: commit_id = grab_output('git', 'rev-parse', '--short=%d' % commit_id_size, 'HEAD') commit_date = grab_output('git', 'show', '-s', '--format=%ci', 'HEAD'...
Fix typo in Python commit id script.
Fix typo in Python commit id script. BUG=angle:529 Change-Id: Ife174e3fb4cb32342f519691d1d5d5c015cf2727 Reviewed-on: https://chromium-review.googlesource.com/187541 Reviewed-by: Nicolas Capens <51edc787c30f24c4904e8ffbb5523c3a9f7a451d@chromium.org> Reviewed-by: Shannon Woods <0f3694938fd5703bd548127ee497e4d604509bef@...
Python
bsd-3-clause
geekboxzone/lollipop_external_chromium_org_third_party_angle,android-ia/platform_external_chromium_org_third_party_angle,geekboxzone/lollipop_external_chromium_org_third_party_angle,geekboxzone/lollipop_external_chromium_org_third_party_angle,xin3liang/platform_external_chromium_org_third_party_angle,geekboxzone/lollip...
--- +++ @@ -7,7 +7,7 @@ commit_id_size = 12 try: - commit_id = grab_output('gat', 'rev-parse', '--short=%d' % commit_id_size, 'HEAD') + commit_id = grab_output('git', 'rev-parse', '--short=%d' % commit_id_size, 'HEAD') commit_date = grab_output('git', 'show', '-s', '--format=%ci', 'HEAD') except: ...
f90cc1b24910b1c6214bdda3c2de831b5b507e01
factual/common/responses.py
factual/common/responses.py
import logging import exceptions class Response(object): def __init__(self, body, meta=None): self.meta = meta self.body = body # todo: handle non-"ok" status self.status = body.get("status", None) self.version = body.get("version", None) self.response = body.get("response", {}) if self.status == "err...
import logging import exceptions class Response(object): def __init__(self, body, meta=None): self.meta = meta self.body = body # todo: handle non-"ok" status self.status = body.get("status", None) self.version = body.get("version", None) self.response = body.get("response", {}) if self.status == "err...
Fix parsing of errors returned by API.
Fix parsing of errors returned by API.
Python
bsd-2-clause
casebeer/factual
--- +++ @@ -12,7 +12,8 @@ self.response = body.get("response", {}) if self.status == "error": - raise exceptions.FactualError(body.get("error")) + error = "\"%s\" error: %s" % (body.get("error_type"), body.get("message")) + raise exceptions.FactualError(error) def __repr__(self): if len(self.respon...
6daa0f1aa06092598892cb37a7f3c5f3541fa0c2
cms/manage.py
cms/manage.py
#!/usr/bin/env python from django.core.management import execute_manager import imp try: imp.find_module('settings') # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized t...
#!/usr/bin/env python from django.core.management import execute_manager import imp try: imp.find_module('settings') # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. " "It app...
Fix string layout for readability
Fix string layout for readability
Python
agpl-3.0
prarthitm/edxplatform,nanolearningllc/edx-platform-cypress,benpatterson/edx-platform,mjirayu/sit_academy,yokose-ks/edx-platform,Edraak/edx-platform,10clouds/edx-platform,raccoongang/edx-platform,kursitet/edx-platform,jolyonb/edx-platform,cecep-edu/edx-platform,Edraak/circleci-edx-platform,nttks/edx-platform,ampax/edx-p...
--- +++ @@ -5,7 +5,9 @@ imp.find_module('settings') # Assumed to be in the same directory. except ImportError: import sys - sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your...
7217e2dcbec3e13d730e47e001d00c5fb8534468
moa/__init__.py
moa/__init__.py
'''A framework for designing and running experiments in Python using Kivy. ''' __version__ = '0.1-dev' from kivy import kivy_home_dir from os import environ from os.path import join from moa.logger import Logger #: moa configuration filename moa_config_fn = '' if not environ.get('MOA_DOC_INCLUDE'): moa_config_...
'''A framework for designing and running experiments in Python using Kivy. ''' __version__ = '0.1-dev' from kivy import kivy_home_dir from os import environ from os.path import join if 'MOA_CLOCK' in environ: from moa.clock import set_clock set_clock(clock='moa') from moa.logger import Logger #: moa confi...
Add config option to start moa clock.
Add config option to start moa clock.
Python
mit
matham/moa
--- +++ @@ -6,6 +6,11 @@ from kivy import kivy_home_dir from os import environ from os.path import join + +if 'MOA_CLOCK' in environ: + from moa.clock import set_clock + set_clock(clock='moa') + from moa.logger import Logger
8556fc0b6fb024ab6cc68364270462681209108a
examples/match.py
examples/match.py
import cassiopeia as cass from cassiopeia.core import Summoner def print_summoner(name: str, id: int): me = Summoner(name="Kalturi", id=21359666) #matches = cass.get_matches(me) matches = me.matches match = matches[0] print(match.id) for p in match.participants: print(p.id, p.champion...
import cassiopeia as cass from cassiopeia.core import Summoner def print_newest_match(name: str, region: str): summoner = Summoner(name=name, region=region) # matches = cass.get_matches(summoner) matches = summoner.matches match = matches[0] print('Match ID:', match.id) for p in match.partici...
Add print description, use function arguments
Add print description, use function arguments - changed name and ID to being name and region - Add a string to the print calls denoting what's being printed out
Python
mit
robrua/cassiopeia,10se1ucgo/cassiopeia,meraki-analytics/cassiopeia
--- +++ @@ -2,17 +2,16 @@ from cassiopeia.core import Summoner -def print_summoner(name: str, id: int): - me = Summoner(name="Kalturi", id=21359666) +def print_newest_match(name: str, region: str): + summoner = Summoner(name=name, region=region) - #matches = cass.get_matches(me) - matches = me.matc...
5e8d64bcbb53da0984ac0b41a470417a05c530d7
microcosm_postgres/factories.py
microcosm_postgres/factories.py
""" Factory that configures SQLAlchemy for PostgreSQL. """ from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from microcosm.api import binding, defaults @binding("postgres") @defaults( host="localhost", port=5432, password="secret", ) def configure_sqlalchemy_engine(graph): ...
""" Factory that configures SQLAlchemy for PostgreSQL. """ from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from microcosm.api import binding, defaults @binding("postgres") @defaults( host="localhost", port=5432, password="secret", ) def configure_sqlalchemy_engine(graph): ...
Rename factory to match what it creates
Rename factory to match what it creates
Python
apache-2.0
globality-corp/microcosm-postgres,globality-corp/microcosm-postgres
--- +++ @@ -40,7 +40,7 @@ return create_engine(uri) -def configure_sqlalchemy_session(graph): +def configure_sqlalchemy_sessionmaker(graph): """ Create the SQLAlchemy session class.
87d9365cd3f19a52957e2e26cefa9fa048c2acb1
TWLight/resources/filters.py
TWLight/resources/filters.py
import django_filters from .models import Language, Partner from .helpers import get_tag_choices class PartnerFilter(django_filters.FilterSet): tags = django_filters.ChoiceFilter( label="Tags", choices=get_tag_choices(), method="tags_filter" ) languages = django_filters.ModelChoiceFilter(queryset...
from django.utils.translation import gettext as _ from .models import Language, Partner from .helpers import get_tag_choices import django_filters class PartnerFilter(django_filters.FilterSet): tags = django_filters.ChoiceFilter( # Translators: On the MyLibrary page (https://wikipedialibrary.wmflabs.or...
Mark filter headers in My Library for translation
Mark filter headers in My Library for translation
Python
mit
WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight,WikipediaLibrary/TWLight
--- +++ @@ -1,14 +1,25 @@ -import django_filters +from django.utils.translation import gettext as _ from .models import Language, Partner from .helpers import get_tag_choices +import django_filters + class PartnerFilter(django_filters.FilterSet): + tags = django_filters.ChoiceFilter( - label="Tag...
e563e8f8f1af691c4c9aa2f6177fbf2c8e2a4855
della/user_manager/draw_service.py
della/user_manager/draw_service.py
import json from django.conf import settings def _get_default_file_content(): return {'status': False} def _write_status_file(): file_path = settings.STATUS_FILE with open(file_path, 'w') as f: json.dump({'status': True}, f) return True def _get_status_file(): file_path = settings.STA...
import json import random from collections import deque from django.conf import settings from django.contrib.auth.models import User def _get_default_file_content(): return {'status': False} def _write_status_file(): file_path = settings.STATUS_FILE with open(file_path, 'w') as f: json.dump({'s...
Add helper funtions for making pairs
Add helper funtions for making pairs
Python
mit
avinassh/della,avinassh/della,avinassh/della
--- +++ @@ -1,6 +1,9 @@ import json +import random +from collections import deque from django.conf import settings +from django.contrib.auth.models import User def _get_default_file_content(): @@ -34,3 +37,34 @@ if not _get_status_file()['status']: return _write_status_file() return True +...
21f06746eebe809f5d7017394b4c7c50ba319066
street_score/bulkadmin/forms.py
street_score/bulkadmin/forms.py
import csv from django import forms class BulkUploadForm(forms.Form): data = forms.FileField() def clean(self): cleaned_data = super(BulkUploadForm, self).clean() cleaned_data['data'] = BulkUploadForm.load_csv(cleaned_data['data']) return cleaned_data @staticmethod def load...
import csv from django import forms class BulkUploadForm(forms.Form): data = forms.FileField(help_text=""" <p>Select the CSV file to upload. The file should have a header for each column you want to populate. When you have selected your file, click the 'Upload' button below.</p> ...
Add a help_text string to the admin form
Add a help_text string to the admin form
Python
mit
openplans/streetscore,openplans/streetscore,openplans/streetscore
--- +++ @@ -4,7 +4,11 @@ class BulkUploadForm(forms.Form): - data = forms.FileField() + data = forms.FileField(help_text=""" + <p>Select the CSV file to upload. The file should have a header for + each column you want to populate. When you have selected your + file, click the '...
edadd7385ff8c839b524a6c06d0fc370c3db25bb
src/constants.py
src/constants.py
#!/usr/bin/env python TRAJECTORY_TYPE = 'circular' if TRAJECTORY_TYPE == 'linear': SIMULATION_TIME_IN_SECONDS = 40 elif TRAJECTORY_TYPE == 'circular': SIMULATION_TIME_IN_SECONDS = 120 DELTA_T = 0.1 # this is the sampling time STEPS = int(SIMULATION_TIME_IN_SECONDS / DELTA_T) K_V = 0.90 K_W = 0.90
#!/usr/bin/env python TRAJECTORY_TYPE = 'squared' if TRAJECTORY_TYPE == 'linear': SIMULATION_TIME_IN_SECONDS = 40.0 elif TRAJECTORY_TYPE == 'circular': SIMULATION_TIME_IN_SECONDS = 120.0 elif TRAJECTORY_TYPE == 'squared': SIMULATION_TIME_IN_SECONDS = 160.0 DELTA_T = 0.1 # this is the sampling time STEPS =...
Add simulation time for a squared trajectory
Add simulation time for a squared trajectory
Python
mit
bit0001/trajectory_tracking,bit0001/trajectory_tracking
--- +++ @@ -1,10 +1,12 @@ #!/usr/bin/env python -TRAJECTORY_TYPE = 'circular' +TRAJECTORY_TYPE = 'squared' if TRAJECTORY_TYPE == 'linear': - SIMULATION_TIME_IN_SECONDS = 40 + SIMULATION_TIME_IN_SECONDS = 40.0 elif TRAJECTORY_TYPE == 'circular': - SIMULATION_TIME_IN_SECONDS = 120 + SIMULATION_TIME_IN_...
d386c389b9e350b01fdf25f7cd91857d3fbb1ead
opps/contrib/multisite/admin.py
opps/contrib/multisite/admin.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.contrib import admin from django.conf import settings from django.utils import timezone from .models import SitePermission class AdminViewPermission(admin.ModelAdmin): def queryset(self, request): queryset = super(AdminViewPermission, self).query...
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.contrib import admin from django.conf import settings from django.utils import timezone from .models import SitePermission class AdminViewPermission(admin.ModelAdmin): def queryset(self, request): queryset = super(AdminViewPermission, self).query...
Use OPPS_MULTISITE_ADMIN on queryset AdminViewPermission
Use OPPS_MULTISITE_ADMIN on queryset AdminViewPermission
Python
mit
opps/opps,YACOWS/opps,williamroot/opps,opps/opps,williamroot/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,YACOWS/opps,opps/opps,jeanmask/opps,williamroot/opps,jeanmask/opps,jeanmask/opps,YACOWS/opps,opps/opps
--- +++ @@ -11,6 +11,8 @@ def queryset(self, request): queryset = super(AdminViewPermission, self).queryset(request) + if not settings.OPPS_MULTISITE_ADMIN: + return queryset try: sitepermission = SitePermission.objects.get( user=request.user,
52e6dabe13abdcd81a097beaacca585800397552
examples/upperair/Wyoming_Request.py
examples/upperair/Wyoming_Request.py
# Copyright (c) 2017 Siphon Contributors. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """ Wyoming Upper Air Data Request ============================== This example shows how to use siphon's `simplewebswervice` support to create a query to the Wyoming upper air ar...
# Copyright (c) 2017 Siphon Contributors. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """ Wyoming Upper Air Data Request ============================== This example shows how to use siphon's `simplewebswervice` support to create a query to the Wyoming upper air ar...
Add attaching units to example.
Add attaching units to example.
Python
bsd-3-clause
Unidata/siphon
--- +++ @@ -10,6 +10,8 @@ """ from datetime import datetime + +from metpy.units import units from siphon.simplewebservice.wyoming import WyomingUpperAir @@ -37,3 +39,11 @@ #################################################### print(df.units['pressure']) + +#################################################...
394ed06411d3ca3ada66aab3bee796682895acc0
cla_backend/apps/core/testing.py
cla_backend/apps/core/testing.py
from django.core.management import call_command from django.test.utils import get_runner from django.conf import settings from django.db import connections, DEFAULT_DB_ALIAS # use jenkins runner if present otherwise the default django one if 'django_jenkins' in settings.INSTALLED_APPS: base_runner = 'django_jenki...
from django.core.management import call_command from django.test.utils import get_runner from django.conf import settings from django.db import connections, DEFAULT_DB_ALIAS # use jenkins runner if present otherwise the default django one if 'django_jenkins' in settings.INSTALLED_APPS: base_runner = 'django_jenki...
Install pgcrypto PGSQL extension but only if it does not exist already (e.g. from template1)
Install pgcrypto PGSQL extension but only if it does not exist already (e.g. from template1)
Python
mit
ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend
--- +++ @@ -21,6 +21,6 @@ ret = super(CLADiscoverRunner, self).setup_databases(**kwargs) connection = connections[DEFAULT_DB_ALIAS] cursor = connection.cursor() - cursor.execute('CREATE EXTENSION pgcrypto') + cursor.execute('CREATE EXTENSION IF NOT EXISTS pgcrypto') c...
9e2d3ed154e977d38126f610f11a0df3a0141da1
apps/local_apps/account/context_processors.py
apps/local_apps/account/context_processors.py
from account.models import Account, AnonymousAccount def openid(request): return {'openid': request.openid} def account(request): account = AnonymousAccount(request) if request.user.is_authenticated(): try: account = Account._default_manager.get(user=request.user) except (Acco...
from account.models import Account, AnonymousAccount def openid(request): return {'openid': request.openid} def account(request): if request.user.is_authenticated(): try: account = Account._default_manager.get(user=request.user) except (Account.DoesNotExist, Account.MultipleObject...
Handle the exception case in the account context_processor.
Handle the exception case in the account context_processor. git-svn-id: 51ba99f60490c2ee9ba726ccda75a38950f5105d@1119 45601e1e-1555-4799-bd40-45c8c71eef50
Python
mit
alex/pinax,amarandon/pinax,amarandon/pinax,amarandon/pinax,amarandon/pinax,alex/pinax,alex/pinax
--- +++ @@ -5,10 +5,11 @@ return {'openid': request.openid} def account(request): - account = AnonymousAccount(request) if request.user.is_authenticated(): try: account = Account._default_manager.get(user=request.user) except (Account.DoesNotExist, Account.MultipleObject...
dddb15a50d64a7b2660f2af1a407dd7fa9b3742b
samples/auth.py
samples/auth.py
"""[START auth]""" from oauth2client.client import GoogleCredentials from googleapiclient.discovery def get_service(): credentials = GoogleCredentials.get_application_default() return build('bigquery', 'v2', credentials) """[END auth]"""
"""[START auth]""" from oauth2client.client import GoogleCredentials from googleapiclient.discovery import build def get_service(): credentials = GoogleCredentials.get_application_default() return build('bigquery', 'v2', credentials) """[END auth]"""
Make sure to import build from googleapiclient.discovery.
Make sure to import build from googleapiclient.discovery.
Python
apache-2.0
googlearchive/bigquery-samples-python,googlearchive/bigquery-samples-python
--- +++ @@ -1,7 +1,7 @@ """[START auth]""" from oauth2client.client import GoogleCredentials -from googleapiclient.discovery +from googleapiclient.discovery import build def get_service(): credentials = GoogleCredentials.get_application_default()
be7f3153e1505ecdfca6e5078c4b3a4ed1817c28
setup.py
setup.py
import os import json from setuptools import setup f = open(os.path.join(os.path.dirname(__file__), 'README.md')) readme = f.read() f.close() f = open(os.path.join(os.path.dirname(__file__), 'package.json')) package = json.loads(f.read()) f.close() setup( name=package['name'], version=package['version'], ...
import os import json from setuptools import setup f = open(os.path.join(os.path.dirname(__file__), 'README.md')) readme = f.read() f.close() f = open(os.path.join(os.path.dirname(__file__), 'package.json')) package = json.loads(f.read()) f.close() setup( name=package['name'], version=package['version'], ...
Add description content type for pypi.
Add description content type for pypi.
Python
mit
bradleyg/django-s3direct,bradleyg/django-s3direct,bradleyg/django-s3direct
--- +++ @@ -15,6 +15,7 @@ version=package['version'], description=package['description'], long_description=readme, + long_description_content_type='text/markdown', author=package['author']['name'], author_email=package['author']['email'], url=package['homepage'],
c99ef9e318467624de8f62afee6c14ca422e8413
setup.py
setup.py
# -*- coding: utf-8 -*- """setup.py: setuptools control.""" import re from setuptools import setup, find_packages import pip version = re.search( '^__version__\s*=\s*"(.*)"', open('src/bslint.py').read(), re.M ).group(1) with open("README.rst", "rb") as f: long_descr = f.read().decode("utf-8...
# -*- coding: utf-8 -*- """setup.py: setuptools control.""" import re from setuptools import setup, find_packages import pip version = re.search( '^__version__\s*=\s*"(.*)"', open('src/bslint.py').read(), re.M ).group(1) with open("README.rst", "rb") as f: long_descr = f.read().decode("utf-8...
Include pip as required install
Include pip as required install
Python
bsd-3-clause
sky-uk/bslint
--- +++ @@ -34,4 +34,5 @@ author_email = "zachary.robinson@sky.uk", url = "https://github.com/sky-uk/roku-linter", download_url = 'https://github.com/sky-uk/bslint/archive/0.2.2.tar.gz', + install_requires=['pip'] )
a3fb6a02a2c039fe53326ab7bf974efa1df0c2fe
setup.py
setup.py
# -*- coding: utf-8 -*- from setuptools import setup setup( name='rq-scheduler', version='0.1', author='Selwin Ong', author_email='selwin.ong@gmail.com', packages=['rq_scheduler'], url='https://github.com/ui/rq-scheduler', license='MIT', description='Provides job scheduling capabilities...
# -*- coding: utf-8 -*- from setuptools import setup setup( name='rq-scheduler', version='0.1.1', author='Selwin Ong', author_email='selwin.ong@gmail.com', packages=['rq_scheduler'], url='https://github.com/ui/rq-scheduler', license='MIT', description='Provides job scheduling capabiliti...
Bump version to fix pypi packaging
Bump version to fix pypi packaging
Python
mit
ihuro/rq-scheduler,sum12/rq-scheduler,cheungpat/rq-scheduler,ui/rq-scheduler,lechup/rq-scheduler,mbodock/rq-scheduler,peergradeio/rq-scheduler
--- +++ @@ -3,7 +3,7 @@ setup( name='rq-scheduler', - version='0.1', + version='0.1.1', author='Selwin Ong', author_email='selwin.ong@gmail.com', packages=['rq_scheduler'],
cadc5534f5926a0aeb1fb4bf6e9f1db0f56a9b6f
setup.py
setup.py
from setuptools import setup, find_packages with open('README.rst') as readme_file: readme = readme_file.read() with open('requirements.txt') as req_file: requires = req_file.read().split('\n') with open('requirements-dev.txt') as req_file: requires_dev = req_file.read().split('\n') with open('VERSION')...
from setuptools import setup, find_packages with open('README.rst') as readme_file: readme = readme_file.read() with open('requirements.txt') as req_file: requires = [req for req in req_file.read().split('\n') if req] with open('requirements-dev.txt') as req_file: requires_dev = [req for req in req_file....
Remove empty string from requirements list
Remove empty string from requirements list When we moved to Python 3 we used this simpler method to read the requirements file. However we need to remove the empty/Falsey elements from the list. This fixes the error: ``` Failed building wheel for molo.polls ```
Python
bsd-2-clause
praekelt/molo.polls,praekelt/molo.polls
--- +++ @@ -4,10 +4,10 @@ readme = readme_file.read() with open('requirements.txt') as req_file: - requires = req_file.read().split('\n') + requires = [req for req in req_file.read().split('\n') if req] with open('requirements-dev.txt') as req_file: - requires_dev = req_file.read().split('\n') + ...
e197d1a030993ec01c113188593fbd12267fd4fa
setup.py
setup.py
#!/usr/bin/env python import sys, os try: from setuptools import setup, find_packages except ImportError: from distutils.core import setup # Hack to prevent "TypeError: 'NoneType' object is not callable" error # in multiprocessing/util.py _exit_function when setup.py exits # (see http://www.eby-sarna.com/pi...
#!/usr/bin/env python import sys, os try: from setuptools import setup, find_packages except ImportError: from distutils.core import setup # Hack to prevent "TypeError: 'NoneType' object is not callable" error # in multiprocessing/util.py _exit_function when setup.py exits # (see http://www.eby-sarna.com/pi...
Exclude tests package from distribution
Exclude tests package from distribution
Python
bsd-3-clause
wgiddens/Willow,wgiddens/Willow
--- +++ @@ -25,7 +25,7 @@ author='Karl Hobley', author_email='karlhobley10@gmail.com', url='', - packages=find_packages(), + packages=find_packages(exclude=['tests']), include_package_data=True, license='BSD', classifiers=[
0a9601c4ee085c38f660e6d40c98256098576a92
setup.py
setup.py
from distutils.core import setup from pip.req import parse_requirements install_reqs = parse_requirements("./requirements.txt") reqs = [str(ir.req) for ir in install_reqs] setup( name='url-matchers', version='0.0.1', modules=['url_matchers'], install_requires=reqs, author="Alex Good", author_e...
from distutils.core import setup from os import path from pip.req import parse_requirements requirements_location = path.join(path.dirname(__file__), "requirements.txt") install_reqs = parse_requirements(requirements_location) reqs = [str(ir.req) for ir in install_reqs] setup( name='url-matchers', version='0....
Use absolute path for requirements file
Use absolute path for requirements file
Python
mit
alexjg/url-matchers
--- +++ @@ -1,7 +1,9 @@ from distutils.core import setup +from os import path from pip.req import parse_requirements -install_reqs = parse_requirements("./requirements.txt") +requirements_location = path.join(path.dirname(__file__), "requirements.txt") +install_reqs = parse_requirements(requirements_location) re...
091d0589d40e5bc19a58e16653ab48c9a821b276
setup.py
setup.py
from setuptools import setup from codecs import open from os import path here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'README.md'), encoding='utf-8') as f: readme = f.read() setup( name='manuale', version='1.0.1.dev0', license='MIT', description="A fully manual Let's Encr...
from setuptools import setup from codecs import open from os import path here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'README.md'), encoding='utf-8') as f: readme = f.read() setup( name='manuale', version='1.0.1.dev0', license='MIT', description="A fully manual Let's Encr...
Add Python 3 only classifier
Add Python 3 only classifier
Python
mit
veeti/manuale
--- +++ @@ -26,6 +26,7 @@ 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3 :: Only', ], packages=['manuale'],
6cb1b973e24fee5879d5623673d976b66fdf4252
setup.py
setup.py
from setuptools import setup setup( name='tattler', author='Joe Friedl', author_email='joe@joefriedl.net', version='0.1', description='A nose plugin that tattles on functions.', keywords='nose plugin test testing mock', url='https://github.com/grampajoe/tattler', license='MIT', py_...
from setuptools import setup setup( name='tattler', author='Joe Friedl', author_email='joe@joefriedl.net', version='0.1', description='A nose plugin that tattles on functions.', keywords='nose plugin test testing mock', url='https://github.com/grampajoe/tattler', license='MIT', py_...
Add nose to the requirements, why not?
Add nose to the requirements, why not?
Python
mit
grampajoe/tattler
--- +++ @@ -12,6 +12,7 @@ license='MIT', py_modules=['tattler'], install_requires=[ + 'nose', 'mock', ], entry_points = {
9a2318d4ddadb57b4096896407c7683d9804e04d
setup.py
setup.py
from setuptools import setup, find_packages long_description = """Publish browser extensions to their stores. Currently only available for Google Chrome.""" setup( name='webstoremgr', version='0.5.3', description='Publish browser extensions to their stores.', long_description=long_description, aut...
from setuptools import setup, find_packages long_description = """Publish browser extensions to their stores. Currently only available for Google Chrome.""" setup( name='webstoremgr', version='0.1', description='Publish browser extensions to their stores.', long_description=long_description, autho...
Reset version number for newly named pkg
Reset version number for newly named pkg
Python
mit
melkamar/webstore-manager,melkamar/webstore-manager
--- +++ @@ -5,7 +5,7 @@ setup( name='webstoremgr', - version='0.5.3', + version='0.1', description='Publish browser extensions to their stores.', long_description=long_description, author='Martin Melka',
2b3c9eb3f849e564775f71714c21d490858bd8dc
setup.py
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from setuptools import setup if os.path.exists('README.rst'): long_description = open('README.rst').read() else: long_description = '''A simple Python wrapper around the ChemSpider Web Services.''' setup( name='ChemSpiPy', version='1.0.5', ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from setuptools import setup if os.path.exists('README.rst'): long_description = open('README.rst').read() else: long_description = '''A simple Python wrapper around the ChemSpider Web Services.''' setup( name='ChemSpiPy', version='1.0.5', ...
Remove classifiers that get outdated
Remove classifiers that get outdated
Python
mit
mcs07/ChemSpiPy
--- +++ @@ -32,11 +32,7 @@ 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.2...
834637f8860f6b2d99726f9f531d05884e375ea3
setup.py
setup.py
#!/usr/bin/env python import os import re from distutils.core import setup DIRNAME = os.path.abspath(os.path.dirname(__file__)) rel = lambda *parts: os.path.abspath(os.path.join(DIRNAME, *parts)) README = open(rel('README.rst')).read() INIT_PY = open(rel('flask_redis.py')).read() VERSION = re.findall("__version__ ...
#!/usr/bin/env python import os import re import sys from distutils.core import setup DIRNAME = os.path.abspath(os.path.dirname(__file__)) rel = lambda *parts: os.path.abspath(os.path.join(DIRNAME, *parts)) with open(rel('README.rst')) as handler: README = handler.read() with open(rel('flask_redis.py')) as han...
Fix install requirements due to Python versions.
Fix install requirements due to Python versions.
Python
bsd-3-clause
playpauseandstop/Flask-And-Redis,playpauseandstop/Flask-And-Redis
--- +++ @@ -2,6 +2,7 @@ import os import re +import sys from distutils.core import setup @@ -9,8 +10,15 @@ DIRNAME = os.path.abspath(os.path.dirname(__file__)) rel = lambda *parts: os.path.abspath(os.path.join(DIRNAME, *parts)) -README = open(rel('README.rst')).read() -INIT_PY = open(rel('flask_redis.py'...
cb1b0b6c6bb3fb2f982f775ee831abf20916c020
setup.py
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from setuptools import setup from github_backup import __version__ def open_file(fname): return open(os.path.join(os.path.dirname(__file__), fname)) setup( name='github-backup', version=__version__, author='Jose Diaz-Gonzalez', author_emai...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from setuptools import setup from github_backup import __version__ def open_file(fname): return open(os.path.join(os.path.dirname(__file__), fname)) setup( name='github-backup', version=__version__, author='Jose Diaz-Gonzalez', author_emai...
Add support for python 3.7 and 3.8 in package classifiers
Add support for python 3.7 and 3.8 in package classifiers
Python
mit
josegonzalez/python-github-backup,josegonzalez/python-github-backup
--- +++ @@ -25,6 +25,8 @@ 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', ], description='backup a github...
169240f25757db371108af98163c81f7cc0e647b
setup.py
setup.py
from setuptools import setup, find_packages import sys, os version = '0.4.3' setup(name='twitter', version=version, description="An API and command-line toolset for Twitter (twitter.com)", long_description=open("./README", "r").read(), # Get strings from http://pypi.python.org/pypi?%3Aaction=l...
from setuptools import setup, find_packages import sys, os version = '0.4.4' setup(name='twitter', version=version, description="An API and command-line toolset for Twitter (twitter.com)", long_description=open("./README", "r").read(), # Get strings from http://pypi.python.org/pypi?%3Aaction=l...
Change dateutil to python-dateutil because some loser decided to rename it. (Thanks Leigh)
Change dateutil to python-dateutil because some loser decided to rename it. (Thanks Leigh) git-svn-id: 7187af8a85e68091b56e148623cc345c4eafc588@188 d723f978-dc38-0410-87ed-da353333cdcc
Python
mit
hugovk/twitter,adonoho/twitter,durden/frappy,jessamynsmith/twitter,tytek2012/twitter,Adai0808/twitter,sixohsix/twitter,miragshin/twitter
--- +++ @@ -1,7 +1,7 @@ from setuptools import setup, find_packages import sys, os -version = '0.4.3' +version = '0.4.4' setup(name='twitter', version=version, @@ -31,7 +31,7 @@ install_requires=[ # -*- Extra requirements: -*- "simplejson>=1.7.1", - "dateutil>=1.1",...
d1a784ec841f4f0fbe8945bf7a5f81e7c3952b93
plugin_handler.py
plugin_handler.py
# -*- coding: utf-8 -*- # Execute this file to see what plugins will be loaded. # Implementation leans to Lex Toumbourou's example: # https://lextoumbourou.com/blog/posts/dynamically-loading-modules-and-classes-in-python/ import os import pkgutil import sys from typing import List from venues.abstract_venue import ...
# -*- coding: utf-8 -*- # Execute this file to see what plugins will be loaded. # Implementation leans to Lex Toumbourou's example: # https://lextoumbourou.com/blog/posts/dynamically-loading-modules-and-classes-in-python/ import os import pkgutil import sys from typing import List from venues.abstract_venue import ...
Disable more plugins to make it work again.
Disable more plugins to make it work again. Will fix venues parsing later. Signed-off-by: Ville Valkonen <989b9f9979d21943697628c770235933300d59bc@gmail.com>
Python
isc
weezel/BandEventNotifier
--- +++ @@ -18,7 +18,7 @@ Read plugin directory and load found plugins. Variable "blocklist" can be used to exclude loading certain plugins. """ - blocklist = ["plugin_tiketti", "plugin_telakka"] + blocklist = ["plugin_tiketti", "plugin_telakka", "plugin_lutakko", "plugin_yotalo"] found_bloc...
6bb184afc3317ca28bcdf9f684de40f173a5a3e6
setup.py
setup.py
import os from setuptools import setup # Ensure that the ssdeep library is built, otherwise install will fail os.environ['BUILD_LIB'] = '1' setup( name="stoq", version="0.10.16", author="Marcus LaFerrera", author_email="marcus@punchcyber.com", description="A framework for simplifying analysis.", ...
import os from setuptools import setup # Ensure that the ssdeep library is built, otherwise install will fail os.environ['BUILD_LIB'] = '1' setup( name="stoq", version="0.10.16", author="Marcus LaFerrera", author_email="marcus@punchcyber.com", description="A framework for simplifying analysis.", ...
Remove libraries not required for most use cases
Remove libraries not required for most use cases
Python
apache-2.0
PUNCH-Cyber/stoq
--- +++ @@ -20,12 +20,9 @@ 'requests', 'python-magic', 'ssdeep', - 'lxml', 'yapsy', 'demjson', 'jinja2', - 'hydra', - ...
8c694c6ad022710a9b7de3b10650591278325267
setup.py
setup.py
#!/usr/bin/env python from codecs import open from setuptools import find_packages, setup with open('README.rst', 'r', 'utf-8') as f: readme = f.read() setup( name='django-latest-tweets', version='0.4.5', description='Latest Tweets for Django', long_description=readme, url='https://github.c...
#!/usr/bin/env python from codecs import open from setuptools import find_packages, setup with open('README.rst', 'r', 'utf-8') as f: readme = f.read() setup( name='django-latest-tweets', version='0.4.5', description='Latest Tweets for Django', long_description=readme, url='https://github.c...
Add support for Python 3.7 and Django 2.2
Add support for Python 3.7 and Django 2.2
Python
bsd-3-clause
blancltd/django-latest-tweets
--- +++ @@ -28,6 +28,7 @@ 'Framework :: Django', 'Framework :: Django :: 1.8', 'Framework :: Django :: 1.11', + 'Framework :: Django :: 2.2', 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python', @...
e5dd1f4cbbc76842ac7a95e9fe878631460ee020
setup.py
setup.py
from setuptools import setup, find_packages from pypandoc import convert def convert_markdown_to_rst(file): return convert(file, 'rst') setup(name='gitlabform', version='1.0.1', description='Easy configuration as code tool for GitLab using config in plain YAML', long_description=convert_mark...
from setuptools import setup, find_packages from pypandoc import convert def convert_markdown_to_rst(file): return convert(file, 'rst') setup(name='gitlabform', version='1.0.2', description='Easy configuration as code tool for GitLab using config in plain YAML', long_description=convert_mark...
Update requests to fix security issue
Update requests to fix security issue
Python
mit
egnyte/gitlabform,egnyte/gitlabform
--- +++ @@ -7,7 +7,7 @@ setup(name='gitlabform', - version='1.0.1', + version='1.0.2', description='Easy configuration as code tool for GitLab using config in plain YAML', long_description=convert_markdown_to_rst('README.md'), url='https://github.com/egnyte/gitlabform', @@ -25,7 +2...
b36f2518666572ccd3b98dd88536533e17a39e3f
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup setup(name='SpaceScout-Server', version='1.0', description='REST Backend for SpaceScout', install_requires=[ 'Django>=1.7,<1.8', 'mock<=1.0.1', 'oauth2<=1.5.211', ...
#!/usr/bin/env python from distutils.core import setup setup(name='SpaceScout-Server', version='1.0', description='REST Backend for SpaceScout', install_requires=[ 'Django>=1.7,<1.8', 'mock<=1.0.1', 'oauth2<=1.5.211', ...
Remove oauth_provider as that's the eggname for django-oauth-plus.
Remove oauth_provider as that's the eggname for django-oauth-plus.
Python
apache-2.0
uw-it-aca/spotseeker_server,uw-it-aca/spotseeker_server,uw-it-aca/spotseeker_server
--- +++ @@ -9,7 +9,6 @@ 'Django>=1.7,<1.8', 'mock<=1.0.1', 'oauth2<=1.5.211', - 'oauth_provider', 'Pillow', 'pyproj', 'pytz',
993b8b23d70b133528a52bc91292735bb5668abe
setup.py
setup.py
from setuptools import setup, find_packages setup( name='zeit.care', version='0.2dev', author='Christian Zagrodnick, Ron Drongowski, Dominik Hoppe', author_email='cz@gocept.com', url='http://trac.gocept.com/zeit', description="""\ """, packages=find_packages('src'), package_dir = {'': '...
from setuptools import setup, find_packages setup( name='zeit.care', version='0.2dev', author='Christian Zagrodnick, Ron Drongowski, Dominik Hoppe', author_email='cz@gocept.com', url='http://trac.gocept.com/zeit', description="""\ """, packages=find_packages('src'), package_dir = {'': '...
Rename commentthreadwriter to commentthreadworker since it does not write anything...
Rename commentthreadwriter to commentthreadworker since it does not write anything...
Python
bsd-3-clause
ZeitOnline/zeit.care
--- +++ @@ -25,6 +25,6 @@ divisor = zeit.care.divisor:main boxinjector = zeit.care.boxinjector:main ressortindexwriter = zeit.care.ressortindex:main - commentthreadwriter = zeit.care.commentthread:main + commentthreadworker = zeit.care.commentthread:main """ )
e30a87841eb00d496d1980b025e2b2458eeaa101
setup.py
setup.py
from setuptools import setup, Extension import numpy setup (name = 'xfel', \ version = '1.0', \ packages = ['xfel', 'xfel.core', 'xfel.orientaton', 'xfel.sampling', 'xfel.test', ], package_dir = {'xfel...
from setuptools import setup, Extension import numpy setup (name = 'bxfel', \ version = '1.0', \ packages = ['bxfel', 'bxfel.core', 'bxfel.orientation', 'bxfel.sampling', 'bxfel.test', ], package_dir =...
Include data files in pacakge
Include data files in pacakge
Python
mit
mmechelke/bayesian_xfel,mmechelke/bayesian_xfel
--- +++ @@ -1,15 +1,20 @@ from setuptools import setup, Extension import numpy -setup (name = 'xfel', \ +setup (name = 'bxfel', \ version = '1.0', \ - packages = ['xfel', - 'xfel.core', - 'xfel.orientaton', - 'xfel.sampling', - ...
11a1ce43d2246574c5b4090252cb6464385194f4
setup.py
setup.py
from setuptools import setup, find_packages setup( name='jmbo-skeleton', version='0.6', description='Create a Jmbo project environment quickly. Includes a Jmbo demo application.', long_description = open('README.rst', 'r').read() + open('AUTHORS.rst', 'r').read() + open('CHANGELOG.rst', 'r').read(), ...
from setuptools import setup, find_packages setup( name='jmbo-skeleton', version='0.6', description='Create a Jmbo project environment quickly. Includes a Jmbo demo application.', long_description = open('README.rst', 'r').read() + open('AUTHORS.rst', 'r').read() + open('CHANGELOG.rst', 'r').read(), ...
Use an older raven until our Sentry is upgraded to 5.1
Use an older raven until our Sentry is upgraded to 5.1
Python
bsd-3-clause
praekelt/jmbo-skeleton,praekelt/jmbo-skeleton,praekelt/jmbo-skeleton
--- +++ @@ -12,7 +12,7 @@ packages = find_packages(), install_requires = [ 'jmbo-foundry>=1.1.1', - 'raven', + 'raven<3.0.0', ], include_package_data=True, tests_require=[
38ccfb87ba7f6f139dbb99ba5002a8abec8c40be
setup.py
setup.py
from setuptools import setup setup( name = "wsgi-sslify", description = "WSGI middleware to force HTTPS.", version = "1.0.1", author = "Jacob Kaplan-Moss", author_email = "jacob@jacobian.org", url = "https://github.com/jacobian/wsgi-sslify", py_modules = ['wsgi_sslify'], install_require...
from setuptools import setup setup( name = "wsgi-sslify", description = "WSGI middleware to force HTTPS.", version = "1.0.1", author = "Jacob Kaplan-Moss", author_email = "jacob@jacobian.org", url = "https://github.com/jacobian/wsgi-sslify", py_modules = ['wsgi_sslify'], install_require...
Add PyPI classifiers for Python 3.4, 3.5 and 3.6
Add PyPI classifiers for Python 3.4, 3.5 and 3.6 Since the tests pass on Python 3.
Python
bsd-3-clause
jacobian/wsgi-sslify
--- +++ @@ -16,6 +16,9 @@ 'Intended Audience :: System Administrators', 'License :: OSI Approved :: BSD License', 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Py...
8d5e1aaf0a06eeeacafcf62a58f83a4c23fc59b7
comet/handler/test/test_spawn.py
comet/handler/test/test_spawn.py
import os import sys import tempfile from twisted.trial import unittest from twisted.python import util from comet.icomet import IHandler from comet.handler import SpawnCommand SHELL = '/bin/sh' class DummyEvent(object): def __init__(self, text=None): self.text = text or u"" class SpawnCommandProtocolT...
import os import sys import tempfile from twisted.trial import unittest from twisted.python import util from comet.icomet import IHandler from comet.handler import SpawnCommand SHELL = '/bin/sh' class DummyEvent(object): def __init__(self, text=None): self.text = text or u"" class SpawnCommandProtocolT...
Convert read data to unicode.
Convert read data to unicode. The NamedTemporaryFile is in binary mode by default, so the read returns raw bytes.
Python
bsd-2-clause
jdswinbank/Comet,jdswinbank/Comet
--- +++ @@ -31,11 +31,13 @@ def test_write_data(self): if not os.access(SHELL, os.X_OK): raise unittest.SkipTest("Shell not available") - TEXT = "Test spawn process" + TEXT = u"Test spawn process" output_file = tempfile.NamedTemporaryFile() def read_data(resu...
0261c895cb41f5caba42ae432b997fd3c941e96f
tests.py
tests.py
import pytest import cleaner class TestTagRemoval(): def test_span_removal(self): text = ('<span style="font-family: &quot;helvetica neue&quot; ,' '&quot;arial&quot; , &quot;helvetica&quot; , sans-serif;">This is some' ' dummy text lalalala</span> This is some more dummy text ' '<sp...
import pytest import cleaner class TestTagTools(): def test_get_pure_tag(self): tag1 = '<div>' tag2 = '</div>' tag3 = '<pre class="prettyprint">' assert cleaner.get_pure_tag(tag1) == '<div>' assert cleaner.get_pure_tag(tag2) == '</div>' assert cleaner.get_pure_tag(t...
Add test for getting pure html tag
Add test for getting pure html tag
Python
mit
jamalmoir/blogger_html_cleaner
--- +++ @@ -1,16 +1,12 @@ import pytest import cleaner -class TestTagRemoval(): - def test_span_removal(self): - text = ('<span style="font-family: &quot;helvetica neue&quot; ,' - '&quot;arial&quot; , &quot;helvetica&quot; , sans-serif;">This is some' - ' dummy text lalalala</span> This is...
d5de8224a0d67b74444a0ad7c755e3c7bc1c39a5
features.py
features.py
""" Define all features to be extracted from the data """ from PIL import Image from PIL.ImageStat import Stat from skimage.feature import local_binary_pattern class BaseFeatureExtractor(object): """ Basis for all feature extractors """ def extract(self, data): """ Return list of feature values ...
""" Define all features to be extracted from the data """ import numpy as np from PIL import Image from PIL.ImageStat import Stat from skimage.feature import local_binary_pattern class BaseFeatureExtractor(object): """ Basis for all feature extractors """ def extract(self, data): """ Return lis...
Use histogram of local binary patterns
Use histogram of local binary patterns
Python
mit
kpj/PyClass
--- +++ @@ -1,6 +1,8 @@ """ Define all features to be extracted from the data """ + +import numpy as np from PIL import Image from PIL.ImageStat import Stat @@ -35,10 +37,21 @@ """ def extract(self, img_path): image = Image.open(img_path) - assert image.size > (500, 500), 'Image must ...
a20ffb81801a5f96af47ccf4bf7fe0133e74102b
source/views.py
source/views.py
from rest_framework.views import APIView from rest_framework.response import Response class EnumView(APIView): permission_classes = [] def get(self, *args, **kwargs): enums = self.enum_class.get_as_tuple_list() context = [] for enum in enums: _id = enum[1] i18...
from rest_framework.views import APIView from rest_framework.response import Response class EnumView(APIView): permission_classes = [] fields = ('i18n', ) def get(self, *args, **kwargs): enums = self.enum_class.get_as_tuple_list() context = [] for enum in enums: _id =...
Add possibility to set fields
Add possibility to set fields
Python
mit
iktw/django-rest-enum-view
--- +++ @@ -4,18 +4,19 @@ class EnumView(APIView): permission_classes = [] + fields = ('i18n', ) def get(self, *args, **kwargs): enums = self.enum_class.get_as_tuple_list() + context = [] - context = [] for enum in enums: _id = enum[1] - i18n...
2314829d58b200570272332c89a85b4009a396bf
tests/common.py
tests/common.py
from pprint import pprint, pformat import datetime import os from sgmock import Fixture from sgmock import TestCase if 'USE_SHOTGUN' in os.environ: from shotgun_api3 import ShotgunError, Fault import shotgun_api3_registry def Shotgun(): return shotgun_api3_registry.connect('sgsession.tests', serve...
from pprint import pprint, pformat import datetime import os from sgmock import Fixture from sgmock import TestCase _shotgun_server = os.environ.get('SHOTGUN', 'mock') if _shotgun_server == 'mock': from sgmock import Shotgun, ShotgunError, Fault else: from shotgun_api3 import ShotgunError, Fault import sh...
Change detection of Shotgun server for tests
Change detection of Shotgun server for tests
Python
bsd-3-clause
westernx/sgsession
--- +++ @@ -5,13 +5,14 @@ from sgmock import Fixture from sgmock import TestCase -if 'USE_SHOTGUN' in os.environ: +_shotgun_server = os.environ.get('SHOTGUN', 'mock') +if _shotgun_server == 'mock': + from sgmock import Shotgun, ShotgunError, Fault +else: from shotgun_api3 import ShotgunError, Fault i...
cb966e6623306ce4dfd96a5a286482489e28b9e9
pyclient/lockd.py
pyclient/lockd.py
# lockd client import httplib import json class LockdClient(object): def __init__(self, host="127.0.0.1", port=2080): self._host_port = "%s:%s" % (host, port) def is_locked(self, name): return self._lockish("GET", name, 404) def lock(self, name): return self._lockish("POST", nam...
# lockd client import httplib import json class LockdClient(object): def __init__(self, host="127.0.0.1", port=2080): self._host_port = "%s:%s" % (host, port) def is_locked(self, name): return self._lockish("GET", name, 404) def lock(self, name): return self._lockish("POST", nam...
Fix bug in python client
Fix bug in python client
Python
mit
divtxt/lockd,divtxt/lockd
--- +++ @@ -33,5 +33,5 @@ elif status == false_code: return False else: - msg = "Unexpected response: %s %s; data: %s" % (status, response.reason, data) + msg = "Unexpected response: %s %s" % (status, response.reason) raise Exception(msg)
c6e69e1cec4de30a2e56ec865c3043edc7bf39b5
civictechprojects/apps.py
civictechprojects/apps.py
from django.apps import AppConfig class CivictechprojectsConfig(AppConfig): name = 'civictechprojects' def ready(self): # Remove any tags that aren't in the canonical tag list # TODO: Fix so this doesn't break in production database # from .models import Project # Project.remo...
from django.apps import AppConfig class CivictechprojectsConfig(AppConfig): name = 'civictechprojects' # def ready(self): # Remove any tags that aren't in the canonical tag list # TODO: Fix so this doesn't break in production database # from .models import Project # Project.re...
Comment out entire function to stop unexpected EOF effor
Comment out entire function to stop unexpected EOF effor
Python
mit
DemocracyLab/CivicTechExchange,DemocracyLab/CivicTechExchange,DemocracyLab/CivicTechExchange,DemocracyLab/CivicTechExchange
--- +++ @@ -4,8 +4,9 @@ class CivictechprojectsConfig(AppConfig): name = 'civictechprojects' - def ready(self): + # def ready(self): # Remove any tags that aren't in the canonical tag list # TODO: Fix so this doesn't break in production database # from .models import Project ...
fbf6fe6d6e5e3b9e9ea192eba7ef6b76b66ebf0a
trade_client.py
trade_client.py
import json import socket from orderbook import create_confirm def send_msg(ip, port, message): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((ip, port)) try: sock.sendall(message) response = sock.recv(1024) print "Received: {}".format(response) finall...
import json import socket from orderbook import create_confirm def send_msg(ip, port, message): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((ip, port)) try: sock.sendall(message) response = sock.recv(1024) finally: sock.close() return response ...
Handle incoming messages that aren't JSON objects.
Handle incoming messages that aren't JSON objects.
Python
mit
Tribler/decentral-market
--- +++ @@ -11,7 +11,6 @@ try: sock.sendall(message) response = sock.recv(1024) - print "Received: {}".format(response) finally: sock.close() return response @@ -23,11 +22,14 @@ def handle_response(response): - response = json.loads(response) - if response: ...
07de3a41daf1a82cb45e63472212821b9f6c809f
panoptes/state_machine/states/core.py
panoptes/state_machine/states/core.py
import time import transitions from panoptes.utils.logger import has_logger @has_logger class PanState(transitions.State): """ Base class for PANOPTES transitions """ def __init__(self, *args, **kwargs): name = kwargs.get('name', self.__class__) self.panoptes = kwargs.get('panoptes', None)...
import time import transitions from panoptes.utils.logger import has_logger @has_logger class PanState(transitions.State): """ Base class for PANOPTES transitions """ def __init__(self, *args, **kwargs): name = kwargs.get('name', self.__class__) self.panoptes = kwargs.get('panoptes', None)...
Add loop to sleep structur
Add loop to sleep structur
Python
mit
joshwalawender/POCS,panoptes/POCS,AstroHuntsman/POCS,AstroHuntsman/POCS,AstroHuntsman/POCS,AstroHuntsman/POCS,panoptes/POCS,panoptes/POCS,joshwalawender/POCS,panoptes/POCS,joshwalawender/POCS
--- +++ @@ -25,11 +25,27 @@ return 'exit' def sleep(self, seconds=None): - """ sleep for `seconds` or `_sleep_delay` seconds """ + """ sleep for `seconds` or `_sleep_delay` seconds + + This puts the state into a loop that is responsive to outside messages. + + Args: + ...
a8179d06885d72e49335263ef2633f3128a20ee7
tests/logging.py
tests/logging.py
import os from datetime import datetime def save_logs(groomer, test_description): divider = ('=' * 10 + '{}' + '=' * 10 + '\n') test_log_path = 'tests/test_logs/{}.log'.format(test_description) with open(test_log_path, 'w+') as test_log: test_log.write(divider.format('TEST LOG')) test_log....
import os from datetime import datetime def save_logs(groomer, test_description): divider = ('=' * 10 + '{}' + '=' * 10 + '\n') test_log_path = 'tests/test_logs/{}.log'.format(test_description) with open(test_log_path, 'w+') as test_log: test_log.write(divider.format('TEST LOG')) test_log....
Read test logs in bytes mode
Read test logs in bytes mode
Python
bsd-3-clause
CIRCL/PyCIRCLean,Rafiot/PyCIRCLean,CIRCL/PyCIRCLean,Rafiot/PyCIRCLean
--- +++ @@ -10,16 +10,16 @@ test_log.write(str(datetime.now().time()) + '\n') test_log.write(test_description + '\n') test_log.write('-' * 20 + '\n') - with open(groomer.logger.log_path, 'r') as logfile: + with open(groomer.logger.log_path, 'rb') as logfile: log =...
523df3d68af5c8fbd52e0f86a7201d9c39f50f54
lib/writeFiles.py
lib/writeFiles.py
import json import sys import os f = open(sys.argv[1]) out = sys.argv[2] data = json.load(f) for key in data["files"]: val = data["files"][key] try: os.makedirs(out + "/" + os.path.dirname(key)) except: print "ignoring error" if type(val) == str or type(val) == unicode: pr...
import json import sys import os f = open(sys.argv[1]) out = sys.argv[2] data = json.load(f) for key in data["files"]: val = data["files"][key] try: os.makedirs(out + "/" + os.path.dirname(key)) except: print "ignoring error" if type(val) == str or type(val) == unicode: print ...
Fix errors when contents of a file contains UTF-8 chars.
Fix errors when contents of a file contains UTF-8 chars. - Convert tabs to spaces. - Use a more pythonic way to open (and write into) the file. - Add UTF-8 encoding before writing the contents of the file.
Python
mit
sheenobu/nix-home,sheenobu/nix-home
--- +++ @@ -7,18 +7,18 @@ data = json.load(f) for key in data["files"]: - val = data["files"][key] - try: - os.makedirs(out + "/" + os.path.dirname(key)) - except: - print "ignoring error" + val = data["files"][key] + try: + os.makedirs(out + "/" + os.path.dirname(...
da2376744ec5b1823ea75f3cefbb0de0ac000c1b
tests/secrets.py
tests/secrets.py
# -*- coding: utf-8 -*- import os from dotenv import load_dotenv, find_dotenv load_dotenv(find_dotenv()) OPS_KEY = os.environ['OPS_KEY'] OPS_SECRET = os.environ['OPS_SECRET']
# -*- coding: utf-8 -*- import os from dotenv import load_dotenv, find_dotenv load_dotenv(find_dotenv()) OPS_KEY = os.environ['OPS_KEY'] OPS_SECRET = os.environ['OPS_SECRET'] TWITTER_CONSUMER_ACCESS = os.environ['TWITTER_CONSUMER_ACCESS'] TWITTER_CONSUMER_SECRET = os.environ['TWITTER_CONSUMER_SECRET'] TWITTER_ACCESS ...
Read twitter tokens from .env
Read twitter tokens from .env
Python
mit
nestauk/inet
--- +++ @@ -6,3 +6,7 @@ load_dotenv(find_dotenv()) OPS_KEY = os.environ['OPS_KEY'] OPS_SECRET = os.environ['OPS_SECRET'] +TWITTER_CONSUMER_ACCESS = os.environ['TWITTER_CONSUMER_ACCESS'] +TWITTER_CONSUMER_SECRET = os.environ['TWITTER_CONSUMER_SECRET'] +TWITTER_ACCESS = os.environ['TWITTER_ACCESS'] +TWITTER_SECRET =...
53be5c9c86d544567f8171baba58128b5ad0502a
tests/test_io.py
tests/test_io.py
import nonstdlib def test_capture_output(): import sys with nonstdlib.capture_output() as output: print('std', end='', file=sys.stdout) print('st', end='', file=sys.stderr) print('out', file=sys.stdout) print('derr', file=sys.stderr) assert 'stdout' in output assert 's...
#!/usr/bin/env python from __future__ import division from __future__ import print_function from __future__ import unicode_literals import nonstdlib def test_capture_output(): import sys with nonstdlib.capture_output() as output: print('std', end='', file=sys.stdout) print('st', end='', file...
Make the tests compatible with python2.
Make the tests compatible with python2.
Python
mit
kalekundert/nonstdlib,KenKundert/nonstdlib,KenKundert/nonstdlib,kalekundert/nonstdlib
--- +++ @@ -1,3 +1,9 @@ +#!/usr/bin/env python + +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + import nonstdlib def test_capture_output():
8bf8101bc755628e66da95734d30fe24e5d9a121
test/__init__.py
test/__init__.py
from kitten import db class MockDatabaseMixin(object): def setup_method(self, method): db.Base.metadata.create_all(db.engine) self.session = db.Session() def teardown_method(self, method): self.session.close() db.Base.metadata.drop_all(db.engine)
Add database helpers to test base
Add database helpers to test base
Python
mit
thiderman/network-kitten
--- +++ @@ -0,0 +1,11 @@ +from kitten import db + + +class MockDatabaseMixin(object): + def setup_method(self, method): + db.Base.metadata.create_all(db.engine) + self.session = db.Session() + + def teardown_method(self, method): + self.session.close() + db.Base.metadata.drop_all(db....
ee65b4ecd9a94598e1fa9fe2a8a25697c2480477
test/conftest.py
test/conftest.py
import pytest def pytest_addoption(parser): parser.addoption("--travis", action="store_true", default=False, help="Only run tests marked for Travis") def pytest_configure(config): config.addinivalue_line("markers", "not_travis: Mark a test that should not be ...
import pytest def pytest_addoption(parser): parser.addoption("--travis", action="store_true", default=False, help="Only run tests marked for Travis") def pytest_configure(config): config.addinivalue_line("markers", "not_travis: Mark a test that should not be ...
Clear caches in test item teardown
test: Clear caches in test item teardown Rather than relying on the user manually clearing the COFS function cache and linear problem cache, clear them in the teardown step of each test.
Python
mit
tkarna/cofs
--- +++ @@ -43,3 +43,10 @@ global progress_process if config.getoption("--travis") and progress_process is not None: progress_process.terminate() + + +def pytest_runtest_teardown(item, nextitem): + """Clear COFS caches after running a test""" + from cofs.utility import linProblemCache, tmpFun...
bf961cf69386404b03d46ebc3ab34b7da804f016
test/test_ttt.py
test/test_ttt.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_ttt ---------------------------------- Tests for `ttt` module. """ import unittest from ttt import ttt class TestPat(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_000_something(self): pass ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_ttt ---------------------------------- Tests for `ttt` module. """ class Test: def setup(self): pass def teardown(self): pass def test_(self): pass
Use pytest instead of unittest
Use pytest instead of unittest
Python
isc
yerejm/ttt,yerejm/ttt
--- +++ @@ -8,23 +8,13 @@ Tests for `ttt` module. """ -import unittest - -from ttt import ttt - - -class TestPat(unittest.TestCase): - - def setUp(self): +class Test: + def setup(self): pass - def tearDown(self): + def teardown(self): pass - def test_000_something(self): + ...
43dce889a79b77445eebe0d0e15532b64e7728d5
tests/test_upbeatbot.py
tests/test_upbeatbot.py
import unittest from libs.upbeatbot import UpBeatBot class TestUpbeatBot(unittest.TestCase): @classmethod def setUpClass(cls): cls.upbeat_bot = UpBeatBot() def test_chosen_animal_returned(self): tweet = 'Hey @upbeatbot send me a dog!' animal = self.upbeat_bot._get_animal_from_mes...
import unittest from libs.upbeatbot import UpBeatBot class TestUpbeatBot(unittest.TestCase): @classmethod def setUpClass(cls): cls.upbeat_bot = UpBeatBot() def test_get_animal_from_message_chosen_animal_returned(self): tweet = 'Hey @upbeatbot send me a dog!' animal = self.upbeat_...
Use more descriptive unit test names
Use more descriptive unit test names
Python
mit
nickdibari/UpBeatBot
--- +++ @@ -8,20 +8,20 @@ def setUpClass(cls): cls.upbeat_bot = UpBeatBot() - def test_chosen_animal_returned(self): + def test_get_animal_from_message_chosen_animal_returned(self): tweet = 'Hey @upbeatbot send me a dog!' animal = self.upbeat_bot._get_animal_from_message(tweet)...
66fc59842fb85bb7b9d1434b7ba6d279c2f454df
tip/algorithms/sorting/mergesort.py
tip/algorithms/sorting/mergesort.py
def merge(a, b): if len(a) * len(b) == 0: return a + b v = (a[0] < b[0] and a or b).pop(0) return [v] + merge(a, b) def mergesort(list): if len(list) < 2: return list m = len(list) / 2 return merge(mergesort(list[:int(m)]), mergesort(list[int(m):]))
def merge(a, b): if len(a) * len(b) == 0: return a + b v = (a[0] < b[0] and a or b).pop(0) return [v]+ merge(a, b) def mergesort(list): if len(list) < 2: return list m = len(list) / 2 return merge(mergesort(list[:int(m)]), mergesort(list[int(m):]))
Add intended error to see flake8 report
Add intended error to see flake8 report
Python
unlicense
davidgasquez/tip
--- +++ @@ -3,7 +3,7 @@ return a + b v = (a[0] < b[0] and a or b).pop(0) - return [v] + merge(a, b) + return [v]+ merge(a, b) def mergesort(list):
12b313ed0be7049335046a00844c378b0bed7064
helpernmap.py
helpernmap.py
import nmap class HelperNmap: def __init__(self,args=""): self.args = args def process(self): print "Running Scan" nm = nmap.PortScanner() nm.scan(hosts='173.255.243.189', arguments='-sV -p1-5000') for host in nm.all_hosts(): print('----------------------------------------------------')...
import nmap class HelperNmap: def __init__(self,args=""): self.args = args def process(self): if self.__setParams(): print "Running Scan" nm = nmap.PortScanner() nm.scan(hosts=str(self.args), arguments='-sV -p1-5000') for host in nm.all_hosts(): print('--------------------...
Add network target as a params
Add network target as a params Signed-off-by: Jacobo Tibaquira <d8d2a0ed36dd5f2e41c721fffbe8af2e7e4fe993@gmail.com>
Python
apache-2.0
JKO/nsearch,JKO/nsearch
--- +++ @@ -6,18 +6,30 @@ self.args = args def process(self): - print "Running Scan" - nm = nmap.PortScanner() - nm.scan(hosts='173.255.243.189', arguments='-sV -p1-5000') - for host in nm.all_hosts(): - print('----------------------------------------------------') - print('Host : %s (...
2dc031aca46c02449eb85ee5149b75951e26e3b9
deferrable/backend/sqs.py
deferrable/backend/sqs.py
from .base import BackendFactory, Backend from ..queue.sqs import SQSQueue class SQSBackendFactory(BackendFactory): def __init__(self, sqs_connection_thunk, visibility_timeout=30, wait_time=10): """To allow backends to be initialized lazily, this factory requires a thunk (parameter-less closure) wh...
from .base import BackendFactory, Backend from ..queue.sqs import SQSQueue class SQSBackendFactory(BackendFactory): def __init__(self, sqs_connection_thunk, visibility_timeout=30, wait_time=10, name_suffix=None): """To allow backends to be initialized lazily, this factory requires a thunk (paramete...
Add naming suffix option for SQS backends
Add naming suffix option for SQS backends
Python
mit
gamechanger/deferrable
--- +++ @@ -2,7 +2,7 @@ from ..queue.sqs import SQSQueue class SQSBackendFactory(BackendFactory): - def __init__(self, sqs_connection_thunk, visibility_timeout=30, wait_time=10): + def __init__(self, sqs_connection_thunk, visibility_timeout=30, wait_time=10, name_suffix=None): """To allow backends ...
5da99ceeeec050b2732475ffca89a64d2d10f34e
trainTweet.py
trainTweet.py
#!/usr/bin/env python import subprocess import argparse parser = argparse.ArgumentParser(description="Tweet some Train Statuses!") parser.add_argument("-s", "--station", dest="station", type=str, help="Station Short Code. Ex: 'SLM'") parser.add_argument("-t", "--train", dest="train", type=int, help="Train Number. Ex:...
#!/usr/bin/env python import subprocess import argparse import os parser = argparse.ArgumentParser(description="Tweet some Train Statuses!") parser.add_argument("-s", "--station", dest="station", type=str, help="Station Short Code. Ex: 'SLM'") parser.add_argument("-t", "--train", dest="train", type=int, help="Train N...
Use full paths & print our current command fully
Use full paths & print our current command fully
Python
mit
dmiedema/train-500-status
--- +++ @@ -2,6 +2,7 @@ import subprocess import argparse +import os parser = argparse.ArgumentParser(description="Tweet some Train Statuses!") parser.add_argument("-s", "--station", dest="station", type=str, help="Station Short Code. Ex: 'SLM'") @@ -14,11 +15,12 @@ def main(): def run_command(cmd_arr...
605340f9c18f1591846e0a9b5f9c983c940d80c9
tests/models/test_repository.py
tests/models/test_repository.py
from nose.tools import eq_ from mock import MagicMock, patch from pyolite.models.repository import Repository class TestRepositoryModel(object): def test_it_should_be_possible_to_retrieve_by_name_a_repo(self): mocked_users = MagicMock() mocked_file = MagicMock() mocked_dir = MagicMock() mocked_path...
from nose.tools import eq_ from mock import MagicMock, patch from pyolite.models.repository import Repository class TestRepositoryModel(object): def test_it_should_be_possible_to_retrieve_by_name_a_repo(self): mocked_users = MagicMock() mocked_file = MagicMock() mocked_dir = MagicMock() mocked_path...
Test if we look after a non-existing repo
Test if we look after a non-existing repo
Python
bsd-2-clause
PressLabs/pyolite,shawkinsl/pyolite
--- +++ @@ -26,3 +26,18 @@ eq_(repo.path, 'simple_path') eq_(repo.git, 'git') eq_(repo.users, mocked_users) + + def test_if_we_find_only_directories_should_return_none(self): + mocked_users = MagicMock() + mocked_dir = MagicMock() + mocked_path = MagicMock() + + mocked_dir.isdir.retu...
09dad7d36c6968fc50cf8f2c475608a66bd6571a
plugins/expand.py
plugins/expand.py
# -*- coding: utf-8 -*- # # This file is part of tofbot, a friendly IRC bot. # You may redistribute it under the Simplified BSD License. # If we meet some day, and you think this stuff is worth it, # you can buy us a beer in return. # # Copyright (c) 2012 Etienne Millon <etienne.millon@gmail.com> from BeautifulSoup im...
# -*- coding: utf-8 -*- # # This file is part of tofbot, a friendly IRC bot. # You may redistribute it under the Simplified BSD License. # If we meet some day, and you think this stuff is worth it, # you can buy us a beer in return. # # Copyright (c) 2012 Etienne Millon <etienne.millon@gmail.com> from BeautifulSoup im...
Add tinyurl.com as a minifier
Add tinyurl.com as a minifier
Python
bsd-2-clause
p0nce/tofbot,tofbot/tofbot,chmduquesne/tofbot,p0nce/tofbot,soulaklabs/tofbot,tofbot/tofbot,martinkirch/tofbot,martinkirch/tofbot,soulaklabs/tofbot
--- +++ @@ -14,6 +14,7 @@ from toflib import Plugin DOMAINS = [ "t.co/" + , "tinyurl.com/" ] VIDEO_DOMAINS = [ "youtube"
66bc3ca0f9bd0e2b20d772e694c819b937a0c346
pogom/pokeller.py
pogom/pokeller.py
# -*- coding: utf-8 -*- import logging import time from threading import Thread from .models import Pokemon log = logging.getLogger(__name__) log.setLevel(level=10) class PokePoller(Thread): def __init__(self): Thread.__init__(self) self.daemon = True self.name = 'pokemon_poller' ...
# -*- coding: utf-8 -*- import logging import time from threading import Thread from .models import Pokemon log = logging.getLogger(__name__) log.setLevel(level=10) class PokePoller(Thread): def __init__(self): Thread.__init__(self) self.daemon = True self.name = 'pokemon_poller' ...
Add a debug message to find an unexpected error
Add a debug message to find an unexpected error
Python
mit
falau/pogom,falau/pogom,falau/pogom
--- +++ @@ -21,4 +21,7 @@ def run(self): while True: time.sleep(10) - self.notify(Pokemon.get_active()) + try: + self.notify(Pokemon.get_active()) + except Exception as e: + log.debug(e)
34e211c2cc3021be7497eb48e68f557c56a2a1ea
django_assets/__init__.py
django_assets/__init__.py
__version__ = (0, 2) # Make a couple frequently used things available right here. from bundle import Bundle from registry import register
__version__ = (0, 3, 'dev') # Make a couple frequently used things available right here. from bundle import Bundle from registry import register
Increment to next dev version.
Increment to next dev version.
Python
bsd-2-clause
scorphus/webassets,wijerasa/webassets,heynemann/webassets,wijerasa/webassets,heynemann/webassets,florianjacob/webassets,john2x/webassets,JDeuce/webassets,scorphus/webassets,glorpen/webassets,aconrad/webassets,JDeuce/webassets,aconrad/webassets,john2x/webassets,florianjacob/webassets,glorpen/webassets,glorpen/webassets,...
--- +++ @@ -1,4 +1,4 @@ -__version__ = (0, 2) +__version__ = (0, 3, 'dev') # Make a couple frequently used things available right here.
1c1ca68a41e56cb912a9ec9f81ab974324f9d2f4
tests/test_filter_refs_prefs.py
tests/test_filter_refs_prefs.py
# tests.test_filter_refs_prefs # coding=utf-8 from __future__ import unicode_literals import nose.tools as nose import yvs.filter_refs as yvs from tests.decorators import use_prefs @use_prefs({'language': 'en', 'version': 59}) def test_version_persistence(): """should remember version preferences""" results ...
# tests.test_filter_refs_prefs # coding=utf-8 from __future__ import unicode_literals import os.path import nose.tools as nose import yvs.filter_refs as yvs from tests.decorators import use_prefs @use_prefs({'language': 'en', 'version': 59}) def test_version_persistence(): """should remember version preferences"...
Add test for silent fail when creating Alfred data dir
Add test for silent fail when creating Alfred data dir
Python
mit
caleb531/youversion-suggest,caleb531/youversion-suggest
--- +++ @@ -2,6 +2,7 @@ # coding=utf-8 from __future__ import unicode_literals +import os.path import nose.tools as nose import yvs.filter_refs as yvs from tests.decorators import use_prefs @@ -21,3 +22,10 @@ results = yvs.get_result_list('gá 4') nose.assert_equal(len(results), 1) nose.assert_eq...
72bc4597e172a5c276057c543998337038ef15f5
projects/views.py
projects/views.py
# This file is part of the FragDev Website. # # the FragDev Website is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # the FragDev W...
# This file is part of the FragDev Website. # # the FragDev Website is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # the FragDev W...
Add missing include, and switch to exclude projects with HIDDEN status from public display
Add missing include, and switch to exclude projects with HIDDEN status from public display
Python
agpl-3.0
lo-windigo/fragdev,lo-windigo/fragdev
--- +++ @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with the FragDev Website. If not, see <http://www.gnu.org/licenses/>. -from django.http import Http404 +from django.http import Http404, HttpResponse from django.shortcuts import render from django.template im...
6798df4657730484549fdeaa13578c2d7e36f4eb
udiskie/automount.py
udiskie/automount.py
""" Udiskie automounter daemon. """ __all__ = ['AutoMounter'] class AutoMounter(object): """ Automatically mount newly added media. """ def __init__(self, mounter): self._mounter = mounter def device_added(self, udevice): self._mounter.add_device(udevice) def media_added(self,...
""" Udiskie automounter daemon. """ __all__ = ['AutoMounter'] class AutoMounter(object): """ Automatically mount newly added media. """ def __init__(self, mounter): self._mounter = mounter def device_added(self, udevice): self._mounter.add_device(udevice) def media_added(self,...
Add function in AutoMounter to handle mounting of LUKS-devices not opened by udiskie
Add function in AutoMounter to handle mounting of LUKS-devices not opened by udiskie
Python
mit
pstray/udiskie,coldfix/udiskie,coldfix/udiskie,mathstuf/udiskie,khardix/udiskie,pstray/udiskie
--- +++ @@ -16,3 +16,13 @@ def media_added(self, udevice): self._mounter.add_device(udevice) + def device_changed(self, old_state, new_state): + """ + Check whether is_external changed, then mount + """ + # fixes usecase: mount luks-cleartext when opened by + # no...
3a4b274d4a7e23911843250c73da2ab59cf6649c
tests/alerts/alert_test_case.py
tests/alerts/alert_test_case.py
import os.path import sys sys.path.append(os.path.join(os.path.dirname(__file__), "../../alerts")) from alert_test_suite import AlertTestSuite class AlertTestCase(object): def __init__(self, description, events=[], events_type='event', expected_alert=None): self.description = description # As a r...
import os.path import sys sys.path.append(os.path.join(os.path.dirname(__file__), "../../alerts")) from alert_test_suite import AlertTestSuite class AlertTestCase(object): def __init__(self, description, events=[], expected_alert=None): self.description = description # As a result of defining our...
Remove events_type from alert test case
Remove events_type from alert test case
Python
mpl-2.0
mpurzynski/MozDef,jeffbryner/MozDef,mozilla/MozDef,mpurzynski/MozDef,Phrozyn/MozDef,mpurzynski/MozDef,jeffbryner/MozDef,jeffbryner/MozDef,Phrozyn/MozDef,mpurzynski/MozDef,jeffbryner/MozDef,mozilla/MozDef,Phrozyn/MozDef,Phrozyn/MozDef,mozilla/MozDef,mozilla/MozDef
--- +++ @@ -6,14 +6,13 @@ class AlertTestCase(object): - def __init__(self, description, events=[], events_type='event', expected_alert=None): + def __init__(self, description, events=[], expected_alert=None): self.description = description # As a result of defining our test cases as clas...
ef56181a5c42ab6dc9283822a9a6214f0a97475f
yolk/__init__.py
yolk/__init__.py
"""yolk Author: Rob Cakebread <cakebread at gmail> License : BSD """ __version__ = '0.5.2'
"""yolk Author: Rob Cakebread <cakebread at gmail> License : BSD """ __version__ = '0.6'
Increment minor version to 0.6
Increment minor version to 0.6
Python
bsd-3-clause
myint/yolk,myint/yolk
--- +++ @@ -6,4 +6,4 @@ """ -__version__ = '0.5.2' +__version__ = '0.6'
4a75d2b12fdaea392e3cf74eb1335b93c8aacdbd
accounts/tests/test_models.py
accounts/tests/test_models.py
"""accounts app unittests for models """ from django.test import TestCase from django.contrib.auth import get_user_model TEST_EMAIL = 'newvisitor@example.com' class UserModelTest(TestCase): """Tests for passwordless user model. """ def test_user_valid_with_only_email(self): """Should not raise...
"""accounts app unittests for models """ from django.test import TestCase from django.contrib.auth import get_user_model USER = get_user_model() TEST_EMAIL = 'newvisitor@example.com' class UserModelTest(TestCase): """Tests for passwordless user model. """ def test_user_valid_with_only_email(self): ...
Tidy up UserModel unit test
Tidy up UserModel unit test
Python
mit
randomic/aniauth-tdd,randomic/aniauth-tdd
--- +++ @@ -5,6 +5,7 @@ from django.contrib.auth import get_user_model +USER = get_user_model() TEST_EMAIL = 'newvisitor@example.com' @@ -16,12 +17,12 @@ """Should not raise if the user model is happy with email only. """ - user = get_user_model()(email=TEST_EMAIL) + user =...
207871f4f057d88f67bad0c371f880664dcee062
pydirections/route_requester.py
pydirections/route_requester.py
""" This class holds all the necessary information required for a proposed route """ ACCEPTABLE_MODES = set(["driving", "walking", "bicycling", "transit"]) class DirectionsRequest(object): def __init__(self, mode="driving", **kwargs): self.mode = mode self.origin = kwargs['origin'] self.destination = kwarg...
""" This class holds all the necessary information required for a proposed route """ ACCEPTABLE_MODES = set(["driving", "walking", "bicycling", "transit"]) class DirectionsRequest(object): def __init__(self, **kwargs): self.mode = "driving" self.origin = kwargs['origin'] self.destination = kwargs['destinat...
Build custom route requester class
Build custom route requester class
Python
apache-2.0
apranav19/pydirections
--- +++ @@ -5,11 +5,12 @@ class DirectionsRequest(object): - def __init__(self, mode="driving", **kwargs): - self.mode = mode + def __init__(self, **kwargs): + self.mode = "driving" self.origin = kwargs['origin'] self.destination = kwargs['destination'] + def set_api_key(self, key): self.api_key ...
9c12e2d6890a32d93ea6b2a9ae6f000d46182377
ga/image/store.py
ga/image/store.py
# -*- coding: utf-8 -*- import StringIO import shortuuid from boto.s3.connection import S3Connection from ga import settings conn = S3Connection(settings.AWS_KEY, settings.AWS_SECRET) bucket = conn.get_bucket(settings.AWS_BUCKET) def upload_image_from_pil_image(image): output = StringIO.StringIO() image.s...
# -*- coding: utf-8 -*- import StringIO import shortuuid from boto.s3.connection import S3Connection from ga import settings def upload_image_from_pil_image(image): output = StringIO.StringIO() image.save(output, 'JPEG') output.name = 'file' return upload_image(output) def upload_image(stream): ...
Move S3 bucket connection into `upload_image`
Move S3 bucket connection into `upload_image`
Python
mit
alexmic/great-again,alexmic/great-again
--- +++ @@ -8,9 +8,6 @@ from ga import settings -conn = S3Connection(settings.AWS_KEY, settings.AWS_SECRET) -bucket = conn.get_bucket(settings.AWS_BUCKET) - def upload_image_from_pil_image(image): output = StringIO.StringIO() image.save(output, 'JPEG') @@ -19,9 +16,12 @@ def upload_image(stream):...
2293539766043db129dc32634cedced7377eb9fe
Lib/test/test_wave.py
Lib/test/test_wave.py
from test_support import TestFailed import os, tempfile import wave def check(t, msg=None): if not t: raise TestFailed, msg nchannels = 2 sampwidth = 2 framerate = 8000 nframes = 100 testfile = tempfile.mktemp() f = wave.open(testfile, 'w') f.setnchannels(nchannels) f.setsampwidth(sampwidth) f.setframer...
from test_support import TestFailed import os, tempfile import wave def check(t, msg=None): if not t: raise TestFailed, msg nchannels = 2 sampwidth = 2 framerate = 8000 nframes = 100 testfile = tempfile.mktemp() f = wave.open(testfile, 'wb') f.setnchannels(nchannels) f.setsampwidth(sampwidth) f.setframe...
Use binary mode to open "wave" files.
Use binary mode to open "wave" files.
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
--- +++ @@ -13,7 +13,7 @@ testfile = tempfile.mktemp() -f = wave.open(testfile, 'w') +f = wave.open(testfile, 'wb') f.setnchannels(nchannels) f.setsampwidth(sampwidth) f.setframerate(framerate) @@ -22,7 +22,7 @@ f.writeframes(output) f.close() -f = wave.open(testfile, 'r') +f = wave.open(testfile, 'rb') ...
1666f883e3f6a497971b484c9ba875df2f6693a2
test/testall.py
test/testall.py
#!/usr/bin/env python # This file is part of beets. # Copyright 2013, Adrian Sampson. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation th...
#!/usr/bin/env python # This file is part of beets. # Copyright 2013, Adrian Sampson. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation th...
Fix python namespaces for test runs
Fix python namespaces for test runs We need to make sure we don't use namespaced versions that are already installed on the system but rather use local version from current sources
Python
mit
SusannaMaria/beets,mathstuf/beets,mathstuf/beets,YetAnotherNerd/beets,lengtche/beets,LordSputnik/beets,shamangeorge/beets,ibmibmibm/beets,m-urban/beets,krig/beets,lightwang1/beets,shamangeorge/beets,MyTunesFreeMusic/privacy-policy,jcoady9/beets,SusannaMaria/beets,beetbox/beets,Andypsamp/CODfinalJUNIT,Andypsamp/CODfinal...
--- +++ @@ -24,6 +24,13 @@ sys.path.append(pkgpath) os.chdir(pkgpath) +# Make sure we use local version of beetsplug and not system namespaced version +# for tests +try: + del sys.modules["beetsplug"] +except KeyError: + pass + def suite(): s = unittest.TestSuite() # Get the suite() of every modu...
aa4a0b1640dab90a4867614f0d00cca99601e342
south/models.py
south/models.py
from django.db import models class MigrationHistory(models.Model): app_name = models.CharField(max_length=255) migration = models.CharField(max_length=255) applied = models.DateTimeField(blank=True) class Meta: unique_together = (('app_name', 'migration'),) @classmethod def for_migrat...
from django.db import models class MigrationHistory(models.Model): app_name = models.CharField(max_length=255) migration = models.CharField(max_length=255) applied = models.DateTimeField(blank=True) @classmethod def for_migration(cls, migration): try: return cls.objects.get(app...
Remove unique_together on the model; the key length was too long on wide-character MySQL installs.
Remove unique_together on the model; the key length was too long on wide-character MySQL installs.
Python
apache-2.0
theatlantic/django-south,theatlantic/django-south
--- +++ @@ -4,9 +4,6 @@ app_name = models.CharField(max_length=255) migration = models.CharField(max_length=255) applied = models.DateTimeField(blank=True) - - class Meta: - unique_together = (('app_name', 'migration'),) @classmethod def for_migration(cls, migration):
cfa77bed245d80d453f7b463ea35473bbc29cc50
toolkits/rdk.py
toolkits/rdk.py
import numpy as np from cinfony import rdk from cinfony.rdk import * class Fingerprint(rdk.Fingerprint): @property def raw(self): return np.array(self.fp, dtype=bool) rdk.Fingerprint = Fingerprint
import numpy as np from cinfony import rdk from cinfony.rdk import * class Fingerprint(rdk.Fingerprint): @property def raw(self): return np.array(self.fp, dtype=bool) rdk.Fingerprint = Fingerprint # Patch reader not to return None as molecules def _readfile(format, filename): for mol in r...
Patch readfile not to return mols
Patch readfile not to return mols
Python
bsd-3-clause
mwojcikowski/opendrugdiscovery
--- +++ @@ -8,3 +8,11 @@ return np.array(self.fp, dtype=bool) rdk.Fingerprint = Fingerprint + +# Patch reader not to return None as molecules +def _readfile(format, filename): + for mol in rdk.readfile(format, filename): + if mol is not None: + yield mol + +rdk.readfile = _rea...
e6c774c13a01f2cbe09947c39c1dac7b4989bebc
jason2/project.py
jason2/project.py
class Project(object): """Holds project configuration parameters, such as data directory.""" def __init__(self, data_directory): self.data_directory = data_directory
import ConfigParser class Project(object): """Holds project configuration parameters, such as data directory.""" @classmethod def from_config(cls, filename): config = ConfigParser.RawConfigParser() config.read(filename) return cls(config.get("data", "directory")) def __init__...
Add from_configfile method to Project
Add from_configfile method to Project
Python
mit
gadomski/jason2
--- +++ @@ -1,5 +1,14 @@ +import ConfigParser + + class Project(object): """Holds project configuration parameters, such as data directory.""" + @classmethod + def from_config(cls, filename): + config = ConfigParser.RawConfigParser() + config.read(filename) + return cls(config.get("...
1a90e2c7b9155f35ced7e8f51707a2d86ad3ca93
scripts/Driver.py
scripts/Driver.py
''' Created on Feb 20, 2013 @author: crisr ''' import xml.etree.ElementTree as ET import os from Simulation import Simulation debug = True if __name__ == '__main__': #open the XML try: inputFile = 'test.xml' #sys.argv[1] except: raise IOError ('input file not provided') workingDir = os.getcwd() if ...
''' Created on Feb 20, 2013 @author: crisr ''' import xml.etree.ElementTree as ET import os from Simulation import Simulation import sys debug = True if __name__ == '__main__': #open the XML try: if len(sys.argv) == 1: inputFile = 'test.xml' else: inputFile = sys.argv[1] except: raise ...
Allow different input files to be specified.
Allow different input files to be specified. r18478
Python
apache-2.0
joshua-cogliati-inl/raven,joshua-cogliati-inl/raven,joshua-cogliati-inl/raven,joshua-cogliati-inl/raven,joshua-cogliati-inl/raven,idaholab/raven,joshua-cogliati-inl/raven,idaholab/raven,idaholab/raven,idaholab/raven,idaholab/raven,idaholab/raven,idaholab/raven,joshua-cogliati-inl/raven
--- +++ @@ -6,13 +6,17 @@ import xml.etree.ElementTree as ET import os from Simulation import Simulation +import sys debug = True if __name__ == '__main__': #open the XML try: - inputFile = 'test.xml' #sys.argv[1] + if len(sys.argv) == 1: + inputFile = 'test.xml' + else: + inputFile...
686406781af00d93e4d70049499068037d72be74
geotrek/core/tests/test_forms.py
geotrek/core/tests/test_forms.py
from django.conf import settings from django.test import TestCase from unittest import skipIf from geotrek.core.factories import TrailFactory from geotrek.authent.factories import UserFactory from geotrek.core.forms import TrailForm @skipIf(not settings.TREKKING_TOPOLOGY_ENABLED, 'Test with dynamic segmentation onl...
from django.conf import settings from django.test import TestCase from unittest import skipIf from geotrek.core.factories import TrailFactory, PathFactory from geotrek.authent.factories import UserFactory from geotrek.core.forms import TrailForm, PathForm @skipIf(not settings.TREKKING_TOPOLOGY_ENABLED, 'Test with d...
Add tests for path overlapping check
Add tests for path overlapping check
Python
bsd-2-clause
GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek
--- +++ @@ -3,9 +3,9 @@ from unittest import skipIf -from geotrek.core.factories import TrailFactory +from geotrek.core.factories import TrailFactory, PathFactory from geotrek.authent.factories import UserFactory -from geotrek.core.forms import TrailForm +from geotrek.core.forms import TrailForm, PathForm ...
4b26066a6f3b666ec107621334ddbcceec6a819a
micro/read_code.py
micro/read_code.py
import fileinput def read_code(): return ''.join([line for line in fileinput.input()]) if __name__ == '__main__': code = read_code() print(code)
import fileinput def read_code(filename='-'): return ''.join([line for line in fileinput.input(filename)]) if __name__ == '__main__': import sys filename = sys.argv[1] if len(sys.argv) > 1 else '-' code = read_code(filename) print(code)
Correct a reading of a code
Correct a reading of a code
Python
mit
thewizardplusplus/micro,thewizardplusplus/micro,thewizardplusplus/micro
--- +++ @@ -1,8 +1,11 @@ import fileinput -def read_code(): - return ''.join([line for line in fileinput.input()]) +def read_code(filename='-'): + return ''.join([line for line in fileinput.input(filename)]) if __name__ == '__main__': - code = read_code() + import sys + + filename = sys.argv[1] i...
9be37b96450780b41f5a5443568ca41a18e06d22
lcapy/sequence.py
lcapy/sequence.py
"""This module handles sequences. Copyright 2020 Michael Hayes, UCECE """ from .expr import ExprList class Sequence(ExprList): def __init__(self, seq, n=None): super (Sequence, self).__init__(seq) # Save the indexes. Ideally, should annotate which item # in sequence corresponds to n ...
"""This module handles sequences. Copyright 2020 Michael Hayes, UCECE """ from .expr import ExprList class Sequence(ExprList): def __init__(self, seq, n=None): super (Sequence, self).__init__(seq) # Save the indexes. Ideally, should annotate which item # in sequence corresponds to n ...
Add pretty and latex for Sequence
Add pretty and latex for Sequence
Python
lgpl-2.1
mph-/lcapy
--- +++ @@ -19,12 +19,32 @@ def latex(self): items = [] - for v1, n1 in zip(self.n, self): - s = v.latex() + for v1, n1 in zip(self, self.n): + try: + s = v1.latex() + except: + s = str(v1) + if n1 ==...
4559e01646010e1ed260d77e612774778a0c1359
lib/rfk/site/forms/login.py
lib/rfk/site/forms/login.py
from wtforms import Form, SubmitField, BooleanField, TextField, SelectField, \ PasswordField, IntegerField, FieldList, FormField, validators class LoginForm(Form): username = TextField('Username', [validators.Required()]) password = PasswordField('Password', [validators.Required()]) remember = Boolean...
from wtforms import Form, SubmitField, BooleanField, TextField, SelectField, \ PasswordField, IntegerField, FieldList, FormField, validators class LoginForm(Form): username = TextField('Username', [validators.Required()]) password = PasswordField('Password', [validators.Required()]) remember = Boolean...
Make it clear that the E-Mail address is optional.
Make it clear that the E-Mail address is optional.
Python
bsd-3-clause
buckket/weltklang,buckket/weltklang,krautradio/PyRfK,krautradio/PyRfK,krautradio/PyRfK,buckket/weltklang,buckket/weltklang,krautradio/PyRfK
--- +++ @@ -18,7 +18,7 @@ validators.Length(min=5, message='Password too short.'), validators.EqualTo('password_retype', message='Passwords must match.')]) password_retype = PasswordField('Password (verification)', [validators....
3d9bf8afd912ccb0d1df72353a9c306c59773007
swf/exceptions.py
swf/exceptions.py
# -*- coding: utf-8 -*- # Copyright (c) 2013, Theo Crevon # Copyright (c) 2013, Greg Leclercq # # See the file LICENSE for copying permission. class SWFError(Exception): def __init__(self, message, raw_error, *args): Exception.__init__(self, message, *args) self.kind, self.details = raw_error.spli...
# -*- coding: utf-8 -*- # Copyright (c) 2013, Theo Crevon # Copyright (c) 2013, Greg Leclercq # # See the file LICENSE for copying permission. class SWFError(Exception): def __init__(self, message, raw_error, *args): Exception.__init__(self, message, *args) self.kind, self.details = raw_error.spli...
Update SWFError with a formatted type
Update SWFError with a formatted type
Python
mit
botify-labs/python-simple-workflow,botify-labs/python-simple-workflow
--- +++ @@ -9,6 +9,7 @@ def __init__(self, message, raw_error, *args): Exception.__init__(self, message, *args) self.kind, self.details = raw_error.split(':') + self.type_ = self.kind.lower().strip().replace(' ', '_') if self.kind else None def __repr__(self): msg = self....
458688aa3a1ce901b2ffcf64497965484cea4e53
temperature_db.py
temperature_db.py
#!/usr/bin/env python """Temperature into database""" import glob from time import sleep import urllib2 import urllib base_dir = '/sys/bus/w1/devices/' device_folder = glob.glob(base_dir + '28*')[0] device_file = device_folder + '/w1_slave' try: while True: lines = open(device_file, 'r').readlines() ...
#!/usr/bin/env python """Temperature into database""" import glob from time import sleep import urllib2 import urllib base_dir = '/sys/bus/w1/devices/' device_folder = glob.glob(base_dir + '28*')[0] device_file = device_folder + '/w1_slave' try: while True: lines = open(device_file, 'r').readlines() ...
Update the DB-inserting script for wifi.
Update the DB-inserting script for wifi.
Python
mit
zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie
--- +++ @@ -23,10 +23,10 @@ data['temperature'] = str(temp_f) data['room'] = '1' url_values = urllib.urlencode(data) - url = 'http://192.168.1.6/addtemperature' + url = 'http://192.168.1.4/addtemperature' full_url = url + '?' + url_values data = urllib2.urlop...