commit stringlengths 40 40 | old_file stringlengths 4 150 | new_file stringlengths 4 150 | old_contents stringlengths 0 3.26k | new_contents stringlengths 1 4.43k | subject stringlengths 15 501 | message stringlengths 15 4.06k | lang stringclasses 4
values | license stringclasses 13
values | repos stringlengths 5 91.5k | diff stringlengths 0 4.35k |
|---|---|---|---|---|---|---|---|---|---|---|
a8f3491811bb639ebb59f79c55f461ae063b06b8 | api/base/urls.py | api/base/urls.py | from django.conf import settings
from django.conf.urls import include, url
# from django.contrib import admin
from django.conf.urls.static import static
from . import views
urlpatterns = [
### API ###
url(r'^$', views.root),
url(r'^nodes/', include('api.nodes.urls', namespace='nodes')),
url(r'^users... | from django.conf import settings
from django.conf.urls import include, url, patterns
# from django.contrib import admin
from django.conf.urls.static import static
from . import views
urlpatterns = [
### API ###
url(r'^v2/', include(patterns('',
url(r'^$', views.root),
url(r'^nodes/', include... | Change API url prefix to 'v2' | Change API url prefix to 'v2'
| Python | apache-2.0 | TomBaxter/osf.io,cwisecarver/osf.io,pattisdr/osf.io,wearpants/osf.io,caseyrygt/osf.io,sbt9uc/osf.io,jmcarp/osf.io,adlius/osf.io,adlius/osf.io,GageGaskins/osf.io,dplorimer/osf,reinaH/osf.io,abought/osf.io,TomHeatwole/osf.io,petermalcolm/osf.io,hmoco/osf.io,pattisdr/osf.io,jeffreyliu3230/osf.io,zachjanicki/osf.io,billyhu... | ---
+++
@@ -1,5 +1,5 @@
from django.conf import settings
-from django.conf.urls import include, url
+from django.conf.urls import include, url, patterns
# from django.contrib import admin
from django.conf.urls.static import static
@@ -9,8 +9,9 @@
urlpatterns = [
### API ###
- url(r'^$', views.root),
-... |
fb7754f15a8f0803c5417782e87d6fe153bf6d20 | migrations/versions/201503061726_573faf4ac644_added_end_date_to_full_text_index_events.py | migrations/versions/201503061726_573faf4ac644_added_end_date_to_full_text_index_events.py | """Added end_date to full text index events
Revision ID: 573faf4ac644
Revises: 342fa3076650
Create Date: 2015-03-06 17:26:54.718493
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '573faf4ac644'
down_revision = '342fa3076650'
def upgrade():
op.alter_colum... | """Added end_date to full text index events
Revision ID: 573faf4ac644
Revises: 342fa3076650
Create Date: 2015-03-06 17:26:54.718493
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '573faf4ac644'
down_revision = '342fa3076650'
def upgrade():
op.alter_colum... | Use index name matching the current naming schema | Use index name matching the current naming schema
| Python | mit | OmeGak/indico,mvidalgarcia/indico,pferreir/indico,indico/indico,DirkHoffmann/indico,indico/indico,mic4ael/indico,ThiefMaster/indico,ThiefMaster/indico,mvidalgarcia/indico,mic4ael/indico,DirkHoffmann/indico,ThiefMaster/indico,OmeGak/indico,indico/indico,OmeGak/indico,DirkHoffmann/indico,mvidalgarcia/indico,DirkHoffmann/... | ---
+++
@@ -16,17 +16,16 @@
def upgrade():
op.alter_column('event_index', 'start_date', nullable=False, schema='events')
- op.create_index('ix_start_date', 'event_index', ['start_date'], schema='events')
+ op.create_index('ix_events_event_index_start_date', 'event_index', ['start_date'], schema='events'... |
029a159fe3f920d59e0168af72177b343daa4256 | phased/__init__.py | phased/__init__.py | from django.conf import settings
def generate_secret_delimiter():
try:
from hashlib import sha1
except ImportError:
from sha import sha as sha1
return sha1(getattr(settings, 'SECRET_KEY', '')).hexdigest()
LITERAL_DELIMITER = getattr(settings, 'LITERAL_DELIMITER', generate_secret_delimiter(... | from django.conf import settings
from django.utils.hashcompat import sha_constructor
def generate_secret_delimiter():
return sha_constructor(getattr(settings, 'SECRET_KEY', '')).hexdigest()
LITERAL_DELIMITER = getattr(settings, 'LITERAL_DELIMITER', generate_secret_delimiter())
| Make use of Django's hashcompat module. | Make use of Django's hashcompat module. | Python | bsd-3-clause | OmarIthawi/django-phased,mab2k/django-phased,mab2k/django-phased,codysoyland/django-phased,OmarIthawi/django-phased | ---
+++
@@ -1,10 +1,7 @@
from django.conf import settings
+from django.utils.hashcompat import sha_constructor
def generate_secret_delimiter():
- try:
- from hashlib import sha1
- except ImportError:
- from sha import sha as sha1
- return sha1(getattr(settings, 'SECRET_KEY', '')).hexdigest(... |
c5a7feb3000bb3e234a3b87e8b20262eb9b94dfe | books/models.py | books/models.py | from django.contrib.auth.models import User
from django.db import models
from django.db.models import fields
from django.utils import timezone
class Transaction(models.Model):
EXPENSE = 'exp'
INCOME = 'inc'
CATEGORY_CHOICES = (
(EXPENSE, 'expense'),
(INCOME, 'income'),
)
title = f... | from django.contrib.auth.models import User
from django.db import models
from django.db.models import fields
from django.utils import timezone
class Transaction(models.Model):
EXPENSE = 'exp'
INCOME = 'inc'
CATEGORY_CHOICES = (
(EXPENSE, 'expense'),
(INCOME, 'income'),
)
title = f... | Create new model for debts and loans | Create new model for debts and loans
| Python | mit | trimailov/finance,trimailov/finance,trimailov/finance | ---
+++
@@ -21,3 +21,26 @@
def __str__(self):
return "{}".format(self.title)
+
+
+class DebtLoan(models.Model):
+ DEBT = 0
+ LOAN = 1
+ CATEGORY_CHOICES = (
+ (DEBT, 'debt'),
+ (LOAN, 'loan'),
+ )
+
+ with_who = fields.CharField(max_length=255)
+ title = fields.CharFiel... |
39c0dfd7821355c9d2ff2274f4dd6292e959ed87 | pronto/__init__.py | pronto/__init__.py | # coding: utf-8
"""
**pronto**: a Python frontend to ontologies
===========================================
"""
from __future__ import absolute_import
__all__ = ["Ontology", "Term", "TermList", "Relationship", "Parser"]
__version__='0.5.0'
__author__='Martin Larralde'
__author_email__ = 'martin.larralde@ens-cachan.f... | # coding: utf-8
"""
**pronto**: a Python frontend to ontologies
===========================================
"""
from __future__ import absolute_import
__all__ = ["Ontology", "Term", "TermList", "Relationship"]
__version__='0.5.0'
__author__='Martin Larralde'
__author_email__ = 'martin.larralde@ens-cachan.fr'
try:
... | Remove Parser from __all__ (from pronto import *) | Remove Parser from __all__ (from pronto import *)
| Python | mit | althonos/pronto | ---
+++
@@ -7,7 +7,7 @@
from __future__ import absolute_import
-__all__ = ["Ontology", "Term", "TermList", "Relationship", "Parser"]
+__all__ = ["Ontology", "Term", "TermList", "Relationship"]
__version__='0.5.0'
__author__='Martin Larralde'
__author_email__ = 'martin.larralde@ens-cachan.fr'
@@ -17,7 +17,6 @@... |
feefc687473b80adf30079e3ca23384459bb1558 | protractor/test.py | protractor/test.py | # -*- coding: utf-8 -*-
import os
import subprocess
class ProtractorTestCaseMixin(object):
protractor_conf = 'protractor.conf.js'
suite = None
specs = None
@classmethod
def setUpClass(cls):
super(ProtractorTestCaseMixin, cls).setUpClass()
with open(os.devnull, 'wb') as f:
... | # -*- coding: utf-8 -*-
import os
import subprocess
class ProtractorTestCaseMixin(object):
protractor_conf = 'protractor.conf.js'
suite = None
specs = None
@classmethod
def setUpClass(cls):
super(ProtractorTestCaseMixin, cls).setUpClass()
with open(os.devnull, 'wb') as f:
... | Update to pass live server url as param to protractor | Update to pass live server url as param to protractor
| Python | mit | penguin359/django-protractor,jpulec/django-protractor | ---
+++
@@ -28,5 +28,6 @@
protractor_command += ' --specs {}'.format(','.join(self.specs))
if self.suite:
protractor_command += ' --suite {}'.format(self.suite)
+ protractor_command += ' --params.live_server_url={}'.format(self.live_server_url)
return_code = subproce... |
e78dd9bf1b9e1d20b8df34ee3328ee08afd45676 | contrib/migrateticketmodel.py | contrib/migrateticketmodel.py | #!/usr/bin/env python
#
# This script completely migrates a <= 0.8.x Trac environment to use the new
# default ticket model introduced in Trac 0.9.
#
# In particular, this means that the severity field is removed (or rather
# disabled by removing all possible values), and the priority values are
# changed to the more... | #!/usr/bin/env python
#
# This script completely migrates a <= 0.8.x Trac environment to use the new
# default ticket model introduced in Trac 0.9.
#
# In particular, this means that the severity field is removed (or rather
# disabled by removing all possible values), and the priority values are
# changed to the more... | Fix missing import in contrib script added in [2630]. | Fix missing import in contrib script added in [2630].
git-svn-id: eda3d06fcef731589ace1b284159cead3416df9b@2631 af82e41b-90c4-0310-8c96-b1721e28e2e2
| Python | bsd-3-clause | netjunki/trac-Pygit2,walty8/trac,jun66j5/trac-ja,jun66j5/trac-ja,walty8/trac,netjunki/trac-Pygit2,netjunki/trac-Pygit2,walty8/trac,jun66j5/trac-ja,jun66j5/trac-ja,walty8/trac | ---
+++
@@ -9,6 +9,7 @@
#
# Make sure to make a backup of the Trac environment before running this!
+import os
import sys
from trac.env import open_environment |
8974dc36e6ea0ab7b5ce3c78e9827d41cf1abcec | appengine_config.py | appengine_config.py | """Configuration."""
import logging
import os
import re
from google.appengine.ext.appstats import recording
logging.info('Loading %s from %s', __name__, __file__)
# Custom webapp middleware to add Appstats.
def webapp_add_wsgi_middleware(app):
app = recording.appstats_wsgi_middleware(app)
return app
# Custom A... | """Configuration."""
import logging
import os
import re
from google.appengine.ext.appstats import recording
logging.info('Loading %s from %s', __name__, __file__)
# Custom webapp middleware to add Appstats.
def webapp_add_wsgi_middleware(app):
app = recording.appstats_wsgi_middleware(app)
return app
# Custom A... | Enable the Appstats Interactive Playground. | Enable the Appstats Interactive Playground.
| Python | apache-2.0 | Koulio/rietveld,gco/rietveld,andyzsf/rietveld,google-code-export/rietveld,kscharding/integral-solutions-smxq,rietveld-codereview/rietveld,google-code-export/rietveld,v3ss0n/rietveld,ericmckean/rietveld,openlabs/cr.openlabs.co.in,aungzanbaw/rietveld,robfig/rietveld,Koulio/rietveld,arg0/rietveld,sajingeo/rietveld,openlab... | ---
+++
@@ -34,8 +34,10 @@
# Segregate Appstats by runtime (python vs. python27).
appstats_KEY_NAMESPACE = '__appstats_%s__' % os.getenv('APPENGINE_RUNTIME')
+# Enable Interactive Playground.
+appstats_SHELL_OK = True
+
# Django 1.2+ requires DJANGO_SETTINGS_MODULE environment variable to be set
-# http://code.g... |
176c03e26f46bad73df39c11ea4a190baca6fe54 | apps/authentication/tests.py | apps/authentication/tests.py | from django.core.urlresolvers import reverse
from django.test import TestCase
class HTTPGetRootTestCase(TestCase):
def setUp(self):
pass
def test_get_root_expect_http_200(self):
url = reverse('microauth_authentication:index')
response = self.client.get(url)
self.assertEqual(20... | from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.utils import override_settings
class HTTPGetRootTestCase(TestCase):
def setUp(self):
pass
def test_get_root_expect_http_200(self):
pipeline_settings = settings.PIPEL... | Make test not depend on django-pipeline | Make test not depend on django-pipeline
| Python | mit | microserv/microauth,microserv/microauth,microserv/microauth | ---
+++
@@ -1,5 +1,7 @@
+from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import TestCase
+from django.test.utils import override_settings
class HTTPGetRootTestCase(TestCase):
@@ -7,6 +9,9 @@
pass
def test_get_root_expect_http_200(self):
- ur... |
4ee182b5561fcd333b7368471038e2692c8e2661 | anchorhub/settings/default_settings.py | anchorhub/settings/default_settings.py | """
Defaults for all settings used by AnchorHub
"""
WRAPPER = '{ }'
INPUT = '.'
OUTPUT = 'out-anchorhub'
ARGPARSER = {
'description': "anchorhub parses through Markdown files and precompiles "
"links to specially formatted anchors."
}
ARGPARSE_INPUT = {
'help': "Path of directory tree to b... | """
Defaults for all settings used by AnchorHub
"""
WRAPPER = '{ }'
INPUT = '.'
OUTPUT = 'anchorhub-out'
ARGPARSER = {
'description': "anchorhub parses through Markdown files and precompiles "
"links to specially formatted anchors."
}
ARGPARSE_INPUT = {
'help': "Path of directory tree to b... | Make default output consistent with old version | Make default output consistent with old version
I flipped the hyphen around: should be 'anchorhub-out', accidentally was
'out-anchorhub'
| Python | apache-2.0 | samjabrahams/anchorhub | ---
+++
@@ -5,7 +5,7 @@
WRAPPER = '{ }'
INPUT = '.'
-OUTPUT = 'out-anchorhub'
+OUTPUT = 'anchorhub-out'
ARGPARSER = {
'description': "anchorhub parses through Markdown files and precompiles " |
4dfa90cee753f6ef937a7a75aa347ec429fa1720 | cms/__init__.py | cms/__init__.py | """
A collection of Django extensions that add content-management facilities to Django projects.
Developed by Dave Hall.
<http://etianen.com/>
"""
VERSION = (1, 8, 5)
| """
A collection of Django extensions that add content-management facilities to Django projects.
Developed by Dave Hall.
<http://etianen.com/>
"""
VERSION = (1, 9)
| Update version number to 1.9 | Update version number to 1.9
| Python | bsd-3-clause | danielsamuels/cms,danielsamuels/cms,jamesfoley/cms,jamesfoley/cms,jamesfoley/cms,dan-gamble/cms,dan-gamble/cms,lewiscollard/cms,lewiscollard/cms,jamesfoley/cms,lewiscollard/cms,dan-gamble/cms,danielsamuels/cms | ---
+++
@@ -6,4 +6,4 @@
<http://etianen.com/>
"""
-VERSION = (1, 8, 5)
+VERSION = (1, 9) |
b501ee5dc2a41bf51f9f91c29501792338bf7269 | automatron/backend/controller.py | automatron/backend/controller.py | from automatron.backend.plugin import PluginManager
from automatron.controller.controller import IAutomatronClientActions
from automatron.core.controller import BaseController
class BackendController(BaseController):
def __init__(self, config_file):
BaseController.__init__(self, config_file)
self.... | from functools import partial
from automatron.backend.plugin import PluginManager
from automatron.controller.controller import IAutomatronClientActions
from automatron.core.controller import BaseController
class BackendController(BaseController):
def __init__(self, config_file):
BaseController.__init__(se... | Use functools.partial for client action proxy. | Use functools.partial for client action proxy.
| Python | mit | automatron/automatron | ---
+++
@@ -1,3 +1,4 @@
+from functools import partial
from automatron.backend.plugin import PluginManager
from automatron.controller.controller import IAutomatronClientActions
from automatron.core.controller import BaseController
@@ -13,6 +14,4 @@
self.plugins = PluginManager(self)
def __getattr__... |
7925afd27ead247a017baf7a7dff97986904055f | comics/views.py | comics/views.py | from django.views import generic
from gallery.models import GalleryImage
from gallery import queries
from .models import Arc, Issue
class IndexView(generic.ListView):
model = Arc
template_name = "comics/index.html"
context_object_name = "arcs"
class IssueView(generic.DetailView):
model = Issue
... | from django.views import generic
from gallery.models import GalleryImage
from gallery import queries
from .models import Arc, Issue
class IndexView(generic.ListView):
model = Arc
template_name = "comics/index.html"
context_object_name = "arcs"
class IssueView(generic.DetailView):
model = Issue
... | Make it look nicer, possibly micro seconds faster | Make it look nicer, possibly micro seconds faster
| Python | mit | evanepio/dotmanca,evanepio/dotmanca,evanepio/dotmanca | ---
+++
@@ -41,11 +41,10 @@
context = super().get_context_data(**kwargs)
context["issue"] = self.issue # Set in get_queryset()
- context["next"] = queries.get_next_image(
- self.issue.gallery, self.object.sort_order
- )
- context["previous"] = queries.get_previous_... |
04416cd9652a9fdc3ab58664ab4b96cbaff3f698 | simuvex/s_event.py | simuvex/s_event.py | import itertools
event_id_count = itertools.count()
class SimEvent(object):
#def __init__(self, address=None, stmt_idx=None, message=None, exception=None, traceback=None):
def __init__(self, state, event_type, **kwargs):
self.id = event_id_count.next()
self.type = event_type
self.ins_ad... | import itertools
event_id_count = itertools.count()
class SimEvent(object):
#def __init__(self, address=None, stmt_idx=None, message=None, exception=None, traceback=None):
def __init__(self, state, event_type, **kwargs):
self.id = event_id_count.next()
self.type = event_type
self.ins_ad... | Set None instead of NoneType to SimEvent.sim_procedure to make pickle happy. | Set None instead of NoneType to SimEvent.sim_procedure to make pickle happy.
| Python | bsd-2-clause | axt/angr,schieb/angr,angr/angr,tyb0807/angr,f-prettyland/angr,tyb0807/angr,chubbymaggie/angr,chubbymaggie/angr,f-prettyland/angr,angr/angr,axt/angr,tyb0807/angr,iamahuman/angr,iamahuman/angr,chubbymaggie/angr,angr/simuvex,schieb/angr,iamahuman/angr,axt/angr,angr/angr,f-prettyland/angr,schieb/angr | ---
+++
@@ -9,7 +9,7 @@
self.ins_addr = state.scratch.ins_addr
self.bbl_addr = state.scratch.bbl_addr
self.stmt_idx = state.scratch.stmt_idx
- self.sim_procedure = state.scratch.sim_procedure.__class__
+ self.sim_procedure = None if state.scratch.sim_procedure is None else sta... |
b1c1b28e58b59eac81954fb55570dfd389b99c0f | tests/acceptance/test_modify.py | tests/acceptance/test_modify.py | import datetime
from nose.tools import assert_raises
from scalymongo import Document
from scalymongo.errors import ModifyFailedError
from tests.acceptance.base_acceptance_test import BaseAcceptanceTest
class ModifyableDocument(Document):
__collection__ = __name__
__database__ = 'test'
structure = {
... | import datetime
from nose.tools import assert_raises
from scalymongo import Document
from scalymongo.errors import ModifyFailedError
from tests.acceptance.base_acceptance_test import BaseAcceptanceTest
class BlogPostModifyExample(Document):
__collection__ = __name__
__database__ = 'test'
structure = {
... | Add more comprehensive testing of `modify` | acceptance: Add more comprehensive testing of `modify`
| Python | bsd-3-clause | allancaffee/scaly-mongo | ---
+++
@@ -7,23 +7,73 @@
from tests.acceptance.base_acceptance_test import BaseAcceptanceTest
-class ModifyableDocument(Document):
+class BlogPostModifyExample(Document):
__collection__ = __name__
__database__ = 'test'
structure = {
- 'field': basestring,
+ 'author': basestring,
+... |
445a150982f2119b340d95edc66940e0ec54afbd | lib/ansiblelint/rules/NoFormattingInWhenRule.py | lib/ansiblelint/rules/NoFormattingInWhenRule.py | from ansiblelint import AnsibleLintRule
class NoFormattingInWhenRule(AnsibleLintRule):
id = 'CINCH0001'
shortdesc = 'No Jinja2 in when'
description = '"when" lines should not include Jinja2 variables'
tags = ['deprecated']
def _is_valid(self, when):
if not isinstance(when, (str, unicode))... | from ansiblelint import AnsibleLintRule
try:
from types import StringTypes
except ImportError:
# Python3 removed types.StringTypes
StringTypes = str,
class NoFormattingInWhenRule(AnsibleLintRule):
id = 'CINCH0001'
shortdesc = 'No Jinja2 in when'
description = '"when" lines should not include J... | Fix Python3 unicode test error | Fix Python3 unicode test error
| Python | mit | willthames/ansible-lint,dataxu/ansible-lint,MatrixCrawler/ansible-lint | ---
+++
@@ -1,4 +1,9 @@
from ansiblelint import AnsibleLintRule
+try:
+ from types import StringTypes
+except ImportError:
+ # Python3 removed types.StringTypes
+ StringTypes = str,
class NoFormattingInWhenRule(AnsibleLintRule):
@@ -8,7 +13,7 @@
tags = ['deprecated']
def _is_valid(self, whe... |
0e48b2130cc53caa9beb9a5f8ce09edbcc40f1b8 | ggplotx/tests/test_geom_point.py | ggplotx/tests/test_geom_point.py | from __future__ import absolute_import, division, print_function
import pandas as pd
from ggplotx import ggplot, aes, geom_point
def test_aesthetics():
df = pd.DataFrame({
'a': range(5),
'b': 2,
'c': 3,
'd': 4,
'e': 5,
'f': 6,
'... | from __future__ import absolute_import, division, print_function
import pandas as pd
from ggplotx import ggplot, aes, geom_point, theme
def test_aesthetics():
df = pd.DataFrame({
'a': range(5),
'b': 2,
'c': 3,
'd': 4,
'e': 5,
'f': 6,
... | Add space on the RHS of geom_point test | Add space on the RHS of geom_point test
| Python | mit | has2k1/plotnine,has2k1/plotnine | ---
+++
@@ -2,7 +2,7 @@
import pandas as pd
-from ggplotx import ggplot, aes, geom_point
+from ggplotx import ggplot, aes, geom_point, theme
def test_aesthetics():
@@ -32,6 +32,7 @@
geom_point(aes(x='h', stroke='a'), fill='white',
color='green', size=10) +
geom_point... |
831c3f82abe5cc148f13f631f78b3c960460bbce | gitlabform/configuration/core.py | gitlabform/configuration/core.py | import os
import logging
import yaml
from pathlib import Path
class ConfigurationCore:
config_from_file = None
def __init__(self, config_path=None):
try:
if not config_path:
config_path = os.path.join(Path.home(), '.gitlabform', 'config.yml')
elif config_path ... | import os
import logging
import yaml
from pathlib import Path
class ConfigurationCore:
config_from_file = None
def __init__(self, config_path=None):
try:
if not config_path:
config_path = os.path.join(Path.home(), '.gitlabform', 'config.yml')
elif config_path ... | Make loading config file safer | Make loading config file safer
| Python | mit | egnyte/gitlabform,egnyte/gitlabform | ---
+++
@@ -18,7 +18,7 @@
logging.info("Reading config from: {}".format(config_path))
with open(config_path, 'r') as ymlfile:
- self.config_from_file = yaml.load(ymlfile)
+ self.config_from_file = yaml.safe_load(ymlfile)
except Exception as e:
... |
9ee39df85da16503d5212a81adac316fcb00a3f6 | src/features/hasWord.py | src/features/hasWord.py | from utils import preprocess_tweet
def check_existence_of_words(tweet, wordlist):
"""
Function for the slang or curse words and acronyms features
:param tweet: semi process tweet (hashtags mentions removed)
:param wordlist:List of words
:return: the binary vector of word in the tweet
"""
tw... | from utils import preprocess_tweet
def check_existence_of_words(tweet, wordlist):
"""
Function for the slang or curse words and acronyms features
:param tweet: semi process tweet (hashtags mentions removed)
:param wordlist:List of words
:return: the binary vector of word in the tweet
"""
t... | Move preprocess tweet to utils, move loading wordlist to init | Move preprocess tweet to utils, move loading wordlist to init
| Python | mit | iamhuy/rumour-veracity-verification | ---
+++
@@ -7,10 +7,12 @@
:param wordlist:List of words
:return: the binary vector of word in the tweet
"""
+
tweet=preprocess_tweet(tweet)
boolean=0
for word in wordlist:
if (tweet.find(word) != -1):
boolean=1
break
+
return [boolean] |
614a996dd8227808e796a369ed0faf1f9427f780 | organizer/views.py | organizer/views.py | from django.http.response import HttpResponse
from .models import Tag
def homepage(request):
tag_list = Tag.objects.all()
html_output = "<html>\n"
html_output += "<head>\n"
html_output += " <title>"
html_output += "Don't Do This!</title>\n"
html_output += "</head>\n"
html_output += "<bod... | from django.http.response import HttpResponse
from django.template import Context, loader
from .models import Tag
def homepage(request):
tag_list = Tag.objects.all()
template = loader.get_template(
'organizer/tag_list.html')
context = Context({'tag_list': tag_list})
output = template.render(c... | Use template in homepage view. | Ch04: Use template in homepage view.
| Python | bsd-2-clause | jambonrose/DjangoUnleashed-1.8,jambonrose/DjangoUnleashed-1.8 | ---
+++
@@ -1,22 +1,13 @@
from django.http.response import HttpResponse
+from django.template import Context, loader
from .models import Tag
def homepage(request):
tag_list = Tag.objects.all()
- html_output = "<html>\n"
- html_output += "<head>\n"
- html_output += " <title>"
- html_output +... |
7a24f314c426e55735836dd2f805d9e0364dc871 | tarbell/hooks.py | tarbell/hooks.py | # -*- coding: utf-8 -*-
hooks = {
'newproject': [], # (site)
'generate': [], # (site, dir, extra_context)
'publish': [], # (site, s3)
'install': [], # (site, project)
'preview': [], # (site)
'server_start': [], # (site)
'server_stop': [], ... | # -*- coding: utf-8 -*-
hooks = {
'newproject': [], # (site)
'generate': [], # (site, dir, extra_context)
'publish': [], # (site, s3)
'install': [], # (site, project)
'preview': [], # (site)
'server_start': [], # (site)
'server_stop': [], ... | Switch to Python 3-friendly `function.__name__` | Switch to Python 3-friendly `function.__name__`
| Python | bsd-3-clause | tarbell-project/tarbell,eyeseast/tarbell,tarbell-project/tarbell,eyeseast/tarbell | ---
+++
@@ -19,7 +19,7 @@
def __call__(self, f):
# Avoid weird duplication
- names = ['{0}.{1}'.format(func.__module__, func.func_name) for func in hooks[self.event]]
- if '{0}.{1}'.format(f.__module__, f.func_name) not in names:
+ names = ['{0}.{1}'.format(func.__module__, func._... |
eff279b0824b4bfb569fa82092c7ce9ac6e8c723 | test/__init__.py | test/__init__.py | import sys
sys.path.append('/home/blake/lazy/build/lib.linux-x86_64-3.4')
| import sys
sys.path.append('/home/blake/b/build/lib.linux-x86_64-3.4')
| Fix manual path hack after relocate | Fix manual path hack after relocate
| Python | apache-2.0 | blake-sheridan/py,blake-sheridan/py | ---
+++
@@ -1,3 +1,3 @@
import sys
-sys.path.append('/home/blake/lazy/build/lib.linux-x86_64-3.4')
+sys.path.append('/home/blake/b/build/lib.linux-x86_64-3.4') |
e08395a35c37fa7f7c0311cc4c7a71537b8b4227 | tests/misc/print_exception.py | tests/misc/print_exception.py | try:
import uio as io
except ImportError:
import io
import sys
if hasattr(sys, 'print_exception'):
print_exception = sys.print_exception
else:
import traceback
print_exception = lambda e, f: traceback.print_exception(None, e, sys.exc_info()[2], file=f)
def print_exc(e):
buf = io.StringIO()
... | try:
import uio as io
except ImportError:
import io
import sys
if hasattr(sys, 'print_exception'):
print_exception = sys.print_exception
else:
import traceback
print_exception = lambda e, f: traceback.print_exception(None, e, sys.exc_info()[2], file=f)
def print_exc(e):
buf = io.StringIO()
... | Add test for line number printing with large bytecode chunk. | tests/misc: Add test for line number printing with large bytecode chunk.
| Python | mit | henriknelson/micropython,AriZuu/micropython,AriZuu/micropython,micropython/micropython-esp32,micropython/micropython-esp32,PappaPeppar/micropython,MrSurly/micropython,MrSurly/micropython-esp32,infinnovation/micropython,trezor/micropython,micropython/micropython-esp32,lowRISC/micropython,torwag/micropython,PappaPeppar/m... | ---
+++
@@ -41,3 +41,13 @@
except Exception as e:
print('caught')
print_exc(e)
+
+# Here we have a function with lots of bytecode generated for a single source-line, and
+# there is an error right at the end of the bytecode. It should report the correct line.
+def f():
+ f([1, 2], [1, 2], [1, 2], {1:1,... |
9d0b1990b979de19939cc37cbefb86e1a0cd4e0f | test/perf/perf.py | test/perf/perf.py | import numpy as np
import pylab as pl
import sys
import timeit
from pykalman import KalmanFilter
N = int(sys.argv[1])
random_state = np.random.RandomState(0)
transition_matrix = [[1, 0.01], [-0.01, 1]]
transition_offset = [0.0,0.0]
observation_matrix = [1.0,0]
observation_offset = [0.0]
transition_covariance = 1e-10*n... | import numpy as np
import sys
import timeit
from pykalman import KalmanFilter
N = int(sys.argv[1])
random_state = np.random.RandomState(0)
transition_matrix = [[1, 0.01], [-0.01, 1]]
transition_offset = [0.0,0.0]
observation_matrix = [1.0,0]
observation_offset = [0.0]
transition_covariance = 1e-10*np.eye(2)
observatio... | Remove pylab from import statements | Remove pylab from import statements
| Python | mit | wkearn/Kalman.jl,wkearn/Kalman.jl | ---
+++
@@ -1,5 +1,4 @@
import numpy as np
-import pylab as pl
import sys
import timeit
from pykalman import KalmanFilter |
5f4155201afa92f048f28b9cd53681a6bc7966ab | vendor/eventlet-0.9.15/eventlet/convenience.py | vendor/eventlet-0.9.15/eventlet/convenience.py | # The history of this repository has been rewritten to erase the vendor/ directory
# Below is the md5sum and size of the file that was in the original commit
bde0e3a3a15c9bbb8d96f4d8a370d8c7
5753
| # The history of this repository has been rewritten to erase the vendor/ directory
# Below is the md5sum and size of the file that was in the original commit
5b7615cc9b13cf39cfa39db53e86977a
5751
| Drop eventlet bundle back to released state. Will workaround the bug we fixed there, in our own code. | Drop eventlet bundle back to released state. Will workaround the bug we fixed
there, in our own code.
| Python | mit | gratipay/aspen.py,gratipay/aspen.py | ---
+++
@@ -1,4 +1,4 @@
# The history of this repository has been rewritten to erase the vendor/ directory
# Below is the md5sum and size of the file that was in the original commit
-bde0e3a3a15c9bbb8d96f4d8a370d8c7
-5753
+5b7615cc9b13cf39cfa39db53e86977a
+5751 |
e5b503d0e66f8422412d0cdeac4ba4f55f14e420 | spectrum/object.py | spectrum/object.py | # -*- coding: utf-8 -*-
class Object:
"""Represents a generic Spectrum object
Supported Operations:
+-----------+--------------------------------------+
| Operation | Description |
+===========+======================================+
| x == y | Checks if t... | # -*- coding: utf-8 -*-
class Object:
"""Represents a generic Spectrum object
Supported Operations:
+-----------+--------------------------------------+
| Operation | Description |
+===========+======================================+
| x == y | Checks if t... | Change wording from future to present tense | Documentation: Change wording from future to present tense
| Python | mit | treefroog/spectrum.py | ---
+++
@@ -14,7 +14,7 @@
| x != y | Checks if two objects are not equal. |
+-----------+--------------------------------------+
- This is the class that will be the base class of most objects, since most
+ This class is the base class of most objects, since most
have an ID number.
... |
9578081d1c6ce378687d605ba2350e08eddb6959 | scipy/ndimage/segment/setup.py | scipy/ndimage/segment/setup.py |
#!/usr/bin/env python
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('segment', parent_package, top_path)
config.add_extension('_segmenter',
sources=['Segmenter_EXT.c',
... |
#!/usr/bin/env python
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('segment', parent_package, top_path)
config.add_extension('_segmenter',
sources=['Segmenter_EXT.c',
... | Add tests as data_dir to ndimage.segment | Add tests as data_dir to ndimage.segment
| Python | bsd-3-clause | jamestwebber/scipy,mdhaber/scipy,ChanderG/scipy,Kamp9/scipy,Stefan-Endres/scipy,rmcgibbo/scipy,gdooper/scipy,mtrbean/scipy,petebachant/scipy,matthewalbani/scipy,fredrikw/scipy,efiring/scipy,apbard/scipy,ales-erjavec/scipy,mikebenfield/scipy,Eric89GXL/scipy,Newman101/scipy,sriki18/scipy,andyfaff/scipy,Stefan-Endres/scip... | ---
+++
@@ -12,6 +12,8 @@
depends = ['ndImage_Segmenter_structs.h']
)
+ config.add_data_dir('tests')
+
return config
if __name__ == '__main__': |
c06e28dae894823c0ae5385e0f9c047ceab8561c | zombies/tests.py | zombies/tests.py | from django.test import TestCase
# Create your tests here.
from django.test import TestCase
from models import Story
class StoryMethodTests(TestCase):
def test_ensure_story_is_inserted(self):
story = Story(name="Zombies on Campus",visits=1,description='Zombies desciption',picture='testpic'... | from django.test import TestCase
# Create your tests here.
from django.test import TestCase
from models import Story, StoryPoint
class StoryMethodTests(TestCase):
def test_ensure_story_is_inserted(self):
story = Story(name="Zombies on Campus",visits=1,description='Zombies desciption',pictu... | Test case 2 for table storypoint | Test case 2 for table storypoint
| Python | apache-2.0 | ITLabProject2016/internet_technology_lab_project,ITLabProject2016/internet_technology_lab_project,ITLabProject2016/internet_technology_lab_project | ---
+++
@@ -3,7 +3,7 @@
# Create your tests here.
from django.test import TestCase
-from models import Story
+from models import Story, StoryPoint
class StoryMethodTests(TestCase):
@@ -16,3 +16,18 @@
self.assertEquals((story.name=='Zombies on Campus'), True)
self.assertEquals((story.descrip... |
2baed20067fed71987bf7582fa9c9a5e53a63cb5 | python/ql/test/experimental/library-tests/frameworks/stdlib/SafeAccessCheck.py | python/ql/test/experimental/library-tests/frameworks/stdlib/SafeAccessCheck.py | s = "taintedString"
if s.startswith("tainted"): # $checks=s $branch=true
pass
| s = "taintedString"
if s.startswith("tainted"): # $checks=s $branch=true
pass
sw = s.startswith # $f-:checks=s $f-:branch=true
if sw("safe"):
pass
| Test false negative from review | Python: Test false negative from review
| Python | mit | github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql | ---
+++
@@ -2,3 +2,7 @@
if s.startswith("tainted"): # $checks=s $branch=true
pass
+
+sw = s.startswith # $f-:checks=s $f-:branch=true
+if sw("safe"):
+ pass |
46ae5bbeab37f8e2fe14607c01e385d746c2d163 | pymt/components.py | pymt/components.py | from __future__ import print_function
__all__ = []
import os
import sys
import warnings
import importlib
from glob import glob
from .framework.bmi_bridge import bmi_factory
from .babel import setup_babel_environ
def import_csdms_components():
debug = os.environ.get('PYMT_DEBUG', False)
setup_babel_environ(... | __all__ = []
import sys
from .plugin import load_csdms_plugins
for plugin in load_csdms_plugins():
__all__.append(plugin.__name__)
setattr(sys.modules[__name__], plugin.__name__, plugin)
| Move csdms-plugin loading to plugin module. | Move csdms-plugin loading to plugin module.
| Python | mit | csdms/pymt,csdms/coupling,csdms/coupling | ---
+++
@@ -1,62 +1,9 @@
-from __future__ import print_function
-
__all__ = []
-import os
import sys
-import warnings
-import importlib
-from glob import glob
-
-from .framework.bmi_bridge import bmi_factory
-from .babel import setup_babel_environ
+from .plugin import load_csdms_plugins
-def import_csdms_comp... |
1e66aba5a2c82b09a6485842948aad49c654efb4 | scripts/load_topics_to_mongodb.py | scripts/load_topics_to_mongodb.py | import os
import csv
from pymongo import MongoClient
print('Parsing topics')
topics = {}
with open('topics.csv', 'rb') as csvfile:
reader = csv.reader(csvfile)
for line in reader:
if line[0] == 1:
continue
topics[line[0]] = line[1:]
print('Connecting to MongoDB')
mongodb_client = M... | import os
import sys
import csv
from pymongo import MongoClient
print('Parsing topics')
topics = {}
with open(sys.argv[1], 'r') as csvfile:
reader = csv.reader(csvfile)
for line in reader:
if line[0] == 1:
continue
topics[line[0]] = line[1:]
print('Connecting to MongoDB')
mongodb_c... | Fix script for loading topics into mongodb | Fix script for loading topics into mongodb | Python | mit | xenx/recommendation_system,xenx/recommendation_system | ---
+++
@@ -1,10 +1,11 @@
import os
+import sys
import csv
from pymongo import MongoClient
print('Parsing topics')
topics = {}
-with open('topics.csv', 'rb') as csvfile:
+with open(sys.argv[1], 'r') as csvfile:
reader = csv.reader(csvfile)
for line in reader:
if line[0] == 1: |
eefa28f06620d568eda641b08c1caa9cff9a0c96 | resourcemanager.py | resourcemanager.py | # Manage resources here
import animation
sounds = {}
images = {}
animations = {}
loaded_resources = False
def load_resources():
"""Fills the structure above with the resources for the game.
"""
if loaded_resources:
return
loaded_resources = True
| # Manage resources here
import pygame
from pygame.locals import *
import animation
sounds = {}
images = {}
animations = {}
loaded_resources = False
sound_defs = {
"aoe" : "aoe.wav",
"big hit" : "big_hit.wav",
"burstfire" : "burstfire.wav",
"explosion" : "explosion.wav",
"fireball" : "fireball.... | Add sound definitions to resource manager | Add sound definitions to resource manager
| Python | mit | vwood/pyweek2013 | ---
+++
@@ -1,4 +1,7 @@
# Manage resources here
+
+import pygame
+from pygame.locals import *
import animation
@@ -8,10 +11,33 @@
loaded_resources = False
+
+sound_defs = {
+ "aoe" : "aoe.wav",
+ "big hit" : "big_hit.wav",
+ "burstfire" : "burstfire.wav",
+ "explosion" : "explosion.wav",
+ "... |
95bc5231f88b9f24d9f7f7200fe069884138e97a | tests/__init__.py | tests/__init__.py | from test_character import *
from test_data import *
from test_exceptions import *
from test_guild import *
from test_raid import *
from test_realm import *
from test_regions import *
from test_utils import *
| Add the list of test modules to test quickly. | Add the list of test modules to test quickly.
We can now start tests with:
python -m unittest tests
assuming the BNET_API_KEY is defined.
| Python | mit | PuckCh/battlenet | ---
+++
@@ -0,0 +1,8 @@
+from test_character import *
+from test_data import *
+from test_exceptions import *
+from test_guild import *
+from test_raid import *
+from test_realm import *
+from test_regions import *
+from test_utils import * | |
e578c90cc542d3cf825645fa9376796a1e7c31f9 | lib/cache.py | lib/cache.py | import functools
import logging
import redis
import config
# Default options
redis_opts = {
'host': 'localhost',
'port': 6379,
'db': 0,
'password': None
}
redis_conn = None
cache_prefix = None
def init():
global redis_conn, cache_prefix
cfg = config.load()
cache = cfg.cache
if not... | import functools
import logging
import redis
import config
# Default options
redis_opts = {
'host': 'localhost',
'port': 6379,
'db': 0,
'password': None
}
redis_conn = None
cache_prefix = None
def init():
global redis_conn, cache_prefix
cfg = config.load()
cache = cfg.cache
if not... | Remove unneeded lru specific helper methods | Remove unneeded lru specific helper methods
| Python | apache-2.0 | dalvikchen/docker-registry,atyenoria/docker-registry,atyenoria/docker-registry,ewindisch/docker-registry,docker/docker-registry,ken-saka/docker-registry,wakermahmud/docker-registry,Carrotzpc/docker-registry,kireal/docker-registry,ewindisch/docker-registry,yuriyf/docker-registry,whuwxl/docker-registry,Haitianisgood/dock... | ---
+++
@@ -37,50 +37,4 @@
cache_prefix = 'cache_path:{0}'.format(cfg.get('storage_path', '/'))
-def cache_key(key):
- return cache_prefix + key
-
-
-def put(f):
- @functools.wraps(f)
- def wrapper(*args):
- content = args[-1]
- key = args[-2]
- key = cache_key(key)
- red... |
52bb18cf1249e3f48764a7ed4e9546439692c5cb | packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/fooSynthProvider.py | packages/Python/lldbsuite/test/functionalities/data-formatter/synthcapping/fooSynthProvider.py | import lldb
class fooSynthProvider:
def __init__(self, valobj, dict):
self.valobj = valobj;
self.int_type = valobj.GetType().GetBasicType(lldb.eBasicTypeInt)
def num_children(self):
return 3;
def get_child_at_index(self, index):
if index == 0:
child = self... | import lldb
class fooSynthProvider:
def __init__(self, valobj, dict):
self.valobj = valobj;
self.int_type = valobj.GetType().GetBasicType(lldb.eBasicTypeInt)
def num_children(self):
return 3;
def get_child_at_index(self, index):
if index == 0:
child = self.valobj.... | Fix TestSyntheticCapping for Python 3. | Fix TestSyntheticCapping for Python 3.
In Python 3, whitespace inconsistences are errors. This synthetic
provider had mixed tabs and spaces, as well as inconsistent
indentation widths. This led to the file not being imported,
and naturally the test failing. No functional change here, just
whitespace.
git-svn-id: 4... | Python | apache-2.0 | llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb | ---
+++
@@ -1,21 +1,21 @@
import lldb
class fooSynthProvider:
- def __init__(self, valobj, dict):
- self.valobj = valobj;
- self.int_type = valobj.GetType().GetBasicType(lldb.eBasicTypeInt)
- def num_children(self):
- return 3;
- def get_child_at_index(self, index):
- if ... |
e6fa443412a909bc01e2dd8d9944ff3ddba35089 | numpy/_array_api/_constants.py | numpy/_array_api/_constants.py | from .. import e, inf, nan, pi
| from ._array_object import ndarray
from ._dtypes import float64
import numpy as np
e = ndarray._new(np.array(np.e, dtype=float64))
inf = ndarray._new(np.array(np.inf, dtype=float64))
nan = ndarray._new(np.array(np.nan, dtype=float64))
pi = ndarray._new(np.array(np.pi, dtype=float64))
| Make the array API constants into dimension 0 arrays | Make the array API constants into dimension 0 arrays
The spec does not actually specify whether these should be dimension 0 arrays
or Python floats (which they are in NumPy). However, making them dimension 0
arrays is cleaner, and ensures they also have all the methods and attributes
that are implemented on the ndarra... | Python | mit | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | ---
+++
@@ -1 +1,9 @@
-from .. import e, inf, nan, pi
+from ._array_object import ndarray
+from ._dtypes import float64
+
+import numpy as np
+
+e = ndarray._new(np.array(np.e, dtype=float64))
+inf = ndarray._new(np.array(np.inf, dtype=float64))
+nan = ndarray._new(np.array(np.nan, dtype=float64))
+pi = ndarray._new(... |
f012d59f163a8b8a693dc894d211f077ae015d11 | Instanssi/kompomaatti/tests.py | Instanssi/kompomaatti/tests.py | from django.test import TestCase
from Instanssi.kompomaatti.models import Entry
VALID_YOUTUBE_URLS = [
# must handle various protocols in the video URL
"http://www.youtube.com/v/asdf123456",
"https://www.youtube.com/v/asdf123456/",
"//www.youtube.com/v/asdf123456",
"www.youtube.com/v/asdf123456",
... | from django.test import TestCase
from Instanssi.kompomaatti.models import Entry
VALID_YOUTUBE_URLS = [
# must handle various protocols and hostnames in the video URL
"http://www.youtube.com/v/asdf123456",
"https://www.youtube.com/v/asdf123456/",
"//www.youtube.com/v/asdf123456",
"www.youtube.com/v... | Add more test data; improve feedback on failing case | kompomaatti: Add more test data; improve feedback on failing case
| Python | mit | Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org,Instanssi/Instanssi.org | ---
+++
@@ -3,15 +3,16 @@
VALID_YOUTUBE_URLS = [
- # must handle various protocols in the video URL
+ # must handle various protocols and hostnames in the video URL
"http://www.youtube.com/v/asdf123456",
"https://www.youtube.com/v/asdf123456/",
"//www.youtube.com/v/asdf123456",
"www.you... |
ed5efcadb03aed8fa48ebde618317d795387d1f5 | smile_base/models/mail_mail.py | smile_base/models/mail_mail.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 Smile (<http://www.smile.fr>). All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under th... | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 Smile (<http://www.smile.fr>). All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under th... | Improve warning "Email sending not enabled" | [IMP] Improve warning "Email sending not enabled" | Python | agpl-3.0 | odoocn/odoo_addons,tiexinliu/odoo_addons,bmya/odoo_addons,odoocn/odoo_addons,odoocn/odoo_addons,tiexinliu/odoo_addons,tiexinliu/odoo_addons,bmya/odoo_addons,bmya/odoo_addons | ---
+++
@@ -29,6 +29,6 @@
@api.cr_uid
def process_email_queue(self, cr, uid, ids=None, context=None):
if not tools.config.get('enable_email_sending'):
- _logger.warning('Email sending not enable')
+ _logger.warning('Email sending not enabled')
return True
... |
e40915461f9c371a56a364e1de27bcea05dc1a37 | satori/__init__.py | satori/__init__.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distrib... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distrib... | Fix flake8 error - relative import | Fix flake8 error - relative import | Python | apache-2.0 | mgeisler/satori,mgeisler/satori,lil-cain/satori,rackerlabs/satori,rackerlabs/satori,lil-cain/satori,lil-cain/satori,samstav/satori,samstav/satori,samstav/satori | ---
+++
@@ -15,7 +15,7 @@
import pbr.version
-from .shell import main
+from satori.shell import main
version_info = pbr.version.VersionInfo('satori') |
948c9c6ffb8a34e3acf00b8190bf65504f2bfaf6 | app.py | app.py | import falcon
from resources.waifu_message_resource import WaifuMessageResource
api = falcon.API()
api.add_route('/waifu/messages', WaifuMessageResource())
| import falcon
from resources.user_resource import UserResource, UserAuthResource
from resources.waifu_message_resource import WaifuMessageResource
from resources.waifu_resource import WaifuResource
api = falcon.API()
api.add_route('/user', UserResource())
api.add_route('/user/auth', UserAuthResource())
api.add_route(... | Add endpoints for all resources. | Add endpoints for all resources.
| Python | cc0-1.0 | sketchturnerr/WaifuSim-backend,sketchturnerr/WaifuSim-backend | ---
+++
@@ -1,5 +1,11 @@
import falcon
+from resources.user_resource import UserResource, UserAuthResource
from resources.waifu_message_resource import WaifuMessageResource
+from resources.waifu_resource import WaifuResource
api = falcon.API()
+
+api.add_route('/user', UserResource())
+api.add_route('/user/auth'... |
09dbb096a796f87e9b43e463d929796db7f96182 | app.py | app.py | from flask import Flask, request
import subprocess
import uuid
import os
import re
import json
app = Flask(__name__)
@app.route('/api/v1/', methods=["GET"])
def lint():
id = uuid.uuid4()
filename = os.path.join("tmp", "{}.md".format(id))
with open(filename, "w+") as f:
f.write(request.values['t... | from flask import Flask, request
import subprocess
import uuid
import os
import re
import json
app = Flask(__name__)
@app.route('/v1/', methods=["GET"])
def lint():
id = uuid.uuid4()
filename = os.path.join("tmp", "{}.md".format(id))
with open(filename, "w+") as f:
f.write(request.values['text'... | Remove redundant 'api' from URL | Remove redundant 'api' from URL
| Python | bsd-3-clause | amperser/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint | ---
+++
@@ -8,7 +8,7 @@
app = Flask(__name__)
-@app.route('/api/v1/', methods=["GET"])
+@app.route('/v1/', methods=["GET"])
def lint():
id = uuid.uuid4() |
bea8b07180e6e9b2c786dfe37e12e75090363a1c | run.py | run.py | import os
import json
default_conf = {
'reddit': {
'username': '',
'password': '',
},
'twitter': {
'consumer_key': '',
'consumer_secret': '',
'access_token': '',
'access_secret': '',
},
}
if __name__ == '__main__':
if not os.path.isfile('config.json... | import os
import json
import sys
default_conf = {
'reddit': {
'username': '',
'password': '',
},
'twitter': {
'consumer_key': '',
'consumer_secret': '',
'access_token': '',
'access_secret': '',
},
}
def write_conf(conf):
config = json.dumps(conf, in... | Add twitter stuff to default config and allow easier merging of configs | Add twitter stuff to default config and allow easier merging of configs
| Python | mit | r3m0t/TweetPoster,joealcorn/TweetPoster,tytek2012/TweetPoster,aperson/TweetPoster | ---
+++
@@ -1,5 +1,6 @@
import os
import json
+import sys
default_conf = {
'reddit': {
@@ -15,10 +16,20 @@
}
+def write_conf(conf):
+ config = json.dumps(conf, indent=4, sort_keys=True)
+ with open('config.json', 'w') as f:
+ f.write(config)
+
+
if __name__ == '__main__':
if not os.p... |
9d65eaa14bc3f04ea998ed7bc43b7c71e5d232f7 | v3/scripts/testing/create-8gb-metadata.py | v3/scripts/testing/create-8gb-metadata.py | #!/usr/bin/env python
# -*- coding: utf8 -*-
__author__ = 'eric'
'''
Need to create some test data
'''
| #!/usr/bin/env python
# -*- coding: utf8 -*-
__author__ = 'eric'
'''
Need to create some test data
8 gigabytes dataset
'''
| Test script for generating metadata | Test script for generating metadata
| Python | mit | TheShellLand/pies,TheShellLand/pies | ---
+++
@@ -5,4 +5,6 @@
'''
Need to create some test data
+ 8 gigabytes dataset
'''
+ |
53d09ddacc92a52219a3cd18bba606840b870fcd | vumi_http_proxy/test/test_servicemaker.py | vumi_http_proxy/test/test_servicemaker.py | from vumi_http_proxy.servicemaker import Options, ProxyWorkerServiceMaker
from vumi_http_proxy import http_proxy
from twisted.trial import unittest
class TestOptions(unittest.TestCase):
def test_defaults(self):
options = Options()
options.parseOptions([])
self.assertEqual(options["port"], ... | from vumi_http_proxy.servicemaker import (
Options, ProxyWorkerServiceMaker, client)
from vumi_http_proxy import http_proxy
from twisted.trial import unittest
from vumi_http_proxy.test import helpers
class TestOptions(unittest.TestCase):
def test_defaults(self):
options = Options()
options.par... | Patch out DNS resolver in makeService tests. | Patch out DNS resolver in makeService tests.
| Python | bsd-3-clause | praekelt/vumi-http-proxy,praekelt/vumi-http-proxy | ---
+++
@@ -1,6 +1,8 @@
-from vumi_http_proxy.servicemaker import Options, ProxyWorkerServiceMaker
+from vumi_http_proxy.servicemaker import (
+ Options, ProxyWorkerServiceMaker, client)
from vumi_http_proxy import http_proxy
from twisted.trial import unittest
+from vumi_http_proxy.test import helpers
class... |
2cc55a25b13ac6575424ba70857a8419b796ca76 | _tests/macro_testing/runner.py | _tests/macro_testing/runner.py | # -*- coding: utf-8 -*-
import os, os.path
import sys
import unittest
from macrotest import JSONSpecMacroTestCaseFactory
def JSONTestCaseLoader(tests_path, recursive=False):
"""
Load JSON specifications for Jinja2 macro test cases from the given
path and returns the resulting test classes.
This fun... | # -*- coding: utf-8 -*-
import os, os.path
import sys
import unittest
from macrotest import JSONSpecMacroTestCaseFactory
def JSONTestCaseLoader(tests_path, recursive=False):
"""
Load JSON specifications for Jinja2 macro test cases from the given
path and returns the resulting test classes.
This fun... | Make the paths not relative, so tests can be run from anywhere. | Make the paths not relative, so tests can be run from anywhere.
| Python | cc0-1.0 | imuchnik/cfgov-refresh,imuchnik/cfgov-refresh,imuchnik/cfgov-refresh,imuchnik/cfgov-refresh | ---
+++
@@ -18,8 +18,9 @@
If `recursive` is True, it will also look in subdirectories. This is
not yet supported.
"""
+ path = os.path.abspath(os.path.join(os.path.dirname( __file__ ), tests_path))
- json_files = [f for f in os.listdir(tests_path) if f.endswith('.json')]
+ json_files = [f fo... |
2cde3dbb69077054c6422cbe96e9b996be700d29 | pulldb/api/subscriptions.py | pulldb/api/subscriptions.py | import json
import logging
from google.appengine.api import oauth
from google.appengine.ext import ndb
from pulldb import users
from pulldb.api.base import OauthHandler, JsonModel
from pulldb.base import create_app, Route
from pulldb.models.subscriptions import Subscription, subscription_context
class ListSubs(Oauth... | import json
import logging
from google.appengine.api import oauth
from google.appengine.ext import ndb
from pulldb import users
from pulldb.api.base import OauthHandler, JsonModel
from pulldb.base import create_app, Route
from pulldb.models.subscriptions import Subscription, subscription_context
class ListSubs(Oauth... | Make subscription handler less oauth dependant | Make subscription handler less oauth dependant
| Python | mit | xchewtoyx/pulldb | ---
+++
@@ -11,7 +11,7 @@
class ListSubs(OauthHandler):
def get(self):
- user_key = users.user_key(oauth.get_current_user(self.scope))
+ user_key = users.user_key(self.user)
query = Subscription.query(ancestor=user_key)
results = query.map(subscription_context)
self.re... |
a18eb7509619914cd0565255730ed6bb40f14c9b | ovp_users/emails.py | ovp_users/emails.py | from django.core.mail import EmailMultiAlternatives
from django.template import Context, Template
from django.template.loader import get_template
from django.conf import settings
import threading
class EmailThread(threading.Thread):
def __init__(self, msg):
self.msg = msg
threading.Thread.__init__(sel... | from ovp_core.emails import BaseMail
class UserMail(BaseMail):
"""
This class is responsible for firing emails for Users
"""
def sendWelcome(self, context={}):
"""
Sent when user registers
"""
return self.sendEmail('welcome', 'Welcome', context)
def sendRecoveryToken(self, context):
"""... | Move BaseMail from ovp-users to ovp-core | Move BaseMail from ovp-users to ovp-core
| Python | agpl-3.0 | OpenVolunteeringPlatform/django-ovp-users,OpenVolunteeringPlatform/django-ovp-users | ---
+++
@@ -1,50 +1,4 @@
-from django.core.mail import EmailMultiAlternatives
-from django.template import Context, Template
-from django.template.loader import get_template
-from django.conf import settings
-
-import threading
-
-class EmailThread(threading.Thread):
- def __init__(self, msg):
- self.msg = ms... |
d940faee24f01d18e398da0592d88bed3908a46d | ox_herd/__init__.py | ox_herd/__init__.py | """The ox_herd package provides a way for herding tests together (like oxen).
"""
VERSION = '0.6.10'
| """The ox_herd package provides a way for herding tests together (like oxen).
"""
VERSION = '0.6.11'
| Fix bug in showing form | Fix bug in showing form
| Python | bsd-2-clause | aocks/ox_herd,aocks/ox_herd,aocks/ox_herd | ---
+++
@@ -1,4 +1,4 @@
"""The ox_herd package provides a way for herding tests together (like oxen).
"""
-VERSION = '0.6.10'
+VERSION = '0.6.11' |
709d4386a308ce8c0767eab1f2174ec321ea59fd | client/main.py | client/main.py | import requests
import yaml
def runLoop( config ):
"""
Runs indefinitely. On user input (card swipe), will gather the card number,
send it to the server configured, and if it has been authorized, open the
relay with a GPIO call.
"""
while True:
swipe = input()
cardNumber = swipe
print( 'The last input wa... | import requests
import yaml
def runLoop( config ):
"""
Runs indefinitely. On user input (card swipe), will gather the card number,
send it to the server configured, and if it has been authorized, open the
relay with a GPIO call.
"""
while True:
swipe = input()
cardNumber = swipe
print( 'The last input wa... | Rename funciton to match corresponding HTTP request | Rename funciton to match corresponding HTTP request
| Python | mit | aradler/Card-lockout,aradler/Card-lockout,aradler/Card-lockout | ---
+++
@@ -15,7 +15,7 @@
print( 'The last input was ' + cardNumber )
try:
- res = queryServer( cardNumber, config )
+ res = requestAuthorization( cardNumber, config )
except requests.exceptions.Timeout:
print( "Server timeout!" )
continue
@@ -25,10 +25,11 @@
pass
-def queryServer( card... |
8960be78113ba122dbbac1ed26d82abf814bbfdf | src/lesson/main.py | src/lesson/main.py | # lesson/main.py
#
# This file is part of LESSON. LESSON is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2 or later.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# A... | # lesson/main.py
#
# This file is part of LESSON. LESSON is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2 or later.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# A... | Fix eclipse error message on mod_wsgi import | Fix eclipse error message on mod_wsgi import
Signed-off-by: Jonathan Dieter <ddc8e8b9809278692339ab749e05e6020a8d4c9a@lesbg.com> | Python | agpl-3.0 | lesbg/lesson-backend | ---
+++
@@ -26,7 +26,7 @@
mode = "debug"
try:
- from mod_wsgi import version
+ from mod_wsgi import version #@UnresolvedImport
print "Detected mod_wgi version %i.%i" % version
mode = "wsgi"
except: |
7206d68648c91790ac4fa14a3074c77c97c01636 | mopidy/backends/base/__init__.py | mopidy/backends/base/__init__.py | import logging
from .current_playlist import CurrentPlaylistController
from .library import LibraryController, BaseLibraryProvider
from .playback import PlaybackController, BasePlaybackProvider
from .stored_playlists import (StoredPlaylistsController,
BaseStoredPlaylistsProvider)
logger = logging.getLogger('mopid... | import logging
from .current_playlist import CurrentPlaylistController
from .library import LibraryController, BaseLibraryProvider
from .playback import PlaybackController, BasePlaybackProvider
from .stored_playlists import (StoredPlaylistsController,
BaseStoredPlaylistsProvider)
logger = logging.getLogger('mopid... | Remove mixer from the Backend API as it is independent | Remove mixer from the Backend API as it is independent
| Python | apache-2.0 | adamcik/mopidy,vrs01/mopidy,pacificIT/mopidy,jmarsik/mopidy,jcass77/mopidy,glogiotatidis/mopidy,kingosticks/mopidy,ZenithDK/mopidy,rawdlite/mopidy,glogiotatidis/mopidy,ZenithDK/mopidy,tkem/mopidy,kingosticks/mopidy,jmarsik/mopidy,SuperStarPL/mopidy,bencevans/mopidy,diandiankan/mopidy,quartz55/mopidy,glogiotatidis/mopid... | ---
+++
@@ -17,9 +17,6 @@
# :class:`mopidy.backends.base.LibraryController`.
library = None
- #: The sound mixer. An instance of :class:`mopidy.mixers.BaseMixer`.
- mixer = None
-
#: The playback controller. An instance of
#: :class:`mopidy.backends.base.PlaybackController`.
playback ... |
b24af9c3e4105d7acd2e9e13545f24d5a69ae230 | saleor/product/migrations/0018_auto_20161212_0725.py | saleor/product/migrations/0018_auto_20161212_0725.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-12 13:25
from __future__ import unicode_literals
from django.db import migrations
from django.utils.text import slugify
def create_slugs(apps, schema_editor):
Value = apps.get_model('product', 'AttributeChoiceValue')
for value in Value.objects.a... | # -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-12 13:25
from __future__ import unicode_literals
from django.db import migrations
from django.utils.text import slugify
def create_slugs(apps, schema_editor):
Value = apps.get_model('product', 'AttributeChoiceValue')
for value in Value.objects.a... | Allow to revert data migaration | Allow to revert data migaration
| Python | bsd-3-clause | KenMutemi/saleor,maferelo/saleor,jreigel/saleor,KenMutemi/saleor,jreigel/saleor,itbabu/saleor,itbabu/saleor,HyperManTT/ECommerceSaleor,UITools/saleor,tfroehlich82/saleor,KenMutemi/saleor,mociepka/saleor,car3oon/saleor,tfroehlich82/saleor,HyperManTT/ECommerceSaleor,itbabu/saleor,UITools/saleor,UITools/saleor,UITools/sal... | ---
+++
@@ -20,5 +20,5 @@
]
operations = [
- migrations.RunPython(create_slugs),
+ migrations.RunPython(create_slugs, migrations.RunPython.noop),
] |
9d0e9af5844772c18ca24d4012642d4518b66dfc | tests/test_judicious.py | tests/test_judicious.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `judicious` package."""
import pytest
import judicious
@pytest.fixture
def response():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixture.html
"""
# import requests
# return requests.get('https://github.com... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `judicious` package."""
import random
import pytest
import judicious
def test_seeding():
r1 = random.random()
r2 = random.random()
judicious.seed("70d911d5-6d93-3c42-f9a4-53e493a79bff")
r3 = random.random()
r4 = random.random()
jud... | Add test of seeding PRNG | Add test of seeding PRNG
| Python | mit | suchow/judicious,suchow/judicious,suchow/judicious | ---
+++
@@ -3,10 +3,32 @@
"""Tests for `judicious` package."""
+import random
+
import pytest
+import judicious
-import judicious
+
+def test_seeding():
+ r1 = random.random()
+ r2 = random.random()
+ judicious.seed("70d911d5-6d93-3c42-f9a4-53e493a79bff")
+ r3 = random.random()
+ r4 = random.... |
d46d908f5cfafcb6962207c45f923d3afb7f35a7 | pyrobus/__init__.py | pyrobus/__init__.py | from .robot import Robot
from .modules import *
| import logging
from .robot import Robot
from .modules import *
nh = logging.NullHandler()
logging.getLogger(__name__).addHandler(nh)
| Add null handler as default for logging. | Add null handler as default for logging.
| Python | mit | pollen/pyrobus | ---
+++
@@ -1,2 +1,8 @@
+import logging
+
from .robot import Robot
from .modules import *
+
+
+nh = logging.NullHandler()
+logging.getLogger(__name__).addHandler(nh) |
c220c0a474a660c4c1167d42fdd0d48599b1b593 | tests/test_pathutils.py | tests/test_pathutils.py | from os.path import join
import sublime
import sys
from unittest import TestCase
version = sublime.version()
try:
from libsass import pathutils
except ImportError:
from sublime_libsass.libsass import pathutils
class TestPathutils(TestCase):
def test_subpaths(self):
path = join('/foo','bar','baz'... | from os.path import join, realpath
import os
import sublime
import sys
from unittest import TestCase
from functools import wraps
def subl_patch(pkg, obj=None):
def subl_deco(fn):
@wraps(fn)
def wrap(*args):
nonlocal pkg
o = []
if obj != None:
o +... | Make custom patch in package to test | Make custom patch in package to test
| Python | mit | blitzrk/sublime_libsass,blitzrk/sublime_libsass | ---
+++
@@ -1,24 +1,41 @@
-from os.path import join
+from os.path import join, realpath
+import os
import sublime
import sys
from unittest import TestCase
+from functools import wraps
-version = sublime.version()
-try:
- from libsass import pathutils
-except ImportError:
- from sublime_libsass.libsass im... |
9eddd3b5c4635637faead9d7eae73efd2e324bdb | recipes/tests/test_views.py | recipes/tests/test_views.py | from django.core.urlresolvers import resolve
from django.http import HttpRequest
from django.template.loader import render_to_string
from django.test import TestCase
from recipes.views import home_page
from recipes.models import Recipe
class HomePageViewTest(TestCase):
def test_root_url_resolves_to_home_page_view... | from django.core.urlresolvers import resolve
from django.http import HttpRequest
from django.template.loader import render_to_string
from django.test import TestCase
from recipes.views import home_page
from recipes.models import Recipe
class HomePageViewTest(TestCase):
def test_root_url_resolves_to_home_page_view... | Use the test client to check all templates for correctness | Use the test client to check all templates for correctness
| Python | agpl-3.0 | XeryusTC/rotd,XeryusTC/rotd,XeryusTC/rotd | ---
+++
@@ -16,10 +16,8 @@
self.assertTemplateUsed(response, 'rotd/base.html')
def test_home_page_uses_correct_template(self):
- request = HttpRequest()
- response = home_page(request)
- expected = render_to_string('recipes/home.html')
- self.assertEqual(response.content.de... |
c1edc666630c03b6d85d9749e0695a9f19dd7c13 | src/collectd_scripts/handle_collectd_notification.py | src/collectd_scripts/handle_collectd_notification.py | #!/usr/bin/python
import sys
import os
import salt.client
def getNotification():
notification_dict = {}
isEndOfDictionary = False
for line in sys.stdin:
if not line.strip():
isEndOfDictionary = True
continue
if isEndOfDictionary:
break
key, value... | #!/usr/bin/python
import sys
import os
import salt.client
def getNotification():
notification_dict = {}
isEndOfDictionary = False
for line in sys.stdin:
if not line.strip():
isEndOfDictionary = True
continue
if isEndOfDictionary:
break
key, value... | Fix in collectd event notifier script. | Skynet: Fix in collectd event notifier script.
This patch adds a fix to collectd event notifier script,
by providing a value the "severity" field in the event
that it sends to salt-master event bus. with out that
event listener in the skyring server will fail to
process it.
Change-Id: I20b738468c8022a25024e4327434ae6... | Python | apache-2.0 | skyrings/skynet,skyrings/skynet | ---
+++
@@ -23,6 +23,7 @@
threshold_dict = {}
caller = salt.client.Caller()
threshold_dict['tags'], threshold_dict['message'] = getNotification()
+ threshold_dict['severity'] = threshold_dict['tags']["Severity"]
tag = "skyring/collectd/node/{0}/threshold/{1}/{2}".format(
threshold_dict... |
545812b5e31b4894c600b2b172640bea27947db8 | ecmd-core/pyecmd/test_api.py | ecmd-core/pyecmd/test_api.py | from pyecmd import *
with Ecmd(fapi2="ver1"):
t = loopTargets("pu", ECMD_SELECTED_TARGETS_LOOP)[0]
data = t.getScom(0x1234)
t.putScom(0x1234, 0x10100000)
# These interfaces may not be defined for some plugins
# Pull them to prevent compile issues
#core_id, thread_id = t.targetToSequenceId... | from pyecmd import *
extensions = {}
if hasattr(ecmd, "fapi2InitExtension"):
extensions["fapi2"] = "ver1"
with Ecmd(**extensions):
t = loopTargets("pu", ECMD_SELECTED_TARGETS_LOOP)[0]
data = t.getScom(0x1234)
t.putScom(0x1234, 0x10100000)
# These interfaces may not be defined for some plugins... | Make fapi2 test conditional on fapi2 being built into ecmd | pyecmd: Make fapi2 test conditional on fapi2 being built into ecmd
| Python | apache-2.0 | mklight/eCMD,mklight/eCMD,mklight/eCMD,mklight/eCMD,open-power/eCMD,open-power/eCMD,open-power/eCMD,open-power/eCMD,open-power/eCMD,mklight/eCMD | ---
+++
@@ -1,6 +1,10 @@
from pyecmd import *
-with Ecmd(fapi2="ver1"):
+extensions = {}
+if hasattr(ecmd, "fapi2InitExtension"):
+ extensions["fapi2"] = "ver1"
+
+with Ecmd(**extensions):
t = loopTargets("pu", ECMD_SELECTED_TARGETS_LOOP)[0]
data = t.getScom(0x1234)
t.putScom(0x1234, 0x101000... |
01e9df01bc17561d0f489f1647ce5e0c566372e5 | flocker/provision/__init__.py | flocker/provision/__init__.py | # Copyright Hybrid Logic Ltd. See LICENSE file for details.
"""
Provisioning for acceptance tests.
"""
from ._common import PackageSource
from ._install import provision
from ._rackspace import rackspace_provisioner
from ._aws import aws_provisioner
# import digitalocean_provisioner
__all__ = [
'PackageSource',... | # Copyright Hybrid Logic Ltd. See LICENSE file for details.
"""
Provisioning for acceptance tests.
"""
from ._common import PackageSource
from ._install import provision
from ._rackspace import rackspace_provisioner
from ._aws import aws_provisioner
from ._digitalocean import digitalocean_provisioner
__all__ = [
... | Make the digitalocean provisioner public | Make the digitalocean provisioner public
| Python | apache-2.0 | wallnerryan/flocker-profiles,1d4Nf6/flocker,hackday-profilers/flocker,moypray/flocker,mbrukman/flocker,hackday-profilers/flocker,agonzalezro/flocker,1d4Nf6/flocker,w4ngyi/flocker,moypray/flocker,agonzalezro/flocker,mbrukman/flocker,adamtheturtle/flocker,moypray/flocker,AndyHuu/flocker,achanda/flocker,lukemarsden/flocke... | ---
+++
@@ -8,10 +8,9 @@
from ._install import provision
from ._rackspace import rackspace_provisioner
from ._aws import aws_provisioner
-# import digitalocean_provisioner
+from ._digitalocean import digitalocean_provisioner
__all__ = [
'PackageSource', 'provision',
- 'rackspace_provisioner', 'aws_provi... |
1ba88cf7d087c2783306854ea3fbc16c5fe17df4 | wagtail/utils/compat.py | wagtail/utils/compat.py | def get_related_model(rel):
# In Django 1.7 and under, the related model is accessed by doing: rel.model
# This was renamed in Django 1.8 to rel.related_model. rel.model now returns
# the base model.
return getattr(rel, 'related_model', rel.model)
| import django
def get_related_model(rel):
# In Django 1.7 and under, the related model is accessed by doing: rel.model
# This was renamed in Django 1.8 to rel.related_model. rel.model now returns
# the base model.
if django.VERSION >= (1, 8):
return rel.related_model
else:
return r... | Check Django version instead of hasattr | Check Django version instead of hasattr
| Python | bsd-3-clause | mayapurmedia/wagtail,chrxr/wagtail,darith27/wagtail,mjec/wagtail,rv816/wagtail,rsalmaso/wagtail,stevenewey/wagtail,KimGlazebrook/wagtail-experiment,kurtw/wagtail,serzans/wagtail,m-sanders/wagtail,KimGlazebrook/wagtail-experiment,JoshBarr/wagtail,JoshBarr/wagtail,inonit/wagtail,kaedroho/wagtail,zerolab/wagtail,FlipperPA... | ---
+++
@@ -1,5 +1,11 @@
+import django
+
+
def get_related_model(rel):
# In Django 1.7 and under, the related model is accessed by doing: rel.model
# This was renamed in Django 1.8 to rel.related_model. rel.model now returns
# the base model.
- return getattr(rel, 'related_model', rel.model)
+ ... |
feecf02f831394747cdee63892d12811f137938c | elevator/api.py | elevator/api.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
class Handler(object):
def __init__(self, db):
# Each handlers is formatted following
# the pattern : [ command,
# default return value,
# raised error ]
self.handles = {
'GET': (db.Get... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
class Handler(object):
def __init__(self, db):
# Each handlers is formatted following
# the pattern : [ command,
# default return value,
# raised error ]
self.handles = {
'GET': (db.Get... | Fix : delete command call badly formatted in handler | Fix : delete command call badly formatted in handler
| Python | mit | oleiade/Elevator | ---
+++
@@ -20,7 +20,7 @@
if op_code in self.handles:
if len(self.handles[op_code]) == 2:
- return self.handles[op_code](*args)
+ value = self.handles[op_code][0](*args)
else:
# FIXME
# global except catching is a tot... |
c6f2ff563c08eb43ba3f33bc9aaa2647e78701d2 | fenced_code_plus/__init__.py | fenced_code_plus/__init__.py | from fenced_code_plus import FencedCodePlusExtension
from fenced_code_plus import makeExtension
| from __future__ import absolute_import
from fenced_code_plus.fenced_code_plus import FencedCodePlusExtension
from fenced_code_plus.fenced_code_plus import makeExtension
| Make import compatable with python3.5 | Make import compatable with python3.5
| Python | bsd-3-clause | amfarrell/fenced-code-plus | ---
+++
@@ -1,2 +1,4 @@
-from fenced_code_plus import FencedCodePlusExtension
-from fenced_code_plus import makeExtension
+from __future__ import absolute_import
+
+from fenced_code_plus.fenced_code_plus import FencedCodePlusExtension
+from fenced_code_plus.fenced_code_plus import makeExtension |
8b127a3d934470aa20fbff83d06ded2e37d00579 | deferrable/delay.py | deferrable/delay.py | """This may seem like a silly module right now, but we had to
separate this out so that deferrable.py and its sub-modules
could all import it without circular imports."""
MAXIMUM_DELAY_SECONDS = 900
| """This may seem like a silly module right now, but we had to
separate this out so that deferrable.py and its sub-modules
could all import it without circular imports."""
# SQS has a hard limit of 900 seconds, and Dockets
# delay queues incur heavy performance penalties,
# so this seems like a reasonable limit for all... | Add back some reasoning on the 900 number | Add back some reasoning on the 900 number
| Python | mit | gamechanger/deferrable | ---
+++
@@ -2,4 +2,7 @@
separate this out so that deferrable.py and its sub-modules
could all import it without circular imports."""
+# SQS has a hard limit of 900 seconds, and Dockets
+# delay queues incur heavy performance penalties,
+# so this seems like a reasonable limit for all
MAXIMUM_DELAY_SECONDS = 900 |
e2909520e93e85286bd4393426377e48db243615 | hastexo_social_auth/oauth2.py | hastexo_social_auth/oauth2.py | from social.backends.oauth import BaseOAuth2
class HastexoOAuth2(BaseOAuth2):
"""Hastexo OAuth2 authentication backend"""
name = 'hastexo'
AUTHORIZATION_URL = 'https://store.hastexo.com/o/authorize/'
ACCESS_TOKEN_URL = 'https://store.hastexo.com/o/token/'
ACCESS_TOKEN_METHOD = 'POST'
SCOPE_SE... | from social.backends.oauth import BaseOAuth2
class HastexoOAuth2(BaseOAuth2):
"""Hastexo OAuth2 authentication backend"""
name = 'hastexo'
AUTHORIZATION_URL = 'https://store.hastexo.com/o/authorize/'
ACCESS_TOKEN_URL = 'https://store.hastexo.com/o/token/'
ACCESS_TOKEN_METHOD = 'POST'
SCOPE_SE... | Update user details API call | Update user details API call
| Python | bsd-3-clause | hastexo/python-social-auth-hastexo,arbrandes/python-social-auth-hastexo | ---
+++
@@ -13,14 +13,14 @@
def get_user_details(self, response):
"""Return user details from hastexo account"""
return {
- 'username': response['username'],
+ 'username': response.get('username'),
'email': response.get('email', ''),
- 'first_name':... |
52cb80dd92ceabd7d2efe67c0a89f76cd701283b | statirator/main.py | statirator/main.py | import os
import sys
def main():
# init is a special case, cause we want to add statirator.core to
# INSTALLED_APPS, and have the command picked up. we'll handle it in here
if 'init' in sys.argv:
from django.conf import settings
settings.configure(INSTALLED_APPS=('statirator.core', ))
... | import os
import sys
def main():
if 'test' in sys.argv:
os.environ.setdefault(
"DJANGO_SETTINGS_MODULE", "statirator.test_settings")
else:
from django.conf import settings
settings.configure(INSTALLED_APPS=('statirator.core', ))
from django.core import management
m... | Add statirator.core for all commands except test | Add statirator.core for all commands except test
| Python | mit | MeirKriheli/statirator,MeirKriheli/statirator,MeirKriheli/statirator | ---
+++
@@ -3,15 +3,12 @@
def main():
- # init is a special case, cause we want to add statirator.core to
- # INSTALLED_APPS, and have the command picked up. we'll handle it in here
-
- if 'init' in sys.argv:
+ if 'test' in sys.argv:
+ os.environ.setdefault(
+ "DJANGO_SETTINGS_MODUL... |
c7ec2805d1c3dde9ff3bf8caacf0bac474a1d468 | cybox/utils.py | cybox/utils.py | #Common utility methods
#Test if a dictionary value is not None and has a length greater than 0
def test_value(value):
if value.get('value') is not None:
if value.get('value') is not None and len(str(value.get('value'))) > 0:
return True
else:
return False
else:
... | """Common utility methods"""
def test_value(value):
"""
Test if a dictionary contains a "value" key whose value is not None
and has a length greater than 0.
We explicitly want to return True even if the value is False or 0, since
some parts of the standards are boolean or allow a 0 value, and we w... | Clean up and document 'test_value' function. | Clean up and document 'test_value' function.
| Python | bsd-3-clause | CybOXProject/python-cybox | ---
+++
@@ -1,11 +1,13 @@
-#Common utility methods
+"""Common utility methods"""
-#Test if a dictionary value is not None and has a length greater than 0
def test_value(value):
- if value.get('value') is not None:
- if value.get('value') is not None and len(str(value.get('value'))) > 0:
- ret... |
1e690994c89b61f3331f6ccacff1dbc822a224a1 | homedisplay/display/views.py | homedisplay/display/views.py | from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.views.generic import View
from homedisplay.utils import publish_ws
class Wrapped(View):
def get(self, request, *args, **kwargs):
return ... | from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.views.generic import View
from homedisplay.utils import publish_ws
class Wrapped(View):
def get(self, request, *args, **kwargs):
return ... | Use renamed frame template file | Use renamed frame template file
| Python | bsd-3-clause | ojarva/home-info-display,ojarva/home-info-display,ojarva/home-info-display,ojarva/home-info-display | ---
+++
@@ -6,4 +6,4 @@
class Wrapped(View):
def get(self, request, *args, **kwargs):
- return render_to_response("index_frame.html", {"frame_src": "/homecontroller/display/content/%s" % kwargs.get("view") }, context_instance=RequestContext(request))
+ return render_to_response("frame.html", {"f... |
7cf32e0300735af93dfe0d90ac1e9c20adbc5cf5 | tests/b009_b010.py | tests/b009_b010.py | """
Should emit:
B009 - Line 17, 18, 19
B010 - Line 28, 29, 30
"""
# Valid getattr usage
getattr(foo, bar)
getattr(foo, "bar", None)
getattr(foo, "bar{foo}".format(foo="a"), None)
getattr(foo, "bar{foo}".format(foo="a"))
getattr(foo, bar, None)
getattr(foo, "123abc")
getattr(foo, "except")
# Invalid usage
getattr(foo... | """
Should emit:
B009 - Line 17, 18, 19
B010 - Line 28, 29, 30
"""
# Valid getattr usage
getattr(foo, bar)
getattr(foo, "bar", None)
getattr(foo, "bar{foo}".format(foo="a"), None)
getattr(foo, "bar{foo}".format(foo="a"))
getattr(foo, bar, None)
getattr(foo, "123abc")
getattr(foo, "except")
# Invalid usage
getattr(foo... | Fix wrong call method in test (GH-179) | Fix wrong call method in test (GH-179)
| Python | mit | ambv/flake8-bugbear,PyCQA/flake8-bugbear | ---
+++
@@ -22,7 +22,7 @@
setattr(foo, bar, None)
setattr(foo, "bar{foo}".format(foo="a"), None)
setattr(foo, "123abc", None)
-getattr(foo, "except", None)
+setattr(foo, "except", None)
# Invalid usage
setattr(foo, "bar", None) |
3fc94b4cffcfd08b439386fb2b01aa1e12fec6d5 | iati/core/tests/test_data.py | iati/core/tests/test_data.py | """A module containing tests for the library representation of IATI data."""
import iati.core.data
class TestDatasets(object):
"""A container for tests relating to Datasets"""
pass
| """A module containing tests for the library representation of IATI data."""
import iati.core.data
class TestDatasets(object):
"""A container for tests relating to Datasets"""
def test_dataset_no_params(self):
"""Test Dataset creation with no parameters."""
pass
def test_dataset_valid_xm... | Test stubs for dataset creation | Test stubs for dataset creation
| Python | mit | IATI/iati.core,IATI/iati.core | ---
+++
@@ -5,4 +5,62 @@
class TestDatasets(object):
"""A container for tests relating to Datasets"""
- pass
+ def test_dataset_no_params(self):
+ """Test Dataset creation with no parameters."""
+ pass
+
+ def test_dataset_valid_xml_string(self):
+ """Test Dataset creation with a... |
7f3476ec37fcea4195f1a180c1515fd321d78697 | tests/run_tests.py | tests/run_tests.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import nose
import logging
logging.disable(logging.DEBUG) # Disable debug logging when running the test suite.
def start(argv=None):
sys.exitfunc = lambda: sys.stderr.write('Shutting down...\n')
if argv is None:
argv = [
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import nose
import logging
logging.disable(logging.INFO) # Disable debug logging when running the test suite.
def start(argv=None):
sys.exitfunc = lambda: sys.stderr.write('Shutting down...\n')
if argv is None:
argv = [
... | Disable INFO messages and down when running test suite | Disable INFO messages and down when running test suite
| Python | mit | inonit/django-chemtrails,inonit/django-chemtrails,inonit/django-chemtrails | ---
+++
@@ -6,7 +6,7 @@
import nose
import logging
-logging.disable(logging.DEBUG) # Disable debug logging when running the test suite.
+logging.disable(logging.INFO) # Disable debug logging when running the test suite.
def start(argv=None): |
da314ab34cb13c1de66b96da2eab1484639e124b | fiona/compat.py | fiona/compat.py | try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
| import collections
from six.moves import UserDict
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
# Users can pass in objects that subclass a few different objects
# More specifically, rasterio has a CRS() class that subclasses UserDict()
# In Python 2 User... | Add a DICT_TYPES variable so we can do isinstance() checks against all the builtin dict-like objects | Add a DICT_TYPES variable so we can do isinstance() checks against all the builtin dict-like objects
| Python | bsd-3-clause | Toblerity/Fiona,rbuffat/Fiona,rbuffat/Fiona,Toblerity/Fiona | ---
+++
@@ -1,4 +1,12 @@
+import collections
+from six.moves import UserDict
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
+
+
+# Users can pass in objects that subclass a few different objects
+# More specifically, rasterio has a CRS() class that sub... |
1c2a981e007b9a205db1302370dff6a6ea15bf8c | iati/versions.py | iati/versions.py | """A module containing components that describe the IATI Standard itself (rather than the parts it is made up of)."""
import re
import iati.constants
class Version(object):
"""Representation of an IATI Standard Version Number."""
def __init__(self, version_string):
"""Initialise a Version Number.
... | """A module containing components that describe the IATI Standard itself (rather than the parts it is made up of)."""
import re
import iati.constants
class Version(object):
"""Representation of an IATI Standard Version Number."""
def __init__(self, version_string):
"""Initialise a Version Number.
... | Add a comment to make some sense of a regex | Add a comment to make some sense of a regex
| Python | mit | IATI/iati.core,IATI/iati.core | ---
+++
@@ -20,7 +20,8 @@
if not isinstance(version_string, str):
raise TypeError('A Version object must be created from a string, not a {0}'.format(type(version_string)))
- iati_version_re = re.compile(r'^((1\.0[1-9])|(((1\d+)|([2-9](\d+)?))\.0[1-9](\d+)?))$')
+ # a regex for wh... |
0ab048e8363a60d47ba780cb622a72343aaf65f2 | tests/test_urls.py | tests/test_urls.py | # -*- coding: utf-8 -*-
from django.conf.urls import include, url
from django.contrib import admin
from django.http.response import HttpResponse
admin.autodiscover()
def empty_view(request):
return HttpResponse()
urlpatterns = [
url(r'^home/', empty_view, name="home"),
url(r'^admin/', admin.site.urls)... | # -*- coding: utf-8 -*-
from django.conf.urls import include, url
from django.contrib import admin
from django.http.response import HttpResponse
admin.autodiscover()
def empty_view(request):
return HttpResponse()
urlpatterns = [
url(r'^home/', empty_view, name="home"),
url(r'^admin/', admin.site.urls)... | Remove useless url from test urls | Remove useless url from test urls
| Python | mit | pydanny/dj-stripe,kavdev/dj-stripe,dj-stripe/dj-stripe,kavdev/dj-stripe,pydanny/dj-stripe,dj-stripe/dj-stripe | ---
+++
@@ -16,7 +16,6 @@
url(r'^admin/', admin.site.urls),
url(r'^djstripe/', include("djstripe.urls", namespace="djstripe")),
url(r'^testapp/', include('tests.apps.testapp.urls')),
- url(r'^__debug__/', include('tests.apps.testapp.urls')),
url(
r'^testapp_namespaced/',
inclu... |
305d04fc0841035bf744480261017c14ae3045b0 | syntax_makefile.py | syntax_makefile.py | import wx.stc
ident = "makefile"
name = "Makefile"
extensions = ["Makefile", "*.mk"]
lexer = wx.stc.STC_LEX_MAKEFILE
indent = 8
use_tabs = True
stylespecs = (
(wx.stc.STC_STYLE_DEFAULT, ""),
)
keywords = ""
| import wx.stc
ident = "makefile"
name = "Makefile"
extensions = ["*Makefile", "*makefile", "*.mk"]
lexer = wx.stc.STC_LEX_MAKEFILE
indent = 8
use_tabs = True
stylespecs = (
(wx.stc.STC_STYLE_DEFAULT, ""),
)
keywords = ""
| Make files ending in makefile or Makefile. | Make files ending in makefile or Makefile.
| Python | mit | shaurz/devo | ---
+++
@@ -2,7 +2,7 @@
ident = "makefile"
name = "Makefile"
-extensions = ["Makefile", "*.mk"]
+extensions = ["*Makefile", "*makefile", "*.mk"]
lexer = wx.stc.STC_LEX_MAKEFILE
indent = 8
use_tabs = True |
19ac41a14875c6df2ed9ddf7b7b315ffb5c70819 | tests/specs/test_yaml_file.py | tests/specs/test_yaml_file.py | import unittest
try:
from unittest import mock
except ImportError:
import mock
from conda_env import env
from conda_env.specs.yaml_file import YamlFileSpec
class TestYAMLFile(unittest.TestCase):
def test_no_environment_file(self):
spec = YamlFileSpec(name=None, filename='not-a-file')
self... | import unittest
import random
try:
from unittest import mock
except ImportError:
import mock
from conda_env import env
from conda_env.specs.yaml_file import YamlFileSpec
class TestYAMLFile(unittest.TestCase):
def test_no_environment_file(self):
spec = YamlFileSpec(name=None, filename='not-a-file'... | Add more tests to YamlFile class | Add more tests to YamlFile class
| Python | bsd-3-clause | ESSS/conda-env,phobson/conda-env,conda/conda-env,asmeurer/conda-env,conda/conda-env,mikecroucher/conda-env,isaac-kit/conda-env,ESSS/conda-env,isaac-kit/conda-env,dan-blanchard/conda-env,phobson/conda-env,nicoddemus/conda-env,dan-blanchard/conda-env,asmeurer/conda-env,nicoddemus/conda-env,mikecroucher/conda-env | ---
+++
@@ -1,4 +1,5 @@
import unittest
+import random
try:
from unittest import mock
except ImportError:
@@ -19,6 +20,14 @@
self.assertTrue(spec.can_handle())
def test_get_environment(self):
- with mock.patch.object(env, 'from_file', return_value={}):
+ r = random.randint(10... |
ecc3a9c90d20699c6f0bf18600cf9bd755b56d65 | rollbar/contrib/fastapi/utils.py | rollbar/contrib/fastapi/utils.py | import logging
log = logging.getLogger(__name__)
class FastAPIVersionError(Exception):
def __init__(self, version, reason=''):
err_msg = f'FastAPI {version}+ is required'
if reason:
err_msg += f' {reason}'
log.error(err_msg)
return super().__init__(err_msg)
| import functools
import logging
import fastapi
log = logging.getLogger(__name__)
class FastAPIVersionError(Exception):
def __init__(self, version, reason=''):
err_msg = f'FastAPI {version}+ is required'
if reason:
err_msg += f' {reason}'
log.error(err_msg)
return sup... | Add decorator to check minimum required FastAPI version | Add decorator to check minimum required FastAPI version
| Python | mit | rollbar/pyrollbar | ---
+++
@@ -1,4 +1,7 @@
+import functools
import logging
+
+import fastapi
log = logging.getLogger(__name__)
@@ -11,3 +14,20 @@
log.error(err_msg)
return super().__init__(err_msg)
+
+
+class fastapi_min_version:
+ def __init__(self, min_version):
+ self.min_version = min_version
+
... |
e895795c6461da12f4824994168893ff131c0dd9 | runtests.py | runtests.py | import sys
import django
from django.conf import settings
APP_NAME = 'impersonate'
settings.configure(
DEBUG=True,
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
},
USE_TZ=True,
ROOT_URLCONF='{0}.tests'.format(APP_NAME),
MIDDLEWARE_CLASSES=(
... | import sys
import django
from django.conf import settings
APP_NAME = 'impersonate'
settings.configure(
DEBUG=True,
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
},
USE_TZ=True,
ROOT_URLCONF='{0}.tests'.format(APP_NAME),
MIDDLEWARE_CLASSES=(
... | Disable impersonation logging during testing | Disable impersonation logging during testing
| Python | bsd-3-clause | Top20Talent/django-impersonate,Top20Talent/django-impersonate | ---
+++
@@ -27,7 +27,7 @@
APP_NAME,
),
# turn off for testing, override in logging-specific tests
- IMPERSONATE_SESSION_LOGGING=False,
+ IMPERSONATE_DISABLE_LOGGING=True,
)
from django.test.utils import get_runner |
8582126efa9907b06e9f9b183a0919feba9fb6b0 | indra/literature/dart_client.py | indra/literature/dart_client.py | import logging
import requests
from indra.config import CONFIG_DICT
logger = logging.getLogger(__name__)
dart_uname = CONFIG_DICT['DART_WM_USERNAME']
dart_pwd = CONFIG_DICT['DART_WM_PASSWORD']
dart_url = 'https://indra-ingest-pipeline-rest-1.prod.dart.worldmodelers.com' \
'/dart/api/v1/readers/query'
... | import logging
import requests
from indra.config import get_config
logger = logging.getLogger(__name__)
dart_uname = get_config('DART_WM_USERNAME')
dart_pwd = get_config('DART_WM_PASSWORD')
dart_url = 'https://indra-ingest-pipeline-rest-1.prod.dart.worldmodelers.com' \
'/dart/api/v1/readers/query'
de... | Use get_config instead of CONFIG_DICT | Use get_config instead of CONFIG_DICT
| Python | bsd-2-clause | johnbachman/indra,johnbachman/belpy,johnbachman/belpy,sorgerlab/belpy,bgyori/indra,sorgerlab/belpy,johnbachman/indra,johnbachman/belpy,bgyori/indra,bgyori/indra,sorgerlab/indra,sorgerlab/indra,sorgerlab/indra,sorgerlab/belpy,johnbachman/indra | ---
+++
@@ -1,13 +1,13 @@
import logging
import requests
-from indra.config import CONFIG_DICT
+from indra.config import get_config
logger = logging.getLogger(__name__)
-dart_uname = CONFIG_DICT['DART_WM_USERNAME']
-dart_pwd = CONFIG_DICT['DART_WM_PASSWORD']
+dart_uname = get_config('DART_WM_USERNAME')
+da... |
33c595574921a64bec79de5ca72a62c22d09eb94 | django_todolist/todo/models.py | django_todolist/todo/models.py | from django.db import models
class Todo(models.Model):
"""
Todo Model: name, description, created
"""
name = models.CharField(max_length=100, unique=True)
description = models.TextField()
created = models.DateTimeField()
def __unicode__(self):
return self.name
| from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Todo(models.Model):
"""
Todo Model: name, description, created
"""
name = models.CharField(max_length=100, unique=True)
description = models.TextField()
created = model... | Add Python portability to model | Add Python portability to model
| Python | bsd-3-clause | andresgz/django_todolist,andresgz/django_todolist,andresgz/django_todolist,andresgz/django_todolist | ---
+++
@@ -1,6 +1,8 @@
from django.db import models
+from django.utils.encoding import python_2_unicode_compatible
+@python_2_unicode_compatible
class Todo(models.Model):
"""
Todo Model: name, description, created
@@ -9,5 +11,5 @@
description = models.TextField()
created = models.DateTimeFi... |
16cca2bc9aa8d5ecf6eb4d829de00905d3d15759 | conveyor/store.py | conveyor/store.py | class BaseStore(object):
def set(self, key, value):
raise NotImplementedError
def get(self, key):
raise NotImplementedError
class InMemoryStore(BaseStore):
def __init__(self, *args, **kwargs):
super(InMemoryStore, self).__init__(*args, **kwargs)
self._data = {}
def... | class BaseStore(object):
def set(self, key, value):
raise NotImplementedError
def get(self, key):
raise NotImplementedError
class InMemoryStore(BaseStore):
def __init__(self, *args, **kwargs):
super(InMemoryStore, self).__init__(*args, **kwargs)
self._data = {}
def... | Switch redis to use the from_url method | Switch redis to use the from_url method
| Python | bsd-2-clause | crateio/carrier | ---
+++
@@ -22,11 +22,11 @@
class RedisStore(BaseStore):
- def __init__(self, connection=None, prefix=None, *args, **kwargs):
+ def __init__(self, url=None, prefix=None, *args, **kwargs):
super(RedisStore, self).__init__(*args, **kwargs)
import redis
- self.redis = redis.StrictRe... |
ef42117ec2bd2a275dcea5f5a2d57322bbd21faa | wafer/talks/tests/fixtures.py | wafer/talks/tests/fixtures.py | from wafer.talks.models import Talk, TalkType
from wafer.tests.utils import create_user
def create_talk_type(name):
"""Create a talk type"""
return TalkType.objects.create(name=name)
def create_talk(title, status, username=None, user=None, talk_type=None):
if username:
user = create_user(usernam... | from wafer.talks.models import Talk, TalkType
from wafer.tests.utils import create_user
def create_talk_type(name):
"""Create a talk type"""
return TalkType.objects.create(name=name)
def create_talk(title, status, username=None, user=None, talk_type=None):
if sum((user is None, username is None)) != 1:
... | Check that user OR username is specified | Check that user OR username is specified
| Python | isc | CTPUG/wafer,CTPUG/wafer,CTPUG/wafer,CTPUG/wafer | ---
+++
@@ -8,6 +8,8 @@
def create_talk(title, status, username=None, user=None, talk_type=None):
+ if sum((user is None, username is None)) != 1:
+ raise ValueError('One of user OR username must be specified')
if username:
user = create_user(username)
talk = Talk.objects.create( |
2c41a2b37df94339074fdc04ccb3ef560d2e6cac | falmer/events/filters.py | falmer/events/filters.py | from django_filters import FilterSet, CharFilter, IsoDateTimeFilter, BooleanFilter, ModelChoiceFilter
from falmer.events.models import Curator
from . import models
class EventFilterSet(FilterSet):
class Meta:
model = models.Event
fields = (
'title',
'venue',
't... | from django_filters import FilterSet, CharFilter, IsoDateTimeFilter, BooleanFilter, ModelChoiceFilter
from falmer.events.models import Curator
from . import models
class EventFilterSet(FilterSet):
class Meta:
model = models.Event
fields = (
'title',
'venue',
't... | Use SG slug for event filtering | Use SG slug for event filtering
| Python | mit | sussexstudent/falmer,sussexstudent/falmer,sussexstudent/falmer,sussexstudent/falmer | ---
+++
@@ -33,6 +33,7 @@
brand = CharFilter(field_name='brand__slug')
bundle = CharFilter(field_name='bundle__slug')
+ student_group = CharFilter(field_name='student_group__slug')
to_time = IsoDateTimeFilter(field_name='start_time', lookup_expr='lte')
|
2e4e9ab2bab2e0a4bd00e10dcf115b1f96d1c714 | modules/urlparser/__init__.py | modules/urlparser/__init__.py | from modules import *
import re
import urllib2
import traceback
try:
import simplejson as json
except ImportError:
import json
from unidecode import unidecode
from twitter import Twitter
from bitly import Bitly
from youtube import Youtube
class Urlparser(Module):
"""Checks incoming messages for possible... | from modules import *
import re
import urllib2
import traceback
try:
import simplejson as json
except ImportError:
import json
from unidecode import unidecode
from twitter import Twitter
from bitly import Bitly
from youtube import Youtube
class Urlparser(Module):
"""Checks incoming messages for possible... | Include url message when fail to run urlparser | Include url message when fail to run urlparser
| Python | mit | billyvg/piebot | ---
+++
@@ -51,6 +51,6 @@
self.server.privmsg(event['target'], msg.encode('ascii', 'ignore'))
break
except:
- print "<<Error>> in Urlparser"
+ print "<<Error>> in Urlparser (%s)" % (event['message'])
print traceback.print_ex... |
a6d49059851450c7ea527941600564cb3f48cc72 | flask_profiler/storage/base.py | flask_profiler/storage/base.py |
class BaseStorage(object):
"""docstring for BaseStorage"""
def __init__(self):
super(BaseStorage, self).__init__()
def filter(self, criteria):
raise Exception("Not implemneted Error")
def getSummary(self, criteria):
raise Exception("Not implemneted Error")
def insert(sel... |
class BaseStorage(object):
"""docstring for BaseStorage"""
def __init__(self):
super(BaseStorage, self).__init__()
def filter(self, criteria):
raise Exception("Not implemneted Error")
def getSummary(self, criteria):
raise Exception("Not implemneted Error")
def insert(sel... | Add tuncate method to BaseStorage class | Add tuncate method to BaseStorage class
This will provide an interface for supporting any new database, there by, making the code more robust.
| Python | mit | muatik/flask-profiler | ---
+++
@@ -16,3 +16,6 @@
def delete(self, measurementId):
raise Exception("Not imlemented Error")
+
+ def truncate(self):
+ raise Exception("Not imlemented Error") |
d7299fd931ae62cc661b48dbc84aa161a395f1fa | fermipy/__init__.py | fermipy/__init__.py | import os
__version__ = "unknown"
try:
from version import get_git_version
__version__ = get_git_version()
except Exception as message:
print(message)
__author__ = "Matthew Wood"
PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
PACKAGE_DATA = os.path.join(PACKAGE_ROOT,'data')
os.environ['FERMIP... | from __future__ import absolute_import, division, print_function
import os
__version__ = "unknown"
try:
from .version import get_git_version
__version__ = get_git_version()
except Exception as message:
print(message)
__author__ = "Matthew Wood"
PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
P... | Fix version module import for Python 3 | Fix version module import for Python 3
| Python | bsd-3-clause | jefemagril/fermipy,jefemagril/fermipy,jefemagril/fermipy,fermiPy/fermipy | ---
+++
@@ -1,9 +1,10 @@
+from __future__ import absolute_import, division, print_function
import os
__version__ = "unknown"
try:
- from version import get_git_version
+ from .version import get_git_version
__version__ = get_git_version()
except Exception as message:
print(message) |
67795baac1f7eb10fbfc90fda5a9f54949af6c24 | ckanext/tayside/helpers.py | ckanext/tayside/helpers.py | from ckan import model
from ckan.plugins import toolkit
def _get_action(action, context_dict, data_dict):
return toolkit.get_action(action)(context_dict, data_dict)
def get_groups():
# Helper used on the homepage for showing groups
data_dict = {
'sort': 'package_count',
'limit': 7,
... | from ckan import model
from ckan.plugins import toolkit
def _get_action(action, context_dict, data_dict):
return toolkit.get_action(action)(context_dict, data_dict)
def get_groups():
# Helper used on the homepage for showing groups
data_dict = {
'sort': 'package_count',
'all_fields': Tr... | Remove limit of 7 groups in homepage | Remove limit of 7 groups in homepage
| Python | agpl-3.0 | ViderumGlobal/ckanext-tayside,ViderumGlobal/ckanext-tayside,ViderumGlobal/ckanext-tayside,ViderumGlobal/ckanext-tayside | ---
+++
@@ -11,7 +11,6 @@
data_dict = {
'sort': 'package_count',
- 'limit': 7,
'all_fields': True
}
groups = _get_action('group_list', {}, data_dict) |
46009d28e2b6285722287ccbeaa8d2f9c6c47fde | ldap_dingens/default_config.py | ldap_dingens/default_config.py | from datetime import timedelta
class DefaultConfiguration:
DEBUG = False
MAIL_SERVER = "localhost"
MAIL_PORT = 25
MAIL_USER = None
MAIL_PASSWORD = None
MAIL_CAFILE = None
INVITATION_SUBJECT = "Invitation to join the FSFW!"
TOKEN_BYTES = 5
TOKEN_LIFETIME = timedelta(days=7)
L... | from datetime import timedelta
class DefaultConfiguration:
DEBUG = False
MAIL_SERVER = "localhost"
MAIL_PORT = 25
MAIL_USER = None
MAIL_PASSWORD = None
MAIL_CAFILE = None
INVITATION_SUBJECT = "Invitation to join the FSFW!"
TOKEN_BYTES = 5
TOKEN_LIFETIME = timedelta(days=7)
L... | Remove pointless default values from DefaultConfiguration | Remove pointless default values from DefaultConfiguration
| Python | agpl-3.0 | fsfw-dresden/ldap-dingens,fsfw-dresden/ldap-dingens | ---
+++
@@ -16,16 +16,4 @@
LOGIN_LIFETIME = timedelta(days=2)
- #: Host name of the LDAP server
LDAP_SERVER = "localhost"
-
- #: str.format string to create a DN which refers to a user with a given
- #: loginname
- LDAP_USER_DN_FORMAT = "uid={loginname},ou=Account,dc=fsfw-dresden,dc=de"
-
- ... |
8fad8a4f1591fb4a7d7d1bdf932c5918197b475c | tests/client.py | tests/client.py | # -*- coding: utf-8 -*-
"""
Description: Client side of sanity check
Author: Mike Ellis
Copyright 2017 Owner
"""
from htmltree import *
def start():
console.log("Starting")
newcontent = H1("Sanity check PASS", _class='test', style=dict(color='green'))
console.log(newcontent.render(0))
document.body.inne... | # -*- coding: utf-8 -*-
"""
Description: Client side of sanity check
Uses JS functions insertAdjacentHTML, innerHTML and addEventListener.
See https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML
https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML
https://developer.mozilla.... | Fix <style> rendering under Transcrypt. | Fix <style> rendering under Transcrypt.
The hasattr test in renderCss() was failing when it shouldn't have.
Fixed by removal. Updated tests/client.py to create and append a style
element to detect problems related to Style() on the client side.
| Python | mit | Michael-F-Ellis/htmltree | ---
+++
@@ -1,15 +1,29 @@
# -*- coding: utf-8 -*-
"""
Description: Client side of sanity check
+Uses JS functions insertAdjacentHTML, innerHTML and addEventListener.
+See https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML
+ https://developer.mozilla.org/en-US/docs/Web/API/Element/innerH... |
e91eac0c667c74062672a1a2cdb7da2a910f8cf7 | InvenTree/users/serializers.py | InvenTree/users/serializers.py | from rest_framework import serializers
from django.contrib.auth.models import User
class UserSerializer(serializers.HyperlinkedModelSerializer):
""" Serializer for a User
"""
class Meta:
model = User
fields = ('username',
'first_name',
'last_name',
... | from rest_framework import serializers
from django.contrib.auth.models import User
class UserSerializer(serializers.HyperlinkedModelSerializer):
""" Serializer for a User
"""
class Meta:
model = User
fields = ('pk',
'username',
'first_name',
... | Include PK in user serializer | Include PK in user serializer
| Python | mit | inventree/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,inventree/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree | ---
+++
@@ -8,7 +8,8 @@
class Meta:
model = User
- fields = ('username',
+ fields = ('pk',
+ 'username',
'first_name',
'last_name',
'email',) |
bf9866e2c337f024fcc02de69456a235dc7ac07c | labs/lab-6/common.py | labs/lab-6/common.py | #!/usr/bin/env python
# Copyright 2014-2015 Boundary, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | #!/usr/bin/env python
# Copyright 2014-2015 Boundary, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | Add application id and static method for usage | Add application id and static method for usage
| Python | apache-2.0 | jdgwartney/tsi-lab,jdgwartney/tsi-lab,jdgwartney/tsi-lab,jdgwartney/tsi-lab,boundary/tsi-lab,boundary/tsi-lab,boundary/tsi-lab,boundary/tsi-lab | ---
+++
@@ -22,9 +22,11 @@
def __init__(self, ):
self.api = API()
self.usage_args = ""
+ # Set our application id from the environment variable
+ self.appl_id = os.environ['TSI_APPL_ID']
@staticmethod
- def usage(self, args):
+ def usage(args):
sys.stderr.wri... |
eec24c2cff1b588b957215a867a85a148f4e71e9 | tuneme/views.py | tuneme/views.py | from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.shortcuts import render
from molo.core.models import ArticlePage
from molo.commenting.models import MoloComment
from wagtail.wagtailsearch.models import Query
def search(request, results_per_page=10):
search_query = request.GET.... | from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.shortcuts import render
from django.utils.translation import get_language_from_request
from molo.core.utils import get_locale_code
from molo.core.models import ArticlePage
from molo.commenting.models import MoloComment
from wagtail.wa... | Add multi-languages support for search | Add multi-languages support for search
| Python | bsd-2-clause | praekelt/molo-tuneme,praekelt/molo-tuneme,praekelt/molo-tuneme,praekelt/molo-tuneme | ---
+++
@@ -1,6 +1,8 @@
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.shortcuts import render
+from django.utils.translation import get_language_from_request
+from molo.core.utils import get_locale_code
from molo.core.models import ArticlePage
from molo.commenting.models i... |
46fc6c7f8f63ce747a30a35bb5fb33ff2d53a2c0 | mackerel/host.py | mackerel/host.py | # -*- coding: utf-8 -*-
"""
mackerel.host
~~~~~~~~~~~~~
Mackerel client implemented by Pyton.
Ported from `mackerel-client-ruby`.
<https://github.com/mackerelio/mackerel-client-ruby>
:copyright: (c) 2014 Hatena, All rights reserved.
:copyright: (c) 2015 Shinya Ohyanagi, All rights reserve... | # -*- coding: utf-8 -*-
"""
mackerel.host
~~~~~~~~~~~~~
Mackerel client implemented by Pyton.
Ported from `mackerel-client-ruby`.
<https://github.com/mackerelio/mackerel-client-ruby>
:copyright: (c) 2014 Hatena, All rights reserved.
:copyright: (c) 2015 Shinya Ohyanagi, All rights reserve... | Add None if kwargs can not get. | Add None if kwargs can not get.
| Python | bsd-3-clause | heavenshell/py-mackerel-client | ---
+++
@@ -20,16 +20,16 @@
def __init__(self, **kwargs):
self.args = kwargs
- self.name = kwargs.get('name')
- self.meta = kwargs.get('meta')
- self.type = kwargs.get('type')
- self.status = kwargs.get('status')
- self.memo = kwargs.get('memo')
- self.is_reti... |
63a893add1170c1e90cdb8eaea6c1e1c6a3a8e0a | 9.py | 9.py | """Python challenge solution #9:
http://www.pythonchallenge.com/pc/return/good.html"""
def main():
pass
if __name__ == "__main__":
main()
| """Python challenge solution #9:
http://www.pythonchallenge.com/pc/return/good.html"""
import urllib
import urllib2
from PIL import Image, ImageDraw
un = 'huge'
pw = 'file'
url = 'http://www.pythonchallenge.com/pc/return/good.jpg'
def setup_auth_handler():
password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
... | Add authentication handler for opening image. | Add authentication handler for opening image.
| Python | mit | bm5w/pychal | ---
+++
@@ -1,10 +1,30 @@
"""Python challenge solution #9:
http://www.pythonchallenge.com/pc/return/good.html"""
+import urllib
+import urllib2
+from PIL import Image, ImageDraw
+un = 'huge'
+pw = 'file'
+url = 'http://www.pythonchallenge.com/pc/return/good.jpg'
+
+
+def setup_auth_handler():
+ password_mgr = ur... |
f3bbfd5221a3d7b3e394a70853d0a7dc1b5eeeac | knights/base.py | knights/base.py |
import ast
from . import parse
class Template:
def __init__(self, raw):
self.raw = raw
self.nodelist = parse.parse(raw)
code = ast.Expression(
body=ast.GeneratorExp(
elt=ast.Call(
func=ast.Name(id='str', ctx=ast.Load()),
... |
import ast
from . import parse
class Template:
def __init__(self, raw):
self.raw = raw
self.parser = parse.Parser(raw)
self.nodelist = self.parser()
code = ast.Expression(
body=ast.GeneratorExp(
elt=ast.Call(
func=ast.Name(id='str'... | Update Template for Parser class | Update Template for Parser class
| Python | mit | funkybob/knights-templater,funkybob/knights-templater | ---
+++
@@ -7,7 +7,8 @@
class Template:
def __init__(self, raw):
self.raw = raw
- self.nodelist = parse.parse(raw)
+ self.parser = parse.Parser(raw)
+ self.nodelist = self.parser()
code = ast.Expression(
body=ast.GeneratorExp( |
52d32849f4cd38ca7a0fcfc0418e9e9580dd426a | kimochiconsumer/views.py | kimochiconsumer/views.py | from pyramid.view import view_config
from pyramid.httpexceptions import (
HTTPNotFound,
)
@view_config(route_name='page', renderer='templates/page.mako')
@view_config(route_name='page_view', renderer='templates/page.mako')
def page_view(request):
if 'page_id' in request.matchdict:
data = request.kimoc... | from pyramid.view import view_config
from pyramid.httpexceptions import (
HTTPNotFound,
)
@view_config(route_name='page', renderer='templates/page.mako')
@view_config(route_name='page_view', renderer='templates/page.mako')
def page_view(request):
if 'page_id' in request.matchdict:
data = request.kimoc... | Use the gallery_image method for required information | Use the gallery_image method for required information
| Python | mit | matslindh/kimochi-consumer | ---
+++
@@ -25,7 +25,7 @@
@view_config(route_name='gallery_image_view', renderer='templates/gallery_image.mako')
def gallery_image_view(request):
- data = request.kimochi.gallery(request.matchdict['gallery_id'])
+ data = request.kimochi.gallery_image(request.matchdict['gallery_id'], request.matchdict['image... |
cc6ce477550152135eed5a9e35bca8144be10111 | groupmestats/plotly_helpers.py | groupmestats/plotly_helpers.py | import plotly
def try_saving_plotly_figure(figure, filename):
try:
plotly.plotly.image.save_as(figure, filename)
except plotly.exceptions.PlotlyError as e:
if 'The response from plotly could not be translated.'in str(e):
print("Failed to save plotly figure. <home>/.plotly/.credentia... | import plotly
def try_saving_plotly_figure(figure, filename):
try:
print("Saving plot to '%s'" % filename)
plotly.plotly.image.save_as(figure, filename)
except plotly.exceptions.PlotlyError as e:
if 'The response from plotly could not be translated.'in str(e):
print("Failed ... | Print when saving plot to file | Print when saving plot to file
| Python | mit | kjteske/groupmestats,kjteske/groupmestats | ---
+++
@@ -2,6 +2,7 @@
def try_saving_plotly_figure(figure, filename):
try:
+ print("Saving plot to '%s'" % filename)
plotly.plotly.image.save_as(figure, filename)
except plotly.exceptions.PlotlyError as e:
if 'The response from plotly could not be translated.'in str(e): |
e2ca99c9f3548fa0d4e46bdd3b309ebd0e658ffa | test/backend/wayland/conftest.py | test/backend/wayland/conftest.py | import contextlib
import os
from libqtile.backend.wayland.core import Core
from test.helpers import Backend
wlr_env = {
"WLR_BACKENDS": "headless",
"WLR_LIBINPUT_NO_DEVICES": "1",
"WLR_RENDERER_ALLOW_SOFTWARE": "1",
"WLR_RENDERER": "pixman",
}
@contextlib.contextmanager
def wayland_environment(outpu... | import contextlib
import os
import textwrap
from libqtile.backend.wayland.core import Core
from test.helpers import Backend
wlr_env = {
"WLR_BACKENDS": "headless",
"WLR_LIBINPUT_NO_DEVICES": "1",
"WLR_RENDERER_ALLOW_SOFTWARE": "1",
"WLR_RENDERER": "pixman",
}
@contextlib.contextmanager
def wayland_e... | Add Wayland Backend.fake_click and Backend.get_all_windows methods | Add Wayland Backend.fake_click and Backend.get_all_windows methods
These work by eval-ing in the test Qtile instance. It might be nicer to
instead make these cmd_s on the `Core` if/when we expose cmd_ methods
from the Core.
| Python | mit | ramnes/qtile,ramnes/qtile,qtile/qtile,qtile/qtile | ---
+++
@@ -1,5 +1,6 @@
import contextlib
import os
+import textwrap
from libqtile.backend.wayland.core import Core
from test.helpers import Backend
@@ -40,8 +41,15 @@
def fake_click(self, x, y):
"""Click at the specified coordinates"""
- raise NotImplementedError
+ self.manager.c.... |
33c26aab9ff4e391f9dde2bfe873f86db4ce126e | opal/tests/test_user_profile.py | opal/tests/test_user_profile.py | """
Tests for opal.models.UserProfile
"""
from django.test import TestCase
from django.contrib.auth.models import User
from opal.models import UserProfile, Team
class UserProfileTest(TestCase):
def setUp(self):
self.user = User(username='testing')
self.user.save()
self.profile, _ = UserP... | """
Tests for opal.models.UserProfile
"""
from django.contrib.auth.models import User
from django.test import TestCase
from mock import patch
from opal.models import UserProfile, Team
class UserProfileTest(TestCase):
def setUp(self):
self.user = User(username='testing')
self.user.save()
s... | Add tests for userprofile properties | Add tests for userprofile properties
| Python | agpl-3.0 | khchine5/opal,khchine5/opal,khchine5/opal | ---
+++
@@ -1,9 +1,9 @@
"""
Tests for opal.models.UserProfile
"""
+from django.contrib.auth.models import User
from django.test import TestCase
-
-from django.contrib.auth.models import User
+from mock import patch
from opal.models import UserProfile, Team
@@ -21,4 +21,14 @@
teams = list(Team.object... |
50fd28e67109f47893a6d38ede7f64758f3fe618 | consts/auth_type.py | consts/auth_type.py | class AuthType(object):
"""
An auth type defines what write privileges an authenticated agent has.
"""
EVENT_DATA = 0
MATCH_VIDEO = 1
EVENT_TEAMS = 2
EVENT_MATCHES = 3
EVENT_RANKINGS = 4
EVENT_ALLIANCES = 5
EVENT_AWARDS = 6
type_names = {
EVENT_DATA: "event data",
... | class AuthType(object):
"""
An auth type defines what write privileges an authenticated agent has.
"""
EVENT_DATA = 0 # DEPRECATED - USE FINER PERMISSIONS INSTEAD
MATCH_VIDEO = 1
EVENT_TEAMS = 2
EVENT_MATCHES = 3
EVENT_RANKINGS = 4
EVENT_ALLIANCES = 5
EVENT_AWARDS = 6
type_... | Add deprecation notice for AuthType.EVENT_DATA | Add deprecation notice for AuthType.EVENT_DATA
| Python | mit | tsteward/the-blue-alliance,tsteward/the-blue-alliance,bdaroz/the-blue-alliance,jaredhasenklein/the-blue-alliance,synth3tk/the-blue-alliance,bdaroz/the-blue-alliance,verycumbersome/the-blue-alliance,verycumbersome/the-blue-alliance,nwalters512/the-blue-alliance,nwalters512/the-blue-alliance,bdaroz/the-blue-alliance,the-... | ---
+++
@@ -2,7 +2,7 @@
"""
An auth type defines what write privileges an authenticated agent has.
"""
- EVENT_DATA = 0
+ EVENT_DATA = 0 # DEPRECATED - USE FINER PERMISSIONS INSTEAD
MATCH_VIDEO = 1
EVENT_TEAMS = 2
EVENT_MATCHES = 3 |
5c40cbfcb89649738945eda02c1bfb804e2ecdae | us_ignite/mailinglist/views.py | us_ignite/mailinglist/views.py | import hashlib
import mailchimp
from django.contrib import messages
from django.conf import settings
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from us_ignite.mailinglist.forms import EmailForm
def subscribe_email(email):
master = mailchimp.Mailchimp(settings.MAI... | import hashlib
import logging
import mailchimp
from django.contrib import messages
from django.conf import settings
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from us_ignite.mailinglist.forms import EmailForm
logger = logging.getLogger('us_ignite.mailinglist.views')
... | Improve handling of errors during mailing list subscription. | Improve handling of errors during mailing list subscription.
https://github.com/madewithbytes/us_ignite/issues/209
Any exception thrown by the mailchimp component will
be handled gracefully and logged.
| Python | bsd-3-clause | us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite | ---
+++
@@ -1,4 +1,5 @@
import hashlib
+import logging
import mailchimp
from django.contrib import messages
@@ -7,6 +8,8 @@
from django.template.response import TemplateResponse
from us_ignite.mailinglist.forms import EmailForm
+
+logger = logging.getLogger('us_ignite.mailinglist.views')
def subscribe_e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.