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
6de5612c0e92b4e7c7ca56b59d7fd5859aeb3409
apps/polls/urls.py
apps/polls/urls.py
from django.conf.urls import patterns, url from apps.polls import views urlpatterns = patterns('', # ex: /polls/ url(r'^$', views.index, name='index'), # ex: /polls/5 url(r'^(?P<poll_id>\d+)/$', views.detail, name='detail'), # ex: /polls/5/results/ url(r'^(?P<poll_id>\d+)/results/$', views.results, name='res...
from django.conf.urls import patterns, url from apps.polls import views urlpatterns = patterns('', # ex: /polls/ url(r'^$', views.IndexView.as_view(), name='index'), # ex: /polls/5 url(r'^(?P<poll_id>\d+)/$', views.DetailView.as_view(), name='detail'), # ex: /polls/5/results/ url(r'^(?P<poll_id>\d+)/results/...
Use generic views: Less code is better
Use generic views: Less code is better
Python
bsd-3-clause
hoale/teracy-tutorial,hoale/teracy-tutorial
--- +++ @@ -4,11 +4,11 @@ urlpatterns = patterns('', # ex: /polls/ - url(r'^$', views.index, name='index'), + url(r'^$', views.IndexView.as_view(), name='index'), # ex: /polls/5 - url(r'^(?P<poll_id>\d+)/$', views.detail, name='detail'), + url(r'^(?P<poll_id>\d+)/$', views.DetailView.as_view(), name='detai...
8849f78d8e9d63942162264d4223e9db277142d7
aligot/tests/test_user.py
aligot/tests/test_user.py
# coding: utf-8 from django.core.urlresolvers import reverse from django.test import TestCase from rest_framework import status from rest_framework.test import APIClient from ..models import User class TestUser(TestCase): def setUp(self): self.client = APIClient() def test_create_without_params(se...
# coding: utf-8 from django.core.urlresolvers import reverse from django.test import TestCase from rest_framework import status from rest_framework.test import APIClient from ..models import User class TestUser(TestCase): def setUp(self): self.client = APIClient() def test_create_without_params(se...
Add test to delete user in DB
Add test to delete user in DB
Python
mit
aligot-project/aligot,aligot-project/aligot,aligot-project/aligot,skitoo/aligot
--- +++ @@ -34,6 +34,21 @@ user = User.objects.all()[0] self.assertEqual(user.username, data['username'], 'Username in DB don\'t match') + def test_delete(self): + """ + Simple deletion of an user in DB + Wait for 204 response. + """ + user = User.objects.crea...
55e0c877dbe1a073534c9cf445ffe58715160b8e
metadata/RomsLite/hooks/post-stage.py
metadata/RomsLite/hooks/post-stage.py
import os import shutil from wmt.utils.hook import find_simulation_input_file def execute(env): """Perform post-stage tasks for running a component. Parameters ---------- env : dict A dict of component parameter values from WMT. """ for name in ('river_forcing_file', 'waves_forcing_fi...
import os import shutil from wmt.utils.hook import find_simulation_input_file _DEFAULT_FILES = { 'river_forcing_file': 'river.nc', 'waves_forcing_file': 'waves.nc', } def execute(env): """Perform post-stage tasks for running a component. Parameters ---------- env : dict A dict of comp...
Remove default forcing files if not being used.
Remove default forcing files if not being used.
Python
mit
csdms/wmt-metadata
--- +++ @@ -3,6 +3,11 @@ from wmt.utils.hook import find_simulation_input_file + +_DEFAULT_FILES = { + 'river_forcing_file': 'river.nc', + 'waves_forcing_file': 'waves.nc', +} def execute(env): """Perform post-stage tasks for running a component. @@ -13,6 +18,12 @@ A dict of component parame...
6d68d07f30f2244b13207c6eaf9d4662492b04e2
run.py
run.py
#!/usr/bin/env python from flask_debugtoolbar import DebugToolbarExtension from app import app from app.models import connect_to_db if __name__ == '__main__': # debug = True as DebugToolbarExtension is invoked connect_to_db(app) # User the DebugToolbar # DebugToolbarExtension(app) PORT = int(os...
#!/usr/bin/env python from flask_debugtoolbar import DebugToolbarExtension from app import app from app.models import connect_to_db if __name__ == '__main__': # debug = True as DebugToolbarExtension is invoked connect_to_db(app) # User the DebugToolbar # DebugToolbarExtension(app) PORT = int...
Change indentation tab to spaces.
Change indentation tab to spaces.
Python
bsd-3-clause
vanesa/kid-o,vanesa/kid-o,vanesa/kid-o,vanesa/kid-o
--- +++ @@ -15,6 +15,6 @@ # User the DebugToolbar # DebugToolbarExtension(app) - PORT = int(os.environ.get("PORT", 5000)) + PORT = int(os.environ.get("PORT", 5000)) - app.run(debug=True, host="0.0.0.0", port=PORT) + app.run(debug=True, host="0.0.0.0", port=PORT)
442136bb1d32baa1be50c3b88caed344e3979cd3
website/project/taxonomies/__init__.py
website/project/taxonomies/__init__.py
from modularodm import fields from framework.mongo import ( ObjectId, StoredObject, utils as mongo_utils ) @mongo_utils.unique_on(['id', '_id']) class Subject(StoredObject): _id = fields.StringField(primary=True, default=lambda: str(ObjectId())) type = fields.StringField(required=True) text =...
from modularodm import fields from framework.mongo import ( ObjectId, StoredObject, utils as mongo_utils ) from website.util import api_v2_url @mongo_utils.unique_on(['text']) class Subject(StoredObject): _id = fields.StringField(primary=True, default=lambda: str(ObjectId())) text = fields.String...
Update Subject model -remove superfluous type field -fix parents field type -update url building
Update Subject model -remove superfluous type field -fix parents field type -update url building
Python
apache-2.0
TomBaxter/osf.io,Johnetordoff/osf.io,samchrisinger/osf.io,sloria/osf.io,alexschiller/osf.io,emetsger/osf.io,laurenrevere/osf.io,cwisecarver/osf.io,adlius/osf.io,CenterForOpenScience/osf.io,chennan47/osf.io,rdhyee/osf.io,chennan47/osf.io,HalcyonChimera/osf.io,mluo613/osf.io,chrisseto/osf.io,hmoco/osf.io,felliott/osf.io,...
--- +++ @@ -6,13 +6,17 @@ utils as mongo_utils ) +from website.util import api_v2_url -@mongo_utils.unique_on(['id', '_id']) +@mongo_utils.unique_on(['text']) class Subject(StoredObject): _id = fields.StringField(primary=True, default=lambda: str(ObjectId())) - type = fields.StringField(required=Tr...
e391aa732eb0e713e7dc6bb9c767998425bc987b
src/server/__init__.py
src/server/__init__.py
""" telepathy-python - Base classes defining the interfaces of the Telepathy framework Copyright (C) 2005, 2006 Collabora Limited Copyright (C) 2005, 2006 Nokia Corporation Copyright (C) 2006 INdT This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public ...
""" telepathy-python - Base classes defining the interfaces of the Telepathy framework Copyright (C) 2005, 2006 Collabora Limited Copyright (C) 2005, 2006 Nokia Corporation Copyright (C) 2006 INdT This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public ...
Add the generated Client interfaces to the telepathy.server namespace
Add the generated Client interfaces to the telepathy.server namespace
Python
lgpl-2.1
PabloCastellano/telepathy-python,freedesktop-unofficial-mirror/telepathy__telepathy-python,PabloCastellano/telepathy-python,detrout/telepathy-python,epage/telepathy-python,max-posedon/telepathy-python,epage/telepathy-python,max-posedon/telepathy-python,freedesktop-unofficial-mirror/telepathy__telepathy-python,detrout/t...
--- +++ @@ -29,4 +29,9 @@ from telepathy.server.media import * from telepathy.server.properties import * +from telepathy._generated.Client_Observer import ClientObserver +from telepathy._generated.Client_Approver import ClientApprover +from telepathy._generated.Client_Handler import ClientHandler +from telepathy....
f980e56d583f1669d56bef6e15df8c2818f99467
ejpi/constants.py
ejpi/constants.py
__pretty_app_name__ = "e**(j pi) + 1 = 0" __app_name__ = "ejpi" __version__ = "1.0.7" __build__ = 2 __app_magic__ = 0xdeadbeef IS_MAEMO = True
__pretty_app_name__ = "e**(j pi) + 1 = 0" __app_name__ = "ejpi" __version__ = "1.0.7" __build__ = 3 __app_magic__ = 0xdeadbeef IS_MAEMO = True
Bump for icon harmattan build
Bump for icon harmattan build
Python
lgpl-2.1
epage/ejpi,epage/ejpi,epage/ejpi
--- +++ @@ -1,7 +1,7 @@ __pretty_app_name__ = "e**(j pi) + 1 = 0" __app_name__ = "ejpi" __version__ = "1.0.7" -__build__ = 2 +__build__ = 3 __app_magic__ = 0xdeadbeef IS_MAEMO = True
d3428d9bb8baf67176e1bd6a22b96845ebcdf42e
indico/migrations/versions/201705221530_3ca338ed5192_remove_background_image_and_add.py
indico/migrations/versions/201705221530_3ca338ed5192_remove_background_image_and_add.py
"""Add backside_template column Revision ID: 3ca338ed5192 Revises: 35d76c40ca48 Create Date: 2017-05-17 11:33:30.295538 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = '3ca338ed5192' down_revision = '35d76c40ca48' branch_labels = None depends_on = None def up...
"""Add backside_template column Revision ID: 3ca338ed5192 Revises: 35d76c40ca48 Create Date: 2017-05-17 11:33:30.295538 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = '3ca338ed5192' down_revision = '35d76c40ca48' branch_labels = None depends_on = None def up...
Add missing index command in revision
Designer: Add missing index command in revision
Python
mit
pferreir/indico,pferreir/indico,OmeGak/indico,mvidalgarcia/indico,mvidalgarcia/indico,indico/indico,indico/indico,OmeGak/indico,mvidalgarcia/indico,pferreir/indico,pferreir/indico,ThiefMaster/indico,mic4ael/indico,indico/indico,OmeGak/indico,mic4ael/indico,mvidalgarcia/indico,mic4ael/indico,ThiefMaster/indico,ThiefMast...
--- +++ @@ -22,9 +22,11 @@ 'designer_templates', 'designer_templates', ['backside_template_id'], ['id'], source_schema='indico', referent_schema='indico') + op.create_index(None, 'designer_templates', ['backside_template_id'], schema=...
abc1d8c52b9893f1695b2f81126b22820cddfc67
src/argon2/__init__.py
src/argon2/__init__.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function from . import exceptions, low_level from ._legacy import ( hash_password, hash_password_raw, verify_password, ) from ._password_hasher import ( DEFAULT_HASH_LENGTH, DEFAULT_MEMORY_COST, DEFAULT_PARALLELISM...
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function from . import exceptions, low_level from ._legacy import ( hash_password, hash_password_raw, verify_password, ) from ._password_hasher import ( DEFAULT_HASH_LENGTH, DEFAULT_MEMORY_COST, DEFAULT_PARALLELISM...
Remove unimported symbols from __all__
Remove unimported symbols from __all__ I don't quite understand, why flake8 didn't catch this...
Python
mit
hynek/argon2_cffi,hynek/argon2_cffi
--- +++ @@ -43,9 +43,6 @@ "exceptions", "hash_password", "hash_password_raw", - "hash_secret", - "hash_secret_raw", "low_level", "verify_password", - "verify_secret", ]
98cd52a2c635a50b6664212ace5e98090246aba2
python/bracket-push/bracket_push.py
python/bracket-push/bracket_push.py
class CheckBrackets: OPENERS = {'{': '}', '[': ']', '(': ')'} CLOSERS = set(OPENERS.values()) def __init__(self, inp): self.check_brackets = self.build_stack(inp) def build_stack(self, inp): stack = [] for char in list(inp): if char in ...
class CheckBrackets: OPENERS = {'{': '}', '[': ']', '(': ')'} CLOSERS = set(OPENERS.values()) def __init__(self, inp): self.check_brackets = self.build_stack(inp) def build_stack(self, inp): stack = [] for char in list(inp): if char in ...
Fix method name to conform to tests
Fix method name to conform to tests
Python
mit
rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism,rootulp/exercism
--- +++ @@ -24,5 +24,5 @@ return cls.OPENERS[opener] == closer -def check_brackets(inp): +def is_paired(inp): return CheckBrackets(inp).check_brackets
830119c570ed9ec3693d9e002b07777c5542bb1f
modelToParseFile/parseFileBacteriaList.py
modelToParseFile/parseFileBacteriaList.py
class parseFileBacteriaList: 'Class for read and print information from text file' bacteriaName = [] fileName = "" def __init__(self,fileName): self.fileName = fileName def readFile(self): file = open(self.fileName).readlines() for linia in file: print linia
class parseFileBacteriaList: 'Class for read and print information from text file' bacteriaName = [] fileName = "" def __init__(self,fileName): self.fileName = fileName def readFile(self): file = open(self.fileName).readlines() listBacteria = [] listDeseases = [] ...
Split text by \t, and added lists of bacteria and diseases
Split text by \t, and added lists of bacteria and diseases
Python
apache-2.0
kgruba/oop_python
--- +++ @@ -8,5 +8,11 @@ def readFile(self): file = open(self.fileName).readlines() + listBacteria = [] + listDeseases = [] for linia in file: - print linia + line = linia.split("\t") + listBacteria.append(line[0]) + listDeseases.appen...
cd359f8487ee5aab3645a0089695967802e485d0
samples/python/uppercase/py/func.py
samples/python/uppercase/py/func.py
import os,sys sys.path.insert(0, os.path.abspath('.')) import grpc import time import function_pb2_grpc as function import fntypes_pb2 as types from concurrent import futures class StringFunctionServicer(function.StringFunctionServicer): def Call(self, request, context): reply = types.Reply() rep...
import os,sys sys.path.insert(0, os.path.abspath('.')) import grpc import time import function_pb2_grpc as function import fntypes_pb2 as types from concurrent import futures ''' This method’s semantics are a combination of those of the request-streaming method and the response-streaming method. It is passed an iter...
Enable GRPC Streaming in Python uppercase sample
Enable GRPC Streaming in Python uppercase sample
Python
apache-2.0
markfisher/sk8s,markfisher/sk8s,markfisher/sk8s,markfisher/sk8s
--- +++ @@ -7,12 +7,17 @@ import fntypes_pb2 as types from concurrent import futures +''' +This method’s semantics are a combination of those of the request-streaming method and the response-streaming method. +It is passed an iterator of request values and is itself an iterator of response values. +''' class St...
34fdb69aa6a414c65a05ee25a0cb1b09e3196221
packages/cardpay-subgraph-extraction/export.py
packages/cardpay-subgraph-extraction/export.py
from subgraph_extractor.cli import extract_from_config import click from cloudpathlib import AnyPath @click.command() @click.option( "--subgraph-config-folder", help="The folder containing the subgraph config files", default='config', ) @click.option( "--database-string", default="postgresql://grap...
from subgraph_extractor.cli import extract_from_config import click from cloudpathlib import AnyPath import os @click.command() @click.option( "--subgraph-config-folder", help="The folder containing the subgraph config files", default="config", ) @click.option( "--database-string", default=os.envi...
Support environment variables for the extraction
Support environment variables for the extraction
Python
mit
cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack
--- +++ @@ -1,30 +1,32 @@ from subgraph_extractor.cli import extract_from_config import click from cloudpathlib import AnyPath +import os + @click.command() @click.option( "--subgraph-config-folder", help="The folder containing the subgraph config files", - default='config', + default="config",...
1e980277f53d12686264b8ce816e65ffea16a2dd
examples/basic.py
examples/basic.py
from simpleflow import ( activity, Workflow, ) @activity.with_attributes(task_list='quickstart') def increment(x): return x + 1 @activity.with_attributes(task_list='quickstart') def double(x): return x * 2 class BasicWorkflow(Workflow): name = 'basic' version = 'example' def run(self,...
import time from simpleflow import ( activity, Workflow, ) @activity.with_attributes(task_list='quickstart') def increment(x): return x + 1 @activity.with_attributes(task_list='quickstart') def double(x): return x * 2 @activity.with_attributes(task_list='quickstart', version='example') def delay(...
Update example: add a delay task
Update example: add a delay task
Python
mit
botify-labs/simpleflow,botify-labs/simpleflow
--- +++ @@ -1,3 +1,5 @@ +import time + from simpleflow import ( activity, Workflow, @@ -14,13 +16,20 @@ return x * 2 +@activity.with_attributes(task_list='quickstart', version='example') +def delay(t, x): + time.sleep(t) + return x + + class BasicWorkflow(Workflow): name = 'basic' ...
2548c8a46b04a34db218e522704fa171d8d6f7b7
nephele.py
nephele.py
"""Nephele - Finding movies to watch on the internet is easy, finding GOOD movies to watch is hard. Let Nephele, the greek nymph of the clouds, help you. Usage: nephele.py get_popular [--debug] nephele.py get_grades <directory> [--debug] Options: -h --help Show this screen. --debug Print debug infor...
"""Nephele - Finding movies to watch on the internet is easy, finding GOOD movies to watch is hard. Let Nephele, the greek nymph of the clouds, help you. Usage: nephele.py get_popular [--debug] nephele.py get_grades <directory> [--debug] Options: -h --help Show this screen. --debug Print deb...
Use four spaces, just like in Python.
Use four spaces, just like in Python.
Python
mit
EmilStenstrom/nephele
--- +++ @@ -3,12 +3,12 @@ nymph of the clouds, help you. Usage: - nephele.py get_popular [--debug] - nephele.py get_grades <directory> [--debug] + nephele.py get_popular [--debug] + nephele.py get_grades <directory> [--debug] Options: - -h --help Show this screen. - --debug Print debug info...
942044eeab89d81b75836268b3635d49a4dbb3ee
ynr/apps/parties/management/commands/parties_import_from_ec.py
ynr/apps/parties/management/commands/parties_import_from_ec.py
from django.core.management.base import BaseCommand from parties.importer import ECPartyImporter from parties.models import PartyEmblem class Command(BaseCommand): help = "My shiny new management command." def add_arguments(self, parser): parser.add_argument("--clear-emblems", action="store_true") ...
from django.core.management.base import BaseCommand from parties.importer import ECPartyImporter from parties.models import PartyEmblem class Command(BaseCommand): help = """ Import policital parties that can stand candidates from The Electoral Commission's API in to the Parties app. This ...
Document the party importer command
Document the party importer command
Python
agpl-3.0
DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative
--- +++ @@ -5,12 +5,33 @@ class Command(BaseCommand): - help = "My shiny new management command." + help = """ + Import policital parties that can stand candidates from The Electoral + Commission's API in to the Parties app. + + + This command creates 3 types of object: parties, descripti...
08afe7e2946f4343d016f55bfacb4f7bac1d3cb2
herana/urls.py
herana/urls.py
from django.conf.urls import patterns, include, url from django.contrib.auth import views as auth_views from django.contrib import admin from django.views.generic.base import RedirectView urlpatterns = patterns('', url(r'^$', 'herana.views.home', name='home'), url(r'^grappelli/', include('grappelli.urls')), ...
from django.conf.urls import patterns, include, url from django.contrib.auth import views as auth_views from django.contrib import admin admin.site.index_title = 'Dashboard' urlpatterns = patterns('', url(r'^$', 'herana.views.home', name='home'), url(r'^grappelli/', include('grappelli.urls')), url(r'^acco...
Change admin index title: 'Dashboard'
Change admin index title: 'Dashboard'
Python
mit
Code4SA/herana,Code4SA/herana,Code4SA/herana,Code4SA/herana
--- +++ @@ -1,8 +1,8 @@ from django.conf.urls import patterns, include, url from django.contrib.auth import views as auth_views from django.contrib import admin -from django.views.generic.base import RedirectView +admin.site.index_title = 'Dashboard' urlpatterns = patterns('', url(r'^$', 'herana.views.ho...
e388e3490502acac90ef4c249ba1af63b5698ab7
print_web_django/api/views.py
print_web_django/api/views.py
from rest_framework import viewsets from . import serializers, models class PrintJobViewSet(viewsets.ModelViewSet): serializer_class = serializers.PrintJobSerializer def get_queryset(self): return self.request.user.printjobs.all()
from rest_framework import viewsets from . import serializers, models class PrintJobViewSet(viewsets.ModelViewSet): serializer_class = serializers.PrintJobSerializer def get_queryset(self): return self.request.user.printjobs.all() def perform_create(self, serializer): # need to also pass...
Add user to posted print object
Add user to posted print object
Python
mit
aabmass/print-web,aabmass/print-web,aabmass/print-web
--- +++ @@ -7,3 +7,7 @@ def get_queryset(self): return self.request.user.printjobs.all() + + def perform_create(self, serializer): + # need to also pass the requests user on a create + serializer.save(user=self.request.user)
be915a11ebd0d9c4e8a0a52b1bdcc7ca2abfbfb1
sms_sender.py
sms_sender.py
from kafka import KafkaConsumer import os import nexmo import json client = nexmo.Client( key=os.environ["API_KEY"], secret=os.environ["API_SECRET"]) consumer = KafkaConsumer(bootstrap_servers=os.environ["KAFKA"], value_deserializer=lambda m: json.loads(m...
from kafka import KafkaConsumer import os import nexmo import json client = nexmo.Client( key=os.environ["API_KEY"], secret=os.environ["API_SECRET"]) consumer = KafkaConsumer(bootstrap_servers=os.environ["KAFKA"], value_deserializer=lambda m: json.loads(m...
Change topic + add exception handling
Change topic + add exception handling
Python
apache-2.0
antongorshkov/kafkasms
--- +++ @@ -7,10 +7,13 @@ secret=os.environ["API_SECRET"]) consumer = KafkaConsumer(bootstrap_servers=os.environ["KAFKA"], value_deserializer=lambda m: json.loads(m.decode('ascii'))) -consumer.subscribe(['kafka_test1']) +consumer.subscribe(['sms_response']...
9792b1a03af3a3a3c0b9d517cefaee4c137c2a2d
pyirt/utl/__init__.py
pyirt/utl/__init__.py
__all__ = ["tools", "loader", "clib"] from . import tools from . import loader import pyximport pyximport.install(build_in_temp=True) from . import clib
__all__ = ["tools", "loader", "clib"] from . import tools from . import loader import pyximport pyximport.install(build_dir="/tmp/pyximport/", build_in_temp=True) from . import clib
Add custom build_dir opt for pyximport.install
Add custom build_dir opt for pyximport.install
Python
mit
17zuoye/pyirt,arunlodhi/pyirt,wlbksy/pyirt
--- +++ @@ -4,5 +4,5 @@ from . import loader import pyximport -pyximport.install(build_in_temp=True) +pyximport.install(build_dir="/tmp/pyximport/", build_in_temp=True) from . import clib
002a598afbdf86472611c018d17d0eff8a9690aa
flocker/provision/_sphinx.py
flocker/provision/_sphinx.py
from docutils.parsers.rst import Directive from twisted.python.reflect import namedAny from docutils import nodes from docutils.statemachine import StringList class FakeRunner(object): def __init__(self): self.commands = [] def run(self, command): self.commands.extend(command.splitlines()) ...
# Copyright Hybrid Logic Ltd. See LICENSE file for details. from inspect import getsourcefile from docutils.parsers.rst import Directive from docutils import nodes from docutils.statemachine import StringList from twisted.python.reflect import namedAny class FakeRunner(object): def __init__(self): self...
Add state change to sphinx plugin.
Add state change to sphinx plugin.
Python
apache-2.0
jml/flocker,wallnerryan/flocker-profiles,runcom/flocker,adamtheturtle/flocker,lukemarsden/flocker,1d4Nf6/flocker,mbrukman/flocker,Azulinho/flocker,moypray/flocker,AndyHuu/flocker,lukemarsden/flocker,agonzalezro/flocker,jml/flocker,1d4Nf6/flocker,runcom/flocker,agonzalezro/flocker,hackday-profilers/flocker,achanda/flock...
--- +++ @@ -1,7 +1,11 @@ +# Copyright Hybrid Logic Ltd. See LICENSE file for details. + +from inspect import getsourcefile from docutils.parsers.rst import Directive -from twisted.python.reflect import namedAny from docutils import nodes from docutils.statemachine import StringList + +from twisted.python.reflect ...
e5bf18be1ad32a39f0eef2bbc8f5bd4674cef7a5
tests/test_dump.py
tests/test_dump.py
""" Testing gitwash dumper """ from os.path import join as pjoin, dirname, split as psplit import shutil from tempfile import mkdtemp from subprocess import call from nose.tools import assert_true, assert_equal, assert_raises _downpath, _ = psplit(dirname(__file__)) EXE_PTH = pjoin(_downpath, 'gitwash_dumper.py') TM...
""" Testing gitwash dumper """ import os from os.path import join as pjoin, dirname, split as psplit import shutil from tempfile import mkdtemp from subprocess import call from nose.tools import assert_true, assert_false, assert_equal, assert_raises _downpath, _ = psplit(dirname(__file__)) _downpath = os.path.abspat...
TEST - add test for replacement in files
TEST - add test for replacement in files
Python
bsd-2-clause
QuLogic/gitwash,QuLogic/gitwash
--- +++ @@ -1,15 +1,18 @@ """ Testing gitwash dumper """ +import os from os.path import join as pjoin, dirname, split as psplit import shutil from tempfile import mkdtemp from subprocess import call -from nose.tools import assert_true, assert_equal, assert_raises +from nose.tools import assert_true, assert_...
d2438a4f3618a2f087ddf49380c5753a4b9805d5
zou/app/models/attachment_file.py
zou/app/models/attachment_file.py
from sqlalchemy_utils import UUIDType from zou.app import db from zou.app.models.serializer import SerializerMixin from zou.app.models.base import BaseMixin class AttachmentFile(db.Model, BaseMixin, SerializerMixin): """ Describes a file which is attached to a comment. """ name = db.Column(db.String...
from sqlalchemy_utils import UUIDType from zou.app import db from zou.app.models.serializer import SerializerMixin from zou.app.models.base import BaseMixin class AttachmentFile(db.Model, BaseMixin, SerializerMixin): """ Describes a file which is attached to a comment. """ name = db.Column(db.String...
Fix import for attachment files
[sync] Fix import for attachment files
Python
agpl-3.0
cgwire/zou
--- +++ @@ -32,3 +32,15 @@ "extension": self.extension, "size": self.size, } + + @classmethod + def create_from_import(cls, data): + data.pop("type", None) + data.pop("comment", None) + previous_data = cls.get(data["id"]) + if previous_data is None:...
fea9c44be08719f0fcca98a1d531a83c9db4c6af
tests/test_urls.py
tests/test_urls.py
import pytest from django.conf import settings from pytest_django_test.compat import force_text pytestmark = pytest.mark.urls('pytest_django_test.urls_overridden') try: from django.core.urlresolvers import is_valid_path except ImportError: from django.core.urlresolvers import resolve, Resolver404 def is...
import pytest from django.conf import settings from pytest_django_test.compat import force_text try: from django.core.urlresolvers import is_valid_path except ImportError: from django.core.urlresolvers import resolve, Resolver404 def is_valid_path(path, urlconf=None): """Return True if path reso...
Add test to confirm url cache is cleared
Add test to confirm url cache is cleared
Python
bsd-3-clause
pombredanne/pytest_django,thedrow/pytest-django,ktosiek/pytest-django,tomviner/pytest-django
--- +++ @@ -3,7 +3,6 @@ from pytest_django_test.compat import force_text -pytestmark = pytest.mark.urls('pytest_django_test.urls_overridden') try: from django.core.urlresolvers import is_valid_path @@ -24,11 +23,43 @@ return False +@pytest.mark.urls('pytest_django_test.urls_overridden') ...
9f0b9b68a3c9dfaa64942e55fc97e435b8eb6f50
bayespy/nodes/__init__.py
bayespy/nodes/__init__.py
################################################################################ # Copyright (C) 2013 Jaakko Luttinen # # This file is licensed under the MIT License. ################################################################################ """ Package for nodes used to construct the model. Stochastic nodes =...
################################################################################ # Copyright (C) 2013 Jaakko Luttinen # # This file is licensed under the MIT License. ################################################################################ """ Package for nodes used to construct the model. Stochastic nodes =...
Include Add node in user API documentation
DOC: Include Add node in user API documentation
Python
mit
bayespy/bayespy,jluttine/bayespy
--- +++ @@ -86,6 +86,7 @@ Dot SumMultiply + Add Gate """
30f0b99a2233c6009a3c41d9b22e3f946c40c3cf
kitchen/urls.py
kitchen/urls.py
"""Root URL routing""" from django.conf.urls.defaults import patterns from django.conf.urls.static import static from django.views.generic import TemplateView from kitchen.dashboard import api import kitchen.settings as settings urlpatterns = patterns('', (r'^$', 'kitchen.dashboard.views.list'), (r'^virt/$',...
"""Root URL routing""" from django.conf.urls.defaults import patterns from django.conf.urls.static import static from django.views.generic import TemplateView from kitchen.dashboard import api import kitchen.settings as settings if settings.SHOW_LIST_VIEW: root_view = 'kitchen.dashboard.views.list' elif settings...
Set root view depending on what views are enabled
Set root view depending on what views are enabled
Python
apache-2.0
edelight/kitchen,edelight/kitchen,edelight/kitchen,edelight/kitchen
--- +++ @@ -7,8 +7,18 @@ import kitchen.settings as settings +if settings.SHOW_LIST_VIEW: + root_view = 'kitchen.dashboard.views.list' +elif settings.SHOW_VIRT_VIEW: + root_view = 'kitchen.dashboard.views.virt' +elif settings.SHOW_GRAPH_VIEW: + root_view = 'kitchen.dashboard.views.graph' +else: + rai...
8c05a08d3d0a9a759c7bbbca6a975d5dfc0e166b
apps/auth/db/db.py
apps/auth/db/db.py
# -*- coding: utf-8; -*- # # This file is part of Superdesk. # # Copyright 2013, 2014 Sourcefabric z.u. and contributors. # # For the full copyright and license information, please see the # AUTHORS and LICENSE files distributed with this source code, or # at https://www.sourcefabric.org/superdesk/license import bcryp...
# -*- coding: utf-8; -*- # # This file is part of Superdesk. # # Copyright 2013, 2014 Sourcefabric z.u. and contributors. # # For the full copyright and license information, please see the # AUTHORS and LICENSE files distributed with this source code, or # at https://www.sourcefabric.org/superdesk/license import bcryp...
Check that the session is the right one
[SD-1422] Check that the session is the right one
Python
agpl-3.0
fritzSF/superdesk,verifiedpixel/superdesk,fritzSF/superdesk,akintolga/superdesk,fritzSF/superdesk,superdesk/superdesk-aap,ancafarcas/superdesk,darconny/superdesk,ancafarcas/superdesk,darconny/superdesk,verifiedpixel/superdesk,akintolga/superdesk-aap,Aca-jov/superdesk,sivakuna-aap/superdesk,mugurrus/superdesk,ioanpocol/...
--- +++ @@ -12,7 +12,7 @@ from apps.auth.service import AuthService from superdesk import get_resource_service from superdesk.errors import CredentialsAuthError -from flask import current_app as app +from flask import g, current_app as app class DbAuthService(AuthService): @@ -44,3 +44,10 @@ ''' ...
6ff11990b7d22be537eb6cbf4f373e1e416ecaf2
spiralgalaxygame/tests/test_callee.py
spiralgalaxygame/tests/test_callee.py
import unittest from spiralgalaxygame import callee class calleeTests (unittest.TestCase): def test_str_of_func(self): def my_func(): pass self.assertEqual(callee.name_of(my_func), 'my_func') def test_str_of_type(self): class MyType (object): pass self.assertEqual(callee.na...
import unittest from spiralgalaxygame import callee class calleeTests (unittest.TestCase): def test_str_of_func(self): def my_func(): pass self.assertEqual(callee.name_of(my_func), 'my_func') def test_str_of_type(self): class MyType (object): pass self.assertEqu...
Break an empty func definition into multiple lines for clearer coverage output.
Break an empty func definition into multiple lines for clearer coverage output.
Python
agpl-3.0
nejucomo/sgg,nejucomo/sgg,nejucomo/sgg
--- +++ @@ -5,7 +5,8 @@ class calleeTests (unittest.TestCase): def test_str_of_func(self): - def my_func(): pass + def my_func(): + pass self.assertEqual(callee.name_of(my_func), 'my_func')
ad813973421ed828f724a999fabbc12c4e429247
src/nodeconductor_paas_oracle/filters.py
src/nodeconductor_paas_oracle/filters.py
import django_filters from .models import Deployment class DeploymentFilter(django_filters.FilterSet): db_name = django_filters.CharFilter() state = django_filters.CharFilter() class Meta(object): model = Deployment fields = [ 'db_name', 'state', ] ...
import django_filters from nodeconductor.structure.filters import BaseResourceStateFilter from .models import Deployment class DeploymentFilter(BaseResourceStateFilter): db_name = django_filters.CharFilter() class Meta(BaseResourceStateFilter.Meta): model = Deployment fields = [ ...
Use generic state filter instead of custom one
Use generic state filter instead of custom one - ITACLOUD-6837
Python
mit
opennode/nodeconductor-paas-oracle
--- +++ @@ -1,13 +1,13 @@ import django_filters +from nodeconductor.structure.filters import BaseResourceStateFilter from .models import Deployment -class DeploymentFilter(django_filters.FilterSet): +class DeploymentFilter(BaseResourceStateFilter): db_name = django_filters.CharFilter() - state = djang...
d4da069b43174482f3a75e9553e8283be905fa16
cla_public/apps/base/filters.py
cla_public/apps/base/filters.py
# -*- coding: utf-8 -*- "Jinja custom filters" import re from cla_public.apps.base import base from babel.dates import format_datetime @base.app_template_filter() def datetime(dt, format='medium', locale='en_GB'): if format == 'full': format = "EEEE, d MMMM y 'at' HH:mm" elif format == 'medium': ...
# -*- coding: utf-8 -*- "Jinja custom filters" import re from urlparse import urlparse, parse_qs from cla_public.apps.base import base from babel.dates import format_datetime @base.app_template_filter() def datetime(dt, format='medium', locale='en_GB'): if format == 'full': format = "EEEE, d MMMM y 'at' ...
Add Jinja filter to convert URL params to dict
BE: Add Jinja filter to convert URL params to dict
Python
mit
ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public
--- +++ @@ -2,6 +2,7 @@ "Jinja custom filters" import re +from urlparse import urlparse, parse_qs from cla_public.apps.base import base from babel.dates import format_datetime
cd374366dc6d49cc543a037fba8398e5b724c382
tabula/util.py
tabula/util.py
import warnings import platform def deprecated(func): """This is a decorator which can be used to mark functions as deprecated. It will result in a warning being emmitted when the function is used.""" def newFunc(*args, **kwargs): warnings.warn("Call to deprecated function {}.".format(func.__n...
import warnings import platform def deprecated(func): """This is a decorator which can be used to mark functions as deprecated. It will result in a warning being emmitted when the function is used.""" def newFunc(*args, **kwargs): warnings.warn("Call to deprecated function {}.".format(func.__n...
Remove textwrap because python 2.7 lacks indent() function
Remove textwrap because python 2.7 lacks indent() function
Python
mit
chezou/tabula-py
--- +++ @@ -36,13 +36,12 @@ def environment_info(): import sys import distro - import textwrap from .__version__ import __version__ print("""Python version: {} Java version: -{} + {} tabula-py version: {} platform: {} uname: @@ -51,7 +50,7 @@ mac_ver: {} """.format( ...
ab640dc35ff87bc32e1e3b54012f69610e73d8d0
sync_scheduler.py
sync_scheduler.py
from tapiriik.database import db from tapiriik.messagequeue import mq from tapiriik.sync import Sync import kombu from datetime import datetime import time Sync.InitializeWorkerBindings() producer = kombu.Producer(Sync._channel, Sync._exchange) while True: queueing_at = datetime.utcnow() users = db.users.find( ...
from tapiriik.database import db from tapiriik.messagequeue import mq from tapiriik.sync import Sync from datetime import datetime from pymongo.read_preferences import ReadPreference import kombu import time Sync.InitializeWorkerBindings() producer = kombu.Producer(Sync._channel, Sync._exchange) while True: queuein...
Make scheduler do primary reads only
Make scheduler do primary reads only
Python
apache-2.0
cmgrote/tapiriik,niosus/tapiriik,gavioto/tapiriik,dlenski/tapiriik,olamy/tapiriik,cmgrote/tapiriik,olamy/tapiriik,cheatos101/tapiriik,gavioto/tapiriik,marxin/tapiriik,niosus/tapiriik,cheatos101/tapiriik,cheatos101/tapiriik,mduggan/tapiriik,campbellr/tapiriik,abs0/tapiriik,mjnbike/tapiriik,niosus/tapiriik,marxin/tapirii...
--- +++ @@ -1,8 +1,9 @@ from tapiriik.database import db from tapiriik.messagequeue import mq from tapiriik.sync import Sync +from datetime import datetime +from pymongo.read_preferences import ReadPreference import kombu -from datetime import datetime import time Sync.InitializeWorkerBindings() @@ -18,7 +19,...
a7328bd229070126ca5b09bb1c9fe4c5e319bb04
members/urls.py
members/urls.py
from django.conf.urls import patterns, url from django.contrib import auth urlpatterns = patterns('members.views', url(r'^login/$', 'login', name='login'), url(r'^logout/$', 'logout', name='logout'), url(r'^search/(?P<name>.*)/$', 'search', name='search'), url(r'^archive/$', 'archive_student_council', ...
from django.conf.urls import patterns, url from django.contrib import auth urlpatterns = patterns('members.views', url(r'^login/$', 'login', name='login'), url(r'^logout/$', 'logout', name='logout'), url(r'^search/(?P<name>.*)/$', 'search', name='search'), url(r'^archive/$', 'archive_student_council', ...
Add url for user's profile
Add url for user's profile
Python
mit
Hackfmi/Diaphanum,Hackfmi/Diaphanum
--- +++ @@ -6,4 +6,5 @@ url(r'^logout/$', 'logout', name='logout'), url(r'^search/(?P<name>.*)/$', 'search', name='search'), url(r'^archive/$', 'archive_student_council', name='archive_student_council'), + url(r'^profile/$', 'user_projects', name='user-projects'), )
dbc7ad0dad6161d19f65bbf186d84d23628cfd16
setup.py
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- try: from setuptools import setup except ImportError: from distutils.core import setup with open('README.rst') as readme_file: readme = readme_file.read() with open('HISTORY.rst') as history_file: history = history_file.read().replace('.. :changelog:', ...
#!/usr/bin/env python # -*- coding: utf-8 -*- try: from setuptools import setup except ImportError: from distutils.core import setup with open('README.rst') as readme_file: readme = readme_file.read() with open('HISTORY.rst') as history_file: history = history_file.read().replace('.. :changelog:', ...
Add entry point for the CLI script
Add entry point for the CLI script
Python
mit
jcollado/pic2map,jcollado/pic2map,jcollado/pic2map
--- +++ @@ -40,6 +40,11 @@ license="BSD", zip_safe=False, keywords='picture map location', + entry_points={ + 'console_scripts': [ + 'pic2map = pic2map.cli:main', + ] + }, classifiers=[ 'Development Status :: 2 - Pre-Alpha', 'Intended Audience :: De...
d94853ee368fdf4a8ef80c72dd22a9f2b2074ab3
setup.py
setup.py
from setuptools import setup, find_packages import account setup( name="django-user-accounts", version=account.__version__, author="Brian Rosner", author_email="brosner@gmail.com", description="a Django user account app", long_description=open("README.rst").read(), license="MIT", url=...
from setuptools import setup, find_packages import account setup( name="django-user-accounts", version=account.__version__, author="Brian Rosner", author_email="brosner@gmail.com", description="a Django user account app", long_description=open("README.rst").read(), license="MIT", url=...
Set new minimum django-appconf version
Set new minimum django-appconf version
Python
mit
GeoNode/geonode-user-accounts,mysociety/django-user-accounts,nderituedwin/django-user-accounts,nderituedwin/django-user-accounts,pinax/django-user-accounts,ntucker/django-user-accounts,jpotterm/django-user-accounts,jawed123/django-user-accounts,GeoNode/geonode-user-accounts,jawed123/django-user-accounts,pinax/django-us...
--- +++ @@ -14,7 +14,7 @@ url="http://github.com/pinax/django-user-accounts", packages=find_packages(), install_requires=[ - "django-appconf>=0.6", + "django-appconf>=1.0.1", "pytz>=2015.6" ], zip_safe=False,
4d83306f89710d70571e2b2fc2f3a61af8b5793b
setup.py
setup.py
from setuptools import setup setup( name='aws-helpers', description='Set of AWS helper scripts', url='https://github.com/otype/aws-helpers', author='Hans-Gunther Schmidt', author_email='hans@otype.de', version='0.1', install_requires=['awscli', 'boto'], scripts=['src/aws-instances', 'src...
from setuptools import setup setup( name='aws-helpers', description='Set of AWS helper scripts', url='https://github.com/otype/aws-helpers', author='Hans-Gunther Schmidt', author_email='hans@otype.de', version='0.1', install_requires=['awscli==1.12.2'], scripts=['src/aws-instances', 'src...
Fix awscli to 1.12.2 as there are errors in later versions
Fix awscli to 1.12.2 as there are errors in later versions
Python
mit
otype/aws-helpers,otype/aws-helpers
--- +++ @@ -6,6 +6,6 @@ author='Hans-Gunther Schmidt', author_email='hans@otype.de', version='0.1', - install_requires=['awscli', 'boto'], + install_requires=['awscli==1.12.2'], scripts=['src/aws-instances', 'src/aws-instances.py'] )
49b13a33d37daa513345f629f5466f9807e24b49
setup.py
setup.py
from setuptools import setup def read(f): try: with open(f) as file: return file.read() except: return "" setup(name='shellvars-py', version='0.1.2', description='Read environment variables defined in a shell script into Python.', author_email='aneil.mallavar@gmai...
from setuptools import setup def read(f): try: with open(f) as file: return file.read() except: return "" setup(name='shellvars-py', version='0.1.2', description='Read environment variables defined in a shell script into Python.', author_email='aneil.mallavar@gmai...
Add POSIX as supported OS type
Add POSIX as supported OS type
Python
apache-2.0
aneilbaboo/shellvars-py
--- +++ @@ -22,6 +22,7 @@ 'Natural Language :: English', 'License :: OSI Approved :: Apache Software License', 'Operating System :: MacOS :: MacOS X', + 'Operating System :: POSIX', 'Programming Language :: Python', 'Programming Language :: Python :: 2',...
166f3d59e40ac795bc929235f8da8e192d25ed93
setup.py
setup.py
import os from setuptools import setup README = open(os.path.join(os.path.dirname(__file__), 'README.md')).read() # allow setup.py to be run from any path os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) setup( name='mdot', version='0.1', packages=['mdot'], include_packa...
import os from setuptools import setup README = open(os.path.join(os.path.dirname(__file__), 'README.md')).read() # allow setup.py to be run from any path os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) setup( name='mdot', version='0.1', packages=['mdot'], include_packa...
Revert "Pin to same version as on production."
Revert "Pin to same version as on production." This reverts commit cd93e130ada22ae66c406ad67101e3b1bf892053.
Python
apache-2.0
uw-it-aca/mdot,charlon/mdot,charlon/mdot,uw-it-aca/mdot,charlon/mdot,uw-it-aca/mdot,uw-it-aca/mdot
--- +++ @@ -16,7 +16,7 @@ 'django<1.9rc1', 'django-compressor', 'django_mobileesp', - 'uw-restclients==1.1.dev7', + 'uw-restclients<2.0', 'django-htmlmin', ], license='Apache License, Version 2.0',
701e1ca3f71653fe472a010b1f1ef0ec2be1eaf1
setup.py
setup.py
"""Setuptools configuration for rpmvenv.""" from setuptools import setup from setuptools import find_packages with open('README.rst', 'r') as readmefile: README = readmefile.read() setup( name='rpmvenv', version='0.1.1', url='https://github.com/kevinconway/rpmvenv', description='RPM packager fo...
"""Setuptools configuration for rpmvenv.""" from setuptools import setup from setuptools import find_packages with open('README.rst', 'r') as readmefile: README = readmefile.read() setup( name='rpmvenv', version='0.1.2', url='https://github.com/kevinconway/rpmvenv', description='RPM packager fo...
Fix missing templates in source packages
Fix missing templates in source packages Signed-off-by: Kevin Conway <3473c1f185ca03eadc40ad288d84425b54fd7d57@gmail.com>
Python
mit
kevinconway/rpmvenv
--- +++ @@ -10,7 +10,7 @@ setup( name='rpmvenv', - version='0.1.1', + version='0.1.2', url='https://github.com/kevinconway/rpmvenv', description='RPM packager for Python virtualenv.', author="Kevin Conway", @@ -29,4 +29,7 @@ 'rpmvenv = rpmvenv.cmd:main', ], }, +...
66dcfe1561f7ab2424aec58801f547001575b885
setup.py
setup.py
from distutils.core import setup with open('README.rst') as readme: long_description = readme.read() VERSION = '0.1.1' setup( install_requires=['gmusicapi', 'colorama', 'requests', 'tqdm', 'eyed3'], name='gmusicsync', version=VERSION, py_modules=['gmusicsync'], url='https://github.com/sashgor...
from distutils.core import setup with open('README.rst') as readme: long_description = readme.read() VERSION = '0.1.2' setup( install_requires=['gmusicapi', 'colorama', 'requests', 'tqdm', 'eyed3'], name='gmusicsync', version=VERSION, py_modules=['gmusicsync'], url='https://github.com/sashgor...
Fix script name Bump to 0.1.2
Fix script name Bump to 0.1.2
Python
mit
sashgorokhov/gmusicsync
--- +++ @@ -3,7 +3,7 @@ with open('README.rst') as readme: long_description = readme.read() -VERSION = '0.1.1' +VERSION = '0.1.2' setup( install_requires=['gmusicapi', 'colorama', 'requests', 'tqdm', 'eyed3'], @@ -28,6 +28,6 @@ author_email='sashgorokhov@gmail.com', description='Google Music...
0793f8dcb6ed27832e7d0adfb920d9c70813f3c7
tasks.py
tasks.py
# -*- coding: utf-8 -*- from invoke import task, run @task def clean(): run("rm -rf .coverage dist build") @task(clean, default=True) def test(): run("py.test") @task(test) def install(): run("pandoc --from=markdown --to=rst README.md -o README.rst") run("python setup.py develop") @task(test) d...
# -*- coding: utf-8 -*- from invoke import task @task def clean(context): context.run("rm -rf .coverage dist build") @task(clean, default=True) def test(context): context.run("py.test") @task(test) def install(context): context.run("pandoc --from=markdown --to=rst README.md -o README.rst") contex...
Use new invoke's context parameter
Use new invoke's context parameter
Python
apache-2.0
miso-belica/sumy,miso-belica/sumy
--- +++ @@ -1,32 +1,32 @@ # -*- coding: utf-8 -*- -from invoke import task, run +from invoke import task @task -def clean(): - run("rm -rf .coverage dist build") +def clean(context): + context.run("rm -rf .coverage dist build") @task(clean, default=True) -def test(): - run("py.test") +def test(c...
f108da5ab277187fa146fc7db060f706b5e3f0ed
rest/authorView.py
rest/authorView.py
# Author: Braedy Kuzma from rest_framework.views import APIView from .serializers import AuthorSerializer from .dataUtils import getAuthor from .httpUtils import JSONResponse class AuthorView(APIView): """ This view gets authors. """ def get(self, request, aid): # Get author author = ...
# Author: Braedy Kuzma from rest_framework.views import APIView from .serializers import AuthorSerializer from .dataUtils import getAuthor from .httpUtils import JSONResponse class AuthorView(APIView): """ This view gets authors. """ def get(self, request, aid): # Get author author = ...
Add friends to author view.
Add friends to author view.
Python
apache-2.0
CMPUT404W17T06/CMPUT404-project,CMPUT404W17T06/CMPUT404-project,CMPUT404W17T06/CMPUT404-project
--- +++ @@ -13,5 +13,6 @@ def get(self, request, aid): # Get author author = getAuthor(request, aid) - authSer = AuthorSerializer(author) + context = {'addFriends': True} + authSer = AuthorSerializer(author, context=context) return JSONResponse(authSer.data)
62f9bf4cb8d02b80c0589c68a308bcba28524d14
bootstrap_paginator/templatetags/paginator.py
bootstrap_paginator/templatetags/paginator.py
import urllib from django import template register = template.Library() @register.inclusion_tag('bootstrap_paginator/paginator.html', takes_context=True) def paginator(context, page=None): """ Based on: http://djangosnippets.org/snippets/2680/ To be used in conjunction with the object_list generic view....
from django.utils.six.moves.urllib.parse import urlencode from django import template register = template.Library() @register.inclusion_tag('bootstrap_paginator/paginator.html', takes_context=True) def paginator(context, page=None): """ Based on: http://djangosnippets.org/snippets/2680/ To be used in co...
Use a py3 compatible urlencode
Use a py3 compatible urlencode
Python
mit
defrex/django-bootstrap-paginator
--- +++ @@ -1,5 +1,5 @@ -import urllib +from django.utils.six.moves.urllib.parse import urlencode from django import template register = template.Library() @@ -44,4 +44,4 @@ def append_to_get(context, **kwargs): get = context['request'].GET.copy() get.update(kwargs) - return '?{1}'.format(urllib.u...
547bc6520652b02dcbe908c98b7483869c9ee831
mysite/context_processors.py
mysite/context_processors.py
from django.conf import settings SETTINGS_TO_ADD = ( 'GOOGLE_ANALYTICS_ACCOUNT', 'SOURCE_HINTS', ) def add_settings(request): """Add some selected settings values to the context""" return { 'settings': { k: getattr(settings, k) for k in SETTINGS_TO_ADD } }
from django.conf import settings SETTINGS_TO_ADD = ( 'GOOGLE_ANALYTICS_ACCOUNT', 'SOURCE_HINTS', 'MEDIA_URL', ) def add_settings(request): """Add some selected settings values to the context""" return { 'settings': { k: getattr(settings, k) for k in SETTINGS_TO_ADD ...
Make sure MEDIA_URL is available in the context of every template
Make sure MEDIA_URL is available in the context of every template
Python
agpl-3.0
mysociety/yournextrepresentative,mysociety/yournextmp-popit,datamade/yournextmp-popit,neavouli/yournextrepresentative,neavouli/yournextrepresentative,mysociety/yournextrepresentative,neavouli/yournextrepresentative,datamade/yournextmp-popit,mysociety/yournextmp-popit,YoQuieroSaber/yournextrepresentative,YoQuieroSaber/y...
--- +++ @@ -3,6 +3,7 @@ SETTINGS_TO_ADD = ( 'GOOGLE_ANALYTICS_ACCOUNT', 'SOURCE_HINTS', + 'MEDIA_URL', ) def add_settings(request):
f974e39c216067de5af68b3016fb35f129556e44
mscgen/setup.py
mscgen/setup.py
# -*- coding: utf-8 -*- from setuptools import setup, find_packages long_desc = ''' This package contains the mscgen Sphinx extension. Allow mscgen-formatted Message Sequence Chart graphs to be included in Sphinx-generated documents inline. ''' requires = ['Sphinx>=0.6'] setup( name='sphinxcontrib-mscgen', ...
# -*- coding: utf-8 -*- from setuptools import setup, find_packages long_desc = ''' This package contains the mscgen_ Sphinx_ extension. .. _mscgen: http://www.mcternan.me.uk/mscgen/ .. _Sphinx: http://sphinx.pocoo.org/ Allow mscgen-formatted Message Sequence Chart (MSC) graphs to be included in Sphinx-generated do...
Improve package short and long descriptions
mscgen: Improve package short and long descriptions
Python
bsd-2-clause
sphinx-contrib/spelling,sphinx-contrib/spelling
--- +++ @@ -3,9 +3,12 @@ from setuptools import setup, find_packages long_desc = ''' -This package contains the mscgen Sphinx extension. +This package contains the mscgen_ Sphinx_ extension. -Allow mscgen-formatted Message Sequence Chart graphs to be included in +.. _mscgen: http://www.mcternan.me.uk/mscgen/ +....
169eb4826ee823b28fc98477af81a69c6c521acc
client/__init__.py
client/__init__.py
__version__ = 'v1.4.3' FILE_NAME = 'ok' import os import sys sys.path.insert(0, '') # Add directory in which the ok.zip is stored to sys.path. sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
__version__ = 'v1.4.4' FILE_NAME = 'ok' import os import sys sys.path.insert(0, '') # Add directory in which the ok.zip is stored to sys.path. sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
Bump version number to v1.4.4.
Bump version number to v1.4.4.
Python
apache-2.0
jathak/ok-client,Cal-CS-61A-Staff/ok-client
--- +++ @@ -1,4 +1,4 @@ -__version__ = 'v1.4.3' +__version__ = 'v1.4.4' FILE_NAME = 'ok' import os
465b39b97ec1fa619e96a0c811a496216c275aaf
src/gui/Gui.py
src/gui/Gui.py
import pygame LEFT = 1 class Gui: def __init__(self): self.gui_elements = list() def update(self, mouse, events): curr_element = None for element in self.gui_elements: if element.contains(mouse.get_pos): curr_element = element element.on_hov...
import pygame LEFT = 1 class Gui: def __init__(self): self.gui_elements = list() def update(self, mouse, events): curr_element = None for element in self.gui_elements: if element.contains(mouse.get_pos()[0], mouse.get_pos()[1]): curr_element = element ...
Fix error in getting mouse posititions.
Fix error in getting mouse posititions.
Python
mit
cthit/CodeIT
--- +++ @@ -9,7 +9,7 @@ def update(self, mouse, events): curr_element = None for element in self.gui_elements: - if element.contains(mouse.get_pos): + if element.contains(mouse.get_pos()[0], mouse.get_pos()[1]): curr_element = element elem...
9c086abd428732080257d073bb6b36f04171f7d1
utils.py
utils.py
from datetime import date from django.db.models import Max, Min def worklog_period(obj): activity_period = obj.worklogentries.aggregate(Max('date'), Min('date')) article_period = obj.articleentries.aggregate(Max('date'), Min('date')) min_date = date(1, 1, 1) max_date = date(3000, 1, 1) if not (...
from datetime import date from django.db.models import Max, Min def worklog_period(obj): activity_period = obj.worklogentries.aggregate(Max('date'), Min('date')) article_period = obj.articleentries.aggregate(Max('date'), Min('date')) min_date = date(1900, 1, 1) max_date = date(3000, 1, 1) if no...
Fix date range in worklog_period
Fix date range in worklog_period
Python
bsd-3-clause
dongguangming/pdfdocument,matthiask/pdfdocument
--- +++ @@ -7,7 +7,7 @@ activity_period = obj.worklogentries.aggregate(Max('date'), Min('date')) article_period = obj.articleentries.aggregate(Max('date'), Min('date')) - min_date = date(1, 1, 1) + min_date = date(1900, 1, 1) max_date = date(3000, 1, 1) if not (activity_period['date__min...
ea2d72473c958de90582e1d4ccfc77af1d578b24
test_stack.py
test_stack.py
from stack import Stack import pytest def test_stack_push(): stack = Stack() stack.push("bacon") assert stack.top.value == "bacon" assert stack.peek() == "bacon" def test_stack_push_multi(): stack = Stack() stack.push("bacon") stack.push("steak") stack.push("grilled cheese") stac...
from stack import Stack import pytest def test_stack_push(): stack = Stack() stack.push("bacon") assert stack.top.value == "bacon" assert stack.peek() == "bacon" def test_stack_push_multi(): stack = Stack() stack.push("bacon") stack.push("steak") stack.push("grilled cheese") asse...
Add test for peek on empty stack
Add test for peek on empty stack
Python
mit
jwarren116/data-structures-deux
--- +++ @@ -14,8 +14,8 @@ stack.push("bacon") stack.push("steak") stack.push("grilled cheese") - stack.pop() - stack.pop() + assert stack.pop() == "grilled cheese" + assert stack.pop() == "steak" assert stack.pop() == "bacon" @@ -23,3 +23,9 @@ stack = Stack() with pytest....
65b4cca13c16e9de0d469ec036c1440dd598b3a0
learning_journal/__init__.py
learning_journal/__init__.py
from pyramid.config import Configurator from sqlalchemy import engine_from_config from .models import ( DBSession, Base, ) def make_session(settings): from sqlalchemy.orm import sessionmaker engine = engine_from_config(settings, 'sqlalchemy') Session = sessionmaker(bind=engine) return Ses...
from pyramid.config import Configurator from sqlalchemy import engine_from_config from pyramid.authorization import ACLAuthorizationPolicy from pyramid.authentication import AuthTktAuthenticationPolicy import os from .models import ( DBSession, Base, ) def make_session(settings): from sqlalchemy.orm ...
Add authN/authZ. Start auth process in main()
Add authN/authZ. Start auth process in main()
Python
mit
DZwell/learning_journal,DZwell/learning_journal,DZwell/learning_journal
--- +++ @@ -1,5 +1,8 @@ from pyramid.config import Configurator from sqlalchemy import engine_from_config +from pyramid.authorization import ACLAuthorizationPolicy +from pyramid.authentication import AuthTktAuthenticationPolicy +import os from .models import ( DBSession, @@ -19,6 +22,16 @@ engine = eng...
0158579b9a6c729e7af9a543caeef25018e07834
conda_build/ldd.py
conda_build/ldd.py
from __future__ import absolute_import, division, print_function import re import subprocess from conda_build import post LDD_RE = re.compile(r'\s*(.*?)\s*=>\s*(.*?)\s*\(.*\)') LDD_NOT_FOUND_RE = re.compile(r'\s*(.*?)\s*=>\s*not found') def ldd(path): "thin wrapper around ldd" lines = subprocess.check_outpu...
from __future__ import absolute_import, division, print_function import re import subprocess import json from os.path import join from conda.install import rm_rf from conda_build import post from conda_build.config import config from conda_build.build import create_env LDD_RE = re.compile(r'\s*(.*?)\s*=>\s*(.*?)\s...
Add first pass at a get_package_linkages function
Add first pass at a get_package_linkages function
Python
bsd-3-clause
takluyver/conda-build,takluyver/conda-build,sandhujasmine/conda-build,frol/conda-build,frol/conda-build,ilastik/conda-build,dan-blanchard/conda-build,mwcraig/conda-build,rmcgibbo/conda-build,dan-blanchard/conda-build,sandhujasmine/conda-build,ilastik/conda-build,ilastik/conda-build,shastings517/conda-build,sandhujasmin...
--- +++ @@ -2,8 +2,15 @@ import re import subprocess +import json +from os.path import join + +from conda.install import rm_rf from conda_build import post +from conda_build.config import config +from conda_build.build import create_env + LDD_RE = re.compile(r'\s*(.*?)\s*=>\s*(.*?)\s*\(.*\)') LDD_NOT_FOUND...
b2b939e13a5bcdabe09e85d7f940052f4fec8f27
events/urls.py
events/urls.py
from django.conf.urls.defaults import * from django.views.generic import list_detail from django.views.generic import date_based from agenda.events.models import Event general_info = { "queryset" : Event.objects.filter(moderated=True), "template_object_name" : "event", } list_info = { "paginate_by": 25, }...
from django.conf.urls.defaults import * from django.views.generic import list_detail from django.views.generic import date_based from agenda.events.models import Event general_info = { "queryset" : Event.objects.filter(moderated=True), "template_object_name" : "event", } list_info = { "paginate_by": 25, }...
Allow empty calendar to be drawn
Allow empty calendar to be drawn
Python
agpl-3.0
mlhamel/agendadulibre,mlhamel/agendadulibre,mlhamel/agendadulibre,vcorreze/agendaEteAccoord,vcorreze/agendaEteAccoord,vcorreze/agendaEteAccoord
--- +++ @@ -16,6 +16,7 @@ "month_format": "%m", "date_field": "start_time", "allow_future": True, + "allow_empty": True, } event_info = general_info
fe225e4f4d9df8c913ad3ed7a6f18f51ca6a0d2a
LiSE/setup.py
LiSE/setup.py
# This file is part of LiSE, a framework for life simulation games. # Copyright (c) Zachary Spector, zacharyspector@gmail.com import sys if sys.version_info[0] < 3 or ( sys.version_info[0] == 3 and sys.version_info[1] < 3 ): raise RuntimeError("LiSE requires Python 3.3 or later") from setuptools i...
# This file is part of LiSE, a framework for life simulation games. # Copyright (c) Zachary Spector, zacharyspector@gmail.com import sys if sys.version_info[0] < 3 or ( sys.version_info[0] == 3 and sys.version_info[1] < 3 ): raise RuntimeError("LiSE requires Python 3.3 or later") from setuptools i...
Include the examples in the LiSE package
Include the examples in the LiSE package
Python
agpl-3.0
LogicalDash/LiSE,LogicalDash/LiSE
--- +++ @@ -21,7 +21,8 @@ url="https://github.com/LogicalDash/LiSE", packages=[ "LiSE", - "LiSE.server" + "LiSE.server", + "LiSE.examples" ], package_data={ 'LiSE': ['sqlite.json']
298cae5d7f15a667195b96c92c4b4320487c922c
tests/test_backends.py
tests/test_backends.py
# -*- coding: utf-8 -*- import unittest from thumbnails.backends import generate_filename, get_thumbnail from thumbnails.images import SourceFile, Thumbnail from .compat import mock class BackendTestCase(unittest.TestCase): def test_generate_filename(self): self.assertEqual( generate_filenam...
# -*- coding: utf-8 -*- import unittest from thumbnails.backends import generate_filename, get_thumbnail from thumbnails.conf import settings from thumbnails.images import SourceFile, Thumbnail from .compat import mock class BackendTestCase(unittest.TestCase): def test_generate_filename(self): self.asse...
Fix failing mock of cache backend
Fix failing mock of cache backend
Python
mit
relekang/python-thumbnails,python-thumbnails/python-thumbnails
--- +++ @@ -2,6 +2,7 @@ import unittest from thumbnails.backends import generate_filename, get_thumbnail +from thumbnails.conf import settings from thumbnails.images import SourceFile, Thumbnail from .compat import mock @@ -18,7 +19,7 @@ ['851', '521c21fe9709802e9d4eb20a5fe84c18cd3ad'] )...
60c7476f63cbeb64284ef8192e686b473cf0863d
wordcloud/wordcloud.py
wordcloud/wordcloud.py
import os from operator import itemgetter import re from haystack.query import SearchQuerySet from pombola.hansard import models as hansard_models BASEDIR = os.path.dirname(__file__) # normal english stop words and hansard-centric words to ignore STOP_WORDS = open(os.path.join(BASEDIR, 'stopwords.txt'), 'rU').read()...
import os from operator import itemgetter import re from haystack.query import SearchQuerySet from pombola.hansard import models as hansard_models BASEDIR = os.path.dirname(__file__) # normal english stop words and hansard-centric words to ignore with open(os.path.join(BASEDIR, 'stopwords.txt'), 'rU') as f: STOP...
Make stop words a set for speed optimization.
Make stop words a set for speed optimization.
Python
agpl-3.0
geoffkilpin/pombola,geoffkilpin/pombola,mysociety/pombola,geoffkilpin/pombola,mysociety/pombola,mysociety/pombola,geoffkilpin/pombola,mysociety/pombola,geoffkilpin/pombola,mysociety/pombola,geoffkilpin/pombola,mysociety/pombola
--- +++ @@ -8,8 +8,8 @@ BASEDIR = os.path.dirname(__file__) # normal english stop words and hansard-centric words to ignore -STOP_WORDS = open(os.path.join(BASEDIR, 'stopwords.txt'), 'rU').read().splitlines() - +with open(os.path.join(BASEDIR, 'stopwords.txt'), 'rU') as f: + STOP_WORDS = set(f.read().splitline...
8ed94e1fb93252eed47239d8c6a5f28796802a36
src/cclib/__init__.py
src/cclib/__init__.py
# This file is part of cclib (http://cclib.sf.net), a library for parsing # and interpreting the results of computational chemistry packages. # # Copyright (C) 2006-2013 the cclib development team # # The library is free software, distributed under the terms of # the GNU Lesser General Public version 2.1 or later. You ...
"""cclib is a library for parsing and interpreting results from computational chemistry packages. The goals of cclib are centered around the reuse of data obtained from various computational chemistry programs and typically contained in output files. Specifically, cclib extracts (parses) data from the output files gen...
Add a descriptive docstring to main cclib module
Add a descriptive docstring to main cclib module
Python
bsd-3-clause
berquist/cclib,jchodera/cclib,ghutchis/cclib,ben-albrecht/cclib,andersx/cclib,gaursagar/cclib,Clyde-fare/cclib,ghutchis/cclib,langner/cclib,andersx/cclib,cclib/cclib,Schamnad/cclib,ATenderholt/cclib,berquist/cclib,cclib/cclib,ATenderholt/cclib,langner/cclib,berquist/cclib,cclib/cclib,langner/cclib,gaursagar/cclib,jchod...
--- +++ @@ -1,7 +1,25 @@ +"""cclib is a library for parsing and interpreting results from computational chemistry packages. + +The goals of cclib are centered around the reuse of data obtained from various +computational chemistry programs and typically contained in output files. Specifically, +cclib extracts (parses...
e2c8c71114692b99f50936dceab77dfd0329a5e0
accelerator/tests/factories/community_factory.py
accelerator/tests/factories/community_factory.py
from factory import Sequence from factory.django import DjangoModelFactory from accelerator.models import Community class CommunityFactory(DjangoModelFactory): class Meta: model = Community name = Sequence(lambda n: "name {0}".format(n)) email = Sequence(lambda n: "user_{0}@example.com".format(n)...
from factory import Sequence from factory.django import DjangoModelFactory from accelerator.models import Community class CommunityFactory(DjangoModelFactory): class Meta: model = Community name = Sequence(lambda n: "name {0}".format(n)) email = Sequence(lambda n: "user_{0}@example.com".format(n)...
Implement feedback - remove deletion
[AC-9653]: Implement feedback - remove deletion
Python
mit
masschallenge/django-accelerator,masschallenge/django-accelerator
--- +++ @@ -9,6 +9,6 @@ model = Community name = Sequence(lambda n: "name {0}".format(n)) email = Sequence(lambda n: "user_{0}@example.com".format(n)) - logo = "logo.jpg" + icon = "icon.jpg" image = "image.jpg" assignment_order = 2
6e46b79b837f61e6fa56c19d59786f6d83e6470a
pages/tests.py
pages/tests.py
from django.test import TestCase from pages.models import * from django.test.client import Client class PagesTestCase(TestCase): fixtures = ['tests.json'] def test_01_add_page(self): """ Test that the add admin page could be displayed via the admin """ c = Client() c.l...
from django.test import TestCase import settings from pages.models import * from django.test.client import Client page_data = {'title':'test page', 'slug':'test-page', 'language':'en', 'sites':[1], 'status':1} class PagesTestCase(TestCase): fixtures = ['tests.json'] def test_01_add_page(self): """ ...
Add a test for slug collision
Add a test for slug collision
Python
bsd-3-clause
Alwnikrotikz/django-page-cms,google-code-export/django-page-cms,google-code-export/django-page-cms,PiRSquared17/django-page-cms,Alwnikrotikz/django-page-cms,odyaka341/django-page-cms,Alwnikrotikz/django-page-cms,PiRSquared17/django-page-cms,Alwnikrotikz/django-page-cms,PiRSquared17/django-page-cms,odyaka341/django-page...
--- +++ @@ -1,10 +1,13 @@ from django.test import TestCase - +import settings from pages.models import * from django.test.client import Client +page_data = {'title':'test page', 'slug':'test-page', 'language':'en', 'sites':[1], 'status':1} + class PagesTestCase(TestCase): fixtures = ['tests.json'] + ...
07f50c1b01cce4550b3b4ecb369932166412063b
tests/commands.py
tests/commands.py
from sublime import Region from sublime_plugin import TextCommand class PhpunitTestSetupFixtureCommand(TextCommand): def run(self, edit, text): self.view.replace(edit, Region(0, self.view.size()), text) if '|' in text: cursor_placeholders = self.view.find_all('\\|') if cur...
from sublime_plugin import TextCommand class PhpunitTestSetupFixtureCommand(TextCommand): def run(self, edit, text): # This fixes an issue where an exception is thrown when reloading the # test commands. I don't know why this is needed, but it works. It's # most likely a bug in ST. The e...
Fix TypeError: 'NoneType' object is not callable when running tests
Fix TypeError: 'NoneType' object is not callable when running tests
Python
bsd-3-clause
gerardroche/sublime-phpunit
--- +++ @@ -1,9 +1,19 @@ -from sublime import Region from sublime_plugin import TextCommand class PhpunitTestSetupFixtureCommand(TextCommand): def run(self, edit, text): + # This fixes an issue where an exception is thrown when reloading the + # test commands. I don't know why this is neede...
2f4141311af549b6d57e72534b4da0a6ce950629
src/waldur_mastermind/analytics/serializers.py
src/waldur_mastermind/analytics/serializers.py
from __future__ import unicode_literals from datetime import timedelta from django.utils import timezone from django.utils.translation import ugettext_lazy as _ from rest_framework import serializers from waldur_core.core.serializers import GenericRelatedField from waldur_core.structure.models import Customer, Proje...
from __future__ import unicode_literals from datetime import timedelta from django.utils import timezone from django.utils.translation import ugettext_lazy as _ from rest_framework import serializers from waldur_core.core.serializers import GenericRelatedField from waldur_core.structure.models import Customer, Proje...
Fix period validation in daily quota serializer.
Fix period validation in daily quota serializer.
Python
mit
opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/waldur-mastermind
--- +++ @@ -17,14 +17,14 @@ end = serializers.DateField(format='%Y-%m-%d', required=False) def validate(self, attrs): - if attrs['start'] >= attrs['end']: - raise serializers.ValidationError( - _('Invalid period specified. `start` should be lesser than `end`.') - ...
9a4cb482cbe0f5dc2de8f6ae89dd0b78a1564a0d
pbxplore/structure/loader.py
pbxplore/structure/loader.py
#! /usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import # Local module from .structure import Chain, Atom from .PDB import PDB # Conditional import try: import MDAnalysis except ImportError: IS_MDANALYSIS = False else: IS_MDANALYSIS = True # Create the __all__ keyword acco...
#! /usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import # Local module from .structure import Chain, Atom from .PDB import PDB # Conditional import try: import MDAnalysis except ImportError: IS_MDANALYSIS = False else: IS_MDANALYSIS = True # Create the __all__ keyword acco...
Create only one MDAnalysis selection
Create only one MDAnalysis selection
Python
mit
pierrepo/PBxplore,pierrepo/PBxplore,jbarnoud/PBxplore,jbarnoud/PBxplore,HubLot/PBxplore,HubLot/PBxplore
--- +++ @@ -38,9 +38,9 @@ def chains_from_trajectory(trajectory, topology): comment = "" universe = MDAnalysis.Universe(topology, trajectory) + selection = universe.select_atoms("backbone") for ts in universe.trajectory: structure = Chain() - selection = universe.select_atoms("backb...
92e0724f28ce0e6802237b13656064c6add63b85
fuzzers/019-ndi1mux/generate.py
fuzzers/019-ndi1mux/generate.py
#!/usr/bin/env python3 # FIXME: getting two bits # 00_40 31_46 # Can we find instance where they are not aliased? WA7USED = 0 from prjxray.segmaker import Segmaker segmk = Segmaker("design.bits") print("Loading tags") ''' module,loc,c31,b31,a31 my_NDI1MUX_NI_NMC31,SLICE_X12Y100,1,1,0 my_NDI1MUX_NI_NMC31,SLICE_X12Y1...
#!/usr/bin/env python3 # FIXME: getting two bits # 00_40 31_46 # Can we find instance where they are not aliased? WA7USED = 0 from prjxray.segmaker import Segmaker segmk = Segmaker("design.bits") print("Loading tags") ''' module,loc,c31,b31,a31 my_NDI1MUX_NI_NMC31,SLICE_X12Y100,1,1,0 my_NDI1MUX_NI_NMC31,SLICE_X12Y1...
Rename DI1MUX to be underneith the *LUT.
Rename DI1MUX to be underneith the *LUT. Signed-off-by: Keith Rothman <1bc19627a439baf17510dc2d0b2d250c96d445a5@users.noreply.github.com>
Python
isc
SymbiFlow/prjxray,SymbiFlow/prjxray,SymbiFlow/prjxray,SymbiFlow/prjxray,SymbiFlow/prjxray
--- +++ @@ -24,9 +24,9 @@ c31 = int(c31) b31 = int(b31) a31 = int(a31) - segmk.add_site_tag(loc, "ADI1MUX.AI", 1 ^ a31) - segmk.add_site_tag(loc, "BDI1MUX.BI", 1 ^ b31) - segmk.add_site_tag(loc, "CDI1MUX.CI", 1 ^ c31) + segmk.add_site_tag(loc, "ALUT.DI1MUX.AI", 1 ^ a31) + segmk.add_site_...
93dee6a3ff44fb7470b3008e8fbbaf99822bbe82
designate/cmd/__init__.py
designate/cmd/__init__.py
# Copyright 2013 Hewlett-Packard Development Company, L.P. # # Author: Kiall Mac Innes <kiall@hp.com> # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/L...
# Copyright 2013 Hewlett-Packard Development Company, L.P. # # Author: Kiall Mac Innes <kiall@hp.com> # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/L...
Fix Redis connection over TLS
Fix Redis connection over TLS When Designate is configured to use Redis for coordination over a TLS connection, it will fail to connect with "ssl.SSLError: ('timed out',)". This is caused by eventlet raising ssl.SSLError instead of the expected socket timeout the core libraries return. This patch monkey-patches eventl...
Python
apache-2.0
openstack/designate,openstack/designate,openstack/designate
--- +++ @@ -14,8 +14,15 @@ # License for the specific language governing permissions and limitations # under the License. import eventlet +from eventlet.green import ssl +import socket eventlet.monkey_patch(os=False) + +# Work around the eventlet issue that impacts redis using TLS. +# https://github.com/eventle...
a54a2e735950c5c31ec71613750bdf1ce194389f
django_datastream/urls.py
django_datastream/urls.py
from django.conf import urls from tastypie import api from . import resources v1_api = api.Api(api_name='v1') v1_api.register(resources.StreamResource()) urlpatterns = urls.patterns( '', urls.url(r'^', urls.include(v1_api.urls)), )
from django.conf import urls from tastypie import api from . import resources v1_api = api.Api(api_name='v1') v1_api.register(resources.StreamResource()) urlpatterns = [ urls.url(r'^', urls.include(v1_api.urls)), ]
Fix urlpatterns for Django 1.10.
Fix urlpatterns for Django 1.10.
Python
agpl-3.0
wlanslovenija/django-datastream,wlanslovenija/django-datastream,wlanslovenija/django-datastream
--- +++ @@ -7,8 +7,6 @@ v1_api = api.Api(api_name='v1') v1_api.register(resources.StreamResource()) -urlpatterns = urls.patterns( - '', - +urlpatterns = [ urls.url(r'^', urls.include(v1_api.urls)), -) +]
6903f63e76ac5e7686ae55348225d06e3757a64b
giphy_magic.py
giphy_magic.py
from IPython.display import Image import requests API_ENDPOINT = 'http://api.giphy.com/v1/gifs/random' # This is the Giphy API's public beta key, see https://github.com/Giphy/GiphyAPI API_KEY = 'dc6zaTOxFJmzC' def giphy(tag): params = { 'api_key': API_KEY, 'tag': tag } r = requests.get(...
from IPython.display import Image import requests API_ENDPOINT = 'http://api.giphy.com/v1/gifs/random' # This is the Giphy API's public beta key, see https://github.com/Giphy/GiphyAPI API_KEY = 'dc6zaTOxFJmzC' RANDOM_ON_NO_MATCH = False def get_params(tag): params = {'api_key': API_KEY} if tag is not None...
Add a constant that determines the response when no results are found
Add a constant that determines the response when no results are found
Python
mit
AustinRochford/giphy-ipython-magic,AustinRochford/giphy-ipython-magic
--- +++ @@ -7,11 +7,18 @@ # This is the Giphy API's public beta key, see https://github.com/Giphy/GiphyAPI API_KEY = 'dc6zaTOxFJmzC' +RANDOM_ON_NO_MATCH = False + +def get_params(tag): + params = {'api_key': API_KEY} + + if tag is not None: + params['tag'] = tag + + return params + def giphy(tag)...
02160f46d5e28c394915d44c42e4e1b09e750717
utils/rest.py
utils/rest.py
import json import logging import requests import plugins.settings as settings headers = {'accept': 'application/json'} def get(config, path, data=None): request = requests.get( url=__format_url(config, path), params=data, headers=headers, auth=(config['username'], config['passwor...
import json import requests import plugins.settings as settings headers = {'accept': 'application/json'} def get(config, path, data=None): auth = None if 'username' in config and 'password' in config: auth = (config['username'], config['password']) request = requests.get( url=__format_ur...
Remove logging and allow anonymous access (for Crucible for example)
Remove logging and allow anonymous access (for Crucible for example)
Python
mit
gpailler/AtlassianBot
--- +++ @@ -1,5 +1,4 @@ import json -import logging import requests import plugins.settings as settings @@ -7,15 +6,16 @@ def get(config, path, data=None): + auth = None + if 'username' in config and 'password' in config: + auth = (config['username'], config['password']) + request = reques...
107ecde6c2373deedcb788115811bcbb50de6851
uwiki/auth.py
uwiki/auth.py
import logging from flask import request from flask.ext.login import current_user, UserMixin, AnonymousUserMixin from .core import app, auth log = logging.getLogger(__name__) app.login_manager.login_view = 'login' @auth.context_processor def provide_user(): return dict(user=current_user) @app.before_request...
import logging from flask import request from flask.ext.login import current_user, UserMixin, AnonymousUserMixin from .core import app, auth log = logging.getLogger(__name__) app.login_manager.login_view = 'login' @auth.context_processor def provide_user(): return dict(user=current_user) @app.before_request...
Allow static files to go through (for now)
Allow static files to go through (for now)
Python
bsd-3-clause
mikeboers/uWiki,mikeboers/uWiki,mikeboers/uWiki,mikeboers/uWiki
--- +++ @@ -17,7 +17,7 @@ @app.before_request def assert_logged_in(): - if not current_user.is_authenticated() and request.endpoint != 'login': + if not current_user.is_authenticated() and request.endpoint not in ('login', 'static'): return app.login_manager.unauthorized()
a1effed87a8e90483f1ab850c77aff7c827b7f48
install_packages.py
install_packages.py
#!/usr/bin/python # -*- coding: utf-8 -*- import weka.core.jvm as jvm import weka.core.packages as packages jvm.start() # checking for installed packages installed_packages = packages.installed_packages() for item in installed_packages: print item.name, item.url, "is installed\n" # Search for GridSearch and Lib...
#!/usr/bin/python # -*- coding: utf-8 -*- import weka.core.jvm as jvm import weka.core.packages as packages jvm.start() # checking for installed packages installed_packages = packages.installed_packages() for item in installed_packages: print item.name, item.url, "is installed\n" # # Search for GridSearch and L...
Add other options to install packages
Add other options to install packages
Python
mit
srvanrell/libsvm-weka-python
--- +++ @@ -11,16 +11,19 @@ for item in installed_packages: print item.name, item.url, "is installed\n" -# Search for GridSearch and LibSVM, just to check package's names -all_packages = packages.all_packages() -for item in all_packages: - if (item.name == "gridSearch") or (item.name == "LibSVM"): - ...
2533aa96b189eb5aaea293c57f928d594ef92eba
utils/language.py
utils/language.py
from utils.synonyms import cached_synonyms from nltk.corpus import wordnet as wn def semantic_similarity(word1, word2): if fast_semantic_similarity(word1, word2) == 1: return 1 max_p = 0 for s1 in wn.synsets(word1): for st1 in [s1] + s1.similar_tos(): for s2 in wn.synsets(word2...
from utils.synonyms import cached_synonyms from nltk.corpus import wordnet as wn def semantic_similarity(word1, word2): words1 = word1.split('_') words2 = word2.split('_') if len(words1) > 1 or len(words2) > 1: sub_similarity = .9 * semantic_similarity(words1[-1], words2[-1]) else: sub...
Check semantic similarity of last word in phrase as well as entire phrase
Check semantic similarity of last word in phrase as well as entire phrase
Python
mit
rdeits/cryptics,rdeits/cryptics,rdeits/cryptics,rdeits/cryptics,rdeits/cryptics,rdeits/cryptics,rdeits/cryptics
--- +++ @@ -3,6 +3,14 @@ def semantic_similarity(word1, word2): + words1 = word1.split('_') + words2 = word2.split('_') + if len(words1) > 1 or len(words2) > 1: + sub_similarity = .9 * semantic_similarity(words1[-1], words2[-1]) + else: + sub_similarity = 0 + if sub_similarity == 1: ...
fe32099bf1b6aa387c98dd6afdfc31557fc4e1f9
volpy/__init__.py
volpy/__init__.py
from .camera import Camera from .scene import Scene, Element, Light from .version import __version__ from .grid import Grid from .homogeneous import (translate, scale, rotatex, rotatey, rotatez, rotatexyz, rotate_axis, cross) from .geometry import Geometry, BBox
''' Volpy ===== A fast volume rendering implementation for Python. Volpy has support for: 1. Multithreading or multiprocessing at the rendering step 2. Native implementation of ray casting 3. Native access to NumPy arrays during rendering 4. Support for ambient and diffuse lighting terms How to use this pack...
Write a docstring for the package
Write a docstring for the package
Python
mit
OEP/volpy,OEP/volpy
--- +++ @@ -1,3 +1,24 @@ +''' +Volpy +===== + +A fast volume rendering implementation for Python. Volpy has support for: + + 1. Multithreading or multiprocessing at the rendering step + 2. Native implementation of ray casting + 3. Native access to NumPy arrays during rendering + 4. Support for ambient and diffuse...
5e2bcc9ae44d0155be1cc72b3728c3869377e02f
website/addons/osfstorage/__init__.py
website/addons/osfstorage/__init__.py
#!/usr/bin/env python # encoding: utf-8 from . import routes, views, model MODELS = [ model.OsfStorageNodeSettings, model.OsfStorageFileTree, model.OsfStorageFileRecord, model.OsfStorageFileVersion, model.OsfStorageGuidFile, ] NODE_SETTINGS_MODEL = model.OsfStorageNodeSettings ROUTES = [ rout...
#!/usr/bin/env python # encoding: utf-8 from . import routes, views, model MODELS = [ model.OsfStorageNodeSettings, model.OsfStorageFileTree, model.OsfStorageFileRecord, model.OsfStorageFileVersion, model.OsfStorageGuidFile, ] NODE_SETTINGS_MODEL = model.OsfStorageNodeSettings ROUTES = [ rout...
Remove storageRubeusConfig.js from osfstorage init.py
Remove storageRubeusConfig.js from osfstorage init.py
Python
apache-2.0
mfraezz/osf.io,caseyrollins/osf.io,leb2dg/osf.io,caseyrygt/osf.io,kushG/osf.io,jmcarp/osf.io,billyhunt/osf.io,Nesiehr/osf.io,haoyuchen1992/osf.io,zkraime/osf.io,HalcyonChimera/osf.io,monikagrabowska/osf.io,lamdnhan/osf.io,HalcyonChimera/osf.io,kushG/osf.io,wearpants/osf.io,samanehsan/osf.io,cwisecarver/osf.io,arpitar/o...
--- +++ @@ -33,7 +33,7 @@ INCLUDE_JS = { 'widget': [], 'page': [], - 'files': ['storageRubeusConfig.js'], + 'files': [], } HAS_HGRID_FILES = True
51e985119e3b62df69f806426b928053ddbac9d7
db/base/templatetags/tags.py
db/base/templatetags/tags.py
from django import template from django.core.urlresolvers import reverse from django.utils.html import format_html register = template.Library() @register.simple_tag def active(request, urls): if request.path in (reverse(url) for url in urls.split()): return 'active' return None @register.filter de...
from django import template from django.core.urlresolvers import reverse from django.utils.html import format_html register = template.Library() @register.simple_tag def active(request, urls): if request.path in (reverse(url) for url in urls.split()): return 'active' return None @register.filter de...
Fix frequency formating and handling
Fix frequency formating and handling
Python
agpl-3.0
Roboneet/satnogs-db,Roboneet/satnogs-db,Roboneet/satnogs-db,Roboneet/satnogs-db
--- +++ @@ -18,9 +18,10 @@ to_format = float(value) except (TypeError, ValueError): return '' - prec = to_format / 1000 - formatted = format(to_format / 1000000, '.3f') - if not prec.is_integer(): - point = str(prec - int(prec))[2:] - formatted = format_html('{0}<small>{1...
837a0e822905fa8c4e0dda33a03f8423b2f9cdb1
nova/policies/hosts.py
nova/policies/hosts.py
# Copyright 2016 Cloudbase Solutions Srl # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
# Copyright 2016 Cloudbase Solutions Srl # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
Add policy description for os-host
Add policy description for os-host This commit adds policy doc for os-host policies. Partial implement blueprint policy-docs Change-Id: Ie15125f025dbb4982ff27cfed12047e8fce3a3cf
Python
apache-2.0
rahulunair/nova,mahak/nova,gooddata/openstack-nova,Juniper/nova,gooddata/openstack-nova,rahulunair/nova,klmitch/nova,phenoxim/nova,phenoxim/nova,openstack/nova,openstack/nova,Juniper/nova,rahulunair/nova,mikalstill/nova,mahak/nova,vmturbo/nova,vmturbo/nova,openstack/nova,klmitch/nova,vmturbo/nova,mikalstill/nova,klmitc...
--- +++ @@ -13,8 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_policy import policy - from nova.policies import base @@ -22,9 +20,38 @@ hosts_policies = [ - policy.RuleDefault( - name=BASE_POLICY_NAME, - check_st...
d0fb729183f702711127b63b1e0898a9a601a7f4
bitbucket/tests/private/private.py
bitbucket/tests/private/private.py
# -*- coding: utf-8 -*- import unittest from bitbucket.bitbucket import Bitbucket from bitbucket.tests.private import USERNAME, PASSWORD TEST_REPO_SLUG = 'test_bitbucket_api' class AuthenticatedBitbucketTest(unittest.TestCase): """ Bitbucket test base class for authenticated methods.""" def setUp(self): ...
# -*- coding: utf-8 -*- import unittest from bitbucket.bitbucket import Bitbucket from bitbucket.tests.private import USERNAME, PASSWORD TEST_REPO_SLUG = 'test_bitbucket_api' class AuthenticatedBitbucketTest(unittest.TestCase): """ Bitbucket test base class for authenticated methods.""" def setUp(self): ...
Update BitbucketAuthenticatedMethodsTest's test_get_tags and test_get_branches methods.
Update BitbucketAuthenticatedMethodsTest's test_get_tags and test_get_branches methods. Signed-off-by: Baptiste Millou <1cfd48a9a65a966defdcd720f66cd790094000c4@smoothie-creative.com>
Python
isc
robwilkerson/BitBucket-api,wadevries/BitBucket-api,chaiapodi/BitBucket-api,affinitic/BitBucket-api,Sheeprider/BitBucket-api,CBitLabs/BitBucket-api,Sheeprider/BitBucket-api,kubilayeksioglu/BitBucket-api,chaiapodi/BitBucket-api
--- +++ @@ -33,9 +33,15 @@ success, result = self.bb.get_tags() self.assertTrue(success) self.assertIsInstance(result, dict) + # test with invalid repository name + success, result = self.bb.get_tags(repo_slug='azertyuiop') + self.assertFalse(success) def test_ge...
c8db390195641c33f84ccd1f645a5af73debc2bd
xapi/tasks.py
xapi/tasks.py
from celery.task import task from django.conf import settings from xapi.sender import TinCanSender @task def send_2_tin_can(): options = settings.TRACKING_BACKENDS['xapi']['OPTIONS'] if options.get("SEND_CRON_ENABLED"): TinCanSender.send_2_tincan_by_settings()
from celery.task import task from django.conf import settings from xapi.sender import TinCanSender @task(name='xapi.send_2_tin_can') def send_2_tin_can(): options = settings.TRACKING_BACKENDS['xapi']['OPTIONS'] TinCanSender.send_2_tincan_by_settings()
Add a name to present task in djcelery options
Add a name to present task in djcelery options
Python
agpl-3.0
marcore/pok-eco,marcore/pok-eco
--- +++ @@ -3,8 +3,7 @@ from xapi.sender import TinCanSender -@task +@task(name='xapi.send_2_tin_can') def send_2_tin_can(): options = settings.TRACKING_BACKENDS['xapi']['OPTIONS'] - if options.get("SEND_CRON_ENABLED"): - TinCanSender.send_2_tincan_by_settings() + TinCanSender.send_2_tincan_by...
11b0608f2cab4f9c804d5a2e67edfc4270448b71
ectoken.py
ectoken.py
from ctypes import CDLL, create_string_buffer, byref import pkg_resources bf = CDLL(pkg_resources.resource_filename(__name__, '_ecblowfish.so')) def ectoken_generate(key, string): if isinstance(string, unicode): string = string.encode('utf-8') string = 'ec_secure=%03d&%s' % (len(string) + 14, string)...
from ctypes import CDLL, create_string_buffer, byref import pkg_resources bf = CDLL(pkg_resources.resource_filename(__name__, '_ecblowfish.so')) def ectoken_generate(key, string): if len(string) > 512: raise ValueError( '%r exceeds maximum length of 512 characters' % string) if isinstance...
Add check for maximum length (taken from the original Edgecast ec_encrypt.c example)
Add check for maximum length (taken from the original Edgecast ec_encrypt.c example)
Python
bsd-3-clause
sebest/ectoken-py,sebest/ectoken-py
--- +++ @@ -5,6 +5,9 @@ def ectoken_generate(key, string): + if len(string) > 512: + raise ValueError( + '%r exceeds maximum length of 512 characters' % string) if isinstance(string, unicode): string = string.encode('utf-8') string = 'ec_secure=%03d&%s' % (len(string) + 14...
68e9015d846c08ed331cdca219648d60f6d65737
ynr/apps/candidates/search_indexes.py
ynr/apps/candidates/search_indexes.py
from haystack import indexes from celery_haystack.indexes import CelerySearchIndex from popolo.models import Person class PersonIndex(CelerySearchIndex, indexes.Indexable): # FIXME: this doesn't seem to work for partial names despite what # docs say text = indexes.EdgeNgramField(document=True, use_templa...
from haystack import indexes from celery_haystack.indexes import CelerySearchIndex from popolo.models import Person class PersonIndex(CelerySearchIndex, indexes.Indexable): # FIXME: this doesn't seem to work for partial names despite what # docs say text = indexes.EdgeNgramField(document=True, use_templa...
Add get_updated_field to search index
Add get_updated_field to search index This will allow us to only update the search index for models updated in a given timedelta.
Python
agpl-3.0
DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative
--- +++ @@ -13,5 +13,8 @@ given_name = indexes.CharField(model_attr='given_name') additional_name = indexes.CharField(model_attr='additional_name') + def get_updated_field(self): + return 'updated_at' + def get_model(self): return Person
bb8506feb44eaa0b38a3d38956bf85c49f54bc5a
fabfile.py
fabfile.py
#!/usr/bin/env python import os from fabric.api import * from fab_shared import (test, tornado_test_runner, tornado_deploy as deploy, setup, development, production, localhost, staging, restart_webserver, rollback, lint, enable, disable, maintenancemode, rechef) env.unit = "trinity" env.path = ...
#!/usr/bin/env python import os from fabric.api import * from fab_shared import (test, nose_test_runner, webpy_deploy as deploy, setup, development, production, localhost, staging, restart_webserver, rollback, lint, enable, disable, maintenancemode, rechef) env.unit = "trinity" env.path = "/var/tornado...
Switch to nose test runners - probably shouldn't use fabric in this project.
Switch to nose test runners - probably shouldn't use fabric in this project.
Python
mit
peplin/trinity
--- +++ @@ -1,10 +1,9 @@ #!/usr/bin/env python import os from fabric.api import * -from fab_shared import (test, tornado_test_runner, tornado_deploy as deploy, +from fab_shared import (test, nose_test_runner, webpy_deploy as deploy, setup, development, production, localhost, staging, restart_webserver, - ...
900b4c02a2ae1570083bb23e562208331ea2a651
python/ecep/portal/widgets.py
python/ecep/portal/widgets.py
from django.forms import widgets from django.utils.safestring import mark_safe class MapWidget(widgets.HiddenInput): def render(self, name, value, attrs=None): widget = super(MapWidget, self).render(name, value, attrs) return mark_safe("""<input name="geom" readonly="readonly" value="%s" type="tex...
from django.forms import widgets from django.utils.safestring import mark_safe class MapWidget(widgets.HiddenInput): """Custom map widget for displaying interactive google map to geocode addresses of learning centers. This widget displays a readonly input box to store lat+lng data, an empty help div,...
Add comments to MapWidget class and MapWidget.render method
Add comments to MapWidget class and MapWidget.render method
Python
mit
smartchicago/chicago-early-learning,smartchicago/chicago-early-learning,smartchicago/chicago-early-learning,smartchicago/chicago-early-learning
--- +++ @@ -3,7 +3,21 @@ class MapWidget(widgets.HiddenInput): + """Custom map widget for displaying interactive google map to geocode + addresses of learning centers. + + This widget displays a readonly input box to store lat+lng data, an empty + help div, a map div for the google map, and a button ...
53a6e81b6a269589df5c6ce199b6248d838f9180
pythonpic/configs/run_wave.py
pythonpic/configs/run_wave.py
""" Run wave propagation""" # coding=utf-8 import numpy as np from ..algorithms import BoundaryCondition from ..classes import Grid, Simulation class wave_propagation(Simulation): def __init__(self, filename, bc = BoundaryCondition.Laser(1, 1, 10, 3).laser_pulse, ): ...
""" Run wave propagation""" # coding=utf-8 import numpy as np from ..algorithms import BoundaryCondition from ..classes import Grid, Simulation class wave_propagation(Simulation): def __init__(self, filename, bc = BoundaryCondition.Laser(1, 1, 10, 3).laser_pulse, ): ...
Fix super bug in wave
Fix super bug in wave
Python
bsd-3-clause
StanczakDominik/PythonPIC
--- +++ @@ -19,6 +19,6 @@ grid = Grid(T=T, L=L, NG=NG, epsilon_0=epsilon_0, c=c, bc=bc, periodic=False) description = "Electrostatic wave driven by boundary condition" - super.__init__(grid, [], filename=filename, category_type="wave", title=description) + super().__init__(grid, [], ...
f2c5210b771728ba60ffe81993617b8af07bbaeb
koans/about_none.py
koans/about_none.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Based on AboutNil in the Ruby Koans # from runner.koan import * class AboutNone(Koan): def test_none_is_an_object(self): "Unlike NULL in a lot of languages" self.assertEqual(__, isinstance(None, object)) def test_none_is_universal(self): ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Based on AboutNil in the Ruby Koans # from runner.koan import * class AboutNone(Koan): def test_none_is_an_object(self): "Unlike NULL in a lot of languages" self.assertEqual(True, isinstance(None, object)) def test_none_is_universal(self): ...
Add first pass at "none" koan. One test left.
Add first pass at "none" koan. One test left.
Python
mit
javierjulio/python-koans-completed,javierjulio/python-koans-completed
--- +++ @@ -11,11 +11,11 @@ def test_none_is_an_object(self): "Unlike NULL in a lot of languages" - self.assertEqual(__, isinstance(None, object)) + self.assertEqual(True, isinstance(None, object)) def test_none_is_universal(self): "There is only one None" - self.a...
54fc2329fa597739ed7d4e2efb859718f25b255d
pysat/_constellation.py
pysat/_constellation.py
class Constellation(object): """Manage and analyze data from multiple pysat Instruments. FIXME document this. """ def __init__(self, instruments=None, name=None): if instruments and name: raise ValueError('When creating a constellation, please specify a ' ...
class Constellation(object): """Manage and analyze data from multiple pysat Instruments. FIXME document this. """ def __init__(self, instruments=None, name=None): if instruments and name: raise ValueError('When creating a constellation, please specify ' ...
Change line wrap to appease pycodestyle.
Change line wrap to appease pycodestyle.
Python
bsd-3-clause
rstoneback/pysat,jklenzing/pysat
--- +++ @@ -6,12 +6,13 @@ """ def __init__(self, instruments=None, name=None): if instruments and name: - raise ValueError('When creating a constellation, please specify a ' - 'list of instruments or a name, not both.') + raise ValueError('When crea...
c57fd21ca62f9217a943cec5111b64403e968ab5
kimochi/scripts/initializedb.py
kimochi/scripts/initializedb.py
import os import sys import transaction from sqlalchemy import engine_from_config from pyramid.paster import ( get_appsettings, setup_logging, ) from pyramid.scripts.common import parse_vars from ..models import ( DBSession, Base, ) def usage(argv): cmd = os.path.basename(argv[0]) ...
import os import sys import transaction from sqlalchemy import engine_from_config from pyramid.paster import ( get_appsettings, setup_logging, ) from pyramid.scripts.common import parse_vars from ..models import ( DBSession, Base, User, ) def usage(argv): cmd = os.path.basename(argv[0]...
Add temporary default admin user
Add temporary default admin user
Python
mit
matslindh/kimochi,matslindh/kimochi
--- +++ @@ -14,7 +14,8 @@ from ..models import ( DBSession, Base, - ) + User, +) def usage(argv): @@ -34,3 +35,6 @@ engine = engine_from_config(settings, 'sqlalchemy.') DBSession.configure(bind=engine) Base.metadata.create_all(engine) + + with transaction.manager: + DBSe...
884a06ea0bd2021bfc298a93495433a28a717a3e
reportlab/test/test_tools_pythonpoint.py
reportlab/test/test_tools_pythonpoint.py
"""Tests for the PythonPoint tool. """ import os, sys, string from reportlab.test import unittest from reportlab.test.utils import makeSuiteForClasses, outputfile import reportlab class PythonPointTestCase(unittest.TestCase): "Some very crude tests on PythonPoint." def test0(self): "Test if pythonp...
"""Tests for the PythonPoint tool. """ import os, sys, string from reportlab.test import unittest from reportlab.test.utils import makeSuiteForClasses, outputfile import reportlab class PythonPointTestCase(unittest.TestCase): "Some very crude tests on PythonPoint." def test0(self): "Test if pythonp...
Fix buglet in compact testing
Fix buglet in compact testing
Python
bsd-3-clause
makinacorpus/reportlab-ecomobile,makinacorpus/reportlab-ecomobile,makinacorpus/reportlab-ecomobile,makinacorpus/reportlab-ecomobile,makinacorpus/reportlab-ecomobile
--- +++ @@ -21,12 +21,11 @@ ppDir = dirname(pythonpoint.__file__) xml = join(ppDir, 'demos', 'pythonpoint.xml') datafilename = 'pythonpoint.pdf' - outdir = outputfile('') + outDir = outputfile('') if isCompactDistro(): cwd = None xml = open_f...
1da1000d7bade80a0f68dbacc93ad1e73463c605
linkedevents/api.py
linkedevents/api.py
import copy from rest_framework.routers import DefaultRouter, SimpleRouter from events.api import all_views as events_views from helevents.api import all_views as users_views class LinkedEventsAPIRouter(DefaultRouter): # these are from Django REST Framework bulk BulkRouter with 'delete' excluded routes = copy...
import copy from rest_framework.routers import DefaultRouter, SimpleRouter from events.api import all_views as events_views from helevents.api import all_views as users_views class LinkedEventsAPIRouter(DefaultRouter): # these are from Django REST Framework bulk BulkRouter with 'delete' excluded routes = copy...
Replace base_name with basename base_name is deprecated
Replace base_name with basename base_name is deprecated
Python
mit
City-of-Helsinki/linkedevents,City-of-Helsinki/linkedevents,City-of-Helsinki/linkedevents
--- +++ @@ -21,7 +21,7 @@ if view['class'] in self.registered_api_views: return self.registered_api_views.add(view['class']) - self.register(view['name'], view['class'], base_name=view.get("base_name")) + self.register(view['name'], view['class'], basename=view.get("base_n...
07c2bdab605eb00bcc59a5540477819d1339e563
examples/minimal/views.py
examples/minimal/views.py
from cruditor.mixins import CruditorMixin from django.views.generic import TemplateView from examples.mixins import ExamplesMixin class DemoView(ExamplesMixin, CruditorMixin, TemplateView): title = 'Demo view' template_name = 'minimal/demo.html'
from cruditor.mixins import CruditorMixin from django.views.generic import TemplateView from examples.mixins import ExamplesMixin class DemoView(ExamplesMixin, CruditorMixin, TemplateView): title = 'Demo view' template_name = 'minimal/demo.html' def get_breadcrumb(self): return super().get_bread...
Add example for additional breadcrumb items.
Add example for additional breadcrumb items.
Python
mit
moccu/django-cruditor,moccu/django-cruditor,moccu/django-cruditor
--- +++ @@ -7,3 +7,11 @@ class DemoView(ExamplesMixin, CruditorMixin, TemplateView): title = 'Demo view' template_name = 'minimal/demo.html' + + def get_breadcrumb(self): + return super().get_breadcrumb() + [{ + 'url': '/', + 'title': 'Additional breadcrumb' + }, { + ...
2539b08770bb5cf5e7cb5dcab3aeef17b163de83
resrc/utils/construct_body.py
resrc/utils/construct_body.py
# -*- coding: utf-8 -*-: import urllib2 import hashlib import os def construct_body(link): if link.content == u'˘': # this signals that content generation previously failed return try: opener = urllib2.build_opener() opener.addheaders = [('Accept-Charset', 'utf-8'), ('User-agen...
# -*- coding: utf-8 -*-: import urllib2 import hashlib import os def construct_body(link): if link.content == u'˘': # this signals that content generation previously failed return try: opener = urllib2.build_opener() opener.addheaders = [('Accept-Charset', 'utf-8'), ('User-agen...
Move from ps2ascii to ps2txt, for better results
Move from ps2ascii to ps2txt, for better results
Python
mit
vhf/resrc,mrbitsdcf/resrc,janez-svetin/resrc,mrbitsdcf/resrc,janez-svetin/resrc,janez-svetin/resrc,mrbitsdcf/resrc,vhf/resrc,vhf/resrc,janez-svetin/resrc,mrbitsdcf/resrc,mrbitsdcf/resrc,vhf/resrc,vhf/resrc,janez-svetin/resrc
--- +++ @@ -26,7 +26,7 @@ thefile.write(data) thefile.close() - os.system(("ps2ascii /tmp/%s.pdf /tmp/%s.txt") %(filename , filename)) + os.system(("ps2txt /tmp/%s.pdf /tmp/%s.txt") %(filename , filename)) link.content = open("/tmp/%s.txt" % filename).r...
78689cba80d507cc6706ebf5d1981b738837f767
knox/crypto.py
knox/crypto.py
import binascii from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import hashes from os import urandom as generate_bytes from knox.settings import knox_settings, CONSTANTS sha = knox_settings.SECURE_HASH_ALGORITHM def create_token_string(): return binascii.hexlify( ...
import binascii from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import hashes from os import urandom as generate_bytes from knox.settings import knox_settings, CONSTANTS sha = knox_settings.SECURE_HASH_ALGORITHM def create_token_string(): return binascii.hexlify( ...
Document unhexlify requirements in hash_token()
Document unhexlify requirements in hash_token()
Python
mit
James1345/django-rest-knox,James1345/django-rest-knox
--- +++ @@ -24,6 +24,9 @@ ''' Calculates the hash of a token and salt. input is unhexlified + + token and salt must contain an even number of hex digits or + a binascii.Error exception will be raised ''' digest = hashes.Hash(sha(), backend=default_backend()) digest.update(binascii....
ffd3d61f24a48048ddb562b731ff134a6fc0d924
django/__init__.py
django/__init__.py
VERSION = (1, 1, 0, 'beta', 1) def get_version(): version = '%s.%s' % (VERSION[0], VERSION[1]) if VERSION[2]: version = '%s.%s' % (version, VERSION[2]) if VERSION[3:] == ('alpha', 0): version = '%s pre-alpha' % version else: version = '%s %s' % (version, VERSION[3]) if V...
VERSION = (1, 1, 0, 'rc', 1) def get_version(): version = '%s.%s' % (VERSION[0], VERSION[1]) if VERSION[2]: version = '%s.%s' % (version, VERSION[2]) if VERSION[3:] == ('alpha', 0): version = '%s pre-alpha' % version else: version = '%s %s' % (version, VERSION[3]) if VER...
Bump django.VERSION for RC 1.
Bump django.VERSION for RC 1. git-svn-id: 4f9f921b081c523744c7bf24d959a0db39629563@11289 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Python
bsd-3-clause
aparo/django-nonrel,FlaPer87/django-nonrel,aparo/django-nonrel,aparo/django-nonrel,FlaPer87/django-nonrel,FlaPer87/django-nonrel
--- +++ @@ -1,4 +1,4 @@ -VERSION = (1, 1, 0, 'beta', 1) +VERSION = (1, 1, 0, 'rc', 1) def get_version(): version = '%s.%s' % (VERSION[0], VERSION[1])
c9e2c70e05ade220e5aa6a4790ee2a9b720cc46e
sorting_test.py
sorting_test.py
import mergesort.merge_sort import quicksort.quicksort import sys import time from random import randint def main(max_len): for n in [2**(n+1) for n in range(max_len)]: print 'Array size: %d' % n arr = [randint(0, 2**max_len) for n in range(n)] current_time = time.time() quicksort.quicksort.check(mergesor...
import mergesort.merge_sort import quicksort.quicksort import sys import time from random import randint def multi_size(max_len): for n in [2**(n+1) for n in range(max_len)]: print 'Array size: %d' % n arr = [randint(0, 2**max_len) for n in range(n)] current_time = time.time() quicksort.quicksort.check(me...
Allow comparison within a fixed time period
Allow comparison within a fixed time period To get an idea of average run-time, I wanted to be able to test mergesort and quicksort with the same inputs many times over; now by specifying a time limit and array length, the script will run each algorithm on as many times as possible on random arrays and report how many...
Python
mit
timpel/stanford-algs,timpel/stanford-algs
--- +++ @@ -4,26 +4,50 @@ import time from random import randint -def main(max_len): +def multi_size(max_len): for n in [2**(n+1) for n in range(max_len)]: print 'Array size: %d' % n arr = [randint(0, 2**max_len) for n in range(n)] current_time = time.time() - quicksort.quicksort.check(mergesort...
29a57097fb903f2849fe21647dd99e06509c364a
dmoj/utils/ansi.py
dmoj/utils/ansi.py
from collections import OrderedDict from termcolor import colored import re def strip_ansi(s): # http://stackoverflow.com/questions/13506033/filtering-out-ansi-escape-sequences return re.sub(r'\x1b\[([0-9,A-Z]{1,2}(;[0-9]{1,2})?(;[0-9]{3})?)?[m|K]?', '', s) try: import ansi2html def format_ansi(s)...
import re from termcolor import colored import ansi2html def strip_ansi(s): # http://stackoverflow.com/questions/13506033/filtering-out-ansi-escape-sequences return re.sub(r'\x1b\[([0-9,A-Z]{1,2}(;[0-9]{1,2})?(;[0-9]{3})?)?[m|K]?', '', s) def format_ansi(s): # TODO: supposedly, the decode isn't necessa...
Stop maintaining old code paths
Stop maintaining old code paths
Python
agpl-3.0
DMOJ/judge,DMOJ/judge,DMOJ/judge
--- +++ @@ -1,6 +1,7 @@ -from collections import OrderedDict +import re + from termcolor import colored -import re +import ansi2html def strip_ansi(s): @@ -8,22 +9,9 @@ return re.sub(r'\x1b\[([0-9,A-Z]{1,2}(;[0-9]{1,2})?(;[0-9]{3})?)?[m|K]?', '', s) -try: - import ansi2html - - - def format_ansi(...
c1e5e6a5c34f1d4617be3053d87af8e95045ad77
query/views.py
query/views.py
""" Views for the rdap_explorer project, query app. """ import ipwhois from django.http import HttpResponseRedirect from django.shortcuts import render from django.urls import reverse from django.views.decorators.cache import cache_page from django.views.decorators.csrf import csrf_protect from json import dumps fro...
""" Views for the rdap_explorer project, query app. """ import ipwhois from django.http import HttpResponseRedirect from django.shortcuts import render from django.urls import reverse from django.views.decorators.cache import cache_page from django.views.decorators.csrf import csrf_protect from json import dumps fro...
Remove raw results from IPWhois object.
Remove raw results from IPWhois object.
Python
mit
cdubz/rdap-explorer,cdubz/rdap-explorer
--- +++ @@ -40,7 +40,7 @@ form = QueryForm(initial={"query": query}) try: ip = ipwhois.IPWhois(query) - result = ip.lookup_rdap(retry_count=1, depth=2, inc_raw=True) + result = ip.lookup_rdap(retry_count=1, depth=2) title = ip.address_str except (ValueError, ipwhois.exce...
16c457faae6ace57afdc9c11c6f76c6d11a53764
moksha/lib/utils.py
moksha/lib/utils.py
from decorator import decorator @decorator def trace(f, *args, **kw): r = f(*args, **kw) print "%s(%s, %s) = %s" % (f.func_name, args, kw, r) return r
from decorator import decorator @decorator def trace(f, *args, **kw): try: r = f(*args, **kw) finally: print "%s(%s, %s) = %s" % (f.func_name, args, kw, r) return r
Make our trace decorator a bit more robust
Make our trace decorator a bit more robust
Python
apache-2.0
pombredanne/moksha,ralphbean/moksha,mokshaproject/moksha,pombredanne/moksha,lmacken/moksha,mokshaproject/moksha,ralphbean/moksha,pombredanne/moksha,lmacken/moksha,mokshaproject/moksha,ralphbean/moksha,mokshaproject/moksha,lmacken/moksha,pombredanne/moksha
--- +++ @@ -2,6 +2,8 @@ @decorator def trace(f, *args, **kw): - r = f(*args, **kw) - print "%s(%s, %s) = %s" % (f.func_name, args, kw, r) + try: + r = f(*args, **kw) + finally: + print "%s(%s, %s) = %s" % (f.func_name, args, kw, r) return r
6afb6134b24f233cac3dd5fe44599eb95cc4cc33
bika/lims/upgrade/to1115.py
bika/lims/upgrade/to1115.py
from Acquisition import aq_inner from Acquisition import aq_parent from Products.CMFCore.utils import getToolByName def upgrade(tool): """ Just some catalog indexes to update """ portal = aq_parent(aq_inner(tool)) portal_catalog = getToolByName(portal, 'portal_catalog') typestool = getToolByName(p...
from Acquisition import aq_inner from Acquisition import aq_parent from Products.CMFCore.utils import getToolByName def upgrade(tool): """ Just some catalog indexes to update """ portal = aq_parent(aq_inner(tool)) portal_catalog = getToolByName(portal, 'portal_catalog') typestool = getToolByName(p...
Fix upgrade step 1115: rebuild catalog
Fix upgrade step 1115: rebuild catalog
Python
agpl-3.0
DeBortoliWines/Bika-LIMS,anneline/Bika-LIMS,rockfruit/bika.lims,rockfruit/bika.lims,veroc/Bika-LIMS,DeBortoliWines/Bika-LIMS,veroc/Bika-LIMS,labsanmartin/Bika-LIMS,anneline/Bika-LIMS,DeBortoliWines/Bika-LIMS,anneline/Bika-LIMS,veroc/Bika-LIMS,labsanmartin/Bika-LIMS,labsanmartin/Bika-LIMS
--- +++ @@ -16,5 +16,4 @@ bc.delIndex('getSamplePointTitle') bc.addIndex('getSampleTypeTitle', 'KeywordIndex') bc.addIndex('getSamplePointTitle', 'KeywordIndex') - for o in bc(): - o.reindexObject(idxs=['getSampleTypeTitle', 'getSamplePointTitle']) + bc.clearFindAndRebuild()
1e6e1eae154008a1dddf12a9c7225054ddcf3d15
corehq/apps/app_manager/xpath_validator/wrapper.py
corehq/apps/app_manager/xpath_validator/wrapper.py
from __future__ import absolute_import from __future__ import unicode_literals from collections import namedtuple from corehq.apps.app_manager.xpath_validator.config import get_xpath_validator_path from corehq.apps.app_manager.xpath_validator.exceptions import XpathValidationError from dimagi.utils.subprocess_manager i...
from __future__ import absolute_import from __future__ import unicode_literals from collections import namedtuple from corehq.apps.app_manager.xpath_validator.config import get_xpath_validator_path from corehq.apps.app_manager.xpath_validator.exceptions import XpathValidationError from dimagi.utils.subprocess_manager i...
Revert "Added comment and used more generic code in xpath validator"
Revert "Added comment and used more generic code in xpath validator"
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
--- +++ @@ -17,8 +17,7 @@ cmd = ['node', path] p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - # Collapse whitespace. '\r' mysteriously causes the process to hang in python 3. - stdout, stderr = p.comm...
638901243c060b243ebf046304c06ea14a98dbe8
dynochemy/errors.py
dynochemy/errors.py
# -*- coding: utf-8 -*- """ This module contains the set of Dynochemy's exceptions :copyright: (c) 2012 by Rhett Garber. :license: ISC, see LICENSE for more details. """ import json class Error(Exception): """This is an ambiguous error that occured.""" pass class SyncUnallowedError(Error): pass class Dup...
# -*- coding: utf-8 -*- """ This module contains the set of Dynochemy's exceptions :copyright: (c) 2012 by Rhett Garber. :license: ISC, see LICENSE for more details. """ import json class Error(Exception): """This is an ambiguous error that occured.""" pass class SyncUnallowedError(Error): pass class Dup...
Handle updated boto exception format.
Handle updated boto exception format. See https://github.com/boto/boto/issues/625
Python
isc
rhettg/Dynochemy
--- +++ @@ -37,11 +37,10 @@ if isinstance(raw_error, Error): return raw_error - error_data = json.loads(raw_error.data) - if 'ProvisionedThroughputExceededException' in error_data['__type']: - return ProvisionedThroughputError(error_data['message']) + if 'ProvisionedThroughputExceededE...
4761d359a28630d0fe378d50e52aad66e88d3a36
DeepFried2/utils.py
DeepFried2/utils.py
import theano as _th import numpy as _np def create_param(shape, init, fan=None, name=None, type=_th.config.floatX): return _th.shared(init(shape, fan).astype(type), name=name) def create_param_and_grad(shape, init, fan=None, name=None, type=_th.config.floatX): val = init(shape, fan).astype(type) param ...
import theano as _th import numpy as _np def create_param(shape, init, fan=None, name=None, type=_th.config.floatX): return _th.shared(init(shape, fan).astype(type), name=name) def create_param_and_grad(shape, init, fan=None, name=None, type=_th.config.floatX): val = init(shape, fan).astype(type) param ...
Make the compression optional, as it slows down.
Make the compression optional, as it slows down.
Python
mit
elPistolero/DeepFried2,lucasb-eyer/DeepFried2,Pandoro/DeepFried2,yobibyte/DeepFried2
--- +++ @@ -26,9 +26,11 @@ return sum(p.get_value().size for p in params) -def save_params(module, where): +def save_params(module, where, compress=False): params, _ = module.parameters() - _np.savez_compressed(where, params=[p.get_value() for p in params]) + + savefn = _np.savez_compressed if com...
7d54cf820a76340f47f2b55ae1b7ff474810ce2b
openelex/tests/test_transform_registry.py
openelex/tests/test_transform_registry.py
from unittest import TestCase from mock import Mock from openelex.base.transform import registry class TestTransformRegistry(TestCase): def test_register_with_validators(self): mock_transform = Mock(return_value=None) mock_transform.__name__ = 'mock_transform' mock_validator1 = Mock(retur...
from unittest import TestCase from mock import Mock from openelex.base.transform import registry class TestTransformRegistry(TestCase): def test_register_with_validators(self): mock_transform = Mock(return_value=None) mock_transform.__name__ = 'mock_transform' mock_validator1 = Mock(retur...
Fix test for transform registry.
Fix test for transform registry. In 24016ce74afc83b18197c89f95d260b388e6e309, the value of transform.validators was changed from a list to an OrderedDict. Update the tests to reflect this change.
Python
mit
datamade/openelections-core,datamade/openelections-core,openelections/openelections-core,cathydeng/openelections-core,openelections/openelections-core,cathydeng/openelections-core
--- +++ @@ -18,7 +18,7 @@ registry.register("XX", mock_transform, validators) transform = registry.get("XX", "mock_transform") - self.assertEqual(transform.validators, validators) + self.assertEqual(transform.validators.values(), validators) transform() mock_tran...
220953f4f8136e9c5eff21426421e6ac7f6f502d
tssim/functions/wrapper.py
tssim/functions/wrapper.py
"""This module contains the main wrapper class.""" class BaseWrapper: """Define base template for function wrapper classes. """ def __init__(self, func): self.func = func self.__doc__ = func.__doc__ def __call__(self, *args, **kwargs): raise NotImplementedError class NumpyWrapp...
"""This module contains the main wrapper class.""" class BaseWrapper: """Define base template for function wrapper classes. """ def __init__(self, func): self.func = func self.__doc__ = func.__doc__ def __call__(self, *args, **kwargs): raise NotImplementedError class NumpyWrapp...
Fix bug due to wrong arguments order.
Fix bug due to wrong arguments order.
Python
mit
mansenfranzen/tssim
--- +++ @@ -34,7 +34,7 @@ if self.size == "arg": def wrapped(x): - return self.func(*args, x.shape[0], **kwargs) + return self.func(x.shape[0], *args, **kwargs) elif self.size == "kwarg": def wrapped(x):
c95085fd43825a57476f8a962563561b42385bd8
ImgProcessingCLI/setup.py
ImgProcessingCLI/setup.py
# This is the setup file for pip from setuptools import setup, find_packages import os, sys from os import path setup( name = 'ImgProcessingCLI', version = '0.0.1', description = 'Image Processing for SUAS Competition', url = 'https://github.com/FlintHill/SUAS-Competition', author = 'Peter Husi...
# This is the setup file for pip from setuptools import setup, find_packages import os, sys from os import path setup( name = 'ImgProcessingCLI', version = '0.0.1', description = 'Image Processing for SUAS Competition', url = 'https://github.com/FlintHill/SUAS-Competition', author = 'Peter Husi...
Add sklearn as a dependency for ImgProcessingCLI
Add sklearn as a dependency for ImgProcessingCLI
Python
mit
FlintHill/SUAS-Competition,FlintHill/SUAS-Competition,FlintHill/SUAS-Competition,FlintHill/SUAS-Competition,FlintHill/SUAS-Competition
--- +++ @@ -27,7 +27,7 @@ packages = find_packages(), - install_requires = ['numpy', 'EigenFit', 'pillow', 'matplotlib'], + install_requires = ['numpy', 'EigenFit', 'pillow', 'matplotlib', 'sklearn'], keywords = ['SUAS'], )