commit
stringlengths
40
40
old_file
stringlengths
4
106
new_file
stringlengths
4
106
old_contents
stringlengths
10
2.94k
new_contents
stringlengths
21
2.95k
subject
stringlengths
16
444
message
stringlengths
17
2.63k
lang
stringclasses
1 value
license
stringclasses
13 values
repos
stringlengths
7
43k
ndiff
stringlengths
52
3.31k
instruction
stringlengths
16
444
content
stringlengths
133
4.32k
diff
stringlengths
49
3.61k
2ef4362be90e2314b69a2ff17ccb5d25ef8905fd
rackspace/database/database_service.py
rackspace/database/database_service.py
from openstack import service_filter class DatabaseService(service_filter.ServiceFilter): """The database service.""" valid_versions = [service_filter.ValidVersion('v1', path='v1.0')] def __init__(self, version=None): """Create a database service.""" super(DatabaseService, self).__init...
from openstack import service_filter class DatabaseService(service_filter.ServiceFilter): """The database service.""" valid_versions = [service_filter.ValidVersion('v1', path='v1.0')] def __init__(self, version=None): """Create a database service.""" if not version: version...
Set default version for cloud databases.
Set default version for cloud databases.
Python
apache-2.0
rackerlabs/rackspace-sdk-plugin,briancurtin/rackspace-sdk-plugin
from openstack import service_filter class DatabaseService(service_filter.ServiceFilter): """The database service.""" valid_versions = [service_filter.ValidVersion('v1', path='v1.0')] def __init__(self, version=None): """Create a database service.""" + if not ve...
Set default version for cloud databases.
## Code Before: from openstack import service_filter class DatabaseService(service_filter.ServiceFilter): """The database service.""" valid_versions = [service_filter.ValidVersion('v1', path='v1.0')] def __init__(self, version=None): """Create a database service.""" super(DatabaseServi...
from openstack import service_filter class DatabaseService(service_filter.ServiceFilter): """The database service.""" valid_versions = [service_filter.ValidVersion('v1', path='v1.0')] def __init__(self, version=None): """Create a database service.""" + if not ve...
3df3f72b54068deaca51ce2b4c52c185bf8f4526
virtool/uploads/models.py
virtool/uploads/models.py
import enum from sqlalchemy import Column, String, Boolean, Integer, DateTime, Enum from virtool.postgres import Base class UploadType(enum.Enum): hmm = "hmm" reference = "reference" reads = "reads" subtraction = "subtraction" null = None class Upload(Base): __tablename__ = "uploads" ...
import enum from sqlalchemy import Column, String, Boolean, Integer, DateTime, Enum from virtool.postgres import Base class UploadType(str, enum.Enum): hmm = "hmm" reference = "reference" reads = "reads" subtraction = "subtraction" null = None class Upload(Base): __tablename__ = "uploads" ...
Declare subclass of `UploadType` to be `str`
Declare subclass of `UploadType` to be `str` * Fixes issues with JSON serializing * Revert `__repr__` string format changes as the newlines created large gaps of whitespace
Python
mit
virtool/virtool,igboyes/virtool,igboyes/virtool,virtool/virtool
import enum from sqlalchemy import Column, String, Boolean, Integer, DateTime, Enum from virtool.postgres import Base - class UploadType(enum.Enum): + class UploadType(str, enum.Enum): hmm = "hmm" reference = "reference" reads = "reads" subtraction = "subtraction" null = ...
Declare subclass of `UploadType` to be `str`
## Code Before: import enum from sqlalchemy import Column, String, Boolean, Integer, DateTime, Enum from virtool.postgres import Base class UploadType(enum.Enum): hmm = "hmm" reference = "reference" reads = "reads" subtraction = "subtraction" null = None class Upload(Base): __tablename__ =...
import enum from sqlalchemy import Column, String, Boolean, Integer, DateTime, Enum from virtool.postgres import Base - class UploadType(enum.Enum): + class UploadType(str, enum.Enum): ? +++++ hmm = "hmm" reference = "reference" reads = "reads" subtraction = "...
3bee320f66d192e2e40b6b91a53c3ccd64c09443
test/MSVC/query_vcbat.py
test/MSVC/query_vcbat.py
import sys import TestSCons test = TestSCons.TestSCons(match = TestSCons.match_re) if sys.platform != 'win32': msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform test.skip_test(msg) ##### # Test the basics test.write('SConstruct',""" import os env = Environment(tools = ['MSVCC...
import sys import TestSCons test = TestSCons.TestSCons(match = TestSCons.match_re) if sys.platform != 'win32': msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform test.skip_test(msg) ##### # Test the basics test.write('SConstruct',""" from SCons.Tool.MSVCCommon import FindMSVSB...
Update our fake test for debugging purpose.
Update our fake test for debugging purpose.
Python
mit
azatoth/scons,azatoth/scons,azatoth/scons,azatoth/scons,azatoth/scons
import sys import TestSCons test = TestSCons.TestSCons(match = TestSCons.match_re) if sys.platform != 'win32': msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform test.skip_test(msg) ##### # Test the basics test.write('SConstruct',""" - import os + f...
Update our fake test for debugging purpose.
## Code Before: import sys import TestSCons test = TestSCons.TestSCons(match = TestSCons.match_re) if sys.platform != 'win32': msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform test.skip_test(msg) ##### # Test the basics test.write('SConstruct',""" import os env = Environment...
import sys import TestSCons test = TestSCons.TestSCons(match = TestSCons.match_re) if sys.platform != 'win32': msg = "Skipping Visual C/C++ test on non-Windows platform '%s'\n" % sys.platform test.skip_test(msg) ##### # Test the basics test.write('SConstruct',""" - import os + f...
5aff8defb8baf83176ea861b03de04a9d6ac8a31
bundles/views.py
bundles/views.py
from django.views.generic import DetailView, ListView from rest_framework import filters, generics, permissions from rest_framework.response import Response from . import models, serializers class BundleList(ListView): model = models.Bundle context_object_name = 'bundles' paginate_by = 25 class Bundle...
from django.views.generic import DetailView, ListView from rest_framework import filters, generics, permissions from rest_framework.response import Response from . import models, serializers class BundleList(ListView): model = models.Bundle context_object_name = 'bundles' paginate_by = 25 class Bundle...
Make bundle view accessible to anyone
Make bundle view accessible to anyone
Python
agpl-3.0
lutris/website,lutris/website,lutris/website,lutris/website
from django.views.generic import DetailView, ListView from rest_framework import filters, generics, permissions from rest_framework.response import Response from . import models, serializers class BundleList(ListView): model = models.Bundle context_object_name = 'bundles' paginat...
Make bundle view accessible to anyone
## Code Before: from django.views.generic import DetailView, ListView from rest_framework import filters, generics, permissions from rest_framework.response import Response from . import models, serializers class BundleList(ListView): model = models.Bundle context_object_name = 'bundles' paginate_by = 2...
from django.views.generic import DetailView, ListView from rest_framework import filters, generics, permissions from rest_framework.response import Response from . import models, serializers class BundleList(ListView): model = models.Bundle context_object_name = 'bundles' paginat...
fef17579a8a084987ea5e413ad512662ab24aa56
ntm/similarities.py
ntm/similarities.py
import theano import theano.tensor as T import numpy as np def cosine_similarity(x, y, eps=1e-9): y = y.dimshuffle(1, 0) z = T.dot(x, y) z /= x.norm(2) * y.norm(2, axis=0).dimshuffle('x', 0) + eps return z
import theano import theano.tensor as T import numpy as np def cosine_similarity(x, y, eps=1e-9): y = y.dimshuffle(1, 0) z = T.dot(x, y) z /= T.sqrt(T.sum(x * x) * T.sum(y * y, axis=0).dimshuffle('x', 0) + 1e-6) return z
Replace T.norm in the cosine similarity
Replace T.norm in the cosine similarity
Python
mit
snipsco/ntm-lasagne
import theano import theano.tensor as T import numpy as np def cosine_similarity(x, y, eps=1e-9): y = y.dimshuffle(1, 0) z = T.dot(x, y) - z /= x.norm(2) * y.norm(2, axis=0).dimshuffle('x', 0) + eps + z /= T.sqrt(T.sum(x * x) * T.sum(y * y, axis=0).dimshuffle('x', 0) + 1e-6) r...
Replace T.norm in the cosine similarity
## Code Before: import theano import theano.tensor as T import numpy as np def cosine_similarity(x, y, eps=1e-9): y = y.dimshuffle(1, 0) z = T.dot(x, y) z /= x.norm(2) * y.norm(2, axis=0).dimshuffle('x', 0) + eps return z ## Instruction: Replace T.norm in the cosine similarity ## Code After: import t...
import theano import theano.tensor as T import numpy as np def cosine_similarity(x, y, eps=1e-9): y = y.dimshuffle(1, 0) z = T.dot(x, y) - z /= x.norm(2) * y.norm(2, axis=0).dimshuffle('x', 0) + eps + z /= T.sqrt(T.sum(x * x) * T.sum(y * y, axis=0).dimshuffle('x', 0) + 1e-6) r...
1efb717cec51ce5d2aa67d668528cb0fcdde94e8
scuevals_api/auth/decorators.py
scuevals_api/auth/decorators.py
from functools import wraps from flask_jwt_extended import get_jwt_identity, jwt_required, current_user from werkzeug.exceptions import Unauthorized from scuevals_api.models import User def optional_arg_decorator(fn): def wrapped_decorator(*args): if len(args) == 1 and callable(args[0]): retu...
from functools import wraps from flask_jwt_extended import get_jwt_identity, jwt_required, current_user from werkzeug.exceptions import Unauthorized from scuevals_api.models import User def optional_arg_decorator(fn): def wrapped_decorator(*args): if len(args) == 1 and callable(args[0]): retu...
Allow multiple permissions for an endpoint
Allow multiple permissions for an endpoint
Python
agpl-3.0
SCUEvals/scuevals-api,SCUEvals/scuevals-api
from functools import wraps from flask_jwt_extended import get_jwt_identity, jwt_required, current_user from werkzeug.exceptions import Unauthorized from scuevals_api.models import User def optional_arg_decorator(fn): def wrapped_decorator(*args): if len(args) == 1 and callable(args[0...
Allow multiple permissions for an endpoint
## Code Before: from functools import wraps from flask_jwt_extended import get_jwt_identity, jwt_required, current_user from werkzeug.exceptions import Unauthorized from scuevals_api.models import User def optional_arg_decorator(fn): def wrapped_decorator(*args): if len(args) == 1 and callable(args[0]): ...
from functools import wraps from flask_jwt_extended import get_jwt_identity, jwt_required, current_user from werkzeug.exceptions import Unauthorized from scuevals_api.models import User def optional_arg_decorator(fn): def wrapped_decorator(*args): if len(args) == 1 and callable(args[0...
22ac4b9f8dd7d74a84585131fb982f3594a91603
hr_family/models/hr_children.py
hr_family/models/hr_children.py
from openerp import models, fields GENDER_SELECTION = [('m', 'M'), ('f', 'F')] class HrChildren(models.Model): _name = 'hr.employee.children' _description = 'HR Employee Children' name = fields.Char("Name", required=True) date_of_birth = fields.Date("Date of Birth", oldname='dob...
from openerp import models, fields GENDER_SELECTION = [('male', 'Male'), ('female', 'Female')] class HrChildren(models.Model): _name = 'hr.employee.children' _description = 'HR Employee Children' name = fields.Char("Name", required=True) date_of_birth = fields.Date("Date of Birt...
Use the same selection like employee
[IMP][hr_family] Use the same selection like employee
Python
agpl-3.0
xpansa/hr,Vauxoo/hr,Eficent/hr,thinkopensolutions/hr,microcom/hr,hbrunn/hr,acsone/hr,hbrunn/hr,Antiun/hr,feketemihai/hr,thinkopensolutions/hr,Antiun/hr,xpansa/hr,Endika/hr,feketemihai/hr,Endika/hr,open-synergy/hr,VitalPet/hr,microcom/hr,Vauxoo/hr,VitalPet/hr,open-synergy/hr,Eficent/hr,acsone/hr
from openerp import models, fields - GENDER_SELECTION = [('m', 'M'), + GENDER_SELECTION = [('male', 'Male'), - ('f', 'F')] + ('female', 'Female')] class HrChildren(models.Model): _name = 'hr.employee.children' _description = 'HR Employee Children' ...
Use the same selection like employee
## Code Before: from openerp import models, fields GENDER_SELECTION = [('m', 'M'), ('f', 'F')] class HrChildren(models.Model): _name = 'hr.employee.children' _description = 'HR Employee Children' name = fields.Char("Name", required=True) date_of_birth = fields.Date("Date of Birt...
from openerp import models, fields - GENDER_SELECTION = [('m', 'M'), + GENDER_SELECTION = [('male', 'Male'), ? +++ +++ - ('f', 'F')] + ('female', 'Female')] ? +++++ +++++ class HrChildren(models.Model): ...
8a645abd1880fdac72e36f7366ae81fa13bf78ae
app/main/views/digital_outcomes_and_specialists.py
app/main/views/digital_outcomes_and_specialists.py
from __future__ import unicode_literals from app import data_api_client from flask import abort, render_template from ...helpers.buyers_helpers import get_framework_and_lot from ...main import main @main.route('/buyers/frameworks/<framework_slug>/requirements/user-research-studios', methods=['GET']) def studios_star...
from __future__ import unicode_literals from app import data_api_client from flask import abort, render_template from ...helpers.buyers_helpers import get_framework_and_lot from ...main import main @main.route('/buyers/frameworks/<framework_slug>/requirements/user-research-studios', methods=['GET']) def studios_star...
Check framework has the studios lot before showing start page
Check framework has the studios lot before showing start page
Python
mit
AusDTO/dto-digitalmarketplace-buyer-frontend,AusDTO/dto-digitalmarketplace-buyer-frontend,alphagov/digitalmarketplace-buyer-frontend,alphagov/digitalmarketplace-buyer-frontend,alphagov/digitalmarketplace-buyer-frontend,alphagov/digitalmarketplace-buyer-frontend,AusDTO/dto-digitalmarketplace-buyer-frontend,AusDTO/dto-di...
from __future__ import unicode_literals from app import data_api_client from flask import abort, render_template from ...helpers.buyers_helpers import get_framework_and_lot from ...main import main @main.route('/buyers/frameworks/<framework_slug>/requirements/user-research-studios', methods=['GET']...
Check framework has the studios lot before showing start page
## Code Before: from __future__ import unicode_literals from app import data_api_client from flask import abort, render_template from ...helpers.buyers_helpers import get_framework_and_lot from ...main import main @main.route('/buyers/frameworks/<framework_slug>/requirements/user-research-studios', methods=['GET']) ...
from __future__ import unicode_literals from app import data_api_client from flask import abort, render_template from ...helpers.buyers_helpers import get_framework_and_lot from ...main import main @main.route('/buyers/frameworks/<framework_slug>/requirements/user-research-studios', methods=['GET']...
aae29a385129e6a1573fac2c631eff8db8ea3079
stackdio/stackdio/__init__.py
stackdio/stackdio/__init__.py
from __future__ import absolute_import import sys from .version import __version__, __version_info__ # NOQA # This will make sure the app is always imported when # Django starts so that shared_task will use this app. try: from .celery import app as celery_app except ImportError: sys.stderr.write('Not import...
from __future__ import absolute_import import sys from .version import __version__, __version_info__ # NOQA # This will make sure the app is always imported when # Django starts so that shared_task will use this app. try: from .celery import app as celery_app except ImportError: sys.stderr.write("Not import...
Print a more useful warning message
Print a more useful warning message
Python
apache-2.0
stackdio/stackdio,clarkperkins/stackdio,stackdio/stackdio,clarkperkins/stackdio,clarkperkins/stackdio,clarkperkins/stackdio,stackdio/stackdio,stackdio/stackdio
from __future__ import absolute_import import sys from .version import __version__, __version_info__ # NOQA # This will make sure the app is always imported when # Django starts so that shared_task will use this app. try: from .celery import app as celery_app except ImportError: - sys....
Print a more useful warning message
## Code Before: from __future__ import absolute_import import sys from .version import __version__, __version_info__ # NOQA # This will make sure the app is always imported when # Django starts so that shared_task will use this app. try: from .celery import app as celery_app except ImportError: sys.stderr.w...
from __future__ import absolute_import import sys from .version import __version__, __version_info__ # NOQA # This will make sure the app is always imported when # Django starts so that shared_task will use this app. try: from .celery import app as celery_app except ImportError: - sys....
001a50b236e60358cf1fbe371d6d20ea72003ceb
noms.py
noms.py
from config import WOLFRAM_KEY import wolframalpha POD_TITLE = 'Average nutrition facts' QUERY = input() def get_macros(pod_text): items = pod_text.split("|") for t in items: chunks = t.split() if 'protein' in chunks: protein = tuple(chunks[-2::]) elif 'total' in chunks: ...
from config import WOLFRAM_KEY import sys import wolframalpha POD_TITLE = 'Average nutrition facts' QUERY = input() def get_macros(pod_text): items = pod_text.split("|") for t in items: chunks = t.split() if 'protein' in chunks: protein = chunks[-2::] elif 'total' in chunk...
Add some basic error handling and remove tuples.
Add some basic error handling and remove tuples. No need for tuples when the lists are going to be so small. The speed difference between the two will be minimal.
Python
mit
brotatos/noms
from config import WOLFRAM_KEY + import sys import wolframalpha POD_TITLE = 'Average nutrition facts' QUERY = input() def get_macros(pod_text): items = pod_text.split("|") for t in items: chunks = t.split() if 'protein' in chunks: - protein = tuple(chunks[-...
Add some basic error handling and remove tuples.
## Code Before: from config import WOLFRAM_KEY import wolframalpha POD_TITLE = 'Average nutrition facts' QUERY = input() def get_macros(pod_text): items = pod_text.split("|") for t in items: chunks = t.split() if 'protein' in chunks: protein = tuple(chunks[-2::]) elif 'tot...
from config import WOLFRAM_KEY + import sys import wolframalpha POD_TITLE = 'Average nutrition facts' QUERY = input() def get_macros(pod_text): items = pod_text.split("|") for t in items: chunks = t.split() if 'protein' in chunks: - protein = tuple(chunks[-...
be2e68d077e90f1915274ac9b0e110cc82a3b126
zou/app/mixin.py
zou/app/mixin.py
from flask_restful import reqparse from flask import request class ArgsMixin(object): """ Helpers to retrieve parameters from GET or POST queries. """ def get_args(self, descriptors): parser = reqparse.RequestParser() for descriptor in descriptors: action = None ...
from flask_restful import reqparse from flask import request class ArgsMixin(object): """ Helpers to retrieve parameters from GET or POST queries. """ def get_args(self, descriptors): parser = reqparse.RequestParser() for descriptor in descriptors: action = None ...
Add a function to clean dict keys
[utils] Add a function to clean dict keys Remove None values.
Python
agpl-3.0
cgwire/zou
from flask_restful import reqparse from flask import request class ArgsMixin(object): """ Helpers to retrieve parameters from GET or POST queries. """ def get_args(self, descriptors): parser = reqparse.RequestParser() for descriptor in descriptors: ...
Add a function to clean dict keys
## Code Before: from flask_restful import reqparse from flask import request class ArgsMixin(object): """ Helpers to retrieve parameters from GET or POST queries. """ def get_args(self, descriptors): parser = reqparse.RequestParser() for descriptor in descriptors: action =...
from flask_restful import reqparse from flask import request class ArgsMixin(object): """ Helpers to retrieve parameters from GET or POST queries. """ def get_args(self, descriptors): parser = reqparse.RequestParser() for descriptor in descriptors: ...
091f9daf8758e56c82dbe7a88a50489ab279f793
adhocracy/lib/helpers/site_helper.py
adhocracy/lib/helpers/site_helper.py
from pylons import config, g from pylons.i18n import _ def name(): return config.get('adhocracy.site.name', _("Adhocracy")) def base_url(instance, path=None): url = "%s://" % config.get('adhocracy.protocol', 'http').strip() if instance is not None and g.single_instance is None: url += instance.k...
from pylons import config, g from pylons.i18n import _ def domain(): return config.get('adhocracy.domain').split(':')[0] def name(): return config.get('adhocracy.site.name', _("Adhocracy")) def base_url(instance, path=None): url = "%s://" % config.get('adhocracy.protocol', 'http').strip() if insta...
Add h.site.domain() to return the domian without the port
Add h.site.domain() to return the domian without the port
Python
agpl-3.0
DanielNeugebauer/adhocracy,liqd/adhocracy,alkadis/vcv,DanielNeugebauer/adhocracy,DanielNeugebauer/adhocracy,liqd/adhocracy,SysTheron/adhocracy,alkadis/vcv,phihag/adhocracy,alkadis/vcv,phihag/adhocracy,SysTheron/adhocracy,alkadis/vcv,DanielNeugebauer/adhocracy,liqd/adhocracy,liqd/adhocracy,alkadis/vcv,DanielNeugebauer/a...
from pylons import config, g from pylons.i18n import _ + + + def domain(): + return config.get('adhocracy.domain').split(':')[0] def name(): return config.get('adhocracy.site.name', _("Adhocracy")) def base_url(instance, path=None): url = "%s://" % config.get('adhocracy.protocol', ...
Add h.site.domain() to return the domian without the port
## Code Before: from pylons import config, g from pylons.i18n import _ def name(): return config.get('adhocracy.site.name', _("Adhocracy")) def base_url(instance, path=None): url = "%s://" % config.get('adhocracy.protocol', 'http').strip() if instance is not None and g.single_instance is None: u...
from pylons import config, g from pylons.i18n import _ + + + def domain(): + return config.get('adhocracy.domain').split(':')[0] def name(): return config.get('adhocracy.site.name', _("Adhocracy")) def base_url(instance, path=None): url = "%s://" % config.get('adhocracy.protocol', ...
96db3441a0cc2e3010606b2017c900a16c6a8f2f
astropy/nddata/tests/test_nddatabase.py
astropy/nddata/tests/test_nddatabase.py
from __future__ import (absolute_import, division, print_function, unicode_literals) from ..nddatabase import NDDataBase from ...tests.helper import pytest class MinimalSubclass(NDDataBase): def __init__(self): super(MinimalSubclass, self).__init__() @property def data(s...
from __future__ import (absolute_import, division, print_function, unicode_literals) from ..nddatabase import NDDataBase from ...tests.helper import pytest class MinimalSubclass(NDDataBase): def __init__(self): super(MinimalSubclass, self).__init__() @property def data(s...
Add returns to test class properties
Add returns to test class properties
Python
bsd-3-clause
tbabej/astropy,lpsinger/astropy,dhomeier/astropy,larrybradley/astropy,pllim/astropy,dhomeier/astropy,AustereCuriosity/astropy,stargaser/astropy,mhvk/astropy,astropy/astropy,AustereCuriosity/astropy,pllim/astropy,lpsinger/astropy,MSeifert04/astropy,tbabej/astropy,stargaser/astropy,bsipocz/astropy,joergdietrich/astropy,j...
from __future__ import (absolute_import, division, print_function, unicode_literals) from ..nddatabase import NDDataBase from ...tests.helper import pytest class MinimalSubclass(NDDataBase): def __init__(self): super(MinimalSubclass, self).__init__() ...
Add returns to test class properties
## Code Before: from __future__ import (absolute_import, division, print_function, unicode_literals) from ..nddatabase import NDDataBase from ...tests.helper import pytest class MinimalSubclass(NDDataBase): def __init__(self): super(MinimalSubclass, self).__init__() @propert...
from __future__ import (absolute_import, division, print_function, unicode_literals) from ..nddatabase import NDDataBase from ...tests.helper import pytest class MinimalSubclass(NDDataBase): def __init__(self): super(MinimalSubclass, self).__init__() ...
8a34e665539b10a8e90c86f89a7e2d5881b36519
functional_tests.py
functional_tests.py
from selenium import webdriver browser = webdriver.Firefox() browser.get('http://localhost:8000') assert 'Django' in browser.title
from selenium import webdriver import unittest class NewVisitorTest(unittest.TestCase): def setUp(self): self.browser = webdriver.Firefox() self.browser.implicitly_wait(3) def tearDown(self): self.browser.quit() def test_can_start_a_list_and_retrieve_it_later(self): self....
Add first FT spec comments
Add first FT spec comments
Python
mit
rodowi/remember-the-beer
from selenium import webdriver + import unittest + class NewVisitorTest(unittest.TestCase): - browser = webdriver.Firefox() - browser.get('http://localhost:8000') - assert 'Django' in browser.title + def setUp(self): + self.browser = webdriver.Firefox() + self.browser.implicitly_wait(3) + +...
Add first FT spec comments
## Code Before: from selenium import webdriver browser = webdriver.Firefox() browser.get('http://localhost:8000') assert 'Django' in browser.title ## Instruction: Add first FT spec comments ## Code After: from selenium import webdriver import unittest class NewVisitorTest(unittest.TestCase): def setUp(self): ...
from selenium import webdriver + import unittest + class NewVisitorTest(unittest.TestCase): - browser = webdriver.Firefox() - browser.get('http://localhost:8000') - assert 'Django' in browser.title + def setUp(self): + self.browser = webdriver.Firefox() + self.browser.implicitly_wait(3) +...
726662d102453f7c7be5fb31499a8c4d5ab34444
apps/storybase_user/models.py
apps/storybase_user/models.py
from django.contrib.auth.models import User from django.db import models from uuidfield.fields import UUIDField from storybase.fields import ShortTextField class Organization(models.Model): """ An organization or a community group that users and stories can be associated with. """ organization_id = UUIDField(a...
from django.contrib.auth.models import User from django.db import models from uuidfield.fields import UUIDField from storybase.fields import ShortTextField class Organization(models.Model): """ An organization or a community group that users and stories can be associated with. """ organization_id = UUIDField(a...
Revert "Updated fields for Project model."
Revert "Updated fields for Project model." This reverts commit f68fc56dd2a7ec59d472806ffc14e993686e1f24.
Python
mit
denverfoundation/storybase,denverfoundation/storybase,denverfoundation/storybase,denverfoundation/storybase
from django.contrib.auth.models import User from django.db import models from uuidfield.fields import UUIDField from storybase.fields import ShortTextField class Organization(models.Model): """ An organization or a community group that users and stories can be associated with. """ organization_...
Revert "Updated fields for Project model."
## Code Before: from django.contrib.auth.models import User from django.db import models from uuidfield.fields import UUIDField from storybase.fields import ShortTextField class Organization(models.Model): """ An organization or a community group that users and stories can be associated with. """ organization_...
from django.contrib.auth.models import User from django.db import models from uuidfield.fields import UUIDField from storybase.fields import ShortTextField class Organization(models.Model): """ An organization or a community group that users and stories can be associated with. """ organization_...
716d967971d9ea23ab54d327231ba873b681a7c7
isserviceup/services/models/service.py
isserviceup/services/models/service.py
from enum import Enum class Status(Enum): ok = 1 # green maintenance = 2 # blue minor = 3 # yellow major = 4 # orange critical = 5 # red unavailable = 6 # gray class Service(object): @property def id(self): return self.__class_...
from enum import Enum class Status(Enum): ok = 1 # green maintenance = 2 # blue minor = 3 # yellow major = 4 # orange critical = 5 # red unavailable = 6 # gray class Service(object): @property def id(self): return self.__class_...
Add icon_url as abstract property
Add icon_url as abstract property
Python
apache-2.0
marcopaz/is-service-up,marcopaz/is-service-up,marcopaz/is-service-up
from enum import Enum class Status(Enum): ok = 1 # green maintenance = 2 # blue minor = 3 # yellow major = 4 # orange critical = 5 # red unavailable = 6 # gray class Service(object): @property def id(sel...
Add icon_url as abstract property
## Code Before: from enum import Enum class Status(Enum): ok = 1 # green maintenance = 2 # blue minor = 3 # yellow major = 4 # orange critical = 5 # red unavailable = 6 # gray class Service(object): @property def id(self): retu...
from enum import Enum class Status(Enum): ok = 1 # green maintenance = 2 # blue minor = 3 # yellow major = 4 # orange critical = 5 # red unavailable = 6 # gray class Service(object): @property def id(sel...
2118cc5efbe70a10c67ddf9b949607b243e05687
rest_framework_docs/api_docs.py
rest_framework_docs/api_docs.py
from django.conf import settings from django.core.urlresolvers import RegexURLResolver, RegexURLPattern from rest_framework.views import APIView from rest_framework_docs.api_endpoint import ApiEndpoint class ApiDocumentation(object): def __init__(self): self.endpoints = [] root_urlconf = __import...
from django.conf import settings from django.core.urlresolvers import RegexURLResolver, RegexURLPattern from rest_framework.views import APIView from rest_framework_docs.api_endpoint import ApiEndpoint class ApiDocumentation(object): def __init__(self): self.endpoints = [] root_urlconf = __import...
Return conditional without using if/else to return boolean values
Return conditional without using if/else to return boolean values In this case, since both methods in the conditional strictly returns boolean values, it is defintely safe and more pythonic to return the conditional
Python
bsd-2-clause
ekonstantinidis/django-rest-framework-docs,manosim/django-rest-framework-docs,ekonstantinidis/django-rest-framework-docs,ekonstantinidis/django-rest-framework-docs,manosim/django-rest-framework-docs,manosim/django-rest-framework-docs
from django.conf import settings from django.core.urlresolvers import RegexURLResolver, RegexURLPattern from rest_framework.views import APIView from rest_framework_docs.api_endpoint import ApiEndpoint class ApiDocumentation(object): def __init__(self): self.endpoints = [] r...
Return conditional without using if/else to return boolean values
## Code Before: from django.conf import settings from django.core.urlresolvers import RegexURLResolver, RegexURLPattern from rest_framework.views import APIView from rest_framework_docs.api_endpoint import ApiEndpoint class ApiDocumentation(object): def __init__(self): self.endpoints = [] root_ur...
from django.conf import settings from django.core.urlresolvers import RegexURLResolver, RegexURLPattern from rest_framework.views import APIView from rest_framework_docs.api_endpoint import ApiEndpoint class ApiDocumentation(object): def __init__(self): self.endpoints = [] r...
7d9265cd3cb29606e37b296dde5af07099098228
axes/tests/test_checks.py
axes/tests/test_checks.py
from django.core.checks import run_checks, Error from django.test import override_settings from axes.checks import Messages, Hints, Codes from axes.conf import settings from axes.tests.base import AxesTestCase @override_settings(AXES_HANDLER='axes.handlers.cache.AxesCacheHandler') class CacheCheckTestCase(AxesTestCa...
from django.core.checks import run_checks, Error from django.test import override_settings from axes.checks import Messages, Hints, Codes from axes.conf import settings from axes.tests.base import AxesTestCase class CacheCheckTestCase(AxesTestCase): @override_settings( AXES_HANDLER='axes.handlers.cache.A...
Add check test for missing case branch
Add check test for missing case branch Signed-off-by: Aleksi Häkli <44cb6a94c0d20644d531e2be44779b52833cdcd2@iki.fi>
Python
mit
jazzband/django-axes,django-pci/django-axes
from django.core.checks import run_checks, Error from django.test import override_settings from axes.checks import Messages, Hints, Codes from axes.conf import settings from axes.tests.base import AxesTestCase - @override_settings(AXES_HANDLER='axes.handlers.cache.AxesCacheHandler') class CacheChec...
Add check test for missing case branch
## Code Before: from django.core.checks import run_checks, Error from django.test import override_settings from axes.checks import Messages, Hints, Codes from axes.conf import settings from axes.tests.base import AxesTestCase @override_settings(AXES_HANDLER='axes.handlers.cache.AxesCacheHandler') class CacheCheckTes...
from django.core.checks import run_checks, Error from django.test import override_settings from axes.checks import Messages, Hints, Codes from axes.conf import settings from axes.tests.base import AxesTestCase - @override_settings(AXES_HANDLER='axes.handlers.cache.AxesCacheHandler') class CacheChec...
5f72b6edc28caa7bf03720ed27a9f3aa32c8323e
go/billing/management/commands/go_gen_statements.py
go/billing/management/commands/go_gen_statements.py
from datetime import datetime from optparse import make_option from go.billing.models import Account from go.billing.tasks import month_range, generate_monthly_statement from go.base.command_utils import BaseGoCommand, get_user_by_email class Command(BaseGoCommand): help = "Generate monthly billing statements fo...
from datetime import datetime from optparse import make_option from go.billing.models import Account from go.billing.tasks import month_range, generate_monthly_statement from go.base.command_utils import BaseGoCommand, get_user_by_email class Command(BaseGoCommand): help = "Generate monthly billing statements fo...
Fix broken billing statement command tests
Fix broken billing statement command tests
Python
bsd-3-clause
praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go
from datetime import datetime from optparse import make_option from go.billing.models import Account from go.billing.tasks import month_range, generate_monthly_statement from go.base.command_utils import BaseGoCommand, get_user_by_email class Command(BaseGoCommand): help = "Generate monthly b...
Fix broken billing statement command tests
## Code Before: from datetime import datetime from optparse import make_option from go.billing.models import Account from go.billing.tasks import month_range, generate_monthly_statement from go.base.command_utils import BaseGoCommand, get_user_by_email class Command(BaseGoCommand): help = "Generate monthly billi...
from datetime import datetime from optparse import make_option from go.billing.models import Account from go.billing.tasks import month_range, generate_monthly_statement from go.base.command_utils import BaseGoCommand, get_user_by_email class Command(BaseGoCommand): help = "Generate monthly b...
d9844f5bcf6d48bde1a60d32998ccdaa87e99676
cloud_browser/__init__.py
cloud_browser/__init__.py
VERSION = (0, 2, 1) __version__ = ".".join(str(v) for v in VERSION) __version_full__ = __version__ + "".join(str(v) for v in VERSION)
VERSION = (0, 2, 1) __version__ = ".".join(str(v) for v in VERSION) __version_full__ = __version__
Fix __version_full__ for new scheme.
Version: Fix __version_full__ for new scheme.
Python
mit
ryan-roemer/django-cloud-browser,UrbanDaddy/django-cloud-browser,UrbanDaddy/django-cloud-browser,ryan-roemer/django-cloud-browser,ryan-roemer/django-cloud-browser
VERSION = (0, 2, 1) __version__ = ".".join(str(v) for v in VERSION) - __version_full__ = __version__ + "".join(str(v) for v in VERSION) + __version_full__ = __version__
Fix __version_full__ for new scheme.
## Code Before: VERSION = (0, 2, 1) __version__ = ".".join(str(v) for v in VERSION) __version_full__ = __version__ + "".join(str(v) for v in VERSION) ## Instruction: Fix __version_full__ for new scheme. ## Code After: VERSION = (0, 2, 1) __version__ = ".".join(str(v) for v in VERSION) __version_full__ = __version_...
VERSION = (0, 2, 1) __version__ = ".".join(str(v) for v in VERSION) - __version_full__ = __version__ + "".join(str(v) for v in VERSION) + __version_full__ = __version__
12683ea64a875b624230f2dd84609a77eaec1095
cd_wizard.py
cd_wizard.py
from PyQt4 import QtGui def createIntroPage(): page = QtGui.QWizardPage() page.setTitle("Introduction") page.setSubTitle("This wizard will help you archive your CDs in your Personal Music Locker") label = QtGui.QLabel("Please insert a CD") label.setWordWrap(True) layout = QtGui.QVBoxLayout...
from PyQt4 import QtGui def createIntroPage(): page = QtGui.QWizardPage() page.setTitle("Introduction") page.setSubTitle("This wizard will help you archive your CDs in your Personal Music Locker") label = QtGui.QLabel("Please insert a CD") label.setWordWrap(True) layout = QtGui.QVBoxLayout...
Add file browser to choose a CD.
Add file browser to choose a CD.
Python
agpl-3.0
brewsterkahle/archivecd
from PyQt4 import QtGui def createIntroPage(): page = QtGui.QWizardPage() page.setTitle("Introduction") page.setSubTitle("This wizard will help you archive your CDs in your Personal Music Locker") label = QtGui.QLabel("Please insert a CD") label.setWordWrap(True) ...
Add file browser to choose a CD.
## Code Before: from PyQt4 import QtGui def createIntroPage(): page = QtGui.QWizardPage() page.setTitle("Introduction") page.setSubTitle("This wizard will help you archive your CDs in your Personal Music Locker") label = QtGui.QLabel("Please insert a CD") label.setWordWrap(True) layout = Q...
from PyQt4 import QtGui def createIntroPage(): page = QtGui.QWizardPage() page.setTitle("Introduction") page.setSubTitle("This wizard will help you archive your CDs in your Personal Music Locker") label = QtGui.QLabel("Please insert a CD") label.setWordWrap(True) ...
659614a6b845a95ce7188e86adae4bdc2c5416e7
examples/benchmark/__init__.py
examples/benchmark/__init__.py
import benchmark_twisted_names __all__ = ['benchmark_fibonacci', 'benchmark_twisted_names']
import benchmark_fibonacci import benchmark_twisted_names __all__ = ['benchmark_fibonacci', 'benchmark_twisted_names']
Add back commented out Fibonacci benchmark.
Add back commented out Fibonacci benchmark.
Python
mit
AlekSi/benchmarking-py
+ import benchmark_fibonacci import benchmark_twisted_names __all__ = ['benchmark_fibonacci', 'benchmark_twisted_names']
Add back commented out Fibonacci benchmark.
## Code Before: import benchmark_twisted_names __all__ = ['benchmark_fibonacci', 'benchmark_twisted_names'] ## Instruction: Add back commented out Fibonacci benchmark. ## Code After: import benchmark_fibonacci import benchmark_twisted_names __all__ = ['benchmark_fibonacci', 'benchmark_twisted_names']
+ import benchmark_fibonacci import benchmark_twisted_names __all__ = ['benchmark_fibonacci', 'benchmark_twisted_names']
f5af9624359523ddf67b63327d8fe85382497c47
pycroft/helpers/user.py
pycroft/helpers/user.py
from passlib.apps import ldap_context import passlib.utils ldap_context = ldap_context.copy(default="ldap_sha512_crypt") def generate_password(length): charset = "abcdefghijklmnopqrstuvwxyz!$%&()=.," \ ":;-_#+1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ" return passlib.utils.generate_password(length, c...
from passlib.apps import ldap_context import passlib.utils crypt_context = ldap_context.copy( default="ldap_sha512_crypt", deprecated=["ldap_plaintext", "ldap_md5", "ldap_sha1", "ldap_salted_md5", "ldap_des_crypt", "ldap_bsdi_crypt", "ldap_md5_crypt"]) def generate_password(length): chars...
Set deprecated password hashing schemes
Set deprecated password hashing schemes
Python
apache-2.0
agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,lukasjuhrich/pycroft,lukasjuhrich/pycroft,lukasjuhrich/pycroft,lukasjuhrich/pycroft
from passlib.apps import ldap_context import passlib.utils - ldap_context = ldap_context.copy(default="ldap_sha512_crypt") + crypt_context = ldap_context.copy( + default="ldap_sha512_crypt", + deprecated=["ldap_plaintext", "ldap_md5", "ldap_sha1", "ldap_salted_md5", + "ldap_des_crypt", "l...
Set deprecated password hashing schemes
## Code Before: from passlib.apps import ldap_context import passlib.utils ldap_context = ldap_context.copy(default="ldap_sha512_crypt") def generate_password(length): charset = "abcdefghijklmnopqrstuvwxyz!$%&()=.," \ ":;-_#+1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ" return passlib.utils.generate_pa...
from passlib.apps import ldap_context import passlib.utils - ldap_context = ldap_context.copy(default="ldap_sha512_crypt") + crypt_context = ldap_context.copy( + default="ldap_sha512_crypt", + deprecated=["ldap_plaintext", "ldap_md5", "ldap_sha1", "ldap_salted_md5", + "ldap_des_crypt", "l...
8c2ebccac0f633b3d2198a6a9d477ac4b8a620df
koztumize/application.py
koztumize/application.py
"""Declare the Koztumize application using Pynuts.""" import ldap from pynuts import Pynuts class Koztumize(Pynuts): """The class which open the ldap.""" @property def ldap(self): """Open the ldap.""" if 'LDAP' not in self.config: # pragma: no cover self.config['LDAP'] = ldap...
"""Declare the Koztumize application using Pynuts.""" import os import ldap from pynuts import Pynuts class Koztumize(Pynuts): """The class which open the ldap.""" @property def ldap(self): """Open the ldap.""" if 'LDAP' not in self.config: # pragma: no cover self.config['LDA...
Use an environment variable as config file
Use an environment variable as config file
Python
agpl-3.0
Kozea/Koztumize,Kozea/Koztumize,Kozea/Koztumize
"""Declare the Koztumize application using Pynuts.""" + import os import ldap from pynuts import Pynuts class Koztumize(Pynuts): """The class which open the ldap.""" @property def ldap(self): """Open the ldap.""" if 'LDAP' not in self.config: # pragma: no cover ...
Use an environment variable as config file
## Code Before: """Declare the Koztumize application using Pynuts.""" import ldap from pynuts import Pynuts class Koztumize(Pynuts): """The class which open the ldap.""" @property def ldap(self): """Open the ldap.""" if 'LDAP' not in self.config: # pragma: no cover self.confi...
"""Declare the Koztumize application using Pynuts.""" + import os import ldap from pynuts import Pynuts class Koztumize(Pynuts): """The class which open the ldap.""" @property def ldap(self): """Open the ldap.""" if 'LDAP' not in self.config: # pragma: no cover ...
dfa752590c944fc07253c01c3d99b640a46dae1d
jinja2_time/jinja2_time.py
jinja2_time/jinja2_time.py
import arrow from jinja2 import nodes from jinja2.ext import Extension class TimeExtension(Extension): tags = set(['now']) def __init__(self, environment): super(TimeExtension, self).__init__(environment) # add the defaults to the environment environment.extend( datetim...
import arrow from jinja2 import nodes from jinja2.ext import Extension class TimeExtension(Extension): tags = set(['now']) def __init__(self, environment): super(TimeExtension, self).__init__(environment) # add the defaults to the environment environment.extend(datetime_format='%Y-...
Implement parser method for optional offset
Implement parser method for optional offset
Python
mit
hackebrot/jinja2-time
import arrow from jinja2 import nodes from jinja2.ext import Extension class TimeExtension(Extension): tags = set(['now']) def __init__(self, environment): super(TimeExtension, self).__init__(environment) # add the defaults to the environment - environme...
Implement parser method for optional offset
## Code Before: import arrow from jinja2 import nodes from jinja2.ext import Extension class TimeExtension(Extension): tags = set(['now']) def __init__(self, environment): super(TimeExtension, self).__init__(environment) # add the defaults to the environment environment.extend( ...
import arrow from jinja2 import nodes from jinja2.ext import Extension class TimeExtension(Extension): tags = set(['now']) def __init__(self, environment): super(TimeExtension, self).__init__(environment) # add the defaults to the environment - environme...
34fa7433ea6f04089a420e0392605147669801d1
dummy.py
dummy.py
import os def foo(): """ This is crappy function. should be removed using git checkout """ if True == True: return True else: return False def main(): pass if __name__ == '__main__': main()
import os def foo(): """ This is crappy function. should be removed using git checkout """ return None def main(): pass if __name__ == '__main__': main()
Revert "added more crappy codes"
Revert "added more crappy codes" This reverts commit 6f10d506bf36572b53f0325fef6dc8a1bac5f4fd.
Python
apache-2.0
kp89/do-git
import os def foo(): """ This is crappy function. should be removed using git checkout """ + return None - if True == True: - return True - else: - return False - def main(): pass if __name__ == '__main__': main()
Revert "added more crappy codes"
## Code Before: import os def foo(): """ This is crappy function. should be removed using git checkout """ if True == True: return True else: return False def main(): pass if __name__ == '__main__': main() ## Instruction: Revert "added more crappy codes" ## Code After: import os def foo(): """ This i...
import os def foo(): """ This is crappy function. should be removed using git checkout """ + return None - if True == True: - return True - else: - return False - def main(): pass if __name__ == '__main__': main()
6f7890c8b29670f613b6a551ebac2b383f3a7a64
tests/test_recipes.py
tests/test_recipes.py
import unittest from brew.constants import IMPERIAL_UNITS from brew.constants import SI_UNITS from brew.recipes import Recipe from fixtures import grain_additions from fixtures import hop_additions from fixtures import recipe class TestRecipe(unittest.TestCase): def setUp(self): # Define Grains ...
import unittest from brew.constants import IMPERIAL_UNITS from brew.constants import SI_UNITS from brew.recipes import Recipe from fixtures import grain_additions from fixtures import hop_additions from fixtures import recipe from fixtures import yeast class TestRecipe(unittest.TestCase): def setUp(self): ...
Test units mismatch in recipe
Test units mismatch in recipe
Python
mit
chrisgilmerproj/brewday,chrisgilmerproj/brewday
import unittest from brew.constants import IMPERIAL_UNITS from brew.constants import SI_UNITS from brew.recipes import Recipe from fixtures import grain_additions from fixtures import hop_additions from fixtures import recipe + from fixtures import yeast class TestRecipe(unittest.TestCase): ...
Test units mismatch in recipe
## Code Before: import unittest from brew.constants import IMPERIAL_UNITS from brew.constants import SI_UNITS from brew.recipes import Recipe from fixtures import grain_additions from fixtures import hop_additions from fixtures import recipe class TestRecipe(unittest.TestCase): def setUp(self): # Define...
import unittest from brew.constants import IMPERIAL_UNITS from brew.constants import SI_UNITS from brew.recipes import Recipe from fixtures import grain_additions from fixtures import hop_additions from fixtures import recipe + from fixtures import yeast class TestRecipe(unittest.TestCase): ...
f76bba08c1a8cfd3c821f641adb2b10e3cfa47b9
tests/test_base_os.py
tests/test_base_os.py
from .fixtures import elasticsearch def test_base_os(host): assert host.system_info.distribution == 'centos' assert host.system_info.release == '7' def test_java_home_env_var(host): java_path_cmdline = '$JAVA_HOME/bin/java -version' assert host.run(java_path_cmdline).exit_status == 0
from .fixtures import elasticsearch def test_base_os(host): assert host.system_info.distribution == 'centos' assert host.system_info.release == '7' def test_java_home_env_var(host): java_path_cmdline = '$JAVA_HOME/bin/java -version' assert host.run(java_path_cmdline).exit_status == 0 def test_no_...
Add acceptance test to ensure image doesn't contain core files in /
Add acceptance test to ensure image doesn't contain core files in / In some occasions, depending on the build platform (noticed with aufs with old docker-ce versions) may create a /corefile.<pid>. Fail a build if the produced image containers any /core* files. Relates #97
Python
apache-2.0
jarpy/elasticsearch-docker,jarpy/elasticsearch-docker
from .fixtures import elasticsearch def test_base_os(host): assert host.system_info.distribution == 'centos' assert host.system_info.release == '7' def test_java_home_env_var(host): java_path_cmdline = '$JAVA_HOME/bin/java -version' assert host.run(java_path_cmdline).exit_st...
Add acceptance test to ensure image doesn't contain core files in /
## Code Before: from .fixtures import elasticsearch def test_base_os(host): assert host.system_info.distribution == 'centos' assert host.system_info.release == '7' def test_java_home_env_var(host): java_path_cmdline = '$JAVA_HOME/bin/java -version' assert host.run(java_path_cmdline).exit_status == ...
from .fixtures import elasticsearch def test_base_os(host): assert host.system_info.distribution == 'centos' assert host.system_info.release == '7' def test_java_home_env_var(host): java_path_cmdline = '$JAVA_HOME/bin/java -version' assert host.run(java_path_cmdline).exit_st...
0ac5a45c27b574c73d2660e96543220e274e1c64
magpy/server/_ejdb.py
magpy/server/_ejdb.py
import os import pyejdb class Database(object): """Simple database connection for use in serverside scripts etc.""" def __init__(self, database_name=None, config_file=None): self.config_file = config_file if not database_name: database_name = os.pa...
import os import pyejdb class Database(object): """Simple database connection for use in serverside scripts etc.""" def __init__(self, database_name=None, config_file=None): self.config_file = config_file if not database_name: database_name = os.pa...
Deal with the weirdnesses of ejdb.
Deal with the weirdnesses of ejdb.
Python
bsd-3-clause
zeth/magpy,catsmith/magpy,zeth/magpy,catsmith/magpy
import os import pyejdb class Database(object): """Simple database connection for use in serverside scripts etc.""" def __init__(self, database_name=None, config_file=None): self.config_file = config_file if not database_name: ...
Deal with the weirdnesses of ejdb.
## Code Before: import os import pyejdb class Database(object): """Simple database connection for use in serverside scripts etc.""" def __init__(self, database_name=None, config_file=None): self.config_file = config_file if not database_name: datab...
import os import pyejdb class Database(object): """Simple database connection for use in serverside scripts etc.""" def __init__(self, database_name=None, config_file=None): self.config_file = config_file if not database_name: ...
62f681803401d05fd0a5e554d4d6c7210dcc7c17
cbv/management/commands/load_all_django_versions.py
cbv/management/commands/load_all_django_versions.py
import os import re from django.conf import settings from django.core.management import call_command, BaseCommand class Command(BaseCommand): """Load the Django project fixtures and all version fixtures""" def handle(self, **options): fixtures_dir = os.path.join(settings.DIRNAME, 'cbv', 'fixtures') ...
import glob import os from django.core.management import call_command, BaseCommand class Command(BaseCommand): """Load the Django project fixtures and all version fixtures""" def handle(self, **options): self.stdout.write('Loading project.json') call_command('loaddata', 'cbv/fixtures/project...
Use glob for finding version fixtures
Use glob for finding version fixtures Thanks @ghickman!
Python
bsd-2-clause
refreshoxford/django-cbv-inspector,refreshoxford/django-cbv-inspector,refreshoxford/django-cbv-inspector,refreshoxford/django-cbv-inspector
+ import glob import os - import re - from django.conf import settings from django.core.management import call_command, BaseCommand class Command(BaseCommand): """Load the Django project fixtures and all version fixtures""" def handle(self, **options): - fixtures_dir = os.path.join...
Use glob for finding version fixtures
## Code Before: import os import re from django.conf import settings from django.core.management import call_command, BaseCommand class Command(BaseCommand): """Load the Django project fixtures and all version fixtures""" def handle(self, **options): fixtures_dir = os.path.join(settings.DIRNAME, 'cb...
+ import glob import os - import re - from django.conf import settings from django.core.management import call_command, BaseCommand class Command(BaseCommand): """Load the Django project fixtures and all version fixtures""" def handle(self, **options): - fixtures_dir = os.path.join...
3a204de33589de943ff09525895812530baac0b2
saylua/modules/pets/models/db.py
saylua/modules/pets/models/db.py
from google.appengine.ext import ndb # This is to store alternate linart versions of the same pets class SpeciesVersion(ndb.Model): name = ndb.StringProperty() base_image = ndb.StringProperty() base_psd = ndb.StringProperty() default_image = ndb.StringProperty() # Pets are divided into species and spe...
from google.appengine.ext import ndb # This is to store alternate linart versions of the same pets class SpeciesVersion(ndb.Model): name = ndb.StringProperty() base_image = ndb.StringProperty() base_psd = ndb.StringProperty() default_image = ndb.StringProperty() # Pets are divided into species and spe...
Update to pet model for provisioner
Update to pet model for provisioner
Python
agpl-3.0
saylua/SayluaV2,saylua/SayluaV2,LikeMyBread/Saylua,LikeMyBread/Saylua,saylua/SayluaV2,LikeMyBread/Saylua,LikeMyBread/Saylua
from google.appengine.ext import ndb # This is to store alternate linart versions of the same pets class SpeciesVersion(ndb.Model): name = ndb.StringProperty() base_image = ndb.StringProperty() base_psd = ndb.StringProperty() default_image = ndb.StringProperty() # Pets are divided ...
Update to pet model for provisioner
## Code Before: from google.appengine.ext import ndb # This is to store alternate linart versions of the same pets class SpeciesVersion(ndb.Model): name = ndb.StringProperty() base_image = ndb.StringProperty() base_psd = ndb.StringProperty() default_image = ndb.StringProperty() # Pets are divided into...
from google.appengine.ext import ndb # This is to store alternate linart versions of the same pets class SpeciesVersion(ndb.Model): name = ndb.StringProperty() base_image = ndb.StringProperty() base_psd = ndb.StringProperty() default_image = ndb.StringProperty() # Pets are divided ...
ebfaf30fca157e83ea9e4bf33173221fc9525caf
demo/examples/employees/forms.py
demo/examples/employees/forms.py
from datetime import date from django import forms from django.utils import timezone from .models import Employee, DeptManager, Title, Salary class ChangeManagerForm(forms.Form): manager = forms.ModelChoiceField(queryset=Employee.objects.all()[:100]) def __init__(self, *args, **kwargs): self.depart...
from django import forms from .models import Employee, DeptManager, Title, Salary class ChangeManagerForm(forms.Form): manager = forms.ModelChoiceField(queryset=Employee.objects.all()[:100]) def __init__(self, *args, **kwargs): self.department = kwargs.pop('department') super(ChangeManagerFo...
Fix emplorrs demo salary db error
Fix emplorrs demo salary db error
Python
bsd-3-clause
viewflow/django-material,viewflow/django-material,viewflow/django-material
- from datetime import date - from django import forms - from django.utils import timezone from .models import Employee, DeptManager, Title, Salary class ChangeManagerForm(forms.Form): manager = forms.ModelChoiceField(queryset=Employee.objects.all()[:100]) def __init__(self, *args, **kwar...
Fix emplorrs demo salary db error
## Code Before: from datetime import date from django import forms from django.utils import timezone from .models import Employee, DeptManager, Title, Salary class ChangeManagerForm(forms.Form): manager = forms.ModelChoiceField(queryset=Employee.objects.all()[:100]) def __init__(self, *args, **kwargs): ...
- from datetime import date - from django import forms - from django.utils import timezone from .models import Employee, DeptManager, Title, Salary class ChangeManagerForm(forms.Form): manager = forms.ModelChoiceField(queryset=Employee.objects.all()[:100]) def __init__(self, *args, **kwar...
647707293524440f014ed0a3ef7d4322a96775e4
tests/example_app/flask_app.py
tests/example_app/flask_app.py
import flask from pale.adapters import flask as pale_flask_adapter from tests.example_app import api def create_pale_flask_app(): """Creates a flask app, and registers a blueprint bound to pale.""" blueprint = flask.Blueprint('api', 'tests.example_app') pale_flask_adapter.bind_blueprint(api, blueprint) ...
import flask from pale.adapters import flask as pale_flask_adapter from pale.config import authenticator, context_creator from tests.example_app import api @authenticator def authenticate_pale_context(context): """Don't actually authenticate anything in this test.""" return context @context_creator def cre...
Add authenticator and context creator to example app
Add authenticator and context creator to example app
Python
mit
Loudr/pale
import flask from pale.adapters import flask as pale_flask_adapter + from pale.config import authenticator, context_creator from tests.example_app import api + + + @authenticator + def authenticate_pale_context(context): + """Don't actually authenticate anything in this test.""" + return context +...
Add authenticator and context creator to example app
## Code Before: import flask from pale.adapters import flask as pale_flask_adapter from tests.example_app import api def create_pale_flask_app(): """Creates a flask app, and registers a blueprint bound to pale.""" blueprint = flask.Blueprint('api', 'tests.example_app') pale_flask_adapter.bind_blueprint(...
import flask from pale.adapters import flask as pale_flask_adapter + from pale.config import authenticator, context_creator from tests.example_app import api + + + @authenticator + def authenticate_pale_context(context): + """Don't actually authenticate anything in this test.""" + return context +...
7c09368b3322144c9cb2b0e18f0b4264acb88eb7
blaze/__init__.py
blaze/__init__.py
from constructors import array, open from datashape import dshape
from constructors import array, open from datashape import dshape def test(verbosity=1, xunitfile=None, exit=False): """ Runs the full Blaze test suite, outputting the results of the tests to sys.stdout. This uses nose tests to discover which tests to run, and runs tests in any 'tests' subdirecto...
Add a nose-based blaze.test() function as a placeholder
Add a nose-based blaze.test() function as a placeholder Hopefully we find something better, but this at least gives us behavior similar to NumPy as a start.
Python
bsd-3-clause
AbhiAgarwal/blaze,dwillmer/blaze,mrocklin/blaze,jdmcbr/blaze,mwiebe/blaze,mwiebe/blaze,ChinaQuants/blaze,xlhtc007/blaze,markflorisson/blaze-core,ContinuumIO/blaze,dwillmer/blaze,cpcloud/blaze,FrancescAlted/blaze,cowlicks/blaze,maxalbert/blaze,caseyclements/blaze,aterrel/blaze,cowlicks/blaze,ChinaQuants/blaze,FrancescAl...
from constructors import array, open from datashape import dshape + def test(verbosity=1, xunitfile=None, exit=False): + """ + Runs the full Blaze test suite, outputting + the results of the tests to sys.stdout. + + This uses nose tests to discover which tests to + run, and runs tests in ...
Add a nose-based blaze.test() function as a placeholder
## Code Before: from constructors import array, open from datashape import dshape ## Instruction: Add a nose-based blaze.test() function as a placeholder ## Code After: from constructors import array, open from datashape import dshape def test(verbosity=1, xunitfile=None, exit=False): """ Runs the full Blaz...
from constructors import array, open from datashape import dshape + + def test(verbosity=1, xunitfile=None, exit=False): + """ + Runs the full Blaze test suite, outputting + the results of the tests to sys.stdout. + + This uses nose tests to discover which tests to + run, and runs tests in ...
6a8f39104a1a7722ee0a0a2437256dd3c123ab18
src/newt/db/tests/base.py
src/newt/db/tests/base.py
import gc import sys PYPY = hasattr(sys, 'pypy_version_info') from .. import pg_connection class DBSetup(object): maxDiff = None @property def dsn(self): return 'postgresql://localhost/' + self.dbname def setUp(self, call_super=True): self.dbname = self.__class__.__name__.lower() + ...
import gc import sys import unittest PYPY = hasattr(sys, 'pypy_version_info') from .. import pg_connection from .._util import closing class DBSetup(object): maxDiff = None @property def dsn(self): return 'postgresql://localhost/' + self.dbname def setUp(self, call_super=True): sel...
Make it easier to clean up tests by closing db sessions
Make it easier to clean up tests by closing db sessions Also added a convenience test base class
Python
mit
newtdb/db
import gc import sys + import unittest + PYPY = hasattr(sys, 'pypy_version_info') from .. import pg_connection + from .._util import closing class DBSetup(object): maxDiff = None @property def dsn(self): return 'postgresql://localhost/' + self.dbname def setUp...
Make it easier to clean up tests by closing db sessions
## Code Before: import gc import sys PYPY = hasattr(sys, 'pypy_version_info') from .. import pg_connection class DBSetup(object): maxDiff = None @property def dsn(self): return 'postgresql://localhost/' + self.dbname def setUp(self, call_super=True): self.dbname = self.__class__.__n...
import gc import sys + import unittest + PYPY = hasattr(sys, 'pypy_version_info') from .. import pg_connection + from .._util import closing class DBSetup(object): maxDiff = None @property def dsn(self): return 'postgresql://localhost/' + self.dbname def setUp...
c7455da1b0092e926ed9dafe5ac5ae1335401dba
admin.py
admin.py
from django.contrib import admin from django.contrib.sites.models import Site from .models import Church admin.site.site_header = "Churches of Bridlington Administration" admin.site.register(Church) admin.site.unregister(Site)
from django.contrib import admin from django.contrib.sites.models import Site from .models import Church admin.site.site_header = "Churches of Bridlington Administration" admin.site.register(Church)
Undo deregistration of Site object
Undo deregistration of Site object This will now be controlled by restricting permissions in the admin.
Python
mit
bm424/churchmanager,bm424/churchmanager
from django.contrib import admin from django.contrib.sites.models import Site from .models import Church admin.site.site_header = "Churches of Bridlington Administration" admin.site.register(Church) - admin.site.unregister(Site)
Undo deregistration of Site object
## Code Before: from django.contrib import admin from django.contrib.sites.models import Site from .models import Church admin.site.site_header = "Churches of Bridlington Administration" admin.site.register(Church) admin.site.unregister(Site) ## Instruction: Undo deregistration of Site object ## Code After: from dj...
from django.contrib import admin from django.contrib.sites.models import Site from .models import Church admin.site.site_header = "Churches of Bridlington Administration" admin.site.register(Church) - admin.site.unregister(Site)
f200d98547baef9ac2faa90d72857ffa0e64c721
IPython/nbconvert/exporters/python.py
IPython/nbconvert/exporters/python.py
"""Python script Exporter class""" #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #----------...
"""Python script Exporter class""" #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #----------...
Add MIME types to nbconvert exporters
Add MIME types to nbconvert exporters
Python
bsd-3-clause
cornhundred/ipywidgets,jupyter-widgets/ipywidgets,cornhundred/ipywidgets,SylvainCorlay/ipywidgets,SylvainCorlay/ipywidgets,cornhundred/ipywidgets,jupyter-widgets/ipywidgets,ipython/ipywidgets,ipython/ipywidgets,ipython/ipywidgets,jupyter-widgets/ipywidgets,ipython/ipywidgets,SylvainCorlay/ipywidgets,cornhundred/ipywidg...
"""Python script Exporter class""" #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this softw...
Add MIME types to nbconvert exporters
## Code Before: """Python script Exporter class""" #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this softw...
"""Python script Exporter class""" #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this softw...
4ec2b94551858e404f0de6d8ad3827d9c6138491
slurmec2utils/sysinit.py
slurmec2utils/sysinit.py
from __future__ import absolute_import, print_function import boto.s3 from boto.s3.key import Key from .clusterconfig import ClusterConfiguration from .instanceinfo import get_instance_id def check_munge_
from __future__ import absolute_import, print_function import boto.s3 from boto.s3.key import Key from .clusterconfig import ClusterConfiguration from .instanceinfo import get_instance_id def get_munge_key(cluster_configuration=None): if cluster_configuration is None: cluster_configuration = ClusterConfigu...
Fix syntax errors. (preventing install)
Fix syntax errors. (preventing install)
Python
apache-2.0
dacut/slurm-ec2-utils,dacut/slurm-ec2-utils
from __future__ import absolute_import, print_function import boto.s3 from boto.s3.key import Key from .clusterconfig import ClusterConfiguration from .instanceinfo import get_instance_id - def check_munge_ + def get_munge_key(cluster_configuration=None): + if cluster_configuration is None: + c...
Fix syntax errors. (preventing install)
## Code Before: from __future__ import absolute_import, print_function import boto.s3 from boto.s3.key import Key from .clusterconfig import ClusterConfiguration from .instanceinfo import get_instance_id def check_munge_ ## Instruction: Fix syntax errors. (preventing install) ## Code After: from __future__ import abs...
from __future__ import absolute_import, print_function import boto.s3 from boto.s3.key import Key from .clusterconfig import ClusterConfiguration from .instanceinfo import get_instance_id - def check_munge_ + def get_munge_key(cluster_configuration=None): + if cluster_configuration is None: + c...
ea22f4bf62204805e698965300b6d8dfa637a662
pybossa_discourse/globals.py
pybossa_discourse/globals.py
"""Jinja globals module for pybossa-discourse.""" from flask import Markup, request class DiscourseGlobals(object): """A class to implement Discourse Global variables.""" def __init__(self, app): self.url = app.config['DISCOURSE_URL'] app.jinja_env.globals.update(discourse=self) def com...
"""Jinja globals module for pybossa-discourse.""" from flask import Markup, request from . import discourse_client class DiscourseGlobals(object): """A class to implement Discourse Global variables.""" def __init__(self, app): self.url = app.config['DISCOURSE_URL'] app.jinja_env.globals.upda...
Add notifications count to global envar
Add notifications count to global envar
Python
bsd-3-clause
alexandermendes/pybossa-discourse
"""Jinja globals module for pybossa-discourse.""" from flask import Markup, request + from . import discourse_client class DiscourseGlobals(object): """A class to implement Discourse Global variables.""" def __init__(self, app): self.url = app.config['DISCOURSE_URL'] ap...
Add notifications count to global envar
## Code Before: """Jinja globals module for pybossa-discourse.""" from flask import Markup, request class DiscourseGlobals(object): """A class to implement Discourse Global variables.""" def __init__(self, app): self.url = app.config['DISCOURSE_URL'] app.jinja_env.globals.update(discourse=se...
"""Jinja globals module for pybossa-discourse.""" from flask import Markup, request + from . import discourse_client class DiscourseGlobals(object): """A class to implement Discourse Global variables.""" def __init__(self, app): self.url = app.config['DISCOURSE_URL'] ap...
e029998f73a77ebd8f4a6e32a8b03edcc93ec0d7
dataproperty/__init__.py
dataproperty/__init__.py
from __future__ import absolute_import from ._align import Align from ._align_getter import align_getter from ._container import MinMaxContainer from ._data_property import ( ColumnDataProperty, DataProperty ) from ._error import TypeConversionError from ._function import ( is_integer, is_hex, is_...
from __future__ import absolute_import from ._align import Align from ._align_getter import align_getter from ._container import MinMaxContainer from ._data_property import ( ColumnDataProperty, DataProperty ) from ._error import TypeConversionError from ._function import ( is_integer, is_hex, is_...
Delete import that no longer used
Delete import that no longer used
Python
mit
thombashi/DataProperty
from __future__ import absolute_import from ._align import Align from ._align_getter import align_getter from ._container import MinMaxContainer from ._data_property import ( ColumnDataProperty, DataProperty ) from ._error import TypeConversionError from ._function import ( is_in...
Delete import that no longer used
## Code Before: from __future__ import absolute_import from ._align import Align from ._align_getter import align_getter from ._container import MinMaxContainer from ._data_property import ( ColumnDataProperty, DataProperty ) from ._error import TypeConversionError from ._function import ( is_integer, ...
from __future__ import absolute_import from ._align import Align from ._align_getter import align_getter from ._container import MinMaxContainer from ._data_property import ( ColumnDataProperty, DataProperty ) from ._error import TypeConversionError from ._function import ( is_in...
794f3d7e229f94b71a7cb3aaefd4640b185e2572
feder/letters/management/commands/reimport_mailbox.py
feder/letters/management/commands/reimport_mailbox.py
from __future__ import unicode_literals from django.core.management.base import BaseCommand from django_mailbox.models import Message from feder.letters.signals import MessageParser class Command(BaseCommand): help = "Reimport mailbox archived emails as letter." def handle(self, *args, **options): ...
from __future__ import unicode_literals from django.core.management.base import BaseCommand from django_mailbox.models import Message from feder.letters.signals import MessageParser class Command(BaseCommand): help = "Reimport mailbox archived emails as letter." def handle(self, *args, **options): ...
Disable delete message on IO error
Disable delete message on IO error
Python
mit
watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder
from __future__ import unicode_literals from django.core.management.base import BaseCommand from django_mailbox.models import Message from feder.letters.signals import MessageParser class Command(BaseCommand): help = "Reimport mailbox archived emails as letter." def handle(self, ...
Disable delete message on IO error
## Code Before: from __future__ import unicode_literals from django.core.management.base import BaseCommand from django_mailbox.models import Message from feder.letters.signals import MessageParser class Command(BaseCommand): help = "Reimport mailbox archived emails as letter." def handle(self, *args, **o...
from __future__ import unicode_literals from django.core.management.base import BaseCommand from django_mailbox.models import Message from feder.letters.signals import MessageParser class Command(BaseCommand): help = "Reimport mailbox archived emails as letter." def handle(self, ...
2833a895e8a7d0ba879598222c83bc5a4cd88853
desc/geometry/__init__.py
desc/geometry/__init__.py
from .curve import FourierRZCurve, FourierXYZCurve, FourierPlanarCurve from .surface import FourierRZToroidalSurface, ZernikeRZToroidalSection __all__ = [ "FourierRZCurve", "FourierXYZCurve", "FourierPlanarCurve", "FourierRZToroidalSurface", "ZernikeRZToroidalSection", ]
from .curve import FourierRZCurve, FourierXYZCurve, FourierPlanarCurve from .surface import FourierRZToroidalSurface, ZernikeRZToroidalSection from .core import Surface, Curve __all__ = [ "FourierRZCurve", "FourierXYZCurve", "FourierPlanarCurve", "FourierRZToroidalSurface", "ZernikeRZToroidalSectio...
Add geometry ABCs to init
Add geometry ABCs to init
Python
mit
PlasmaControl/DESC,PlasmaControl/DESC
from .curve import FourierRZCurve, FourierXYZCurve, FourierPlanarCurve from .surface import FourierRZToroidalSurface, ZernikeRZToroidalSection + from .core import Surface, Curve __all__ = [ "FourierRZCurve", "FourierXYZCurve", "FourierPlanarCurve", "FourierRZToroidalSurface", "Zer...
Add geometry ABCs to init
## Code Before: from .curve import FourierRZCurve, FourierXYZCurve, FourierPlanarCurve from .surface import FourierRZToroidalSurface, ZernikeRZToroidalSection __all__ = [ "FourierRZCurve", "FourierXYZCurve", "FourierPlanarCurve", "FourierRZToroidalSurface", "ZernikeRZToroidalSection", ] ## Instruc...
from .curve import FourierRZCurve, FourierXYZCurve, FourierPlanarCurve from .surface import FourierRZToroidalSurface, ZernikeRZToroidalSection + from .core import Surface, Curve __all__ = [ "FourierRZCurve", "FourierXYZCurve", "FourierPlanarCurve", "FourierRZToroidalSurface", "Zer...
3372bade0c5aee8c30c507832c842d6533608f61
porunga/tests/test_main.py
porunga/tests/test_main.py
import unittest from porunga import get_manager from porunga.commands.test import PorungaTestCommand class TestManager(unittest.TestCase): def test_manager_has_proper_commands(self): manager = get_manager() commands = manager.get_commands() self.assertIn('test', commands) test_co...
import unittest from porunga import get_manager from porunga.commands.test import PorungaTestCommand class TestManager(unittest.TestCase): def test_manager_has_proper_commands(self): manager = get_manager() commands = manager.get_commands() self.assertTrue('test' in commands) tes...
Test updated to work with Python 2.6
Test updated to work with Python 2.6
Python
bsd-2-clause
lukaszb/porunga,lukaszb/porunga
import unittest from porunga import get_manager from porunga.commands.test import PorungaTestCommand class TestManager(unittest.TestCase): def test_manager_has_proper_commands(self): manager = get_manager() commands = manager.get_commands() - self.assertIn('test', c...
Test updated to work with Python 2.6
## Code Before: import unittest from porunga import get_manager from porunga.commands.test import PorungaTestCommand class TestManager(unittest.TestCase): def test_manager_has_proper_commands(self): manager = get_manager() commands = manager.get_commands() self.assertIn('test', commands)...
import unittest from porunga import get_manager from porunga.commands.test import PorungaTestCommand class TestManager(unittest.TestCase): def test_manager_has_proper_commands(self): manager = get_manager() commands = manager.get_commands() - self.assertIn('test', c...
3598b974ecc078f34e54a32b06e16af8ccaf839b
opps/core/admin/__init__.py
opps/core/admin/__init__.py
from opps.core.admin.channel import * from opps.core.admin.profile import *
from opps.core.admin.channel import * from opps.core.admin.profile import * from opps.core.admin.source import *
Add source admin in Admin Opps Core
Add source admin in Admin Opps Core
Python
mit
opps/opps,jeanmask/opps,YACOWS/opps,YACOWS/opps,williamroot/opps,jeanmask/opps,williamroot/opps,jeanmask/opps,opps/opps,YACOWS/opps,williamroot/opps,opps/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,opps/opps
from opps.core.admin.channel import * from opps.core.admin.profile import * + from opps.core.admin.source import *
Add source admin in Admin Opps Core
## Code Before: from opps.core.admin.channel import * from opps.core.admin.profile import * ## Instruction: Add source admin in Admin Opps Core ## Code After: from opps.core.admin.channel import * from opps.core.admin.profile import * from opps.core.admin.source import *
from opps.core.admin.channel import * from opps.core.admin.profile import * + from opps.core.admin.source import *
8a8b152566b92cfe0ccbc379b9871da795cd4b5b
keystoneclient/hacking/checks.py
keystoneclient/hacking/checks.py
import re def check_oslo_namespace_imports(logical_line, blank_before, filename): oslo_namespace_imports = re.compile( r"(((from)|(import))\s+oslo\." "((config)|(serialization)|(utils)|(i18n)))|" "(from\s+oslo\s+import\s+((config)|(serialization)|(utils)|(i18n)))") if re.match(oslo_...
import re def check_oslo_namespace_imports(logical_line, blank_before, filename): oslo_namespace_imports = re.compile( r"(((from)|(import))\s+oslo\.)|(from\s+oslo\s+import\s+)") if re.match(oslo_namespace_imports, logical_line): msg = ("K333: '%s' must be used instead of '%s'.") % ( ...
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
jamielennox/keystoneauth,citrix-openstack-build/keystoneauth,sileht/keystoneauth
import re def check_oslo_namespace_imports(logical_line, blank_before, filename): oslo_namespace_imports = re.compile( + r"(((from)|(import))\s+oslo\.)|(from\s+oslo\s+import\s+)") - r"(((from)|(import))\s+oslo\." - "((config)|(serialization)|(utils)|(i18n)))|" - "(f...
Change hacking check to verify all oslo imports
## Code Before: import re def check_oslo_namespace_imports(logical_line, blank_before, filename): oslo_namespace_imports = re.compile( r"(((from)|(import))\s+oslo\." "((config)|(serialization)|(utils)|(i18n)))|" "(from\s+oslo\s+import\s+((config)|(serialization)|(utils)|(i18n)))") i...
import re def check_oslo_namespace_imports(logical_line, blank_before, filename): oslo_namespace_imports = re.compile( + r"(((from)|(import))\s+oslo\.)|(from\s+oslo\s+import\s+)") - r"(((from)|(import))\s+oslo\." - "((config)|(serialization)|(utils)|(i18n)))|" - "(f...
89a8cc53f2ad373eb8ff0508dbb5f111e6ee2b6e
nashvegas/models.py
nashvegas/models.py
from django.db import models from django.utils import timezone class Migration(models.Model): migration_label = models.CharField(max_length=200) date_created = models.DateTimeField(default=timezone.now) content = models.TextField() scm_version = models.CharField(max_length=50, null=True, blank=Tr...
from django.db import models try: from django.utils.timezone import now except ImportError: from datetime.datetime import now class Migration(models.Model): migration_label = models.CharField(max_length=200) date_created = models.DateTimeField(default=now) content = models.TextField() sc...
Fix import error for Django 1.3.1
Fix import error for Django 1.3.1
Python
mit
paltman-archive/nashvegas,jonathanchu/nashvegas,iivvoo/nashvegas,dcramer/nashvegas,paltman/nashvegas
from django.db import models - from django.utils import timezone + + try: + from django.utils.timezone import now + except ImportError: + from datetime.datetime import now class Migration(models.Model): migration_label = models.CharField(max_length=200) - date_created = models.DateTi...
Fix import error for Django 1.3.1
## Code Before: from django.db import models from django.utils import timezone class Migration(models.Model): migration_label = models.CharField(max_length=200) date_created = models.DateTimeField(default=timezone.now) content = models.TextField() scm_version = models.CharField(max_length=50, nul...
from django.db import models - from django.utils import timezone + + try: + from django.utils.timezone import now + except ImportError: + from datetime.datetime import now class Migration(models.Model): migration_label = models.CharField(max_length=200) - date_created = models.DateTi...
949f629b349707c2f4caf0a288969b5a6143a730
kyokai/response.py
kyokai/response.py
from http_parser.util import IOrderedDict from .util import HTTP_CODES class Response(object): """ A response is responsible (no pun intended) for delivering data to the client, again. The method `to_bytes()` transforms this into a bytes response. """ def __init__(self, code: int, body: str, he...
from http_parser.util import IOrderedDict from .util import HTTP_CODES class Response(object): """ A response is responsible (no pun intended) for delivering data to the client, again. The method `to_bytes()` transforms this into a bytes response. """ def __init__(self, code: int, body: str, he...
Add \r\n to the end of each header too
Add \r\n to the end of each header too
Python
mit
SunDwarf/Kyoukai
from http_parser.util import IOrderedDict from .util import HTTP_CODES class Response(object): """ A response is responsible (no pun intended) for delivering data to the client, again. The method `to_bytes()` transforms this into a bytes response. """ def __init__(self...
Add \r\n to the end of each header too
## Code Before: from http_parser.util import IOrderedDict from .util import HTTP_CODES class Response(object): """ A response is responsible (no pun intended) for delivering data to the client, again. The method `to_bytes()` transforms this into a bytes response. """ def __init__(self, code: in...
from http_parser.util import IOrderedDict from .util import HTTP_CODES class Response(object): """ A response is responsible (no pun intended) for delivering data to the client, again. The method `to_bytes()` transforms this into a bytes response. """ def __init__(self...
bef9fb7f778666e602bfc5b27a65888f7459d0f9
blog/forms.py
blog/forms.py
from .models import BlogPost, BlogComment from django.forms import ModelForm class BlogPostForm(ModelForm): class Meta: model = BlogPost exclude = ('user',) def save(self, user, commit=True): post = super(BlogPostForm, self).save(commit=False) post.user = user if commi...
from .models import BlogPost, BlogComment from django.forms import ModelForm class BlogPostForm(ModelForm): class Meta: model = BlogPost exclude = ('user',) def save(self, user, commit=True): post = super(BlogPostForm, self).save(commit=False) post.user = user if commi...
Add a custom save() method to CommentForm
Add a custom save() method to CommentForm
Python
mit
andreagrandi/bloggato,andreagrandi/bloggato
from .models import BlogPost, BlogComment from django.forms import ModelForm class BlogPostForm(ModelForm): class Meta: model = BlogPost exclude = ('user',) def save(self, user, commit=True): post = super(BlogPostForm, self).save(commit=False) post.user = ...
Add a custom save() method to CommentForm
## Code Before: from .models import BlogPost, BlogComment from django.forms import ModelForm class BlogPostForm(ModelForm): class Meta: model = BlogPost exclude = ('user',) def save(self, user, commit=True): post = super(BlogPostForm, self).save(commit=False) post.user = user ...
from .models import BlogPost, BlogComment from django.forms import ModelForm class BlogPostForm(ModelForm): class Meta: model = BlogPost exclude = ('user',) def save(self, user, commit=True): post = super(BlogPostForm, self).save(commit=False) post.user = ...
ea2d72473c958de90582e1d4ccfc77af1d578b24
test_stack.py
test_stack.py
from stack import Stack import pytest def test_stack_push(): stack = Stack() stack.push("bacon") assert stack.top.value == "bacon" assert stack.peek() == "bacon" def test_stack_push_multi(): stack = Stack() stack.push("bacon") stack.push("steak") stack.push("grilled cheese") stac...
from stack import Stack import pytest def test_stack_push(): stack = Stack() stack.push("bacon") assert stack.top.value == "bacon" assert stack.peek() == "bacon" def test_stack_push_multi(): stack = Stack() stack.push("bacon") stack.push("steak") stack.push("grilled cheese") asse...
Add test for peek on empty stack
Add test for peek on empty stack
Python
mit
jwarren116/data-structures-deux
from stack import Stack import pytest def test_stack_push(): stack = Stack() stack.push("bacon") assert stack.top.value == "bacon" assert stack.peek() == "bacon" def test_stack_push_multi(): stack = Stack() stack.push("bacon") stack.push("steak") stack...
Add test for peek on empty stack
## Code Before: from stack import Stack import pytest def test_stack_push(): stack = Stack() stack.push("bacon") assert stack.top.value == "bacon" assert stack.peek() == "bacon" def test_stack_push_multi(): stack = Stack() stack.push("bacon") stack.push("steak") stack.push("grilled c...
from stack import Stack import pytest def test_stack_push(): stack = Stack() stack.push("bacon") assert stack.top.value == "bacon" assert stack.peek() == "bacon" def test_stack_push_multi(): stack = Stack() stack.push("bacon") stack.push("steak") stack...
7e766747dbda4548b63b278e062335c8a10fe008
src/vimapt/library/vimapt/data_format/yaml.py
src/vimapt/library/vimapt/data_format/yaml.py
from pureyaml import dump as dumps from pureyaml import load as loads __all__ = ['dumps', 'loads']
from __future__ import absolute_import import functools from yaml import dump, Dumper, load, Loader dumps = functools.partial(dump, Dumper=Dumper) loads = functools.partial(load, Loader=Loader) __all__ = ['dumps', 'loads']
Use PyYAML as YAML's loader and dumper
Use PyYAML as YAML's loader and dumper
Python
mit
howl-anderson/vimapt,howl-anderson/vimapt
- from pureyaml import dump as dumps - from pureyaml import load as loads + from __future__ import absolute_import + + import functools + + from yaml import dump, Dumper, load, Loader + + dumps = functools.partial(dump, Dumper=Dumper) + loads = functools.partial(load, Loader=Loader) __all__ = ['dumps', 'loads']...
Use PyYAML as YAML's loader and dumper
## Code Before: from pureyaml import dump as dumps from pureyaml import load as loads __all__ = ['dumps', 'loads'] ## Instruction: Use PyYAML as YAML's loader and dumper ## Code After: from __future__ import absolute_import import functools from yaml import dump, Dumper, load, Loader dumps = functools.partial(dump...
- from pureyaml import dump as dumps - from pureyaml import load as loads + from __future__ import absolute_import + + import functools + + from yaml import dump, Dumper, load, Loader + + dumps = functools.partial(dump, Dumper=Dumper) + loads = functools.partial(load, Loader=Loader) __all__ = ['dumps', 'loads']
32951dda5a46487a485c949a07f457ae537f07f2
src/encoded/upgrade/bismark_quality_metric.py
src/encoded/upgrade/bismark_quality_metric.py
from contentbase import ( ROOT, upgrade_step, ) @upgrade_step('bismark_quality_metric', '1', '2') def bismark_quality_metric_1_2(value, system): # http://redmine.encodedcc.org/issues/3114 root = system['registry'][ROOT] step_run = root.get_by_uuid(value['step_run']) value['quality_metric_of'] =...
from contentbase import ( CONNECTION, upgrade_step, ) @upgrade_step('bismark_quality_metric', '1', '2') def bismark_quality_metric_1_2(value, system): # http://redmine.encodedcc.org/issues/3114 conn = system['registry'][CONNECTION] step_run = conn.get_by_uuid(value['step_run']) output_files = ...
Change upgrade step to not use rev link.
Change upgrade step to not use rev link.
Python
mit
4dn-dcic/fourfront,hms-dbmi/fourfront,4dn-dcic/fourfront,T2DREAM/t2dream-portal,hms-dbmi/fourfront,ENCODE-DCC/encoded,T2DREAM/t2dream-portal,T2DREAM/t2dream-portal,ENCODE-DCC/encoded,ENCODE-DCC/snovault,ENCODE-DCC/snovault,ENCODE-DCC/encoded,hms-dbmi/fourfront,4dn-dcic/fourfront,4dn-dcic/fourfront,ENCODE-DCC/snovault,E...
from contentbase import ( - ROOT, + CONNECTION, upgrade_step, ) + @upgrade_step('bismark_quality_metric', '1', '2') def bismark_quality_metric_1_2(value, system): # http://redmine.encodedcc.org/issues/3114 - root = system['registry'][ROOT] + conn = system['registry'][CONNECTION] ...
Change upgrade step to not use rev link.
## Code Before: from contentbase import ( ROOT, upgrade_step, ) @upgrade_step('bismark_quality_metric', '1', '2') def bismark_quality_metric_1_2(value, system): # http://redmine.encodedcc.org/issues/3114 root = system['registry'][ROOT] step_run = root.get_by_uuid(value['step_run']) value['quali...
from contentbase import ( - ROOT, + CONNECTION, upgrade_step, ) + @upgrade_step('bismark_quality_metric', '1', '2') def bismark_quality_metric_1_2(value, system): # http://redmine.encodedcc.org/issues/3114 - root = system['registry'][ROOT] ? ^ ^^ ^ ^ + ...
d66a412efad62d47e7df8d2ff4922be4c268a93e
hunittest/utils.py
hunittest/utils.py
import os import re from enum import Enum from contextlib import contextmanager def pyname_join(seq): return ".".join(seq) def is_pkgdir(dirpath): return os.path.isdir(dirpath) \ and os.path.isfile(os.path.join(dirpath, "__init__.py")) def mod_split(modname): mo = re.match(r"^(.+)\.(.*)$", mod...
import os import re from enum import Enum from contextlib import contextmanager import unittest def pyname_join(seq): return ".".join(seq) def is_pkgdir(dirpath): return os.path.isdir(dirpath) \ and os.path.isfile(os.path.join(dirpath, "__init__.py")) def mod_split(modname): mo = re.match(r"^(...
Add helper to load a single test case.
Add helper to load a single test case.
Python
bsd-2-clause
nicolasdespres/hunittest
import os import re from enum import Enum from contextlib import contextmanager + import unittest def pyname_join(seq): return ".".join(seq) def is_pkgdir(dirpath): return os.path.isdir(dirpath) \ and os.path.isfile(os.path.join(dirpath, "__init__.py")) def mod_spli...
Add helper to load a single test case.
## Code Before: import os import re from enum import Enum from contextlib import contextmanager def pyname_join(seq): return ".".join(seq) def is_pkgdir(dirpath): return os.path.isdir(dirpath) \ and os.path.isfile(os.path.join(dirpath, "__init__.py")) def mod_split(modname): mo = re.match(r"^(...
import os import re from enum import Enum from contextlib import contextmanager + import unittest def pyname_join(seq): return ".".join(seq) def is_pkgdir(dirpath): return os.path.isdir(dirpath) \ and os.path.isfile(os.path.join(dirpath, "__init__.py")) def mod_spli...
26672e83ab1bd1a932d275dfd244fe20749e3b1e
tripleo_common/utils/safe_import.py
tripleo_common/utils/safe_import.py
import eventlet from eventlet.green import subprocess # Due to an eventlet issue subprocess is not being correctly patched # on git module so it has to be done manually git = eventlet.import_patched('git', ('subprocess', subprocess)) Repo = git.Repo # git.refs is lazy loaded when there's a new commit, this needs t...
from eventlet.green import subprocess import eventlet.patcher as patcher # Due to an eventlet issue subprocess is not being correctly patched # on git.refs patcher.inject('git.refs', None, ('subprocess', subprocess), ) # this has to be loaded after the inject. import git # noqa: E402 Repo = git.Repo
Make gitpython and eventlet work with eventlet 0.25.1
Make gitpython and eventlet work with eventlet 0.25.1 Version 0.25 is having a bad interaction with python git. that is due to the way that eventlet unloads some modules now. Changed to use the inject method that supports what we need intead of the imported_patched that was having the problem Change-Id: I79894d4f711c...
Python
apache-2.0
openstack/tripleo-common,openstack/tripleo-common
- import eventlet from eventlet.green import subprocess + import eventlet.patcher as patcher # Due to an eventlet issue subprocess is not being correctly patched - # on git module so it has to be done manually + # on git.refs + patcher.inject('git.refs', None, ('subprocess', subprocess), ) - git = event...
Make gitpython and eventlet work with eventlet 0.25.1
## Code Before: import eventlet from eventlet.green import subprocess # Due to an eventlet issue subprocess is not being correctly patched # on git module so it has to be done manually git = eventlet.import_patched('git', ('subprocess', subprocess)) Repo = git.Repo # git.refs is lazy loaded when there's a new comm...
- import eventlet from eventlet.green import subprocess + import eventlet.patcher as patcher # Due to an eventlet issue subprocess is not being correctly patched - # on git module so it has to be done manually + # on git.refs + patcher.inject('git.refs', None, ('subprocess', subprocess), ) - git = event...
e9d87a087a0f0102157d7c718a048c72f655c54a
smore/ext/marshmallow.py
smore/ext/marshmallow.py
from __future__ import absolute_import from marshmallow.compat import iteritems from marshmallow import class_registry from smore import swagger from smore.apispec.core import Path from smore.apispec.utils import load_operations_from_docstring def schema_definition_helper(name, schema, **kwargs): """Definition h...
from __future__ import absolute_import from marshmallow.compat import iteritems from marshmallow import class_registry from smore import swagger from smore.apispec.core import Path from smore.apispec.utils import load_operations_from_docstring def schema_definition_helper(spec, name, schema, **kwargs): """Defini...
Store registered refs as plugin metadata
Store registered refs as plugin metadata
Python
mit
marshmallow-code/apispec,Nobatek/apispec,marshmallow-code/smore,gorgias/apispec,jmcarp/smore
from __future__ import absolute_import from marshmallow.compat import iteritems from marshmallow import class_registry from smore import swagger from smore.apispec.core import Path from smore.apispec.utils import load_operations_from_docstring - def schema_definition_helper(name, schema, **kwargs):...
Store registered refs as plugin metadata
## Code Before: from __future__ import absolute_import from marshmallow.compat import iteritems from marshmallow import class_registry from smore import swagger from smore.apispec.core import Path from smore.apispec.utils import load_operations_from_docstring def schema_definition_helper(name, schema, **kwargs): ...
from __future__ import absolute_import from marshmallow.compat import iteritems from marshmallow import class_registry from smore import swagger from smore.apispec.core import Path from smore.apispec.utils import load_operations_from_docstring - def schema_definition_helper(name, schema, **kwargs):...
3e1f1e515b4392d98fe221ce4c14daefc531a1fe
tests/test_compatibility/tests.py
tests/test_compatibility/tests.py
"""Backward compatible behaviour with primary key 'Id'.""" from __future__ import absolute_import from django.conf import settings from django.test import TestCase from salesforce.backend import sf_alias from tests.test_compatibility.models import Lead, User current_user = settings.DATABASES[sf_alias]['USER'] class ...
"""Backward compatible behaviour with primary key 'Id'.""" from __future__ import absolute_import from django.conf import settings from django.test import TestCase from salesforce.backend import sf_alias from tests.test_compatibility.models import Lead, User current_user = settings.DATABASES[sf_alias]['USER'] class ...
Test for compatibility of primary key AutoField
Test for compatibility of primary key AutoField
Python
mit
philchristensen/django-salesforce,hynekcer/django-salesforce,django-salesforce/django-salesforce,chromakey/django-salesforce,philchristensen/django-salesforce,django-salesforce/django-salesforce,hynekcer/django-salesforce,chromakey/django-salesforce,django-salesforce/django-salesforce,hynekcer/django-salesforce,chromak...
"""Backward compatible behaviour with primary key 'Id'.""" from __future__ import absolute_import from django.conf import settings from django.test import TestCase from salesforce.backend import sf_alias from tests.test_compatibility.models import Lead, User current_user = settings.DATABASES[sf_alias][...
Test for compatibility of primary key AutoField
## Code Before: """Backward compatible behaviour with primary key 'Id'.""" from __future__ import absolute_import from django.conf import settings from django.test import TestCase from salesforce.backend import sf_alias from tests.test_compatibility.models import Lead, User current_user = settings.DATABASES[sf_alias][...
"""Backward compatible behaviour with primary key 'Id'.""" from __future__ import absolute_import from django.conf import settings from django.test import TestCase from salesforce.backend import sf_alias from tests.test_compatibility.models import Lead, User current_user = settings.DATABASES[sf_alias][...
329e74f280537aab41d5b810f8650bfd8d6d81f5
tests/test_generate_files.py
tests/test_generate_files.py
import pytest from cookiecutter import generate from cookiecutter import exceptions @pytest.mark.usefixtures("clean_system") def test_generate_files_nontemplated_exception(): with pytest.raises(exceptions.NonTemplatedInputDirException): generate.generate_files( context={'cookiecutter': {'food...
from __future__ import unicode_literals import os import pytest from cookiecutter import generate from cookiecutter import exceptions from cookiecutter import utils @pytest.fixture(scope="function") def clean_system_remove_additional_folders(request, clean_system): def remove_additional_folders(): if os...
Add teardown specific to the former TestCase class
Add teardown specific to the former TestCase class
Python
bsd-3-clause
michaeljoseph/cookiecutter,christabor/cookiecutter,cguardia/cookiecutter,janusnic/cookiecutter,michaeljoseph/cookiecutter,cguardia/cookiecutter,vincentbernat/cookiecutter,drgarcia1986/cookiecutter,Vauxoo/cookiecutter,cichm/cookiecutter,benthomasson/cookiecutter,0k/cookiecutter,terryjbates/cookiecutter,atlassian/cookiec...
+ from __future__ import unicode_literals + import os import pytest + from cookiecutter import generate from cookiecutter import exceptions + from cookiecutter import utils + @pytest.fixture(scope="function") + def clean_system_remove_additional_folders(request, clean_system): + def remove_additiona...
Add teardown specific to the former TestCase class
## Code Before: import pytest from cookiecutter import generate from cookiecutter import exceptions @pytest.mark.usefixtures("clean_system") def test_generate_files_nontemplated_exception(): with pytest.raises(exceptions.NonTemplatedInputDirException): generate.generate_files( context={'cooki...
+ from __future__ import unicode_literals + import os import pytest + from cookiecutter import generate from cookiecutter import exceptions + from cookiecutter import utils + @pytest.fixture(scope="function") + def clean_system_remove_additional_folders(request, clean_system): + def remove_additiona...
6bb3321c0a2e4221d08f39e46e1d21220361cdc6
shuup_tests/api/conftest.py
shuup_tests/api/conftest.py
from django.conf import settings def pytest_runtest_setup(item): settings.INSTALLED_APPS = [app for app in settings.INSTALLED_APPS if "shuup.front" not in app]
from django.conf import settings ORIGINAL_SETTINGS = [] def pytest_runtest_setup(item): global ORIGINAL_SETTINGS ORIGINAL_SETTINGS = [item for item in settings.INSTALLED_APPS] settings.INSTALLED_APPS = [app for app in settings.INSTALLED_APPS if "shuup.front" not in app] def pytest_runtest_teardown(ite...
Fix unit test by adding back front apps after API tests
Fix unit test by adding back front apps after API tests
Python
agpl-3.0
shoopio/shoop,shoopio/shoop,shoopio/shoop
from django.conf import settings + ORIGINAL_SETTINGS = [] + + def pytest_runtest_setup(item): + global ORIGINAL_SETTINGS + ORIGINAL_SETTINGS = [item for item in settings.INSTALLED_APPS] settings.INSTALLED_APPS = [app for app in settings.INSTALLED_APPS if "shuup.front" not in app] + + def p...
Fix unit test by adding back front apps after API tests
## Code Before: from django.conf import settings def pytest_runtest_setup(item): settings.INSTALLED_APPS = [app for app in settings.INSTALLED_APPS if "shuup.front" not in app] ## Instruction: Fix unit test by adding back front apps after API tests ## Code After: from django.conf import settings ORIGINAL_SETTIN...
from django.conf import settings + ORIGINAL_SETTINGS = [] + + def pytest_runtest_setup(item): + global ORIGINAL_SETTINGS + ORIGINAL_SETTINGS = [item for item in settings.INSTALLED_APPS] settings.INSTALLED_APPS = [app for app in settings.INSTALLED_APPS if "shuup.front" not in app] + + + def p...
1e010e940390ae5b650224363e4acecd816b2611
settings_dev.py
settings_dev.py
import sublime_plugin from .sublime_lib.path import root_at_packages, get_package_name PLUGIN_NAME = get_package_name() SETTINGS_SYNTAX = ("Packages/%s/Package/Sublime Text Settings/Sublime Settings.tmLanguage" % PLUGIN_NAME) TPL = "{\n\t$0\n}" class NewSettingsCommand(sublime_plugin.WindowComm...
import sublime_plugin from .sublime_lib.path import root_at_packages, get_package_name PLUGIN_NAME = get_package_name() SETTINGS_SYNTAX = ("Packages/%s/Package/Sublime Text Settings/Sublime Text Settings.sublime-syntax" % PLUGIN_NAME) TPL = '''\ { "$1": $0 }'''.replace(" " * 4, "\t") class ...
Update syntax path for new settings file command
Update syntax path for new settings file command
Python
mit
SublimeText/AAAPackageDev,SublimeText/AAAPackageDev,SublimeText/PackageDev
import sublime_plugin from .sublime_lib.path import root_at_packages, get_package_name PLUGIN_NAME = get_package_name() - SETTINGS_SYNTAX = ("Packages/%s/Package/Sublime Text Settings/Sublime Settings.tmLanguage" + SETTINGS_SYNTAX = ("Packages/%s/Package/Sublime Text Settings/Sublime Text Settings.sub...
Update syntax path for new settings file command
## Code Before: import sublime_plugin from .sublime_lib.path import root_at_packages, get_package_name PLUGIN_NAME = get_package_name() SETTINGS_SYNTAX = ("Packages/%s/Package/Sublime Text Settings/Sublime Settings.tmLanguage" % PLUGIN_NAME) TPL = "{\n\t$0\n}" class NewSettingsCommand(sublime_p...
import sublime_plugin from .sublime_lib.path import root_at_packages, get_package_name PLUGIN_NAME = get_package_name() - SETTINGS_SYNTAX = ("Packages/%s/Package/Sublime Text Settings/Sublime Settings.tmLanguage" ? -- ^^^^...
fbb0abe3bdb62ec64bfdd03f9b45ded4def9613a
wsgi_intercept/test/test_mechanize.py
wsgi_intercept/test/test_mechanize.py
from nose.tools import with_setup, raises from urllib2 import URLError from wsgi_intercept.mechanize_intercept import Browser import wsgi_intercept from wsgi_intercept import test_wsgi_app from mechanize import Browser as MechanizeBrowser ### _saved_debuglevel = None def add_intercept(): # _saved_debuglevel, ws...
from urllib2 import URLError from wsgi_intercept import testing from wsgi_intercept.testing import unittest from wsgi_intercept.test import base try: import mechanize has_mechanize = True except ImportError: has_mechanize = False _skip_message = "mechanize is not installed" @unittest.skipUnless(has_mecha...
Use unittest in the mechanize related tests.
Use unittest in the mechanize related tests.
Python
mit
pumazi/wsgi_intercept2
+ from urllib2 import URLError + from wsgi_intercept import testing + from wsgi_intercept.testing import unittest + from wsgi_intercept.test import base - from nose.tools import with_setup, raises - from urllib2 import URLError - from wsgi_intercept.mechanize_intercept import Browser - import wsgi_intercept - from w...
Use unittest in the mechanize related tests.
## Code Before: from nose.tools import with_setup, raises from urllib2 import URLError from wsgi_intercept.mechanize_intercept import Browser import wsgi_intercept from wsgi_intercept import test_wsgi_app from mechanize import Browser as MechanizeBrowser ### _saved_debuglevel = None def add_intercept(): # _save...
+ from urllib2 import URLError + from wsgi_intercept import testing + from wsgi_intercept.testing import unittest + from wsgi_intercept.test import base - from nose.tools import with_setup, raises - from urllib2 import URLError - from wsgi_intercept.mechanize_intercept import Browser - import wsgi_intercept - from w...
88263748a1ec742e514b6f321002d06e6e79b36e
plim/adapters/babelplugin.py
plim/adapters/babelplugin.py
"""gettext message extraction via Babel: http://babel.edgewall.org/""" from mako.ext.babelplugin import extract as _extract_mako from .. import lexer from ..util import StringIO def extract(fileobj, keywords, comment_tags, options): """Extract messages from Plim templates. :param fileobj: the file-like obj...
"""gettext message extraction via Babel: http://babel.edgewall.org/""" from mako.ext.babelplugin import extract as _extract_mako from .. import lexer from ..util import StringIO, PY3K def extract(fileobj, keywords, comment_tags, options): """Extract messages from Plim templates. :param fileobj: the file-lik...
Fix Babel plugin in Python3 environment
Fix Babel plugin in Python3 environment
Python
mit
kxxoling/Plim
"""gettext message extraction via Babel: http://babel.edgewall.org/""" from mako.ext.babelplugin import extract as _extract_mako from .. import lexer - from ..util import StringIO + from ..util import StringIO, PY3K - def extract(fileobj, keywords, comment_tags, options): """Extract messages fro...
Fix Babel plugin in Python3 environment
## Code Before: """gettext message extraction via Babel: http://babel.edgewall.org/""" from mako.ext.babelplugin import extract as _extract_mako from .. import lexer from ..util import StringIO def extract(fileobj, keywords, comment_tags, options): """Extract messages from Plim templates. :param fileobj: t...
"""gettext message extraction via Babel: http://babel.edgewall.org/""" from mako.ext.babelplugin import extract as _extract_mako from .. import lexer - from ..util import StringIO + from ..util import StringIO, PY3K ? ++++++ - def extract(fileobj, keywords, comment_tags, op...
7ddb5b9ab579c58fc1fc8be7760f7f0963d02c3a
CodeFights/chessBoardCellColor.py
CodeFights/chessBoardCellColor.py
def chessBoardCellColor(cell1, cell2): pass def main(): tests = [ ["A1", "C3", True], ["A1", "H3", False], ["A1", "A2", False], ["A1", "B2", True], ["B3", "H8", False], ["C3", "B5", False], ["G5", "E7", True], ["C8", "H8", False], ["D2"...
def chessBoardCellColor(cell1, cell2): ''' Determine if the two given cells on chess board are same color A, C, E, G odd cells are same color as B, D, F, H even cells ''' def get_color(cell): return ("DARK" if (cell[0] in "ACEG" and int(cell[1]) % 2 == 1) or (cell[0] in "BD...
Solve chess board cell color problem
Solve chess board cell color problem
Python
mit
HKuz/Test_Code
def chessBoardCellColor(cell1, cell2): - pass + ''' + Determine if the two given cells on chess board are same color + A, C, E, G odd cells are same color as B, D, F, H even cells + ''' + def get_color(cell): + return ("DARK" if (cell[0] in "ACEG" and int(cell[1]) % 2 == 1) or + ...
Solve chess board cell color problem
## Code Before: def chessBoardCellColor(cell1, cell2): pass def main(): tests = [ ["A1", "C3", True], ["A1", "H3", False], ["A1", "A2", False], ["A1", "B2", True], ["B3", "H8", False], ["C3", "B5", False], ["G5", "E7", True], ["C8", "H8", False...
def chessBoardCellColor(cell1, cell2): - pass + ''' + Determine if the two given cells on chess board are same color + A, C, E, G odd cells are same color as B, D, F, H even cells + ''' + def get_color(cell): + return ("DARK" if (cell[0] in "ACEG" and int(cell[1]) % 2 == 1) or + ...
52fd4086b0ef1ac290b393b8cd534a042826b145
scripts/addStitleToBlastTab.py
scripts/addStitleToBlastTab.py
import sys, argparse parser = argparse.ArgumentParser() parser.add_argument('--db2Name', help='tab-separated database lookup: full name file for reference (eg nr or swissprot)') parser.add_argument('-b','--blast', help='blast input file') args = parser.parse_args() blastOrder = [] blastD = {} with open(args.blast, ...
import sys, argparse parser = argparse.ArgumentParser() parser.add_argument('--db2Name', help='tab-separated database lookup: full name file for reference (eg nr or swissprot)') parser.add_argument('-b','--blast', help='blast input file') args = parser.parse_args() blastOrder = [] blastD = {} with open(args.blast, ...
Fix mixed indents. replaced tabs with spaces
Fix mixed indents. replaced tabs with spaces
Python
bsd-3-clause
bluegenes/MakeMyTranscriptome,bluegenes/MakeMyTranscriptome,bluegenes/MakeMyTranscriptome
import sys, argparse parser = argparse.ArgumentParser() parser.add_argument('--db2Name', help='tab-separated database lookup: full name file for reference (eg nr or swissprot)') parser.add_argument('-b','--blast', help='blast input file') args = parser.parse_args() blastOrder = [] blastD = {} ...
Fix mixed indents. replaced tabs with spaces
## Code Before: import sys, argparse parser = argparse.ArgumentParser() parser.add_argument('--db2Name', help='tab-separated database lookup: full name file for reference (eg nr or swissprot)') parser.add_argument('-b','--blast', help='blast input file') args = parser.parse_args() blastOrder = [] blastD = {} with o...
import sys, argparse parser = argparse.ArgumentParser() parser.add_argument('--db2Name', help='tab-separated database lookup: full name file for reference (eg nr or swissprot)') parser.add_argument('-b','--blast', help='blast input file') args = parser.parse_args() blastOrder = [] blastD = {} ...
1bd90d597b23f49bce3ca3402256c9bb1ad22647
accounts/management/commands/request_common_profile_update.py
accounts/management/commands/request_common_profile_update.py
from django.contrib.auth.models import User from django.contrib.sites.models import Site from django.core.management.base import BaseCommand from django.core.urlresolvers import reverse from post_office import mail class Command(BaseCommand): help = "Notify users to update." def handle(self, *args, **option...
from django.contrib.auth.models import User from django.contrib.sites.models import Site from django.core.exceptions import ValidationError from django.core.management.base import BaseCommand from django.core.urlresolvers import reverse from post_office import mail class Command(BaseCommand): help = "Notify use...
Handle missing and invalid email addresses.
Handle missing and invalid email addresses.
Python
agpl-3.0
osamak/student-portal,osamak/student-portal,enjaz/enjaz,osamak/student-portal,osamak/student-portal,enjaz/enjaz,enjaz/enjaz,enjaz/enjaz,enjaz/enjaz,osamak/student-portal
from django.contrib.auth.models import User from django.contrib.sites.models import Site + from django.core.exceptions import ValidationError from django.core.management.base import BaseCommand from django.core.urlresolvers import reverse + from post_office import mail class Command(BaseCommand): ...
Handle missing and invalid email addresses.
## Code Before: from django.contrib.auth.models import User from django.contrib.sites.models import Site from django.core.management.base import BaseCommand from django.core.urlresolvers import reverse from post_office import mail class Command(BaseCommand): help = "Notify users to update." def handle(self,...
from django.contrib.auth.models import User from django.contrib.sites.models import Site + from django.core.exceptions import ValidationError from django.core.management.base import BaseCommand from django.core.urlresolvers import reverse + from post_office import mail class Command(BaseCommand): ...
78b62cd865b5c31a17c982b78dc91127ebf54525
erpnext/patches/may_2012/same_purchase_rate_patch.py
erpnext/patches/may_2012/same_purchase_rate_patch.py
def execute(): import webnotes gd = webnotes.model.code.get_obj('Global Defaults') gd.doc.maintain_same_rate = 1 gd.doc.save() gd.on_update()
def execute(): import webnotes from webnotes.model.code import get_obj gd = get_obj('Global Defaults') gd.doc.maintain_same_rate = 1 gd.doc.save() gd.on_update()
Maintain same rate throughout pur cycle: in global defaults, by default set true
Maintain same rate throughout pur cycle: in global defaults, by default set true
Python
agpl-3.0
rohitwaghchaure/digitales_erpnext,gangadhar-kadam/smrterp,pombredanne/erpnext,saurabh6790/test-med-app,gangadharkadam/johnerp,indictranstech/erpnext,hernad/erpnext,gangadhar-kadam/helpdesk-erpnext,gangadhar-kadam/mic-erpnext,mbauskar/Das_Erpnext,hernad/erpnext,Tejal011089/huntercamp_erpnext,saurabh6790/ON-RISAPP,mbausk...
def execute(): import webnotes + from webnotes.model.code import get_obj - gd = webnotes.model.code.get_obj('Global Defaults') + gd = get_obj('Global Defaults') gd.doc.maintain_same_rate = 1 gd.doc.save() gd.on_update()
Maintain same rate throughout pur cycle: in global defaults, by default set true
## Code Before: def execute(): import webnotes gd = webnotes.model.code.get_obj('Global Defaults') gd.doc.maintain_same_rate = 1 gd.doc.save() gd.on_update() ## Instruction: Maintain same rate throughout pur cycle: in global defaults, by default set true ## Code After: def execute(): import webnotes from webno...
def execute(): import webnotes + from webnotes.model.code import get_obj - gd = webnotes.model.code.get_obj('Global Defaults') ? -------------------- + gd = get_obj('Global Defaults') gd.doc.maintain_same_rate = 1 gd.doc.save() gd.on_update()
a7ba6ece76e768e642a6ed264791e3987f7c7629
apps/user_app/forms.py
apps/user_app/forms.py
from django import forms from django.core import validators from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm class RegistrationForm(UserCreationForm): username = forms.CharField(label='username', max_length=30, required=True,) #validators=[self.isValidU...
from django import forms from django.core.exceptions import ValidationError from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm def isValidUserName(username): try: User.objects.get(username=username) except User.DoesNotExist: return raise ValidationError('The usern...
Implement validation to the username field.
Implement validation to the username field.
Python
mit
pedrolinhares/po-po-modoro,pedrolinhares/po-po-modoro
from django import forms - from django.core import validators + from django.core.exceptions import ValidationError from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm + + def isValidUserName(username): + try: + User.objects.get(username=username) + except User.D...
Implement validation to the username field.
## Code Before: from django import forms from django.core import validators from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm class RegistrationForm(UserCreationForm): username = forms.CharField(label='username', max_length=30, required=True,) #validator...
from django import forms - from django.core import validators ? ^ - + from django.core.exceptions import ValidationError ? +++++++++++ ^ ++++++ from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm + + def i...
689dd5cb67516fd091a69e39708b547c66f96750
nap/dataviews/models.py
nap/dataviews/models.py
from .fields import Field from .views import DataView from django.utils.six import with_metaclass class MetaView(type): def __new__(mcs, name, bases, attrs): meta = attrs.get('Meta', None) try: model = meta.model except AttributeError: if name != 'ModelDataView'...
from django.db.models.fields import NOT_PROVIDED from django.utils.six import with_metaclass from . import filters from .fields import Field from .views import DataView # Map of ModelField name -> list of filters FIELD_FILTERS = { 'DateField': [filters.DateFilter], 'TimeField': [filters.TimeFilter], 'Da...
Add Options class Add field filters lists Start proper model field introspection
Add Options class Add field filters lists Start proper model field introspection
Python
bsd-3-clause
limbera/django-nap,MarkusH/django-nap
+ from django.db.models.fields import NOT_PROVIDED + from django.utils.six import with_metaclass + + from . import filters from .fields import Field from .views import DataView - from django.utils.six import with_metaclass + + # Map of ModelField name -> list of filters + FIELD_FILTERS = { + 'DateField'...
Add Options class Add field filters lists Start proper model field introspection
## Code Before: from .fields import Field from .views import DataView from django.utils.six import with_metaclass class MetaView(type): def __new__(mcs, name, bases, attrs): meta = attrs.get('Meta', None) try: model = meta.model except AttributeError: if name !=...
+ from django.db.models.fields import NOT_PROVIDED + from django.utils.six import with_metaclass + + from . import filters from .fields import Field from .views import DataView - from django.utils.six import with_metaclass + + # Map of ModelField name -> list of filters + FIELD_FILTERS = { + 'DateField'...
5ae97ea5eb7e07c9e967741bac5871379b643b39
nova/db/base.py
nova/db/base.py
"""Base class for classes that need modular database access.""" from oslo.config import cfg from nova.openstack.common import importutils db_driver_opt = cfg.StrOpt('db_driver', default='nova.db', help='The driver to use for database access') CONF = cfg.CONF CO...
"""Base class for classes that need modular database access.""" from oslo.config import cfg from nova.openstack.common import importutils db_driver_opt = cfg.StrOpt('db_driver', default='nova.db', help='The driver to use for database access') CONF = cfg.CONF CO...
Add super call to db Base class
Add super call to db Base class Without this call, multiple inheritance involving the db Base class does not work correctly. Change-Id: Iac6b99d34f00babb8b66fede4977bf75f0ed61d4
Python
apache-2.0
joker946/nova,alexandrucoman/vbox-nova-driver,felixma/nova,watonyweng/nova,devendermishrajio/nova,joker946/nova,Juniper/nova,NeCTAR-RC/nova,BeyondTheClouds/nova,redhat-openstack/nova,Yusuke1987/openstack_template,bgxavier/nova,ted-gould/nova,redhat-openstack/nova,phenoxim/nova,tudorvio/nova,jeffrey4l/nova,scripnichenko...
"""Base class for classes that need modular database access.""" from oslo.config import cfg from nova.openstack.common import importutils db_driver_opt = cfg.StrOpt('db_driver', default='nova.db', help='The driver to use for database access')...
Add super call to db Base class
## Code Before: """Base class for classes that need modular database access.""" from oslo.config import cfg from nova.openstack.common import importutils db_driver_opt = cfg.StrOpt('db_driver', default='nova.db', help='The driver to use for database access') CO...
"""Base class for classes that need modular database access.""" from oslo.config import cfg from nova.openstack.common import importutils db_driver_opt = cfg.StrOpt('db_driver', default='nova.db', help='The driver to use for database access')...
225ae01e3147bbee5c03462dad7dcfef22297f51
elevator/utils/patterns.py
elevator/utils/patterns.py
from collections import Sequence # Enums beautiful python implementation # Used like this : # Numbers = enum('ZERO', 'ONE', 'TWO') # >>> Numbers.ZERO # 0 # >>> Numbers.ONE # 1 # Found here: http://stackoverflow.com/questions/36932/whats-the-best-way-to-implement-an-enum-in-python def enum(*sequential, **named): en...
from collections import Sequence # Enums beautiful python implementation # Used like this : # Numbers = enum('ZERO', 'ONE', 'TWO') # >>> Numbers.ZERO # 0 # >>> Numbers.ONE # 1 # Found here: http://stackoverflow.com/questions/36932/whats-the-best-way-to-implement-an-enum-in-python def enum(*sequential, **named): en...
Update : try/except in destructurate greatly enhances performances on mass read/write
Update : try/except in destructurate greatly enhances performances on mass read/write
Python
mit
oleiade/Elevator
from collections import Sequence # Enums beautiful python implementation # Used like this : # Numbers = enum('ZERO', 'ONE', 'TWO') # >>> Numbers.ZERO # 0 # >>> Numbers.ONE # 1 # Found here: http://stackoverflow.com/questions/36932/whats-the-best-way-to-implement-an-enum-in-python def enum(*sequen...
Update : try/except in destructurate greatly enhances performances on mass read/write
## Code Before: from collections import Sequence # Enums beautiful python implementation # Used like this : # Numbers = enum('ZERO', 'ONE', 'TWO') # >>> Numbers.ZERO # 0 # >>> Numbers.ONE # 1 # Found here: http://stackoverflow.com/questions/36932/whats-the-best-way-to-implement-an-enum-in-python def enum(*sequential, ...
from collections import Sequence # Enums beautiful python implementation # Used like this : # Numbers = enum('ZERO', 'ONE', 'TWO') # >>> Numbers.ZERO # 0 # >>> Numbers.ONE # 1 # Found here: http://stackoverflow.com/questions/36932/whats-the-best-way-to-implement-an-enum-in-python def enum(*sequen...
29f6e1c46179257b6604a4314855b0347bc312ad
src/config.py
src/config.py
import json import jsoncomment class Config: def __init_config_from_file(self, path): with open(path) as f: for k, v in jsoncomment.JsonComment(json).loads(f.read()).items(): self.__config[k] = v def __init__(self, config): self.__config = config def __getitem...
import json import jsoncomment class Config: def __init_config_from_file(self, path): with open(path) as f: for k, v in jsoncomment.JsonComment(json).loads(f.read()).items(): self.__config[k] = v def __init__(self, config): self.__config = config def __getitem...
Remove 'fallback_path' handling from Config class
Remove 'fallback_path' handling from Config class
Python
mit
sbobek/achievement-unlocked
import json import jsoncomment class Config: def __init_config_from_file(self, path): with open(path) as f: for k, v in jsoncomment.JsonComment(json).loads(f.read()).items(): self.__config[k] = v def __init__(self, config): self.__config = c...
Remove 'fallback_path' handling from Config class
## Code Before: import json import jsoncomment class Config: def __init_config_from_file(self, path): with open(path) as f: for k, v in jsoncomment.JsonComment(json).loads(f.read()).items(): self.__config[k] = v def __init__(self, config): self.__config = config ...
import json import jsoncomment class Config: def __init_config_from_file(self, path): with open(path) as f: for k, v in jsoncomment.JsonComment(json).loads(f.read()).items(): self.__config[k] = v def __init__(self, config): self.__config = c...
92a5d02b3e052fb0536e51aba043ff2f026c6484
appengine_config.py
appengine_config.py
import logging def appstats_should_record(env): from gae_mini_profiler.config import should_profile if should_profile(): return True def gae_mini_profiler_should_profile_production(): from google.appengine.api import users return users.is_current_user_admin() def gae_mini_profiler_should_profile_develo...
import logging def appstats_should_record(env): #from gae_mini_profiler.config import should_profile #if should_profile(): # return True return False def gae_mini_profiler_should_profile_production(): from google.appengine.api import users return users.is_current_user_admin() def gae_mini_profiler_sho...
Disable GAE mini profiler by default
Disable GAE mini profiler by default
Python
mit
bbondy/brianbondy.gae,bbondy/brianbondy.gae,bbondy/brianbondy.gae,bbondy/brianbondy.gae
import logging def appstats_should_record(env): - from gae_mini_profiler.config import should_profile + #from gae_mini_profiler.config import should_profile - if should_profile(): + #if should_profile(): - return True + # return True + return False def gae_mini_profiler_should_profile_p...
Disable GAE mini profiler by default
## Code Before: import logging def appstats_should_record(env): from gae_mini_profiler.config import should_profile if should_profile(): return True def gae_mini_profiler_should_profile_production(): from google.appengine.api import users return users.is_current_user_admin() def gae_mini_profiler_shoul...
import logging def appstats_should_record(env): - from gae_mini_profiler.config import should_profile + #from gae_mini_profiler.config import should_profile ? + - if should_profile(): + #if should_profile(): ? + - return True + # return True ? + + return False def gae_mini_prof...
ea287daca69d0385c2792cd0021a0b1a23fb912b
helpers/datadog_reporting.py
helpers/datadog_reporting.py
import os import yaml from dogapi import dog_stats_api, dog_http_api def setup(): """ Initialize connection to datadog during locust startup. Reads the datadog api key from (in order): 1) An environment variable named DATADOG_API_KEY 2) the DATADOG_API_KEY of a yaml file at 2a) the enviro...
import os import yaml from dogapi import dog_stats_api, dog_http_api def setup(): """ Initialize connection to datadog during locust startup. Reads the datadog api key from (in order): 1) An environment variable named DATADOG_API_KEY 2) the DATADOG_API_KEY of a yaml file at 2a) the enviro...
Fix reading of API key from yaml file.
Fix reading of API key from yaml file.
Python
apache-2.0
edx/edx-load-tests,edx/edx-load-tests,edx/edx-load-tests,edx/edx-load-tests
import os import yaml from dogapi import dog_stats_api, dog_http_api def setup(): """ Initialize connection to datadog during locust startup. Reads the datadog api key from (in order): 1) An environment variable named DATADOG_API_KEY 2) the DATADOG_API_KEY of a yaml fil...
Fix reading of API key from yaml file.
## Code Before: import os import yaml from dogapi import dog_stats_api, dog_http_api def setup(): """ Initialize connection to datadog during locust startup. Reads the datadog api key from (in order): 1) An environment variable named DATADOG_API_KEY 2) the DATADOG_API_KEY of a yaml file at ...
import os import yaml from dogapi import dog_stats_api, dog_http_api def setup(): """ Initialize connection to datadog during locust startup. Reads the datadog api key from (in order): 1) An environment variable named DATADOG_API_KEY 2) the DATADOG_API_KEY of a yaml fil...
ff67e435ea31680698166e4ae3296ff4211e2b51
kremlin/__init__.py
kremlin/__init__.py
from flask import Flask from flaskext.sqlalchemy import SQLAlchemy from flaskext.uploads import configure_uploads, UploadSet, IMAGES app = Flask(__name__) # Load default configuration values, override with whatever is specified # in configuration file. This is, I think, the sanest approach. app.config.from_object('k...
from flask import Flask from flaskext.uploads import configure_uploads, UploadSet, IMAGES from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) # Load default configuration values, override with whatever is specified # in configuration file. This is, I think, the sanest approach. app.config.from_object('krem...
Fix import for new Flask-SQlAlchemy (no longer in flaskext)
Fix import for new Flask-SQlAlchemy (no longer in flaskext)
Python
bsd-2-clause
glasnost/kremlin,glasnost/kremlin,glasnost/kremlin
from flask import Flask - from flaskext.sqlalchemy import SQLAlchemy from flaskext.uploads import configure_uploads, UploadSet, IMAGES + from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) # Load default configuration values, override with whatever is specified # in configuration file. This...
Fix import for new Flask-SQlAlchemy (no longer in flaskext)
## Code Before: from flask import Flask from flaskext.sqlalchemy import SQLAlchemy from flaskext.uploads import configure_uploads, UploadSet, IMAGES app = Flask(__name__) # Load default configuration values, override with whatever is specified # in configuration file. This is, I think, the sanest approach. app.confi...
from flask import Flask - from flaskext.sqlalchemy import SQLAlchemy from flaskext.uploads import configure_uploads, UploadSet, IMAGES + from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) # Load default configuration values, override with whatever is specified # in configuration file. This...
fbd49474eb9d0d80874048964ca08295e8c040cb
webwatcher/fetcher/simple.py
webwatcher/fetcher/simple.py
import json import requests def simple(conf): url = conf['url'] output_format = conf.get('format', 'html') response = requests.get(url) if output_format == 'json': return json.dumps(response.json(), indent=True) else: return response.text
import json import requests def simple(conf): url = conf['url'] output_format = conf.get('format', 'html') response = requests.get(url) if output_format == 'json': return json.dumps(response.json(), indent=True, sort_keys=True) else: return response.text
Sort keys in JSON fetcher for consistent results
Sort keys in JSON fetcher for consistent results
Python
mit
kibitzr/kibitzr,kibitzr/kibitzr
import json import requests def simple(conf): url = conf['url'] output_format = conf.get('format', 'html') response = requests.get(url) if output_format == 'json': - return json.dumps(response.json(), indent=True) + return json.dumps(response.json(), indent=True, s...
Sort keys in JSON fetcher for consistent results
## Code Before: import json import requests def simple(conf): url = conf['url'] output_format = conf.get('format', 'html') response = requests.get(url) if output_format == 'json': return json.dumps(response.json(), indent=True) else: return response.text ## Instruction: Sort keys...
import json import requests def simple(conf): url = conf['url'] output_format = conf.get('format', 'html') response = requests.get(url) if output_format == 'json': - return json.dumps(response.json(), indent=True) + return json.dumps(response.json(), indent=True, s...
057cdbdb0cd3edb18201ca090f57908681512c76
openupgradelib/__init__.py
openupgradelib/__init__.py
import sys __author__ = 'Odoo Community Association (OCA)' __email__ = 'support@odoo-community.org' __doc__ = """A library with support functions to be called from Odoo \ migration scripts.""" __license__ = "AGPL-3" if sys.version_info >= (3, 8): from importlib.metadata import version, PackageNotFoundError else:...
import sys __author__ = 'Odoo Community Association (OCA)' __email__ = 'support@odoo-community.org' __doc__ = """A library with support functions to be called from Odoo \ migration scripts.""" __license__ = "AGPL-3" try: if sys.version_info >= (3, 8): from importlib.metadata import version, PackageNotFou...
Fix issue when running setup.py on python<3.8
Fix issue when running setup.py on python<3.8
Python
agpl-3.0
OCA/openupgradelib
import sys __author__ = 'Odoo Community Association (OCA)' __email__ = 'support@odoo-community.org' __doc__ = """A library with support functions to be called from Odoo \ migration scripts.""" __license__ = "AGPL-3" + try: - if sys.version_info >= (3, 8): + if sys.version_info >= (3, 8): - ...
Fix issue when running setup.py on python<3.8
## Code Before: import sys __author__ = 'Odoo Community Association (OCA)' __email__ = 'support@odoo-community.org' __doc__ = """A library with support functions to be called from Odoo \ migration scripts.""" __license__ = "AGPL-3" if sys.version_info >= (3, 8): from importlib.metadata import version, PackageNot...
import sys __author__ = 'Odoo Community Association (OCA)' __email__ = 'support@odoo-community.org' __doc__ = """A library with support functions to be called from Odoo \ migration scripts.""" __license__ = "AGPL-3" + try: - if sys.version_info >= (3, 8): + if sys.version_info >= (3, 8): ? ++++...
2c38fea1434f8591957c2707359412151c4b6c43
tests/test_timezones.py
tests/test_timezones.py
import unittest import datetime from garage.timezones import TimeZone class TimeZoneTest(unittest.TestCase): def test_time_zone(self): utc = datetime.datetime(2000, 1, 2, 3, 4, 0, 0, TimeZone.UTC) cst = utc.astimezone(TimeZone.CST) print('xxx', utc, cst) self.assertEqual(2000, c...
import unittest import datetime from garage.timezones import TimeZone class TimeZoneTest(unittest.TestCase): def test_time_zone(self): utc = datetime.datetime(2000, 1, 2, 3, 4, 0, 0, TimeZone.UTC) cst = utc.astimezone(TimeZone.CST) self.assertEqual(2000, cst.year) self.assertEqu...
Remove print in unit test
Remove print in unit test
Python
mit
clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage
import unittest import datetime from garage.timezones import TimeZone class TimeZoneTest(unittest.TestCase): def test_time_zone(self): utc = datetime.datetime(2000, 1, 2, 3, 4, 0, 0, TimeZone.UTC) cst = utc.astimezone(TimeZone.CST) - print('xxx', utc, cst) ...
Remove print in unit test
## Code Before: import unittest import datetime from garage.timezones import TimeZone class TimeZoneTest(unittest.TestCase): def test_time_zone(self): utc = datetime.datetime(2000, 1, 2, 3, 4, 0, 0, TimeZone.UTC) cst = utc.astimezone(TimeZone.CST) print('xxx', utc, cst) self.ass...
import unittest import datetime from garage.timezones import TimeZone class TimeZoneTest(unittest.TestCase): def test_time_zone(self): utc = datetime.datetime(2000, 1, 2, 3, 4, 0, 0, TimeZone.UTC) cst = utc.astimezone(TimeZone.CST) - print('xxx', utc, cst) ...
4a8c608c545b67f9dc1f436c82e0d83a55e168e9
scripts/database/common.py
scripts/database/common.py
import sys import psycopg2 import os import yaml if 'CATMAID_CONFIGURATION' in os.environ: path = os.environ['CATMAID_CONFIGURATION'] else: path = os.path.join(os.environ['HOME'], '.catmaid-db') try: conf = yaml.load(open(path)) except: print >> sys.stderr, '''Your %s file should look like: host: loc...
import sys import psycopg2 import os import yaml if 'CATMAID_CONFIGURATION' in os.environ: path = os.environ['CATMAID_CONFIGURATION'] else: path = os.path.join(os.environ['HOME'], '.catmaid-db') try: conf = yaml.load(open(path)) except: print >> sys.stderr, '''Your %s file should look like: host: loc...
Add default port to database connection script
Add default port to database connection script The default port is used if the ~/.catmaid-db file doesn't contain it. This fixes #454.
Python
agpl-3.0
fzadow/CATMAID,htem/CATMAID,htem/CATMAID,htem/CATMAID,fzadow/CATMAID,fzadow/CATMAID,fzadow/CATMAID,htem/CATMAID
import sys import psycopg2 import os import yaml if 'CATMAID_CONFIGURATION' in os.environ: path = os.environ['CATMAID_CONFIGURATION'] else: path = os.path.join(os.environ['HOME'], '.catmaid-db') try: conf = yaml.load(open(path)) except: print >> sys.stderr, '''Your %s file ...
Add default port to database connection script
## Code Before: import sys import psycopg2 import os import yaml if 'CATMAID_CONFIGURATION' in os.environ: path = os.environ['CATMAID_CONFIGURATION'] else: path = os.path.join(os.environ['HOME'], '.catmaid-db') try: conf = yaml.load(open(path)) except: print >> sys.stderr, '''Your %s file should look ...
import sys import psycopg2 import os import yaml if 'CATMAID_CONFIGURATION' in os.environ: path = os.environ['CATMAID_CONFIGURATION'] else: path = os.path.join(os.environ['HOME'], '.catmaid-db') try: conf = yaml.load(open(path)) except: print >> sys.stderr, '''Your %s file ...
c46398091fbe591bbe79744ed4371fddcc454912
IPython/html/terminal/handlers.py
IPython/html/terminal/handlers.py
"""Tornado handlers for the terminal emulator.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from tornado import web import terminado from ..base.handlers import IPythonHandler class TerminalHandler(IPythonHandler): """Render the terminal interface.""" ...
"""Tornado handlers for the terminal emulator.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from tornado import web import terminado from ..base.handlers import IPythonHandler class TerminalHandler(IPythonHandler): """Render the terminal interface.""" ...
Use relative URL for redirect in NewTerminalHandler
Use relative URL for redirect in NewTerminalHandler
Python
bsd-3-clause
ipython/ipython,ipython/ipython
"""Tornado handlers for the terminal emulator.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from tornado import web import terminado from ..base.handlers import IPythonHandler class TerminalHandler(IPythonHandler): """Render the ter...
Use relative URL for redirect in NewTerminalHandler
## Code Before: """Tornado handlers for the terminal emulator.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from tornado import web import terminado from ..base.handlers import IPythonHandler class TerminalHandler(IPythonHandler): """Render the terminal ...
"""Tornado handlers for the terminal emulator.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from tornado import web import terminado from ..base.handlers import IPythonHandler class TerminalHandler(IPythonHandler): """Render the ter...
a1e56d65807228b952036fc182071aab5e6ff25f
tests/cli/test_pixel.py
tests/cli/test_pixel.py
import os from click.testing import CliRunner import matplotlib as mpl import pytest from yatsm.cli.main import cli mpl_skip = pytest.mark.skipif( mpl.get_backend() != 'agg' and "DISPLAY" not in os.environ, reason='Requires either matplotlib "agg" backend or that DISPLAY" is set') @mpl_skip def test_cli_pi...
import os from click.testing import CliRunner import matplotlib as mpl import pytest from yatsm.cli.main import cli mpl_skip = pytest.mark.skipif( mpl.get_backend() != 'agg' and "DISPLAY" not in os.environ, reason='Requires either matplotlib "agg" backend or that DISPLAY" is set') @mpl_skip def test_cli_pi...
Add test for all plot types
Add test for all plot types
Python
mit
valpasq/yatsm,c11/yatsm,ceholden/yatsm,ceholden/yatsm,c11/yatsm,valpasq/yatsm
import os from click.testing import CliRunner import matplotlib as mpl import pytest from yatsm.cli.main import cli mpl_skip = pytest.mark.skipif( mpl.get_backend() != 'agg' and "DISPLAY" not in os.environ, reason='Requires either matplotlib "agg" backend or that DISPLAY" is set') ...
Add test for all plot types
## Code Before: import os from click.testing import CliRunner import matplotlib as mpl import pytest from yatsm.cli.main import cli mpl_skip = pytest.mark.skipif( mpl.get_backend() != 'agg' and "DISPLAY" not in os.environ, reason='Requires either matplotlib "agg" backend or that DISPLAY" is set') @mpl_skip...
import os from click.testing import CliRunner import matplotlib as mpl import pytest from yatsm.cli.main import cli mpl_skip = pytest.mark.skipif( mpl.get_backend() != 'agg' and "DISPLAY" not in os.environ, reason='Requires either matplotlib "agg" backend or that DISPLAY" is set') ...
af7122220447b1abe771f37400daeb4370603dd4
collection_pipelines/core.py
collection_pipelines/core.py
import functools def coroutine(fn): def wrapper(*args, **kwargs): generator = fn(*args, **kwargs) next(generator) return generator return wrapper class CollectionPipelineProcessor: sink = None start_source = None receiver = None def process(self, item): rais...
import functools def coroutine(fn): def wrapper(*args, **kwargs): generator = fn(*args, **kwargs) next(generator) return generator return wrapper class CollectionPipelineProcessor: sink = None start_source = None receiver = None def process(self, item): rais...
Add base class for output pipeline processors
Add base class for output pipeline processors
Python
mit
povilasb/pycollection-pipelines
import functools def coroutine(fn): def wrapper(*args, **kwargs): generator = fn(*args, **kwargs) next(generator) return generator return wrapper class CollectionPipelineProcessor: sink = None start_source = None receiver = None d...
Add base class for output pipeline processors
## Code Before: import functools def coroutine(fn): def wrapper(*args, **kwargs): generator = fn(*args, **kwargs) next(generator) return generator return wrapper class CollectionPipelineProcessor: sink = None start_source = None receiver = None def process(self, ite...
import functools def coroutine(fn): def wrapper(*args, **kwargs): generator = fn(*args, **kwargs) next(generator) return generator return wrapper class CollectionPipelineProcessor: sink = None start_source = None receiver = None d...
cbf4d85092232051cd7643d74e003b86f24ba571
feincms/templatetags/feincms_admin_tags.py
feincms/templatetags/feincms_admin_tags.py
from django import template register = template.Library() @register.filter def post_process_fieldsets(fieldset): """ Removes a few fields from FeinCMS admin inlines, those being ``id``, ``DELETE`` and ``ORDER`` currently. """ process = fieldset.model_admin.verbose_name_plural.startswith('Feincm...
from django import template register = template.Library() @register.filter def post_process_fieldsets(fieldset): """ Removes a few fields from FeinCMS admin inlines, those being ``id``, ``DELETE`` and ``ORDER`` currently. """ excluded_fields = ('id', 'DELETE', 'ORDER') fieldset.fields = [f ...
Fix post_process_fieldsets: This filter is only called for FeinCMS inlines anyway
Fix post_process_fieldsets: This filter is only called for FeinCMS inlines anyway Thanks to mjl for the report and help in fixing the issue.
Python
bsd-3-clause
matthiask/django-content-editor,matthiask/feincms2-content,joshuajonah/feincms,matthiask/feincms2-content,matthiask/django-content-editor,mjl/feincms,feincms/feincms,nickburlett/feincms,mjl/feincms,nickburlett/feincms,feincms/feincms,pjdelport/feincms,pjdelport/feincms,mjl/feincms,nickburlett/feincms,michaelkuty/feincm...
from django import template register = template.Library() @register.filter def post_process_fieldsets(fieldset): """ Removes a few fields from FeinCMS admin inlines, those being ``id``, ``DELETE`` and ``ORDER`` currently. """ - process = fieldset.model_admin.verbose_na...
Fix post_process_fieldsets: This filter is only called for FeinCMS inlines anyway
## Code Before: from django import template register = template.Library() @register.filter def post_process_fieldsets(fieldset): """ Removes a few fields from FeinCMS admin inlines, those being ``id``, ``DELETE`` and ``ORDER`` currently. """ process = fieldset.model_admin.verbose_name_plural.st...
from django import template register = template.Library() @register.filter def post_process_fieldsets(fieldset): """ Removes a few fields from FeinCMS admin inlines, those being ``id``, ``DELETE`` and ``ORDER`` currently. """ - process = fieldset.model_admin.verbose_na...
156093f3b4872d68663897b8525f4706ec5a555c
pyfr/template.py
pyfr/template.py
# -*- coding: utf-8 -*- import os import pkgutil from mako.lookup import TemplateLookup from mako.template import Template class DottedTemplateLookup(TemplateLookup): def __init__(self, pkg): self.dfltpkg = pkg def adjust_uri(self, uri, relto): return uri def get_template(self, name):...
# -*- coding: utf-8 -*- import os import pkgutil from mako.lookup import TemplateLookup from mako.template import Template class DottedTemplateLookup(TemplateLookup): def __init__(self, pkg): self.dfltpkg = pkg def adjust_uri(self, uri, relto): return uri def get_template(self, name):...
Enhance the dotted name lookup functionality.
Enhance the dotted name lookup functionality.
Python
bsd-3-clause
tjcorona/PyFR,tjcorona/PyFR,tjcorona/PyFR,BrianVermeire/PyFR,iyer-arvind/PyFR,Aerojspark/PyFR
# -*- coding: utf-8 -*- import os import pkgutil from mako.lookup import TemplateLookup from mako.template import Template class DottedTemplateLookup(TemplateLookup): def __init__(self, pkg): self.dfltpkg = pkg def adjust_uri(self, uri, relto): return uri ...
Enhance the dotted name lookup functionality.
## Code Before: # -*- coding: utf-8 -*- import os import pkgutil from mako.lookup import TemplateLookup from mako.template import Template class DottedTemplateLookup(TemplateLookup): def __init__(self, pkg): self.dfltpkg = pkg def adjust_uri(self, uri, relto): return uri def get_templ...
# -*- coding: utf-8 -*- import os import pkgutil from mako.lookup import TemplateLookup from mako.template import Template class DottedTemplateLookup(TemplateLookup): def __init__(self, pkg): self.dfltpkg = pkg def adjust_uri(self, uri, relto): return uri ...
0d1300165b2d33802124917d477047f7b414a69c
plugins/Tools/ScaleTool/ScaleToolHandle.py
plugins/Tools/ScaleTool/ScaleToolHandle.py
from UM.Scene.ToolHandle import ToolHandle class ScaleToolHandle(ToolHandle): def __init__(self, parent = None): super().__init__(parent) md = self.getMeshData() md.addVertex(0, 0, 0) md.addVertex(0, 20, 0) md.addVertex(0, 0, 0) md.addVertex(20, 0, 0) md.ad...
from UM.Scene.ToolHandle import ToolHandle from UM.Mesh.MeshData import MeshData from UM.Mesh.MeshBuilder import MeshBuilder from UM.Math.Vector import Vector class ScaleToolHandle(ToolHandle): def __init__(self, parent = None): super().__init__(parent) lines = MeshData() lines.addVertex(0...
Implement proper scale tool handles
Implement proper scale tool handles
Python
agpl-3.0
onitake/Uranium,onitake/Uranium
from UM.Scene.ToolHandle import ToolHandle + from UM.Mesh.MeshData import MeshData + from UM.Mesh.MeshBuilder import MeshBuilder + from UM.Math.Vector import Vector class ScaleToolHandle(ToolHandle): def __init__(self, parent = None): super().__init__(parent) - md = self.getMeshData() ...
Implement proper scale tool handles
## Code Before: from UM.Scene.ToolHandle import ToolHandle class ScaleToolHandle(ToolHandle): def __init__(self, parent = None): super().__init__(parent) md = self.getMeshData() md.addVertex(0, 0, 0) md.addVertex(0, 20, 0) md.addVertex(0, 0, 0) md.addVertex(20, 0, ...
from UM.Scene.ToolHandle import ToolHandle + from UM.Mesh.MeshData import MeshData + from UM.Mesh.MeshBuilder import MeshBuilder + from UM.Math.Vector import Vector class ScaleToolHandle(ToolHandle): def __init__(self, parent = None): super().__init__(parent) - md = self.getMeshData() ...
4f66208343c29226bdb549c2b1d6d15cd2ab985e
tests/twisted/presence/initial-presence.py
tests/twisted/presence/initial-presence.py
from twisted.words.xish import domish from gabbletest import exec_test from servicetest import EventPattern, assertEquals, assertNotEquals import ns import constants as cs from invisible_helper import ValidInvisibleListStream, Xep0186XmlStream def test(q, bus, conn, stream): props = conn.Properties.GetAll(cs.CON...
from twisted.words.xish import domish from gabbletest import exec_test from servicetest import EventPattern, assertEquals, assertNotEquals import ns import constants as cs from invisible_helper import ValidInvisibleListStream, Xep0186Stream, \ Xep0186AndValidInvisibleListStream def test(q, bus, conn, stream): ...
Add hybrid (XEP-0126 & XEP-0186) service to initial presence test.
Add hybrid (XEP-0126 & XEP-0186) service to initial presence test.
Python
lgpl-2.1
Ziemin/telepathy-gabble,jku/telepathy-gabble,mlundblad/telepathy-gabble,Ziemin/telepathy-gabble,mlundblad/telepathy-gabble,Ziemin/telepathy-gabble,Ziemin/telepathy-gabble,jku/telepathy-gabble,mlundblad/telepathy-gabble,jku/telepathy-gabble
from twisted.words.xish import domish from gabbletest import exec_test from servicetest import EventPattern, assertEquals, assertNotEquals import ns import constants as cs - from invisible_helper import ValidInvisibleListStream, Xep0186XmlStream + from invisible_helper import ValidInvisibleListStream, X...
Add hybrid (XEP-0126 & XEP-0186) service to initial presence test.
## Code Before: from twisted.words.xish import domish from gabbletest import exec_test from servicetest import EventPattern, assertEquals, assertNotEquals import ns import constants as cs from invisible_helper import ValidInvisibleListStream, Xep0186XmlStream def test(q, bus, conn, stream): props = conn.Properti...
from twisted.words.xish import domish from gabbletest import exec_test from servicetest import EventPattern, assertEquals, assertNotEquals import ns import constants as cs - from invisible_helper import ValidInvisibleListStream, Xep0186XmlStream ? ...
b2657fd84c0d8fd4e1188a649bb2595651b83adb
kazoo/handlers/util.py
kazoo/handlers/util.py
try: from gevent import monkey [start_new_thread] = monkey.get_original('thread', ['start_new_thread']) except ImportError: from thread import start_new_thread def thread(func): """Thread decorator Takes a function and spawns it as a daemon thread using the real OS thread regardless of monkey...
from __future__ import absolute_import try: from gevent._threading import start_new_thread except ImportError: from thread import start_new_thread def thread(func): """Thread decorator Takes a function and spawns it as a daemon thread using the real OS thread regardless of monkey patching. ...
Make sure we use proper gevent with absolute import, pull the start_new_thread directly out.
Make sure we use proper gevent with absolute import, pull the start_new_thread directly out.
Python
apache-2.0
harlowja/kazoo,pombredanne/kazoo,rockerbox/kazoo,AlexanderplUs/kazoo,harlowja/kazoo,pombredanne/kazoo,rgs1/kazoo,Asana/kazoo,jacksontj/kazoo,kormat/kazoo,rackerlabs/kazoo,bsanders/kazoo,tempbottle/kazoo,python-zk/kazoo,rockerbox/kazoo,jacksontj/kazoo,rackerlabs/kazoo,python-zk/kazoo,rgs1/kazoo,tempbottle/kazoo,Alexande...
+ from __future__ import absolute_import + try: + from gevent._threading import start_new_thread - from gevent import monkey - [start_new_thread] = monkey.get_original('thread', ['start_new_thread']) except ImportError: from thread import start_new_thread def thread(func): """Thread...
Make sure we use proper gevent with absolute import, pull the start_new_thread directly out.
## Code Before: try: from gevent import monkey [start_new_thread] = monkey.get_original('thread', ['start_new_thread']) except ImportError: from thread import start_new_thread def thread(func): """Thread decorator Takes a function and spawns it as a daemon thread using the real OS thread rega...
+ from __future__ import absolute_import + try: + from gevent._threading import start_new_thread - from gevent import monkey - [start_new_thread] = monkey.get_original('thread', ['start_new_thread']) except ImportError: from thread import start_new_thread def thread(func): """Thread...
8dadb34bdfe6d85d3016a59a9441ed8a552d1149
octane_fuelclient/octaneclient/commands.py
octane_fuelclient/octaneclient/commands.py
from fuelclient.commands import base from fuelclient.commands import environment as env_commands from fuelclient.common import data_utils class EnvClone(env_commands.EnvMixIn, base.BaseShowCommand): """Clone environment and translate settings to the given release.""" columns = env_commands.EnvShow.columns ...
from fuelclient.commands import base from fuelclient.commands import environment as env_commands from fuelclient.common import data_utils class EnvClone(env_commands.EnvMixIn, base.BaseShowCommand): """Clone environment and translate settings to the given release.""" columns = env_commands.EnvShow.columns ...
Fix endpoint for clone operation
Fix endpoint for clone operation
Python
apache-2.0
stackforge/fuel-octane,Mirantis/octane,Mirantis/octane,stackforge/fuel-octane
from fuelclient.commands import base from fuelclient.commands import environment as env_commands from fuelclient.common import data_utils class EnvClone(env_commands.EnvMixIn, base.BaseShowCommand): """Clone environment and translate settings to the given release.""" columns = env_commands....
Fix endpoint for clone operation
## Code Before: from fuelclient.commands import base from fuelclient.commands import environment as env_commands from fuelclient.common import data_utils class EnvClone(env_commands.EnvMixIn, base.BaseShowCommand): """Clone environment and translate settings to the given release.""" columns = env_commands.En...
from fuelclient.commands import base from fuelclient.commands import environment as env_commands from fuelclient.common import data_utils class EnvClone(env_commands.EnvMixIn, base.BaseShowCommand): """Clone environment and translate settings to the given release.""" columns = env_commands....
29c437e15f7793886c80b71ca6764184caff2597
readthedocs/oauth/management/commands/load_project_remote_repo_relation.py
readthedocs/oauth/management/commands/load_project_remote_repo_relation.py
import json from django.core.management.base import BaseCommand from readthedocs.oauth.models import RemoteRepository class Command(BaseCommand): help = "Load Project and RemoteRepository Relationship from JSON file" def add_arguments(self, parser): # File path of the json file containing relations...
import json from django.core.management.base import BaseCommand from readthedocs.oauth.models import RemoteRepository class Command(BaseCommand): help = "Load Project and RemoteRepository Relationship from JSON file" def add_arguments(self, parser): # File path of the json file containing relations...
Check if the remote_repo was updated or not and log error
Check if the remote_repo was updated or not and log error
Python
mit
rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org
import json from django.core.management.base import BaseCommand from readthedocs.oauth.models import RemoteRepository class Command(BaseCommand): help = "Load Project and RemoteRepository Relationship from JSON file" def add_arguments(self, parser): # File path of the json f...
Check if the remote_repo was updated or not and log error
## Code Before: import json from django.core.management.base import BaseCommand from readthedocs.oauth.models import RemoteRepository class Command(BaseCommand): help = "Load Project and RemoteRepository Relationship from JSON file" def add_arguments(self, parser): # File path of the json file cont...
import json from django.core.management.base import BaseCommand from readthedocs.oauth.models import RemoteRepository class Command(BaseCommand): help = "Load Project and RemoteRepository Relationship from JSON file" def add_arguments(self, parser): # File path of the json f...
1ba0f715a0730dbc575bd1998f2edc69fab60fc5
project_task_add_very_high/__openerp__.py
project_task_add_very_high/__openerp__.py
{ "name": "Project Task Add Very High", "summary": "Adds an extra option 'Very High' on tasks", "version": "8.0.1.0.0", "author": "Onestein", "license": "AGPL-3", "category": "Project Management", "website": "http://www.onestein.eu", "depends": ["project"], "installable": True, ...
{ "name": "Project Task Add Very High", "summary": "Adds an extra option 'Very High' on tasks", "version": "8.0.1.0.0", "author": "Onestein, Odoo Community Association (OCA)", "license": "AGPL-3", "category": "Project Management", "website": "http://www.onestein.eu", "depends": ["projec...
Add OCA in authors list
Add OCA in authors list
Python
agpl-3.0
ddico/project,OCA/project-service,dreispt/project-service,NeovaHealth/project-service,dreispt/project,acsone/project,acsone/project-service
{ "name": "Project Task Add Very High", "summary": "Adds an extra option 'Very High' on tasks", "version": "8.0.1.0.0", - "author": "Onestein", + "author": "Onestein, Odoo Community Association (OCA)", "license": "AGPL-3", "category": "Project Management", "website": "ht...
Add OCA in authors list
## Code Before: { "name": "Project Task Add Very High", "summary": "Adds an extra option 'Very High' on tasks", "version": "8.0.1.0.0", "author": "Onestein", "license": "AGPL-3", "category": "Project Management", "website": "http://www.onestein.eu", "depends": ["project"], "installa...
{ "name": "Project Task Add Very High", "summary": "Adds an extra option 'Very High' on tasks", "version": "8.0.1.0.0", - "author": "Onestein", + "author": "Onestein, Odoo Community Association (OCA)", "license": "AGPL-3", "category": "Project Management", "website": "ht...
55af5785d1aedff028f85229af691d5f59ba434a
python_cowbull_server/__init__.py
python_cowbull_server/__init__.py
import argparse import logging # Import standard logging - for levels only from python_cowbull_server.Configurator import Configurator from flask import Flask # # Step 1 - Check any command line arguments passed # parser = argparse.ArgumentParser() parser.add_argument('--env', dest='show...
import logging # Import standard logging - for levels only from python_cowbull_server.Configurator import Configurator from flask import Flask # Instantiate the Flask application as app app = Flask(__name__) c = Configurator() print('') print('-'*80) print('The following environment variables may be set to...
Remove parameter support (due to unittest module) and modify to print parameters on each run.
Remove parameter support (due to unittest module) and modify to print parameters on each run.
Python
apache-2.0
dsandersAzure/python_cowbull_server,dsandersAzure/python_cowbull_server
- import argparse import logging # Import standard logging - for levels only from python_cowbull_server.Configurator import Configurator from flask import Flask - # - # Step 1 - Check any command line arguments passed - # - parser = argparse.ArgumentParser() - parser.add_argument('--env', - ...
Remove parameter support (due to unittest module) and modify to print parameters on each run.
## Code Before: import argparse import logging # Import standard logging - for levels only from python_cowbull_server.Configurator import Configurator from flask import Flask # # Step 1 - Check any command line arguments passed # parser = argparse.ArgumentParser() parser.add_argument('--env', ...
- import argparse import logging # Import standard logging - for levels only from python_cowbull_server.Configurator import Configurator from flask import Flask - # - # Step 1 - Check any command line arguments passed - # - parser = argparse.ArgumentParser() - parser.add_argument('--env', - ...
3f909cdfba61719dfa0a860aeba1e418fe740f33
indra/__init__.py
indra/__init__.py
from __future__ import print_function, unicode_literals import logging import os import sys __version__ = '1.10.0' __all__ = ['assemblers', 'belief', 'databases', 'explanation', 'literature', 'mechlinker', 'preassembler', 'sources', 'tools', 'util'] logging.basicConfig(format='%(levelname)s: [%(asctime)s] ...
from __future__ import print_function, unicode_literals import logging import os import sys __version__ = '1.10.0' __all__ = ['assemblers', 'belief', 'databases', 'explanation', 'literature', 'mechlinker', 'preassembler', 'sources', 'tools', 'util'] logging.basicConfig(format=('%(levelname)s: [%(asctime)s]...
Remove indra prefix from logger
Remove indra prefix from logger
Python
bsd-2-clause
bgyori/indra,bgyori/indra,johnbachman/indra,pvtodorov/indra,sorgerlab/indra,bgyori/indra,pvtodorov/indra,johnbachman/belpy,sorgerlab/belpy,sorgerlab/belpy,sorgerlab/belpy,sorgerlab/indra,johnbachman/indra,johnbachman/indra,pvtodorov/indra,sorgerlab/indra,johnbachman/belpy,johnbachman/belpy,pvtodorov/indra
from __future__ import print_function, unicode_literals import logging import os import sys __version__ = '1.10.0' __all__ = ['assemblers', 'belief', 'databases', 'explanation', 'literature', 'mechlinker', 'preassembler', 'sources', 'tools', 'util'] - logging.basicConfig(format='%(levelna...
Remove indra prefix from logger
## Code Before: from __future__ import print_function, unicode_literals import logging import os import sys __version__ = '1.10.0' __all__ = ['assemblers', 'belief', 'databases', 'explanation', 'literature', 'mechlinker', 'preassembler', 'sources', 'tools', 'util'] logging.basicConfig(format='%(levelname)s...
from __future__ import print_function, unicode_literals import logging import os import sys __version__ = '1.10.0' __all__ = ['assemblers', 'belief', 'databases', 'explanation', 'literature', 'mechlinker', 'preassembler', 'sources', 'tools', 'util'] - logging.basicConfig(format='%(levelna...
423288b4cc8cf1506285913558b3fcff9e7788fa
gitlab/urls.py
gitlab/urls.py
from django.conf.urls import patterns, url from django.views.generic.base import RedirectView from gitlab import views urlpatterns = patterns('', url(r'^favicon\.ico$', RedirectView.as_view(url='/static/app/favicon.ico')), url(r'^push_event/hv$', views.push_event_hv), url(r'^push_event/web$', views.push_e...
from django.conf.urls import patterns, url from django.views.generic.base import RedirectView from gitlab import views urlpatterns = patterns('', url(r'^favicon\.ico$', RedirectView.as_view(url='/static/app/favicon.ico')), url(r'^push_event/hv$', views.push_event_hv), url(r'^push_event/web$', views.push_e...
Add URL for monitoring hook
Add URL for monitoring hook
Python
apache-2.0
ReanGD/web-work-fitnesse,ReanGD/web-work-fitnesse,ReanGD/web-work-fitnesse
from django.conf.urls import patterns, url from django.views.generic.base import RedirectView from gitlab import views urlpatterns = patterns('', url(r'^favicon\.ico$', RedirectView.as_view(url='/static/app/favicon.ico')), url(r'^push_event/hv$', views.push_event_hv), - url(r'^push_event/w...
Add URL for monitoring hook
## Code Before: from django.conf.urls import patterns, url from django.views.generic.base import RedirectView from gitlab import views urlpatterns = patterns('', url(r'^favicon\.ico$', RedirectView.as_view(url='/static/app/favicon.ico')), url(r'^push_event/hv$', views.push_event_hv), url(r'^push_event/web...
from django.conf.urls import patterns, url from django.views.generic.base import RedirectView from gitlab import views urlpatterns = patterns('', url(r'^favicon\.ico$', RedirectView.as_view(url='/static/app/favicon.ico')), url(r'^push_event/hv$', views.push_event_hv), - url(r'^push_event/w...
97c0f23c676de7e726e938bf0b61087834cf9fd9
netbox/tenancy/api/serializers.py
netbox/tenancy/api/serializers.py
from rest_framework import serializers from extras.api.serializers import CustomFieldSerializer from tenancy.models import Tenant, TenantGroup # # Tenant groups # class TenantGroupSerializer(serializers.ModelSerializer): class Meta: model = TenantGroup fields = ['id', 'name', 'slug'] class Te...
from rest_framework import serializers from extras.api.serializers import CustomFieldSerializer from tenancy.models import Tenant, TenantGroup # # Tenant groups # class TenantGroupSerializer(serializers.ModelSerializer): class Meta: model = TenantGroup fields = ['id', 'name', 'slug'] class Te...
Add description field to TenantSerializer
Add description field to TenantSerializer This might be just an oversight. Other data models do include the description in their serialisers. The API produces the description field with this change.
Python
apache-2.0
digitalocean/netbox,snazy2000/netbox,digitalocean/netbox,snazy2000/netbox,Alphalink/netbox,snazy2000/netbox,lampwins/netbox,Alphalink/netbox,snazy2000/netbox,Alphalink/netbox,lampwins/netbox,lampwins/netbox,digitalocean/netbox,digitalocean/netbox,lampwins/netbox,Alphalink/netbox
from rest_framework import serializers from extras.api.serializers import CustomFieldSerializer from tenancy.models import Tenant, TenantGroup # # Tenant groups # class TenantGroupSerializer(serializers.ModelSerializer): class Meta: model = TenantGroup fields = ['i...
Add description field to TenantSerializer
## Code Before: from rest_framework import serializers from extras.api.serializers import CustomFieldSerializer from tenancy.models import Tenant, TenantGroup # # Tenant groups # class TenantGroupSerializer(serializers.ModelSerializer): class Meta: model = TenantGroup fields = ['id', 'name', 's...
from rest_framework import serializers from extras.api.serializers import CustomFieldSerializer from tenancy.models import Tenant, TenantGroup # # Tenant groups # class TenantGroupSerializer(serializers.ModelSerializer): class Meta: model = TenantGroup fields = ['i...
ab9a38793645a9c61cf1c320e5a4db9bf7b03ccf
grow/deployments/utils.py
grow/deployments/utils.py
from .indexes import messages import git class Error(Exception): pass class NoGitHeadError(Error, ValueError): pass def create_commit_message(repo): message = messages.CommitMessage() try: commit = repo.head.commit except ValueError: raise NoGitHeadError('On initial commit, no HEAD yet.') try:...
from .indexes import messages import git class Error(Exception): pass class NoGitHeadError(Error, ValueError): pass def create_commit_message(repo): message = messages.CommitMessage() try: commit = repo.head.commit except ValueError: raise NoGitHeadError('On initial commit, no HEAD yet.') try:...
Allow operating in an environment with a detached HEAD.
Allow operating in an environment with a detached HEAD.
Python
mit
grow/pygrow,denmojo/pygrow,grow/grow,grow/grow,grow/pygrow,codedcolors/pygrow,grow/grow,grow/pygrow,denmojo/pygrow,denmojo/pygrow,denmojo/pygrow,codedcolors/pygrow,codedcolors/pygrow,grow/grow
from .indexes import messages import git class Error(Exception): pass class NoGitHeadError(Error, ValueError): pass def create_commit_message(repo): message = messages.CommitMessage() try: commit = repo.head.commit except ValueError: raise NoGitHeadError('On i...
Allow operating in an environment with a detached HEAD.
## Code Before: from .indexes import messages import git class Error(Exception): pass class NoGitHeadError(Error, ValueError): pass def create_commit_message(repo): message = messages.CommitMessage() try: commit = repo.head.commit except ValueError: raise NoGitHeadError('On initial commit, no HE...
from .indexes import messages import git class Error(Exception): pass class NoGitHeadError(Error, ValueError): pass def create_commit_message(repo): message = messages.CommitMessage() try: commit = repo.head.commit except ValueError: raise NoGitHeadError('On i...
f114e5ecf62a5a08c22e1db23e891abe066b61f8
oneflow/core/forms.py
oneflow/core/forms.py
import logging #from django import forms #from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.forms import UserCreationForm from django.contrib.auth import get_user_model LOGGER = logging.getLogger(__name__) User = get_user_model() class FullUserCreationForm(UserCreationForm): """ ...
import logging from django import forms from django.utils.translation import ugettext_lazy as _ from django.contrib.auth import get_user_model LOGGER = logging.getLogger(__name__) User = get_user_model() class FullUserCreationForm(forms.ModelForm): """ Like the django UserCreationForm, with optional fi...
Make the FullUserCreationForm work on a fresh database which doesn't have Django's auth_user table.
Make the FullUserCreationForm work on a fresh database which doesn't have Django's auth_user table.
Python
agpl-3.0
1flow/1flow,1flow/1flow,WillianPaiva/1flow,1flow/1flow,1flow/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,WillianPaiva/1flow,WillianPaiva/1flow
import logging - #from django import forms + from django import forms - #from django.utils.translation import ugettext_lazy as _ + from django.utils.translation import ugettext_lazy as _ - from django.contrib.auth.forms import UserCreationForm from django.contrib.auth import get_user_model LOGGER = loggi...
Make the FullUserCreationForm work on a fresh database which doesn't have Django's auth_user table.
## Code Before: import logging #from django import forms #from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.forms import UserCreationForm from django.contrib.auth import get_user_model LOGGER = logging.getLogger(__name__) User = get_user_model() class FullUserCreationForm(UserCreatio...
import logging - #from django import forms ? - + from django import forms - #from django.utils.translation import ugettext_lazy as _ ? - + from django.utils.translation import ugettext_lazy as _ - from django.contrib.auth.forms import UserCreationForm from django.contrib.auth import get_user_model LOGG...
d0dfd2c9055092f64e396177275dbe285ad41efb
blo/DBControl.py
blo/DBControl.py
import sqlite3 class DBControl: def __init__(self, db_name=":memory:"): self.db_conn = sqlite3.connect(db_name)
import sqlite3 class DBControl: def __init__(self, db_name=":memory:"): self.db_conn = sqlite3.connect(db_name) def create_tables(self): self.db_conn.execute("""CREATE TABLE IF NOT EXISTS Articles (" id INTEGER PRIMARY KEY AUTOINCREMENT, ...
Add Create tables method and close db connection method.
Add Create tables method and close db connection method. create_table method create article table (if not exists in db) and virtual table for full text search.
Python
mit
10nin/blo,10nin/blo
import sqlite3 class DBControl: def __init__(self, db_name=":memory:"): self.db_conn = sqlite3.connect(db_name) + def create_tables(self): + self.db_conn.execute("""CREATE TABLE IF NOT EXISTS Articles (" + id INTEGER PRIMARY KEY AUTOINCREMENT,...
Add Create tables method and close db connection method.
## Code Before: import sqlite3 class DBControl: def __init__(self, db_name=":memory:"): self.db_conn = sqlite3.connect(db_name) ## Instruction: Add Create tables method and close db connection method. ## Code After: import sqlite3 class DBControl: def __init__(self, db_name=":memory:"): sel...
import sqlite3 class DBControl: def __init__(self, db_name=":memory:"): self.db_conn = sqlite3.connect(db_name) + + def create_tables(self): + self.db_conn.execute("""CREATE TABLE IF NOT EXISTS Articles (" + id INTEGER PRIMARY KEY AUTOINCREMENT,...
5a6c8b1c9c13078462bec7ba254c6a6f95dd3c42
contrib/linux/tests/test_action_dig.py
contrib/linux/tests/test_action_dig.py
from __future__ import absolute_import from st2tests.base import BaseActionTestCase from dig import DigAction class DigActionTestCase(BaseActionTestCase): action_cls = DigAction def test_run(self): action = self.get_action_instance() # Use the defaults from dig.yaml result = action...
from __future__ import absolute_import from st2tests.base import BaseActionTestCase from dig import DigAction class DigActionTestCase(BaseActionTestCase): action_cls = DigAction def test_run(self): action = self.get_action_instance() # Use the defaults from dig.yaml result = action...
Test that returned result is a str instance
Test that returned result is a str instance
Python
apache-2.0
nzlosh/st2,StackStorm/st2,StackStorm/st2,Plexxi/st2,Plexxi/st2,Plexxi/st2,StackStorm/st2,StackStorm/st2,nzlosh/st2,nzlosh/st2,Plexxi/st2,nzlosh/st2
from __future__ import absolute_import from st2tests.base import BaseActionTestCase from dig import DigAction class DigActionTestCase(BaseActionTestCase): action_cls = DigAction def test_run(self): action = self.get_action_instance() # Use the defaults from dig....
Test that returned result is a str instance
## Code Before: from __future__ import absolute_import from st2tests.base import BaseActionTestCase from dig import DigAction class DigActionTestCase(BaseActionTestCase): action_cls = DigAction def test_run(self): action = self.get_action_instance() # Use the defaults from dig.yaml ...
from __future__ import absolute_import from st2tests.base import BaseActionTestCase from dig import DigAction class DigActionTestCase(BaseActionTestCase): action_cls = DigAction def test_run(self): action = self.get_action_instance() # Use the defaults from dig....
c8779edcb4078c799b7112625b5495f63a00e428
l10n_ro_partner_unique/models/res_partner.py
l10n_ro_partner_unique/models/res_partner.py
from odoo import _, api, models from odoo.exceptions import ValidationError class ResPartner(models.Model): _inherit = "res.partner" @api.model def _get_vat_nrc_constrain_domain(self): domain = [ ("company_id", "=", self.company_id), ("parent_id", "=", False), ...
from odoo import _, api, models from odoo.exceptions import ValidationError class ResPartner(models.Model): _inherit = "res.partner" @api.model def _get_vat_nrc_constrain_domain(self): domain = [ ("company_id", "=", self.company_id.id if self.company_id else False), ("par...
Add vat unique per comapny
Add vat unique per comapny
Python
agpl-3.0
OCA/l10n-romania,OCA/l10n-romania
from odoo import _, api, models from odoo.exceptions import ValidationError class ResPartner(models.Model): _inherit = "res.partner" @api.model def _get_vat_nrc_constrain_domain(self): domain = [ - ("company_id", "=", self.company_id), + ("company_id...
Add vat unique per comapny
## Code Before: from odoo import _, api, models from odoo.exceptions import ValidationError class ResPartner(models.Model): _inherit = "res.partner" @api.model def _get_vat_nrc_constrain_domain(self): domain = [ ("company_id", "=", self.company_id), ("parent_id", "=", Fal...
from odoo import _, api, models from odoo.exceptions import ValidationError class ResPartner(models.Model): _inherit = "res.partner" @api.model def _get_vat_nrc_constrain_domain(self): domain = [ - ("company_id", "=", self.company_id), + ("company_id...
bb3ec131261f0619a86f21f549d6b1cb47f2c9ad
graph/serializers.py
graph/serializers.py
from rest_framework import serializers from measurement.models import Measurement from threshold_value.models import ThresholdValue from calendar import timegm from alarm.models import Alarm class GraphSeriesSerializer(serializers.ModelSerializer): x = serializers.SerializerMethodField('get_time') y = seriali...
from rest_framework import serializers from measurement.models import Measurement from threshold_value.models import ThresholdValue from calendar import timegm from alarm.models import Alarm class GraphSeriesSerializer(serializers.ModelSerializer): x = serializers.SerializerMethodField('get_time') y = seriali...
Simplify SimpleAlarmSerializer to improve the performance of the graph_data endpoint
Simplify SimpleAlarmSerializer to improve the performance of the graph_data endpoint
Python
mit
sigurdsa/angelika-api
from rest_framework import serializers from measurement.models import Measurement from threshold_value.models import ThresholdValue from calendar import timegm from alarm.models import Alarm class GraphSeriesSerializer(serializers.ModelSerializer): x = serializers.SerializerMethodField('get_time...
Simplify SimpleAlarmSerializer to improve the performance of the graph_data endpoint
## Code Before: from rest_framework import serializers from measurement.models import Measurement from threshold_value.models import ThresholdValue from calendar import timegm from alarm.models import Alarm class GraphSeriesSerializer(serializers.ModelSerializer): x = serializers.SerializerMethodField('get_time')...
from rest_framework import serializers from measurement.models import Measurement from threshold_value.models import ThresholdValue from calendar import timegm from alarm.models import Alarm class GraphSeriesSerializer(serializers.ModelSerializer): x = serializers.SerializerMethodField('get_time...
d1da755f10d4287d1cfbec3a6d29d9961125bbce
plugins/tff_backend/plugin_consts.py
plugins/tff_backend/plugin_consts.py
NAMESPACE = u'tff_backend' KEY_ALGORITHM = u'ed25519' KEY_NAME = u'threefold' THREEFOLD_APP_ID = u'em-be-threefold-token' FULL_CURRENCY_NAMES = { 'USD': 'dollar', 'EUR': 'euro', 'YEN': 'yen', 'UAE': 'dirham', 'GBP': 'pound', } CURRENCY_RATES = { 'USD': 5.0, 'EUR': 4.2, 'YEN': 543.6, ...
NAMESPACE = u'tff_backend' KEY_ALGORITHM = u'ed25519' KEY_NAME = u'threefold' THREEFOLD_APP_ID = u'em-be-threefold-token' FULL_CURRENCY_NAMES = { 'USD': 'dollar', 'EUR': 'euro', 'YEN': 'yen', 'UAE': 'dirham', 'GBP': 'pound', 'BTC': 'bitcoin', } CURRENCY_RATES = { 'USD': 5.0, 'EUR': 4....
Add BTC to possible currencies
Add BTC to possible currencies
Python
bsd-3-clause
threefoldfoundation/app_backend,threefoldfoundation/app_backend,threefoldfoundation/app_backend,threefoldfoundation/app_backend
NAMESPACE = u'tff_backend' KEY_ALGORITHM = u'ed25519' KEY_NAME = u'threefold' THREEFOLD_APP_ID = u'em-be-threefold-token' FULL_CURRENCY_NAMES = { 'USD': 'dollar', 'EUR': 'euro', 'YEN': 'yen', 'UAE': 'dirham', 'GBP': 'pound', + 'BTC': 'bitcoin', } CURRENCY_RATES =...
Add BTC to possible currencies
## Code Before: NAMESPACE = u'tff_backend' KEY_ALGORITHM = u'ed25519' KEY_NAME = u'threefold' THREEFOLD_APP_ID = u'em-be-threefold-token' FULL_CURRENCY_NAMES = { 'USD': 'dollar', 'EUR': 'euro', 'YEN': 'yen', 'UAE': 'dirham', 'GBP': 'pound', } CURRENCY_RATES = { 'USD': 5.0, 'EUR': 4.2, ...
NAMESPACE = u'tff_backend' KEY_ALGORITHM = u'ed25519' KEY_NAME = u'threefold' THREEFOLD_APP_ID = u'em-be-threefold-token' FULL_CURRENCY_NAMES = { 'USD': 'dollar', 'EUR': 'euro', 'YEN': 'yen', 'UAE': 'dirham', 'GBP': 'pound', + 'BTC': 'bitcoin', } CURRENCY_RATES =...
f6b4b16c26ee97d48ba524027a96d17fba63dc80
project/models.py
project/models.py
import datetime from project import db, bcrypt class User(db.Model): __tablename__ = "users" id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String, unique=True, nullable=False) password = db.Column(db.String, nullable=False) registered_on = db.Column(db.DateTime, nullable=Fal...
import datetime from project import db, bcrypt class User(db.Model): __tablename__ = "users" id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String, unique=True, nullable=False) password = db.Column(db.String, nullable=False) registered_on = db.Column(db.DateTime, nullable=Fal...
Update user model with confirmed and confirmed_at
Update user model with confirmed and confirmed_at
Python
mit
dylanshine/streamschool,dylanshine/streamschool
import datetime from project import db, bcrypt class User(db.Model): __tablename__ = "users" id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String, unique=True, nullable=False) password = db.Column(db.String, nullable=False) registered_on = db.Column...
Update user model with confirmed and confirmed_at
## Code Before: import datetime from project import db, bcrypt class User(db.Model): __tablename__ = "users" id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String, unique=True, nullable=False) password = db.Column(db.String, nullable=False) registered_on = db.Column(db.DateTi...
import datetime from project import db, bcrypt class User(db.Model): __tablename__ = "users" id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String, unique=True, nullable=False) password = db.Column(db.String, nullable=False) registered_on = db.Column...
f6bff4e5360ba2c0379c129a111d333ee718c1d3
datafeeds/usfirst_event_teams_parser.py
datafeeds/usfirst_event_teams_parser.py
import re from BeautifulSoup import BeautifulSoup from datafeeds.parser_base import ParserBase class UsfirstEventTeamsParser(ParserBase): @classmethod def parse(self, html): """ Find what Teams are attending an Event, and return their team_numbers. """ teamRe = re.compile(r'...
import re from BeautifulSoup import BeautifulSoup from datafeeds.parser_base import ParserBase class UsfirstEventTeamsParser(ParserBase): @classmethod def parse(self, html): """ Find what Teams are attending an Event, and return their team_numbers. """ teamRe = re.compile(r'...
Fix event teams parser for new format
Fix event teams parser for new format
Python
mit
the-blue-alliance/the-blue-alliance,jaredhasenklein/the-blue-alliance,nwalters512/the-blue-alliance,nwalters512/the-blue-alliance,bdaroz/the-blue-alliance,1fish2/the-blue-alliance,synth3tk/the-blue-alliance,jaredhasenklein/the-blue-alliance,bdaroz/the-blue-alliance,nwalters512/the-blue-alliance,tsteward/the-blue-allian...
import re from BeautifulSoup import BeautifulSoup from datafeeds.parser_base import ParserBase class UsfirstEventTeamsParser(ParserBase): @classmethod def parse(self, html): """ Find what Teams are attending an Event, and return their team_numbers. """ + ...
Fix event teams parser for new format
## Code Before: import re from BeautifulSoup import BeautifulSoup from datafeeds.parser_base import ParserBase class UsfirstEventTeamsParser(ParserBase): @classmethod def parse(self, html): """ Find what Teams are attending an Event, and return their team_numbers. """ teamRe...
import re from BeautifulSoup import BeautifulSoup from datafeeds.parser_base import ParserBase class UsfirstEventTeamsParser(ParserBase): @classmethod def parse(self, html): """ Find what Teams are attending an Event, and return their team_numbers. """ + ...