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
bb59028a3dab81139a83f9a0eb8a4c58b9c25829
sample_application/app.py
sample_application/app.py
import os from flask import Blueprint, Flask from flask import Flask, g from views import blueprint, Resources, UnixTime, PrintArg, ExampleApiUsage from flask.ext.restful import Api from client import Client def create_app(): api = Api(blueprint) api.add_resource(Resources, '/resources') api.add_resource(UnixTim...
import os from flask import Blueprint, Flask from flask import Flask, g from views import blueprint, Resources, UnixTime, PrintArg, ExampleApiUsage from flask.ext.restful import Api from client import Client def create_app(): api = Api(blueprint) api.add_resource(Resources, '/resources') api.add_resource(UnixTim...
Change config import strategy to config.from_pyfile()
Change config import strategy to config.from_pyfile()
Python
mit
adsabs/adsabs-webservices-blueprint,jonnybazookatone/adsabs-webservices-blueprint
--- +++ @@ -14,10 +14,10 @@ app = Flask(__name__, static_folder=None) app.url_map.strict_slashes = False - app.config.from_object('sample_application.config') + app.config.from_pyfile('config.py') try: - app.config.from_object('sample_application.local_config') - except ImportError: + app.config....
20c8d494519b3d54bc3981aebdad18871deef3cb
src/sentry/auth/manager.py
src/sentry/auth/manager.py
from __future__ import absolute_import, print_function __all__ = ['ProviderManager'] from .exceptions import ProviderNotRegistered # Ideally this and PluginManager abstracted from the same base, but # InstanceManager has become convulated and wasteful class ProviderManager(object): def __init__(self): s...
from __future__ import absolute_import, print_function __all__ = ['ProviderManager'] from .exceptions import ProviderNotRegistered # Ideally this and PluginManager abstracted from the same base, but # InstanceManager has become convulated and wasteful class ProviderManager(object): def __init__(self): s...
Revert back to using key
Revert back to using key
Python
bsd-3-clause
argonemyth/sentry,gencer/sentry,JamesMura/sentry,vperron/sentry,nicholasserra/sentry,alexm92/sentry,jokey2k/sentry,zenefits/sentry,jokey2k/sentry,zenefits/sentry,Kryz/sentry,llonchj/sentry,llonchj/sentry,daevaorn/sentry,zenefits/sentry,ewdurbin/sentry,TedaLIEz/sentry,boneyao/sentry,nicholasserra/sentry,felixbuenemann/s...
--- +++ @@ -14,20 +14,20 @@ def __iter__(self): return self.__values.iteritems() - def get(self, name, **kwargs): + def get(self, key, **kwargs): try: - cls = self.__values[name] + cls = self.__values[key] except KeyError: - raise ProviderNotReg...
2bf4aacbc2a43305506d2d16cef97c6c89c30ee9
pythontutorials/books/AutomateTheBoringStuff/Ch13/P3_combinePDFs.py
pythontutorials/books/AutomateTheBoringStuff/Ch13/P3_combinePDFs.py
#! python3 """Combine PDFs Combines all the PDFs in the current working directory into a single PDF. Note: * Example PDFs can be downloaded from http://nostarch.com/automatestuff/ * Book uses PyPDF2; I'm an overachiever that uses PyPDF4 """ def main(): import PyPDF4, os # Get all the PDF filenames...
#! python3 """Combine PDFs Combines all the PDFs in the current working directory into a single PDF. Note: * Example PDFs can be downloaded from http://nostarch.com/automatestuff/ * Book uses :py:mod:`PyPDF2`; I'm an overachiever that uses PyPDF4 """ def main(): import PyPDF4, os # Get all the PDF...
Update P2_combinePDF.py added module reference in docstring
Update P2_combinePDF.py added module reference in docstring
Python
mit
JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials
--- +++ @@ -5,7 +5,7 @@ Note: * Example PDFs can be downloaded from http://nostarch.com/automatestuff/ - * Book uses PyPDF2; I'm an overachiever that uses PyPDF4 + * Book uses :py:mod:`PyPDF2`; I'm an overachiever that uses PyPDF4 """
ce25cea7e8d10f9c318e2e7ef1dc1013921ed062
clint/textui/prompt.py
clint/textui/prompt.py
# -*- coding: utf8 -*- """ clint.textui.prompt ~~~~~~~~~~~~~~~~~~~ Module for simple interactive prompts handling """ from __future__ import absolute_import from re import match, I def yn(prompt, default='y', batch=False): # A sanity check against default value # If not y/n then y is assumed if defau...
# -*- coding: utf8 -*- """ clint.textui.prompt ~~~~~~~~~~~~~~~~~~~ Module for simple interactive prompts handling """ from __future__ import absolute_import, print_function from re import match, I def yn(prompt, default='y', batch=False): # A sanity check against default value # If not y/n then y is assum...
Use print() function to fix install on python 3
Use print() function to fix install on python 3 clint 0.3.2 can't be installed on python 3.3 because of a print statement.
Python
isc
1gitGrey/clint,thusoy/clint,wkentaro/clint,1gitGrey/clint,glorizen/clint,wkentaro/clint,tz70s/clint,Lh4cKg/clint,nathancahill/clint,kennethreitz/clint,nathancahill/clint
--- +++ @@ -8,7 +8,7 @@ """ -from __future__ import absolute_import +from __future__ import absolute_import, print_function from re import match, I @@ -30,7 +30,7 @@ if not batch: input = raw_input(prompt).strip() else: - print prompt + print(prompt) ...
9be4dcdf9ea312465a27d6f105213d88d8dd0909
anchorhub/lib/tests/test_data/test_filetolist.py
anchorhub/lib/tests/test_data/test_filetolist.py
""" Tests for filetolist.py filetolist.py: http://www.github.com/samjabrahams/anchorhub/lib/filetolist.py """ from anchorhub.lib.filetolist import FileToList from anchorhub.util.getanchorhubpath import get_anchorhub_path from anchorhub.compatibility import get_path_separator def test_file_to_list_basic(): sep = ...
""" Tests for filetolist.py filetolist.py: http://www.github.com/samjabrahams/anchorhub/lib/filetolist.py """ from anchorhub.lib.filetolist import FileToList from anchorhub.util.getanchorhubpath import get_anchorhub_path from anchorhub.compatibility import get_path_separator def test_file_to_list_basic(): sep = ...
Add expression slash to perhaps fix python3 bug
Add expression slash to perhaps fix python3 bug
Python
apache-2.0
samjabrahams/anchorhub
--- +++ @@ -13,5 +13,5 @@ sep = get_path_separator() path = get_anchorhub_path() + sep + 'lib' + sep + 'tests' + sep + \ 'test_data' + sep + 'filelist' - assert FileToList.to_list(path) == ['Hello!\n', 'My name\n', 'is\n', + assert FileToList.to_list(path) == ['Hello!\n', 'My name\n', 'is\...
2b0f1c47a85c79c39e6066e0658c9b47090b46c4
.ci-support/upload_label.py
.ci-support/upload_label.py
import os travis_tag = os.getenv('TRAVIS_TAG') appveyor_tag = os.getenv('APPVEYOR_REPO_TAG') def generate_label(version): dev_names = ['dev', 'alpha', 'beta', 'rc'] is_dev = any(name in version for name in dev_names) # Output is the name of the label to which the package should be # uploaded on ana...
import os travis_tag = os.getenv('TRAVIS_TAG') appveyor_tag = os.getenv('APPVEYOR_REPO_TAG_NAME') def generate_label(version): dev_names = ['dev', 'alpha', 'beta', 'rc'] is_dev = any(name in version for name in dev_names) # Output is the name of the label to which the package should be # uploaded o...
Fix name of environment variable on appveyor tht contains tag name
Fix name of environment variable on appveyor tht contains tag name
Python
mit
mwcraig/vpython-jupyter,mwcraig/vpython-jupyter,BruceSherwood/vpython-jupyter,BruceSherwood/vpython-jupyter,mwcraig/vpython-jupyter,BruceSherwood/vpython-jupyter,mwcraig/vpython-jupyter,BruceSherwood/vpython-jupyter
--- +++ @@ -1,7 +1,7 @@ import os travis_tag = os.getenv('TRAVIS_TAG') -appveyor_tag = os.getenv('APPVEYOR_REPO_TAG') +appveyor_tag = os.getenv('APPVEYOR_REPO_TAG_NAME') def generate_label(version):
d677f3762e0daf16e1be05a88b058194ddf43e15
comics/comics/perrybiblefellowship.py
comics/comics/perrybiblefellowship.py
from comics.aggregator.crawler import CrawlerBase, CrawlerImage from comics.core.comic_data import ComicDataBase class ComicData(ComicDataBase): name = "The Perry Bible Fellowship" language = "en" url = "http://www.pbfcomics.com/" start_date = "2001-01-01" rights = "Nicholas Gurewitch" class Cra...
from comics.aggregator.crawler import CrawlerBase, CrawlerImage from comics.core.comic_data import ComicDataBase class ComicData(ComicDataBase): name = "The Perry Bible Fellowship" language = "en" url = "http://www.pbfcomics.com/" start_date = "2001-01-01" rights = "Nicholas Gurewitch" class Cra...
Rewrite "The Perry Bible Fellowship" after feed change
Rewrite "The Perry Bible Fellowship" after feed change
Python
agpl-3.0
datagutten/comics,jodal/comics,datagutten/comics,datagutten/comics,jodal/comics,jodal/comics,jodal/comics,datagutten/comics
--- +++ @@ -11,12 +11,15 @@ class Crawler(CrawlerBase): - history_capable_date = "2001-01-01" + history_capable_date = "2019-06-12" time_zone = "US/Eastern" def crawl(self, pub_date): feed = self.parse_feed("http://www.pbfcomics.com/feed/feed.xml") for entry in feed.for_date(p...
dc4307a781e34bf051b20b18935d4939b2de1f8e
examples/unicode_commands.py
examples/unicode_commands.py
#!/usr/bin/env python # coding=utf-8 """A simple example demonstrating support for unicode command names. """ import math import cmd2 class UnicodeApp(cmd2.Cmd): """Example cmd2 application with unicode command names.""" def __init__(self): super().__init__() self.intro = 'Welcome the Unicode...
#!/usr/bin/env python # coding=utf-8 """A simple example demonstrating support for unicode command names. """ import math import cmd2 class UnicodeApp(cmd2.Cmd): """Example cmd2 application with unicode command names.""" def __init__(self): super().__init__() self.intro = 'Welcome the Unicode...
Fix flake8 error due to extra blank line in example
Fix flake8 error due to extra blank line in example
Python
mit
python-cmd2/cmd2,python-cmd2/cmd2
--- +++ @@ -25,4 +25,3 @@ if __name__ == '__main__': app = UnicodeApp() app.cmdloop() -
241d1e6b36eb8f87a5c6111bfa52104feb821bb8
test/dependencies_test.py
test/dependencies_test.py
import luigi import sciluigi as sl import os TESTFILE_PATH = '/tmp/test.out' class TestTask(sl.Task): def out_data(self): return sl.TargetInfo(self, TESTFILE_PATH) def run(self): with self.out_data().open('w') as outfile: outfile.write('File written by luigi\n') class TestRunTas...
import logging import luigi import sciluigi as sl import os TESTFILE_PATH = '/tmp/test.out' log = logging.getLogger('sciluigi-interface') log.setLevel(logging.WARNING) class TestTask(sl.Task): def out_data(self): return sl.TargetInfo(self, TESTFILE_PATH) def run(self): with self.out_data()....
Set log level to WARNING when testing
Set log level to WARNING when testing
Python
mit
pharmbio/sciluigi,samuell/sciluigi,pharmbio/sciluigi
--- +++ @@ -1,8 +1,12 @@ +import logging import luigi import sciluigi as sl import os TESTFILE_PATH = '/tmp/test.out' + +log = logging.getLogger('sciluigi-interface') +log.setLevel(logging.WARNING) class TestTask(sl.Task):
758a8bff354d1e1542b5c4614276bdfa229f3dbc
extended_choices/__init__.py
extended_choices/__init__.py
"""Little helper application to improve django choices (for fields)""" from __future__ import unicode_literals from .choices import Choices, OrderedChoices __author__ = 'Stephane "Twidi" Ange;' __contact__ = "s.angel@twidi.com" __homepage__ = "https://pypi.python.org/pypi/django-extended-choices" __version__ = "1.1....
"""Little helper application to improve django choices (for fields)""" from __future__ import unicode_literals from .choices import Choices, OrderedChoices __all__ = ['Choices', 'OrderedChoices'] __author__ = 'Stephane "Twidi" Ange;' __contact__ = "s.angel@twidi.com" __homepage__ = "https://pypi.python.org/pypi/djan...
Add `__all__` at package root level
Add `__all__` at package root level
Python
bsd-3-clause
twidi/django-extended-choices
--- +++ @@ -4,6 +4,7 @@ from .choices import Choices, OrderedChoices +__all__ = ['Choices', 'OrderedChoices'] __author__ = 'Stephane "Twidi" Ange;' __contact__ = "s.angel@twidi.com" __homepage__ = "https://pypi.python.org/pypi/django-extended-choices"
389bd3773d2f89321c31b05da8a733b65ccbeef8
tests/test_coefficient.py
tests/test_coefficient.py
# -*- coding: utf-8 -*- from nose.tools import assert_equal from openfisca_france.model.prelevements_obligatoires.prelevements_sociaux.cotisations_sociales.allegements import * from openfisca_core.periods import * from openfisca_france import FranceTaxBenefitSystem def test_coefficient_proratisation_only_contract_pe...
# -*- coding: utf-8 -*- from nose.tools import assert_equal from openfisca_france.model.prelevements_obligatoires.prelevements_sociaux.cotisations_sociales.allegements import * from openfisca_core.periods import * from openfisca_france import FranceTaxBenefitSystem def test_coefficient_proratisation_only_contract_pe...
Fix test to avoid weird period handling
Fix test to avoid weird period handling
Python
agpl-3.0
sgmap/openfisca-france,antoinearnoud/openfisca-france,sgmap/openfisca-france,antoinearnoud/openfisca-france
--- +++ @@ -9,7 +9,7 @@ def test_coefficient_proratisation_only_contract_periods(): tax_benefit_system = FranceTaxBenefitSystem() scenario = tax_benefit_system.new_scenario() - scenario.init_single_entity(period='2017-11', + scenario.init_single_entity(period='2017', parent1=dict(salaire_de_base=2300, ...
ee4c8b806ecf0ada51916fe63f9da9e81c03850d
django_react_templatetags/tests/demosite/urls.py
django_react_templatetags/tests/demosite/urls.py
from django.urls import path from django_react_templatetags.tests.demosite import views urlpatterns = [ path( 'static-react-view', views.StaticReactView.as_view(), name='static_react_view', ), ]
from django.conf.urls import url from django_react_templatetags.tests.demosite import views urlpatterns = [ url( 'static-react-view', views.StaticReactView.as_view(), name='static_react_view', ), ]
Use url instead of path (to keep django 1 compat)
Use url instead of path (to keep django 1 compat)
Python
mit
Frojd/django-react-templatetags,Frojd/django-react-templatetags,Frojd/django-react-templatetags
--- +++ @@ -1,10 +1,11 @@ -from django.urls import path +from django.conf.urls import url + from django_react_templatetags.tests.demosite import views urlpatterns = [ - path( + url( 'static-react-view', views.StaticReactView.as_view(), name='static_react_view',
4244e285c25c0c13a1f7f6e172b31ebb8f2bb7b1
spacy/lang/es/__init__.py
spacy/lang/es/__init__.py
# coding: utf8 from __future__ import unicode_literals from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS from .tag_map import TAG_MAP from .stop_words import STOP_WORDS from .lemmatizer import LOOKUP from .syntax_iterators import SYNTAX_ITERATORS from ..tokenizer_exceptions import BASE_EXCEPTIONS from ..norm_exc...
# coding: utf8 from __future__ import unicode_literals from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS from .tag_map import TAG_MAP from .stop_words import STOP_WORDS from .lemmatizer import LOOKUP from .syntax_iterators import SYNTAX_ITERATORS from ..tokenizer_exceptions import BASE_EXCEPTIONS from ..norm_exc...
Fix Spanish noun_chunks failure caused by typo
Fix Spanish noun_chunks failure caused by typo
Python
mit
recognai/spaCy,explosion/spaCy,aikramer2/spaCy,explosion/spaCy,spacy-io/spaCy,explosion/spaCy,aikramer2/spaCy,honnibal/spaCy,spacy-io/spaCy,recognai/spaCy,recognai/spaCy,spacy-io/spaCy,recognai/spaCy,recognai/spaCy,explosion/spaCy,aikramer2/spaCy,explosion/spaCy,aikramer2/spaCy,explosion/spaCy,honnibal/spaCy,aikramer2/...
--- +++ @@ -21,7 +21,7 @@ tokenizer_exceptions = update_exc(BASE_EXCEPTIONS, TOKENIZER_EXCEPTIONS) tag_map = TAG_MAP stop_words = STOP_WORDS - sytax_iterators = SYNTAX_ITERATORS + syntax_iterators = SYNTAX_ITERATORS lemma_lookup = LOOKUP
78af5e585eb109049299bd1c826f93001e4f6c68
adama/store.py
adama/store.py
import collections import pickle import redis from .tools import location class Store(collections.MutableMapping): def __init__(self, db=0): host, port = location('redis', 6379) self._db = redis.StrictRedis(host=host, port=port, db=db) def __getitem__(self, key): obj = self._db.get...
import collections import pickle import redis class Store(collections.MutableMapping): def __init__(self, db=0): host, port = 'redis', 6379 self._db = redis.StrictRedis(host=host, port=port, db=db) def __getitem__(self, key): obj = self._db.get(key) if obj is None: ...
Use /etc/hosts to find redis
Use /etc/hosts to find redis
Python
mit
waltermoreira/adama-app,waltermoreira/adama-app,waltermoreira/adama-app
--- +++ @@ -3,13 +3,11 @@ import redis -from .tools import location - class Store(collections.MutableMapping): def __init__(self, db=0): - host, port = location('redis', 6379) + host, port = 'redis', 6379 self._db = redis.StrictRedis(host=host, port=port, db=db) def __geti...
50f8e32521ccf871177b4402b6a410dad896b272
src/schema_matching/collector/description/_argparser.py
src/schema_matching/collector/description/_argparser.py
import utilities def parse(src): if src == ':': from ..description import default as desc elif src.startswith(':'): import importlib desc = importlib.import_module(src[1:]) else: import os, imp from .. import description as parent_package # needs to be imported before its child modules with open(src) a...
import importlib def parse(src): try: if src == ':': from ..description import default as desc elif src.startswith(':'): desc = importlib.import_module(src[1:], __package__.partition('.')[0]) else: desc = importlib.machinery.SourceFileLoader(src, src).load_module() except: raise ImportError(src) ...
Use importlib in favour of imp
Use importlib in favour of imp
Python
mit
davidfoerster/schema-matching
--- +++ @@ -1,24 +1,18 @@ -import utilities +import importlib def parse(src): - if src == ':': - from ..description import default as desc - elif src.startswith(':'): - import importlib - desc = importlib.import_module(src[1:]) - else: - import os, imp - from .. import description as parent_package # needs ...
e94e3931ec254e432993d18d9f4ac79f559a2257
scripts/starting_py_program.py
scripts/starting_py_program.py
import sys def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) def main(argv=None): if argv is None: argv = sys.argv return 0 if __name__ == "__main__": sys.exit(main())
#!/usr/bin/env python3 # from __future__ import print_function #(if python2) import sys def eprint(*args, **kwargs): """ Just like the print function, but on stderr """ print(*args, file=sys.stderr, **kwargs) def main(argv=None): """ Program starting point, it can started by the OS or as normal fun...
Add docstrings to starting py program
Add docstrings to starting py program
Python
unlicense
paolobolzoni/useful-conf,paolobolzoni/useful-conf,paolobolzoni/useful-conf
--- +++ @@ -1,10 +1,21 @@ +#!/usr/bin/env python3 + +# from __future__ import print_function #(if python2) import sys + def eprint(*args, **kwargs): + """ Just like the print function, but on stderr + """ print(*args, file=sys.stderr, **kwargs) def main(argv=None): + """ Program starting point,...
13f8d6feebcfb28b96bb0f69d1e5625a337c22fa
demo/ok_test/tests/q1.py
demo/ok_test/tests/q1.py
test = { 'name': 'Question 1', 'points': 3, 'suites': [ { 'cases': [ { 'answer': 'Domain is numbers. Range is numbers', 'choices': [ 'Domain is numbers. Range is numbers', 'Domain is numbers. Range is strings', 'Domain is strings. Range is ...
test = { 'name': 'Question 1', 'points': 3, 'suites': [ { 'type': 'concept', 'cases': [ { 'answer': 'Domain is numbers. Range is numbers', 'choices': [ 'Domain is numbers. Range is numbers', 'Domain is numbers. Range is strings', 'Dom...
Add a demo for wwpp
Add a demo for wwpp
Python
apache-2.0
jathak/ok-client,Cal-CS-61A-Staff/ok-client,jackzhao-mj/ok-client
--- +++ @@ -3,6 +3,7 @@ 'points': 3, 'suites': [ { + 'type': 'concept', 'cases': [ { 'answer': 'Domain is numbers. Range is numbers', @@ -16,8 +17,26 @@ 'question': 'What is the domain and range of the square function?' } ], - 'scored': False,...
6dadf50366b1e142f96ef3bf4a356f7aa98f37be
geokey_export/__init__.py
geokey_export/__init__.py
from geokey.extensions.base import register VERSION = (0, 2, 0) __version__ = '.'.join(map(str, VERSION)) register( 'geokey_export', 'Export', display_admin=True, superuser=False, version=__version__ )
from geokey.extensions.base import register VERSION = (0, 2, 0) __version__ = '.'.join(map(str, VERSION)) register( 'geokey_export', 'Export', display_admin=True, superuser=False )
Undo previous commit (should not been on new branch) - Sorry!
Undo previous commit (should not been on new branch) - Sorry! Signed-off-by: Matthias Stevens <3e0606afd16757d2df162884117429808539458f@gmail.com>
Python
mit
ExCiteS/geokey-export,ExCiteS/geokey-export,ExCiteS/geokey-export
--- +++ @@ -8,6 +8,5 @@ 'geokey_export', 'Export', display_admin=True, - superuser=False, - version=__version__ + superuser=False )
a6774092839f8c6aff743cf8f4cc982fe8ce2e63
interfaces/cython/cantera/mixmaster/utilities.py
interfaces/cython/cantera/mixmaster/utilities.py
import string import os, sys import types, traceback try: if sys.version_info[0] == 3: from tkinter import Tk from tkinter import messagebox else: from Tkinter import Tk import tkMessageBox _hasTk = 1 except: _hasTk = 0 def write_CSV(f,x): """write list x to file f...
import string import os, sys import types, traceback try: if sys.version_info[0] == 3: from tkinter import Tk from tkinter import messagebox else: from Tkinter import Tk import tkMessageBox as messagebox _hasTk = 1 except: _hasTk = 0 def write_CSV(f,x): """write li...
Fix displaying of errors when using Python 2
[MixMaster] Fix displaying of errors when using Python 2
Python
bsd-3-clause
Heathckliff/cantera,imitrichev/cantera,imitrichev/cantera,imitrichev/cantera,Heathckliff/cantera,Heathckliff/cantera,Heathckliff/cantera,imitrichev/cantera,Heathckliff/cantera,imitrichev/cantera,Heathckliff/cantera,imitrichev/cantera
--- +++ @@ -8,7 +8,7 @@ from tkinter import messagebox else: from Tkinter import Tk - import tkMessageBox + import tkMessageBox as messagebox _hasTk = 1 except: _hasTk = 0 @@ -26,13 +26,6 @@ string.rjust('%10.5e' %value, 15) + ' ' + \ string.ljust(...
f13e9ff10c79f58df2f6d43c8b840b642be56dab
core/admin.py
core/admin.py
# -*- encoding: UTF-8 -*- # # Copyright 2014-2015 # # STIC-Investigación - Universidad de La Laguna (ULL) <gesinv@ull.edu.es> # # This file is part of Portal del Investigador. # # Portal del Investigador is free software: you can redistribute it and/or # modify it under the terms of the GNU Affero Gen...
# -*- encoding: UTF-8 -*- # # Copyright 2014-2015 # # STIC-Investigación - Universidad de La Laguna (ULL) <gesinv@ull.edu.es> # # This file is part of Portal del Investigador. # # Portal del Investigador is free software: you can redistribute it and/or # modify it under the terms of the GNU Affero Gen...
Patch django submit_row templatetag so it takes into account button config sent in context
Patch django submit_row templatetag so it takes into account button config sent in context
Python
agpl-3.0
tic-ull/portal-del-investigador,tic-ull/portal-del-investigador,tic-ull/portal-del-investigador,tic-ull/portal-del-investigador
--- +++ @@ -21,6 +21,21 @@ # along with Portal del Investigador. If not, see # <http://www.gnu.org/licenses/>. # +from django.contrib.admin.templatetags.admin_modify import register +from django.contrib.admin.templatetags.admin_modify import submit_row as osr + + +# If the developer wants to enable/disable ...
6e43c5a69bd7b0291ef54d1936f64d0596189fa5
userena/contrib/umessages/urls.py
userena/contrib/umessages/urls.py
from django.conf.urls import * from userena.contrib.umessages import views as messages_views from django.contrib.auth.decorators import login_required urlpatterns = patterns('', url(r'^compose/$', messages_views.message_compose, name='userena_umessages_compose'), url(r'^compose/(?P<recipients>...
from django.conf.urls import * from userena.contrib.umessages import views as messages_views from django.contrib.auth.decorators import login_required urlpatterns = patterns('', url(r'^compose/$', messages_views.message_compose, name='userena_umessages_compose'), url(r'^compose/(?P<recipients>...
Allow spaces in username, cont'd: forgotten url pattern.
Allow spaces in username, cont'd: forgotten url pattern.
Python
bsd-3-clause
ugoertz/django-userena,ugoertz/django-userena,ugoertz/django-userena
--- +++ @@ -7,7 +7,7 @@ messages_views.message_compose, name='userena_umessages_compose'), - url(r'^compose/(?P<recipients>[\@\+\.\w-]+)/$', + url(r'^compose/(?P<recipients>[\@ \+\.\w-]+)/$', messages_views.message_compose, name='userena_umessages_compose_to'),
30bfe04e0fa1386e263cbd0e8dbc6f3689f9cb21
connector_carepoint/migrations/9.0.1.3.0/pre-migrate.py
connector_carepoint/migrations/9.0.1.3.0/pre-migrate.py
# -*- coding: utf-8 -*- # Copyright 2016 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). def migrate(cr, version): cr.execute('ALTER TABLE carepoint_medical_prescription_order_line ' 'RENAME TO carepoint_rx_ord_ln') cr.execute('ALTER TABLE carepoint_carepoint_organ...
# -*- coding: utf-8 -*- # Copyright 2016 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). import logging _logger = logging.getLogger(__name__) def migrate(cr, version): try: cr.execute('ALTER TABLE carepoint_medical_prescription_order_line ' 'RENAME TO care...
Fix prescription migration * Add try/catch & rollback to db alterations in case server re-upgrades
[FIX] connector_carepoint: Fix prescription migration * Add try/catch & rollback to db alterations in case server re-upgrades
Python
agpl-3.0
laslabs/odoo-connector-carepoint
--- +++ @@ -2,10 +2,22 @@ # Copyright 2016 LasLabs Inc. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +import logging + +_logger = logging.getLogger(__name__) + def migrate(cr, version): - cr.execute('ALTER TABLE carepoint_medical_prescription_order_line ' - 'RENAME TO carepo...
259ac1bf6390c050892fa678842c1793e7f1dda0
runtests.py
runtests.py
#!/usr/bin/env python import os import sys import unittest from huey import tests def _requirements_installed(): try: import django return True except Exception: return False def run_tests(*test_args): suite = unittest.TestLoader().loadTestsFromModule(tests) result = unittes...
#!/usr/bin/env python import os import sys import unittest from huey import tests def _requirements_installed(): try: import django return True except Exception: return False def run_tests(*test_args): suite = unittest.TestLoader().loadTestsFromModule(tests) result = unittes...
Allow running tests without Django.
Allow running tests without Django.
Python
mit
coleifer/huey,rsalmaso/huey,pombredanne/huey
--- +++ @@ -35,10 +35,10 @@ if __name__ == '__main__': - if not _requirements_installed(): - print('Requirements are not installed. Run "pip install -r test_requirements.txt" to install all dependencies.') - sys.exit(2) run_tests(*sys.argv[1:]) - run_django_tests(*sys.argv[1:]) + if _...
746cc719ce80636c19b2eea4b3d7328e680f7624
settings_example.py
settings_example.py
""" Example settings module. This should be copied as `settings.py` and the values modified there. That file is ignored by the repo, since it will contain environment specific and sensitive information (like passwords). """ import logging import os import re import yaml from imap import EmailCheckError, EmailServe...
""" Example settings module. This should be copied as `settings.py` and the values modified there. That file is ignored by the repo, since it will contain environment specific and sensitive information (like passwords). """ import logging import os import re import yaml from imap import EmailCheckError, EmailServe...
Change file name to logger name in example settings
Change file name to logger name in example settings
Python
mit
AustralianAntarcticDataCentre/save_emails_to_files,AustralianAntarcticDataCentre/save_emails_to_files
--- +++ @@ -24,10 +24,12 @@ SETTINGS_YAML_PATH = os.path.join(os.getcwd(), 'settings.yaml') +#- file: %(pathname)s +# function: %(funcName)s LOGGING_FORMAT = ''' -- file: %(pathname)s - level: %(levelname)s +- level: %(levelname)s line: %(lineno)s + logger: %(name)s message: | %(message)s time:...
1ef0e4db1079995b5dd6a013d3fa51c1b61db178
config-example.py
config-example.py
# Copy this file to config.py and change the settings. Don't forget to specify your own SECRET_KEY. # The app name will be used in several places. APP_NAME = 'Yelp Love' APP_BASE_URL = 'https://PROJECT_ID.appspot.com/' LOVE_SENDER_EMAIL = 'Yelp Love <love@PROJECT_ID.appspotmail.com>' # Flask's secret key, used to e...
# Copy this file to config.py and change the settings. Don't forget to specify your own SECRET_KEY. # The app name will be used in several places. APP_NAME = 'Yelp Love' APP_BASE_URL = 'https://PROJECT_ID.appspot.com/' LOVE_SENDER_EMAIL = 'Yelp Love <love@PROJECT_ID.appspotmail.com>' # Flask's secret key, used to e...
Make ORG_TITLE the complete pre-existing title.
Make ORG_TITLE the complete pre-existing title.
Python
mit
Yelp/love,Yelp/love,Yelp/love
--- +++ @@ -29,4 +29,4 @@ # * anything else - disabled GRAVATAR = 'backup' -ORG_TITLE = "Company" +ORG_TITLE = "All Company"
650c94107106cddafccaf5d2021a6407fcac990e
bend/src/users/jwt_util.py
bend/src/users/jwt_util.py
from jwt_auth.forms import JSONWebTokenForm def loginUser(username, password): """Should login user and return a jwt token, piggyback on jwt_auth""" request = {"username": username, "password": password} form = JSONWebTokenForm(request) if not form.is_valid(): return print("JWT form not valid"...
from jwt_auth.forms import JSONWebTokenForm def loginUser(username, password): """Should login user and return a jwt token, piggyback on jwt_auth""" request = {"username": username, "password": password} form = JSONWebTokenForm(request) if not form.is_valid(): return print("JWT form not valid"...
Return the token string instead of object with string
Return the token string instead of object with string
Python
mit
ncrmro/ango,ncrmro/reango,ncrmro/ango,ncrmro/reango,ncrmro/ango,ncrmro/reango
--- +++ @@ -8,8 +8,4 @@ if not form.is_valid(): return print("JWT form not valid") - context_dict = { - 'token': form.object['token'] - } - - return context_dict + return form.object['token']
994e185e7bb8b2ffb78f20012121c441ea6b73a1
comics/views.py
comics/views.py
from django.views import generic from gallery.models import GalleryImage from .models import Arc, Issue class IndexView(generic.ListView): model = Arc template_name = "comics/index.html" context_object_name = "arcs" class IssueView(generic.DetailView): model = Issue template_name = "comics/issu...
from django.views import generic from gallery.models import GalleryImage from .models import Arc, Issue class IndexView(generic.ListView): model = Arc template_name = "comics/index.html" context_object_name = "arcs" class IssueView(generic.DetailView): model = Issue template_name = "comics/issu...
Fix bug where arc slug could be literally anything
Fix bug where arc slug could be literally anything
Python
mit
evanepio/dotmanca,evanepio/dotmanca,evanepio/dotmanca
--- +++ @@ -14,6 +14,10 @@ model = Issue template_name = "comics/issue.html" + def get_queryset(self): + query_set = super().get_queryset().filter(arc__slug=self.kwargs.get("arc_slug")) + return query_set + class ComicPageView(generic.DetailView): model = GalleryImage
d624a1e638cf6f1fca7b7d8966f3ab7c6c9f7300
linter.py
linter.py
from SublimeLinter.lint import Linter, util class Cppcheck(Linter): cmd = ('cppcheck', '--template=gcc', '--inline-suppr', '--quiet', '${args}', '${file}') regex = ( r'^(?P<file>(:\\|[^:])+):(?P<line>\d+):((?P<col>\d+):)?\s+' r'((?P<error>error)|(?P<warning>warning|style|performance|portabilit...
from SublimeLinter.lint import Linter, util class Cppcheck(Linter): cmd = ('cppcheck', '--template={file}:{line}: {severity}: {message}', '--inline-suppr', '--quiet', '${args}', '${file}') regex = ( r'^(?P<file>(:\\|[^:])+):(?P<line>\d+):((?P<col>\d+):)?\s+' r'((?P<error>error)|(?P<warning>war...
Use explicit template instead of 'gcc'
Use explicit template instead of 'gcc' cppcheck 1.84 changed the meaning of --template=gcc to add a second line of output that confuses the linter plugin, so explicitly request the old format see https://github.com/danmar/cppcheck/commit/f058d9ad083a6111e9339b4b3506c5da7db579e0 for the details of that change
Python
mit
SublimeLinter/SublimeLinter-cppcheck
--- +++ @@ -2,7 +2,7 @@ class Cppcheck(Linter): - cmd = ('cppcheck', '--template=gcc', '--inline-suppr', '--quiet', '${args}', '${file}') + cmd = ('cppcheck', '--template={file}:{line}: {severity}: {message}', '--inline-suppr', '--quiet', '${args}', '${file}') regex = ( r'^(?P<file>(:\\|[^:])...
2b81d198b7d3dd9094f47d2f8e51f0275ee31463
osf/migrations/0084_migrate_node_info_for_target.py
osf/migrations/0084_migrate_node_info_for_target.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-11-13 16:14 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('osf', '0083_add_file_fields_for_target'), ] operations = [ migrations.RunSQL( ...
# -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-11-13 16:14 from __future__ import unicode_literals from django.db import migrations, models, connection from django.contrib.contenttypes.models import ContentType def set_basefilenode_target(apps, schema_editor): BaseFileNode = apps.get_model('osf', '...
Use batches instead of raw sql for long migration
Use batches instead of raw sql for long migration
Python
apache-2.0
baylee-d/osf.io,Johnetordoff/osf.io,mfraezz/osf.io,mattclark/osf.io,aaxelb/osf.io,HalcyonChimera/osf.io,adlius/osf.io,felliott/osf.io,pattisdr/osf.io,CenterForOpenScience/osf.io,Johnetordoff/osf.io,brianjgeiger/osf.io,brianjgeiger/osf.io,mfraezz/osf.io,erinspace/osf.io,HalcyonChimera/osf.io,CenterForOpenScience/osf.io,...
--- +++ @@ -2,25 +2,46 @@ # Generated by Django 1.11.4 on 2017-11-13 16:14 from __future__ import unicode_literals -from django.db import migrations +from django.db import migrations, models, connection +from django.contrib.contenttypes.models import ContentType +def set_basefilenode_target(apps, schema_edito...
d9d52d2ba93b29f04d1f0e6903a6a343718f7bce
Instanssi/dblog/models.py
Instanssi/dblog/models.py
# -*- coding: utf-8 -*- from django.db import models from django.contrib.auth.models import User from Instanssi.kompomaatti.models import Event class DBLogEntry(models.Model): user = models.ForeignKey(User, blank=True, null=True) event = models.ForeignKey(Event, blank=True, null=True) date = models.DateT...
# -*- coding: utf-8 -*- from django.db import models from django.contrib.auth.models import User from Instanssi.kompomaatti.models import Event class DBLogEntry(models.Model): user = models.ForeignKey(User, blank=True, null=True) event = models.ForeignKey(Event, blank=True, null=True) date = models.DateT...
Fix log entry __unicode__ method functionality
dblog: Fix log entry __unicode__ method functionality
Python
mit
Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org
--- +++ @@ -14,8 +14,8 @@ message = models.TextField() def __unicode__(self): - if len(self.message) > 48: - return u' ...'.format(self.message[:48]) + if len(self.message) > 64: + return u'{} ...'.format(self.message[:64]) else: return self.messag...
77d3f60468fcf814c19d693e3401b1769e4993a9
cob/cli/migrate_cli.py
cob/cli/migrate_cli.py
import click import logbook from .utils import appcontext_command from ..ctx import context import flask_migrate _logger = logbook.Logger(__name__) @click.group() def migrate(): pass @migrate.command() @appcontext_command def init(): flask_migrate.init('migrations', False) @migrate.command() @click.opt...
import click import logbook from .utils import appcontext_command from ..ctx import context import flask_migrate _logger = logbook.Logger(__name__) @click.group() def migrate(): pass @migrate.command() @appcontext_command def init(): flask_migrate.init('migrations', False) @migrate.command() @click.opt...
Fix typo in cob migrate down
Fix typo in cob migrate down
Python
bsd-3-clause
getweber/weber-cli
--- +++ @@ -37,4 +37,4 @@ @migrate.command() @appcontext_command def down(): - flask_migrate.upgrade() + flask_migrate.downgrade()
56e2bea0798ae3afbc50d53947e505e7df9edba3
config/invariant_checks.py
config/invariant_checks.py
from sts.invariant_checker import InvariantChecker def check_for_loops_or_connectivity(simulation): from sts.invariant_checker import InvariantChecker result = InvariantChecker.check_loops(simulation) if result: return result result = InvariantChecker.python_check_connectivity(simulation) if not result: ...
from sts.invariant_checker import InvariantChecker import sys def bail_on_connectivity(simulation): result = InvariantChecker.python_check_connectivity(simulation) if not result: print "Connectivity established - bailing out" sys.exit(0) return [] def check_for_loops_or_connectivity(simulation): resul...
Add a new invariant check: check blackholes *or* loops
Add a new invariant check: check blackholes *or* loops
Python
apache-2.0
ucb-sts/sts,jmiserez/sts,jmiserez/sts,ucb-sts/sts
--- +++ @@ -1,20 +1,30 @@ from sts.invariant_checker import InvariantChecker +import sys + +def bail_on_connectivity(simulation): + result = InvariantChecker.python_check_connectivity(simulation) + if not result: + print "Connectivity established - bailing out" + sys.exit(0) + return [] def check_for_loo...
d58c04d9745f1a0af46f35fba7b3e2aef704547e
application.py
application.py
import os from flask import Flask from whitenoise import WhiteNoise from app import create_app PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) STATIC_ROOT = os.path.join(PROJECT_ROOT, 'app', 'static') STATIC_URL = 'static/' app = Flask('app') create_app(app) application = WhiteNoise(app, STATIC_ROOT, STA...
import os from flask import Flask from whitenoise import WhiteNoise from app import create_app PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) STATIC_ROOT = os.path.join(PROJECT_ROOT, 'app', 'static') STATIC_URL = 'static/' app = Flask('app') create_app(app) app.wsgi_app = WhiteNoise(app.wsgi_app, STATIC...
Make Whitenoise serve static assets
Make Whitenoise serve static assets Currently it’s not configured properly, so isn’t having any effect. This change makes it wrap the Flask app, so it intercepts any requests for static content. Follows the pattern documented in http://whitenoise.evans.io/en/stable/flask.html#enable-whitenoise
Python
mit
alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin
--- +++ @@ -12,4 +12,4 @@ app = Flask('app') create_app(app) -application = WhiteNoise(app, STATIC_ROOT, STATIC_URL) +app.wsgi_app = WhiteNoise(app.wsgi_app, STATIC_ROOT, STATIC_URL)
7231111564145bdbc773ed2bb5479b6edc0c7426
issues/admin.py
issues/admin.py
from django.contrib.admin import site, ModelAdmin from .models import Issue, Jurisdiction, Service, Application class ApplicationAdmin(ModelAdmin): list_display = ('identifier', 'name', 'active') list_filter = ('active',) search_fields = ('identifier', 'name',) def get_readonly_fields(self, requ...
from django.contrib.admin import site, ModelAdmin from parler.admin import TranslatableAdmin from .models import Issue, Jurisdiction, Service, Application class ApplicationAdmin(ModelAdmin): list_display = ('identifier', 'name', 'active') list_filter = ('active',) search_fields = ('identifier', 'name',) ...
Use a `TranslatableAdmin` for `Service`s
Use a `TranslatableAdmin` for `Service`s Fixes #70
Python
mit
6aika/issue-reporting,6aika/issue-reporting,6aika/issue-reporting
--- +++ @@ -1,4 +1,5 @@ from django.contrib.admin import site, ModelAdmin +from parler.admin import TranslatableAdmin from .models import Issue, Jurisdiction, Service, Application @@ -7,7 +8,7 @@ list_display = ('identifier', 'name', 'active') list_filter = ('active',) search_fields = ('identifie...
4d446f6b810fdb1a996ab9b65259c1212c6b951a
connect_to_postgres.py
connect_to_postgres.py
import os import psycopg2 import urlparse urlparse.uses_netloc.append("postgres") url = urlparse.urlparse(os.environ["DATABASE_URL"]) conn = psycopg2.connect( database=url.path[1:], user=url.username, password=url.password, host=url.hostname, port=url.port ) cur = conn.cursor() cur.execute("SE...
import os import psycopg2 import urlparse # urlparse.uses_netloc.append("postgres") # url = urlparse.urlparse(os.environ["DATABASE_URL"]) # conn = psycopg2.connect( # database=url.path[1:], # user=url.username, # password=url.password, # host=url.hostname, # port=url.port # ) # cur = conn.cursor(...
Test functional version of connecting to postgres
Test functional version of connecting to postgres
Python
mit
gsganden/pitcher-reports,gsganden/pitcher-reports
--- +++ @@ -2,23 +2,49 @@ import psycopg2 import urlparse -urlparse.uses_netloc.append("postgres") -url = urlparse.urlparse(os.environ["DATABASE_URL"]) +# urlparse.uses_netloc.append("postgres") +# url = urlparse.urlparse(os.environ["DATABASE_URL"]) -conn = psycopg2.connect( - database=url.path[1:], - use...
5839e70f2ffab6640997e3a609a26e50ff2b4da6
opps/containers/urls.py
opps/containers/urls.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.conf.urls import patterns, url from django.conf import settings from django.views.decorators.cache import cache_page from .views import ContainerList, ContainerDetail from .views import Search from opps.contrib.feeds.views import ContainerFeed, ChannelFeed ur...
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.conf.urls import patterns, url from django.conf import settings from django.views.decorators.cache import cache_page from .views import ContainerList, ContainerDetail from .views import ContainerAPIList, ContainerAPIDetail from .views import Search from opps.co...
Add url entry container api
Add url entry container api
Python
mit
jeanmask/opps,williamroot/opps,opps/opps,opps/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,YACOWS/opps,opps/opps,jeanmask/opps,williamroot/opps,opps/opps,YACOWS/opps,williamroot/opps,jeanmask/opps,YACOWS/opps
--- +++ @@ -5,6 +5,7 @@ from django.views.decorators.cache import cache_page from .views import ContainerList, ContainerDetail +from .views import ContainerAPIList, ContainerAPIDetail from .views import Search from opps.contrib.feeds.views import ContainerFeed, ChannelFeed @@ -22,10 +23,16 @@ cache_p...
959c317f9929dc781d9ad08611896963f1bc3172
zou/app/blueprints/crud/notifications.py
zou/app/blueprints/crud/notifications.py
from zou.app.models.notifications import Notification from zou.app.utils import permissions from .base import BaseModelResource, BaseModelsResource class NotificationsResource(BaseModelsResource): def __init__(self): BaseModelsResource.__init__(self, Notification) def check_create_permissions(self,...
from zou.app.models.notifications import Notification from zou.app.utils import permissions from .base import BaseModelResource, BaseModelsResource class NotificationsResource(BaseModelsResource): def __init__(self): BaseModelsResource.__init__(self, Notification) def check_create_permissions(self,...
Fix crud controller for notifacation
Fix crud controller for notifacation It was not possible to get, update or retrieve a notification
Python
agpl-3.0
cgwire/zou
--- +++ @@ -16,7 +16,7 @@ class NotificationResource(BaseModelResource): def __init__(self): - BaseModelResource.__init__(self, NotificationResource) + BaseModelResource.__init__(self, Notification) def check_read_permissions(self, instance): return permissions.check_admin_permis...
adc76c9a629cb9f6e70ea1780351304dfba16197
pcad/gen.py
pcad/gen.py
from genshi.template import TemplateLoader import os import sys if len(sys.argv) < 2: print("I need the name of a file as the first argument!") exit(1) loader = TemplateLoader(os.path.dirname(__file__)) tmpl = loader.load(sys.argv[1]) print(tmpl.generate(r_outer=100, r_inner=25, ...
from genshi.template import TemplateLoader import os import sys if len(sys.argv) < 2: print("I need the name of a file as the first argument!") exit(1) loader = TemplateLoader(os.path.dirname(__file__)) tmpl = loader.load(sys.argv[1]) print(tmpl.generate(r_outer=100, r_inner=25, ...
Increase spacing for quadrature encoders
Increase spacing for quadrature encoders
Python
mit
WesleyAC/toybox,WesleyAC/toybox,WesleyAC/toybox,WesleyAC/toybox,WesleyAC/toybox
--- +++ @@ -10,7 +10,7 @@ tmpl = loader.load(sys.argv[1]) print(tmpl.generate(r_outer=100, r_inner=25, - spacing=3, + spacing=6, num_clicks=16, flip=True, debug=False))
6c1b81705beeaf9981deb2890382622026a37ba9
app/redidropper/startup/initializer.py
app/redidropper/startup/initializer.py
# Goal: Init the application routes and read the settings # # @authors: # Andrei Sura <sura.andrei@gmail.com> # Ruchi Vivek Desai <ruchivdesai@gmail.com> # Sanath Pasumarthy <sanath@ufl.edu> from flask_user import UserManager, SQLAlchemyAdapter import logging def do_init(app, db, extra_...
# Goal: Init the application routes and read the settings # # @authors: # Andrei Sura <sura.andrei@gmail.com> # Ruchi Vivek Desai <ruchivdesai@gmail.com> # Sanath Pasumarthy <sanath@ufl.edu> from flask_user import UserManager, SQLAlchemyAdapter import logging from logging import Formatter...
Call `configure_logging` to enable more debug information
Call `configure_logging` to enable more debug information
Python
bsd-3-clause
indera/redi-dropper-client,indera/redi-dropper-client,indera/redi-dropper-client,indera/redi-dropper-client,indera/redi-dropper-client
--- +++ @@ -7,7 +7,7 @@ from flask_user import UserManager, SQLAlchemyAdapter import logging - +from logging import Formatter def do_init(app, db, extra_settings={}): """ @@ -30,5 +30,21 @@ #from redidropper.models import UserEntity #from redidropper.models import UserAuthEntity + configure...
0cf393c9bafbe99e29a76cf289f34ac8edcc9416
pianette/PianetteApi.py
pianette/PianetteApi.py
# coding: utf-8 from pianette.utils import Debug from flask import Flask, render_template, request from threading import Thread app = Flask(__name__, template_folder='../templates') import logging log = logging.getLogger('werkzeug') log.setLevel(logging.ERROR) @app.route('/', methods = ['GET']) def home(): retur...
# coding: utf-8 from pianette.utils import Debug from flask import Flask, render_template, request from threading import Thread app = Flask(__name__, template_folder='../templates') import logging log = logging.getLogger('werkzeug') log.setLevel(logging.ERROR) @app.route('/', methods = ['GET']) def home(): retur...
Add external IP for Flask
Add external IP for Flask
Python
mit
tchapi/pianette,tchapi/pianette,tchapi/pianette,tchapi/pianette
--- +++ @@ -32,4 +32,4 @@ t.start() def startApi(self): - app.run(debug=False, threaded=True) + app.run(debug=False, threaded=True, host=0.0.0.0)
2205ea40f64b09f611b7f6cb4c9716d8e29136d4
grammpy/Rule.py
grammpy/Rule.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """ class Rule: pass
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """ from grammpy import EPSILON class Rule: right = [EPSILON] left = [EPSILON] rule = ([EPSILON], [EPSILON]) rules = [([EPSILON], [EPSILON])] def is_regular(self): return False ...
Add base interface for rule
Add base interface for rule
Python
mit
PatrikValkovic/grammpy
--- +++ @@ -7,6 +7,23 @@ """ +from grammpy import EPSILON + class Rule: - pass + right = [EPSILON] + left = [EPSILON] + rule = ([EPSILON], [EPSILON]) + rules = [([EPSILON], [EPSILON])] + + def is_regular(self): + return False + + def is_contextfree(self): + return False + + ...
0ea263fa9a496d8dbd8ff3f966cc23eba170842c
django_mfa/models.py
django_mfa/models.py
from django.db import models from django.conf import settings class UserOTP(models.Model): OTP_TYPES = ( ('HOTP', 'hotp'), ('TOTP', 'totp'), ) user = models.OneToOneField(settings.AUTH_USER_MODEL) otp_type = models.CharField(max_length=20, choices=OTP_TYPES) secre...
from django.conf import settings from django.db import models class UserOTP(models.Model): OTP_TYPES = ( ('HOTP', 'hotp'), ('TOTP', 'totp'), ) user = models.OneToOneField(settings.AUTH_USER_MODEL) otp_type = models.CharField(max_length=20, choices=OTP_TYPES) secret_key = models.C...
Remove try/except from determing if mfa is enabled
Remove try/except from determing if mfa is enabled
Python
mit
MicroPyramid/django-mfa,MicroPyramid/django-mfa,MicroPyramid/django-mfa
--- +++ @@ -1,12 +1,12 @@ +from django.conf import settings from django.db import models -from django.conf import settings class UserOTP(models.Model): OTP_TYPES = ( - ('HOTP', 'hotp'), - ('TOTP', 'totp'), + ('HOTP', 'hotp'), + ('TOTP', 'totp'), ) u...
2bdbcf41cc99f9c7430f8d429cc8d2a5e2ee6701
pyrho/NEURON/minimal.py
pyrho/NEURON/minimal.py
# minNEURON.py cell = h.SectionList() soma = h.Section(name='soma') #create soma soma.push() #h.topology() # Geometry soma.nseg = 1 soma.L = 20 soma.diam = 20 # Biophysics for sec in h.allsec(): sec.Ra = 100 sec.cm = 1 sec.insert('pas') #sec.insert('hh') # insert hh cell.append(sec) #h('objre...
# minNEURON.py from neuron import h cell = h.SectionList() soma = h.Section(name='soma') #create soma soma.push() #h.topology() # Geometry soma.nseg = 1 soma.L = 20 soma.diam = 20 # Biophysics for sec in h.allsec(): sec.Ra = 100 sec.cm = 1 sec.insert('pas') #sec.insert('hh') # insert hh cell.a...
Add import to stop warnings
Add import to stop warnings
Python
bsd-3-clause
ProjectPyRhO/PyRhO,ProjectPyRhO/PyRhO
--- +++ @@ -1,4 +1,5 @@ # minNEURON.py +from neuron import h cell = h.SectionList() soma = h.Section(name='soma') #create soma @@ -36,4 +37,4 @@ -return cell +#return cell
800d69acf0e7a68d39e0e258258b750d3b8e0ace
debugtools/__init__.py
debugtools/__init__.py
# following PEP 386 __version__ = "1.2" VERSION = (1, 2) # Make sure the ``{% print %}`` is always available, even without a {% load debug_tags %} call. # **NOTE** this uses the undocumented, unofficial add_to_builtins() call. It's not promoted # by Django developers because it's better to be explicit with a {% load ...
# following PEP 386 __version__ = "1.2" VERSION = (1, 2) # Make sure the ``{% print %}`` is always available, even without a {% load debug_tags %} call. # **NOTE** this uses the undocumented, unofficial add_to_builtins() call. It's not promoted # by Django developers because it's better to be explicit with a {% load ...
Fix add_to_builtins import for Django 1.7 support
Fix add_to_builtins import for Django 1.7 support Older Django versions also use this location already.
Python
apache-2.0
edoburu/django-debugtools,edoburu/django-debugtools,edoburu/django-debugtools
--- +++ @@ -10,5 +10,5 @@ # This function is used here nevertheless because the {% print %} tag is a debugging aid, # and not a tag that should remain permanently in your templates. Convenience is preferred here. # -from django.template.loader import add_to_builtins +from django.template.base import add_to_builtin...
be16b3c2b67f160e46ed951a8e9e691bc09b8d05
easypyplot/pdf.py
easypyplot/pdf.py
""" * Copyright (c) 2016. Mingyu Gao * All rights reserved. * """ import matplotlib.backends.backend_pdf from .format import paper_plot def plot_setup(name, dims, fontsize=9): """ Setup a PDF page for plot. name: PDF file name. If not ending with .pdf, will automatically append. dims: dimension of the...
""" * Copyright (c) 2016. Mingyu Gao * All rights reserved. * """ from contextlib import contextmanager import matplotlib.backends.backend_pdf from .format import paper_plot def plot_setup(name, figsize=None, fontsize=9): """ Setup a PDF page for plot. name: PDF file name. If not ending with .pdf, will au...
Add a context manager for PDF plot.
Add a context manager for PDF plot.
Python
bsd-3-clause
gaomy3832/easypyplot,gaomy3832/easypyplot
--- +++ @@ -3,22 +3,23 @@ * All rights reserved. * """ +from contextlib import contextmanager import matplotlib.backends.backend_pdf + from .format import paper_plot - -def plot_setup(name, dims, fontsize=9): +def plot_setup(name, figsize=None, fontsize=9): """ Setup a PDF page for plot. name: PD...
792d0ace4f84023d1132f8d61a88bd48e3d7775d
test/contrib/test_pyopenssl.py
test/contrib/test_pyopenssl.py
from nose.plugins.skip import SkipTest from urllib3.packages import six if six.PY3: raise SkipTest('Testing of PyOpenSSL disabled on PY3') try: from urllib3.contrib.pyopenssl import (inject_into_urllib3, extract_from_urllib3) except ImportError as e: raise SkipTe...
from nose.plugins.skip import SkipTest from urllib3.packages import six try: from urllib3.contrib.pyopenssl import (inject_into_urllib3, extract_from_urllib3) except ImportError as e: raise SkipTest('Could not import PyOpenSSL: %r' % e) from ..with_dummyserver.test_...
Enable PyOpenSSL testing on Python 3.
Enable PyOpenSSL testing on Python 3.
Python
mit
Lukasa/urllib3,haikuginger/urllib3,Disassem/urllib3,urllib3/urllib3,Disassem/urllib3,haikuginger/urllib3,urllib3/urllib3,sigmavirus24/urllib3,sigmavirus24/urllib3,Lukasa/urllib3
--- +++ @@ -1,8 +1,5 @@ from nose.plugins.skip import SkipTest from urllib3.packages import six - -if six.PY3: - raise SkipTest('Testing of PyOpenSSL disabled on PY3') try: from urllib3.contrib.pyopenssl import (inject_into_urllib3,
ad4ecad2e5785ddeb7bbd595e59dc12345c4b256
xbob/blitz/__init__.py
xbob/blitz/__init__.py
#!/usr/bin/env python # vim: set fileencoding=utf-8 : # Andre Anjos <andre.anjos@idiap.ch> # Fri 20 Sep 14:45:01 2013 """Blitz++ Array bindings for Python""" import pkg_resources from ._library import array, as_blitz from . import version from .version import module as __version__ from .version import api as __api_v...
#!/usr/bin/env python # vim: set fileencoding=utf-8 : # Andre Anjos <andre.anjos@idiap.ch> # Fri 20 Sep 14:45:01 2013 """Blitz++ Array bindings for Python""" import pkg_resources from ._library import array, as_blitz from . import version from .version import module as __version__ from .version import api as __api_v...
Add API number in get_config()
Add API number in get_config()
Python
bsd-3-clause
tiagofrepereira2012/bob.blitz,tiagofrepereira2012/bob.blitz,tiagofrepereira2012/bob.blitz
--- +++ @@ -27,7 +27,8 @@ this = packages[0] deps = packages[1:] - retval = "%s: %s (%s)\n" % (this.key, this.version, this.location) + retval = "%s: %s [api=0x%04x] (%s)\n" % (this.key, this.version, + version.api, this.location) retval += " - c/c++ dependencies:\n" for k in sorted(externals)...
0388ab2bb8ad50aa40716a1c5f83f5e1f400bb32
scripts/start_baxter.py
scripts/start_baxter.py
#!/usr/bin/python from baxter_myo.arm_controller import ArmController from baxter_myo.config_reader import ConfigReader def main(): c = ConfigReader("demo_config") c.parse_all() s = ArmController('right', c.right_angles, c.push_thresh) s.move_loop() if __name__ == "__main__": main()
#!/usr/bin/python import time import rospy from baxter_myo.arm_controller import ArmController from baxter_myo.config_reader import ConfigReader def main(): c = ConfigReader("demo_config") c.parse_all() s = ArmController('right', c.right_angles, c.push_thresh) while not rospy.is_shutdown(): s...
Enable ctrl-c control with rospy
Enable ctrl-c control with rospy
Python
mit
ipab-rad/baxter_myo,ipab-rad/myo_baxter_pc,ipab-rad/myo_baxter_pc,ipab-rad/baxter_myo
--- +++ @@ -1,4 +1,6 @@ #!/usr/bin/python +import time +import rospy from baxter_myo.arm_controller import ArmController from baxter_myo.config_reader import ConfigReader @@ -8,7 +10,8 @@ c = ConfigReader("demo_config") c.parse_all() s = ArmController('right', c.right_angles, c.push_thresh) - s...
f198941de6191ef9f729d1d8758c588654598f48
runtests.py
runtests.py
#!/usr/bin/env python from __future__ import unicode_literals import os, sys import six try: from django.conf import settings except ImportError: print("Django has not been installed.") sys.exit(0) if not settings.configured: settings.configure( INSTALLED_APPS=["jstemplate"], DATABAS...
#!/usr/bin/env python from __future__ import unicode_literals import os, sys try: import six from django.conf import settings except ImportError: print("Django has not been installed.") sys.exit(0) if not settings.configured: settings.configure( INSTALLED_APPS=["jstemplate"], DAT...
Check whether six has been installed before running tests
Check whether six has been installed before running tests
Python
bsd-3-clause
mjumbewu/django-jstemplate,mjumbewu/django-jstemplate,bopo/django-jstemplate,bopo/django-jstemplate,bopo/django-jstemplate,mjumbewu/django-jstemplate
--- +++ @@ -2,9 +2,9 @@ from __future__ import unicode_literals import os, sys -import six try: + import six from django.conf import settings except ImportError: print("Django has not been installed.")
0b8e99a6c7ecf5b35c61ce4eed1b2eec3110d41d
runtests.py
runtests.py
import os import sys # Force this to happen before loading django try: os.environ["DJANGO_SETTINGS_MODULE"] = "testtinymce.settings" test_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, test_dir) except ImportError: pass else: import django from django.conf ...
import argparse import os import sys # Force this to happen before loading django try: os.environ["DJANGO_SETTINGS_MODULE"] = "testtinymce.settings" test_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, test_dir) except ImportError: pass else: import django f...
Add ability to run tests with verbosity and failfast options
Add ability to run tests with verbosity and failfast options
Python
mit
aljosa/django-tinymce,aljosa/django-tinymce,aljosa/django-tinymce,aljosa/django-tinymce
--- +++ @@ -1,3 +1,4 @@ +import argparse import os import sys @@ -14,13 +15,28 @@ from django.test.utils import get_runner -def runtests(): +def runtests(verbosity=1, failfast=False): django.setup() TestRunner = get_runner(settings) - test_runner = TestRunner(verbosity=1, interactive=True) +...
50a88c05c605f5157eebadb26e30f418dc3251b6
tests/teamscale_client_test.py
tests/teamscale_client_test.py
import requests import responses from teamscale_client.teamscale_client import TeamscaleClient def get_client(): return TeamscaleClient("http://localhost:8080", "admin", "admin", "foo") @responses.activate def test_put(): responses.add(responses.PUT, 'http://localhost:8080', body='succes...
import requests import responses import re from teamscale_client.teamscale_client import TeamscaleClient URL = "http://localhost:8080" def get_client(): return TeamscaleClient(URL, "admin", "admin", "foo") def get_project_service_mock(service_id): return re.compile(r'%s/p/foo/%s/.*' % (URL, service_id)) def...
Add basic execution tests for upload methods
Add basic execution tests for upload methods
Python
apache-2.0
cqse/teamscale-client-python
--- +++ @@ -1,9 +1,18 @@ import requests import responses +import re from teamscale_client.teamscale_client import TeamscaleClient +URL = "http://localhost:8080" + def get_client(): - return TeamscaleClient("http://localhost:8080", "admin", "admin", "foo") + return TeamscaleClient(URL, "admin", "admin", "...
441eac1b7d9d3f2fb30fbd2faf1dbe8fe3908402
99_misc/control_flow.py
99_misc/control_flow.py
#!/usr/bin/env python # function def sum(op1, op2): return op1 + op2 my_sum = sum print my_sum(1, 2) print my_sum("I am ", "zzz"); # pass print "press ctrl + c to continue" while True: pass
#!/usr/bin/env python # function def sum(op1, op2): return op1 + op2 my_sum = sum print my_sum(1, 2) print my_sum("I am ", "zzz"); # Default value in a fuction init = 12 def accumulate(val = init): val += val return val my_accu = accumulate init = 11 print my_accu() # is 12 + 12 rather than 11 + 11 # pa...
Test default value of a function
Test default value of a function
Python
bsd-2-clause
zzz0072/Python_Exercises,zzz0072/Python_Exercises
--- +++ @@ -7,6 +7,15 @@ print my_sum(1, 2) print my_sum("I am ", "zzz"); +# Default value in a fuction +init = 12 +def accumulate(val = init): + val += val + return val + +my_accu = accumulate +init = 11 +print my_accu() # is 12 + 12 rather than 11 + 11 # pass print "press ctrl + c to continue"
c4cdb8429ab9eeeeb7182191589e0594c201d0d2
glue/_mpl_backend.py
glue/_mpl_backend.py
class MatplotlibBackendSetter(object): """ Import hook to make sure the proper Qt backend is set when importing Matplotlib. """ enabled = True def find_module(self, mod_name, pth): if self.enabled and 'matplotlib' in mod_name: self.enabled = False set_mpl_backen...
class MatplotlibBackendSetter(object): """ Import hook to make sure the proper Qt backend is set when importing Matplotlib. """ enabled = True def find_module(self, mod_name, pth): if self.enabled and 'matplotlib' in mod_name: self.enabled = False set_mpl_backen...
Add missing find_spec for import hook, to avoid issues when trying to set colormap
Add missing find_spec for import hook, to avoid issues when trying to set colormap
Python
bsd-3-clause
stscieisenhamer/glue,saimn/glue,saimn/glue,stscieisenhamer/glue
--- +++ @@ -10,8 +10,9 @@ if self.enabled and 'matplotlib' in mod_name: self.enabled = False set_mpl_backend() - return + def find_spec(self, name, import_path, target_module=None): + pass def set_mpl_backend():
db61a650413d7cf9b225fc3d6f79c706afd33871
grum/api/__init__.py
grum/api/__init__.py
from flask import Blueprint from flask.ext.restful import Api api = Blueprint("api", __name__, template_folder="templates") rest = Api(api) # Import the non-restful resources from grum.api import mailgun # Let's get restful! from grum.api.inbox import Inbox rest.add_resource(Inbox, '/inbox') from grum.api.messages...
from flask import Blueprint from flask.ext.restful import Api api = Blueprint("api", __name__, template_folder="templates") rest = Api(api) # Import the non-restful resources from grum.api import mailgun # Let's get restful! from grum.api.inbox import Inbox rest.add_resource(Inbox, '/inbox') from grum.api.messages...
Move where to post for sending emails
Move where to post for sending emails
Python
mit
Grum-Hackdee/grum-web,Grum-Hackdee/grum-web,Grum-Hackdee/grum-web,Grum-Hackdee/grum-web
--- +++ @@ -17,4 +17,4 @@ from grum.api.accounts import Account, Accounts rest.add_resource(Accounts, '/accounts') -rest.add_resource(Account, '/account/<string:address>') +rest.add_resource(Account, '/accounts/<string:address>')
a2cd647966df4f4af5cfd4679ae3c5793c40ee5d
neo/test/iotest/test_asciisignalio.py
neo/test/iotest/test_asciisignalio.py
# -*- coding: utf-8 -*- """ Tests of neo.io.asciisignalio """ # needed for python 3 compatibility from __future__ import absolute_import, division import unittest from neo.io import AsciiSignalIO from neo.test.iotest.common_io_test import BaseTestIO class TestAsciiSignalIO(BaseTestIO, unittest.TestCase, ): ioc...
# -*- coding: utf-8 -*- """ Tests of neo.io.asciisignalio """ # needed for python 3 compatibility from __future__ import absolute_import, division import unittest from neo.io import AsciiSignalIO from neo.test.iotest.common_io_test import BaseTestIO class TestAsciiSignalIO(BaseTestIO, unittest.TestCase, ): ioc...
Remove problematic file from testing
Remove problematic file from testing
Python
bsd-3-clause
apdavison/python-neo,NeuralEnsemble/python-neo,rgerkin/python-neo,INM-6/python-neo,samuelgarcia/python-neo,JuliaSprenger/python-neo
--- +++ @@ -14,7 +14,7 @@ class TestAsciiSignalIO(BaseTestIO, unittest.TestCase, ): ioclass = AsciiSignalIO - files_to_download = ['File_asciisignal_1.asc', + files_to_download = [#'File_asciisignal_1.asc', 'File_asciisignal_2.txt', 'File_asciisignal_3...
a65eb4af0c35c8e79d44efa6acb546e19008a8ee
elmo/moon_tracker/forms.py
elmo/moon_tracker/forms.py
from django import forms import csv from io import StringIO class BatchMoonScanForm(forms.Form): data = forms.CharField( widget=forms.Textarea(attrs={'class':'form-control monospace'}), ) def clean(self): cleaned_data = super(BatchMoonScanForm, self).clean() raw = StringIO(cleaned...
from django import forms import csv from io import StringIO class BatchMoonScanForm(forms.Form): data = forms.CharField( widget=forms.Textarea(attrs={'class':'form-control monospace'}), ) def clean(self): cleaned_data = super(BatchMoonScanForm, self).clean() raw = StringIO(cleaned...
Improve batch form return data structure.
Improve batch form return data structure.
Python
mit
StephenSwat/eve_lunar_mining_organiser,StephenSwat/eve_lunar_mining_organiser
--- +++ @@ -15,29 +15,43 @@ next(reader) - res = [] + res = {} + current_moon = 0 + percentage_sum = 0 + current_scan = {} for x in reader: print(x) if len(x) == 1: - assert(len(x[0]) > 0) + if len(x[0])...
83fed17149a8b65491b3f418a9f147e3ffe46e9d
prepare_data.py
prepare_data.py
# TODO: Load the csv files into dataframes here. class data_preparer(): def __init__():
# TODO: Load the csv files into dataframes here. import csv import pandas class data_preparer(): def __init__(self): pass def load(self, filename): # X = pandas.DataFrame() # with open(filename) as csvfile: # filereader = csv.reader(csvfile,delimiter=',') X = pandas....
Use 'pandas.read_csv' method to create dataframe
feat: Use 'pandas.read_csv' method to create dataframe
Python
mit
bwc126/MLND-Subvocal
--- +++ @@ -1,5 +1,13 @@ # TODO: Load the csv files into dataframes here. +import csv +import pandas class data_preparer(): - def __init__(): - + def __init__(self): + pass + def load(self, filename): + # X = pandas.DataFrame() + # with open(filename) as csvfile: + # f...
d1d7ec0765b842758b35ee1b5d069536bcd33d59
ereuse_workbench/config.py
ereuse_workbench/config.py
from decouple import AutoConfig from ereuse_workbench.test import TestDataStorageLength class WorkbenchConfig: # Path where find .env file config = AutoConfig(search_path='/home/user/') # Env variables for DH parameters DH_TOKEN = config('DH_TOKEN') DH_HOST = config('DH_HOST') DH_DATABASE = ...
from decouple import AutoConfig from ereuse_workbench.test import TestDataStorageLength class WorkbenchConfig: # Path where find settings.ini file config = AutoConfig(search_path='/home/user/') # Env variables for DH parameters DH_TOKEN = config('DH_TOKEN') DH_HOST = config('DH_HOST') DH_DAT...
Change .env to settings.ini file
Change .env to settings.ini file
Python
agpl-3.0
eReuse/workbench,eReuse/workbench
--- +++ @@ -4,7 +4,7 @@ class WorkbenchConfig: - # Path where find .env file + # Path where find settings.ini file config = AutoConfig(search_path='/home/user/') # Env variables for DH parameters @@ -17,7 +17,7 @@ ) # type: str ## Env variables for WB parameters - WB_BENCHMARK =...
1e7dd0a322e32621468ade5bf390664f1b8b7a8b
fixture/application.py
fixture/application.py
from selenium.webdriver.firefox.webdriver import WebDriver from fixture.session import SessionHelper from fixture.group import GroupHelper from fixture.contact import ContactHelper class Application: def __init__(self): self.wd = WebDriver() self.wd.implicitly_wait(60) self.session = Sess...
from selenium.webdriver.firefox.webdriver import WebDriver from fixture.session import SessionHelper from fixture.group import GroupHelper from fixture.contact import ContactHelper class Application: def __init__(self): self.wd = WebDriver() self.wd.implicitly_wait(5) self.session = Sessi...
Change Wait time from 60 to 5 sec
Change Wait time from 60 to 5 sec
Python
apache-2.0
tkapriyan/python_training
--- +++ @@ -8,7 +8,7 @@ def __init__(self): self.wd = WebDriver() - self.wd.implicitly_wait(60) + self.wd.implicitly_wait(5) self.session = SessionHelper(self) self.group = GroupHelper(self) self.contact = ContactHelper(self)
2b4b4ac3ec238a039717feff727316217c13d294
test/test_cronquot.py
test/test_cronquot.py
import unittest from cronquot.cronquot import has_directory class CronquotTest(unittest.TestCase): def test_has_directory(self): self.assertTrue(has_directory('/tmp')) if __name__ == '__main__': unittest.test()
import unittest import os from cronquot.cronquot import has_directory class CronquotTest(unittest.TestCase): def test_has_directory(self): sample_dir = os.path.join( os.path.dirname(__file__), 'crontab') self.assertTrue(has_directory(sample_dir)) if __name__ == '__main__': un...
Fix to test crontab dir
Fix to test crontab dir
Python
mit
pyohei/cronquot,pyohei/cronquot
--- +++ @@ -1,11 +1,14 @@ import unittest +import os from cronquot.cronquot import has_directory class CronquotTest(unittest.TestCase): def test_has_directory(self): - self.assertTrue(has_directory('/tmp')) + sample_dir = os.path.join( + os.path.dirname(__file__), 'crontab')...
038e619e47a05aadf7e0641dd87b6dc573abe3e5
massa/domain.py
massa/domain.py
# -*- coding: utf-8 -*- from sqlalchemy import ( Column, Date, Integer, MetaData, Numeric, String, Table, create_engine, ) metadata = MetaData() measurement = Table('measurement', metadata, Column('id', Integer, primary_key=True), Column('weight', Numeric(4, 1), nullable=Fals...
# -*- coding: utf-8 -*- from sqlalchemy import ( Column, Date, Integer, MetaData, Numeric, String, Table, create_engine, ) metadata = MetaData() measurement = Table('measurement', metadata, Column('id', Integer, primary_key=True), Column('weight', Numeric(4, 1), nullable=Fals...
Add a function to drop db tables.
Add a function to drop db tables.
Python
mit
jaapverloop/massa
--- +++ @@ -31,3 +31,6 @@ def make_tables(): metadata.create_all() + +def drop_tables(): + metadata.drop_all()
5425c2419b7365969ea8b211432858d599214201
tests/test_archive.py
tests/test_archive.py
from json import load from django_archive import __version__ from .base import BaseArchiveTestCase from .sample.models import Sample class ArchiveTestCase(BaseArchiveTestCase): """ Test that the archive command includes correct data in the archive """ def setUp(self): Sample().save() ...
from json import load from django.core.files.base import ContentFile from django_archive import __version__ from .base import BaseArchiveTestCase from .sample.models import Sample class ArchiveTestCase(BaseArchiveTestCase): """ Test that the archive command includes correct data in the archive """ ...
Update test to ensure attached files are present in archives.
Update test to ensure attached files are present in archives.
Python
mit
nathan-osman/django-archive,nathan-osman/django-archive
--- +++ @@ -1,5 +1,6 @@ from json import load +from django.core.files.base import ContentFile from django_archive import __version__ from .base import BaseArchiveTestCase @@ -11,18 +12,28 @@ Test that the archive command includes correct data in the archive """ + _ATTACHMENT_FILENAME = 'sample.t...
1b5fc874924958664797ba2f1e73835b4cbcef57
mfr/__init__.py
mfr/__init__.py
"""The mfr core module.""" # -*- coding: utf-8 -*- import os __version__ = '0.1.0-alpha' __author__ = 'Center for Open Science' from mfr.core import (render, detect, FileHandler, get_file_extension, register_filehandler, export, get_file_exporters, config, collect_static ) from mfr._config import Config P...
"""The mfr core module.""" # -*- coding: utf-8 -*- import os __version__ = '0.1.0-alpha' __author__ = 'Center for Open Science' from mfr.core import ( render, detect, FileHandler, get_file_extension, register_filehandler, export, get_file_exporters, config, collect_static, Ren...
Add RenderResult to mfr namespace
Add RenderResult to mfr namespace
Python
apache-2.0
TomBaxter/modular-file-renderer,chrisseto/modular-file-renderer,mfraezz/modular-file-renderer,haoyuchen1992/modular-file-renderer,haoyuchen1992/modular-file-renderer,erinspace/modular-file-renderer,rdhyee/modular-file-renderer,CenterForOpenScience/modular-file-renderer,icereval/modular-file-renderer,TomBaxter/modular-f...
--- +++ @@ -6,9 +6,17 @@ __author__ = 'Center for Open Science' -from mfr.core import (render, detect, FileHandler, get_file_extension, - register_filehandler, export, get_file_exporters, - config, collect_static +from mfr.core import ( + render, + detect, + FileHandler, + get_file_extension, +...
0a5331c36cb469b2af10d87ab375d9bd0c6c3fb8
tests/test_lattice.py
tests/test_lattice.py
import rml.lattice def test_create_lattice(): l = rml.lattice.Lattice() assert(len(l)) == 0
import rml.lattice def test_create_lattice(): l = rml.lattice.Lattice() assert(len(l)) == 0 def test_non_negative_lattice(): l = rml.lattice.Lattice() assert(len(l)) >= 0
Test lattince length for non-negative values
Test lattince length for non-negative values
Python
apache-2.0
willrogers/pml,razvanvasile/RML,willrogers/pml
--- +++ @@ -4,3 +4,6 @@ l = rml.lattice.Lattice() assert(len(l)) == 0 +def test_non_negative_lattice(): + l = rml.lattice.Lattice() + assert(len(l)) >= 0
19dc8b7e1535c4cc431b765f95db117175fc7d24
server/admin.py
server/admin.py
from django.contrib import admin from server.models import * class MachineGroupAdmin(admin.ModelAdmin): readonly_fields = ('key',) class MachineAdmin(admin.ModelAdmin): list_display = ('hostname', 'serial') admin.site.register(UserProfile) admin.site.register(BusinessUnit) admin.site.register(MachineGroup...
from django.contrib import admin from server.models import * class ApiKeyAdmin(admin.ModelAdmin): list_display = ('name', 'public_key', 'private_key') class MachineAdmin(admin.ModelAdmin): list_display = ('hostname', 'serial') class MachineGroupAdmin(admin.ModelAdmin): readonly_fields = ('key',) ad...
Sort registrations. Separate classes of imports. Add API key display.
Sort registrations. Separate classes of imports. Add API key display.
Python
apache-2.0
salopensource/sal,sheagcraig/sal,salopensource/sal,salopensource/sal,sheagcraig/sal,sheagcraig/sal,sheagcraig/sal,salopensource/sal
--- +++ @@ -1,33 +1,38 @@ from django.contrib import admin + from server.models import * + + +class ApiKeyAdmin(admin.ModelAdmin): + list_display = ('name', 'public_key', 'private_key') + + +class MachineAdmin(admin.ModelAdmin): + list_display = ('hostname', 'serial') class MachineGroupAdmin(admin.ModelA...
b5aacae66d4395a3c507c661144b21f9b2838a0f
utils/dakota_utils.py
utils/dakota_utils.py
#! /usr/bin/env python # # Dakota utility programs. # # Mark Piper (mark.piper@colorado.edu) import numpy as np def get_names(dat_file): ''' Reads the header from Dakota tabular graphics file. Returns a list of variable names. ''' fp = open(dat_file, 'r') return fp.readline().split() def ge...
#! /usr/bin/env python # # Dakota utility programs. # # Mark Piper (mark.piper@colorado.edu) import numpy as np from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt def get_names(dat_file): ''' Reads the header from Dakota tabular graphics file. Returns a list of variable names. ''...
Add routine to make surface plot from Dakota output
Add routine to make surface plot from Dakota output
Python
mit
mdpiper/dakota-experiments,mdpiper/dakota-experiments,mdpiper/dakota-experiments,mcflugen/dakota-experiments,mcflugen/dakota-experiments
--- +++ @@ -5,6 +5,8 @@ # Mark Piper (mark.piper@colorado.edu) import numpy as np +from mpl_toolkits.mplot3d import Axes3D +import matplotlib.pyplot as plt def get_names(dat_file): @@ -19,7 +21,7 @@ def get_data(dat_file): ''' Reads the data from Dakota tabular graphics file. Returns a numpy array...
1c22c7806f459ae385c38a0d952ab324fdbc02d9
lib/ansiblelint/formatters/__init__.py
lib/ansiblelint/formatters/__init__.py
class Formatter(object): def format(self, match): formatstr = "[{0}] {1}\n{2}:{3}\n{4}\n" return formatstr.format(match.rule.id, match.message, match.filename, match.linenumber, ...
class Formatter(object): def format(self, match): formatstr = u"[{0}] {1}\n{2}:{3}\n{4}\n" return formatstr.format(match.rule.id, match.message, match.filename, match.linenumber, ...
Fix crash tasks with unicode string name (like name: héhé).
Fix crash tasks with unicode string name (like name: héhé).
Python
mit
MatrixCrawler/ansible-lint,willthames/ansible-lint,dataxu/ansible-lint
--- +++ @@ -1,7 +1,7 @@ class Formatter(object): def format(self, match): - formatstr = "[{0}] {1}\n{2}:{3}\n{4}\n" + formatstr = u"[{0}] {1}\n{2}:{3}\n{4}\n" return formatstr.format(match.rule.id, match.message, match.fi...
64368ac4d5d90de7df92110364b165be975719c9
manager/apps/brand/urls.py
manager/apps/brand/urls.py
from django.conf.urls import patterns, url from manager.apps.brand.views import BrandListView, BrandView from manager.apps.brand.views import OwnerListView, OwnerView urlpatterns = patterns( '', url(r'^brand$', BrandListView.as_view(), name='brandlist'), url(r'^brand/(?P<bsin>[1-9A-NP-Z]{6})', BrandView.as...
from django.conf.urls import patterns, url from manager.apps.brand.views import BrandListView, BrandView from manager.apps.brand.views import OwnerListView, OwnerView urlpatterns = patterns( '', url(r'^brand/$', BrandListView.as_view(), name='brandlist'), url(r'^brand/(?P<bsin>[1-9A-NP-Z]{6})', BrandView.a...
Fix Brand and Owner public links (missing / would get a 404 on brand/ and owner/)
Fix Brand and Owner public links (missing / would get a 404 on brand/ and owner/) Also follow the same URL scheme as admin (which always have trailing slash)
Python
mit
okfn/opd-brand-manager,okfn/opd-brand-manager,okfn/brand-manager,okfn/brand-manager
--- +++ @@ -4,9 +4,9 @@ urlpatterns = patterns( '', - url(r'^brand$', BrandListView.as_view(), name='brandlist'), + url(r'^brand/$', BrandListView.as_view(), name='brandlist'), url(r'^brand/(?P<bsin>[1-9A-NP-Z]{6})', BrandView.as_view(), name='brand'), - url(r'^owner$', OwnerListView.as_view()...
50ca3fa53b6bb22dbd38b75cc4cf2244b0a2767c
python/setup.py
python/setup.py
# coding: utf-8 from distutils.core import setup setup( name = 'gherkin3', packages = ['gherkin3'], version = '3.0.0', description = 'Gherkin parser', author = 'Björn Rasmusson', author_email = 'cukes@googlegroups.com', url = 'https://github.com/cucumber/gherkin-python', license = 'MIT', download_url ...
# coding: utf-8 from distutils.core import setup setup( name = 'gherkin3', packages = ['gherkin3'], version = '3.0.0', description = 'Gherkin parser', author = 'Björn Rasmusson', author_email = 'cukes@googlegroups.com', url = 'https://github.com/cucumber/gherkin-python', license = 'MIT', download_url ...
Correct the download url for gherkin-python
Correct the download url for gherkin-python
Python
mit
chebizarro/gherkin3,curzona/gherkin3,Zearin/gherkin3,thetutlage/gherkin3,Zearin/gherkin3,hayd/gherkin3,thiblahute/gherkin3,thetutlage/gherkin3,SabotageAndi/gherkin,concertman/gherkin3,SabotageAndi/gherkin,moreirap/gherkin3,concertman/gherkin3,concertman/gherkin3,concertman/gherkin3,concertman/gherkin3,SabotageAndi/gher...
--- +++ @@ -9,7 +9,7 @@ author_email = 'cukes@googlegroups.com', url = 'https://github.com/cucumber/gherkin-python', license = 'MIT', - download_url = 'https://github.com/cucumber/gherkin-ruby/archive/v3.0.0.tar.gz', + download_url = 'https://github.com/cucumber/gherkin-python/archive/v3.0.0.tar.gz', ke...
f5a3148ed638c65a3de3e1de0e5dece96f0c049b
placidity/plugin_loader.py
placidity/plugin_loader.py
class PluginLoader: def load(self, directory): ret = [] for plugin in directory.children: plugin_file = plugin.find(name=plugin.name, type='py') plugin_class = plugin_file.classes[plugin.name] self._check_attributes(plugin_class) plugin_instance = ...
class PluginLoader: def load(self, directory): ret = [] for plugin in directory.children: plugin_file = plugin.find(name=plugin.name, type='py') if not plugin_file: continue plugin_class = plugin_file.classes[plugin.name] ...
Make plugin loader more robust
Make plugin loader more robust
Python
mit
bebraw/Placidity
--- +++ @@ -5,6 +5,10 @@ for plugin in directory.children: plugin_file = plugin.find(name=plugin.name, type='py') + + if not plugin_file: + continue + plugin_class = plugin_file.classes[plugin.name] self._check_attributes(plugi...
d39edc6d3e02adeb3cd89ca13fdb9660be3247b4
hydromet/__init__.py
hydromet/__init__.py
from hydromet import disaggregate from hydromet import models from hydromet import stats from ._version import get_versions __version__ = get_versions()['version'] del get_versions
from hydromet import disaggregate #from hydromet import models from hydromet import stats from ._version import get_versions __version__ = get_versions()['version'] del get_versions
Disable import so that hydromet can be used w/o hydromath.so
Disable import so that hydromet can be used w/o hydromath.so Should make the code for finding/not working if hydromath.so isn't available a bit more robust, but in the mean time disabling an import so that other parts of hydromet can be used without requiring hydromath.
Python
bsd-3-clause
amacd31/hydromet-toolkit,amacd31/hydromet-toolkit
--- +++ @@ -1,5 +1,5 @@ from hydromet import disaggregate -from hydromet import models +#from hydromet import models from hydromet import stats from ._version import get_versions
b1b8c9b4e392d4865756ece6528e6668e2bc8975
wafw00f/plugins/expressionengine.py
wafw00f/plugins/expressionengine.py
#!/usr/bin/env python NAME = 'Expression Engine (EllisLab)' def is_waf(self): for attack in self.attacks: r = attack(self) if r is None: return response, page = r # There are traces found where cookie is returning values like: # Set-Cookie: exp_last_query=834y...
#!/usr/bin/env python NAME = 'Expression Engine (EllisLab)' def is_waf(self): for attack in self.attacks: r = attack(self) if r is None: return response, page = r # There are traces found where cookie is returning values like: # Set-Cookie: exp_last_query=834y...
Fix to avoid NoneType bugs
Fix to avoid NoneType bugs
Python
bsd-3-clause
EnableSecurity/wafw00f
--- +++ @@ -13,8 +13,9 @@ # There are traces found where cookie is returning values like: # Set-Cookie: exp_last_query=834y8d73y94d8g983u4shn8u4shr3uh3 # Set-Cookie: exp_last_id=b342b432b1a876r8 - if 'exp_last_' in response.getheader('Set-Cookie'): - return True + i...
bf241d6c7aa96c5fca834eb1063fc009a9320329
portfolio/urls.py
portfolio/urls.py
from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.home, name='home'), url(r'^about/$', views.about, name='about'), url(r'^contact/$', views.contact, name='contact'), url(r'^projects/$', views.projects, name='projects'), url(r'^tribute/$', views.tribute, name='tri...
from django.conf.urls import url from django.views.generic import TemplateView from . import views urlpatterns = [ url(r'^$', views.home, name='home'), url(r'^about/$', views.about, name='about'), url(r'^contact/$', TemplateView.as_view(template_name="contact.html"), name='contact'), # url(r'^contact/$...
Change URL pattern for contacts
Change URL pattern for contacts
Python
mit
bacarlino/portfolio,bacarlino/portfolio,bacarlino/portfolio
--- +++ @@ -1,10 +1,12 @@ from django.conf.urls import url +from django.views.generic import TemplateView from . import views urlpatterns = [ url(r'^$', views.home, name='home'), url(r'^about/$', views.about, name='about'), - url(r'^contact/$', views.contact, name='contact'), + url(r'^contact/$',...
6e433c59348ed4c47c040efb50c891c4759bcee4
jedihttp/__main__.py
jedihttp/__main__.py
# Copyright 2015 Cedraro Andrea <a.cedraro@gmail.com> # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
# Copyright 2015 Cedraro Andrea <a.cedraro@gmail.com> # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
Add command-line argument for server host
Add command-line argument for server host
Python
apache-2.0
vheon/JediHTTP,micbou/JediHTTP,micbou/JediHTTP,vheon/JediHTTP
--- +++ @@ -21,16 +21,17 @@ def ParseArgs(): parser = argparse.ArgumentParser() + parser.add_argument( '--host', type = str, default = '127.0.0.1', + help = 'server host' ) parser.add_argument( '--port', type = int, default = 0, - help = 'server port') - + ...
2ee8011b6c793c862b55272bf76c109c71fb5aaa
eigen/3.2/test/conanfile.py
eigen/3.2/test/conanfile.py
from conans.model.conan_file import ConanFile from conans import CMake import os class DefaultNameConan(ConanFile): name = "DefaultName" version = "0.1" settings = "os", "compiler", "arch", "build_type" generators = "cmake" requires = "eigen/3.2@jslee02/testing" def build(self): cmake ...
from conans.model.conan_file import ConanFile from conans import CMake import os class DefaultNameConan(ConanFile): name = "DefaultName" version = "0.1" settings = "os", "compiler", "arch", "build_type" generators = "cmake" requires = "eigen/3.2@jslee02/stable" def build(self): cmake =...
Test stable channel instead of testing channel for eigen
Test stable channel instead of testing channel for eigen
Python
bsd-2-clause
jslee02/conan-dart,jslee02/conan-dart,jslee02/conan-dart
--- +++ @@ -7,7 +7,7 @@ version = "0.1" settings = "os", "compiler", "arch", "build_type" generators = "cmake" - requires = "eigen/3.2@jslee02/testing" + requires = "eigen/3.2@jslee02/stable" def build(self): cmake = CMake(self.settings)
bd4506dc95ee7a778a5b0f062d6d0423ade5890c
alerts/lib/alert_plugin_set.py
alerts/lib/alert_plugin_set.py
from mozdef_util.plugin_set import PluginSet from mozdef_util.utilities.logger import logger class AlertPluginSet(PluginSet): def send_message_to_plugin(self, plugin_class, message, metadata=None): if 'utctimestamp' in message and 'summary' in message: message_log_str = '{0} received message:...
from mozdef_util.plugin_set import PluginSet class AlertPluginSet(PluginSet): def send_message_to_plugin(self, plugin_class, message, metadata=None): return plugin_class.onMessage(message), metadata
Remove logger entry for alert plugins receiving alerts
Remove logger entry for alert plugins receiving alerts
Python
mpl-2.0
mozilla/MozDef,jeffbryner/MozDef,jeffbryner/MozDef,mpurzynski/MozDef,mpurzynski/MozDef,mozilla/MozDef,jeffbryner/MozDef,mpurzynski/MozDef,jeffbryner/MozDef,mpurzynski/MozDef,mozilla/MozDef,mozilla/MozDef
--- +++ @@ -1,12 +1,7 @@ from mozdef_util.plugin_set import PluginSet -from mozdef_util.utilities.logger import logger class AlertPluginSet(PluginSet): def send_message_to_plugin(self, plugin_class, message, metadata=None): - if 'utctimestamp' in message and 'summary' in message: - mess...
1a4d2ea23ad37b63bab1751b7f3b7572f6804f14
api/base/exceptions.py
api/base/exceptions.py
from rest_framework import status from rest_framework.exceptions import APIException def json_api_exception_handler(exc, context): """ Custom exception handler that returns errors object as an array """ # Import inside method to avoid errors when the OSF is loaded without Django from rest_framework.view...
from rest_framework import status from rest_framework.exceptions import APIException def json_api_exception_handler(exc, context): """ Custom exception handler that returns errors object as an array """ # Import inside method to avoid errors when the OSF is loaded without Django from rest_framework.view...
Use if response since 'is not None' is unnecessary.
Use if response since 'is not None' is unnecessary.
Python
apache-2.0
Johnetordoff/osf.io,njantrania/osf.io,pattisdr/osf.io,baylee-d/osf.io,GageGaskins/osf.io,brandonPurvis/osf.io,mfraezz/osf.io,TomHeatwole/osf.io,cosenal/osf.io,erinspace/osf.io,caneruguz/osf.io,crcresearch/osf.io,binoculars/osf.io,RomanZWang/osf.io,samanehsan/osf.io,doublebits/osf.io,caseyrygt/osf.io,TomHeatwole/osf.io,...
--- +++ @@ -14,7 +14,7 @@ top_level_error_keys = ['id', 'links', 'status', 'code', 'detail', 'source', 'meta'] errors = [] - if response is not None: + if response: message = response.data if isinstance(message, dict): for key, value in message.iteritems():
b5c9931d75b64d11681f40a7c7badea810f8592a
spiff/__init__.py
spiff/__init__.py
import logging import inspect def funcLog(): frame = inspect.stack()[1] localVars = frame[0].f_locals if 'self' in localVars: logName = '%s.%s.%s'%(localVars['self'].__class__.__module__, localVars['self'].__class__.__name__, frame[3]) else: logName = '%s.%s'%(frame[0].f_globals['__name__'], frame[3]) ...
import logging import inspect def funcLog(*args, **kwargs): frame = inspect.stack()[1] localVars = frame[0].f_locals if 'self' in localVars: logName = '%s.%s.%s'%(localVars['self'].__class__.__module__, localVars['self'].__class__.__name__, frame[3]) else: logName = '%s.%s'%(frame[0].f_globals['__name_...
Add a funcLog shortcut to debug
Add a funcLog shortcut to debug
Python
agpl-3.0
SYNHAK/spiff,SYNHAK/spiff,SYNHAK/spiff
--- +++ @@ -1,11 +1,14 @@ import logging import inspect -def funcLog(): +def funcLog(*args, **kwargs): frame = inspect.stack()[1] localVars = frame[0].f_locals if 'self' in localVars: logName = '%s.%s.%s'%(localVars['self'].__class__.__module__, localVars['self'].__class__.__name__, frame[3]) els...
d87cb6b401e38a06c5d594e40ad813a9db0738e6
taca/analysis/cli.py
taca/analysis/cli.py
""" CLI for the analysis subcommand """ import click from taca.analysis import analysis as an @click.group() def analysis(): """ Analysis methods entry point """ pass # analysis subcommands @analysis.command() @click.option('-r', '--run', type=click.Path(exists=True), default=None, help='Demultiplex only a pa...
""" CLI for the analysis subcommand """ import click from taca.analysis import analysis as an @click.group() def analysis(): """ Analysis methods entry point """ pass # analysis subcommands @analysis.command() @click.option('-r', '--run', type=click.Path(exists=True), default=None, help='Demultiplex only a pa...
Add option for triggering or not the analysis
Add option for triggering or not the analysis
Python
mit
senthil10/TACA,kate-v-stepanova/TACA,SciLifeLab/TACA,SciLifeLab/TACA,vezzi/TACA,guillermo-carrasco/TACA,senthil10/TACA,b97pla/TACA,kate-v-stepanova/TACA,SciLifeLab/TACA,b97pla/TACA,guillermo-carrasco/TACA,vezzi/TACA
--- +++ @@ -19,7 +19,8 @@ an.run_preprocessing(run) @analysis.command() +@click.option('-a','--analysis', is_flag=True, help='Trigger the analysis for the transferred flowcell') @click.argument('rundir') -def transfer(rundir): +def transfer(rundir, analysis): """Transfers the run without qc""" - an.tran...
74a76dd7e21c4248d6a19e55fde69b92169d4008
osmfilter/parsing.py
osmfilter/parsing.py
from .compat import etree from .entities import Node, Way, Relation def parse(fp): context = etree.iterparse(fp, events=('end',)) for action, elem in context: # Act only on node, ways and relations if elem.tag not in ('node', 'way', 'relation'): continue tags = {t.get('k'...
from threading import Thread from .compat import etree from .entities import Node, Way, Relation def xml_node_cleanup(elem): elem.clear() while elem.getprevious() is not None: del elem.getparent()[0] def parse(fp): context = etree.iterparse(fp, events=('end',)) for action, elem in context:...
Make Reader subclass of Thread
Make Reader subclass of Thread
Python
mit
gileri/osmfiltering
--- +++ @@ -1,5 +1,13 @@ +from threading import Thread + from .compat import etree from .entities import Node, Way, Relation + + +def xml_node_cleanup(elem): + elem.clear() + while elem.getprevious() is not None: + del elem.getparent()[0] def parse(fp): @@ -20,14 +28,20 @@ nodes = [n....
675c6d78738a56cc556984553216ce92cf0ecd94
test/parseResults.py
test/parseResults.py
#!/usr/bin/env python3 import json import sys PREFIXES = [ ["FAIL", "PASS"], ["EXPECTED FAIL", "UNEXPECTED PASS"], ] def parse_expected_failures(): expected_failures = set() with open("expected-failures.txt", "r") as fp: for line in fp: line = line.strip() if not line...
#!/usr/bin/env python3 import json import sys PREFIXES = [ ["FAIL", "PASS"], ["EXPECTED FAIL", "UNEXPECTED PASS"], ] def parse_expected_failures(): expected_failures = set() with open("expected-failures.txt", "r") as fp: for line in fp: line = line.strip() if not line...
Print the scenario when running 262-style tests.
Print the scenario when running 262-style tests.
Python
isc
js-temporal/temporal-polyfill,js-temporal/temporal-polyfill,js-temporal/temporal-polyfill
--- +++ @@ -31,7 +31,7 @@ for test in results: expected_failure = test["file"] in expected_failures actual_result = test["result"]["pass"] - print("{} {}".format(PREFIXES[expected_failure][actual_result], test["file"])) + print("{} {} ({})".format(PREFIXES[expected_failure][actual...
da516d06ab294dc2dde4bb671ab16653b1421314
tests/performance.py
tests/performance.py
"""Script to run performance check.""" import time from examples.game_of_life import GameOfLife, GOLExperiment from xentica.utils.formatters import sizeof_fmt MODELS = [ ("Conway's Life", GameOfLife, GOLExperiment), ] NUM_STEPS = 10000 if __name__ == "__main__": for name, model, experiment in MODELS: ...
"""Script to run performance check.""" import time from examples.game_of_life import ( GameOfLife, GOLExperiment ) from examples.shifting_sands import ( ShiftingSands, ShiftingSandsExperiment ) from xentica.utils.formatters import sizeof_fmt MODELS = [ ("Conway's Life", GameOfLife, GOLExperiment), ("...
Add Shifting Sands to benchmark tests
Add Shifting Sands to benchmark tests
Python
mit
a5kin/hecate,a5kin/hecate
--- +++ @@ -1,12 +1,18 @@ """Script to run performance check.""" import time -from examples.game_of_life import GameOfLife, GOLExperiment +from examples.game_of_life import ( + GameOfLife, GOLExperiment +) +from examples.shifting_sands import ( + ShiftingSands, ShiftingSandsExperiment +) from xentica.utils...
d2130b64c63bdcfdea854db39fb21c7efe0b24e1
tests/test_httpheader.py
tests/test_httpheader.py
# MIT licensed # Copyright (c) 2021 lilydjwg <lilydjwg@gmail.com>, et al. import pytest pytestmark = pytest.mark.asyncio async def test_redirection(get_version): assert await get_version("jmeter-plugins-manager", { "source": "httpheader", "url": "https://www.unifiedremote.com/download/linux-x64-d...
# MIT licensed # Copyright (c) 2021 lilydjwg <lilydjwg@gmail.com>, et al. import pytest pytestmark = pytest.mark.asyncio async def test_redirection(get_version): assert await get_version("unifiedremote", { "source": "httpheader", "url": "https://www.unifiedremote.com/download/linux-x64-deb", ...
Correct package name in httpheader test
Correct package name in httpheader test
Python
mit
lilydjwg/nvchecker
--- +++ @@ -6,7 +6,7 @@ pytestmark = pytest.mark.asyncio async def test_redirection(get_version): - assert await get_version("jmeter-plugins-manager", { + assert await get_version("unifiedremote", { "source": "httpheader", "url": "https://www.unifiedremote.com/download/linux-x64-deb", ...
361a1a1ca88630981bb83a85648714c5bc4c5a89
thinc/neural/_classes/feed_forward.py
thinc/neural/_classes/feed_forward.py
from .model import Model from ... import describe def _run_child_hooks(model, X, y): for layer in model._layers: for hook in layer.on_data_hooks: hook(layer, X, y) X = layer(X) @describe.on_data(_run_child_hooks) class FeedForward(Model): '''A feed-forward network, that chains mu...
from .model import Model from ... import describe def _run_child_hooks(model, X, y): for layer in model._layers: for hook in layer.on_data_hooks: hook(layer, X, y) X = layer(X) @describe.on_data(_run_child_hooks) class FeedForward(Model): '''A feed-forward network, that chains mu...
Add predict() path to feed-forward
Add predict() path to feed-forward
Python
mit
explosion/thinc,explosion/thinc,spacy-io/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc
--- +++ @@ -30,6 +30,11 @@ def output_shape(self): return self._layers[-1].output_shape + def predict(self, X): + for layer in self._layers: + X = layer(X) + return X + def begin_update(self, X, drop=0.): callbacks = [] for layer in self._layers:
76d9d1beaebf5b7d8e2ef051c8b8926724542387
regenesis/storage.py
regenesis/storage.py
import os import json from regenesis.core import app def cube_path(cube_name, ext): return os.path.join( app.config.get('DATA_DIRECTORY'), cube_name + '.' + ext ) def store_cube_raw(cube_name, cube_data): fh = open(cube_path(cube_name, 'raw'), 'wb') fh.write(cube_data.e...
import os import json from regenesis.core import app def cube_path(cube_name, ext): return os.path.join( app.config.get('DATA_DIRECTORY'), cube_name + '.' + ext ) def exists_raw(cube_name): return os.path.isfile(cube_path(cube_name, 'raw')) def store_cube_raw(cube_name, cu...
Check if a cube exists on disk.
Check if a cube exists on disk.
Python
mit
pudo/regenesis,pudo/regenesis
--- +++ @@ -7,6 +7,9 @@ app.config.get('DATA_DIRECTORY'), cube_name + '.' + ext ) + +def exists_raw(cube_name): + return os.path.isfile(cube_path(cube_name, 'raw')) def store_cube_raw(cube_name, cube_data): fh = open(cube_path(cube_name, 'raw'), 'wb') @@ -23,3 +26,4 @...
593c2ec0d62049cee9bedc282903491b670d811f
ci/set_secrets_file.py
ci/set_secrets_file.py
""" Move the right secrets file into place for Travis CI. """
""" Move the right secrets file into place for Travis CI. """ import os import shutil from pathlib import Path def move_secrets_file() -> None: """ Move the right secrets file to the current directory. """ branch = os.environ['TRAVIS_BRANCH'] is_pr = os.environ['TRAVIS_PULL_REQUEST'] != 'false' ...
Add script to move secrets file
Add script to move secrets file
Python
mit
adamtheturtle/vws-python,adamtheturtle/vws-python
--- +++ @@ -1,3 +1,28 @@ """ Move the right secrets file into place for Travis CI. """ + +import os +import shutil +from pathlib import Path + + +def move_secrets_file() -> None: + """ + Move the right secrets file to the current directory. + """ + branch = os.environ['TRAVIS_BRANCH'] + is_pr = os.e...
982e523807b42d8258ddcc4b984399b46e8ad74f
tools/tsv_gen_embeddings.py
tools/tsv_gen_embeddings.py
#! /usr/bin/python3 import sys import argparse import xml_utils as u import datetime from collections import defaultdict ##------------------------------------------------------------ ## can be called with: ## tsv_gen_embeddings *.xml dirs ##------------------------------------------------------------ def main (a...
#! /usr/bin/python3 import sys import argparse import xml_utils as u import datetime from collections import defaultdict ##------------------------------------------------------------ ## can be called with: ## tsv_gen_embeddings *.xml dirs ##------------------------------------------------------------ def main (a...
Write out tsv embedding files instead of plotting them.
Write out tsv embedding files instead of plotting them.
Python
mit
hypraptive/bearid,hypraptive/bearid,hypraptive/bearid
--- +++ @@ -27,7 +27,7 @@ print("files: ", args.files) xml_files = u.generate_xml_file_list (args.files) - u.plot_embeddings (xml_files) + u.write_embed_tsv (xml_files) if __name__ == "__main__": main (sys.argv)
663edbc7b19d5cb99a78bc380359a0dbfae1f1aa
cmsplugin_rst/forms.py
cmsplugin_rst/forms.py
from cmsplugin_rst.models import RstPluginModel, rst_help_text from django import forms class RstPluginForm(forms.ModelForm): body = forms.CharField( widget=forms.Textarea(attrs={ 'rows':30, 'cols':80, 'style':'font-family:monospace' ...
from cmsplugin_rst.models import RstPluginModel, rst_help_text from django import forms class RstPluginForm(forms.ModelForm): body = forms.CharField( widget=forms.Textarea(attrs={ 'rows':20, 'cols':80, 'style':'font-family:monospace' ...
Tweak too high textarea for RST text.
Tweak too high textarea for RST text.
Python
bsd-3-clause
ojii/cmsplugin-rst,pakal/cmsplugin-rst
--- +++ @@ -7,7 +7,7 @@ body = forms.CharField( widget=forms.Textarea(attrs={ - 'rows':30, + 'rows':20, 'cols':80, 'style':'font-family:monospace' }),
255a93e2e075a8db914e4736cb79fbdb58b41a24
file_transfer/baltrad_to_s3.py
file_transfer/baltrad_to_s3.py
""" Baltrad to S3 porting """ import sys from creds import URL, LOGIN, PASSWORD import datamover as dm def main(): """Run data transfer from Baltrad to S3""" # ------------------ # DATA TRANSFER # ------------------ # Setup the connection of the Baltrad and S3 btos = dm.BaltradToS3(URL, L...
""" Baltrad to S3 porting """ import sys from creds import URL, LOGIN, PASSWORD import datamover as dm def main(): """Run data transfer from Baltrad to S3""" # ------------------ # DATA TRANSFER # ------------------ # Setup the connection of the Baltrad and S3 btos = dm.BaltradToS3(URL, L...
Extend data pipeline from baltrad
Extend data pipeline from baltrad
Python
mit
enram/data-repository,enram/data-repository,enram/data-repository,enram/data-repository,enram/infrastructure,enram/infrastructure
--- +++ @@ -23,18 +23,25 @@ btos.transfer(name_match="_vp_", overwrite=False, limit=None) btos.report(reset_file=False, transfertype="Baltrad to S3") - # ------------------ - # UPDATE COVERAGE - # ------------------ + # --------------------------------------------- + # UPDATE COVERAGE AND M...
fd721c76e30f776b04c7691ce536525561dd2cfa
sympy/matrices/expressions/transpose.py
sympy/matrices/expressions/transpose.py
from matexpr import MatrixExpr from sympy import Basic class Transpose(MatrixExpr): """Matrix Transpose Represents the transpose of a matrix expression. Use .T as shorthand >>> from sympy import MatrixSymbol, Transpose >>> A = MatrixSymbol('A', 3, 5) >>> B = MatrixSymbol('B', 5, 3) >>> T...
from matexpr import MatrixExpr from sympy import Basic class Transpose(MatrixExpr): """Matrix Transpose Represents the transpose of a matrix expression. Use .T as shorthand >>> from sympy import MatrixSymbol, Transpose >>> A = MatrixSymbol('A', 3, 5) >>> B = MatrixSymbol('B', 5, 3) >>> T...
Remove unnecessary MatAdd and MatMul imports
Remove unnecessary MatAdd and MatMul imports
Python
bsd-3-clause
drufat/sympy,hrashk/sympy,toolforger/sympy,yashsharan/sympy,AunShiLord/sympy,oliverlee/sympy,MridulS/sympy,Arafatk/sympy,shikil/sympy,MechCoder/sympy,lindsayad/sympy,kevalds51/sympy,iamutkarshtiwari/sympy,cswiercz/sympy,mafiya69/sympy,AkademieOlympia/sympy,Designist/sympy,garvitr/sympy,sahmed95/sympy,pandeyadarsh/sympy...
--- +++ @@ -42,6 +42,3 @@ def _eval_transpose(self): return self.arg - -from matmul import MatMul -from matadd import MatAdd
ed40088b5e913e70c161e8148ab76fdc0b6c5c46
clt_utils/argparse.py
clt_utils/argparse.py
from datetime import datetime import argparse import os def is_dir(string): """ Type check for a valid directory for ArgumentParser. """ if not os.path.isdir(string): msg = '{0} is not a directory'.format(string) raise argparse.ArgumentTypeError(msg) return string def is_file(str...
from __future__ import absolute_import from datetime import datetime import argparse as _argparse import os def is_dir(string): """ Type check for a valid directory for ArgumentParser. """ if not os.path.isdir(string): msg = '{0} is not a directory'.format(string) raise _argparse.Argu...
Fix bug with self reference
Fix bug with self reference
Python
apache-2.0
55minutes/clt-utils
--- +++ @@ -1,5 +1,7 @@ +from __future__ import absolute_import + from datetime import datetime -import argparse +import argparse as _argparse import os @@ -9,7 +11,7 @@ """ if not os.path.isdir(string): msg = '{0} is not a directory'.format(string) - raise argparse.ArgumentTypeError(m...
923ae01ab8beadfd73c5275f0c954510d3a13832
coherence/__init__.py
coherence/__init__.py
import platform import sys __version_info__ = (0, 6, 7) __version__ = '.'.join(map(str, __version_info__)) SERVER_ID = ','.join([platform.system(), platform.release(), 'UPnP/1.0,Coherence UPnP framework', __version__]) try: from twisted import ve...
import platform import sys __version__ = "0.6.7.dev0" SERVER_ID = ','.join([platform.system(), platform.release(), 'UPnP/1.0,Coherence UPnP framework', __version__]) try: from twisted import version as twisted_version from twisted.web import ...
Switch to PEP 440 compliant version string and bump to 0.6.7.dev0.
Switch to PEP 440 compliant version string and bump to 0.6.7.dev0.
Python
mit
coherence-project/Coherence,coherence-project/Coherence
--- +++ @@ -1,8 +1,7 @@ import platform import sys -__version_info__ = (0, 6, 7) -__version__ = '.'.join(map(str, __version_info__)) +__version__ = "0.6.7.dev0" SERVER_ID = ','.join([platform.system(), platform.release(),
0202320f5f07437292bfa293c2a6711416dab048
vumi/transports/integrat/failures.py
vumi/transports/integrat/failures.py
# -*- test-case-name: vumi.transports.intergrat.tests.test_failures -*- from vumi.transports.failures import FailureWorker class IntegratFailureWorker(FailureWorker): def do_retry(self, message, reason): message = self.update_retry_metadata(message) self.store_failure(message, reason, message['r...
# -*- test-case-name: vumi.transports.integrat.tests.test_failures -*- from vumi.transports.failures import FailureWorker class IntegratFailureWorker(FailureWorker): def do_retry(self, message, reason): message = self.update_retry_metadata(message) self.store_failure(message, reason, message['re...
Fix link to failure tests.
Fix link to failure tests.
Python
bsd-3-clause
TouK/vumi,TouK/vumi,vishwaprakashmishra/xmatrix,vishwaprakashmishra/xmatrix,vishwaprakashmishra/xmatrix,harrissoerja/vumi,TouK/vumi,harrissoerja/vumi,harrissoerja/vumi
--- +++ @@ -1,4 +1,4 @@ -# -*- test-case-name: vumi.transports.intergrat.tests.test_failures -*- +# -*- test-case-name: vumi.transports.integrat.tests.test_failures -*- from vumi.transports.failures import FailureWorker
b5663776e89b1d406b2b93d291a346bd9235fcf1
wafer/utils.py
wafer/utils.py
import functools import unicodedata from django.core.cache import get_cache from django.conf import settings def normalize_unicode(u): """Replace non-ASCII characters with closest ASCII equivalents where possible. """ return unicodedata.normalize('NFKD', u).encode('ascii', 'ignore') def cache_...
import functools import unicodedata from django.core.cache import get_cache from django.conf import settings def normalize_unicode(u): """Replace non-ASCII characters with closest ASCII equivalents where possible. """ return unicodedata.normalize('NFKD', u).encode('ascii', 'ignore') def cache_...
Add query tracking utility for use in tests.
Add query tracking utility for use in tests.
Python
isc
CarlFK/wafer,CarlFK/wafer,CarlFK/wafer,CTPUG/wafer,CTPUG/wafer,CTPUG/wafer,CTPUG/wafer,CarlFK/wafer
--- +++ @@ -34,3 +34,24 @@ wrapper.invalidate = invalidate return wrapper return decorator + + +class QueryTracker(object): + """ Track queries to database. """ + + def __enter__(self): + from django.conf import settings + from django.db import connection + self._debu...
29f91d362689a53e04557588e47f1ac3e8d0fadc
server/lib/pricing.py
server/lib/pricing.py
def price(printTime, filamentUsed, filament=None): return round((printTime/60/60)*filament['price'])
def price(printTime, filamentUsed, filament=None): return round((printTime/60/60)*200)
Set constant price for all filaments
Set constant price for all filaments
Python
agpl-3.0
MakersLab/custom-print
--- +++ @@ -1,2 +1,2 @@ def price(printTime, filamentUsed, filament=None): - return round((printTime/60/60)*filament['price']) + return round((printTime/60/60)*200)
edd2cc66fff3159699c28c8f86c52e6524ce9d86
social_auth/fields.py
social_auth/fields.py
from django.core.exceptions import ValidationError from django.db import models from django.utils import simplejson class JSONField(models.TextField): """Simple JSON field that stores python structures as JSON strings on database. """ __metaclass__ = models.SubfieldBase def to_python(self, value...
from django.core.exceptions import ValidationError from django.db import models from django.utils import simplejson class JSONField(models.TextField): """Simple JSON field that stores python structures as JSON strings on database. """ __metaclass__ = models.SubfieldBase def to_python(self, value...
Use get_prep_value instead of the database related one. Closes gh-42
Use get_prep_value instead of the database related one. Closes gh-42
Python
bsd-3-clause
vuchau/django-social-auth,getsentry/django-social-auth,1st/django-social-auth,michael-borisov/django-social-auth,michael-borisov/django-social-auth,beswarm/django-social-auth,lovehhf/django-social-auth,omab/django-social-auth,adw0rd/django-social-auth,mayankcu/Django-social,caktus/django-social-auth,antoviaque/django-s...
--- +++ @@ -34,7 +34,7 @@ except Exception, e: raise ValidationError(str(e)) - def get_db_prep_value(self, value, connection, prepared=False): + def get_prep_value(self, value): """Convert value to JSON string before save""" try: return simplejson.dumps(val...
111682e3c19784aa87d5f3d4b56149226e6f9d3b
app/tests/archives_tests/test_models.py
app/tests/archives_tests/test_models.py
import pytest from tests.archives_tests.factories import ArchiveFactory from tests.model_helpers import do_test_factory @pytest.mark.django_db class TestArchivesModels: # test functions are added dynamically to this class def test_study_str(self): model = ArchiveFactory() assert str(model) == ...
import pytest from django.core.exceptions import ObjectDoesNotExist from tests.archives_tests.factories import ArchiveFactory from tests.cases_tests.factories import ImageFactoryWithImageFile from tests.model_helpers import do_test_factory @pytest.mark.django_db class TestArchivesModels: # test functions are add...
Add test for cascading deletion of archive
Add test for cascading deletion of archive
Python
apache-2.0
comic/comic-django,comic/comic-django,comic/comic-django,comic/comic-django,comic/comic-django
--- +++ @@ -1,12 +1,15 @@ import pytest +from django.core.exceptions import ObjectDoesNotExist + from tests.archives_tests.factories import ArchiveFactory +from tests.cases_tests.factories import ImageFactoryWithImageFile from tests.model_helpers import do_test_factory @pytest.mark.django_db class TestArchiv...
0acbe43b91fab6a01b5a773c4ac494d01138f216
engines/mako_engine.py
engines/mako_engine.py
#!/usr/bin/env python3 """Provide the mako templating engine.""" from __future__ import print_function from mako.template import Template from mako.lookup import TemplateLookup from . import Engine class MakoEngine(Engine): """Mako templating engine.""" handle = 'mako' def __init__(self, template, ...
#!/usr/bin/env python3 """Provide the mako templating engine.""" from __future__ import print_function from mako.template import Template from mako.lookup import TemplateLookup from . import Engine class MakoEngine(Engine): """Mako templating engine.""" handle = 'mako' def __init__(self, template, ...
Handle undefined names in tolerant mode in the mako engine.
Handle undefined names in tolerant mode in the mako engine.
Python
mit
blubberdiblub/eztemplate
--- +++ @@ -20,11 +20,19 @@ """Initialize mako template.""" super(MakoEngine, self).__init__(**kwargs) + default_filters = ['filter_undefined'] if tolerant else None encoding_errors = 'replace' if tolerant else 'strict' + imports = ['def filter_undefined(value):\n' + ...
d2a3f9b1118a965774e0002b2a7b480213bb3fde
alignak_backend_client/__init__.py
alignak_backend_client/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Alignak REST backend client library This module is a Python library used the REST API of the Alignak backend """ # Application version and manifest VERSION = (0, 5, 0) __application__ = u"Alignak Backend client" __short_version__ = '.'.join((str(each) for ea...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Alignak REST backend client library This module is a Python library used the REST API of the Alignak backend """ # Application version and manifest VERSION = (0, 5, 1) __application__ = u"Alignak Backend client" __short_version__ = '.'.join((str(each) for ea...
Set version number as 0.5.1
Set version number as 0.5.1
Python
agpl-3.0
Alignak-monitoring-contrib/alignak-backend-client,Alignak-monitoring-contrib/alignakbackend-api-client,Alignak-monitoring-contrib/alignakbackend-api-client,Alignak-monitoring-contrib/alignak-backend-client
--- +++ @@ -8,7 +8,7 @@ This module is a Python library used the REST API of the Alignak backend """ # Application version and manifest -VERSION = (0, 5, 0) +VERSION = (0, 5, 1) __application__ = u"Alignak Backend client" __short_version__ = '.'.join((str(each) for each in VERSION[:2]))
c2364bfe321bc19ab2d648fc77c8111522654237
adhocracy/migration/versions/032_remove_comment_title.py
adhocracy/migration/versions/032_remove_comment_title.py
from datetime import datetime from sqlalchemy import MetaData, Column, ForeignKey, Table from sqlalchemy import DateTime, Integer, Unicode, UnicodeText metadata = MetaData() old_revision_table = Table('revision', metadata, Column('id', Integer, primary_key=True), Column('create_time', DateTime, default=datet...
from datetime import datetime from sqlalchemy import MetaData, Column, ForeignKey, Table from sqlalchemy import DateTime, Integer, Unicode, UnicodeText metadata = MetaData() old_revision_table = Table('revision', metadata, Column('id', Integer, primary_key=True), Column('create_time', DateTime, default=datet...
Remove silly exception inserted for testing
Remove silly exception inserted for testing
Python
agpl-3.0
SysTheron/adhocracy,DanielNeugebauer/adhocracy,SysTheron/adhocracy,DanielNeugebauer/adhocracy,DanielNeugebauer/adhocracy,SysTheron/adhocracy,alkadis/vcv,liqd/adhocracy,alkadis/vcv,phihag/adhocracy,liqd/adhocracy,alkadis/vcv,liqd/adhocracy,phihag/adhocracy,liqd/adhocracy,phihag/adhocracy,DanielNeugebauer/adhocracy,phiha...
--- +++ @@ -36,7 +36,6 @@ migrate_engine.execute(update_statement) revisions_table.c.title.drop() - raise Exception('ksjdfkl') def downgrade(migrate_engine):