commit
stringlengths
40
40
old_file
stringlengths
4
236
new_file
stringlengths
4
236
old_contents
stringlengths
1
3.26k
new_contents
stringlengths
16
4.43k
subject
stringlengths
16
624
message
stringlengths
17
3.29k
lang
stringclasses
5 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
9c184878af2e7dd45bc7ff653979d008a77b0e30
SimPEG/regularization/__init__.py
SimPEG/regularization/__init__.py
from .base import ( BaseRegularization, LeastSquaresRegularization, BaseSimilarityMeasure, Small, SmoothDeriv, SmoothDeriv2, ) from .regularization_mesh import RegularizationMesh from .sparse import SparseSmall, SparseDeriv, Sparse from .pgi import ( PGIsmallness, PGI, PGIwithNonline...
from ..utils.code_utils import deprecate_class from .base import ( BaseRegularization, LeastSquaresRegularization, BaseSimilarityMeasure, Small, SmoothDeriv, SmoothDeriv2, ) from .regularization_mesh import RegularizationMesh from .sparse import SparseSmall, SparseDeriv, Sparse from .pgi import ...
Move deprecate reg classed to init
Move deprecate reg classed to init
Python
mit
simpeg/simpeg
f9b6dbc958251050c6170587d5a205350252329c
samples/ucrmain.py
samples/ucrmain.py
""" Script for performing queries on large time series by using UCR ED and DTW algs. """ from time import time import blaze from blaze.ts.ucr_dtw import ucr # Convert txt file into Blaze native format def convert(filetxt, storage): import os.path if not os.path.exists(storage): blaze.Array(np.loadtx...
""" Script for performing queries on large time series by using UCR ED and DTW algs. """ from time import time import blaze from blaze.ts.ucr_dtw import ucr import numpy as np # Convert txt file into Blaze native format def convert(filetxt, storage): import os.path if not os.path.exists(storage): bl...
Fix missing numpy import in ucr test
Fix missing numpy import in ucr test
Python
bsd-2-clause
seibert/blaze-core,seibert/blaze-core,seibert/blaze-core,seibert/blaze-core,seibert/blaze-core
bce79a9156f93fd3c9356579bcb9309a66f2bdf2
pushbullet/filetype.py
pushbullet/filetype.py
def _magic_get_file_type(f, _): file_type = magic.from_buffer(f.read(1024), mime=True) f.seek(0) return file_type.decode('utf-8') def _guess_file_type(_, filename): return mimetypes.guess_type(filename)[0] try: import magic except ImportError: import mimetypes get_file_type = _guess_file...
def _magic_get_file_type(f, _): file_type = magic.from_buffer(f.read(1024), mime=True) f.seek(0) return maybe_decode(file_type) def _guess_file_type(_, filename): return mimetypes.guess_type(filename)[0] # return str on python3. Don't want to unconditionally # decode because that results in unicode...
Return str rather than bytes for the description strings on python3.
Return str rather than bytes for the description strings on python3.
Python
mit
randomchars/pushbullet.py,kovacsbalu/pushbullet.py,Saturn/pushbullet.py
2a57e5c17115e9c89936e6667985af1a47bf3247
raiden/utils/typing.py
raiden/utils/typing.py
# -*- coding: utf-8 -*- from typing import * # NOQA pylint:disable=wildcard-import,unused-wildcard-import from typing import NewType T_Address = bytes Address = NewType('Address', bytes) T_BlockExpiration = int BlockExpiration = NewType('BlockExpiration', int) T_BlockNumber = int BlockNumber = NewType('BlockNumber'...
# -*- coding: utf-8 -*- from typing import * # NOQA pylint:disable=wildcard-import,unused-wildcard-import from typing import NewType T_Address = bytes Address = NewType('Address', bytes) T_BlockExpiration = int BlockExpiration = NewType('BlockExpiration', int) T_BlockNumber = int BlockNumber = NewType('BlockNumber'...
Fix an oversight in new type definitions
Fix an oversight in new type definitions
Python
mit
hackaugusto/raiden,hackaugusto/raiden
525a9fcb14a1f91aa94508ca6dcc362d430d2969
__openerp__.py
__openerp__.py
{ 'name': "Project Logical Framework", 'category': 'Project', 'sequence': 1, 'description': """ Project Logical Framework ========================= """, 'version': '0.3', 'depends': ['project'], 'data': [ 'static/src/xml/create_project.xml', ], }
{ 'name': "Project Logical Framework", 'author' : 'Stéphane Codazzi @ TeMPO-consulting', 'category': 'Project', 'sequence': 1, 'description': """ Project Logical Framework ========================= """, 'version': '0.3', 'depends': ['project'], 'data': [ 'static/src/xml/creat...
Add o2m between project and logical frameworks lines
Add o2m between project and logical frameworks lines
Python
mit
stephane-/project_logical_framework
fc203d643aa9a69c835aebee0de9b17851ef7a58
compose/cli/docker_client.py
compose/cli/docker_client.py
from docker import Client from docker import tls import ssl import os def docker_client(): """ Returns a docker-py client configured using environment variables according to the same logic as the official Docker client. """ cert_path = os.environ.get('DOCKER_CERT_PATH', '') if cert_path == '':...
from docker import Client from docker import tls import ssl import os def docker_client(): """ Returns a docker-py client configured using environment variables according to the same logic as the official Docker client. """ cert_path = os.environ.get('DOCKER_CERT_PATH', '') if cert_path == '':...
Allow API version specification via env var
Allow API version specification via env var Hard-coding the API version to '1.18' with the docker-py constructor will cause the docker-py logic at https://github.com/docker/docker-py/blob/master/docker/client.py#L143-L146 to always fail, which will cause authentication issues if you're using a remote daemon using API ...
Python
apache-2.0
jeanpralo/compose,shubheksha/docker.github.io,saada/compose,talolard/compose,joaofnfernandes/docker.github.io,ionrock/compose,iamluc/compose,goloveychuk/compose,vdemeester/compose,menglingwei/denverdino.github.io,qzio/compose,d2bit/compose,docker/docker.github.io,GM-Alex/compose,bdwill/docker.github.io,anweiss/docker.g...
093702a38645853d560606446da0b078ba12d14e
eventkit_cloud/auth/admin.py
eventkit_cloud/auth/admin.py
import logging from django.contrib import admin from django.contrib.auth.admin import UserAdmin from django.contrib.auth.models import User from rest_framework.authtoken.models import Token from eventkit_cloud.auth.models import OAuth from eventkit_cloud.jobs.models import UserLicense logger = logging.getLogger(__...
import logging from django.contrib import admin from django.contrib.auth.admin import UserAdmin from django.contrib.auth.models import User from rest_framework.authtoken.models import Token from eventkit_cloud.auth.models import OAuth from eventkit_cloud.jobs.models import UserLicense logger = logging.getLogger(__...
Add OAuth class information to the UserAdmin page.
Add OAuth class information to the UserAdmin page.
Python
bsd-3-clause
terranodo/eventkit-cloud,venicegeo/eventkit-cloud,terranodo/eventkit-cloud,venicegeo/eventkit-cloud,terranodo/eventkit-cloud,venicegeo/eventkit-cloud,venicegeo/eventkit-cloud,venicegeo/eventkit-cloud,terranodo/eventkit-cloud,venicegeo/eventkit-cloud
bf4b22ef25d158ddeb1a98432d29451e10a912e6
quick_orm/examples/hello_world.py
quick_orm/examples/hello_world.py
from quick_orm.core import Database from sqlalchemy import Column, String __metaclass__ = Database.DefaultMeta class User: name = Column(String(30)) Database.register() if __name__ == '__main__': db = Database('sqlite://') db.create_tables() user = User(name = 'Hello World') ...
from quick_orm.core import Database from sqlalchemy import Column, String __metaclass__ = Database.DefaultMeta class User: name = Column(String(30)) Database.register() if __name__ == '__main__': db = Database('sqlite://') # database urls: http://docs.sqlalchemy.org/en/latest/core/engines.html#da...
Add a link for database urls
Add a link for database urls
Python
bsd-3-clause
tek/sqlpharmacy,tylerlong/quick_orm
c55a2b152cd2b6603ef358e0f764eeb0308ff332
Orange/__init__.py
Orange/__init__.py
from __future__ import absolute_import from importlib import import_module try: from .import version # Always use short_version here (see PEP 386) __version__ = version.short_version __git_revision__ = version.git_revision except ImportError: __version__ = "unknown" __git_revision__ = "unknown"...
from __future__ import absolute_import from importlib import import_module try: from .import version # Always use short_version here (see PEP 386) __version__ = version.short_version __git_revision__ = version.git_revision except ImportError: __version__ = "unknown" __git_revision__ = "unknown"...
Remove imports in Orange, except data
Remove imports in Orange, except data
Python
bsd-2-clause
marinkaz/orange3,kwikadi/orange3,qusp/orange3,kwikadi/orange3,kwikadi/orange3,qPCR4vir/orange3,kwikadi/orange3,qPCR4vir/orange3,qPCR4vir/orange3,cheral/orange3,marinkaz/orange3,qusp/orange3,qPCR4vir/orange3,cheral/orange3,qusp/orange3,marinkaz/orange3,qPCR4vir/orange3,cheral/orange3,marinkaz/orange3,qPCR4vir/orange3,ch...
1bd90d597b23f49bce3ca3402256c9bb1ad22647
accounts/management/commands/request_common_profile_update.py
accounts/management/commands/request_common_profile_update.py
from django.contrib.auth.models import User from django.contrib.sites.models import Site from django.core.management.base import BaseCommand from django.core.urlresolvers import reverse from post_office import mail class Command(BaseCommand): help = "Notify users to update." def handle(self, *args, **option...
from django.contrib.auth.models import User from django.contrib.sites.models import Site from django.core.exceptions import ValidationError from django.core.management.base import BaseCommand from django.core.urlresolvers import reverse from post_office import mail class Command(BaseCommand): help = "Notify use...
Handle missing and invalid email addresses.
Handle missing and invalid email addresses.
Python
agpl-3.0
osamak/student-portal,osamak/student-portal,enjaz/enjaz,osamak/student-portal,osamak/student-portal,enjaz/enjaz,enjaz/enjaz,enjaz/enjaz,enjaz/enjaz,osamak/student-portal
c2973d4f2ae7da0f75f573cebd8eb1780d5b33e1
account_withholding_automatic/models/account_payment_group.py
account_withholding_automatic/models/account_payment_group.py
# -*- coding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in module root # directory ############################################################################## from openerp import models, api, fields class Ac...
# -*- coding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in module root # directory ############################################################################## from openerp import models, api, fields class Ac...
FIX withholdings computation when payment come from invoices
FIX withholdings computation when payment come from invoices
Python
agpl-3.0
ingadhoc/account-payment
ffa6417b30517569cadff00aec839d968f3c91d7
bisnode/constants.py
bisnode/constants.py
COMPANY_STANDARD_REPORT = "NRGCompanyReportStandard" COMPANY_RATING_REPORT = "NRGCompanyReportRating" HIGH = 'AAA' GOOD = 'AA' WORTHY = 'A' BELOW_AVERAGE = 'B' BAD = 'C' MISSING = '-' RATING_CHOICES = ( (HIGH, "high"), (GOOD, "good"), (WORTHY, "worthy"), (BELOW_AVERAGE, "below average"), (BAD, "ba...
COMPANY_STANDARD_REPORT = "NRGCompanyReportStandard" COMPANY_RATING_REPORT = "NRGCompanyReportRating" HIGH = 'AAA' GOOD = 'AA' WORTHY = 'A' NEW = 'AN' BELOW_AVERAGE = 'B' BAD = 'C' MISSING = '-' RATING_CHOICES = ( (HIGH, "high"), (GOOD, "good"), (WORTHY, "worthy"), (NEW, "new"), (BELOW_AVERAGE, "b...
Add a new rating code
Add a new rating code
Python
mit
FundedByMe/django-bisnode
73b1273de8f8e17adf51893bdbd24d2067866297
bootstrap/helpers.py
bootstrap/helpers.py
# -*- coding: utf-8 -*- """ bootstrap.helpers ~~~~~~~~~~~~~~~~~ :Copyright: 2006-2016 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from byceps.services.orga.models import OrgaFlag from byceps.services.user.models.user import User from byceps.services.user import service as user_service ...
# -*- coding: utf-8 -*- """ bootstrap.helpers ~~~~~~~~~~~~~~~~~ :Copyright: 2006-2016 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from byceps.services.user.models.user import User from byceps.services.user import service as user_service from .util import add_to_database # -----------...
Remove bootstrap helper to promote a user to organizer as there is a service function (and a script calling it) for that
Remove bootstrap helper to promote a user to organizer as there is a service function (and a script calling it) for that
Python
bsd-3-clause
m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps
a1e56d65807228b952036fc182071aab5e6ff25f
tests/cli/test_pixel.py
tests/cli/test_pixel.py
""" Test ``yatsm line`` """ import os from click.testing import CliRunner import matplotlib as mpl import pytest from yatsm.cli.main import cli mpl_skip = pytest.mark.skipif( mpl.get_backend() != 'agg' and "DISPLAY" not in os.environ, reason='Requires either matplotlib "agg" backend or that DISPLAY" is set')...
""" Test ``yatsm line`` """ import os from click.testing import CliRunner import matplotlib as mpl import pytest from yatsm.cli.main import cli mpl_skip = pytest.mark.skipif( mpl.get_backend() != 'agg' and "DISPLAY" not in os.environ, reason='Requires either matplotlib "agg" backend or that DISPLAY" is set')...
Add test for all plot types
Add test for all plot types
Python
mit
valpasq/yatsm,c11/yatsm,ceholden/yatsm,ceholden/yatsm,c11/yatsm,valpasq/yatsm
e0fa24595a60dd3c2ab5d1b64a76bae9ce3c05a8
testproject/testapp/tests/test_root.py
testproject/testapp/tests/test_root.py
from djet import assertions, restframework from rest_framework import status import djoser.constants import djoser.utils import djoser.views class RootViewTest(restframework.APIViewTestCase, assertions.StatusCodeAssertionsMixin): view_class = djoser.views.RootView def test_get_should_retur...
from djet import assertions, restframework from rest_framework import status import djoser.constants import djoser.utils import djoser.views class RootViewTest(restframework.APIViewTestCase, assertions.StatusCodeAssertionsMixin): view_class = djoser.views.RootView def test_get_should_retur...
Add test for non existent url pattern
Add test for non existent url pattern
Python
mit
akalipetis/djoser,sunscrapers/djoser,akalipetis/djoser,sunscrapers/djoser,sunscrapers/djoser
8f24d774227dca13500c0db0c10771d6b4ee7141
corehq/apps/domain/management/commands/find_secure_submission_image_domains.py
corehq/apps/domain/management/commands/find_secure_submission_image_domains.py
from django.core.management.base import BaseCommand from corehq.apps.domain.models import Domain import csv class Command(BaseCommand): help = 'Find domains with secure submissions and image questions' def handle(self, *args, **options): with open('domain_results.csv', 'wb+') as csvfile: ...
from django.core.management.base import BaseCommand from corehq.apps.domain.models import Domain import csv class Command(BaseCommand): help = 'Find domains with secure submissions and image questions' def check_domain(self, domain, csv_writer): if domain.secure_submissions: for app in do...
Add audio/video support and bail on findings
Add audio/video support and bail on findings
Python
bsd-3-clause
qedsoftware/commcare-hq,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,puttar...
194a84b4559449f0b0e3e9cc9e7026392822c0af
questions/urls.py
questions/urls.py
from django.conf.urls.defaults import * from spenglr.education.models import * # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^m/(?P<object_id>\d+)$', 'django.views.generic.list_detail.object_detail', { 'queryset': Module....
from django.conf.urls.defaults import * from spenglr.education.models import * # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^m/(?P<object_id>\d+)$', 'django.views.generic.list_detail.object_detail', { 'queryset': Module....
Change to questions template location.
Change to questions template location.
Python
bsd-3-clause
mfitzp/smrtr,mfitzp/smrtr
b9389a54183e37d8b0d17f74c4655dfb51bf2053
neo/test/rawiotest/test_openephysbinaryrawio.py
neo/test/rawiotest/test_openephysbinaryrawio.py
import unittest from neo.rawio.openephysbinaryrawio import OpenEphysBinaryRawIO from neo.test.rawiotest.common_rawio_test import BaseTestRawIO class TestOpenEphysBinaryRawIO(BaseTestRawIO, unittest.TestCase): rawioclass = OpenEphysBinaryRawIO entities_to_download = [ 'openephysbinary' ] entit...
import unittest from neo.rawio.openephysbinaryrawio import OpenEphysBinaryRawIO from neo.test.rawiotest.common_rawio_test import BaseTestRawIO class TestOpenEphysBinaryRawIO(BaseTestRawIO, unittest.TestCase): rawioclass = OpenEphysBinaryRawIO entities_to_download = [ 'openephysbinary' ] entit...
Add new OE test folder
Add new OE test folder
Python
bsd-3-clause
NeuralEnsemble/python-neo,INM-6/python-neo,JuliaSprenger/python-neo,apdavison/python-neo
9f8db061956fc73a197d9c5eb1b045a6e0655dc0
fc2json.py
fc2json.py
#!/usr/bin/env python import sys, json file = sys.argv[1] subject = file.split('.')[0] data = { "subject": subject, "cards": {} } fc = [line.split(':') for line in open(file, 'r').read().splitlines()] js = open(subject + ".json", 'w') for line in fc: data["cards"][line[0]] = line[1] js.write(json.dum...
#!/usr/bin/env python ''' File: fc2json.py Author: Kristoffer Dalby Description: Tiny script for converting flashcard format to json. ''' import sys, json file = sys.argv[1] subject = file.split('.')[0] data = { "subject": subject, "cards": {} } fc = [line.split(':') for line in open(file, 'r').read().spli...
Use a real JS construct, WTF knows why this works in chromium.
Use a real JS construct, WTF knows why this works in chromium.
Python
mit
kradalby/flashcards,kradalby/flashcards
9d78b571fcd0575e02d4849a0938a51f15e07961
multi_schema/management/__init__.py
multi_schema/management/__init__.py
from django.db import models, connection from django.core.management.color import no_style from multi_schema.models import Schema def post_syncdb_duplicator(sender, **kwargs): # See if any of the newly created models are schema-aware schema_aware_models = [m for m in kwargs['created_models'] if m._is_schema_a...
from django.db import models, connection from django.core.management.color import no_style from multi_schema.models import Schema def post_syncdb_duplicator(sender, **kwargs): # See if any of the newly created models are schema-aware schema_aware_models = [m for m in kwargs['created_models'] if m._is_schema_a...
Create the correct references to other tables in all schemata.
Create the correct references to other tables in all schemata.
Python
bsd-3-clause
schinckel/django-boardinghouse,schinckel/django-boardinghouse,schinckel/django-boardinghouse
533194b5b8e044bca2aaeccff4d550731922b3b8
genome_designer/conf/demo_settings.py
genome_designer/conf/demo_settings.py
""" Settings for DEMO_MODE. Must set DEMO_MODE = True in local_settings.py. """ # Views that are visible in demo mode. DEMO_SAFE_VIEWS = [ 'main.views.home_view', 'main.views.project_list_view', 'main.views.project_view', 'main.views.tab_root_analyze', 'main.views.reference_genome_list_view', ...
""" Settings for DEMO_MODE. Must set DEMO_MODE = True in local_settings.py. """ # Views that are visible in demo mode. DEMO_SAFE_VIEWS = [ 'main.views.home_view', 'main.views.project_list_view', 'main.views.project_view', 'main.views.tab_root_analyze', 'main.views.reference_genome_list_view', ...
Add login and logout to allowed views in DEMO_MODE.
Add login and logout to allowed views in DEMO_MODE.
Python
mit
woodymit/millstone,churchlab/millstone,churchlab/millstone,woodymit/millstone_accidental_source,woodymit/millstone,woodymit/millstone,woodymit/millstone,woodymit/millstone_accidental_source,churchlab/millstone,woodymit/millstone_accidental_source,churchlab/millstone,woodymit/millstone_accidental_source
6282aa2617bcc9bb8f293ea620eff23d2009334b
example/test.py
example/test.py
import rust_ext import numpy as np a = np.array([1.0, 2.0]) rust_ext.mult(3, a) print(a)
#!/usr/bin/env python import rust_ext import numpy as np x = np.array([1.0, 2.0]) y = np.array([2.0, 3.0]) result = rust_ext.axpy(3, x, y) print(result)
Use axpy on sample Python script
Use axpy on sample Python script
Python
bsd-2-clause
termoshtt/rust-numpy,termoshtt/rust-numpy
f894aff53577fb459bfac1802f3880133e4143cf
build/build.py
build/build.py
# # Copyright (c) 2004 Specifix, Inc. # All rights reserved # import os import shutil import util class Make: def doBuild(self, dir): os.system("cd %s; make" % dir) class MakeInstall: def doInstall(self, dir, root): os.system("cd %s; make %s=%s install" % (dir, self.rootVar, root)) def __init__(self,...
# # Copyright (c) 2004 Specifix, Inc. # All rights reserved # import os import shutil import util class ManualConfigure: def doBuild(self, dir): os.system("cd %s; ./configure %s" % (dir, self.extraflags)) def __init__(self, extraflags=""): self.extraflags = extraflags class Configure: def doBu...
Add classes to run ./configure
Add classes to run ./configure
Python
apache-2.0
fedora-conary/conary,fedora-conary/conary,fedora-conary/conary,fedora-conary/conary,fedora-conary/conary
cf3596ee93eabf425c7d42c15fc07b11f7741158
humblemedia/causes/models.py
humblemedia/causes/models.py
from django.db import models class Cause(models.Model): title = models.CharField(max_length=64) description = models.TextField() creator = models.ForeignKey('auth.User', related_name='causes') target = models.PositiveIntegerField(null=True, blank=True) url = models.URLField(null=True, blank=True) ...
from django.db import models class Cause(models.Model): title = models.CharField(max_length=64) description = models.TextField() creator = models.ForeignKey('auth.User', related_name='causes') organization = models.ForeignKey('organizations.Organization', related_name='causes', null=True, blank=True) ...
Add organization to cause model
Add organization to cause model
Python
mit
vladimiroff/humble-media,vladimiroff/humble-media
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
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
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
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,...
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...
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
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
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
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
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
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
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
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
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
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
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
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...
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
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
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
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
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/...
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
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
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
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
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...
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
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
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
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
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...
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
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
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
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...
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
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
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
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...
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...
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
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
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
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
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
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
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
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
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
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...
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
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...
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
a6dfc5c5f256acd78d806cc8d4ddac9bd1ac34b5
barbicanclient/osc_plugin.py
barbicanclient/osc_plugin.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distrib...
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distrib...
Add plug-in summary for osc doc
Add plug-in summary for osc doc Stevedore Sphinx extension handles this comment. http://docs.openstack.org/developer/python-openstackclient/plugin-commands.html Change-Id: Id6339d11b900a644647c8c25bbd630ef52a60aab
Python
apache-2.0
openstack/python-barbicanclient
086e54f0b89670027272e5485d9eb832adecc7b9
constants/base.py
constants/base.py
from collections import namedtuple class Constants(object): Constant = namedtuple('Constant', ['codename', 'value', 'description']) def __init__(self, **kwargs): self._constants = [] try: for codename, (value, description) in kwargs.items(): if hasattr(self, codena...
from collections import namedtuple class Constants(object): Constant = namedtuple('Constant', ['codename', 'value', 'description']) def __init__(self, **kwargs): self._constants = [] for codename in kwargs: try: value, description = kwargs.get(codename) ...
Refactor Constants initialization to throw more specific exceptions
Refactor Constants initialization to throw more specific exceptions
Python
bsd-3-clause
caktus/django-dry-choices
d9ce6cc440019ecfc73f1c82e41da4e9ce02a234
smart_open/__init__.py
smart_open/__init__.py
# -*- coding: utf-8 -*- # # Copyright (C) 2019 Radim Rehurek <me@radimrehurek.com> # # This code is distributed under the terms and conditions # from the MIT License (MIT). # """ Utilities for streaming to/from several file-like data storages: S3 / HDFS / local filesystem / compressed files, and many more, using a sim...
# -*- coding: utf-8 -*- # # Copyright (C) 2019 Radim Rehurek <me@radimrehurek.com> # # This code is distributed under the terms and conditions # from the MIT License (MIT). # """ Utilities for streaming to/from several file-like data storages: S3 / HDFS / local filesystem / compressed files, and many more, using a sim...
Configure logging handlers before submodule imports
Configure logging handlers before submodule imports - Fix #474 - Fix #475
Python
mit
RaRe-Technologies/smart_open,RaRe-Technologies/smart_open,piskvorky/smart_open
ac9123c7926c04af7ac68949e2636a81f771fd7d
ncdc_download/download_mapper2.py
ncdc_download/download_mapper2.py
#!/usr/bin/env python3 import ftplib import gzip import sys host = 'ftp.ncdc.noaa.gov' base = '/pub/data/noaa' retries = 3 ftp = ftplib.FTP(host) ftp.login() for line in sys.stdin: (year, filename) = line.strip().split() for i in range(retries): sys.stderr.write('reporter:status:Processing file %s/%s...
#!/usr/bin/env python3 import ftplib import gzip import os import sys host = 'ftp.ncdc.noaa.gov' base = '/pub/data/noaa' retries = 3 ftp = ftplib.FTP(host) ftp.login() for line in sys.stdin: (year, filename) = line.strip().split() for i in range(retries): sys.stderr.write('reporter:status:Processing ...
Decompress downloaded files from disk, not in memory
Decompress downloaded files from disk, not in memory
Python
mit
simonbrady/cat,simonbrady/cat
db13de154fa44f3ef0bf1e365d2ee0d7a6951700
cellcounter/accounts/urls.py
cellcounter/accounts/urls.py
from django.conf.urls import patterns, url from cellcounter.accounts import views urlpatterns = patterns('', url('^new/$', views.RegistrationView.as_view(), name='register'), url('^(?P<pk>[0-9]+)/$', views.UserDetailView.as_view(), name='user-detail'), url('^(?P<pk>[0-9]+)/delete/$', views.UserDeleteView....
from django.conf.urls import patterns, url from cellcounter.accounts import views urlpatterns = patterns('', url('^new/$', views.RegistrationView.as_view(), name='register'), url('^(?P<pk>[0-9]+)/$', views.UserDetailView.as_view(), name='user-detail'), url('^(?P<pk>[0-9]+)/delete/$', views.UserDeleteView....
Use URL regex as per main Django project
Use URL regex as per main Django project
Python
mit
cellcounter/cellcounter,haematologic/cellcounter,haematologic/cellcounter,cellcounter/cellcounter,cellcounter/cellcounter,cellcounter/cellcounter,haematologic/cellcounter