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 |
|---|---|---|---|---|---|---|---|---|---|---|
a3dc06b0389eccd9a97270399c9878968c2d910c | shopify_auth/__init__.py | shopify_auth/__init__.py | VERSION = (0, 1, 0)
__version__ = '.'.join(map(str, VERSION))
__author__ = 'Gavin Ballard' | import shopify
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
VERSION = (0, 1, 1)
__version__ = '.'.join(map(str, VERSION))
__author__ = 'Gavin Ballard'
def initialize():
if not settings.SHOPIFY_APP_API_KEY or not settings.SHOPIFY_APP_API_SECRET:
raise Imp... | Add initialize() method to ShopifyAuth, which sets up the API key and secret of the app. | Add initialize() method to ShopifyAuth, which sets up the API key and secret of the app. | Python | mit | funkybob/django-shopify-auth,discolabs/django-shopify-auth,funkybob/django-shopify-auth,discolabs/django-shopify-auth,RafaAguilar/django-shopify-auth,RafaAguilar/django-shopify-auth | ---
+++
@@ -1,3 +1,15 @@
-VERSION = (0, 1, 0)
+import shopify
+
+from django.conf import settings
+from django.core.exceptions import ImproperlyConfigured
+
+
+VERSION = (0, 1, 1)
__version__ = '.'.join(map(str, VERSION))
__author__ = 'Gavin Ballard'
+
+
+def initialize():
+ if not settings.SHOPIFY_APP_... |
f003fd0099b1817e965483e94a51745834a802de | simple_neural_network.py | simple_neural_network.py | # This code is inspired from this post:
# http://www.kdnuggets.com/2015/10/neural-network-python-tutorial.html?utm_content=buffer2cfea&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer
import numpy as np
# Feature matrix and targets
X = np.array([[0,0,1],[0,1,1],[1,0,1],[1,1,1]])
print X.shape
y = np.array... | # This code is inspired from this post:
# http://www.kdnuggets.com/2015/10/neural-network-python-tutorial.html?utm_content=buffer2cfea&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer
import numpy as np
np.random.seed(314)
# Feature matrix and targets
X = np.array([[0,0,1],[0,1,1],[1,0,1],[1,1,1]])
print... | Set a seed for the simple neural network | Set a seed for the simple neural network
| Python | mit | yassineAlouini/ml-experiments,yassineAlouini/ml-experiments | ---
+++
@@ -2,6 +2,8 @@
# http://www.kdnuggets.com/2015/10/neural-network-python-tutorial.html?utm_content=buffer2cfea&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer
import numpy as np
+
+np.random.seed(314)
# Feature matrix and targets
X = np.array([[0,0,1],[0,1,1],[1,0,1],[1,1,1]])
@@ -12,7 +1... |
0688d285494e9c2ddb5b6ab35f2c0bd1dac02a54 | basecampx/client.py | basecampx/client.py | import json
import requests
class Client(object):
LAUNCHPAD_URL = 'https://launchpad.37signals.com'
BASE_URL = 'https://basecamp.com/%s/api/v1'
def __init__(self, access_token, user_agent, account_id=None):
"""Initialize client for making requests.
user_agent -- string identifying the ap... | import json
import urlparse
import requests
class Client(object):
LAUNCHPAD_URL = 'https://launchpad.37signals.com/'
BASE_URL = 'https://basecamp.com/%s/api/v1/'
def __init__(self, access_token, user_agent, account_id=None):
"""Initialize client for making requests.
user_agent -- string ... | Use urljoin to form urls. | Use urljoin to form urls.
| Python | mit | nous-consulting/basecamp-next | ---
+++
@@ -1,10 +1,11 @@
import json
+import urlparse
import requests
class Client(object):
- LAUNCHPAD_URL = 'https://launchpad.37signals.com'
- BASE_URL = 'https://basecamp.com/%s/api/v1'
+ LAUNCHPAD_URL = 'https://launchpad.37signals.com/'
+ BASE_URL = 'https://basecamp.com/%s/api/v1/'
d... |
3abb2aa6a86603ab8811c47ffd61a851dc314276 | src/run.py | src/run.py | """This is the main function of twitter-news-bot project
It is intended to be run as a cronjob to periodically scan
for news of interest and Tweet about it
"""
import random
from twitter_bot.service.curator import Curator
from twitter_bot.service.news_reader import NewsReader
from twitter_bot.service.twitter import Tw... | """This is the main function of twitter-news-bot project
It is intended to be run as a cronjob to periodically scan
for news of interest and Tweet about it
"""
import argparse
import random
from twitter_bot.service.curator import Curator
from twitter_bot.service.news_reader import NewsReader
from twitter_bot.service.... | Add argument parser to allow for debug mode | Add argument parser to allow for debug mode
| Python | mit | econne01/twitter-news-bot | ---
+++
@@ -3,13 +3,25 @@
It is intended to be run as a cronjob to periodically scan
for news of interest and Tweet about it
"""
+import argparse
import random
+
from twitter_bot.service.curator import Curator
from twitter_bot.service.news_reader import NewsReader
from twitter_bot.service.twitter import Twitte... |
241df143d4f75404c6cda3ff0ab3fe2fccba5f79 | whistleblower/tasks.py | whistleblower/tasks.py | import json
import logging
import os
import subprocess
from celery import Celery
from celery.schedules import crontab
from whistleblower.targets.twitter import Post as TwitterPost
import whistleblower.queue
HOUR = 3600
ENABLED_TARGETS = [
TwitterPost,
]
RABBITMQ_URL = os.environ.get('CLOUDAMQP_URL', 'pyamqp://gu... | import json
import logging
import os
import subprocess
from celery import Celery
from celery.schedules import crontab
from whistleblower.targets.twitter import Post as TwitterPost
import whistleblower.queue
HOUR = 3600
ENABLED_TARGETS = [
TwitterPost,
]
RABBITMQ_URL = os.environ.get('CLOUDAMQP_URL', 'pyamqp://gu... | Reduce time window between posts to 3 hours | Reduce time window between posts to 3 hours
| Python | unlicense | datasciencebr/whistleblower | ---
+++
@@ -19,7 +19,7 @@
@app.on_after_configure.connect
def setup_periodic_tasks(sender, **kwargs):
- sender.add_periodic_task(4 * HOUR, process_queue.s())
+ sender.add_periodic_task(3 * HOUR, process_queue.s())
@app.task |
2cc9de18bf20753907c2c0e591b58ccefe1578e0 | erudite/components/commands/find_owner.py | erudite/components/commands/find_owner.py | """
Command that will allow for a user to inject triples into a database.
"""
from rhobot.components.commands.base_command import BaseCommand
from rdflib.namespace import FOAF
from rhobot.namespace import RHO
import logging
logger = logging.getLogger(__name__)
class FindOwner(BaseCommand):
def initialize_command... | """
Command that will allow for a user to inject triples into a database.
"""
from rhobot.components.commands.base_command import BaseCommand
from rdflib.namespace import FOAF
from rhobot.namespace import RHO
from rhobot.components.storage import StoragePayload
import logging
logger = logging.getLogger(__name__)
clas... | Update find owner to work with promises. | Update find owner to work with promises.
| Python | bsd-3-clause | rerobins/rho_erudite | ---
+++
@@ -4,6 +4,7 @@
from rhobot.components.commands.base_command import BaseCommand
from rdflib.namespace import FOAF
from rhobot.namespace import RHO
+from rhobot.components.storage import StoragePayload
import logging
logger = logging.getLogger(__name__)
@@ -25,19 +26,26 @@
:return:
"""... |
144f14bc292e9621508ac755c70d679affddfb90 | corehq/apps/couch_sql_migration/management/commands/show_started_migrations.py | corehq/apps/couch_sql_migration/management/commands/show_started_migrations.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from operator import attrgetter
import six
from django.core.management.base import BaseCommand
from corehq.apps.domain_migration_flags.api import get_uncompleted_migrations
from ...progress import CO... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from operator import attrgetter
from django.core.management.base import BaseCommand
import six
from corehq.apps.domain_migration_flags.api import get_uncompleted_migrations
from ...progress import C... | Print diff stats for each domain | Print diff stats for each domain
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | ---
+++
@@ -4,12 +4,17 @@
from operator import attrgetter
+from django.core.management.base import BaseCommand
+
import six
-from django.core.management.base import BaseCommand
from corehq.apps.domain_migration_flags.api import get_uncompleted_migrations
from ...progress import COUCH_TO_SQL_SLUG
+from .mi... |
61fa32fc65ea4dbc48f881efd70c82955d8bb15e | coda/coda_project/settings/test.py | coda/coda_project/settings/test.py | from .base import *
SITE_ID = 1
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'coda_local',
'USER': os.getenv('DB_MYSQL_USER', default="root"),
'PASSWORD': os.getenv('DB_PASSWORD', default="root"),
'HOST': os.getenv('DB_HOST', default='db'),
}... | from .base import *
SITE_ID = 1
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'coda_local',
'USER': os.getenv('DB_MYSQL_USER', default='root'),
'PASSWORD': os.getenv('DB_PASSWORD', default='root'),
'HOST': os.getenv('DB_HOST', default='db'),
}... | Change double quotes to single. | Change double quotes to single.
| Python | bsd-3-clause | unt-libraries/coda,unt-libraries/coda,unt-libraries/coda,unt-libraries/coda | ---
+++
@@ -6,8 +6,8 @@
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'coda_local',
- 'USER': os.getenv('DB_MYSQL_USER', default="root"),
- 'PASSWORD': os.getenv('DB_PASSWORD', default="root"),
+ 'USER': os.getenv('DB_MYSQL_USER', default='root'),
+ 'PAS... |
0e8f8d7606380809c206e3e5db329040abe6f267 | knightos.py | knightos.py | import os
import requests
from sys import stderr, exit
from resources import get_resource_root
def get_key(platform):
if platform == "TI73": return 0x02
if platform == "TI83p" or platform == "TI83pSE": return 0x04
if platform == "TI84p" or platform == "TI84pSE": return 0x0A
if platform == "TI84pCSE": r... | import os
import requests
from sys import stderr, exit
from resources import get_resource_root
def get_key(platform):
if platform == "TI73": return 0x02
if platform == "TI83p" or platform == "TI83pSE": return 0x04
if platform == "TI84p" or platform == "TI84pSE": return 0x0A
if platform == "TI84pCSE": r... | Fix FAT constant for TI-83+ | Fix FAT constant for TI-83+
| Python | mit | KnightOS/sdk,KnightOS/sdk,KnightOS/sdk | ---
+++
@@ -24,7 +24,7 @@
def get_fat(platform):
if platform == "TI73": return 0x17
- if platform == "TI83p": return 0x37
+ if platform == "TI83p": return 0x17
if platform == "TI83pSE": return 0x77
if platform == "TI84p": return 0x37
if platform == "TI84pSE": return 0x77 |
5950f14ab025999b8161204595a7c35554fe46a0 | celery/decorators.py | celery/decorators.py | from celery.task.base import Task
from celery.registry import tasks
from inspect import getargspec
def task(**options):
"""Make a task out of any callable.
Examples:
>>> @task()
... def refresh_feed(url):
... return Feed.objects.get(url=url).refresh()
... | from celery.task.base import Task
from inspect import getargspec
def task(**options):
"""Make a task out of any callable.
Examples:
>>> @task()
... def refresh_feed(url):
... return Feed.objects.get(url=url).refresh()
>>> refresh_feed("http://example... | Allow base=PeriodicTask argument to task decorator | Allow base=PeriodicTask argument to task decorator
| Python | bsd-3-clause | WoLpH/celery,cbrepo/celery,ask/celery,cbrepo/celery,frac/celery,mitsuhiko/celery,WoLpH/celery,ask/celery,frac/celery,mitsuhiko/celery | ---
+++
@@ -1,5 +1,4 @@
from celery.task.base import Task
-from celery.registry import tasks
from inspect import getargspec
@@ -32,7 +31,7 @@
"""
def _create_task_cls(fun):
- name = options.pop("name", None)
+ base = options.pop("base", Task)
cls_name = fun.__name__
@@ -45... |
e88899fe11f1216e25e6f42f4af2acf003b22071 | documentation/doxygen/makeimage.py | documentation/doxygen/makeimage.py | #! /usr/bin/env python
import ROOT
import shutil
import os
def makeimage(MacroName, ImageName, OutDir, cp, py, batch):
'''Generates the ImageName output of the macro MacroName'''
if batch:
ROOT.gROOT.SetBatch(1)
if py: execfile(MacroName)
else: ROOT.gInterpreter.ProcessLine(".x " + MacroName... | #! /usr/bin/env python
import ROOT
import shutil
import os
def makeimage(MacroName, ImageName, OutDir, cp, py, batch):
'''Generates the ImageName output of the macro MacroName'''
ROOT.gStyle.SetImageScaling(3.)
if batch:
ROOT.gROOT.SetBatch(1)
if py: execfile(MacroName)
else: ROOT.gInte... | Implement high def pictures for python tutorials. | Implement high def pictures for python tutorials.
| Python | lgpl-2.1 | olifre/root,olifre/root,olifre/root,root-mirror/root,karies/root,root-mirror/root,olifre/root,olifre/root,olifre/root,olifre/root,karies/root,root-mirror/root,karies/root,root-mirror/root,karies/root,karies/root,karies/root,olifre/root,root-mirror/root,karies/root,olifre/root,olifre/root,karies/root,root-mirror/root,ol... | ---
+++
@@ -6,6 +6,8 @@
def makeimage(MacroName, ImageName, OutDir, cp, py, batch):
'''Generates the ImageName output of the macro MacroName'''
+
+ ROOT.gStyle.SetImageScaling(3.)
if batch:
ROOT.gROOT.SetBatch(1)
@@ -18,13 +20,20 @@
MNBase = os.path.basename(MN)
shutil.cop... |
5b7db97d615b9e30a2780a45bd1c38690e6e2e51 | src/practica/practica_turtlebot_mariano/src/node.py | src/practica/practica_turtlebot_mariano/src/node.py | #!/usr/bin/env python
# TODO is it necessary here?
import roslib; roslib.load_manifest('practica_turtlebot')
import rospy
from driver import Driver
from driver import Point
if __name__ == '__main__':
try:
# Starts a unique node with name driver
rospy.init_node('driver')
# Get current pos... | #!/usr/bin/env python
# TODO is it necessary here?
import roslib; roslib.load_manifest('practica_turtlebot')
import rospy
from driver import Driver
from driver import Point
if __name__ == '__main__':
try:
# Starts a unique node with name driver
rospy.init_node('driver')
# Get current position
star... | Add impl. of stop on obstacle | Add impl. of stop on obstacle | Python | mit | Sharekhan/catkin_ws | ---
+++
@@ -8,26 +8,23 @@
from driver import Point
if __name__ == '__main__':
- try:
- # Starts a unique node with name driver
- rospy.init_node('driver')
+ try:
+ # Starts a unique node with name driver
+ rospy.init_node('driver')
- # Get current position
- start_position ... |
1cc15cbe37e1118f102f05d9530d6f0a6055d638 | handler/base_handler.py | handler/base_handler.py | import os
from serf_master import SerfHandler
from utils import with_payload, truncated_stdout
class BaseHandler(SerfHandler):
@truncated_stdout
@with_payload
def where(self, role=None):
my_role = os.environ.get('ROLE', 'no_role')
if my_role == role:
print(self.my_info())
... | import os
from serf_master import SerfHandler
from utils import with_payload, truncated_stdout
class BaseHandler(SerfHandler):
def __init__(self, *args, **kwargs):
super(BaseHandler, self).__init__(*args, **kwargs)
self.setup()
def setup(self):
pass
@truncated_stdout
@with_... | Add setup method to base serf handler | Add setup method to base serf handler
| Python | mit | waltermoreira/serfnode,waltermoreira/serfnode,waltermoreira/serfnode | ---
+++
@@ -5,6 +5,13 @@
class BaseHandler(SerfHandler):
+
+ def __init__(self, *args, **kwargs):
+ super(BaseHandler, self).__init__(*args, **kwargs)
+ self.setup()
+
+ def setup(self):
+ pass
@truncated_stdout
@with_payload |
551d4dc7cb8839fdf8269284c81079b2b29f2ba5 | version.py | version.py | major = 0
minor=0
patch=20
branch="master"
timestamp=1376526219.94 | major = 0
minor=0
patch=21
branch="master"
timestamp=1376526439.16 | Tag commit for v0.0.21-master generated by gitmake.py | Tag commit for v0.0.21-master generated by gitmake.py
| Python | mit | ryansturmer/gitmake | ---
+++
@@ -1,5 +1,5 @@
major = 0
minor=0
-patch=20
+patch=21
branch="master"
-timestamp=1376526219.94
+timestamp=1376526439.16 |
fa73ac1d9451cbef8be65cfcd2f03762831f4212 | website_snippet_data_slider/__openerp__.py | website_snippet_data_slider/__openerp__.py | # -*- coding: utf-8 -*-
# © 2016-TODAY LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Website Snippet - Data Slider",
"summary": "Abstract data slider for use on website. Primary use is product slider.",
"version": "9.0.1.0.0",
"category": "Website",
"w... | # -*- coding: utf-8 -*-
# © 2016-TODAY LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Website Snippet - Data Slider",
"summary":
"Abstract data slider for use on website."
" Primary use (and default implementation) is product slider.",
"version... | Update summary to fix flake in website_snippet_data_slider | Update summary to fix flake in website_snippet_data_slider
| Python | agpl-3.0 | laslabs/odoo-website,laslabs/odoo-website,laslabs/odoo-website | ---
+++
@@ -4,7 +4,9 @@
{
"name": "Website Snippet - Data Slider",
- "summary": "Abstract data slider for use on website. Primary use is product slider.",
+ "summary":
+ "Abstract data slider for use on website."
+ " Primary use (and default implementation) is product slider.",
"vers... |
813b81293cd2bd69982aef36ad09fc52f7bea1f6 | relaygram/http_server.py | relaygram/http_server.py | import http.server
from threading import Thread
import os.path
class HTTPHandler:
def __init__(self, config):
self.config = config
handler = HTTPHandler.make_http_handler('C:/tmp/test/')
self.httpd = http.server.HTTPServer(('', 8000), handler)
self.thread = Thread(target=self.mai... | import http.server
from threading import Thread
import os.path
class HTTPHandler:
def __init__(self, config):
self.config = config
handler = HTTPHandler.make_http_handler(self.config['media_dir'])
self.httpd = http.server.HTTPServer(('', self.config['media']['port']), handler)
se... | Use proper settings for httpd server. | Use proper settings for httpd server.
| Python | mit | Surye/relaygram | ---
+++
@@ -7,8 +7,8 @@
def __init__(self, config):
self.config = config
- handler = HTTPHandler.make_http_handler('C:/tmp/test/')
- self.httpd = http.server.HTTPServer(('', 8000), handler)
+ handler = HTTPHandler.make_http_handler(self.config['media_dir'])
+ self.httpd = h... |
103f232f6b4c12e1d1c643c48c5055d66d7a126d | workshopvenues/venues/tests/test_models.py | workshopvenues/venues/tests/test_models.py | """
This file demonstrates writing tests using the unittest module. These will pass
when you run "./manage.py test --settings=workshopvenues.settings_test venues"
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
from .factories import FacilityFactory, CountryFactory,... | """
This file demonstrates writing tests using the unittest module. These will pass
when you run "./manage.py test --settings=workshopvenues.settings_test venues"
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
from .factories import FacilityFactory, CountryFactory,... | Add an additional test for Venue model to cover all the factory cases. | Add an additional test for Venue model to cover all the factory cases.
| Python | bsd-3-clause | andreagrandi/workshopvenues | ---
+++
@@ -29,6 +29,11 @@
venue = VenueFactory.create(facilities = (FacilityFactory(name = 'WiFI'),
FacilityFactory.create(name = 'Elevator')))
self.assertTrue(venue.id >= 0)
+
+ def test_build_venue(self):
+ venue = VenueFactory.build(facilities = (FacilityFactory(name = 'W... |
b977de3af3ae93a57f36e1d6eea234f01cbc7a61 | py/selenium/__init__.py | py/selenium/__init__.py | # Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | # Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | Remove import of Selenium RC | Remove import of Selenium RC
| Python | apache-2.0 | bayandin/selenium,carlosroh/selenium,asolntsev/selenium,Herst/selenium,alb-i986/selenium,joshuaduffy/selenium,oddui/selenium,TikhomirovSergey/selenium,sankha93/selenium,mojwang/selenium,lmtierney/selenium,carlosroh/selenium,jsakamoto/selenium,mach6/selenium,Herst/selenium,krmahadevan/selenium,DrMarcII/selenium,tbeadle/... | ---
+++
@@ -15,7 +15,5 @@
# specific language governing permissions and limitations
# under the License.
-from selenium import selenium
-
__version__ = "2.53.0" |
e0b2ce4b0287e8321cddde6c658a833dcf147974 | features.py | features.py | import numpy as np
def mean_energy(x_blocks):
return np.sqrt(np.mean(x_blocks**2, axis=1))
if __name__ == '__main__':
import matplotlib.pyplot as plt
from files import load_wav
from analysis import split_to_blocks
def analyze_mean_energy(file, block_size=1024):
x, fs = load_wav(file)
... | import numpy as np
from numpy.linalg import norm
def mean_power(x_blocks):
return np.sqrt(np.mean(x_blocks**2, axis=-1))
def power(x_blocks):
return np.sqrt(np.sum(x_blocks**2, axis=-1))
def mean_energy(x_blocks):
return np.mean(x_blocks**2, axis=-1)
def energy(x_blocks):
return np.sum(x_blocks**2, ... | Add computation on energy and power (mean and total). | Add computation on energy and power (mean and total).
| Python | mit | bzamecnik/tfr,bzamecnik/tfr | ---
+++
@@ -1,7 +1,17 @@
import numpy as np
+from numpy.linalg import norm
+
+def mean_power(x_blocks):
+ return np.sqrt(np.mean(x_blocks**2, axis=-1))
+
+def power(x_blocks):
+ return np.sqrt(np.sum(x_blocks**2, axis=-1))
def mean_energy(x_blocks):
- return np.sqrt(np.mean(x_blocks**2, axis=1))
+ ret... |
74a84d76492088f8d9df8d2712041381e57c29bb | dbaas/dbaas/settings_test.py | dbaas/dbaas/settings_test.py | from settings import * # noqa
import os
TEST_DISCOVER_ROOT = os.path.abspath(os.path.join(__file__, '../..'))
# Comment this line for turn on debug on tests
LOGGING = {}
DEBUG = 0
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
NOSE_ARGS = [
'--verbosity=0',
'--no-byte-compile',
'--debug-log=error_test.... | from settings import * # noqa
import os
TEST_DISCOVER_ROOT = os.path.abspath(os.path.join(__file__, '../..'))
# Comment this line for turn on debug on tests
LOGGING = {}
DEBUG = 0
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
NOSE_ARGS = [
'--verbosity=2',
'--no-byte-compile',
'--debug-log=error_test.... | Change verbosity of testes. To fix travis | Change verbosity of testes. To fix travis
| Python | bsd-3-clause | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | ---
+++
@@ -9,7 +9,7 @@
DEBUG = 0
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
NOSE_ARGS = [
- '--verbosity=0',
+ '--verbosity=2',
'--no-byte-compile',
'--debug-log=error_test.log',
# '-l', |
fc6aae454464aa31f1be401148645310ea9ee2b9 | cloud4rpi/errors.py | cloud4rpi/errors.py | # -*- coding: utf-8 -*-
import subprocess
TYPE_WARN_MSG = 'WARNING! A string "%s" passed to a numeric variable. ' \
'Change the variable type or the passed value.' \
class InvalidTokenError(Exception):
pass
class InvalidConfigError(TypeError):
pass
class UnexpectedVariableTypeError(Type... | # -*- coding: utf-8 -*-
import subprocess
TYPE_WARN_MSG = 'WARNING! A string "%s" passed to a numeric variable. ' \
'Change the variable type or the passed value.' \
class InvalidTokenError(Exception):
pass
class InvalidConfigError(TypeError):
pass
class UnexpectedVariableTypeError(Type... | Fix receiving an error message for python2 & 3 | Fix receiving an error message for python2 & 3
| Python | mit | cloud4rpi/cloud4rpi | ---
+++
@@ -49,4 +49,4 @@
def get_error_message(e):
- return __messages.get(type(e), 'Unexpected error: {0}').format(e.message)
+ return __messages.get(type(e), 'Unexpected error: {0}').format(str(type(e)) + str(e.args)) |
c17fed815cd062b37ebe5e6118da43afcf89db1f | relay_api/core/relay.py | relay_api/core/relay.py | import RPi.GPIO as GPIO
class relay():
def __init__(self, gpio_num, NC=False):
self.gpio_num = gpio_num
GPIO.setmode(GPIO.BCM)
try:
GPIO.input(self.gpio_num)
raise LookupError("Relay is already in use!")
except RuntimeError:
GPIO.setup(self.gpio_... | import RPi.GPIO as GPIO
class relay():
def __init__(self, gpio_num, NC=False):
self.gpio = gpio_num
self.nc = NC
GPIO.setmode(GPIO.BCM)
try:
GPIO.input(self.gpio)
raise LookupError("Relay is already in use!")
except RuntimeError:
GPIO.set... | Add nc and state as attributes. Change name of gpio_num to gpio | Add nc and state as attributes. Change name of gpio_num to gpio
| Python | mit | pahumadad/raspi-relay-api | ---
+++
@@ -3,28 +3,31 @@
class relay():
def __init__(self, gpio_num, NC=False):
- self.gpio_num = gpio_num
+ self.gpio = gpio_num
+ self.nc = NC
GPIO.setmode(GPIO.BCM)
try:
- GPIO.input(self.gpio_num)
+ GPIO.input(self.gpio)
raise Look... |
abff14b5804bf43bc2bffeac6418259580bdbae5 | makecard.py | makecard.py | #!/usr/bin/env python
import svgwrite
def main():
print 'test'
if __name__ == '__main__':
main()
| #!/usr/bin/env python
import sys
import svgwrite
def main():
drawing = svgwrite.Drawing(size=('1000', '1400'))
img = svgwrite.image.Image('bullets/NYCS-bull-trans-1.svg',insert=(100, 100), size=(100,100))
drawing.add(img)
sys.stdout.write(drawing.tostring())
if __name__ == '__main__':
main()
| Include the first bullet svg | Include the first bullet svg
| Python | apache-2.0 | nanaze/xmascard | ---
+++
@@ -1,9 +1,17 @@
#!/usr/bin/env python
+import sys
import svgwrite
def main():
- print 'test'
+ drawing = svgwrite.Drawing(size=('1000', '1400'))
+
+ img = svgwrite.image.Image('bullets/NYCS-bull-trans-1.svg',insert=(100, 100), size=(100,100))
+
+ drawing.add(img)
+
+ sys.stdout.write(drawing.... |
d2699a9848652a17967ee5243055e811a7d0909b | lib/node_modules/@stdlib/math/base/special/logit/test/fixtures/python/runner.py | lib/node_modules/@stdlib/math/base/special/logit/test/fixtures/python/runner.py | #!/usr/bin/env python
"""Generate fixtures."""
import os
import json
import numpy as np
from scipy import special
# Get the file path:
FILE = os.path.realpath(__file__)
# Extract the directory in which this file resides:
DIR = os.path.dirname(FILE)
def gen(x, name):
"""Generates fixture data and writes them t... | #!/usr/bin/env python
"""Generate fixtures."""
import os
import json
import numpy as np
from scipy import special
# Get the file path:
FILE = os.path.realpath(__file__)
# Extract the directory in which this file resides:
DIR = os.path.dirname(FILE)
def gen(x, name):
"""Generates fixture data and writes them t... | Fix range of values in example code | Fix range of values in example code
| Python | apache-2.0 | stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib | ---
+++
@@ -25,7 +25,7 @@
# Examples
``` python
- python> x = linspace(-1000, 1000, 2001);
+ python> x = linspace(0.0, 1.0, 2001);
python> gen(x, \"./data.json\");
```
""" |
b29e607d56ab07d07f4e33e2229a728cf0be1585 | usability/python-markdown/pymdpreprocessor.py | usability/python-markdown/pymdpreprocessor.py | """This preprocessor replaces Python code in markdowncell with the result
stored in cell metadata
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2014, Juergen Hasch
#
# Distributed under the terms of the Modified BSD License.
#
#--------------------------------------... | # -*- coding: utf-8 -*-
"""This preprocessor replaces Python code in markdowncell with the result
stored in cell metadata
"""
from nbconvert.preprocessors import *
import re
def get_variable( match, variables):
try:
x = variables[match]
return x
except KeyError:
return ""
class PyMar... | Update preprocessor for 4.x: New imports and make it more robust | Update preprocessor for 4.x: New imports and make it more robust
| Python | bsd-3-clause | jbn/IPython-notebook-extensions,juhasch/IPython-notebook-extensions,ipython-contrib/IPython-notebook-extensions,Konubinix/IPython-notebook-extensions,jcb91/IPython-notebook-extensions,andyneff/IPython-notebook-extensions,jcb91/IPython-notebook-extensions,andyneff/IPython-notebook-extensions,ipython-contrib/IPython-note... | ---
+++
@@ -1,25 +1,27 @@
+# -*- coding: utf-8 -*-
"""This preprocessor replaces Python code in markdowncell with the result
stored in cell metadata
"""
-#-----------------------------------------------------------------------------
-# Copyright (c) 2014, Juergen Hasch
-#
-# Distributed under the terms of the Mo... |
b323d60597038d4a7ac5698f704907ef5bd87489 | Utilities.py | Utilities.py | # Contains a lot of one-offs that aren't easy to deal with.
import logging
import Hand
def reset():
global overload, resources, combo, turn, turnOffset, us, them, numMinions
overload = 0
resources = '0' # Relevant for Wild Growth, which gives a card if at full.
combo = False # Relevant for Rogues, where... | # Contains a lot of one-offs that aren't easy to deal with.
import logging
import Hand
def reset():
global overload, resources, combo, turn, turnOffset, us, them, numMinions
overload = 0
resources = '0' # Relevant for Wild Growth, which gives a card if at full.
combo = False # Relevant for Rogues, where... | Fix for a small bug | Fix for a small bug
| Python | apache-2.0 | jbzdarkid/HearthstonePro | ---
+++
@@ -22,7 +22,7 @@
global turnOffset
if truth:
logging.info("You are going first")
- Hand.hand = [Hand.card('Mulliganned') for _ in range(4)] + [Hand.card(-1, note='The Coin')]
+ Hand.hand = [Hand.card('Mulliganned') for _ in range(4)] + [Hand.card('The Coin')]
turnOff... |
dbe7c01ed649abb1cbd8efe07a6633951cb1943e | tests/integration/states/test_handle_error.py | tests/integration/states/test_handle_error.py | # -*- coding: utf-8 -*-
'''
tests for host state
'''
# Import Python libs
from __future__ import absolute_import
# Import Salt Testing libs
from tests.support.case import ModuleCase
class HandleErrorTest(ModuleCase):
'''
Validate that ordering works correctly
'''
def test_handle_error(self):
... | # -*- coding: utf-8 -*-
'''
tests for host state
'''
# Import Python libs
from __future__ import absolute_import, unicode_literals
# Import Salt Testing libs
from tests.support.case import ModuleCase
class HandleErrorTest(ModuleCase):
'''
Validate that ordering works correctly
'''
def test_function_... | Update integration test: docs, add more checks, rename | Update integration test: docs, add more checks, rename
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -4,7 +4,7 @@
'''
# Import Python libs
-from __future__ import absolute_import
+from __future__ import absolute_import, unicode_literals
# Import Salt Testing libs
from tests.support.case import ModuleCase
@@ -14,14 +14,11 @@
'''
Validate that ordering works correctly
'''
- def tes... |
66165e490e785120b4ae3d96ec3fac3f7af69350 | sale_payment_method_automatic_workflow/__openerp__.py | sale_payment_method_automatic_workflow/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2015 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2015 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | Set the module as auto_install | Set the module as auto_install
So it installs when both sale_payment_method and sale_automatic_workflow are installed.
This module acts as the glue between them
| Python | agpl-3.0 | brain-tec/sale-workflow,akretion/sale-workflow,factorlibre/sale-workflow,open-synergy/sale-workflow,acsone/sale-workflow,thomaspaulb/sale-workflow,diagramsoftware/sale-workflow,Endika/sale-workflow,fevxie/sale-workflow,ddico/sale-workflow,acsone/sale-workflow,jabibi/sale-workflow,akretion/sale-workflow,brain-tec/sale-w... | ---
+++
@@ -30,5 +30,5 @@
'data': [],
'test': [],
'installable': True,
- 'auto_install': False,
+ 'auto_install': True,
} |
14414263ef7578ec0c710e99de0f62c49319c6be | saw-remote-api/python/tests/saw/test_provers.py | saw-remote-api/python/tests/saw/test_provers.py | from cryptol import cryptoltypes
from cryptol.bitvector import BV
import saw
from saw.proofscript import *
import unittest
from pathlib import Path
def cry(exp):
return cryptoltypes.CryptolLiteral(exp)
class ProverTest(unittest.TestCase):
@classmethod
def setUpClass(self):
saw.connect(reset_ser... | from cryptol import cryptoltypes
from cryptol.bitvector import BV
import saw
from saw.proofscript import *
import unittest
from pathlib import Path
def cry(exp):
return cryptoltypes.CryptolLiteral(exp)
class ProverTest(unittest.TestCase):
@classmethod
def setUpClass(self):
saw.connect(reset_ser... | Remove Yices test from RPC prover test | Remove Yices test from RPC prover test
| Python | bsd-3-clause | GaloisInc/saw-script,GaloisInc/saw-script,GaloisInc/saw-script,GaloisInc/saw-script,GaloisInc/saw-script | ---
+++
@@ -27,7 +27,6 @@
simple_thm = cry('\(x:[8]) -> x != x+1')
self.assertTrue(saw.prove(simple_thm, ProofScript([abc])).is_valid())
- self.assertTrue(saw.prove(simple_thm, ProofScript([yices([])])).is_valid())
self.assertTrue(saw.prove(simple_thm, ProofScript([z3([])])).is_val... |
61b9a0e69b2db362e526bd3312e0e47609a42fad | scenarios/UAC/bob_cfg.py | scenarios/UAC/bob_cfg.py | from lib.test_config import AUTH_CREDS as AUTH_CREDS_orig
allargs = (('SHA-512-256', 'SHA-256', 'MD5', 'MD5-sess'), \
('SHA-512-256', 'SHA-256', 'SHA-256-sess', 'MD5'), \
('SHA-512-256', 'SHA-512-256-sess', 'SHA-256', 'MD5')) \
class AUTH_CREDS(AUTH_CREDS_orig):
enalgs = None
realm = 'VoIPTests.NET'
... | from random import shuffle
from lib.test_config import AUTH_CREDS as AUTH_CREDS_orig
allalgs = (('SHA-512-256', 'SHA-256', 'MD5', 'MD5-sess'), \
('SHA-512-256', 'SHA-256', 'SHA-256-sess', 'MD5'), \
('SHA-512-256', 'SHA-512-256-sess', 'SHA-256', 'MD5')) \
class AUTH_CREDS(AUTH_CREDS_orig):
enalgs = None
re... | Fix typo: allargs -> allalgs. Add missing import of shuffle(). | Fix typo: allargs -> allalgs. Add missing import of shuffle().
| Python | bsd-2-clause | sippy/voiptests,sippy/voiptests | ---
+++
@@ -1,6 +1,7 @@
+from random import shuffle
from lib.test_config import AUTH_CREDS as AUTH_CREDS_orig
-allargs = (('SHA-512-256', 'SHA-256', 'MD5', 'MD5-sess'), \
+allalgs = (('SHA-512-256', 'SHA-256', 'MD5', 'MD5-sess'), \
('SHA-512-256', 'SHA-256', 'SHA-256-sess', 'MD5'), \
('SHA-512-256', 'SHA-512... |
56471d264671b652b4b40619f709dc6b8e02eac1 | dragonflow/db/models/host_route.py | dragonflow/db/models/host_route.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
# d... | # 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
# d... | Change HostRoute to a plain model | Change HostRoute to a plain model
Since HostRoute doesn't have id, store it as a plain db model.
Change-Id: I3dbb9e5ffa42bf48f47b7010ee6baf470b55e85e
Partially-Implements: bp refactor-nb-api
| Python | apache-2.0 | openstack/dragonflow,openstack/dragonflow,openstack/dragonflow | ---
+++
@@ -10,12 +10,11 @@
# License for the specific language governing permissions and limitations
# under the License.
+from jsonmodels import models
+
import dragonflow.db.field_types as df_fields
-import dragonflow.db.model_framework as mf
-@mf.construct_nb_db_model
-class HostRoute(mf.ModelBase)... |
2e1f4ffa667bcff2c10caf64be345f3e8619232f | python/simple_types.py | python/simple_types.py | # Many built-in types have built-in names
assert(type(5) == int)
assert(type(True) == bool)
assert(type(5.7) == float)
assert(type(9 + 5j) == complex)
assert(type((8, 'dog', False)) == tuple)
assert(type('hello') == str)
assert(type(b'hello') == bytes)
assert(type([1, '', False]) == list)
assert(type(range(1,10)) == ra... | # Many built-in types have built-in names
assert(type(5) == int)
assert(type(True) == bool)
assert(type(5.7) == float)
assert(type(9 + 5j) == complex)
assert(type((8, 'dog', False)) == tuple)
assert(type('hello') == str)
assert(type(b'hello') == bytes)
assert(type([1, '', False]) == list)
assert(type(range(1,10)) == ra... | Add example of date type in Python | Add example of date type in Python
| Python | mit | rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/polyglot,rtoal/polyglot,rtoal/polyglot,rtoal/polyglot,rtoal/polyglot,rtoal/polyglot,rtoal/polyglot,rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal... | ---
+++
@@ -26,3 +26,7 @@
# Even modules are types!
import math
assert(str(type(math)) == "<class 'module'>")
+
+# Many built-in modules define their own types
+from datetime import date
+assert(type(date(1969,7,20)) == date) |
517a65e5fba0ec302a05ad550f473bd72a719398 | test/test_recipes.py | test/test_recipes.py | from __future__ import print_function, absolute_import
import json
import os
import sys
from imp import reload
from io import StringIO
import pytest
import yaml
from adr import query
from adr.main import run_recipe
class new_run_query(object):
def __init__(self, test):
self.test = test
def __call_... | from __future__ import print_function, absolute_import
import json
import os
import sys
from imp import reload
from io import BytesIO, StringIO
import pytest
import yaml
from adr import query
from adr.main import run_recipe
class new_run_query(object):
def __init__(self, test):
self.test = test
de... | Fix python 2 error when dumping expected test results | Fix python 2 error when dumping expected test results
| Python | mpl-2.0 | ahal/active-data-recipes,ahal/active-data-recipes | ---
+++
@@ -4,7 +4,7 @@
import os
import sys
from imp import reload
-from io import StringIO
+from io import BytesIO, StringIO
import pytest
import yaml
@@ -36,7 +36,10 @@
result = json.loads(run_recipe(recipe_test['recipe'], recipe_test['args'], fmt='json'))
- buf = StringIO()
+ if sys.version_... |
5d21ad5ae63addac0892242fe774250a2934fc87 | awx/lib/metrics.py | awx/lib/metrics.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import logging
from functools import wraps
from django_statsd.clients import statsd
logger = logging.getLogger(__name__)
def task_timer(fn):
@wraps(fn)
def __wrapped__(self, *args, **kwargs):
statsd.incr('tasks.{}.{}.count'.format(
... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import logging
from functools import wraps
from django_statsd.clients import statsd
logger = logging.getLogger(__name__)
def task_timer(fn):
@wraps(fn)
def __wrapped__(self, *args, **kwargs):
statsd.incr('tasks.{0}.{1}.count'.format(
... | Fix up statsd work to support python 2.6 | Fix up statsd work to support python 2.6
Format specifiers must include field specifier
| Python | apache-2.0 | snahelou/awx,wwitzel3/awx,wwitzel3/awx,wwitzel3/awx,snahelou/awx,snahelou/awx,snahelou/awx,wwitzel3/awx | ---
+++
@@ -11,10 +11,10 @@
def task_timer(fn):
@wraps(fn)
def __wrapped__(self, *args, **kwargs):
- statsd.incr('tasks.{}.{}.count'.format(
+ statsd.incr('tasks.{0}.{1}.count'.format(
self.name.rsplit('.', 1)[-1],
fn.__name__))
- with statsd.timer('tasks.{}.{... |
50c877733f052ce7235ee193d5c8ba88a266df60 | app/sense.py | app/sense.py | import threading
import time
class SensorThread(object):
def __init__(self, notify, delay=0):
self.notify = notify
self.delay = delay
self.interval = 1
self.distance = -1
def start(self, robot):
self.robot = robot
thread = threading.Thread(target=self.run, args... | import threading
import time
class SensorThread(object):
def __init__(self, notify, delay=0):
self.notify = notify
self.delay = delay
self.interval = 1
self.distance = -1
def start(self, robot):
self.robot = robot
thread = threading.Thread(target=self.run, args... | Use integer distances to avoid so many events. | Use integer distances to avoid so many events.
| Python | bsd-2-clause | legorovers/legoflask,legorovers/legoflask,legorovers/legoflask | ---
+++
@@ -17,7 +17,7 @@
def run(self):
while True:
- distance = self.robot.distance()
+ distance = int(self.robot.distance())
if not self.distance == distance:
self.notify.emit('sense', distance)
self.distance = distance |
432323eaf442db41d6486841168c159732d8dfe0 | bhgcal/__init__.py | bhgcal/__init__.py | from __future__ import unicode_literals
import os
from datetime import datetime
from dateutil.relativedelta import relativedelta
import requests
login_url = 'http://bukkesprangetnatur.barnehage.no/LogOn'
ics_url = ('http://bukkesprangetnatur.barnehage.no/Ukeplan/'
'PlanMonthAsICalendar/61?year={year}&mont... | from __future__ import unicode_literals
from datetime import datetime
import os
import sys
from dateutil.relativedelta import relativedelta
import requests
bases = {'r\xf8sslyngen': 59,
'myrulla': 61}
login_url = 'http://bukkesprangetnatur.barnehage.no/LogOn'
ics_url = ('http://bukkesprangetnatur.barnehage... | Support iterating over the different bases | Support iterating over the different bases
And fix the encoding issue that suddenly became obvious.
| Python | mit | asmundg/bhgcal | ---
+++
@@ -1,30 +1,56 @@
from __future__ import unicode_literals
+from datetime import datetime
import os
-from datetime import datetime
+import sys
from dateutil.relativedelta import relativedelta
import requests
+bases = {'r\xf8sslyngen': 59,
+ 'myrulla': 61}
+
login_url = 'http://bukkesprangetn... |
eb1568e9baf3d60a8d1e3ea59c49d54dc7b34437 | tests/test_pgbackup.py | tests/test_pgbackup.py | # coding: utf-8
"""
Unit tests for essential functions in postgresql backup.
"""
from unittest.mock import MagicMock, mock_open, patch
import pytest
import smdba.postgresqlgate
class TestPgBackup:
"""
Test suite for postgresql backup.
"""
@patch("smdba.postgresqlgate.os.path.exists", MagicMock(return_... | # coding: utf-8
"""
Unit tests for essential functions in postgresql backup.
"""
from unittest.mock import MagicMock, mock_open, patch
import pytest
import smdba.postgresqlgate
class TestPgBackup:
"""
Test suite for postgresql backup.
"""
@patch("smdba.postgresqlgate.os.path.exists", MagicMock(return_... | Add test for constructor of pgbackup for pg_data is set correctly. | Add test for constructor of pgbackup for pg_data is set correctly.
| Python | mit | SUSE/smdba,SUSE/smdba | ---
+++
@@ -12,9 +12,9 @@
Test suite for postgresql backup.
"""
@patch("smdba.postgresqlgate.os.path.exists", MagicMock(return_value=False))
- def test_init_pkbackup_checks_archivecleaup(self):
+ def test_init_pgbackup_checks_archivecleaup(self):
"""
- Test constructor of pkgbacku... |
643c60364266c9015b919a39ff8f0807e6138efc | fileupload/views.py | fileupload/views.py | from fileupload.models import Picture
from django.views.generic import CreateView, DeleteView
from django.http import HttpResponse
from django.utils import simplejson
from django.core.urlresolvers import reverse
from django.conf import settings
class PictureCreateView(CreateView):
model = Picture
def form_v... | from fileupload.models import Picture
from django.views.generic import CreateView, DeleteView
from django.http import HttpResponse
from django.utils import simplejson
from django.core.urlresolvers import reverse
from django.conf import settings
class PictureCreateView(CreateView):
model = Picture
def form_v... | Add comment about browsers not liking application/json. | Add comment about browsers not liking application/json.
| Python | mit | Imaginashion/cloud-vision,extremoburo/django-jquery-file-upload,minhlongdo/django-jquery-file-upload,extremoburo/django-jquery-file-upload,Imaginashion/cloud-vision,Imaginashion/cloud-vision,extremoburo/django-jquery-file-upload,vaniakov/django-jquery-file-upload,vaniakov/django-jquery-file-upload,madteckhead/django-jq... | ---
+++
@@ -25,7 +25,7 @@
return JSONResponse(True)
class JSONResponse(HttpResponse):
- """ JSON response class """
+ """JSON response class. This does not help browsers not liking application/json."""
def __init__(self,obj='',json_opts={},mimetype="application/json",*args,**kwargs):
c... |
371f67f290d19021b488057780292ae1009bca9b | fresque/__init__.py | fresque/__init__.py | from __future__ import absolute_import, unicode_literals, print_function
import os
from flask import Flask
from flask.ext.migrate import Migrate, MigrateCommand
from flask.ext.script import Manager
from flask.ext.sqlalchemy import SQLAlchemy
from pkg_resources import resource_filename
app = Flask(__name__)
app.conf... | # -*- coding: utf-8 -*-
'''
Top level of the fresque application.
'''
from __future__ import absolute_import, unicode_literals, print_function
import logging
import logging.handlers
import os
import sys
import urlparse
import flask
from flask.ext.fas_openid import FAS
APP = flask.Flask(__name__)
APP.config.from_ob... | Rework a little bit the top level module of the application | Rework a little bit the top level module of the application
Start working on the logging
Add couple of utility functions (as is_authenticated)
Fix case of the APP variable, to be pep8
Make the application working behind a reverse proxy
Make the application use the FAS plugin for authentication
| Python | agpl-3.0 | whitel/fresque,rahulrrixe/fresque,vivekanand1101/fresque,rahulrrixe/fresque,vivekanand1101/fresque,whitel/fresque,rahulrrixe/fresque,whitel/fresque,fedora-infra/fresque,fedora-infra/fresque,fedora-infra/fresque,fedora-infra/fresque,vivekanand1101/fresque,rahulrrixe/fresque,vivekanand1101/fresque,whitel/fresque | ---
+++
@@ -1,31 +1,62 @@
+# -*- coding: utf-8 -*-
+
+'''
+Top level of the fresque application.
+'''
+
from __future__ import absolute_import, unicode_literals, print_function
+import logging
+import logging.handlers
import os
+import sys
+import urlparse
-from flask import Flask
-from flask.ext.migrate import... |
6672a0634265e09366a9274d3c2a04afca49cf02 | dirtree_filter.py | dirtree_filter.py | class DirTreeFilter(object):
def __init__(self, show_hidden=False, show_files=True, show_dirs=True):
self.show_hidden = show_hidden
self.show_files = show_files
self.show_dirs = show_dirs
self.hidden_exts = [".pyc", ".pyo", ".o", ".a", ".obj", ".lib", ".swp", "~"]
self.hidden... | import re
def compile_file_patterns(patterns):
return re.compile("$%s^" % "|".join("(%s)" % re.escape(p).replace("\\*", ".*") for p in patterns))
hidden_files = [".*", "*~", "*.swp", "*.pyc", "*.pyo", "*.o", "*.a", "*.obj", "*.lib", "*.class"]
hidden_dirs = ["CVS", "__pycache__"]
class DirTreeFilter(object):
... | Use file patterns compiled to regular expressions to match hidden files. | Use file patterns compiled to regular expressions to match hidden files.
| Python | mit | shaurz/devo | ---
+++
@@ -1,24 +1,31 @@
+import re
+
+def compile_file_patterns(patterns):
+ return re.compile("$%s^" % "|".join("(%s)" % re.escape(p).replace("\\*", ".*") for p in patterns))
+
+hidden_files = [".*", "*~", "*.swp", "*.pyc", "*.pyo", "*.o", "*.a", "*.obj", "*.lib", "*.class"]
+hidden_dirs = ["CVS", "__pycache__"... |
5b215758adab39923399db98b5975fc76d389472 | __init__.py | __init__.py | # -*- coding: utf-8 -*-
import configparser
import optparse
from blo import Blo
if __name__ == '__main__':
parser = optparse.OptionParser("usage: %prog [option] markdown_file.md")
parser.add_option("-c", "--config", dest="config_file",
default="./blo.cfg", type="string", help="specify con... | # -*- coding: utf-8 -*-
import optparse
from blo import Blo
if __name__ == '__main__':
parser = optparse.OptionParser("usage: %prog [options] markdown_file.md")
parser.add_option("-c", "--config", dest="config_file",
default="./blo.cfg", type="string", help="specify configuration file pat... | Implement main section of blo package. | Implement main section of blo package.
| Python | mit | 10nin/blo,10nin/blo | ---
+++
@@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
-import configparser
import optparse
from blo import Blo
if __name__ == '__main__':
- parser = optparse.OptionParser("usage: %prog [option] markdown_file.md")
+ parser = optparse.OptionParser("usage: %prog [options] markdown_file.md")
parser.add_option... |
cf61b61b6908940c465bec2bfc4575ec0f657c72 | apps/externalsites/urls.py | apps/externalsites/urls.py | # Amara, universalsubtitles.org
#
# Copyright (C) 2013 Participatory Culture Foundation
#
# This program 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
# License, or (at your op... | # Amara, universalsubtitles.org
#
# Copyright (C) 2013 Participatory Culture Foundation
#
# This program 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
# License, or (at your op... | Allow "-" chars in the resync view | Allow "-" chars in the resync view
| Python | agpl-3.0 | wevoice/wesub,ReachingOut/unisubs,norayr/unisubs,ujdhesa/unisubs,pculture/unisubs,pculture/unisubs,pculture/unisubs,wevoice/wesub,ReachingOut/unisubs,ujdhesa/unisubs,ReachingOut/unisubs,norayr/unisubs,ReachingOut/unisubs,eloquence/unisubs,ofer43211/unisubs,ujdhesa/unisubs,pculture/unisubs,ofer43211/unisubs,ofer43211/un... | ---
+++
@@ -19,5 +19,5 @@
from django.conf.urls import patterns, url
urlpatterns = patterns('externalsites.views',
- url(r'^resync/(?P<video_url_id>\d+)/(?P<language_code>\w+)/$', 'resync', name='resync'),
+ url(r'^resync/(?P<video_url_id>\d+)/(?P<language_code>[\w-]+)/$', 'resync', name='resync'),
) |
c3bb6f173478419662aa96b2378fa459c0a4ed6a | pystruct/datasets/dataset_loaders.py | pystruct/datasets/dataset_loaders.py | import cPickle
from os.path import dirname
from os.path import join
import numpy as np
def load_letters():
"""Load the OCR letters dataset.
This is a chain classification task.
Each example consists of a word, segmented into letters.
The first letter of each word is ommited from the data,
as it ... | import cPickle
from os.path import dirname
from os.path import join
import numpy as np
def load_letters():
"""Load the OCR letters dataset.
This is a chain classification task.
Each example consists of a word, segmented into letters.
The first letter of each word is ommited from the data,
as it ... | FIX sample data load for Windows | FIX sample data load for Windows
| Python | bsd-2-clause | massmutual/pystruct,massmutual/pystruct,amueller/pystruct,wattlebird/pystruct,pystruct/pystruct,d-mittal/pystruct,pystruct/pystruct,amueller/pystruct,wattlebird/pystruct,d-mittal/pystruct | ---
+++
@@ -14,7 +14,7 @@
as it was a capital letter (in contrast to all other letters).
"""
module_path = dirname(__file__)
- data_file = open(join(module_path, 'letters.pickle'))
+ data_file = open(join(module_path, 'letters.pickle'),'rb')
data = cPickle.load(data_file)
# we add an ea... |
357fc83908fe09da2c69be78afdae9f1cf5c4b0d | hjlog/forms/post.py | hjlog/forms/post.py | from flask_wtf import Form
from wtforms import TextAreaField, StringField, SelectField, BooleanField
from wtforms.validators import InputRequired, Optional, Length
class PostForm(Form):
title = StringField('제목', validators=[InputRequired(), Length(max=120)])
body = TextAreaField('내용', validators=[InputRequired... | from flask_wtf import Form
from wtforms import TextAreaField, StringField, SelectField, BooleanField
from wtforms.validators import InputRequired, Optional, Length
class PostForm(Form):
title = StringField('제목', validators=[InputRequired(), Length(max=120)])
body = TextAreaField('내용', validators=[InputRequired... | Change label text of 'private' Field | Change label text of 'private' Field
| Python | mit | heejongahn/hjlog,heejongahn/hjlog,heejongahn/hjlog,heejongahn/hjlog | ---
+++
@@ -5,7 +5,7 @@
class PostForm(Form):
title = StringField('제목', validators=[InputRequired(), Length(max=120)])
body = TextAreaField('내용', validators=[InputRequired()])
- private = BooleanField('이 글을 비공개로 작성합니다', default=True)
+ private = BooleanField('비공개 설정', default=True)
tags = String... |
b3839c72a831589dd707b38ae2088fd4b304faa1 | django_filters/rest_framework/filterset.py | django_filters/rest_framework/filterset.py |
from __future__ import absolute_import
from copy import deepcopy
from django.db import models
from django import forms
from django.utils.translation import ugettext_lazy as _
from django_filters import filterset
from .filters import BooleanFilter, IsoDateTimeFilter
from .. import compat, utils
FILTER_FOR_DBFIELD_D... |
from __future__ import absolute_import
from copy import deepcopy
from django.db import models
from django import forms
from django.utils.translation import ugettext_lazy as _
from django_filters import filterset
from .filters import BooleanFilter, IsoDateTimeFilter
from .. import compat, utils
FILTER_FOR_DBFIELD_D... | Move crispy helper to '.form' property | Move crispy helper to '.form' property
| Python | bsd-3-clause | alex/django-filter,alex/django-filter | ---
+++
@@ -21,14 +21,15 @@
class FilterSet(filterset.FilterSet):
FILTER_DEFAULTS = FILTER_FOR_DBFIELD_DEFAULTS
- def __init__(self, *args, **kwargs):
- super(FilterSet, self).__init__(*args, **kwargs)
+ @property
+ def form(self):
+ form = super(FilterSet, self).form
if comp... |
550106fbff26c16cdf2269dc0778814c05ed1e3b | nap/apps.py | nap/apps.py |
from django.apps import AppConfig
from django.utils.module_loading import autodiscover_modules
class NapConfig(AppConfig):
'''App Config that performs auto-discover on ready.'''
def ready(self):
super(NapConfig, self).ready()
autodiscover_modules('publishers')
|
from django.apps import AppConfig
from django.utils.module_loading import autodiscover_modules
class NapConfig(AppConfig):
'''App Config that performs auto-discover on ready.'''
name = 'nap'
def ready(self):
super(NapConfig, self).ready()
autodiscover_modules('publishers')
| Fix to include mandatory name attribute | Fix to include mandatory name attribute | Python | bsd-3-clause | MarkusH/django-nap,limbera/django-nap | ---
+++
@@ -6,6 +6,8 @@
class NapConfig(AppConfig):
'''App Config that performs auto-discover on ready.'''
+
+ name = 'nap'
def ready(self):
super(NapConfig, self).ready() |
14398ec42c0d31d577278d8748b0617650f91775 | porick/controllers/create.py | porick/controllers/create.py | import logging
from pylons import request, response, session, tmpl_context as c, url
from pylons.controllers.util import abort, redirect
import porick.lib.helpers as h
from porick.lib.auth import authorize
from porick.lib.base import BaseController, render
from porick.lib.create import create_quote, create_user
log... | import logging
from pylons import request, response, session, tmpl_context as c, url
from pylons.controllers.util import abort, redirect
import porick.lib.helpers as h
from porick.lib.auth import authorize
from porick.lib.base import BaseController, render
from porick.lib.create import create_quote, create_user
log... | Deal with comma-separated tags lists HNGH | Deal with comma-separated tags lists HNGH
| Python | apache-2.0 | kopf/porick,kopf/porick,kopf/porick | ---
+++
@@ -23,7 +23,8 @@
if not quote_body:
abort(400)
notes = request.params.get('notes', '')
- tags = request.params.get('tags', '').split(' ')
+ tags = filter(None, request.params.get('tags', '').replace(',', ' ').split(' '))
+
... |
99bd91cac200f9e83ee710ac8758fd20ac1febfa | examples/find_facial_features_in_picture.py | examples/find_facial_features_in_picture.py | from PIL import Image, ImageDraw
import face_recognition
# Load the jpg file into a numpy array
image = face_recognition.load_image_file("biden.jpg")
# Find all facial features in all the faces in the image
face_landmarks_list = face_recognition.face_landmarks(image)
print("I found {} face(s) in this photograph.".fo... | from PIL import Image, ImageDraw
import face_recognition
# Load the jpg file into a numpy array
image = face_recognition.load_image_file("two_people.jpg")
# Find all facial features in all the faces in the image
face_landmarks_list = face_recognition.face_landmarks(image)
print("I found {} face(s) in this photograph... | Tweak demo to show multiple faces in one window instead of separate windows | Tweak demo to show multiple faces in one window instead of separate windows
| Python | mit | ageitgey/face_recognition | ---
+++
@@ -2,12 +2,16 @@
import face_recognition
# Load the jpg file into a numpy array
-image = face_recognition.load_image_file("biden.jpg")
+image = face_recognition.load_image_file("two_people.jpg")
# Find all facial features in all the faces in the image
face_landmarks_list = face_recognition.face_landm... |
5b2e154fe28a32eb128c9c1060c1954eb1664c3f | child_sync_typo3/wizard/child_depart_wizard.py | child_sync_typo3/wizard/child_depart_wizard.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __open... | # -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __open... | Correct wrong inheritance on sponsorship_typo3 child_depart wizard. | Correct wrong inheritance on sponsorship_typo3 child_depart wizard.
| Python | agpl-3.0 | eicher31/compassion-switzerland,ecino/compassion-switzerland,Secheron/compassion-switzerland,ecino/compassion-switzerland,eicher31/compassion-switzerland,ndtran/compassion-switzerland,CompassionCH/compassion-switzerland,CompassionCH/compassion-switzerland,Secheron/compassion-switzerland,eicher31/compassion-switzerland,... | ---
+++
@@ -12,8 +12,8 @@
from ..model.sync_typo3 import Sync_typo3
-class end_sponsorship_wizard(orm.TransientModel):
- _inherit = 'end.sponsorship.wizard'
+class child_depart_wizard(orm.TransientModel):
+ _inherit = 'child.depart.wizard'
def child_depart(self, cr, uid, ids, context=None):
... |
5293a24bc2ab6a3aa1c9fc98d857c79548509356 | explanatory_style.py | explanatory_style.py | import gate
class EventAttributionUnit:
"""event, attribution must be gate.Annotation objects
"""
def __init__(self, event, attribution):
self._event = event
self._attribution = attribution
for annotation in [self._event, self._attribution]:
# if type(anntotation) != "A... | import gate
class EventAttributionUnit:
def __init__(self, event, attribution):
"""event, attribution must be gate.Annotation objects
"""
self._event = event
self._attribution = attribution
for annotation in [self._event, self._attribution]:
if not isinstance(an... | Add __main__ program for running on files | Add __main__ program for running on files
| Python | mit | nickwbarber/HILT-annotations | ---
+++
@@ -2,13 +2,12 @@
class EventAttributionUnit:
- """event, attribution must be gate.Annotation objects
- """
def __init__(self, event, attribution):
+ """event, attribution must be gate.Annotation objects
+ """
self._event = event
self._attribution = attribution
... |
b1196e347129e79bd616cc572714982be6739d3c | indra/pipeline/decorators.py | indra/pipeline/decorators.py | pipeline_functions = {}
def register_pipeline(function):
if function.__name__ in pipeline_functions:
raise ExistingFunctionError(
'%s is already registered with %s.%s' % (
function.__name__, function.__module__, function.__name__))
pipeline_functions[function.__name__] = fu... | pipeline_functions = {}
def register_pipeline(function):
"""Decorator to register a function for the assembly pipeline."""
if function.__name__ in pipeline_functions:
raise ExistingFunctionError(
'%s is already registered with %s.%s' % (
function.__name__, function.__module... | Add minimal docstring for decorator | Add minimal docstring for decorator
| Python | bsd-2-clause | johnbachman/belpy,johnbachman/belpy,johnbachman/indra,sorgerlab/indra,johnbachman/belpy,sorgerlab/belpy,sorgerlab/indra,johnbachman/indra,sorgerlab/belpy,bgyori/indra,sorgerlab/indra,bgyori/indra,sorgerlab/belpy,bgyori/indra,johnbachman/indra | ---
+++
@@ -2,6 +2,7 @@
def register_pipeline(function):
+ """Decorator to register a function for the assembly pipeline."""
if function.__name__ in pipeline_functions:
raise ExistingFunctionError(
'%s is already registered with %s.%s' % ( |
b69bf4dd6e9c1d8b9133c2a8f2b18ac8d41f3145 | src/streaming-programs/car-average-speeds.py | src/streaming-programs/car-average-speeds.py | #!/usr/bin/python
import sys
import json
# Count average speeds for links
def main(locationdata_dictionary_file):
locationdata = {}
with open(locationdata_dictionary_file, "r") as dictionary_file:
locationdata = json.load(dictionary_file)
for input_line in sys.stdin:
data = json.loads(in... | #!/usr/bin/python
import sys
import json
# Count average speeds for links
def main(locationdata_dictionary_file):
locationdata = {}
with open(locationdata_dictionary_file, "r") as dictionary_file:
locationdata = json.load(dictionary_file)
for input_line in sys.stdin:
data = json.loads(in... | Use default dictionary when no arg passed | Use default dictionary when no arg passed
| Python | mit | gofore/aws-emr,gofore/aws-emr,gofore/aws-emr,gofore/aws-emr | ---
+++
@@ -23,4 +23,8 @@
pass
if __name__ == "__main__":
- main(sys.argv[1])
+
+ if len(sys.argv) > 1:
+ main(sys.argv[1])
+ else:
+ main("locationdata.json") |
6ee4cd2ace969365a4898e3f89944e8ddbdca1c8 | wolme/wallet/models.py | wolme/wallet/models.py | from __future__ import unicode_literals
from django.conf import settings
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext as _
@python_2_unicode_compatible
class Tag(models.Model):
slug = models.SlugField(unique=True)
des... | from __future__ import unicode_literals
from django.conf import settings
from django.db import models
from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext as _
@python_2_unicode_compatible
class Tag(models.Model):
slug = mod... | Add default to movement date | Add default to movement date
| Python | bsd-2-clause | synasius/wolme | ---
+++
@@ -2,6 +2,7 @@
from django.conf import settings
from django.db import models
+from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext as _
@@ -32,7 +33,7 @@
@python_2_unicode_compatible
class Movement(models.Model... |
cbc60512f0f29ba3444573b6fd835e1505e5e35c | radar/radar/validation/fetal_anomaly_scans.py | radar/radar/validation/fetal_anomaly_scans.py | from radar.validation.data_sources import DataSourceValidationMixin
from radar.validation.core import Field, Validation
from radar.validation.meta import MetaValidationMixin
from radar.validation.patients import PatientValidationMixin
from radar.validation.validators import required, optional, min_, max_, none_if_blank... | from radar.validation.data_sources import DataSourceValidationMixin
from radar.validation.core import Field, Validation
from radar.validation.meta import MetaValidationMixin
from radar.validation.patients import PatientValidationMixin
from radar.validation.validators import required, optional, min_, max_, none_if_blank... | Check date of scan is not in future | Check date of scan is not in future
| Python | agpl-3.0 | renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar | ---
+++
@@ -2,11 +2,11 @@
from radar.validation.core import Field, Validation
from radar.validation.meta import MetaValidationMixin
from radar.validation.patients import PatientValidationMixin
-from radar.validation.validators import required, optional, min_, max_, none_if_blank, max_length
+from radar.validation.... |
6ef190887b38df4f5212a8a7017e002051734c9f | lokar/bib.py | lokar/bib.py | # coding=utf-8
from __future__ import unicode_literals
from .marc import Record
from .util import etree, parse_xml, show_diff
class Bib(object):
""" An Alma Bib record """
def __init__(self, alma, xml):
self.alma = alma
self.orig_xml = xml.encode('utf-8')
self.init(xml)
def in... | # coding=utf-8
from __future__ import unicode_literals
from io import BytesIO
from .marc import Record
from .util import etree, parse_xml, show_diff
class Bib(object):
""" An Alma Bib record """
def __init__(self, alma, xml):
self.alma = alma
self.orig_xml = xml.encode('utf-8')
sel... | Add xml header and post data as stream-like object just to be sure | Add xml header and post data as stream-like object just to be sure
| Python | agpl-3.0 | scriptotek/almar,scriptotek/lokar | ---
+++
@@ -2,6 +2,7 @@
from __future__ import unicode_literals
+from io import BytesIO
from .marc import Record
from .util import etree, parse_xml, show_diff
@@ -24,13 +25,14 @@
def save(self, diff=False):
# Save record back to Alma
- post_data = etree.tostring(self.doc, encoding='UTF... |
e9f2a3c29185466f1c92121e9f4e4b727fb20fd0 | scripts/rename_tutorial_src_files.py | scripts/rename_tutorial_src_files.py | #%%
from pathlib import Path, PurePath
from string import digits
directory = Path("./docs/tutorial/src")
dirs = sorted([Path(f) for f in directory.iterdir()])
d: PurePath
sufix = "__out__"
for d in dirs:
if d.name.endswith(sufix):
continue
output_dir_name = d.name + "__out__"
output_directory = dir... | #%%
from pathlib import Path, PurePath
from string import digits
directory = Path("./docs/tutorial/src")
skip_names = {"bigger_applications"}
skip_dirs = {directory / name for name in skip_names}
dirs = sorted([Path(f) for f in directory.iterdir() if f not in skip_dirs])
d: PurePath
sufix = "__out__"
for d in dirs:
... | Update tutorial renamer to exclude files | :sparkles: Update tutorial renamer to exclude files
| Python | mit | tiangolo/fastapi,tiangolo/fastapi,tiangolo/fastapi | ---
+++
@@ -3,7 +3,9 @@
from string import digits
directory = Path("./docs/tutorial/src")
-dirs = sorted([Path(f) for f in directory.iterdir()])
+skip_names = {"bigger_applications"}
+skip_dirs = {directory / name for name in skip_names}
+dirs = sorted([Path(f) for f in directory.iterdir() if f not in skip_dirs])... |
1f745b3dbfbeb5c328d8ef69de0da0ff3618eb35 | purchase_order_line_invoicing/tests/__init__.py | purchase_order_line_invoicing/tests/__init__.py | # -*- coding: utf-8 -*-
from . import test_purchase_order_line_invoice_wizard
| # -*- coding: utf-8 -*-
from . import test_purchase_order_line_invoicing_wizard
| Fix wrong import after module renaming | Fix wrong import after module renaming
| Python | agpl-3.0 | OCA/purchase-workflow,OCA/purchase-workflow | ---
+++
@@ -1,2 +1,2 @@
# -*- coding: utf-8 -*-
-from . import test_purchase_order_line_invoice_wizard
+from . import test_purchase_order_line_invoicing_wizard |
0998953838a36cec14ab356d13e84732fb02167a | examples/tf/demo.py | examples/tf/demo.py | # python3
# Copyright 2020 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 applicab... | # python3
# Copyright 2020 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 applicab... | Add online prediction example for TF | Add online prediction example for TF
Change-Id: I508aaca04576b3bda500fae3350351ef7b251747
| Python | apache-2.0 | GoogleCloudPlatform/ml-pipeline-generator-python,GoogleCloudPlatform/ml-pipeline-generator-python | ---
+++
@@ -18,10 +18,27 @@
def main():
config = "examples/tf/config.yaml"
+ pred_input = [{"age": 25,
+ "workclass": " Private",
+ "education": " 11th",
+ "education_num": 7,
+ "marital_status":" Never-married",
+ "occupa... |
4563ad431102bd578582dfd6af41fe68ac7c6c26 | examples/basic.py | examples/basic.py | import time
from simpleflow import (
activity,
Workflow,
futures,
)
@activity.with_attributes(task_list='quickstart', version='example')
def increment(x):
return x + 1
@activity.with_attributes(task_list='quickstart', version='example')
def double(x):
return x * 2
# A simpleflow activity can b... | import time
from simpleflow import (
activity,
Workflow,
futures,
)
@activity.with_attributes(task_list='quickstart', version='example')
def increment(x):
return x + 1
@activity.with_attributes(task_list='quickstart', version='example')
def double(x):
return x * 2
@activity.with_attributes(ta... | Revert "Update example workflow to show you can use classes" | Revert "Update example workflow to show you can use classes"
This reverts commit dbce79102efa8fee233af95939f1ff0b9d060b00.
| Python | mit | botify-labs/simpleflow,botify-labs/simpleflow | ---
+++
@@ -16,13 +16,11 @@
def double(x):
return x * 2
-# A simpleflow activity can be any callable, so a function works, but a class
-# will also work given the processing happens in __init__()
+
@activity.with_attributes(task_list='quickstart', version='example')
-class Delay(object):
- def __init__(se... |
bd0a572faf851ee01177c44fc2fe64770ab4f38a | app/main/views/index.py | app/main/views/index.py | import markdown
import os
from flask import render_template, url_for, redirect, Markup
from app.main import main
from flask_login import login_required
from flask.ext.login import current_user
from mdx_gfm import GithubFlavoredMarkdownExtension
@main.route('/')
def index():
if current_user and current_user.is_au... | import markdown
import os
from flask import render_template, url_for, redirect, Markup
from app.main import main
from flask_login import login_required
from flask.ext.login import current_user
from mdx_gfm import GithubFlavoredMarkdownExtension
@main.route('/')
def index():
if current_user and current_user.is_au... | Add encoding to the documentation file. | Add encoding to the documentation file.
| Python | mit | alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin | ---
+++
@@ -44,7 +44,7 @@
@main.route('/documentation')
def documentation():
curr_dir = os.path.dirname(os.path.realpath(__file__))
- with open(os.path.join(curr_dir, '../../../docs/index.md')) as source:
+ with open(os.path.join(curr_dir, '../../../docs/index.md'), encoding='utf-8') as source:
... |
b235ae762adb76fe9835d98f7e2a4fc3d92db251 | src/util/sortLargeFIs.py | src/util/sortLargeFIs.py | import os, sys
from operator import itemgetter
def errorExit(msg):
sys.stderr.write(msg)
sys.exit(1)
def main():
# Verify arguments
if len(sys.argv) != 2:
errorExit("Usage: {} FILE\n".format(os.path.basename(sys.argv[0])))
fileName = sys.argv[1]
if not os.path.isfile(fileName):
... | import os, sys
from operator import itemgetter
def errorExit(msg):
sys.stderr.write(msg)
sys.exit(1)
def main():
# Verify arguments
if len(sys.argv) != 2:
errorExit("Usage: {} FILE\n".format(os.path.basename(sys.argv[0])))
fileName = sys.argv[1]
if not os.path.isfile(fileName):
... | Modify to handle ARtool output | Modify to handle ARtool output
| Python | apache-2.0 | jdebrabant/parallel_arules,jdebrabant/parallel_arules,jdebrabant/parallel_arules,jdebrabant/parallel_arules | ---
+++
@@ -16,9 +16,10 @@
results = []
with open(fileName) as FILE:
for line in FILE:
- tokens = line.split("\t")
- frequency = float(tokens[1])
- results.append((line, frequency))
+ tokens = line.split("}")
+ itemset = tokens[0][1:-1]
+ ... |
f22fa6d0c1b7e3bde95554f87af7254c2c381c41 | django_app_lti/urls.py | django_app_lti/urls.py | from django.urls import path
from .views import LTILaunchView, LTIToolConfigView, logout_view, logged_out_view
urlpatterns = [
path('', LTILaunchView.as_view(), name='index'),
path('launch', LTILaunchView.as_view(), name='launch'),
path('config', LTIToolConfigView.as_view(), name='config'),
path('logou... | from django.urls import path
from .views import LTILaunchView, LTIToolConfigView, logout_view, logged_out_view
app_name = 'lti'
urlpatterns = [
path('', LTILaunchView.as_view(), name='index'),
path('launch', LTILaunchView.as_view(), name='launch'),
path('config', LTIToolConfigView.as_view(), name='config')... | Add app_name to url module | Add app_name to url module
| Python | bsd-3-clause | Harvard-ATG/django-app-lti | ---
+++
@@ -1,6 +1,7 @@
from django.urls import path
from .views import LTILaunchView, LTIToolConfigView, logout_view, logged_out_view
+app_name = 'lti'
urlpatterns = [
path('', LTILaunchView.as_view(), name='index'),
path('launch', LTILaunchView.as_view(), name='launch'), |
1f8cc2ffe1f4c9b390a5dc19a2bd9eb4601f0055 | ledger/migrations/0002_auto_20170717_2255.py | ledger/migrations/0002_auto_20170717_2255.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-18 03:55
from __future__ import unicode_literals
from django.db import migrations, connection
def load_data(apps, schema_editor):
Account = apps.get_model("ledger", "Account")
Account(name="Cash", type="asset").save()
Account(name="Bank", t... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-18 03:55
from __future__ import unicode_literals
from django.db import migrations, connection
def load_data(apps, schema_editor):
Account = apps.get_model("ledger", "Account")
Account(name="Cash", type="asset").save()
Account(name="Bank", t... | Add a balance (equity) account | Add a balance (equity) account
| Python | mpl-2.0 | jackbravo/condorest-django,jackbravo/condorest-django,jackbravo/condorest-django | ---
+++
@@ -14,6 +14,7 @@
Account(name="Deposits", type="revenue").save()
Account(name="Administrative", type="expense").save()
Account(name="Purchases", type="expense").save()
+ Account(name="Balance", type="equity").save()
def remove_data(apps, schema_editor): |
6908fb4f5796e0b2f44ce93f54227f3873bb9a9b | masters/master.client.dart.packages/packages.py | masters/master.client.dart.packages/packages.py | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
PACKAGES = [
{
'name' : 'core-elements',
'package_dependencies' : [],
},
{
'name' : 'paper-elements',
'package_dependencies' : ['core-e... | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
PACKAGES = [
{
'name' : 'core-elements',
'package_dependencies' : [],
},
{
'name' : 'paper-elements',
'package_dependencies' : ['core-e... | Add googleapis_auth to dart package waterfall | Add googleapis_auth to dart package waterfall
Review URL: https://codereview.chromium.org/574283003
git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@291992 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | eunchong/build,eunchong/build,eunchong/build,eunchong/build | ---
+++
@@ -19,4 +19,8 @@
'name' : 'gcloud',
'package_dependencies' : [],
},
+ {
+ 'name' : 'googleapis_auth',
+ 'package_dependencies' : [],
+ },
] |
924bee7b0a8b11aa0f1506584966533924d29478 | django_hash_filter/templatetags/hash_filter.py | django_hash_filter/templatetags/hash_filter.py | from django import template
from django.template.defaultfilters import stringfilter
from django.template.base import TemplateSyntaxError
import hashlib
from django_hash_filter.templatetags import get_available_hashes
register = template.Library()
@register.filter
@stringfilter
def hash(value, arg):
"""
Return... | from django import template
from django.template.defaultfilters import stringfilter
from django.template.base import TemplateSyntaxError
import hashlib
from django_hash_filter.templatetags import get_available_hashes
register = template.Library()
@register.filter
@stringfilter
def hash(value, arg):
"""
Return... | Add helpful text to template error | Add helpful text to template error | Python | mit | andrewjsledge/django-hash-filter | ---
+++
@@ -14,7 +14,7 @@
"""
arg = str(arg).lower()
if not arg in get_available_hashes():
- raise TemplateSyntaxError("The %s hash algorithm does not exist." % arg)
+ raise TemplateSyntaxError("The %s hash algorithm does not exist. Supported algorithms are: %" % (arg, get_available_hashe... |
aa10d2c0d49fd28afcda2b67f969fdb4a1d3072b | backend/breach/views.py | backend/breach/views.py | from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
def get_work(request):
return HttpResponse('Not implemented')
@csrf_exempt
def work_completed(request):
return HttpResponse('Not implemented')
| import json
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
def create_new_work():
return {'url': 'https://www.dimkarakostas.com/?breach-test',
'amount': 10,
'timeout': 0}
def get_work(request):
new_work = create_new_work()
return HttpRes... | Change get_work to response with work JSON | Change get_work to response with work JSON
| Python | mit | dimkarakostas/rupture,esarafianou/rupture,dimkarakostas/rupture,dionyziz/rupture,dionyziz/rupture,esarafianou/rupture,dimriou/rupture,dionyziz/rupture,esarafianou/rupture,esarafianou/rupture,dimkarakostas/rupture,dimriou/rupture,dimriou/rupture,dimkarakostas/rupture,dimriou/rupture,dionyziz/rupture,dimriou/rupture,dimk... | ---
+++
@@ -1,9 +1,17 @@
+import json
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
+def create_new_work():
+ return {'url': 'https://www.dimkarakostas.com/?breach-test',
+ 'amount': 10,
+ 'timeout': 0}
+
+
def get_work(request):
- return ... |
804edb8d7423ee882e483bec8ffe551a168602b4 | contentstore/models.py | contentstore/models.py | from django.db import models
from django.utils.translation import ugettext_lazy as _
class Schedule(models.Model):
minute = models.CharField(_('minute'), max_length=64, default='*')
hour = models.CharField(_('hour'), max_length=64, default='*')
day_of_week = models.CharField(
_('day of week'), max... | from django.db import models
from django.utils.translation import ugettext_lazy as _
class Schedule(models.Model):
"""
Schdules (sometimes referred to as Protocols) are the method used to
define the rate and frequency at which the messages are sent to
the recipient
"""
minute = models.CharFie... | Add docstring to Schedule model | Add docstring to Schedule model
| Python | bsd-3-clause | praekelt/django-messaging-contentstore,praekelt/django-messaging-contentstore | ---
+++
@@ -3,6 +3,12 @@
class Schedule(models.Model):
+
+ """
+ Schdules (sometimes referred to as Protocols) are the method used to
+ define the rate and frequency at which the messages are sent to
+ the recipient
+ """
minute = models.CharField(_('minute'), max_length=64, default='*')
... |
0f7853c3568791f0e93ece57d2fc750dbc93b963 | starlette/concurrency.py | starlette/concurrency.py | import asyncio
import functools
import typing
from typing import Any, AsyncGenerator, Iterator
try:
import contextvars # Python 3.7+ only.
except ImportError: # pragma: no cover
contextvars = None # type: ignore
async def run_in_threadpool(
func: typing.Callable, *args: typing.Any, **kwargs: typing.An... | import asyncio
import functools
import typing
from typing import Any, AsyncGenerator, Iterator
try:
import contextvars # Python 3.7+ only.
except ImportError: # pragma: no cover
contextvars = None # type: ignore
T = typing.TypeVar("T")
async def run_in_threadpool(
func: typing.Callable[..., T], *args... | Add type hint for run_in_threadpool return type | Add type hint for run_in_threadpool return type
| Python | bsd-3-clause | encode/starlette,encode/starlette | ---
+++
@@ -8,10 +8,12 @@
except ImportError: # pragma: no cover
contextvars = None # type: ignore
+T = typing.TypeVar("T")
+
async def run_in_threadpool(
- func: typing.Callable, *args: typing.Any, **kwargs: typing.Any
-) -> typing.Any:
+ func: typing.Callable[..., T], *args: typing.Any, **kwargs:... |
52c7efbe7f9a24f568768fb926f487a276a47f51 | numba/typesystem/exttypes/attributestype.py | numba/typesystem/exttypes/attributestype.py | # -*- coding: utf-8 -*-
"""
Extension attribute table type. Supports ordered (struct) fields, or
unordered (hash-based) fields.
"""
from numba.typesystem import *
from numba.typesystem.exttypes import ordering
#------------------------------------------------------------------------
# Extension Attributes Type
#----... | # -*- coding: utf-8 -*-
"""
Extension attribute table type. Supports ordered (struct) fields, or
unordered (hash-based) fields.
"""
import numba
from numba.typesystem import NumbaType, is_obj
from numba.typesystem.exttypes import ordering
#------------------------------------------------------------------------
# Ex... | Add to_struct to attribute table | Add to_struct to attribute table
| Python | bsd-2-clause | gmarkall/numba,sklam/numba,GaZ3ll3/numba,stonebig/numba,IntelLabs/numba,IntelLabs/numba,GaZ3ll3/numba,cpcloud/numba,GaZ3ll3/numba,seibert/numba,GaZ3ll3/numba,gdementen/numba,gdementen/numba,sklam/numba,cpcloud/numba,stuartarchibald/numba,stuartarchibald/numba,shiquanwang/numba,stefanseefeld/numba,shiquanwang/numba,Inte... | ---
+++
@@ -5,7 +5,8 @@
unordered (hash-based) fields.
"""
-from numba.typesystem import *
+import numba
+from numba.typesystem import NumbaType, is_obj
from numba.typesystem.exttypes import ordering
#------------------------------------------------------------------------
@@ -17,12 +18,21 @@
Type for ex... |
3075a10c56fb38611134aa15c06b6da8cc777868 | enthought/pyface/tasks/task_window_layout.py | enthought/pyface/tasks/task_window_layout.py | # Enthought library imports.
from enthought.traits.api import Dict, HasStrictTraits, Instance, List, Str, \
Tuple
# Local imports.
from task_layout import TaskLayout
class TaskWindowLayout(HasStrictTraits):
""" A picklable object that describes the layout and state of a TaskWindow.
"""
# The ID of ... | # Enthought library imports.
from enthought.traits.api import Dict, HasStrictTraits, Instance, List, Str, \
Tuple
# Local imports.
from task_layout import TaskLayout
class TaskWindowLayout(HasStrictTraits):
""" A picklable object that describes the layout and state of a TaskWindow.
"""
# The ID of ... | Add a few useful utility methods to TaskWindowLayout. | Add a few useful utility methods to TaskWindowLayout.
| Python | bsd-3-clause | brett-patterson/pyface,pankajp/pyface,geggo/pyface,geggo/pyface,enthought/traitsgui | ---
+++
@@ -24,3 +24,21 @@
# A map from task IDs to their respective layouts. Set by the framework.
layout_state = Dict(Str, Instance(TaskLayout))
+
+ def get_active_task(self):
+ """ Returns the ID of the active task in the layout, or None if there is
+ no active task.
+ """
+... |
c430aa52d22cb2aa97fa11b225047f5b52fa5326 | security.py | security.py | def file_is_allowed(file):
return file.endswith(".py") and "__init__" not in file.title() and "Sample_City" not in file.title()
| def file_is_allowed(file):
return file.endswith(".py") and "__Init__" not in file.title() and "Sample_City" not in file.title()
| Fix bug '__init__' showing in list of cities | Fix bug '__init__' showing in list of cities
| Python | mit | offenesdresden/ParkAPI,Mic92/ParkAPI,offenesdresden/ParkAPI,Mic92/ParkAPI | ---
+++
@@ -1,2 +1,2 @@
def file_is_allowed(file):
- return file.endswith(".py") and "__init__" not in file.title() and "Sample_City" not in file.title()
+ return file.endswith(".py") and "__Init__" not in file.title() and "Sample_City" not in file.title() |
663f44e94c22f8ac889a1d7608e6ab0e3cbf9ad3 | checkeol.py | checkeol.py | # Check files for incorrect newlines
import fnmatch, os
def check_file(fname):
for n, line in enumerate(open(fname, "rb")):
if "\r" in line:
print "%s@%d: CR found" % (fname, n)
return
def check_files(root, patterns):
for root, dirs, files in os.walk(root):
for f in fi... | # Check files for incorrect newlines
import fnmatch, os
def check_file(fname):
for n, line in enumerate(open(fname, "rb")):
if "\r" in line:
print "%s@%d: CR found" % (fname, n)
return
def check_files(root, patterns):
for root, dirs, files in os.walk(root):
for f in fi... | Check on the EOL chars in ,cover gold files. | Check on the EOL chars in ,cover gold files.
| Python | apache-2.0 | larsbutler/coveragepy,jayhetee/coveragepy,nedbat/coveragepy,blueyed/coveragepy,hugovk/coveragepy,7WebPages/coveragepy,nedbat/coveragepy,jayhetee/coveragepy,blueyed/coveragepy,larsbutler/coveragepy,jayhetee/coveragepy,larsbutler/coveragepy,larsbutler/coveragepy,hugovk/coveragepy,nedbat/coveragepy,jayhetee/coveragepy,hug... | ---
+++
@@ -20,5 +20,5 @@
dirs.remove('.svn')
check_files("coverage", ["*.py"])
-check_files("test", ["*.py"])
+check_files("test", ["*.py", "*,cover"])
check_file("setup.py") |
251e13b96ed10e48b69ccf5d625d673a5507f222 | requests_kerberos/__init__.py | requests_kerberos/__init__.py | """
requests Kerberos/GSSAPI authentication library
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Requests is an HTTP library, written in Python, for human beings. This library
adds optional Kerberos/GSSAPI authentication support and supports mutual
authentication. Basic GET usage:
>>> import requests
>>> f... | """
requests Kerberos/GSSAPI authentication library
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Requests is an HTTP library, written in Python, for human beings. This library
adds optional Kerberos/GSSAPI authentication support and supports mutual
authentication. Basic GET usage:
>>> import requests
>>> f... | Remove REQUIRED, OPTIONAL, DISABLED from default exports | Remove REQUIRED, OPTIONAL, DISABLED from default exports
Prevent polluting the callers namespace with generically named constants.
| Python | isc | requests/requests-kerberos,AbsoluteMSTR/requests-kerberos,rbcarson/requests-kerberos,requests/requests-kerberos,danc86/requests-kerberos | ---
+++
@@ -21,5 +21,5 @@
logging.getLogger(__name__).addHandler(NullHandler())
-__all__ = [HTTPKerberosAuth, MutualAuthenticationError, REQUIRED, OPTIONAL, DISABLED]
+__all__ = [HTTPKerberosAuth, MutualAuthenticationError]
__version__ = '0.1' |
bcc3a4e4c8b3117deea4c7621653f65b588537f9 | keystone/common/policies/token_revocation.py | keystone/common/policies/token_revocation.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Add scope_types to token revocation policies | Add scope_types to token revocation policies
This doesn't seem useful since the API will return an empty list
regardless because PKI support has been removed.
More or less doing this for consistency.
Change-Id: Iaa2925119fa6c9e2324546ed44aa54bac51dba05
| Python | apache-2.0 | mahak/keystone,openstack/keystone,openstack/keystone,mahak/keystone,openstack/keystone,mahak/keystone | ---
+++
@@ -18,6 +18,11 @@
policy.DocumentedRuleDefault(
name=base.IDENTITY % 'revocation_list',
check_str=base.RULE_SERVICE_OR_ADMIN,
+ # NOTE(lbragstad): Documenting scope_types here doesn't really make a
+ # difference since this API is going to return an empty list regardless
... |
c7ed2e94f10b680eef9942f2bda1d246f11595c5 | src/foremast/consts.py | src/foremast/consts.py | """Load base config and export package constants."""
import logging
from configparser import ConfigParser
from os.path import expanduser
LOG = logging.getLogger(__name__)
def find_config():
"""Look for config in config_locations. If not found, give a fatal error.
Returns:
ConfigParser: found configu... | """Load base config and export package constants."""
import logging
from configparser import ConfigParser
from os.path import expanduser
LOG = logging.getLogger(__name__)
def find_config():
"""Look for **foremast.cfg** in config_locations.
If not found, give a fatal error.
Returns:
ConfigParser... | Update docstring to include config file name | docs: Update docstring to include config file name
| Python | apache-2.0 | gogoair/foremast,gogoair/foremast | ---
+++
@@ -7,7 +7,9 @@
def find_config():
- """Look for config in config_locations. If not found, give a fatal error.
+ """Look for **foremast.cfg** in config_locations.
+
+ If not found, give a fatal error.
Returns:
ConfigParser: found configuration file |
1e6fcb134f55cb70ddd394a051a86c45aa50c944 | cli_helpers/tabular_output/tabulate_adapter.py | cli_helpers/tabular_output/tabulate_adapter.py | from cli_helpers.packages import tabulate
from .preprocessors import bytes_to_string, align_decimals
tabulate.PRESERVE_WHITESPACE = True
supported_markup_formats = ('mediawiki', 'html', 'latex', 'latex_booktabs',
'textile', 'moinmoin', 'jira')
supported_table_formats = ('plain', 'simple', ... | from cli_helpers.packages import tabulate
from .preprocessors import bytes_to_string, align_decimals
supported_markup_formats = ('mediawiki', 'html', 'latex', 'latex_booktabs',
'textile', 'moinmoin', 'jira')
supported_table_formats = ('plain', 'simple', 'grid', 'fancy_grid', 'pipe',
... | Make whitespace and numparse configurable. | Make whitespace and numparse configurable.
| Python | bsd-3-clause | dbcli/cli_helpers,dbcli/cli_helpers | ---
+++
@@ -1,7 +1,5 @@
from cli_helpers.packages import tabulate
from .preprocessors import bytes_to_string, align_decimals
-
-tabulate.PRESERVE_WHITESPACE = True
supported_markup_formats = ('mediawiki', 'html', 'latex', 'latex_booktabs',
'textile', 'moinmoin', 'jira')
@@ -12,11 +10... |
aa0ebe55ae5804f4f324a83de64e0879228261bd | securedrop/request_that_secures_file_uploads.py | securedrop/request_that_secures_file_uploads.py | from flask import wrappers
from tempfile import NamedTemporaryFile
from io import BytesIO
class RequestThatSecuresFileUploads(wrappers.Request):
def _secure_file_stream(self, total_content_length, content_type, filename=None,
content_length=None):
if total_content_length > 1024 * 5... | from io import BytesIO
from flask import wrappers
from secure_tempfile import SecureTemporaryFile
class RequestThatSecuresFileUploads(wrappers.Request):
def _secure_file_stream(self, total_content_length, content_type,
filename=None, content_length=None):
"""Storage class for... | Use SecureTemporaryFile for Source Interface requests | Use SecureTemporaryFile for Source Interface requests
| Python | agpl-3.0 | jeann2013/securedrop,chadmiller/securedrop,harlo/securedrop,micahflee/securedrop,jrosco/securedrop,GabeIsman/securedrop,chadmiller/securedrop,heartsucker/securedrop,heartsucker/securedrop,chadmiller/securedrop,pwplus/securedrop,micahflee/securedrop,jeann2013/securedrop,jaseg/securedrop,ehartsuyker/securedrop,jrosco/sec... | ---
+++
@@ -1,17 +1,31 @@
+from io import BytesIO
+
from flask import wrappers
-from tempfile import NamedTemporaryFile
-from io import BytesIO
+
+from secure_tempfile import SecureTemporaryFile
class RequestThatSecuresFileUploads(wrappers.Request):
- def _secure_file_stream(self, total_content_length, conte... |
9ba9e26888578e66469a63e412f46cf151fbcfd7 | common/data_refinery_common/test_microarray.py | common/data_refinery_common/test_microarray.py | from unittest.mock import Mock, patch
from django.test import TestCase
from data_refinery_common import microarray
CEL_FILE_HUMAN = "test-files/C30057.CEL"
CEL_FILE_RAT = "test-files/SG2_u34a.CEL"
CEL_FILE_MOUSE = "test-files/97_(Mouse430_2).CEL"
CEL_FILE_ZEBRAFISH = "test-files/CONTROL6.cel"
class MicroarrayTestCas... | from unittest.mock import Mock, patch
from django.test import TestCase
from data_refinery_common import microarray
CEL_FILE_HUMAN = "test-files/C30057.CEL.gz"
CEL_FILE_RAT = "test-files/SG2_u34a.CEL.gz"
CEL_FILE_MOUSE = "test-files/97_(Mouse430_2).CEL.gz"
CEL_FILE_ZEBRAFISH = "test-files/CONTROL6.cel.gz"
class Micro... | Update test file paths for common to point to compressed versions. | Update test file paths for common to point to compressed versions.
| Python | bsd-3-clause | data-refinery/data_refinery,data-refinery/data_refinery,data-refinery/data_refinery | ---
+++
@@ -2,10 +2,10 @@
from django.test import TestCase
from data_refinery_common import microarray
-CEL_FILE_HUMAN = "test-files/C30057.CEL"
-CEL_FILE_RAT = "test-files/SG2_u34a.CEL"
-CEL_FILE_MOUSE = "test-files/97_(Mouse430_2).CEL"
-CEL_FILE_ZEBRAFISH = "test-files/CONTROL6.cel"
+CEL_FILE_HUMAN = "test-file... |
a0d79fac86d77de6c7ce9f76b269c18dc0972482 | domain_squeezer/urls.py | domain_squeezer/urls.py | """
URL path mapping for our Django app.
"""
from django.conf.urls import url
from . import views
from .settings import URL_MAX_WORDS
urlpatterns = [
url(r'^/*$', views.index, name='squeezer-index'),
]
# match every single element in URL path
for times in range(1, URL_MAX_WORDS + 1):
pattern = r'^/*' + (r'([... | """
URL path mapping for our Django app.
"""
from django.conf.urls import url
from . import views
from .settings import URL_MAX_WORDS
urlpatterns = [
url(r'^$', views.index, name='squeezer-index'),
]
# match every single element in URL path
for times in range(1, URL_MAX_WORDS + 1):
pattern = r'^' + (r'([^/]+... | Address Django warnings on url pattern regex | Address Django warnings on url pattern regex
| Python | mit | bittner/django-domain-squeezer,bittner/django-domain-squeezer | ---
+++
@@ -7,12 +7,12 @@
from .settings import URL_MAX_WORDS
urlpatterns = [
- url(r'^/*$', views.index, name='squeezer-index'),
+ url(r'^$', views.index, name='squeezer-index'),
]
# match every single element in URL path
for times in range(1, URL_MAX_WORDS + 1):
- pattern = r'^/*' + (r'([^/]+)/+' ... |
d330925b8e1f559bb16f75cca25ce583ccaa7f90 | rnacentral/rnacentral/urls.py | rnacentral/rnacentral/urls.py | """
Copyright [2009-2014] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | """
Copyright [2009-2014] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | Rename new sequence search url | Rename new sequence search url
| Python | apache-2.0 | RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode,RNAcentral/rnacentral-webcode | ---
+++
@@ -26,5 +26,5 @@
# export metadata search results
url(r'^export/', include('export.urls')),
# sequence search
- url(r'^sequence-search-new/', include('nhmmer.urls')),
+ url(r'^sequence-search-nhmmer/', include('nhmmer.urls')),
) |
42518bb29357194257b45989f9c64028f27ac804 | boundaryservice/urls.py | boundaryservice/urls.py | from django.conf.urls.defaults import patterns, include, url
from boundaryservice.views import *
urlpatterns = patterns('',
url(r'^boundary-set/$', BoundarySetListView.as_view(), name='boundaryservice_set_list'),
url(r'^boundary-set/(?P<slug>[\w_-]+)/$', BoundarySetDetailView.as_view(), name='boundaryservice_... | from django.conf.urls.defaults import patterns, include, url
from boundaryservice.views import *
urlpatterns = patterns('',
url(r'^boundary-set/$', BoundarySetListView.as_view(), name='boundaryservice_set_list'),
url(r'^boundary-set/(?P<slug>[\w_-]+)/$', BoundarySetDetailView.as_view(), name='boundaryservice_... | Allow shape output on /boundary/ queries | Allow shape output on /boundary/ queries
| Python | mit | opencorato/represent-boundaries,opencorato/represent-boundaries,datamade/represent-boundaries,opencorato/represent-boundaries,datamade/represent-boundaries,datamade/represent-boundaries | ---
+++
@@ -6,6 +6,7 @@
url(r'^boundary-set/$', BoundarySetListView.as_view(), name='boundaryservice_set_list'),
url(r'^boundary-set/(?P<slug>[\w_-]+)/$', BoundarySetDetailView.as_view(), name='boundaryservice_set_detail'),
url(r'^boundary/$', BoundaryListView.as_view(), name='boundaryservice_boundary_... |
95cfb8176432fcf289571026ebfb88626ad8b3fb | mopidy_scrobbler/__init__.py | mopidy_scrobbler/__init__.py | import os
from mopidy import config, ext
__version__ = "1.2.1"
class Extension(ext.Extension):
dist_name = "Mopidy-Scrobbler"
ext_name = "scrobbler"
version = __version__
def get_default_config(self):
conf_file = os.path.join(os.path.dirname(__file__), "ext.conf")
return config.rea... | import pathlib
from mopidy import config, ext
__version__ = "1.2.1"
class Extension(ext.Extension):
dist_name = "Mopidy-Scrobbler"
ext_name = "scrobbler"
version = __version__
def get_default_config(self):
return config.read(pathlib.Path(__file__).parent / "ext.conf")
def get_config_s... | Use pathlib to read ext.conf | Use pathlib to read ext.conf
| Python | apache-2.0 | mopidy/mopidy-scrobbler | ---
+++
@@ -1,4 +1,4 @@
-import os
+import pathlib
from mopidy import config, ext
@@ -12,8 +12,7 @@
version = __version__
def get_default_config(self):
- conf_file = os.path.join(os.path.dirname(__file__), "ext.conf")
- return config.read(conf_file)
+ return config.read(pathlib.P... |
4aab1eb2d2d3a0c9b9c4ab6df23b043e6822ff84 | examples/delta/delta.py | examples/delta/delta.py | import sys
from SALib.analyze import delta
from SALib.util import read_param_file
import numpy as np
sys.path.append('../..')
# Read the parameter range file and generate samples
# Since this is "given data", the bounds in the parameter file will not be used
# but the columns are still expected
proble... | import sys
from SALib.analyze import delta
from SALib.util import read_param_file
import numpy as np
sys.path.append('../..')
# Read the parameter range file and generate samples
# Since this is "given data", the bounds in the parameter file will not be used
# but the columns are still expected
proble... | Fix up example with corrected path | Fix up example with corrected path
| Python | mit | jdherman/SALib,SALib/SALib,jdherman/SALib | ---
+++
@@ -12,8 +12,8 @@
# Since this is "given data", the bounds in the parameter file will not be used
# but the columns are still expected
problem = read_param_file('../../src/SALib/test_functions/params/Ishigami.txt')
-X = np.loadtxt('model_input.txt')
-Y = np.loadtxt('model_output.txt')
+X = np.loadtxt('../d... |
4e9de4dd4c408a056f72c833d89832a1981a7b0d | features/tags/forms.py | features/tags/forms.py | from django import forms
from django.db.models.functions import Lower
from . import models
class TagGroup(forms.ModelForm):
class Meta:
model = models.Tagged
fields = []
group = forms.ModelChoiceField(label='Gruppe', queryset=None)
def __init__(self, **kwargs):
tagger = kwargs.p... | from django import forms
from django.db.models.functions import Lower
from . import models
class TagGroup(forms.ModelForm):
class Meta:
model = models.Tagged
fields = []
group = forms.ModelChoiceField(label='Gruppe', queryset=None)
def __init__(self, **kwargs):
tagger = kwargs.p... | Fix save for empty tags | Fix save for empty tags
| Python | agpl-3.0 | stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten | ---
+++
@@ -18,5 +18,8 @@
tags__tag=self.instance.tag).order_by(Lower('name'))
def save(self, commit=True):
+ if commit and not self.instance.tag.pk:
+ self.instance.tag.save()
+ self.instance.tag = self.instance.tag
self.instance.tagged = self.cleaned_dat... |
8c00c71de736c54c22fedfae86101eb99846ba4f | anyjson.py | anyjson.py | """
Get the best JSON encoder/decoder available on this system.
"""
__version__ = "0.1"
__author__ = "Rune Halvorsen <runefh@gmail.com>"
__homepage__ = "http://bitbucket.org/runeh/anyjson/"
__docformat__ = "restructuredtext"
"""
.. function:: serialize(obj)
Serialize the object to JSON.
.. function:: deseriali... | """
Get the best JSON encoder/decoder available on this system.
"""
__version__ = "0.1"
__author__ = "Rune Halvorsen <runefh@gmail.com>"
__homepage__ = "http://bitbucket.org/runeh/anyjson/"
__docformat__ = "restructuredtext"
"""
.. function:: serialize(obj)
Serialize the object to JSON.
.. function:: deseriali... | Raise our own ImportError if all fails. Looks better than to complain about django when that happens | Raise our own ImportError if all fails. Looks better than to complain about
django when that happens
| Python | bsd-3-clause | newvem/anyjson,kennethreitz-archive/anyjson | ---
+++
@@ -40,8 +40,12 @@
serialize = json.dumps
deserialize = json.loads
except ImportError:
- # If all of the above fails, try to fallback to the simplejson
- # embedded in Django.
- from django.utils import simplejson
- serialize = sim... |
4706d6feaff7057d04def0544e291900a754558e | nbgrader/apps/solutionapp.py | nbgrader/apps/solutionapp.py | from IPython.config.loader import Config
from IPython.config.application import catch_config_error
from IPython.utils.traitlets import Unicode
from nbgrader.apps.customnbconvertapp import CustomNbConvertApp
class SolutionApp(CustomNbConvertApp):
name = Unicode(u'nbgrader-solution')
description = Unicode(u... | from IPython.config.loader import Config
from IPython.config.application import catch_config_error
from IPython.utils.traitlets import Unicode
from nbgrader.apps.customnbconvertapp import CustomNbConvertApp
class SolutionApp(CustomNbConvertApp):
name = Unicode(u'nbgrader-solution')
description = Unicode(u... | Add files writer to solution app | Add files writer to solution app
| Python | bsd-3-clause | ellisonbg/nbgrader,jupyter/nbgrader,modulexcite/nbgrader,ellisonbg/nbgrader,modulexcite/nbgrader,jupyter/nbgrader,ellisonbg/nbgrader,dementrock/nbgrader,jdfreder/nbgrader,jupyter/nbgrader,EdwardJKim/nbgrader,jhamrick/nbgrader,MatKallada/nbgrader,dementrock/nbgrader,jhamrick/nbgrader,jupyter/nbgrader,alope107/nbgrader,a... | ---
+++
@@ -21,4 +21,5 @@
'IPython.nbconvert.preprocessors.ExecutePreprocessor'
]
self.extra_config.RenderSolutions.solution = True
+ self.extra_config.NbGraderApp.writer_class = 'IPython.nbconvert.writers.FilesWriter'
self.config.merge(self.extra_config) |
20733c6b3d3bc249098297a73341f56e781aabbe | plugins/storage/storagetype/test/test_integration.py | plugins/storage/storagetype/test/test_integration.py | #!/usr/bin/env python
#-*- coding: utf-8 -*-
#This software is distributed under the Creative Commons license (CC0) version 1.0. A copy of this license should have been distributed with this software.
#The license can also be read online: <https://creativecommons.org/publicdomain/zero/1.0/>. If this online license dif... | #!/usr/bin/env python
#-*- coding: utf-8 -*-
#This software is distributed under the Creative Commons license (CC0) version 1.0. A copy of this license should have been distributed with this software.
#The license can also be read online: <https://creativecommons.org/publicdomain/zero/1.0/>. If this online license dif... | Add simple test case to test plug-in discovery | Add simple test case to test plug-in discovery
This just tests if can_read is callable for now, but at least the plug-in discovery in tests works. It doesn't work beautifully, but we can work from here.
| Python | cc0-1.0 | Ghostkeeper/Luna | ---
+++
@@ -9,7 +9,20 @@
interface.
"""
+import os.path #To get the plug-in directory.
+import luna.plugins #To get the plug-ins to test with.
import luna.test_case
+plugin_base = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "..") #The main directory containing this plug-in (as well as ... |
b4d97079b6a74e9a2001b50c66b9eee6bc57ba66 | swiftclient/__init__.py | swiftclient/__init__.py | # -*- encoding: utf-8 -*-
# Copyright (c) 2012 Rackspace
# flake8: noqa
# 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 ... | # -*- encoding: utf-8 -*-
# Copyright (c) 2012 Rackspace
# flake8: noqa
# 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 ... | Remove extra double quote from docstring | Remove extra double quote from docstring
The extra " was visible on
http://docs.openstack.org/developer/python-swiftclient/swiftclient.html
Change-Id: I7d61c8259a4f13464c11ae7e3fa28eb3a58e4baa
| Python | apache-2.0 | krnflake/python-hubicclient,varunarya10/python-swiftclient,jeseem/python-swiftclient,JioCloud/python-swiftclient,sohonetlabs/python-swiftclient,pratikmallya/python-swiftclient,iostackproject/IO-Bandwidth-Differentiation-Client,JioCloud/python-swiftclient,openstack/python-swiftclient,pratikmallya/python-swiftclient,varu... | ---
+++
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-""""
+"""
OpenStack Swift Python client binding.
"""
from .client import * |
23a9aaae78cc4d9228f8d0705647fbcadcaf7975 | markymark/fields.py | markymark/fields.py | from django import forms
from django.db import models
from .widgets import MarkdownTextarea
class MarkdownFormField(forms.fields.CharField):
def __init__(self, *args, **kwargs):
kwargs['widget'] = MarkdownTextarea
super(MarkdownFormField, self).__init__(*args, **kwargs)
class MarkdownField(mode... | from django import forms
from django.db import models
from .widgets import MarkdownTextarea
class MarkdownFormField(forms.fields.CharField):
def __init__(self, *args, **kwargs):
kwargs['widget'] = kwargs.pop('widget', MarkdownTextarea)
super(MarkdownFormField, self).__init__(*args, **kwargs)
cl... | Allow widget overwriting on form field | Allow widget overwriting on form field
| Python | mit | moccu/django-markymark,moccu/django-markymark,moccu/django-markymark | ---
+++
@@ -6,7 +6,7 @@
class MarkdownFormField(forms.fields.CharField):
def __init__(self, *args, **kwargs):
- kwargs['widget'] = MarkdownTextarea
+ kwargs['widget'] = kwargs.pop('widget', MarkdownTextarea)
super(MarkdownFormField, self).__init__(*args, **kwargs)
|
dbe28b1d00a17acdd276263c9042dbd7b5dfc311 | src/adhocracy_kit/adhocracy_kit/__init__.py | src/adhocracy_kit/adhocracy_kit/__init__.py | """Adhocracy extension."""
from pyramid.config import Configurator
from adhocracy_core import root_factory
def includeme(config):
"""Setup adhocracy extension.
The kit package should be exactly like the spd package but with different
root permissions and default translations for the emails.
"""
... | """Adhocracy extension."""
from pyramid.config import Configurator
from adhocracy_core import root_factory
def includeme(config):
"""Setup adhocracy extension.
The kit package should be exactly like the spd package but with different
root permissions and default translations for the emails.
"""
... | Fix wrong config includes in kit package | Fix wrong config includes in kit package
| Python | agpl-3.0 | liqd/adhocracy3.mercator,fhartwig/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,fhartwig/adhocracy3.mercator,fhartwig/adhocracy3.mercator,fhartwig/adhocracy3.mercator,fhartwig/adhocracy3.mercator,liqd/adhocracy3.mercator,fhartwig/adhocracy3.mercator,liqd/adhocracy3.mercator,fhartwig/adhocracy3.m... | ---
+++
@@ -13,15 +13,15 @@
# copied from adhocracy_spd (without resources and translations)
config.include('adhocracy_core')
config.commit()
- config.include('.sheets')
- config.include('.workflows')
- config.include('.evolution')
+ config.include('adhocracy_spd.sheets')
+ config.includ... |
2e299c5c2a35d3cd42be43c90af41c28e5d27c15 | reindexer/reindex_shard_generator/src/test_reindex_shard_config.py | reindexer/reindex_shard_generator/src/test_reindex_shard_config.py | # -*- encoding: utf-8
import pytest
from reindex_shard_config import create_reindex_shard
@pytest.mark.parametrize(
'source_name, source_id, expected_reindex_shard', [
('sierra', 'b0000001', 'sierra/2441'),
('miro', 'A0000001', 'miro/128')
])
def test_create_reindex_shard(source_name, source_id, expecte... | # -*- encoding: utf-8
import pytest
from reindex_shard_config import create_reindex_shard
@pytest.mark.parametrize(
'source_name, source_id, expected_reindex_shard', [
('sierra', 'b0000001', 'sierra/2441'),
('miro', 'A0000001', 'miro/128')
])
def test_create_reindex_shard(source_name, source_id, expecte... | Fix a Python lint error | Fix a Python lint error
| Python | mit | wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api | ---
+++
@@ -21,7 +21,7 @@
@pytest.mark.parametrize('source_name', ['foo', 13, None])
def test_unrecognised_source_name_is_ValueError(source_name):
with pytest.raises(ValueError) as err:
- reindex_shard = create_reindex_shard(
+ create_reindex_shard(
source_name=source_name,
... |
eff924e07999bd0aaaa36373c658efb1ffefe5c7 | magpie/utils/solr.py | magpie/utils/solr.py | from mysolr import Solr
from magpie.settings import settings
_solr = None
def open_solr_connection(core_name):
global _solr
if not _solr:
url = '{}/{}'.format(settings.SOLR_URL, core_name)
_solr = Solr(url)
return _solr | from mysolr import Solr
from magpie.settings import settings
_solr = None
def open_solr_connection(core_name):
global _solr
if not _solr:
url = '{}/{}'.format(settings.SOLR_URL, core_name)
_solr = Solr(url)
return _solr
def escape_solr_query(query):
"""
Escape special chars fo... | Add method to escape special chars in Solr queries | Add method to escape special chars in Solr queries
| Python | apache-2.0 | nimiq/moogle-project | ---
+++
@@ -12,3 +12,15 @@
url = '{}/{}'.format(settings.SOLR_URL, core_name)
_solr = Solr(url)
return _solr
+
+
+def escape_solr_query(query):
+ """
+ Escape special chars for Solr queries.
+ """
+ chars = ['+', '-', '&&', '||', '!', '(', ')', '{', '}', '[', ']', '^', '"', '~', '*'... |
8d831e4834b61c04b3f5f2d8a812095eea8c022f | personDb.py | personDb.py | import pickle
class PersonDb(object):
def __init__(self, dbName, autoload = True):
self.dbName = dbName
self.db = None
if autoload:
self.setup()
def setup(self):
self.db = PersonDb.load(self.dbName)
self.getGroups()
def getGroups(self):
tmp = s... | import pickle
import os
class PersonDb(object):
def __init__(self, dbName, autoload = True):
self.dbName = dbName
self.db = None
if autoload:
self.setup()
def setup(self):
self.db = PersonDb.load(self.dbName)
self.getGroups()
def getGroups(self):
... | Add handling of not present file. | Add handling of not present file.
Signed-off-by: Matej Dujava <03ce64f61b3ea1fda633fb2a103b989e3272d16b@gmail.com>
| Python | mit | matejd11/birthdayNotify | ---
+++
@@ -1,4 +1,5 @@
import pickle
+import os
class PersonDb(object):
@@ -26,9 +27,12 @@
def load(fileName = 'database'):
filen = PersonDb.fileExtension(fileName)
- with open(filen, "rb") as pickleIn:
- data = pickle.load(pickleIn)
- return data
+ if os.path.ex... |
77bfe0b92e9bc8ffa23f91a4a9b18093ae8f5f8a | ehriportal/portal/utils.py | ehriportal/portal/utils.py | """Utility functions for dealing with repository and geo data."""
from incf.countryutils import transformations
import babel
# Hacky dictionary of official country/languages names
# we want to substitute for friendlier versions...
# A more permenant solution is needed to this.
SUBNAMES = {
"United Kingdom of Gre... | """Utility functions for dealing with repository and geo data."""
import json
import datetime
from types import MethodType
from incf.countryutils import transformations
import babel
from haystack.query import SearchQuerySet
from django.core.paginator import Paginator, Page, InvalidPage, EmptyPage
from haystack.mode... | Add a class to JSON encode a page object containing Haystack search results. Note: this is a stopgap measure and quite inefficient, since Haystack turns the Solr data into objects and this turns it back into JSON, but at least it's not specific to a search engine backend. | Add a class to JSON encode a page object containing Haystack search results. Note: this is a stopgap measure and quite inefficient, since Haystack turns the Solr data into objects and this turns it back into JSON, but at least it's not specific to a search engine backend.
| Python | mit | mikesname/ehri-collections,mikesname/ehri-collections,mikesname/ehri-collections | ---
+++
@@ -1,7 +1,15 @@
"""Utility functions for dealing with repository and geo data."""
+import json
+import datetime
+from types import MethodType
from incf.countryutils import transformations
import babel
+
+from haystack.query import SearchQuerySet
+from django.core.paginator import Paginator, Page, Inva... |
42901554db49cd1204054ea695cea6ee4e368b1e | tests/basics/int-long.py | tests/basics/int-long.py | # This tests long ints for 32-bit machine
a = 0x1ffffffff
b = 0x100000000
print(a)
print(b)
print(a + b)
print(a - b)
print(b - a)
# overflows long long implementation
#print(a * b)
print(a // b)
print(a % b)
print(a & b)
print(a | b)
print(a ^ b)
print(a << 3)
print(a >> 1)
a += b
print(a)
a -= 123456
print(a)
a *= ... | # This tests long ints for 32-bit machine
a = 0x1ffffffff
b = 0x100000000
print(a)
print(b)
print(a + b)
print(a - b)
print(b - a)
# overflows long long implementation
#print(a * b)
print(a // b)
print(a % b)
print(a & b)
print(a | b)
print(a ^ b)
print(a << 3)
print(a >> 1)
a += b
print(a)
a -= 123456
print(a)
a *= ... | Add regression test for improper inplace op implementation. | objint_longlong: Add regression test for improper inplace op implementation.
| Python | mit | jmarcelino/pycom-micropython,cwyark/micropython,puuu/micropython,rubencabrera/micropython,lbattraw/micropython,warner83/micropython,skybird6672/micropython,methoxid/micropystat,blmorris/micropython,alex-march/micropython,rubencabrera/micropython,dxxb/micropython,firstval/micropython,ahotam/micropython,TDAbboud/micropyt... | ---
+++
@@ -37,3 +37,10 @@
print(a)
a >>= 1
print(a)
+
+# Test referential integrity of long ints
+a = 0x1ffffffff
+b = a
+a += 1
+print(a)
+print(b) |
1771e1d37f48c62dc20c3a83e480b98cb7c4500c | xoinvader/application.py | xoinvader/application.py | import time
class Application(object):
def __init__(self, startup_args={}):
self._state = None
self._states = {}
self._mspf = None # ms per frame
@property
def state(self):
return self._state
@state.setter
def state(self, name):
if name in self._states:
... | import time
class Application(object):
def __init__(self, startup_args={}):
self._state = None
self._states = {}
self._mspf = None # ms per frame
self._running = False
@property
def running(self):
return self._running
@property
def state(self):
if ... | Make loop stopable, some fixes. | Make loop stopable, some fixes.
| Python | mit | pkulev/xoinvader,pankshok/xoinvader | ---
+++
@@ -6,10 +6,18 @@
self._state = None
self._states = {}
self._mspf = None # ms per frame
+ self._running = False
+
+ @property
+ def running(self):
+ return self._running
@property
def state(self):
- return self._state
+ if self._state:
+... |
98ba566742bb6c4be1783287843183242d48bd41 | gitmostwanted/config.py | gitmostwanted/config.py | # pylint: disable=C1001
class Config():
CELERY_BROKER_URL = ''
SQLALCHEMY_ECHO = False
SECRET_KEY = ''
TESTING = False
DEBUG = False
class ConfigDevelopment(Config):
SQLALCHEMY_ECHO = True
DEBUG = True
class ConfigTesting(Config):
SECRET_KEY = 'testing' # noqa
TESTING = True
c... | # pylint: disable=C1001
class Config:
CELERY_BROKER_URL = ''
SQLALCHEMY_ECHO = False
SECRET_KEY = ''
TESTING = False
DEBUG = True
class ConfigDevelopment(Config):
SQLALCHEMY_ECHO = True
class ConfigTesting(Config):
SECRET_KEY = 'testing' # noqa
TESTING = True
class ConfigProductio... | DEBUG = True for the Testing env | DEBUG = True for the Testing env
| Python | mit | kkamkou/gitmostwanted.com,kkamkou/gitmostwanted.com,kkamkou/gitmostwanted.com,kkamkou/gitmostwanted.com | ---
+++
@@ -1,15 +1,14 @@
# pylint: disable=C1001
-class Config():
+class Config:
CELERY_BROKER_URL = ''
SQLALCHEMY_ECHO = False
SECRET_KEY = ''
TESTING = False
- DEBUG = False
+ DEBUG = True
class ConfigDevelopment(Config):
SQLALCHEMY_ECHO = True
- DEBUG = True
class Conf... |
ea46030784640d86a70c382ece7913eeb0996ba9 | 01_dataprep/trn_to_phn.py | 01_dataprep/trn_to_phn.py | #!/usr/bin/env python3
import os
import sys
def main(trn_file, phn_dir):
phone_map = {v[0]: v[1].strip() for v in (l.split(None, 1) for l in open('data/phone_map', encoding='utf-8'))}
for line in open(trn_file):
parts = line.split()
sentence = parts[:-1]
sid = parts[-1][1:-1]
... | #!/usr/bin/env python3
import os
import sys
def main(langdat_dir, trn_file, phn_dir):
phone_map = {v[0]: v[1].strip() for v in (l.split(None, 1) for l in open('{}/phones'.format(langdat_dir), encoding='utf-8'))}
for line in open(trn_file):
parts = line.split()
sentence = parts[:-1]
si... | Fix trn to phn script | Fix trn to phn script
| Python | bsd-3-clause | phsmit/iwclul2016-scripts,phsmit/iwclul2016-scripts,phsmit/iwclul2016-scripts | ---
+++
@@ -3,8 +3,8 @@
import sys
-def main(trn_file, phn_dir):
- phone_map = {v[0]: v[1].strip() for v in (l.split(None, 1) for l in open('data/phone_map', encoding='utf-8'))}
+def main(langdat_dir, trn_file, phn_dir):
+ phone_map = {v[0]: v[1].strip() for v in (l.split(None, 1) for l in open('{}/phones'... |
03ad5a9e31127828ce7f14de61af80af20362624 | test/field/test_date.py | test/field/test_date.py | # encoding: utf-8
from __future__ import unicode_literals
from common import FieldExam
from marrow.mongo.field import Date
class TestDateField(FieldExam):
__field__ = Date
| # encoding: utf-8
from __future__ import unicode_literals
from datetime import datetime
from bson import ObjectId
from common import FieldExam
from marrow.mongo.field import Date
class TestDateField(FieldExam):
__field__ = Date
def test_date_like_oid(self, Sample):
oid = ObjectId('586846800000000000000000')
... | Add test for extraction of dates from ObjectIds. | Add test for extraction of dates from ObjectIds.
| Python | mit | marrow/mongo | ---
+++
@@ -2,9 +2,17 @@
from __future__ import unicode_literals
+from datetime import datetime
+
+from bson import ObjectId
from common import FieldExam
from marrow.mongo.field import Date
class TestDateField(FieldExam):
__field__ = Date
+
+ def test_date_like_oid(self, Sample):
+ oid = ObjectId('586... |
467a359445dd5b1f20a4d622d60a0970d08fc1f1 | samklang_pages/admin.py | samklang_pages/admin.py | from django.contrib import admin
from samklang_pages.models import Page, PageWidget
from samklang_pages.forms import PageForm
class PageWidgetInline(admin.TabularInline):
model = PageWidget
class PageAdminForm(PageForm):
class Meta:
fields = ('url', 'name', 'content', 'site', 'user', 'group', 'adming... | from django.contrib import admin
from samklang_pages.models import Page, PageWidget
from samklang_pages.forms import PageForm
class PageWidgetInline(admin.TabularInline):
model = PageWidget
class PageAdminForm(PageForm):
class Meta:
fields = ('url', 'name', 'content', 'site', 'user', 'group', 'adming... | Hide pagewidgets away for now | Hide pagewidgets away for now
| Python | agpl-3.0 | sigurdga/samklang-pages,sigurdga/samklang-pages | ---
+++
@@ -23,5 +23,5 @@
class PageWidgetAdmin(admin.ModelAdmin):
pass
-admin.site.register(PageWidget, PageWidgetAdmin)
+#admin.site.register(PageWidget, PageWidgetAdmin)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.