commit
stringlengths
40
40
old_file
stringlengths
4
236
new_file
stringlengths
4
236
old_contents
stringlengths
1
3.26k
new_contents
stringlengths
16
4.43k
subject
stringlengths
16
624
message
stringlengths
17
3.29k
lang
stringclasses
5 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
4bf7f15896677b1ffb5678710086e13ff0c3e094
PyFVCOM/__init__.py
PyFVCOM/__init__.py
""" The FVCOM Python toolbox (PyFVCOM) """ __version__ = '1.6.2' __author__ = 'Pierre Cazenave' __credits__ = ['Pierre Cazenave'] __license__ = 'MIT' __maintainer__ = 'Pierre Cazenave' __email__ = 'pica@pml.ac.uk' import inspect from warnings import warn # Import everything! from PyFVCOM import buoy_tools from PyFV...
""" The FVCOM Python toolbox (PyFVCOM) """ __version__ = '1.6.2' __author__ = 'Pierre Cazenave' __credits__ = ['Pierre Cazenave'] __license__ = 'MIT' __maintainer__ = 'Pierre Cazenave' __email__ = 'pica@pml.ac.uk' import inspect from warnings import warn # Import everything! from PyFVCOM import buoy_tools from PyFV...
Fix sorting of the imports.
Fix sorting of the imports.
Python
mit
pwcazenave/PyFVCOM
fcad1fa7187fe81d80b8861df2851402be01b667
PyFVCOM/__init__.py
PyFVCOM/__init__.py
""" The FVCOM Python toolbox (PyFVCOM) """ __version__ = '2.0.0' __author__ = 'Pierre Cazenave' __credits__ = ['Pierre Cazenave'] __license__ = 'MIT' __maintainer__ = 'Pierre Cazenave' __email__ = 'pica@pml.ac.uk' import inspect from warnings import warn # Import everything! from PyFVCOM import buoy from PyFVCOM im...
""" The FVCOM Python toolbox (PyFVCOM) """ __version__ = '2.0.0' __author__ = 'Pierre Cazenave' __credits__ = ['Pierre Cazenave', 'Michael Bedington'] __license__ = 'MIT' __maintainer__ = 'Pierre Cazenave' __email__ = 'pica@pml.ac.uk' import inspect from warnings import warn # Import everything! from PyFVCOM import...
Add Mike as a contributor.
Add Mike as a contributor.
Python
mit
pwcazenave/PyFVCOM
cf2615c2488198bd9f904a4e65ac4fc0e0d6c475
insertion.py
insertion.py
import timeit def insertion(_list): '''Sorts a list via the insertion method.''' if type(_list) is not list: raise TypeError('Entire list must be numbers') for i in range(1, len(_list)): key = _list[i] if not isinstance(key, int): raise TypeError('Entire list must be nu...
import time def timed_func(func): """Decorator for timing our traversal methods.""" def timed(*args, **kwargs): start = time.time() result = func(*args, **kwargs) elapsed = time.time() - start # print "time expired: %s" % elapsed return (result, elapsed) return time...
Add timing to show time complexity.
Add timing to show time complexity.
Python
mit
bm5w/second_dataS
fb8db56ca83a18860ed1ae279d3f390456e224fe
cinder/brick/initiator/host_driver.py
cinder/brick/initiator/host_driver.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 OpenStack Foundation. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apac...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 OpenStack Foundation. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apac...
Check if dir exists before calling listdir
Check if dir exists before calling listdir Changes along the way to how we clean up and detach after copying an image to a volume exposed a problem in the cleanup of the brick/initiator routines. The clean up in the initiator detach was doing a blind listdir of /dev/disk/by-path, however due to detach and cleanup bei...
Python
apache-2.0
rickerc/cinder_audit,rickerc/cinder_audit
d7157d2999a4d9a8f624c3b509726b49d9193a01
conllu/compat.py
conllu/compat.py
try: from io import StringIO except ImportError: from StringIO import StringIO try: FileNotFoundError = FileNotFoundError except NameError: FileNotFoundError = IOError try: from contextlib import redirect_stdout except ImportError: import contextlib import sys @contextlib.contextmanag...
from io import StringIO try: FileNotFoundError = FileNotFoundError except NameError: FileNotFoundError = IOError try: from contextlib import redirect_stdout except ImportError: import contextlib import sys @contextlib.contextmanager def redirect_stdout(target): original = sys.stdo...
Remove special case from StringIO.
Remove special case from StringIO.
Python
mit
EmilStenstrom/conllu
d1e1ce5612e1437b2776043f3b6276be5b1d25a6
csv_converter.py
csv_converter.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import csv class CsvConverter: def __init__(self, csv_file_path): self.csv_file_path = csv_file_path self.rows = [] self.source_product_code = "product_code" self.source_quantity = "quantity" def clear(self): self.rows = [...
#!/usr/bin/env python # -*- coding: utf-8 -*- import csv class CsvConverter: def __init__(self, csv_file_path): self.csv_file_path = csv_file_path self.rows = [] self.source_product_code = "product_code" self.source_quantity = "quantity" def clear(self): self.rows = [...
Add checking empty product code
Add checking empty product code
Python
mit
stormaaja/csvconverter,stormaaja/csvconverter,stormaaja/csvconverter
d78188713ffd3e36514ba0db5f74bae111e6a7dc
calc.py
calc.py
"""calc.py: A simple calculator.""" import sys def add_all(nums): return sum(nums) def multiply_all(nums): return reduce(lambda a, b: a * b, nums) if __name__ == '__main__': command = sys.argv[1] nums = map(float, sys.argv[2:]) if command == 'add': print(add_all(nums)) elif command =...
"""calc.py: A simple calculator.""" import sys def add_all(nums): return sum(nums) def multiply_all(nums): return reduce(lambda a, b: a * b, nums) if __name__ == '__main__': command = sys.argv[1] nums = map(float, sys.argv[2:]) if command == 'add': print(add_all(nums)) elif command =...
Add usage string for fallthrough cases
Add usage string for fallthrough cases
Python
bsd-3-clause
mkuiper/calc-1
3ac6f578397235e8eda686fe3589cda780af53d5
ginga/qtw/Plot.py
ginga/qtw/Plot.py
# # Plot.py -- Plotting function for Ginga FITS viewer. # # Eric Jeschke (eric@naoj.org) # # Copyright (c) Eric R. Jeschke. All rights reserved. # This is open-source software licensed under a BSD license. # Please see the file LICENSE.txt for details. # # GUI imports from ginga.qtw.QtHelp import QtGui, QtCore from g...
# # Plot.py -- Plotting function for Ginga FITS viewer. # # Eric Jeschke (eric@naoj.org) # # Copyright (c) Eric R. Jeschke. All rights reserved. # This is open-source software licensed under a BSD license. # Please see the file LICENSE.txt for details. # # GUI imports from ginga.qtw.QtHelp import QtGui, QtCore from g...
Fix for import error with matplotlib Qt4Agg backend
Fix for import error with matplotlib Qt4Agg backend
Python
bsd-3-clause
stscieisenhamer/ginga,ejeschke/ginga,sosey/ginga,Cadair/ginga,rupak0577/ginga,eteq/ginga,rajul/ginga,ejeschke/ginga,pllim/ginga,ejeschke/ginga,sosey/ginga,naojsoft/ginga,naojsoft/ginga,Cadair/ginga,rupak0577/ginga,rajul/ginga,eteq/ginga,stscieisenhamer/ginga,rupak0577/ginga,pllim/ginga,sosey/ginga,stscieisenhamer/ginga...
8ccbddffc2c41cbe623439c76cfde7097f5fa801
nighttrain/utils.py
nighttrain/utils.py
# Copyright 2017 Codethink Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
# Copyright 2017 Codethink Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
Fix crash when there are no includes for a task
Fix crash when there are no includes for a task
Python
apache-2.0
ssssam/nightbus,ssssam/nightbus
f0b27af3cc09808146442c94df7c76127776acf8
gslib/devshell_auth_plugin.py
gslib/devshell_auth_plugin.py
# -*- coding: utf-8 -*- # Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
# -*- coding: utf-8 -*- # Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
Fix provider check causing Devshell auth failure
Fix provider check causing Devshell auth failure This commit builds on commit 13c4926, allowing Devshell credentials to be used only with Google storage.
Python
apache-2.0
GoogleCloudPlatform/gsutil,GoogleCloudPlatform/gsutil,fishjord/gsutil,BrandonY/gsutil
519a5afc8c8561166f4d8fb0ca43f0ff35a0389b
addons/hr_payroll_account/__manifest__.py
addons/hr_payroll_account/__manifest__.py
#-*- coding:utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Payroll Accounting', 'category': 'Human Resources', 'description': """ Generic Payroll system Integrated with Accounting. ================================================== * Expense Encoding ...
#-*- coding:utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Payroll Accounting', 'category': 'Human Resources', 'description': """ Generic Payroll system Integrated with Accounting. ================================================== * Expense Encoding ...
Remove useless dependency to hr_expense
[IMP] hr_payroll_account: Remove useless dependency to hr_expense
Python
agpl-3.0
ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo
84f111f6b5029fc86645311866310b5de48a39e3
mqo_program/__openerp__.py
mqo_program/__openerp__.py
# -*- coding: utf-8 -*- { 'name': "MQO Programs", 'summary': """Manage programs""", 'description': """ MQO module for managing programs: """, 'author': "Your Company", 'website': "http://www.yourcompany.com", # Categories can be used to filter modules in modules list...
# -*- coding: utf-8 -*- { 'name': "MQO Programs", 'summary': """Manage programs""", 'description': """ MQO module for managing programs: """, 'author': "Your Company", 'website': "http://www.yourcompany.com", # Categories can be used to filter modules in modules list...
Add required dependency to mqo_programs.
[IMP] Add required dependency to mqo_programs.
Python
agpl-3.0
drummingbird/mqo,drummingbird/mqo
671a932682f37912b11413f989ad52cf6b046ed6
basex-api/src/main/python/QueryExample.py
basex-api/src/main/python/QueryExample.py
# This example shows how queries can be executed in an iterative manner. # Iterative evaluation will be slower, as more server requests are performed. # # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License import BaseXClient, time try: # create session session = B...
# This example shows how queries can be executed in an iterative manner. # Iterative evaluation will be slower, as more server requests are performed. # # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License import BaseXClient, time try: # create session session = B...
Fix a bug on a query example for python
Fix a bug on a query example for python Methods used by the former example, `query.more()` and `query.next()`, do not exist any longer. I've modified them to `query.execute()`, according to `BaseXClient.py`, to make it run as good as it should be.
Python
bsd-3-clause
ksclarke/basex,deshmnnit04/basex,dimitarp/basex,joansmith/basex,joansmith/basex,dimitarp/basex,ksclarke/basex,drmacro/basex,dimitarp/basex,dimitarp/basex,BaseXdb/basex,joansmith/basex,vincentml/basex,drmacro/basex,joansmith/basex,BaseXdb/basex,BaseXdb/basex,JensErat/basex,joansmith/basex,JensErat/basex,ksclarke/basex,J...
c6cf2fbe34f536f4c2f25e7359c6cdf1d05a55cb
image_analysis.py
image_analysis.py
# -*- coding: utf-8 -*- """ Created on Mon Dec 25 15:19:55 2017 @author: vostok """ import os import tempfile from astropy.io import fits def extract_stars(input_array): (infilehandle, infilepath) = tempfile.mkstemp(suffix='.fits') os.close(infilehandle) fits.writeto(infilepath, \ input...
# -*- coding: utf-8 -*- """ Created on Mon Dec 25 15:19:55 2017 @author: vostok """ import os import tempfile from astropy.io import fits def extract_stars(input_array): (infilehandle, infilepath) = tempfile.mkstemp(suffix='.fits') os.close(infilehandle) fits.writeto(infilepath, \ input...
Fix extracted star coordinates from 1- to 0-based indexing
Fix extracted star coordinates from 1- to 0-based indexing Note that center of first pixel is 0, ie. edge of first pixel is -0.5
Python
mit
lkangas/python-tycho2
73660f4f539a1aeb520c33112cfc41183e4dd43a
luigi/tasks/rfam/clans_csv.py
luigi/tasks/rfam/clans_csv.py
# -*- coding: utf-8 -*- """ Copyright [2009-2017] EMBL-European Bioinformatics Institute 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 requir...
# -*- coding: utf-8 -*- """ Copyright [2009-2017] EMBL-European Bioinformatics Institute 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 requir...
Use MysqlQueryTask for getting clan data
Use MysqlQueryTask for getting clan data
Python
apache-2.0
RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline
d0ccfd4558b9dcf1610140c9df95cec284f0fbe3
correos_project/correos/managers.py
correos_project/correos/managers.py
from email import message_from_string, utils import json from django.db import models from dateutil.parser import parse class EmailManager(models.Manager): def create_from_message(self, mailfrom, rcpttos, data): from .models import Recipient message = message_from_string(data) realnames =...
from email import message_from_string, utils import json from django.db import models from dateutil.parser import parse class EmailManager(models.Manager): def create_from_message(self, mailfrom, rcpttos, data): from .models import Recipient message = message_from_string(data) realnames =...
Use email username if no realname is found in header
Use email username if no realname is found in header
Python
bsd-3-clause
transcode-de/correos,transcode-de/correos,transcode-de/correos
b8b18160e4dad9d87bfdf4207b3cf4841af0140d
examples/dot/dot.py
examples/dot/dot.py
"""\ Usage: dot.py [options] [<path>] [<address>] dot.py -h | --help dot.py --version Where: <path> is the file to serve <address> is what to listen on, of the form <host>[:<port>], or just <port> """ import sys from docopt import docopt from path_and_address import resolve, split_address def main(args=No...
"""\ Usage: dot.py [options] [<path>] [<address>] dot.py -h | --help dot.py --version Where: <path> is the file to serve <address> is what to listen on, of the form <host>[:<port>], or just <port> """ import sys from docopt import docopt from path_and_address import resolve, split_address def main(args=No...
Add validation to example script.
Add validation to example script.
Python
mit
joeyespo/path-and-address
6cf5d7db54ee272fa9af66d45a504d5994693ae4
tests/functional/test_configuration.py
tests/functional/test_configuration.py
"""Tests for the config command """ from pip.status_codes import ERROR from tests.lib.configuration_helpers import kinds, ConfigurationFileIOMixin def test_no_options_passed_should_error(script): result = script.pip('config', expect_error=True) assert result.returncode == ERROR class TestBasicLoading(Confi...
"""Tests for the config command """ import pytest import textwrap from pip.status_codes import ERROR from tests.lib.configuration_helpers import kinds, ConfigurationFileIOMixin def test_no_options_passed_should_error(script): result = script.pip('config', expect_error=True) assert result.returncode == ERROR...
Add basic tests for configuration
Add basic tests for configuration
Python
mit
zvezdan/pip,pypa/pip,xavfernandez/pip,xavfernandez/pip,techtonik/pip,pradyunsg/pip,RonnyPfannschmidt/pip,pradyunsg/pip,zvezdan/pip,RonnyPfannschmidt/pip,RonnyPfannschmidt/pip,rouge8/pip,sbidoul/pip,xavfernandez/pip,rouge8/pip,pfmoore/pip,zvezdan/pip,techtonik/pip,pypa/pip,sbidoul/pip,pfmoore/pip,rouge8/pip,techtonik/pi...
5b71b9e86dc09fe21717a75e45748a81d833c632
src/test-python.py
src/test-python.py
def test(options, buildout): from subprocess import Popen, PIPE import os import sys python = options['python'] if not os.path.exists(python): raise IOError("There is no file at %s" % python) if sys.platform == 'darwin': output = Popen([python, "-c", "import platform; print (pla...
def test(options, buildout): from subprocess import Popen, PIPE import os import sys python = options['python'] if not os.path.exists(python): raise IOError("There is no file at %s" % python) if sys.platform == 'darwin': output = Popen([python, "-c", "import platform; print (pla...
Check if the installed python2.4 have ssl support.
Check if the installed python2.4 have ssl support.
Python
mit
upiq/plonebuild,upiq/plonebuild
b3b28bd582d3f1e2ed5e646275760d1d0669acea
WikimediaUtilities.py
WikimediaUtilities.py
from urllib.request import urlopen import Utilities FILENAME_CUE = "File:" IMAGE_LOCATION_CUE = '<div class="fullMedia"><a href="https://upload.wikimedia.org/wikipedia/commons/' IMAGE_LOCATION_URL_START = 'https://upload.wikimedia.org/wikipedia/commons/' def directUrlOfFile(mediaPageURL): """Returns (success, url...
from urllib.request import urlopen, quote import Utilities FILENAME_CUE = "File:" IMAGE_LOCATION_CUE = '<div class="fullMedia"><a href="https://upload.wikimedia.org/wikipedia/commons/' IMAGE_LOCATION_URL_START = 'https://upload.wikimedia.org/wikipedia/commons/' def directUrlOfFile(mediaPageURL): """Returns (succe...
Use python's built in system for percent-encoding
Use python's built in system for percent-encoding
Python
mit
alset333/PeopleLookerUpper
b6e532f01d852738f40eb8bedc89f5c056b2f62c
netbox/generate_secret_key.py
netbox/generate_secret_key.py
#!/usr/bin/env python # This script will generate a random 50-character string suitable for use as a SECRET_KEY. import random charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*(-_=+)' secure_random = random.SystemRandom() print(''.join(secure_random.sample(charset, 50)))
#!/usr/bin/env python # This script will generate a random 50-character string suitable for use as a SECRET_KEY. import secrets charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*(-_=+)' print(''.join(secrets.choice(charset) for _ in range(50)))
Fix how SECRET_KEY is generated
Fix how SECRET_KEY is generated Use secrets.choice instead of random.sample to generate the secret key.
Python
apache-2.0
digitalocean/netbox,digitalocean/netbox,digitalocean/netbox,digitalocean/netbox
7f649a9e4e90587bd88b4b83b648f76287610f16
pytest_django_haystack.py
pytest_django_haystack.py
import pytest __version__ = '0.1.1' def pytest_configure(config): # Register the marks config.addinivalue_line( 'markers', 'haystack: Mark the test as using the django-haystack search engine, ' 'rebuilding the index for each test.') @pytest.fixture(autouse=True) def _haystack_marke...
import pytest __version__ = '0.1.1' def pytest_configure(config): # Register the marks config.addinivalue_line( 'markers', 'haystack: Mark the test as using the django-haystack search engine, ' 'rebuilding the index for each test.') @pytest.fixture(autouse=True) def _haystack_marke...
Move db fixture to the inside of the method
Move db fixture to the inside of the method
Python
mit
rouge8/pytest-django-haystack
b145b03b2569f4a82adefe57e843ef91384c47a4
panoptes/state_machine/states/core.py
panoptes/state_machine/states/core.py
import time import transitions from panoptes.utils.logger import has_logger @has_logger class PanState(transitions.State): """ Base class for PANOPTES transitions """ def __init__(self, *args, **kwargs): name = kwargs.get('name', self.__class__) self.panoptes = kwargs.get('panoptes', None)...
import time import transitions from panoptes.utils.logger import has_logger @has_logger class PanState(transitions.State): """ Base class for PANOPTES transitions """ def __init__(self, *args, **kwargs): name = kwargs.get('name', self.__class__) self.panoptes = kwargs.get('panoptes', None)...
Raise exception for state not overriding main
Raise exception for state not overriding main
Python
mit
joshwalawender/POCS,panoptes/POCS,panoptes/POCS,joshwalawender/POCS,AstroHuntsman/POCS,AstroHuntsman/POCS,AstroHuntsman/POCS,joshwalawender/POCS,AstroHuntsman/POCS,panoptes/POCS,panoptes/POCS
3cfa4f48c6bf28ed4273004d9a44173ecb4b195c
parliament/templatetags/parliament.py
parliament/templatetags/parliament.py
from django import template register = template.Library() @register.filter(name='governing') def governing(party, date): return party.is_governing(date)
from django import template from ..models import Party, Statement register = template.Library() @register.filter(name='governing') def governing(obj, date=None): if isinstance(obj, Party): assert date is not None, "Date must be supplied when 'govern' is called with a Party object" return obj.is_go...
Allow governing templatetag to be called with a Statement object
Allow governing templatetag to be called with a Statement object
Python
agpl-3.0
kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu,kansanmuisti/kamu
5c074950663d2e508fee0e015472e8460bf5b183
rootpy/plotting/canvas.py
rootpy/plotting/canvas.py
""" This module implements python classes which inherit from and extend the functionality of the ROOT canvas classes. """ import ctypes, ctypes.util ctypes.cdll.LoadLibrary(ctypes.util.find_library("Gui")) import ROOT from ..core import Object from .. import rootpy_globals as _globals from .. import defaults, QROOT ...
""" This module implements python classes which inherit from and extend the functionality of the ROOT canvas classes. """ import ROOT from ..core import Object from .. import rootpy_globals as _globals from .. import defaults, QROOT class _PadBase(Object): def _post_init(self): self.members = [] ...
Remove code which should never have made it in
Remove code which should never have made it in
Python
bsd-3-clause
rootpy/rootpy,kreczko/rootpy,kreczko/rootpy,kreczko/rootpy,rootpy/rootpy,ndawe/rootpy,rootpy/rootpy,ndawe/rootpy,ndawe/rootpy
fc6ca51d4a865368f82c26426a2d6c8d8366e25d
tcconfig/tcshow.py
tcconfig/tcshow.py
#!/usr/bin/env python # encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com> """ from __future__ import absolute_import from __future__ import with_statement import sys try: import json except ImportError: import simplejson as json import six import thutils import tcconfig import tcc...
#!/usr/bin/env python # encoding: utf-8 """ .. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com> """ from __future__ import absolute_import from __future__ import with_statement import json import sys import six import thutils import tcconfig import tcconfig.traffic_control from ._common import verify_network_in...
Drop support for Python 2.6
Drop support for Python 2.6
Python
mit
thombashi/tcconfig,thombashi/tcconfig
2b892b58049bd2b99ae97b62149f88c8001c82ca
ceph_deploy/tests/test_cli_osd.py
ceph_deploy/tests/test_cli_osd.py
import pytest import subprocess def test_help(tmpdir, cli): with cli( args=['ceph-deploy', 'osd', '--help'], stdout=subprocess.PIPE, ) as p: result = p.stdout.read() assert 'usage: ceph-deploy osd' in result assert 'positional arguments' in result assert 'optional argum...
import pytest import subprocess def test_help(tmpdir, cli): with cli( args=['ceph-deploy', 'osd', '--help'], stdout=subprocess.PIPE, ) as p: result = p.stdout.read() assert 'usage: ceph-deploy osd' in result assert 'positional arguments' in result assert 'optional argum...
Remove unneeded creation of .conf file
[RM-11742] Remove unneeded creation of .conf file Signed-off-by: Travis Rhoden <e5e44d6dbac12e32e01c3bb8b67940d8b42e225b@redhat.com>
Python
mit
trhoden/ceph-deploy,branto1/ceph-deploy,SUSE/ceph-deploy-to-be-deleted,branto1/ceph-deploy,ceph/ceph-deploy,SUSE/ceph-deploy,isyippee/ceph-deploy,ghxandsky/ceph-deploy,imzhulei/ceph-deploy,codenrhoden/ceph-deploy,codenrhoden/ceph-deploy,shenhequnying/ceph-deploy,zhouyuan/ceph-deploy,shenhequnying/ceph-deploy,ghxandsky/...
913590519e05a6209efb1102649ea7aba4abfbf5
airship/__init__.py
airship/__init__.py
import os import json from flask import Flask, render_template def channels_json(station, escaped=False): channels = [{"name": channel} for channel in station.channels()] jsonbody = json.dumps(channels) if escaped: jsonbody = jsonbody.replace("</", "<\\/") return jsonbody def make_airship(s...
import os import json from flask import Flask, render_template def jsonate(obj, escaped): jsonbody = json.dumps(obj) if escaped: jsonbody = jsonbody.replace("</", "<\\/") return jsonbody def channels_json(station, escaped=False): channels = [{"name": channel} for channel in station.channels...
Fix the grefs route in the airship server
Fix the grefs route in the airship server
Python
mit
richo/groundstation,richo/groundstation,richo/groundstation,richo/groundstation,richo/groundstation
06b7a81a0c89177e6ac1913cab65819b7b565754
python/ssc/__init__.py
python/ssc/__init__.py
# outer __init__.py """ Implementation of some simple and dumb audio codecs, like Delta Modualtion """ from ssc.aux import pack, unpack from ssc.dm import predictive_dm, decode_dm from ssc.btc import lin2btc, btc2lin, calc_rc from ssc.configure import *
# outer __init__.py """ Implementation of some simple and dumb audio codecs, like Delta Modualtion """ from ssc.aux import pack, unpack from ssc.dm import lin2dm, dm2lin, calc_a_value from ssc.btc import lin2btc, btc2lin, calc_rc
Update function names from dm.py and removed import to configure.py
Update function names from dm.py and removed import to configure.py
Python
bsd-3-clause
Zardoz89/Simple-Sound-Codecs,Zardoz89/Simple-Sound-Codecs
8b3538150bbd3aa1dea0ad060b32a35acb80c51a
common/test/acceptance/edxapp_pages/lms/find_courses.py
common/test/acceptance/edxapp_pages/lms/find_courses.py
""" Find courses page (main page of the LMS). """ from bok_choy.page_object import PageObject from bok_choy.promise import BrokenPromise from . import BASE_URL class FindCoursesPage(PageObject): """ Find courses page (main page of the LMS). """ url = BASE_URL def is_browser_on_page(self): ...
""" Find courses page (main page of the LMS). """ from bok_choy.page_object import PageObject from bok_choy.promise import BrokenPromise from . import BASE_URL class FindCoursesPage(PageObject): """ Find courses page (main page of the LMS). """ url = BASE_URL def is_browser_on_page(self): ...
Fix find courses page title in bok choy test suite
Fix find courses page title in bok choy test suite
Python
agpl-3.0
nttks/jenkins-test,Unow/edx-platform,amir-qayyum-khan/edx-platform,nttks/edx-platform,DNFcode/edx-platform,jbassen/edx-platform,morenopc/edx-platform,procangroup/edx-platform,atsolakid/edx-platform,itsjeyd/edx-platform,jazztpt/edx-platform,jamesblunt/edx-platform,eduNEXT/edunext-platform,jruiperezv/ANALYSE,stvstnfrd/ed...
ad4b972667e9111c403c1d3726b2cde87fcbc88e
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup setup(name='natural', version='0.1.4', description='Convert data to their natural (human-readable) format', long_description=''' Example Usage ============= Basic usage:: >>> from natural.file import accessed >>> print accessed(__file__) ...
#!/usr/bin/env python from distutils.core import setup setup(name='natural', version='0.1.4', description='Convert data to their natural (human-readable) format', long_description=''' Example Usage ============= Basic usage:: >>> from natural.file import accessed >>> print accessed(__file__) ...
Use 2to3 for Python 3
Use 2to3 for Python 3
Python
mit
tehmaze/natural
6547d653491adb6ab46e4a3a5f8251129719d3f7
login/middleware.py
login/middleware.py
from django.conf import settings from django.http import HttpResponseRedirect DETACH_PATH = '/user/detach' ACTIVATE_PATH = '/user/activate' class DetachMiddleware(object): def process_request(self, request): if not request.path == '/login/' \ and not request.path.startswith('/api'): ...
from django.conf import settings from django.http import HttpResponseRedirect DETACH_PATH = '/user/detach' ACTIVATE_PATH = '/user/activate' class DetachMiddleware(object): def process_request(self, request): if not request.path == '/login/' \ and not request.path.startswith('/api') \ ...
Remove infinite loop if user is neither native nor verified
Remove infinite loop if user is neither native nor verified
Python
agpl-3.0
openego/oeplatform,openego/oeplatform,openego/oeplatform,openego/oeplatform
016f14304b6b86634c4608927d3345f993178682
config.py
config.py
### # Copyright (c) 2012, spline # All rights reserved. # # ### import supybot.conf as conf import supybot.registry as registry from supybot.i18n import PluginInternationalization, internationalizeDocstring _ = PluginInternationalization('Scores') def configure(advanced): # This will be called by supybot to conf...
### # Copyright (c) 2012, spline # All rights reserved. # # ### import supybot.conf as conf import supybot.registry as registry from supybot.i18n import PluginInternationalization, internationalizeDocstring _ = PluginInternationalization('Scores') def configure(advanced): # This will be called by supybot to conf...
Add in channel value for disabling ansi
Add in channel value for disabling ansi
Python
mit
reticulatingspline/Scores,cottongin/Scores
61fe55efba2c491da6a93421fa702f123615bc32
spacy/lang/en/__init__.py
spacy/lang/en/__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 .lex_attrs import LEX_ATTRS from .morph_rules import MORPH_RULES from .lemmatizer import LEMMA_RULES, LEMMA_INDEX, LEMMA_EXC from .syntax_it...
# 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 .lex_attrs import LEX_ATTRS from .morph_rules import MORPH_RULES from .lemmatizer import LEMMA_RULES, LEMMA_INDEX, LEMMA_EXC from .syntax_it...
Move EnglishDefaults class out of English
Move EnglishDefaults class out of English
Python
mit
honnibal/spaCy,aikramer2/spaCy,recognai/spaCy,recognai/spaCy,honnibal/spaCy,aikramer2/spaCy,explosion/spaCy,aikramer2/spaCy,recognai/spaCy,aikramer2/spaCy,spacy-io/spaCy,recognai/spaCy,spacy-io/spaCy,explosion/spaCy,explosion/spaCy,explosion/spaCy,honnibal/spaCy,spacy-io/spaCy,recognai/spaCy,aikramer2/spaCy,recognai/sp...
d6cd7c16e32f64c4fd3627953d751e8c8bc26f1c
premis_event_service/forms.py
premis_event_service/forms.py
from django import forms import settings OUTCOME_CHOICES = settings.EVENT_OUTCOME_CHOICES EVENT_TYPE_CHOICES = settings.EVENT_TYPE_CHOICES class EventSearchForm(forms.Form): event_outcome = forms.ChoiceField( widget=forms.Select( attrs={ 'id': 'prependedInput', ...
from django import forms import settings OUTCOME_CHOICES = settings.EVENT_OUTCOME_CHOICES EVENT_TYPE_CHOICES = settings.EVENT_TYPE_CHOICES class EventSearchForm(forms.Form): event_outcome = forms.ChoiceField( widget=forms.Select(attrs={'id': 'prependedInput', 'class': 'input-small'}), choices=OU...
Fix formatting for the EventSearchForm class.
Fix formatting for the EventSearchForm class.
Python
bsd-3-clause
unt-libraries/django-premis-event-service,unt-libraries/django-premis-event-service,unt-libraries/django-premis-event-service
2937af0fe2f28ed9381b6b43c337c4cca14e4e78
apps/polls/admin.py
apps/polls/admin.py
from django.contrib import admin from apps.polls.models import Poll, Choice class ChoiceInline(admin.TabularInline): model = Choice extra = 3 class PollAdmin(admin.ModelAdmin): fieldsets = [ (None, {'fields': ['question']}), ('Date information', {'fields': ['pub_date'], 'classes': ['colla...
from django.contrib import admin from apps.polls.models import Poll, Choice class ChoiceInline(admin.TabularInline): model = Choice extra = 3 class PollAdmin(admin.ModelAdmin): fieldsets = [ (None, {'fields': ['question']}), ('Date information', {'fields': ['pub_date'], 'classes': ['colla...
Add search_fields = ['question'] to PollAdmin
Add search_fields = ['question'] to PollAdmin
Python
bsd-3-clause
datphan/teracy-tutorial,teracyhq/django-tutorial
f50589ec9b61efbd2bd56cca802ffc542f5b3336
pyrene/constants.py
pyrene/constants.py
class REPO: '''Repo attributes''' TYPE = 'type' DIRECTORY = 'directory' VOLATILE = 'volatile' SERVE_INTERFACE = 'serve_interface' SERVE_PORT = 'serve_port' SERVE_USERNAME = 'serve_username' SERVE_PASSWORD = 'serve_password' USERNAME = 'username' PASSWORD = 'password' DOWNLO...
class REPO: '''Repo attributes''' TYPE = 'type' DIRECTORY = 'directory' VOLATILE = 'volatile' SERVE_INTERFACE = 'interface' SERVE_PORT = 'port' SERVE_USERNAME = 'username' SERVE_PASSWORD = 'password' USERNAME = 'username' PASSWORD = 'password' DOWNLOAD_URL = 'download_url' ...
Revert "make REPO.SERVE_* attributes distinct from other attributes (username, password)"
Revert "make REPO.SERVE_* attributes distinct from other attributes (username, password)" This reverts commit 1553f4bae5f315666fac5ad9f6600ba8b076a84b.
Python
mit
krisztianfekete/pyrene
2973b664e8c9cf551d5d7277ab4995125be5fad0
python/reference.py
python/reference.py
import os # Current directory # If you call this from the current directory without abspath, # then it will not work since __file__ is a relative path os.path.dirname(os.path.abspath(__file__))
import os # Current directory # If you call this from the current directory without abspath, # then it will not work since __file__ is a relative path os.path.dirname(os.path.abspath(__file__)) # Get all files in a directory # Never use os.walk again def all_sub_files(root): for path, subdirs, files in os.walk(roo...
Add util for not using os.walk
Add util for not using os.walk
Python
mit
brycepg/how-to
0540b78a5c83cf307c4d629bb814c8359edd8709
comrade/core/context_processors.py
comrade/core/context_processors.py
from django.conf import settings from django.contrib.sites.models import Site from settings import DeploymentType def context_processor(request): context = {} context['DEPLOYMENT'] = settings.DEPLOYMENT context['site'] = Site.objects.get_current() if settings.DEPLOYMENT != DeploymentType.PRODUCTION: ...
from django.conf import settings from django.contrib.sites.models import Site from settings import DeploymentType def default(request): context = {} context['DEPLOYMENT'] = settings.DEPLOYMENT context['site'] = Site.objects.get_current() if settings.DEPLOYMENT != DeploymentType.PRODUCTION: cont...
Rename the only context processor.
Rename the only context processor.
Python
mit
bueda/django-comrade
b7939c13622d1134364e874da1d1903bcea6cffe
tests/test_graph.py
tests/test_graph.py
import os from xml.etree import ElementTree from utils import with_app, pretty_print_xml #============================================================================= # Tests @with_app(buildername="xml", srcdir="graph", warningiserror=True) def test_graph(app, status, warning): app.build() tree...
import os from xml.etree import ElementTree from utils import with_app, pretty_print_xml #============================================================================= # Tests @with_app(buildername="xml", srcdir="graph", warningiserror=True) def test_graph(app, status, warning): app.build() tree...
Remove debug printing of doctree during a test
Remove debug printing of doctree during a test
Python
apache-2.0
t4ngo/sphinxcontrib-traceables
c76e3accff36eb993ea44f4e38adad9466af1f54
tests/wsgi_tests.py
tests/wsgi_tests.py
import mock import unittest from resto.wsgi import Middleware class AppTestCase(unittest.TestCase): def setUp(self): self.environ = { 'wsgi.version': (1, 0), 'wsgi.multithread': False, 'wsgi.multiprocess': False, 'wsgi.run_once': True, } se...
import mock import unittest from resto.wsgi import Middleware class AppTestCase(unittest.TestCase): def setUp(self): self.environ = { 'wsgi.version': (1, 0), 'wsgi.multithread': False, 'wsgi.multiprocess': False, 'wsgi.run_once': True, } se...
Test WSGI start_response is called
Test WSGI start_response is called
Python
mit
rafaelpivato/resto
019aa0d78fbf54dda405cf8df3aab92dfdaba188
tests/grammar_atomic_tests.py
tests/grammar_atomic_tests.py
from unittest import TestCase from pyparsing import ParseException from regparser.grammar.atomic import * class GrammarAtomicTests(TestCase): def test_em_digit_p(self): result = em_digit_p.parseString('(<E T="03">2</E>)') self.assertEqual('2', result.p5) def test_double_alpha(self): ...
from unittest import TestCase from pyparsing import ParseException from regparser.grammar.atomic import * class GrammarAtomicTests(TestCase): def test_em_digit_p(self): result = em_digit_p.parseString('(<E T="03">2</E>)') self.assertEqual('2', result.p5) def test_double_alpha(self): ...
Refactor test to eliminate assertRaises() error with Python 2.6
Refactor test to eliminate assertRaises() error with Python 2.6
Python
cc0-1.0
adderall/regulations-parser,willbarton/regulations-parser,grapesmoker/regulations-parser
c34817c2740e860493692b630a11fdb7acab76aa
tests/test_simple_features.py
tests/test_simple_features.py
from wordgraph.points import Point import wordgraph EPOCH_START = 1407109280 def time_values(values, start=EPOCH_START, increment=1): datapoints = [] for index, value in enumerate(values): datapoints.append(Point(x=value, y=start + (increment * index))) return datapoints def test_monotonic_up_per...
from wordgraph.points import Point import wordgraph EPOCH_START = 1407109280 def time_values(values, start=EPOCH_START, increment=1): datapoints = [] for index, value in enumerate(values): datapoints.append(Point(x=value, y=start + (increment * index))) return datapoints def test_monotonic_up_per...
Test case for monotonically decreasing graphs
Test case for monotonically decreasing graphs Generate time series data for values that decrease monotonically over time.
Python
apache-2.0
tleeuwenburg/wordgraph,tleeuwenburg/wordgraph
156ebae630c3690db875b8925bfbdc5ded396fdd
src/Sensors/Factory.py
src/Sensors/Factory.py
from src.Sensors.BME280 import BME280 from src.Sensors.BME680 import BME680 from src.Sensors.DS18B20 import DS18B20 from src.Notification.Subscriber.LED.RGB import RGB class Factory: @staticmethod def create_sensor(device, address): if device == 'BME280': return BME280(address=address) ...
from src.Sensors.BME280 import BME280 from src.Sensors.BME680 import BME680 from src.Sensors.DS18B20 import DS18B20 from src.Sensors.CCS811 import CCS811 from src.Notification.Subscriber.LED.RGB import RGB class Factory: @staticmethod def create_sensor(device, address): if device == 'BME280': ...
Add CCS811 to device factory
Add CCS811 to device factory
Python
mit
dashford/sentinel
f1af7dad41992b53e90a5f8dd20e1635f11a7ce1
pstats_print2list/__init__.py
pstats_print2list/__init__.py
# -*- coding: utf-8 -*- __author__ = 'Vauxoo' __email__ = 'info@vauxoo.com' __version__ = '0.1.0'
# -*- coding: utf-8 -*- from pstats_print2list import print_stats __author__ = 'Vauxoo' __email__ = 'info@vauxoo.com' __version__ = '0.1.0'
Add print_stats to init file
[REF] pstats_print2list: Add print_stats to init file
Python
isc
Vauxoo/pstats-print2list
d279572c255a302dd5f191b0f047c46c9184ec2a
tests/test_write.py
tests/test_write.py
from __future__ import absolute_import from ofxparse import OfxParser as op, OfxPrinter from unittest import TestCase from os import close, remove from tempfile import mkstemp import sys sys.path.append('..') from .support import open_file class TestOfxWrite(TestCase): def test_write(self): test_file = o...
from __future__ import absolute_import from ofxparse import OfxParser, OfxPrinter from unittest import TestCase from os import close, remove from tempfile import mkstemp import sys sys.path.append('..') from .support import open_file class TestOfxWrite(TestCase): def test_write(self): with open_file('fid...
Fix warnings under Python 3
Fix warnings under Python 3
Python
mit
rdsteed/ofxparse,jaraco/ofxparse,jseutter/ofxparse,udibr/ofxparse
491613b34cb3c89e8d49670457a46b924a109529
pypinksign/__init__.py
pypinksign/__init__.py
""" Basic Template system for project pinksign, similar to the template part of PasteScript but without any dependencies. """ from .pypinksign import ( PinkSign, get_npki_path, url_encode, paramize, choose_cert, seed_cbc_128_encrypt, seed_cbc_128_decrypt, seed_generator, bit2string, separate_p12_into_npki )
""" Basic Template system for project pinksign, similar to the template part of PasteScript but without any dependencies. """ from .pypinksign import ( PinkSign, get_npki_path, url_encode, paramize, choose_cert, seed_cbc_128_encrypt, seed_cbc_128_decrypt, seed_generator, bit2string, separate_p12_into_npki, en...
Add new function in init
Add new function in init
Python
mit
bandoche/PyPinkSign
d7534dc3536ebe035abf063d83aa8d471cdadb16
python/pyqt_version.py
python/pyqt_version.py
import PySide2.QtCore # Prints PySide2 version # e.g. 5.11.1a1 print(PySide2.__version__) # Gets a tuple with each version component # e.g. (5, 11, 1, 'a', 1) print(PySide2.__version_info__) # Prints the Qt version used to compile PySide2 # e.g. "5.11.2" print(PySide2.QtCore.__version__) # Gets a tuple with each ve...
#!/usr/bin/env python3 # coding: utf-8 ''' PySide2 ''' import sys try: import PySide2.QtCore except ImportError: print('cannot load module: PySide2.QtCore') sys.exit(1) # Prints PySide2 version # e.g. 5.11.1a1 print(PySide2.__version__) # Gets a tuple with each version component # e.g. (5, 11, 1, 'a', 1...
ADD try-except to handle import error
ADD try-except to handle import error
Python
mit
ericosur/myqt,ericosur/myqt,ericosur/myqt,ericosur/myqt,ericosur/myqt,ericosur/myqt
da67ce3f25a708b99cb81f17703e74965dbea960
rtrss/filestorage/httputil.py
rtrss/filestorage/httputil.py
import logging import time import requests from googleapiclient.errors import HttpError # Number of retries in case of API errors NUM_RETRIES = 3 # Delay between retry attempts, seconds RETRY_DELAY = 1 _logger = logging.getLogger(__name__) def is_retryable(exc): retryable_codes = [500, 502, 503, 504] """...
import logging import time import requests from googleapiclient.errors import HttpError # Number of retries in case of API errors NUM_RETRIES = 3 # Delay between retry attempts, seconds RETRY_DELAY = 1 _logger = logging.getLogger(__name__) def is_retryable(exc): retryable_codes = [500, 502, 503, 504] ""...
Remove unnecessary parameter, fix type detection bug
Remove unnecessary parameter, fix type detection bug
Python
apache-2.0
notapresent/rtrss,notapresent/rtrss,notapresent/rtrss,notapresent/rtrss
5a3cdba13cb4898b76d83c949fc3ab6895c267ff
scripts/cpuflags.py
scripts/cpuflags.py
import errno class CPUFlags: def __init__(self): self.flags = set() try: self.flags = self.__parse_cpuinfo() except IOError as e: if e.errno == errno.ENOENT: return raise def __contains__(self, name): return name in self.fl...
import errno import sys class CPUFlags: def __init__(self): self.flags = set() try: self.flags = self.__parse_cpuinfo() except IOError as e: if e.errno == errno.ENOENT: return raise def __contains__(self, name): return name...
Check script returns an exit code
Check script returns an exit code
Python
bsd-2-clause
WojciechMula/toys,WojciechMula/toys,WojciechMula/toys,WojciechMula/toys,WojciechMula/toys
ea62a1cd9642dbff69cbfae3f8b540604a8a8fca
mine/__init__.py
mine/__init__.py
#!/usr/bin/env python """Package for mine.""" import sys __project__ = 'mine' __version__ = '0.1' CLI = 'mine' VERSION = __project__ + '-' + __version__ DESCRIPTION = "Manages running applications across multiple computers." PYTHON_VERSION = 3, 3 if not sys.version_info >= PYTHON_VERSION: # pragma: no cover (man...
#!/usr/bin/env python """Package for mine.""" import sys __project__ = 'mine' __version__ = '0.1' CLI = 'mine' VERSION = __project__ + '-' + __version__ DESCRIPTION = "For applications that haven't learned to share." PYTHON_VERSION = 3, 3 if not sys.version_info >= PYTHON_VERSION: # pragma: no cover (manual test...
Update headline to match GitHub
Update headline to match GitHub
Python
mit
jacebrowning/mine
f95460070e80e1d83394fa6ed08bad9dad34802c
ovp_users/emails.py
ovp_users/emails.py
from ovp_core.emails import BaseMail class UserMail(BaseMail): """ This class is responsible for firing emails for Users """ def __init__(self, user, async_mail=None): super(UserMail, self).__init__(user.email, async_mail) def sendWelcome(self, context={}): """ Sent when user registers """ ...
from ovp_core.emails import BaseMail class UserMail(BaseMail): """ This class is responsible for firing emails for Users """ def __init__(self, user, async_mail=None): super(UserMail, self).__init__(user.email, async_mail) def sendWelcome(self, context={}): """ Sent when user registers """ ...
Revert "fix getting user email for recoveryToken"
Revert "fix getting user email for recoveryToken" This reverts commit a47b098e4d644391213958f9e05c179a7410208d.
Python
agpl-3.0
OpenVolunteeringPlatform/django-ovp-users,OpenVolunteeringPlatform/django-ovp-users
839a0cafca1d172f7a061dcec5f6a4eca6d725c8
superlists/lists/tests.py
superlists/lists/tests.py
from django.test import TestCase # Create your tests here.
from django.test import TestCase class SmokeTest(TestCase): def test_bad_maths(self): self.assertEqual(1 + 1, 3)
Add app for lists, with deliberately failing unit test
Add app for lists, with deliberately failing unit test
Python
apache-2.0
Alfawuhn/test-driven-python
13d9cf933e49849a3c5343e7bdbf887b9aee6097
busbus/entity.py
busbus/entity.py
from busbus import util class LazyEntityProperty(object): def __init__(self, f, *args, **kwargs): self.f = f self.args = args self.kwargs = kwargs def __call__(self): return self.f(*self.args, **self.kwargs) class BaseEntity(object): def __init__(self, provider, **kwar...
from busbus import util class LazyEntityProperty(object): def __init__(self, f, *args, **kwargs): self.f = f self.args = args self.kwargs = kwargs def __call__(self): return self.f(*self.args, **self.kwargs) class BaseEntity(object): __repr_attrs__ = ('id',) def __...
Use an instance variable instead of a non-standard argument to __repr__
Use an instance variable instead of a non-standard argument to __repr__
Python
mit
spaceboats/busbus
5b6823ec19185ed5b413d1c01d3afeb5b1716778
taca/server_status/cli.py
taca/server_status/cli.py
import click import logging from taca.server_status import server_status as status from taca.utils.config import CONFIG from taca.server_status import cronjobs as cj # to avoid similar names with command, otherwise exception @click.group(name='server_status') def server_status(): """ Monitor server status """ ...
import click import logging from taca.server_status import server_status as status from taca.utils.config import CONFIG from taca.server_status import cronjobs as cj # to avoid similar names with command, otherwise exception @click.group(name='server_status') def server_status(): """ Monitor server status """ #...
Move warning about missing config entry to relevant subcommand
Move warning about missing config entry to relevant subcommand
Python
mit
SciLifeLab/TACA,SciLifeLab/TACA,SciLifeLab/TACA
d20347f4a57bb195291ebc79fc1ca0858b3f1d65
PyLunch/pylunch/specials/models.py
PyLunch/pylunch/specials/models.py
from django.db import models MAX_PRICE_FORMAT = { 'max_digits': 5, 'decimal_places': 2 } SPECIAL_TYPES = ( ('LU', 'Lunch'), ('BR', 'Breakfast'), ('DI', 'Dinner'), ) MAX_RESTAURANT_NAME_LENGTH = 50 MAX_DESCRIPTION_LENGTH = 500 class Restaurant(models.Model): name = models.Ch...
from django.db import models MAX_PRICE_FORMAT = { 'max_digits': 5, 'decimal_places': 2 } SPECIAL_TYPES = ( ('LU', 'Lunch'), ('BR', 'Breakfast'), ('DI', 'Dinner'), ) MAX_RESTAURANT_NAME_LENGTH = 50 MAX_DESCRIPTION_LENGTH = 500 class Restaurant(models.Model): name = models.Ch...
Add fields to Special model
Add fields to Special model
Python
unlicense
wiehan-a/pylunch
d72e34de631e3f6984a1810cbd8ec2b128a196de
sigma_core/tests/factories.py
sigma_core/tests/factories.py
import factory from django.utils.text import slugify from sigma_core.models.user import User from sigma_core.models.group import Group class UserFactory(factory.django.DjangoModelFactory): class Meta: model = User lastname = factory.Faker('last_name') firstname = factory.Faker('first_name') ...
import factory from django.utils.text import slugify from sigma_core.models.user import User from sigma_core.models.group import Group from sigma_core.models.user_group import UserGroup class UserFactory(factory.django.DjangoModelFactory): class Meta: model = User lastname = factory.Faker('last_nam...
Add UserGroupFactory for future tests
Add UserGroupFactory for future tests
Python
agpl-3.0
ProjetSigma/backend,ProjetSigma/backend
70f69f7b801404f7091e91b6ed997602709f9f42
commands/globaladd.py
commands/globaladd.py
from devbot import chat def call(message: str, name, protocol, cfg, commands): if message is '': chat.say('/msg {} {}'.format(name, commands['help']['globaladd'].format('globaladd'))) return if ' ' in message: chat.say('/msg {} Sorry, that was not a valid player name: It contains spac...
from devbot import chat def call(message: str, name, protocol, cfg, commands): if message is '': chat.say('/msg {} {}'.format(name, commands['help']['globaladd'].format('globaladd'))) return if ' ' in message: chat.say('/msg {} Sorry, that was not a valid player name: It contains space...
Fix gadd not sending tutorial
Fix gadd not sending tutorial
Python
mit
Ameliorate/DevotedBot,Ameliorate/DevotedBot
559f3c18a7e27e4bb1147b03a27ec083a66749d0
was/photo/models.py
was/photo/models.py
from django.db import models class Photo(models.Model): artist = models.ForeignKey('artists.Artists') picture = models.ImageField(null=True, blank=True, upload_to="art_picture/") comment = models.TextField(max_length=500)
from django.db import models class Photo(models.Model): artist = models.ForeignKey('artists.Artists') picture = models.ImageField(null=True, blank=True, upload_to="art_picture/") comment = models.TextField(max_length=500) def __str__(self): return '{}'.format(self.picture)
Define a '__str__' method for photo model
Define a '__str__' method for photo model
Python
mit
KeserOner/where-artists-share,KeserOner/where-artists-share
13ee0e2084765dcf958f4dbc844da54750878242
snapshottest/django.py
snapshottest/django.py
from __future__ import absolute_import from django.test import TestCase as dTestCase from django.test.runner import DiscoverRunner from snapshottest.reporting import reporting_lines from .unittest import TestCase as uTestCase class TestRunner(DiscoverRunner): separator1 = "=" * 70 separator2 = "-" * 70 ...
from __future__ import absolute_import from django.test import TestCase as dTestCase from django.test import SimpleTestCase as dSimpleTestCase from django.test.runner import DiscoverRunner from snapshottest.reporting import reporting_lines from .unittest import TestCase as uTestCase class TestRunner(DiscoverRunner):...
Allow use of alternate Django test cases
Allow use of alternate Django test cases
Python
mit
syrusakbary/snapshottest
7c591a38bc89350ea2586fb83a6880cdf71b4a9a
passwd_change.py
passwd_change.py
#!/usr/bin/env python3 import sys _args = sys.argv if __name__ == "__main__": if len(_args) == 4: keys_file = _args[1] target_file = _args[2] result_file = _args[3] with open(keys_file, 'r') as k: keys = k.readlines() keys = [key.strip() for key in keys] ...
#!/usr/bin/env python3 import sys _args = sys.argv if __name__ == "__main__": if len(_args) == 4: keys_file = _args[1] target_file = _args[2] result_file = _args[3] try: with open(keys_file, 'r') as k: keys = k.readlines() keys = [key.s...
Add Exception to all with's block.
Add Exception to all with's block.
Python
mit
maxsocl/oldmailer
c79c573c93a96bf5b631472c5e7efccc60102813
yatsm/log_yatsm.py
yatsm/log_yatsm.py
import logging FORMAT = '%(asctime)s:%(levelname)s:%(module)s.%(funcName)s:%(message)s' logging.basicConfig(format=FORMAT, level=logging.INFO, datefmt='%H:%M:%S') logger = logging.getLogger('yatsm')
import logging _FORMAT = '%(asctime)s:%(levelname)s:%(module)s.%(funcName)s:%(message)s' _formatter = logging.Formatter(_FORMAT) _handler = logging.StreamHandler() _handler.setFormatter(_formatter) logger = logging.getLogger('yatsm') logger.addHandler(_handler) logger.setLevel(logging.INFO)
Change logger to be more friendly and play nice
Change logger to be more friendly and play nice
Python
mit
ceholden/yatsm,ceholden/yatsm,valpasq/yatsm,c11/yatsm,valpasq/yatsm,c11/yatsm
03ebfe0518a7ac39f9414b3e8d8638c9dcba917c
tests/auth/test_models.py
tests/auth/test_models.py
# -*- coding: utf-8 -*- from django.core.urlresolvers import reverse from django.test import TestCase from django.utils import unittest from bakery.auth.models import BakeryUser class TestBakeryUserModel(TestCase): @unittest.skip('Not yet implemented') def test_get_absolute_url(self): user = Bakery...
# -*- coding: utf-8 -*- from django.test import TestCase from bakery.auth.models import BakeryUser class TestBakeryUserModel(TestCase): def test_get_absolute_url(self): user = BakeryUser.objects.create_user('user', 'password') user.name = 'John Doe' self.assertEqual(user.get_absolute_ur...
Adjust test (refers prev commit)
Adjust test (refers prev commit)
Python
bsd-3-clause
muffins-on-dope/bakery,muffins-on-dope/bakery,muffins-on-dope/bakery
853eb4896315c7fc60b1cbd7c87be9f7674f01ba
urls.py
urls.py
from django.conf.urls.defaults import * from django.contrib import admin from django.contrib.auth.decorators import login_required from django.views.generic.simple import direct_to_template import settings admin.autodiscover() urlpatterns = patterns('', (r'^admin/', include(admin.site.urls)), (r'^idp/', incl...
from django.conf.urls.defaults import * from django.contrib import admin from django.contrib.auth.decorators import login_required from django.views.generic.simple import direct_to_template import settings admin.autodiscover() urlpatterns = patterns('', (r'^admin/', include(admin.site.urls)), (r'^idp/', incl...
Move OpenID stuff under /accounts/openid/
Move OpenID stuff under /accounts/openid/
Python
agpl-3.0
adieu/authentic2,adieu/authentic2,pu239ppy/authentic2,incuna/authentic,incuna/authentic,BryceLohr/authentic,BryceLohr/authentic,pu239ppy/authentic2,incuna/authentic,adieu/authentic2,adieu/authentic2,BryceLohr/authentic,BryceLohr/authentic,incuna/authentic,incuna/authentic,pu239ppy/authentic2,pu239ppy/authentic2
73af0eed3ce746154b957af5c05137f9e432c7a3
tests/test_pkgmanifest.py
tests/test_pkgmanifest.py
# Copyright (C) Ivan Kravets <me@ikravets.com> # See LICENSE for details. import requests from platformio.util import get_api_result def pytest_generate_tests(metafunc): if "package_data" not in metafunc.fixturenames: return pkgs_manifest = get_api_result("/packages") assert isinstance(pkgs_manif...
# Copyright (C) Ivan Kravets <me@ikravets.com> # See LICENSE for details. import requests from platformio.util import get_api_result def pytest_generate_tests(metafunc): if "package_data" not in metafunc.fixturenames: return pkgs_manifest = get_api_result("/packages") assert isinstance(pkgs_manif...
Add "application/octet-stream" mime type for package
Add "application/octet-stream" mime type for package
Python
apache-2.0
bkudria/platformio,awong1900/platformio,bkudria/platformio,platformio/platformio,jrobeson/platformio,platformio/platformio-core,TimJay/platformio,jrobeson/platformio,eiginn/platformio,platformio/platformio-core,bkudria/platformio,TimJay/platformio,TimJay/platformio,awong1900/platformio,valeros/platformio,ZachMassia/pla...
fe98a627943c235ba24fc6de781deec69e7fd02e
relayer/__init__.py
relayer/__init__.py
from kafka import KafkaProducer from .event_emitter import EventEmitter from .exceptions import ConfigurationError __version__ = '0.1.3' class Relayer(object): def __init__(self, logging_topic, context_handler_class, kafka_hosts=None, topic_prefix='', topic_suffix='', source=''): self.logging_topic = l...
from kafka import KafkaProducer from .event_emitter import EventEmitter from .exceptions import ConfigurationError __version__ = '0.1.3' class Relayer(object): def __init__(self, logging_topic, context_handler_class, kafka_hosts=None, topic_prefix='', topic_suffix='', source=''): self.logging_topic = l...
Save event emitter y producer reference in relayer instance
Save event emitter y producer reference in relayer instance
Python
mit
wizeline/relayer
b698c7ab1c13353d8e9538bb42797344049812c1
astro.py
astro.py
import ephem from datetime import datetime def const(planet_name): # function name and parameters planet_class = getattr(ephem, planet_name) # sets ephem object class date_class = datetime.now() planet = planet_class() # sets planet variable south_bend = ephem.Observer...
import ephem from datetime import datetime def const(planet_name): # function name and parameters planet_class = getattr(ephem, planet_name) # sets ephem object class date_class = datetime.now() planet = planet_class() # sets planet variable south_bend = ephem.Observer...
Add to line 15 for testing.
Add to line 15 for testing.
Python
mit
bennettscience/PySky
d0018748cae3f0af4818106643926f7e8effe3c6
monasca_log_api_tempest/clients.py
monasca_log_api_tempest/clients.py
# Copyright 2015 FUJITSU LIMITED # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
# Copyright 2015-2016 FUJITSU LIMITED # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
Fix the Monasca Log API tempest tests
Fix the Monasca Log API tempest tests The Tempest Manager class must have changed and the service argument apparently no longer exists. Instead, it was being set as the scope which caused the catalog to not be retrieved See-also: If934bac4e2cd833fe4e381c373218383354969ec Change-Id: I43c023e91eb93e2c19096b0de812eabf7b...
Python
apache-2.0
openstack/monasca-log-api,stackforge/monasca-log-api,stackforge/monasca-log-api,stackforge/monasca-log-api,openstack/monasca-log-api,openstack/monasca-log-api
66fe6f98c079490d2d5de4c161da1d8b3801cda4
monasca_persister/conf/influxdb.py
monasca_persister/conf/influxdb.py
# (C) Copyright 2016-2017 Hewlett Packard Enterprise Development LP # Copyright 2017 FUJITSU LIMITED # # 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...
# (C) Copyright 2016-2017 Hewlett Packard Enterprise Development LP # Copyright 2017 FUJITSU LIMITED # # 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...
Allow hostnames to be used as ip_address
Allow hostnames to be used as ip_address Previously introduced change for monasca-persister had enforced the IPAddress as the only type one can configure influxdb.ip_address property with. Following change makes it possible to use also hostname. Using IPAdress is still possible. Change-Id: Ib0d7f19b3ac2dcb7c84923872...
Python
apache-2.0
stackforge/monasca-persister,openstack/monasca-persister,stackforge/monasca-persister,stackforge/monasca-persister,openstack/monasca-persister,openstack/monasca-persister
3ecca9dfa3f79a4c42a386e0bfe27cdca7e46a69
tests/21-ct-clean-up-nc.py
tests/21-ct-clean-up-nc.py
import socket, sys if len(sys.argv) != 6: print('Wrong number of arguments. Usage: ./21-ct-clean-up-nc.py <localport> <timeout> <remote-address> <remote-port> <HTTP path>') localport = int(sys.argv[1]) timeout = int(sys.argv[2]) serverAddr = sys.argv[3] serverPort = int(sys.argv[4]) httpPath = sys.argv[5] if ":" n...
import socket, sys if len(sys.argv) != 6: print('Wrong number of arguments. Usage: ./21-ct-clean-up-nc.py <localport> <timeout> <remote-address> <remote-port> <HTTP path>') localport = int(sys.argv[1]) timeout = int(sys.argv[2]) serverAddr = sys.argv[3] serverPort = int(sys.argv[4]) httpPath = sys.argv[5] if ":" n...
Use HTTP 1.1 instead of HTTP 1.0
tests: Use HTTP 1.1 instead of HTTP 1.0 Envoy does not support HTTP 1.0, so use HTTP 1.1 instead. Signed-off-by: Jarno Rajahalme <0f1ab0ac7dffd9db21aa539af2fd4bb04abc3ad4@covalent.io>
Python
apache-2.0
cilium/cilium,cilium/cilium,tgraf/cilium,michi-covalent/cilium,cilium-team/cilium,eloycoto/cilium,tgraf/cilium,eloycoto/cilium,cilium/cilium,eloycoto/cilium,scanf/cilium,cilium-team/cilium,scanf/cilium,tklauser/cilium,scanf/cilium,cilium/cilium,scanf/cilium,cilium/cilium,tgraf/cilium,tgraf/cilium,tklauser/cilium,eloyco...
8d0d4704f62b223128bab193cd5f5cda8e978c19
polling_stations/apps/pollingstations/tests/test_urls.py
polling_stations/apps/pollingstations/tests/test_urls.py
import json from django.test import TestCase from django_extensions.management.commands.show_urls import Command class UrlTests(TestCase): def is_exception(self, url): exceptions = [".txt", ".ics", ".geojson"] for exception in exceptions: if exception in url: return Tru...
import json from django.test import TestCase from django_extensions.management.commands.show_urls import Command class UrlTests(TestCase): def is_exception(self, url): exceptions = [".txt", ".ics", ".geojson"] for exception in exceptions: if exception in url: return Tru...
Refactor test for new view added with upgrade
Refactor test for new view added with upgrade
Python
bsd-3-clause
DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations
fb675239ae79adcdc5f050bcf8403effb067a59b
smsgateway/utils.py
smsgateway/utils.py
import logging logger = logging.getLogger(__name__) def strspn(source, allowed): newchrs = [] for c in source: if c in allowed: newchrs.append(c) return u''.join(newchrs) def check_cell_phone_number(number): cleaned_number = strspn(number, u'+0123456789') if not u'+' in cleane...
import logging logger = logging.getLogger(__name__) def strspn(source, allowed): newchrs = [] for c in source: if c in allowed: newchrs.append(c) return u''.join(newchrs) def check_cell_phone_number(number): cleaned_number = strspn(number, u'+0123456789') if not u'+' in cleane...
Remove warning for long messages
Remove warning for long messages
Python
bsd-3-clause
mvpoland/django-smsgateway,peterayeni/django-smsgateway,peterayeni/django-smsgateway,peterayeni/django-smsgateway,mvpoland/django-smsgateway,peterayeni/django-smsgateway,mvpoland/django-smsgateway
e25f085025f881ccf0a0da2e620b09787819507a
sub.py
sub.py
import csv import sys import threading from time import sleep from datetime import datetime import msgpack import zmq context = zmq.Context() socket = context.socket(zmq.SUB) socket.setsockopt(zmq.SUBSCRIBE, b'') socket.bind("tcp://*:4200") terminate = threading.Event() def go(): global terminate writer = ...
import csv import sys import threading from time import sleep from datetime import datetime import msgpack import zmq context = zmq.Context() socket = context.socket(zmq.SUB) socket.setsockopt(zmq.SUBSCRIBE, b'') socket.bind("tcp://*:4200") terminate = threading.Event() def go(): global terminate writer = ...
Move date/time to the first csv column.
Move date/time to the first csv column.
Python
isc
jaj42/hsmedstream,jaj42/phystream
866026a5d2f89a8ac76a726720e4fbe812c94eb4
ds/providers/shell.py
ds/providers/shell.py
from __future__ import absolute_import, unicode_literals __all__ = ['ShellProvider'] from .base import Provider class ShellProvider(Provider): def get_options(self): return { 'command': {'required': True}, } def execute(self, workspace, task): command = task.provider_con...
from __future__ import absolute_import, unicode_literals __all__ = ['ShellProvider'] from .base import Provider class ShellProvider(Provider): def get_options(self): return { 'command': {'required': True}, } def execute(self, workspace, task): command = task.provider_con...
Fix arg passing to command
Fix arg passing to command
Python
apache-2.0
rshk/freight,klynton/freight,jkimbo/freight,getsentry/freight,getsentry/freight,klynton/freight,getsentry/freight,klynton/freight,rshk/freight,klynton/freight,jkimbo/freight,getsentry/freight,rshk/freight,jkimbo/freight,jkimbo/freight,rshk/freight,getsentry/freight
b05d2666c834a9c4d151d0340612010851bd4610
eniric/Qcalculator.py
eniric/Qcalculator.py
""" Created on Mon Dec 29 00:14:56 2014 @author: pfigueira Editied Thur Dec 15 13:00 2016 by Jason Neal for eniric. """ # from eniric.IOmodule import read_2col import numpy as np import pandas as pd c = 299792458 # m/s def RVprec_calc(spectrum_file="resampled/Spectrum_M0-PHOENIX-ACES_Hband_vsini1.0_R60k_res3.txt...
""" Created on Mon Dec 29 00:14:56 2014 @author: pfigueira Editied Thur Dec 15 13:00 2016 by Jason Neal for eniric. """ # from eniric.IOmodule import read_2col import numpy as np import pandas as pd c = 299792458 # m/s def RVprec_calc(spectrum_file="resampled/Spectrum_M0-PHOENIX-ACES_Hband_vsini1.0_R60k_res3.txt...
Update RVprec_calculation use numpy.diff() and remove unnecessary array calls.
Update RVprec_calculation use numpy.diff() and remove unnecessary array calls. Former-commit-id: 646ff0cea061feb87c08b819a47d8e9f3dd55b55
Python
mit
jason-neal/eniric,jason-neal/eniric
7d0f3ba1aa82c2ea5a4a2eca2bbe842b63a82c72
wafer/talks/serializers.py
wafer/talks/serializers.py
from rest_framework import serializers from reversion import revisions from wafer.talks.models import Talk class TalkSerializer(serializers.ModelSerializer): class Meta: model = Talk exclude = ('_abstract_rendered', ) @revisions.create_revision() def create(self, validated_data): ...
from rest_framework import serializers from reversion import revisions from wafer.talks.models import Talk class TalkSerializer(serializers.ModelSerializer): class Meta: model = Talk # private_notes should possibly be accessible to # talk reviewers by the API, but certainly # not...
Exclude notes and private_notes from api for now
Exclude notes and private_notes from api for now
Python
isc
CTPUG/wafer,CTPUG/wafer,CTPUG/wafer,CTPUG/wafer
0600f3a4f9e13ac0a2a2b4d542db949f90e4185c
challenge_2/python/ning/challenge_2.py
challenge_2/python/ning/challenge_2.py
def find_unique(sequence): item_counter = dict() uniques = list() for item in sequence: if item not in item_counter: item_counter[item] = 1 else: item_counter[item] += 1 for item, item_count in item_counter.items(): if item_count == 1: unique...
import collections def find_unique(sequence): counter_dict = collections.defaultdict(int) uniques = [] for item in sequence: counter_dict[item] += 1 for item, count in counter_dict.items(): if count == 1: uniques.append(item) return uniques test_sequence_list = [2,'a...
Change logic to use defaultdict, lists initiate now with
Change logic to use defaultdict, lists initiate now with []
Python
mit
erocs/2017Challenges,popcornanachronism/2017Challenges,erocs/2017Challenges,erocs/2017Challenges,popcornanachronism/2017Challenges,DakRomo/2017Challenges,popcornanachronism/2017Challenges,mindm/2017Challenges,erocs/2017Challenges,DakRomo/2017Challenges,popcornanachronism/2017Challenges,mindm/2017Challenges,DakRomo/2017...
4f70897d5a85f1822a93df9bc91979ea79594901
nose2/tests/unit/test_generators_plugin.py
nose2/tests/unit/test_generators_plugin.py
from nose2.plugins.loader import functions from nose2.tests._common import TestCase class TestGeneratorUnpack(TestCase): tags = ['unit'] def setUp(self): self.expect = [(0, ('call', (0, 1))), (1, ('call', (1, 2))), (2, ('call', (2, 3))),] def test_un...
from nose2 import events, loader, session from nose2.plugins.loader import generators from nose2.tests._common import TestCase class TestGeneratorUnpack(TestCase): tags = ['unit'] def setUp(self): self.session = session.Session() self.loader = loader.PluggableTestLoader(self.session) ...
Add initial tests for generators plugin
Add initial tests for generators plugin
Python
bsd-2-clause
ojengwa/nose2,ojengwa/nose2,leth/nose2,little-dude/nose2,ptthiem/nose2,ezigman/nose2,ezigman/nose2,ptthiem/nose2,leth/nose2,little-dude/nose2
afdab20403a360508bced14f4750dd6ef4e6aa57
flask_apidoc/utils.py
flask_apidoc/utils.py
""" Helpers. """ def cached(f): """ Cache decorator for functions taking one or more arguments. :param f: The function to be cached. :return: The cached value. """ class CachedDict(dict): def __init__(self, f): self.f = f def __call__(self, *args): retu...
""" Helpers. """ import functools def cached(f): """ Cache decorator for functions taking one or more arguments. :param f: The function to be cached. :return: The cached value. """ cache = f.cache = {} @functools.wraps(f) def decorator(*args, **kwargs): key = str(args) + str...
Improve cached decorator to support class based methods
Improve cached decorator to support class based methods
Python
mit
viniciuschiele/flask-apidoc
d66e44fa9fd9b8e8944907b2490d32102c3fba82
keystoneclient/hacking/checks.py
keystoneclient/hacking/checks.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
Change hacking check to verify all oslo imports
Change hacking check to verify all oslo imports The hacking check was verifying that specific oslo imports weren't using the oslo-namespaced package. Since all the oslo libraries used by keystoneclient are now changed to use the new package name the hacking check can be simplified. bp drop-namespace-packages Change-...
Python
apache-2.0
Mercador/python-keystoneclient,Mercador/python-keystoneclient,sdpp/python-keystoneclient,magic0704/python-keystoneclient,ging/python-keystoneclient,darren-wang/ksc,magic0704/python-keystoneclient,klmitch/python-keystoneclient,darren-wang/ksc,klmitch/python-keystoneclient,sdpp/python-keystoneclient,ging/python-keystonec...
36e0821fcd871935e48ae10926be7594d42f13b8
knowledge_repo/converters/pdf.py
knowledge_repo/converters/pdf.py
from ..converter import KnowledgePostConverter from .html import HTMLConverter class PDFConverter(KnowledgePostConverter): ''' Use this as a template for new KnowledgePostConverters. ''' _registry_keys = ['pdf'] @property def dependencies(self): # Dependencies required for this conve...
from ..converter import KnowledgePostConverter from .html import HTMLConverter class PDFConverter(KnowledgePostConverter): ''' Use this as a template for new KnowledgePostConverters. ''' _registry_keys = ['pdf'] @property def dependencies(self): # Dependencies required for this conve...
Change PDF font to Helvetica
Change PDF font to Helvetica Changing the PDF font from the default to Helvetica
Python
apache-2.0
airbnb/knowledge-repo,airbnb/knowledge-repo,airbnb/knowledge-repo,airbnb/knowledge-repo,airbnb/knowledge-repo
985198a9ea569cc6f418c5b337632b91cdda7e37
lib/rapidsms/backends/backend.py
lib/rapidsms/backends/backend.py
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 class Backend(object): def log(self, level, message): self.router.log(level, message) def start(self): raise NotImplementedError def stop(self): raise NotImplementedError def send(self): raise NotImpleme...
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 class Backend(object): def __init__ (self, router): self.router = router def log(self, level, message): self.router.log(level, message) def start(self): raise NotImplementedError def stop(self): raise NotImple...
Add a constructor method for Backend
Add a constructor method for Backend
Python
bsd-3-clause
dimagi/rapidsms-core-dev,peterayeni/rapidsms,rapidsms/rapidsms-core-dev,lsgunth/rapidsms,catalpainternational/rapidsms,ken-muturi/rapidsms,ehealthafrica-ci/rapidsms,eHealthAfrica/rapidsms,unicefuganda/edtrac,unicefuganda/edtrac,eHealthAfrica/rapidsms,catalpainternational/rapidsms,catalpainternational/rapidsms,eHealthAf...
329fedb27fe54d593f192912beda56588faec214
tests/__init__.py
tests/__init__.py
from django.conf import settings from mock import Mock, patch from unittest2 import TestCase settings.configure() # Need to import this after configure() from django.db.models import ForeignKey class TestPreference(object): _meta = Mock(fields=[ForeignKey('user', name='user')]) objects = Mock() def __...
from django.conf import settings from mock import Mock, patch from unittest2 import TestCase settings.configure() # Need to import this after configure() from django.db.models import ForeignKey class TestPreference(object): _meta = Mock(fields=[ForeignKey('user', name='user')]) objects = Mock() def __...
Extend mocking to run validation
Extend mocking to run validation
Python
mit
yola/drf-madprops
817976878b584086bedc296e5fd6d264006c8dcd
tests/conftest.py
tests/conftest.py
from __future__ import absolute_import from __future__ import unicode_literals import os import subprocess import mock import pytest @pytest.yield_fixture def in_tmpdir(tmpdir): pwd = os.getcwd() os.chdir(tmpdir.strpath) try: yield finally: os.chdir(pwd) @pytest.yield_fixture def c...
from __future__ import absolute_import from __future__ import unicode_literals import os import subprocess import mock import pytest @pytest.fixture def in_tmpdir(tmpdir): pwd = os.getcwd() os.chdir(tmpdir.strpath) try: yield finally: os.chdir(pwd) @pytest.fixture def check_call_mo...
Replace deprecated yield_fixture with fixture
Replace deprecated yield_fixture with fixture Committed via https://github.com/asottile/all-repos
Python
mit
asottile/css-explore
b778c0192cabc652fc06daf99f6b890b3297f83f
Lib/test/test_sqlite.py
Lib/test/test_sqlite.py
from test.support import run_unittest, import_module, verbose # Skip test if _sqlite3 module not installed import_module('_sqlite3') import sqlite3 from sqlite3.test import (dbapi, types, userfunctions, factory, transactions, hooks, regression, dump) de...
import test.support # Skip test if _sqlite3 module not installed test.support.import_module('_sqlite3') import sqlite3 from sqlite3.test import (dbapi, types, userfunctions, factory, transactions, hooks, regression, dump) def test_main(): if test.su...
Make the printing of sqlite version in verbose mode work with regrtest -w.
Make the printing of sqlite version in verbose mode work with regrtest -w.
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
d8e9201c627840c72a540a77425ec0c13ac48a22
tests/test_cmd.py
tests/test_cmd.py
import unittest from click.testing import CliRunner from scuevals_api.cmd import cli class CmdsTestCase(unittest.TestCase): @classmethod def setUpClass(cls): cls.runner = CliRunner() def cli_run(self, *cmds): return self.runner.invoke(cli, cmds) cls.cli_run = cli_run ...
import unittest from click.testing import CliRunner from scuevals_api.cmd import cli class CmdsTestCase(unittest.TestCase): @classmethod def setUpClass(cls): cls.runner = CliRunner() def cli_run(self, *cmds): return self.runner.invoke(cli, cmds) cls.cli_run = cli_run ...
Add detailed error for CLI test failure
Add detailed error for CLI test failure
Python
agpl-3.0
SCUEvals/scuevals-api,SCUEvals/scuevals-api
e7d42847284ae73befad8bdf2fa035a6f95a82bb
tests/test_dow.py
tests/test_dow.py
from datetime import datetime import pycron def test_parser(): now = datetime(2015, 6, 18, 16, 7) assert pycron.is_now('* * * * *', now) assert pycron.is_now('* * * * 4', now) assert pycron.is_now('* * * * */4', now) assert pycron.is_now('* * * * 0,3,4', now) assert pycron.is_now('* * * * 3', ...
from datetime import datetime, timedelta import pycron def test_parser(): now = datetime(2015, 6, 18, 16, 7) assert pycron.is_now('* * * * *', now) assert pycron.is_now('* * * * 4', now) assert pycron.is_now('* * * * */4', now) assert pycron.is_now('* * * * 0,3,4', now) assert pycron.is_now('*...
Add more thorough testing of day of week.
Add more thorough testing of day of week.
Python
mit
kipe/pycron
a89e7f9f625427d558300eb5e5cbc2881cdcc207
get_a_job/__init__.py
get_a_job/__init__.py
from flask import Flask from flask.ext.restful import Api from .models import db from .api import configure_api def create_app(object_name): app = Flask(object_name) app.config.from_object(object_name) db.init_app(app) configure_api(app) return app
from flask import Flask from flask.ext.restful import Api from .models import db from .api import configure_api def create_app(object_name, **kwargs): app = Flask(object_name) app.config.from_object(object_name) app.config.update(kwargs) db.init_app(app) configure_api(app) return app
Add optional configuration customization of app.
Add optional configuration customization of app.
Python
mit
smoynes/get_a_job
d8cde079d6e8dd0dcd5a13a36a0bca9685ba7b1c
api/BucketListAPI.py
api/BucketListAPI.py
from flask import Flask, jsonify from modals.modals import User, Bucket, Item from api.__init__ import create_app, db app = create_app('DevelopmentEnv') @app.errorhandler(404) def page_not_found(e): response = jsonify({'error': 'The request can not be completed'}) response.status_code = 404 return respon...
from flask import Flask, jsonify from modals.modals import User, Bucket, Item from api.__init__ import create_app, db app = create_app('DevelopmentEnv') @app.errorhandler(404) def page_not_found(e): response = jsonify({'error': 'The request can not be completed'}) response.status_code = 404 return respon...
Add error handler for invalid token
Add error handler for invalid token
Python
mit
patlub/BucketListAPI,patlub/BucketListAPI
45254f3a7401b4b63d829f38c426c0635485f1e0
PRESUBMIT.py
PRESUBMIT.py
# Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Top-level presubmit script for GYP. See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details about the presubmit...
# Copyright (c) 2011 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Top-level presubmit script for GYP. See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details about the presubmit API built...
Fix the license header regex.
Fix the license header regex. Most of the files are attributed to Google Inc so I used this instead of Chromium Authors. R=mark@chromium.org BUG= TEST= Review URL: http://codereview.chromium.org/7108074 git-svn-id: e7e1075985beda50ea81ac4472467b4f6e91fc78@936 78cadc50-ecff-11dd-a971-7dbc132099af
Python
bsd-3-clause
enkripsi/gyp,mistydemeo/gyp,cysp/gyp,IllusionRom-deprecated/android_platform_external_chromium_org_tools_gyp,LazyCodingCat/gyp,IllusionRom-deprecated/android_platform_external_chromium_org_tools_gyp,ttyangf/gyp,saghul/gyn,ttyangf/pdfium_gyp,lukeweber/gyp-override,carlTLR/gyp,amoikevin/gyp,erikge/watch_gyp,LazyCodingCat...
ac3c855583a023fc76b8720aa7e38419b28a26d4
falcom/api/hathi.py
falcom/api/hathi.py
# Copyright (c) 2017 The Regents of the University of Michigan. # All Rights Reserved. Licensed according to the terms of the Revised # BSD License. See LICENSE.txt for details. import json def get_counts_from_item_list (items, htid): a = len([x for x in items if x["htid"] == htid]) b = len(items) - a ret...
# Copyright (c) 2017 The Regents of the University of Michigan. # All Rights Reserved. Licensed according to the terms of the Revised # BSD License. See LICENSE.txt for details. import json class HathiItems: def __init__ (self): pass def __len__ (self): return 0 def get_counts_from_item_list...
Refactor empty tuple into empty object with len()
Refactor empty tuple into empty object with len()
Python
bsd-3-clause
mlibrary/image-conversion-and-validation,mlibrary/image-conversion-and-validation
7872a2327f9dea7d4c1f5a3054b6be6bba25fdd4
scripts/migration/migrate_deleted_wikis.py
scripts/migration/migrate_deleted_wikis.py
import logging import sys from modularodm import Q from framework.transactions.context import TokuTransaction from website.app import init_app from website.models import NodeLog from scripts import utils as script_utils logger = logging.getLogger(__name__) def get_targets(): return NodeLog.find(Q('action', 'eq'...
import logging import sys from modularodm import Q from framework.transactions.context import TokuTransaction from website.app import init_app from website.models import NodeLog from scripts import utils as script_utils logger = logging.getLogger(__name__) def get_targets(): return NodeLog.find(Q('action', 'eq'...
Remove TokuTransaction in migrate function
Remove TokuTransaction in migrate function
Python
apache-2.0
hmoco/osf.io,samchrisinger/osf.io,hmoco/osf.io,icereval/osf.io,caneruguz/osf.io,cwisecarver/osf.io,chrisseto/osf.io,erinspace/osf.io,SSJohns/osf.io,monikagrabowska/osf.io,crcresearch/osf.io,crcresearch/osf.io,laurenrevere/osf.io,leb2dg/osf.io,crcresearch/osf.io,baylee-d/osf.io,leb2dg/osf.io,saradbowman/osf.io,sloria/os...
c69d99ff9c102926d94d8bd2d55c5de40f5e2072
application/senic/nuimo_hub/subprocess_run.py
application/senic/nuimo_hub/subprocess_run.py
"""Provides `subprocess.run()` from Python 3.5+ if available. Otherwise falls back to `subprocess.check_output()`.""" try: from subprocess import run except ImportError: from collections import namedtuple from subprocess import check_output def run(args, *, stdin=None, input=None, stdout=None, stderr=N...
"""Provides `subprocess.run()` from Python 3.5+ if available. Otherwise falls back to `subprocess.check_output()`.""" try: from subprocess import run except ImportError: from collections import namedtuple from subprocess import check_output def run(args, *, stdin=None, input=None, stdout=None, stderr=N...
Remove parameters that are not supported
Remove parameters that are not supported Apparently Python 3.4 doesn't have encoding and errors parameters
Python
mit
grunskis/nuimo-hub-backend,grunskis/senic-hub,grunskis/senic-hub,getsenic/senic-hub,grunskis/senic-hub,grunskis/senic-hub,grunskis/nuimo-hub-backend,grunskis/nuimo-hub-backend,grunskis/senic-hub,getsenic/senic-hub,grunskis/nuimo-hub-backend,grunskis/senic-hub,grunskis/nuimo-hub-backend
7894b066cde13eca75479921531e9d005970e9c3
go/billing/views.py
go/billing/views.py
# Create your views here.
import os from django.conf import settings from django.contrib.auth.decorators import login_required from django.http import HttpResponse from django.shortcuts import get_object_or_404 from django.template import RequestContext, loader from xhtml2pdf import pisa from go.billing.models import Statement @login_requi...
Add basic PDF view for billing
Add basic PDF view for billing
Python
bsd-3-clause
praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go
9a1a05c33258461c5d474b014654464892cd7b90
bake/bakedefaults.py
bake/bakedefaults.py
#!/usr/bin/env python LABEL_KEY = 'label' KEY_START = '@' KEY_END = '@' CFGFILE = 'bake.cfg'
#!/usr/bin/env python LABEL_KEY = 'label' KEY_START = '@' KEY_END = '@'
Remove mention of bake.cfg file
Remove mention of bake.cfg file
Python
mit
AlexSzatmary/bake
c859416d2d35aab83fc9e8f400e00f8f07c0b8a9
test/parser_test.py
test/parser_test.py
import socket client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client_socket.connect(("localhost", 5002)) with open("resources/Matrix.java", "r") as java_file: source = java_file.read() + "\nEOS_BITSHIFT" client_socket.send("%d\n%s" % (len(source), source)); data = '' while True: data = ...
import socket, sys file_name = 'resources/<name>.c' server_socket_number = 5001 if __name__ == '__main__': if len(sys.argv) == 1: print "Please input a parser to test." elif len(sys.argv) > 2: print "Too many arguments." else: if sys.argv[1] == 'c': pass elif...
Change test file to support different parsers
Change test file to support different parsers
Python
mit
earwig/bitshift,earwig/bitshift,earwig/bitshift,earwig/bitshift,earwig/bitshift,earwig/bitshift
e5e2b270d7bdf1b8225405619908389319686146
tests/test_demos.py
tests/test_demos.py
import os from dallinger import db class TestBartlett1932(object): """Tests for the Bartlett1932 demo class""" def _make_one(self): from demos.bartlett1932.experiment import Bartlett1932 return Bartlett1932(self._db) def setup(self): self._db = db.init_db(drop_all=True) #...
import os import subprocess from dallinger import db class TestDemos(object): """Verify all the built-in demos.""" def test_verify_all_demos(self): demo_paths = os.listdir("demos") for demo_path in demo_paths: if os.path.isdir(demo_path): os.chdir(demo_path) ...
Test by verifying all demos
Test by verifying all demos
Python
mit
Dallinger/Dallinger,Dallinger/Dallinger,Dallinger/Dallinger,Dallinger/Dallinger,jcpeterson/Dallinger,jcpeterson/Dallinger,Dallinger/Dallinger,jcpeterson/Dallinger,jcpeterson/Dallinger,jcpeterson/Dallinger
64b26ba9cab7d432d3e4185a8edb12f9257ab473
setup.py
setup.py
# -*- coding: utf-8 -*- from distutils.core import setup setup( name = 'grades', packages = ['grades'], scripts = ['bin/grades'], version = '0.1', description = 'Minimalist grades management for teachers.', author = 'Loïc Séguin-C.', author_email = 'loicseguin@gmail.com', url = 'https:...
# -*- coding: utf-8 -*- from distutils.core import setup setup( name = 'grades', packages = ['grades'], scripts = ['bin/grades'], version = '0.1', description = 'Minimalist grades management for teachers.', author = 'Loïc Séguin-C.', author_email = 'loicseguin@gmail.com', url = 'https:...
Use README.rst as long description.
Use README.rst as long description.
Python
bsd-3-clause
loicseguin/grades
0922c8d06264f02f9b8de59e3546e499c8599326
tests/test_views.py
tests/test_views.py
import unittest from flask import current_app, url_for, get_flashed_messages from app import create_app, db from app.models import * class TestCreateAdmissionView(unittest.TestCase): def setUp(self): self.app = create_app('testing') self.app_context = self.app.app_context() self.app_contex...
import unittest from flask import current_app, url_for, get_flashed_messages from app import create_app, db from app.models import * class TestCreateAdmissionView(unittest.TestCase): def setUp(self): self.app = create_app('testing') self.app_context = self.app.app_context() self.app_contex...
Change id_lvrs_internt to string. Test if there's only one created
:bug: Change id_lvrs_internt to string. Test if there's only one created
Python
mit
gems-uff/labsys,gems-uff/labsys,gems-uff/labsys
6752007377e57850f21553e1aa2b85ca64c6e769
pesabot/client.py
pesabot/client.py
import requests from requests.auth import HTTPBasicAuth BASE_URL = 'https://pesabot.com/api/v1/' class Client(object): def __init__(self, email, password): self.auth = HTTPBasicAuth(email, password) def call(self, path, method='GET', payload={}): if method == 'POST': res = request...
import requests from requests.auth import HTTPBasicAuth BASE_URL = 'https://pesabot.com/api/v1/' class Client(object): def __init__(self, email, password): self.auth = None if email and password: self.auth = HTTPBasicAuth(email, password) def call(self, path, method='GET', payload...
Make auth optional for allow any routes to work
Make auth optional for allow any routes to work
Python
mit
pesabot/pesabot-py