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
6c8122be60b25bbe9ba4ff8a714370e801e6ae70
cufflinks/offline.py
cufflinks/offline.py
import plotly.offline as py_offline ### Offline Mode def go_offline(connected=False): try: py_offline.init_notebook_mode(connected) except TypeError: #For older versions of plotly py_offline.init_notebook_mode() py_offline.__PLOTLY_OFFLINE_INITIALIZED=True def go_online(): py_offline.__PLOTLY_OFFLINE_INIT...
import plotly.offline as py_offline ### Offline Mode def run_from_ipython(): try: __IPYTHON__ return True except NameError: return False def go_offline(connected=False): if run_from_ipython(): try: py_offline.init_notebook_mode(connected) except TypeE...
Call init_notebook_mode only if inside IPython
Call init_notebook_mode only if inside IPython
Python
mit
santosjorge/cufflinks
--- +++ @@ -2,13 +2,22 @@ ### Offline Mode +def run_from_ipython(): + try: + __IPYTHON__ + return True + except NameError: + return False + + def go_offline(connected=False): - try: - py_offline.init_notebook_mode(connected) - except TypeError: - #For older versions of plotly - py...
979ec05ed34cec2af0d45dc76b84921af85f84e9
script/compile-coffee.py
script/compile-coffee.py
#!/usr/bin/env python import os import subprocess import sys from lib.util import * SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__)) def main(): input_file = sys.argv[1] output_dir = os.path.dirname(sys.argv[2]) coffee = os.path.join(SOURCE_ROOT, 'node_modules', 'coffee-script', 'bin', ...
#!/usr/bin/env python import os import subprocess import sys from lib.util import * SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__)) def main(): input_file = sys.argv[1] output_dir = os.path.dirname(sys.argv[2]) coffee = os.path.join(SOURCE_ROOT, 'node_modules', 'coffee-script', 'bin', ...
Fix running node from python.
[Win] Fix running node from python. There is a mysterious "WindowsError [error 5] Access is denied" error is the "executable" is not specified under Windows.
Python
mit
mjaniszew/electron,meowlab/electron,rreimann/electron,eriser/electron,tonyganch/electron,nicholasess/electron,wolfflow/electron,thingsinjars/electron,dongjoon-hyun/electron,rhencke/electron,Evercoder/electron,yan-foto/electron,mattdesl/electron,pirafrank/electron,nagyistoce/electron-atom-shell,bitemyapp/electron,Andrey...
--- +++ @@ -16,8 +16,11 @@ coffee = os.path.join(SOURCE_ROOT, 'node_modules', 'coffee-script', 'bin', 'coffee') - subprocess.check_call(['node', coffee, '-c', '-o', output_dir, input_file]) - + if sys.platform in ['win32', 'cygwin']: + subprocess.check_call(['node', coffee, '-c', '-...
785fcdca3c9bfb908444d3b9339457c616761f2c
tests/flights_to_test.py
tests/flights_to_test.py
import unittest import datetime import json import sys sys.path.append('..') import sabre_dev_studio import sabre_dev_studio.sabre_exceptions as sabre_exceptions ''' requires config.json in the same directory for api authentication { "sabre_client_id": -----, "sabre_client_secret": ----- } ''' class TestBasicInst...
import unittest import datetime import json import sys sys.path.append('..') import sabre_dev_studio import sabre_dev_studio.sabre_exceptions as sabre_exceptions ''' requires config.json in the same directory for api authentication { "sabre_client_id": -----, "sabre_client_secret": ----- } ''' class TestBasicFlig...
Change instaflights name in flights_to tests
Change instaflights name in flights_to tests
Python
mit
Jamil/sabre_dev_studio
--- +++ @@ -16,7 +16,7 @@ } ''' -class TestBasicInstaflights(unittest.TestCase): +class TestBasicFlightsTo(unittest.TestCase): def read_config(self): raw_data = open('config.json').read() @@ -36,8 +36,9 @@ def test_basic_request(self): city = 'YTO' - instaf = self.sds.flight...
d623ae9eed5fd8e558461de8bc52a83ff0a168af
recursive_remove_ltac.py
recursive_remove_ltac.py
import re __all__ = ["recursively_remove_ltac"] LTAC_REG = re.compile(r'^\s*(?:Local\s+|Global\s+)?Ltac\s+([^\s]+)', re.MULTILINE) def recursively_remove_ltac(statements, exclude_n=3): """Removes any Ltac statement which is not used later in statements. Does not remove any code in the last exclude_n sta...
import re __all__ = ["recursively_remove_ltac"] LTAC_REG = re.compile(r'^\s*(?:Local\s+|Global\s+)?Ltac\s+([^\s]+)', re.MULTILINE) def recursively_remove_ltac(statements, exclude_n=3): """Removes any Ltac statement which is not used later in statements. Does not remove any code in the last exclude_n sta...
Add a comment with a TODO
Add a comment with a TODO
Python
mit
JasonGross/coq-tools,JasonGross/coq-tools
--- +++ @@ -8,6 +8,9 @@ """Removes any Ltac statement which is not used later in statements. Does not remove any code in the last exclude_n statements.""" + # TODO(jgross): Figure out what the optimal exclude_n is. It's + # probably 1 or 2, but I don't want to accidentally exclude the + # li...
65f5695b90054f73d7119f0c50be51f61de777fa
tardis/tests/tests_slow/runner.py
tardis/tests/tests_slow/runner.py
import argparse import json import os import time import requests from tardis import __githash__ as tardis_githash parser = argparse.ArgumentParser(description="Run slow integration tests") parser.add_argument("--yaml", dest="yaml_filepath", help="Path to YAML config file for integration tests.")...
import argparse import datetime import json import os import time import requests from tardis import __githash__ as tardis_githash parser = argparse.ArgumentParser(description="Run slow integration tests") parser.add_argument("--yaml", dest="yaml_filepath", help="Path to YAML config file for inte...
Print the time of checking status at github.
Print the time of checking status at github.
Python
bsd-3-clause
kaushik94/tardis,orbitfold/tardis,kaushik94/tardis,orbitfold/tardis,orbitfold/tardis,kaushik94/tardis,orbitfold/tardis,kaushik94/tardis
--- +++ @@ -1,4 +1,5 @@ import argparse +import datetime import json import os import time @@ -33,4 +34,8 @@ os.system(test_command.format(args.yaml_filepath, args.atomic_dataset)) else: + checked = datetime.datetime.now() + pr...
0d38b9592fbb63e25b080d2f17b690c478042455
google-code-jam-2012/perfect-game/perfect-game.py
google-code-jam-2012/perfect-game/perfect-game.py
#!/usr/bin/env python import sys if len(sys.argv) < 2: sys.exit('Usage: %s file.in' % sys.argv[0]) file = open(sys.argv[1], 'r') T = int(file.readline()) for i in xrange(1, T+1): N = int(file.readline()) L = map(int, file.readline().split(' ')) P = map(int, file.readline().split(' ')) assert N == len(L)...
#!/usr/bin/env python # expected time per attempt is given by equation # time = L[0] + (1-P[0])*L[1] + (1-P[0])*(1-P[1])*L[2] + ... # where L is the expected time and P is the probability of failure, per level # swap two levels if L[i]*P[i+1] > L[i+1]*P[i] import sys if len(sys.argv) < 2: sys.exit('Usage: %s file....
Add comments to Perfect Game solution
Add comments to Perfect Game solution
Python
mit
robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles,robertdimarco/puzzles
--- +++ @@ -1,4 +1,9 @@ #!/usr/bin/env python + +# expected time per attempt is given by equation +# time = L[0] + (1-P[0])*L[1] + (1-P[0])*(1-P[1])*L[2] + ... +# where L is the expected time and P is the probability of failure, per level +# swap two levels if L[i]*P[i+1] > L[i+1]*P[i] import sys
93870690f17a4baddeb33549a1f6c67eeee1abe0
src/adhocracy/lib/tiles/util.py
src/adhocracy/lib/tiles/util.py
import logging from time import time from pylons import tmpl_context as c from adhocracy import config from adhocracy.lib.cache import memoize log = logging.getLogger(__name__) class BaseTile(object): ''' Base class for tiles ''' def render_tile(template_name, def_name, tile, cached=False, **kwargs):...
import logging from time import time from pylons import tmpl_context as c from adhocracy import config from adhocracy.lib.cache import memoize log = logging.getLogger(__name__) class BaseTile(object): ''' Base class for tiles ''' def render_tile(template_name, def_name, tile, cached=False, **kwargs):...
Increase cache tile duration from 6 hours to 1 week
Increase cache tile duration from 6 hours to 1 week
Python
agpl-3.0
alkadis/vcv,DanielNeugebauer/adhocracy,alkadis/vcv,phihag/adhocracy,DanielNeugebauer/adhocracy,phihag/adhocracy,alkadis/vcv,DanielNeugebauer/adhocracy,DanielNeugebauer/adhocracy,DanielNeugebauer/adhocracy,phihag/adhocracy,liqd/adhocracy,phihag/adhocracy,liqd/adhocracy,liqd/adhocracy,liqd/adhocracy,alkadis/vcv,alkadis/v...
--- +++ @@ -24,7 +24,7 @@ tile=tile, **kwargs) rendered = "" if cached and config.get_bool('adhocracy.cache_tiles'): - @memoize('tile_cache' + template_name + def_name, 86400 / 4) + @memoize('tile_cache' + template_name + def_name, 7 * 86400) def ...
4d247da1ecd39bcd699a55b5387412a1ac9e1582
txlege84/topics/management/commands/bootstraptopics.py
txlege84/topics/management/commands/bootstraptopics.py
from django.core.management.base import BaseCommand from topics.models import Topic class Command(BaseCommand): help = u'Bootstrap the topic lists in the database.' def handle(self, *args, **kwargs): self.load_topics() def load_topics(self): self.stdout.write(u'Loading hot list topics.....
from django.core.management.base import BaseCommand from topics.models import Topic class Command(BaseCommand): help = u'Bootstrap the topic lists in the database.' def handle(self, *args, **kwargs): self.load_topics() def load_topics(self): self.stdout.write(u'Loading hot list topics.....
Split Energy and Environment, change Civil Liberties to Social Justice
Split Energy and Environment, change Civil Liberties to Social Justice
Python
mit
texastribune/txlege84,texastribune/txlege84,texastribune/txlege84,texastribune/txlege84
--- +++ @@ -15,14 +15,15 @@ topics = [ u'Budget & Taxes', u'Business & Technology', - u'Civil Liberties', u'Criminal Justice', - u'Energy & Environment', + u'Energy', + u'Environment', u'Ethics', u'He...
fd8caec8567178abe09abc810f1e96bfc4bb531b
calc.py
calc.py
import sys def add_all(nums): return sum(nums) def multiply_all(nums): return reduce(lambda a, b: a * b, nums) if __name__== '__main__': command = sys.argv[1] nums = map(float, sys.argv[2:]) if command == 'add': print(add_all(nums)) elif command == 'multiply': print(multiply_all(sums))
import sys def add_all(nums): return sum(nums) def multiply_all(nums): return reduce(lambda a, b: a * b, nums) if __name__== '__main__': command = sys.argv[1] nums = map(float, sys.argv[2:]) if command == 'add': print(add_all(nums)) elif command == 'multiply': print(multiply_all(nums))
Fix bug in 'multiply' support
Fix bug in 'multiply' support
Python
bsd-3-clause
tanecious/calc
--- +++ @@ -12,4 +12,4 @@ if command == 'add': print(add_all(nums)) elif command == 'multiply': - print(multiply_all(sums)) + print(multiply_all(nums))
5c5de666e86d6f2627df79762b0e3b0f188861d4
scripts/claim_vlan.py
scripts/claim_vlan.py
import MySQLdb from datetime import datetime, timedelta db = MySQLdb.connect(host="10.0.196.2", user="ciuser", passwd="secret", db="ciresources") cur = db.cursor() f = '%Y-%m-%d %H:%M:%S' three_hours_ago_dt = datetime.utcnow() - timedelta(hours=3) three_...
import MySQLdb from datetime import datetime, timedelta db = MySQLdb.connect(host="10.0.196.2", user="ciuser", passwd="secret", db="ciresources") cur = db.cursor() f = '%Y-%m-%d %H:%M:%S' three_hours_ago_dt = datetime.utcnow() - timedelta(hours=3) three_...
Fix timestamp comparison on ciresources
Fix timestamp comparison on ciresources
Python
apache-2.0
CiscoSystems/project-config-third-party,CiscoSystems/project-config-third-party
--- +++ @@ -12,7 +12,7 @@ three_hours_ago_dt = datetime.utcnow() - timedelta(hours=3) three_hours_ago = three_hours_ago_dt.strftime(f) -cur.execute("SELECT * FROM vlans WHERE locked!=true OR timestamp > '%s' LIMIT 1 FOR UPDATE" % three_hours_ago) +cur.execute("SELECT * FROM vlans WHERE locked!=true OR timestamp<'...
224abc99becc1683605a6dc5c3460510efef3efb
tests/test_pyserial.py
tests/test_pyserial.py
from __future__ import (absolute_import, print_function, unicode_literals) import os import sys lib_path = os.path.abspath('../') sys.path.append(lib_path) import io import struct import unittest import threading import time import serial try: import unittest2 as unittest except ImportError: import unittest ...
from __future__ import (absolute_import, print_function, unicode_literals) import os import sys lib_path = os.path.abspath('../') sys.path.append(lib_path) import io import struct import unittest import threading import time import serial try: import unittest2 as unittest except ImportError: import unittest ...
Comment out the pyserial TestIsCorrectVariant test.
Comment out the pyserial TestIsCorrectVariant test.
Python
agpl-3.0
Jnesselr/s3g,makerbot/s3g,Jnesselr/s3g,makerbot/s3g,makerbot/s3g,makerbot/s3g
--- +++ @@ -27,7 +27,8 @@ import serial.tools.list_ports as lp scan = lp.list_ports_by_vid_pid - + ''' + # This test is commented out because it requires an actual serial port. def test_variantDoesBlocking(self): #grab a port #try to grab it again @@ -43,6 +44,7 @@ s = serial.Seria...
e716a71bad4e02410e2a0908d630abbee1d4c691
django/contrib/admin/__init__.py
django/contrib/admin/__init__.py
from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL from django.contrib.admin.options import StackedInline, TabularInline from django.contrib.admin.sites import AdminSite, site def autodiscover(): """ Auto-discover INSTALLED_APPS admin.py modules and fail silently when not present. T...
# ACTION_CHECKBOX_NAME is unused, but should stay since its import from here # has been referenced in documentation. from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL from django.contrib.admin.options import StackedInline, TabularInli...
Revert the removal of an unused import (in [14175]) that was referenced in documentation. Thanks for noticing, clong.
Revert the removal of an unused import (in [14175]) that was referenced in documentation. Thanks for noticing, clong. git-svn-id: 4f9f921b081c523744c7bf24d959a0db39629563@14359 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Python
bsd-3-clause
schinckel/django,DasIch/django,coldmind/django,rwillmer/django,jpic/django,techdragon/django,abomyi/django,EmadMokhtar/Django,koniiiik/django,auvipy/django,elkingtonmcb/django,Balachan27/django,jscn/django,darkryder/django,lunafeng/django,sergei-maertens/django,Leila20/django,chyeh727/django,huang4fstudio/django,saydul...
--- +++ @@ -1,3 +1,6 @@ +# ACTION_CHECKBOX_NAME is unused, but should stay since its import from here +# has been referenced in documentation. +from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL from django.contrib.admin.options im...
0d7add686605d9d86e688f9f65f617555282ab60
opwen_email_server/backend/email_sender.py
opwen_email_server/backend/email_sender.py
from typing import Tuple from opwen_email_server import azure_constants as constants from opwen_email_server import config from opwen_email_server.services.queue import AzureQueue from opwen_email_server.services.sendgrid import SendgridEmailSender QUEUE = AzureQueue(account=config.QUEUES_ACCOUNT, key=config.QUEUES_K...
from typing import Tuple from opwen_email_server import azure_constants as constants from opwen_email_server import config from opwen_email_server.services.queue import AzureQueue from opwen_email_server.services.sendgrid import SendgridEmailSender QUEUE = AzureQueue(account=config.QUEUES_ACCOUNT, key=config.QUEUES_K...
Add debugging CLI hook for email sending
Add debugging CLI hook for email sending
Python
apache-2.0
ascoderu/opwen-cloudserver,ascoderu/opwen-cloudserver
--- +++ @@ -18,3 +18,18 @@ return 'error', 500 return 'sent', 200 + + +if __name__ == '__main__': + from argparse import ArgumentParser + from json import loads + from uuid import uuid4 + + parser = ArgumentParser() + parser.add_argument('email') + args = parser.parse_args() + + e...
cc6c80ad64fe7f4d4cb2b4e367c595f1b08f9d3b
i3blocks-sonos.py
i3blocks-sonos.py
#!/usr/bin/env python3 # # By Henrik Lilleengen (mail@ithenrik.com) # # Released under the MIT License: https://opensource.org/licenses/MIT import soco, sys speakers = list(soco.discover()) state = speakers[0].get_current_transport_info()['current_transport_state'] if state == 'PLAYING': if len(sys.argv) > 1 a...
#!/usr/bin/env python3 # # By Henrik Lilleengen (mail@ithenrik.com) # # Released under the MIT License: https://opensource.org/licenses/MIT import soco, sys speakers = list(soco.discover()) if len(speakers) > 0: state = speakers[0].get_current_transport_info()['current_transport_state'] if state == 'PLAYING...
Remove script crash when no sonos is found
Remove script crash when no sonos is found
Python
mit
Lilleengen/i3blocks-sonos
--- +++ @@ -8,20 +8,20 @@ speakers = list(soco.discover()) +if len(speakers) > 0: + state = speakers[0].get_current_transport_info()['current_transport_state'] -state = speakers[0].get_current_transport_info()['current_transport_state'] - -if state == 'PLAYING': - if len(sys.argv) > 1 and sys.argv[1] == ...
ce48ef985a8e79d0cd636abf2116917fde24d6d2
candidates/tests/test_posts_view.py
candidates/tests/test_posts_view.py
from __future__ import unicode_literals from django_webtest import WebTest from .uk_examples import UK2015ExamplesMixin class TestPostsView(UK2015ExamplesMixin, WebTest): def setUp(self): super(TestPostsView, self).setUp() def test_single_election_posts_page(self): response = self.app.get...
from __future__ import unicode_literals from django_webtest import WebTest from .uk_examples import UK2015ExamplesMixin class TestPostsView(UK2015ExamplesMixin, WebTest): def test_single_election_posts_page(self): response = self.app.get('/posts') self.assertTrue( response.html.fi...
Remove an unnecessary method override
Remove an unnecessary method override
Python
agpl-3.0
DemocracyClub/yournextrepresentative,mysociety/yournextrepresentative,mysociety/yournextmp-popit,mysociety/yournextrepresentative,neavouli/yournextrepresentative,DemocracyClub/yournextrepresentative,mysociety/yournextrepresentative,DemocracyClub/yournextrepresentative,mysociety/yournextrepresentative,neavouli/yournextr...
--- +++ @@ -6,9 +6,6 @@ class TestPostsView(UK2015ExamplesMixin, WebTest): - - def setUp(self): - super(TestPostsView, self).setUp() def test_single_election_posts_page(self):
014925aa73e85fe3cb0d939a3d5d9c30424e32b4
func.py
func.py
# PyArt by MohamadKh75 # 2017-10-05 # ******************** from pathlib import Path # Set the Alphabet folder path folder_path = Path("Alphabet").resolve() # Read all Capital Letters - AA is Capital A def letter_reader(letter): # if it's Capital - AA is Capital A if 65 <= ord(letter) <= 90: letter_...
# PyArt by MohamadKh75 # 2017-10-05 # ******************** from pathlib import Path # Set the Alphabet folder path folder_path = Path("Alphabet").resolve() # Read all Capital Letters - AA is Capital A def letter_reader(letter): # if it's Capital - AA is Capital A if 65 <= ord(letter) <= 90: letter_...
Add Numbers and Symbols Exception
Add Numbers and Symbols Exception
Python
mit
MohamadKh75/Arthon
--- +++ @@ -21,10 +21,11 @@ letter_file = open(str(folder_path) + str("\\") + str(letter) + ".txt", 'r') letter_txt = letter_file.read() - # if it's symbol + # if it's symbol or number - NOT SUPPORTED in Ver. 1.0 else: - letter_file = open(str(folder_path) + str("\\") + str(lette...
374981fd60c0116e861d598eec763cc2b8165189
cs251tk/common/check_submit_date.py
cs251tk/common/check_submit_date.py
import os from dateutil.parser import parse from ..common import run, chdir def check_dates(spec_id, username, spec, basedir): """ Port of the CheckDates program from C++ Finds the first submission date for an assignment by comparing first commits for all files in the spec and ret...
import os from dateutil.parser import parse from ..common import run, chdir def check_dates(spec_id, username, spec, basedir): """ Port of the CheckDates program from C++ Finds the first submission date for an assignment by comparing first commits for all files in the spec and ret...
Add -- to git log call
Add -- to git log call
Python
mit
StoDevX/cs251-toolkit,StoDevX/cs251-toolkit,StoDevX/cs251-toolkit,StoDevX/cs251-toolkit
--- +++ @@ -16,7 +16,7 @@ for file in spec['files']: # Run a git log on each file with earliest commits listed first - status, res, _ = run(['git', 'log', '--reverse', '--pretty=format:%ad', '--date=iso8601', + status, res, _ = run(['git', 'log', '--reverse', '--pretty=fo...
f0e29748ff899d7e65d1f4169e890d3e3c4bda0e
icekit/project/settings/_test.py
icekit/project/settings/_test.py
from ._base import * # DJANGO ###################################################################### DATABASE_NAME = 'test_%s' % DATABASES['default']['NAME'] DATABASES = { 'default': { 'NAME': DATABASE_NAME, 'TEST': { 'NAME': DATABASE_NAME, # See: https://docs.djangoprojec...
from ._base import * # DJANGO ###################################################################### DATABASE_NAME = 'test_%s' % DATABASES['default']['NAME'] DATABASES['default'].update({ 'NAME': DATABASE_NAME, 'TEST': { 'NAME': DATABASE_NAME, # See: https://docs.djangoproject.com/en/1.7/ref/...
Update instead of overriding `DATABASES` setting in `test` settings.
Update instead of overriding `DATABASES` setting in `test` settings.
Python
mit
ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit
--- +++ @@ -4,16 +4,14 @@ DATABASE_NAME = 'test_%s' % DATABASES['default']['NAME'] -DATABASES = { - 'default': { +DATABASES['default'].update({ + 'NAME': DATABASE_NAME, + 'TEST': { 'NAME': DATABASE_NAME, - 'TEST': { - 'NAME': DATABASE_NAME, - # See: https://docs.dja...
e637e5f53990709ed654b661465685ad9d05a182
api/spawner/templates/constants.py
api/spawner/templates/constants.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function from django.conf import settings JOB_NAME = 'plxjob-{task_type}{task_idx}-{experiment_uuid}' DEFAULT_PORT = 2222 ENV_VAR_TEMPLATE = '{name: "{var_name}", value: "{var_value}"}' VOLUME_NAME = 'pv-{vol_name}' VOLUME_CLAIM_NAME = 'p...
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function from django.conf import settings JOB_NAME = 'plxjob-{task_type}{task_idx}-{experiment_uuid}' DEFAULT_PORT = 2222 ENV_VAR_TEMPLATE = '{name: "{var_name}", value: "{var_value}"}' VOLUME_NAME = 'pv-{vol_name}' VOLUME_CLAIM_NAME = 'p...
Update cluster config map key format
Update cluster config map key format
Python
apache-2.0
polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon
--- +++ @@ -9,7 +9,7 @@ VOLUME_NAME = 'pv-{vol_name}' VOLUME_CLAIM_NAME = 'pvc-{vol_name}' CLUSTER_CONFIG_MAP_NAME = 'plxcluster-{experiment_uuid}' -CLUSTER_CONFIG_MAP_KEY_NAME = 'plxcluster_{experiment_uuid}_{task_type}' +CLUSTER_CONFIG_MAP_KEY_NAME = 'plxcluster_{task_type}' POD_CONTAINER_PROJECT_NAME = 'plxpro...
70d009834123cb5a10788763fed3193017cc8162
libpebble2/__init__.py
libpebble2/__init__.py
__author__ = 'katharine' from .exceptions import *
__author__ = 'katharine' import logging from .exceptions import * logging.getLogger('libpebble2').addHandler(logging.NullHandler())
Add a default null logger per python recommendations.
Add a default null logger per python recommendations.
Python
mit
pebble/libpebble2
--- +++ @@ -1,3 +1,7 @@ __author__ = 'katharine' +import logging + from .exceptions import * + +logging.getLogger('libpebble2').addHandler(logging.NullHandler())
60156236836944205f3993badcf179aaa6e7ae54
ehriportal/portal/api/handlers.py
ehriportal/portal/api/handlers.py
""" Piston handlers for notable resources. """ from piston.handler import BaseHandler from portal import models class RepositoryHandler(BaseHandler): model = models.Repository class CollectionHandler(BaseHandler): model = models.Collection class PlaceHandler(BaseHandler): model = models.Place clas...
""" Piston handlers for notable resources. """ from piston.handler import BaseHandler from portal import models class ResourceHandler(BaseHandler): model = models.Resource class RepositoryHandler(BaseHandler): model = models.Repository class CollectionHandler(BaseHandler): model = models.Collection ...
Add an (unexposed) ResourceHandler so inheriting objects serialise better
Add an (unexposed) ResourceHandler so inheriting objects serialise better
Python
mit
mikesname/ehri-collections,mikesname/ehri-collections,mikesname/ehri-collections
--- +++ @@ -6,6 +6,8 @@ from piston.handler import BaseHandler from portal import models +class ResourceHandler(BaseHandler): + model = models.Resource class RepositoryHandler(BaseHandler): model = models.Repository
51f4d40cf6750d35f10f37d939a2c30c5f26d300
backend/scripts/updatedf.py
backend/scripts/updatedf.py
#!/usr/bin/env python #import hashlib import os def main(): for root, dirs, files in os.walk("/mcfs/data/materialscommons"): for f in files: print f if __name__ == "__main__": main()
#!/usr/bin/env python import hashlib import os import rethinkdb as r def main(): conn = r.connect('localhost', 28015, db='materialscommons') for root, dirs, files in os.walk("/mcfs/data/materialscommons"): for f in files: path = os.path.join(root, f) with open(path) as fd: ...
Update script to write results to the database.
Update script to write results to the database.
Python
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
--- +++ @@ -1,12 +1,20 @@ #!/usr/bin/env python -#import hashlib +import hashlib import os +import rethinkdb as r def main(): + conn = r.connect('localhost', 28015, db='materialscommons') for root, dirs, files in os.walk("/mcfs/data/materialscommons"): for f in files: - print f + ...
923d49c753acf7d8945d6b79efbdb08363e130a2
noseprogressive/tests/test_utils.py
noseprogressive/tests/test_utils.py
from os import chdir, getcwd from os.path import dirname, basename from unittest import TestCase from nose.tools import eq_ from noseprogressive.utils import human_path, frame_of_test class UtilsTests(TestCase): """Tests for independent little bits and pieces""" def test_human_path(self): chdir(dir...
from os import chdir, getcwd from os.path import dirname, basename from unittest import TestCase from nose.tools import eq_ from noseprogressive.utils import human_path, frame_of_test class UtilsTests(TestCase): """Tests for independent little bits and pieces""" def test_human_path(self): chdir(dir...
Bring test_frame_of_test_null_file up to date with new signature of frame_of_test().
Bring test_frame_of_test_null_file up to date with new signature of frame_of_test().
Python
mit
pmclanahan/pytest-progressive,erikrose/nose-progressive,veo-labs/nose-progressive,olivierverdier/nose-progressive
--- +++ @@ -17,6 +17,7 @@ def test_frame_of_test_null_file(self): """Make sure frame_of_test() doesn't crash when test_file is None.""" try: - frame_of_test((None, None, None), [('file', 333)]) + frame_of_test((None, None, None), NotImplementedError, + ...
e6af9d901f26fdf779a6a13319face483fe48a3b
dwitter/dweet/views.py
dwitter/dweet/views.py
from django.shortcuts import get_object_or_404, render from django.http import HttpResponseRedirect, HttpResponse, Http404 from django.core.urlresolvers import reverse from django.contrib.auth.decorators import login_required from dwitter.models import Dweet def fullscreen_dweet(request, dweet_id): dweet = get_obje...
from django.shortcuts import get_object_or_404, render from django.http import HttpResponseRedirect, HttpResponse, Http404 from django.core.urlresolvers import reverse from django.contrib.auth.decorators import login_required from dwitter.models import Dweet from django.views.decorators.clickjacking import xframe_opti...
Disable clickjacking protection on demos to display them in iframes
Disable clickjacking protection on demos to display them in iframes
Python
apache-2.0
lionleaf/dwitter,lionleaf/dwitter,lionleaf/dwitter
--- +++ @@ -4,7 +4,10 @@ from django.contrib.auth.decorators import login_required from dwitter.models import Dweet +from django.views.decorators.clickjacking import xframe_options_exempt + +@xframe_options_exempt def fullscreen_dweet(request, dweet_id): dweet = get_object_or_404(Dweet, id=dweet_id)
d16373609b2f30c6ffa576c1269c529f12c9622c
backend/uclapi/timetable/urls.py
backend/uclapi/timetable/urls.py
from django.conf.urls import url from . import views urlpatterns = [ url(r'^personal_fast$', views.get_personal_timetable_fast), url(r'^personal$', views.get_personal_timetable), url(r'^bymodule$', views.get_modules_timetable), ]
from django.conf.urls import url from . import views urlpatterns = [ url(r'^personal$', views.get_personal_timetable_fast), url(r'^bymodule$', views.get_modules_timetable), ]
Switch to fast method for personal timetable
Switch to fast method for personal timetable
Python
mit
uclapi/uclapi,uclapi/uclapi,uclapi/uclapi,uclapi/uclapi
--- +++ @@ -3,7 +3,6 @@ from . import views urlpatterns = [ - url(r'^personal_fast$', views.get_personal_timetable_fast), - url(r'^personal$', views.get_personal_timetable), + url(r'^personal$', views.get_personal_timetable_fast), url(r'^bymodule$', views.get_modules_timetable), ]
0812ec319291b709613152e9e1d781671047a428
config.py
config.py
import os SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL'] ACCESS_TOKEN = os.environ['ACCESS_TOKEN'] PAGE_ID = os.environ['PAGE_ID'] APP_ID = os.environ['APP_ID'] VERIFY_TOKEN = os.environ['VERIFY_TOKEN']
import os SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL', 'sqlite://') ACCESS_TOKEN = os.environ.get('ACCESS_TOKEN') PAGE_ID = os.environ.get('PAGE_ID') APP_ID = os.environ.get('APP_ID') VERIFY_TOKEN = os.environ.get('VERIFY_TOKEN')
Make server ignore missing environment variables
Make server ignore missing environment variables This is by far the best solution for setup, CI and testing purposes.
Python
mit
Stark-Mountain/meetup-facebook-bot,Stark-Mountain/meetup-facebook-bot
--- +++ @@ -1,8 +1,8 @@ import os -SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL'] +SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL', 'sqlite://') -ACCESS_TOKEN = os.environ['ACCESS_TOKEN'] -PAGE_ID = os.environ['PAGE_ID'] -APP_ID = os.environ['APP_ID'] -VERIFY_TOKEN = os.environ['VERIFY_TOKEN'] +ACC...
d7e03596f8bf1e886e984c0ea98334af878a15e2
meta/bytecodetools/print_code.py
meta/bytecodetools/print_code.py
''' Created on May 10, 2012 @author: sean ''' from .bytecode_consumer import ByteCodeConsumer from argparse import ArgumentParser class ByteCodePrinter(ByteCodeConsumer): def generic_consume(self, instr): print instr def main(): parser = ArgumentParser() parser.add_argument() if __name__ ==...
''' Created on May 10, 2012 @author: sean ''' from __future__ import print_function from .bytecode_consumer import ByteCodeConsumer from argparse import ArgumentParser class ByteCodePrinter(ByteCodeConsumer): def generic_consume(self, instr): print(instr) def main(): parser = ArgumentParser() ...
Use __future__.print_function so syntax is valid on Python 3
Use __future__.print_function so syntax is valid on Python 3
Python
bsd-3-clause
enthought/Meta,gutomaia/Meta
--- +++ @@ -3,13 +3,15 @@ @author: sean ''' +from __future__ import print_function + from .bytecode_consumer import ByteCodeConsumer from argparse import ArgumentParser class ByteCodePrinter(ByteCodeConsumer): def generic_consume(self, instr): - print instr + print(instr) def main...
ca5c3648ad5f28090c09ecbbc0e008c51a4ce708
bin/push/silent_ios_push.py
bin/push/silent_ios_push.py
import json import logging import argparse import emission.net.ext_service.push.notify_usage as pnu if __name__ == '__main__': logging.basicConfig(level=logging.DEBUG) parser = argparse.ArgumentParser(prog="silent_ios_push") parser.add_argument("interval", help="specify the sync interval that the ...
import json import logging import argparse import emission.net.ext_service.push.notify_usage as pnu if __name__ == '__main__': logging.basicConfig(level=logging.DEBUG) parser = argparse.ArgumentParser(prog="silent_ios_push") parser.add_argument("interval", help="specify the sync interval that the ...
Add a new dev (optional) parameter and use it
Add a new dev (optional) parameter and use it Actually use the functionality in 78e2efd09d61c2abee95590aa637a64fa0618896
Python
bsd-3-clause
sunil07t/e-mission-server,shankari/e-mission-server,shankari/e-mission-server,shankari/e-mission-server,shankari/e-mission-server,sunil07t/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,sunil07t/e-mission-server,sunil07t/e-mission-server,e-mission/e-mission-server
--- +++ @@ -10,8 +10,9 @@ parser.add_argument("interval", help="specify the sync interval that the phones have subscribed to", type=int) + parser.add_argument("-d", "--dev", action="store_true", default=False) args = parser.parse_args() logging.debug("About to send notification t...
21149eb8d128c405d0b69991d1855e99ced951c7
ExperimentsManager/tests.py
ExperimentsManager/tests.py
from django.test import TestCase from .models import Experiment from UserManager.models import WorkbenchUser from django.contrib.auth.models import User from django.test import Client class ExperimentTestCase(TestCase): def setUp(self): self.user = User.objects.create_user('test', 'test@test.nl', 'test') ...
from django.test import TestCase from .models import Experiment from UserManager.models import WorkbenchUser from django.contrib.auth.models import User from django.test import Client class ExperimentTestCase(TestCase): def setUp(self): self.user = User.objects.create_user('test', 'test@test.nl', 'test') ...
Test fixed: WorkbenchUser is auto created by signal, so creating it separately is not required
Test fixed: WorkbenchUser is auto created by signal, so creating it separately is not required
Python
mit
MOOCworkbench/MOOCworkbench,MOOCworkbench/MOOCworkbench,MOOCworkbench/MOOCworkbench
--- +++ @@ -8,7 +8,7 @@ class ExperimentTestCase(TestCase): def setUp(self): self.user = User.objects.create_user('test', 'test@test.nl', 'test') - self.workbench_user = WorkbenchUser.objects.create(netid='jlmdegoede', user=self.user) + self.workbench_user = WorkbenchUser.objects.get(user...
32e83559e00b7d5a363585d599cd087af854c445
chainer/links/loss/crf1d.py
chainer/links/loss/crf1d.py
from chainer.functions.loss import crf1d from chainer import link from chainer import variable class CRF1d(link.Link): """Linear-chain conditional random field loss layer. This link wraps the :func:`~chainer.functions.crf1d` function. It holds a transition cost matrix as a parameter. Args: ...
from chainer.functions.loss import crf1d from chainer import link from chainer import variable class CRF1d(link.Link): """Linear-chain conditional random field loss layer. This link wraps the :func:`~chainer.functions.crf1d` function. It holds a transition cost matrix as a parameter. Args: ...
Support custom initializer in links.CRF1d
Support custom initializer in links.CRF1d
Python
mit
keisuke-umezawa/chainer,hvy/chainer,okuta/chainer,niboshi/chainer,niboshi/chainer,okuta/chainer,chainer/chainer,chainer/chainer,keisuke-umezawa/chainer,keisuke-umezawa/chainer,okuta/chainer,pfnet/chainer,tkerola/chainer,wkentaro/chainer,chainer/chainer,okuta/chainer,hvy/chainer,niboshi/chainer,hvy/chainer,chainer/chain...
--- +++ @@ -19,10 +19,11 @@ cost (~chainer.Variable): Transition cost parameter. """ - def __init__(self, n_label): + def __init__(self, n_label, initialW=0): super(CRF1d, self).__init__() with self.init_scope(): - self.cost = variable.Parameter(0, (n_label, n_label)...
8214d516b3feba92ab3ad3b1f2fa1cf253e83012
pyexcel/internal/__init__.py
pyexcel/internal/__init__.py
""" pyexcel.internal ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Pyexcel internals that subjected to change :copyright: (c) 2015-2017 by Onni Software Ltd. :license: New BSD License """ from lml.loader import scan_plugins from pyexcel.internal.plugins import PARSER, RENDERER # noqa from pyexcel.int...
""" pyexcel.internal ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Pyexcel internals that subjected to change :copyright: (c) 2015-2017 by Onni Software Ltd. :license: New BSD License """ from lml.loader import scan_plugins from pyexcel.internal.plugins import PARSER, RENDERER # noqa from pyexcel.int...
Remove use of deprecated `scan_plugins` method
Remove use of deprecated `scan_plugins` method `scan_plugins` has been deprecated in favour of `scan_plugins_regex`. This is causing warnings to be logged. The new method takes a regular expression as its first argument, rather than a simple prefix string. This commit adds a regular expression which does the s...
Python
bsd-3-clause
chfw/pyexcel,chfw/pyexcel
--- +++ @@ -30,4 +30,4 @@ ] -scan_plugins("pyexcel_", "pyexcel", BLACK_LIST, WHITE_LIST) +scan_plugins_regex("^pyexcel_.+$", "pyexcel", BLACK_LIST, WHITE_LIST)
a23a1050501563889c2806a514fe2994a2ebe3a8
example/consume_many_csv_files.py
example/consume_many_csv_files.py
from __future__ import print_function from itertools import chain from itertools import imap import karld from karld.path import i_walk_csv_paths def main(): """ Consume many csv files as if one. """ import pathlib input_dir = pathlib.Path('test_data/things_kinds') # # Use a generator expr...
from __future__ import print_function from itertools import chain try: from itertools import imap except ImportError: # if python 3 imap = map import karld from karld.path import i_walk_csv_paths def main(): """ Consume many csv files as if one. """ import pathlib input_dir = pathl...
Add python3 support in example
Add python3 support in example
Python
apache-2.0
johnwlockwood/stream_tap,johnwlockwood/karl_data,johnwlockwood/stream_tap,johnwlockwood/iter_karld_tools
--- +++ @@ -1,6 +1,11 @@ from __future__ import print_function from itertools import chain -from itertools import imap + +try: + from itertools import imap +except ImportError: + # if python 3 + imap = map import karld
29384b927b620b7e943343409f62511451bb3059
neupy/algorithms/memory/utils.py
neupy/algorithms/memory/utils.py
from numpy import where __all__ = ('sign2bin', 'bin2sign', 'hopfield_energy') def sign2bin(matrix): return where(matrix == 1, 1, 0) def bin2sign(matrix): return where(matrix == 0, -1, 1) def hopfield_energy(weight, input_data, output_data): energy_output = -0.5 * input_data.dot(weight).dot(output_da...
from numpy import where, inner from numpy.core.umath_tests import inner1d __all__ = ('sign2bin', 'bin2sign', 'hopfield_energy') def sign2bin(matrix): return where(matrix == 1, 1, 0) def bin2sign(matrix): return where(matrix == 0, -1, 1) def hopfield_energy(weight, input_data, output_data): return -0...
Fix problem with Hopfield energy function for Python 2.7
Fix problem with Hopfield energy function for Python 2.7
Python
mit
stczhc/neupy,stczhc/neupy,itdxer/neupy,itdxer/neupy,stczhc/neupy,stczhc/neupy,itdxer/neupy,itdxer/neupy
--- +++ @@ -1,4 +1,5 @@ -from numpy import where +from numpy import where, inner +from numpy.core.umath_tests import inner1d __all__ = ('sign2bin', 'bin2sign', 'hopfield_energy') @@ -13,5 +14,4 @@ def hopfield_energy(weight, input_data, output_data): - energy_output = -0.5 * input_data.dot(weight).dot(ou...
bf28376f252fd474d594e5039d0b2f2bb1afc26a
IPython/frontend.py
IPython/frontend.py
import sys import types class ShimModule(types.ModuleType): def __getattribute__(self, key): exec 'from IPython import %s' % key return eval(key) sys.modules['IPython.frontend'] = ShimModule('frontend')
""" Shim to maintain backwards compatibility with old frontend imports. We have moved all contents of the old `frontend` subpackage into top-level subpackages (`html`, `qt` and `terminal`). This will let code that was making `from IPython.frontend...` calls continue working, though a warning will be printed. """ #--...
Add proper warnings on use of the backwards compatibility shim.
Add proper warnings on use of the backwards compatibility shim.
Python
bsd-3-clause
ipython/ipython,ipython/ipython
--- +++ @@ -1,11 +1,51 @@ +""" +Shim to maintain backwards compatibility with old frontend imports. + +We have moved all contents of the old `frontend` subpackage into top-level +subpackages (`html`, `qt` and `terminal`). This will let code that was making +`from IPython.frontend...` calls continue working, though a...
981a74b116081f3ce1d97262c3c88104a953cdf4
saau/sections/misc/header.py
saau/sections/misc/header.py
import matplotlib.pyplot as plt from operator import gt, lt, itemgetter from lxml.etree import fromstring, XMLSyntaxError def frange(start, stop, step): cur = start op = gt if start > stop else lt while op(cur, stop): yield cur cur += step def parse_lines(lines): for line in lines: ...
import matplotlib.pyplot as plt from operator import itemgetter from lxml.etree import fromstring, XMLSyntaxError import numpy as np def parse_lines(lines): for line in lines: try: xml_line = fromstring(line.encode('utf-8')) except XMLSyntaxError: attrs = [] else:...
Use numpy's float supporting range
Use numpy's float supporting range
Python
mit
Mause/statistical_atlas_of_au
--- +++ @@ -1,15 +1,9 @@ import matplotlib.pyplot as plt -from operator import gt, lt, itemgetter +from operator import itemgetter from lxml.etree import fromstring, XMLSyntaxError +import numpy as np -def frange(start, stop, step): - cur = start - op = gt if start > stop else lt - - while op(cur, stop...
f4bbb244716f9471b520f53ebffaf34a31503cd1
Web/scripts/CPWeb/__init__.py
Web/scripts/CPWeb/__init__.py
""" CPWeb - A collection of commonly used routines to produce CoolProp's online documentation ===== """ from __future__ import division, absolute_import, print_function import codecs import csv import cStringIO def get_version(): return 5.0 if __name__ == "__main__": print('You are using version %s of the...
""" CPWeb - A collection of commonly used routines to produce CoolProp's online documentation ===== """ from __future__ import division, absolute_import, print_function def get_version(): return 5.0 if __name__ == "__main__": print('You are using version %s of the Python package for creating CoolProp\' onli...
Remove unused imports (besides they are Py 2.x only)
Remove unused imports (besides they are Py 2.x only)
Python
mit
CoolProp/CoolProp,CoolProp/CoolProp,henningjp/CoolProp,henningjp/CoolProp,CoolProp/CoolProp,CoolProp/CoolProp,CoolProp/CoolProp,henningjp/CoolProp,henningjp/CoolProp,henningjp/CoolProp,henningjp/CoolProp,henningjp/CoolProp,CoolProp/CoolProp,CoolProp/CoolProp,henningjp/CoolProp,CoolProp/CoolProp
--- +++ @@ -4,11 +4,6 @@ """ from __future__ import division, absolute_import, print_function - -import codecs -import csv -import cStringIO - def get_version(): return 5.0
37ab58016e69993b5ab1d63c99d9afcf54bd95af
fireplace/cards/tgt/neutral_epic.py
fireplace/cards/tgt/neutral_epic.py
from ..utils import * ## # Minions # Kodorider class AT_099: inspire = Summon(CONTROLLER, "AT_099t")
from ..utils import * ## # Minions # Twilight Guardian class AT_017: play = HOLDING_DRAGON & Buff(SELF, "AT_017e") # Sideshow Spelleater class AT_098: play = Summon(CONTROLLER, Copy(ENEMY_HERO_POWER)) # Kodorider class AT_099: inspire = Summon(CONTROLLER, "AT_099t") # Master of Ceremonies class AT_117: pla...
Implement more TGT Neutral Epics
Implement more TGT Neutral Epics
Python
agpl-3.0
Meerkov/fireplace,Ragowit/fireplace,oftc-ftw/fireplace,liujimj/fireplace,oftc-ftw/fireplace,smallnamespace/fireplace,Ragowit/fireplace,Meerkov/fireplace,liujimj/fireplace,amw2104/fireplace,beheh/fireplace,amw2104/fireplace,NightKev/fireplace,smallnamespace/fireplace,jleclanche/fireplace
--- +++ @@ -4,6 +4,31 @@ ## # Minions +# Twilight Guardian +class AT_017: + play = HOLDING_DRAGON & Buff(SELF, "AT_017e") + + +# Sideshow Spelleater +class AT_098: + play = Summon(CONTROLLER, Copy(ENEMY_HERO_POWER)) + + # Kodorider class AT_099: inspire = Summon(CONTROLLER, "AT_099t") + + +# Master of Ceremon...
dfe1213ba9de5e5e5aaf9690a2cf5e3b295869fa
examples/graph/degree_sequence.py
examples/graph/degree_sequence.py
#!/usr/bin/env python """ Random graph from given degree sequence. """ __author__ = """Aric Hagberg (hagberg@lanl.gov)""" __date__ = "$Date: 2004-11-03 08:11:09 -0700 (Wed, 03 Nov 2004) $" __credits__ = """""" __revision__ = "$Revision: 503 $" # Copyright (C) 2004 by # Aric Hagberg <hagberg@lanl.gov> # Dan Sc...
#!/usr/bin/env python """ Random graph from given degree sequence. """ __author__ = """Aric Hagberg (hagberg@lanl.gov)""" __date__ = "$Date: 2004-11-03 08:11:09 -0700 (Wed, 03 Nov 2004) $" __credits__ = """""" __revision__ = "$Revision: 503 $" # Copyright (C) 2004 by # Aric Hagberg <hagberg@lanl.gov> # Dan Sc...
Remove Python 3 incompatible print statement
Remove Python 3 incompatible print statement
Python
bsd-3-clause
RMKD/networkx,jakevdp/networkx,JamesClough/networkx,jni/networkx,harlowja/networkx,debsankha/networkx,andnovar/networkx,tmilicic/networkx,ghdk/networkx,goulu/networkx,RMKD/networkx,dmoliveira/networkx,beni55/networkx,chrisnatali/networkx,wasade/networkx,nathania/networkx,jakevdp/networkx,blublud/networkx,kernc/networkx...
--- +++ @@ -16,7 +16,7 @@ from networkx import * z=[5,3,3,3,3,2,2,2,1,1,1] -print is_valid_degree_sequence(z) +print(is_valid_degree_sequence(z)) print("Configuration model") G=configuration_model(z) # configuration model @@ -32,5 +32,3 @@ print("degree #nodes") for d in hist: print('%d %d' % (d,hist[...
b3ddba27c92f36ee9534903b43ff632daa148585
froide/publicbody/search_indexes.py
froide/publicbody/search_indexes.py
from django.conf import settings from haystack import indexes from haystack import site from publicbody.models import PublicBody from helper.searchindex import QueuedRealTimeSearchIndex PUBLIC_BODY_BOOSTS = getattr(settings, "FROIDE_PUBLIC_BODY_BOOSTS", {}) class PublicBodyIndex(QueuedRealTimeSearchIndex): te...
from django.conf import settings from haystack import indexes from haystack import site from publicbody.models import PublicBody from helper.searchindex import QueuedRealTimeSearchIndex PUBLIC_BODY_BOOSTS = getattr(settings, "FROIDE_PUBLIC_BODY_BOOSTS", {}) class PublicBodyIndex(QueuedRealTimeSearchIndex): te...
Fix public body search index by indexing jurisdiction name
Fix public body search index by indexing jurisdiction name
Python
mit
CodeforHawaii/froide,ryankanno/froide,okfse/froide,stefanw/froide,CodeforHawaii/froide,catcosmo/froide,LilithWittmann/froide,ryankanno/froide,stefanw/froide,fin/froide,okfse/froide,LilithWittmann/froide,catcosmo/froide,fin/froide,okfse/froide,okfse/froide,fin/froide,ryankanno/froide,LilithWittmann/froide,catcosmo/froid...
--- +++ @@ -13,7 +13,7 @@ class PublicBodyIndex(QueuedRealTimeSearchIndex): text = indexes.EdgeNgramField(document=True, use_template=True) name = indexes.CharField(model_attr='name', boost=1.5) - jurisdiction = indexes.CharField(model_attr='jurisdiction', default='') + jurisdiction = indexes.CharFie...
de381a56e87a21da1e82146da01bb546c5094ec4
scripts/asgard-deploy.py
scripts/asgard-deploy.py
#!/usr/bin/env python import sys import logging import click from os import path # Add top-level module path to sys.path before importing tubular code. sys.path.append( path.dirname( path.dirname( path.abspath(__file__) ) ) ) from tubular import asgard logging.basicConfig(stream=sys.stdout, level=logging.INFO) @cl...
#!/usr/bin/env python import sys import logging import traceback import click from os import path # Add top-level module path to sys.path before importing tubular code. sys.path.append( path.dirname( path.dirname( path.abspath(__file__) ) ) ) from tubular import asgard logging.basicConfig(stream=sys.stdout, level=l...
Print the traceback as well for debugging purposes.
Print the traceback as well for debugging purposes.
Python
agpl-3.0
eltoncarr/tubular,eltoncarr/tubular
--- +++ @@ -1,6 +1,7 @@ #!/usr/bin/env python import sys import logging +import traceback import click from os import path @@ -18,6 +19,7 @@ try: asgard.deploy(ami_id) except Exception, e: + traceback.print_exc() click.secho("Error Deploying AMI: {0}.\nMessage: {1}".format(am...
9926cbb1919b96999d479f5a8d67e17ce71a1091
motobot/irc_message.py
motobot/irc_message.py
class IRCMessage: """ Class to store and parse an IRC Message. """ def __init__(self, msg): """ Parse a raw IRC message to IRCMessage. """ self.sender = None self.nick = None self.command = None self.params = [] self.__parse_msg(msg) def __parse_msg(self, ...
class IRCMessage: """ Class to store and parse an IRC Message. """ def __init__(self, msg): """ Parse a raw IRC message to IRCMessage. """ self.sender = None self.nick = None self.command = None self.params = [] self.__parse_msg(msg) def __parse_msg(self, ...
Improve the get_nick a tiny amount
Improve the get_nick a tiny amount
Python
mit
Motoko11/MotoBot
--- +++ @@ -37,4 +37,4 @@ def get_nick(host): """ Get the user's nick from a host. """ - return host.split('!')[0] + return host.split('!', 1)[0]
6ad4796030aab2f6dbf8389b4030007d0fcf8761
panoptes/test/mount/test_ioptron.py
panoptes/test/mount/test_ioptron.py
from nose.tools import raises import panoptes from panoptes.mount.ioptron import Mount class TestIOptron(): @raises(AssertionError) def test_no_config_no_commands(self): """ Mount needs a config """ mount = Mount() @raises(AssertionError) def test_config_no_commands(self): """ """ mount = Mount(config={...
from nose.tools import raises import panoptes from panoptes.mount.ioptron import Mount class TestIOptron(): @raises(AssertionError) def test_no_config_no_commands(self): """ Mount needs a config """ mount = Mount() @raises(AssertionError) def test_config_bad_commands(self): """ Passes in a default config ...
Update to test for mount setup
Update to test for mount setup
Python
mit
Guokr1991/POCS,joshwalawender/POCS,AstroHuntsman/POCS,panoptes/POCS,AstroHuntsman/POCS,panoptes/POCS,Guokr1991/POCS,Guokr1991/POCS,Guokr1991/POCS,panoptes/POCS,AstroHuntsman/POCS,panoptes/POCS,joshwalawender/POCS,AstroHuntsman/POCS,fmin2958/POCS,joshwalawender/POCS,fmin2958/POCS,fmin2958/POCS
--- +++ @@ -11,6 +11,10 @@ mount = Mount() @raises(AssertionError) - def test_config_no_commands(self): - """ """ - mount = Mount(config={'mount': { 'model': 'ioptron', 'port':'/dev/ttyUSB0' } }, commands=dict()) + def test_config_bad_commands(self): + """ Passes in a default config but blank commands, whic...
24d4fee92c1c2ff4bac1fe09d9b436748234a48c
main.py
main.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 """ Main script. Executes the XML Server implementation with an HTTP connection and default parameters. """ import sys import argparse from server import xml_server from connection import http_connection parser = argparse.ArgumentParser() parser.add...
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 """ Main script. Executes the XML Server implementation with an HTTP connection and default parameters. """ import sys import argparse from server import xml_server, defective_servers from connection import http_connection parser = argparse.Argument...
Add argument for execution of defective server.
Add argument for execution of defective server.
Python
apache-2.0
Solucionamos/dummybmc
--- +++ @@ -8,7 +8,7 @@ import sys import argparse -from server import xml_server +from server import xml_server, defective_servers from connection import http_connection parser = argparse.ArgumentParser() @@ -16,8 +16,12 @@ help="server's HTTP port") parser.add_argument('--sensordata', type=str, ...
52c2205804d8dc38447bca1ccbf5599e00cd1d7b
main.py
main.py
#!/usr/bin/env python3 import requests CONFIG_DIR = "config" class Bot: def __init__(self): self.config = Config(CONFIG_DIR) self.api = TelegramBotApi(self.config.get_auth_token()) def run(self): self.api.send_message(self.config.get_user_id(), "test") class TelegramBotApi: de...
#!/usr/bin/env python3 import requests CONFIG_DIR = "config" class Bot: def __init__(self): self.config = Config(CONFIG_DIR) self.api = TelegramBotApi(self.config.get_auth_token()) def run(self): self.api.send_message(self.config.get_admin_user_id(), "test") class TelegramBotApi: ...
Rename user_id config key to admin_user_id
Rename user_id config key to admin_user_id
Python
agpl-3.0
alvarogzp/telegram-bot,alvarogzp/telegram-bot
--- +++ @@ -11,7 +11,7 @@ self.api = TelegramBotApi(self.config.get_auth_token()) def run(self): - self.api.send_message(self.config.get_user_id(), "test") + self.api.send_message(self.config.get_admin_user_id(), "test") class TelegramBotApi: @@ -32,8 +32,8 @@ def get_auth_toke...
4ca8889396595f9da99becbb88fb7e38ab0ed560
hunter/reviewsapi.py
hunter/reviewsapi.py
import requests import os from .endpoints import * class UnauthorizedToken(Exception): pass class ReviewsAPI: def __init__(self): token = os.environ.get('UDACITY_AUTH_TOKEN') self.headers = {'Authorization': token, 'Content-Length': '0'} def certifications(self): try: ...
import requests import os from .endpoints import * class UnauthorizedToken(Exception): pass class ReviewsAPI: def __init__(self): token = os.environ.get('UDACITY_AUTH_TOKEN') self.headers = {'Authorization': token, 'Content-Length': '0'} def certifications(self): try: ...
Raise exception if connection not succeed and customize error message
Raise exception if connection not succeed and customize error message
Python
mit
anapaulagomes/reviews-assigner
--- +++ @@ -17,10 +17,13 @@ try: raw_response = requests.get(CERTIFICATIONS_URL, headers=self.headers) response = raw_response.json() + + raw_response.raise_for_status() + certifications_list = [item['project_id'] for item in response if item['sta...
bdca4889442e7d84f8c4e68ecdbee676d46ff264
examples/test_with_data_provider.py
examples/test_with_data_provider.py
from pytf.dataprovider import DataProvider try: from unittest.mock import call except ImportError: from mock import call @DataProvider([call(max=5), call(max=10), call(max=15)]) class TestCase(object): def __init__(self, max): self.max = max @DataProvider([call(n=3), call(n=7), call(n=12), c...
from pytf.dataprovider import DataProvider, call @DataProvider(max_5=call(max=5), max_10=call(max=10), max_15=call(max=15)) class TestCase(object): def __init__(self, max): self.max = max @DataProvider(n_3=call(n=3), n_7=call(n=7), n_12=call(n=12), n_20=call(n=20)) def test_test(self, n): ...
Fix data provider example file.
Fix data provider example file.
Python
mit
Lothiraldan/pytf
--- +++ @@ -1,16 +1,11 @@ -from pytf.dataprovider import DataProvider - -try: - from unittest.mock import call -except ImportError: - from mock import call +from pytf.dataprovider import DataProvider, call -@DataProvider([call(max=5), call(max=10), call(max=15)]) +@DataProvider(max_5=call(max=5), max_10=cal...
346e296872e1ca011eb5e469505de1c15c86732f
Doc/tools/sphinx-build.py
Doc/tools/sphinx-build.py
# -*- coding: utf-8 -*- """ Sphinx - Python documentation toolchain ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: 2007 by Georg Brandl. :license: Python license. """ import sys if __name__ == '__main__': if sys.version_info[:3] < (2, 5, 0): print >>sys.stderr, """\ Error: Sphinx ne...
# -*- coding: utf-8 -*- """ Sphinx - Python documentation toolchain ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: 2007 by Georg Brandl. :license: Python license. """ import sys if __name__ == '__main__': if sys.version_info[:3] < (2, 5, 0): print >>sys.stderr, """\ Error: Sphinx ne...
Clarify the comment about setting the PYTHON variable for the Doc Makefile.
Clarify the comment about setting the PYTHON variable for the Doc Makefile.
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
--- +++ @@ -13,9 +13,10 @@ if sys.version_info[:3] < (2, 5, 0): print >>sys.stderr, """\ -Error: Sphinx needs to be executed with Python 2.5 or newer. +Error: Sphinx needs to be executed with Python 2.5 or newer (If you run this from the Makefile, you can set the PYTHON variable -to the path of an al...
f68e8612f1e8198a4b300b67536d654e13809eb4
plinth/modules/monkeysphere/urls.py
plinth/modules/monkeysphere/urls.py
# # This file is part of Plinth. # # 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 option) any later version. # # This program is distribute...
# # This file is part of Plinth. # # 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 option) any later version. # # This program is distribute...
Allow SHA256 hashes in URLs
monkeysphere: Allow SHA256 hashes in URLs
Python
agpl-3.0
kkampardi/Plinth,harry-7/Plinth,harry-7/Plinth,freedomboxtwh/Plinth,harry-7/Plinth,freedomboxtwh/Plinth,freedomboxtwh/Plinth,harry-7/Plinth,kkampardi/Plinth,kkampardi/Plinth,vignanl/Plinth,vignanl/Plinth,vignanl/Plinth,freedomboxtwh/Plinth,kkampardi/Plinth,freedomboxtwh/Plinth,kkampardi/Plinth,vignanl/Plinth,vignanl/Pl...
--- +++ @@ -26,7 +26,7 @@ urlpatterns = [ url(r'^sys/monkeysphere/$', views.index, name='index'), - url(r'^sys/monkeysphere/(?P<ssh_fingerprint>[0-9A-Fa-f:]+)/import/$', + url(r'^sys/monkeysphere/(?P<ssh_fingerprint>[0-9A-Za-z:+/]+)/import/$', views.import_key, name='import'), url(r'^sys/m...
547c9e36255870bcee8a800a3fa95c3806a95c2c
newsApp/linkManager.py
newsApp/linkManager.py
import os import time from constants import * from dbhelper import * from dbItemManagerV2 import DbItemManagerV2 from link import Link LINK_EXPIRY_TIME_IN_DAYS = 80 class LinkManager(DbItemManagerV2): """ Manage links stored on AWS dynamo db database. Contains functions for CRUD operations on the links ...
import os import time from constants import * from dbhelper import * from dbItemManagerV2 import DbItemManagerV2 from link import Link LINK_EXPIRY_TIME_IN_DAYS = 80 class LinkManager(DbItemManagerV2): """ Manage links stored on AWS dynamo db database. Contains functions for CRUD operations on the links ...
Update links when it starts getting redirected
Update links when it starts getting redirected
Python
mit
adityabansal/newsAroundMe,adityabansal/newsAroundMe,adityabansal/newsAroundMe
--- +++ @@ -32,7 +32,14 @@ """ dbItem = DbItemManagerV2.get(self, linkId); - return Link(linkId, dbItem.tags) + link = Link(linkId, dbItem.tags) + + #handle the case when link starts gettting redirected to new url + if link.id != linkId: + self.delete(linkId)...
366ecdd77520004c307cbbf127bb374ab546ce7e
run-quince.py
run-quince.py
#!/usr/bin/env python3 # coding: utf-8 # Raytheon BBN Technologies 2016 # Contributiors: Graham Rowlands # # This file runs the main loop # Use PyQt5 by default import os os.environ["QT_API"] = 'pyqt5' from qtpy.QtWidgets import QApplication import sys import argparse from quince.view import * if __name__ == "__mai...
#!/usr/bin/env python3 # coding: utf-8 # Raytheon BBN Technologies 2016 # Contributiors: Graham Rowlands # # This file runs the main loop # Use PyQt5 by default import os os.environ["QT_API"] = 'pyqt5' from qtpy.QtWidgets import QApplication import sys import argparse import ctypes from quince.view import * if __na...
Use windows API to change the AppID and use our icon.
Use windows API to change the AppID and use our icon.
Python
apache-2.0
BBN-Q/Quince
--- +++ @@ -12,6 +12,7 @@ from qtpy.QtWidgets import QApplication import sys import argparse +import ctypes from quince.view import * @@ -28,6 +29,12 @@ png_path = os.path.join(os.path.dirname(__file__), "assets/quince_icon.png") app.setWindowIcon(QIcon(png_path)) + # Convince windows that this...
7b3f239964c6663a9b655553202567fccead85c8
mollie/api/resources/profiles.py
mollie/api/resources/profiles.py
from ..error import IdentifierError from ..objects.profile import Profile from .base import Base class Profiles(Base): RESOURCE_ID_PREFIX = 'pfl_' def get_resource_object(self, result): return Profile(result, self.client) def get(self, profile_id, **params): if not profile_id or \ ...
from ..error import IdentifierError from ..objects.profile import Profile from .base import Base class Profiles(Base): RESOURCE_ID_PREFIX = 'pfl_' def get_resource_object(self, result): return Profile(result, self.client) def get(self, profile_id, **params): if not profile_id or \ ...
Add 'me' to profile IdentifierError
Add 'me' to profile IdentifierError
Python
bsd-2-clause
mollie/mollie-api-python
--- +++ @@ -14,7 +14,9 @@ (not profile_id.startswith(self.RESOURCE_ID_PREFIX) and not profile_id == 'me'): raise IdentifierError( - "Invalid profile ID: '{id}'. A profile ID should start with '{prefix}'.".format( - id=profile_id, prefix...
a2eae87fc76ba1e9fbfa8102c3e19c239445a62a
nazs/web/forms.py
nazs/web/forms.py
from achilles.forms import * # noqa from nazs.models import SingletonModel # Override forms template Form.template_name = 'web/form.html' class ModelForm(ModelForm): def get_form(self, form_data=None, *args, **kwargs): # manage SingletonModels if issubclass(self.form_class.Meta.model, Singleto...
from achilles.forms import * # noqa from nazs.models import SingletonModel # Override forms template Form.template_name = 'web/form.html' class ModelForm(ModelForm): def get_form(self, form_data=None, *args, **kwargs): # manage SingletonModels if issubclass(self.form_class.Meta.model, Singleto...
Fix form retrieval in ModelForm
Fix form retrieval in ModelForm
Python
agpl-3.0
exekias/droplet,exekias/droplet,exekias/droplet
--- +++ @@ -14,4 +14,4 @@ instance = self.form_class.Meta.model.get() return self.form_class(form_data, instance=instance) else: - return super(ModelForm, self).get_form(*args, **kwargs) + return super(ModelForm, self).get_form(form_data, *args, **kwargs)
b6dff8fcd7dec56703006f2a7bcf1c8c72d0c21b
price_security/models/invoice.py
price_security/models/invoice.py
# -*- coding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in module root # directory ############################################################################## from openerp import fields, models, api class ac...
# -*- coding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in module root # directory ############################################################################## from openerp import fields, models, api class ac...
FIX price sec. related field as readonly
FIX price sec. related field as readonly
Python
agpl-3.0
ingadhoc/product,ingadhoc/product
--- +++ @@ -20,6 +20,7 @@ ) product_can_modify_prices = fields.Boolean( related='product_id.can_modify_prices', + readonly=True, string='Product Can modify prices') @api.one
38de795103748ca757a03a62da8ef3d89b0bf682
GoProController/models.py
GoProController/models.py
from django.db import models class Camera(models.Model): ssid = models.CharField(max_length=255) password = models.CharField(max_length=255) date_added = models.DateTimeField(auto_now_add=True) last_attempt = models.DateTimeField(auto_now=True) last_update = models.DateTimeField(null=True, blank=T...
from django.db import models class Camera(models.Model): ssid = models.CharField(max_length=255) password = models.CharField(max_length=255) date_added = models.DateTimeField(auto_now_add=True) last_attempt = models.DateTimeField(auto_now=True) last_update = models.DateTimeField(null=True, blank=T...
Fix bug that prevent commands with no values from being added
Fix bug that prevent commands with no values from being added
Python
apache-2.0
Nzaga/GoProController,joshvillbrandt/GoProController,Nzaga/GoProController,joshvillbrandt/GoProController
--- +++ @@ -21,7 +21,7 @@ class Command(models.Model): camera = models.ForeignKey(Camera) command = models.CharField(max_length=255) - value = models.CharField(max_length=255) + value = models.CharField(blank=True, max_length=255) date_added = models.DateTimeField(auto_now_add=True) time_co...
caff96633ce29a2139bc61bb5ee333efd69d50ef
processmysteps/default_config.py
processmysteps/default_config.py
""" Base line settings """ CONFIG = { 'input_path': None, 'backup_path': None, 'dest_path': None, 'life_all': None, 'db': { 'host': None, 'port': None, 'name': None, 'user': None, 'pass': None }, # 'preprocess': { # 'max_acc': 30.0 # }, ...
""" Base line settings """ CONFIG = { 'input_path': None, 'backup_path': None, 'dest_path': None, 'life_all': None, 'db': { 'host': None, 'port': None, 'name': None, 'user': None, 'pass': None }, # 'preprocess': { # 'max_acc': 30.0 # }, ...
Remove default classifier path from default config
Remove default classifier path from default config
Python
mit
ruipgil/ProcessMySteps,ruipgil/ProcessMySteps
--- +++ @@ -41,7 +41,7 @@ 'transportation': { 'remove_stops': False, 'min_time': 60, - 'classifier_path': 'classifier.data'# None + 'classifier_path': None#'classifier.data'# None }, 'trip_learning': { 'epsilon': 0.0,
5f522cf58a1566513e874002bdaeb063e8a02497
server/models/checkup.py
server/models/checkup.py
# -*- coding: utf-8 -*- from datetime import datetime from app import db class Checkup(db.Model): __tablename__ = 'checkup' id = db.Column(db.Integer, primary_key=True) created = db.Column(db.DateTime, default=datetime.utcnow) repo_name = db.Column(db.String, unique=True) # github-user/repo-name ...
# -*- coding: utf-8 -*- from datetime import datetime from app import db class Checkup(db.Model): __tablename__ = 'checkup' id = db.Column(db.Integer, primary_key=True) created = db.Column(db.DateTime, default=datetime.utcnow) # TODO: add one unique constraint on the column group of owner and repo ...
Update model and add TODO
Update model and add TODO
Python
mit
harunurhan/repologist,harunurhan/repodoctor,harunurhan/repologist,harunurhan/repodoctor
--- +++ @@ -9,6 +9,8 @@ id = db.Column(db.Integer, primary_key=True) created = db.Column(db.DateTime, default=datetime.utcnow) - repo_name = db.Column(db.String, unique=True) # github-user/repo-name + # TODO: add one unique constraint on the column group of owner and repo + owner = db.Column(db.S...
2e042201d6c0e0709d7056d399052389d1ea54b0
shopify_auth/__init__.py
shopify_auth/__init__.py
import shopify from django.conf import settings from django.core.exceptions import ImproperlyConfigured VERSION = (0, 1, 5) __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...
VERSION = (0, 1, 6) __version__ = '.'.join(map(str, VERSION)) __author__ = 'Gavin Ballard' def initialize(): import shopify from django.conf import settings from django.core.exceptions import ImproperlyConfigured if not settings.SHOPIFY_APP_API_KEY or not settings.SHOPIFY_APP_API_SECRET: ...
Move imports inside initialize() method so that we don’t break things on initial setup.
Move imports inside initialize() method so that we don’t break things on initial setup.
Python
mit
RafaAguilar/django-shopify-auth,discolabs/django-shopify-auth,RafaAguilar/django-shopify-auth,funkybob/django-shopify-auth,funkybob/django-shopify-auth,discolabs/django-shopify-auth
--- +++ @@ -1,15 +1,14 @@ -import shopify - -from django.conf import settings -from django.core.exceptions import ImproperlyConfigured - - -VERSION = (0, 1, 5) +VERSION = (0, 1, 6) __version__ = '.'.join(map(str, VERSION)) __author__ = 'Gavin Ballard' def initialize(): + import shopify + + from ...
3989abf6de879af6982a76ea3522f11f789c6569
MarkovNetwork/_version.py
MarkovNetwork/_version.py
# -*- coding: utf-8 -*- """ Copyright 2016 Randal S. Olson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge...
# -*- coding: utf-8 -*- """ Copyright 2016 Randal S. Olson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge...
Increment version for speedup release
Increment version for speedup release
Python
mit
rhiever/MarkovNetwork,rhiever/MarkovNetwork
--- +++ @@ -20,4 +20,4 @@ """ -__version__ = '1.2' +__version__ = '1.3'
f0e07f97fd43a0f54c8b0996944038a07e9a0e96
metering/loader.py
metering/loader.py
""" metering.loader ~~~~~~~~~ Define the meter data models """ from nemreader import read_nem_file from sqlalchemy.orm import sessionmaker from energy_shaper import split_into_daily_intervals from . import get_db_engine from . import save_energy_reading from . import refresh_daily_stats from . import refre...
""" metering.loader ~~~~~~~~~ Define the meter data models """ import logging from nemreader import read_nem_file from sqlalchemy.orm import sessionmaker from energy_shaper import split_into_daily_intervals from . import get_db_engine from . import save_energy_reading from . import refresh_daily_stats from...
Add error handling for when the meter name does not match the NEM file
Add error handling for when the meter name does not match the NEM file
Python
agpl-3.0
aguinane/energyusage,aguinane/energyusage,aguinane/energyusage,aguinane/energyusage
--- +++ @@ -4,6 +4,7 @@ Define the meter data models """ +import logging from nemreader import read_nem_file from sqlalchemy.orm import sessionmaker from energy_shaper import split_into_daily_intervals @@ -21,7 +22,12 @@ session = Session() m = read_nem_file(nem_file) - channels = m.readings...
8064be72de340fca963da2cade2b73aa969fbdbd
csunplugged/activities/models.py
csunplugged/activities/models.py
from django.db import models class Activity(models.Model): name = models.CharField(max_length=200) description = models.TextField()
from django.db import models class Activity(models.Model): name = models.CharField(max_length=200) description = models.TextField() def __str__(self): return self.name
Add string representation for Activity model
Add string representation for Activity model
Python
mit
uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged
--- +++ @@ -3,3 +3,6 @@ class Activity(models.Model): name = models.CharField(max_length=200) description = models.TextField() + + def __str__(self): + return self.name
f20eb91dcf04bc8e33fbb48ebfbef1b56acbf02d
web.py
web.py
""" Heroku/Python Quickstart: https://blog.heroku.com/archives/2011/9/28/python_and_django""" import os from flask import Flask app = Flask(__name__) @app.route('/') def home_page(): return 'Hello from the SPARK learn-a-thon!' if __name__ == '__main__': port = int(os.environ.get("PORT", 5000)) app.run(h...
""" Heroku/Python Quickstart: https://blog.heroku.com/archives/2011/9/28/python_and_django""" import os import random import requests from flask import Flask import tweepy import settings app = Flask(__name__) @app.route('/') def home_page(): return 'Hello from the SPARK learn-a-thon!' def get_instagram_im...
Make functions that pull a number of tweets and pics
Make functions that pull a number of tweets and pics
Python
apache-2.0
samanehsan/spark_github,samanehsan/spark_github,samanehsan/learn-git,samanehsan/learn-git
--- +++ @@ -1,14 +1,61 @@ """ Heroku/Python Quickstart: https://blog.heroku.com/archives/2011/9/28/python_and_django""" import os +import random +import requests from flask import Flask +import tweepy + +import settings + + app = Flask(__name__) + @app.route('/') def home_page(): return 'Hello from t...
d9189f91370abd1e20e5010bb70d9c47efd58215
muver/reference.py
muver/reference.py
from wrappers import bowtie2, picard, samtools def create_reference_indices(ref_fn): ''' For a given reference FASTA file, generate several indices. ''' bowtie2.build(ref_fn) samtools.faidx_index(ref_fn) picard.create_sequence_dictionary(ref_fn) def read_chrom_sizes(reference_ass...
import os from wrappers import bowtie2, picard, samtools def create_reference_indices(ref_fn): ''' For a given reference FASTA file, generate several indices. ''' bowtie2.build(ref_fn) samtools.faidx_index(ref_fn) picard.create_sequence_dictionary(ref_fn) def read_chrom_sizes(...
Change read_chrom_sizes to read from a FAIDX index if available
Change read_chrom_sizes to read from a FAIDX index if available
Python
mit
NIEHS/muver
--- +++ @@ -1,3 +1,5 @@ +import os + from wrappers import bowtie2, picard, samtools @@ -12,23 +14,25 @@ def read_chrom_sizes(reference_assembly_fn): ''' - Iterate through a FASTA file to find the length of each chromosome. + Iterate through a FASTA file to find the length of each chromosome. If a +...
4657acf6408b2fb416e2c9577ac09d18d81f8a68
nameless/config.py
nameless/config.py
import os _basedir = os.path.abspath(os.path.dirname(__file__)) # Plugin settings DATABASE_NAMES = ['atc', 'nhs', 'sms'] # Using sqlite for local development, will be SQL on production. SQLALCHEMY_BINDS = { 'atc': 'sqlite:///' + os.path.join(_basedir, 'db/atc.db'), 'nhs': 'sqlite:///' + os.path.join(_basedir, '...
import os _basedir = os.path.abspath(os.path.dirname(__file__)) # Plugin settings DATABASE_NAMES = ['atc', 'sms'] # Using sqlite for local development, will be SQL on production. SQLALCHEMY_BINDS = { 'atc': 'sqlite:///' + os.path.join(_basedir, 'db/atc.db'), 'sms': 'sqlite:///' + os.path.join(_basedir, 'db/sms....
Remove unused NHS database mockup
Remove unused NHS database mockup
Python
mit
jawrainey/sris
--- +++ @@ -1,11 +1,10 @@ import os _basedir = os.path.abspath(os.path.dirname(__file__)) # Plugin settings -DATABASE_NAMES = ['atc', 'nhs', 'sms'] +DATABASE_NAMES = ['atc', 'sms'] # Using sqlite for local development, will be SQL on production. SQLALCHEMY_BINDS = { 'atc': 'sqlite:///' + os.path.join(_based...
d60dea7b7b1fb073eef2c350177b3920f32de748
6/e6.py
6/e6.py
#!/usr/bin/env python def sum_seq_squares(n): return (n * (n+1) * ((2*n)+1)) / 6 def sum_seq(n): return (n * (n + 1)) / 2 def main(): sum_seq_sq_100 = sum_seq_squares(100) sum_seq_100 = sum_seq(100) sq_sum_seq_100 = sum_seq_100**2 diff = sq_sum_seq_100 - sum_seq_sq_100 print('diff is {0}'.format(diff)) ...
#!/usr/bin/env python # http://www.proofwiki.org/wiki/Sum_of_Sequence_of_Squares def sum_seq_squares(n): return (n * (n+1) * ((2*n)+1)) / 6 # http://www.regentsprep.org/regents/math/algtrig/ATP2/ArithSeq.htm def sum_seq(n): return (n * (n + 1)) / 2 def main(): sum_seq_sq_100 = sum_seq_squares(100) sum_seq_...
Add comments indicating source of formulae..
Add comments indicating source of formulae..
Python
mit
cveazey/ProjectEuler,cveazey/ProjectEuler
--- +++ @@ -1,8 +1,10 @@ #!/usr/bin/env python +# http://www.proofwiki.org/wiki/Sum_of_Sequence_of_Squares def sum_seq_squares(n): return (n * (n+1) * ((2*n)+1)) / 6 +# http://www.regentsprep.org/regents/math/algtrig/ATP2/ArithSeq.htm def sum_seq(n): return (n * (n + 1)) / 2
91ff11cde50ce2485c0a6725651931f88a085ca7
app.py
app.py
""" app.py """ from flask import Flask, render_template import requests app = Flask(__name__) def get_time(): try: response = requests.get('http://localhost:3001/time') except requests.exceptions.ConnectionError: return 'Unavailable' return response.json().get('datetime') def get_user...
""" app.py """ from flask import Flask, render_template import requests app = Flask(__name__) def get_time(): try: response = requests.get('http://localhost:3001/time', timeout=3.0) except (requests.exceptions.ConnectionError, requests.exceptions.Timeout): return 'Unavailable' ...
Update get_time to handle timeout errors.
Update get_time to handle timeout errors.
Python
mit
danriti/short-circuit,danriti/short-circuit
--- +++ @@ -9,8 +9,9 @@ def get_time(): try: - response = requests.get('http://localhost:3001/time') - except requests.exceptions.ConnectionError: + response = requests.get('http://localhost:3001/time', timeout=3.0) + except (requests.exceptions.ConnectionError, + requests.excep...
e62db9661295ff3912dbaaaff0d9f267f0b7ffe1
auth.py
auth.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from bottle.ext import auth from utils import conf try: auth_import = conf('auth')['engine'].split('.')[-1] auth_from = u".".join(conf('auth')['engine'].split('.')[:-1]) auth_engine = getattr(__import__(auth_from, fromlist=[auth_import]), ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from bottle.ext import auth from utils import conf try: auth_import = conf('auth')['engine'].split('.')[-1] auth_from = u".".join(conf('auth')['engine'].split('.')[:-1]) auth_engine = getattr(__import__(auth_from, fromlist=[auth_import]), ...
Add url callback on custom login
Add url callback on custom login
Python
mit
AndrzejR/mining,mining/mining,mlgruby/mining,mining/mining,mlgruby/mining,mlgruby/mining,jgabriellima/mining,avelino/mining,jgabriellima/mining,seagoat/mining,chrisdamba/mining,seagoat/mining,avelino/mining,AndrzejR/mining,chrisdamba/mining
--- +++ @@ -30,6 +30,6 @@ # Not working requered parans engine = auth_engine() else: - engine = auth_engine() + engine = auth_engine(callback_url=callback) auth = auth.AuthPlugin(engine)
8157af3da0e535074b18c76f0e5391d8cac806e8
whats_fresh/whats_fresh_api/tests/views/test_stories.py
whats_fresh/whats_fresh_api/tests/views/test_stories.py
from django.test import TestCase from django.test.client import Client from django.core.urlresolvers import reverse from whats_fresh_api.models import * from django.contrib.gis.db import models import json class StoriesTestCase(TestCase): fixtures = ['whats_fresh_api/tests/testdata/test_fixtures.json'] def s...
from django.test import TestCase from django.test.client import Client from django.core.urlresolvers import reverse from whats_fresh_api.models import * from django.contrib.gis.db import models import json class StoriesTestCase(TestCase): fixtures = ['whats_fresh_api/tests/testdata/test_fixtures.json'] def s...
Add error field to expected JSON
Add error field to expected JSON
Python
apache-2.0
osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api,iCHAIT/whats-fresh-api,osu-cass/whats-fresh-api
--- +++ @@ -10,10 +10,19 @@ fixtures = ['whats_fresh_api/tests/testdata/test_fixtures.json'] def setUp(self): - self.expected_json = """ + self.expected_json = """" { - "story": "These are the voyages of the Starfish Enterblub; her five year mission -- to seek out new fish and new fishil...
f2139cad673ee50f027164bda80d86979d5ce7a0
passenger_wsgi.py
passenger_wsgi.py
import os import sys try: from flask import Flask, render_template, send_file, Response import requests except ImportError: INTERP = "venv/bin/python" if os.path.relpath(sys.executable, os.getcwd()) != INTERP: try: os.execl(INTERP, INTERP, *sys.argv) except OSError: ...
import os import sys try: from flask import Flask import flask_login from flask_restless import APIManager from flask_sqlalchemy import SQLAlchemy import requests except ImportError: INTERP = "venv/bin/python" if os.path.relpath(sys.executable, os.getcwd()) != INTERP: try: ...
Add more imports for further functionality
Add more imports for further functionality `flask_login`, `flask_restless`, `flask_sqlalchemy`
Python
mit
GregBrimble/boilerplate-web-service,GregBrimble/boilerplate-web-service
--- +++ @@ -2,7 +2,10 @@ import sys try: - from flask import Flask, render_template, send_file, Response + from flask import Flask + import flask_login + from flask_restless import APIManager + from flask_sqlalchemy import SQLAlchemy import requests except ImportError: INTERP = "venv...
abae242bbcdc3eefcd0ab1ff29f660f89d47db1a
mirigata/surprise/models.py
mirigata/surprise/models.py
from django.db import models class Surprise(models.Model): link = models.URLField(max_length=500) description = models.TextField(max_length=1000)
from django.core.urlresolvers import reverse from django.db import models class Surprise(models.Model): link = models.URLField(max_length=500) description = models.TextField(max_length=1000) def get_absolute_url(self): return reverse('surprise-detail', kwargs={"pk": self.id})
Add absolute URL for Surprises
Add absolute URL for Surprises This allows the CreateView to work correctly
Python
agpl-3.0
mirigata/mirigata,mirigata/mirigata,mirigata/mirigata,mirigata/mirigata
--- +++ @@ -1,6 +1,10 @@ +from django.core.urlresolvers import reverse from django.db import models class Surprise(models.Model): link = models.URLField(max_length=500) description = models.TextField(max_length=1000) + + def get_absolute_url(self): + return reverse('surprise-detail', kwargs=...
8b944f04ebf9b635029182a3137e9368edafe9d2
pgsearch/utils.py
pgsearch/utils.py
from django.contrib.postgres.search import SearchVector, SearchRank, SearchQuery import shlex import string def parseSearchString(search_string): search_strings = shlex.split(search_string) translator = str.maketrans({key: None for key in string.punctuation}) search_strings = [s.translate(translator) for ...
from django.contrib.postgres.search import SearchVector, SearchRank, SearchQuery import shlex import string def parseSearchString(search_string): try: search_strings = shlex.split(search_string) translator = str.maketrans({key: None for key in string.punctuation}) search_strings = [s.trans...
Handle exception for bad search strings
Handle exception for bad search strings
Python
bsd-3-clause
groundupnews/gu,groundupnews/gu,groundupnews/gu,groundupnews/gu,groundupnews/gu
--- +++ @@ -4,9 +4,12 @@ import string def parseSearchString(search_string): - search_strings = shlex.split(search_string) - translator = str.maketrans({key: None for key in string.punctuation}) - search_strings = [s.translate(translator) for s in search_strings] + try: + search_strings = shlex...
b077df615eb4354f416877cc2857fb9848e158eb
saleor/core/templatetags/shop.py
saleor/core/templatetags/shop.py
from __future__ import unicode_literals try: from itertools import zip_longest except ImportError: from itertools import izip_longest as zip_longest from django.template import Library from django.utils.http import urlencode register = Library() @register.filter def slice(items, group_size=1): args = [...
from __future__ import unicode_literals try: from itertools import zip_longest except ImportError: from itertools import izip_longest as zip_longest from django.template import Library from django.utils.http import urlencode register = Library() @register.filter def slice(items, group_size=1): args = [...
Fix get_sort_by_toggle to work with QueryDicts with multiple values
Fix get_sort_by_toggle to work with QueryDicts with multiple values
Python
bsd-3-clause
UITools/saleor,mociepka/saleor,mociepka/saleor,UITools/saleor,maferelo/saleor,maferelo/saleor,UITools/saleor,UITools/saleor,mociepka/saleor,maferelo/saleor,UITools/saleor
--- +++ @@ -32,10 +32,10 @@ @register.simple_tag(takes_context=True) def get_sort_by_url_toggle(context, field): request = context['request'] - request_get = request.GET.dict() + request_get = request.GET.copy() if field == request_get.get('sort_by'): - new_sort_by = '-%s' % field # descendi...
7842919b2af368c640363b4e4e05144049b111ba
ovp_core/emails.py
ovp_core/emails.py
from django.core.mail import EmailMultiAlternatives from django.template import Context, Template from django.template.loader import get_template from django.conf import settings import threading class EmailThread(threading.Thread): def __init__(self, msg): self.msg = msg threading.Thread.__init__(sel...
from django.core.mail import EmailMultiAlternatives from django.template import Context, Template from django.template.loader import get_template from django.conf import settings import threading class EmailThread(threading.Thread): def __init__(self, msg): self.msg = msg threading.Thread.__init__(sel...
Remove BaseMail dependency on User object
Remove BaseMail dependency on User object
Python
agpl-3.0
OpenVolunteeringPlatform/django-ovp-core,OpenVolunteeringPlatform/django-ovp-core
--- +++ @@ -20,8 +20,8 @@ """ from_email = '' - def __init__(self, user, async_mail=None): - self.user = user + def __init__(self, email_address, async_mail=None): + self.email_address = email_address self.async_mail = async_mail def sendEmail(self, template_name, subject, context): @@ -29,7...
3c9de69112c8158877e4b0060ef0ab89c083f376
packages/custom.py
packages/custom.py
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python from cerbero.packages import package from cerbero.enums import License class GStreamer: url = "http://gstreamer.freedesktop.org" version = '1.14.0' vendor = 'GStreamer Project' licenses = [License.LGPL] org = 'org.freedesktop.gstreamer...
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python from cerbero.packages import package from cerbero.enums import License class GStreamer: url = "http://gstreamer.freedesktop.org" version = '1.14.0.1' vendor = 'GStreamer Project' licenses = [License.LGPL] org = 'org.freedesktop.gstream...
Build 1.14.0.1 package for Windows
Build 1.14.0.1 package for Windows
Python
lgpl-2.1
GStreamer/cerbero,atsushieno/cerbero,centricular/cerbero,fluendo/cerbero,atsushieno/cerbero,nirbheek/cerbero,fluendo/cerbero,centricular/cerbero,centricular/cerbero,GStreamer/cerbero,fluendo/cerbero,atsushieno/cerbero,fluendo/cerbero,nirbheek/cerbero,centricular/cerbero,GStreamer/cerbero,atsushieno/cerbero,atsushieno/c...
--- +++ @@ -6,7 +6,7 @@ class GStreamer: url = "http://gstreamer.freedesktop.org" - version = '1.14.0' + version = '1.14.0.1' vendor = 'GStreamer Project' licenses = [License.LGPL] org = 'org.freedesktop.gstreamer'
2652919c8d2e6fad8f7b3d47f5e82528b4b5214e
plots/monotone.py
plots/monotone.py
# MONOTONE # Produce a monotonically decreasing output plot from noisy data # Input: columns: t x # Output: columns: t_i x_i , sampled such that x_i <= x_j # for j > i. from string import * import sys # Set PYTHONPATH=$PWD from plottools import * if len(sys.argv) != 3: abort("usage:...
# MONOTONE # Produce a monotonically decreasing output plot from noisy data # Input: columns: t x # Output: columns: t_i x_i , sampled such that x_i <= x_j # for j > i. from string import * import sys # Set PYTHONPATH=$PWD from plottools import * if len(sys.argv) != 3: abort("usage:...
Write the last point for plot completeness
Write the last point for plot completeness
Python
mit
ECP-CANDLE/Database,ECP-CANDLE/Database
--- +++ @@ -26,4 +26,7 @@ val_loss = float(val_loss_string) if val_loss < val_loss_min: val_loss_min = val_loss + fp_o.write("%s, %f\n" % (t, val_loss_min)) + # Ensure the last data point is written for the plot: + if val_loss >= val_loss_min: fp_o.write("%s, %...
4c66010cf0cd4f763b362b6e84eb67d7ef1278b8
linter.py
linter.py
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Jack Brewer # Copyright (c) 2015 Jack Brewer # # License: MIT """This module exports the Stylint plugin class.""" from SublimeLinter.lint import NodeLinter, util class Stylint(NodeLinter): """Provides an inte...
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Jack Brewer # Copyright (c) 2015 Jack Brewer # # License: MIT """This module exports the Stylint plugin class.""" from SublimeLinter.lint import NodeLinter, util class Stylint(NodeLinter): """Provides an inte...
Make "near" group optional in regex
Make "near" group optional in regex Some errors output with a column number. For these, the `near` group should match. ``` 1:2 semicolons error unnecessary semicolon found ``` But some won't. For these, the `near` match should be optional. ``` 1 sortOrder error prefer alphabetical when sorting properties ...
Python
mit
jackbrewer/SublimeLinter-contrib-stylint
--- +++ @@ -26,7 +26,7 @@ # /path/to/file/example.styl ^.*$\s* # 177:24 colors warning hexidecimal color should be a variable - ^(?P<line>\d+):(?P<near>\d+)\s*\w+\s*((?P<warning>warning)|(?P<error>error))\s*(?P<message>.+)$\s* + ^(?P<line>\d+):?(?P<near>\d+)?\s*\w+\s*((?P<warn...
3fbbba8dae5c97cedf414eea8a39482c01a269e6
main.py
main.py
import io import json import logging import os import pdb import traceback from logging import config from functools import wraps from flask import ( Flask, render_template, request, send_file, send_from_directory, ) app = Flask(__name__) config.fileConfig('logger.conf') logger = logging.getLo...
import io import json import logging import os import pdb import traceback from logging import config from functools import wraps from flask import ( Flask, render_template, request, send_file, send_from_directory, ) app = Flask(__name__) config.fileConfig('logger.conf') logger = logging.getLo...
Add `debug=True` to avoid restarting the server after each change
Add `debug=True` to avoid restarting the server after each change
Python
mit
danoneata/video_annotation,danoneata/video_annotation,danoneata/video_annotation
--- +++ @@ -48,4 +48,4 @@ if __name__ == '__main__': - app.run('0.0.0.0', port=5152) + app.run('0.0.0.0', port=5152, debug=True)
7119c07b422f823f40939691fa84f0c2581ae70d
test/unit/helpers/test_qiprofile_helper.py
test/unit/helpers/test_qiprofile_helper.py
import datetime import pytz from nose.tools import (assert_is_none) from qipipe.helpers.qiprofile_helper import QIProfile from qiprofile.models import Project from test import project from test.helpers.logging_helper import logger SUBJECT = 'Breast099' """The test subject.""" SESSION = 'Session01' """The test sessio...
import datetime import pytz from nose.tools import (assert_is_none) from qipipe.helpers.qiprofile_helper import QIProfile from qiprofile_rest.models import Project from test import project from test.helpers.logging_helper import logger SUBJECT = 'Breast099' """The test subject.""" SESSION = 'Session01' """The test s...
Fix the REST module name.
Fix the REST module name.
Python
bsd-2-clause
ohsu-qin/qipipe
--- +++ @@ -3,7 +3,7 @@ from nose.tools import (assert_is_none) from qipipe.helpers.qiprofile_helper import QIProfile -from qiprofile.models import Project +from qiprofile_rest.models import Project from test import project from test.helpers.logging_helper import logger
a3923263a100dd39772533aa37ea7ff956e6c874
manage.py
manage.py
# -*- coding: utf-8 -*- from flask.ext.script import Manager, Server from yoyo import create_app manager = Manager(create_app) manager.add_option('-c', '--configfile', dest='configfile', required=False) if __name__ == '__main__': manager.run()
# -*- coding: utf-8 -*- from flask.ext.script import Manager, Server from yoyo import create_app manager = Manager(create_app) manager.add_option('-c', '--configfile', dest='configfile', required=False) manager.add_command('runserver', Server( use_debugger = True, use_reloader = True, host = '0.0.0.0', ...
Make app accessible outside the development machine.
Make app accessible outside the development machine.
Python
mit
jaapverloop/massa
--- +++ @@ -7,5 +7,12 @@ manager = Manager(create_app) manager.add_option('-c', '--configfile', dest='configfile', required=False) +manager.add_command('runserver', Server( + use_debugger = True, + use_reloader = True, + host = '0.0.0.0', + port = 8080, +)) + if __name__ == '__main__': manager.r...
08b54819a56d9bfc65225045d97a4c331f9a3e11
manage.py
manage.py
#!/usr/bin/env python3 from flask_script import Manager from flask_migrate import Migrate, MigrateCommand from service import app, db # db.create_all() needs all models to be imported from service.db_access import * migrate = Migrate(app, db) manager = Manager(app) manager.add_command('db', MigrateCommand) if _...
#!/usr/bin/env python3 from flask_script import Manager from flask_migrate import Migrate, MigrateCommand from service import app, db # db.create_all() needs all models to be imported explicitly (not *) from service.db_access import User migrate = Migrate(app, db) manager = Manager(app) manager.add_command('db', ...
Fix model import needed by create_all()
Fix model import needed by create_all()
Python
mit
LandRegistry/login-api,LandRegistry/login-api
--- +++ @@ -5,8 +5,8 @@ from service import app, db -# db.create_all() needs all models to be imported -from service.db_access import * +# db.create_all() needs all models to be imported explicitly (not *) +from service.db_access import User migrate = Migrate(app, db)
a3ad91928f7d4753204a2443237c7f720fed37f1
inselect/gui/sort_document_items.py
inselect/gui/sort_document_items.py
from PySide.QtCore import QSettings from inselect.lib.sort_document_items import sort_document_items # QSettings path _PATH = 'sort_by_columns' # Global - set to instance of CookieCutterChoice in cookie_cutter_boxes _SORT_DOCUMENT = None def sort_items_choice(): "Returns an instance of SortDocumentItems" g...
from PySide.QtCore import QSettings from inselect.lib.sort_document_items import sort_document_items # QSettings path _PATH = 'sort_by_columns' # Global - set to instance of CookieCutterChoice in cookie_cutter_boxes _SORT_DOCUMENT = None def sort_items_choice(): "Returns an instance of SortDocumentItems" g...
Fix persistence of 'sort by' preference on Windows
Fix persistence of 'sort by' preference on Windows
Python
bsd-3-clause
NaturalHistoryMuseum/inselect,NaturalHistoryMuseum/inselect
--- +++ @@ -19,7 +19,8 @@ class SortDocumentItems(object): def __init__(self): - self._by_columns = QSettings().value(_PATH, False) + # Key holds an integer + self._by_columns = 1 == QSettings().value(_PATH, False) @property def by_columns(self): @@ -33,5 +34,7 @@ use...
783f7a5d17b3db83e1f27ad3bebb4c165c4e66ca
django_settings/keymaker.py
django_settings/keymaker.py
class KeyMaker(object): def __init__(self, prefix): self.prefix = prefix def convert(self, arg): return str(arg) def args_to_key(self, args): return ":".join(map(self.convert, args)) def kwargs_to_key(self, kwargs): return ":".join([ "%s:%s" % (self.convert...
import sys class KeyMaker(object): def __init__(self, prefix): self.prefix = prefix def convert(self, arg): if sys.version_info < (3,) and isinstance(arg, unicode): return arg.encode(django.settings.DEFAULT_CHARSET) return str(arg) def args_to_key(self, args): ...
Fix convert to support python 2 and python 3
Fix convert to support python 2 and python 3
Python
bsd-3-clause
jrutila/django-settings,jrutila/django-settings,jrutila/django-settings,jrutila/django-settings
--- +++ @@ -1,8 +1,12 @@ +import sys + class KeyMaker(object): def __init__(self, prefix): self.prefix = prefix def convert(self, arg): + if sys.version_info < (3,) and isinstance(arg, unicode): + return arg.encode(django.settings.DEFAULT_CHARSET) return str(arg) ...
f8eb93f1845a7776c61a59bafc6fdeb689712aff
examples/comp/ask_user_dialog.py
examples/comp/ask_user_dialog.py
"""Example showing the Ask User dialog controls and overall usage.""" import fusionless as fu dialog = fu.AskUserDialog() dialog.add_text("text", default="Default text value") dialog.add_position("position", default=(0.2, 0.8)) dialog.add_slider("slider", default=0.5, min=-10, max=10) dialog.add_screw("screw") dialog...
"""Example showing the Ask User dialog controls and overall usage.""" import fusionless as fu dialog = fu.AskUserDialog("Example Ask User Dialog") dialog.add_text("text", default="Default text value") dialog.add_position("position", default=(0.2, 0.8)) dialog.add_slider("slider", default=0.5, min=-10, max=10) dialog....
Add dialog title to example
Add dialog title to example
Python
bsd-3-clause
BigRoy/fusionless,BigRoy/fusionscript
--- +++ @@ -2,7 +2,7 @@ import fusionless as fu -dialog = fu.AskUserDialog() +dialog = fu.AskUserDialog("Example Ask User Dialog") dialog.add_text("text", default="Default text value") dialog.add_position("position", default=(0.2, 0.8)) dialog.add_slider("slider", default=0.5, min=-10, max=10)
c5ccf36fbeb6b744918e3090422763103b181de8
tests/test_tripleStandardize.py
tests/test_tripleStandardize.py
import json from ppp_nlp_classical import Triple, TriplesBucket, computeTree, simplify, buildBucket, DependenciesTree, tripleProduce1, tripleProduce2, tripleProduce3, buildTree from ppp_datamodel import Triple, Resource, Missing import data from unittest import TestCase class StandardTripleTests(TestCase): def ...
import json from ppp_nlp_classical import Triple, TriplesBucket, computeTree, simplify, buildBucket, DependenciesTree, tripleProduce1, tripleProduce2, tripleProduce3, buildTree from ppp_datamodel import Triple, Resource, Missing import data from unittest import TestCase class StandardTripleTests(TestCase): def ...
Fix name (copy paste fail...)
Fix name (copy paste fail...)
Python
agpl-3.0
ProjetPP/PPP-QuestionParsing-Grammatical,ProjetPP/PPP-QuestionParsing-Grammatical
--- +++ @@ -8,7 +8,7 @@ class StandardTripleTests(TestCase): - def testBuildBucket(self): + def testBuildFromBucket(self): tree = computeTree(data.give_president_of_USA()['sentences'][0]) qw = simplify(tree) triple = buildTree(buildBucket(tree,qw))
818d89c897603eeb33caf1ca2cdaeae5c3010880
engines/mako_engine.py
engines/mako_engine.py
#!/usr/bin/env python """Provide the mako templating engine.""" from __future__ import print_function from mako.template import Template from mako.lookup import TemplateLookup from . import Engine class MakoEngine(Engine): """Mako templating engine.""" handle = 'mako' def __init__(self, template, t...
#!/usr/bin/env python """Provide the mako templating engine.""" from __future__ import print_function from mako.template import Template from mako.lookup import TemplateLookup from . import Engine class MakoEngine(Engine): """Mako templating engine.""" handle = 'mako' def __init__(self, template, d...
Use passed directory in mako engine.
Use passed directory in mako engine.
Python
mit
blubberdiblub/eztemplate
--- +++ @@ -16,9 +16,12 @@ handle = 'mako' - def __init__(self, template, tolerant=False, **kwargs): + def __init__(self, template, dirname=None, tolerant=False, **kwargs): """Initialize mako template.""" super(MakoEngine, self).__init__(**kwargs) + + directories = [dirname] if...
04c3cac3054626773bc0434453378cb295f7e38c
pytus2000/read.py
pytus2000/read.py
import pandas as pd from .datadicts import diary def read_diary_file(path_to_file): return pd.read_csv( path_to_file, delimiter='\t', nrows=50, converters=_column_name_to_type_mapping(diary), low_memory=False # some columns seem to have mixed types ) def _column_name...
import pandas as pd from .datadicts import diary def read_diary_file(path_to_file): return pd.read_csv( path_to_file, delimiter='\t', converters=_column_name_to_type_mapping(diary), low_memory=False # some columns seem to have mixed types ) def _column_name_to_type_mapping(m...
Add handling of invalid values
Add handling of invalid values Values that are not defined in the data dictionary will be replaced by None.
Python
mit
timtroendle/pytus2000
--- +++ @@ -7,7 +7,6 @@ return pd.read_csv( path_to_file, delimiter='\t', - nrows=50, converters=_column_name_to_type_mapping(diary), low_memory=False # some columns seem to have mixed types ) @@ -29,5 +28,11 @@ if value == ' ': return None ...
826f23f0fc7eea4c72dcc26f637f3752bee51b47
test/ctypesgentest.py
test/ctypesgentest.py
import optparse, sys, StringIO sys.path.append("..") import ctypesgencore """ctypesgentest is a simple module for testing ctypesgen on various C constructs. It consists of a single function, test(). test() takes a string that represents a C header file, along with some keyword arguments representing options. It proces...
import optparse, sys, StringIO sys.path.append(".") # Allow tests to be called from parent directory with Python 2.6 sys.path.append("..") import ctypesgencore """ctypesgentest is a simple module for testing ctypesgen on various C constructs. It consists of a single function, test(). test() takes a string that repres...
Allow tests to be called from parent directory of "test"
Allow tests to be called from parent directory of "test" git-svn-id: 397be6d5b34b040010577acc149a81bea378be26@89 1754e6c4-832e-0410-bb55-0fb906f63d99
Python
bsd-3-clause
kanzure/ctypesgen,kanzure/ctypesgen,novas0x2a/ctypesgen,davidjamesca/ctypesgen,kanzure/ctypesgen
--- +++ @@ -1,4 +1,5 @@ import optparse, sys, StringIO +sys.path.append(".") # Allow tests to be called from parent directory with Python 2.6 sys.path.append("..") import ctypesgencore
69eafa95df4bdeb143d40c321f0a312d06efff1f
skimage/segmentation/__init__.py
skimage/segmentation/__init__.py
from .random_walker_segmentation import random_walker from ._felzenszwalb import felzenszwalb from ._slic import slic from ._quickshift import quickshift from .boundaries import find_boundaries, visualize_boundaries, mark_boundaries from ._clear_border import clear_border from ._join import join_segmentations, relabel_...
from .random_walker_segmentation import random_walker from ._felzenszwalb import felzenszwalb from ._slic import slic from ._quickshift import quickshift from .boundaries import find_boundaries, visualize_boundaries, mark_boundaries from ._clear_border import clear_border from ._join import join_segmentations, relabel_...
Add __all__ to segmentation package
Add __all__ to segmentation package
Python
bsd-3-clause
Midafi/scikit-image,pratapvardhan/scikit-image,michaelaye/scikit-image,bsipocz/scikit-image,blink1073/scikit-image,robintw/scikit-image,oew1v07/scikit-image,Britefury/scikit-image,chriscrosscutler/scikit-image,Hiyorimi/scikit-image,vighneshbirodkar/scikit-image,paalge/scikit-image,newville/scikit-image,ajaybhat/scikit-...
--- +++ @@ -5,3 +5,15 @@ from .boundaries import find_boundaries, visualize_boundaries, mark_boundaries from ._clear_border import clear_border from ._join import join_segmentations, relabel_from_one + + +__all__ = ['random_walker', + 'felzenszwalb', + 'slic', + 'quickshift', + ...
d59f3259875ffac49668ffb3ce34ca511385ebb7
rated/settings.py
rated/settings.py
from django.conf import settings DEFAULT_REALM = getattr(settings, 'RATED_DEFAULT_REALM', 'default') DEFAULT_LIMIT = getattr(settings, 'RATED_DEFAULT_LIMIT', 100) DEFAULT_DURATION = getattr(settings, 'RATED_DEFAULT_DURATION', 60 * 60) RESPONSE_CODE = getattr(settings, 'RATED_RESPONSE_CODE', 429) RESPONSE_MESSAGE = g...
from django.conf import settings DEFAULT_REALM = getattr(settings, 'RATED_DEFAULT_REALM', 'default') DEFAULT_LIMIT = getattr(settings, 'RATED_DEFAULT_LIMIT', 100) DEFAULT_DURATION = getattr(settings, 'RATED_DEFAULT_DURATION', 60 * 60) RESPONSE_CODE = getattr(settings, 'RATED_RESPONSE_CODE', 429) RESPONSE_MESSAGE = g...
Fix USE_X_FORWARDED_FOR for proxied environments
Fix USE_X_FORWARDED_FOR for proxied environments The settings for USE_X_FORWARDED_FOR were not being respected because the settings were not being passed through.
Python
bsd-3-clause
funkybob/django-rated
--- +++ @@ -17,3 +17,4 @@ # Redis config parameters REDIS = getattr(settings, 'RATED_REDIS', {}) +USE_X_FORWARDED_FOR = getattr(settings, 'USE_X_FORWARDED_FOR', False)
c1ae43fd33cd0f8eb3e270907a8ed7e728d1e268
server.py
server.py
import evdev import requests import json import datetime import yaml def main(): config = load_config() dev = evdev.InputDevice(config['device_path']) output_line('Initialized - Capturing device: ' + str(dev)) for event in dev.read_loop(): if event.type == evdev.ecodes.EV_KEY: event = evdev.categor...
import evdev import requests import json import datetime import yaml def main(): config = load_config() dev = evdev.InputDevice(config['device_path']) output_line('Initialized - Capturing device: ' + str(dev)) for event in dev.read_loop(): if event.type == evdev.ecodes.EV_KEY: output_line(event) ...
Add captured_at timestamp to POST payload
Add captured_at timestamp to POST payload Timestamp is in ISO 8601 format
Python
mit
nicolas-fricke/keypost
--- +++ @@ -12,7 +12,6 @@ for event in dev.read_loop(): if event.type == evdev.ecodes.EV_KEY: - event = evdev.categorize(event) output_line(event) payload = build_payload(event) output_line('Sending ' + str(payload) + ' to ' + config['post_url']) @@ -20,10 +19,12 @@ output_l...
4c5550420b8a9f1bf88f4329952f6e2a161cd20f
test/test_panels/test_navigation.py
test/test_panels/test_navigation.py
from pyqode.core.api import TextHelper from pyqode.qt.QtTest import QTest def test_toggle_button(editor): editor.file.open('test/files/example.json') editor.show() TextHelper(editor).goto_line(6) QTest.qWait(500) panel = editor.panels.get('NavigationPanel') assert len(panel._widgets) == 4 ...
from pyqode.core.api import TextHelper from pyqode.qt.QtTest import QTest def test_toggle_button(editor): editor.file.open('test/files/example.json') editor.show() TextHelper(editor).goto_line(6) QTest.qWait(500) panel = editor.panels.get('NavigationPanel') assert len(panel._widgets) == 4 ...
Fix test on kaos with latest qt5
Fix test on kaos with latest qt5
Python
mit
pyQode/pyqode.json,pyQode/pyqode.json
--- +++ @@ -9,7 +9,7 @@ QTest.qWait(500) panel = editor.panels.get('NavigationPanel') assert len(panel._widgets) == 4 - assert panel._widgets[1].text() == 'window' + assert panel._widgets[1].text().replace('&', '').lower() == 'window' panel._widgets[1].toggled.emit(True) QTest.qWait(500...
8e6662a4aaf654ddf18c1c4e733c58db5b9b5579
opps/channels/context_processors.py
opps/channels/context_processors.py
# -*- coding: utf-8 -*- from django.utils import timezone from django.conf import settings from django.contrib.sites.models import get_current_site from .models import Channel def channel_context(request): """ Channel context processors """ site = get_current_site(request) opps_menu = Channel.objects...
# -*- coding: utf-8 -*- from django.utils import timezone from django.conf import settings from django.contrib.sites.models import get_current_site from django.core.cache import cache from .models import Channel def channel_context(request): """ Channel context processors """ site = get_current_site(requ...
Add cache in opps menu list via context processors
Add cache in opps menu list via context processors
Python
mit
YACOWS/opps,opps/opps,jeanmask/opps,jeanmask/opps,YACOWS/opps,opps/opps,williamroot/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,opps/opps,jeanmask/opps,opps/opps,williamroot/opps
--- +++ @@ -2,6 +2,7 @@ from django.utils import timezone from django.conf import settings from django.contrib.sites.models import get_current_site +from django.core.cache import cache from .models import Channel @@ -10,10 +11,14 @@ """ Channel context processors """ site = get_current_site(req...
7060f48df582dcfae1768cc37d00a25e0e2e1f6f
app/views/comment_view.py
app/views/comment_view.py
from flask import jsonify from flask_classy import FlaskView from flask_user import current_user, login_required from ..models import CommentModel, PostModel from ..forms import CommentForm class Comment(FlaskView): def get(self): pass def all(self, post_id): comment = CommentModel() ...
from flask import jsonify from flask_classy import FlaskView from flask_user import current_user, login_required from ..models import CommentModel, PostModel from ..forms import CommentForm class Comment(FlaskView): def get(self): pass def all(self, post_id): comment = CommentModel() ...
Comment post endpoint return a ksopn, fix issue saving comments add post id and convert it to int
Comment post endpoint return a ksopn, fix issue saving comments add post id and convert it to int
Python
mit
oldani/nanodegree-blog,oldani/nanodegree-blog,oldani/nanodegree-blog
--- +++ @@ -21,8 +21,10 @@ if form.validate_on_submit(): post = PostModel().get(post_id) post = PostModel(**post) - comment = CommentModel(user=current_user.username, **form.data) + comment = CommentModel(user=current_user.username, + ...
6e7dfe97cdce58f892f88560e4b4709e6625e6bd
metatlas/__init__.py
metatlas/__init__.py
__version__ = '0.2' from .mzml_loader import mzml_to_hdf from .h5_query import plot_heatmap, plot_spectrogram, plot_xic from .h5_query import get_data, get_XIC, get_HeatMapRTMZ, get_spectrogram
__version__ = '0.2' from .mzml_loader import mzml_to_hdf from .h5_query import plot_heatmap, plot_spectrogram, plot_XIC from .h5_query import get_data, get_XIC, get_heatmap, get_spectrogram
Clean up package level imports
Clean up package level imports
Python
bsd-3-clause
aitatanit/metatlas,aitatanit/metatlas,aitatanit/metatlas,metabolite-atlas/metatlas,biorack/metatlas,biorack/metatlas,metabolite-atlas/metatlas,metabolite-atlas/metatlas
--- +++ @@ -1,4 +1,4 @@ __version__ = '0.2' from .mzml_loader import mzml_to_hdf -from .h5_query import plot_heatmap, plot_spectrogram, plot_xic -from .h5_query import get_data, get_XIC, get_HeatMapRTMZ, get_spectrogram +from .h5_query import plot_heatmap, plot_spectrogram, plot_XIC +from .h5_query import get_data,...
aa3e36cc37b2ddcc5d166965f8abeff560e6b0f1
migrations/config.py
migrations/config.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import os import logging from logging.handlers import SysLogHandler from dotenv import load_dotenv load_dotenv('.env') # Storage DATABASE_URL =...
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import os import logging from logging.handlers import SysLogHandler from dotenv import load_dotenv load_dotenv('.env') # Storage if not os.envi...
Use test database on alembic when necessary
Use test database on alembic when necessary
Python
agpl-3.0
frictionlessdata/goodtables.io,frictionlessdata/goodtables.io,frictionlessdata/goodtables.io,frictionlessdata/goodtables.io
--- +++ @@ -13,7 +13,11 @@ # Storage -DATABASE_URL = os.environ['DATABASE_URL'] +if not os.environ.get('TESTING'): + DATABASE_URL = os.environ['DATABASE_URL'] +else: + DATABASE_URL = os.environ['TEST_DATABASE_URL'] + # Logging
2b3281863f11fa577dd6504e58f6faec8ada2259
qiime_studio/api/v1.py
qiime_studio/api/v1.py
from flask import Blueprint, jsonify from .security import validate_request_authentication from qiime.sdk import PluginManager PLUGIN_MANAGER = PluginManager() v1 = Blueprint('v1', __name__) v1.before_request(validate_request_authentication) @v1.route('/', methods=['GET', 'POST']) def root(): return jsonify(con...
from flask import Blueprint, jsonify from .security import validate_request_authentication from qiime.sdk import PluginManager PLUGIN_MANAGER = PluginManager() v1 = Blueprint('v1', __name__) v1.before_request(validate_request_authentication) @v1.route('/', methods=['GET', 'POST']) def root(): return jsonify(con...
Change order of API call
Change order of API call
Python
bsd-3-clause
jakereps/qiime-studio-frontend,jakereps/qiime-studio,qiime2/qiime-studio,qiime2/qiime-studio,jakereps/qiime-studio,qiime2/qiime-studio-frontend,qiime2/qiime-studio-frontend,qiime2/qiime-studio,jakereps/qiime-studio,jakereps/qiime-studio-frontend
--- +++ @@ -19,7 +19,7 @@ return jsonify({"names": plugin_list}) -@v1.route('/workflows/<plugin_name>', methods=['GET']) +@v1.route('/<plugin_name>/workflows', methods=['GET']) def api_workflows(plugin_name): plugin = PLUGIN_MANAGER.plugins[plugin_name] workflows_dict = {}
e1a7e4535e64c005fb508ba6d3fed021bbd40a62
oedb_datamodels/versions/1a73867b1e79_add_meta_search.py
oedb_datamodels/versions/1a73867b1e79_add_meta_search.py
"""Add meta_search table Revision ID: 1a73867b1e79 Revises: 1c6e2fb3d3b6 Create Date: 2019-04-29 11:47:04.783168 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql from sqlalchemy.orm.session import sessionmaker from api.actions import update_meta_search # revision identif...
"""Add meta_search table Revision ID: 1a73867b1e79 Revises: 1c6e2fb3d3b6 Create Date: 2019-04-29 11:47:04.783168 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql from sqlalchemy.orm.session import sessionmaker from api.actions import update_meta_search from dataedit.views...
Update only tables in visible schemas
Update only tables in visible schemas
Python
agpl-3.0
openego/oeplatform,openego/oeplatform,openego/oeplatform,openego/oeplatform
--- +++ @@ -11,6 +11,7 @@ from sqlalchemy.orm.session import sessionmaker from api.actions import update_meta_search +from dataedit.views import schema_whitelist # revision identifiers, used by Alembic. revision = "1a73867b1e79" @@ -34,7 +35,8 @@ meta.reflect() for table in meta.tables.values(): -...
7eb10376b585e56faad4672959f6654f2500a38d
astropy/units/__init__.py
astropy/units/__init__.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This subpackage contains classes and functions for defining and converting between different physical units. This code is adapted from the `pynbody <http://code.google.com/p/pynbody/>`_ units module written by Andrew Pontzen, who has granted the Astr...
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This subpackage contains classes and functions for defining and converting between different physical units. This code is adapted from the `pynbody <http://code.google.com/p/pynbody/>`_ units module written by Andrew Pontzen, who has granted the Astr...
Add `one` as shortcut to `dimensionless_unscaled`
Add `one` as shortcut to `dimensionless_unscaled` I find creating dimensionless `Quantity`es overly painful compared to quantities with dimensions. Currently the two existing options are: 1. Putting `u.km`, `u.s` next to `u.dimensionless_unscaled`. Too large. 2. Putting `u.km`, `u.s` next to `u.Unit('')` or `u.Uni...
Python
bsd-3-clause
kelle/astropy,aleksandr-bakanov/astropy,bsipocz/astropy,kelle/astropy,mhvk/astropy,funbaker/astropy,larrybradley/astropy,MSeifert04/astropy,aleksandr-bakanov/astropy,saimn/astropy,DougBurke/astropy,AustereCuriosity/astropy,AustereCuriosity/astropy,StuartLittlefair/astropy,astropy/astropy,lpsinger/astropy,AustereCuriosi...
--- +++ @@ -27,6 +27,9 @@ del bases + +one = dimensionless_unscaled + # Enable the set of default units. This notably does *not* include # Imperial units.
8a9fa06c36a89e3fde93059cfbe827506d5b8b62
orchard/errors/e500.py
orchard/errors/e500.py
# -*- coding: utf-8 -*- """ This module sets up the view for handling ``500 Internal Server Error`` errors. """ import datetime import flask import flask_classful from orchard.errors import blueprint class Error500View(flask_classful.FlaskView): """ View for ``500 Internal Server Error`` errors. ...
# -*- coding: utf-8 -*- """ This module sets up the view for handling ``500 Internal Server Error`` errors. """ import datetime import flask import flask_classful from orchard.errors import blueprint class Error500View(flask_classful.FlaskView): """ View for ``500 Internal Server Error`` errors. ...
Disable exception logging of status code 500 during testing.
Disable exception logging of status code 500 during testing.
Python
mit
BMeu/Orchard,BMeu/Orchard
--- +++ @@ -39,7 +39,9 @@ agent_browser_version = flask.request.user_agent.version, agent = flask.request.user_agent.string) - flask.current_app.logger.exception(message) + if not flask.current_app.testing: # pragma: no cover. + fla...
282ac04e49c6adef237ea30fa4dcae64e6f959d8
stronghold/middleware.py
stronghold/middleware.py
from django.contrib.auth.decorators import login_required from stronghold import conf class LoginRequiredMiddleware(object): """ Force all views to use login required View is deemed to be public if the @public decorator is applied to the view View is also deemed to be Public if listed in in django s...
from django.contrib.auth.decorators import login_required from stronghold import conf class LoginRequiredMiddleware(object): """ Force all views to use login required View is deemed to be public if the @public decorator is applied to the view View is also deemed to be Public if listed in in django s...
Support for non-blank server roots
Support for non-blank server roots Using request.path_info instead of request.path for regex matching. This opens support for root server URLs such in the form of 'www.example.com/django_root/<view_url>'
Python
mit
mgrouchy/django-stronghold,SunilMohanAdapa/django-stronghold,SunilMohanAdapa/django-stronghold
--- +++ @@ -27,7 +27,7 @@ # if this view matches a whitelisted regex, don't process it for view_url in self.public_view_urls: - if view_url.match(request.path): + if view_url.match(request.path_info): return None return login_required(view_func)(re...
6edd4114c4e715a3a0c440af455fff089a099620
scrapy/squeues.py
scrapy/squeues.py
""" Scheduler queues """ import marshal from six.moves import cPickle as pickle from queuelib import queue def _serializable_queue(queue_class, serialize, deserialize): class SerializableQueue(queue_class): def push(self, obj): s = serialize(obj) super(SerializableQueue, self).p...
""" Scheduler queues """ import marshal from six.moves import cPickle as pickle from queuelib import queue def _serializable_queue(queue_class, serialize, deserialize): class SerializableQueue(queue_class): def push(self, obj): s = serialize(obj) super(SerializableQueue, self).p...
Clarify comment about Pyhton versions
Clarify comment about Pyhton versions
Python
bsd-3-clause
pablohoffman/scrapy,pawelmhm/scrapy,finfish/scrapy,Ryezhang/scrapy,ssteo/scrapy,pawelmhm/scrapy,ssteo/scrapy,scrapy/scrapy,pawelmhm/scrapy,starrify/scrapy,ArturGaspar/scrapy,ssteo/scrapy,wujuguang/scrapy,dangra/scrapy,pablohoffman/scrapy,dangra/scrapy,elacuesta/scrapy,starrify/scrapy,scrapy/scrapy,kmike/scrapy,pablohof...
--- +++ @@ -25,9 +25,9 @@ def _pickle_serialize(obj): try: return pickle.dumps(obj, protocol=2) - # Python<=3.4 raises pickle.PicklingError here while - # Python>=3.5 raises AttributeError and - # Python>=3.6 raises TypeError + # Python <= 3.4 raises pickle.PicklingError here while + # 3...