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 |
|---|---|---|---|---|---|---|---|---|---|---|
1160a10a3d78eee3be61d760849e70e645272355 | analytical/__init__.py | analytical/__init__.py | """
Analytics service integration for Django
========================================
The django-analytical application integrates analytics services into a
Django_ project. See the ``docs`` directory for more information.
.. _Django: http://www.djangoproject.com/
"""
__author__ = "Joost Cassee"
__email__ = "joost@... | """
Analytics service integration for Django
========================================
The django-analytical application integrates analytics services into a
Django_ project. See the ``docs`` directory for more information.
.. _Django: http://www.djangoproject.com/
"""
__author__ = "Joost Cassee"
__email__ = "joost@... | Add 'and others' to copyright | Add 'and others' to copyright
| Python | mit | jcassee/django-analytical,ericdwang/django-analytical,machtfit/django-analytical,apocquet/django-analytical,bittner/django-analytical,ChristosChristofidis/django-analytical,pjdelport/django-analytical | ---
+++
@@ -11,5 +11,5 @@
__author__ = "Joost Cassee"
__email__ = "joost@cassee.net"
__version__ = "0.9.0"
-__copyright__ = "Copyright (C) 2011 Joost Cassee"
+__copyright__ = "Copyright (C) 2011 Joost Cassee and others"
__license__ = "MIT License" |
576dc66d2826759e05d55d5ffbef446825a62481 | designatedashboard/__init__.py | designatedashboard/__init__.py | # -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | Fix package name in init.py | Fix package name in init.py
Change-Id: Ib20efd224de709d493d98cfd9ab5dad6005779de
| Python | apache-2.0 | openstack/designate-dashboard,openstack/designate-dashboard,openstack/designate-dashboard | ---
+++
@@ -16,4 +16,4 @@
__version__ = pbr.version.VersionInfo(
- 'designatedashboard').version_string()
+ 'designate-dashboard').version_string() |
b2a977a7285cbe832350492b967213b5261ad6b4 | flask_app/tasks.py | flask_app/tasks.py | from __future__ import absolute_import
import functools
import os
import sys
import logbook
from celery import Celery
from celery.signals import after_setup_logger, after_setup_task_logger
from .app import create_app
_logger = logbook.Logger(__name__)
queue = Celery('tasks', broker='redis://localhost')
queue.con... | from __future__ import absolute_import
import functools
import os
import sys
import logging
import logging.handlers
import logbook
from celery import Celery
from celery.signals import after_setup_logger, after_setup_task_logger
from celery.log import redirect_stdouts_to_logger
from .app import create_app
_logger =... | Fix celery logging in deployment | Fix celery logging in deployment
| Python | mit | getslash/mailboxer,getslash/mailboxer,getslash/mailboxer,vmalloc/mailboxer,vmalloc/mailboxer,vmalloc/mailboxer,Infinidat/lanister,Infinidat/lanister | ---
+++
@@ -4,10 +4,13 @@
import os
import sys
+import logging
+import logging.handlers
import logbook
from celery import Celery
from celery.signals import after_setup_logger, after_setup_task_logger
+from celery.log import redirect_stdouts_to_logger
from .app import create_app
@@ -25,6 +28,15 @@
def s... |
16256c57de5b12b2a1ef148d2ba15db2dfce7407 | foundry/settings_dev.py | foundry/settings_dev.py | from foundry.settings import *
#FOUNDRY['layers'] = ('basic',)
FOUNDRY['layers'] = ('web', 'basic',)
#FOUNDRY['layers'] = ('mid', 'basic',)
#FOUNDRY['layers'] = ('smart', 'mid', 'basic',)
compute_settings(sys.modules[__name__])
| from foundry.settings import *
#FOUNDRY['layers'] = ('basic',)
#FOUNDRY['layers'] = ('smart', 'basic',)
FOUNDRY['layers'] = ('web', 'basic',)
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
}
| Disable caching in development mode | Disable caching in development mode
| Python | bsd-3-clause | praekelt/jmbo-foundry,praekelt/jmbo-foundry,praekelt/jmbo-foundry | ---
+++
@@ -1,9 +1,11 @@
from foundry.settings import *
#FOUNDRY['layers'] = ('basic',)
+#FOUNDRY['layers'] = ('smart', 'basic',)
FOUNDRY['layers'] = ('web', 'basic',)
-#FOUNDRY['layers'] = ('mid', 'basic',)
-#FOUNDRY['layers'] = ('smart', 'mid', 'basic',)
-
-compute_settings(sys.modules[__name__])
+CACHE... |
796f9ff27f579557237c48196eb50d40269c6840 | glitch/__main__.py | glitch/__main__.py | from . import config
from . import apikeys
import argparse
import logging
parser = argparse.ArgumentParser(description="Invoke the Infinite Glitch server(s)")
parser.add_argument("server", help="Server to invoke", choices=["main", "renderer"], nargs="?", default="main")
parser.add_argument("-l", "--log", help="Logging... | from . import config
from . import apikeys
import argparse
# Hack: Allow "python -m glitch database" to be the same as "glitch.database"
import sys
if len(sys.argv) > 1 and sys.argv[1] == "database":
from . import database
import clize
sys.exit(clize.run(*database.commands, args=sys.argv[1:]))
import logging
parse... | Allow 'python -m glitch database' as well as with a dot | Allow 'python -m glitch database' as well as with a dot
| Python | artistic-2.0 | MikeiLL/appension,MikeiLL/appension,Rosuav/appension,Rosuav/appension,MikeiLL/appension,MikeiLL/appension,Rosuav/appension,Rosuav/appension | ---
+++
@@ -1,6 +1,13 @@
from . import config
from . import apikeys
import argparse
+
+# Hack: Allow "python -m glitch database" to be the same as "glitch.database"
+import sys
+if len(sys.argv) > 1 and sys.argv[1] == "database":
+ from . import database
+ import clize
+ sys.exit(clize.run(*database.commands, args... |
452b48b9313af8126052a32230e789dff2c69df7 | frontui/data.py | frontui/data.py | """ Data layer """
# pylint: disable=line-too-long
import json
import os
from frontui.models import ChecklistInfo
class DataProvider:
""" Data provider (objects, questions, etc) """
def __init__(self):
self.data_dir = './frontui/app_data'
self.checklists_dir = self.data_dir + '/checklists'
... | """ Data layer """
# pylint: disable=line-too-long
import json
import os
from frontui.models import ChecklistInfo
class DataProvider:
""" Data provider (objects, questions, etc) """
def __init__(self):
self.data_dir = './frontui/app_data'
self.checklists_dir = self.data_dir + '/checklists'
... | Fix non ascii symbols in json | Fix non ascii symbols in json
| Python | mit | nixxa/SecretShopper,nixxa/SecretShopper,nixxa/SecretShopper | ---
+++
@@ -21,7 +21,7 @@
def save_checklist(self, obj_num, obj_date, obj_dict):
""" Save checklist data """
- obj_json = json.dumps(obj_dict, sort_keys=True, indent=4)
+ obj_json = json.dumps(obj_dict, sort_keys=True, indent=4, ensure_ascii=False)
filedir = self.checklists_dir ... |
0d572d60522ae0e80105330981a66bc541434b99 | rip/filter_operators.py | rip/filter_operators.py |
EQUALS = 'equals'
GT = 'gt'
LT = 'lt'
OPERATOR_SEPARATOR = '__'
REVERSE_ORDER = '-'
ALL_OPERATORS = {EQUALS: 1, GT: 1, LT: 1}
def split_to_field_and_filter_type(filter_name):
filter_split = filter_name.split(OPERATOR_SEPARATOR)
filter_type = filter_split[-1] if len(filter_split) > 0 else None
if filte... |
EQUALS = 'equals'
GT = 'gt'
LT = 'lt'
IN = 'in'
OPERATOR_SEPARATOR = '__'
REVERSE_ORDER = '-'
ALL_OPERATORS = {EQUALS: 1, GT: 1, LT: 1, IN: 1}
def split_to_field_and_filter_type(filter_name):
filter_split = filter_name.split(OPERATOR_SEPARATOR)
filter_type = filter_split[-1] if len(filter_split) > 0 else N... | Support __in as operator for backwards comp | Support __in as operator for backwards comp
| Python | mit | Aplopio/rip,Aplopio/django_rip | ---
+++
@@ -2,11 +2,12 @@
EQUALS = 'equals'
GT = 'gt'
LT = 'lt'
+IN = 'in'
OPERATOR_SEPARATOR = '__'
REVERSE_ORDER = '-'
-ALL_OPERATORS = {EQUALS: 1, GT: 1, LT: 1}
+ALL_OPERATORS = {EQUALS: 1, GT: 1, LT: 1, IN: 1}
def split_to_field_and_filter_type(filter_name): |
dc6819f67a5f348d260c36c496bc9d116a875ef7 | backend/backend/serializers.py | backend/backend/serializers.py | from rest_framework import serializers
from .models import Animal
class AnimalSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Animal
fields = ('id', 'name', 'dob', 'gender', 'active', 'own', 'father', 'mother') | from rest_framework import serializers
from .models import Animal
class AnimalSerializer(serializers.ModelSerializer):
class Meta:
model = Animal
fields = ('id', 'name', 'dob', 'gender', 'active', 'own', 'father', 'mother') | Change sanitizer to normal model sanitizer, so it sends ids of parents. | Change sanitizer to normal model sanitizer, so it sends ids of parents.
| Python | apache-2.0 | mmlado/animal_pairing,mmlado/animal_pairing | ---
+++
@@ -1,7 +1,7 @@
from rest_framework import serializers
from .models import Animal
-class AnimalSerializer(serializers.HyperlinkedModelSerializer):
+class AnimalSerializer(serializers.ModelSerializer):
class Meta:
model = Animal
fields = ('id', 'name', 'dob', 'gender', 'active', 'own... |
988cac30eeb3ca9ee25378581371e5ea61faec3e | paypal/exceptions.py | paypal/exceptions.py | from oscar.apps.payment.exceptions import PaymentError
class PayPalError(PaymentError):
pass
| try:
from oscar.apps.payment.exceptions import PaymentError
except ImportError:
class PaymentError(Exception):
pass
class PayPalError(PaymentError):
pass | Make gateway importable without django-oscar installed. | Make gateway importable without django-oscar installed.
| Python | bsd-3-clause | vintasoftware/django-oscar-paypal,ZachGoldberg/django-oscar-paypal,bharling/django-oscar-worldpay,britco/django-oscar-paypal,st8st8/django-oscar-paypal,evonove/django-oscar-paypal,embedded1/django-oscar-paypal,bharling/django-oscar-worldpay,FedeDR/django-oscar-paypal,django-oscar/django-oscar-paypal,django-oscar/django... | ---
+++
@@ -1,5 +1,8 @@
-from oscar.apps.payment.exceptions import PaymentError
-
+try:
+ from oscar.apps.payment.exceptions import PaymentError
+except ImportError:
+ class PaymentError(Exception):
+ pass
class PayPalError(PaymentError):
pass |
8fa0c30cce8d47344ea66a26d4d627fe12c46ee9 | pombola/settings/south_africa.py | pombola/settings/south_africa.py | import re
from .base import *
from .south_africa_base import *
INSTALLED_APPS = insert_after(INSTALLED_APPS,
'markitup',
'pombola.' + COUNTRY_APP)
INSTALLED_APPS += OPTIONAL_APPS
# This is needed by the speeches application
MIDDLEWARE_CLASSES += ( 'pombola... | import re
from .base import *
from .south_africa_base import *
HAYSTACK_CONNECTIONS['default']['EXCLUDED_INDEXES'] = ['pombola.search.search_indexes.PlaceIndex']
INSTALLED_APPS = insert_after(INSTALLED_APPS,
'markitup',
'pombola.' + COUNTRY_APP)
INSTALLED_... | Add PlaceIndex to the Haystack EXCLUDED_INDEXES | ZA: Add PlaceIndex to the Haystack EXCLUDED_INDEXES
This was a mistake in the earlier rearrangement of the settings
modules; PlaceIndex needed to be added to Haystack EXCLUDED_INDEXES
in the south_africa module as well as tests_south_africa.
| Python | agpl-3.0 | hzj123/56th,mysociety/pombola,geoffkilpin/pombola,patricmutwiri/pombola,mysociety/pombola,ken-muturi/pombola,patricmutwiri/pombola,patricmutwiri/pombola,hzj123/56th,hzj123/56th,hzj123/56th,geoffkilpin/pombola,patricmutwiri/pombola,ken-muturi/pombola,mysociety/pombola,mysociety/pombola,ken-muturi/pombola,hzj123/56th,geo... | ---
+++
@@ -2,6 +2,8 @@
from .base import *
from .south_africa_base import *
+
+HAYSTACK_CONNECTIONS['default']['EXCLUDED_INDEXES'] = ['pombola.search.search_indexes.PlaceIndex']
INSTALLED_APPS = insert_after(INSTALLED_APPS,
'markitup', |
cbacb4148eba442a5d2b178721bf5805d31fdf8d | disposable_email_checker/__init__.py | disposable_email_checker/__init__.py | from django.conf import settings
import re
import sys
class DisposableEmailChecker():
"""
Check if an email is from a disposable
email service
"""
def __init__(self):
self.emails = [line.strip() for line in open(settings.DISPOSABLE_EMAIL_DOMAINS)]
def chunk(l,n):
retu... | from django.conf import settings
import re
import sys
class DisposableEmailChecker():
"""
Check if an email is from a disposable
email service
"""
def __init__(self):
self.emails = [line.strip() for line in open(settings.DISPOSABLE_EMAIL_DOMAINS)]
def chunk(self,l,n):
... | Fix bug in chunk arguments | Fix bug in chunk arguments
| Python | bsd-3-clause | aaronbassett/DisposableEmailChecker | ---
+++
@@ -12,7 +12,7 @@
def __init__(self):
self.emails = [line.strip() for line in open(settings.DISPOSABLE_EMAIL_DOMAINS)]
- def chunk(l,n):
+ def chunk(self,l,n):
return (l[i:i+n] for i in xrange(0, len(l), n))
def is_disposable(self, email): |
8a28dee1bc3ca8ec83705cc431768ef18be7798c | segments/virtual_env.py | segments/virtual_env.py | import os
def add_virtual_env_segment():
env = os.getenv('VIRTUAL_ENV')
if env is None:
return
env_name = os.path.basename(env)
bg = Color.VIRTUAL_ENV_BG
fg = Color.VIRTUAL_ENV_FG
powerline.append(' %s ' % env_name, fg, bg)
add_virtual_env_segment()
| import os
def add_virtual_env_segment():
env = os.getenv('VIRTUAL_ENV') or os.getenv('CONDA_ENV_PATH')
if env is None:
return
env_name = os.path.basename(env)
bg = Color.VIRTUAL_ENV_BG
fg = Color.VIRTUAL_ENV_FG
powerline.append(' %s ' % env_name, fg, bg)
add_virtual_env_segment()
| Allow venv segment to be from Anaconda | Allow venv segment to be from Anaconda
| Python | mit | banga/powerline-shell,tswsl1989/powerline-shell,paulhybryant/powerline-shell,b-ryan/powerline-shell,rbanffy/powerline-shell,b-ryan/powerline-shell,Menci/powerline-shell,iKrishneel/powerline-shell,milkbikis/powerline-shell,paulhybryant/powerline-shell,torbjornvatn/powerline-shell,banga/powerline-shell,bitIO/powerline-sh... | ---
+++
@@ -1,7 +1,7 @@
import os
def add_virtual_env_segment():
- env = os.getenv('VIRTUAL_ENV')
+ env = os.getenv('VIRTUAL_ENV') or os.getenv('CONDA_ENV_PATH')
if env is None:
return
|
4262e9fa6b67d56c33202ce05d6a1128338ebf7f | zipline/gens/brokers/__init__.py | zipline/gens/brokers/__init__.py | #
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under ... | #
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under ... | Fix ib_broker import from brokers | Fix ib_broker import from brokers
| Python | apache-2.0 | Scapogo/zipline,florentchandelier/zipline,florentchandelier/zipline,Scapogo/zipline | ---
+++
@@ -11,6 +11,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from ib_broker import IBBroker
+from .ib_broker import IBBroker
__all__ = ["IBBroker"] |
6b762607914e1c79bc05f7e8d5cdbe6c6d7a49e4 | hiro/patches.py | hiro/patches.py | """
patched builtin time classes for use by :class:`hiro.Timeline`
"""
import abc
from datetime import date as realdate
from datetime import datetime as realdatetime
import time
import six
class DatetimeMeta(abc.ABCMeta):
"""
meta class to allow interaction between :class:`datetime.datetime`
objects creat... | """
patched builtin time classes for use by :class:`hiro.Timeline`
"""
import abc
from datetime import date as realdate
from datetime import datetime as realdatetime
import time
import six
class DatetimeMeta(abc.ABCMeta):
"""
meta class to allow interaction between :class:`datetime.datetime`
objects creat... | Fix issue with daylight saving time + utcnow | Fix issue with daylight saving time + utcnow
Fixes issue #2
| Python | mit | alisaifee/hiro,alisaifee/hiro | ---
+++
@@ -39,7 +39,7 @@
@classmethod
def utcnow(cls):
- return cls.fromtimestamp(time.mktime(time.gmtime()))
+ return cls.utcfromtimestamp(time.time())
@six.add_metaclass(DateMeta)
class Date(realdate): |
3d91950735d8b42e030f6f479a32369804e90ac0 | gaphas/picklers.py | gaphas/picklers.py | """
Some extra picklers needed to gracefully dump and load a canvas.
"""
import copyreg
import types
import cairo
from future import standard_library
standard_library.install_aliases()
# Allow instancemethod to be pickled:
def construct_instancemethod(funcname, self, clazz):
func = getattr(clazz, funcname)
... | """
Some extra picklers needed to gracefully dump and load a canvas.
"""
import copyreg
import types
import cairo
from future import standard_library
standard_library.install_aliases()
# Allow cairo.Matrix to be pickled:
def construct_cairo_matrix(*args):
return cairo.Matrix(*args)
def reduce_cairo_matrix(m):... | Remove ununsed pickle code for instance methods | Remove ununsed pickle code for instance methods
| Python | lgpl-2.1 | amolenaar/gaphas | ---
+++
@@ -10,23 +10,6 @@
standard_library.install_aliases()
-
-# Allow instancemethod to be pickled:
-def construct_instancemethod(funcname, self, clazz):
- func = getattr(clazz, funcname)
- return types.MethodType(func, self)
-
-
-def reduce_instancemethod(im):
- return (
- construct_instancem... |
aa6d6e59be8c0b8577517bd16de3e75de7f0e570 | project_name/urls.py | project_name/urls.py | """{{project_name}} URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
... | # -*- coding: utf-8 -*-
from django.conf.urls import include, url
from django.contrib import admin
from django.conf import settings
from django.views.generic import TemplateView
from django.conf.urls.static import static
from django.views import defaults as default_views
urlpatterns = [
url(settings.ADMIN_URL, in... | Improve url patterns structure, enable debugging common error pages while debugging | Improve url patterns structure, enable debugging common error pages while debugging
| Python | mit | Nikola-K/django-template,Nikola-K/django-template | ---
+++
@@ -1,25 +1,24 @@
-"""{{project_name}} URL Configuration
+# -*- coding: utf-8 -*-
-The `urlpatterns` list routes URLs to views. For more information please see:
- https://docs.djangoproject.com/en/1.8/topics/http/urls/
-Examples:
-Function views
- 1. Add an import: from my_app import views
- 2. Ad... |
a4a139e4476fefe431e6561bd0ef950cb74c0db4 | htpt/buffers.py | htpt/buffers.py | from constants import *
class Buffer:
"""Stores data, buffers it and sends it to the Framer"""
def __init__(self):
self.buffer = []
self.callback = None
def attach(self, callback):
self.callback = callback
def addData(self, data):
# we can't add all the data, there's n... | from constants import *
class Buffer:
"""Stores data, buffers it and sends it to the Framer"""
def __init__(self):
self.buffer = []
self.callback = None
def attach(self, callback):
self.callback = callback
def addData(self, data):
# we can't add all the data, there's not enough space
if l... | Change indentation to 2 spaces | Change indentation to 2 spaces
| Python | mit | gsathya/htpt,gsathya/htpt | ---
+++
@@ -1,30 +1,30 @@
from constants import *
class Buffer:
- """Stores data, buffers it and sends it to the Framer"""
- def __init__(self):
- self.buffer = []
- self.callback = None
+ """Stores data, buffers it and sends it to the Framer"""
+ def __init__(self):
+ self.buffer = []
+ ... |
ee7a49fa7094160f27993adb25fb2d98db518cb9 | pinax/wiki/urls.py | pinax/wiki/urls.py | import os
from django.conf.urls import patterns, url
from .conf import settings
from .views import index, page, edit, file_download, file_upload
urlpatterns = patterns(
"",
url(r"^file-download/(\d+)/([^/]+)$", file_download, name="pinax_wiki_file_download"),
url(r"^file-upload/$", file_upload, name="pin... | import os
from django.conf.urls import url
from .conf import settings
from .views import index, page, edit, file_download, file_upload
urlpatterns = [
url(r"^file-download/(\d+)/([^/]+)$", file_download, name="pinax_wiki_file_download"),
url(r"^file-upload/$", file_upload, name="pinax_wiki_file_upload")
]
f... | Fix for patterns() being deprecated and now removed in Django 1.10 | Fix for patterns() being deprecated and now removed in Django 1.10 | Python | mit | pinax/pinax-wiki | ---
+++
@@ -1,20 +1,18 @@
import os
-from django.conf.urls import patterns, url
+from django.conf.urls import url
from .conf import settings
from .views import index, page, edit, file_download, file_upload
-urlpatterns = patterns(
- "",
+urlpatterns = [
url(r"^file-download/(\d+)/([^/]+)$", file_down... |
c9534dfb1b2aaa8cb4aaee3a3471ac39d956e5b7 | plugins/spotify.py | plugins/spotify.py | from plugins.util import command, get_url
import json
import re
SPOTIFY_URI_REGEX = r"(?<=spotify:)(?:track|album|artist):[a-zA-Z0-9]{22}"
ENDPOINT = "https://api.spotify.com/v1/{0}s/{1}"
@command()
def spotify(m):
"""Retrieve information about a Spotify URI."""
spotify_uris = re.findall(SPOTIFY_URI_REGEX, m.... | from plugins.util import command, get_url
import json
import re
SPOTIFY_URI_REGEX = r"(?<=spotify:)(?:track|album|artist):[a-zA-Z0-9]{22}"
ENDPOINT = "https://api.spotify.com/v1/{0}s/{1}"
@command()
def spotify(m):
"""Retrieve information about a Spotify URI."""
spotify_uris = re.findall(SPOTIFY_URI_REGEX, m.... | Remove URL from Spotify response | Remove URL from Spotify response
| Python | mit | molly/GorillaBot,molly/GorillaBot,quanticle/GorillaBot,quanticle/GorillaBot | ---
+++
@@ -19,12 +19,10 @@
if req:
blob = json.loads(req)
if type == "track" or type == "album":
- m.bot.private_message(m.location, '"{0}" by {1} - {2}'
- .format(blob["name"], blob["artists"][0]["name"],
- ... |
794868448bc9740bc76f9c3381ff75385f72c769 | kinetic_widget/admin.py | kinetic_widget/admin.py | from django.contrib import admin
from kinetic_widget.models import *
admin.site.register(TestWidgetSimple)
admin.site.register(TestWidgetMulti)
| from django.contrib import admin
from django.http import HttpResponse
from django.conf.urls import url, patterns
from django.shortcuts import render_to_response, render, get_object_or_404, redirect
from kinetic_widget.models import *
class TestWidgetSimpleAdmin(admin.ModelAdmin):
def get_urls(self):
urls ... | Test Widget: added support for displaying raw json | Test Widget: added support for displaying raw json
| Python | bsd-2-clause | knaperek/gits,knaperek/gits,knaperek/gits | ---
+++
@@ -1,6 +1,24 @@
from django.contrib import admin
+from django.http import HttpResponse
+from django.conf.urls import url, patterns
+from django.shortcuts import render_to_response, render, get_object_or_404, redirect
from kinetic_widget.models import *
-admin.site.register(TestWidgetSimple)
-admin.site... |
b6eaabd47e98d51e4392c5419a59a75a0db45bf1 | geotrek/core/tests/test_forms.py | geotrek/core/tests/test_forms.py | from django.conf import settings
from django.test import TestCase
from unittest import skipIf
from geotrek.core.factories import TrailFactory
from geotrek.authent.factories import UserFactory
from geotrek.core.forms import TrailForm
@skipIf(not settings.TREKKING_TOPOLOGY_ENABLED, 'Test with dynamic segmentation onl... | from django.conf import settings
from django.test import TestCase
from unittest import skipIf
from geotrek.core.factories import TrailFactory, PathFactory
from geotrek.authent.factories import UserFactory
from geotrek.core.forms import TrailForm, PathForm
@skipIf(not settings.TREKKING_TOPOLOGY_ENABLED, 'Test with d... | Add tests for path overlapping check | Add tests for path overlapping check
| Python | bsd-2-clause | makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin | ---
+++
@@ -3,9 +3,9 @@
from unittest import skipIf
-from geotrek.core.factories import TrailFactory
+from geotrek.core.factories import TrailFactory, PathFactory
from geotrek.authent.factories import UserFactory
-from geotrek.core.forms import TrailForm
+from geotrek.core.forms import TrailForm, PathForm
... |
cef2fbc059c5c9f55e4379e1963b4b974d09b7fb | statbot/__init__.py | statbot/__init__.py | #
# __init__.py
#
# statbot - Store Discord records for later analysis
# Copyright (c) 2017 Ammon Smith
#
# statbot is available free of charge under the terms of the MIT
# License. You are free to redistribute and/or modify it under those
# terms. It is distributed in the hopes that it will be useful, but
# WITHOUT AN... | #
# __init__.py
#
# statbot - Store Discord records for later analysis
# Copyright (c) 2017 Ammon Smith
#
# statbot is available free of charge under the terms of the MIT
# License. You are free to redistribute and/or modify it under those
# terms. It is distributed in the hopes that it will be useful, but
# WITHOUT AN... | Bump statbot version to 0.4.0 | Bump statbot version to 0.4.0
| Python | mit | strinking/statbot,strinking/statbot | ---
+++
@@ -19,4 +19,4 @@
'util',
]
-__version__ = '0.3.0'
+__version__ = '0.4.0' |
6392e2d9487d5718d13f73f87797ad142ff14e50 | src/zeit/find/cli.py | src/zeit/find/cli.py | from argparse import ArgumentParser
from gocept.runner import once
from zeit.find import search, elastic
def parse():
parser = ArgumentParser(description='Elasticsearch debug client')
parser.add_argument('-f', '--fulltext', help='Fulltext search term')
parser.add_argument('-a', '--authors', help='Search a... | from argparse import ArgumentParser
from gocept.runner import once
from logging import getLogger
from operator import itemgetter
from zeit.cms.interfaces import ICMSContent
from zeit.find import search, elastic
log = getLogger(__name__)
def parse():
parser = ArgumentParser(description='Elasticsearch debug clien... | Allow search script to report the query & results. | TMS-240: Allow search script to report the query & results.
In addition search conditions are now specified using a <field>:<term>
notation:
$ work/zope/bin/search-solr --verbose "authors:Klaus Mustermann"
$ work/zope/bin/search-elastic --verbose "fulltext:Klaus Lage"
| Python | bsd-3-clause | ZeitOnline/zeit.find,ZeitOnline/zeit.find | ---
+++
@@ -1,28 +1,41 @@
from argparse import ArgumentParser
from gocept.runner import once
+from logging import getLogger
+from operator import itemgetter
+from zeit.cms.interfaces import ICMSContent
from zeit.find import search, elastic
+
+
+log = getLogger(__name__)
def parse():
parser = ArgumentPars... |
8ef82138d513630f5d83adef6233c6a9386019a1 | main.py | main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICEN... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICEN... | Fix problem with repeating rows. Good data on 3x3. | Fix problem with repeating rows. Good data on 3x3.
| Python | apache-2.0 | zimolzak/ffuu,zimolzak/ffuu | ---
+++
@@ -18,13 +18,18 @@
service = build("customsearch", "v1", developerKey=mykey)
n = 3 # Max number of Fs or Us.
-M = [[None] * (n+1)] * (n+1)
+M = []
+T = []
-for i in range(1, n+1):
- for j in range(1, n+1):
- query = ("f" * i) + ("u" * j)
+for i in range(n):
+ M.append([])
+ T.append([])... |
a83949ef067a5302bd1bb1f428c40c1c244b9f0d | main.py | main.py | from createCollection import createCollection
from ObjectFactories.albumFactory import AlbumFactory
from ObjectFactories.bookFactory import BookFactory
from ObjectFactories.itemFactory import ItemFactory
from ObjectFactories.movieFactory import MovieFactory
def main():
createCollection('agarner','books')
... | from createCollection import createCollection
from ObjectFactories.ItemFactory import ItemFactory
from DataObjects.Collection import Collection
import datetime
import json
def main():
#createCollection('agarner','books')
now = datetime.datetime.now()
items = []
for i in range(0,10):
... | Implement export data to json test | Implement export data to json test
| Python | apache-2.0 | AmosGarner/PyInventory | ---
+++
@@ -1,21 +1,19 @@
from createCollection import createCollection
-from ObjectFactories.albumFactory import AlbumFactory
-from ObjectFactories.bookFactory import BookFactory
-from ObjectFactories.itemFactory import ItemFactory
-from ObjectFactories.movieFactory import MovieFactory
+from ObjectFactories.ItemFac... |
cd5802850fab20648748b4be4a47ad4cc050c32d | tests/test_fields/common_tests.py | tests/test_fields/common_tests.py | from unittest import TestCase
from lie2me import Field
class CommonTests(object):
def get_instance(self):
return self.Field()
def test_submitting_empty_value_on_required_field_returns_error(self):
field = self.get_instance()
field.required = True
value, error = field.submit(f... | from unittest import TestCase
from lie2me import Field
class CommonTests(object):
def get_instance(self):
return self.Field()
def test_submitting_empty_value_on_required_field_returns_error(self):
field = self.get_instance()
field.required = True
value, error = field.submit(f... | Fix detail in one of the common tests | Fix detail in one of the common tests
The value returned by the submit will not necessarily be truish.
| Python | mit | hugollm/lie2me,hugollm/lie2me | ---
+++
@@ -28,7 +28,6 @@
field = self.get_instance()
field.default = self.valid_default
value, error = field.submit(field.empty_value())
- self.assertTrue(value)
self.assertFalse(error)
def test_field_instance_can_overwrite_specific_messages(self): |
2306478f67a93e27dd9d7d397f97e3641df3516a | ipython_startup.py | ipython_startup.py | import scipy as sp
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
| from __future__ import division
from __future__ import absolute_import
import scipy as sp
import itertools as it
import functools as ft
import operator as op
import sys
import sympy
# Plotting
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.pyplot import subplots
from matplotl... | Add lots of useful default imports to ipython | Add lots of useful default imports to ipython
| Python | cc0-1.0 | davidshepherd7/dotfiles,davidshepherd7/dotfiles,davidshepherd7/dotfiles,davidshepherd7/dotfiles,davidshepherd7/dotfiles | ---
+++
@@ -1,3 +1,24 @@
+from __future__ import division
+from __future__ import absolute_import
+
import scipy as sp
+import itertools as it
+import functools as ft
+import operator as op
+import sys
+import sympy
+
+
+# Plotting
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
+from matpl... |
109085a9f5f6eded6ea2afe1f6aabaf183980d7c | scripts/jenkins/cloud/ansible/roles/heat-generator/files/dns-update.py | scripts/jenkins/cloud/ansible/roles/heat-generator/files/dns-update.py | #!/usr/bin/env python
import argparse
import yaml
def parse_commandline():
parser = argparse.ArgumentParser()
parser.add_argument(
"--dns-servers",
metavar="NAME",
help="A list of nameservers",
nargs="+",
default=[])
parser.add_argument(
"--ntp-servers",
... | #!/usr/bin/env python
import argparse
import yaml
def parse_commandline():
parser = argparse.ArgumentParser()
parser.add_argument(
"--dns-servers",
metavar="NAME",
help="A list of nameservers",
nargs="+",
default=[])
parser.add_argument(
"--ntp-servers",
... | Add option for name and path of cloudConfig.yml file | Add option for name and path of cloudConfig.yml file
This change adds a command line option to the dns script to specify
the name and location of the `cloudConfig.yml` file.
Signed-off-by: Nicolas Bock <4ad6fd604400c7892c7a2cb53bf674987bcaa405@suse.com>
| Python | apache-2.0 | aspiers/automation,SUSE-Cloud/automation,gosipyan/automation,gosipyan/automation,gosipyan/automation,gosipyan/automation,SUSE-Cloud/automation,aspiers/automation,aspiers/automation,aspiers/automation,SUSE-Cloud/automation,SUSE-Cloud/automation | ---
+++
@@ -19,6 +19,11 @@
help="A list of ntp servers",
nargs="+",
default=[])
+ parser.add_argument(
+ "--cloud-config",
+ metavar="FILE",
+ help="The cloudConfig.yml FILE",
+ default="cloudConfig.yml")
return parser.parse_args()
@@ -26,11 +31,11 @@... |
58ae075463518e477185816094eb83f42ce5b77c | gcloud/bigquery/__init__.py | gcloud/bigquery/__init__.py | # Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | # Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | Add public API entties from 'bigquery.table'. | Add public API entties from 'bigquery.table'.
| Python | apache-2.0 | CyrusBiotechnology/gcloud-python,tseaver/google-cloud-python,Fkawala/gcloud-python,waprin/gcloud-python,jonparrott/gcloud-python,EugenePig/gcloud-python,dhermes/google-cloud-python,tswast/google-cloud-python,thesandlord/gcloud-python,tswast/google-cloud-python,EugenePig/gcloud-python,jbuberel/gcloud-python,dhermes/goog... | ---
+++
@@ -24,3 +24,5 @@
from gcloud.bigquery.client import Client
from gcloud.bigquery.connection import SCOPE
from gcloud.bigquery.dataset import Dataset
+from gcloud.bigquery.table import SchemaField
+from gcloud.bigquery.table import Table |
661baf5e280f64824bf983b710c54efccb93a41a | oscar/apps/wishlists/forms.py | oscar/apps/wishlists/forms.py | # -*- coding: utf-8 -*-
from django import forms
from django.db.models import get_model
from django.forms.models import inlineformset_factory
WishList = get_model('wishlists', 'WishList')
Line = get_model('wishlists', 'Line')
class WishListForm(forms.ModelForm):
def __init__(self, user, *args, **kwargs):
... | # -*- coding: utf-8 -*-
from django import forms
from django.db.models import get_model
from django.forms.models import inlineformset_factory, fields_for_model
WishList = get_model('wishlists', 'WishList')
Line = get_model('wishlists', 'Line')
class WishListForm(forms.ModelForm):
def __init__(self, user, *args,... | Set size on wishlist line quantity form field | Set size on wishlist line quantity form field
This doesn't actually work since there is an overriding CSS style. When
issue #851 is resolved, this should start working.
| Python | bsd-3-clause | sasha0/django-oscar,nickpack/django-oscar,elliotthill/django-oscar,DrOctogon/unwash_ecom,josesanch/django-oscar,bnprk/django-oscar,kapari/django-oscar,marcoantoniooliveira/labweb,solarissmoke/django-oscar,kapt/django-oscar,nickpack/django-oscar,machtfit/django-oscar,jlmadurga/django-oscar,marcoantoniooliveira/labweb,Bo... | ---
+++
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from django import forms
from django.db.models import get_model
-from django.forms.models import inlineformset_factory
+from django.forms.models import inlineformset_factory, fields_for_model
WishList = get_model('wishlists', 'WishList')
Line = get_model('wishlis... |
e5322958f14b2428b74de726476fd98adae8c454 | app.py | app.py | from flask import Flask, render_template, request, redirect
import requests
import pandas as pd
from datetime import datetime
from bokeh.plotting import figure, output_notebook, output_file, save
app = Flask(__name__)
@app.route('/')
def main():
return redirect('/index')
@app.route('/index', methods=['GET', 'POS... | from flask import Flask, render_template, request, redirect
import requests
import pandas as pd
from datetime import datetime
from bokeh.plotting import figure, output_notebook, output_file, save
app = Flask(__name__)
# @app.route('/')
# def main():
# return redirect('/index')
@app.route('/', methods=['GET', 'PO... | Remove redirect to avoid Chrome privacy error | Remove redirect to avoid Chrome privacy error
| Python | mit | gsganden/pitcher-reports,gsganden/pitcher-reports | ---
+++
@@ -6,11 +6,11 @@
app = Flask(__name__)
-@app.route('/')
-def main():
- return redirect('/index')
+# @app.route('/')
+# def main():
+# return redirect('/index')
-@app.route('/index', methods=['GET', 'POST'])
+@app.route('/', methods=['GET', 'POST'])
def index():
if request.method == 'GET':... |
5c64fe29690e2471aef20473592f0dcebac4eff8 | tests/_support/contextualized.py | tests/_support/contextualized.py | from invoke import ctask
@ctask
def go(ctx):
return ctx
@ctask
def run(ctx):
ctx.run('x')
| from invoke import ctask
@ctask
def go(ctx):
return ctx
@ctask
def run(ctx):
ctx.run('false')
| Tweak a test so it fails more usefully when mocking doesn't work, heh | Tweak a test so it fails more usefully when mocking doesn't work, heh
| Python | bsd-2-clause | kejbaly2/invoke,frol/invoke,pyinvoke/invoke,singingwolfboy/invoke,pfmoore/invoke,mattrobenolt/invoke,tyewang/invoke,mkusz/invoke,mattrobenolt/invoke,mkusz/invoke,kejbaly2/invoke,frol/invoke,pfmoore/invoke,pyinvoke/invoke | ---
+++
@@ -8,4 +8,4 @@
@ctask
def run(ctx):
- ctx.run('x')
+ ctx.run('false') |
67a102e5da283e318928028e54f6a85b4d266043 | nipap/nipap/nipapconfig.py | nipap/nipap/nipapconfig.py | import ConfigParser
class NipapConfig(ConfigParser.SafeConfigParser):
""" Makes configuration data available.
Implemented as a class with a shared state; once an instance has been
created, new instances with the same state can be obtained by calling
the custructor again.
"""
__sh... | import ConfigParser
class NipapConfig(ConfigParser.SafeConfigParser):
""" Makes configuration data available.
Implemented as a class with a shared state; once an instance has been
created, new instances with the same state can be obtained by calling
the custructor again.
"""
__sh... | Remove requirement on presence of config file | Remove requirement on presence of config file
The NipapConfig object required the presence of a configuration file. As
it is benficial to be able to load the NipapConfig without a
configuration file (for example when building docs using Sphinx), this
requirement has been removed.
| Python | mit | fredsod/NIPAP,ettrig/NIPAP,SoundGoof/NIPAP,ettrig/NIPAP,fredsod/NIPAP,ettrig/NIPAP,ettrig/NIPAP,garberg/NIPAP,bbaja42/NIPAP,bbaja42/NIPAP,SoundGoof/NIPAP,SpriteLink/NIPAP,plajjan/NIPAP,fredsod/NIPAP,bbaja42/NIPAP,garberg/NIPAP,fredsod/NIPAP,SoundGoof/NIPAP,SpriteLink/NIPAP,SoundGoof/NIPAP,plajjan/NIPAP,SpriteLink/NIPAP... | ---
+++
@@ -21,8 +21,6 @@
if len(self.__shared_state) == 0:
# First time - create new instance!
- if cfg_path is None:
- raise NipapConfigError("missing configuration file")
self._cfg_path = cfg_path
ConfigParser.ConfigParser.__init__(self,... |
441ecd25c9fdbc3acbe0e345bbaeafd8de9e3b73 | tests/test_srvy.py | tests/test_srvy.py | import unittest
import context
from srvy.srvy import get_current_questions
class MyTest(unittest.TestCase):
def setUp(self):
self.questions = ["Question 1?", "Question 2?", "Question 3?", "Question 4?"]
def test_get_current_questions_gets_all_questions_from_file(self):
self.assertEqual(get_c... | import unittest
import context
from collection.srvy import get_current_questions
class MyTest(unittest.TestCase):
def setUp(self):
self.questions = ["Question 1?", "Question 2?", "Question 3?", "Question 4?"]
def test_get_current_questions_gets_all_questions_from_file(self):
self.assertEqua... | Update unittest to check get_current_questions | Update unittest to check get_current_questions
| Python | mit | andrewlrogers/srvy | ---
+++
@@ -1,15 +1,16 @@
import unittest
import context
-from srvy.srvy import get_current_questions
+from collection.srvy import get_current_questions
class MyTest(unittest.TestCase):
def setUp(self):
self.questions = ["Question 1?", "Question 2?", "Question 3?", "Question 4?"]
+
def t... |
aceee9b19920d6a78fd8edda07009480ed48f565 | jsondb/__init__.py | jsondb/__init__.py | """
A flat file database for json objects.
"""
from .db import Database
__version__ = '0.1.5'
__author__ = 'Gunther Cox'
__email__ = 'gunthercx@gmail.com'
__url__ = 'https://github.com/gunthercox/jsondb'
| """
A flat file database for json objects.
"""
from .db import Database
__version__ = '0.1.6'
__author__ = 'Gunther Cox'
__email__ = 'gunthercx@gmail.com'
__url__ = 'https://github.com/gunthercox/jsondb'
| Update release version to 0.1.6 | Update release version to 0.1.6
| Python | bsd-3-clause | gunthercox/jsondb | ---
+++
@@ -4,7 +4,7 @@
from .db import Database
-__version__ = '0.1.5'
+__version__ = '0.1.6'
__author__ = 'Gunther Cox'
__email__ = 'gunthercx@gmail.com'
__url__ = 'https://github.com/gunthercox/jsondb' |
c4741e3246ca85d621f10530e9d70a85cdff7414 | learn/my_pbkdf2.py | learn/my_pbkdf2.py | import ctypes
__all__ = ["pbkdf2"]
libssl = ctypes.CDLL("libssl.dylib")
libssl.PKCS5_PBKDF2_HMAC_SHA1.restype = ctypes.c_int
def cBuf(data):
return ctypes.create_string_buffer(data, len(data))
def pbkdf2(password, salt, iterations, outlen):
targetbuf = cBuf("\0" * outlen)
ret = libssl.PKCS5_PBKDF2_HMAC_SHA1(
... | import ctypes
import platform
__all__ = ["pbkdf2"]
name = "libssl.%s" % ("dylib" if platform.system() == "Darwin" else "so")
libssl = ctypes.CDLL("libssl.dylib")
libssl.PKCS5_PBKDF2_HMAC_SHA1.restype = ctypes.c_int
def cBuf(data):
return ctypes.create_string_buffer(data, len(data))
def pbkdf2(password, salt, iter... | Load .so if not on Crap OS X | Load .so if not on Crap OS X
| Python | bsd-2-clause | tzwenn/luksfs | ---
+++
@@ -1,6 +1,9 @@
import ctypes
+import platform
__all__ = ["pbkdf2"]
+
+name = "libssl.%s" % ("dylib" if platform.system() == "Darwin" else "so")
libssl = ctypes.CDLL("libssl.dylib")
libssl.PKCS5_PBKDF2_HMAC_SHA1.restype = ctypes.c_int |
4c372b62ac97bc06f18dc953fd9e0ccfe4de80fe | ibmcnx/doc/Documentation.py | ibmcnx/doc/Documentation.py | ######
# Create a file (html or markdown) with the output of
# - JVMHeap
# - LogFiles
# - Ports
# - Variables
#
# Author: Christoph Stoettner
# Mail: christoph.stoettner@stoeps.de
# Documentation: http://scripting101.stoeps.de
#
# Version: 2.0
# Date: 2014-06-08
... | ######
# Create a file (html or markdown) with the output of
# - JVMHeap
# - LogFiles
# - Ports
# - Variables
#
# Author: Christoph Stoettner
# Mail: christoph.stoettner@stoeps.de
# Documentation: http://scripting101.stoeps.de
#
# Version: 2.0
# Date: 2014-06-08
... | Create script to save documentation to a file | 4: Create script to save documentation to a file
Task-Url: http://github.com/stoeps13/ibmcnx2/issues/issue/4 | Python | apache-2.0 | stoeps13/ibmcnx2,stoeps13/ibmcnx2 | ---
+++
@@ -22,7 +22,7 @@
emp1 = ibmcnx.filehandle.Ibmcnxfile()
-sys.stdout = emp1
+sys.stdout = emp1.askFileParams()
print '# JVM Settings of all AppServers:'
execfile( 'ibmcnx/doc/JVMSettings.py' ) |
058a0eb16a5a807c137553042f973c907d231cf1 | ndb/operate/__init__.py | ndb/operate/__init__.py | # coding=utf-8
import node_locate
import node_filter
import node_select
import node_update
import node_delete
import node_insert
import node_script
def select(node, path, action=None):
return node_select.NodeSelect().select(node, path, action)
def update(node, path, value, action=None):
return node_update.N... | # coding=utf-8
import node_locate
import node_select
import node_update
import node_delete
import node_insert
import node_script
import node_clean
import node_travel
def select(node, path, action=None):
return node_select.NodeSelect().select(node, path, action)
def update(node, path, value, action=None):
re... | Add clean and travel to operate | Add clean and travel to operate | Python | apache-2.0 | PinaeOS/ndb-py,node-db/ndb-py | ---
+++
@@ -1,13 +1,14 @@
# coding=utf-8
import node_locate
-import node_filter
import node_select
import node_update
import node_delete
import node_insert
import node_script
+import node_clean
+import node_travel
def select(node, path, action=None):
return node_select.NodeSelect().select(node, pat... |
c9eb050771c487aae67e0a1f8c69ad011b6aaa90 | repomgmt/management/commands/process-build-queue.py | repomgmt/management/commands/process-build-queue.py | #
# Copyright 2012 Cisco Systems, Inc.
#
# Author: Soren Hansen <sorhanse@cisco.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE... | #
# Copyright 2012 Cisco Systems, Inc.
#
# Author: Soren Hansen <sorhanse@cisco.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE... | Add tailing / to APT_REPO_BASE_URL | Add tailing / to APT_REPO_BASE_URL
| Python | apache-2.0 | sorenh/python-django-repomgmt,sorenh/python-django-repomgmt | ---
+++
@@ -17,7 +17,7 @@
#
from django.core.management.base import BaseCommand
from repomgmt.models import BuildNode, BuildRecord
-import repomgmt.utils
+
class Command(BaseCommand):
args = '' |
7f611e99d36089bc6836042ba8aec2df02a56f3a | pymemcache/test/test_serde.py | pymemcache/test/test_serde.py | from unittest import TestCase
from pymemcache.serde import (python_memcache_serializer,
python_memcache_deserializer)
import pytest
import six
@pytest.mark.unit()
class TestSerde(TestCase):
def check(self, value):
serialized, flags = python_memcache_serializer(b'key', value... | from unittest import TestCase
from pymemcache.serde import (python_memcache_serializer,
python_memcache_deserializer, FLAG_PICKLE,
FLAG_INTEGER, FLAG_LONG, FLAG_TEXT)
import pytest
import six
@pytest.mark.unit()
class TestSerde(TestCase):
def check(sel... | Test for expected flags with serde tests | Test for expected flags with serde tests
| Python | apache-2.0 | bwalks/pymemcache,sontek/pymemcache,pinterest/pymemcache,ewdurbin/pymemcache,pinterest/pymemcache,sontek/pymemcache | ---
+++
@@ -1,7 +1,8 @@
from unittest import TestCase
from pymemcache.serde import (python_memcache_serializer,
- python_memcache_deserializer)
+ python_memcache_deserializer, FLAG_PICKLE,
+ FLAG_INTEGER, FLAG_LONG, FLAG_TEXT)
... |
f050c0429beffa13d94ad303c1730fef5b44f544 | pymysql/tests/test_nextset.py | pymysql/tests/test_nextset.py | from pymysql.tests import base
from pymysql import util
class TestNextset(base.PyMySQLTestCase):
def setUp(self):
super(TestNextset, self).setUp()
self.con = self.connections[0]
def test_nextset(self):
cur = self.con.cursor()
cur.execute("SELECT 1; SELECT 2;")
self.as... | from pymysql.tests import base
from pymysql import util
try:
import unittest2 as unittest
except ImportError:
import unittest
class TestNextset(base.PyMySQLTestCase):
def setUp(self):
super(TestNextset, self).setUp()
self.con = self.connections[0]
def test_nextset(self):
cur... | Add multi cursor test currently failed. | Add multi cursor test currently failed.
| Python | mit | Geoion/Tornado-MySQL,PyMySQL/PyMySQL,PyMySQL/Tornado-MySQL,boneyao/PyMySQL,aio-libs/aiomysql,jwjohns/PyMySQL,yeyinzhu3211/PyMySQL,jheld/PyMySQL,eibanez/PyMySQL,pymysql/pymysql,lzedl/PyMySQL,modulexcite/PyMySQL,xjzhou/PyMySQL,xjzhou/PyMySQL,MartinThoma/PyMySQL,wraziens/PyMySQL,mosquito/Tornado-MySQL,pulsar314/Tornado-My... | ---
+++
@@ -1,5 +1,10 @@
from pymysql.tests import base
from pymysql import util
+
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
class TestNextset(base.PyMySQLTestCase):
@@ -26,3 +31,20 @@
cur.execute("SELECT 42")
self.assertEqual([(42,)], list(cur))
+
+ ... |
21ac167e827cde53ccbb60f713c8190ec2ff6bda | api/management/commands/cron_notifications.py | api/management/commands/cron_notifications.py | # -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand, CommandError
from api import models
from web.utils import send_email
class Command(BaseCommand):
can_import_settings = True
def handle(self, *args, **options):
notifications = models.Notification.objects.filter(email_sent=Fa... | # -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand, CommandError
from api import models
from web.utils import send_email
class Command(BaseCommand):
can_import_settings = True
def handle(self, *args, **options):
notifications = models.Notification.objects.filter(email_sent=Fa... | Handle errors in cron notifications | Handle errors in cron notifications
| Python | apache-2.0 | SchoolIdolTomodachi/SchoolIdolAPI,dburr/SchoolIdolAPI,rdsathene/SchoolIdolAPI,SchoolIdolTomodachi/SchoolIdolAPI,rdsathene/SchoolIdolAPI,dburr/SchoolIdolAPI,dburr/SchoolIdolAPI,rdsathene/SchoolIdolAPI,SchoolIdolTomodachi/SchoolIdolAPI | ---
+++
@@ -12,17 +12,21 @@
for notification in notifications:
preferences = notification.owner.preferences
if preferences.is_notification_email_allowed(notification.message):
- send_email(
- subject=(u'School Idol Tomodachi' + u'✨ ' + u' Notificati... |
c955628b134586491265bc2e6b4045398072cead | allauth/socialaccount/providers/kakao/provider.py | allauth/socialaccount/providers/kakao/provider.py | from allauth.account.models import EmailAddress
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class KakaoAccount(ProviderAccount):
@property
def properties(self):
return self.account.extra_data['properties']
... | from allauth.account.models import EmailAddress
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class KakaoAccount(ProviderAccount):
@property
def properties(self):
return self.account.extra_data['properties']
... | Handle case where email is not present | fix(kakao): Handle case where email is not present
| Python | mit | pennersr/django-allauth,rsalmaso/django-allauth,rsalmaso/django-allauth,lukeburden/django-allauth,bittner/django-allauth,AltSchool/django-allauth,pennersr/django-allauth,AltSchool/django-allauth,rsalmaso/django-allauth,AltSchool/django-allauth,lukeburden/django-allauth,bittner/django-allauth,lukeburden/django-allauth,b... | ---
+++
@@ -31,12 +31,13 @@
def extract_email_addresses(self, data):
ret = []
email = data.get("kaccount_email")
- verified = data.get("kaccount_email_verified")
- # data["kaccount_email_verified"] imply the email address is
- # verified
- ret.append(EmailAddress(ema... |
6064f95021119e781b13224febfeca2d7de4aec5 | wagtailmenus/management/commands/autopopulate_main_menus.py | wagtailmenus/management/commands/autopopulate_main_menus.py | # -*- coding: utf-8 -*-
import logging
from django.core.management.base import BaseCommand
from wagtail.wagtailcore.models import Site
from wagtailmenus import app_settings
logger = logging.getLogger(__name__)
class Command(BaseCommand):
help = (
"Create a 'main menu' for any 'Site' that doesn't alread... | # -*- coding: utf-8 -*-
import logging
from django.core.management.base import BaseCommand
from wagtail.wagtailcore.models import Site
from wagtailmenus import app_settings
logger = logging.getLogger(__name__)
class Command(BaseCommand):
help = (
"Create a 'main menu' for any 'Site' that doesn't alread... | Make the '--add-home-links' option work for any value that evaluates to a bool | Make the '--add-home-links' option work for any value that evaluates to a bool
| Python | mit | rkhleics/wagtailmenus,ababic/wagtailmenus,ababic/wagtailmenus,rkhleics/wagtailmenus,rkhleics/wagtailmenus,ababic/wagtailmenus | ---
+++
@@ -32,6 +32,6 @@
if not menu.get_menu_items_manager().exists():
menu.add_menu_items_for_pages(
site.root_page.get_descendants(
- inclusive=options['add-home-links']
+ inclusive=bool(options['add-home-links'])
... |
f0a1cd06f954094bc5ef3dfa337901a87d22485c | prod.py | prod.py | #! /usr/bin/env python2.7
import cherrypy
import medlem
wsgiapp = cherrypy.Application(medlem.Medlem(), '/', config="config/production.conf")
| #! /usr/bin/env python2.7
import cherrypy
import medlem
app = cherrypy.Application(medlem.Medlem(), '/', config="config/production.conf")
| Change name of the wsgi-object to match what uwsgi | Change name of the wsgi-object to match what uwsgi
| Python | bsd-3-clause | UngaForskareStockholm/medlem2 | ---
+++
@@ -3,4 +3,4 @@
import cherrypy
import medlem
-wsgiapp = cherrypy.Application(medlem.Medlem(), '/', config="config/production.conf")
+app = cherrypy.Application(medlem.Medlem(), '/', config="config/production.conf") |
5aa13f1aafd2afa71d7a95f6b59ff28a1c97fbd2 | compare_mt/__init__.py | compare_mt/__init__.py | import compare_mt.ngram_utils
import compare_mt.stat_utils
import compare_mt.corpus_utils
import compare_mt.sign_utils
import compare_mt.scorers
import compare_mt.bucketers
import compare_mt.reporters
import compare_mt.arg_utils
import compare_mt.print_utils
__version__ = "0.2"
| import compare_mt.ngram_utils
import compare_mt.stat_utils
import compare_mt.corpus_utils
import compare_mt.sign_utils
import compare_mt.scorers
import compare_mt.bucketers
import compare_mt.reporters
import compare_mt.arg_utils
import compare_mt.print_utils
__version__ = "0.2.1"
| Increase version number to update pipy | Increase version number to update pipy
| Python | bsd-3-clause | neulab/compare-mt,neulab/compare-mt | ---
+++
@@ -9,4 +9,4 @@
import compare_mt.print_utils
-__version__ = "0.2"
+__version__ = "0.2.1" |
94edf518993860dbff8d845292bfe4ce94d9fe5e | netdumplings/console/__init__.py | netdumplings/console/__init__.py | from .info import main as info
from .printer import main as printer
from .shifty import main as shifty
from .snifty import main as snifty
from .status import main as status
(
info,
printer,
shifty,
snifty,
status,
)
| from .printer import printer
from .shifty import shifty
from .shiftydetails import shiftydetails
from .shiftysummary import shiftysummary
from .snifty import snifty
(
printer,
shifty,
shiftydetails,
shiftysummary,
snifty,
)
| Update console module with new cli names | Update console module with new cli names
| Python | mit | mjoblin/netdumplings,mjoblin/netdumplings,mjoblin/netdumplings | ---
+++
@@ -1,14 +1,14 @@
-from .info import main as info
-from .printer import main as printer
-from .shifty import main as shifty
-from .snifty import main as snifty
-from .status import main as status
+from .printer import printer
+from .shifty import shifty
+from .shiftydetails import shiftydetails
+from .shiftys... |
68e8dfb52aea3a3f6ee99b3ce2a2b479a39c19db | doc/examples/special/plot_errorfill.py | doc/examples/special/plot_errorfill.py | """
================
Plot `errorfill`
================
When you have continuous data measurement and errors associated with every data point, plotting error bars can get really noisy. `special.errorfill` plots a filled region to represent the error values instead of using individual bars.
"""
import numpy as np
impor... | """
================
Plot `errorfill`
================
When you have continuous data measurement and errors associated with every data point, plotting error bars can get really noisy. `special.errorfill` plots a filled region to represent the error values instead of using individual bars.
"""
import numpy as np
impor... | Fix labeling on plots so it matches elements. | DOC: Fix labeling on plots so it matches elements.
| Python | bsd-3-clause | tonysyu/mpltools,matteoicardi/mpltools | ---
+++
@@ -16,8 +16,8 @@
y_cos = np.cos(x)
y_err = 0.2
-special.errorfill(x, y_sin, y_err, label='blue', label_fill='blue error')
-special.errorfill(x, y_cos, y_err, label='red', label_fill='red error',
+special.errorfill(x, y_sin, y_err, label='sin', label_fill='sin error')
+special.errorfill(x, y_cos, y_err, l... |
2a2c9e01b51b10594da97c5ce273073931e44c43 | social_auth/backends/pipeline/misc.py | social_auth/backends/pipeline/misc.py | from social_auth.backends import PIPELINE
from social_auth.utils import setting
PIPELINE_ENTRY = 'social_auth.backends.pipeline.misc.save_status_to_session'
def tuple_index(t, e):
for (i, te) in enumerate(t):
if te == e:
return i
return None
def save_status_to_session(request, auth, *arg... | from social_auth.backends import PIPELINE
from social_auth.utils import setting
PIPELINE_ENTRY = 'social_auth.backends.pipeline.misc.save_status_to_session'
def save_status_to_session(request, auth, *args, **kwargs):
"""Saves current social-auth status to session."""
next_entry = setting('SOCIAL_AUTH_PIPELI... | Revert "Add own tuple_index function to stay compatible with python 2.5" | Revert "Add own tuple_index function to stay compatible with python 2.5"
This reverts commit 7e6af723e15a785b403010de4b44b49fce924e91.
| Python | bsd-3-clause | michael-borisov/django-social-auth,qas612820704/django-social-auth,VishvajitP/django-social-auth,beswarm/django-social-auth,lovehhf/django-social-auth,antoviaque/django-social-auth-norel,qas612820704/django-social-auth,MjAbuz/django-social-auth,omab/django-social-auth,caktus/django-social-auth,VishvajitP/django-social-... | ---
+++
@@ -4,22 +4,18 @@
PIPELINE_ENTRY = 'social_auth.backends.pipeline.misc.save_status_to_session'
-def tuple_index(t, e):
- for (i, te) in enumerate(t):
- if te == e:
- return i
- return None
def save_status_to_session(request, auth, *args, **kwargs):
"""Saves current social-... |
93effb501a50d8265afd37826fbcab4dd4a87611 | qa_app/views.py | qa_app/views.py | # Copyright 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | # Copyright 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Fix user and attempts sqlalchemia request. | Fix user and attempts sqlalchemia request.
| Python | apache-2.0 | molecul/qa_app_flask,molecul/qa_app_flask,molecul/qa_app_flask | ---
+++
@@ -33,6 +33,6 @@
@views.route('/profile')
@login_required
def profile():
- user = Users.query(email=session['email']).first()
- attempts = Attempts.query(user_id=user.id).all()
+ user = Users.query.filter_by(email=session['email']).first()
+ attempts = Attempts.query.filter_by(user_id=user.id)... |
1914bd9a9fc2f1ce7a557dd2134d98796866283d | rootpy/userdata.py | rootpy/userdata.py | """
This module handles creation of the user-data area
"""
import os
import tempfile
import atexit
DATA_ROOT = None
if os.getenv('ROOTPY_GRIDMODE') not in ('1', 'true'):
DATA_ROOT = os.getenv('ROOTPY_DATA')
if DATA_ROOT is None:
DATA_ROOT = os.path.expanduser('~/.rootpy')
else:
DATA_ROOT =... | """
This module handles creation of the user-data area
"""
import os
import tempfile
import atexit
from os.path import expanduser, expandvars, exists, isdir
if "XDG_CONFIG_HOME" not in os.environ:
os.environ["XDG_CONFIG_HOME"] = expanduser('~/.config')
if "XDG_CACHE_HOME" not in os.environ:
os.environ["XDG_C... | Use XDG base directory specificiation | Use XDG base directory specificiation
| Python | bsd-3-clause | rootpy/rootpy,rootpy/rootpy,ndawe/rootpy,kreczko/rootpy,ndawe/rootpy,kreczko/rootpy,ndawe/rootpy,kreczko/rootpy,rootpy/rootpy | ---
+++
@@ -5,35 +5,47 @@
import tempfile
import atexit
-
-DATA_ROOT = None
-if os.getenv('ROOTPY_GRIDMODE') not in ('1', 'true'):
- DATA_ROOT = os.getenv('ROOTPY_DATA')
- if DATA_ROOT is None:
- DATA_ROOT = os.path.expanduser('~/.rootpy')
- else:
- DATA_ROOT = os.path.expandvars(os.path.ex... |
1ae98c0f2186dcdbd658f774a14172b4618bb0a8 | logging_util.py | logging_util.py | # https://docs.python.org/3.6/howto/logging.html#logging-basic-tutorial
import logging
import sys
def get_logger(name):
"""
https://stackoverflow.com/questions/28330317/print-timestamp-for-logging-in-python
https://docs.python.org/3/library/logging.html#formatter-objects
https://docs.python.org/3.6/ho... | # https://docs.python.org/3.6/howto/logging.html#logging-basic-tutorial
import logging
import sys
def get_logger(name):
"""
https://stackoverflow.com/questions/28330317/print-timestamp-for-logging-in-python
https://docs.python.org/3/library/logging.html#formatter-objects
https://docs.python.org/3.6/ho... | Fix bug some log output showing on screen not present in log file by changing logging file handler mode from 'w' write to 'a' append. | Fix bug some log output showing on screen not present in log file by changing logging file handler mode from 'w' write to 'a' append.
| Python | mit | beepscore/fibonacci | ---
+++
@@ -21,7 +21,8 @@
# add one or more handlers
# log to file
- handler = logging.FileHandler('./data/output/fib.log', mode='w')
+ # mode 'a' append, not 'w' write
+ handler = logging.FileHandler('./data/output/fib.log', mode='a')
handler.setFormatter(formatter)
logger.addHandler(h... |
98fd04596367f94b7f47056c429ea23b2dd6165b | miller-rabin.py | miller-rabin.py | import sys, math, random
if len(sys.argv) > 1:
candidate = eval(sys.argv[1])
else:
candidate = 221
modulo = candidate - 1
s = -1
quotient = modulo
remainder = 0
while remainder == 0:
quotient, remainder = divmod(quotient, 2)
s += 1
d = quotient * 2 + 1
for k in range(10):
witness = random.randint(2, modulo - 1)... | import sys, math, random
# Receive candidate number from arguments, or default to 221 for test purposes.
if len(sys.argv) > 1:
candidate = eval(sys.argv[1])
else:
candidate = 221
modulo = candidate - 1
# Write the modulo (candidate -1) number in the form
# 2^s * d.
s = 0
quotient = modulo
remainder = 0
while rema... | Add comments to Python version | Add comments to Python version
| Python | mit | boppreh/miller-rabin,boppreh/miller-rabin | ---
+++
@@ -1,33 +1,55 @@
import sys, math, random
+# Receive candidate number from arguments, or default to 221 for test purposes.
if len(sys.argv) > 1:
candidate = eval(sys.argv[1])
else:
candidate = 221
modulo = candidate - 1
-s = -1
+
+# Write the modulo (candidate -1) number in the form
+# 2^s * d.
+... |
0fed2ca675967f1d43d0abacb9110875b30b0d64 | tests/test_input.py | tests/test_input.py | from unittest.mock import patch
from rcfc import server, input_methods
from test_helpers import IgnoredArgument
input_value = 0
def set_input_value(val):
global input_value
input_value = val
@patch("bottle.Bottle.route")
def test_slider(mock_route):
server.clear_buttons()
input_methods.slider("Sli... | from unittest.mock import patch
from rcfc import server, input_methods
from test_helpers import IgnoredArgument
input_value = 0
def set_input_value(val):
global input_value
input_value = val
@patch("bottle.Bottle.route")
def test_slider(mock_route):
server.clear_buttons()
input_methods.slider("Sli... | Add custom rangers to slider | Add custom rangers to slider
| Python | mit | pviafore/rcfc,pviafore/rcfc,pviafore/rcfc | ---
+++
@@ -27,3 +27,23 @@
mock_route.assert_called_once_with("/buttons/0",
["POST", "OPTIONS"],
IgnoredArgument())
+
+
+@patch("bottle.Bottle.route")
+def test_slider_with_range(mock_route):
+ server.clear_buttons()
+ input_me... |
91bdd47afe409e86bceca71ebb07ae1975e9073a | tests/test_sweep.py | tests/test_sweep.py | import os
import numpy as np
import crepe
def test_sweep():
# this data contains a sine sweep
file = os.path.join(os.path.dirname(__file__), 'sweep.wav')
model = crepe.build_and_load_model()
crepe.process_file(model, file)
f0_file = os.path.join(os.path.dirname(__file__), 'sweep.f0.csv')
res... | import os
import numpy as np
import crepe
def test_sweep():
# this data contains a sine sweep
file = os.path.join(os.path.dirname(__file__), 'sweep.wav')
model = crepe.build_and_load_model()
crepe.process_file(model, file)
f0_file = os.path.join(os.path.dirname(__file__), 'sweep.f0.csv')
res... | Fix bug in unit test (ignore header row in output csv file) | Fix bug in unit test (ignore header row in output csv file)
| Python | mit | marl/crepe | ---
+++
@@ -11,7 +11,7 @@
crepe.process_file(model, file)
f0_file = os.path.join(os.path.dirname(__file__), 'sweep.f0.csv')
- result = np.loadtxt(f0_file, delimiter=',')
+ result = np.loadtxt(f0_file, delimiter=',', skiprows=1)
# the result should be confident enough about the presence of pit... |
fcfe2513fc8532dc2212a254da42d75048e76de7 | form_designer/tests/test_cms_plugin.py | form_designer/tests/test_cms_plugin.py | from django.contrib.auth.models import AnonymousUser
from django.utils.crypto import get_random_string
import pytest
from cms import api
from cms.page_rendering import render_page
from form_designer.contrib.cms_plugins.form_designer_form.cms_plugins import FormDesignerPlugin
from form_designer.models import FormDefini... | import django
from django.contrib.auth.models import AnonymousUser
from django.utils.crypto import get_random_string
import pytest
from cms import api
from cms.page_rendering import render_page
from form_designer.contrib.cms_plugins.form_designer_form.cms_plugins import FormDesignerPlugin
from form_designer.models imp... | Disable Django-CMS test on Django 1.10+ | Disable Django-CMS test on Django 1.10+
Someone with the time and inclination should set up the test to work with a Django-CMS version compatible with Django 1.10+, then try again
| Python | bsd-3-clause | andersinno/django-form-designer-ai,kcsry/django-form-designer,andersinno/django-form-designer,andersinno/django-form-designer,kcsry/django-form-designer,andersinno/django-form-designer-ai | ---
+++
@@ -1,3 +1,4 @@
+import django
from django.contrib.auth.models import AnonymousUser
from django.utils.crypto import get_random_string
@@ -10,6 +11,8 @@
@pytest.mark.django_db
def test_cms_plugin_renders_in_cms_page(rf):
+ if django.VERSION >= (1, 10):
+ pytest.xfail('This test is broken in D... |
1d82b988fdd913e291ed73552964c8724934ad32 | tools/build_interface_docs.py | tools/build_interface_docs.py | #!/usr/bin/env python
"""Script to auto-generate our API docs.
"""
# stdlib imports
import os
import sys
# local imports
from interfacedocgen import InterfaceHelpWriter
#*****************************************************************************
if __name__ == '__main__':
nipypepath = os.path.abspath('..')
... | #!/usr/bin/env python
"""Script to auto-generate our API docs.
"""
# stdlib imports
import os
import sys
# local imports
from interfacedocgen import InterfaceHelpWriter
#*****************************************************************************
if __name__ == '__main__':
nipypepath = os.path.abspath('..')
... | Remove pymvpa from documentation build. | Remove pymvpa from documentation build.
git-svn-id: 24f545668198cdd163a527378499f2123e59bf9f@931 ead46cd0-7350-4e37-8683-fc4c6f79bf00
| Python | bsd-3-clause | arokem/nipype,grlee77/nipype,JohnGriffiths/nipype,wanderine/nipype,fprados/nipype,fprados/nipype,christianbrodbeck/nipype,dgellis90/nipype,wanderine/nipype,sgiavasis/nipype,arokem/nipype,rameshvs/nipype,mick-d/nipype,FredLoney/nipype,mick-d/nipype_source,mick-d/nipype,blakedewey/nipype,sgiavasis/nipype,rameshvs/nipype,... | ---
+++
@@ -28,6 +28,7 @@
'\.interfaces\.base$',
'\.interfaces\.matlab$',
'\.interfaces\.rest$',
+ '\.interfaces\.pymvpa$',
... |
0c69c3e25f52ab126886a2a2f1c33d099d0bb5a4 | annfab/distances/matrix_cosine.py | annfab/distances/matrix_cosine.py | import numpy as np
import nearpy.distances
class MatrixCosineDistance(nearpy.distances.CosineDistance):
"""
A distance measure for calculating the cosine distance between matrices.
"""
def distance(self, x, y):
if len(x.shape) <= 1:
return super(MatrixCosineDistance, self).distance(x, y)
... | import numpy as np
import nearpy.distances
class MatrixCosineDistance(nearpy.distances.CosineDistance):
"""
A distance measure for calculating the cosine distance between matrices.
"""
def distance(self, x, y):
if len(x.shape) <= 1:
return super(MatrixCosineDistance, self).distan... | Add simple tests for matrix operands for distance measure. | Add simple tests for matrix operands for distance measure.
| Python | mit | elezar/ann-fab,elezar/ann-fab,elezar/ann-fab | ---
+++
@@ -9,18 +9,17 @@
"""
def distance(self, x, y):
- if len(x.shape) <= 1:
- return super(MatrixCosineDistance, self).distance(x, y)
+ if len(x.shape) <= 1:
+ return super(MatrixCosineDistance, self).distance(x, y)
- k = x.shape[1]
- if len(y.shape) > 1:
- m ... |
6723dd3e2980d040cef4f7d0f7675933666eb088 | tests/benchmarks/constructs/LocalVariableAssign.py | tests/benchmarks/constructs/LocalVariableAssign.py | # Copyright 2015, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Python test originally created or extracted from other peoples work. The
# parts from me are licensed as below. It is at least Free Softwar where
# it's copied from other people. In these cases, that will normally be
# indicated.
#
# Li... | # Copyright 2015, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Python test originally created or extracted from other peoples work. The
# parts from me are licensed as below. It is at least Free Softwar where
# it's copied from other people. In these cases, that will normally be
# indicated.
#
# Li... | Enhance construct test to avoid local variable optimization. | Tests: Enhance construct test to avoid local variable optimization.
| Python | apache-2.0 | wfxiang08/Nuitka,kayhayen/Nuitka,tempbottle/Nuitka,kayhayen/Nuitka,wfxiang08/Nuitka,tempbottle/Nuitka,tempbottle/Nuitka,kayhayen/Nuitka,kayhayen/Nuitka,wfxiang08/Nuitka,tempbottle/Nuitka,wfxiang08/Nuitka | ---
+++
@@ -33,6 +33,8 @@
local_value * 2
# construct_end
+ return local_value
+
for x in xrange(50000):
calledRepeatedly()
|
6f939e9c2bd4cf42cb4ad58112375f36abf489bf | terraform/templates/sch_log_parser.py | terraform/templates/sch_log_parser.py | import time
from datetime import datetime
def my_log_parser(logger, line):
if line.count(',') >= 6:
date, report_type, group_id, job_id, event, package, rest = line.split(',',6)
if report_type == 'J' and event != 'Pending':
date = datetime.strptime(date, "%Y-%m-%d %H:%M:%S")
... | import time
from datetime import datetime
def my_log_parser(logger, line):
if line.count(',') >= 6:
date, report_type, group_id, job_id, event, package, rest = line.split(',',6)
if report_type == 'J' and event != 'Pending':
date = datetime.strptime(date, "%Y-%m-%d %H:%M:%S")
... | Add group/job info to job dashboard | Add group/job info to job dashboard
Signed-off-by: Salim Alam <18ae4dd1e3db1d49a738226169e3b099325c79a0@chef.io>
| Python | apache-2.0 | habitat-sh/habitat,nathenharvey/habitat,nathenharvey/habitat,georgemarshall/habitat,georgemarshall/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,nathenharvey/habitat,rsertelon/habitat,nathenharvey/habitat,habitat-sh/habitat,georg... | ---
+++
@@ -16,7 +16,7 @@
elif event == 'Complete':
message = package + ' ' + url
else:
- message = package
+ message = package + ' grp:' + group_id + ' job:' + job_id
logged_event = {
'msg_title': event, |
51dc6f26ef8c063c51e1218a0cc09105ae16022c | twext/who/test/test_aggregate.py | twext/who/test/test_aggregate.py | ##
# Copyright (c) 2013 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | ##
# Copyright (c) 2013 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | Make sure the aggregate service only using the IDirectoryService interface when interactive with its sub-services. | Make sure the aggregate service only using the IDirectoryService interface when interactive with its sub-services.
git-svn-id: 81e381228600e5752b80483efd2b45b26c451ea2@10781 e27351fd-9f3e-4f54-a53b-843176b1656c
| Python | apache-2.0 | trevor/calendarserver,trevor/calendarserver,trevor/calendarserver | ---
+++
@@ -38,10 +38,10 @@
# implementation assumptions about the IDirectoryService
# objects it gets.
#
-# services = tuple((
-# proxyForInterface(IDirectoryService)(s)
-# for s in services
-# ))
+ services = tuple((
+ proxyForInterfac... |
29ecb6f6bac85aeecba6b2602744f178735c0adc | pyautoupdate/_move_glob.py | pyautoupdate/_move_glob.py | import glob
import shutil
import os
if os.name == "nt":
from .ntcommonpath import commonpath
else:
from .posixcommonpath import commonpath
def move_glob(src,dst):
"""Moves files from src to dest.
src may be any glob to recognize files. dst must be a folder."""
for obj in glob.iglob(src):
... | import glob
import shutil
import os
if os.name == "nt":
from .ntcommonpath import commonpath
else:
from .posixcommonpath import commonpath
def move_glob(src,dst):
"""Moves files from src to dest.
src may be any glob to recognize files. dst must be a folder."""
for obj in glob.iglob(src):
... | Fix bug in copy_glob when destination directory already has files | Fix bug in copy_glob when destination directory already has files
| Python | lgpl-2.1 | rlee287/pyautoupdate,rlee287/pyautoupdate | ---
+++
@@ -22,8 +22,10 @@
if os.path.isdir(obj):
start_part=commonpath([src,obj])
end_part=os.path.relpath(obj,start_part)
- shutil.copytree(obj,os.path.join(dst,end_part))
+ ctree_dst=os.path.join(dst,end_part)
+ if not os.path.isdir(ctree_dst):
+ ... |
7698ad7a907da5e7b4ad7cfd40255bb9c44b5b87 | scripts/sort-cluster-issue.py | scripts/sort-cluster-issue.py | #!/usr/bin/python
from pyspark import SparkContext
from pyspark.sql import SQLContext, Row
from pyspark.sql.functions import asc, desc
if __name__ == "__main__":
sc = SparkContext(appName='resort data')
sqlContext = SQLContext(sc)
df = sqlContext.read.load('hdfs://discovery3:9000/tmp/dasmith/c19-20160919-a50-o... | #!/usr/bin/python
from __future__ import print_function
import sys
from pyspark import SparkContext
from pyspark.sql import SQLContext
from pyspark.sql.functions import desc
if __name__ == "__main__":
if len(sys.argv) < 3:
print("Usage: sort-cluster-issue.py <input> <output>", file=sys.stderr)
exit(-1)
sc... | Use command-line arguments for paths. | Use command-line arguments for paths.
| Python | apache-2.0 | ViralTexts/vt-passim,ViralTexts/vt-passim,ViralTexts/vt-passim | ---
+++
@@ -1,17 +1,24 @@
#!/usr/bin/python
+from __future__ import print_function
+import sys
from pyspark import SparkContext
-from pyspark.sql import SQLContext, Row
-from pyspark.sql.functions import asc, desc
+from pyspark.sql import SQLContext
+from pyspark.sql.functions import desc
if __name__ == "__mai... |
742e5e7a998e8e397a438d4edf9fa3d6234009fc | popit/migrations/0001_initial.py | popit/migrations/0001_initial.py | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
pass
def backwards(self, orm):
pass
models = {
}
complete_apps = ['{{ app_name }}']
| # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
pass
def backwards(self, orm):
pass
models = {
}
complete_apps = ['popit']
| Replace placeholders with actual app name | Replace placeholders with actual app name
| Python | agpl-3.0 | ciudadanointeligente/popit-django,mysociety/popit-django,ciudadanointeligente/popit-django,mysociety/popit-django,mysociety/popit-django,ciudadanointeligente/popit-django | ---
+++
@@ -18,4 +18,4 @@
}
- complete_apps = ['{{ app_name }}']
+ complete_apps = ['popit'] |
c05e1d39af6089f31e72fa8dc1c27e22795e8e2f | sites/docs/conf.py | sites/docs/conf.py | # Obtain shared config values
import os, sys
from os.path import abspath, join, dirname
sys.path.append(abspath(join(dirname(__file__), '..')))
sys.path.append(abspath(join(dirname(__file__), '..', '..')))
from shared_conf import *
# Enable autodoc, intersphinx
extensions.extend(['sphinx.ext.autodoc', 'sphinx.ext.inte... | # Obtain shared config values
import os, sys
from os.path import abspath, join, dirname
sys.path.append(abspath(join(dirname(__file__), '..')))
sys.path.append(abspath(join(dirname(__file__), '..', '..')))
from shared_conf import *
# Enable autodoc, intersphinx
extensions.extend(['sphinx.ext.autodoc', 'sphinx.ext.inte... | Fix Invoke doc intersphinx path (and tweak formatting) | Fix Invoke doc intersphinx path (and tweak formatting)
| Python | bsd-2-clause | fabric/fabric | ---
+++
@@ -18,7 +18,11 @@
target = 'http://www.fabfile.org/'
www = (target, None)
# Ditto Invoke
-target = join(dirname(__file__), '..', '..', '..', 'invoke', 'docs', '_build')
+target = join(
+ dirname(__file__),
+ '..', '..', '..',
+ 'invoke', 'sites', 'docs', '_build'
+)
if os.environ.get('READTH... |
e12138061b0babca3f14b1479cd3269fec36e9ea | remo/featuredrep/models.py | remo/featuredrep/models.py | from django.contrib.auth.models import User
from django.db import models
from django.dispatch import receiver
from south.signals import post_migrate
from remo.base.utils import add_permissions_to_groups
class FeaturedRep(models.Model):
"""Featured Rep model.
Featured Rep -or Rep of the Month- relates exist... | from django.contrib.auth.models import User
from django.db import models
from django.dispatch import receiver
from south.signals import post_migrate
from remo.base.utils import add_permissions_to_groups
class FeaturedRep(models.Model):
"""Featured Rep model.
Featured Rep -or Rep of the Month- relates exist... | Change ordering to FeaturedRep model. | Change ordering to FeaturedRep model.
| Python | bsd-3-clause | flamingspaz/remo,akatsoulas/remo,Mte90/remo,flamingspaz/remo,johngian/remo,abdullah2891/remo,flamingspaz/remo,akatsoulas/remo,chirilo/remo,abdullah2891/remo,mozilla/remo,Mte90/remo,johngian/remo,johngian/remo,tsmrachel/remo,Mte90/remo,mozilla/remo,chirilo/remo,mozilla/remo,chirilo/remo,johngian/remo,chirilo/remo,akatso... | ---
+++
@@ -22,7 +22,7 @@
class Meta:
ordering = ['-updated_on']
- get_latest_by = 'created_on'
+ get_latest_by = 'updated_on'
permissions = (('can_edit_featured', 'Can edit featured reps'),
('can_delete_featured', 'Can delete featured reps'))
|
27e86c661021b1276123b264f00536fc89d203c4 | common/templatetags/lutris.py | common/templatetags/lutris.py | import copy
from django import template
from django.conf import settings
from games import models
register = template.Library()
def get_links(user_agent):
systems = ['ubuntu', 'fedora', 'linux']
downloads = copy.copy(settings.DOWNLOADS)
main_download = None
for system in systems:
if system ... | import copy
from django import template
from django.conf import settings
from games import models
register = template.Library()
def get_links(user_agent):
systems = ['ubuntu', 'fedora', 'linux']
downloads = copy.copy(settings.DOWNLOADS)
main_download = None
for system in systems:
if system ... | Fix download link , again | Fix download link , again
| Python | agpl-3.0 | Turupawn/website,Turupawn/website,lutris/website,lutris/website,lutris/website,Turupawn/website,Turupawn/website,lutris/website | ---
+++
@@ -16,7 +16,8 @@
if system in user_agent:
main_download = {system: downloads[system]}
downloads.pop(system)
- if not main_download:
+ break
+ if main_download is None:
main_download = {'linux': downloads.pop('linux')}
return (main_download, do... |
a367b1d4bdbb639b4eab862c7ce691eb4a861d26 | wandb/compat/windows.py | wandb/compat/windows.py | """
Windows-related compatibility helpers.
"""
import re
_find_unsafe = re.compile(r'[\s<>|&^]').search
def quote_arg(s):
"""Based on shlex.quote in the standard library."""
if not s:
return '""'
if _find_unsafe(s) is None:
return s
# If we found an unsafe character, escape with doub... | """
Windows-related compatibility helpers.
"""
import re
_find_unsafe = re.compile(r'[\s<>|&^]').search
def quote_arg(s):
"""Based on shlex.quote in the standard library."""
if not s:
return '""'
if _find_unsafe(s) is None:
return s
if s.startswith('"') and s.endswith('"'):
re... | Add check for args which are already quotes | Add check for args which are already quotes
| Python | mit | wandb/client,wandb/client,wandb/client | ---
+++
@@ -12,6 +12,8 @@
return '""'
if _find_unsafe(s) is None:
return s
+ if s.startswith('"') and s.endswith('"'):
+ return s
# If we found an unsafe character, escape with double quotes.
return '"' + s + '"' |
508ca596d46c08fdc9295769059f5de974b2d1df | base/components/accounts/admin.py | base/components/accounts/admin.py | from django.contrib import admin
from django.contrib.auth.models import Group
from .models import Editor
class ContributorMixin(admin.ModelAdmin):
def save_model(self, request, obj, form, change):
super(ContributorMixin, self).save_model(request, obj, form, change)
if not change:
obj.... | from django.contrib import admin
from django.contrib.auth.models import Group
from .models import Editor
class ContributorMixin(admin.ModelAdmin):
def save_model(self, request, obj, form, change):
if not change:
obj.submitted_by = request.user
obj.edited_by.add(request.user)
o... | Move this to the bottom... | Move this to the bottom...
| Python | apache-2.0 | hello-base/web,hello-base/web,hello-base/web,hello-base/web | ---
+++
@@ -6,11 +6,11 @@
class ContributorMixin(admin.ModelAdmin):
def save_model(self, request, obj, form, change):
- super(ContributorMixin, self).save_model(request, obj, form, change)
if not change:
obj.submitted_by = request.user
obj.edited_by.add(request.user)
... |
9502755baf7efba7851c07edbf2579f7cff95e44 | py/rackattack/tcp/debug.py | py/rackattack/tcp/debug.py | import contextlib
import logging
import time
import os
logger = logging.getLogger('network')
@contextlib.contextmanager
def logNetwork(message):
transaction = Transaction(message)
yield
transaction.finished()
class Transaction:
def __init__(self, message):
self._message = message
s... | import contextlib
import logging
import time
import os
logger = logging.getLogger('network')
@contextlib.contextmanager
def logNetwork(message):
transaction = Transaction(message)
yield
transaction.finished()
class Transaction:
TRANSACTION_PERIOD_MAX = 0.3
def __init__(self, message):
... | Increase max transaction period due to more networking tasks | Increase max transaction period due to more networking tasks
| Python | apache-2.0 | eliran-stratoscale/rackattack-api,Stratoscale/rackattack-api | ---
+++
@@ -15,6 +15,7 @@
class Transaction:
+ TRANSACTION_PERIOD_MAX = 0.3
def __init__(self, message):
self._message = message
self._before = time.time()
@@ -30,7 +31,7 @@
took = time.time() - self._before
msg = "Finished %(transaction)s took %(took)s" % dict(transac... |
1a04c983eb921f47452ea6c013313f90875c400f | pkgconf/__init__.py | pkgconf/__init__.py | import sys
from functools import partial, update_wrapper
from django.utils import six
def proxy(attr, default):
def wrapper(self):
# It has to be most recent,
# to override settings in tests
from django.conf import settings
value = getattr(settings, attr, default)
if callab... | import sys
from functools import partial, update_wrapper
from django.utils import six
def proxy(attr, default):
def wrapper(self):
# It has to be most recent,
# to override settings in tests
from django.conf import settings
value = getattr(settings, attr, default)
if callab... | Fix "import star" feature support | Fix "import star" feature support
`dict.keys()` returns `dict_keys` object in py3,
which does not support indexing.
| Python | bsd-3-clause | byashimov/django-pkgconf | ---
+++
@@ -26,7 +26,7 @@
for key, value in attrs.items()
if not key.startswith('__')
}
- attrs.update(fields, __all__=fields.keys())
+ attrs.update(fields, __all__=tuple(fields))
# Ready to build
cls = super(ConfMeta, mcs).__new__(mcs, name, bases,... |
4fe1350e5bb5d093e4d41fb1deace70fd8dfec50 | main.py | main.py | #!/usr/bin/python
from flask import Flask
from flask.ext.pymongo import PyMongo
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
@app.route("/recent")
def get_recent_questions():
pass
@app.route('/register', methods=["POST"])
def register():
pass
def login():
pass
def logo... | #!/usr/bin/python
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
@app.route("/recent")
def get_recent_questions():
pass
@app.route('/register', methods=["POST"])
def register():
pass
@app.route("/login", methods=["POST"])
def login():
pass
@app.ro... | Add missing routes to API. | Add missing routes to API.
| Python | agpl-3.0 | tatsuhirosatou/p2p-app-backend,tatsuhirosatou/p2p-app-backend | ---
+++
@@ -1,7 +1,6 @@
#!/usr/bin/python
from flask import Flask
-from flask.ext.pymongo import PyMongo
app = Flask(__name__)
@@ -17,9 +16,11 @@
def register():
pass
+@app.route("/login", methods=["POST"])
def login():
pass
+@app.route("/logout")
def logout():
pass
@@ -27,6 +28,7 @@
... |
d61bc5d2d5dad607332bfe131e537d139011ab57 | main.py | main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from bot import Bot
if __name__ == "__main__":
bot = Bot()
bot.start() | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from bot import Bot
import os
import signal
def signal_handler(signal, frame):
print "Caught SIGINT, terminating."
os._exit(0)
if __name__ == "__main__":
bot = Bot()
bot.start()
signal.signal(signal.SIGINT, signal_handler)
while Ture:
signa... | Allow program termination using SIGINT | Allow program termination using SIGINT
It's a rather crude method, but it works.
| Python | mit | gehaxelt/python-rss2irc | ---
+++
@@ -1,7 +1,16 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from bot import Bot
+import os
+import signal
+
+def signal_handler(signal, frame):
+ print "Caught SIGINT, terminating."
+ os._exit(0)
if __name__ == "__main__":
bot = Bot()
bot.start()
+ signal.signal(signal.SIGINT, sign... |
c49024439978fddee1cd688524741e8ee482132b | pi_gpio/sockets.py | pi_gpio/sockets.py | from flask.ext.socketio import emit
from pi_gpio import socketio
from config.pins import PinManager
PIN_MANAGER = PinManager()
@socketio.on('pin:list')
def pin_list():
response = PIN_MANAGER.read_all()
emit('pin:list', response)
@socketio.on('pin:read')
def pin_read(data):
response = PIN_MANAGER.read_... | from flask.ext.socketio import emit
from pi_gpio import socketio
from config.pins import PinManager
PIN_MANAGER = PinManager()
@socketio.on('pin:list')
def pin_list():
response = PIN_MANAGER.read_all()
emit('pin:list', response)
@socketio.on('pin:read')
def pin_read(data):
response = PIN_MANAGER.read_... | Fix the usage of dict object | Fix the usage of dict object
Fix this error:
```sh
pi@raspberrypi:~/Pi-GPIO-Server $ !sudo
sudo python pi_gpio_server.py
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gevent/greenlet.py", line 327, in run
result = self._run(*self.args, **self.kwargs)
File "/usr/local/... | Python | mit | projectweekend/Pi-GPIO-Server,projectweekend/Pi-GPIO-Server,projectweekend/Pi-GPIO-Server,projectweekend/Pi-GPIO-Server | ---
+++
@@ -14,15 +14,15 @@
@socketio.on('pin:read')
def pin_read(data):
- response = PIN_MANAGER.read_one(data.num)
+ response = PIN_MANAGER.read_one(data['num'])
emit('pin:read', response)
@socketio.on('pin:write')
def pin_write(data):
- result = PIN_MANAGER.update_value(data.num, data.value... |
324c61e220fcb66973007cab4b95ca249aef3274 | bvggrabber/api/actualdeparture.py | bvggrabber/api/actualdeparture.py | # -*- coding: utf-8 -*-
| # -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
from bvggrabber.api import QueryApi, Departure
ACTUAL_QUERY_API_ENDPOINT = 'http://mobil.bvg.de/IstAbfahrtzeiten/index/mobil'
class ActualDepartureQueryApi(QueryApi):
def __init__(self, station):
super(ActualDepartureQueryApi, se... | Add first attempt of ActualDepartureQueryApi | Add first attempt of ActualDepartureQueryApi
| Python | bsd-3-clause | MarkusH/bvg-grabber | ---
+++
@@ -1 +1,53 @@
# -*- coding: utf-8 -*-
+
+
+import requests
+
+from bs4 import BeautifulSoup
+
+from bvggrabber.api import QueryApi, Departure
+
+
+ACTUAL_QUERY_API_ENDPOINT = 'http://mobil.bvg.de/IstAbfahrtzeiten/index/mobil'
+
+
+class ActualDepartureQueryApi(QueryApi):
+
+ def __init__(self, station):
... |
98bb4305ccdd8a83763bedb1f09c261e9904487c | cla_backend/apps/legalaid/tests/test_views.py | cla_backend/apps/legalaid/tests/test_views.py | import unittest
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase, Client
from django.contrib.auth.models import Permission
from legalaid.tests.views.test_base import CLAProviderAuthBaseApiTestMixin
from legalaid.views import FullCaseViewSet
from... | from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase, Client
from django.contrib.auth.models import Permission
from django.core.urlresolvers import reverse
from legalaid.views import FullCaseViewSet
from cla_backend.apps.call_centre.permissions impor... | Refactor the test for the method test_filter inside class FullCaseViewSet and create a new test that allows you to test for just ASCII characters | Refactor the test for the method test_filter inside class FullCaseViewSet and create a new test that allows you to test for just ASCII characters
| Python | mit | ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend | ---
+++
@@ -1,22 +1,26 @@
-import unittest
-
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase, Client
from django.contrib.auth.models import Permission
+from django.core.urlresolvers import reverse
-from legalaid.tests.views.test_base impo... |
e9a5bbd1eba1cdad15626a712bfc7994008c7381 | byceps/blueprints/snippet/init.py | byceps/blueprints/snippet/init.py | """
byceps.blueprints.snippet.init
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from flask import current_app
from ...services.snippet import mountpoint_service
from .views import blueprint as snippet_blueprint, view_current_version_b... | """
byceps.blueprints.snippet.init
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from flask import current_app
from ...services.snippet import mountpoint_service
from .views import blueprint as snippet_blueprint, view_current_version_b... | Fix snippet URL rules to use mountpoints' endpoint suffix | Fix snippet URL rules to use mountpoints' endpoint suffix
| Python | bsd-3-clause | m-ober/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps | ---
+++
@@ -25,7 +25,7 @@
"""Register a route for the snippet."""
endpoint = '{}.{}'.format(snippet_blueprint.name,
mountpoint.endpoint_suffix)
- defaults = {'name': mountpoint.snippet.name}
+ defaults = {'name': mountpoint.endpoint_suffix}
current_app.add_url_rul... |
5611d502c30ee0274fcd523deffcb68c77f31fd8 | basic.py | basic.py |
from brutal.core.plugin import BotPlugin, cmd, event, match, threaded
@cmd
def ping(event):
"""Responds 'pong' to your 'ping'."""
return 'pong'
@cmd
def echo(event):
"""Echoes back the message it recieves."""
return ' '.join(event.args)
@cmd
def sudo(event):
return 'okay.'
@cmd
def make(even... |
from brutal.core.plugin import BotPlugin, cmd, event, match, threaded
@cmd
def ping(event):
"""Responds 'pong' to your 'ping'."""
return 'pong'
@cmd
def echo(event):
"""Echoes back the message it recieves."""
return ' '.join(event.args)
@cmd
def sudo(event):
"""Responds 'okay.' to your 'sudo ... | Add docstrings to 'sudo' and 'make'. | Add docstrings to 'sudo' and 'make'. | Python | apache-2.0 | Adman/brutal-plugins,mrshu/brutal-plugins | ---
+++
@@ -16,10 +16,12 @@
@cmd
def sudo(event):
+ """Responds 'okay.' to your 'sudo ...' (http://xkcd.com/149/)."""
return 'okay.'
@cmd
def make(event):
+ """Tells user to go make it himself (http://xkcd.com/149/')."""
return 'what? make it yourself.'
|
d37cac61f1457609806fba507cf9568188d1664d | button.py | button.py | import RPi.GPIO as GPIO
import time
import os
#sets the Input Pin for your Button
#in this case it is GPIO24 or HardwarePin 19
buttonPin = 19
#sets GPIO Mode to use Hardware Pin Layout
GPIO.setmode(GPIO.BCM)
#sets GPIO Pin to INPUT mode with a Pull Down Resistor
GPIO.setup(buttonPin,GPIO.IN, pull_up_down=GPIO.PUD_DOWN... | import RPi.GPIO as GPIO
import time
import os
import sys
from optparse import OptionParser
# Parse input arguments
parser = OptionParser()
parser.add_option("-t", "--testGPIO", action="store_true", help="Test GPIO connection, does not call the JS script.")
# The option --pin sets the Input Pin for your Button
# It d... | Allow parsing of option arguments and basic GPIO testing. | Allow parsing of option arguments and basic GPIO testing.
| Python | mit | henne-/guest-password-printer,henne-/guest-password-printer | ---
+++
@@ -1,17 +1,39 @@
import RPi.GPIO as GPIO
import time
import os
+import sys
-#sets the Input Pin for your Button
-#in this case it is GPIO24 or HardwarePin 19
-buttonPin = 19
+from optparse import OptionParser
+
+# Parse input arguments
+parser = OptionParser()
+parser.add_option("-t", "--testGPIO", acti... |
eb39ec42078994eac9a5d085f35bcb35dea77a64 | salt/states/apt.py | salt/states/apt.py | # Import python libs
import logging
# Import salt libs
import salt.utils
log = logging.getLogger(__name__)
def held(name):
'''
Set package in 'hold' state, meaning it will not be upgraded.
name
The name of the package, e.g., 'tmux'
'''
ret = {'name': name}
state = __salt__['pkg.get_... | # Import python libs
import logging
# Import salt libs
import salt.utils
log = logging.getLogger(__name__)
def held(name):
'''
Set package in 'hold' state, meaning it will not be upgraded.
name
The name of the package, e.g., 'tmux'
'''
ret = {'name': name, 'changes': {}, 'result': False... | Make dict updates more dense | Make dict updates more dense
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -14,36 +14,26 @@
name
The name of the package, e.g., 'tmux'
'''
- ret = {'name': name}
+ ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''}
state = __salt__['pkg.get_selections'](
pattern=name,
)
if not state:
- ret.update({'changes':... |
d0818c7dcabebe7697444b73b6b8f30ade73958d | openedx/core/djangoapps/appsembler/eventtracking/utils.py | openedx/core/djangoapps/appsembler/eventtracking/utils.py | """
Utility functions for event tracking processing.
"""
from django.core.exceptions import MultipleObjectsReturned
from . import exceptions
def get_site_config_for_event(event_props):
"""
Try multiple strategies to find a SiteConfiguration object to use
for evaluating and processing an event.
Retu... | """
Utility functions for event tracking processing.
"""
from django.core.exceptions import MultipleObjectsReturned
from . import exceptions
def get_site_config_for_event(event_props):
"""
Try multiple strategies to find a SiteConfiguration object to use
for evaluating and processing an event.
Retu... | Return exeption if cannot get the site config in event | Return exeption if cannot get the site config in event
| Python | agpl-3.0 | appsembler/edx-platform,appsembler/edx-platform,appsembler/edx-platform,appsembler/edx-platform | ---
+++
@@ -31,6 +31,11 @@
# allow to fail if more than one Organization to avoid sharing data
orgcourse = models.OrganizationCourse.objects.get(course_id=args)
org = orgcourse.organization
+ else:
+ raise exceptions.EventProcessingError(
+ ... |
872875ecb3b5a09c14da8836cdd4b7a6f6610675 | vumi/transports/mxit/responses.py | vumi/transports/mxit/responses.py | import re
from twisted.web.template import Element, renderer, XMLFile
from twisted.python.filepath import FilePath
class ResponseParser(object):
HEADER_PATTERN = r'^(.*)[\r\n]{1,2}\d?'
ITEM_PATTERN = r'^(\d+)\. (.+)$'
def __init__(self, content):
header_match = re.match(self.HEADER_PATTERN, con... | import re
from twisted.web.template import Element, renderer, XMLFile
from twisted.python.filepath import FilePath
from vumi.utils import PkgResources
MXIT_RESOURCES = PkgResources(__name__)
class ResponseParser(object):
HEADER_PATTERN = r'^(.*)[\r\n]{1,2}\d?'
ITEM_PATTERN = r'^(\d+)\. (.+)$'
def __... | Use PkgResources helper to load response templates. | Use PkgResources helper to load response templates.
| Python | bsd-3-clause | TouK/vumi,TouK/vumi,TouK/vumi,harrissoerja/vumi,harrissoerja/vumi,vishwaprakashmishra/xmatrix,vishwaprakashmishra/xmatrix,harrissoerja/vumi,vishwaprakashmishra/xmatrix | ---
+++
@@ -2,6 +2,11 @@
from twisted.web.template import Element, renderer, XMLFile
from twisted.python.filepath import FilePath
+
+from vumi.utils import PkgResources
+
+
+MXIT_RESOURCES = PkgResources(__name__)
class ResponseParser(object):
@@ -25,8 +30,7 @@
class MxitResponse(Element):
- loader =... |
4719401819a877ceebfcc49f1084fb01395a3f4d | nyuki/bus/persistence/mongo_backend.py | nyuki/bus/persistence/mongo_backend.py | from datetime import datetime
import logging
from motor.motor_asyncio import AsyncIOMotorClient
from pymongo.errors import AutoReconnect
log = logging.getLogger(__name__)
class MongoBackend(object):
def __init__(self, name):
self.name = name
self.host = None
self._collection = None
... | from datetime import datetime
import logging
from motor.motor_asyncio import AsyncIOMotorClient
from pymongo.errors import AutoReconnect
log = logging.getLogger(__name__)
class MongoBackend(object):
def __init__(self, name):
self.name = name
self.host = None
self._collection = None
... | Add failsafe mongo calls | Add failsafe mongo calls [ci skip]
| Python | apache-2.0 | optiflows/nyuki,gdraynz/nyuki,gdraynz/nyuki,optiflows/nyuki | ---
+++
@@ -30,11 +30,14 @@
log.error("Could not reach mongo at address '%s'", self.host)
async def store(self, topic, message):
- await self._collection.insert({
- 'created_at': datetime.utcnow(),
- 'topic': str(topic),
- 'message': message
- })
+ ... |
eb7201789bc5ce03ca415fc4c208ce5a41bfc249 | sha1.py | sha1.py | #!/usr/bin/env python
"""
usage: python -m sha1 <filename>
"""
import sys
import hashlib
# --- these fields are required for packaging
__version__ = '1.0'
__author__ = 'anatoly techtonik <techtonik@gmail.com>'
__license__ = 'Public Domain'
__url__ = 'https://gist.github.com/techtonik/df09baeacbebc52d234b'
# /-- these ... | #!/usr/bin/env python
"""
usage: python -m sha1 <filename>
"""
import sys
import hashlib
# --- these fields are required for packaging
__version__ = '1.0'
__author__ = 'anatoly techtonik <techtonik@gmail.com>'
__license__ = 'Public Domain'
__url__ = 'https://github.com/techtonik/sha1'
# /-- these fields are required f... | Move from Gist to GitHub | Move from Gist to GitHub | Python | unlicense | techtonik/sha1 | ---
+++
@@ -9,7 +9,7 @@
__version__ = '1.0'
__author__ = 'anatoly techtonik <techtonik@gmail.com>'
__license__ = 'Public Domain'
-__url__ = 'https://gist.github.com/techtonik/df09baeacbebc52d234b'
+__url__ = 'https://github.com/techtonik/sha1'
# /-- these fields are required for packaging
if not sys.argv[1:]: |
fbbb01a3ef5811c102be6822a16a881212e421a9 | typo.py | typo.py | from __future__ import absolute_import
__all__ = ['app']
from ConfigParser import SafeConfigParser as ConfigParser
from urlparse import urlparse, urlunparse
from flask import Flask, request, redirect
from fuzzywuzzy import process
from tldextract import extract
config = ConfigParser()
config.read(['config.ini', 'co... | from __future__ import absolute_import
__all__ = ['app']
from ConfigParser import SafeConfigParser as ConfigParser
from urlparse import urlparse, urlunparse
from flask import Flask, request, redirect
from fuzzywuzzy import process
from tldextract import extract
config = ConfigParser()
config.read(['config.ini', 'co... | Use passed url argument in get_best_match | Use passed url argument in get_best_match
| Python | mit | sabf/typo | ---
+++
@@ -35,7 +35,7 @@
def get_best_match(url):
- original_url = extract(request.url)
+ original_url = extract(url)
sub = original_url.subdomain
closest, score = process.extractOne(sub, MATCH_SITES.keys(),
score_cutoff=CUTOFF) or (None, 0) |
75e0c323871d6eae6959523b105a06cfe8460a28 | etk2/etk.py | etk2/etk.py | import json
class ETK(object):
def __init__(self):
pass
def get_glossary(self, file_path):
res = dict()
with open(file_path) as fp:
line = fp.readline().rstrip('\n')
while line:
res[line] = line
line = fp.readline().rstrip('\n')
... | from typing import List
import json
class ETK(object):
def __init__(self):
pass
def get_glossary(self, file_path) -> List[str]:
"""
A glossary is a text file, one entry per line.
Args:
file_path (str): path to a text file containing a glossary.
Returns: L... | Add comments and typing annotations | Add comments and typing annotations
| Python | mit | usc-isi-i2/etk,usc-isi-i2/etk,usc-isi-i2/etk | ---
+++
@@ -1,3 +1,4 @@
+from typing import List
import json
class ETK(object):
@@ -5,7 +6,16 @@
def __init__(self):
pass
- def get_glossary(self, file_path):
+ def get_glossary(self, file_path) -> List[str]:
+ """
+ A glossary is a text file, one entry per line.
+
+ Arg... |
3f1c988830b7b5128c8da141326ecbf7234a791a | kolibri/core/content/utils/content_types_tools.py | kolibri/core/content/utils/content_types_tools.py | from django.db.models import Q
from le_utils.constants import content_kinds
from kolibri.core.content.hooks import ContentRendererHook
from kolibri.core.content.models import ContentNode
# Start with an empty queryset, as we'll be using OR to add conditions
renderable_contentnodes_without_topics_q_filter = ContentNod... | from django.db.models import Q
from le_utils.constants import content_kinds
from kolibri.core.content.hooks import ContentRendererHook
# Start with an empty Q object, as we'll be using OR to add conditions
renderable_contentnodes_without_topics_q_filter = Q()
# loop through all the registered content renderer hooks... | Use Q object instead of empty queryset | Use Q object instead of empty queryset
| Python | mit | mrpau/kolibri,lyw07/kolibri,lyw07/kolibri,learningequality/kolibri,mrpau/kolibri,learningequality/kolibri,indirectlylit/kolibri,learningequality/kolibri,indirectlylit/kolibri,mrpau/kolibri,lyw07/kolibri,indirectlylit/kolibri,lyw07/kolibri,learningequality/kolibri,indirectlylit/kolibri,mrpau/kolibri | ---
+++
@@ -2,10 +2,10 @@
from le_utils.constants import content_kinds
from kolibri.core.content.hooks import ContentRendererHook
-from kolibri.core.content.models import ContentNode
-# Start with an empty queryset, as we'll be using OR to add conditions
-renderable_contentnodes_without_topics_q_filter = Conten... |
756456992247bf8dbb0731556e37ecd0cf32e3ab | scripts/splitfa.py | scripts/splitfa.py | #!/usr/bin/env python
from __future__ import print_function, absolute_import, division
import screed
import docopt
CLI = """
USAGE:
fasplit <fasta> <prefix>
"""
opts = docopt.docopt(CLI)
prefix = opts['<prefix>']
with screed.open(opts['<fasta>']) as fh:
for record in fh:
fname = "{}{}.fasta".format(p... | #!/usr/bin/env python
from __future__ import print_function, absolute_import, division
import screed
import docopt
CLI = """
USAGE:
fasplit <fasta> <prefix>
"""
opts = docopt.docopt(CLI)
prefix = opts['<prefix>']
with screed.open(opts['<fasta>']) as fh:
for record in fh:
fname = "{}{}.fasta".format(p... | Remove gaps from individual genomes | Remove gaps from individual genomes
| Python | mit | kdmurray91/kwip-experiments,kdmurray91/kwip-experiments,kdmurray91/kwip-experiments | ---
+++
@@ -16,5 +16,5 @@
fname = "{}{}.fasta".format(prefix, record.name)
with open(fname, 'w') as ofh:
print(">", record.name, sep='', file=ofh)
- print(record.sequence, file=ofh)
+ print(str(record.sequence).translate(None, '-'), file=ofh)
|
e8880d6a4fb96722551bdc50274cdfddc2bd41d2 | corehq/ex-submodules/casexml/apps/case/tests/test_signals.py | corehq/ex-submodules/casexml/apps/case/tests/test_signals.py | from django.test import TestCase
from casexml.apps.case.mock import CaseFactory
from casexml.apps.case.signals import cases_received
from casexml.apps.case.xform import process_cases_with_casedb
from corehq.form_processor.backends.sql.dbaccessors import FormAccessorSQL
from corehq.form_processor.interfaces.processor im... | from django.test import TestCase
from casexml.apps.case.mock import CaseFactory
from casexml.apps.case.signals import cases_received
from casexml.apps.case.xform import process_cases_with_casedb
from corehq.form_processor.backends.sql.dbaccessors import FormAccessorSQL
from corehq.form_processor.interfaces.processor im... | Refactor test to not use global variable | Refactor test to not use global variable
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | ---
+++
@@ -17,14 +17,14 @@
CommCareCaseSQL(case_id='fake2'),
])
form = FormAccessorSQL.get_form(case.xform_ids[0])
+ received = []
- def assert_exactly_one_case(sender, xform, cases, **kwargs):
- global case_count
- case_count = len(cases)
+ ... |
081b1cd60e363adf941ba511c7683c0ed2843a97 | gubernator/appengine_config.py | gubernator/appengine_config.py | # Copyright 2016 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | # Copyright 2016 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | Increase Gubernator's url fetch deadline -- 5 seconds is too fast! | Increase Gubernator's url fetch deadline -- 5 seconds is too fast!
This should avoid a lot of refreshes because some directory listing or
download takes slightly too long.
| Python | apache-2.0 | mikedanese/test-infra,gmarek/test-infra,mindprince/test-infra,shashidharatd/test-infra,cblecker/test-infra,rmmh/kubernetes-test-infra,mikedanese/test-infra,jlowdermilk/test-infra,shyamjvs/test-infra,mikedanese/test-infra,girishkalele/test-infra,grodrigues3/test-infra,monopole/test-infra,foxish/test-infra,mikedanese/tes... | ---
+++
@@ -15,6 +15,7 @@
import os
from google.appengine.ext import vendor
+from google.appengine.api import urlfetch
# Add any libraries installed in the "third_party" folder.
vendor.add('third_party')
@@ -22,3 +23,7 @@
# Use remote GCS calls for local development.
if os.environ.get('SERVER_SOFTWARE','').... |
e8e326fe39623ea04082553d1293b1e79c3611f6 | proto/ho.py | proto/ho.py | #!/usr/bin/env python
import sys
from board import Board, BoardView
from utils import clear, getch
def main():
board = Board(19, 19)
view = BoardView(board)
def move():
board.move(*view.cursor)
view.redraw()
def exit():
sys.exit(0)
KEYS = {
'w': view.cursor_up,... | #!/usr/bin/env python
import sys
from board import Board, BoardView
from utils import clear, getch
def main():
board = Board(19, 19)
view = BoardView(board)
err = None
def move():
board.move(*view.cursor)
view.redraw()
def exit():
sys.exit(0)
KEYS = {
'w': ... | Add error handling to main game loop | Add error handling to main game loop
| Python | mit | davesque/go.py | ---
+++
@@ -9,6 +9,7 @@
def main():
board = Board(19, 19)
view = BoardView(board)
+ err = None
def move():
board.move(*view.cursor)
@@ -30,8 +31,12 @@
# Print board
clear()
sys.stdout.write('{0}\n'.format(view))
- sys.stdout.write('Black: {black} -- Whit... |
bc399ed6902f6ba3d24e1ce1a8ff88a259793c3a | Artifactorial/urls.py | Artifactorial/urls.py | # -*- coding: utf-8 -*-
# vim: set ts=4
# Copyright 2014 Rémi Duraffort
# This file is part of Artifactorial.
#
# Artifactorial is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the L... | # -*- coding: utf-8 -*-
# vim: set ts=4
# Copyright 2014 Rémi Duraffort
# This file is part of Artifactorial.
#
# Artifactorial is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the L... | Use the new url pattern | Use the new url pattern
| Python | mit | ivoire/Artifactorial,ivoire/Artifactorial,ivoire/Artifactorial | ---
+++
@@ -21,7 +21,10 @@
from django.conf.urls import patterns, url
+import Artifactorial.views as a_views
-urlpatterns = patterns('Artifactorial.views',
- url(r'^artifacts/(?P<filename>.*)$', 'artifacts', name='artifacts'),
- url(r'^shared/(?P<token>.*)$', 'shared... |
ff2d9b276928d2bf06ae81b1fa243ee2816cd694 | seawater/__init__.py | seawater/__init__.py | # -*- coding: utf-8 -*-
__all__ = ["csiro", "extras"]
__authors__ = 'Filipe Fernandes'
__created_ = "14-Jan-2010"
__email__ = "ocefpaf@gmail.com"
__license__ = "MIT"
__maintainer__ = "Filipe Fernandes"
__modified__ = "16-Mar-2013"
__status__ = "Production"
__version__ = "2.0.0"
import csiro
import extras
| # -*- coding: utf-8 -*-
from csiro import *
| Update to reflect some small re-factoring. | Update to reflect some small re-factoring.
| Python | mit | ocefpaf/python-seawater,pyoceans/python-seawater,pyoceans/python-seawater,ocefpaf/python-seawater | ---
+++
@@ -1,14 +1,3 @@
# -*- coding: utf-8 -*-
-__all__ = ["csiro", "extras"]
-__authors__ = 'Filipe Fernandes'
-__created_ = "14-Jan-2010"
-__email__ = "ocefpaf@gmail.com"
-__license__ = "MIT"
-__maintainer__ = "Filipe Fernandes"
-__modified__ = "16-Mar-2013"
-__status__ = "Production"
-__version__ = "2.0.0"
-
... |
9e8093fe66da557ca9e976e600b8977c002f5241 | blog/testsettings.py | blog/testsettings.py | DEBUG = True
DEBUG_TEMPLATE = True
SITE_ID = 1
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = '/tmp/asgard-blog-devel.db'
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.comments',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.admin',
'django.contrib.sites',
'django.contrib.sit... | DEBUG = True
DEBUG_TEMPLATE = True
SITE_ID = 1
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = '/tmp/asgard-blog-devel.db'
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.comments',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.admin',
'django.contrib.sites',
'django.contrib.sit... | Revert "Fixed up some things." | Revert "Fixed up some things."
This reverts commit 2d3d6c1b569e1f35faf9cd79a369862651c008ff.
| Python | bsd-3-clause | myles-archive/asgard-blog,asgardproject/asgard-blog,asgardproject/asgard-blog,asgardproject/asgard-blog,myles-archive/asgard-blog,myles-archive/asgard-blog | ---
+++
@@ -14,6 +14,7 @@
'django_markup',
'taggit',
+ 'django_graffle',
'blog',
] |
0d135a746dd79ad1b703570e2bb3b27a694c67b0 | simuvex/procedures/stubs/NoReturnUnconstrained.py | simuvex/procedures/stubs/NoReturnUnconstrained.py | import simuvex
######################################
# NoReturnUnconstrained
# Use in places you would put ReturnUnconstrained as a default action
# But the function shouldn't actually return
######################################
use_cases = {'exit_group', 'exit', 'abort', 'longjmp', 'pthread_exit', 'siglongjmp'}
... | import simuvex
######################################
# NoReturnUnconstrained
# Use in places you would put ReturnUnconstrained as a default action
# But the function shouldn't actually return
######################################
class NoReturnUnconstrained(simuvex.SimProcedure): #pylint:disable=redefined-builtin
... | Move use_cases into the class | Move use_cases into the class
| Python | bsd-2-clause | iamahuman/angr,iamahuman/angr,f-prettyland/angr,chubbymaggie/simuvex,chubbymaggie/angr,schieb/angr,angr/angr,tyb0807/angr,f-prettyland/angr,tyb0807/angr,axt/angr,tyb0807/angr,chubbymaggie/angr,angr/angr,angr/angr,iamahuman/angr,axt/angr,f-prettyland/angr,chubbymaggie/angr,angr/simuvex,chubbymaggie/simuvex,zhuyue1314/si... | ---
+++
@@ -6,9 +6,9 @@
# But the function shouldn't actually return
######################################
-use_cases = {'exit_group', 'exit', 'abort', 'longjmp', 'pthread_exit', 'siglongjmp'}
-
class NoReturnUnconstrained(simuvex.SimProcedure): #pylint:disable=redefined-builtin
+ use_cases = {'exit_group', ... |
4e5825b732597d7adcfcf8eaea3468c893b86347 | src/akllt/tests.py | src/akllt/tests.py | # coding: utf-8
import pkg_resources
from django.test.testcases import TransactionTestCase
from homophony import BrowserTestCase, Browser
def import_pages(directory):
pass
class SmokeTest(TransactionTestCase):
def test_nothing(self):
self.client.get('/')
class FoobarTestCase(BrowserTestCase):
... | # coding: utf-8
import pkg_resources
from django.test.testcases import TransactionTestCase
from homophony import BrowserTestCase, Browser
from akllt.models import StandardPage
def import_pages(directory):
pass
def import_pages(directory):
pass
class SmokeTest(TransactionTestCase):
def test_nothing(s... | Create functional test for data import | Create functional test for data import
| Python | agpl-3.0 | python-dirbtuves/akl.lt,python-dirbtuves/akl.lt,python-dirbtuves/akl.lt,python-dirbtuves/akl.lt,python-dirbtuves/akl.lt | ---
+++
@@ -3,6 +3,11 @@
from django.test.testcases import TransactionTestCase
from homophony import BrowserTestCase, Browser
+from akllt.models import StandardPage
+
+
+def import_pages(directory):
+ pass
def import_pages(directory):
@@ -35,3 +40,11 @@
# expected_content = pkg_resources.resource... |
983e4fc9c5fafcfb60996c73571fc9ae9dd6b307 | app/__init__.py | app/__init__.py | from flask import Flask
from flask_login import LoginManager
from flask_bcrypt import Bcrypt
from flask_admin import Admin
from flask_admin.contrib.peewee import ModelView
from playhouse.flask_utils import FlaskDB
app = Flask(__name__)
app.config.from_object('config')
@app.before_request
def _db_connect():
db.co... | from flask import Flask
from flask_login import LoginManager
from flask_bcrypt import Bcrypt
from flask_admin import Admin
from flask_admin.contrib.peewee import ModelView
from playhouse.flask_utils import FlaskDB
app = Flask(__name__)
app.config.from_object('config')
@app.before_request
def _db_connect():
db.co... | Fix table names in flask-admin | Fix table names in flask-admin
| Python | mpl-2.0 | teknologkoren/teknologkoren-se,teknologkoren/teknologkoren-se,teknologkoren/teknologkoren-se,teknologkoren/teknologkoren-se | ---
+++
@@ -31,10 +31,10 @@
from app.models import User, Page, Post, Event
admin = Admin(app, name='teknologkoren.se')
-admin.add_view(ModelView(User, db))
-admin.add_view(ModelView(Page, db))
-admin.add_view(ModelView(Post, db))
-admin.add_view(ModelView(Event, db))
+admin.add_view(ModelView(User, name='User'))
... |
d617ce484c1c85032f6c792b7f03d7710df97acf | GoldenDictMedia/2.1/golden_dict_media/__init__.py | GoldenDictMedia/2.1/golden_dict_media/__init__.py | import aqt
from golden_dict_media.AddonInitializer import init_addon
if aqt.mw is not None:
init_addon()
| import aqt
from .AddonInitializer import init_addon
if aqt.mw is not None:
init_addon()
| Use relative paths in golden_dict_media | Use relative paths in golden_dict_media
| Python | mit | searene/Anki-Addons,searene/Anki-Addons | ---
+++
@@ -1,6 +1,6 @@
import aqt
-from golden_dict_media.AddonInitializer import init_addon
+from .AddonInitializer import init_addon
if aqt.mw is not None:
init_addon() |
130dbb5003273e0681b35aa171c8c7e235fbbe59 | src/bibim/lexer.py | src/bibim/lexer.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from rply import LexerGenerator
op_map = {
'NUMBER': r'\d[\d\s]*',
'PLUS': r'\+',
'MINUS': r'-',
'MUL': r'\*',
'NUMBER_SEP': r'/',
'EXPR_OPEN': r'\(',
'EXPR_CLOSE': r'\)',
'AND': r'&',
'OR': r'\|',
'NOT': r'!',
... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from rply import LexerGenerator
op_map = {
'NUMBER': r'\d[\d\s]*',
'PLUS': r'\+',
'MINUS': r'-',
'MUL': r'\*',
'NUMBER_SEP': r'/',
'EXPR_OPEN': r'\(',
'EXPR_CLOSE': r'\)',
'AND': r'&',
'OR': r'\|',
'NOT': r'!',
... | Fix issue on multi-line comment | Fix issue on multi-line comment
| Python | mit | bibim-lang/pybibim,rishubil/pybibim,bibim-lang/pybibim | ---
+++
@@ -33,6 +33,6 @@
lg.add(name, regex)
lg.ignore('\s+')
-lg.ignore('~\s*#((?!#~).)*#\s*~')
+lg.ignore('~\s*#((?!#~)[\s|\S])*#\s*~')
lexer = lg.build() |
5e736819e35efaad8568bb0782af3d256d55963d | game/quests/__init__.py | game/quests/__init__.py | # -*- coding: utf-8 -*-
"""
Quests
- questcache.wdb
"""
from .. import *
class Quest(Model):
def getTooltip(self):
return QuestTooltip(self)
class QuestTooltip(Tooltip):
def tooltip(self):
self.append("name", self.obj.getName(), color=YELLOW)
ret = self.values
self.values = []
return ret
class Q... | # -*- coding: utf-8 -*-
"""
Quests
- questcache.wdb
"""
from .. import *
class Quest(Model):
def getTooltip(self):
return QuestTooltip(self)
class QuestTooltip(Tooltip):
def tooltip(self):
self.append("name", self.obj.getName(), color=YELLOW)
self.appendEmptyLine()
self.append("objective", self.obj... | Implement getObjective and tooltip objective | game/quests: Implement getObjective and tooltip objective
| Python | cc0-1.0 | jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow,jleclanche/pywow | ---
+++
@@ -15,6 +15,10 @@
def tooltip(self):
self.append("name", self.obj.getName(), color=YELLOW)
+ self.appendEmptyLine()
+
+ self.append("objective", self.obj.getObjective())
+ self.appendEmptyLine()
ret = self.values
self.values = []
@@ -40,6 +44,9 @@
def getName(self, row):
return r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.