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 |
|---|---|---|---|---|---|---|---|---|---|---|
813ebbce962e7d59602a1f1693359b9d61bbef07 | byceps/services/email/service.py | byceps/services/email/service.py | """
byceps.services.email.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2017 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from typing import List, Optional
from ... import email
from ...typing import BrandID
from .models import EmailConfig
def find_sender_address_for_brand(br... | """
byceps.services.email.service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2017 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from typing import List, Optional
from ... import email
from ...typing import BrandID
from .models import EmailConfig
def find_sender_address_for_brand(br... | Return `None` if no email configuration exists for brand instead of raising an exception | Return `None` if no email configuration exists for brand instead of raising an exception
| Python | bsd-3-clause | homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps | ---
+++
@@ -17,6 +17,10 @@
def find_sender_address_for_brand(brand_id: BrandID) -> Optional[str]:
"""Return the configured sender e-mail address for the brand."""
config = EmailConfig.query.get(brand_id)
+
+ if config is None:
+ return None
+
return config.sender_address
|
7822598afa31f0f556766c53ecff27cb8aca76d6 | chipy_org/apps/meetings/utils.py | chipy_org/apps/meetings/utils.py | from django.core.exceptions import ObjectDoesNotExist
import requests
from apps.meetings.models import Meeting, RSVP
def meetup_meeting_sync(api_key, meetup_event_id):
url = "http://api.meetup.com/2/rsvps"
params = dict(key=api_key, event_id=meetup_event_id)
api_response = requests.get(url, params=params)... | from django.core.exceptions import ObjectDoesNotExist
import requests
from apps.meetings.models import Meeting, RSVP
def get_rsvp(meeting, meetup_member):
"""
Handles getting the rsvp instance to update from Meetup.
Will return a new instance if needed.
If there is a name collision, it will update th... | Handle name collisions from meetup by attaching the meetup id to the user. While not perfect, should be good enough. | Handle name collisions from meetup by attaching the meetup id to the user.
While not perfect, should be good enough.
| Python | mit | brianray/chipy.org,brianray/chipy.org,bharathelangovan/chipy.org,tanyaschlusser/chipy.org,chicagopython/chipy.org,agfor/chipy.org,brianray/chipy.org,tanyaschlusser/chipy.org,chicagopython/chipy.org,agfor/chipy.org,chicagopython/chipy.org,bharathelangovan/chipy.org,chicagopython/chipy.org,agfor/chipy.org,tanyaschlusser/... | ---
+++
@@ -1,6 +1,33 @@
from django.core.exceptions import ObjectDoesNotExist
import requests
from apps.meetings.models import Meeting, RSVP
+
+
+def get_rsvp(meeting, meetup_member):
+ """
+ Handles getting the rsvp instance to update from Meetup.
+ Will return a new instance if needed.
+
+ If there ... |
fb719c54a41d90e07b62c82d1995f9c3149b68ec | adhocracy4/projects/views.py | adhocracy4/projects/views.py | from django.views import generic
from rules.contrib import views as rules_views
from . import mixins, models
class ProjectDetailView(rules_views.PermissionRequiredMixin,
mixins.PhaseDispatchMixin,
generic.DetailView):
model = models.Project
permission_required... | from django.views import generic
from rules.contrib import views as rules_views
from . import mixins, models
class ProjectDetailView(rules_views.PermissionRequiredMixin,
mixins.PhaseDispatchMixin,
generic.DetailView):
model = models.Project
permission_required... | Remove project property which is already set by the PhaseDispatchMixin | Remove project property which is already set by the PhaseDispatchMixin
| Python | agpl-3.0 | liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4 | ---
+++
@@ -14,10 +14,3 @@
@property
def raise_exception(self):
return self.request.user.is_authenticated()
-
- @property
- def project(self):
- """
- Emulate ProjectMixin interface for template sharing.
- """
- return self.get_object() |
a910295b2cbffdcb78c99218a48cb0120ecc3085 | ynr/apps/ynr_refactoring/settings.py | ynr/apps/ynr_refactoring/settings.py | from .helpers.popolo_fields import simple_fields
SIMPLE_POPOLO_FIELDS = simple_fields
| from enum import Enum, unique
from .helpers.popolo_fields import simple_fields
SIMPLE_POPOLO_FIELDS = simple_fields
@unique
class PersonIdentifierFields(Enum):
email = "Email"
facebook_page_url = "Facebook Page"
facebook_personal_url = "Facebook Personal"
homepage_url = "Homepage"
linkedin_url =... | Add Enum for PersonIdentifier Fields | Add Enum for PersonIdentifier Fields
This is similar to the work to remove SimplePopoloFields from the
database layer. The values here are all the values we want in the
initial version of the "n-links" on the person page model.
One day we want to enable any type of link, specified by the user.
That's too big a change... | Python | agpl-3.0 | DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative | ---
+++
@@ -1,3 +1,19 @@
+from enum import Enum, unique
+
from .helpers.popolo_fields import simple_fields
SIMPLE_POPOLO_FIELDS = simple_fields
+
+
+@unique
+class PersonIdentifierFields(Enum):
+ email = "Email"
+ facebook_page_url = "Facebook Page"
+ facebook_personal_url = "Facebook Personal"
+ home... |
c8785033d313f0b6b78eff4bb01c7fa2df330f0d | djpjax/middleware.py | djpjax/middleware.py | import re
from djpjax.utils import strip_pjax_parameter
from django.conf import settings
import djpjax
class DjangoPJAXMiddleware(object):
def __init__(self):
djpjax_setting = getattr(settings, 'DJPJAX_DECORATE_URLS', [])
self.decorated_urls = tuple(
(re.compile(url_regex), getattr(d... | import re
from djpjax.utils import strip_pjax_parameter
from django.conf import settings
import djpjax
class DjangoPJAXMiddleware(object):
def __init__(self):
djpjax_setting = getattr(settings, 'DJPJAX_DECORATED_URLS', [])
self.decorated_urls = tuple(
(re.compile(url_regex), getattr(... | Change setting name to DJPJAX_DECORATED_URLS. | Change setting name to DJPJAX_DECORATED_URLS.
| Python | bsd-3-clause | AlexHill/djpj,AlexHill/djpj | ---
+++
@@ -8,7 +8,7 @@
class DjangoPJAXMiddleware(object):
def __init__(self):
- djpjax_setting = getattr(settings, 'DJPJAX_DECORATE_URLS', [])
+ djpjax_setting = getattr(settings, 'DJPJAX_DECORATED_URLS', [])
self.decorated_urls = tuple(
(re.compile(url_regex), getattr(dj... |
0b3499beebeb789323d293513fdfc98565f6e02a | examples/IPLoM_example.py | examples/IPLoM_example.py | # for local run, before pygraphc packaging
import sys
sys.path.insert(0, '../pygraphc/misc')
from IPLoM import *
RawLogPath = '/home/hudan/Git/labeled-authlog/dataset/161.166.232.17/'
RawLogFile = 'auth.log.anon'
OutputPath = './results'
para = Para(path=RawLogPath, logname=RawLogFile, save_path=OutputPath)
myparser ... | # for local run, before pygraphc packaging
import sys
sys.path.insert(0, '../pygraphc/misc')
from IPLoM import *
sys.path.insert(0, '../pygraphc/clustering')
from ClusterUtility import *
from ClusterEvaluation import *
ip_address = '161.166.232.17'
standard_path = '/home/hudan/Git/labeled-authlog/dataset/' + ip_addres... | Add evaluation metrics to example | Add evaluation metrics to example
| Python | mit | studiawan/pygraphc | ---
+++
@@ -2,13 +2,26 @@
import sys
sys.path.insert(0, '../pygraphc/misc')
from IPLoM import *
+sys.path.insert(0, '../pygraphc/clustering')
+from ClusterUtility import *
+from ClusterEvaluation import *
-RawLogPath = '/home/hudan/Git/labeled-authlog/dataset/161.166.232.17/'
-RawLogFile = 'auth.log.anon'
+ip_ad... |
f3f210b523f1733e48bb6316ecbb15e198dd503c | examples/field_example.py | examples/field_example.py | import graphene
class Person(graphene.Interface):
name = graphene.String()
age = graphene.ID()
class Patron(Person):
id = graphene.ID()
class Query(graphene.ObjectType):
patron = graphene.Field(Patron)
def resolve_patron(self, args, info):
return Patron(id=1, name='Demo')
schema = g... | import graphene
class Patron(graphene.ObjectType):
id = graphene.ID()
name = graphene.String()
age = graphene.ID()
class Query(graphene.ObjectType):
patron = graphene.Field(Patron)
def resolve_patron(self, args, info):
return Patron(id=1, name='Demo')
schema = graphene.Schema(query=Qu... | Modify the field example to remove the use of interface | Modify the field example to remove the use of interface
| Python | mit | sjhewitt/graphene,Globegitter/graphene,Globegitter/graphene,graphql-python/graphene,graphql-python/graphene,sjhewitt/graphene | ---
+++
@@ -1,13 +1,10 @@
import graphene
-class Person(graphene.Interface):
+class Patron(graphene.ObjectType):
+ id = graphene.ID()
name = graphene.String()
age = graphene.ID()
-
-
-class Patron(Person):
- id = graphene.ID()
class Query(graphene.ObjectType):
@@ -27,5 +24,4 @@
}
'''
resu... |
ed4666b0d1bf5b8f82e298dfb043cce158c4ba2f | morepath/tests/fixtures/template_unknown_extension_no_render.py | morepath/tests/fixtures/template_unknown_extension_no_render.py | import morepath
import os
from .template_engine import FormatLoader
class App(morepath.App):
pass
@App.path(path='{name}')
class Person(object):
def __init__(self, name):
self.name = name
@App.template_loader(extension='.unknown')
def get_template_loader(template_directories, settings):
return... | import morepath
import os
from .template_engine import FormatLoader
class App(morepath.App):
pass
@App.path(path='{name}')
class Person(object):
def __init__(self, name):
self.name = name
@App.template_loader(extension='.unknown')
def get_template_loader(template_directories, settings):
return... | Fix so that error under test actually gets triggered. | Fix so that error under test actually gets triggered.
| Python | bsd-3-clause | taschini/morepath,faassen/morepath,morepath/morepath | ---
+++
@@ -18,6 +18,11 @@
return FormatLoader(template_directories)
+@App.template_directory()
+def get_template_directory():
+ return 'templates'
+
+
@App.html(model=Person, template='person.unknown')
def person_default(self, request):
return { 'name': self.name } |
27fe9d6531a2e76affd9388db53c0433062a9cfa | photonix/photos/management/commands/create_library.py | photonix/photos/management/commands/create_library.py | import os
from pathlib import Path
from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand
from django.db.utils import IntegrityError
from photonix.photos.models import Library, LibraryPath, LibraryUser
from photonix.photos.utils.db import record_photo
from photonix.photos.u... | import os
from pathlib import Path
from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand
from django.db.utils import IntegrityError
from photonix.photos.models import Library, LibraryPath, LibraryUser
from photonix.photos.utils.db import record_photo
from photonix.photos.u... | Fix path cannot be set when creating new library | Fix path cannot be set when creating new library | Python | agpl-3.0 | damianmoore/photo-manager,damianmoore/photo-manager,damianmoore/photo-manager,damianmoore/photo-manager | ---
+++
@@ -16,7 +16,7 @@
class Command(BaseCommand):
help = 'Create a library for a user'
- def create_library(self, username, library_name):
+ def create_library(self, username, library_name, path):
# Get user
user = User.objects.get(username=username)
# Create Library
@@ -2... |
93756f6f72d9f797c058bedcb3d6d7546a5a83f3 | server/management/commands/friendly_model_name.py | server/management/commands/friendly_model_name.py | '''
Retrieves the firendly model name for machines that don't have one yet.
'''
from django.core.management.base import BaseCommand, CommandError
from server.models import Machine
from django.db.models import Q
import server.utils as utils
class Command(BaseCommand):
help = 'Retrieves friendly model names for ma... | """Retrieves the friendly model name for machines that don't have one yet."""
from django.core.management.base import BaseCommand, CommandError
from django.db.models import Q
import server.utils as utils
from server.models import Machine
class Command(BaseCommand):
help = 'Retrieves friendly model names for mac... | Fix missing paren, imports, spelling. | Fix missing paren, imports, spelling.
| Python | apache-2.0 | sheagcraig/sal,salopensource/sal,salopensource/sal,salopensource/sal,sheagcraig/sal,sheagcraig/sal,sheagcraig/sal,salopensource/sal | ---
+++
@@ -1,11 +1,10 @@
-'''
-Retrieves the firendly model name for machines that don't have one yet.
-'''
+"""Retrieves the friendly model name for machines that don't have one yet."""
from django.core.management.base import BaseCommand, CommandError
+from django.db.models import Q
+
+import server.utils as uti... |
ab41dfa53325ee90032c4ed1b2e6e3c90b808ecf | contact/views.py | contact/views.py | import binascii
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib import messages
from django.db import IntegrityError, transaction
from django.conf import settings
from django.template.loader import render_to_string
from django.core.mail import send_mail
from django.core.urlresolve... | import binascii
from django.shortcuts import render
from django.contrib import messages
from django.core.mail import send_mail
from contact.forms import ContactForm
# Create your views here.
def contact(request):
form_init = {
'username': request.user.username,
'ip_address': request.ME... | Clean up import, pre-fill email address | Clean up import, pre-fill email address
If user is logged in, their email address is automatically filled in for them.
Also fixed an error with the messages usage, namely I forgot to pass in the request object.
| Python | mit | Kromey/akwriters,Kromey/akwriters,Kromey/fbxnano,Kromey/fbxnano,Kromey/fbxnano,Kromey/fbxnano,Kromey/akwriters,Kromey/akwriters | ---
+++
@@ -1,14 +1,9 @@
import binascii
-from django.shortcuts import render, redirect, get_object_or_404
+from django.shortcuts import render
from django.contrib import messages
-from django.db import IntegrityError, transaction
-from django.conf import settings
-from django.template.loader import render_to_s... |
0f4dc67fb9522801f010853d25939c0ef531f8ff | lbrynet/__init__.py | lbrynet/__init__.py | import logging
__version__ = "0.16.0rc7"
version = tuple(__version__.split('.'))
logging.getLogger(__name__).addHandler(logging.NullHandler())
| import logging
__version__ = "0.16.0rc8"
version = tuple(__version__.split('.'))
logging.getLogger(__name__).addHandler(logging.NullHandler())
| Bump version 0.16.0rc7 --> 0.16.0rc8 | Bump version 0.16.0rc7 --> 0.16.0rc8
Signed-off-by: Jack Robison <40884020c67726395ea162083a125620dc32cdab@lbry.io>
| Python | mit | lbryio/lbry,lbryio/lbry,lbryio/lbry | ---
+++
@@ -1,6 +1,6 @@
import logging
-__version__ = "0.16.0rc7"
+__version__ = "0.16.0rc8"
version = tuple(__version__.split('.'))
logging.getLogger(__name__).addHandler(logging.NullHandler()) |
7641293947dba9f721cdd0364a638b9f7714033a | examples/pax_mininet_node.py | examples/pax_mininet_node.py | # coding: latin-1
"""
pax_mininet_node.py: Defines PaxNode which allows Pax to behave as the sole packet hander on a node.
"""
from mininet.node import Node
from mininet.log import info, warn
class PaxNode( Node ):
"PaxNode: A node which allows Pax to behave as the sole packet hander on that node."
def __in... | # coding: latin-1
"""
pax_mininet_node.py: Defines PaxNode which allows Pax to behave as the sole packet hander on a node.
"""
from mininet.node import Node
from mininet.log import info, warn
class PaxNode( Node ):
"PaxNode: A node which allows Pax to behave as the sole packet hander on that node."
def __in... | Fix bug in Pax Mininet node class | Fix bug in Pax Mininet node class
| Python | apache-2.0 | niksu/pax,TMVector/pax,niksu/pax,niksu/pax,TMVector/pax | ---
+++
@@ -23,9 +23,9 @@
for intf in self.intfList():
self.cmd("iptables -A INPUT -p tcp -i %s -j DROP" % intf.name)
- def terminate( self ):
+ def terminate(self):
# Remove iptables rules
for intf in self.intfList():
- runCmd(net, nat0, "iptables -D INPUT -p tc... |
bc979e995162c441cd37b3368154e5ed842694f5 | cartoframes/core/logger.py | cartoframes/core/logger.py | import sys
import logging
def init_logger():
logging.basicConfig(
stream=sys.stdout,
format='%(asctime)s - %(levelname)s - %(message)s',
level=logging.INFO)
return logging.getLogger('CARTOframes')
def set_log_level(level):
"""Set the level of the log in the library.
Args:
... | import sys
import logging
def init_logger(formatter):
handler = logging.StreamHandler(sys.stdout)
handler.setFormatter(logging.Formatter(formatter))
logging.basicConfig(
level=logging.INFO,
handlers=[handler])
return handler, logging.getLogger('CARTOframes')
handler, log = init_logge... | Apply long log formatter only in debug | Apply long log formatter only in debug
| Python | bsd-3-clause | CartoDB/cartoframes,CartoDB/cartoframes | ---
+++
@@ -2,12 +2,16 @@
import logging
-def init_logger():
+def init_logger(formatter):
+ handler = logging.StreamHandler(sys.stdout)
+ handler.setFormatter(logging.Formatter(formatter))
logging.basicConfig(
- stream=sys.stdout,
- format='%(asctime)s - %(levelname)s - %(message)s',
- ... |
09a78126595ff355f59f70e4f381c3e2c4bef045 | apps/innovate/tests/test_views.py | apps/innovate/tests/test_views.py | from django.core.urlresolvers import reverse
from django.test import Client
from projects.models import Project
from innovate import urls
def test_routes():
c = Client()
for pattern in urls.urlpatterns:
response = c.get(reverse(pattern.name))
assert response.status_code == 301
assert ... | from django.core.urlresolvers import reverse
from django.test import Client
from django.test.client import RequestFactory
from projects.models import Project
from innovate import urls
from innovate.views import handle404, handle500
def test_routes():
c = Client()
for pattern in urls.urlpatterns:
resp... | Add tests for the 404 and 500 error handlers. | Add tests for the 404 and 500 error handlers.
| Python | bsd-3-clause | mozilla/mozilla-ignite,mozilla/mozilla-ignite,mozilla/mozilla-ignite,mozilla/mozilla-ignite | ---
+++
@@ -1,8 +1,10 @@
from django.core.urlresolvers import reverse
from django.test import Client
+from django.test.client import RequestFactory
from projects.models import Project
from innovate import urls
+from innovate.views import handle404, handle500
def test_routes():
@@ -28,3 +30,14 @@
respo... |
536746eaf35f4a2899a747bfe0b1e8918f9ec8c9 | httoop/header/__init__.py | httoop/header/__init__.py | # -*- coding: utf-8 -*-
"""HTTP headers
.. seealso:: :rfc:`2616#section-2.2`
.. seealso:: :rfc:`2616#section-4.2`
.. seealso:: :rfc:`2616#section-14`
"""
__all__ = ['Headers']
# FIXME: python3?
# TODO: add a MAXIMUM of 500 headers?
import inspect
from httoop.header.element import HEADER, HeaderElement, HeaderTyp... | # -*- coding: utf-8 -*-
"""HTTP headers
.. seealso:: :rfc:`2616#section-2.2`
.. seealso:: :rfc:`2616#section-4.2`
.. seealso:: :rfc:`2616#section-14`
"""
__all__ = ['Headers']
# FIXME: python3?
# TODO: add a MAXIMUM of 500 headers?
import inspect
from httoop.header.element import HEADER, HeaderElement, HeaderTyp... | Add all header elements to httoop.header | Add all header elements to httoop.header
| Python | mit | spaceone/httoop,spaceone/httoop,spaceone/httoop | ---
+++
@@ -31,3 +31,4 @@
for _, member in (member for type_ in types for member in inspect.getmembers(type_, inspect.isclass)):
if isinstance(member, HeaderType) and member is not HeaderElement:
HEADER[member.__name__] = member
+ globals()[_] = member |
fe451116ffcb12621600310b6d4ca9b6316494ff | scripts/zpe.py | scripts/zpe.py | import logging
from vaspy.iter import OutCar
_logger = logging.getLogger("vaspy.script")
if "__main__" == __name__:
outcar = OutCar()
poscar = outcar.poscar
freq_types = outcar.freq_types
# Frequency info.
_logger.info("{:<10s}{:<20s}".format("atom", "freq_type"))
_logger.info("-"*25)
i... | import logging
from vaspy.iter import OutCar
_logger = logging.getLogger("vaspy.script")
if "__main__" == __name__:
outcar = OutCar()
poscar = outcar.poscar
freq_types = outcar.freq_types
# Frequency info.
_logger.info("{:<10s}{:<10s}{:<20s}".format("atom", "type", "freq_type"))
_logger.info... | Add atom type info output. | Add atom type info output.
| Python | mit | PytLab/VASPy,PytLab/VASPy | ---
+++
@@ -10,14 +10,21 @@
freq_types = outcar.freq_types
# Frequency info.
- _logger.info("{:<10s}{:<20s}".format("atom", "freq_type"))
- _logger.info("-"*25)
+ _logger.info("{:<10s}{:<10s}{:<20s}".format("atom", "type", "freq_type"))
+ _logger.info("-"*35)
+
+ # Get atom types.
+ atom... |
24fe59c0f5df9343337549eb4495d6ca0e1e58d1 | iconizer/iconizer_main.py | iconizer/iconizer_main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from iconizer.console.launcher import CrossGuiLauncher
from iconizer.qtconsole.PyQtGuiFactory import PyQtGuiFactory
class Iconizer(object):
def __init__(self):
self.server = CrossGuiLauncher(PyQtGuiFactory())
self.server.start()
self.server.sta... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from iconizer.console.launcher import CrossGuiLauncher
from iconizer.qtconsole.PyQtGuiFactory import PyQtGuiFactory
class Iconizer(object):
def start_gui(self):
self.server = CrossGuiLauncher(PyQtGuiFactory())
self.server.start()
self.server.st... | Move GUI creation out of __init__ function. | Move GUI creation out of __init__ function.
| Python | bsd-3-clause | weijia/iconizer | ---
+++
@@ -5,7 +5,7 @@
class Iconizer(object):
- def __init__(self):
+ def start_gui(self):
self.server = CrossGuiLauncher(PyQtGuiFactory())
self.server.start()
self.server.start_cross_gui_launcher_no_return()
@@ -16,7 +16,7 @@
def main():
- Iconizer()
+ Iconizer().st... |
3b5feba4141dab974f7e6e343af76694e49246d4 | app/settings/prod.py | app/settings/prod.py | import dj_database_url
from .default import *
DEBUG = False
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY', None)
ALLOWED_HOSTS = ['agendaodonto.herokuapp.com']
DATABASES = {'default': dj_database_url.config()}
CORS_ORIGIN_WHITELIST = (
'https://agendaodonto.com',
'https://backend.agendaodonto.com',
)
DJOSER[... | import dj_database_url
from .default import *
DEBUG = False
SECRET_KEY = os.getenv('DJANGO_SECRET_KEY', None)
ALLOWED_HOSTS = ['agendaodonto.herokuapp.com']
DATABASES = {'default': dj_database_url.config()}
CORS_ORIGIN_WHITELIST = (
'agendaodonto.com',
'backend.agendaodonto.com',
)
DJOSER['DOMAIN'] = 'age... | Remove the scheme from the domain | fix: Remove the scheme from the domain
| Python | agpl-3.0 | agendaodonto/server,agendaodonto/server | ---
+++
@@ -10,8 +10,8 @@
DATABASES = {'default': dj_database_url.config()}
CORS_ORIGIN_WHITELIST = (
- 'https://agendaodonto.com',
- 'https://backend.agendaodonto.com',
+ 'agendaodonto.com',
+ 'backend.agendaodonto.com',
)
DJOSER['DOMAIN'] = 'agendaodonto.com' |
dad3eb5c1b0e188671884e97260422a90bdd5c21 | gitcommitautosave.py | gitcommitautosave.py | """Git Commit Auto Save.
Sublime Text 3 package to auto save commit messages when the window is closed.
This allows the user to close the window without having to save before,
or having to deal with the "Save File" popup.
"""
import sublime_plugin
class GitCommitAutoSave(sublime_plugin.EventListener):
def on_load(s... | """Git Commit Auto Save.
Sublime Text 3 package to auto save commit messages when the window is closed.
This allows the user to close the window without having to save before,
or having to deal with the "Save File" popup.
"""
import sublime_plugin
class GitCommitAutoSave(sublime_plugin.EventListener):
def on_load(s... | Fix 'NoneType' object has no attribute 'endswith' | Fix 'NoneType' object has no attribute 'endswith'
| Python | mit | aristidesfl/sublime-git-commit-message-auto-save | ---
+++
@@ -9,9 +9,9 @@
class GitCommitAutoSave(sublime_plugin.EventListener):
def on_load(self, view):
- if view.file_name().endswith('COMMIT_EDITMSG'):
+ if view.file_name() and view.file_name().endswith('COMMIT_EDITMSG'):
view.set_scratch(True) # disable save file dialog on exit
def on_pre_close(se... |
c300453131360ef9c48586f48287d6c24b3a94a2 | jsonrpcclient/__init__.py | jsonrpcclient/__init__.py | """__init__.py"""
from .request import Request, Notification
| """__init__.py"""
from .request import Request, Notification
from .http_client import HTTPClient
def request(endpoint, method, *args, **kwargs):
"""
A convenience function. Instantiates and executes a HTTPClient request, then
throws it away.
"""
return HTTPClient(endpoint).request(method, *args, *... | Add convenience functions 'request' and 'notify' | Add convenience functions 'request' and 'notify'
Closes #54
| Python | mit | bcb/jsonrpcclient | ---
+++
@@ -1,2 +1,19 @@
"""__init__.py"""
from .request import Request, Notification
+from .http_client import HTTPClient
+
+
+def request(endpoint, method, *args, **kwargs):
+ """
+ A convenience function. Instantiates and executes a HTTPClient request, then
+ throws it away.
+ """
+ return HTTPCli... |
aecaecfa20caba28af1e8117ffc14eeb6460872e | deployment/config.py | deployment/config.py | class Azure:
resource_group = "MajavaShakki"
location = "northeurope"
cosmosdb_name = f"{resource_group}mongo".lower()
plan_name = f"{resource_group}Plan"
site_name = f"{resource_group}Site"
class Mongo:
database_name = "Majavashakki"
collection_throughput = 400
system_indexes_collection = "undefined" ... | class Azure:
resource_group = "MajavaShakki"
location = "northeurope"
cosmosdb_name = f"{resource_group}mongo".lower()
plan_name = f"{resource_group}Plan"
site_name = f"{resource_group}Site"
class Mongo:
database_name = "Majavashakki"
collection_throughput = 400
system_indexes_collection = "undefined" ... | Configure throughput for games collection | Configure throughput for games collection
The collection gamemodels should be deleted when it is no longer in use
| Python | mit | Majavapaja/Mursushakki,Majavapaja/Mursushakki,Majavapaja/Mursushakki,Majavapaja/Mursushakki,Majavapaja/Mursushakki,Majavapaja/Mursushakki | ---
+++
@@ -9,4 +9,4 @@
database_name = "Majavashakki"
collection_throughput = 400
system_indexes_collection = "undefined" # https://github.com/Automattic/mongoose/issues/6989
- collections = ["gamemodels", "sessions", "users", system_indexes_collection]
+ collections = ["games", "gamemodels", "sessions", ... |
91b9e5d71c323be2e5e0d1aa16e47cc49d45acc4 | likes/middleware.py | likes/middleware.py | try:
from hashlib import md5
except ImportError:
from md5 import md5
from django.http import HttpResponseBadRequest
from secretballot.middleware import SecretBallotIpUseragentMiddleware
class SecretBallotUserIpUseragentMiddleware(SecretBallotIpUseragentMiddleware):
def generate_token(self, request):
... | try:
from hashlib import md5
except ImportError:
from md5 import md5
from django.http import HttpResponseBadRequest
from secretballot.middleware import SecretBallotIpUseragentMiddleware
class SecretBallotUserIpUseragentMiddleware(SecretBallotIpUseragentMiddleware):
def generate_token(self, request):
... | Fix hashing for Python 3 | Fix hashing for Python 3
| Python | bsd-3-clause | Afnarel/django-likes,Afnarel/django-likes,Afnarel/django-likes | ---
+++
@@ -15,7 +15,7 @@
return request.user.username
else:
try:
- s = u''.join((request.META['REMOTE_ADDR'], request.META['HTTP_USER_AGENT']))
- return md5(s).hexdigest()
+ s = ''.join((request.META['REMOTE_ADDR'], request.META['HTTP_US... |
c62e1b325a536294b3285f8cbcad7d66a415ee23 | heat/objects/base.py | heat/objects/base.py | # Copyright 2015 Intel Corp.
#
# 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 agr... | # Copyright 2015 Intel Corp.
#
# 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 agr... | Use a weakref for the data object context | Use a weakref for the data object context
There are no known circular reference issues caused by storing the
context in data objects, but the following changes will refer to data
objects in the context, so this change prevents any later issues.
Change-Id: I3680e5678003cf339a98fbb7a2b1b387fb2243c0
Related-Bug: #157885... | Python | apache-2.0 | noironetworks/heat,openstack/heat,openstack/heat,cwolferh/heat-scratch,noironetworks/heat,cwolferh/heat-scratch | ---
+++
@@ -14,9 +14,26 @@
"""Heat common internal object model"""
+import weakref
+
from oslo_versionedobjects import base as ovoo_base
class HeatObject(ovoo_base.VersionedObject):
OBJ_PROJECT_NAMESPACE = 'heat'
VERSION = '1.0'
+
+ @property
+ def _context(self):
+ if self._contextr... |
c6dae4cbd8d8dcbcd323526c2811fea9525bcb74 | __init__.py | __init__.py | import spyral.memoize
import spyral.point
import spyral.camera
import spyral.util
import spyral.sprite
import spyral.gui
import spyral.scene
import spyral._lib
import pygame
director = scene.Director()
def init():
pygame.init()
pygame.font.init() | import spyral.memoize
import spyral.point
import spyral.camera
import spyral.util
import spyral.sprite
import spyral.gui
import spyral.scene
import spyral._lib
import spyral.event
import pygame
director = scene.Director()
def init():
pygame.init()
pygame.font.init() | Add an event module import | Add an event module import
| Python | lgpl-2.1 | platipy/spyral | ---
+++
@@ -6,6 +6,7 @@
import spyral.gui
import spyral.scene
import spyral._lib
+import spyral.event
import pygame
director = scene.Director() |
42701f0ba5147bbd1aeeb2871f1b9970bcb7e01e | pygraphc/clustering/ClusterUtility.py | pygraphc/clustering/ClusterUtility.py | from itertools import combinations
class ClusterUtility(object):
@staticmethod
def get_geometric_mean(weights):
multiplication = 1
for weight in weights:
multiplication = multiplication * weight
gmean = 0.0
multiplication = round(multiplication, 5)
if multi... | from itertools import combinations
class ClusterUtility(object):
@staticmethod
def get_geometric_mean(weights):
multiplication = 1
for weight in weights:
multiplication = multiplication * weight
gmean = 0.0
if multiplication > 0.0:
k = float(len(weights... | Remove round of multiplication result for get_geometric_mean and bug fix get edge weight | Remove round of multiplication result for get_geometric_mean and bug fix get edge weight
| Python | mit | studiawan/pygraphc | ---
+++
@@ -9,7 +9,6 @@
multiplication = multiplication * weight
gmean = 0.0
- multiplication = round(multiplication, 5)
if multiplication > 0.0:
k = float(len(weights))
gmean = multiplication ** (1 / k)
@@ -22,7 +21,7 @@
for clique in cliques... |
039a19032bebd1e6852990f8aacf05042f000070 | args.py | args.py | import inspect
def argspec_set(func):
if not hasattr(func, 'argspec'):
func.argspec = inspect.getargspec(func)
def argspec_iscompat(func, lenargs):
spec = func.argspec
minargs = len(spec.args) - len(spec.defaults or ())
maxargs = len(spec.args) if spec.varargs is None else None
return lena... | import inspect
def argspec_set(func):
if not hasattr(func, 'argspec'):
func.argspec = inspect.getargspec(func)
def argspec_iscompat(func, lenargs):
spec = func.argspec
minargs = len(spec.args) - len(spec.defaults or ())
maxargs = len(spec.args) if spec.varargs is None else float("infinity")
... | Simplify funcion arg compatibility check | Simplify funcion arg compatibility check
| Python | mit | infogulch/pyspades-events | ---
+++
@@ -7,8 +7,8 @@
def argspec_iscompat(func, lenargs):
spec = func.argspec
minargs = len(spec.args) - len(spec.defaults or ())
- maxargs = len(spec.args) if spec.varargs is None else None
- return lenargs >= minargs and (maxargs is None or lenargs <= maxargs)
+ maxargs = len(spec.args) if sp... |
bdfc87ff9f9b67f038248052805327278309e558 | openacademy/model/openacademy_session.py | openacademy/model/openacademy_session.py |
from openerp import fields, models
class Session(models.Model):
_name = 'openacademy.session'
name = fields.Char(required=True)
start_date = fields.Date()
duration = fields.Float(digits=(6, 2), help="Duration in days")
seats = fields.Integer(string="Number of seats")
instructor_id = fields.Many2one... |
from openerp import fields, models
class Session(models.Model):
_name = 'openacademy.session'
name = fields.Char(required=True)
start_date = fields.Date()
duration = fields.Float(digits=(6, 2), help="Duration in days")
seats = fields.Integer(string="Number of seats")
instructor_id = fields.Many2one... | Add domain or and ilike | [REF] openacademy: Add domain or and ilike
| Python | apache-2.0 | mapuerta/openacademy-proyect | ---
+++
@@ -8,7 +8,12 @@
start_date = fields.Date()
duration = fields.Float(digits=(6, 2), help="Duration in days")
seats = fields.Integer(string="Number of seats")
- instructor_id = fields.Many2one('res.partner', string="Instructor")
+ instructor_id = fields.Many2one('res.partner', string="Instructor... |
8d50750ae94e2c94059dcbf1009dd46441d44842 | __init__.py | __init__.py | # -*- coding: utf-8 -*-
from flask import Flask, render_template
from flask.ext.mongoengine import MongoEngine, MongoEngineSessionInterface
import configparser
from .momentjs import momentjs
app = Flask(__name__)
# Security
WTF_CSRF_ENABLED = True
app.config['SECRET_KEY'] = '2bN9UUaBpcjrxR'
app.jinja_env.globals['mome... | # -*- coding: utf-8 -*-
from flask import Flask, render_template
from flask.ext.mongoengine import MongoEngine, MongoEngineSessionInterface
import configparser
from .momentjs import momentjs
app = Flask(__name__)
# Security
WTF_CSRF_ENABLED = True
app.config['SECRET_KEY'] = '2bN9UUaBpcjrxR'
app.jinja_env.globals['mome... | Update how we set the connection information for MongoDB to support Mongo 3.0.5 | Update how we set the connection information for MongoDB to support Mongo 3.0.5
Signed-off-by: Robert Dempsey <715b5a941e732be1613fdd9d94dfd8e50c02b187@gmail.com>
| Python | mit | rdempsey/weight-tracker,rdempsey/weight-tracker,rdempsey/weight-tracker | ---
+++
@@ -14,11 +14,12 @@
config = configparser.ConfigParser()
config.read('config/config.ini')
-app.config['MONGODB_DB'] = config['MongoDB']['db_name']
-app.config['MONGODB_HOST'] = config['MongoDB']['host']
-app.config['MONGODB_PORT'] = int(config['MongoDB']['port'])
-app.config['MONGODB_USERNAME'] = config['... |
5057b70a59c1a3c8301928c0297d4012bd96b21a | mapApp/views/index.py | mapApp/views/index.py | from django.shortcuts import render
from mapApp.models import Incident, Theft, Hazard, Official, AlertArea
from mapApp.forms import IncidentForm, HazardForm, TheftForm, GeofenceForm, EditForm
import datetime
def index(request, lat=None, lng=None, zoom=None):
incidents = Incident.objects.select_related('point').all()... | from django.shortcuts import render
from mapApp.models import Incident, Theft, Hazard, Official, AlertArea
from mapApp.forms import IncidentForm, HazardForm, TheftForm, GeofenceForm, EditForm
import datetime
def index(request, lat=None, lng=None, zoom=None):
incidents = Incident.objects.select_related('point').all()... | Remove expired hazards from main map | Remove expired hazards from main map
| Python | mit | SPARLab/BikeMaps,SPARLab/BikeMaps,SPARLab/BikeMaps | ---
+++
@@ -12,7 +12,7 @@
# Model data used by map
'collisions': incidents.filter(p_type__exact="collision"),
'nearmisses': incidents.filter(p_type__exact="nearmiss"),
- 'hazards': Hazard.objects.select_related('point').exclude(expires_date__lt=now),
+ 'hazards': Hazard.objects.select_related('point').excl... |
19af4b621a50639a0c1156bab1c97c7b827b89a8 | django_nose/tools.py | django_nose/tools.py | # vim: tabstop=4 expandtab autoindent shiftwidth=4 fileencoding=utf-8
"""
Assertions that sort of follow Python unittest/Django test cases
"""
from django.test.testcases import TestCase
import re
## Python
from nose import tools
for t in dir(tools):
if t.startswith('assert_'):
vars()[t] = getattr(tools... | # vim: tabstop=4 expandtab autoindent shiftwidth=4 fileencoding=utf-8
"""
Provides Nose and Django test case assert functions
"""
from django.test.testcases import TestCase
import re
## Python
from nose import tools
for t in dir(tools):
if t.startswith('assert_'):
vars()[t] = getattr(tools, t)
## Djan... | Make the heading doc string a bit more descriptive | Make the heading doc string a bit more descriptive
| Python | bsd-3-clause | brilliant-org/django-nose,franciscoruiz/django-nose,sociateru/django-nose,millerdev/django-nose,fabiosantoscode/django-nose-123-fix,dgladkov/django-nose,aristiden7o/django-nose,krinart/django-nose,aristiden7o/django-nose,krinart/django-nose,fabiosantoscode/django-nose-123-fix,franciscoruiz/django-nose,millerdev/django-... | ---
+++
@@ -1,7 +1,7 @@
# vim: tabstop=4 expandtab autoindent shiftwidth=4 fileencoding=utf-8
"""
-Assertions that sort of follow Python unittest/Django test cases
+Provides Nose and Django test case assert functions
"""
from django.test.testcases import TestCase |
78ec1cffde6443016bae2c8aefdb67ab26bfab10 | __init__.py | __init__.py | # Copyright (c) 2015 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from . import OctoPrintOutputDevicePlugin
from . import DiscoverOctoPrintAction
from UM.i18n import i18nCatalog
catalog = i18nCatalog("cura")
def getMetaData():
return {
"type": "extension",
"plugin": {
... | # Copyright (c) 2015 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from . import OctoPrintOutputDevicePlugin
from . import DiscoverOctoPrintAction
from UM.i18n import i18nCatalog
catalog = i18nCatalog("cura")
def getMetaData():
return {
"type": "extension",
"plugin": {
... | Update plugin information (name, description, version, author) | Update plugin information (name, description, version, author)
| Python | agpl-3.0 | fieldOfView/OctoPrintPlugin | ---
+++
@@ -9,9 +9,10 @@
return {
"type": "extension",
"plugin": {
- "name": "Wifi connection",
- "author": "Ultimaker",
- "description": catalog.i18nc("Wifi connection", "Wifi connection"),
+ "name": "OctoPrint connection",
+ "author": "fi... |
762ba71537cebac83970fbfb19725054b127191b | __init__.py | __init__.py | from .blendergltf import * | if 'loaded' in locals():
import imp
imp.reload(blendergltf)
from .blendergltf import *
else:
loaded = True
from .blendergltf import * | Improve reloading of the module | Improve reloading of the module
| Python | apache-2.0 | Kupoman/blendergltf,lukesanantonio/blendergltf | ---
+++
@@ -1 +1,7 @@
-from .blendergltf import *
+if 'loaded' in locals():
+ import imp
+ imp.reload(blendergltf)
+ from .blendergltf import *
+else:
+ loaded = True
+ from .blendergltf import * |
37069b80e9ab17f7d3cdbe8baf7085ff67780914 | minimongo/__init__.py | minimongo/__init__.py | # -*- coding: utf-8 -*-
'''
minimongo
~~~~~~~~~
Minimongo is a lightweight, schemaless, Pythonic Object-Oriented
interface to MongoDB.
'''
from minimongo.index import Index
from minimongo.collection import Collection
from minimongo.model import Model
from minimongo.options import configure
__all__ = (... | # -*- coding: utf-8 -*-
'''
minimongo
~~~~~~~~~
Minimongo is a lightweight, schemaless, Pythonic Object-Oriented
interface to MongoDB.
'''
from minimongo.index import Index
from minimongo.collection import Collection
from minimongo.model import Model, AttrDict
from minimongo.options import configure
_... | Add AttrDict to the top level | Add AttrDict to the top level
| Python | bsd-2-clause | terianil/minimongo,slacy/minimongo,terianil/minimongo | ---
+++
@@ -8,9 +8,9 @@
'''
from minimongo.index import Index
from minimongo.collection import Collection
-from minimongo.model import Model
+from minimongo.model import Model, AttrDict
from minimongo.options import configure
-__all__ = ('Collection', 'Index', 'Model', 'configure')
+__all__ = ('Collection', 'In... |
68c0f77155f0cc77634a8d73b2a1ab6cbd66bac1 | handlers/issue_handler.py | handlers/issue_handler.py | class IssueHandler:
def __init__(self, repos):
self.repos = repos
def handle(self, channel, prefix, issue):
repo = self.find_repo(prefix, channel)
if repo is not None:
return "https://github.com/" + repo + "/issues/" + issue
def find_repo(self, prefix, channel):
for repo in self.repos:
if prefix in r... | class IssueHandler:
def __init__(self, repos):
self.repos = repos
def handle(self, channel, prefix, issue):
repo = self.find_repo(prefix, channel)
if repo is not None:
return "https://github.com/" + repo + "/issues/" + issue
def find_repo(self, prefix, channel):
for repo in self.repos:
if prefix is "... | Make issue prefix matching case-insensitive | Make issue prefix matching case-insensitive
| Python | mit | azeier/hearthbot | ---
+++
@@ -9,5 +9,9 @@
def find_repo(self, prefix, channel):
for repo in self.repos:
- if prefix in repo["prefixes"] or (prefix is "" and channel in repo["channels"]):
+ if prefix is "" and channel in repo["channels"]:
+ # "Look at #123"
return repo["name"]
+ if prefix in repo["prefixes"] or pre... |
95e1f9517d79fb48bb9601e2d94419c6e2c984ca | tools/data2c.py | tools/data2c.py | #!/usr/bin/python
import sys
import os.path
import string
def path2varname(path):
path = os.path.basename(path)
s = ''
for c in path:
if c in string.ascii_letters or c in string.digits:
s += c
else:
s += '_'
return s
def main():
for path in sys.argv[1:]:
... | #!/usr/bin/python
import sys
import os.path
import string
import getopt
cflag = 0 # clean output: just the hexdump
def path2varname(path):
path = os.path.basename(path)
s = ''
for c in path:
if c in string.ascii_letters or c in string.digits:
s += c
else:
s += '_'
... | Add -c option: output only hexdump, without C variable wrapper. | Add -c option: output only hexdump, without C variable wrapper.
| Python | isc | S010/misc,S010/misc,S010/misc,S010/misc,S010/misc,S010/misc,S010/misc,S010/misc,S010/misc | ---
+++
@@ -3,6 +3,9 @@
import sys
import os.path
import string
+import getopt
+
+cflag = 0 # clean output: just the hexdump
def path2varname(path):
path = os.path.basename(path)
@@ -15,18 +18,31 @@
return s
def main():
- for path in sys.argv[1:]:
+ global cflag
+
+ opts, args = getopt.get... |
aedc449ec40a2c0407a38608e8e800b09c6c25b0 | tests/model.py | tests/model.py | import mongomock
from mongo_thingy import Model
def test_collection_alias():
col = mongomock.MongoClient().db.collection
class Foo(Model):
_collection = col
assert Foo.collection == col
def test_get_database_from_table():
col = mongomock.MongoClient().db.collection
class Foo(Model):
... | import mongomock
from mongo_thingy import Model
def test_collection_alias():
col = mongomock.MongoClient().db.collection
class Foo(Model):
_collection = col
assert Foo.collection == col
def test_get_database_from_table():
col = mongomock.MongoClient().db.collection
class Foo(Model):
... | Add a test for _get_table_from_database | Add a test for _get_table_from_database
| Python | mit | numberly/mongo-thingy | ---
+++
@@ -19,3 +19,12 @@
_collection = col
assert isinstance(Foo.database, mongomock.Database)
+
+
+def test_get_table_from_database():
+ db = mongomock.MongoClient().db
+
+ class Foo(Model):
+ _database = db
+
+ assert Foo.collection_name == "foo" |
7c5747688dffd41737c841ac354c4947939006c3 | django_excel_tools/exceptions.py | django_excel_tools/exceptions.py | class BaseExcelError(Exception):
def __init__(self, message):
super(BaseExcelError, self).__init__()
self.message = message
class ValidationError(BaseExcelError):
pass
class ColumnNotEqualError(BaseExcelError):
pass
class FieldNotExist(BaseExcelError):
pass
class SerializerConfi... | class BaseExcelError(Exception):
def __init__(self, message):
super(BaseExcelError, self).__init__()
self.message = message
class ColumnNotEqualError(BaseExcelError):
pass
class FieldNotExist(BaseExcelError):
pass
class ImportOperationFailed(BaseExcelError):
pass
class Serialize... | Add exception for import operation error and validation error | Add exception for import operation error and validation error
| Python | mit | NorakGithub/django-excel-tools | ---
+++
@@ -3,10 +3,6 @@
def __init__(self, message):
super(BaseExcelError, self).__init__()
self.message = message
-
-
-class ValidationError(BaseExcelError):
- pass
class ColumnNotEqualError(BaseExcelError):
@@ -17,5 +13,13 @@
pass
+class ImportOperationFailed(BaseExcelError)... |
b4e879e6bbfae9bf5692df2fb3b715f9e376041d | app/priu.py | app/priu.py | import os, sys
import json as _json
from flask import Flask, Response, request
app = Flask(__name__)
app.debug = True
import lib
@app.route("/", methods=["HEAD", "GET", "POST", "DELETE", "PUT"])
def adapter():
json = request.get_data()
decoded = _json.loads(json)
docker_json = _json.loads(decoded['Clien... | import os, sys
import json as _json
from flask import Flask, Response, request
app = Flask(__name__)
app.debug = True
import lib
@app.route("/", methods=["HEAD", "GET", "POST", "DELETE", "PUT"])
def adapter():
json = request.get_data()
decoded = _json.loads(json)
docker_json = _json.loads(decoded['Clien... | Support for diallowing official images. | Support for diallowing official images.
| Python | apache-2.0 | robhaswell/powerstrip-restrict-image-user | ---
+++
@@ -15,7 +15,10 @@
docker_json = _json.loads(decoded['ClientRequest']['Body'])
image = docker_json['Image']
- user = image.split("/")[0]
+ if "/" not in image:
+ user = "_"
+ else:
+ user = image.split("/")[0]
if user != app.config['ALLOWED_USER']:
return '', 4... |
8e4d77636a9846296225ddbfab872be4c7486261 | dask_distance/_pycompat.py | dask_distance/_pycompat.py | # -*- coding: utf-8 -*-
try:
irange = xrange
except NameError:
irange = range
| # -*- coding: utf-8 -*-
try:
irange = xrange
except NameError:
irange = range
try:
from itertools import izip
except ImportError:
izip = zip
| Add izip for Python 2/3 compatibility | Add izip for Python 2/3 compatibility
Simply use `izip` from `itertools` on Python 2 and alias `izip` as `zip`
on Python 3. This way an iterable form of `zip` remains available on
both Python 2 and Python 3 that is named `izip`. Should help avoid
having the performance of the two implementations from diverging too
far... | Python | bsd-3-clause | jakirkham/dask-distance | ---
+++
@@ -5,3 +5,8 @@
irange = xrange
except NameError:
irange = range
+
+try:
+ from itertools import izip
+except ImportError:
+ izip = zip |
114f6eb7fc6e7bf7e2cbc885ded0063adce3eccc | api/init/graphqlapi/batch.py | api/init/graphqlapi/batch.py | import docker
def execute_batch(batch_id: int):
container_name = f'mobydq-batch-{batch_id}'
client = docker.from_env()
client.containers.run(
name=container_name,
image='mobydq-scripts',
network='mobydq-network',
command=['python', 'run.py', 'execute_batch', batch_id],
... | import docker
def execute_batch(batch_id: int):
container_name = f'mobydq-batch-{batch_id}'
client = docker.from_env()
client.containers.run(
name=container_name,
image='mobydq-scripts',
network='mobydq-network',
command=['python', 'run.py', 'execute_batch', batch_id],
... | Add new line at the end of file | Add new line at the end of file
| Python | apache-2.0 | alexisrolland/data-quality,alexisrolland/data-quality,alexisrolland/data-quality,alexisrolland/data-quality | |
21541a4a1b2fcdfaa4bb7d2fbebf7db702eebacc | app/main.py | app/main.py | import csv
import yaml
import parse
import deparse
def main():
with open('data/features.csv', 'r') as f:
segments = [segment for segment in csv.DictReader(f)]
with open('data/diacritics.yaml') as f:
diacritics = yaml.load(f)
with open('data/feature-strings-with-diacritics.csv') as f:
... | import csv
import yaml
import parse
import evolve
import deparse
def evolve_words(words, available_rules, generations=5):
'''Evolves the given list of words according to the given list of rules, for a
number of generations. If no more applicable rules are available, the evolution
will stop early. Returns... | Create basic flow of evolution process. | Create basic flow of evolution process.
| Python | mit | kdelwat/LangEvolve,kdelwat/LangEvolve,kdelwat/LangEvolve | ---
+++
@@ -2,7 +2,28 @@
import yaml
import parse
+import evolve
import deparse
+
+
+def evolve_words(words, available_rules, generations=5):
+ '''Evolves the given list of words according to the given list of rules, for a
+ number of generations. If no more applicable rules are available, the evolution
+ ... |
04f8e26d2dfd29c0958372098f4199d833977c62 | app/main/views/frameworks.py | app/main/views/frameworks.py | from flask import jsonify
from sqlalchemy.types import String
from sqlalchemy import func
import datetime
from .. import main
from ...models import db, Framework, DraftService, Service, User, Supplier, SelectionAnswers, AuditEvent
@main.route('/frameworks', methods=['GET'])
def list_frameworks():
frameworks = Fr... | from flask import jsonify
from sqlalchemy.types import String
from sqlalchemy import func
import datetime
from .. import main
from ...models import db, Framework, DraftService, Service, User, Supplier, SelectionAnswers, AuditEvent
@main.route('/frameworks', methods=['GET'])
def list_frameworks():
frameworks = Fr... | Use UTC time (we want to standardise on this) | Use UTC time (we want to standardise on this)
| Python | mit | alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api | ---
+++
@@ -19,7 +19,7 @@
@main.route('/frameworks/g-cloud-7/stats', methods=['GET'])
def get_framework_stats():
- seven_days_ago = datetime.datetime.now() + datetime.timedelta(-7)
+ seven_days_ago = datetime.datetime.utcnow() + datetime.timedelta(-7)
lot_column = DraftService.data['lot'].cast(String).... |
fe4a0e0b86300f7da5f45a5541ee9c42c0a76ab7 | docker_manager/dispatcher.py | docker_manager/dispatcher.py | import requests_unixsocket
import urllib
import json
import re
def dockerapi_dispatcher(app,request):
method = request.method
uri = re.match(r"^.+/dockerapi/(.+)", request.url).group(1)
session = requests_unixsocket.Session()
unix_socket = urllib.quote_plus( app.config['SOCKET'] )
return getattr(s... | import requests_unixsocket
import urllib
import re
def dockerapi_dispatcher(app,request):
method = request.method
uri = re.match(r"^.+/dockerapi/(.+)", request.url).group(1)
session = requests_unixsocket.Session()
unix_socket = urllib.quote_plus( app.config['SOCKET'] )
return getattr(session,metho... | Remove unsed json module import | Remove unsed json module import
| Python | apache-2.0 | nathanIL/docker-manager,nathanIL/docker-manager,nathanIL/docker-manager | ---
+++
@@ -1,6 +1,5 @@
import requests_unixsocket
import urllib
-import json
import re
|
1b18d81f673e9f982e9778823198cbc336285db4 | tests/grammar_creation_test/NonterminalAddingTest.py | tests/grammar_creation_test/NonterminalAddingTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
"""
from unittest import TestCase, main
from grammpy import *
class NonterminalAddingTest(TestCase):
pass
if __name__ == '__main__':
main()
| #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
"""
from unittest import TestCase, main
from grammpy import *
from grammpy.exceptions import NotNonterminalException
class A(Nonterminal):
pass
class B(Nonterminal):
pass
class C(Nonterminal):
... | Add test of adding nonterminals when grammar is create | Add test of adding nonterminals when grammar is create
| Python | mit | PatrikValkovic/grammpy | ---
+++
@@ -9,10 +9,45 @@
from unittest import TestCase, main
from grammpy import *
+from grammpy.exceptions import NotNonterminalException
+
+
+class A(Nonterminal):
+ pass
+
+
+class B(Nonterminal):
+ pass
+
+
+class C(Nonterminal):
+ pass
+
+
+class D(Nonterminal):
+ pass
class NonterminalAddi... |
a81e3f43b83fb003b9708e3a7a581da1dc9190c1 | django_project/api/urls.py | django_project/api/urls.py | # -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from .views import LocalitiesAPI, LocalityAPI
urlpatterns = patterns(
'',
url(
r'^localities$', LocalitiesAPI.as_view(),
name='api_localities'
),
url(
r'^localitiy/(?P<uuid>\w{32})$', LocalityAPI.as_view(),
... | # -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from .views import LocalitiesAPI, LocalityAPI
urlpatterns = patterns(
'',
url(
r'^localities$', LocalitiesAPI.as_view(),
name='api_localities'
),
url(
r'^locality/(?P<uuid>\w{32})$', LocalityAPI.as_view(),
... | Fix spelling for api/locality/:uuid URL | Fix spelling for api/locality/:uuid URL
Closes #121
| Python | bsd-2-clause | ismailsunni/healthsites,ismailsunni/healthsites,ismailsunni/healthsites,ismailsunni/healthsites | ---
+++
@@ -10,7 +10,7 @@
name='api_localities'
),
url(
- r'^localitiy/(?P<uuid>\w{32})$', LocalityAPI.as_view(),
+ r'^locality/(?P<uuid>\w{32})$', LocalityAPI.as_view(),
name='api_locality'
)
) |
8b04e4de91f60a2727f9c7a6f5a56d86279c667d | avalonstar/apps/live/urls.py | avalonstar/apps/live/urls.py | # -*- coding: utf-8 -*-
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.views.generic import RedirectView
from .views import AwayView, DiscussionView, GameView, PrologueView
urlpatterns = patterns('',
# Because sooner or later, avalonstar.tv/ will be a welcome pag... | # -*- coding: utf-8 -*-
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.views.generic import RedirectView
from .views import (AwayView, DiscussionView, EpilogueView, GameView,
PrologueView)
urlpatterns = patterns('',
# Because sooner or later, avalonstar.tv/ w... | Add a URL conf for the EpilogueView. | Add a URL conf for the EpilogueView.
| Python | apache-2.0 | bryanveloso/avalonstar-tv,bryanveloso/avalonstar-tv,bryanveloso/avalonstar-tv | ---
+++
@@ -3,7 +3,8 @@
from django.conf.urls import patterns, include, url
from django.views.generic import RedirectView
-from .views import AwayView, DiscussionView, GameView, PrologueView
+from .views import (AwayView, DiscussionView, EpilogueView, GameView,
+ PrologueView)
urlpatterns = patterns('',
@... |
78ec6813df74c153501b109b31383a07f02bde07 | furious/_pkg_meta.py | furious/_pkg_meta.py | version_info = (1, 2, 0)
version = '.'.join(map(str, version_info))
| version_info = (1, 3, 0)
version = '.'.join(map(str, version_info))
| Upgrade the version to 1.3.0 | Upgrade the version to 1.3.0
| Python | apache-2.0 | beaulyddon-wf/furious,Workiva/furious,mattsanders-wf/furious,beaulyddon-wf/furious,mattsanders-wf/furious,andreleblanc-wf/furious,Workiva/furious,andreleblanc-wf/furious | ---
+++
@@ -1,2 +1,2 @@
-version_info = (1, 2, 0)
+version_info = (1, 3, 0)
version = '.'.join(map(str, version_info)) |
5cbbe25d9bbfbea804d22f399ec16ed438c492e4 | moss/plots.py | moss/plots.py | import os.path as op
import numpy as np
import nibabel as nib
import seaborn as sns
def plot_mask_distribution(fname, hist=False):
"""Plot the distribution of voxel coordinates in a mask file.
Parameters
----------
fname : string
path to binary mask file
Returns
-------
ax : matpl... | import os.path as op
import numpy as np
import nibabel as nib
import matplotlib.pyplot as plt
import seaborn as sns
def plot_mask_distribution(fname, ax=None, hist=False):
"""Plot the distribution of voxel coordinates in a mask file.
Parameters
----------
fname : string
path to binary mask fil... | Allow for shade or hist in mask plot | Allow for shade or hist in mask plot
| Python | bsd-3-clause | mwaskom/moss,mwaskom/moss | ---
+++
@@ -1,9 +1,10 @@
import os.path as op
import numpy as np
import nibabel as nib
+import matplotlib.pyplot as plt
import seaborn as sns
-def plot_mask_distribution(fname, hist=False):
+def plot_mask_distribution(fname, ax=None, hist=False):
"""Plot the distribution of voxel coordinates in a mask file... |
77a6ff9fa19349bcb9428e79b7a7bf05cb4fb2a2 | demo/apps/catalogue/migrations/0011_auto_20160616_1335.py | demo/apps/catalogue/migrations/0011_auto_20160616_1335.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailimages', '0013_make_rendition_upload_callable'),
('catalogue', '0010_auto_20160616_1048'),
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailimages', '0013_make_rendition_upload_callable'),
('catalogue', '0010_auto_20160616_1048'),
... | Add field instead of alter field | Add field instead of alter field
| Python | mit | pgovers/oscar-wagtail-demo,pgovers/oscar-wagtail-demo | ---
+++
@@ -23,7 +23,7 @@
name='image',
field=models.ForeignKey(related_name='+', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='wagtailimages.Image', null=True),
),
- migrations.AlterField(
+ migrations.AddField(
model_name='category',
... |
99f862b6c123b8c6d81e931254c061e64431bccc | pysingcells/logger.py | pysingcells/logger.py |
# -*- coding: utf-8 -*-
""" Function related to logging """
# stp import
import sys
import logging
# fief import
from fief import filter_effective_parameters as fief
log = logging.getLogger()
@fief
def setup_logging(options):
log_level = 10 if "logging_level" in options else options["logging_level"]
... |
# -*- coding: utf-8 -*-
""" Function related to logging """
# stp import
import sys
import logging
# fief import
from fief import filter_effective_parameters as fief
log = logging.getLogger()
@fief
def setup_logging(options):
log_level = 10 if "logging_level" in options else options["logging_level"]
... | Add time in logging trace | Add time in logging trace
| Python | mit | Fougere87/pysingcells | ---
+++
@@ -19,7 +19,7 @@
log.setLevel(log_level)
handler = logging.StreamHandler(sys.stderr)
- formatter = logging.Formatter('%(levelname)s :: %(message)s')
+ formatter = logging.Formatter('%(asctime)s :: %(levelname)s :: %(message)s')
handler.setFormatter(formatter)
handler.setLevel(lo... |
1bc174d357423964191625faad6733466320face | application.py | application.py | import os
import sentry_sdk
from flask import Flask
from sentry_sdk.integrations.flask import FlaskIntegration
from sentry_sdk.integrations import logging
from app import create_app
sentry_sdk.init(
dsn=os.environ['SENTRY_DSN'],
integrations=[FlaskIntegration()],
environment=os.environ['NOTIFY_ENVIRONMEN... | import os
import sentry_sdk
from flask import Flask
from sentry_sdk.integrations.flask import FlaskIntegration
from sentry_sdk.integrations.redis import RedisIntegration
from sentry_sdk.integrations import logging
from app import create_app
sentry_sdk.init(
dsn=os.environ['SENTRY_DSN'],
integrations=[FlaskIn... | Add RedisIntegration to Sentry trial | Add RedisIntegration to Sentry trial
This should expose additional performance stats.
| Python | mit | alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin | ---
+++
@@ -3,13 +3,14 @@
import sentry_sdk
from flask import Flask
from sentry_sdk.integrations.flask import FlaskIntegration
+from sentry_sdk.integrations.redis import RedisIntegration
from sentry_sdk.integrations import logging
from app import create_app
sentry_sdk.init(
dsn=os.environ['SENTRY_DSN']... |
6de1eb3e3279af6fa09ddafd0e220becac7edf21 | author/urls.py | author/urls.py | from django.conf.urls import patterns
from django.conf.urls import url
from django.views.generic.base import RedirectView
from django.core.urlresolvers import reverse_lazy
from django.contrib.auth.views import login
from django.contrib.auth.decorators import login_required
from author import views
urlpatterns = patt... | from django.conf.urls import patterns
from django.conf.urls import url
from django.views.generic.base import RedirectView
from django.core.urlresolvers import reverse_lazy
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import Permission
from django.contrib.auth.views import l... | Add permission checks in author app | Add permission checks in author app
| Python | bsd-3-clause | stefantsov/blackbox3,stefantsov/blackbox3,stefantsov/blackbox3 | ---
+++
@@ -2,10 +2,26 @@
from django.conf.urls import url
from django.views.generic.base import RedirectView
from django.core.urlresolvers import reverse_lazy
+from django.contrib.contenttypes.models import ContentType
+from django.contrib.auth.models import Permission
from django.contrib.auth.views import login... |
c80c9aa63426f138d725eeecf74f386fbee61aed | gistmail.py | gistmail.py | """\
GistMail
Email gist@gistmail.com with a link and get a response with that article's summary.
"""
from summarize import summarize_page
from flask import Flask, render_template
# Flask application
app = Flask(__name__)
# Configuration
app.config.from_object('settings')
app.config.from_envvar('SETTINGS_MODULE', s... | """\
GistMail
Email gist@gistmail.com with a link and get a response with that article's summary.
"""
from summarize import summarize_page
from flask import Flask, render_template, request
# Flask application
app = Flask(__name__)
# Configuration
app.config.from_object('settings')
app.config.from_envvar('SETTINGS_M... | Add GET handler to /incoming. | Add GET handler to /incoming.
| Python | mit | joeyespo/gistmail.com,joeyespo/gistmail.com | ---
+++
@@ -5,7 +5,7 @@
"""
from summarize import summarize_page
-from flask import Flask, render_template
+from flask import Flask, render_template, request
# Flask application
@@ -22,11 +22,13 @@
return render_template('index.html')
-@app.route('/incoming', methods=['POST'])
+@app.route('/incoming... |
69029424035c8506a46b94422fd347871ee51269 | accelerator/tests/factories/program_family_factory.py | accelerator/tests/factories/program_family_factory.py | # MIT License
# Copyright (c) 2017 MassChallenge, Inc.
from __future__ import unicode_literals
import swapper
from factory import (
DjangoModelFactory,
Sequence,
)
from accelerator.apps import AcceleratorConfig
ProgramFamily = swapper.load_model(AcceleratorConfig.name, 'ProgramFamily')
class ProgramFamily... | # MIT License
# Copyright (c) 2017 MassChallenge, Inc.
from __future__ import unicode_literals
import swapper
from factory import (
DjangoModelFactory,
Sequence,
)
from accelerator.apps import AcceleratorConfig
ProgramFamily = swapper.load_model(AcceleratorConfig.name, 'ProgramFamily')
class ProgramFamily... | Add new field to factory | Add new field to factory
| Python | mit | masschallenge/django-accelerator,masschallenge/django-accelerator | ---
+++
@@ -26,3 +26,4 @@
physical_address = "Boston"
is_open_for_startups = True
is_open_for_experts = True
+ use_site_tree_side_nav = False |
3860e0a9ac99c4c4422630e4133bf3b35927bf41 | conf_site/sponsorship/tests/__init__.py | conf_site/sponsorship/tests/__init__.py | import factory
from symposion.schedule.tests.factories import ConferenceFactory
from symposion.sponsorship.models import SponsorLevel, Sponsor
class SponsorLevelFactory(factory.django.DjangoModelFactory):
conference = factory.SubFactory(ConferenceFactory)
name = factory.Faker("color_name")
order = factor... | import factory
from symposion.schedule.tests.factories import ConferenceFactory
from symposion.sponsorship.models import SponsorLevel, Sponsor
class SponsorLevelFactory(factory.django.DjangoModelFactory):
conference = factory.SubFactory(ConferenceFactory)
name = factory.Faker("color_name")
order = factor... | Allow SponsorFactory to create active sponsors. | Allow SponsorFactory to create active sponsors.
| Python | mit | pydata/conf_site,pydata/conf_site,pydata/conf_site | ---
+++
@@ -22,6 +22,7 @@
contact_name = factory.Faker("name")
contact_email = factory.Faker("company_email")
level = factory.SubFactory(SponsorLevelFactory)
+ active = factory.Faker("boolean")
class Meta:
model = Sponsor |
58321c0471f10169ea5c0f705cdb35825036d77f | cat_leds.py | cat_leds.py | #!/usr/bin/env python
"""Display standard input on LEDs."""
import sys
import RPi.GPIO as GPIO
from seven_segment import print_leds
pins = [17, 23, 24, 22, 27, 25, 5]
GPIO.setmode(GPIO.BCM)
GPIO.setup(pins, GPIO.OUT)
pipe_contents = sys.stdin.read()
print_leds(pipe_contents, pins)
GPIO.cleanup()
| #!/usr/bin/env python
"""Display standard input on LEDs."""
import sys
import RPi.GPIO as GPIO
from seven_segment import print_leds
pins = [6, 19, 5, 13, 20, 12, 16]
GPIO.setmode(GPIO.BCM)
GPIO.setup(pins, GPIO.OUT)
pipe_contents = sys.stdin.read()
print_leds(pipe_contents, pins, 1/2.0)
GPIO.cleanup()
| Set up for my new 7 seg display. | Set up for my new 7 seg display.
| Python | mit | zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie,zimolzak/Raspberry-Pi-newbie | ---
+++
@@ -6,12 +6,13 @@
import RPi.GPIO as GPIO
from seven_segment import print_leds
-pins = [17, 23, 24, 22, 27, 25, 5]
+
+pins = [6, 19, 5, 13, 20, 12, 16]
GPIO.setmode(GPIO.BCM)
GPIO.setup(pins, GPIO.OUT)
pipe_contents = sys.stdin.read()
-print_leds(pipe_contents, pins)
+print_leds(pipe_contents, pins... |
caaf8e40c99f410b09580b81c4fa7a094395319c | test/test_progress_bar.py | test/test_progress_bar.py | import pytest
from downloads.download import _progress_bar
@pytest.mark.parametrize(
"current,block_size,total_size",
[
(
100,
32,
100 * 32,
),
(
75,
32,
100 * 32,
),
(
50,
... | import pytest
from downloads.download import _progress_bar
@pytest.mark.parametrize(
"current,block_size,total_size",
[
(
100,
32,
100 * 32,
),
(
75,
32,
100 * 32,
),
(
50,
... | Test width of progress bar | Test width of progress bar
| Python | mit | audy/downloads | ---
+++
@@ -40,3 +40,4 @@
assert bar.count("#") == current
assert bar.split()[-1] == f"{current:.1f}%"
+ assert len(bar) == 100 + 8 |
6b777abcc694ff8991cd522300d8d545fb49586a | cct/core2/stronginfo.py | cct/core2/stronginfo.py | import logging
import colorlog
logging.STRONGINFO = logging.DEBUG + 5
logging.addLevelName(logging.STRONGINFO, 'STRONGINFO')
def logStrongInfo(msg, *args, **kwargs):
"""Log a message with severity 'STRONGINFO' on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with... | import logging
import colorlog
logging.STRONGINFO = logging.INFO + 5
logging.addLevelName(logging.STRONGINFO, 'STRONGINFO')
def logStrongInfo(msg, *args, **kwargs):
"""Log a message with severity 'STRONGINFO' on the root logger. If the logger has
no handlers, call basicConfig() to add a console handler with ... | Correct priority for STRONGINFO log level | Correct priority for STRONGINFO log level
| Python | bsd-3-clause | awacha/cct,awacha/cct,awacha/cct | ---
+++
@@ -1,7 +1,7 @@
import logging
import colorlog
-logging.STRONGINFO = logging.DEBUG + 5
+logging.STRONGINFO = logging.INFO + 5
logging.addLevelName(logging.STRONGINFO, 'STRONGINFO')
|
d2079a26f1a259aa69dea061be2b192137030fd1 | ckanext/nhm/lib/form.py | ckanext/nhm/lib/form.py | #!/usr/bin/env python
# encoding: utf-8
#
# This file is part of ckanext-nhm
# Created by the Natural History Museum in London, UK
def list_to_form_options(values, allow_empty=False, allow_empty_text='None'):
'''Format a list of values into a list of dict suitable
for use in forms: [{value: x, name: y}]
... | #!/usr/bin/env python
# encoding: utf-8
#
# This file is part of ckanext-nhm
# Created by the Natural History Museum in London, UK
def list_to_form_options(values, allow_empty=False, allow_empty_text='None'):
'''Format a list of values into a list of dict suitable
for use in forms: [{value: x, name: y}]
... | Switch empty value to empty string rather than None | Switch empty value to empty string rather than None
When None is used this is rendered in the HTML as a string, which then when it is returned to the CKAN server becomes 'None' not None.
An empty string represents no value better.
| Python | mit | NaturalHistoryMuseum/ckanext-nhm,NaturalHistoryMuseum/ckanext-nhm,NaturalHistoryMuseum/ckanext-nhm | ---
+++
@@ -17,7 +17,7 @@
options = []
if allow_empty:
- options.append({'value': None, 'text': allow_empty_text or None})
+ options.append({'value': '', 'text': allow_empty_text or None})
for value in values:
|
f30d2f5b09ae3a62bff02165a173af6e25345a60 | trevornet/nets/pynet/aimath.py | trevornet/nets/pynet/aimath.py | import math
import sys
def sigmoid(x):
try:
val = 1/(1 + math.exp(-x))
except OverflowError:
val = sys.float_info.max
return val
def sigmoidprime(x):
return (1 - sigmoid(x))*sigmoid(x)
| import math
import sys
def sigmoid(x):
try:
val = 1/(1 + math.exp(-x))
except OverflowError:
val = 0.
return val
def sigmoidprime(x):
return (1 - sigmoid(x))*sigmoid(x)
| Fix mistake in sigmoid function | Fix mistake in sigmoid function
| Python | mit | tmerr/trevornet | ---
+++
@@ -5,7 +5,7 @@
try:
val = 1/(1 + math.exp(-x))
except OverflowError:
- val = sys.float_info.max
+ val = 0.
return val
def sigmoidprime(x): |
4510a4a22965d002bd41293fd8fe629c8285800d | tests/test_errors.py | tests/test_errors.py | # coding: pyxl
import pytest
from pyxl.codec.register import pyxl_decode
from pyxl.codec.parser import ParseError
def test_malformed_if():
with pytest.raises(ParseError):
pyxl_decode(b"""
<frag>
<if cond="{true}">foo</if>
this is incorrect!
<else... | # coding: pyxl
import pytest
from pyxl.codec.register import pyxl_decode
from pyxl.codec.parser import ParseError
from pyxl.codec.html_tokenizer import BadCharError
def test_malformed_if():
with pytest.raises(ParseError):
pyxl_decode(b"""
<frag>
<if cond="{true}">foo</if>
... | Add test for BadCharError exception. | Add test for BadCharError exception.
| Python | apache-2.0 | pyxl4/pyxl4 | ---
+++
@@ -3,6 +3,7 @@
from pyxl.codec.register import pyxl_decode
from pyxl.codec.parser import ParseError
+from pyxl.codec.html_tokenizer import BadCharError
def test_malformed_if():
with pytest.raises(ParseError):
@@ -29,3 +30,7 @@
<if cond="{true}">foo</if>
<else><el... |
25e4730c4614a26cdecd60eb0846e69578353d2c | tomcrypt/__init__.py | tomcrypt/__init__.py |
import os
import ctypes
# We need to manually load the _core SO the first time so that we can specify
# that it use the RTLD_GLOBAL flag. Otherwise (when not on a Mac) the runtime
# linker will not be able to resolve undefined symbols in the other modules.
_core_handle = ctypes.CDLL(
os.path.join(os.path.dirname(... |
import ctypes
class Error(ValueError):
def __init__(self, *args, **kwargs):
self.code = kwargs.get('code', -1)
ValueError.__init__(self, *args)
class LibError(Error):
pass
# We need to manually load the _core the first time so that we can specify
# that it use the RTLD_GLOBAL flag. Otherwi... | Use import to locate _core | Linking: Use import to locate _core
Related to #8 | Python | bsd-3-clause | mikeboers/PyTomCrypt,mikeboers/PyTomCrypt,mikeboers/PyTomCrypt | ---
+++
@@ -1,14 +1,5 @@
-import os
import ctypes
-
-# We need to manually load the _core SO the first time so that we can specify
-# that it use the RTLD_GLOBAL flag. Otherwise (when not on a Mac) the runtime
-# linker will not be able to resolve undefined symbols in the other modules.
-_core_handle = ctypes.CDLL... |
b4ce1a023bf047524f40ac63f40d46a70c8f6f77 | src/dirtyfields/dirtyfields.py | src/dirtyfields/dirtyfields.py | # Adapted from http://stackoverflow.com/questions/110803/dirty-fields-in-django
from django.db.models.signals import post_save
class DirtyFieldsMixin(object):
def __init__(self, *args, **kwargs):
super(DirtyFieldsMixin, self).__init__(*args, **kwargs)
post_save.connect(reset_state, sender=self.__cl... | # Adapted from http://stackoverflow.com/questions/110803/dirty-fields-in-django
from django.db.models.signals import post_save
class DirtyFieldsMixin(object):
def __init__(self, *args, **kwargs):
super(DirtyFieldsMixin, self).__init__(*args, **kwargs)
post_save.connect(reset_state, sender=self.__cl... | Check primary keys for foreign key and one-to-one fields | Check primary keys for foreign key and one-to-one fields
| Python | bsd-3-clause | stanhu/django-dirtyfields | ---
+++
@@ -9,7 +9,7 @@
reset_state(sender=self.__class__, instance=self)
def _as_dict(self):
- return dict([(f.name, getattr(self, f.name)) for f in self._meta.local_fields if not f.rel])
+ return dict([(f.name, getattr(self, f.name)) for f in self._meta.local_fields])
def get_di... |
625307615f0dac8801b35ac5689a92706556ad01 | main.py | main.py | import struct
id_i = 0
value_i = 0.0
id_i_1 = 0
value_i_1 = 1.0
number = 0
with open("sort.dat", "r") as f:
for line in f:
line = line.replace('(', '')
line = line.replace(')', '')
line = line.replace(' ', '')
line = line.replace('\n', '')
# print line
[id, value] =... | Update the code of visualization. | Update the code of visualization.
| Python | mit | SigmaQuan/NTM-Keras | ---
+++
@@ -0,0 +1,40 @@
+import struct
+
+
+id_i = 0
+value_i = 0.0
+id_i_1 = 0
+value_i_1 = 1.0
+number = 0
+with open("sort.dat", "r") as f:
+ for line in f:
+ line = line.replace('(', '')
+ line = line.replace(')', '')
+ line = line.replace(' ', '')
+ line = line.replace('\n', '')
+... | |
67ea33e9e46ff321c2915d46a354d66756ff9c2b | main.py | main.py | #!/usr/bin/env python
"""
This is the main file for a script that reads info off a game on kongregate.com and acts upon it.
"""
# import line/s for builtin modules
# import pyautogui
__author__ = "Alex Flores Escarcega"
__copyright__ = "Copyright 2007, Alex Flores Escarcega"
__credits__ = ["Alex Flores Escarcega"]
__... | #!/usr/bin/env python
"""
This is the main file for a script that reads info off a game on kongregate.com and acts upon it.
"""
# import line/s for builtin modules
# import pyautogui
__author__ = "Alex Flores Escarcega"
__copyright__ = "Copyright 2007, Alex Flores Escarcega"
__credits__ = ["Alex Flores Escarcega"]
__... | Add method to find the coordinates of game | Add method to find the coordinates of game
| Python | mit | hydrophilicsun/Automating-Endless-Expansion | ---
+++
@@ -17,12 +17,23 @@
# game located at http://www.kongregate.com/games/Volch/endless-expansion?haref=HP_TGTM_endless-expansion
+def find_game_region():
+ """
+ Finds the top left coordinates of the game by substracting (700 + 300) from the location of the game.
+ The 300 comes from the width of ... |
8b6daefb98c20ddb288604f7aa2202c21df2c526 | main.py | main.py | __author__ = 'alex'
print 45
print 54 | _author__ = 'alex'
import sys
import xml.dom.minidom as dom
def get_Res_Matrix(length,nodes,nets_d,elem_type):
Res = [[[] for j in range(length)] for i in range(length)]
for i in range(nodes.length):
if nodes[i].nodeType != elem_type: continue
name = nodes[i].nodeName
if name == "diode"... | Read and parse xml to Matrix | Read and parse xml to Matrix
| Python | mit | BaydinAlexey/proglangs_baydin,BaydinAlexey/proglangs_baydin | ---
+++
@@ -1,6 +1,47 @@
-__author__ = 'alex'
+_author__ = 'alex'
+import sys
+import xml.dom.minidom as dom
+def get_Res_Matrix(length,nodes,nets_d,elem_type):
+ Res = [[[] for j in range(length)] for i in range(length)]
+ for i in range(nodes.length):
+ if nodes[i].nodeType != elem_type: continue
+ ... |
fa2fb3387912474eff2b6c2a14d6304fcf5cd1f8 | erasmus/cogs/bible/testing_server_preferences_group.py | erasmus/cogs/bible/testing_server_preferences_group.py | from __future__ import annotations
from typing import TYPE_CHECKING
from botus_receptus.app_commands import test_guilds_only
from discord import app_commands
from .daily_bread.daily_bread_preferences_group import DailyBreadPreferencesGroup
if TYPE_CHECKING:
from ...erasmus import Erasmus
from ...l10n import... | from __future__ import annotations
from typing import TYPE_CHECKING
from botus_receptus.app_commands import test_guilds_only
from discord import app_commands
from .daily_bread.daily_bread_preferences_group import DailyBreadPreferencesGroup
if TYPE_CHECKING:
from ...erasmus import Erasmus
from ...l10n import... | Use serverprefs localizer for TestingServerPreferencesGroup | Use serverprefs localizer for TestingServerPreferencesGroup
| Python | bsd-3-clause | bryanforbes/Erasmus | ---
+++
@@ -26,6 +26,6 @@
def initialize_from_parent(self, parent: ParentCog, /) -> None:
self.bot = parent.bot
- self.localizer = parent.localizer.for_group(self)
+ self.localizer = parent.localizer.for_group('serverprefs')
self.daily_bread.initialize_from_parent(self) |
d044576e08e06dd6a2c68ab7868c281cd2979764 | wsgi.py | wsgi.py | from app import create_app
from credstash import getAllSecrets
import os
default_env_file = '/home/ubuntu/environment'
environment = 'live'
if os.path.isfile(default_env_file):
with open(default_env_file, 'r') as environment_file:
environment = environment_file.readline().strip()
# on aws get secrets an... | from credstash import getAllSecrets
import os
default_env_file = '/home/ubuntu/environment'
environment = 'live'
if os.path.isfile(default_env_file):
with open(default_env_file, 'r') as environment_file:
environment = environment_file.readline().strip()
# on aws get secrets and export to env
os.environ.... | Order of imports means the config doesn't get set up properly | Order of imports means the config doesn't get set up properly
| Python | mit | gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin | ---
+++
@@ -1,4 +1,3 @@
-from app import create_app
from credstash import getAllSecrets
import os
@@ -17,6 +16,8 @@
os.environ['NOTIFY_ADMIN_ENVIRONMENT'] = configs[environment]
+from app import create_app
+
application = create_app()
if __name__ == "__main__": |
f3ec0593bb67db25c4f5af4b3b00d82d5e4e0f04 | csv2ofx/mappings/gls.py | csv2ofx/mappings/gls.py | from operator import itemgetter
mapping = {
'has_header': True,
'currency': 'EUR',
'delimiter': ';',
'bank': 'GLS Bank',
'account': itemgetter('Kontonummer'),
# Chop up the dotted German date format and put it in ridiculous M/D/Y order
'date': lambda r:
r['Buchungstag'][3:5] + '/' ... | from __future__ import absolute_import
from operator import itemgetter
mapping = {
'has_header': True,
'currency': 'EUR',
'delimiter': ';',
'bank': 'GLS Bank',
'account': itemgetter('Kontonummer'),
# Chop up the dotted German date format and put it in ridiculous M/D/Y order
'date': lambda ... | Add import for other python versions | Add import for other python versions | Python | mit | reubano/csv2ofx,reubano/csv2ofx | ---
+++
@@ -1,3 +1,4 @@
+from __future__ import absolute_import
from operator import itemgetter
mapping = { |
3e52078450a4205fdfaa2d4ba2448bce3d3d19d7 | gpio_components/input_devices.py | gpio_components/input_devices.py | from RPi import GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
class InputDevice(object):
def __init__(self, pin):
self.pin = pin
GPIO.setup(pin, GPIO.IN, GPIO.PUD_UP)
def is_pressed(self):
return GPIO.input(self.pin) == 0
class Button(InputDevice):
pass
| from RPi import GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
class InputDevice(object):
def __init__(self, pin=None):
if pin is None:
raise InputDeviceError('No GPIO pin number given')
self.pin = pin
self.pull = GPIO.PUD_UP
self.edge = GPIO.FALLING
sel... | Add wait_for_input and add_callback methods to InputDevice | Add wait_for_input and add_callback methods to InputDevice
| Python | bsd-3-clause | lurch/python-gpiozero,waveform80/gpio-zero,agiledata/python-gpiozero,Gadgetoid/python-gpiozero,cymplecy/python-gpioone,RPi-Distro/python-gpiozero,MrHarcombe/python-gpiozero | ---
+++
@@ -6,13 +6,36 @@
class InputDevice(object):
- def __init__(self, pin):
+ def __init__(self, pin=None):
+ if pin is None:
+ raise InputDeviceError('No GPIO pin number given')
+
self.pin = pin
- GPIO.setup(pin, GPIO.IN, GPIO.PUD_UP)
+ self.pull = GPIO.PUD_UP
... |
2f55855ed1c1ea7862e239af76fab57f32affc0c | hamlpy/views/generic/__init__.py | hamlpy/views/generic/__init__.py | from __future__ import print_function, unicode_literals
import django.views.generic
pouet = [
'ArchiveIndexView', 'YearArchiveView', 'MonthArchiveView',
'WeekArchiveView', 'DayArchiveView', 'TodayArchiveView', 'DateDetailView',
'DetailView', 'CreateView', 'UpdateView', 'DeleteView', 'ListView',
]
class ... | from __future__ import print_function, unicode_literals
import django.views.generic
pouet = [
'ArchiveIndexView', 'YearArchiveView', 'MonthArchiveView',
'WeekArchiveView', 'DayArchiveView', 'TodayArchiveView', 'DateDetailView',
'DetailView', 'CreateView', 'UpdateView', 'DeleteView', 'ListView',
]
class ... | Fix views file Python 3 issue | Fix views file Python 3 issue
| Python | mit | Psycojoker/HamlPy,nyaruka/django-hamlpy,Psycojoker/HamlPy,nyaruka/django-hamlpy,Psycojoker/HamlPy | ---
+++
@@ -24,4 +24,4 @@
for view in pouet:
- locals()[view] = type(view, (HamlExtensionTemplateView, getattr(django.views.generic, view)), {})
+ locals()[view] = type(str(view), (HamlExtensionTemplateView, getattr(django.views.generic, view)), {}) |
f61aa6a8088721c31510beef2145e3de7a46b1f4 | mako_pipeline/__init__.py | mako_pipeline/__init__.py | # coding: utf-8
ASSETS = {
'debug': False,
'media_url': '/',
}
def configure(data):
ASSETS.update(data)
| # coding: utf-8
ASSETS = {
'debug': False,
'media_url': '/',
}
def configure(data=None):
if data:
ASSETS.update(data)
return ASSETS
| Return config when calling configure def | Return config when calling configure def
| Python | mit | rcmachado/mako-pipeline | ---
+++
@@ -6,5 +6,7 @@
}
-def configure(data):
- ASSETS.update(data)
+def configure(data=None):
+ if data:
+ ASSETS.update(data)
+ return ASSETS |
ed437d9a5b4ccb29eb5240b176773a475ff371c3 | grd/urls.py | grd/urls.py | from django.conf.urls import include, url
from django.contrib import admin
from rest_framework import routers
from rest_framework.authtoken.views import obtain_auth_token
from grd import views
router = routers.SimpleRouter()
router.register(r'devices', views.DeviceView)
urlpatterns = [
# Examples:
# url(r'^... | from django.conf.urls import include, url
from django.contrib import admin
from rest_framework import routers
from rest_framework.authtoken.views import obtain_auth_token
from grd import views
router = routers.DefaultRouter()
router.register(r'devices', views.DeviceView)
urlpatterns = [
# Examples:
# url(r'... | Use DefaultRouter which includes a default API root view. | Use DefaultRouter which includes a default API root view.
| Python | agpl-3.0 | eReuse/grd,eReuse/grd | ---
+++
@@ -6,7 +6,7 @@
from grd import views
-router = routers.SimpleRouter()
+router = routers.DefaultRouter()
router.register(r'devices', views.DeviceView)
urlpatterns = [ |
0a9f378784e8c30cdf16d4d1caaf3b98f112bb90 | nap/meta.py | nap/meta.py | from __future__ import unicode_literals
class Meta(object):
'''Generic container for Meta classes'''
def __new__(cls, meta=None):
# Return a new class base on ourselves
attrs = dict(
(name, getattr(meta, name))
for name in dir(meta)
if not name[0] == '_'
... | from __future__ import unicode_literals
class Meta(object):
'''Generic container for Meta classes'''
def __new__(cls, meta=None):
# Return a new class base on ourselves
attrs = dict(
(name, getattr(meta, name))
for name in dir(meta)
if not name[0] == '_' and... | Make Meta class enforce only known properties | Make Meta class enforce only known properties
| Python | bsd-3-clause | MarkusH/django-nap,limbera/django-nap | ---
+++
@@ -8,6 +8,6 @@
attrs = dict(
(name, getattr(meta, name))
for name in dir(meta)
- if not name[0] == '_'
+ if not name[0] == '_' and hasattr(cls, name)
)
return object.__new__(type(str('Meta'), (cls,), attrs)) |
ea5bfe240cc349144e089f606534726863f2c21b | media/sites/lapinkansa.py | media/sites/lapinkansa.py | import requests
from bs4 import BeautifulSoup
def nouda( url , out ):
r = requests.get( url )
r.encoding = 'UTF-8'
soup = BeautifulSoup( r.text )
teksti = soup.find_all( class_ ='post-meta' )
for string in teksti[0].stripped_strings:
out.write( string.encode('utf8') + ' ' )
if __name__ == '__main__'... | import requests
from bs4 import BeautifulSoup
def nouda( url , out ):
r = requests.get( url )
r.encoding = 'UTF-8'
soup = BeautifulSoup( r.text )
teksti = soup.find_all( class_ = 'news-excerpt' )
for string in teksti[0].stripped_strings:
out.write( string.encode('utf8') + ' ' )
if __name__ == '__mai... | Fix to new page layout | Fix to new page layout
| Python | mit | HIIT/digivaalit-2015,HIIT/digivaalit-2015,HIIT/digivaalit-2015 | ---
+++
@@ -8,7 +8,7 @@
r.encoding = 'UTF-8'
soup = BeautifulSoup( r.text )
- teksti = soup.find_all( class_ ='post-meta' )
+ teksti = soup.find_all( class_ = 'news-excerpt' )
for string in teksti[0].stripped_strings:
out.write( string.encode('utf8') + ' ' ) |
c2355829706b2b728ca369474157cac58f9c35d1 | examples/utils.py | examples/utils.py | import subprocess
import os
import sys
STEPS = "Step:"
RESULT = "Result:"
SETUP = "Setup:"
def enter_depend_test():
# Simple magic for using scripts within a source tree
BASEDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if os.path.isdir(os.path.join(BASEDIR, 'depend_test_framework')):... | import subprocess
import time
import re
import os
import sys
import paramiko
STEPS = "Step:"
RESULT = "Result:"
SETUP = "Setup:"
def enter_depend_test():
# Simple magic for using scripts within a source tree
BASEDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if os.path.isdir(os.path.jo... | Add help function to run command in guest | Add help function to run command in guest
Signed-off-by: Luyao Huang <23d9981432efa88691fd2a71f5525bc2174f7664@redhat.com>
| Python | mit | LuyaoHuang/depend-test-framework | ---
+++
@@ -1,6 +1,9 @@
import subprocess
+import time
+import re
import os
import sys
+import paramiko
STEPS = "Step:"
RESULT = "Result:"
@@ -17,3 +20,36 @@
def run_cmd(cmd):
return subprocess.check_output(cmd.split())
+
+def _get_guest_ip(guest_name):
+ # TODO: fallback to agent
+ ret = run_cmd... |
24520fc982d0a1a2b1b6fa7b493888fbdd3ef6a8 | util/versioncheck.py | util/versioncheck.py | #!/usr/bin/python
from subprocess import check_output as co
from sys import exit
# Actually run bin/mn rather than importing via python path
version = 'Mininet ' + co( 'PYTHONPATH=. bin/mn --version', shell=True )
version = version.strip()
# Find all Mininet path references
lines = co( "egrep -or 'Mininet [0-9\.]+\w... | #!/usr/bin/python
from subprocess import check_output as co
from sys import exit
# Actually run bin/mn rather than importing via python path
version = 'Mininet ' + co( 'PYTHONPATH=. bin/mn --version', shell=True )
version = version.strip()
# Find all Mininet path references
lines = co( "egrep -or 'Mininet [0-9\.\+]+... | Allow + in version number | Allow + in version number
| Python | bsd-3-clause | mininet/mininet,mininet/mininet,mininet/mininet | ---
+++
@@ -8,7 +8,7 @@
version = version.strip()
# Find all Mininet path references
-lines = co( "egrep -or 'Mininet [0-9\.]+\w*' *", shell=True )
+lines = co( "egrep -or 'Mininet [0-9\.\+]+\w*' *", shell=True )
error = False
|
7a5ad08262afa4b7f4b8f580755136145d681ace | tests/apps/tornado_server/__init__.py | tests/apps/tornado_server/__init__.py | # (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2020
import os
import sys
from ...helpers import testenv
from ..utils import launch_background_thread
app_thread = None
if not any((app_thread, os.environ.get('GEVENT_TEST'), os.environ.get('CASSANDRA_TEST')):
testenv["tornado_port"] = 10813
testenv... | # (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2020
import os
import sys
from ...helpers import testenv
from ..utils import launch_background_thread
app_thread = None
if not any((app_thread, os.environ.get('GEVENT_TEST'), os.environ.get('CASSANDRA_TEST'))):
testenv["tornado_port"] = 10813
testen... | Fix expression in tornado_server app | fix(test): Fix expression in tornado_server app
Signed-off-by: Ferenc Géczi <056c6d27de7ab660258538226bb901048afb31e4@ibm.com>
| Python | mit | instana/python-sensor,instana/python-sensor | ---
+++
@@ -8,7 +8,7 @@
app_thread = None
-if not any((app_thread, os.environ.get('GEVENT_TEST'), os.environ.get('CASSANDRA_TEST')):
+if not any((app_thread, os.environ.get('GEVENT_TEST'), os.environ.get('CASSANDRA_TEST'))):
testenv["tornado_port"] = 10813
testenv["tornado_server"] = ("http://127.0.0.1... |
6d17a7becc0ddebceba0bd77f876bf9744a2d62e | server/patch_hosts.py | server/patch_hosts.py | #!/usr/bin/env python3
import argparse
from qlmdm import set_gpg
from qlmdm.server import patch_hosts
set_gpg('server')
def parse_args():
parser = argparse.ArgumentParser(description='Queue a patch for one or '
'more hosts')
parser.add_argument('--host', action='append... | #!/usr/bin/env python3
import argparse
from qlmdm import set_gpg
from qlmdm.server import patch_hosts
set_gpg('server')
def parse_args():
parser = argparse.ArgumentParser(description='Queue a patch for one or '
'more hosts')
parser.add_argument('--host', action='append'... | Remove extra space in usage message text | Remove extra space in usage message text
| Python | apache-2.0 | quantopian/PenguinDome,quantopian/PenguinDome | ---
+++
@@ -10,7 +10,7 @@
def parse_args():
parser = argparse.ArgumentParser(description='Queue a patch for one or '
- 'more hosts')
+ 'more hosts')
parser.add_argument('--host', action='append', help='Host(s) on which to '
... |
b21d63d8df7d17e150702c531ef449f409100eff | wot_clan_battles/views_auth.py | wot_clan_battles/views_auth.py | import six
from django.http import HttpResponseRedirect
from django.shortcuts import reverse
from django.conf import settings
from openid.consumer import consumer
import wargaming
wot = wargaming.WoT(settings.WARGAMING_KEY, language='ru', region='ru')
def auth_callback(request):
oidconsumer = consumer.Consume... | import six
from django.http import HttpResponseRedirect
from django.shortcuts import reverse
from django.conf import settings
from openid.consumer import consumer
import wargaming
wot = wargaming.WoT(settings.WARGAMING_KEY, language='ru', region='ru')
def auth_callback(request):
oidconsumer = consumer.Consume... | Remove debug print from view | Remove debug print from view
| Python | mit | monester/wot-battles,monester/wot-battles,monester/wot-battles,monester/wot-battles | ---
+++
@@ -17,7 +17,6 @@
result = oidconsumer.complete(request.GET, url)
if result.status == consumer.SUCCESS:
identifier = result.getDisplayIdentifier()
- print identifier
user_id, username = six.moves.urllib_parse.urlparse(identifier).path.split('/')[2].split('-')
reques... |
045c1405c4b8c7bc502814672c0da36e3e4a8a15 | kolibri/deployment/default/settings/debug_panel.py | kolibri/deployment/default/settings/debug_panel.py | from __future__ import absolute_import, print_function, unicode_literals
from .base import * # noqa
INTERNAL_IPS = ['127.0.0.1']
DEBUG_TOOLBAR_CONFIG = {
"SHOW_TOOLBAR_CALLBACK": lambda x: True,
}
MIDDLEWARE_CLASSES = (
'debug_panel.middleware.DebugPanelMiddleware',
) + MIDDLEWARE_CLASSES # noqa
INSTALLE... | from __future__ import absolute_import, print_function, unicode_literals
from .base import * # noqa
INTERNAL_IPS = ['127.0.0.1']
DEBUG_TOOLBAR_CONFIG = {
"SHOW_TOOLBAR_CALLBACK": lambda x: True,
}
MIDDLEWARE_CLASSES = (
'debug_panel.middleware.DebugPanelMiddleware',
) + MIDDLEWARE_CLASSES # noqa
INSTALLE... | Add DEBUG_PANEL_ACTIVE setting back into custom DDT settings file | Add DEBUG_PANEL_ACTIVE setting back into custom DDT settings file
| Python | mit | mrpau/kolibri,mrpau/kolibri,MingDai/kolibri,DXCanas/kolibri,DXCanas/kolibri,jonboiser/kolibri,lyw07/kolibri,benjaoming/kolibri,benjaoming/kolibri,christianmemije/kolibri,learningequality/kolibri,learningequality/kolibri,christianmemije/kolibri,lyw07/kolibri,MingDai/kolibri,jonboiser/kolibri,benjaoming/kolibri,mrpau/kol... | ---
+++
@@ -18,3 +18,5 @@
]
ENABLE_DATA_BOOTSTRAPPING = False
+
+DEBUG_PANEL_ACTIVE = True |
69a417c421d774c4998ae721b85211a60757ce85 | fit_blackbody.py | fit_blackbody.py | import numpy as np
from scipy.optimize import curve_fit
from astropy import units as u
from planck import planck_function
def bb_flux(wavelength, temperature, angular_radius):
bb_flux = (np.pi) * planck_function(wavelength, temperature) * (angular_radius)**2
return bb_flux
def bb_flux_nounits(wavelength, tem... | import numpy as np
from scipy.optimize import curve_fit
from astropy import units as u
from planck import planck_function, dplanck_dT
def bb_flux(wavelength, temperature, angular_radius):
bb_flux = (np.pi) * planck_function(wavelength, temperature) * (angular_radius)**2
return bb_flux
def bb_flux_nounits(wav... | Add derivative of BB flux with temperature | Add derivative of BB flux with temperature
Added functions which calculate the derivative of the blackbody flux
with temperature (with units and without units)
| Python | mit | JALusk/SNoBoL,JALusk/SuperBoL,JALusk/SNoBoL | ---
+++
@@ -1,7 +1,7 @@
import numpy as np
from scipy.optimize import curve_fit
from astropy import units as u
-from planck import planck_function
+from planck import planck_function, dplanck_dT
def bb_flux(wavelength, temperature, angular_radius):
bb_flux = (np.pi) * planck_function(wavelength, temperatur... |
fcc4eb6feaf05c950bcb0cb3f5861e631dacd8d4 | migrations/versions/16ef0d8ffae1_add_user_roles.py | migrations/versions/16ef0d8ffae1_add_user_roles.py | """Add user roles
Revision ID: 16ef0d8ffae1
Revises: 8acb1453abb
Create Date: 2015-03-17 15:45:05.406297
"""
# revision identifiers, used by Alembic.
revision = '16ef0d8ffae1'
down_revision = '8acb1453abb'
from alembic import op
import sqlalchemy as sa
from findaconf import db
from findaconf.models import Group
... | """Add user roles
Revision ID: 16ef0d8ffae1
Revises: 8acb1453abb
Create Date: 2015-03-17 15:45:05.406297
"""
# revision identifiers, used by Alembic.
revision = '16ef0d8ffae1'
down_revision = '8acb1453abb'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import table, column
from findaconf.models... | Refactor data migration for Group model | Refactor data migration for Group model
Undelying explanation as in commit f580a63909166efccc8030eb36d8b2fe697f7236
| Python | mit | koorukuroo/findaconf,cuducos/findaconf,koorukuroo/findaconf,cuducos/findaconf,cuducos/findaconf,koorukuroo/findaconf | ---
+++
@@ -12,17 +12,23 @@
from alembic import op
import sqlalchemy as sa
+from sqlalchemy.sql import table, column
-from findaconf import db
from findaconf.models import Group
def upgrade():
roles = ['user', 'moderator', 'admin']
- [db.session.add(Group(title=role)) for role in roles]
- db.se... |
eddf3ec729fd385fd3ec2ec425db1d777a302e46 | tensorprob/distributions/exponential.py | tensorprob/distributions/exponential.py | import tensorflow as tf
from .. import config
from ..distribution import Distribution
@Distribution
def Exponential(lambda_, name=None):
X = tf.placeholder(config.dtype, name=name)
Distribution.logp = tf.log(lambda_) - lambda_*X
def cdf(lim):
return tf.constant(1, dtype=config.dtype) - tf.exp(-... | import tensorflow as tf
from .. import config
from ..distribution import Distribution
@Distribution
def Exponential(lambda_, name=None):
X = tf.placeholder(config.dtype, name=name)
Distribution.logp = tf.log(lambda_) - lambda_*X
def integral(lower, upper):
return tf.exp(-lambda_*lower) - tf.exp... | Correct integral used for Exponential distributon | Correct integral used for Exponential distributon
| Python | mit | ibab/tensorprob,tensorprob/tensorprob,ibab/tensorfit | ---
+++
@@ -10,9 +10,9 @@
Distribution.logp = tf.log(lambda_) - lambda_*X
- def cdf(lim):
- return tf.constant(1, dtype=config.dtype) - tf.exp(-lambda_*lim)
+ def integral(lower, upper):
+ return tf.exp(-lambda_*lower) - tf.exp(-lambda_*upper)
- Distribution.integral = lambda lower, ... |
56902792b2a7fdd25bd64781e9e98a63db2ee348 | all/__init__.py | all/__init__.py | ###----------------------------------------------------------------------------
from .help import HyperHelpCommand, HyperHelpNavigateCommand
from .help import HyperHelpListener
###----------------------------------------------------------------------------
| ###----------------------------------------------------------------------------
__version_tuple = (1, 0, 0)
__version__ = ".".join([str(num) for num in __version_tuple])
# These are exposed to Sublime to implement the core of the help system.
from .help import HyperHelpCommand, HyperHelpNavigateCommand
from .help im... | Include a package version number | Include a package version number
This includes in the core package the concept of a version number that
underlying code could use to determine what version of the core it is
interfacing with.
This is only really needed for packages that get at the underlying
core code in hyperhelp, which at the moment would only be t... | Python | mit | OdatNurd/hyperhelp | ---
+++
@@ -1,8 +1,27 @@
###----------------------------------------------------------------------------
+__version_tuple = (1, 0, 0)
+__version__ = ".".join([str(num) for num in __version_tuple])
+
+# These are exposed to Sublime to implement the core of the help system.
from .help import HyperHelpCommand, Hyp... |
28d48dd681dd20d839aa0748ee478947a0eb3da0 | hiss/__init__.py | hiss/__init__.py | import pygame
class Sprite():
def __init__(self, name):
self.name = name
self.costumes = []
def addCostume(self, costumePath):
costume = pygame.image.load(costumePath)
self.costumes.append(costume)
| import pygame, time, random
class Stage():
def __init__(self, name):
self.name = name
self.costumes = []
def addCostume(self, costumePath):
costume = pygame.image.load(costumePath)
self.costumes.append(costume)
class Sprite(Stage):
def __init__(self, name):
... | Split Sprite and Stage, begin code | Split Sprite and Stage, begin code
The way I see it, sprites should be an extension of the stage. After all, the stage is like one big sprite that can't move.
Also, begin code has been added. | Python | mit | PySlither/Slither,PySlither/Slither | ---
+++
@@ -1,10 +1,22 @@
-import pygame
-
-class Sprite():
+import pygame, time, random
+
+class Stage():
def __init__(self, name):
self.name = name
self.costumes = []
def addCostume(self, costumePath):
costume = pygame.image.load(costumePath)
- self.costumes.app... |
eef8c0c99a6a02602cc9da75eadf180e65ad55b0 | collectd_haproxy/__init__.py | collectd_haproxy/__init__.py | version_info = (1, 0, 1)
__version__ = ".".join(map(str, version_info))
try:
import collectd
collectd_present = True
except ImportError:
collectd_present = False
from .plugin import HAProxyPlugin
if collectd_present:
HAProxyPlugin.register(collectd)
| try:
import collectd
collectd_present = True
except ImportError:
collectd_present = False
from .plugin import HAProxyPlugin
version_info = (1, 0, 1)
__version__ = ".".join(map(str, version_info))
if collectd_present:
HAProxyPlugin.register(collectd)
| Fix style test complaing about non-top import. | Fix style test complaing about non-top import.
| Python | mit | wglass/collectd-haproxy | ---
+++
@@ -1,7 +1,3 @@
-version_info = (1, 0, 1)
-
-__version__ = ".".join(map(str, version_info))
-
try:
import collectd
collectd_present = True
@@ -10,6 +6,10 @@
from .plugin import HAProxyPlugin
+version_info = (1, 0, 1)
+
+__version__ = ".".join(map(str, version_info))
+
if collectd_present:
... |
342515edc89d6666a5dc9064de7d2ceea9a7b468 | accelerator/tests/test_program_cycle.py | accelerator/tests/test_program_cycle.py | # MIT License
# Copyright (c) 2017 MassChallenge, Inc.
from __future__ import unicode_literals
from django.test import TestCase
from accelerator.tests.factories import ProgramCycleFactory
class TestProgramCycle(TestCase):
def test_display_name_no_short_name(self):
cycle = ProgramCycleFactory(short_name... | # MIT License
# Copyright (c) 2017 MassChallenge, Inc.
from __future__ import unicode_literals
from django.test import TestCase
from accelerator.tests.factories import ProgramCycleFactory
class TestProgramCycle(TestCase):
def test_display_name_no_short_name(self):
cycle = ProgramCycleFactory(short_name... | Add tests for the functionality added | [AC-7049] Add tests for the functionality added
| Python | mit | masschallenge/django-accelerator,masschallenge/django-accelerator | ---
+++
@@ -13,21 +13,18 @@
cycle = ProgramCycleFactory(short_name=None)
assert cycle.name in str(cycle)
- def test_program_cycle_with_open_applications_has_default_application_type(self):
- cycle = ProgramCycleFactory()
- if (cycle.applications_open and
- not cycle.defaul... |
8e10801ab28b3db02b301c27966aeaabc154329b | opps/core/models/image.py | opps/core/models/image.py | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from opps.core.models.publishable import Publishable
class Image(Publishable):
title = models.CharField(_(u"Title"), max_length=140)
slug = models.SlugField(_(u"Slug"), max_length=150, blank=True)
... | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from opps.core.models.publishable import Publishable
from opps.core.models import Source
class Image(Publishable):
title = models.CharField(_(u"Title"), max_length=140)
slug = models.SlugField(_(u"S... | Change credit to source models | Change credit to source models
| Python | mit | opps/opps,williamroot/opps,jeanmask/opps,williamroot/opps,opps/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,YACOWS/opps,opps/opps,jeanmask/opps,jeanmask/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,opps/opps | ---
+++
@@ -3,6 +3,7 @@
from django.utils.translation import ugettext_lazy as _
from opps.core.models.publishable import Publishable
+from opps.core.models import Source
@@ -14,7 +15,7 @@
description = models.CharField(_(u"Description"), max_length=255,
null=True, blank=True)
- credit... |
6dd1881fc2631602d7e34aede208abf42ed688aa | renderMenu.py | renderMenu.py | #!/usr/bin/env python
import json, os, requests
from awsauth import S3Auth
from datetime import datetime
from pytz import timezone
from flask import Flask, render_template, url_for
from models import app, db, FoodMenu, FoodServices
MIXPANEL_TOKEN = os.environ.get('MIXPANEL_TOKEN')
@app.route('/')
def renderMenu():
n... | #!/usr/bin/env python
import json, os, requests
from awsauth import S3Auth
from datetime import datetime
from pytz import timezone
from flask import Flask, render_template, url_for, jsonify
from models import app, db, FoodMenu, FoodServices
MIXPANEL_TOKEN = os.environ.get('MIXPANEL_TOKEN')
@app.route('/')
def renderM... | Add API endpoints to serve data in JSON format. | Add API endpoints to serve data in JSON format.
| Python | mit | alykhank/FoodMenu,alykhank/FoodMenu,alykhank/FoodMenu | ---
+++
@@ -3,7 +3,7 @@
from awsauth import S3Auth
from datetime import datetime
from pytz import timezone
-from flask import Flask, render_template, url_for
+from flask import Flask, render_template, url_for, jsonify
from models import app, db, FoodMenu, FoodServices
MIXPANEL_TOKEN = os.environ.get('MIXPANEL_... |
3b79447e1027cc4965ab3272c34740b82d79c66c | tools/perf/benchmarks/start_with_url.py | tools/perf/benchmarks/start_with_url.py | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from measurements import startup
import page_sets
from telemetry import benchmark
@benchmark.Disabled
class StartWithUrlCold(benchmark.Benchmark):
"""Mea... | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from measurements import startup
import page_sets
from telemetry import benchmark
@benchmark.Enabled('android', 'has tabs')
class StartWithUrlCold(benchmar... | Enable statup_with_url.cold benchmark on android. | Enable statup_with_url.cold benchmark on android.
The benchmark works locally, and collects an important datapoint for our
current optimization work.
Review URL: https://codereview.chromium.org/508303004
Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#298526}
| Python | bsd-3-clause | axinging/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,fujunwei/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,markYoungH/chromium.src,M4sse/chromium.src,markYoungH/chromium.src,jaruba/chromium.src,M4sse/chromium.src,chuan9/chromium-crosswalk,Jonekee/chromium.src,mohamed--abdel-maksoud/chromium.src,dushu1... | ---
+++
@@ -7,7 +7,7 @@
from telemetry import benchmark
-@benchmark.Disabled
+@benchmark.Enabled('android', 'has tabs')
class StartWithUrlCold(benchmark.Benchmark):
"""Measure time to start Chrome cold with startup URLs"""
tag = 'cold' |
f177e6acbafa514f6e6ac4563cb92c49f3213618 | data_structures/Stack/Python/Stack.py | data_structures/Stack/Python/Stack.py | # Author: AlexBanks97
# Purpose: LIFO Stack implementation using python array.
# Date: October 15th 2017
class Stack(object):
def __init__(self):
# Initialize stack as empty array
self.stack = [] | # Author: AlexBanks97
# Purpose: LIFO Stack implementation using python array.
# Date: October 15th 2017
class Stack(object):
def __init__(self):
# Initialize stack as empty array
self.stack = []
# Return and remove the last element of the stack array.
def pop(self):
# If the stack... | Add pop method and implementation | Add pop method and implementation
| Python | cc0-1.0 | ZoranPandovski/al-go-rithms,Cnidarias/al-go-rithms,ZoranPandovski/al-go-rithms,EUNIX-TRIX/al-go-rithms,manikTharaka/al-go-rithms,ZoranPandovski/al-go-rithms,Deepak345/al-go-rithms,ZoranPandovski/al-go-rithms,EUNIX-TRIX/al-go-rithms,ZoranPandovski/al-go-rithms,Cnidarias/al-go-rithms,manikTharaka/al-go-rithms,Deepak345/a... | ---
+++
@@ -5,4 +5,10 @@
class Stack(object):
def __init__(self):
# Initialize stack as empty array
- self.stack = []
+ self.stack = []
+
+ # Return and remove the last element of the stack array.
+ def pop(self):
+ # If the stack is not empty, pop.
+ if self.stack.le... |
e0ce0095fd488852a7d565ecaf49eba0b8dbd7d5 | db/sql_server/pyodbc.py | db/sql_server/pyodbc.py | from django.db import connection
from django.db.models.fields import *
from south.db import generic
class DatabaseOperations(generic.DatabaseOperations):
"""
django-pyodbc (sql_server.pyodbc) implementation of database operations.
"""
def create_table(self, table_name, fields):
# Tweak stuff a... | from django.db import connection
from django.db.models.fields import *
from south.db import generic
class DatabaseOperations(generic.DatabaseOperations):
"""
django-pyodbc (sql_server.pyodbc) implementation of database operations.
"""
add_column_string = 'ALTER TABLE %s ADD %s;'
def create_ta... | Add column support for sql server | Add column support for sql server
--HG--
extra : convert_revision : svn%3A69d324d9-c39d-4fdc-8679-7745eae9e2c8/trunk%40111
| Python | apache-2.0 | theatlantic/django-south,theatlantic/django-south | ---
+++
@@ -6,6 +6,8 @@
"""
django-pyodbc (sql_server.pyodbc) implementation of database operations.
"""
+
+ add_column_string = 'ALTER TABLE %s ADD %s;'
def create_table(self, table_name, fields):
# Tweak stuff as needed |
98405875fd8ec682caa04244a900e6ce9eac9acb | pavement.py | pavement.py | import sys
from paver.easy import task, needs, path, sh, cmdopts, options
from paver.setuputils import setup, install_distutils_tasks
from distutils.extension import Extension
from distutils.dep_util import newer
sys.path.insert(0, path('.').abspath())
import version
setup(name='microdrop-plugin-manager',
vers... | import platform
import sys
from paver.easy import task, needs, path, sh, cmdopts, options
from paver.setuputils import setup, install_distutils_tasks
from distutils.extension import Extension
from distutils.dep_util import newer
sys.path.insert(0, path('.').abspath())
import version
install_requires = ['configobj',... | Add pywin32 as Windows required package | [FIX] Add pywin32 as Windows required package
| Python | bsd-3-clause | wheeler-microfluidics/mpm | ---
+++
@@ -1,3 +1,4 @@
+import platform
import sys
from paver.easy import task, needs, path, sh, cmdopts, options
@@ -8,6 +9,13 @@
sys.path.insert(0, path('.').abspath())
import version
+
+install_requires = ['configobj', 'path-helpers', 'pip-helpers>=0.6',
+ 'progressbar2', 'pyyaml', 'si-... |
db2c50de660228745cc9a7fafaaa9b3d9e451aee | python/src/setup.py | python/src/setup.py | """Setup specs for packaging, distributing, and installing gcs lib."""
import distribute_setup
distribute_setup.use_setuptools()
import setuptools
setuptools.setup(
name="GoogleAppEngineCloudStorageClient",
version="1.8.3.1",
packages=setuptools.find_packages(),
author="Google App Engine",
auth... | """Setup specs for packaging, distributing, and installing gcs lib."""
import distribute_setup
distribute_setup.use_setuptools()
import setuptools
setuptools.setup(
name="GoogleAppEngineCloudStorageClient",
version="1.9.0.0",
packages=setuptools.find_packages(),
author="Google App Engine",
auth... | Create PyPI Release for 1.9.0.0. | PYTHON: Create PyPI Release for 1.9.0.0.
Revision created by MOE tool push_codebase.
MOE_MIGRATION=6943
| Python | apache-2.0 | aozarov/appengine-gcs-client,GoogleCloudPlatform/appengine-gcs-client,GoogleCloudPlatform/appengine-gcs-client,aozarov/appengine-gcs-client,GoogleCloudPlatform/appengine-gcs-client,aozarov/appengine-gcs-client | ---
+++
@@ -9,7 +9,7 @@
setuptools.setup(
name="GoogleAppEngineCloudStorageClient",
- version="1.8.3.1",
+ version="1.9.0.0",
packages=setuptools.find_packages(),
author="Google App Engine",
author_email="app-engine-pipeline-api@googlegroups.com", |
2b18bc0e0f3b9e0ca14935e2648fb9e6d637c8d0 | backend/rest.py | backend/rest.py | #!/usr/bin/env python
from mcapi.mcapp import app
from mcapi import tservices, public, utils, private, access, process, machine, template, tservices
from mcapi.user import account, datadirs, datafiles, reviews, ud, usergroups, projects, conditions
from mcapi.stater import stater
import sys
if __name__ == '__main__':
... | #!/usr/bin/env python
from mcapi.mcapp import app
from mcapi import tservices, public, utils, private, access, process, machine, template, tservices
from mcapi.user import account, datadirs, datafiles, reviews, ud, usergroups, projects, conditions
from mcapi.stater import stater
import sys
from os import environ
_HOS... | Allow host and port that the service listens on to be set from environment variables. | Allow host and port that the service listens on to be set from environment variables.
| Python | mit | materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org | ---
+++
@@ -5,6 +5,10 @@
from mcapi.user import account, datadirs, datafiles, reviews, ud, usergroups, projects, conditions
from mcapi.stater import stater
import sys
+from os import environ
+
+_HOST = environ.get('MC_SERVICE_HOST') or 'localhost'
+_PORT = environ.get('MC_SERVICE_PORT') or '5000'
if __name__ ==... |
f764e9e0f3cba7c387952fe8f19aa702825e8378 | tests/test_core/test_server.py | tests/test_core/test_server.py | from mock import patch
import sure # noqa
from moto.server import main
def test_wrong_arguments():
try:
main(["name", "test1", "test2", "test3"])
assert False, ("main() when called with the incorrect number of args"
" should raise a system exit")
except SystemExit:
... | from mock import patch
import sure # noqa
from moto.server import main, create_backend_app, DomainDispatcherApplication
def test_wrong_arguments():
try:
main(["name", "test1", "test2", "test3"])
assert False, ("main() when called with the incorrect number of args"
" should... | Add more test coverage for the server. | Add more test coverage for the server.
| Python | apache-2.0 | william-richard/moto,Affirm/moto,Brett55/moto,gjtempleton/moto,whummer/moto,Affirm/moto,rocky4570/moto,ZuluPro/moto,spulec/moto,Brett55/moto,gjtempleton/moto,okomestudio/moto,ZuluPro/moto,alexdebrie/moto,rouge8/moto,william-richard/moto,gjtempleton/moto,botify-labs/moto,braintreeps/moto,2rs2ts/moto,spulec/moto,okomestu... | ---
+++
@@ -1,7 +1,7 @@
from mock import patch
import sure # noqa
-from moto.server import main
+from moto.server import main, create_backend_app, DomainDispatcherApplication
def test_wrong_arguments():
@@ -27,3 +27,21 @@
func_call = run_simple.call_args[0]
func_call[0].should.equal("0.0.0.0")
... |
54add3fa95ab450e5afcbbf7fe8a3205bfc5889c | indra/tests/test_reading_scripts_aws.py | indra/tests/test_reading_scripts_aws.py |
import boto3
from os import path, chdir
from subprocess import check_call
from nose.plugins.attrib import attr
from indra.tools.reading import submit_reading_pipeline as srp
s3 = boto3.client('s3')
HERE = path.dirname(path.abspath(__file__))
@attr('nonpublic')
def test_normal_pmid_reading_call():
chdir(path... |
import boto3
from os import path, chdir
from subprocess import check_call
from nose.plugins.attrib import attr
from indra.tools.reading import submit_reading_pipeline as srp
from indra.sources import sparser
s3 = boto3.client('s3')
HERE = path.dirname(path.abspath(__file__))
@attr('nonpublic')
def test_normal_p... | Add test with currently known-stall sentance. | Add test with currently known-stall sentance.
| Python | bsd-2-clause | bgyori/indra,pvtodorov/indra,pvtodorov/indra,sorgerlab/indra,sorgerlab/indra,sorgerlab/indra,pvtodorov/indra,bgyori/indra,johnbachman/indra,pvtodorov/indra,sorgerlab/belpy,johnbachman/indra,johnbachman/indra,johnbachman/belpy,johnbachman/belpy,sorgerlab/belpy,sorgerlab/belpy,johnbachman/belpy,bgyori/indra | ---
+++
@@ -5,6 +5,7 @@
from nose.plugins.attrib import attr
from indra.tools.reading import submit_reading_pipeline as srp
+from indra.sources import sparser
s3 = boto3.client('s3')
@@ -33,3 +34,11 @@
print("Removing %s..." % entry['Key'])
s3.delete_object(Bucket='bigmech', Key=entry['Key'... |
fbe78315efcbf646710da6bf7d6a9d6c26fa8645 | bayesian_jobs/handlers/clean_postgres.py | bayesian_jobs/handlers/clean_postgres.py | from selinon import StoragePool
from cucoslib.models import WorkerResult, Analysis
from .base import BaseHandler
class CleanPostgres(BaseHandler):
""" Clean JSONB columns in Postgres """
def execute(self):
s3 = StoragePool.get_connected_storage('S3Data')
results = self.postgres.session.query... | from selinon import StoragePool
from cucoslib.models import WorkerResult, Analysis
from .base import BaseHandler
class CleanPostgres(BaseHandler):
""" Clean JSONB columns in Postgres """
def execute(self):
s3 = StoragePool.get_connected_storage('S3Data')
results = self.postgres.session.query... | Mark error flag if an object is not present on S3 | Mark error flag if an object is not present on S3
| Python | apache-2.0 | fabric8-analytics/fabric8-analytics-jobs,fabric8-analytics/fabric8-analytics-jobs | ---
+++
@@ -24,6 +24,11 @@
entry.package.name,
entry.version.identifier,
entry.worker)
- entry.ta... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.